how to get all available event slots in google calendar? - google-api

I have an appointment schedule that I want to retrieve. But the list event method only returns the slots that have been booked and not all slots so that I can filter out available slots.
$events = $service->events->listEvents('calendarID'); // Only returns booked appointments (my case 2)
How can I achieve this?

Related

Get unique ID before saving the meeting in Outlook that must be same after saving the meeting

I'm working on Outlook add-in, In which we are providing the service for ordering the catering products during the meeting scheduling.
I want to send the order along with the meeting (for which meeting i ordered the products) so in this case i need any id i.e MeetingId So can save this meetingId and order detail in the database.
When i will open scheduled meeting from my Outlook calendar and on the behalf of that meetingId i can get the order detail from the server and i can update the order.
So i'm looking any solution, Please share your suggestion here how can i update my order inside the Add-ins from already scheduled meeting.
On the compose form you may call the Office.context.mailbox.item.saveAsync method and then get the itemId property value. There is no need to call the saveAsync method if the appointment was saved previously.

laravel - how to set relation with hasManyThrough?

I have problem with relation of laravel in this case.
One event has many event dates.
One event date has many tickets.
One ticket has many slots. User will book slot and save in booking table.
How can i get list of event dates have list of tickets and total booking of every ticket ?
In Event model i has :
return $this->hasMany('App\EventTicket', 'event_date_id');
Please help me improve it to get right data ?
1) How can I get list of event dates to have list of tickets?
you can make hasManyThrough relation for that. In EventDates model make relation as tickes with hasManyThrough.
Now through event dates, you will get all the tickets for that day.
2) total booking of every ticket
after make hasManyThrough you can use withCount('tickes') with this, you'll get the booking total count.

Stripe: Expire/Cancel subscription after n payments

In our app, we create subscriptions for users which is working good, subscription can vary on type of plan. But I am not able to figure out how to cancel subscription after user has fully paid.
Is there any parameter we can tell stripe at the time of creation of subscription that tells it when subscription should cancel OR tell it to cancel it after n number of payments?
So essentially if customer bought a product which costs 1000, we would charge him 100 a month but then automatically cancel subscription once he has fully paid.
Thanks for the help
I answered this here: Stripe cancel subscription at specific date
Stripe just added this to their API and I happened to stumble upon it. They have a field called "cancel_at" that can be set to a date in the future. They don't have this attribute listed in their documentation since it is so new. You can see the value in the response object here:
https://stripe.com/docs/api/subscriptions/create?lang=php
I've tested this using .NET and can confirm it sets the subscription to expire at value you provide.
When you create a subscription in Stripe, there is no way to tell Stripe to stop the subscription after N months or when a given amount in reached.
From the documentation:
By default, a subscription continues, and the customer continues to be
billed, until it’s canceled
So what you could do is to cancel the subscription once a given condition is met.
You could use webhooks to get notified every time the customer is billed, at the end of every billing cycle, using the invoice.payment_succeeded event (documentation here).
Somehow you could keep track of the total amount paid by the customer in your database and the amount that is left before the item you sell is "fully paid".
Everytime you get the webhook, you increment the total and, if the required amount in reached, you cancel the subscription so that the customer will not be billed the next month.

Event Before the Record is changed in MS Access

I have an MS Access Form where I have two subforms. I need to be able to run a code/query before the record is discarded.
This DB is for tracking a hotel's sales and payments. The bounded form has the following layout:
First we have the main form with global fields like, ClientID, client name, address, bill date, restaurant bill, spa charges, etc.
Then I have the rooms subform (Datasheet view). This form has all rooms allotted to the guest. It also has the number of days charged and Rate fields.
Lastly I have a payments sub form (DataSheet View). It has all payments received from the guest. Last Tab index is for the payments Subform. I need to find the total amount the customer was billed. (sum of all room rate X number of days + Money Spent in Spa + Restaurant Bill). I also need to find the sum of all payments. If the total payment is different from total bill then I need to prompt the Operator to confirm the addition.
I know the VBA codes and queries to process the above. But what I do not know is how to trigger this event. I tried AfterUpdate, but it is fired the moment I move to any Sub Form. I need the code to run after the Operator has made all changes and is ready to move to the next record. I am at a loss on how to accomplish this.
You could just place the function in the after update of the last field in the operator's workflow on the last subform?
Alternatively, place a check to run the code on your move next/prev buttons to ensure the operator has completed the entirety of the workflow?
Could you post a ss of the form(s) so I can get a visual picture :)?

What datastructure should i use storing and recording events?

I want to record events based on on a date. I also want people to be able to search for event based on a particular date and the person who recorded the event.
For example:
Person A logs in and sees a calendar, click on a day/date and records an event for that day.
Person B logs in and sees a calendar, click on a day/date and records an event for that day.
Person C comes and does the same thing.
Note that either of these persons can record more than one event.
I want to be able record this data effectively in the database and search for these events based on a number of different criteria.
Please can someone help me with a data structure for this problem?
Person
ID
Name
PersonalEvent
ID
Person
Name
Date

Resources