add braintree mandate
This commit is contained in:
parent
407b9661ca
commit
4fa9223beb
|
|
@ -1,9 +0,0 @@
|
||||||
import{i as l,w as c}from"./wait-8f4ae121.js";/**
|
|
||||||
* Invoice Ninja (https://invoiceninja.com).
|
|
||||||
*
|
|
||||||
* @link https://github.com/invoiceninja/invoiceninja source repository
|
|
||||||
*
|
|
||||||
* @copyright Copyright (c) 2021. Invoice Ninja LLC (https://invoiceninja.com)
|
|
||||||
*
|
|
||||||
* @license https://www.elastic.co/licensing/elastic-license
|
|
||||||
*/function i(){var o;window.braintree.client.create({authorization:(o=document.querySelector('meta[name="client-token"]'))==null?void 0:o.content}).then(function(t){return braintree.usBankAccount.create({client:t})}).then(function(t){var a;(a=document.getElementById("authorize-bank-account"))==null||a.addEventListener("click",r=>{r.target.parentElement.disabled=!0,document.getElementById("errors").hidden=!0,document.getElementById("errors").textContent="";let n={accountNumber:document.getElementById("account-number").value,routingNumber:document.getElementById("routing-number").value,accountType:document.querySelector('input[name="account-type"]:checked').value,ownershipType:document.querySelector('input[name="ownership-type"]:checked').value,billingAddress:{streetAddress:document.getElementById("billing-street-address").value,extendedAddress:document.getElementById("billing-extended-address").value,locality:document.getElementById("billing-locality").value,region:document.getElementById("billing-region").value,postalCode:document.getElementById("billing-postal-code").value}};if(n.ownershipType==="personal"){let e=document.getElementById("account-holder-name").value.split(" ",2);n.firstName=e[0],n.lastName=e[1]}else n.businessName=document.getElementById("account-holder-name").value;t.tokenize({bankDetails:n,mandateText:'By clicking ["Checkout"], I authorize Braintree, a service of PayPal, on behalf of [your business name here] (i) to verify my bank account information using bank information and consumer reports and (ii) to debit my bank account.'}).then(function(e){document.querySelector("input[name=nonce]").value=e.nonce,document.getElementById("server_response").submit()}).catch(function(e){r.target.parentElement.disabled=!1,document.getElementById("errors").textContent=`${e.details.originalError.message} ${e.details.originalError.details.originalError[0].message}`,document.getElementById("errors").hidden=!1})})}).catch(function(t){document.getElementById("errors").textContent=t.message,document.getElementById("errors").hidden=!1})}l()?i():c("#braintree-ach-authorize").then(()=>i());
|
|
||||||
|
|
@ -0,0 +1,9 @@
|
||||||
|
import{i as c,w as d}from"./wait-8f4ae121.js";/**
|
||||||
|
* Invoice Ninja (https://invoiceninja.com).
|
||||||
|
*
|
||||||
|
* @link https://github.com/invoiceninja/invoiceninja source repository
|
||||||
|
*
|
||||||
|
* @copyright Copyright (c) 2021. Invoice Ninja LLC (https://invoiceninja.com)
|
||||||
|
*
|
||||||
|
* @license https://www.elastic.co/licensing/elastic-license
|
||||||
|
*/function i(){var o;window.braintree.client.create({authorization:(o=document.querySelector('meta[name="client-token"]'))==null?void 0:o.content}).then(function(t){return braintree.usBankAccount.create({client:t})}).then(function(t){var r;(r=document.getElementById("authorize-bank-account"))==null||r.addEventListener("click",a=>{if(!document.getElementById("accept-terms").checked){errors.textContent="You must accept the mandate terms prior to making payment.",errors.hidden=!1;return}a.target.parentElement.disabled=!0,document.getElementById("errors").hidden=!0,document.getElementById("errors").textContent="";let n={accountNumber:document.getElementById("account-number").value,routingNumber:document.getElementById("routing-number").value,accountType:document.querySelector('input[name="account-type"]:checked').value,ownershipType:document.querySelector('input[name="ownership-type"]:checked').value,billingAddress:{streetAddress:document.getElementById("billing-street-address").value,extendedAddress:document.getElementById("billing-extended-address").value,locality:document.getElementById("billing-locality").value,region:document.getElementById("billing-region").value,postalCode:document.getElementById("billing-postal-code").value}};if(n.ownershipType==="personal"){let e=document.getElementById("account-holder-name").value.split(" ",2);n.firstName=e[0],n.lastName=e[1]}else n.businessName=document.getElementById("account-holder-name").value;t.tokenize({bankDetails:n,mandateText:'By clicking ["Checkout"], I authorize Braintree, a service of PayPal, on behalf of [your business name here] (i) to verify my bank account information using bank information and consumer reports and (ii) to debit my bank account.'}).then(function(e){document.querySelector("input[name=nonce]").value=e.nonce,document.getElementById("server_response").submit()}).catch(function(e){a.target.parentElement.disabled=!1,document.getElementById("errors").textContent=`${e.details.originalError.message} ${e.details.originalError.details.originalError[0].message}`,document.getElementById("errors").hidden=!1})})}).catch(function(t){document.getElementById("errors").textContent=t.message,document.getElementById("errors").hidden=!1})}c()?i():d("#braintree-ach-authorize").then(()=>i());
|
||||||
|
|
@ -70,7 +70,7 @@
|
||||||
"src": "resources/js/clients/payment_methods/authorize-stripe-acss.js"
|
"src": "resources/js/clients/payment_methods/authorize-stripe-acss.js"
|
||||||
},
|
},
|
||||||
"resources/js/clients/payment_methods/braintree-ach.js": {
|
"resources/js/clients/payment_methods/braintree-ach.js": {
|
||||||
"file": "assets/braintree-ach-3d6b328f.js",
|
"file": "assets/braintree-ach-78e45d03.js",
|
||||||
"imports": [
|
"imports": [
|
||||||
"_wait-8f4ae121.js"
|
"_wait-8f4ae121.js"
|
||||||
],
|
],
|
||||||
|
|
|
||||||
|
|
@ -21,6 +21,13 @@ function boot() {
|
||||||
document
|
document
|
||||||
.getElementById('authorize-bank-account')
|
.getElementById('authorize-bank-account')
|
||||||
?.addEventListener('click', (e) => {
|
?.addEventListener('click', (e) => {
|
||||||
|
|
||||||
|
if (!document.getElementById('accept-terms').checked) {
|
||||||
|
errors.textContent = "You must accept the mandate terms prior to making payment.";
|
||||||
|
errors.hidden = false;
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
e.target.parentElement.disabled = true;
|
e.target.parentElement.disabled = true;
|
||||||
|
|
||||||
document.getElementById('errors').hidden = true;
|
document.getElementById('errors').hidden = true;
|
||||||
|
|
|
||||||
|
|
@ -33,6 +33,11 @@
|
||||||
|
|
||||||
<div class="alert alert-failure mb-4" hidden id="errors"></div>
|
<div class="alert alert-failure mb-4" hidden id="errors"></div>
|
||||||
|
|
||||||
|
@component('portal.ninja2020.components.general.card-element-single')
|
||||||
|
<input type="checkbox" class="form-checkbox mr-1" id="accept-terms" required>
|
||||||
|
<label for="accept-terms" class="cursor-pointer">By clicking ["Add Payment Method"], I authorize Braintree, a service of PayPal, on behalf of <b>{{ $company->present()->name() }}</b> (i) to verify my bank account information using bank information and consumer reports and (ii) to debit my bank account.</label>
|
||||||
|
@endcomponent
|
||||||
|
|
||||||
@component('portal.ninja2020.components.general.card-element', ['title' => ctrans('texts.account_type')])
|
@component('portal.ninja2020.components.general.card-element', ['title' => ctrans('texts.account_type')])
|
||||||
<span class="flex items-center mr-4">
|
<span class="flex items-center mr-4">
|
||||||
<input class="form-radio mr-2" type="radio" value="checking" name="account-type" checked>
|
<input class="form-radio mr-2" type="radio" value="checking" name="account-type" checked>
|
||||||
|
|
|
||||||
|
|
@ -29,6 +29,11 @@
|
||||||
|
|
||||||
<div class="alert alert-failure mb-4" hidden id="errors"></div>
|
<div class="alert alert-failure mb-4" hidden id="errors"></div>
|
||||||
|
|
||||||
|
@component('portal.ninja2020.components.general.card-element-single')
|
||||||
|
<input type="checkbox" class="form-checkbox mr-1" id="accept-terms" required>
|
||||||
|
<label for="accept-terms" class="cursor-pointer">By clicking ["Add Payment Method"], I authorize Braintree, a service of PayPal, on behalf of <b>{{ $company->present()->name() }}</b> (i) to verify my bank account information using bank information and consumer reports and (ii) to debit my bank account.</label>
|
||||||
|
@endcomponent
|
||||||
|
|
||||||
@component('portal.ninja2020.components.general.card-element', ['title' => ctrans('texts.account_type')])
|
@component('portal.ninja2020.components.general.card-element', ['title' => ctrans('texts.account_type')])
|
||||||
<span class="flex items-center mr-4">
|
<span class="flex items-center mr-4">
|
||||||
<input class="form-radio mr-2" type="radio" value="checking" name="account-type" checked>
|
<input class="form-radio mr-2" type="radio" value="checking" name="account-type" checked>
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue