diff --git a/app/Models/CompanyGateway.php b/app/Models/CompanyGateway.php index c52a6c1ca8aa..53a83e25275d 100644 --- a/app/Models/CompanyGateway.php +++ b/app/Models/CompanyGateway.php @@ -14,6 +14,7 @@ namespace App\Models; use App\Models\GatewayType; use App\Utils\Number; use Illuminate\Database\Eloquent\SoftDeletes; +use PDO; use stdClass; class CompanyGateway extends BaseModel @@ -125,7 +126,11 @@ class CompanyGateway extends BaseModel { $class = static::driver_class(); + if(!$class) + return false; + return new $class($this, $client); + } private function driver_class() @@ -136,7 +141,9 @@ class CompanyGateway extends BaseModel if (class_exists($class)) return $class; - throw new \Exception("Payment Driver does not exist"); + return false; + + // throw new \Exception("Payment Driver does not exist"); } /** diff --git a/app/Services/Client/PaymentMethod.php b/app/Services/Client/PaymentMethod.php index aaf79c4a95d7..4eee1a235ef2 100644 --- a/app/Services/Client/PaymentMethod.php +++ b/app/Services/Client/PaymentMethod.php @@ -140,6 +140,10 @@ class PaymentMethod foreach ($this->gateways as $gateway) { + //if gateway doesn't exist or is not implemented - continue here //todo + if(!$gateway->driver($this->client)) + continue; + foreach ($gateway->driver($this->client)->gatewayTypes() as $type) { if (isset($gateway->fees_and_limits) && is_object($gateway->fees_and_limits) && property_exists($gateway->fees_and_limits, $type)) {