diff --git a/resources/js/clients/payments/process.js b/resources/js/clients/payments/stripe-credit-card.js similarity index 88% rename from resources/js/clients/payments/process.js rename to resources/js/clients/payments/stripe-credit-card.js index 279469a6a099..f5b2c32629bd 100644 --- a/resources/js/clients/payments/process.js +++ b/resources/js/clients/payments/stripe-credit-card.js @@ -8,10 +8,11 @@ * @license https://opensource.org/licenses/AAL */ -class ProcessStripePayment { - constructor(key, usingToken) { +class StripeCreditCard { + constructor(key, token, secret) { this.key = key; - this.usingToken = usingToken; + this.token = token; + this.secret = secret; } setupStripe() { @@ -67,7 +68,7 @@ class ProcessStripePayment { let cardHolderName = document.getElementById('cardholder-name'); this.stripe - .handleCardPayment(payNowButton.dataset.secret, this.cardElement, { + .handleCardPayment(this.secret, this.cardElement, { payment_method_data: { billing_details: { name: cardHolderName.value }, }, @@ -131,10 +132,8 @@ class ProcessStripePayment { } } -const publishableKey = document.querySelector( - 'meta[name="stripe-publishable-key"]' -).content; +const publishableKey = document.querySelector('meta[name="stripe-publishable-key"]').content; +const token = document.querySelector('meta[name="stripe-token"]').content; +const secret = document.querySelector('meta[name="stripe-secret"]').content; -const usingToken = document.querySelector('meta[name="using-token"]').content; - -new ProcessStripePayment(publishableKey, usingToken).handle(); +new StripeCreditCard(publishableKey, token, secret).handle(); diff --git a/resources/views/portal/ninja2020/gateways/includes/pay_now.blade.php b/resources/views/portal/ninja2020/gateways/includes/pay_now.blade.php new file mode 100644 index 000000000000..d3bdcc8c83e7 --- /dev/null +++ b/resources/views/portal/ninja2020/gateways/includes/pay_now.blade.php @@ -0,0 +1,9 @@ +
+ +
diff --git a/resources/views/portal/ninja2020/gateways/stripe/credit_card.blade.php b/resources/views/portal/ninja2020/gateways/stripe/credit_card.blade.php index 1fbef7f295b2..7beefe76861f 100644 --- a/resources/views/portal/ninja2020/gateways/stripe/credit_card.blade.php +++ b/resources/views/portal/ninja2020/gateways/stripe/credit_card.blade.php @@ -1,12 +1,12 @@ -@extends('portal.ninja2020.layout.app') -@section('meta_title', ctrans('texts.pay_now')) +@extends('portal.ninja2020.layout.payments', ['gateway_title' => 'Stripe (Credit card)', 'card_title' => 'Stripe (Credit card)']) -@push('head') +@section('gateway_head') - -@endpush + + +@endsection -@section('body') +@section('gateway_content')
@csrf @@ -17,49 +17,15 @@
-
-
-
- -
-
-

- {{ ctrans('texts.pay_now') }} -

-

- {{ ctrans('texts.complete_your_payment') }} -

-
-
-
- @include('portal.ninja2020.gateways.includes.payment_details') + @component('portal.ninja2020.components.general.card-element', ['title' => ctrans('texts.payment_type')]) + {{ ctrans('texts.credit_card') }} (Stripe) + @endcomponent - @if((int)$total['amount_with_fee'] == 0) - @include('portal.ninja2020.gateways.stripe.includes.pay_with_credit') - @elseif($token) - @include('portal.ninja2020.gateways.stripe.includes.pay_with_token') - @else - @include('portal.ninja2020.gateways.stripe.includes.card_widget') - -
- -
- @endif -
-
-
-
-
-
+ @include('portal.ninja2020.gateways.stripe.includes.card_widget') + @include('portal.ninja2020.gateways.includes.pay_now') @endsection -@push('footer') +@section('gateway_footer') - -@endpush + +@endsection \ No newline at end of file diff --git a/resources/views/portal/ninja2020/gateways/stripe/credit_card.blade.php.old b/resources/views/portal/ninja2020/gateways/stripe/credit_card.blade.php.old new file mode 100644 index 000000000000..1fbef7f295b2 --- /dev/null +++ b/resources/views/portal/ninja2020/gateways/stripe/credit_card.blade.php.old @@ -0,0 +1,65 @@ +@extends('portal.ninja2020.layout.app') +@section('meta_title', ctrans('texts.pay_now')) + +@push('head') + + +@endpush + +@section('body') +
+ @csrf + + + + + + +
+ +
+
+
+ +
+
+

+ {{ ctrans('texts.pay_now') }} +

+

+ {{ ctrans('texts.complete_your_payment') }} +

+
+
+
+ @include('portal.ninja2020.gateways.includes.payment_details') + + @if((int)$total['amount_with_fee'] == 0) + @include('portal.ninja2020.gateways.stripe.includes.pay_with_credit') + @elseif($token) + @include('portal.ninja2020.gateways.stripe.includes.pay_with_token') + @else + @include('portal.ninja2020.gateways.stripe.includes.card_widget') + +
+ +
+ @endif +
+
+
+
+
+
+@endsection + +@push('footer') + + +@endpush diff --git a/resources/views/portal/ninja2020/gateways/stripe/includes/card_widget.blade.php b/resources/views/portal/ninja2020/gateways/stripe/includes/card_widget.blade.php index db649eb7fe0f..5d8e554f5840 100644 --- a/resources/views/portal/ninja2020/gateways/stripe/includes/card_widget.blade.php +++ b/resources/views/portal/ninja2020/gateways/stripe/includes/card_widget.blade.php @@ -1,39 +1,13 @@ @unless(isset($show_name) && $show_name == false) -
-
- {{ ctrans('texts.name') }} -
-
- -
-
+ @component('portal.ninja2020.components.general.card-element', ['title' => ctrans('texts.name')]) + + @endcomponent @endunless @unless(isset($show_card_element) && $show_card_element == false) -
-
- {{ ctrans('texts.credit_card') }} -
-
-
-
-
+ @component('portal.ninja2020.components.general.card-element-single') +
+ @endcomponent @endunless -@unless(isset($show_save) && $show_save == false) -
-
- {{ ctrans('texts.token_billing_checkbox') }} -
-
- - -
-
-@endunless +@include('portal.ninja2020.gateways.includes.save_card') \ No newline at end of file