From e1dc5d1176ab24fcaca87856b435246aeae245d9 Mon Sep 17 00:00:00 2001 From: David Bomba Date: Wed, 14 Aug 2024 20:19:37 +1000 Subject: [PATCH] Improvements for forte --- app/PaymentDrivers/BaseDriver.php | 2 +- app/PaymentDrivers/FortePaymentDriver.php | 5 ++++- 2 files changed, 5 insertions(+), 2 deletions(-) diff --git a/app/PaymentDrivers/BaseDriver.php b/app/PaymentDrivers/BaseDriver.php index 070678e25620..e7ea1efd83d4 100644 --- a/app/PaymentDrivers/BaseDriver.php +++ b/app/PaymentDrivers/BaseDriver.php @@ -232,7 +232,7 @@ class BaseDriver extends AbstractPaymentDriver * * @param ClientGatewayToken $cgt The client gateway token object * @param PaymentHash $payment_hash The Payment hash containing the payment meta data - * @return ?Payment The payment response + * @return ?Payment|bool The payment response */ public function tokenBilling(ClientGatewayToken $cgt, PaymentHash $payment_hash) { diff --git a/app/PaymentDrivers/FortePaymentDriver.php b/app/PaymentDrivers/FortePaymentDriver.php index 1bdd7081ac68..90efcfa0c18b 100644 --- a/app/PaymentDrivers/FortePaymentDriver.php +++ b/app/PaymentDrivers/FortePaymentDriver.php @@ -248,6 +248,9 @@ class FortePaymentDriver extends BaseDriver private function getClient(?string $email) { + if(!$email) + return false; + return ClientContact::query() ->where('company_id', $this->company_gateway->company_id) ->where('email', $email) @@ -257,7 +260,7 @@ class FortePaymentDriver extends BaseDriver public function tokenBilling(\App\Models\ClientGatewayToken $cgt, \App\Models\PaymentHash $payment_hash) { - $amount_with_fee = $payment_hash->data->total->amount_with_fee; + $amount_with_fee = $payment_hash->data->amount_with_fee; $fee_total = $payment_hash->fee_total; $data =