Payum / PayumServer

Payment processing microservice. Written in Symfony4
https://payum.forma-pro.com/
MIT License
114 stars 34 forks source link

Register other gateways #45

Closed gtrias closed 8 years ago

gtrias commented 8 years ago

I'm trying to add new gateway to the PayumServer but I cannot figure which file is responsible to add the gateways. I have to add the next code in order to register the gateway:

<?php
//config.php

use Payum\Core\Extension\GenericTokenFactoryExtension;

// ...
$factory = new \Crevillo\Payum\Redsys\RedsysGatewayFactory;
$gateways['redsys'] = $factory->create(array(
   'merchant_code' => 'REPLACE WITH YOURS',
   'terminal' => 'REPLACE WITH YOURS', // normally '001'
   'secret_key' => 'REPLACE WITH YOURS'
   'sandbox' => true

    // uncomment if you want notify url to be generated automatically.
    // 'payum.extension.token_factory' => new GenericTokenFactoryExtension($tokenFactory),
));

But I cannot find where, looking PayumSilexProvider documentation it says to use $app['payum.gateways'] but I'm getting InvalidArgumentException: Identifier "payum.gateways" is not defined. all the time.

Any point in how to add other gateways than the default ones would be very appreciated :)

Thanks

makasim commented 8 years ago

Something like this has to work:

<?php

$app['payum.builder']->addGatewayFactory('redsys', function($config, $coreGateway)) {
    return new \Crevillo\Payum\Redsys\RedsysGatewayFactory($config, $coreGateway);
});

I am going to remove this service: payum.gateways

gtrias commented 8 years ago

It works! Thank you.

I think it would be nice to have this well documented

makasim commented 8 years ago

Indeed.