Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.
Table of Contents

🛠️ Potential Solutions

Info

Note: this section should be short and sweet, documenting notes about different solutions that were considered during ideation. Can just be a link to a whiteboard for example. Expected outcome: one solution is chosen and documented in more detail under Proposed Solution.

✅ Proposed Solution

Info

Description of the proposed solution.

...

Info

List here potential challenges that have come across the opportunity definition or from the potential solutions so far.

💰 Cost

Info

Describe any additional cost this solution may imply.

🎛️ Configuration

Info

Include here any configuration required (Sanity, LaunchDarkly flags, etc.) required to enable the solution.

📈 Metrics

Info

Describe the metrics that will be used to measure the solution’s success, as well as how to measure those KPIs.

🗓️ Delivery Plan

Info

Link to the task or list of all the tasks required to deliver the solution, along with its progress.

🧑‍🚒 QA Plan

Info

Testing scenarios. See example /wiki/spaces/EGMT/pages/4080861189.

⚠️ Call-outs

...

🧐 Assumptions

  • We will only add the brands of credit cards in the “add new credit card” option.

  • Do not show “sodexo”, “cheque gourmet” and “ticket restaurant” brands in the “add new credit card” option.

  • Do not display card components for “sodexo”, “cheque gourmet” and “ticket restaurant”.

  • Iframe loading is indifferent to card component details (can be shown before loading the iframe).

Solution #1 - Map cards accepted in whitelabel-app

The first solution is to add a mapper just to the frontend to obtain the types of cards accepted for payment and directly obtain these values ​​that will be displayed. Changing accepted cards is very infrequently, we would not have problems with changes in these fields.

✅ Pros:

  • Quick implementation

(error) Cons:

  • Changes to information require engineering time

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

In this solution we would have the flexibility of a more dynamic change, but we would be linking the feature to the feature flag and adding another flag to the system.

The change needed to add the flags is just a change in the paycomet-credit-card-form.tsx file. To do this, you need to create a component to add the flags and call it after paymentJetId is enabled, as it defines when the form is ready to be displayed to the user.

Expand
titlesrc/utils/launchdarkly/flags.ts
Code Block
/**
 * This flag retrieve all accepted cards types.
 */
 ACCEPTED-CARDS-TYPES = 'accepted-cards-types',
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 / less complex

  • Ease of changing card type values

Solution #3 - Get accepted cards in the backend with launch-darkly

In this solution we created a more robust solution to store the types of cards accepted and retrieve them from launchdarkly.

The feature flag structure will be as follows:

Feature Flag

Variations


accepted-cards-types

acceptedCards

none

Solution #3.1 - Frontend integrate endpoint directly to payments-service

This solution involves creating an endpoint to retrieve the accepted card type data in the payment service and the frontend calling this endpoint directly without the need to go through graphql/fulfillment.

...

Expand
titlehttps://sequencediagram.org/
Code Block
note over Frontend,Graphql: No endpoint implentation
Frontend->Payment Service: Get accepted card types
Payment Service->Launch Darkly (Platform): Get feature flag value
Payment Service<-Launch Darkly (Platform): Retrieve feature flag value
Payment Service->Frontend:Retrieve accepted card types

✅ Pros:

  • Ease of changing card type values

(error) Cons:

  • More robust implementation

  • Creating new endpoints

Solution #3.2 - Frontend integrate endpoint directly to graphql/fulfillment

This solution involves creating an endpoint to retrieve the accepted card type data in graphql/fulfillment and the frontend calling this endpoint directly.

...

Expand
titlehttps://sequencediagram.org/
Code Block
Frontend->Graphql: Get accepted card types
Graphql->Launch Darkly (Platform): Get feature flag value
Graphql<-Launch Darkly (Platform): Retrieve feature flag value
Frontend<-Graphql:Retrieve accepted card types

✅ Pros:

  • Ease of changing card type values

(error) Cons:

  • More robust implementation

  • Creating new endpoints

Solution #3.3 - Frontend integrate endpoint directly to userAccounts endpoint

This solution involves changing the userAccounts endpoint and adding the new acceptedCards field.

...

Expand
titlehttps://sequencediagram.org/
Code Block
Frontend->Graphql (UserAccounts): Get accepted card types
Graphql (UserAccounts)->Launch Darkly (Platform): Get feature flag value
Graphql (UserAccounts)<-Launch Darkly (Platform): Retrieve feature flag value
Frontend<-Graphql (UserAccounts): Retrieve accepted card types

✅ Pros:

  • Ease of changing card type values

  • Endpoint already implemented

  • Scalable solution for all countries of a given Brand

(error) Cons:

  • Addition of the feature flag value request, which would increase the endpoint delay a little.

✅ Proposed Solution

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

The change needed is a change in intl-whitelabel-app and a change in the userAccounts endpoint in graphql.

To do this, you need to create a component to add the flags and call it after paymentJetId is enabled, as it defines when the form is ready to be displayed to the user.

intl-whitelabel-app

Expand
titlesrc/state/payment/index.tsx
Code Block
export interface IPaymentContext {
  acceptedCardTypes: string[];
  ...
}

const {
  acceptedCardTypes,
  ...
} = usePayment({
    ...,
});

return {
  ...,
  acceptedCardTypes
  ...,
}
Expand
titlepayment/hooks/use-payment.tsx
Code Block
const acceptedCardTypes = userAccountsData?.userAccounts?.acceptedCardTypes;

return {
  ...,
  acceptedCardTypes
  ...,
}
Expand
titlepayment-method/index.tsx
Code Block
const payment = usePaymentContext();

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

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

intl-whitelabel-graphql

Expand
titlesrc/functions/graphql/resolvers/payments.ts
Code Block
CONST ACCEPTED_CARDS = 'accepted-card-types'

async userAccounts(
  ...
): Promise<GraphQLTypes.AccountListResponse> {
  ...
  
  const launchDarkly: LaunchDarkly = new LaunchDarkly({
    config: config.launchDarkly,
    context: { logger },
  });

  const acceptedCardTypes = await launchDarkly.getFeatureValue({
    feature: ACCEPTED_CARDS,
    defaultValue: [],
  });
  
  return {
    ...,
    acceptedCardTypes: acceptedCardTypes ? acceptedCardTypes[paymentProcessor] : [],
  };
}
Expand
titlesrc/functions/graphql/schemas/payments.gql
Code Block
type AccountListResponse {
  ...
  acceptedCardTypes: string[]
}
Info

After adding the new property in type, you need to run graphql:types

🎛️ Configuration

Feature Flag

accepted-cards-types

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 #3.3 - Get accepted cards in the launch-darkly

Variations

acceptedCards:

Code Block
{
  paycomet: [
    'VISA',
    'MASTERCARD,
  ],
  firstdata: [
    'VISA',
    'MASTERCARD',
    'AMEX'
  ],
  paymark: []
}

none:

Code Block
{}

📈 Metrics

Reduce the abandonment rate in the payment process by 11.8%.

...

KPI = (Paycomet Error 102) / All Payments * 100

Error 102: Operation not permitted for card type.

🧑‍🚒 QA Plan

Test Scenario

Result

Screenshots

Show icons for accepted credit card types

  • When selecting the credit card payment method

  • The accepted credit card brands are to be shown

Image Added

NOT show icons for accepted credit card types for sodexo

  • When selecting the credit card payment method

  • Not show the card details

Image Added

NOT show icons for accepted credit card types for cheque gourmet

  • When selecting the credit card payment method

  • Not show the card details

Image Added

NOT show icons for accepted credit card types for ticket restaurant

  • When selecting the credit card payment method

  • Not show the card details

Image Added