graycoreio/daffodil

View on GitHub
libs/cart/src/injection-tokens/payment-method-map.ts

Summary

Maintainability
A
0 mins
Test Coverage
import { createSingleInjectionToken } from '@daffodil/core';

export const {
  /**
   * An injection token for a mapping from the platform-specific cart payment method
   * to a user-defined platform-agnostic payment ID.
   * It should be an object whose keys are the cart payment's method and whose values are strings.
   * Defaults to an empty object.
   */
  // TODO: refactor to upper snake case
  token: DaffCartPaymentMethodIdMap,
  /**
   * Provider function for {@link DaffCartPaymentMethodIdMap}.
   */
  provider: provideDaffCartPaymentMethodIdMap,
} = createSingleInjectionToken<{[key: string]: string}>(
  'DaffCartPaymentMethodIdMap',
  { factory: () => ({}) },
);