Versions Compared

Key

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

Questions:

  •  N/D

Technical Refinement

...

  • Create a 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

...

  • We will need to send the new discount attribute to Winrest by webhook:

  • Then, we will add the new attribute on mapper mapRbiCart;

  • So we will add the variable discountsOffer to mapRbiCart: mapRbiCart(pricingCart, discountsOffer);

    • In this method, we will add a new condition to send the discount values:

      Image Added
      Code Block
      languagetypescript
      if (FEATURE_FLAG && orderDiscounts?.length && verifyDiscountTypes(cartEntry)) {
        result.orderDiscounts = orderDiscounts;
      }
    • Where, the verifyDiscountTypes method verify item type of the cart that there will be a discount because these items are already an items offerthe types (CartEntryType.offerDiscount, CartEntryType.offerCombo, CartEntryType.offerItem) are already the offer of an item;

      Code Block
      languagejson
      const verifyDiscountTypes = (cartEntry: ICartEntry): boolean => {
        return (
          cartEntry.type !== CartEntryType.offerDiscount &&
          cartEntry.type !== CartEntryType.offerCombo &&
          cartEntry.type !== CartEntryType.offerItem
        );
      };

...