Skip to content

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

@LucaGallinari

Description

@LucaGallinari

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?

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions