import{getDecimalAmount as e}from"../../utils/amount-util.js";import t from"./config.js";function r(e,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function n(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{},o=Object.keys(n);"function"==typeof Object.getOwnPropertySymbols&&(o=o.concat(Object.getOwnPropertySymbols(n).filter(function(e){return Object.getOwnPropertyDescriptor(n,e).enumerable}))),o.forEach(function(t){r(e,t,n[t])})}return e}function o(e,t){if(null==e)return{};var r,n,o,a={};if("undefined"!=typeof Reflect&&Reflect.ownKeys){for(r=Reflect.ownKeys(e),o=0;o<r.length;o++)n=r[o],t.indexOf(n)>=0||Object.prototype.propertyIsEnumerable.call(e,n)&&(a[n]=e[n]);return a}if(a=function(e,t){if(null==e)return{};var r,n,o={},a=Object.getOwnPropertyNames(e);for(n=0;n<a.length;n++)r=a[n],t.indexOf(r)>=0||Object.prototype.propertyIsEnumerable.call(e,r)&&(o[r]=e[r]);return o}(e,t),Object.getOwnPropertySymbols)for(r=Object.getOwnPropertySymbols(e),o=0;o<r.length;o++)n=r[o],t.indexOf(n)>=0||Object.prototype.propertyIsEnumerable.call(e,n)&&(a[n]=e[n]);return a}function a({allowedAuthMethods:e,allowedCardNetworks:r,existingPaymentMethodRequired:n=!1}){return{apiVersion:t.API_VERSION,apiVersionMinor:t.API_VERSION_MINOR,allowedPaymentMethods:[{type:"CARD",parameters:{allowedAuthMethods:e,allowedCardNetworks:r},tokenizationSpecification:{type:"PAYMENT_GATEWAY",parameters:{}}}],existingPaymentMethodRequired:n}}function i(t){let{amount:r,countryCode:a="US",totalPriceStatus:i="FINAL"}=t,s=o(t,["amount","countryCode","totalPriceStatus"]);const l=String(e(r.value,r.currency));return n({countryCode:a,currencyCode:r.currency,totalPrice:l,totalPriceStatus:i},s.transactionInfo)}function s(e,r){let a=[e,r],[s,...l]=a,{configuration:d}=s,u=o(s,["configuration"]),[c]=l;return{apiVersion:t.API_VERSION,apiVersionMinor:t.API_VERSION_MINOR,transactionInfo:i(n({countryCode:c},u)),merchantInfo:n({merchantId:d.merchantId,merchantName:d.merchantName},d.merchantOrigin?{merchantOrigin:d.merchantOrigin}:{},d.authJwt?{authJwt:d.authJwt}:{}),allowedPaymentMethods:[{type:"CARD",tokenizationSpecification:{type:"PAYMENT_GATEWAY",parameters:{gateway:t.GATEWAY,gatewayMerchantId:d.gatewayMerchantId}},parameters:{allowedAuthMethods:u.allowedAuthMethods,allowedCardNetworks:u.allowedCardNetworks,assuranceDetailsRequired:u.assuranceDetailsRequired,allowPrepaidCards:u.allowPrepaidCards,allowCreditCards:u.allowCreditCards,allowedIssuerCountryCodes:u.allowedIssuerCountryCodes,blockedIssuerCountryCodes:u.blockedIssuerCountryCodes,billingAddressRequired:u.billingAddressRequired,billingAddressParameters:u.billingAddressParameters}}],emailRequired:u.emailRequired,shippingAddressRequired:u.shippingAddressRequired,shippingAddressParameters:u.shippingAddressParameters,shippingOptionRequired:u.shippingOptionRequired,shippingOptionParameters:u.shippingOptionParameters,callbackIntents:u.callbackIntents}}export{i as getTransactionInfo,s as initiatePaymentRequest,a as isReadyToPayRequest};
//# sourceMappingURL=requests.js.map
