mirror of
https://github.com/invoiceninja/invoiceninja.git
synced 2025-07-09 03:14:30 -04: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'])){
|
if(in_array($response->state, ['authorized', 'captured'])){
|
||||||
//success
|
//success
|
||||||
nlog("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);
|
$this->processSuccessfulPayment($response, $payment_status);
|
||||||
}
|
}
|
||||||
@ -173,7 +173,7 @@ class CreditCard
|
|||||||
//some type of failure
|
//some type of failure
|
||||||
nlog("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);
|
$this->processUnSuccessfulPayment($response, $payment_status);
|
||||||
}
|
}
|
||||||
|
@ -121,6 +121,13 @@
|
|||||||
if (payNowButton) {
|
if (payNowButton) {
|
||||||
payNowButton
|
payNowButton
|
||||||
.addEventListener('click', (e) => {
|
.addEventListener('click', (e) => {
|
||||||
|
|
||||||
|
payNowButton.disabled = true;
|
||||||
|
|
||||||
|
payNowButton.querySelector('svg').classList.remove('hidden');
|
||||||
|
payNowButton.querySelector('span').classList.add('hidden');
|
||||||
|
|
||||||
|
|
||||||
let token = document.getElementById('token').value;
|
let token = document.getElementById('token').value;
|
||||||
|
|
||||||
/* Attach store card value to form */
|
/* Attach store card value to form */
|
||||||
@ -164,6 +171,7 @@
|
|||||||
function handleCardPayment(){
|
function handleCardPayment(){
|
||||||
|
|
||||||
var myCard = $('#my-card');
|
var myCard = $('#my-card');
|
||||||
|
let payNowButton = document.getElementById('pay-now');
|
||||||
|
|
||||||
if(document.getElementById('cardholder_name') == "") {
|
if(document.getElementById('cardholder_name') == "") {
|
||||||
document.getElementById('cardholder_name').focus();
|
document.getElementById('cardholder_name').focus();
|
||||||
@ -196,11 +204,7 @@
|
|||||||
return;
|
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(' ');
|
var userName = [valueById('cardholder_name')].join(' ');
|
||||||
response = WePay.credit_card.create({
|
response = WePay.credit_card.create({
|
||||||
@ -219,10 +223,10 @@
|
|||||||
if (data.error) {
|
if (data.error) {
|
||||||
//console.log(data);
|
//console.log(data);
|
||||||
// handle error response error_description
|
// handle error response error_description
|
||||||
cardButton = document.getElementById('card_button');
|
|
||||||
cardButton.disabled = false;
|
payNowButton.disabled = false;
|
||||||
cardButton.querySelector('svg').classList.add('hidden');
|
payNowButton.querySelector('svg').classList.add('hidden');
|
||||||
cardButton.querySelector('span').classList.remove('hidden');
|
payNowButton.querySelector('span').classList.remove('hidden');
|
||||||
|
|
||||||
errors.textContent = '';
|
errors.textContent = '';
|
||||||
errors.textContent = data.error_description;
|
errors.textContent = data.error_description;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user