Fixes for authorize page

This commit is contained in:
Benjamin Beganović 2021-08-19 11:05:06 +02:00
parent 7fe8fff43b
commit 6186cc1420
2 changed files with 8 additions and 3 deletions

View File

@ -78,13 +78,17 @@ class SquareCreditCard {
}
async handle() {
if (document.querySelector('meta[name=square-authorize]')) {
await this.init();
}
document
.getElementById('authorize-card')
?.addEventListener('click', (e) =>
this.completePaymentWithoutToken(e)
);
document.getElementById('pay-now').addEventListener('click', (e) => {
document.getElementById('pay-now')?.addEventListener('click', (e) => {
let tokenInput = document.querySelector('input[name=token]');
if (tokenInput.value) {
@ -110,7 +114,7 @@ class SquareCreditCard {
document
.getElementById('toggle-payment-with-credit-card')
.addEventListener('click', async (element) => {
?.addEventListener('click', async (element) => {
document
.getElementById('card-container')
.classList.remove('hidden');
@ -128,7 +132,7 @@ class SquareCreditCard {
);
if (!toggleWithToken) {
document.getElementById('toggle-payment-with-credit-card').click();
document.getElementById('toggle-payment-with-credit-card')?.click();
}
}
}

View File

@ -4,6 +4,7 @@
@section('gateway_head')
<meta name="square-appId" content="{{ $gateway->company_gateway->getConfigField('applicationId') }}">
<meta name="square-locationId" content="{{ $gateway->company_gateway->getConfigField('locationId') }}">
<meta name="square-authorize" content="true">
@endsection
@section('gateway_content')