This commit is contained in:
Hillel Coren 2016-05-16 21:07:08 +03:00
parent 6b203fcd5e
commit dea596566f

View File

@ -13,7 +13,6 @@
var data = { var data = {
name: $('#first_name').val() + ' ' + $('#last_name').val(), name: $('#first_name').val() + ' ' + $('#last_name').val(),
email: $('#email').val(),
address_line1: $('#address1').val(), address_line1: $('#address1').val(),
address_line2: $('#address2').val(), address_line2: $('#address2').val(),
address_city: $('#city').val(), address_city: $('#city').val(),
@ -24,7 +23,7 @@
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 // allow space until there's a setting to disable
if ($('#cvv').val() != ' ') { if ($('#cvv').val() != ' ') {
data.cvc = $('#cvv').val(); data.cvc = $('#cvv').val();
@ -39,16 +38,16 @@
$('#js-error-message').html('{{ trans('texts.invalid_expiry') }}').fadeIn(); $('#js-error-message').html('{{ trans('texts.invalid_expiry') }}').fadeIn();
return false; return false;
} }
if (data.hasOwnProperty('cvc') && !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;
} }
// 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);
$('#js-error-message').hide(); $('#js-error-message').hide();
Stripe.card.createToken(data, stripeResponseHandler); Stripe.card.createToken(data, stripeResponseHandler);
// Prevent the form from submitting with the default action // Prevent the form from submitting with the default action
@ -324,9 +323,9 @@
{!! Button::success(strtoupper(trans('texts.pay_now') . ' - ' . $account->formatMoney($amount, $client, true) )) {!! Button::success(strtoupper(trans('texts.pay_now') . ' - ' . $account->formatMoney($amount, $client, true) ))
->submit() ->submit()
->large() !!} ->large() !!}
</center> </center>
<p>&nbsp;</p> <p>&nbsp;</p>
<div id="js-error-message" style="display:none" class="alert alert-danger"></div> <div id="js-error-message" style="display:none" class="alert alert-danger"></div>
</div> </div>
@ -354,4 +353,4 @@
</script> </script>
@stop @stop