-
-
Notifications
You must be signed in to change notification settings - Fork 724
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 #6964: don't try to complete a failed payment #6965
Fix #6964: don't try to complete a failed payment #6965
Conversation
but we do know the exact Stripe request we receive when that happens, don't we? We would need to stub that out and we'd be reproducing the same scenario. |
@@ -20,7 +20,7 @@ def call! | |||
|
|||
last_payment.update_attribute(:cvv_response_message, nil) | |||
OrderWorkflow.new(@order).next | |||
last_payment.complete! if !last_payment.completed? | |||
last_payment.complete! if %w('pending processing').include?(last_payment.state) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I would personally make the effort to extract a method out of this and find a name for this so 1) we don't mix levels of abstraction in #call!
2) we make it easier for the next dev to understand why pending
and processing
states and not others.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Good catch, I'm not sure I didn't just use the can_complete?
method in the first place.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We should test this new behavior.
EDIT nice! the test is failing
dc2b12d
to
3b15e0e
Compare
Hey @andrewpbrett , thanks for addressing this. Before this PR we had the following scenario: i) placing an order in the BO (admin) After this PR: Also, please not that I was not able to reproduce bug #6683 after this PR 🎉 We can see, that the (3 eur) transaction fee do not pile up, despite the failed payment attempts: The fact that the order is still in the balance due state relates to bug #5574. It would be good to have a spec covering us from the re-occurrence of #6683. Should I open a tech-debt for this? Awesome, let's get this merged 🎉 |
Yes, I think it's worth exploring why no test failed after we introduced this regression. |
What? Why?
Closes #6964
Here we only complete a payment if it's in a state where it can be completed, and list those states explicitly
What should we test?
Choosing not to authorize an SCA payment should not result in a snail.
This might be pretty difficult to write an automated test for since we're testing what happens when the customer interacts with the Stripe website.
Release notes
I don't think this is happening in production
Changelog Category: Technical changes
Dependencies
Documentation updates