diff --git a/app/Http/Controllers/ClientPortal/PaymentMethodController.php b/app/Http/Controllers/ClientPortal/PaymentMethodController.php index 13556fdc5d..e57cc00007 100644 --- a/app/Http/Controllers/ClientPortal/PaymentMethodController.php +++ b/app/Http/Controllers/ClientPortal/PaymentMethodController.php @@ -44,8 +44,12 @@ class PaymentMethodController extends Controller { $gateway = auth()->user()->client->getCreditCardGateway(); - return $gateway->driver(auth()->user()->client)->authorizeView(GatewayType::CREDIT_CARD); + $data['gateway'] = $gateway; + return $gateway + ->driver(auth()->user()->client) + ->setPaymentMethod(GatewayType::BANK_TRANSFER) + ->authorizeView($data); } /** @@ -57,9 +61,11 @@ class PaymentMethodController extends Controller public function store(Request $request) { $gateway = auth()->user()->client->getCreditCardGateway(); - - return $gateway->driver(auth()->user()->client)->authorizeResponseView($request->all()); + return $gateway + ->driver(auth()->user()->client) + ->setPaymentMethod(GatewayType::BANK_TRANSFER) + ->authorizeResponse($request); } /** @@ -104,7 +110,7 @@ class PaymentMethodController extends Controller return $gateway ->driver(auth()->user()->client) - ->setPaymentMethod('App\\PaymentDrivers\\Stripe\\ACH') + ->setPaymentMethod(GatewayType::BANK_TRANSFER) ->verificationView($payment_method); } @@ -114,7 +120,7 @@ class PaymentMethodController extends Controller return $gateway ->driver(auth()->user()->client) - ->setPaymentMethod('App\\PaymentDrivers\\Stripe\\ACH') + ->setPaymentMethod(GatewayType::BANK_TRANSFER) ->processVerification($payment_method); } diff --git a/app/PaymentDrivers/StripePaymentDriver.php b/app/PaymentDrivers/StripePaymentDriver.php index cff4ceda3e..3e329e14ba 100644 --- a/app/PaymentDrivers/StripePaymentDriver.php +++ b/app/PaymentDrivers/StripePaymentDriver.php @@ -172,7 +172,7 @@ class StripePaymentDriver extends BasePaymentDriver * @return \Illuminate\Contracts\View\Factory|\Illuminate\View\View */ - public function authorizeCreditCardResponse($request) + public function authorizeResponse($request) { return $this->payment_method->authorizeResponse($request); } diff --git a/resources/lang/en/texts.php b/resources/lang/en/texts.php index 42c5f2bfaf..5bb3764f9f 100644 --- a/resources/lang/en/texts.php +++ b/resources/lang/en/texts.php @@ -3224,4 +3224,6 @@ return [ 'year_invalid' => 'Provided year is not valid.', 'if_you_need_help' => 'If you need help you can either post to our', + + 'bank_account_not_linked' => 'To pay with bank account, first you have to add it as payment method.', ]; diff --git a/resources/views/portal/ninja2020/gateways/stripe/ach/pay.blade.php b/resources/views/portal/ninja2020/gateways/stripe/ach/pay.blade.php index 46182a54c5..d4ffdf84a2 100644 --- a/resources/views/portal/ninja2020/gateways/stripe/ach/pay.blade.php +++ b/resources/views/portal/ninja2020/gateways/stripe/ach/pay.blade.php @@ -2,18 +2,20 @@ @section('meta_title', ctrans('texts.ach')) @section('body') -
- @csrf - @foreach($invoices as $invoice) - - @endforeach - - - - - - -
+ @if($token) +
+ @csrf + @foreach($invoices as $invoice) + + @endforeach + + + + + + +
+ @endif
@@ -29,27 +31,36 @@

-
-
- {{ ctrans('texts.payment_type') }} -
-
- {{ ctrans('texts.ach') }} ({{ ctrans('texts.bank_transfer') }}) (****{{ $token->meta->last4 }}) -
-
-
-
- {{ ctrans('texts.amount') }} -
-
- {{ App\Utils\Number::formatMoney($amount, $client) }} -
-
-
- -
+ @if($token) +
+
+ {{ ctrans('texts.payment_type') }} +
+
+ {{ ctrans('texts.ach') }} ({{ ctrans('texts.bank_transfer') }}) (****{{ $token->meta->last4 }}) +
+
+
+
+ {{ ctrans('texts.amount') }} +
+
+ {{ App\Utils\Number::formatMoney($amount, $client) }} +
+
+
+ +
+ @else +
+
+ {{ ctrans('texts.bank_account_not_linked') }} + {{ ctrans('texts.add_payment_method') }} +
+
+ @endif