Delivery API - Integration Test Cases

Contents

Address Availability

Action

Tests

Expected Vendor Behavior

Expected Result

Action

Tests

Expected Vendor Behavior

Expected Result

Restaurant Selection

  • Within Delivery Area

Authenticated user inputs address within delivery area on restaurant search in App

Vendor answers successfully to DELIVERY_QUOTE_CREATE webhook (docs), with desired storeId.

Desired restaurant is selected for delivery.

Restaurant Selection

  • Outside Delivery Area

Authenticated user inputs address outside delivery area on restaurant search in App

Vendor answers to DELIVERY_QUOTE_CREATE webhook (docs) with empty storeId.

Modal of Delivery unavailable for selected address displayed.

 

Order Confirmation

Action

Tests

Expected Vendor Behavior

Expected Result

Action

Tests

Expected Vendor Behavior

Expected Result

Delivery Fee

  • Standard Rate

Authenticated user navigates to checkout page

Vendor answers successfully to DELIVERY_QUOTE_APPLY webhook (docs), with desired cost.

The delivery fee amount is displayed on order description at the checkout page.

Delivery Fee

  • Added Rate

Authenticated user navigates to checkout page

Vendor answers successfully to DELIVERY_QUOTE_APPLY webhook (docs), with desired cost.

The delivery fee amount is displayed on order description at the checkout page.

Estimated Time of Arrival (ETA)

Authenticated user navigates to checkout page

Vendor answers successfully to DELIVERY_QUOTE_APPLY webhook (docs), with desired dropoffWindow.

The ETA is displayed on order description at the checkout page.

 

Order Creation

Action

Tests

Expected Vendor Behavior

Expected Result

Action

Tests

Expected Vendor Behavior

Expected Result

Order creation

Authenticated user clicks on “Continue” on the checkout page, and confirms selecting any payment method by clicking “Place Secure Order”.

  • fireOrderInSeconds=null

Vendor answers successfully to DELIVERY_CREATE webhook (docs).

  • First progression status on the order is checked: “Order placed”

  • Second progression status on the order is unchecked “Order being prepared”

Estimated Time of Arrival (ETA)

Authenticated user clicks on “Continue” on the checkout page, and confirms selecting any payment method by clicking “Place Secure Order”.

Vendor answers successfully to DELIVERY_CREATE webhook (docs), with desired dropoffWindow.

The ETA is displayed on order confirmation page.

Firing order to kitchen

Delivery vendor request to move the order to kitchen

  • Based on driver’s geolocation OR driver’s ETA to the restaurant

  • fireOrderInSeconds=0

Vendor triggers a FIRE_ORDER event by sending a request to the fire order endpoint (docs).

Order is sent to kitchen, for preparation.

It can be validated by the GET request API

 

Order Delivery

Action

Tests

Expected Vendor Behavior

Expected Result

Action

Tests

Expected Vendor Behavior

Expected Result

Order is picked up by driver

User remains in the order confirmation page, meanwhile the driver picks the order up at the restaurant.

Vendor sends a request to the delivery event endpoint (docs), updating the delivery to ORDER_PICKED_UP status.

“Driver Enroute” state is displayed in the order confirmation page.

Order is delivered to customer address

User remains in the order confirmation page, driver drops order at customer address.

Vendor sends a request to the delivery event endpoint (docs), updating the delivery to ORDER_DROPPED_OFF status.

“Delivered” state is displayed in the order confirmation page.

 

Alternative Flows

Action

Tests

Expected Vendor Behavior

Expected Result

Action

Tests

Expected Vendor Behavior

Expected Result

Pre-order scheduling

User places a order with “Delivery Time“

Vendor should receive the DELIVERY_CREATE event with the fireOrderInSeconds field

Order must be send to the kitchen only in the right delivery time indicated in the fireOrderInSeconds field

Restaurant not eligible for selection

Inputs address on restaurant search in Whitelabel App.

The store tested must not be eligible

Vendor should not receive request for DELIVERY_QUOTE_CREATE for that restaurant.

Another restaurant is selected for delivery or “no-delivery-stores” modal should be displayed if any restaurant is eligible.

Quote failed by unavailability reason

Inputs address on restaurant search in Whitelabel App.

Vendor should receive the quote request DELIVERY_QUOTE_CREATE webhook (docs), but must return status QUOTE_ERROR with some of the reasons:

  • NO_DRIVERS_AVAILABLE

  • NUMBER_OF_ORDERS

  • REDUCED_CAPACITY

  • RESTAURANT_NEAR_TO_CLOSE

  • TECHNICAL_ISSUES

  • UNREACHABLE_RESTAURANT

  • WEATHER

Another restaurant is selected for delivery or “no-delivery-stores” modal should be displayed if any restaurant is eligible.

Order confirmation when the restaurant is no longer eligible

An authenticated user, select a restaurant, add some item to the cart and navigate to the checkout page.

The store should no longer be eligible

Vendor should not receive request for DELIVERY_QUOTE_CREATE for that restaurant.

A modal should be displayed to inform that the restaurant is unavailable.

Order is cancelled by delivery vendor

Order is cancelled during the delivery process.

Vendor sends a request to the delivery event endpoint (docs), updating the delivery to ORDER_CANCELLED status and another request to update the order status CANCELED (docs).

  • Ordered is cancelled, RBI broadcasts this status through Delivery (docs) / Order (docs) status webhook events.

  • The cancelled modal is displayed on the confirmation page

  • Money is refunded if online payment

Order is cancelled by another party (POS, RBI, etc.)

Order is cancelled by POS, RBI, or a different party than the delivery vendor.

Vendor reacts to delivery or order status changes from DELIVERY_EVENT (docs) / ORDER_EVENT (docs) webhooks.

Vendor must cancel the order and send delivery event (docs) to indicate that the delivery order has been canceled in full.

  • Consistent final status of order, and delivery, across all integrated systems.

  • The cancelled modal is displayed on the confirmation page

  • Money is refunded if online payment

Driver cancels the trip before collecting the order

After the driver has been assigned to deliver the order, he cancels the trip

Vendor should send the DRIVER_UNASSIGNED event (docs)

No order status change

Driver cancels the trip after collecting the order

After the driver has been picked up the order, he cancels the trip

Vendor should send the ORDER_CANCELLED event (docs)

  • Ordered is cancelled, RBI broadcasts this status through Delivery (docs) / Order (docs) status webhook events.

  • The cancelled modal is displayed on the confirmation page

  • Money is refunded if online payment

Optional flows

Set restaurant to available/unavailable

When the delivery provider changes store availability

Send a event to the RBI to notify the change (docs)

Receive the event from the vendor

Refund order

The order paid with online payment is canceled by the vendor and the customer receives a refund

Vendor should send a request to refund the order (docs)

The refund must be made successfully

Create a loyalty vouncher

The order is delivered with problem (e.g. missing fries), manager sends a voucher to the customer in the format of a loyalty offer.

Vendor should send a request to create a voucher to the customer loyalty account (docs)

A voucher must be create in the customer loyalty account.