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,KAAA1D,EAAAA,SAAEP,KAAK+D,WAAWC,QAAQ,eAAO,OAAjC,EAAmCE,SACvC,EAEAtE,EAAUM,UAAUiE,aAAe,WAC/B,MAAmC,KAA5BnE,KAAKH,OAAOsE,YACvB,EAEAvE,EAAUM,UAAUS,wBAA0B,WACtCX,KAAKmE,iBACL,EAAA5D,EAAAA,SAAEC,SAASC,MAAMgD,QAAQ,kBAEjC,EAEA7D,EAAUM,UAAUoB,oBAAsB,SAAUQ,GAAM,WACtD,OAAO,IAAIsC,SAAQ,SAACC,EAASC,GACzB/D,EAAAA,QAAEgE,KAAK,CACHC,OAAQ,OACRC,SAAU,OACV3C,KAAM,EAAF,CAAGyB,eAAgB,EAAKmB,YAAe5C,GAC3C6C,IAAK,EAAK9E,OAAO+E,OAAOC,UAAUC,QAAQ,KAAM,2CAChDC,WAAY,EAAKC,iBAAiB1E,KAAK,KACxC2E,MAAK,SAAAC,GACAA,EAAS7B,KACTiB,EAAOY,EAASC,SAEhBd,EAAQa,EAEhB,IAAGE,MAAK,SAACC,EAAKC,EAAYC,GACtB,EAAK1C,aAAa0C,EACtB,GACJ,GACJ,EAEA3F,EAAUM,UAAY,EAAH,OAAOJ,EAAAA,YAAYI,WAAcD,EAAAA,gBAAgBC,WAAcN,EAAUM,WAE5F,IAAIN,EAAU4F,iC","sources":["webpack://woo-stripe-payment/./node_modules/@babel/runtime/helpers/defineProperty.js","webpack://woo-stripe-payment/./node_modules/@babel/runtime/helpers/interopRequireDefault.js","webpack://woo-stripe-payment/external window \"jQuery\"","webpack://woo-stripe-payment/external window [\"wc_stripe\"]","webpack://woo-stripe-payment/webpack/bootstrap","webpack://woo-stripe-payment/./assets/js/frontend/ach-connections.js"],"sourcesContent":["function _defineProperty(obj, key, value) {\n if (key in obj) {\n Object.defineProperty(obj, key, {\n value: value,\n enumerable: true,\n configurable: true,\n writable: true\n });\n } else {\n obj[key] = value;\n }\n\n return obj;\n}\n\nmodule.exports = _defineProperty;","function _interopRequireDefault(obj) {\n return obj && obj.__esModule ? obj : {\n \"default\": obj\n };\n}\n\nmodule.exports = _interopRequireDefault;","module.exports = window[\"jQuery\"];","module.exports = window[\"wc_stripe\"];","// The module cache\nvar __webpack_module_cache__ = {};\n\n// The require function\nfunction __webpack_require__(moduleId) {\n\t// Check if module is in cache\n\tvar cachedModule = __webpack_module_cache__[moduleId];\n\tif (cachedModule !== undefined) {\n\t\treturn cachedModule.exports;\n\t}\n\t// Create a new module (and put it into the cache)\n\tvar module = __webpack_module_cache__[moduleId] = {\n\t\t// no module.id needed\n\t\t// no module.loaded needed\n\t\texports: {}\n\t};\n\n\t// Execute the module function\n\t__webpack_modules__[moduleId](module, module.exports, __webpack_require__);\n\n\t// Return the exports of the module\n\treturn module.exports;\n}\n\n","import $ from 'jquery';\nimport {BaseGateway, CheckoutGateway} from '@paymentplugins/wc-stripe';\n\nfunction StripeACH(params) {\n BaseGateway.call(this, params);\n CheckoutGateway.call(this);\n}\n\n\nStripeACH.prototype.initialize = function () {\n window.addEventListener('hashchange', this.hashchange.bind(this));\n $(document.body).on('payment_method_selected', this.payment_method_selected.bind(this));\n $(document.body).on('click', '#place_order', this.on_order_pay.bind(this));\n}\n\nStripeACH.prototype.checkout_place_order = function () {\n this.payment_token_received = true;\n return CheckoutGateway.prototype.checkout_place_order.apply(this);\n}\n\nStripeACH.prototype.on_order_pay = function (e) {\n if (this.is_gateway_selected()) {\n // create the setup intent.\n if (this.is_change_payment_method()) {\n const {order_id, order_key} = this.params;\n e.preventDefault();\n this.create_setup_intent({order_id, order_key}).then(({setup_intent}) => {\n this.handle_payment_method_setup({\n order_id,\n order_key,\n client_secret: setup_intent.client_secret\n });\n });\n } else if (this.is_current_page('order_pay')) {\n e.preventDefault();\n this.process_order_pay();\n }\n }\n}\n\nStripeACH.prototype.handle_next_action = function (data) {\n const {client_secret} = data;\n this.stripe.collectBankAccountForPayment({\n clientSecret: client_secret,\n params: {\n payment_method_type: 'us_bank_account',\n payment_method_data: {\n billing_details: {\n name: this.get_customer_name(this.get_billing_prefix()),\n email: this.fields.get('billing_email', null),\n },\n },\n }\n }).then(({paymentIntent, error}) => {\n if (error) {\n return this.submit_error(error);\n }\n // show the mandate confirmation\n if (paymentIntent.status === \"requires_confirmation\") {\n this.do_payment_confirmation(data);\n } else {\n this.cancel_payment_processing();\n }\n });\n}\n\nStripeACH.prototype.handle_payment_method_setup = function (data) {\n const {client_secret} = data;\n this.stripe.collectBankAccountForSetup({\n clientSecret: client_secret,\n params: {\n payment_method_type: 'us_bank_account',\n payment_method_data: {\n billing_details: {\n name: this.get_customer_name(this.get_billing_prefix()),\n email: this.fields.get('billing_email', null),\n },\n },\n }\n }).then(({setupIntent, error}) => {\n if (error) {\n return this.submit_error(error);\n }\n // show the mandate confirmation\n if (setupIntent.status === \"requires_confirmation\") {\n this.do_setup_confirmation(data);\n } else {\n this.cancel_payment_processing();\n }\n });\n}\n\nStripeACH.prototype.do_payment_confirmation = function ({client_secret, order_id, order_key}) {\n this.stripe.confirmUsBankAccountPayment(client_secret).then(({paymentIntent, error}) => {\n if (error) {\n return this.submit_error(error);\n }\n if (paymentIntent.status === 'requires_payment_method') {\n this.cancel_payment_processing();\n } else if (paymentIntent.status === 'requires_action') {\n // paymentIntent?.next_action?.type === 'verify_with_microdeposits'\n // todo - eventually support microdeposits. For now, show a message\n this.cancel_payment_processing();\n return this.submit_error({code: 'ach_instant_only'});\n } else if (paymentIntent.status === 'processing') {\n this.set_nonce(paymentIntent.payment_method);\n if (this.is_current_page('order_pay')) {\n this.get_form().trigger('submit');\n } else {\n this.process_payment(order_id, order_key);\n }\n }\n });\n}\n\nStripeACH.prototype.do_setup_confirmation = function ({client_secret, order_id, order_key}) {\n this.stripe.confirmUsBankAccountSetup(client_secret).then(({setupIntent, error}) => {\n if (error) {\n return this.submit_error(error);\n }\n if (setupIntent.status === 'requires_payment_method') {\n this.cancel_payment_processing();\n } else if (setupIntent.status === 'requires_action') {\n // paymentIntent?.next_action?.type === 'verify_with_microdeposits'\n // todo - eventually support microdeposits. For now, show a message\n this.cancel_payment_processing();\n return this.submit_error({code: 'ach_instant_only'});\n } else if (setupIntent.status === 'succeeded') {\n this.set_nonce(setupIntent.payment_method);\n if (this.is_current_page('order_pay') || this.is_change_payment_method()) {\n this.get_form().trigger('submit');\n } else {\n this.process_payment(order_id, order_key);\n }\n }\n });\n}\n\nStripeACH.prototype.hide_place_order = function () {\n}\n\nStripeACH.prototype.show_payment_button = function () {\n this.show_place_order();\n}\n\nStripeACH.prototype.cancel_payment_processing = function () {\n $(this.container).closest('form').removeClass('processing');\n $(this.container).closest('form')?.unblock();\n}\n\nStripeACH.prototype.fees_enabled = function () {\n return this.params.fees_enabled == \"1\";\n}\n\nStripeACH.prototype.payment_method_selected = function () {\n if (this.fees_enabled()) {\n $(document.body).trigger('update_checkout');\n }\n}\n\nStripeACH.prototype.create_setup_intent = function (data) {\n return new Promise((resolve, reject) => {\n $.ajax({\n method: 'POST',\n dataType: 'json',\n data: {payment_method: this.gateway_id, ...data},\n url: this.params.routes.base_path.replace('%s', 'wc-stripe/v1/subscriptions/setup-intent'),\n beforeSend: this.ajax_before_send.bind(this)\n }).done(response => {\n if (response.code) {\n reject(response.message);\n } else {\n resolve(response);\n }\n }).fail((xhr, textStatus, errorThrown) => {\n this.submit_error(errorThrown);\n });\n })\n}\n\nStripeACH.prototype = {...BaseGateway.prototype, ...CheckoutGateway.prototype, ...StripeACH.prototype};\n\nnew StripeACH(wc_stripe_ach_connections_params);"],"names":["module","exports","obj","key","value","Object","defineProperty","enumerable","configurable","writable","__esModule","window","__webpack_module_cache__","__webpack_require__","moduleId","cachedModule","undefined","__webpack_modules__","StripeACH","params","BaseGateway","call","this","CheckoutGateway","prototype","initialize","addEventListener","hashchange","bind","$","document","body","on","payment_method_selected","on_order_pay","checkout_place_order","payment_token_received","apply","e","is_gateway_selected","is_change_payment_method","order_id","order_key","preventDefault","create_setup_intent","then","setup_intent","handle_payment_method_setup","client_secret","is_current_page","process_order_pay","handle_next_action","data","stripe","collectBankAccountForPayment","clientSecret","payment_method_type","payment_method_data","billing_details","name","get_customer_name","get_billing_prefix","email","fields","get","paymentIntent","error","submit_error","status","do_payment_confirmation","cancel_payment_processing","collectBankAccountForSetup","setupIntent","do_setup_confirmation","confirmUsBankAccountPayment","code","set_nonce","payment_method","get_form","trigger","process_payment","confirmUsBankAccountSetup","hide_place_order","show_payment_button","show_place_order","container","closest","removeClass","unblock","fees_enabled","Promise","resolve","reject","ajax","method","dataType","gateway_id","url","routes","base_path","replace","beforeSend","ajax_before_send","done","response","message","fail","xhr","textStatus","errorThrown","wc_stripe_ach_connections_params"],"sourceRoot":""}