Versions Compared

Key

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

...

Expand
titlepayment-method/index.tsx
Code Block
const acceptedCardsFeatureFlag = useFlag(
    LaunchDarklyFlag.ACCEPTED_CARDS
);

const creditTypeAccepted = () => {
  if(sodexo || chequeGourmet || ticketRestaurant){
    return
  }
  
  const mappedAcceptedCards = acceptedCardsFeatureFlag.map((cardType) => {
    return (
      <Icon .... >
    )
  })
  
  return (
    <>
      <h3>Card Details</h3>
      {mappedAcceptedCards()}
    </>
  );
};

return (
  <>
    <PaymentMethodSelect>
    ...
    </PaymentMethodSelect>
    {isAddCardOpen && creditTypeAccepted()}
  </>
)

Feature Flag

Variations

["MASTERCARD", "VISA", "AMEX"]

โœ… Pros:

  • Quick implementation

  • Ease of changing card type values

...

To configure the feature flag correctly, it is necessary to enable the feature flag and configure the variations to add the values โ€‹โ€‹of the accepted card types. For example:

Solution #2 - Get accepted cards in the launch-darkly

...

Variations

...

Solution #3.3 - Get accepted cards in the launch-darkly

...