From 7d61ec831759e0db95767c76df33b66ce9848d8b Mon Sep 17 00:00:00 2001 From: David Bomba Date: Wed, 29 Dec 2021 09:14:41 +1100 Subject: [PATCH] Fixes for gatewayTypeId --- app/Http/Controllers/ClientPortalController.php | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/app/Http/Controllers/ClientPortalController.php b/app/Http/Controllers/ClientPortalController.php index 0a768426d770..ae82faca997e 100644 --- a/app/Http/Controllers/ClientPortalController.php +++ b/app/Http/Controllers/ClientPortalController.php @@ -140,7 +140,7 @@ class ClientPortalController extends BaseController $paymentURL = ''; if (count($paymentTypes) == 1) { $paymentURL = $paymentTypes[0]['url']; - if (in_array($paymentTypes[0]['gatewayTypeId'], [GATEWAY_TYPE_CUSTOM1, GATEWAY_TYPE_CUSTOM2, GATEWAY_TYPE_CUSTOM3])) { + if (array_key_exists('gatewayTypeId', $paymentTypes[0]) && in_array($paymentTypes[0]['gatewayTypeId'], [GATEWAY_TYPE_CUSTOM1, GATEWAY_TYPE_CUSTOM2, GATEWAY_TYPE_CUSTOM3])) { // do nothing } elseif (! $account->isGatewayConfigured(GATEWAY_PAYPAL_EXPRESS)) { $paymentURL = URL::to($paymentURL); @@ -162,6 +162,11 @@ class ClientPortalController extends BaseController $showApprove = false; } + $gatewayTypeIdCast = false; + + if(array_key_exists('gatewayTypeId', $paymentTypes[0])) + $gatewayTypeIdCast = $paymentTypes[0]['gatewayTypeId']; + $data += [ 'account' => $account, 'showApprove' => $showApprove, @@ -173,7 +178,7 @@ class ClientPortalController extends BaseController 'paymentTypes' => $paymentTypes, 'paymentURL' => $paymentURL, 'phantomjs' => Request::has('phantomjs'), - 'gatewayTypeId' => count($paymentTypes) == 1 ? $paymentTypes[0]['gatewayTypeId'] : false, + 'gatewayTypeId' => count($paymentTypes) == 1 ? $gatewayTypeIdCast : false, ]; if ($invoice->canBePaid()) {