As CBA feature is deprecated we need to change the promo code field to accept loyalty promo codes. (here more details on how to configure the promo code on sanity and voucherify: https://rbictg.atlassian.net/wiki/spaces/CG/pages/984973325- OBS.: The documentation explain how configure promo codes to CBA offers and Loyalty Offers, So follow just the loyalty steps.)
After the config, we will have the config offer like this:
OBS.: On In-App Benefits there is just one item. If there are more itens, the discount will be the first item.
How to create a config offer and vinculate to a Voucherify voucher
intl-whitelabel-app
Acceptance criteria
We can’t impact the other markets
Apply promotional codes at checkout
Same as when the promo code is applied on the offers page
Validate the promotional code on voucherify
Use the current design of the promotional code field at checkout
We need to show only the input and the apply button when our new flag is ON (Task 3 for more details)
We need to render only the input for the promotional code instead of the collapse structure if our flag is ON
Before
After our change (with our flag ON)
@Raphael Ferreira Gomes said that when the component is expanded some events are dispatched to mParticle. We need to validate what will happen now that the component will be loaded in the screen without the collapse. He recommended that we need to talk with Manuel (Manuel Rodrigues da Silva) to understand if this will be a problem and what’s expect for the events part ← To be validate during development
Do we need to fire events if the component is already rendered in the screen?
This task is not for now. We’ll develop a PoC and validate the ideas first
Currently, we don’t have the validated voucher flow on whitelabel-app and voucherify, Just the burn voucher flow when we applied the promo code.
When we applied the promo code, the offer get saved on the offers page.
So, We need to validate the offers saved and compare the promo code added on the field to offers saved before validating the promo code on voucherify.
If we have a promo code saved, we will apply the offer without validating voucherify.
If we don’t have one, we will validate the promo code with voucherify
Important (BLOCKED): apparently this flow changed in the current app and the result was not what Rodrigo showed in the screenshots below (redeem in restaurant modal). We don’t have enough time during the A&D to go deep on this. We can talk with @de Sousa Santos, Rodrigo to understand better what code we should base in.
There is a feature flag that limits what kind of modal should be shown: ENABLE_IMPROVED_SIMPLIFIED_REDEEM_IN_RESTAURANT_STATIC_OFFERS
With this flag on, we won’t have a close modal button like the one below:
And when it’s turned on it will be shown as below:
When finish the order, we need to clean the offers on cookies, sessions, etc.
Suggestion of PoC code: Instead of clear each state using a set function (showed in the PoC code below) we can improve this creating new slices to handle with the data clear:
selectedOffer state → We can create a new slice to clear/reset this state
appliedOffers state → We can reuse the resetAppliedOffers() slice that already exists to clear/reset this state instead of set an empty array
cmsOffers state → We can create a new slice to clear/reset this state
As last resource we can create a new slice to clear all the data related to the applied offer
After the order is finished, we need to apply the sanity rules too, for example:
If the number used voucher is 1, after the order, the offer should be removed from the offer page
we can use the same logic on the component OfferRedemptionModal
Will show the modal and if we click on the close button, the offers will removed on the offer page. So we can use the same logic:
OBS: This relation between offer x customer, probably is saved on dynamoBD
We can find the answer on intl-promotion-service repository, from redeemCoupon method flow
intl-partners-service (backend)
After applying the Whitelabel will do a call to the backend to calculate the discount value:
How is the calculation done?
So basically, we need to send (via slack) to Winrest the offers sanityId.
They register these sanityId on their system and after that, always we use some offers with these sanityId registered, Winrest will return the calculation offers correctly.
Example:
To use the offer Test: Test Discount Offer (Sanity DEV)