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

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

Open
LucaGallinari opened this issue Jan 29, 2021 · 2 comments
Labels

Comments

@LucaGallinari
Copy link
Contributor

Steps to reproduce

        return $this->client->post(sprintf('v2/checkout/orders/%s/capture', $orderId), $token, null, [
            'PayPal-Mock-Response' => '{"mock_application_codes": "INSTRUMENT_DECLINED"}'
        ]);
  • Place an order
  • In "Pay with Paypal page" use the yellow paypal button, and confirm the payment on Paypal
  • You will be redirected to the homepage, but if you try to retry the payment it will fail cause it's in "PROCESSING" state but the CreatePayPalOrderAction class try to load the last payment with "NEW" state and it won't find any.

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
Copy link
Contributor Author

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.

@Zales0123 Zales0123 added the Bug label May 21, 2021
@jcgdjob
Copy link

jcgdjob commented Sep 5, 2022

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

3 participants