From 5affb4a03649d9ce559ca57f73550c7764a16740 Mon Sep 17 00:00:00 2001 From: David Bomba Date: Fri, 9 Jul 2021 09:46:18 +1000 Subject: [PATCH] Additional checks for payment method objects --- app/Models/Client.php | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/app/Models/Client.php b/app/Models/Client.php index 18103e595f..4c42c32764 100644 --- a/app/Models/Client.php +++ b/app/Models/Client.php @@ -13,6 +13,7 @@ namespace App\Models; use App\DataMapper\ClientSettings; use App\DataMapper\CompanySettings; +use App\DataMapper\FeesAndLimits; use App\Models\CompanyGateway; use App\Models\Presenters\ClientPresenter; use App\Services\Client\ClientService; @@ -430,6 +431,13 @@ class Client extends BaseModel implements HasLocalePreference { $cg = CompanyGateway::find($pm['company_gateway_id']); + if($cg && !property_exists($cg->fees_and_limits, GatewayType::CREDIT_CARD)){ + $fees_and_limits = $cg->fees_and_limits; + $fees_and_limits->{GatewayType::CREDIT_CARD} = new FeesAndLimits; + $cg->fees_and_limits = $fees_and_limits; + $cg->save(); + } + if($cg && $cg->fees_and_limits->{GatewayType::CREDIT_CARD}->is_enabled) return $cg; @@ -455,6 +463,13 @@ class Client extends BaseModel implements HasLocalePreference { $cg = CompanyGateway::find($pm['company_gateway_id']); + if($$cg && !property_exists($cg->fees_and_limits, GatewayType::BANK_TRANSFER)){ + $fees_and_limits = $cg->fees_and_limits; + $fees_and_limits->{GatewayType::BANK_TRANSFER} = new FeesAndLimits; + $cg->fees_and_limits = $fees_and_limits; + $cg->save(); + } + if($cg && $cg->fees_and_limits->{GatewayType::BANK_TRANSFER}->is_enabled) return $cg; }