Fixes for ACSS

This commit is contained in:
David Bomba 2022-03-09 11:31:59 +11:00
parent 85b58ec8df
commit cfd76fc8df
6 changed files with 14 additions and 11 deletions

View File

@ -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;

View File

@ -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) {

View File

@ -67,7 +67,7 @@
{{ $payment_method->formatDateTimestamp($payment_method->created_at, $client->date_format()) }}
</td>
<td class="px-6 py-4 whitespace-nowrap text-sm leading-5 text-gray-500">
{{ ctrans("texts.{$payment_method->gateway_type->alias}") }}
{{ App\Models\GatewayType::getAlias($payment_method->gateway_type_id) }}
</td>
<td class="px-6 py-4 whitespace-nowrap text-sm leading-5 text-gray-500">
{{ ucfirst(optional($payment_method->meta)->brand) }}

View File

@ -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

View File

@ -33,7 +33,7 @@
</div>
<div class="mt-5 sm:mt-4 sm:flex sm:flex-row-reverse">
<div class="flex w-full rounded-md shadow-sm sm:ml-3 sm:w-auto">
<form action="{{ route('client.payment_methods.destroy', [$payment_method->hashed_id, 'method' => $payment_method->gateway_type->id]) }}" method="post">
<form action="{{ route('client.payment_methods.destroy', [$payment_method->hashed_id, 'method' => $payment_method->gateway_type_id]) }}" method="post">
@csrf
@method('DELETE')
<button type="submit" onclick="setTimeout(() => this.disabled = true, 0); return true;" class="button button-danger button-block" dusk="confirm-payment-removal">

View File

@ -1,12 +1,12 @@
@extends('portal.ninja2020.layout.app')
@section('meta_title', ucfirst($payment_method->gateway_type->name))
@section('meta_title', App\Models\GatewayType::getAlias($payment_method->gateway_type_id))
@section('body')
<div class="container mx-auto">
<div class="overflow-hidden bg-white shadow sm:rounded-lg">
<div class="px-4 py-5 border-b border-gray-200 sm:px-6">
<h3 class="text-lg font-medium leading-6 text-gray-900">
{{ ctrans("texts.{$payment_method->gateway_type->alias}") }}
{{ App\Models\GatewayType::getAlias($payment_method->gateway_type_id) }}
</h3>
<p class="max-w-2xl mt-1 text-sm leading-5 text-gray-500" translate>
{{ ctrans('texts.payment_method_details') }}
@ -14,13 +14,13 @@
</div>
<div>
<dl>
@if(!empty($payment_method->gateway_type->name) && !is_null($payment_method->gateway_type->name))
@if(!empty(App\Models\GatewayType::getAlias($payment_method->gateway_type_id)) && !is_null(App\Models\GatewayType::getAlias($payment_method->gateway_type_id)))
<div class="px-4 py-5 bg-gray-50 sm:grid sm:grid-cols-3 sm:gap-4 sm:px-6">
<dt class="text-sm font-medium leading-5 text-gray-500">
{{ ctrans('texts.payment_type') }}
</dt>
<dd class="mt-1 text-sm leading-5 text-gray-900 sm:mt-0 sm:col-span-2">
{{ ucfirst($payment_method->gateway_type->name) }}
{{ App\Models\GatewayType::getAlias($payment_method->gateway_type_id) }}
</dd>
</div>
@endif