-1

I have setup the payum Paypal Rest. Credit card purchase into my laravel app for payment using credit card, everything is set but it's given me exception like:

A storage for model Payum\Paypal\Rest\Model\PaymentDetails was not registered. There are storages for next models: Payum\Core\Model\Payment, Payum\Core\Model\ArrayObject, Payum\Core\Model\Payout.

AppServiceProvider.php

//For payment gateway...
$this->app->resolving('payum.builder', function(\Payum\Core\PayumBuilder $payumBuilder) {
    $payumBuilder
    // this method registers filesystem storages, consider to change them to something more
    // sophisticated, like eloquent storage
    ->addDefaultStorages()
    //->getPayum();
    ->addGateway('paypal_ec', [
        'factory' => 'paypal_express_checkout',
        'username' => config('payment.paypalusername'),
        'password' => config('payment.paypalpassword'),
        'signature' => config('payment.paypalsignature'),
        'sandbox' => true
    ])
    ->addGateway('paypalRest', [
        'factory' => 'paypal_rest',
        'client_id' => config('payment.paypalclientid'),
        'client_secret' => config('payment.paypalsecret'),
        'config_path' => '%kernel.root_dir%/config/sdk_config.ini'
    ]);                
});

prepare.php

$storage = $this->getPayum()->getStorage('Payum\Paypal\Rest\Model\PaymentDetails');
$payment = $storage->create();
.
.
.

Where I need to register storage for model Payum\Paypal\Rest\Model\PaymentDetails?

AddWeb Solution Pvt Ltd
  • 21,025
  • 5
  • 26
  • 57

1 Answers1

0

Payum Paypal Rest extension uses a model from the official Paypal's SDK lib. There is no storage for it by default and you provide one:

<?php

/** @var \Payum\Core\Storage\StorageInterface $storage */
$storage;

$payumBuilder->addStorage('Payum\Paypal\Rest\Model\PaymentDetails', $storage);

What you could also do is to create your own capture action that supports array and ArrayObject model from the Payum core and in that action, you get data from the array and set it to Paypal Rest model and do subrequest with it. Then set data back from the model to the array.

I must admit that the extension was created a long time ago as a proof of concept and haven't been updated for a long time. For example, it would be good to use basic models (from Payum core) in it.

Maksim Kotlyar
  • 3,821
  • 27
  • 31