5

I'm new to Payum and I am trying to create a new payment gateway. However I can't figure out how the config values relate to the files I've created (Actions/Factory etc).

Here's what I have so far;

payum:
    security:
        token_storage:
            Path\To\PaymentSecurityToken:
                doctrine:
                    driver: orm
    contexts:
        xxx:
            yyyy:
                api:
                    options:
                        sandbox: true
        storages:
            Path\To\Payment:
                doctrine:
                    driver: orm

I don't get what I am supposed to put into xxx and yyy. No matter what values I try I still don't get it. I keep getting the following error.

InvalidConfigurationException: Unrecognized options "yyy" under "payum.contexts.xxx"

Can anyone tell me what those values are supposed to be and how the values I set are related to the gateway and where there are needed so the config actually matches up to something in the gateway code?

Thanks in advance :)

jonupton
  • 95
  • 1
  • 5

1 Answers1

2

yyyy - is the payment (or storage) factory name. Under this section you put payment specific options. They are defined in addConfiguration method. These options later passed to method that creates a payment service

There are some factories shipped with Payum bundle. You can use they or add your own. For that you have to implement PaymentFactoryInterface and register it like others to Payum extension.

xxx - it is context name (you name it). The idea behind it is pretty simple. You can have two paypal payments but configured differently. One for US and one for EU (different paypal accounts). Something like:

payum:
   contexts:
       paypal_eu:
           paypal_express_checkout_nvp:
               username: ~
               password: ~
               signature: ~
       paypal_us:
           paypal_express_checkout_nvp:
               username: ~
               password: ~
               signature: ~

Later when you want to get the payment instance you have to use context name:

$payment = $container->get('payum')->getPayment('paypal_eu');

P.S. Some real config examples you can find in docs.

Maksim Kotlyar
  • 3,821
  • 27
  • 31
  • Thanks. I'll check out my code to see if i'm following your pattern. – jonupton Jun 01 '14 at 14:56
  • That sorted my initial problem. My next is one of documentation. I cannot find a start to end example of creating a new payment gateway using payum bundle and symfony2. I've created a payment factory. Is this where I register my new actions? If not, where am I supposed to set this up. I'm still not understanding how all the parts are tied together. – jonupton Jun 02 '14 at 03:40
  • Could you ask it as separate question? So we can discuss it details. – Maksim Kotlyar Jun 02 '14 at 07:39
  • Thanks. I have added my full question here. http://stackoverflow.com/questions/23992381/how-to-register-a-new-payum-payment-method-and-add-actions – jonupton Jun 02 '14 at 10:55