Sylius / PayPalPlugin

Official integration with PayPal Commerce Platform
37 stars 55 forks source link

Order with payment "stuck" in processing state when complete request fails #187

Open LucaGallinari opened 3 years ago

LucaGallinari commented 3 years ago

Steps to reproduce

Possible solution This does not happen with HostedFields cause there is an additional check here that cancel the payment if it is still processing after the complete call. But i think that this solution is weak. If, for example, the user closes the page while the capture request is going on, it will never call the cancel payment. Or maybe due to another error, the cancel payment url could never be called, and the payment of the order will remain PROCESSING. Probably, it should be responsibility of the CompletePayPalOrderAction controller to cancel the payment if it failed. What do you think?

LucaGallinari commented 3 years ago

Generally, i think that the PayPalClient class should "handle" properly the cases in which Paypal return a response with a status code that is not 20X. Actually the Client only logs the error when that happen. Maybe it could throw exception and the classes that use the PayPalClient will catch that exception and operate consequently.

jcgdjob commented 2 years ago

When the payment status is "processing", and the paypal status is "captured", the cancel last payment should re-capture the payment instead of mark the payment as "canceled" as the actual payment has already been done.