mirror of
https://github.com/invoiceninja/invoiceninja.git
synced 2025-07-09 03:14:30 -04:00
Temporary workaround to support not setting the CVC/CVV
This commit is contained in:
parent
07f50d188f
commit
604c132a3a
@ -98,9 +98,13 @@ class PaymentService extends BaseService
|
|||||||
'number' => isset($input['card_number']) ? $input['card_number'] : null,
|
'number' => isset($input['card_number']) ? $input['card_number'] : null,
|
||||||
'expiryMonth' => isset($input['expiration_month']) ? $input['expiration_month'] : null,
|
'expiryMonth' => isset($input['expiration_month']) ? $input['expiration_month'] : null,
|
||||||
'expiryYear' => isset($input['expiration_year']) ? $input['expiration_year'] : null,
|
'expiryYear' => isset($input['expiration_year']) ? $input['expiration_year'] : null,
|
||||||
'cvv' => isset($input['cvv']) ? $input['cvv'] : '',
|
|
||||||
];
|
];
|
||||||
|
|
||||||
|
// allow space until there's a setting to disable
|
||||||
|
if (isset($input['cvv']) && $input['cvv'] != ' ') {
|
||||||
|
$data['cvv'] = $input['cvv'];
|
||||||
|
}
|
||||||
|
|
||||||
if (isset($input['country_id'])) {
|
if (isset($input['country_id'])) {
|
||||||
$country = Country::find($input['country_id']);
|
$country = Country::find($input['country_id']);
|
||||||
|
|
||||||
|
@ -20,11 +20,15 @@
|
|||||||
address_zip: $('#postal_code').val(),
|
address_zip: $('#postal_code').val(),
|
||||||
address_country: $("#country_id option:selected").text(),
|
address_country: $("#country_id option:selected").text(),
|
||||||
number: $('#card_number').val(),
|
number: $('#card_number').val(),
|
||||||
cvc: $('#cvv').val(),
|
|
||||||
exp_month: $('#expiration_month').val(),
|
exp_month: $('#expiration_month').val(),
|
||||||
exp_year: $('#expiration_year').val()
|
exp_year: $('#expiration_year').val()
|
||||||
};
|
};
|
||||||
|
|
||||||
|
// allow space until there's a setting to disable
|
||||||
|
if ($('#cvv').val() != ' ') {
|
||||||
|
data.cvc = $('#cvv').val();
|
||||||
|
}
|
||||||
|
|
||||||
// Validate the card details
|
// Validate the card details
|
||||||
if (!Stripe.card.validateCardNumber(data.number)) {
|
if (!Stripe.card.validateCardNumber(data.number)) {
|
||||||
$('#js-error-message').html('{{ trans('texts.invalid_card_number') }}').fadeIn();
|
$('#js-error-message').html('{{ trans('texts.invalid_card_number') }}').fadeIn();
|
||||||
@ -34,7 +38,8 @@
|
|||||||
$('#js-error-message').html('{{ trans('texts.invalid_expiry') }}').fadeIn();
|
$('#js-error-message').html('{{ trans('texts.invalid_expiry') }}').fadeIn();
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
if (!Stripe.card.validateCVC(data.cvc)) {
|
|
||||||
|
if (data.hasOwnProperty('cvc') && !Stripe.card.validateCVC(data.cvc)) {
|
||||||
$('#js-error-message').html('{{ trans('texts.invalid_cvv') }}').fadeIn();
|
$('#js-error-message').html('{{ trans('texts.invalid_cvv') }}').fadeIn();
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user