barryvdh / laravel-omnipay

Omnipay ServiceProvider for Laravel
MIT License
168 stars 46 forks source link

Gateway configuration should use the name instead of the classname #8

Closed dpgover closed 6 years ago

dpgover commented 8 years ago

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

siarheipashkevich commented 6 years ago

@barryvdh what do you think about @dpgover solution?

barryvdh commented 6 years ago

Think so indeed

siarheipashkevich commented 6 years ago

@barryvdh may I create a PR with this changes?

barryvdh commented 6 years ago

Sure

siarheipashkevich commented 6 years ago

@barryvdh please see PR

ammonkc commented 6 years ago

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

barryvdh commented 6 years ago

Reverted