Skip to end of metadata
Go to start of metadata

You are viewing an old version of this page. View the current version.

Compare with Current View Page History

« Previous Version 10 Next »

Participants

🔍 Reviewers

Context

In the effort to display customized messages for different errors when quoting an order fails (Service paused and Reduced Area ), it is necessary to propagate this information from partners server where it is received to front end, where the customer can be redirected to the appropriate page. Given there are many different possibilities to achieve this goal, this ADR is intended to document the chosen reason.

There are two pages where Whitelabel App (directly or indirectly) creates new quotes: The store locator page and the checkout page.

Store locator page

The app triggers a DeliveryRestaurant query that directly generates an empty quote to check the restaurant availability, as displayed in the sequence diagram below.

Page

image-20240412-180656.png

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 are described in the sequence diagram below.

Sequence diagram

Page

image-20240412-180548.png

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:

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

  • No labels

0 Comments

You are not logged in. Any changes you make will be marked as anonymous. You may want to Log In if you already have an account.