The suggested time slots for order availability do not behave the same way when using a 3rd party delivery service. Because we rely on external driver availability, we need to communicate with the delivery service ahead of time to ensure we suggest times when drivers will be available.
There are three steps to submitting orders to the delivery service:
There are three steps to submitting orders to the delivery service:
- Get estimates to display available time slots and ASAP time
- When a time slot is selected, and again at checkout, validate the selected time (and create an order Quote)
- After payment and submitting the order to the POS, confirm the delivery for the quoted order
Time slot suggestion logic:
- We first calculate the earliest (ASAP) pickup time at the location based on the store's delivery settings (prep time, notice period).
- We then submit an estimate request to the delivery service, including the ASAP pickup time.
- The delivery service replies with estimates for its pickup and dropoff times. If the pickup time does not match what we requested, we verify that the new pickup estimate is feasible for the location (for example, the location could be closed by that time, or the time slot may be unavailable due to throttling settings). If the time is not available for pickup, this process repeats until the system finds a matching pickup time that is no more than 10 minutes before or after the requested pickup time.
- Once we find a matching estimate, we read the dropoff time returned by the provider, round it up to the nearest 5-minute increment, and label it as the earliest (ASAP) available time. This is the time used for the ASAP estimate shown to the user.
- Once we have the ASAP estimate, we generate the time slots shown to the user. For today's date, we start at the ASAP time and add time slots at the store's configured interval, up until the store's closing time.
- For future dates, we repeat the process by first checking the earliest available time for that day, then generating time slots from that point. We try to avoid additional calls to the delivery service when possible by reusing past results.