mirror of
https://github.com/invoiceninja/invoiceninja.git
synced 2024-11-11 21:52:35 +01:00
2 lines
3.3 KiB
JavaScript
2 lines
3.3 KiB
JavaScript
|
!function(n){var r={};function o(e){if(r[e])return r[e].exports;var t=r[e]={i:e,l:!1,exports:{}};return n[e].call(t.exports,t,t.exports,o),t.l=!0,t.exports}o.m=n,o.c=r,o.d=function(e,t,n){o.o(e,t)||Object.defineProperty(e,t,{enumerable:!0,get:n})},o.r=function(e){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},o.t=function(t,e){if(1&e&&(t=o(t)),8&e)return t;if(4&e&&"object"==typeof t&&t&&t.__esModule)return t;var n=Object.create(null);if(o.r(n),Object.defineProperty(n,"default",{enumerable:!0,value:t}),2&e&&"string"!=typeof t)for(var r in t)o.d(n,r,function(e){return t[e]}.bind(null,r));return n},o.n=function(e){var t=e&&e.__esModule?function(){return e.default}:function(){return e};return o.d(t,"a",t),t},o.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},o.p="/",o(o.s=28)}({28:function(e,t,n){e.exports=n("guV3")},guV3:function(e,t){var n;function r(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}function o(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}var i=(r(d.prototype,[{key:"handleSuccess",value:function(e){document.querySelector('input[name="gateway_response"]').value=JSON.stringify(e.paymentIntent),document.getElementById("server-response").submit()}},{key:"handleFailure",value:function(e){var t=document.getElementById("errors");t.textContent="",t.textContent=e,t.hidden=!1,document.getElementById("pay-now").disabled=!1,document.querySelector("#pay-now > svg").classList.add("hidden"),document.querySelector("#pay-now > span").classList.remove("hidden")}}]),d),u=null!==(n=null===(u=document.querySelector('meta[name="stripe-publishable-key"]'))||void 0===u?void 0:u.content)&&void 0!==n?n:"",a=null!==(n=null===(n=document.querySelector('meta[name="stripe-account-id"]'))||void 0===n?void 0:n.content)&&void 0!==n?n:"";function d(e,t){var n=this;!function(e){if(!(e instanceof d))throw new TypeError("Cannot call a class as a function")}(this),o(this,"setupStripe",function(){return n.stripe=Stripe(n.key),n.stripeConnect&&(n.stripe.stripeAccount=a),n}),o(this,"handle",function(){document.getElementById("pay-now").addEventListener("click",e=>{let t=document.getElementById("errors");return""===document.getElementById("acss-name").value?(document.getElementById("acss-name").focus(),t.textContent="Name required.",void(t.hidden=!1)):""===document.getElementById("acss-email-address").value?(document.getElementById("acss-email-address").focus(),t.textContent="Email required.",void(t.hidden=!1)):(document.getElementById("pay-now").disabled=!0,document.querySelector("#pay-now > svg").classList.remove("hidden"),document.querySelector("#pay-now > span").classList.add("hidden"),void this.stripe.confirmAcssDebitPayment(document.querySelector("meta[name=pi-client-secret").content,{payment_method:{billing_details:{name:document.getElementById("acss-name").value,email:document.getElementById("acss-email-address").value}}}).then(e=>e.error?this.handleFailure(e.error.message):this.handleSuccess(e)))})}),this.key=e,this.errors=document.getElementById("errors"),this.stripeConnect=t}new i(u,a).setupStripe().handle()}});
|