Search code examples
phppayum

Create a custom gateway - model-problems


i'm trying to create a custom gateway and have followed a lot of the different documentations. Yesterday i discovered the new Payum/Skeleton and started with that and followed that example. Though i have a problem when redirected to the capture-page, i get the following two exceptions:

Fatal error: Uncaught exception 'Payum\Core\Exception\RequestNotSupportedException' with message 'Request Capture{model: Identity} is not supported. Make sure the storage extension for "Payum\Core\Model\Payment" is registered to the gateway. Make sure the storage find method returns an instance by id "5678ff3e481ba". Make sure the gateway supports the requests and there is an action which supports this request (The method returns true). There may be a bug, so look for a related issue on the issue tracker.' in /home/vagrant/code/payumdibs/vendor/payum/core/Payum/Core/Exception/RequestNotSupportedException.php on line 57

And

Payum\Core\Exception\RequestNotSupportedException: Request Capture{model: Identity} is not supported. Make sure the storage extension for "Payum\Core\Model\Payment" is registered to the gateway. Make sure the storage find method returns an instance by id "5678ff3e481ba". Make sure the gateway supports the requests and there is an action which supports this request (The method returns true). There may be a bug, so look for a related issue on the issue tracker. in /home/vagrant/code/payumdibs/vendor/payum/core/Payum/Core/Exception/RequestNotSupportedException.php on line 57

I've used x-debug and figured out that when CaptureAction::supports is called $request->getModel() is not an instance of \ArrayAccess and therefore returns false.

When using the standard payment gateways everything works fine, but using a custom does not.

My config:

$payum = (new PayumBuilder())
        ->addDefaultStorages()
        ->addGatewayFactory('paypal', new \Acme\Paypal\PaypalGatewayFactory([]))
        ->addGateway('offline', [
            'factory' => 'offline',
        ])->addGateway('paypal', [
            'factory' => 'paypal',
            'sandbox' => true,
        ])->getPayum();

Anyone have any ideas whats going wrong?


Solution

  • Got the answer in comment by Maksim Kotlyar. https://github.com/Payum/Payum/issues/452