Versions Compared

Key

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

...

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

type AcceptedCardTypes = {
  acceptedCardTypes: string[];
};

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] : [],
  };
}

...