robmcvey / cakephp-paypal

CakePHP 2.0 plugin for PayPal Website Payment Pro
60 stars 44 forks source link

Internal Error #16

Closed kibm closed 10 years ago

kibm commented 10 years ago

When using express checkout, it works fine if a user pays using a PayPal account.

However, If the user is paying by manually entering the card in paypal - doExpressCheckoutPayment fails with internal error.

"This transaction couldn't be completed. Redirecting to payment gateway Error: An Internal Error Has Occurred."

Is there a way to have better error reporting, or redirect user back to PayPal if required?

robmcvey commented 10 years ago

Looking at the docs, I believe this error can also occur when using their normal PayPal account too (let's say their funding card has expired) so yes we need to implement a redirect here.

You'll see in the class we have a specific exception for redirect errors of this nature:

if (in_array($parsed['L_ERRORCODE0'], $this->redirectErrors)) {
    throw new PaypalRedirectException($this->getErrorMessage($parsed));
}

I've updated the README here to show how to best handle errors of this nature - simply use $this->redirect() to send the user back to PayPal. I'm suggesting that PaypalRedirectException will contain the correct URL to send the user to.

Would you agree this is an appropriate solution?

kibm commented 10 years ago

I think that would be a perfect solution. Thanks.

robmcvey commented 10 years ago

This fix has been added