From c4231f702dbfdf90b01a90bd0b0513cf7b3d606b Mon Sep 17 00:00:00 2001 From: David Bomba Date: Wed, 18 May 2022 09:39:54 +1000 Subject: [PATCH] refactor for ach payments --- app/PaymentDrivers/Stripe/ACH.php | 16 ++++- .../ach/pay_instant_verification.blade.php | 66 +++++++++++++++++++ .../gateways/stripe/plaid/auth.blade.php | 57 ++++++++++++++++ 3 files changed, 138 insertions(+), 1 deletion(-) create mode 100644 resources/views/portal/ninja2020/gateways/stripe/ach/pay_instant_verification.blade.php create mode 100644 resources/views/portal/ninja2020/gateways/stripe/plaid/auth.blade.php diff --git a/app/PaymentDrivers/Stripe/ACH.php b/app/PaymentDrivers/Stripe/ACH.php index d151ed0d8ae7..8dbee2d534ef 100644 --- a/app/PaymentDrivers/Stripe/ACH.php +++ b/app/PaymentDrivers/Stripe/ACH.php @@ -143,7 +143,21 @@ class ACH $data['customer'] = $this->stripe->findOrCreateCustomer(); $data['amount'] = $this->stripe->convertToStripeAmount($data['total']['amount_with_fee'], $this->stripe->client->currency()->precision, $this->stripe->client->currency()); - return render('gateways.stripe.ach.pay', $data); + $intent = + $this->stripe->createPaymentIntent([ + 'amount' => $data['amount'], + 'currency' => $data['currency'], + 'setup_future_usage' => 'off_session', + 'customer' => $data['customer']->id, + 'payment_method_types' => ['us_bank_account'], + ] + ); + + $data['client_secret'] = $intent->client_secret; + + + return render('gateways.stripe.ach.pay_instant_verification', $data); + // return render('gateways.stripe.ach.pay', $data); } public function tokenBilling(ClientGatewayToken $cgt, PaymentHash $payment_hash) diff --git a/resources/views/portal/ninja2020/gateways/stripe/ach/pay_instant_verification.blade.php b/resources/views/portal/ninja2020/gateways/stripe/ach/pay_instant_verification.blade.php new file mode 100644 index 000000000000..a5841604a1f9 --- /dev/null +++ b/resources/views/portal/ninja2020/gateways/stripe/ach/pay_instant_verification.blade.php @@ -0,0 +1,66 @@ +@extends('portal.ninja2020.layout.payments', ['gateway_title' => 'ACH', 'card_title' => 'ACH']) + +@section('gateway_content') + @if(count($tokens) > 0) + + + @include('portal.ninja2020.gateways.includes.payment_details') + +
+ @csrf + + + + + + + + +
+ + @component('portal.ninja2020.components.general.card-element', ['title' => ctrans('texts.pay_with')]) + @if(count($tokens) > 0) + @foreach($tokens as $token) + + @endforeach + @endisset + @endcomponent + + @else + @component('portal.ninja2020.components.general.card-element-single', ['title' => 'ACH', 'show_title' => false]) + {{ ctrans('texts.bank_account_not_linked') }} + {{ ctrans('texts.add_payment_method') }} + + @endcomponent + @endif + + @include('portal.ninja2020.gateways.includes.pay_now') +@endsection + +@push('footer') + +@endpush diff --git a/resources/views/portal/ninja2020/gateways/stripe/plaid/auth.blade.php b/resources/views/portal/ninja2020/gateways/stripe/plaid/auth.blade.php new file mode 100644 index 000000000000..da23ba1ab8d5 --- /dev/null +++ b/resources/views/portal/ninja2020/gateways/stripe/plaid/auth.blade.php @@ -0,0 +1,57 @@ + + + + \ No newline at end of file