Questions:
...
Create feature flag;
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
...
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;
intl-partners-service
When the frontend call the backend, the first method ran is:
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.
On
price(input: IPriceOrderRequest)
on fileorders.service.ts
, there is a call method namedthis.cartTotalService.calculate(input.cart)
.Inside this method is calc the some type offers, for example System Wide offers, but there isn’t the calc relative Offer configs.
The method that calc relative the system wide offer is
getSystemWideOfferIncentiveDiscountAndType(offerId: string): Promise<IRewardIncentive | undefined>
path:
@intl-sanity/loyalty/index.ts
Expand | |||||
---|---|---|---|---|---|
| |||||
|
Info |
---|
Possible solution configOffer calc: |
We will need to create a new method to get the config offers on
intl-sanity
repository:path:
intl-sanity/loyalty/index.ts
Expand | |||||
---|---|---|---|---|---|
| |||||
|
After it, we will need to update the
intl-sanity
lib onintl-partners-service
to have access at this new query.In the next, we can do the new method to calc this type offer that can be after
getSystemWideOfferIncentiveDiscountAndType
method:path:
intl-partners-service/src/modules/orders/cart-total.service.ts
Expand | ||
---|---|---|
| ||
|
Expand | |||||
---|---|---|---|---|---|
| |||||
|
...
Remembering that all these problems can occur because there is an error in the offer settings somewhere.
Screenshots
...
Screenshots
N/A
POC
FRONTEND (WHITELABEL)
https://github.com/rbilabs/intl-partners-serviceBranch POC: https://github.com/rbilabs/intl-whitelabel-app/tree/poc/IBFEC-934-loyalty-promo-code-at-checkout
Impact Analysis
N/A
Dependencies
...