diff --git a/app/PaymentDrivers/WePay/CreditCard.php b/app/PaymentDrivers/WePay/CreditCard.php index 104efa8e28..acbd254083 100644 --- a/app/PaymentDrivers/WePay/CreditCard.php +++ b/app/PaymentDrivers/WePay/CreditCard.php @@ -164,7 +164,7 @@ class CreditCard if(in_array($response->state, ['authorized', 'captured'])){ //success nlog("success"); - $payment_status = ($response->status == 'authorized') ? Payment::STATUS_COMPLETED : Payment:STATUS_PENDING; + $payment_status = $response->status == 'authorized' ? Payment::STATUS_COMPLETED : Payment::STATUS_PENDING; $this->processSuccessfulPayment($response, $payment_status); } @@ -173,7 +173,7 @@ class CreditCard //some type of failure nlog("failure"); - $payment_status = ($response->status == 'cancelled') ? Payment::STATUS_CANCELLED : Payment:STATUS_FAILED; + $payment_status = $response->status == 'cancelled' ? Payment::STATUS_CANCELLED : Payment::STATUS_FAILED; $this->processUnSuccessfulPayment($response, $payment_status); } diff --git a/resources/views/portal/ninja2020/gateways/wepay/credit_card/pay.blade.php b/resources/views/portal/ninja2020/gateways/wepay/credit_card/pay.blade.php index 572fd27af2..6be603104f 100644 --- a/resources/views/portal/ninja2020/gateways/wepay/credit_card/pay.blade.php +++ b/resources/views/portal/ninja2020/gateways/wepay/credit_card/pay.blade.php @@ -121,6 +121,13 @@ if (payNowButton) { payNowButton .addEventListener('click', (e) => { + + payNowButton.disabled = true; + + payNowButton.querySelector('svg').classList.remove('hidden'); + payNowButton.querySelector('span').classList.add('hidden'); + + let token = document.getElementById('token').value; /* Attach store card value to form */ @@ -164,6 +171,7 @@ function handleCardPayment(){ var myCard = $('#my-card'); + let payNowButton = document.getElementById('pay-now'); if(document.getElementById('cardholder_name') == "") { document.getElementById('cardholder_name').focus(); @@ -196,11 +204,7 @@ return; } - cardButton = document.getElementById('card_button'); - cardButton.disabled = true; - cardButton.querySelector('svg').classList.remove('hidden'); - cardButton.querySelector('span').classList.add('hidden'); var userName = [valueById('cardholder_name')].join(' '); response = WePay.credit_card.create({ @@ -219,10 +223,10 @@ if (data.error) { //console.log(data); // handle error response error_description - cardButton = document.getElementById('card_button'); - cardButton.disabled = false; - cardButton.querySelector('svg').classList.add('hidden'); - cardButton.querySelector('span').classList.remove('hidden'); + + payNowButton.disabled = false; + payNowButton.querySelector('svg').classList.add('hidden'); + payNowButton.querySelector('span').classList.remove('hidden'); errors.textContent = ''; errors.textContent = data.error_description;