mirror of
https://github.com/invoiceninja/invoiceninja.git
synced 2024-11-08 20:22:42 +01:00
Merge pull request #10191 from beganovich/INV2-1639
Preselecting token when available
This commit is contained in:
commit
e4b17ce82e
18
package-lock.json
generated
18
package-lock.json
generated
@ -1,9 +1,10 @@
|
|||||||
{
|
{
|
||||||
"name": "invoiceninja",
|
"name": "@invoiceninja/invoiceninja",
|
||||||
"lockfileVersion": 2,
|
"lockfileVersion": 2,
|
||||||
"requires": true,
|
"requires": true,
|
||||||
"packages": {
|
"packages": {
|
||||||
"": {
|
"": {
|
||||||
|
"name": "@invoiceninja/invoiceninja",
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"axios": "^0.25",
|
"axios": "^0.25",
|
||||||
"card-js": "^1.0.13",
|
"card-js": "^1.0.13",
|
||||||
@ -3570,9 +3571,9 @@
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
"node_modules/caniuse-lite": {
|
"node_modules/caniuse-lite": {
|
||||||
"version": "1.0.30001593",
|
"version": "1.0.30001669",
|
||||||
"resolved": "https://registry.npmjs.org/caniuse-lite/-/caniuse-lite-1.0.30001593.tgz",
|
"resolved": "https://registry.npmjs.org/caniuse-lite/-/caniuse-lite-1.0.30001669.tgz",
|
||||||
"integrity": "sha512-UWM1zlo3cZfkpBysd7AS+z+v007q9G1+fLTUU42rQnY6t2axoogPW/xol6T7juU5EUoOhML4WgBIdG+9yYqAjQ==",
|
"integrity": "sha512-DlWzFDJqstqtIVx1zeSpIMLjunf5SmwOw0N2Ck/QSQdS8PLS4+9HrLaYei4w8BIAL7IB/UEDu889d8vhCTPA0w==",
|
||||||
"funding": [
|
"funding": [
|
||||||
{
|
{
|
||||||
"type": "opencollective",
|
"type": "opencollective",
|
||||||
@ -3586,7 +3587,8 @@
|
|||||||
"type": "github",
|
"type": "github",
|
||||||
"url": "https://github.com/sponsors/ai"
|
"url": "https://github.com/sponsors/ai"
|
||||||
}
|
}
|
||||||
]
|
],
|
||||||
|
"license": "CC-BY-4.0"
|
||||||
},
|
},
|
||||||
"node_modules/card-js": {
|
"node_modules/card-js": {
|
||||||
"version": "1.0.13",
|
"version": "1.0.13",
|
||||||
@ -13972,9 +13974,9 @@
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
"caniuse-lite": {
|
"caniuse-lite": {
|
||||||
"version": "1.0.30001593",
|
"version": "1.0.30001669",
|
||||||
"resolved": "https://registry.npmjs.org/caniuse-lite/-/caniuse-lite-1.0.30001593.tgz",
|
"resolved": "https://registry.npmjs.org/caniuse-lite/-/caniuse-lite-1.0.30001669.tgz",
|
||||||
"integrity": "sha512-UWM1zlo3cZfkpBysd7AS+z+v007q9G1+fLTUU42rQnY6t2axoogPW/xol6T7juU5EUoOhML4WgBIdG+9yYqAjQ=="
|
"integrity": "sha512-DlWzFDJqstqtIVx1zeSpIMLjunf5SmwOw0N2Ck/QSQdS8PLS4+9HrLaYei4w8BIAL7IB/UEDu889d8vhCTPA0w=="
|
||||||
},
|
},
|
||||||
"card-js": {
|
"card-js": {
|
||||||
"version": "1.0.13",
|
"version": "1.0.13",
|
||||||
|
@ -1,4 +1,5 @@
|
|||||||
{
|
{
|
||||||
|
"name": "@invoiceninja/invoiceninja",
|
||||||
"private": true,
|
"private": true,
|
||||||
"scripts": {
|
"scripts": {
|
||||||
"dev": "vite --host 0.0.0.0",
|
"dev": "vite --host 0.0.0.0",
|
||||||
|
109
public/build/assets/app-021b0210.js
vendored
109
public/build/assets/app-021b0210.js
vendored
File diff suppressed because one or more lines are too long
@ -1,4 +1,4 @@
|
|||||||
var m=Object.defineProperty;var y=(n,e,t)=>e in n?m(n,e,{enumerable:!0,configurable:!0,writable:!0,value:t}):n[e]=t;var o=(n,e,t)=>(y(n,typeof e!="symbol"?e+"":e,t),t);import{i as h,w as g}from"./wait-8f4ae121.js";/**
|
var m=Object.defineProperty;var y=(a,e,t)=>e in a?m(a,e,{enumerable:!0,configurable:!0,writable:!0,value:t}):a[e]=t;var o=(a,e,t)=>(y(a,typeof e!="symbol"?e+"":e,t),t);import{i as g,w as h}from"./wait-8f4ae121.js";/**
|
||||||
* Invoice Ninja (https://invoiceninja.com)
|
* Invoice Ninja (https://invoiceninja.com)
|
||||||
*
|
*
|
||||||
* @link https://github.com/invoiceninja/invoiceninja source repository
|
* @link https://github.com/invoiceninja/invoiceninja source repository
|
||||||
@ -6,4 +6,4 @@ var m=Object.defineProperty;var y=(n,e,t)=>e in n?m(n,e,{enumerable:!0,configura
|
|||||||
* @copyright Copyright (c) 2021. Invoice Ninja LLC (https://invoiceninja.com)
|
* @copyright Copyright (c) 2021. Invoice Ninja LLC (https://invoiceninja.com)
|
||||||
*
|
*
|
||||||
* @license https://www.elastic.co/licensing/elastic-license
|
* @license https://www.elastic.co/licensing/elastic-license
|
||||||
*/class p{constructor(e,t){o(this,"handleAuthorization",()=>{var c,l,s,i;if(this.cvvRequired=="1"&&document.getElementById("cvv").value.length<3){const r=document.getElementById("errors");r&&(r.innerText="CVV is required",r.style.display="block"),document.getElementById("pay-now").disabled=!1,document.querySelector("#pay-now > svg").classList.add("hidden"),document.querySelector("#pay-now > span").classList.remove("hidden");return}var e={};e.clientKey=this.publicKey,e.apiLoginID=this.loginId;var t={};t.cardNumber=(c=this.sc.value("number"))==null?void 0:c.replace(/[^\d]/g,""),t.month=(l=this.sc.value("month"))==null?void 0:l.replace(/[^\d]/g,""),t.year=`20${(s=this.sc.value("year"))==null?void 0:s.replace(/[^\d]/g,"")}`,t.cardCode=(i=this.sc.value("cvv"))==null?void 0:i.replace(/[^\d]/g,"");var a={};return a.authData=e,a.cardData=t,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")),Accept.dispatchData(a,this.responseHandler),!1});o(this,"responseHandler",e=>{if(e.messages.resultCode==="Error"){var t=0;const a=document.getElementById("errors");a&&(a.innerText=`${e.messages.message[t].code}: ${e.messages.message[t].text}`,a.style.display="block"),document.getElementById("pay-now").disabled=!1,document.querySelector("#pay-now > svg").classList.add("hidden"),document.querySelector("#pay-now > span").classList.remove("hidden")}else if(e.messages.resultCode==="Ok"){document.getElementById("dataDescriptor").value=e.opaqueData.dataDescriptor,document.getElementById("dataValue").value=e.opaqueData.dataValue;let a=document.querySelector("input[name=token-billing-checkbox]:checked");a&&(document.getElementById("store_card").value=a.value),document.getElementById("server_response").submit()}return!1});o(this,"handle",()=>{Array.from(document.getElementsByClassName("toggle-payment-with-token")).forEach(a=>a.addEventListener("click",d=>{document.getElementById("save-card--container").style.display="none",document.getElementById("authorize--credit-card-container").style.display="none",document.getElementById("token").value=d.target.dataset.token}));let e=document.getElementById("toggle-payment-with-credit-card");e&&e.addEventListener("click",()=>{document.getElementById("save-card--container").style.display="grid",document.getElementById("authorize--credit-card-container").style.display="flex",document.getElementById("token").value=null});let t=document.getElementById("pay-now");return t&&t.addEventListener("click",a=>{let d=document.getElementById("token");d.value?this.handlePayNowAction(d.value):this.handleAuthorization()}),this});this.publicKey=e,this.loginId=t,this.cardHolderName=document.getElementById("cardholder_name"),this.sc=createSimpleCard({fields:{card:{number:"#number",date:"#date",cvv:"#cvv"}}}),this.sc.mount(),this.cvvRequired=document.querySelector('meta[name="authnet-require-cvv"]').content}handlePayNowAction(e){document.getElementById("pay-now").disabled=!0,document.querySelector("#pay-now > svg").classList.remove("hidden"),document.querySelector("#pay-now > span").classList.add("hidden"),document.getElementById("token").value=e,document.getElementById("server_response").submit()}}function u(){const n=document.querySelector('meta[name="authorize-public-key"]').content,e=document.querySelector('meta[name="authorize-login-id"]').content;new p(n,e).handle()}h()?u():g("#authorize-net-credit-card-payment").then(()=>u());
|
*/class p{constructor(e,t){o(this,"handleAuthorization",()=>{var c,l,s,i;if(this.cvvRequired=="1"&&document.getElementById("cvv").value.length<3){const r=document.getElementById("errors");r&&(r.innerText="CVV is required",r.style.display="block"),document.getElementById("pay-now").disabled=!1,document.querySelector("#pay-now > svg").classList.add("hidden"),document.querySelector("#pay-now > span").classList.remove("hidden");return}var e={};e.clientKey=this.publicKey,e.apiLoginID=this.loginId;var t={};t.cardNumber=(c=this.sc.value("number"))==null?void 0:c.replace(/[^\d]/g,""),t.month=(l=this.sc.value("month"))==null?void 0:l.replace(/[^\d]/g,""),t.year=`20${(s=this.sc.value("year"))==null?void 0:s.replace(/[^\d]/g,"")}`,t.cardCode=(i=this.sc.value("cvv"))==null?void 0:i.replace(/[^\d]/g,"");var n={};return n.authData=e,n.cardData=t,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")),Accept.dispatchData(n,this.responseHandler),!1});o(this,"responseHandler",e=>{if(e.messages.resultCode==="Error"){var t=0;const n=document.getElementById("errors");n&&(n.innerText=`${e.messages.message[t].code}: ${e.messages.message[t].text}`,n.style.display="block"),document.getElementById("pay-now").disabled=!1,document.querySelector("#pay-now > svg").classList.add("hidden"),document.querySelector("#pay-now > span").classList.remove("hidden")}else if(e.messages.resultCode==="Ok"){document.getElementById("dataDescriptor").value=e.opaqueData.dataDescriptor,document.getElementById("dataValue").value=e.opaqueData.dataValue;let n=document.querySelector("input[name=token-billing-checkbox]:checked");n&&(document.getElementById("store_card").value=n.value),document.getElementById("server_response").submit()}return!1});o(this,"handle",()=>{Array.from(document.getElementsByClassName("toggle-payment-with-token")).forEach(n=>n.addEventListener("click",d=>{document.getElementById("save-card--container").style.display="none",document.getElementById("authorize--credit-card-container").style.display="none",document.getElementById("token").value=d.target.dataset.token}));let e=document.getElementById("toggle-payment-with-credit-card");e&&e.addEventListener("click",()=>{document.getElementById("save-card--container").style.display="grid",document.getElementById("authorize--credit-card-container").style.display="flex",document.getElementById("token").value=null});let t=document.getElementById("pay-now");return t&&t.addEventListener("click",n=>{let d=document.getElementById("token");d.value?this.handlePayNowAction(d.value):this.handleAuthorization()}),this});this.publicKey=e,this.loginId=t,this.cardHolderName=document.getElementById("cardholder_name"),this.sc=createSimpleCard({fields:{card:{number:"#number",date:"#date",cvv:"#cvv"}}}),this.sc.mount(),this.cvvRequired=document.querySelector('meta[name="authnet-require-cvv"]').content}handlePayNowAction(e){document.getElementById("pay-now").disabled=!0,document.querySelector("#pay-now > svg").classList.remove("hidden"),document.querySelector("#pay-now > span").classList.add("hidden"),document.getElementById("token").value=e,document.getElementById("server_response").submit()}}function u(){const a=document.querySelector('meta[name="authorize-public-key"]').content,e=document.querySelector('meta[name="authorize-login-id"]').content;new p(a,e).handle();const t=document.querySelectorAll("input.toggle-payment-with-token");t.length>0&&t[0].click()}g()?u():h("#authorize-net-credit-card-payment").then(()=>u());
|
@ -1,4 +1,4 @@
|
|||||||
import{i as l,w as s}from"./wait-8f4ae121.js";/**
|
import{i as c,w as s}from"./wait-8f4ae121.js";/**
|
||||||
* Invoice Ninja (https://invoiceninja.com).
|
* Invoice Ninja (https://invoiceninja.com).
|
||||||
*
|
*
|
||||||
* @link https://github.com/invoiceninja/invoiceninja source repository
|
* @link https://github.com/invoiceninja/invoiceninja source repository
|
||||||
@ -6,4 +6,4 @@ import{i as l,w as s}from"./wait-8f4ae121.js";/**
|
|||||||
* @copyright Copyright (c) 2021. Invoice Ninja LLC (https://invoiceninja.com)
|
* @copyright Copyright (c) 2021. Invoice Ninja LLC (https://invoiceninja.com)
|
||||||
*
|
*
|
||||||
* @license https://www.elastic.co/licensing/elastic-license
|
* @license https://www.elastic.co/licensing/elastic-license
|
||||||
*/class c{initBraintreeDataCollector(){window.braintree.client.create({authorization:document.querySelector("meta[name=client-token]").content},function(t,r){window.braintree.dataCollector.create({client:r,paypal:!0},function(n,e){n||(document.querySelector("input[name=client-data]").value=e.deviceData)})})}mountBraintreePaymentWidget(){window.braintree.dropin.create({authorization:document.querySelector("meta[name=client-token]").content,container:"#dropin-container",threeDSecure:document.querySelector("input[name=threeds_enable]").value.toLowerCase()==="true"},this.handleCallback)}handleCallback(t,r){if(t){console.error(t);return}let n=document.getElementById("pay-now"),e=JSON.parse(document.querySelector("input[name=threeds]").value);n.addEventListener("click",()=>{r.requestPaymentMethod({threeDSecure:{challengeRequested:!0,amount:e.amount,email:e.email,billingAddress:{givenName:e.billingAddress.givenName,surname:e.billingAddress.surname,phoneNumber:e.billingAddress.phoneNumber,streetAddress:e.billingAddress.streetAddress,extendedAddress:e.billingAddress.extendedAddress,locality:e.billingAddress.locality,region:e.billingAddress.region,postalCode:e.billingAddress.postalCode,countryCodeAlpha2:e.billingAddress.countryCodeAlpha2}}},function(i,a){if(i){console.log(i),dropin.clearSelectedPaymentMethod(),alert("There was a problem verifying this card, please contact your merchant");return}if(document.querySelector("input[name=threeds_enable]").value==="true"&&!a.liabilityShifted){console.log("Liability did not shift",a),alert("There was a problem verifying this card, please contact your merchant");return}n.disabled=!0,n.querySelector("svg").classList.remove("hidden"),n.querySelector("span").classList.add("hidden"),document.querySelector("input[name=gateway_response]").value=JSON.stringify(a);let d=document.querySelector('input[name="token-billing-checkbox"]:checked');d&&(document.querySelector('input[name="store_card"]').value=d.value),document.getElementById("server-response").submit()})})}handle(){this.initBraintreeDataCollector(),this.mountBraintreePaymentWidget(),Array.from(document.getElementsByClassName("toggle-payment-with-token")).forEach(r=>r.addEventListener("click",n=>{document.getElementById("dropin-container").classList.add("hidden"),document.getElementById("save-card--container").style.display="none",document.querySelector("input[name=token]").value=n.target.dataset.token,document.getElementById("pay-now-with-token").classList.remove("hidden"),document.getElementById("pay-now").classList.add("hidden")})),document.getElementById("toggle-payment-with-credit-card").addEventListener("click",r=>{document.getElementById("dropin-container").classList.remove("hidden"),document.getElementById("save-card--container").style.display="grid",document.querySelector("input[name=token]").value="",document.getElementById("pay-now-with-token").classList.add("hidden"),document.getElementById("pay-now").classList.remove("hidden")});let t=document.getElementById("pay-now-with-token");t.addEventListener("click",r=>{t.disabled=!0,t.querySelector("svg").classList.remove("hidden"),t.querySelector("span").classList.add("hidden"),document.getElementById("server-response").submit()})}}function o(){new c().handle()}l()?o():s("#braintree-credit-card-payment","meta[name=client-token]").then(()=>o());
|
*/class u{initBraintreeDataCollector(){window.braintree.client.create({authorization:document.querySelector("meta[name=client-token]").content},function(t,r){window.braintree.dataCollector.create({client:r,paypal:!0},function(n,e){n||(document.querySelector("input[name=client-data]").value=e.deviceData)})})}mountBraintreePaymentWidget(){window.braintree.dropin.create({authorization:document.querySelector("meta[name=client-token]").content,container:"#dropin-container",threeDSecure:document.querySelector("input[name=threeds_enable]").value.toLowerCase()==="true"},this.handleCallback)}handleCallback(t,r){if(t){console.error(t);return}let n=document.getElementById("pay-now"),e=JSON.parse(document.querySelector("input[name=threeds]").value);n.addEventListener("click",()=>{r.requestPaymentMethod({threeDSecure:{challengeRequested:!0,amount:e.amount,email:e.email,billingAddress:{givenName:e.billingAddress.givenName,surname:e.billingAddress.surname,phoneNumber:e.billingAddress.phoneNumber,streetAddress:e.billingAddress.streetAddress,extendedAddress:e.billingAddress.extendedAddress,locality:e.billingAddress.locality,region:e.billingAddress.region,postalCode:e.billingAddress.postalCode,countryCodeAlpha2:e.billingAddress.countryCodeAlpha2}}},function(d,i){if(d){console.log(d),dropin.clearSelectedPaymentMethod(),alert("There was a problem verifying this card, please contact your merchant");return}if(document.querySelector("input[name=threeds_enable]").value==="true"&&!i.liabilityShifted){console.log("Liability did not shift",i),alert("There was a problem verifying this card, please contact your merchant");return}n.disabled=!0,n.querySelector("svg").classList.remove("hidden"),n.querySelector("span").classList.add("hidden"),document.querySelector("input[name=gateway_response]").value=JSON.stringify(i);let o=document.querySelector('input[name="token-billing-checkbox"]:checked');o&&(document.querySelector('input[name="store_card"]').value=o.value),document.getElementById("server-response").submit()})})}handle(){this.initBraintreeDataCollector(),this.mountBraintreePaymentWidget(),Array.from(document.getElementsByClassName("toggle-payment-with-token")).forEach(r=>r.addEventListener("click",n=>{document.getElementById("dropin-container").classList.add("hidden"),document.getElementById("save-card--container").style.display="none",document.querySelector("input[name=token]").value=n.target.dataset.token,document.getElementById("pay-now-with-token").classList.remove("hidden"),document.getElementById("pay-now").classList.add("hidden")})),document.getElementById("toggle-payment-with-credit-card").addEventListener("click",r=>{document.getElementById("dropin-container").classList.remove("hidden"),document.getElementById("save-card--container").style.display="grid",document.querySelector("input[name=token]").value="",document.getElementById("pay-now-with-token").classList.add("hidden"),document.getElementById("pay-now").classList.remove("hidden")});let t=document.getElementById("pay-now-with-token");t.addEventListener("click",r=>{t.disabled=!0,t.querySelector("svg").classList.remove("hidden"),t.querySelector("span").classList.add("hidden"),document.getElementById("server-response").submit()})}}function l(){new u().handle();const a=document.querySelectorAll("input.toggle-payment-with-token");a.length>0&&a[0].click()}c()?l():s("#braintree-credit-card-payment","meta[name=client-token]").then(()=>l());
|
@ -1,4 +1,4 @@
|
|||||||
import{i as s,w as u}from"./wait-8f4ae121.js";/**
|
import{i as u,w as m}from"./wait-8f4ae121.js";/**
|
||||||
* Invoice Ninja (https://invoiceninja.com).
|
* Invoice Ninja (https://invoiceninja.com).
|
||||||
*
|
*
|
||||||
* @link https://github.com/invoiceninja/invoiceninja source repository
|
* @link https://github.com/invoiceninja/invoiceninja source repository
|
||||||
@ -6,4 +6,4 @@ import{i as s,w as u}from"./wait-8f4ae121.js";/**
|
|||||||
* @copyright Copyright (c) 2021. Invoice Ninja LLC (https://invoiceninja.com)
|
* @copyright Copyright (c) 2021. Invoice Ninja LLC (https://invoiceninja.com)
|
||||||
*
|
*
|
||||||
* @license https://www.elastic.co/licensing/elastic-license
|
* @license https://www.elastic.co/licensing/elastic-license
|
||||||
*/class a{initBraintreeDataCollector(){window.braintree.client.create({authorization:document.querySelector("meta[name=client-token]").content},function(e,t){window.braintree.dataCollector.create({client:t,paypal:!0},function(n,o){n||(document.querySelector("input[name=client-data]").value=o.deviceData)})})}static getPaymentDetails(){return{flow:"vault"}}static handleErrorMessage(e){let t=document.getElementById("errors");t.innerText=e,t.hidden=!1}handlePaymentWithToken(){Array.from(document.getElementsByClassName("toggle-payment-with-token")).forEach(t=>t.addEventListener("click",n=>{document.getElementById("paypal-button").classList.add("hidden"),document.getElementById("save-card--container").style.display="none",document.querySelector("input[name=token]").value=n.target.dataset.token,document.getElementById("pay-now-with-token").classList.remove("hidden"),document.getElementById("pay-now").classList.add("hidden")}));let e=document.getElementById("pay-now-with-token");e.addEventListener("click",t=>{e.disabled=!0,e.querySelector("svg").classList.remove("hidden"),e.querySelector("span").classList.add("hidden"),document.getElementById("server-response").submit()})}handle(){this.initBraintreeDataCollector(),this.handlePaymentWithToken(),braintree.client.create({authorization:document.querySelector("meta[name=client-token]").content}).then(function(e){return braintree.paypalCheckout.create({client:e})}).then(function(e){return e.loadPayPalSDK({vault:!0}).then(function(t){return paypal.Buttons({fundingSource:paypal.FUNDING.PAYPAL,createBillingAgreement:function(){return t.createPayment(a.getPaymentDetails())},onApprove:function(n,o){return t.tokenizePayment(n).then(function(d){var i,c;(i=document.querySelector("#paypal-button"))==null||i.classList.add("hidden"),(c=document.querySelector("#paypal-spinner"))==null||c.classList.remove("hidden");let r=document.querySelector('input[name="token-billing-checkbox"]:checked');r&&(document.querySelector('input[name="store_card"]').value=r.value),document.querySelector("input[name=gateway_response]").value=JSON.stringify(d),document.getElementById("server-response").submit()})},onCancel:function(n){},onError:function(n){console.log(n.message),a.handleErrorMessage(n.message)}}).render("#paypal-button")})}).catch(function(e){console.log(e.message),a.handleErrorMessage(e.message)})}}function l(){new a().handle()}s()?l():u("#braintree-paypal-payment").then(()=>l());
|
*/class a{initBraintreeDataCollector(){window.braintree.client.create({authorization:document.querySelector("meta[name=client-token]").content},function(e,t){window.braintree.dataCollector.create({client:t,paypal:!0},function(n,r){n||(document.querySelector("input[name=client-data]").value=r.deviceData)})})}static getPaymentDetails(){return{flow:"vault"}}static handleErrorMessage(e){let t=document.getElementById("errors");t.innerText=e,t.hidden=!1}handlePaymentWithToken(){Array.from(document.getElementsByClassName("toggle-payment-with-token")).forEach(t=>t.addEventListener("click",n=>{document.getElementById("paypal-button").classList.add("hidden"),document.getElementById("save-card--container").style.display="none",document.querySelector("input[name=token]").value=n.target.dataset.token,document.getElementById("pay-now-with-token").classList.remove("hidden"),document.getElementById("pay-now").classList.add("hidden")}));let e=document.getElementById("pay-now-with-token");e.addEventListener("click",t=>{e.disabled=!0,e.querySelector("svg").classList.remove("hidden"),e.querySelector("span").classList.add("hidden"),document.getElementById("server-response").submit()})}handle(){this.initBraintreeDataCollector(),this.handlePaymentWithToken(),braintree.client.create({authorization:document.querySelector("meta[name=client-token]").content}).then(function(e){return braintree.paypalCheckout.create({client:e})}).then(function(e){return e.loadPayPalSDK({vault:!0}).then(function(t){return paypal.Buttons({fundingSource:paypal.FUNDING.PAYPAL,createBillingAgreement:function(){return t.createPayment(a.getPaymentDetails())},onApprove:function(n,r){return t.tokenizePayment(n).then(function(d){var l,c;(l=document.querySelector("#paypal-button"))==null||l.classList.add("hidden"),(c=document.querySelector("#paypal-spinner"))==null||c.classList.remove("hidden");let i=document.querySelector('input[name="token-billing-checkbox"]:checked');i&&(document.querySelector('input[name="store_card"]').value=i.value),document.querySelector("input[name=gateway_response]").value=JSON.stringify(d),document.getElementById("server-response").submit()})},onCancel:function(n){},onError:function(n){console.log(n.message),a.handleErrorMessage(n.message)}}).render("#paypal-button")})}).catch(function(e){console.log(e.message),a.handleErrorMessage(e.message)})}}function s(){new a().handle();const o=document.querySelectorAll("input.toggle-payment-with-token");o.length>0&&o[0].click()}u()?s():m("#braintree-paypal-payment").then(()=>s());
|
@ -1,4 +1,4 @@
|
|||||||
import{i as s,w as i}from"./wait-8f4ae121.js";/**
|
import{i,w as c}from"./wait-8f4ae121.js";/**
|
||||||
* Invoice Ninja (https://invoiceninja.com)
|
* Invoice Ninja (https://invoiceninja.com)
|
||||||
*
|
*
|
||||||
* @link https://github.com/invoiceninja/invoiceninja source repository
|
* @link https://github.com/invoiceninja/invoiceninja source repository
|
||||||
@ -6,4 +6,4 @@ import{i as s,w as i}from"./wait-8f4ae121.js";/**
|
|||||||
* @copyright Copyright (c) 2021. Invoice Ninja LLC (https://invoiceninja.com)
|
* @copyright Copyright (c) 2021. Invoice Ninja LLC (https://invoiceninja.com)
|
||||||
*
|
*
|
||||||
* @license https://www.elastic.co/licensing/elastic-license
|
* @license https://www.elastic.co/licensing/elastic-license
|
||||||
*/class a{constructor(){this.tokens=[]}handlePaymentUsingToken(t){document.getElementById("checkout--container").classList.add("hidden"),document.getElementById("pay-now-with-token--container").classList.remove("hidden"),document.getElementById("save-card--container").style.display="none",document.querySelector("input[name=token]").value=t.target.dataset.token}handlePaymentUsingCreditCard(t){document.getElementById("checkout--container").classList.remove("hidden"),document.getElementById("pay-now-with-token--container").classList.add("hidden"),document.getElementById("save-card--container").style.display="grid",document.querySelector("input[name=token]").value="";const e=document.getElementById("pay-button"),d=document.querySelector('meta[name="public-key"]').content??"",o=document.getElementById("payment-form");Frames.init(d),Frames.addEventHandler(Frames.Events.CARD_VALIDATION_CHANGED,function(n){e.disabled=!Frames.isCardValid()}),Frames.addEventHandler(Frames.Events.CARD_TOKENIZATION_FAILED,function(n){e.disabled=!1}),Frames.addEventHandler(Frames.Events.CARD_TOKENIZED,function(n){e.disabled=!0,document.querySelector('input[name="gateway_response"]').value=JSON.stringify(n),document.querySelector('input[name="store_card"]').value=document.querySelector("input[name=token-billing-checkbox]:checked").value,document.getElementById("server-response").submit()}),o.addEventListener("submit",function(n){n.preventDefault(),e.disabled=!0,Frames.submitCard()})}completePaymentUsingToken(t){let e=document.getElementById("pay-now-with-token");e.disabled=!0,e.querySelector("svg").classList.remove("hidden"),e.querySelector("span").classList.add("hidden"),document.getElementById("server-response").submit()}handle(){this.handlePaymentUsingCreditCard(),Array.from(document.getElementsByClassName("toggle-payment-with-token")).forEach(t=>t.addEventListener("click",this.handlePaymentUsingToken)),document.getElementById("toggle-payment-with-credit-card").addEventListener("click",this.handlePaymentUsingCreditCard),document.getElementById("pay-now-with-token").addEventListener("click",this.completePaymentUsingToken)}}function r(){new a().handle()}s()?r():i("#checkout-credit-card-payment").then(()=>new a().handle());
|
*/class r{constructor(){this.tokens=[]}handlePaymentUsingToken(t){document.getElementById("checkout--container").classList.add("hidden"),document.getElementById("pay-now-with-token--container").classList.remove("hidden"),document.getElementById("save-card--container").style.display="none",document.querySelector("input[name=token]").value=t.target.dataset.token}handlePaymentUsingCreditCard(t){document.getElementById("checkout--container").classList.remove("hidden"),document.getElementById("pay-now-with-token--container").classList.add("hidden"),document.getElementById("save-card--container").style.display="grid",document.querySelector("input[name=token]").value="";const e=document.getElementById("pay-button"),o=document.querySelector('meta[name="public-key"]').content??"",s=document.getElementById("payment-form");Frames.init(o),Frames.addEventHandler(Frames.Events.CARD_VALIDATION_CHANGED,function(n){e.disabled=!Frames.isCardValid()}),Frames.addEventHandler(Frames.Events.CARD_TOKENIZATION_FAILED,function(n){e.disabled=!1}),Frames.addEventHandler(Frames.Events.CARD_TOKENIZED,function(n){e.disabled=!0,document.querySelector('input[name="gateway_response"]').value=JSON.stringify(n),document.querySelector('input[name="store_card"]').value=document.querySelector("input[name=token-billing-checkbox]:checked").value,document.getElementById("server-response").submit()}),s.addEventListener("submit",function(n){n.preventDefault(),e.disabled=!0,Frames.submitCard()})}completePaymentUsingToken(t){let e=document.getElementById("pay-now-with-token");e.disabled=!0,e.querySelector("svg").classList.remove("hidden"),e.querySelector("span").classList.add("hidden"),document.getElementById("server-response").submit()}handle(){this.handlePaymentUsingCreditCard(),Array.from(document.getElementsByClassName("toggle-payment-with-token")).forEach(t=>t.addEventListener("click",this.handlePaymentUsingToken)),document.getElementById("toggle-payment-with-credit-card").addEventListener("click",this.handlePaymentUsingCreditCard),document.getElementById("pay-now-with-token").addEventListener("click",this.completePaymentUsingToken)}}function d(){new r().handle();const a=document.querySelectorAll("input.toggle-payment-with-token");a.length>0&&a[0].click()}i()?d():c("#checkout-credit-card-payment").then(()=>d());
|
File diff suppressed because one or more lines are too long
@ -1,4 +1,4 @@
|
|||||||
import{i as d,w as l}from"./wait-8f4ae121.js";/**
|
import{i as l,w as c}from"./wait-8f4ae121.js";/**
|
||||||
* Invoice Ninja (https://invoiceninja.com).
|
* Invoice Ninja (https://invoiceninja.com).
|
||||||
*
|
*
|
||||||
* @link https://github.com/invoiceninja/invoiceninja source repository
|
* @link https://github.com/invoiceninja/invoiceninja source repository
|
||||||
@ -6,4 +6,4 @@ import{i as d,w as l}from"./wait-8f4ae121.js";/**
|
|||||||
* @copyright Copyright (c) 2021. Invoice Ninja LLC (https://invoiceninja.com)
|
* @copyright Copyright (c) 2021. Invoice Ninja LLC (https://invoiceninja.com)
|
||||||
*
|
*
|
||||||
* @license https://www.elastic.co/licensing/elastic-license
|
* @license https://www.elastic.co/licensing/elastic-license
|
||||||
*/class c{constructor(){var e,t;this.mollie=Mollie((e=document.querySelector("meta[name=mollie-profileId]"))==null?void 0:e.content,{testmode:(t=document.querySelector("meta[name=mollie-testmode]"))==null?void 0:t.content,locale:"en_US"})}createCardHolderInput(){let e=this.mollie.createComponent("cardHolder");e.mount("#card-holder");let t=document.getElementById("card-holder-error");return e.addEventListener("change",function(n){n.error&&n.touched?t.textContent=n.error:t.textContent=""}),this}createCardNumberInput(){let e=this.mollie.createComponent("cardNumber");e.mount("#card-number");let t=document.getElementById("card-number-error");return e.addEventListener("change",function(n){n.error&&n.touched?t.textContent=n.error:t.textContent=""}),this}createExpiryDateInput(){let e=this.mollie.createComponent("expiryDate");e.mount("#expiry-date");let t=document.getElementById("expiry-date-error");return e.addEventListener("change",function(n){n.error&&n.touched?t.textContent=n.error:t.textContent=""}),this}createCvvInput(){let e=this.mollie.createComponent("verificationCode");e.mount("#cvv");let t=document.getElementById("cvv-error");return e.addEventListener("change",function(n){n.error&&n.touched?t.textContent=n.error:t.textContent=""}),this}handlePayNowButton(){if(document.getElementById("pay-now").disabled=!0,document.querySelector("input[name=token]").value!=="")return document.querySelector("input[name=gateway_response]").value="",document.getElementById("server-response").submit();this.mollie.createToken().then(function(e){let t=e.token,n=e.error;if(n){document.getElementById("pay-now").disabled=!1;let o=document.getElementById("errors");o.innerText=n.message,o.hidden=!1;return}let r=document.querySelector('input[name="token-billing-checkbox"]:checked');r&&(document.querySelector('input[name="store_card"]').value=r.value),document.querySelector("input[name=gateway_response]").value=t,document.querySelector("input[name=token]").value="",document.getElementById("server-response").submit()})}handle(){this.createCardHolderInput().createCardNumberInput().createExpiryDateInput().createCvvInput(),Array.from(document.getElementsByClassName("toggle-payment-with-token")).forEach(e=>e.addEventListener("click",t=>{document.getElementById("mollie--payment-container").classList.add("hidden"),document.getElementById("save-card--container").style.display="none",document.querySelector("input[name=token]").value=t.target.dataset.token})),document.getElementById("toggle-payment-with-credit-card").addEventListener("click",e=>{document.getElementById("mollie--payment-container").classList.remove("hidden"),document.getElementById("save-card--container").style.display="grid",document.querySelector("input[name=token]").value=""}),document.getElementById("pay-now").addEventListener("click",()=>this.handlePayNowButton())}}function a(){new c().handle()}d()?a():l("#mollie-credit-card-payment").then(()=>a());
|
*/class i{constructor(){var e,t;this.mollie=Mollie((e=document.querySelector("meta[name=mollie-profileId]"))==null?void 0:e.content,{testmode:(t=document.querySelector("meta[name=mollie-testmode]"))==null?void 0:t.content,locale:"en_US"})}createCardHolderInput(){let e=this.mollie.createComponent("cardHolder");e.mount("#card-holder");let t=document.getElementById("card-holder-error");return e.addEventListener("change",function(n){n.error&&n.touched?t.textContent=n.error:t.textContent=""}),this}createCardNumberInput(){let e=this.mollie.createComponent("cardNumber");e.mount("#card-number");let t=document.getElementById("card-number-error");return e.addEventListener("change",function(n){n.error&&n.touched?t.textContent=n.error:t.textContent=""}),this}createExpiryDateInput(){let e=this.mollie.createComponent("expiryDate");e.mount("#expiry-date");let t=document.getElementById("expiry-date-error");return e.addEventListener("change",function(n){n.error&&n.touched?t.textContent=n.error:t.textContent=""}),this}createCvvInput(){let e=this.mollie.createComponent("verificationCode");e.mount("#cvv");let t=document.getElementById("cvv-error");return e.addEventListener("change",function(n){n.error&&n.touched?t.textContent=n.error:t.textContent=""}),this}handlePayNowButton(){if(document.getElementById("pay-now").disabled=!0,document.querySelector("input[name=token]").value!=="")return document.querySelector("input[name=gateway_response]").value="",document.getElementById("server-response").submit();this.mollie.createToken().then(function(e){let t=e.token,n=e.error;if(n){document.getElementById("pay-now").disabled=!1;let a=document.getElementById("errors");a.innerText=n.message,a.hidden=!1;return}let o=document.querySelector('input[name="token-billing-checkbox"]:checked');o&&(document.querySelector('input[name="store_card"]').value=o.value),document.querySelector("input[name=gateway_response]").value=t,document.querySelector("input[name=token]").value="",document.getElementById("server-response").submit()})}handle(){this.createCardHolderInput().createCardNumberInput().createExpiryDateInput().createCvvInput(),Array.from(document.getElementsByClassName("toggle-payment-with-token")).forEach(e=>e.addEventListener("click",t=>{document.getElementById("mollie--payment-container").classList.add("hidden"),document.getElementById("save-card--container").style.display="none",document.querySelector("input[name=token]").value=t.target.dataset.token})),document.getElementById("toggle-payment-with-credit-card").addEventListener("click",e=>{document.getElementById("mollie--payment-container").classList.remove("hidden"),document.getElementById("save-card--container").style.display="grid",document.querySelector("input[name=token]").value=""}),document.getElementById("pay-now").addEventListener("click",()=>this.handlePayNowButton())}}function d(){new i().handle();const r=document.querySelectorAll("input.toggle-payment-with-token");r.length>0&&r[0].click()}l()?d():c("#mollie-credit-card-payment").then(()=>d());
|
@ -1,4 +1,4 @@
|
|||||||
import{i as o,w as i}from"./wait-8f4ae121.js";/**
|
import{i,w as l}from"./wait-8f4ae121.js";/**
|
||||||
* Invoice Ninja (https://invoiceninja.com).
|
* Invoice Ninja (https://invoiceninja.com).
|
||||||
*
|
*
|
||||||
* @link https://github.com/invoiceninja/invoiceninja source repository
|
* @link https://github.com/invoiceninja/invoiceninja source repository
|
||||||
@ -6,4 +6,4 @@ import{i as o,w as i}from"./wait-8f4ae121.js";/**
|
|||||||
* @copyright Copyright (c) 2021. Invoice Ninja LLC (https://invoiceninja.com)
|
* @copyright Copyright (c) 2021. Invoice Ninja LLC (https://invoiceninja.com)
|
||||||
*
|
*
|
||||||
* @license https://www.elastic.co/licensing/elastic-license
|
* @license https://www.elastic.co/licensing/elastic-license
|
||||||
*/class l{constructor(){var t;this.clientKey=(t=document.querySelector("meta[name=paytrace-client-key]"))==null?void 0:t.content}get creditCardStyles(){return{font_color:"#000",border_color:"#a1b1c9",border_style:"dotted",font_size:"13pt",input_border_radius:"3px",input_border_width:"1px",input_font:"Times New Roman, arial, fantasy",input_font_weight:"400",input_margin:"5px 0px 5px 0px",input_padding:"0px 5px 0px 5px",label_color:"#a0aec0",label_size:"16px",label_width:"150px",label_font:"Times New Roman, sans-serif, serif",label_font_weight:"light",label_margin:"5px 0px 0px 0px",label_padding:"0px 5px 0px 5px",background_color:"white",height:"30px",width:"370px",padding_bottom:"0px"}}get codeStyles(){return{font_color:"#000",border_color:"#a1b1c9",border_style:"dotted",font_size:"13pt",input_border_radius:"2px",input_border_width:"1px",input_font:"serif, cursive, fantasy",input_font_weight:"700",input_margin:"5px 0px 5px 20px",input_padding:"0px 5px 0px 5px",label_color:"#a0aec0",label_size:"16px",label_width:"150px",label_font:"sans-serif, arial, serif",label_font_weight:"bold",label_margin:"5px 0px 0px 20px",label_padding:"2px 5px 2px 5px",background_color:"white",height:"30px",width:"150px",padding_bottom:"2px"}}get expStyles(){return{font_color:"#000",border_color:"#a1b1c9",border_style:"dashed",font_size:"12pt",input_border_radius:"0px",input_border_width:"2px",input_font:"arial, cursive, fantasy",input_font_weight:"400",input_margin:"5px 0px 5px 0px",input_padding:"0px 5px 0px 5px",label_color:"#a0aec0",label_size:"16px",label_width:"150px",label_font:"arial, fantasy, serif",label_font_weight:"normal",label_margin:"5px 0px 0px 0px",label_padding:"2px 5px 2px 5px",background_color:"white",height:"30px",width:"85px",padding_bottom:"2px",type:"dropdown"}}updatePayTraceLabels(){window.PTPayment.getControl("securityCode").label.text(document.querySelector("meta[name=ctrans-cvv]").content),window.PTPayment.getControl("creditCard").label.text(document.querySelector("meta[name=ctrans-card_number]").content),window.PTPayment.getControl("expiration").label.text(document.querySelector("meta[name=ctrans-expires]").content)}setupPayTrace(){return window.PTPayment.setup({styles:{code:this.codeStyles,cc:this.creditCardStyles,exp:this.expStyles},authorization:{clientKey:this.clientKey}})}handlePaymentWithCreditCard(t){const e=document.getElementById("pay-now");e.querySelector("svg").classList.remove("hidden"),e.querySelector("span").classList.add("hidden"),t.target.parentElement.disabled=!0,document.getElementById("errors").hidden=!0,window.PTPayment.validate(a=>{if(a.length>=1){let n=document.getElementById("errors");return n.textContent=a[0].description,n.hidden=!1,e.querySelector("svg").classList.add("hidden"),e.querySelector("span").classList.remove("hidden"),t.target.parentElement.disabled=!1}this.ptInstance.process().then(n=>{document.getElementById("HPF_Token").value=n.message.hpf_token,document.getElementById("enc_key").value=n.message.enc_key;let r=document.querySelector('input[name="token-billing-checkbox"]:checked');r&&(document.querySelector('input[name="store_card"]').value=r.value),document.getElementById("server_response").submit()}).catch(n=>{document.getElementById("errors").textContent=JSON.stringify(n),document.getElementById("errors").hidden=!1,e.querySelector("svg").classList.add("hidden"),e.querySelector("span").classList.remove("hidden"),console.log(n)})})}handlePaymentWithToken(t){t.target.parentElement.disabled=!0;const e=document.getElementById("pay-now");e.querySelector("svg").classList.remove("hidden"),e.querySelector("span").classList.add("hidden"),document.getElementById("server_response").submit()}handle(){var t;Array.from(document.getElementsByClassName("toggle-payment-with-token")).forEach(e=>e.addEventListener("click",a=>{document.getElementById("paytrace--credit-card-container").classList.add("hidden"),document.getElementById("save-card--container").style.display="none",document.querySelector("input[name=token]").value=a.target.dataset.token})),(t=document.getElementById("toggle-payment-with-credit-card"))==null||t.addEventListener("click",e=>{document.getElementById("paytrace--credit-card-container").classList.remove("hidden"),document.getElementById("save-card--container").style.display="grid",document.querySelector("input[name=token]").value="",this.setupPayTrace().then(a=>{this.ptInstance=a,this.updatePayTraceLabels()})}),document.getElementById("pay-now").addEventListener("click",e=>document.querySelector("input[name=token]").value===""?this.handlePaymentWithCreditCard(e):this.handlePaymentWithToken(e)),Array.from(document.getElementsByClassName("toggle-payment-with-token")).length===0&&!o()&&document.getElementById("toggle-payment-with-credit-card").click()}}function d(){new l().handle()}o()?d():i("#paytrace-credit-card-payment").then(()=>d());
|
*/class c{constructor(){var t;this.clientKey=(t=document.querySelector("meta[name=paytrace-client-key]"))==null?void 0:t.content}get creditCardStyles(){return{font_color:"#000",border_color:"#a1b1c9",border_style:"dotted",font_size:"13pt",input_border_radius:"3px",input_border_width:"1px",input_font:"Times New Roman, arial, fantasy",input_font_weight:"400",input_margin:"5px 0px 5px 0px",input_padding:"0px 5px 0px 5px",label_color:"#a0aec0",label_size:"16px",label_width:"150px",label_font:"Times New Roman, sans-serif, serif",label_font_weight:"light",label_margin:"5px 0px 0px 0px",label_padding:"0px 5px 0px 5px",background_color:"white",height:"30px",width:"370px",padding_bottom:"0px"}}get codeStyles(){return{font_color:"#000",border_color:"#a1b1c9",border_style:"dotted",font_size:"13pt",input_border_radius:"2px",input_border_width:"1px",input_font:"serif, cursive, fantasy",input_font_weight:"700",input_margin:"5px 0px 5px 20px",input_padding:"0px 5px 0px 5px",label_color:"#a0aec0",label_size:"16px",label_width:"150px",label_font:"sans-serif, arial, serif",label_font_weight:"bold",label_margin:"5px 0px 0px 20px",label_padding:"2px 5px 2px 5px",background_color:"white",height:"30px",width:"150px",padding_bottom:"2px"}}get expStyles(){return{font_color:"#000",border_color:"#a1b1c9",border_style:"dashed",font_size:"12pt",input_border_radius:"0px",input_border_width:"2px",input_font:"arial, cursive, fantasy",input_font_weight:"400",input_margin:"5px 0px 5px 0px",input_padding:"0px 5px 0px 5px",label_color:"#a0aec0",label_size:"16px",label_width:"150px",label_font:"arial, fantasy, serif",label_font_weight:"normal",label_margin:"5px 0px 0px 0px",label_padding:"2px 5px 2px 5px",background_color:"white",height:"30px",width:"85px",padding_bottom:"2px",type:"dropdown"}}updatePayTraceLabels(){window.PTPayment.getControl("securityCode").label.text(document.querySelector("meta[name=ctrans-cvv]").content),window.PTPayment.getControl("creditCard").label.text(document.querySelector("meta[name=ctrans-card_number]").content),window.PTPayment.getControl("expiration").label.text(document.querySelector("meta[name=ctrans-expires]").content)}setupPayTrace(){return window.PTPayment.setup({styles:{code:this.codeStyles,cc:this.creditCardStyles,exp:this.expStyles},authorization:{clientKey:this.clientKey}})}handlePaymentWithCreditCard(t){const e=document.getElementById("pay-now");e.querySelector("svg").classList.remove("hidden"),e.querySelector("span").classList.add("hidden"),t.target.parentElement.disabled=!0,document.getElementById("errors").hidden=!0,window.PTPayment.validate(a=>{if(a.length>=1){let n=document.getElementById("errors");return n.textContent=a[0].description,n.hidden=!1,e.querySelector("svg").classList.add("hidden"),e.querySelector("span").classList.remove("hidden"),t.target.parentElement.disabled=!1}this.ptInstance.process().then(n=>{document.getElementById("HPF_Token").value=n.message.hpf_token,document.getElementById("enc_key").value=n.message.enc_key;let o=document.querySelector('input[name="token-billing-checkbox"]:checked');o&&(document.querySelector('input[name="store_card"]').value=o.value),document.getElementById("server_response").submit()}).catch(n=>{document.getElementById("errors").textContent=JSON.stringify(n),document.getElementById("errors").hidden=!1,e.querySelector("svg").classList.add("hidden"),e.querySelector("span").classList.remove("hidden"),console.log(n)})})}handlePaymentWithToken(t){t.target.parentElement.disabled=!0;const e=document.getElementById("pay-now");e.querySelector("svg").classList.remove("hidden"),e.querySelector("span").classList.add("hidden"),document.getElementById("server_response").submit()}handle(){var t;Array.from(document.getElementsByClassName("toggle-payment-with-token")).forEach(e=>e.addEventListener("click",a=>{document.getElementById("paytrace--credit-card-container").classList.add("hidden"),document.getElementById("save-card--container").style.display="none",document.querySelector("input[name=token]").value=a.target.dataset.token})),(t=document.getElementById("toggle-payment-with-credit-card"))==null||t.addEventListener("click",e=>{document.getElementById("paytrace--credit-card-container").classList.remove("hidden"),document.getElementById("save-card--container").style.display="grid",document.querySelector("input[name=token]").value="",this.setupPayTrace().then(a=>{this.ptInstance=a,this.updatePayTraceLabels()})}),document.getElementById("pay-now").addEventListener("click",e=>document.querySelector("input[name=token]").value===""?this.handlePaymentWithCreditCard(e):this.handlePaymentWithToken(e)),Array.from(document.getElementsByClassName("toggle-payment-with-token")).length===0&&!i()&&document.getElementById("toggle-payment-with-credit-card").click()}}function d(){new c().handle();const r=document.querySelectorAll("input.toggle-payment-with-token");r.length>0&&r[0].click()}i()?d():l("#paytrace-credit-card-payment").then(()=>d());
|
@ -6,7 +6,7 @@ import{i as l,w as m}from"./wait-8f4ae121.js";/**
|
|||||||
* @copyright Copyright (c) 2024. Invoice Ninja LLC (https://invoiceninja.com)
|
* @copyright Copyright (c) 2024. Invoice Ninja LLC (https://invoiceninja.com)
|
||||||
*
|
*
|
||||||
* @license https://www.elastic.co/licensing/elastic-license
|
* @license https://www.elastic.co/licensing/elastic-license
|
||||||
*/let u=!1;function y(){const t=document.querySelector("meta[name=public_key]"),e=document.querySelector("meta[name=gateway_id]"),r=document.querySelector("meta[name=environment]"),n=document.querySelector("meta[name=supported_cards]"),o=new cba.HtmlWidget("#widget",t==null?void 0:t.content,e==null?void 0:e.content);if(o.setEnv(r==null?void 0:r.content),o.useAutoResize(),n!=null&&n.content)try{const a=JSON.parse(n.content);o.setSupportedCardIcons(a,!0)}catch{}o.interceptSubmitForm("#stepone"),o.onFinishInsert('#server-response input[name="gateway_response"]',"payment_source"),o.setFormFields(["card_name*"]),o.reload();let d=document.getElementById("pay-now");return d.disabled=!1,d.querySelector("svg").classList.add("hidden"),d.querySelector("span").classList.remove("hidden"),document.querySelector('#server-response input[name="gateway_response"]').value="",o}function g(){var t,e,r;(t=document.querySelector("#widget"))==null||t.replaceChildren(),(e=document.querySelector("#widget"))==null||e.classList.remove("hidden"),(r=document.querySelector("#widget-3dsecure"))==null||r.replaceChildren()}function s(){var o,d;if(g(),!((o=document.querySelector("meta[name=gateway_id]"))==null?void 0:o.content)){let a=document.getElementById("pay-now");a.disabled=!0,a.querySelector("svg").classList.remove("hidden"),a.querySelector("span").classList.add("hidden"),document.getElementById("errors").textContent="Gateway not found or verified",document.getElementById("errors").hidden=!1}const e=y();e.on("finish",()=>{document.getElementById("errors").hidden=!0,p()}),e.on("submit",function(a){document.getElementById("errors").hidden=!0});let r=document.getElementById("pay-now");r.addEventListener("click",()=>{const a=document.getElementById("widget");if(e.getValidationState(),!e.isValidForm()&&a.offsetParent!==null){r.disabled=!1,r.querySelector("svg").classList.add("hidden"),r.querySelector("span").classList.remove("hidden");return}r.disabled=!0,r.querySelector("svg").classList.remove("hidden"),r.querySelector("span").classList.add("hidden");let c=document.querySelector("input[name=token-billing-checkbox]:checked");c&&(document.getElementById("store_card").value=c.value),a.offsetParent!==null?document.getElementById("stepone_submit").click():document.getElementById("server-response").submit()}),document.getElementById("toggle-payment-with-credit-card").addEventListener("click",a=>{var i;document.getElementById("widget").classList.remove("hidden"),document.getElementById("save-card--container").style.display="grid",document.querySelector("input[name=token]").value="",(i=document.querySelector("#powerboard-payment-container"))==null||i.classList.remove("hidden")}),Array.from(document.getElementsByClassName("toggle-payment-with-token")).forEach(a=>a.addEventListener("click",c=>{var i;document.getElementById("widget").classList.add("hidden"),document.getElementById("save-card--container").style.display="none",document.querySelector("input[name=token]").value=c.target.dataset.token,(i=document.querySelector("#powerboard-payment-container"))==null||i.classList.add("hidden")}));const n=document.querySelector('input[name="payment-type"]');n&&n.click(),u&&((d=document.getElementById("toggle-payment-with-credit-card"))==null||d.click())}async function p(){try{const t=await h();if(!t||!t.status||t.status==="not_authenticated"||t==="not_authenticated")throw u=!0,s(),new Error("There was an issue authenticating this payment method.");if(t.status==="authentication_not_supported"){document.querySelector('input[name="browser_details"]').value=null,document.querySelector('input[name="charge"]').value=JSON.stringify(t);let n=document.querySelector("input[name=token-billing-checkbox]:checked");return n&&(document.getElementById("store_card").value=n.value),document.getElementById("server-response").submit()}const e=new cba.Canvas3ds("#widget-3dsecure",t._3ds.token);e.load(),document.getElementById("widget").classList.add("hidden"),e.on("chargeAuthSuccess",function(n){document.querySelector('input[name="browser_details"]').value=null,document.querySelector('input[name="charge"]').value=JSON.stringify(n);let o=document.querySelector("input[name=token-billing-checkbox]:checked");o&&(document.getElementById("store_card").value=o.value),document.getElementById("server-response").submit()}),e.on("chargeAuthReject",function(n){document.getElementById("errors").textContent="Sorry, your transaction could not be processed...",document.getElementById("errors").hidden=!1,u=!0,s()}),e.load()}catch(t){const e=t.message??"Unknown error.";document.getElementById("errors").textContent=`Sorry, your transaction could not be processed...
|
*/let u=!1;function y(){const t=document.querySelector("meta[name=public_key]"),e=document.querySelector("meta[name=gateway_id]"),r=document.querySelector("meta[name=environment]"),n=document.querySelector("meta[name=supported_cards]"),o=new cba.HtmlWidget("#widget",t==null?void 0:t.content,e==null?void 0:e.content);if(o.setEnv(r==null?void 0:r.content),o.useAutoResize(),n!=null&&n.content)try{const a=JSON.parse(n.content);o.setSupportedCardIcons(a,!0)}catch{}o.interceptSubmitForm("#stepone"),o.onFinishInsert('#server-response input[name="gateway_response"]',"payment_source"),o.setFormFields(["card_name*"]),o.reload();let d=document.getElementById("pay-now");return d.disabled=!1,d.querySelector("svg").classList.add("hidden"),d.querySelector("span").classList.remove("hidden"),document.querySelector('#server-response input[name="gateway_response"]').value="",o}function g(){var t,e,r;(t=document.querySelector("#widget"))==null||t.replaceChildren(),(e=document.querySelector("#widget"))==null||e.classList.remove("hidden"),(r=document.querySelector("#widget-3dsecure"))==null||r.replaceChildren()}function s(){var o,d;if(g(),!((o=document.querySelector("meta[name=gateway_id]"))==null?void 0:o.content)){let a=document.getElementById("pay-now");a.disabled=!0,a.querySelector("svg").classList.remove("hidden"),a.querySelector("span").classList.add("hidden"),document.getElementById("errors").textContent="Gateway not found or verified",document.getElementById("errors").hidden=!1}const e=y();e.on("finish",()=>{document.getElementById("errors").hidden=!0,p()}),e.on("submit",function(a){document.getElementById("errors").hidden=!0});let r=document.getElementById("pay-now");r.addEventListener("click",()=>{const a=document.getElementById("widget");if(e.getValidationState(),!e.isValidForm()&&a.offsetParent!==null){r.disabled=!1,r.querySelector("svg").classList.add("hidden"),r.querySelector("span").classList.remove("hidden");return}r.disabled=!0,r.querySelector("svg").classList.remove("hidden"),r.querySelector("span").classList.add("hidden");let c=document.querySelector("input[name=token-billing-checkbox]:checked");c&&(document.getElementById("store_card").value=c.value),a.offsetParent!==null?document.getElementById("stepone_submit").click():document.getElementById("server-response").submit()}),document.getElementById("toggle-payment-with-credit-card").addEventListener("click",a=>{var i;document.getElementById("widget").classList.remove("hidden"),document.getElementById("save-card--container").style.display="grid",document.querySelector("input[name=token]").value="",(i=document.querySelector("#powerboard-payment-container"))==null||i.classList.remove("hidden")}),Array.from(document.getElementsByClassName("toggle-payment-with-token")).forEach(a=>a.addEventListener("click",c=>{var i;document.getElementById("widget").classList.add("hidden"),document.getElementById("save-card--container").style.display="none",document.querySelector("input[name=token]").value=c.target.dataset.token,(i=document.querySelector("#powerboard-payment-container"))==null||i.classList.add("hidden")}));const n=document.querySelectorAll("input.toggle-payment-with-token");n.length>0&&n[0].click(),u&&((d=document.getElementById("toggle-payment-with-credit-card"))==null||d.click())}async function p(){try{const t=await h();if(!t||!t.status||t.status==="not_authenticated"||t==="not_authenticated")throw u=!0,s(),new Error("There was an issue authenticating this payment method.");if(t.status==="authentication_not_supported"){document.querySelector('input[name="browser_details"]').value=null,document.querySelector('input[name="charge"]').value=JSON.stringify(t);let n=document.querySelector("input[name=token-billing-checkbox]:checked");return n&&(document.getElementById("store_card").value=n.value),document.getElementById("server-response").submit()}const e=new cba.Canvas3ds("#widget-3dsecure",t._3ds.token);e.load(),document.getElementById("widget").classList.add("hidden"),e.on("chargeAuthSuccess",function(n){document.querySelector('input[name="browser_details"]').value=null,document.querySelector('input[name="charge"]').value=JSON.stringify(n);let o=document.querySelector("input[name=token-billing-checkbox]:checked");o&&(document.getElementById("store_card").value=o.value),document.getElementById("server-response").submit()}),e.on("chargeAuthReject",function(n){document.getElementById("errors").textContent="Sorry, your transaction could not be processed...",document.getElementById("errors").hidden=!1,u=!0,s()}),e.load()}catch(t){const e=t.message??"Unknown error.";document.getElementById("errors").textContent=`Sorry, your transaction could not be processed...
|
||||||
|
|
||||||
${e}`,document.getElementById("errors").hidden=!1,u=!0,s()}}async function h(){const t={name:navigator.userAgent.substring(0,100),java_enabled:navigator.javaEnabled()?"true":"false",language:navigator.language||navigator.userLanguage,screen_height:window.screen.height.toString(),screen_width:window.screen.width.toString(),time_zone:(new Date().getTimezoneOffset()*-1).toString(),color_depth:window.screen.colorDepth.toString()};document.querySelector('input[name="browser_details"]').value=JSON.stringify(t);const e=JSON.stringify(Object.fromEntries(new FormData(document.getElementById("server-response")))),r=document.querySelector("meta[name=payments_route]");try{const n=await fetch(r.content,{method:"POST",headers:{"Content-Type":"application/json","X-Requested-With":"XMLHttpRequest",Accept:"application/json","X-CSRF-Token":document.querySelector('meta[name="csrf-token"]').content},body:e});return n.ok?await n.json():await n.json().then(o=>{throw new Error(o.message??"Unknown error.")})}catch(n){document.getElementById("errors").textContent=`Sorry, your transaction could not be processed...
|
${e}`,document.getElementById("errors").hidden=!1,u=!0,s()}}async function h(){const t={name:navigator.userAgent.substring(0,100),java_enabled:navigator.javaEnabled()?"true":"false",language:navigator.language||navigator.userLanguage,screen_height:window.screen.height.toString(),screen_width:window.screen.width.toString(),time_zone:(new Date().getTimezoneOffset()*-1).toString(),color_depth:window.screen.colorDepth.toString()};document.querySelector('input[name="browser_details"]').value=JSON.stringify(t);const e=JSON.stringify(Object.fromEntries(new FormData(document.getElementById("server-response")))),r=document.querySelector("meta[name=payments_route]");try{const n=await fetch(r.content,{method:"POST",headers:{"Content-Type":"application/json","X-Requested-With":"XMLHttpRequest",Accept:"application/json","X-CSRF-Token":document.querySelector('meta[name="csrf-token"]').content},body:e});return n.ok?await n.json():await n.json().then(o=>{throw new Error(o.message??"Unknown error.")})}catch(n){document.getElementById("errors").textContent=`Sorry, your transaction could not be processed...
|
||||||
|
|
@ -1,4 +1,4 @@
|
|||||||
import{i as c,w as d}from"./wait-8f4ae121.js";/**
|
import{i as s,w as d}from"./wait-8f4ae121.js";/**
|
||||||
* Invoice Ninja (https://invoiceninja.com).
|
* Invoice Ninja (https://invoiceninja.com).
|
||||||
*
|
*
|
||||||
* @link https://github.com/invoiceninja/invoiceninja source repository
|
* @link https://github.com/invoiceninja/invoiceninja source repository
|
||||||
@ -6,4 +6,4 @@ import{i as c,w as d}from"./wait-8f4ae121.js";/**
|
|||||||
* @copyright Copyright (c) 2021. Invoice Ninja LLC (https://invoiceninja.com)
|
* @copyright Copyright (c) 2021. Invoice Ninja LLC (https://invoiceninja.com)
|
||||||
*
|
*
|
||||||
* @license https://www.elastic.co/licensing/elastic-license
|
* @license https://www.elastic.co/licensing/elastic-license
|
||||||
*/class s{constructor(){this.appId=document.querySelector("meta[name=square-appId]").content,this.locationId=document.querySelector("meta[name=square-locationId]").content,this.isLoaded=!1}async init(){this.payments=Square.payments(this.appId,this.locationId),this.card=await this.payments.card(),await this.card.attach("#card-container"),this.isLoaded=!0;let t=document.querySelector(".sq-card-iframe-container");t&&t.setAttribute("style","150px !important"),document.querySelector(".toggle-payment-with-token")&&document.getElementById("card-container").classList.add("hidden")}async completePaymentWithoutToken(t){document.getElementById("errors").hidden=!0,t.target.parentElement.disabled=!0;let n=document.getElementById("pay-now");this.payNowButton=n,this.payNowButton.disabled=!0,this.payNowButton.querySelector("svg").classList.remove("hidden"),this.payNowButton.querySelector("span").classList.add("hidden");let a=await this.card.tokenize(),o;try{const e={amount:document.querySelector("meta[name=amount]").content,billingContact:JSON.parse(document.querySelector("meta[name=square_contact]").content),currencyCode:document.querySelector("meta[name=currencyCode]").content,intent:"CHARGE"};o=(await this.payments.verifyBuyer(a.token,e)).token}catch{t.target.parentElement.disabled=!0}if(document.querySelector('input[name="verificationToken"]').value=o,a.status==="OK"){document.getElementById("sourceId").value=a.token;let e=document.querySelector('input[name="token-billing-checkbox"]:checked');return e&&(document.querySelector('input[name="store_card"]').value=e.value),document.getElementById("server_response").submit()}document.getElementById("errors").textContent=a.errors[0].message,document.getElementById("errors").hidden=!1,t.target.parentElement.disabled=!1,this.payNowButton.disabled=!1,this.payNowButton.querySelector("svg").classList.add("hidden"),this.payNowButton.querySelector("span").classList.remove("hidden")}async completePaymentUsingToken(t){t.target.parentElement.disabled=!0;let n=document.getElementById("pay-now");return this.payNowButton=n,this.payNowButton.disabled=!0,this.payNowButton.querySelector("svg").classList.remove("hidden"),this.payNowButton.querySelector("span").classList.add("hidden"),document.getElementById("server_response").submit()}async verifyBuyer(t){const n={amount:document.querySelector("meta[name=amount]").content,billingContact:document.querySelector("meta[name=square_contact]").content,currencyCode:document.querySelector("meta[name=currencyCode]").content,intent:"CHARGE"};return(await this.payments.verifyBuyer(t,n)).token}async handle(){document.getElementById("payment-list").classList.add("hidden"),await this.init().then(()=>{var t,n,a,o;(t=document.getElementById("authorize-card"))==null||t.addEventListener("click",e=>this.completePaymentWithoutToken(e)),(n=document.getElementById("pay-now"))==null||n.addEventListener("click",e=>document.querySelector("input[name=token]").value?this.completePaymentUsingToken(e):this.completePaymentWithoutToken(e)),Array.from(document.getElementsByClassName("toggle-payment-with-token")).forEach(e=>e.addEventListener("click",async r=>{document.getElementById("card-container").classList.add("hidden"),document.getElementById("save-card--container").style.display="none",document.querySelector("input[name=token]").value=r.target.dataset.token})),(a=document.getElementById("toggle-payment-with-credit-card"))==null||a.addEventListener("click",async e=>{document.getElementById("card-container").classList.remove("hidden"),document.getElementById("save-card--container").style.display="grid",document.querySelector("input[name=token]").value=""}),Array.from(document.getElementsByClassName("loader")).forEach(e=>{e.classList.add("hidden")}),document.getElementById("payment-list").classList.remove("hidden"),(o=document.getElementById("toggle-payment-with-credit-card"))==null||o.click()})}}function i(){new s().handle()}c()?i():d("#square-credit-card-payment").then(()=>i());
|
*/class l{constructor(){this.appId=document.querySelector("meta[name=square-appId]").content,this.locationId=document.querySelector("meta[name=square-locationId]").content,this.isLoaded=!1}async init(){this.payments=Square.payments(this.appId,this.locationId),this.card=await this.payments.card(),await this.card.attach("#card-container"),this.isLoaded=!0;let t=document.querySelector(".sq-card-iframe-container");t&&t.setAttribute("style","150px !important"),document.querySelector(".toggle-payment-with-token")&&document.getElementById("card-container").classList.add("hidden")}async completePaymentWithoutToken(t){document.getElementById("errors").hidden=!0,t.target.parentElement.disabled=!0;let n=document.getElementById("pay-now");this.payNowButton=n,this.payNowButton.disabled=!0,this.payNowButton.querySelector("svg").classList.remove("hidden"),this.payNowButton.querySelector("span").classList.add("hidden");let a=await this.card.tokenize(),o;try{const e={amount:document.querySelector("meta[name=amount]").content,billingContact:JSON.parse(document.querySelector("meta[name=square_contact]").content),currencyCode:document.querySelector("meta[name=currencyCode]").content,intent:"CHARGE"};o=(await this.payments.verifyBuyer(a.token,e)).token}catch{t.target.parentElement.disabled=!0}if(document.querySelector('input[name="verificationToken"]').value=o,a.status==="OK"){document.getElementById("sourceId").value=a.token;let e=document.querySelector('input[name="token-billing-checkbox"]:checked');return e&&(document.querySelector('input[name="store_card"]').value=e.value),document.getElementById("server_response").submit()}document.getElementById("errors").textContent=a.errors[0].message,document.getElementById("errors").hidden=!1,t.target.parentElement.disabled=!1,this.payNowButton.disabled=!1,this.payNowButton.querySelector("svg").classList.add("hidden"),this.payNowButton.querySelector("span").classList.remove("hidden")}async completePaymentUsingToken(t){t.target.parentElement.disabled=!0;let n=document.getElementById("pay-now");return this.payNowButton=n,this.payNowButton.disabled=!0,this.payNowButton.querySelector("svg").classList.remove("hidden"),this.payNowButton.querySelector("span").classList.add("hidden"),document.getElementById("server_response").submit()}async verifyBuyer(t){const n={amount:document.querySelector("meta[name=amount]").content,billingContact:document.querySelector("meta[name=square_contact]").content,currencyCode:document.querySelector("meta[name=currencyCode]").content,intent:"CHARGE"};return(await this.payments.verifyBuyer(t,n)).token}async handle(){document.getElementById("payment-list").classList.add("hidden"),await this.init().then(()=>{var t,n,a,o;(t=document.getElementById("authorize-card"))==null||t.addEventListener("click",e=>this.completePaymentWithoutToken(e)),(n=document.getElementById("pay-now"))==null||n.addEventListener("click",e=>document.querySelector("input[name=token]").value?this.completePaymentUsingToken(e):this.completePaymentWithoutToken(e)),Array.from(document.getElementsByClassName("toggle-payment-with-token")).forEach(e=>e.addEventListener("click",async i=>{document.getElementById("card-container").classList.add("hidden"),document.getElementById("save-card--container").style.display="none",document.querySelector("input[name=token]").value=i.target.dataset.token})),(a=document.getElementById("toggle-payment-with-credit-card"))==null||a.addEventListener("click",async e=>{document.getElementById("card-container").classList.remove("hidden"),document.getElementById("save-card--container").style.display="grid",document.querySelector("input[name=token]").value=""}),Array.from(document.getElementsByClassName("loader")).forEach(e=>{e.classList.add("hidden")}),document.getElementById("payment-list").classList.remove("hidden"),(o=document.getElementById("toggle-payment-with-credit-card"))==null||o.click()})}}function c(){new l().handle();const r=document.querySelectorAll("input.toggle-payment-with-token");r.length>0&&r[0].click()}s()?c():d("#square-credit-card-payment").then(()=>c());
|
@ -1,4 +1,4 @@
|
|||||||
import{i as c,w as u}from"./wait-8f4ae121.js";/**
|
import{i as u,w as m}from"./wait-8f4ae121.js";/**
|
||||||
* Invoice Ninja (https://invoiceninja.com)
|
* Invoice Ninja (https://invoiceninja.com)
|
||||||
*
|
*
|
||||||
* @link https://github.com/invoiceninja/invoiceninja source repository
|
* @link https://github.com/invoiceninja/invoiceninja source repository
|
||||||
@ -6,4 +6,4 @@ import{i as c,w as u}from"./wait-8f4ae121.js";/**
|
|||||||
* @copyright Copyright (c) 2021. Invoice Ninja LLC (https://invoiceninja.com)
|
* @copyright Copyright (c) 2021. Invoice Ninja LLC (https://invoiceninja.com)
|
||||||
*
|
*
|
||||||
* @license https://www.elastic.co/licensing/elastic-license
|
* @license https://www.elastic.co/licensing/elastic-license
|
||||||
*/class m{constructor(e,t,n,r){this.key=e,this.secret=t,this.onlyAuthorization=n,this.stripeConnect=r}setupStripe(){return this.stripeConnect?this.stripe=Stripe(this.key,{stripeAccount:this.stripeConnect}):this.stripe=Stripe(this.key),this.elements=this.stripe.elements(),this}createElement(){var e;return this.cardElement=this.elements.create("card",{hidePostalCode:((e=document.querySelector("meta[name=stripe-require-postal-code]"))==null?void 0:e.content)==="0",value:{postalCode:document.querySelector("meta[name=client-postal-code]").content},hideIcon:!1}),this}mountCardElement(){return this.cardElement.mount("#card-element"),this}completePaymentUsingToken(){let e=document.querySelector("input[name=token]").value,t=document.getElementById("pay-now");this.payNowButton=t,this.payNowButton.disabled=!0,this.payNowButton.querySelector("svg").classList.remove("hidden"),this.payNowButton.querySelector("span").classList.add("hidden"),this.stripe.handleCardPayment(this.secret,{payment_method:e}).then(n=>n.error?this.handleFailure(n.error.message):this.handleSuccess(n))}completePaymentWithoutToken(){let e=document.getElementById("pay-now");this.payNowButton=e,this.payNowButton.disabled=!0,this.payNowButton.querySelector("svg").classList.remove("hidden"),this.payNowButton.querySelector("span").classList.add("hidden");let t=document.getElementById("cardholder-name");this.stripe.handleCardPayment(this.secret,this.cardElement,{payment_method_data:{billing_details:{name:t.value}}}).then(n=>n.error?this.handleFailure(n.error.message):this.handleSuccess(n))}handleSuccess(e){document.querySelector('input[name="gateway_response"]').value=JSON.stringify(e.paymentIntent);let t=document.querySelector('input[name="token-billing-checkbox"]:checked');t&&(document.querySelector('input[name="store_card"]').value=t.value),document.getElementById("server-response").submit()}handleFailure(e){let t=document.getElementById("errors");t.textContent="",t.textContent=e,t.hidden=!1,this.payNowButton.disabled=!1,this.payNowButton.querySelector("svg").classList.add("hidden"),this.payNowButton.querySelector("span").classList.remove("hidden")}handleAuthorization(){let e=document.getElementById("cardholder-name"),t=document.getElementById("authorize-card");this.payNowButton=t,this.payNowButton.disabled=!0,this.payNowButton.querySelector("svg").classList.remove("hidden"),this.payNowButton.querySelector("span").classList.add("hidden"),this.stripe.handleCardSetup(this.secret,this.cardElement,{payment_method_data:{billing_details:{name:e.value}}}).then(n=>n.error?this.handleFailure(n.error.message):this.handleSuccessfulAuthorization(n))}handleSuccessfulAuthorization(e){document.getElementById("gateway_response").value=JSON.stringify(e.setupIntent),document.getElementById("server_response").submit()}handle(){this.setupStripe(),this.onlyAuthorization?(this.createElement().mountCardElement(),document.getElementById("authorize-card").addEventListener("click",()=>this.handleAuthorization())):(Array.from(document.getElementsByClassName("toggle-payment-with-token")).forEach(e=>e.addEventListener("click",t=>{document.getElementById("stripe--payment-container").classList.add("hidden"),document.getElementById("save-card--container").style.display="none",document.querySelector("input[name=token]").value=t.target.dataset.token})),document.getElementById("toggle-payment-with-credit-card").addEventListener("click",e=>{document.getElementById("stripe--payment-container").classList.remove("hidden"),document.getElementById("save-card--container").style.display="grid",document.querySelector("input[name=token]").value=""}),this.createElement().mountCardElement(),document.getElementById("pay-now").addEventListener("click",()=>{try{return document.querySelector("input[name=token]").value?this.completePaymentUsingToken():this.completePaymentWithoutToken()}catch(e){console.log(e.message)}}))}}function l(){var a,s,i,d;const o=((a=document.querySelector('meta[name="stripe-publishable-key"]'))==null?void 0:a.content)??"",e=((s=document.querySelector('meta[name="stripe-secret"]'))==null?void 0:s.content)??"",t=((i=document.querySelector('meta[name="only-authorization"]'))==null?void 0:i.content)??"",n=((d=document.querySelector('meta[name="stripe-account-id"]'))==null?void 0:d.content)??"";new m(o,e,t,n).handle()}c()?l():u("#stripe-credit-card-payment").then(()=>l());
|
*/class h{constructor(e,t,n,r){this.key=e,this.secret=t,this.onlyAuthorization=n,this.stripeConnect=r}setupStripe(){return this.stripeConnect?this.stripe=Stripe(this.key,{stripeAccount:this.stripeConnect}):this.stripe=Stripe(this.key),this.elements=this.stripe.elements(),this}createElement(){var e;return this.cardElement=this.elements.create("card",{hidePostalCode:((e=document.querySelector("meta[name=stripe-require-postal-code]"))==null?void 0:e.content)==="0",value:{postalCode:document.querySelector("meta[name=client-postal-code]").content},hideIcon:!1}),this}mountCardElement(){return this.cardElement.mount("#card-element"),this}completePaymentUsingToken(){let e=document.querySelector("input[name=token]").value,t=document.getElementById("pay-now");this.payNowButton=t,this.payNowButton.disabled=!0,this.payNowButton.querySelector("svg").classList.remove("hidden"),this.payNowButton.querySelector("span").classList.add("hidden"),this.stripe.handleCardPayment(this.secret,{payment_method:e}).then(n=>n.error?this.handleFailure(n.error.message):this.handleSuccess(n))}completePaymentWithoutToken(){let e=document.getElementById("pay-now");this.payNowButton=e,this.payNowButton.disabled=!0,this.payNowButton.querySelector("svg").classList.remove("hidden"),this.payNowButton.querySelector("span").classList.add("hidden");let t=document.getElementById("cardholder-name");this.stripe.handleCardPayment(this.secret,this.cardElement,{payment_method_data:{billing_details:{name:t.value}}}).then(n=>n.error?this.handleFailure(n.error.message):this.handleSuccess(n))}handleSuccess(e){document.querySelector('input[name="gateway_response"]').value=JSON.stringify(e.paymentIntent);let t=document.querySelector('input[name="token-billing-checkbox"]:checked');t&&(document.querySelector('input[name="store_card"]').value=t.value),document.getElementById("server-response").submit()}handleFailure(e){let t=document.getElementById("errors");t.textContent="",t.textContent=e,t.hidden=!1,this.payNowButton.disabled=!1,this.payNowButton.querySelector("svg").classList.add("hidden"),this.payNowButton.querySelector("span").classList.remove("hidden")}handleAuthorization(){let e=document.getElementById("cardholder-name"),t=document.getElementById("authorize-card");this.payNowButton=t,this.payNowButton.disabled=!0,this.payNowButton.querySelector("svg").classList.remove("hidden"),this.payNowButton.querySelector("span").classList.add("hidden"),this.stripe.handleCardSetup(this.secret,this.cardElement,{payment_method_data:{billing_details:{name:e.value}}}).then(n=>n.error?this.handleFailure(n.error.message):this.handleSuccessfulAuthorization(n))}handleSuccessfulAuthorization(e){document.getElementById("gateway_response").value=JSON.stringify(e.setupIntent),document.getElementById("server_response").submit()}handle(){this.setupStripe(),this.onlyAuthorization?(this.createElement().mountCardElement(),document.getElementById("authorize-card").addEventListener("click",()=>this.handleAuthorization())):(Array.from(document.getElementsByClassName("toggle-payment-with-token")).forEach(e=>e.addEventListener("click",t=>{document.getElementById("stripe--payment-container").classList.add("hidden"),document.getElementById("save-card--container").style.display="none",document.querySelector("input[name=token]").value=t.target.dataset.token})),document.getElementById("toggle-payment-with-credit-card").addEventListener("click",e=>{document.getElementById("stripe--payment-container").classList.remove("hidden"),document.getElementById("save-card--container").style.display="grid",document.querySelector("input[name=token]").value=""}),this.createElement().mountCardElement(),document.getElementById("pay-now").addEventListener("click",()=>{try{return document.querySelector("input[name=token]").value?this.completePaymentUsingToken():this.completePaymentWithoutToken()}catch(e){console.log(e.message)}}))}}function c(){var s,i,d,l;const o=((s=document.querySelector('meta[name="stripe-publishable-key"]'))==null?void 0:s.content)??"",e=((i=document.querySelector('meta[name="stripe-secret"]'))==null?void 0:i.content)??"",t=((d=document.querySelector('meta[name="only-authorization"]'))==null?void 0:d.content)??"",n=((l=document.querySelector('meta[name="stripe-account-id"]'))==null?void 0:l.content)??"";new h(o,e,t,n).handle();const a=document.querySelectorAll("input.toggle-payment-with-token");a.length>0&&a[0].click()}u()?c():m("#stripe-credit-card-payment").then(()=>c());
|
@ -1,4 +1,4 @@
|
|||||||
var i=Object.defineProperty;var l=(a,e,t)=>e in a?i(a,e,{enumerable:!0,configurable:!0,writable:!0,value:t}):a[e]=t;var r=(a,e,t)=>(l(a,typeof e!="symbol"?e+"":e,t),t);import{i as s,w as c}from"./wait-8f4ae121.js";/**
|
var s=Object.defineProperty;var i=(a,e,t)=>e in a?s(a,e,{enumerable:!0,configurable:!0,writable:!0,value:t}):a[e]=t;var o=(a,e,t)=>(i(a,typeof e!="symbol"?e+"":e,t),t);import{i as l,w as d}from"./wait-8f4ae121.js";/**
|
||||||
* Invoice Ninja (https://invoiceninja.com)
|
* Invoice Ninja (https://invoiceninja.com)
|
||||||
*
|
*
|
||||||
* @link https://github.com/invoiceninja/invoiceninja source repository
|
* @link https://github.com/invoiceninja/invoiceninja source repository
|
||||||
@ -6,4 +6,4 @@ var i=Object.defineProperty;var l=(a,e,t)=>e in a?i(a,e,{enumerable:!0,configura
|
|||||||
* @copyright Copyright (c) 2021. Invoice Ninja LLC (https://invoiceninja.com)
|
* @copyright Copyright (c) 2021. Invoice Ninja LLC (https://invoiceninja.com)
|
||||||
*
|
*
|
||||||
* @license https://www.elastic.co/licensing/elastic-license
|
* @license https://www.elastic.co/licensing/elastic-license
|
||||||
*/class d{constructor(e,t){r(this,"setupStripe",()=>{this.stripeConnect?this.stripe=Stripe(this.key,{stripeAccount:this.stripeConnect}):this.stripe=Stripe(this.key);const e=this.stripe.elements();var t={base:{color:"#32325d",fontFamily:'-apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif',fontSmoothing:"antialiased",fontSize:"16px","::placeholder":{color:"#aab7c4"},":-webkit-autofill":{color:"#32325d"}},invalid:{color:"#fa755a",iconColor:"#fa755a",":-webkit-autofill":{color:"#fa755a"}}},n={style:t,supportedCountries:["SEPA"],placeholderCountry:document.querySelector('meta[name="country"]').content};return this.iban=e.create("iban",n),this.iban.mount("#sepa-iban"),document.getElementById("sepa-name").value=document.querySelector("meta[name=client_name]").content,document.getElementById("sepa-email-address").value=document.querySelector("meta[name=client_email]").content,this});r(this,"handle",()=>{let e=document.getElementById("errors");Array.from(document.getElementsByClassName("toggle-payment-with-token")).forEach(t=>t.addEventListener("click",n=>{document.getElementById("stripe--payment-container").classList.add("hidden"),document.getElementById("save-card--container").style.display="none",document.querySelector("input[name=token]").value=n.target.dataset.token})),document.getElementById("toggle-payment-with-new-bank-account").addEventListener("click",t=>{document.getElementById("stripe--payment-container").classList.remove("hidden"),document.getElementById("save-card--container").style.display="grid",document.querySelector("input[name=token]").value=""}),document.getElementById("pay-now").addEventListener("click",t=>{if(document.querySelector("input[name=token]").value.length!==0)document.getElementById("pay-now").disabled=!0,document.querySelector("#pay-now > svg").classList.remove("hidden"),document.querySelector("#pay-now > span").classList.add("hidden"),this.stripe.confirmSepaDebitPayment(document.querySelector("meta[name=pi-client-secret").content,{payment_method:document.querySelector("input[name=token]").value}).then(n=>n.error?this.handleFailure(n.error.message):this.handleSuccess(n));else{if(document.getElementById("sepa-name").value===""){document.getElementById("sepa-name").focus(),e.textContent=document.querySelector("meta[name=translation-name-required]").content,e.hidden=!1;return}if(document.getElementById("sepa-email-address").value===""){document.getElementById("sepa-email-address").focus(),e.textContent=document.querySelector("meta[name=translation-email-required]").content,e.hidden=!1;return}if(!document.getElementById("sepa-mandate-acceptance").checked){e.textContent=document.querySelector("meta[name=translation-terms-required]").content,e.hidden=!1;return}document.getElementById("pay-now").disabled=!0,document.querySelector("#pay-now > svg").classList.remove("hidden"),document.querySelector("#pay-now > span").classList.add("hidden"),this.stripe.confirmSepaDebitPayment(document.querySelector("meta[name=pi-client-secret").content,{payment_method:{sepa_debit:this.iban,billing_details:{name:document.getElementById("sepa-name").value,email:document.getElementById("sepa-email-address").value}}}).then(n=>n.error?this.handleFailure(n.error.message):this.handleSuccess(n))}})});this.key=e,this.errors=document.getElementById("errors"),this.stripeConnect=t}handleSuccess(e){document.querySelector('input[name="gateway_response"]').value=JSON.stringify(e.paymentIntent);let t=document.querySelector('input[name="token-billing-checkbox"]:checked');t&&(document.querySelector('input[name="store_card"]').value=t.value),document.querySelector("input[name=token]").value.length>2&&(document.querySelector('input[name="store_card"]').value=!1),document.getElementById("server-response").submit()}handleFailure(e){let 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")}handleSuccess(e){document.querySelector('input[name="gateway_response"]').value=JSON.stringify(e.paymentIntent);let t=document.querySelector('input[name="token-billing-checkbox"]:checked');t&&(document.querySelector('input[name="store_card"]').value=t.value),document.getElementById("server-response").submit()}}function o(){var t,n;const a=((t=document.querySelector('meta[name="stripe-publishable-key"]'))==null?void 0:t.content)??"",e=((n=document.querySelector('meta[name="stripe-account-id"]'))==null?void 0:n.content)??"";new d(a,e).setupStripe().handle()}s()?o():c("#stripe-sepa-payment").then(()=>o());s()?o():c("#stripe-sepa-payment").then(()=>o());
|
*/class m{constructor(e,t){o(this,"setupStripe",()=>{this.stripeConnect?this.stripe=Stripe(this.key,{stripeAccount:this.stripeConnect}):this.stripe=Stripe(this.key);const e=this.stripe.elements();var t={base:{color:"#32325d",fontFamily:'-apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif',fontSmoothing:"antialiased",fontSize:"16px","::placeholder":{color:"#aab7c4"},":-webkit-autofill":{color:"#32325d"}},invalid:{color:"#fa755a",iconColor:"#fa755a",":-webkit-autofill":{color:"#fa755a"}}},n={style:t,supportedCountries:["SEPA"],placeholderCountry:document.querySelector('meta[name="country"]').content};return this.iban=e.create("iban",n),this.iban.mount("#sepa-iban"),document.getElementById("sepa-name").value=document.querySelector("meta[name=client_name]").content,document.getElementById("sepa-email-address").value=document.querySelector("meta[name=client_email]").content,this});o(this,"handle",()=>{let e=document.getElementById("errors");Array.from(document.getElementsByClassName("toggle-payment-with-token")).forEach(t=>t.addEventListener("click",n=>{document.getElementById("stripe--payment-container").classList.add("hidden"),document.getElementById("save-card--container").style.display="none",document.querySelector("input[name=token]").value=n.target.dataset.token})),document.getElementById("toggle-payment-with-new-bank-account").addEventListener("click",t=>{document.getElementById("stripe--payment-container").classList.remove("hidden"),document.getElementById("save-card--container").style.display="grid",document.querySelector("input[name=token]").value=""}),document.getElementById("pay-now").addEventListener("click",t=>{if(document.querySelector("input[name=token]").value.length!==0)document.getElementById("pay-now").disabled=!0,document.querySelector("#pay-now > svg").classList.remove("hidden"),document.querySelector("#pay-now > span").classList.add("hidden"),this.stripe.confirmSepaDebitPayment(document.querySelector("meta[name=pi-client-secret").content,{payment_method:document.querySelector("input[name=token]").value}).then(n=>n.error?this.handleFailure(n.error.message):this.handleSuccess(n));else{if(document.getElementById("sepa-name").value===""){document.getElementById("sepa-name").focus(),e.textContent=document.querySelector("meta[name=translation-name-required]").content,e.hidden=!1;return}if(document.getElementById("sepa-email-address").value===""){document.getElementById("sepa-email-address").focus(),e.textContent=document.querySelector("meta[name=translation-email-required]").content,e.hidden=!1;return}if(!document.getElementById("sepa-mandate-acceptance").checked){e.textContent=document.querySelector("meta[name=translation-terms-required]").content,e.hidden=!1;return}document.getElementById("pay-now").disabled=!0,document.querySelector("#pay-now > svg").classList.remove("hidden"),document.querySelector("#pay-now > span").classList.add("hidden"),this.stripe.confirmSepaDebitPayment(document.querySelector("meta[name=pi-client-secret").content,{payment_method:{sepa_debit:this.iban,billing_details:{name:document.getElementById("sepa-name").value,email:document.getElementById("sepa-email-address").value}}}).then(n=>n.error?this.handleFailure(n.error.message):this.handleSuccess(n))}})});this.key=e,this.errors=document.getElementById("errors"),this.stripeConnect=t}handleSuccess(e){document.querySelector('input[name="gateway_response"]').value=JSON.stringify(e.paymentIntent);let t=document.querySelector('input[name="token-billing-checkbox"]:checked');t&&(document.querySelector('input[name="store_card"]').value=t.value),document.querySelector("input[name=token]").value.length>2&&(document.querySelector('input[name="store_card"]').value=!1),document.getElementById("server-response").submit()}handleFailure(e){let 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")}handleSuccess(e){document.querySelector('input[name="gateway_response"]').value=JSON.stringify(e.paymentIntent);let t=document.querySelector('input[name="token-billing-checkbox"]:checked');t&&(document.querySelector('input[name="store_card"]').value=t.value),document.getElementById("server-response").submit()}}function c(){var n,r;const a=((n=document.querySelector('meta[name="stripe-publishable-key"]'))==null?void 0:n.content)??"",e=((r=document.querySelector('meta[name="stripe-account-id"]'))==null?void 0:r.content)??"";new m(a,e).setupStripe().handle();const t=document.querySelectorAll("input.toggle-payment-with-token");t.length>0&&t[0].click()}l()?c():d("#stripe-sepa-payment").then(()=>c());
|
@ -12,7 +12,7 @@
|
|||||||
"file": "assets/wait-8f4ae121.js"
|
"file": "assets/wait-8f4ae121.js"
|
||||||
},
|
},
|
||||||
"resources/js/app.js": {
|
"resources/js/app.js": {
|
||||||
"file": "assets/app-021b0210.js",
|
"file": "assets/app-2353b88b.js",
|
||||||
"imports": [
|
"imports": [
|
||||||
"_index-08e160a7.js",
|
"_index-08e160a7.js",
|
||||||
"__commonjsHelpers-725317a4.js"
|
"__commonjsHelpers-725317a4.js"
|
||||||
@ -78,7 +78,7 @@
|
|||||||
"src": "resources/js/clients/payment_methods/wepay-bank-account.js"
|
"src": "resources/js/clients/payment_methods/wepay-bank-account.js"
|
||||||
},
|
},
|
||||||
"resources/js/clients/payments/authorize-credit-card-payment.js": {
|
"resources/js/clients/payments/authorize-credit-card-payment.js": {
|
||||||
"file": "assets/authorize-credit-card-payment-222655bd.js",
|
"file": "assets/authorize-credit-card-payment-4a21c1d6.js",
|
||||||
"imports": [
|
"imports": [
|
||||||
"_wait-8f4ae121.js"
|
"_wait-8f4ae121.js"
|
||||||
],
|
],
|
||||||
@ -94,7 +94,7 @@
|
|||||||
"src": "resources/js/clients/payments/blockonomics.js"
|
"src": "resources/js/clients/payments/blockonomics.js"
|
||||||
},
|
},
|
||||||
"resources/js/clients/payments/braintree-credit-card.js": {
|
"resources/js/clients/payments/braintree-credit-card.js": {
|
||||||
"file": "assets/braintree-credit-card-60bd8878.js",
|
"file": "assets/braintree-credit-card-bdd1449a.js",
|
||||||
"imports": [
|
"imports": [
|
||||||
"_wait-8f4ae121.js"
|
"_wait-8f4ae121.js"
|
||||||
],
|
],
|
||||||
@ -102,7 +102,7 @@
|
|||||||
"src": "resources/js/clients/payments/braintree-credit-card.js"
|
"src": "resources/js/clients/payments/braintree-credit-card.js"
|
||||||
},
|
},
|
||||||
"resources/js/clients/payments/braintree-paypal.js": {
|
"resources/js/clients/payments/braintree-paypal.js": {
|
||||||
"file": "assets/braintree-paypal-f78ad64b.js",
|
"file": "assets/braintree-paypal-a8e50876.js",
|
||||||
"imports": [
|
"imports": [
|
||||||
"_wait-8f4ae121.js"
|
"_wait-8f4ae121.js"
|
||||||
],
|
],
|
||||||
@ -110,7 +110,7 @@
|
|||||||
"src": "resources/js/clients/payments/braintree-paypal.js"
|
"src": "resources/js/clients/payments/braintree-paypal.js"
|
||||||
},
|
},
|
||||||
"resources/js/clients/payments/checkout-credit-card.js": {
|
"resources/js/clients/payments/checkout-credit-card.js": {
|
||||||
"file": "assets/checkout-credit-card-2cca8b36.js",
|
"file": "assets/checkout-credit-card-f20e4c86.js",
|
||||||
"imports": [
|
"imports": [
|
||||||
"_wait-8f4ae121.js"
|
"_wait-8f4ae121.js"
|
||||||
],
|
],
|
||||||
@ -118,7 +118,7 @@
|
|||||||
"src": "resources/js/clients/payments/checkout-credit-card.js"
|
"src": "resources/js/clients/payments/checkout-credit-card.js"
|
||||||
},
|
},
|
||||||
"resources/js/clients/payments/eway-credit-card.js": {
|
"resources/js/clients/payments/eway-credit-card.js": {
|
||||||
"file": "assets/eway-credit-card-150298fa.js",
|
"file": "assets/eway-credit-card-ea8590e3.js",
|
||||||
"imports": [
|
"imports": [
|
||||||
"_wait-8f4ae121.js"
|
"_wait-8f4ae121.js"
|
||||||
],
|
],
|
||||||
@ -142,7 +142,7 @@
|
|||||||
"src": "resources/js/clients/payments/forte-credit-card-payment.js"
|
"src": "resources/js/clients/payments/forte-credit-card-payment.js"
|
||||||
},
|
},
|
||||||
"resources/js/clients/payments/mollie-credit-card.js": {
|
"resources/js/clients/payments/mollie-credit-card.js": {
|
||||||
"file": "assets/mollie-credit-card-d81afbd4.js",
|
"file": "assets/mollie-credit-card-182bf0e2.js",
|
||||||
"imports": [
|
"imports": [
|
||||||
"_wait-8f4ae121.js"
|
"_wait-8f4ae121.js"
|
||||||
],
|
],
|
||||||
@ -150,7 +150,7 @@
|
|||||||
"src": "resources/js/clients/payments/mollie-credit-card.js"
|
"src": "resources/js/clients/payments/mollie-credit-card.js"
|
||||||
},
|
},
|
||||||
"resources/js/clients/payments/paytrace-credit-card.js": {
|
"resources/js/clients/payments/paytrace-credit-card.js": {
|
||||||
"file": "assets/paytrace-credit-card-d29797c1.js",
|
"file": "assets/paytrace-credit-card-4bcd953d.js",
|
||||||
"imports": [
|
"imports": [
|
||||||
"_wait-8f4ae121.js"
|
"_wait-8f4ae121.js"
|
||||||
],
|
],
|
||||||
@ -158,7 +158,7 @@
|
|||||||
"src": "resources/js/clients/payments/paytrace-credit-card.js"
|
"src": "resources/js/clients/payments/paytrace-credit-card.js"
|
||||||
},
|
},
|
||||||
"resources/js/clients/payments/powerboard-credit-card.js": {
|
"resources/js/clients/payments/powerboard-credit-card.js": {
|
||||||
"file": "assets/powerboard-credit-card-f4852d3b.js",
|
"file": "assets/powerboard-credit-card-a6ec35e2.js",
|
||||||
"imports": [
|
"imports": [
|
||||||
"_wait-8f4ae121.js"
|
"_wait-8f4ae121.js"
|
||||||
],
|
],
|
||||||
@ -174,7 +174,7 @@
|
|||||||
"src": "resources/js/clients/payments/razorpay-aio.js"
|
"src": "resources/js/clients/payments/razorpay-aio.js"
|
||||||
},
|
},
|
||||||
"resources/js/clients/payments/square-credit-card.js": {
|
"resources/js/clients/payments/square-credit-card.js": {
|
||||||
"file": "assets/square-credit-card-9e88c754.js",
|
"file": "assets/square-credit-card-da390944.js",
|
||||||
"imports": [
|
"imports": [
|
||||||
"_wait-8f4ae121.js"
|
"_wait-8f4ae121.js"
|
||||||
],
|
],
|
||||||
@ -251,7 +251,7 @@
|
|||||||
"src": "resources/js/clients/payments/stripe-browserpay.js"
|
"src": "resources/js/clients/payments/stripe-browserpay.js"
|
||||||
},
|
},
|
||||||
"resources/js/clients/payments/stripe-credit-card.js": {
|
"resources/js/clients/payments/stripe-credit-card.js": {
|
||||||
"file": "assets/stripe-credit-card-5487be17.js",
|
"file": "assets/stripe-credit-card-f8033e95.js",
|
||||||
"imports": [
|
"imports": [
|
||||||
"_wait-8f4ae121.js"
|
"_wait-8f4ae121.js"
|
||||||
],
|
],
|
||||||
@ -307,7 +307,7 @@
|
|||||||
"src": "resources/js/clients/payments/stripe-przelewy24.js"
|
"src": "resources/js/clients/payments/stripe-przelewy24.js"
|
||||||
},
|
},
|
||||||
"resources/js/clients/payments/stripe-sepa.js": {
|
"resources/js/clients/payments/stripe-sepa.js": {
|
||||||
"file": "assets/stripe-sepa-23154322.js",
|
"file": "assets/stripe-sepa-f19c8a05.js",
|
||||||
"imports": [
|
"imports": [
|
||||||
"_wait-8f4ae121.js"
|
"_wait-8f4ae121.js"
|
||||||
],
|
],
|
||||||
|
@ -187,6 +187,13 @@ function boot() {
|
|||||||
|
|
||||||
/** @handle */
|
/** @handle */
|
||||||
new AuthorizeAuthorizeCard(publicKey, loginId).handle();
|
new AuthorizeAuthorizeCard(publicKey, loginId).handle();
|
||||||
|
|
||||||
|
/** @type {NodeListOf<HTMLInputElement>} */
|
||||||
|
const tokens = document.querySelectorAll('input.toggle-payment-with-token');
|
||||||
|
|
||||||
|
if (tokens.length > 0) {
|
||||||
|
tokens[0].click();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
instant() ? boot() : wait('#authorize-net-credit-card-payment').then(() => boot());
|
instant() ? boot() : wait('#authorize-net-credit-card-payment').then(() => boot());
|
||||||
|
@ -12,29 +12,44 @@ import { wait, instant } from '../wait';
|
|||||||
|
|
||||||
class BraintreeCreditCard {
|
class BraintreeCreditCard {
|
||||||
initBraintreeDataCollector() {
|
initBraintreeDataCollector() {
|
||||||
window.braintree.client.create({
|
window.braintree.client.create(
|
||||||
authorization: document.querySelector('meta[name=client-token]').content
|
{
|
||||||
}, function (err, clientInstance) {
|
authorization: document.querySelector('meta[name=client-token]')
|
||||||
window.braintree.dataCollector.create({
|
.content,
|
||||||
client: clientInstance,
|
},
|
||||||
paypal: true
|
function (err, clientInstance) {
|
||||||
}, function (err, dataCollectorInstance) {
|
window.braintree.dataCollector.create(
|
||||||
if (err) {
|
{
|
||||||
return;
|
client: clientInstance,
|
||||||
}
|
paypal: true,
|
||||||
|
},
|
||||||
|
function (err, dataCollectorInstance) {
|
||||||
|
if (err) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
document.querySelector('input[name=client-data]').value = dataCollectorInstance.deviceData;
|
document.querySelector(
|
||||||
});
|
'input[name=client-data]'
|
||||||
});
|
).value = dataCollectorInstance.deviceData;
|
||||||
|
}
|
||||||
|
);
|
||||||
|
}
|
||||||
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
mountBraintreePaymentWidget() {
|
mountBraintreePaymentWidget() {
|
||||||
|
window.braintree.dropin.create(
|
||||||
window.braintree.dropin.create({
|
{
|
||||||
authorization: document.querySelector('meta[name=client-token]').content,
|
authorization: document.querySelector('meta[name=client-token]')
|
||||||
container: '#dropin-container',
|
.content,
|
||||||
threeDSecure: document.querySelector('input[name=threeds_enable]').value.toLowerCase() === 'true'
|
container: '#dropin-container',
|
||||||
}, this.handleCallback);
|
threeDSecure:
|
||||||
|
document
|
||||||
|
.querySelector('input[name=threeds_enable]')
|
||||||
|
.value.toLowerCase() === 'true',
|
||||||
|
},
|
||||||
|
this.handleCallback
|
||||||
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
handleCallback(error, dropinInstance) {
|
handleCallback(error, dropinInstance) {
|
||||||
@ -44,58 +59,76 @@ class BraintreeCreditCard {
|
|||||||
}
|
}
|
||||||
|
|
||||||
let payNow = document.getElementById('pay-now');
|
let payNow = document.getElementById('pay-now');
|
||||||
let params = JSON.parse(document.querySelector('input[name=threeds]').value);
|
let params = JSON.parse(
|
||||||
|
document.querySelector('input[name=threeds]').value
|
||||||
|
);
|
||||||
|
|
||||||
payNow.addEventListener('click', () => {
|
payNow.addEventListener('click', () => {
|
||||||
dropinInstance.requestPaymentMethod({
|
dropinInstance.requestPaymentMethod(
|
||||||
threeDSecure: {
|
{
|
||||||
challengeRequested: true,
|
threeDSecure: {
|
||||||
amount: params.amount,
|
challengeRequested: true,
|
||||||
email: params.email,
|
amount: params.amount,
|
||||||
billingAddress: {
|
email: params.email,
|
||||||
givenName: params.billingAddress.givenName, // ASCII-printable characters required, else will throw a validation error
|
billingAddress: {
|
||||||
surname: params.billingAddress.surname, // ASCII-printable characters required, else will throw a validation error
|
givenName: params.billingAddress.givenName, // ASCII-printable characters required, else will throw a validation error
|
||||||
phoneNumber: params.billingAddress.phoneNumber,
|
surname: params.billingAddress.surname, // ASCII-printable characters required, else will throw a validation error
|
||||||
streetAddress: params.billingAddress.streetAddress,
|
phoneNumber: params.billingAddress.phoneNumber,
|
||||||
extendedAddress: params.billingAddress.extendedAddress,
|
streetAddress: params.billingAddress.streetAddress,
|
||||||
locality: params.billingAddress.locality,
|
extendedAddress:
|
||||||
region: params.billingAddress.region,
|
params.billingAddress.extendedAddress,
|
||||||
postalCode: params.billingAddress.postalCode,
|
locality: params.billingAddress.locality,
|
||||||
countryCodeAlpha2: params.billingAddress.countryCodeAlpha2
|
region: params.billingAddress.region,
|
||||||
|
postalCode: params.billingAddress.postalCode,
|
||||||
|
countryCodeAlpha2:
|
||||||
|
params.billingAddress.countryCodeAlpha2,
|
||||||
|
},
|
||||||
|
},
|
||||||
|
},
|
||||||
|
function (err, payload) {
|
||||||
|
if (err) {
|
||||||
|
console.log(err);
|
||||||
|
dropin.clearSelectedPaymentMethod();
|
||||||
|
alert(
|
||||||
|
'There was a problem verifying this card, please contact your merchant'
|
||||||
|
);
|
||||||
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (
|
||||||
|
document.querySelector('input[name=threeds_enable]')
|
||||||
|
.value === 'true' &&
|
||||||
|
!payload.liabilityShifted
|
||||||
|
) {
|
||||||
|
console.log('Liability did not shift', payload);
|
||||||
|
alert(
|
||||||
|
'There was a problem verifying this card, please contact your merchant'
|
||||||
|
);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
payNow.disabled = true;
|
||||||
|
|
||||||
|
payNow.querySelector('svg').classList.remove('hidden');
|
||||||
|
payNow.querySelector('span').classList.add('hidden');
|
||||||
|
|
||||||
|
document.querySelector(
|
||||||
|
'input[name=gateway_response]'
|
||||||
|
).value = JSON.stringify(payload);
|
||||||
|
|
||||||
|
let tokenBillingCheckbox = document.querySelector(
|
||||||
|
'input[name="token-billing-checkbox"]:checked'
|
||||||
|
);
|
||||||
|
|
||||||
|
if (tokenBillingCheckbox) {
|
||||||
|
document.querySelector(
|
||||||
|
'input[name="store_card"]'
|
||||||
|
).value = tokenBillingCheckbox.value;
|
||||||
|
}
|
||||||
|
|
||||||
|
document.getElementById('server-response').submit();
|
||||||
}
|
}
|
||||||
}, function (err, payload) {
|
);
|
||||||
if (err) {
|
|
||||||
console.log(err);
|
|
||||||
dropin.clearSelectedPaymentMethod();
|
|
||||||
alert("There was a problem verifying this card, please contact your merchant");
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (document.querySelector('input[name=threeds_enable]').value === 'true' && !payload.liabilityShifted) {
|
|
||||||
console.log('Liability did not shift', payload);
|
|
||||||
alert("There was a problem verifying this card, please contact your merchant");
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
payNow.disabled = true;
|
|
||||||
|
|
||||||
payNow.querySelector('svg').classList.remove('hidden');
|
|
||||||
payNow.querySelector('span').classList.add('hidden');
|
|
||||||
|
|
||||||
document.querySelector('input[name=gateway_response]').value = JSON.stringify(payload);
|
|
||||||
|
|
||||||
let tokenBillingCheckbox = document.querySelector(
|
|
||||||
'input[name="token-billing-checkbox"]:checked'
|
|
||||||
);
|
|
||||||
|
|
||||||
if (tokenBillingCheckbox) {
|
|
||||||
document.querySelector('input[name="store_card"]').value =
|
|
||||||
tokenBillingCheckbox.value;
|
|
||||||
}
|
|
||||||
|
|
||||||
document.getElementById('server-response').submit();
|
|
||||||
});
|
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -103,43 +136,66 @@ class BraintreeCreditCard {
|
|||||||
this.initBraintreeDataCollector();
|
this.initBraintreeDataCollector();
|
||||||
this.mountBraintreePaymentWidget();
|
this.mountBraintreePaymentWidget();
|
||||||
|
|
||||||
Array
|
Array.from(
|
||||||
.from(document.getElementsByClassName('toggle-payment-with-token'))
|
document.getElementsByClassName('toggle-payment-with-token')
|
||||||
.forEach((element) => element.addEventListener('click', (element) => {
|
).forEach((element) =>
|
||||||
document.getElementById('dropin-container').classList.add('hidden');
|
element.addEventListener('click', (element) => {
|
||||||
document.getElementById('save-card--container').style.display = 'none';
|
document
|
||||||
document.querySelector('input[name=token]').value = element.target.dataset.token;
|
.getElementById('dropin-container')
|
||||||
|
.classList.add('hidden');
|
||||||
|
document.getElementById('save-card--container').style.display =
|
||||||
|
'none';
|
||||||
|
document.querySelector('input[name=token]').value =
|
||||||
|
element.target.dataset.token;
|
||||||
|
|
||||||
document.getElementById('pay-now-with-token').classList.remove('hidden');
|
document
|
||||||
|
.getElementById('pay-now-with-token')
|
||||||
|
.classList.remove('hidden');
|
||||||
document.getElementById('pay-now').classList.add('hidden');
|
document.getElementById('pay-now').classList.add('hidden');
|
||||||
}));
|
})
|
||||||
|
);
|
||||||
|
|
||||||
document
|
document
|
||||||
.getElementById('toggle-payment-with-credit-card')
|
.getElementById('toggle-payment-with-credit-card')
|
||||||
.addEventListener('click', (element) => {
|
.addEventListener('click', (element) => {
|
||||||
document.getElementById('dropin-container').classList.remove('hidden');
|
document
|
||||||
document.getElementById('save-card--container').style.display = 'grid';
|
.getElementById('dropin-container')
|
||||||
document.querySelector('input[name=token]').value = "";
|
.classList.remove('hidden');
|
||||||
|
document.getElementById('save-card--container').style.display =
|
||||||
|
'grid';
|
||||||
|
document.querySelector('input[name=token]').value = '';
|
||||||
|
|
||||||
document.getElementById('pay-now-with-token').classList.add('hidden');
|
document
|
||||||
|
.getElementById('pay-now-with-token')
|
||||||
|
.classList.add('hidden');
|
||||||
document.getElementById('pay-now').classList.remove('hidden');
|
document.getElementById('pay-now').classList.remove('hidden');
|
||||||
});
|
});
|
||||||
|
|
||||||
let payNowWithToken = document.getElementById('pay-now-with-token');
|
let payNowWithToken = document.getElementById('pay-now-with-token');
|
||||||
|
|
||||||
payNowWithToken
|
payNowWithToken.addEventListener('click', (element) => {
|
||||||
.addEventListener('click', (element) => {
|
payNowWithToken.disabled = true;
|
||||||
payNowWithToken.disabled = true;
|
payNowWithToken.querySelector('svg').classList.remove('hidden');
|
||||||
payNowWithToken.querySelector('svg').classList.remove('hidden');
|
payNowWithToken.querySelector('span').classList.add('hidden');
|
||||||
payNowWithToken.querySelector('span').classList.add('hidden');
|
|
||||||
|
|
||||||
document.getElementById('server-response').submit();
|
document.getElementById('server-response').submit();
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
function boot() {
|
function boot() {
|
||||||
new BraintreeCreditCard().handle();
|
new BraintreeCreditCard().handle();
|
||||||
|
|
||||||
|
/** @type {NodeListOf<HTMLInputElement>} */
|
||||||
|
const tokens = document.querySelectorAll('input.toggle-payment-with-token');
|
||||||
|
|
||||||
|
if (tokens.length > 0) {
|
||||||
|
tokens[0].click();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
instant() ? boot() : wait('#braintree-credit-card-payment', 'meta[name=client-token]').then(() => boot());
|
instant()
|
||||||
|
? boot()
|
||||||
|
: wait('#braintree-credit-card-payment', 'meta[name=client-token]').then(
|
||||||
|
() => boot()
|
||||||
|
);
|
||||||
|
213
resources/js/clients/payments/braintree-paypal.js
vendored
213
resources/js/clients/payments/braintree-paypal.js
vendored
@ -12,26 +12,35 @@ import { wait, instant } from '../wait';
|
|||||||
|
|
||||||
class BraintreePayPal {
|
class BraintreePayPal {
|
||||||
initBraintreeDataCollector() {
|
initBraintreeDataCollector() {
|
||||||
window.braintree.client.create({
|
window.braintree.client.create(
|
||||||
authorization: document.querySelector('meta[name=client-token]').content
|
{
|
||||||
}, function (err, clientInstance) {
|
authorization: document.querySelector('meta[name=client-token]')
|
||||||
window.braintree.dataCollector.create({
|
.content,
|
||||||
client: clientInstance,
|
},
|
||||||
paypal: true
|
function (err, clientInstance) {
|
||||||
}, function (err, dataCollectorInstance) {
|
window.braintree.dataCollector.create(
|
||||||
if (err) {
|
{
|
||||||
return;
|
client: clientInstance,
|
||||||
}
|
paypal: true,
|
||||||
|
},
|
||||||
|
function (err, dataCollectorInstance) {
|
||||||
|
if (err) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
document.querySelector('input[name=client-data]').value = dataCollectorInstance.deviceData;
|
document.querySelector(
|
||||||
});
|
'input[name=client-data]'
|
||||||
});
|
).value = dataCollectorInstance.deviceData;
|
||||||
|
}
|
||||||
|
);
|
||||||
|
}
|
||||||
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
static getPaymentDetails() {
|
static getPaymentDetails() {
|
||||||
return {
|
return {
|
||||||
flow: 'vault',
|
flow: 'vault',
|
||||||
}
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
static handleErrorMessage(message) {
|
static handleErrorMessage(message) {
|
||||||
@ -42,90 +51,134 @@ class BraintreePayPal {
|
|||||||
}
|
}
|
||||||
|
|
||||||
handlePaymentWithToken() {
|
handlePaymentWithToken() {
|
||||||
Array
|
Array.from(
|
||||||
.from(document.getElementsByClassName('toggle-payment-with-token'))
|
document.getElementsByClassName('toggle-payment-with-token')
|
||||||
.forEach((element) => element.addEventListener('click', (element) => {
|
).forEach((element) =>
|
||||||
document.getElementById('paypal-button').classList.add('hidden');
|
element.addEventListener('click', (element) => {
|
||||||
document.getElementById('save-card--container').style.display = 'none';
|
document
|
||||||
document.querySelector('input[name=token]').value = element.target.dataset.token;
|
.getElementById('paypal-button')
|
||||||
|
.classList.add('hidden');
|
||||||
|
document.getElementById('save-card--container').style.display =
|
||||||
|
'none';
|
||||||
|
document.querySelector('input[name=token]').value =
|
||||||
|
element.target.dataset.token;
|
||||||
|
|
||||||
document.getElementById('pay-now-with-token').classList.remove('hidden');
|
document
|
||||||
|
.getElementById('pay-now-with-token')
|
||||||
|
.classList.remove('hidden');
|
||||||
document.getElementById('pay-now').classList.add('hidden');
|
document.getElementById('pay-now').classList.add('hidden');
|
||||||
}));
|
})
|
||||||
|
);
|
||||||
|
|
||||||
let payNowWithToken = document.getElementById('pay-now-with-token');
|
let payNowWithToken = document.getElementById('pay-now-with-token');
|
||||||
|
|
||||||
payNowWithToken
|
payNowWithToken.addEventListener('click', (element) => {
|
||||||
.addEventListener('click', (element) => {
|
payNowWithToken.disabled = true;
|
||||||
payNowWithToken.disabled = true;
|
payNowWithToken.querySelector('svg').classList.remove('hidden');
|
||||||
payNowWithToken.querySelector('svg').classList.remove('hidden');
|
payNowWithToken.querySelector('span').classList.add('hidden');
|
||||||
payNowWithToken.querySelector('span').classList.add('hidden');
|
|
||||||
|
|
||||||
document.getElementById('server-response').submit();
|
document.getElementById('server-response').submit();
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
handle() {
|
handle() {
|
||||||
this.initBraintreeDataCollector();
|
this.initBraintreeDataCollector();
|
||||||
this.handlePaymentWithToken();
|
this.handlePaymentWithToken();
|
||||||
|
|
||||||
braintree.client.create({
|
braintree.client
|
||||||
authorization: document.querySelector('meta[name=client-token]').content,
|
.create({
|
||||||
}).then(function (clientInstance) {
|
authorization: document.querySelector('meta[name=client-token]')
|
||||||
return braintree.paypalCheckout.create({
|
.content,
|
||||||
client: clientInstance
|
})
|
||||||
|
.then(function (clientInstance) {
|
||||||
|
return braintree.paypalCheckout.create({
|
||||||
|
client: clientInstance,
|
||||||
|
});
|
||||||
|
})
|
||||||
|
.then(function (paypalCheckoutInstance) {
|
||||||
|
return paypalCheckoutInstance
|
||||||
|
.loadPayPalSDK({
|
||||||
|
vault: true,
|
||||||
|
})
|
||||||
|
.then(function (paypalCheckoutInstance) {
|
||||||
|
return paypal
|
||||||
|
.Buttons({
|
||||||
|
fundingSource: paypal.FUNDING.PAYPAL,
|
||||||
|
|
||||||
|
createBillingAgreement: function () {
|
||||||
|
return paypalCheckoutInstance.createPayment(
|
||||||
|
BraintreePayPal.getPaymentDetails()
|
||||||
|
);
|
||||||
|
},
|
||||||
|
|
||||||
|
onApprove: function (data, actions) {
|
||||||
|
return paypalCheckoutInstance
|
||||||
|
.tokenizePayment(data)
|
||||||
|
.then(function (payload) {
|
||||||
|
document
|
||||||
|
.querySelector('#paypal-button')
|
||||||
|
?.classList.add('hidden');
|
||||||
|
document
|
||||||
|
.querySelector(
|
||||||
|
'#paypal-spinner'
|
||||||
|
)
|
||||||
|
?.classList.remove('hidden');
|
||||||
|
|
||||||
|
let tokenBillingCheckbox =
|
||||||
|
document.querySelector(
|
||||||
|
'input[name="token-billing-checkbox"]:checked'
|
||||||
|
);
|
||||||
|
|
||||||
|
if (tokenBillingCheckbox) {
|
||||||
|
document.querySelector(
|
||||||
|
'input[name="store_card"]'
|
||||||
|
).value =
|
||||||
|
tokenBillingCheckbox.value;
|
||||||
|
}
|
||||||
|
|
||||||
|
document.querySelector(
|
||||||
|
'input[name=gateway_response]'
|
||||||
|
).value = JSON.stringify(payload);
|
||||||
|
document
|
||||||
|
.getElementById(
|
||||||
|
'server-response'
|
||||||
|
)
|
||||||
|
.submit();
|
||||||
|
});
|
||||||
|
},
|
||||||
|
|
||||||
|
onCancel: function (data) {
|
||||||
|
// ..
|
||||||
|
},
|
||||||
|
|
||||||
|
onError: function (err) {
|
||||||
|
console.log(err.message);
|
||||||
|
|
||||||
|
BraintreePayPal.handleErrorMessage(
|
||||||
|
err.message
|
||||||
|
);
|
||||||
|
},
|
||||||
|
})
|
||||||
|
.render('#paypal-button');
|
||||||
|
});
|
||||||
|
})
|
||||||
|
.catch(function (err) {
|
||||||
|
console.log(err.message);
|
||||||
|
|
||||||
|
BraintreePayPal.handleErrorMessage(err.message);
|
||||||
});
|
});
|
||||||
}).then(function (paypalCheckoutInstance) {
|
|
||||||
return paypalCheckoutInstance.loadPayPalSDK({
|
|
||||||
vault: true
|
|
||||||
}).then(function (paypalCheckoutInstance) {
|
|
||||||
return paypal.Buttons({
|
|
||||||
fundingSource: paypal.FUNDING.PAYPAL,
|
|
||||||
|
|
||||||
createBillingAgreement: function () {
|
|
||||||
return paypalCheckoutInstance.createPayment(BraintreePayPal.getPaymentDetails());
|
|
||||||
},
|
|
||||||
|
|
||||||
onApprove: function (data, actions) {
|
|
||||||
return paypalCheckoutInstance.tokenizePayment(data).then(function (payload) {
|
|
||||||
document.querySelector('#paypal-button')?.classList.add('hidden');
|
|
||||||
document.querySelector('#paypal-spinner')?.classList.remove('hidden');
|
|
||||||
|
|
||||||
let tokenBillingCheckbox = document.querySelector(
|
|
||||||
'input[name="token-billing-checkbox"]:checked'
|
|
||||||
);
|
|
||||||
|
|
||||||
if (tokenBillingCheckbox) {
|
|
||||||
document.querySelector('input[name="store_card"]').value =
|
|
||||||
tokenBillingCheckbox.value;
|
|
||||||
}
|
|
||||||
|
|
||||||
document.querySelector('input[name=gateway_response]').value = JSON.stringify(payload);
|
|
||||||
document.getElementById('server-response').submit();
|
|
||||||
});
|
|
||||||
},
|
|
||||||
|
|
||||||
onCancel: function (data) {
|
|
||||||
// ..
|
|
||||||
},
|
|
||||||
|
|
||||||
onError: function (err) {
|
|
||||||
console.log(err.message);
|
|
||||||
|
|
||||||
BraintreePayPal.handleErrorMessage(err.message);
|
|
||||||
}
|
|
||||||
}).render('#paypal-button');
|
|
||||||
});
|
|
||||||
}).catch(function (err) {
|
|
||||||
console.log(err.message);
|
|
||||||
|
|
||||||
BraintreePayPal.handleErrorMessage(err.message);
|
|
||||||
});
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
function boot() {
|
function boot() {
|
||||||
new BraintreePayPal().handle();
|
new BraintreePayPal().handle();
|
||||||
|
|
||||||
|
/** @type {NodeListOf<HTMLInputElement>} */
|
||||||
|
const tokens = document.querySelectorAll('input.toggle-payment-with-token');
|
||||||
|
|
||||||
|
if (tokens.length > 0) {
|
||||||
|
tokens[0].click();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
instant() ? boot() : wait('#braintree-paypal-payment').then(() => boot());
|
instant() ? boot() : wait('#braintree-paypal-payment').then(() => boot());
|
||||||
|
@ -110,9 +110,14 @@ class CheckoutCreditCard {
|
|||||||
}
|
}
|
||||||
|
|
||||||
function boot() {
|
function boot() {
|
||||||
new CheckoutCreditCard().handle()
|
new CheckoutCreditCard().handle();
|
||||||
|
|
||||||
|
/** @type {NodeListOf<HTMLInputElement>} */
|
||||||
|
const tokens = document.querySelectorAll('input.toggle-payment-with-token');
|
||||||
|
|
||||||
|
if (tokens.length > 0) {
|
||||||
|
tokens[0].click();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
instant() ? boot() : wait('#checkout-credit-card-payment').then(() =>
|
instant() ? boot() : wait('#checkout-credit-card-payment').then(() => boot());
|
||||||
new CheckoutCreditCard().handle()
|
|
||||||
);
|
|
||||||
|
@ -497,8 +497,9 @@ class EwayRapid {
|
|||||||
document
|
document
|
||||||
.getElementById('eway-secure-panel')
|
.getElementById('eway-secure-panel')
|
||||||
.classList.remove('hidden');
|
.classList.remove('hidden');
|
||||||
document.getElementById('save-card--container').style.display =
|
document.getElementById(
|
||||||
'grid';
|
'save-card--container'
|
||||||
|
).style.display = 'grid';
|
||||||
document.querySelector('input[name=token]').value = '';
|
document.querySelector('input[name=token]').value = '';
|
||||||
document.getElementById('pay-now').disabled = true;
|
document.getElementById('pay-now').disabled = true;
|
||||||
});
|
});
|
||||||
@ -523,6 +524,13 @@ class EwayRapid {
|
|||||||
|
|
||||||
function boot() {
|
function boot() {
|
||||||
new EwayRapid().handle();
|
new EwayRapid().handle();
|
||||||
|
|
||||||
|
/** @type {NodeListOf<HTMLInputElement>} */
|
||||||
|
const tokens = document.querySelectorAll('input.toggle-payment-with-token');
|
||||||
|
|
||||||
|
if (tokens.length > 0) {
|
||||||
|
tokens[0].click();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
instant() ? boot() : wait('#eway-credit-card-payment').then(() => boot());
|
instant() ? boot() : wait('#eway-credit-card-payment').then(() => boot());
|
||||||
|
@ -122,9 +122,8 @@ class _Mollie {
|
|||||||
tokenBillingCheckbox.value;
|
tokenBillingCheckbox.value;
|
||||||
}
|
}
|
||||||
|
|
||||||
document.querySelector(
|
document.querySelector('input[name=gateway_response]').value =
|
||||||
'input[name=gateway_response]'
|
token;
|
||||||
).value = token;
|
|
||||||
document.querySelector('input[name=token]').value = '';
|
document.querySelector('input[name=token]').value = '';
|
||||||
|
|
||||||
document.getElementById('server-response').submit();
|
document.getElementById('server-response').submit();
|
||||||
@ -168,9 +167,15 @@ class _Mollie {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
function boot() {
|
function boot() {
|
||||||
new _Mollie().handle();
|
new _Mollie().handle();
|
||||||
|
|
||||||
|
/** @type {NodeListOf<HTMLInputElement>} */
|
||||||
|
const tokens = document.querySelectorAll('input.toggle-payment-with-token');
|
||||||
|
|
||||||
|
if (tokens.length > 0) {
|
||||||
|
tokens[0].click();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
instant() ? boot(): wait('#mollie-credit-card-payment').then(() => boot());
|
instant() ? boot() : wait('#mollie-credit-card-payment').then(() => boot());
|
||||||
|
@ -19,80 +19,80 @@ class PayTraceCreditCard {
|
|||||||
|
|
||||||
get creditCardStyles() {
|
get creditCardStyles() {
|
||||||
return {
|
return {
|
||||||
'font_color': '#000',
|
font_color: '#000',
|
||||||
'border_color': '#a1b1c9',
|
border_color: '#a1b1c9',
|
||||||
'border_style': 'dotted',
|
border_style: 'dotted',
|
||||||
'font_size': '13pt',
|
font_size: '13pt',
|
||||||
'input_border_radius': '3px',
|
input_border_radius: '3px',
|
||||||
'input_border_width': '1px',
|
input_border_width: '1px',
|
||||||
'input_font': 'Times New Roman, arial, fantasy',
|
input_font: 'Times New Roman, arial, fantasy',
|
||||||
'input_font_weight': '400',
|
input_font_weight: '400',
|
||||||
'input_margin': '5px 0px 5px 0px',
|
input_margin: '5px 0px 5px 0px',
|
||||||
'input_padding': '0px 5px 0px 5px',
|
input_padding: '0px 5px 0px 5px',
|
||||||
'label_color': '#a0aec0',
|
label_color: '#a0aec0',
|
||||||
'label_size': '16px',
|
label_size: '16px',
|
||||||
'label_width': '150px',
|
label_width: '150px',
|
||||||
'label_font': 'Times New Roman, sans-serif, serif',
|
label_font: 'Times New Roman, sans-serif, serif',
|
||||||
'label_font_weight': 'light',
|
label_font_weight: 'light',
|
||||||
'label_margin': '5px 0px 0px 0px',
|
label_margin: '5px 0px 0px 0px',
|
||||||
'label_padding': '0px 5px 0px 5px',
|
label_padding: '0px 5px 0px 5px',
|
||||||
'background_color': 'white',
|
background_color: 'white',
|
||||||
'height': '30px',
|
height: '30px',
|
||||||
'width': '370px',
|
width: '370px',
|
||||||
'padding_bottom': '0px'
|
padding_bottom: '0px',
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
get codeStyles() {
|
get codeStyles() {
|
||||||
return {
|
return {
|
||||||
'font_color': '#000',
|
font_color: '#000',
|
||||||
'border_color': '#a1b1c9',
|
border_color: '#a1b1c9',
|
||||||
'border_style': 'dotted',
|
border_style: 'dotted',
|
||||||
'font_size': '13pt',
|
font_size: '13pt',
|
||||||
'input_border_radius': '2px',
|
input_border_radius: '2px',
|
||||||
'input_border_width': '1px',
|
input_border_width: '1px',
|
||||||
'input_font': 'serif, cursive, fantasy',
|
input_font: 'serif, cursive, fantasy',
|
||||||
'input_font_weight': '700',
|
input_font_weight: '700',
|
||||||
'input_margin': '5px 0px 5px 20px',
|
input_margin: '5px 0px 5px 20px',
|
||||||
'input_padding': '0px 5px 0px 5px',
|
input_padding: '0px 5px 0px 5px',
|
||||||
'label_color': '#a0aec0',
|
label_color: '#a0aec0',
|
||||||
'label_size': '16px',
|
label_size: '16px',
|
||||||
'label_width': '150px',
|
label_width: '150px',
|
||||||
'label_font': 'sans-serif, arial, serif',
|
label_font: 'sans-serif, arial, serif',
|
||||||
'label_font_weight': 'bold',
|
label_font_weight: 'bold',
|
||||||
'label_margin': '5px 0px 0px 20px',
|
label_margin: '5px 0px 0px 20px',
|
||||||
'label_padding': '2px 5px 2px 5px',
|
label_padding: '2px 5px 2px 5px',
|
||||||
'background_color': 'white',
|
background_color: 'white',
|
||||||
'height': '30px',
|
height: '30px',
|
||||||
'width': '150px',
|
width: '150px',
|
||||||
'padding_bottom': '2px'
|
padding_bottom: '2px',
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
get expStyles() {
|
get expStyles() {
|
||||||
return {
|
return {
|
||||||
'font_color': '#000',
|
font_color: '#000',
|
||||||
'border_color': '#a1b1c9',
|
border_color: '#a1b1c9',
|
||||||
'border_style': 'dashed',
|
border_style: 'dashed',
|
||||||
'font_size': '12pt',
|
font_size: '12pt',
|
||||||
'input_border_radius': '0px',
|
input_border_radius: '0px',
|
||||||
'input_border_width': '2px',
|
input_border_width: '2px',
|
||||||
'input_font': 'arial, cursive, fantasy',
|
input_font: 'arial, cursive, fantasy',
|
||||||
'input_font_weight': '400',
|
input_font_weight: '400',
|
||||||
'input_margin': '5px 0px 5px 0px',
|
input_margin: '5px 0px 5px 0px',
|
||||||
'input_padding': '0px 5px 0px 5px',
|
input_padding: '0px 5px 0px 5px',
|
||||||
'label_color': '#a0aec0',
|
label_color: '#a0aec0',
|
||||||
'label_size': '16px',
|
label_size: '16px',
|
||||||
'label_width': '150px',
|
label_width: '150px',
|
||||||
'label_font': 'arial, fantasy, serif',
|
label_font: 'arial, fantasy, serif',
|
||||||
'label_font_weight': 'normal',
|
label_font_weight: 'normal',
|
||||||
'label_margin': '5px 0px 0px 0px',
|
label_margin: '5px 0px 0px 0px',
|
||||||
'label_padding': '2px 5px 2px 5px',
|
label_padding: '2px 5px 2px 5px',
|
||||||
'background_color': 'white',
|
background_color: 'white',
|
||||||
'height': '30px',
|
height: '30px',
|
||||||
'width': '85px',
|
width: '85px',
|
||||||
'padding_bottom': '2px',
|
padding_bottom: '2px',
|
||||||
'type': 'dropdown'
|
type: 'dropdown',
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -139,7 +139,6 @@ class PayTraceCreditCard {
|
|||||||
errorsContainer.textContent = errors[0].description;
|
errorsContainer.textContent = errors[0].description;
|
||||||
errorsContainer.hidden = false;
|
errorsContainer.hidden = false;
|
||||||
|
|
||||||
|
|
||||||
button.querySelector('svg').classList.add('hidden');
|
button.querySelector('svg').classList.add('hidden');
|
||||||
button.querySelector('span').classList.remove('hidden');
|
button.querySelector('span').classList.remove('hidden');
|
||||||
|
|
||||||
@ -167,9 +166,8 @@ class PayTraceCreditCard {
|
|||||||
document.getElementById('server_response').submit();
|
document.getElementById('server_response').submit();
|
||||||
})
|
})
|
||||||
.catch((error) => {
|
.catch((error) => {
|
||||||
document.getElementById(
|
document.getElementById('errors').textContent =
|
||||||
'errors'
|
JSON.stringify(error);
|
||||||
).textContent = JSON.stringify(error);
|
|
||||||
document.getElementById('errors').hidden = false;
|
document.getElementById('errors').hidden = false;
|
||||||
|
|
||||||
button.querySelector('svg').classList.add('hidden');
|
button.querySelector('svg').classList.add('hidden');
|
||||||
@ -192,7 +190,6 @@ class PayTraceCreditCard {
|
|||||||
}
|
}
|
||||||
|
|
||||||
handle() {
|
handle() {
|
||||||
|
|
||||||
Array.from(
|
Array.from(
|
||||||
document.getElementsByClassName('toggle-payment-with-token')
|
document.getElementsByClassName('toggle-payment-with-token')
|
||||||
).forEach((element) =>
|
).forEach((element) =>
|
||||||
@ -200,9 +197,8 @@ class PayTraceCreditCard {
|
|||||||
document
|
document
|
||||||
.getElementById('paytrace--credit-card-container')
|
.getElementById('paytrace--credit-card-container')
|
||||||
.classList.add('hidden');
|
.classList.add('hidden');
|
||||||
document.getElementById(
|
document.getElementById('save-card--container').style.display =
|
||||||
'save-card--container'
|
'none';
|
||||||
).style.display = 'none';
|
|
||||||
document.querySelector('input[name=token]').value =
|
document.querySelector('input[name=token]').value =
|
||||||
element.target.dataset.token;
|
element.target.dataset.token;
|
||||||
})
|
})
|
||||||
@ -214,9 +210,8 @@ class PayTraceCreditCard {
|
|||||||
document
|
document
|
||||||
.getElementById('paytrace--credit-card-container')
|
.getElementById('paytrace--credit-card-container')
|
||||||
.classList.remove('hidden');
|
.classList.remove('hidden');
|
||||||
document.getElementById(
|
document.getElementById('save-card--container').style.display =
|
||||||
'save-card--container'
|
'grid';
|
||||||
).style.display = 'grid';
|
|
||||||
document.querySelector('input[name=token]').value = '';
|
document.querySelector('input[name=token]').value = '';
|
||||||
|
|
||||||
this.setupPayTrace().then((instance) => {
|
this.setupPayTrace().then((instance) => {
|
||||||
@ -225,19 +220,20 @@ class PayTraceCreditCard {
|
|||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
document
|
document.getElementById('pay-now').addEventListener('click', (e) => {
|
||||||
.getElementById('pay-now')
|
if (document.querySelector('input[name=token]').value === '') {
|
||||||
.addEventListener('click', (e) => {
|
return this.handlePaymentWithCreditCard(e);
|
||||||
if (
|
}
|
||||||
document.querySelector('input[name=token]').value === ''
|
|
||||||
) {
|
|
||||||
return this.handlePaymentWithCreditCard(e);
|
|
||||||
}
|
|
||||||
|
|
||||||
return this.handlePaymentWithToken(e);
|
return this.handlePaymentWithToken(e);
|
||||||
});
|
});
|
||||||
|
|
||||||
if (Array.from(document.getElementsByClassName('toggle-payment-with-token')).length === 0 && !instant()) {
|
if (
|
||||||
|
Array.from(
|
||||||
|
document.getElementsByClassName('toggle-payment-with-token')
|
||||||
|
).length === 0 &&
|
||||||
|
!instant()
|
||||||
|
) {
|
||||||
document.getElementById('toggle-payment-with-credit-card').click();
|
document.getElementById('toggle-payment-with-credit-card').click();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -245,6 +241,13 @@ class PayTraceCreditCard {
|
|||||||
|
|
||||||
function boot() {
|
function boot() {
|
||||||
new PayTraceCreditCard().handle();
|
new PayTraceCreditCard().handle();
|
||||||
|
|
||||||
|
/** @type {NodeListOf<HTMLInputElement>} */
|
||||||
|
const tokens = document.querySelectorAll('input.toggle-payment-with-token');
|
||||||
|
|
||||||
|
if (tokens.length > 0) {
|
||||||
|
tokens[0].click();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
instant() ? boot() : wait('#paytrace-credit-card-payment').then(() => boot())
|
instant() ? boot() : wait('#paytrace-credit-card-payment').then(() => boot());
|
||||||
|
@ -158,10 +158,11 @@ function pay() {
|
|||||||
})
|
})
|
||||||
);
|
);
|
||||||
|
|
||||||
const first = document.querySelector('input[name="payment-type"]');
|
/** @type {NodeListOf<HTMLInputElement>} */
|
||||||
|
const tokens = document.querySelectorAll('input.toggle-payment-with-token');
|
||||||
|
|
||||||
if (first) {
|
if (tokens.length > 0) {
|
||||||
first.click();
|
tokens[0].click();
|
||||||
}
|
}
|
||||||
|
|
||||||
if (focusCreditCard) {
|
if (focusCreditCard) {
|
||||||
|
@ -80,12 +80,11 @@ class SquareCreditCard {
|
|||||||
|
|
||||||
verificationToken = verificationResults.token;
|
verificationToken = verificationResults.token;
|
||||||
} catch (typeError) {
|
} catch (typeError) {
|
||||||
e.target.parentElement.disabled = true
|
e.target.parentElement.disabled = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
document.querySelector(
|
document.querySelector('input[name="verificationToken"]').value =
|
||||||
'input[name="verificationToken"]'
|
verificationToken;
|
||||||
).value = verificationToken;
|
|
||||||
|
|
||||||
if (result.status === 'OK') {
|
if (result.status === 'OK') {
|
||||||
document.getElementById('sourceId').value = result.token;
|
document.getElementById('sourceId').value = result.token;
|
||||||
@ -147,26 +146,27 @@ class SquareCreditCard {
|
|||||||
}
|
}
|
||||||
|
|
||||||
async handle() {
|
async handle() {
|
||||||
|
|
||||||
document.getElementById('payment-list').classList.add('hidden');
|
document.getElementById('payment-list').classList.add('hidden');
|
||||||
|
|
||||||
await this.init().then(() => {
|
await this.init().then(() => {
|
||||||
|
|
||||||
document
|
document
|
||||||
.getElementById('authorize-card')
|
.getElementById('authorize-card')
|
||||||
?.addEventListener('click', (e) =>
|
?.addEventListener('click', (e) =>
|
||||||
this.completePaymentWithoutToken(e)
|
this.completePaymentWithoutToken(e)
|
||||||
);
|
);
|
||||||
|
|
||||||
document.getElementById('pay-now')?.addEventListener('click', (e) => {
|
document
|
||||||
let tokenInput = document.querySelector('input[name=token]');
|
.getElementById('pay-now')
|
||||||
|
?.addEventListener('click', (e) => {
|
||||||
|
let tokenInput =
|
||||||
|
document.querySelector('input[name=token]');
|
||||||
|
|
||||||
if (tokenInput.value) {
|
if (tokenInput.value) {
|
||||||
return this.completePaymentUsingToken(e);
|
return this.completePaymentUsingToken(e);
|
||||||
}
|
}
|
||||||
|
|
||||||
return this.completePaymentWithoutToken(e);
|
return this.completePaymentWithoutToken(e);
|
||||||
});
|
});
|
||||||
|
|
||||||
Array.from(
|
Array.from(
|
||||||
document.getElementsByClassName('toggle-payment-with-token')
|
document.getElementsByClassName('toggle-payment-with-token')
|
||||||
@ -175,8 +175,9 @@ class SquareCreditCard {
|
|||||||
document
|
document
|
||||||
.getElementById('card-container')
|
.getElementById('card-container')
|
||||||
.classList.add('hidden');
|
.classList.add('hidden');
|
||||||
document.getElementById('save-card--container').style.display =
|
document.getElementById(
|
||||||
'none';
|
'save-card--container'
|
||||||
|
).style.display = 'none';
|
||||||
document.querySelector('input[name=token]').value =
|
document.querySelector('input[name=token]').value =
|
||||||
element.target.dataset.token;
|
element.target.dataset.token;
|
||||||
})
|
})
|
||||||
@ -188,29 +189,33 @@ class SquareCreditCard {
|
|||||||
document
|
document
|
||||||
.getElementById('card-container')
|
.getElementById('card-container')
|
||||||
.classList.remove('hidden');
|
.classList.remove('hidden');
|
||||||
document.getElementById('save-card--container').style.display =
|
document.getElementById(
|
||||||
'grid';
|
'save-card--container'
|
||||||
|
).style.display = 'grid';
|
||||||
document.querySelector('input[name=token]').value = '';
|
document.querySelector('input[name=token]').value = '';
|
||||||
});
|
});
|
||||||
|
|
||||||
Array.from(
|
Array.from(document.getElementsByClassName('loader')).forEach(
|
||||||
document.getElementsByClassName('loader')
|
(element) => {
|
||||||
).forEach((element) => {
|
|
||||||
|
|
||||||
element.classList.add('hidden');
|
element.classList.add('hidden');
|
||||||
|
}
|
||||||
});
|
);
|
||||||
|
|
||||||
document.getElementById('payment-list').classList.remove('hidden');
|
document.getElementById('payment-list').classList.remove('hidden');
|
||||||
document.getElementById('toggle-payment-with-credit-card')?.click();
|
document.getElementById('toggle-payment-with-credit-card')?.click();
|
||||||
|
|
||||||
});
|
});
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
function boot() {
|
function boot() {
|
||||||
new SquareCreditCard().handle();
|
new SquareCreditCard().handle();
|
||||||
|
|
||||||
|
/** @type {NodeListOf<HTMLInputElement>} */
|
||||||
|
const tokens = document.querySelectorAll('input.toggle-payment-with-token');
|
||||||
|
|
||||||
|
if (tokens.length > 0) {
|
||||||
|
tokens[0].click();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
instant() ? boot() : wait('#square-credit-card-payment').then(() => boot());
|
instant() ? boot() : wait('#square-credit-card-payment').then(() => boot());
|
||||||
|
@ -248,6 +248,13 @@ function boot() {
|
|||||||
);
|
);
|
||||||
|
|
||||||
s.handle();
|
s.handle();
|
||||||
|
|
||||||
|
/** @type {NodeListOf<HTMLInputElement>} */
|
||||||
|
const tokens = document.querySelectorAll('input.toggle-payment-with-token');
|
||||||
|
|
||||||
|
if (tokens.length > 0) {
|
||||||
|
tokens[0].click();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
instant() ? boot() : wait('#stripe-credit-card-payment').then(() => boot());
|
instant() ? boot() : wait('#stripe-credit-card-payment').then(() => boot());
|
||||||
|
102
resources/js/clients/payments/stripe-sepa.js
vendored
102
resources/js/clients/payments/stripe-sepa.js
vendored
@ -18,13 +18,10 @@ class ProcessSEPA {
|
|||||||
}
|
}
|
||||||
|
|
||||||
setupStripe = () => {
|
setupStripe = () => {
|
||||||
|
|
||||||
if (this.stripeConnect) {
|
if (this.stripeConnect) {
|
||||||
|
|
||||||
this.stripe = Stripe(this.key, {
|
this.stripe = Stripe(this.key, {
|
||||||
stripeAccount: this.stripeConnect,
|
stripeAccount: this.stripeConnect,
|
||||||
});
|
});
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
this.stripe = Stripe(this.key);
|
this.stripe = Stripe(this.key);
|
||||||
}
|
}
|
||||||
@ -33,7 +30,8 @@ class ProcessSEPA {
|
|||||||
var style = {
|
var style = {
|
||||||
base: {
|
base: {
|
||||||
color: '#32325d',
|
color: '#32325d',
|
||||||
fontFamily: '-apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif',
|
fontFamily:
|
||||||
|
'-apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif',
|
||||||
fontSmoothing: 'antialiased',
|
fontSmoothing: 'antialiased',
|
||||||
fontSize: '16px',
|
fontSize: '16px',
|
||||||
'::placeholder': {
|
'::placeholder': {
|
||||||
@ -63,8 +61,11 @@ class ProcessSEPA {
|
|||||||
this.iban = elements.create('iban', options);
|
this.iban = elements.create('iban', options);
|
||||||
this.iban.mount('#sepa-iban');
|
this.iban.mount('#sepa-iban');
|
||||||
|
|
||||||
document.getElementById('sepa-name').value = document.querySelector('meta[name=client_name]').content;
|
document.getElementById('sepa-name').value = document.querySelector(
|
||||||
document.getElementById('sepa-email-address').value = document.querySelector('meta[name=client_email]').content;
|
'meta[name=client_name]'
|
||||||
|
).content;
|
||||||
|
document.getElementById('sepa-email-address').value =
|
||||||
|
document.querySelector('meta[name=client_email]').content;
|
||||||
|
|
||||||
return this;
|
return this;
|
||||||
};
|
};
|
||||||
@ -98,19 +99,26 @@ class ProcessSEPA {
|
|||||||
});
|
});
|
||||||
|
|
||||||
document.getElementById('pay-now').addEventListener('click', (e) => {
|
document.getElementById('pay-now').addEventListener('click', (e) => {
|
||||||
|
if (
|
||||||
if (document.querySelector('input[name=token]').value.length !== 0) {
|
document.querySelector('input[name=token]').value.length !== 0
|
||||||
|
) {
|
||||||
document.getElementById('pay-now').disabled = true;
|
document.getElementById('pay-now').disabled = true;
|
||||||
document.querySelector('#pay-now > svg').classList.remove('hidden');
|
document
|
||||||
document.querySelector('#pay-now > span').classList.add('hidden');
|
.querySelector('#pay-now > svg')
|
||||||
|
.classList.remove('hidden');
|
||||||
|
document
|
||||||
|
.querySelector('#pay-now > span')
|
||||||
|
.classList.add('hidden');
|
||||||
|
|
||||||
this.stripe
|
this.stripe
|
||||||
.confirmSepaDebitPayment(
|
.confirmSepaDebitPayment(
|
||||||
document.querySelector('meta[name=pi-client-secret')
|
document.querySelector('meta[name=pi-client-secret')
|
||||||
.content, {
|
.content,
|
||||||
payment_method: document.querySelector('input[name=token]').value
|
{
|
||||||
}
|
payment_method:
|
||||||
|
document.querySelector('input[name=token]')
|
||||||
|
.value,
|
||||||
|
}
|
||||||
)
|
)
|
||||||
.then((result) => {
|
.then((result) => {
|
||||||
if (result.error) {
|
if (result.error) {
|
||||||
@ -119,9 +127,7 @@ class ProcessSEPA {
|
|||||||
|
|
||||||
return this.handleSuccess(result);
|
return this.handleSuccess(result);
|
||||||
});
|
});
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
|
|
||||||
if (document.getElementById('sepa-name').value === '') {
|
if (document.getElementById('sepa-name').value === '') {
|
||||||
document.getElementById('sepa-name').focus();
|
document.getElementById('sepa-name').focus();
|
||||||
errors.textContent = document.querySelector(
|
errors.textContent = document.querySelector(
|
||||||
@ -131,7 +137,9 @@ class ProcessSEPA {
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (document.getElementById('sepa-email-address').value === '') {
|
if (
|
||||||
|
document.getElementById('sepa-email-address').value === ''
|
||||||
|
) {
|
||||||
document.getElementById('sepa-email-address').focus();
|
document.getElementById('sepa-email-address').focus();
|
||||||
errors.textContent = document.querySelector(
|
errors.textContent = document.querySelector(
|
||||||
'meta[name=translation-email-required]'
|
'meta[name=translation-email-required]'
|
||||||
@ -140,7 +148,9 @@ class ProcessSEPA {
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!document.getElementById('sepa-mandate-acceptance').checked) {
|
if (
|
||||||
|
!document.getElementById('sepa-mandate-acceptance').checked
|
||||||
|
) {
|
||||||
errors.textContent = document.querySelector(
|
errors.textContent = document.querySelector(
|
||||||
'meta[name=translation-terms-required]'
|
'meta[name=translation-terms-required]'
|
||||||
).content;
|
).content;
|
||||||
@ -150,24 +160,29 @@ class ProcessSEPA {
|
|||||||
}
|
}
|
||||||
|
|
||||||
document.getElementById('pay-now').disabled = true;
|
document.getElementById('pay-now').disabled = true;
|
||||||
document.querySelector('#pay-now > svg').classList.remove('hidden');
|
document
|
||||||
document.querySelector('#pay-now > span').classList.add('hidden');
|
.querySelector('#pay-now > svg')
|
||||||
|
.classList.remove('hidden');
|
||||||
|
document
|
||||||
|
.querySelector('#pay-now > span')
|
||||||
|
.classList.add('hidden');
|
||||||
|
|
||||||
this.stripe
|
this.stripe
|
||||||
.confirmSepaDebitPayment(
|
.confirmSepaDebitPayment(
|
||||||
document.querySelector('meta[name=pi-client-secret')
|
document.querySelector('meta[name=pi-client-secret')
|
||||||
.content, {
|
.content,
|
||||||
payment_method: {
|
{
|
||||||
sepa_debit: this.iban,
|
payment_method: {
|
||||||
billing_details: {
|
sepa_debit: this.iban,
|
||||||
name: document.getElementById('sepa-name')
|
billing_details: {
|
||||||
.value,
|
name: document.getElementById('sepa-name')
|
||||||
email: document.getElementById(
|
.value,
|
||||||
'sepa-email-address'
|
email: document.getElementById(
|
||||||
).value,
|
'sepa-email-address'
|
||||||
|
).value,
|
||||||
|
},
|
||||||
},
|
},
|
||||||
},
|
}
|
||||||
}
|
|
||||||
)
|
)
|
||||||
.then((result) => {
|
.then((result) => {
|
||||||
if (result.error) {
|
if (result.error) {
|
||||||
@ -176,16 +191,13 @@ class ProcessSEPA {
|
|||||||
|
|
||||||
return this.handleSuccess(result);
|
return this.handleSuccess(result);
|
||||||
});
|
});
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
});
|
});
|
||||||
};
|
};
|
||||||
|
|
||||||
handleSuccess(result) {
|
handleSuccess(result) {
|
||||||
document.querySelector(
|
document.querySelector('input[name="gateway_response"]').value =
|
||||||
'input[name="gateway_response"]'
|
JSON.stringify(result.paymentIntent);
|
||||||
).value = JSON.stringify(result.paymentIntent);
|
|
||||||
|
|
||||||
let tokenBillingCheckbox = document.querySelector(
|
let tokenBillingCheckbox = document.querySelector(
|
||||||
'input[name="token-billing-checkbox"]:checked'
|
'input[name="token-billing-checkbox"]:checked'
|
||||||
@ -215,9 +227,8 @@ class ProcessSEPA {
|
|||||||
document.querySelector('#pay-now > span').classList.remove('hidden');
|
document.querySelector('#pay-now > span').classList.remove('hidden');
|
||||||
}
|
}
|
||||||
handleSuccess(result) {
|
handleSuccess(result) {
|
||||||
document.querySelector(
|
document.querySelector('input[name="gateway_response"]').value =
|
||||||
'input[name="gateway_response"]'
|
JSON.stringify(result.paymentIntent);
|
||||||
).value = JSON.stringify(result.paymentIntent);
|
|
||||||
|
|
||||||
let tokenBillingCheckbox = document.querySelector(
|
let tokenBillingCheckbox = document.querySelector(
|
||||||
'input[name="token-billing-checkbox"]:checked'
|
'input[name="token-billing-checkbox"]:checked'
|
||||||
@ -234,15 +245,20 @@ class ProcessSEPA {
|
|||||||
|
|
||||||
function boot() {
|
function boot() {
|
||||||
const publishableKey =
|
const publishableKey =
|
||||||
document.querySelector('meta[name="stripe-publishable-key"]')?.content ??
|
document.querySelector('meta[name="stripe-publishable-key"]')
|
||||||
'';
|
?.content ?? '';
|
||||||
|
|
||||||
const stripeConnect =
|
const stripeConnect =
|
||||||
document.querySelector('meta[name="stripe-account-id"]')?.content ?? '';
|
document.querySelector('meta[name="stripe-account-id"]')?.content ?? '';
|
||||||
|
|
||||||
new ProcessSEPA(publishableKey, stripeConnect).setupStripe().handle();
|
new ProcessSEPA(publishableKey, stripeConnect).setupStripe().handle();
|
||||||
|
|
||||||
|
/** @type {NodeListOf<HTMLInputElement>} */
|
||||||
|
const tokens = document.querySelectorAll('input.toggle-payment-with-token');
|
||||||
|
|
||||||
|
if (tokens.length > 0) {
|
||||||
|
tokens[0].click();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
instant() ? boot() : wait('#stripe-sepa-payment').then(() => boot());
|
instant() ? boot() : wait('#stripe-sepa-payment').then(() => boot());
|
||||||
|
|
||||||
instant() ? boot() : wait('#stripe-sepa-payment').then(() => boot());
|
|
@ -40,7 +40,7 @@
|
|||||||
@component('portal.ninja2020.components.general.card-element', ['title' => ctrans('texts.pay_with')])
|
@component('portal.ninja2020.components.general.card-element', ['title' => ctrans('texts.pay_with')])
|
||||||
@if (count($tokens) > 0)
|
@if (count($tokens) > 0)
|
||||||
@foreach ($tokens as $token)
|
@foreach ($tokens as $token)
|
||||||
<label class="mr-4">
|
<label class="flex items-center cursor-pointer px-2 mr-4 mb-2">
|
||||||
<input type="radio" data-token="{{ $token->token }}" name="payment-type"
|
<input type="radio" data-token="{{ $token->token }}" name="payment-type"
|
||||||
class="form-radio cursor-pointer toggle-payment-with-token" />
|
class="form-radio cursor-pointer toggle-payment-with-token" />
|
||||||
<span class="ml-1 cursor-pointer">**** {{ $token->meta?->last4 }}</span>
|
<span class="ml-1 cursor-pointer">**** {{ $token->meta?->last4 }}</span>
|
||||||
@ -48,7 +48,7 @@
|
|||||||
@endforeach
|
@endforeach
|
||||||
@endisset
|
@endisset
|
||||||
|
|
||||||
<label>
|
<label class="flex items-center cursor-pointer px-2">
|
||||||
<input type="radio" id="toggle-payment-with-new-bank-account" class="form-radio cursor-pointer" name="payment-type"
|
<input type="radio" id="toggle-payment-with-new-bank-account" class="form-radio cursor-pointer" name="payment-type"
|
||||||
checked />
|
checked />
|
||||||
<span class="ml-1 cursor-pointer">{{ __('texts.new_bank_account') }}</span>
|
<span class="ml-1 cursor-pointer">{{ __('texts.new_bank_account') }}</span>
|
||||||
|
Loading…
Reference in New Issue
Block a user