Support adding cardholder name to checkout.com meta data
This commit is contained in:
parent
bb7c37ed44
commit
9300829ded
|
|
@ -59,7 +59,7 @@ class CreditCard implements MethodInterface, LivewireMethodInterface
|
||||||
public function authorizeView($data)
|
public function authorizeView($data)
|
||||||
{
|
{
|
||||||
$data['gateway'] = $this->checkout;
|
$data['gateway'] = $this->checkout;
|
||||||
|
$data['cardholder_name'] = auth()->guard('contact')->user()->present()->name() ?? '';
|
||||||
return render('gateways.checkout.credit_card.authorize', $data);
|
return render('gateways.checkout.credit_card.authorize', $data);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -150,6 +150,7 @@ class CreditCard implements MethodInterface, LivewireMethodInterface
|
||||||
$data['value'] = $this->checkout->convertToCheckoutAmount($data['total']['amount_with_fee'], $this->checkout->client->getCurrencyCode());
|
$data['value'] = $this->checkout->convertToCheckoutAmount($data['total']['amount_with_fee'], $this->checkout->client->getCurrencyCode());
|
||||||
$data['raw_value'] = $data['total']['amount_with_fee'];
|
$data['raw_value'] = $data['total']['amount_with_fee'];
|
||||||
$data['customer_email'] = $this->checkout->client->present()->email();
|
$data['customer_email'] = $this->checkout->client->present()->email();
|
||||||
|
$data['cardholder_name'] = auth()->guard('contact')->user()->present()->name() ?? '';
|
||||||
|
|
||||||
return $data;
|
return $data;
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -1,9 +0,0 @@
|
||||||
/**
|
|
||||||
* 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
|
|
||||||
*/class t{constructor(){this.button=document.getElementById("pay-button")}init(){this.frames=Frames.init(document.querySelector("meta[name=public-key]").content)}handle(){this.init(),Frames.addEventHandler(Frames.Events.CARD_VALIDATION_CHANGED,e=>{this.button.disabled=!Frames.isCardValid()}),Frames.addEventHandler(Frames.Events.CARD_TOKENIZED,e=>{document.querySelector('input[name="gateway_response"]').value=JSON.stringify(e),document.getElementById("server_response").submit()}),document.querySelector("#authorization-form").addEventListener("submit",e=>{this.button.disabled=!0,e.preventDefault(),Frames.submitCard()})}}new t().handle();
|
|
||||||
|
|
@ -1,9 +0,0 @@
|
||||||
import{i,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
|
|
||||||
*/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());
|
|
||||||
|
|
@ -49,7 +49,7 @@
|
||||||
"src": "resources/js/clients/payment_methods/authorize-authorize-card.js"
|
"src": "resources/js/clients/payment_methods/authorize-authorize-card.js"
|
||||||
},
|
},
|
||||||
"resources/js/clients/payment_methods/authorize-checkout-card.js": {
|
"resources/js/clients/payment_methods/authorize-checkout-card.js": {
|
||||||
"file": "assets/authorize-checkout-card-d561d355.js",
|
"file": "assets/authorize-checkout-card-6a2d99f6.js",
|
||||||
"isEntry": true,
|
"isEntry": true,
|
||||||
"src": "resources/js/clients/payment_methods/authorize-checkout-card.js"
|
"src": "resources/js/clients/payment_methods/authorize-checkout-card.js"
|
||||||
},
|
},
|
||||||
|
|
@ -123,7 +123,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-f20e4c86.js",
|
"file": "assets/checkout-credit-card-ad69ad44.js",
|
||||||
"imports": [
|
"imports": [
|
||||||
"_wait-8f4ae121.js"
|
"_wait-8f4ae121.js"
|
||||||
],
|
],
|
||||||
|
|
|
||||||
|
|
@ -45,6 +45,11 @@ class CheckoutCreditCardAuthorization {
|
||||||
this.button.disabled = true;
|
this.button.disabled = true;
|
||||||
|
|
||||||
event.preventDefault();
|
event.preventDefault();
|
||||||
|
|
||||||
|
Frames.cardholder = {
|
||||||
|
name: document.querySelector('meta[name="cardholder_name"]').content ?? '',
|
||||||
|
};
|
||||||
|
|
||||||
Frames.submitCard();
|
Frames.submitCard();
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -75,6 +75,11 @@ class CheckoutCreditCard {
|
||||||
|
|
||||||
form.addEventListener('submit', function (event) {
|
form.addEventListener('submit', function (event) {
|
||||||
event.preventDefault();
|
event.preventDefault();
|
||||||
|
|
||||||
|
Frames.cardholder = {
|
||||||
|
name: document.querySelector('meta[name="cardholder_name"]').content ?? '',
|
||||||
|
};
|
||||||
|
|
||||||
payButton.disabled = true;
|
payButton.disabled = true;
|
||||||
Frames.submitCard();
|
Frames.submitCard();
|
||||||
});
|
});
|
||||||
|
|
|
||||||
|
|
@ -86,5 +86,10 @@ Frames.addEventHandler(Frames.Events.CARD_TOKENIZED, function(event) {
|
||||||
|
|
||||||
form.addEventListener('submit', function(event) {
|
form.addEventListener('submit', function(event) {
|
||||||
event.preventDefault();
|
event.preventDefault();
|
||||||
|
|
||||||
|
Frames.cardholder = {
|
||||||
|
name: document.querySelector('meta[name="cardholder_name"]').content ?? '',
|
||||||
|
};
|
||||||
|
|
||||||
Frames.submitCard();
|
Frames.submitCard();
|
||||||
});
|
});
|
||||||
|
|
|
||||||
|
|
@ -2,6 +2,7 @@
|
||||||
|
|
||||||
@section('gateway_head')
|
@section('gateway_head')
|
||||||
<meta name="public-key" content="{{ $gateway->getPublishableKey() }}">
|
<meta name="public-key" content="{{ $gateway->getPublishableKey() }}">
|
||||||
|
<meta name="cardholder_name" content="{{ $cardholder_name }}">
|
||||||
|
|
||||||
@include('portal.ninja2020.gateways.checkout.credit_card.includes.styles')
|
@include('portal.ninja2020.gateways.checkout.credit_card.includes.styles')
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -7,6 +7,7 @@
|
||||||
<meta name="currency" content="{{ $currency }}">
|
<meta name="currency" content="{{ $currency }}">
|
||||||
<meta name="reference" content="{{ $payment_hash }}">
|
<meta name="reference" content="{{ $payment_hash }}">
|
||||||
<meta name="instant-payment" content="yes" />
|
<meta name="instant-payment" content="yes" />
|
||||||
|
<meta name="cardholder_name" content="{{ $cardholder_name }}">
|
||||||
|
|
||||||
@include('portal.ninja2020.gateways.checkout.credit_card.includes.styles')
|
@include('portal.ninja2020.gateways.checkout.credit_card.includes.styles')
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -4,6 +4,7 @@
|
||||||
<meta name="value" content="{{ $value }}">
|
<meta name="value" content="{{ $value }}">
|
||||||
<meta name="currency" content="{{ $currency }}">
|
<meta name="currency" content="{{ $currency }}">
|
||||||
<meta name="reference" content="{{ $payment_hash }}">
|
<meta name="reference" content="{{ $payment_hash }}">
|
||||||
|
<meta name="cardholder_name" content="{{ $cardholder_name }}">
|
||||||
|
|
||||||
@include('portal.ninja2020.gateways.checkout.credit_card.includes.styles')
|
@include('portal.ninja2020.gateways.checkout.credit_card.includes.styles')
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue