From 9f1efeba99b53d2723fd784edcae7517a6d84602 Mon Sep 17 00:00:00 2001 From: David Bomba Date: Thu, 27 Jun 2024 09:14:49 +1000 Subject: [PATCH] Add back credit options --- app/Services/Client/PaymentMethod.php | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/app/Services/Client/PaymentMethod.php b/app/Services/Client/PaymentMethod.php index d4e788fcc39a..492f907e13b9 100644 --- a/app/Services/Client/PaymentMethod.php +++ b/app/Services/Client/PaymentMethod.php @@ -180,6 +180,21 @@ class PaymentMethod } } + if (($this->client->getSetting('use_credits_payment') == 'option' || $this->client->getSetting('use_credits_payment') == 'always') && $this->client->service()->getCreditBalance() > 0) { + // Show credits as only payment option if both statements are true. + if ( + $this->client->service()->getCreditBalance() > $this->amount + && $this->client->getSetting('use_credits_payment') == 'always') { + $payment_urls = []; + } + + $this->payment_urls[] = [ + 'label' => ctrans('texts.apply_credit'), + 'company_gateway_id' => CompanyGateway::GATEWAY_CREDIT, + 'gateway_type_id' => GatewayType::CREDIT, + ]; + } + return $this; }