Fix for using a space as the cvv

This commit is contained in:
Hillel Coren 2016-08-11 09:31:47 +03:00
parent 450a2dd356
commit 38ef857c14

View File

@ -23,7 +23,7 @@
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(), //cvc: $('#cvv').val(),
exp_month: $('#expiration_month').val(), exp_month: $('#expiration_month').val(),
exp_year: $('#expiration_year').val() exp_year: $('#expiration_year').val()
}; };
@ -37,10 +37,14 @@
$('#js-error-message').html('{{ trans('texts.invalid_expiry') }}').fadeIn(); $('#js-error-message').html('{{ trans('texts.invalid_expiry') }}').fadeIn();
return false; return false;
} }
if ($('#cvv').val() != ' ') {
data.cvv = $('#cvv').val();
if (!Stripe.card.validateCVC(data.cvc)) { if (!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;
} }
}
// Disable the submit button to prevent repeated clicks // Disable the submit button to prevent repeated clicks
$form.find('button').prop('disabled', true); $form.find('button').prop('disabled', true);