mirror of
https://github.com/invoiceninja/invoiceninja.git
synced 2024-11-10 21:22:58 +01:00
Fixes for credit card payment
This commit is contained in:
parent
886e006de7
commit
1cea863e77
@ -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);
|
||||
}
|
||||
|
@ -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;
|
||||
|
Loading…
Reference in New Issue
Block a user