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,
|
||||
'expiryMonth' => isset($input['expiration_month']) ? $input['expiration_month'] : 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'])) {
|
||||
$country = Country::find($input['country_id']);
|
||||
|
||||
|
@ -20,10 +20,14 @@
|
||||
address_zip: $('#postal_code').val(),
|
||||
address_country: $("#country_id option:selected").text(),
|
||||
number: $('#card_number').val(),
|
||||
cvc: $('#cvv').val(),
|
||||
exp_month: $('#expiration_month').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
|
||||
if (!Stripe.card.validateCardNumber(data.number)) {
|
||||
@ -34,11 +38,12 @@
|
||||
$('#js-error-message').html('{{ trans('texts.invalid_expiry') }}').fadeIn();
|
||||
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();
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
// Disable the submit button to prevent repeated clicks
|
||||
$form.find('button').prop('disabled', true);
|
||||
$('#js-error-message').hide();
|
||||
|
Loading…
x
Reference in New Issue
Block a user