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: Updated action Remove button
We will need to update the button action to remove the applied offer on
loyalty.offers.cmsOffers
path:
intl-whitelabel-app/workspaces/frontend/src/state/global-state/models/loyalty/offers/offers.slice.ts
Code Block language typescript removeCmsOffers: (state, { payload }: PayloadAction<LoyaltyOffer>) => { state.cmsOffers = state.cmsOffers.filter(offer => offer._id !== payload._id); },
path:
intl-whitelabel-app/workspaces/frontend/src/pages/cart/your-cart/cart-offer.tsx
Code Block language typescript const onRemove = () => { ... dispatch(actions.loyalty.removeCmsOffers(selectedLoyaltyOffer)); };
OBS.: Change also:
path:
intl-whitelabel-app/workspaces/frontend/src/state/global-state/models/loyalty/loyalty.actions.ts
...
3 - 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
...
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;
...