Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Payum\Core\Storage\FilesystemStorage::__set_state() with ZendCache enabled #8

Closed
nickurt opened this issue Jul 28, 2014 · 12 comments
Closed

Comments

@nickurt
Copy link
Contributor

nickurt commented Jul 28, 2014

When I have this as my config file

<?php
use Buzz\Client\Curl;
use Payum\Core\Extension\StorageExtension;
use Payum\Core\Storage\FilesystemStorage;
use Payum\Paypal\ExpressCheckout\Nvp\Api;
use Payum\Paypal\ExpressCheckout\Nvp\PaymentFactory;

return array(
    'payum' => array(
        'token_storage' => new FilesystemStorage(
            __DIR__.'/../../data/cache',
            'Payments\Model\PaymentSecurityToken',
            'hash'
        ),
        'payments' => array(
            'paypal' => PaymentFactory::create(new Api(new Curl(), array(
                'username'  =>  '{username}',
                'password'  =>  '{password}',
                'signature' =>  '{signature}',
                'sandbox'   =>  true
            )))
        ),
        'storages' => array(
            'Payments\Model\PaymentDetails' => new FilesystemStorage(__DIR__.'/../../data/cache', 'Payments\Model\PaymentDetails'),
        )
    ),
);

And I enabled the Zend Config & Module Cache, I get this error

Fatal error: Call to undefined method Payum\Core\Storage\FilesystemStorage::__set_state() in [..]/httpdocs/data/cache/module-config-cache.2245023265ae4cf87d02c8b6ba991139.php on line 1433

How can I solve this?

@makasim
Copy link
Member

makasim commented Jul 28, 2014

Is this working without Module Cache?

@nickurt
Copy link
Contributor Author

nickurt commented Jul 28, 2014

With 'module_map_cache_enabled' enabled it works, but not with 'config_cache_enabled'.

@makasim
Copy link
Member

makasim commented Jul 28, 2014

I am not sure where the bag comes from... you can try to move the logic of storage and payment creation to the services and use in config only service names. Hope it helps.

@makasim
Copy link
Member

makasim commented Jul 28, 2014

Cuz as I see it tries to cache the config, and serialize it. The Storage is not designed to be serialized.

@nickurt
Copy link
Contributor Author

nickurt commented Jul 28, 2014

When I add the factories tot the config file, I still got the error ...

'factories' => array(
        'payum' => 'Payum\PayumModule\Registry\RegistryFactory',
        'payum.options' => 'Payum\PayumModule\Options\PayumOptionsFactory',
        'payum.security.token_storage' => 'Payum\PayumModule\Security\TokenStorageFactory',
        'payum.security.http_request_verifier' => 'Payum\PayumModule\Security\HttpRequestVerifierFactory',
),

I followed this configuration steps

@makasim
Copy link
Member

makasim commented Jul 28, 2014

you have to add factories for storage and payment, objects created in the config. The idea is not have a config with simple types, strings, scalars, arrays but not objects. So it could be easy serialized and cached

@nickurt
Copy link
Contributor Author

nickurt commented Jul 28, 2014

I understand that, so there is no example/possibility to have 'factory classes' and not 'factory closures' in the config file?

@makasim
Copy link
Member

makasim commented Jul 28, 2014

if you configure it will work, the payum support such use case, but yes there is not an example how to setup.... should be easy though.

@makasim
Copy link
Member

makasim commented Jul 28, 2014

something like this, add a factory (you can also use a closure):

'factories' => array(
    'payment.paypal_express_checkout' => 'Acme\AcmePaymentModule\PaypalPaymentFactory',
    'payment.token_storage' => 'Acme\AcmePaymentModule\TokenStorageFactory',
    'payment.details_storage' => 'Acme\AcmePaymentModule\DetailsStorageFactory',
),

and add it to payum config:

return array(
    'payum' => array(
        'token_storage' => 'payment.token_storage',
        'payments' => array(
            'paypal' => 'payment.paypal_express_checkout',
        ),
        'storages' => array(
            'Payments\Model\PaymentDetails' => 'payment.details_storage',
        ),
    ),
);

@makasim
Copy link
Member

makasim commented Jul 28, 2014

Not sure about token_storage, if it does not it has to be fixed.

@nickurt
Copy link
Contributor Author

nickurt commented Jul 29, 2014

You have to change the 'createService' functions, for now, I will disabled it and I hope it will be solved in the future.

@nickurt
Copy link
Contributor Author

nickurt commented Dec 28, 2014

Since I've been moved to SpeckPaypal and created a wip/demo app of it, this can be closed.

@nickurt nickurt closed this as completed Dec 28, 2014
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants