diff --git a/resources/views/payments/credit_card.blade.php b/resources/views/payments/credit_card.blade.php index e06b0ad34..595a73430 100644 --- a/resources/views/payments/credit_card.blade.php +++ b/resources/views/payments/credit_card.blade.php @@ -322,7 +322,167 @@ @endif @if ($accountGateway->isGateway(GATEWAY_WEPAY) && $account->token_billing_type_id == TOKEN_BILLING_DISABLED) - {{--- do nothing ---}} + {{--- do nothing --}} + @elseif($accountGateway->isGateway(GATEWAY_STRIPE)) + +
+
+
+
+ +
+
+
+
+
+
+ +
+
+
+
+ +
+
+
+ + +
+ + @include("payments.stripe.credit_card_stripe_css") + + @else
@@ -463,4 +623,4 @@ {!! Former::close() !!} -@stop +@stop \ No newline at end of file diff --git a/resources/views/payments/stripe/credit_card.blade.php b/resources/views/payments/stripe/credit_card.blade.php index 51d3842c6..45d6e7cce 100644 --- a/resources/views/payments/stripe/credit_card.blade.php +++ b/resources/views/payments/stripe/credit_card.blade.php @@ -5,89 +5,7 @@ @if ($accountGateway->getPublishableKey()) - - if ($('[name=plaidAccountId]').length) { - return; - } - - var $form = $(this); - - var data = { - name: $('#first_name').val() + ' ' + $('#last_name').val(), - address_line1: $('#address1').val(), - address_line2: $('#address2').val(), - address_city: $('#city').val(), - address_state: $('#state').val(), - 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() - }; - - // Validate the card details - if (!Stripe.card.validateCardNumber(data.number)) { - $('#js-error-message').html('{{ trans('texts.invalid_card_number') }}').fadeIn(); - return false; - } - if (!Stripe.card.validateExpiry(data.exp_month, data.exp_year)) { - $('#js-error-message').html('{{ trans('texts.invalid_expiry') }}').fadeIn(); - return false; - } - - if ($('#cvv').val() != ' ') { - data.cvc = $('#cvv').val(); - if (!Stripe.card.validateCVC(data.cvc)) { - $('#js-error-message').html('{{ trans('texts.invalid_cvv') }}').fadeIn(); - return false; - } - } - - if ($form.find('button').is(':disabled')) { - return false; - } - - // Disable the submit button to prevent repeated clicks - $form.find('button').prop('disabled', true); - $('#js-error-message').hide(); - - Stripe.card.createToken(data, stripeResponseHandler); - - // Prevent the form from submitting with the default action - return false; - }); - - }); - - function stripeResponseHandler(status, response) { - var $form = $('.payment-form'); - - if (response.error) { - // Show the errors on the form - var error = response.error.message; - $form.find('button').prop('disabled', false); - $('#js-error-message').html(error).fadeIn(); - } else { - // response contains id and card, which contains additional card details - var token = response.id; - if (token) { - // Insert the token into the form so it gets submitted to the server - $form.append($('').val(token)); - // and submit - $form.get(0).submit(); - } else { - $('#js-error-message').html('An error occurred').fadeIn(); - $form.find('button').prop('disabled', false); - logError('STRIPE_ERROR: ' + JSON.stringify(response)); - } - } - }; - @endif @stop diff --git a/resources/views/payments/stripe/credit_card_stripe_css.blade.php b/resources/views/payments/stripe/credit_card_stripe_css.blade.php new file mode 100644 index 000000000..0595ef900 --- /dev/null +++ b/resources/views/payments/stripe/credit_card_stripe_css.blade.php @@ -0,0 +1,209 @@ + \ No newline at end of file