Versions Compared

Key

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

Questions:

...

  • The first step to use the loyalty promo code at checkout will be to change the validation promo code flow.

    • On promo code component field, we will need to add a feature flag:

      • When this flag is enabled: The promo code flow will be LOYALTY OFFER

      • When this flag is disabled: The promo code flow will be CBA OFFER (current flow)

  • We will create a new hook to contain all the rules of this flow

    • We can use the same hook used to offer page flow.

      • intl-whitelabel-app/workspaces/frontend/src/state/loyalty/hooks/use-redeem-promo-codes.ts

...

With this update, the frontend is prepared to apply the promo code to loyalty.

...

2 - TASK: Clean the applied offer when finished the order

  • When finished the order, we need to clean the offers on cookies, sessions and etc.

    • path: intl-whitelabel-app/workspaces/frontend/src/pages/order-confirmation/order-confirmation.tsx

Expand
titleExample code
Code Block
languagetypescript
useEffect(() => {
  if (!loading && !orderErrors) {
    dispatch(actions.loyalty.setSelectedOffer(null));
    dispatch(actions.loyalty.setAppliedOffers([]));
    dispatch(actions.loyalty.setCmsOffers([]));
  }
}, [dispatch, loading, orderErrors]);

Back-end

After applied the whitelabel will do a call to backend to calculate the discount value:

  • First, it will call the PriceOrder mutation on intl-gateway or intl-graphql

  • This mutation will call the backend: intl-partners-service repository.

    • on this repository, will call:

      • public async price(@Body() payload: PriceOrderRequestDto): Promise<OrderResponseDto>

        • path: intl-partners-service/src/modules/orders/orders.controller.ts

      • after: public async price(input: IPriceOrderRequest): Promise<IOrder>

        • path: intl-partners-service/src/modules/orders/orders.service.ts

        • on this file is where calculate the order and is generated the rbiOrderId.

Info

Currently for some reason, the calc is wrong in 2 aspects:

  • Setting up wrong offers;

  • Missing configOffer calc;

...