1
0
mirror of https://github.com/invoiceninja/invoiceninja.git synced 2024-09-23 09:51:35 +02:00
invoiceninja/public/js/clients/payments/forte-ach-payment.js
2022-07-20 10:08:05 +10:00

2 lines
1.7 KiB
JavaScript
Vendored

/*! For license information please see forte-ach-payment.js.LICENSE.txt */
(()=>{function e(e,n,t){return n in e?Object.defineProperty(e,n,{value:t,enumerable:!0,configurable:!0,writable:!0}):e[n]=t,e}new function n(t){var o=this;!function(e,n){if(!(e instanceof n))throw new TypeError("Cannot call a class as a function")}(this,n),e(this,"handleAuthorization",(function(){var e=document.getElementById("account-number").value,n=document.getElementById("routing-number").value,t={api_login_id:o.apiLoginId,account_number:e,routing_number:n,account_type:"checking"};return document.getElementById("pay-now")&&(document.getElementById("pay-now").disabled=!0,document.querySelector("#pay-now > svg").classList.remove("hidden"),document.querySelector("#pay-now > span").classList.add("hidden")),forte.createToken(t).success(o.successResponseHandler).error(o.failedResponseHandler),!1})),e(this,"successResponseHandler",(function(e){return document.getElementById("payment_token").value=e.onetime_token,document.getElementById("server_response").submit(),!1})),e(this,"failedResponseHandler",(function(e){var n='<div class="alert alert-failure mb-4"><ul><li>'+e.response_description+"</li></ul></div>";return document.getElementById("forte_errors").innerHTML=n,document.getElementById("pay-now").disabled=!1,document.querySelector("#pay-now > svg").classList.add("hidden"),document.querySelector("#pay-now > span").classList.remove("hidden"),!1})),e(this,"handle",(function(){var e=document.getElementById("pay-now");return e&&e.addEventListener("click",(function(e){o.handleAuthorization()})),o})),this.apiLoginId=t}(document.querySelector('meta[name="forte-api-login-id"]').content).handle()})();