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

Fix #53 - cancel an empty payment #54

Merged

Conversation

cbastienbaron
Copy link
Contributor

@cbastienbaron cbastienbaron commented Jun 3, 2024

Hey 🖖

Explanations :
When an user cancel a payment (from stripe gateway), a void (i.e. no txid, or whatever (see details db field)) payment is created (normal behaviour from sylius) so when we want to cancel an order (from bo), all payments are intent to be cancel but void payment cannot be canceled to stripe side (it's void :), no txid exist )

so this pr aims to avoid error mentionned in #53 and focus on only cancel command

@Prometee
Copy link
Member

Prometee commented Jun 4, 2024

Hi @cbastienbaron!

Thank you very much for this PR!

Do you see a way to write a little scenario to cover this ?
You can found some example here : https://github.com/FLUX-SE/SyliusPayumStripePlugin/tree/master/features/shop.

Let me know if you need help, don't hesitate to contact me on Sylius's Slack : https://sylius-community.slack.com/

@cbastienbaron
Copy link
Contributor Author

Hey @Prometee 🖖 ,

humm good question, perhaps an additionnal scenario for admin with a cancelFromGatewayFollowByCancelOrder and play with ManagingOrdersContext.php

I don't really have a preference, do you have any ideas ?

@Prometee
Copy link
Member

Prometee commented Jun 7, 2024

@cbastienbaron since it covers your case, lets try it 😉

@Prometee
Copy link
Member

@cbastienbaron After reading and testing on my own using your PR, I simplify the BeHat test method, to let Sylius do what it is supposed to do.
Meaning : when a first payment is available and you cancel it, then a new one with an empty details array is available with the same payment method. So I replace part of the @given method you added by a processing in the state machine.

@Prometee Prometee merged commit 3034701 into FLUX-SE:master Jun 11, 2024
20 checks passed
@Prometee
Copy link
Member

Thank you very much for this PR @cbastienbaron 🎉

@cbastienbaron
Copy link
Contributor Author

thanks you @Prometee for this kind read and the simplification of behat test :)

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

Successfully merging this pull request may close these issues.

2 participants