From cfd76fc8dff750b9934e1faf2f88800b04d6c9b9 Mon Sep 17 00:00:00 2001 From: David Bomba Date: Wed, 9 Mar 2022 11:31:59 +1100 Subject: [PATCH] Fixes for ACSS --- app/PaymentDrivers/Stripe/ACSS.php | 8 +++++--- app/PaymentDrivers/StripePaymentDriver.php | 2 -- .../components/livewire/payment-methods-table.blade.php | 2 +- .../portal/ninja2020/gateways/stripe/acss/pay.blade.php | 3 +++ .../payment_methods/includes/modals/removal.blade.php | 2 +- .../views/portal/ninja2020/payment_methods/show.blade.php | 8 ++++---- 6 files changed, 14 insertions(+), 11 deletions(-) diff --git a/app/PaymentDrivers/Stripe/ACSS.php b/app/PaymentDrivers/Stripe/ACSS.php index 7f3c0cc4a116..69069bf76400 100644 --- a/app/PaymentDrivers/Stripe/ACSS.php +++ b/app/PaymentDrivers/Stripe/ACSS.php @@ -154,6 +154,7 @@ class ACSS 'interval_description' => 'when any invoice becomes due', 'transaction_type' => 'personal' // TODO: check if is company or personal https://stripe.com/docs/payments/acss-debit ], + 'verification_method' => 'instant', ] ] ], $this->stripe->stripe_connect_auth); @@ -183,7 +184,7 @@ class ACSS $this->stripe->payment_hash->save(); if (property_exists($gateway_response, 'status') && $gateway_response->status == 'processing') { - $this->storePaymentMethod($gateway_response); + // $this->storePaymentMethod($gateway_response); return $this->processSuccessfulPayment($gateway_response->id); } return $this->processUnsuccessfulPayment(); @@ -243,12 +244,13 @@ class ACSS private function storePaymentMethod($intent) { + try { $method = $this->stripe->getStripePaymentMethod($intent->payment_method); $payment_meta = new \stdClass; - $payment_meta->brand = (string) \sprintf('%s (%s)', $method->au_becs_debit->bank_code, ctrans('texts.acss')); - $payment_meta->last4 = (string) $method->au_becs_debit->last4; + $payment_meta->brand = (string) $method->acss_debit->bank_name; + $payment_meta->last4 = (string) $method->acss_debit->last4; $payment_meta->state = 'authorized'; $payment_meta->type = GatewayType::ACSS; diff --git a/app/PaymentDrivers/StripePaymentDriver.php b/app/PaymentDrivers/StripePaymentDriver.php index 7d0ed85771de..5826cb36761a 100644 --- a/app/PaymentDrivers/StripePaymentDriver.php +++ b/app/PaymentDrivers/StripePaymentDriver.php @@ -533,12 +533,10 @@ class StripePaymentDriver extends BaseDriver //payment_intent.succeeded - this will confirm or cancel the payment if($request->type === 'payment_intent.succeeded'){ PaymentIntentWebhook::dispatch($request->data, $request->company_key, $this->company_gateway->id)->delay(10); - // PaymentIntentWebhook::dispatch($request->data, $request->company_key, $this->company_gateway->id); return response()->json([], 200); } if ($request->type === 'charge.succeeded') { - // if ($request->type === 'charge.succeeded' || $request->type === 'payment_intent.succeeded') { foreach ($request->data as $transaction) { diff --git a/resources/views/portal/ninja2020/components/livewire/payment-methods-table.blade.php b/resources/views/portal/ninja2020/components/livewire/payment-methods-table.blade.php index f480d3514ad9..0faa5f515c48 100644 --- a/resources/views/portal/ninja2020/components/livewire/payment-methods-table.blade.php +++ b/resources/views/portal/ninja2020/components/livewire/payment-methods-table.blade.php @@ -67,7 +67,7 @@ {{ $payment_method->formatDateTimestamp($payment_method->created_at, $client->date_format()) }} - {{ ctrans("texts.{$payment_method->gateway_type->alias}") }} + {{ App\Models\GatewayType::getAlias($payment_method->gateway_type_id) }} {{ ucfirst(optional($payment_method->meta)->brand) }} diff --git a/resources/views/portal/ninja2020/gateways/stripe/acss/pay.blade.php b/resources/views/portal/ninja2020/gateways/stripe/acss/pay.blade.php index bb9bc2ea50c7..dba21e08c822 100644 --- a/resources/views/portal/ninja2020/gateways/stripe/acss/pay.blade.php +++ b/resources/views/portal/ninja2020/gateways/stripe/acss/pay.blade.php @@ -28,6 +28,9 @@ @component('portal.ninja2020.components.general.card-element', ['title' => ctrans('texts.payment_type')]) {{ ctrans('texts.acss') }} ({{ ctrans('texts.bank_transfer') }}) @endcomponent + + @include('portal.ninja2020.gateways.stripe.acss.acss') + @include('portal.ninja2020.gateways.includes.pay_now') @endsection diff --git a/resources/views/portal/ninja2020/payment_methods/includes/modals/removal.blade.php b/resources/views/portal/ninja2020/payment_methods/includes/modals/removal.blade.php index c50b4eade584..47d4d1cb222b 100644 --- a/resources/views/portal/ninja2020/payment_methods/includes/modals/removal.blade.php +++ b/resources/views/portal/ninja2020/payment_methods/includes/modals/removal.blade.php @@ -33,7 +33,7 @@
-
+ @csrf @method('DELETE')