diff --git a/config/laravel-payments.php b/config/laravel-payments.php index 7b814e5..5b1ca26 100644 --- a/config/laravel-payments.php +++ b/config/laravel-payments.php @@ -6,8 +6,19 @@ 'currency' => 'USD', 'gateways' => [ - 'default' => '' -// 'another' => Another\Gateway\Implementation::class, + 'default' => [ + 'gateway' => 'Gateway\Class', + 'params' => [ + 'key1' => 'value1', + ], + ], + +// 'another' => [ +// 'gateway' => 'Gateway\Class', +// 'params' => [ +// 'key1' => 'value1', +// ], +// ], ], ]; diff --git a/src/Gateways/GatewayFactory.php b/src/Gateways/GatewayFactory.php index 2ff883e..c39e322 100644 --- a/src/Gateways/GatewayFactory.php +++ b/src/Gateways/GatewayFactory.php @@ -18,7 +18,8 @@ class GatewayFactory public static function make(Payment $payment = null): AbstractGateway { // Get the Gateway Class from the config file using the payment's gateway_name attribute, or the default gateway if none was set. - $gatewayClass = config('laravel-payments.gateways')[optional($payment)->gateway_name ?? config('laravel-payments.default_gateway')]; + $gateway = optional($payment)->gateway_name ?? config('laravel-payments.default_gateway'); + $gatewayClass = config('laravel-payments.gateways')[$gateway]['gateway']; // Check the Gateway Class exists if (! class_exists($gatewayClass)) {