UNPKG

@adyen/adyen-web

Version:

[![npm](https://img.shields.io/npm/v/@adyen/adyen-web.svg)](https://www.npmjs.com/package/@adyen/adyen-web)

3 lines (2 loc) 1.94 kB
import{getDecimalAmount as e}from"../../utils/amount-util.js";import r from"./config.js";function t({allowedAuthMethods:e,allowedCardNetworks:t,existingPaymentMethodRequired:a=!1}){return{apiVersion:r.API_VERSION,apiVersionMinor:r.API_VERSION_MINOR,allowedPaymentMethods:[{type:"CARD",parameters:{allowedAuthMethods:e,allowedCardNetworks:t},tokenizationSpecification:{type:"PAYMENT_GATEWAY",parameters:{}}}],existingPaymentMethodRequired:a}}function a({amount:r,countryCode:t="US",totalPriceStatus:a="FINAL",...i}){const n=String(e(r.value,r.currency));return{countryCode:t,currencyCode:r.currency,totalPrice:n,totalPriceStatus:a,...i.transactionInfo}}function i({configuration:e,...t},i){return{apiVersion:r.API_VERSION,apiVersionMinor:r.API_VERSION_MINOR,transactionInfo:a({countryCode:i,...t}),merchantInfo:{merchantId:e.merchantId,merchantName:e.merchantName,...e.merchantOrigin?{merchantOrigin:e.merchantOrigin}:{},...e.authJwt?{authJwt:e.authJwt}:{}},allowedPaymentMethods:[{type:"CARD",tokenizationSpecification:{type:"PAYMENT_GATEWAY",parameters:{gateway:r.GATEWAY,gatewayMerchantId:e.gatewayMerchantId}},parameters:{allowedAuthMethods:t.allowedAuthMethods,allowedCardNetworks:t.allowedCardNetworks,assuranceDetailsRequired:t.assuranceDetailsRequired,allowPrepaidCards:t.allowPrepaidCards,allowCreditCards:t.allowCreditCards,allowedIssuerCountryCodes:t.allowedIssuerCountryCodes,blockedIssuerCountryCodes:t.blockedIssuerCountryCodes,billingAddressRequired:t.billingAddressRequired,billingAddressParameters:t.billingAddressParameters}}],emailRequired:t.emailRequired,shippingAddressRequired:t.shippingAddressRequired,shippingAddressParameters:t.shippingAddressParameters,shippingOptionRequired:t.shippingOptionRequired,shippingOptionParameters:t.shippingOptionParameters,callbackIntents:t.callbackIntents}}export{a as getTransactionInfo,i as initiatePaymentRequest,t as isReadyToPayRequest}; //# sourceMappingURL=requests.js.map