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

[Bug] Transition "cancel" is called even on completed or already canceled payment #238

Open
LucaGallinari opened this issue Apr 8, 2022 · 0 comments
Labels

Comments

@LucaGallinari
Copy link
Contributor

SyliusPayPalPlugin version affected: >=1.3.2

Description
The "CancelLastPayPalPaymentAction" is called even when the payment page in "unloaded" due to a successful payment. This lead to call the transition "cancel" on the payment even if it's completed and results in an error like this:

Uncaught PHP Exception SM\SMException: "Transition "cancel" cannot be applied on state "completed" of object "App\Entity\Payment\Payment" with graph "sylius_payment""

Steps to reproduce

  1. Place an order with a successful payment
  2. You can see in the network tab or in the log (it depends on your monolog settings) that the request to "cancel-last-pay-pal-payment" failed with a 500.

Possible Solution
This is due to this. The cancel transition is called without checking if it can be run (with ->can()).
There is also this point in which this change should be applied.

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

1 participant