Payum / PayumLaravelPackage

Payum offers everything you need to work with payments. From simplest use cases to very advanced ones.
https://payum.forma-pro.com/
MIT License
122 stars 38 forks source link

Interface Doctrine\Common\Persistence\Proxy does not exist #13

Closed frankgu1208 closed 10 years ago

frankgu1208 commented 10 years ago

Hello, I am a beginner of laravel and payum. I followed the example, but cannot go through the code in sandbox. ReflectionException Interface Doctrine\Common\Persistence\Proxy does not exist The error is in the file: ..\vendor\payum\core\Payum\Core\Registry\AbstractRegistry.php The error code is: $class = is_object($class) ? get_class($class) : $class;

    // TODO: this is a quick fix. I have to find a better\clean solution.
    if (class_exists($class)) {            
        $rc = new \ReflectionClass($class);
        if ($rc->implementsInterface('Doctrine\Common\Persistence\Proxy')) {
            $class = $rc->getParentClass()->getName();
        }

I really don't know how to deal with it.

makasim commented 10 years ago

Thanks for reporting it!

It was a bug, I've just fixed it. Try https://github.com/Payum/Payum/releases/tag/0.11.3 version

frankgu1208 commented 10 years ago

I used composer update updating to new version. However there appears another error when run $storage->updateModel($details); in class PaypalController extends BaseController The error info is: ErrorException (E_UNKNOWN) file_put_contents(D:\wamp\www\payment\app\config\packages\payum\payum-laravel-package/../../../../storage/payments/payum-model-54193cd0d20bf): failed to open stream: No such file or directory Error code is: $rp->setAccessible(false); $this->identityMap[$id] = $model; file_put_contents($this->storageDir.'/payum-model-'.$id, serialize($model)); which is in the file: ..\payum\core\Payum\Core\Storage\FilesystemStorage.php

Thank you so much.

makasim commented 10 years ago

Make sure you have this folder D:\wamp\www\payment\app\config\packages\payum\payum-laravel-package/../../../../storage/payments and correct permissions set for it

makasim commented 10 years ago

Also I'd really advice you not to use filesystem storage on production. Consider using Doctrine (supported) or Eloquent ORM (not supported yet) storages. You can always implement your own storage ofcource.

frankgu1208 commented 10 years ago

Thank you for your advice. I will learn it and use it in my code soon. Actually, I'm not clear about which file generate this error. Is the part in config.php ? I copied the code in http://payum.org/doc/0.11/PayumLaravelPackage/get-it-started, and try to change this part of code in many ways. But still it didn't work.

return array(
    'token_storage' => new FilesystemStorage(__DIR__.'/../../../../storage/payments', $tokenClass, 'hash'),
    'payments' => array(
        'paypal_es' => $paypalPayment,
    ),
    'storages' => array(
        $detailsClass => new FilesystemStorage(__DIR__.'/../../../../storage/payments', $detailsClass),
    )
);

Could you give me a example. Or maybe I get totally wrong?

makasim commented 10 years ago

just for debugging you may set tmp dir, like this:

return array(
    'token_storage' => new FilesystemStorage(sys_get_temp_dir(), $tokenClass, 'hash'),
    'payments' => array(
        'paypal_es' => $paypalPayment,
    ),
    'storages' => array(
        $detailsClass => new FilesystemStorage(sys_get_temp_dir(), $detailsClass),
    )
);
makasim commented 10 years ago

Could you give me a example. Or maybe I get totally wrong?

the code looks good IMO, I think you get into troubles because of OS you use. I've never tested it on windows.

frankgu1208 commented 10 years ago

Thank you for your code. I found to create a payments folder under storage also works. By the way, the dir use Illuminate\Routing\Controllers\Controller; in the file vendor\payum\payum-laravel-package\src\Payum\LaravelPackage\Controller\PayumController.php is not existed. Mine is use Illuminate\Routing\Controller Maybe is because of OS or different version of laravel. Then I followed by this web http://www.zen-cart.com/showthread.php?213892-Curl-error-(60)-SSL-Certificate-problem-Unable-to-get-local-issuer-certificate to solve the problem of ssl.

Now it can jump to paypal website. Hope it can give others some help. And thank you so much.

frankgu1208 commented 10 years ago

And change SimpleStatusRequest to GetHumanStatus

makasim commented 10 years ago

And change SimpleStatusRequest to GetHumanStatus

yes, it was renamed in 0.11 version.