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) 2.3 kB
import{createElement as t}from"../../external/preact/dist/preact.js";import{UIElement as e}from"../internal/UIElement/UIElement.js";import o from"../internal/RedirectButton/RedirectButton.js";import{TxVariants as s}from"../tx-variants.js";import a from"./components/AchComponent.js";import n from"./defaultProps.js";function r(t,e,o){return e in t?Object.defineProperty(t,e,{value:o,enumerable:!0,configurable:!0,writable:!0}):t[e]=o,t}class i extends e{formatData(){var t,e;return!!this.props.storedPaymentMethodId?{paymentMethod:{type:i.type,storedPaymentMethodId:this.props.storedPaymentMethodId}}:function(t){for(var e=1;e<arguments.length;e++){var o=null!=arguments[e]?arguments[e]:{},s=Object.keys(o);"function"==typeof Object.getOwnPropertySymbols&&(s=s.concat(Object.getOwnPropertySymbols(o).filter(function(t){return Object.getOwnPropertyDescriptor(o,t).enumerable}))),s.forEach(function(e){r(t,e,o[e])})}return t}({paymentMethod:{type:i.type,ownerName:this.state.data.ownerName,accountHolderType:null===(t=this.state.data.selectedAccountType)||void 0===t?void 0:t.split(".")[0],bankAccountType:null===(e=this.state.data.selectedAccountType)||void 0===e?void 0:e.split(".")[1],bankLocationId:this.state.data.routingNumber,bankAccountNumber:this.state.data.accountNumber}},this.state.storePaymentMethod&&{storePaymentMethod:this.state.storePaymentMethod})}get isValid(){return!!this.props.storedPaymentMethodId||!!this.state.isValid}get displayName(){return this.props.storedPaymentMethodId&&this.props.bankAccountNumber?`•••• ${this.props.bankAccountNumber.slice(-4)}`:this.props.name}get additionalInfo(){return this.props.storedPaymentMethodId?this.props.i18n.get("ach.savedBankAccount"):""}componentToRender(){return this.props.storedPaymentMethodId?t(o,{showPayButton:this.props.showPayButton,name:this.displayName,payButton:this.payButton,onSubmit:this.submit,ref:t=>{this.componentRef=t}}):t(a,{onChange:this.setState,payButton:this.payButton,showPayButton:this.props.showPayButton,hasHolderName:this.props.hasHolderName,placeholders:this.props.placeholders,data:this.props.data,setComponentRef:this.setComponentRef,enableStoreDetails:this.props.enableStoreDetails})}}r(i,"type",s.ach),r(i,"defaultProps",n);export{i as AchElement,i as default}; //# sourceMappingURL=Ach.js.map