Untitled

 avatar
unknown
plain_text
2 years ago
1.4 kB
6
Indexable
export const getClientConfiguration = (state: RootState): ClientConfig => {
  const allowedCards = state.itinerary?.standaloneHotel
    ? getAcceptedCreditCardsByStandaloneHotel(state)
    : getAcceptedCreditCardsByCarrier(state)
  return {
    apiVersion: 2,
    apiVersionMinor: 0,
    emailRequired: true,
    existingPaymentMethodRequired: true,
    merchantInfo: {
      merchantName: 'Priceline'
    },
    allowedPaymentMethods: [
      {
        type: 'CARD',
        parameters: {
          allowedAuthMethods: ['PAN_ONLY'],
          allowedCardNetworks: allowedCards.reduce((result: string[], card: string) => {
            if (card === 'VI') {
              result.push('VISA')
            } else if (card === 'MC') {
              result.push('MASTERCARD')
            } else if (card === 'AX') {
              result.push('AMEX')
            } else if (card === 'DS') {
              result.push('DISCOVER')
            }
            return result
          }, []),
          billingAddressRequired: true,
          billingAddressParameters: {
            phoneNumberRequired: true,
            format: 'FULL'
          }
        },
        tokenizationSpecification: {
          type: 'DIRECT',
          parameters: {
            protocolVersion: 'ECv2',
            publicKey: 'BEtHE8GqWeaRKKoccaWLAOt3gwOGRllCVhItLta9c36jdEkPGFRAm+CbvoYkHhPxC11bT9emUtMkqGzOodloHLY='
          }
        }
      }
    ]
  }
}
Editor is loading...