Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

...

Zenuml sequence macro lite
uuidc2a4bd77-05fb-4697-980f-9b3585ca245f
customContentId4636213390
updatedAt2024-04-12T16:09:44Z

Page

...

Checkout page

In the checkout page, a new quote is created indirectly after the priceOrder mutation is triggered in the front. Through a series of asynchronous steps, the on-apply lambda is triggered after the order is priced, and then the deliveryServiceApplyQuote lambda updates the delivery in the RBI order. The full processes is are described in the sequence diagram below.

Sequence diagram

Zenuml sequence macro lite
uuid0dcd41ad-2982-4150-aa2a-4ba42864490a
customContentId4636672144
updatedAt2024-04-12T16:15:59Z

Page

...

Decision

Include an optional unavailabilityReason field in the following interfaces:

interface

where

why?

triggered by

delivery-restaurant.dto.ts

delivery-service

Rest API requested for wl-gql when processing DeliveryRestaurant query

store-locator page

schema.graphql

delivery-service

Graphql type for DeliveryRestaurant query when using the gateway

store-locator page

restaurant.gql

intl-whitelabel-graphql

Graphql type for DeliveryRestaurant query when not using the gateway

store-locator page

delivery.ts

intl-packages

wl-app use a getOrder pooling to validate the quote success. Including unavailabilityReason here will enable the app to display the right message

checkout page

Consequences

(plus) Little impact on platform existing quote logic and validations

(plus) Scales well with new reasons for restaurant unavailability

(plus) Doesn’t require the creation of new queries in front end

(error) Includes a new field for delivery that will only be used for partners orders

(error) Modifies more interfaces than some of the alternatives

Disregarded alternatives

Disregarded solution 1

Add new values to DeliveryStatus enum to represent possible unavailability reasons. This would require the inclusion of the following values in DeliveryStatus enum definition:

Code Block
languagejs
export enum DeliveryStatus {
  // Current values 
  DRIVER_ASSIGNED = 'DRIVER_ASSIGNED',
  DRIVER_AT_CUSTOMER = 'DRIVER_AT_CUSTOMER',
  DRIVER_AT_STORE = 'DRIVER_AT_STORE',
  DRIVER_STARTING = 'DRIVER_STARTING',
  DRIVER_UNASSIGNED = 'DRIVER_UNASSIGNED',
  ORDER_ABANDONED = 'ORDER_ABANDONED',
  ORDER_CANCELLED = 'ORDER_CANCELLED',
  ORDER_CREATED = 'ORDER_CREATED',
  ORDER_DROPPED_OFF = 'ORDER_DROPPED_OFF',
  ORDER_ERROR = 'ORDER_ERROR',
  ORDER_PICKED_UP = 'ORDER_PICKED_UP',
  ORDER_TIMEOUT = 'ORDER_TIMEOUT',
  QUOTE_ERROR = 'QUOTE_ERROR',
  QUOTE_NOT_REQUIRED = 'QUOTE_NOT_REQUIRED',
  QUOTE_REQUESTED = 'QUOTE_REQUESTED',
  QUOTE_SUCCESSFUL = 'QUOTE_SUCCESSFUL',
  QUOTE_UNAVAILABLE = 'QUOTE_UNAVAILABLE'

 // New values
 QUOTE_UNAVAILABLE_RESTAURANT_CLOSED
 QUOTE_UNAVAILABLE_NUMBER_OF_ORDERS
 QUOTE_UNAVAILABLE_TECHNICAL_ISSUES
 QUOTE_UNAVAILABLE_RESTAURANT_NEAR_TO_CLOSE
 QUOTE_UNAVAILABLE_WEATHER
 QUOTE_UNAVAILABLE_NO_DRIVERS_AVAILABLE
 QUOTE_UNAVAILABLE_REDUCED_CAPACITY
} 

Consequences

(plus) Doesn’t require changes in multiple interfaces, only a single enum

(error) Bad semantics, since the new values are quote error reasons and not really a delivery status

(error) Will impact the quote validation logic in many areas of the platform (e.g. isPriceOrderRequestComplete in fulfillment)

(error) Doesn’t scale with new quote errors

Disregarded solution 2

This solution proposes the same as the chosen solution for the store-locator page, but for the checkout page, instead of saving the unavailability reason in the order it will save it in the quote dynamo table and poll for it in WL App. This would require the inclusion of the unavailabilityReason field in the following interfaces:

interface

where

why?

triggered by

delivery-restaurant.dto.ts

delivery-service

Rest API requested for wl-gql when processing DeliveryRestaurant query

store-locator page

schema.graphql

delivery-service

Graphql type for DeliveryRestaurant query when using the gateway

store-locator page

restaurant.gql

intl-whitelabel-graphql

Graphql type for DeliveryRestaurant query when not using the gateway

store-locator page

Currently, if any of the quote validations in the create quote fail and throw an error, the quote is not saved in the delivery table. This solution would require the create quote logic to also save quotes with errors. With this information stored, WL App can pool for it using the getQuote endpoint.

Consequences

(plus) Scales well with new reasons for restaurant unavailability

(plus) Doesn’t modify RBI Order interface

(error) Adds a new pooling in the checkout, which is a critical page that already has poor performance

(error) Saves failed quotes in dynamo, which increase storage cost in AWS