mirror of
https://github.com/invoiceninja/invoiceninja.git
synced 2025-07-09 03:14:30 -04:00
Fixes for handling payment drivers that do not exist in v5
This commit is contained in:
parent
16880ddc8b
commit
2e19d1e4a9
@ -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");
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -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)) {
|
||||
|
Loading…
x
Reference in New Issue
Block a user