barryvdh / laravel-omnipay

Omnipay ServiceProvider for Laravel

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Gateway configuration should use the name instead of the classname

dpgover opened this issue · comments

GatewayManager, line 50:

if(!isset($this->gateways[$class])){
            $gateway = $this->factory->create($class, null, $this->app['request']);
            $gateway->initialize($this->getConfig($class));
            $this->gateways[$class] = $gateway;
        }

The config gets checked for the classname instead of the gateways name. I think it should be:

if(!isset($this->gateways[$class])){
            $gateway = $this->factory->create($class, null, $this->app['request']);
            $gateway->initialize($this->getConfig($gateway->getName()));
            $this->gateways[$class] = $gateway;
        }

That way, I can pass a custom gateway without having to use the fully qualified name of the class on the config file...

Am I correct?

Thanks

@barryvdh what do you think about @dpgover solution?

Think so indeed

@barryvdh may I create a PR with this changes?

@barryvdh @siarheipashkevich this PR seems to break the default gateway configs. see my comment here.

Reverted