-
-
Notifications
You must be signed in to change notification settings - Fork 708
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
Reset order state to cart in case the stripe SCA authorization step fails #5824
Merged
luisramos0
merged 21 commits into
openfoodfoundation:master
from
luisramos0:improve_checkout
Aug 1, 2020
Merged
Changes from 1 commit
Commits
Show all changes
21 commits
Select commit
Hold shift + click to select a range
5266d95
Move method closer to related/similar methods
luisramos0 1bf946d
Reused code in checkout controller, the reponse for the case when the…
luisramos0 b23b707
Notify bugsnag and execute post checkout actions (reset to cart state…
luisramos0 ec0d06a
Reuse update_failed method as the code needed is exactly the same
luisramos0 d8a96c9
Bring order checkout workflow and some of its specs from spree_core
luisramos0 e99f0dc
Rubocop autocorrect and easy rubocop issues
luisramos0 51de526
Fix specs in checkout_spec
luisramos0 e80337a
Transpec checkout_spec
luisramos0 734fce5
Add code to persist payments after failed payments. The state machine
luisramos0 26eee46
Rename AdvanceOrderService to OrderWorkflow
luisramos0 c3f9905
Move advance_order_state from checkout_controller to OrderWorkflow se…
luisramos0 9cbcf14
Move shipping method id setting code to OrderWorkflow service
luisramos0 ac5882e
Refactor OrderWorkflow
luisramos0 0700559
Move payments persistence code to order workflow service
luisramos0 fe0c04b
Complete renaming of AdvanceOrderService to OrderWorkflow
mkllnk ad00971
Improve readability and add bugsnag error (now in the checkout_failed…
luisramos0 da4abf6
Add a comment to explain the necessity of the first rescue in the upd…
luisramos0 9e9e0d0
Remove rescue_from and just add the rescue to the edit action, the up…
luisramos0 2136eec
Avoid reloading the payment every time, so that in-memory data is not…
luisramos0 e739c51
Add specs to verify that Spree::Core::Gateway exceptions are handled …
luisramos0 0359d10
Improve code comments on dodgy and/but critical checkout process method
luisramos0 File filter
Filter by extension
Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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'm still a bit confused what's happening here. Do we need a comment explaining that? My theory is:
payment
and a payment object is created.payment
tocomplete
but on error the state machine stays inpayment
.checkout
,pending
,processing
,completed
void
andinvalid
.void
orinvalid
tocheckout
orpending
(I don't know which).Do you agree with this?
What else could happen? I guess a payment could complete but something else fails and we override the payment state to mark it as completed. That's a good thing.
I reckon that the payment should happen outside of the state machine transition to not be affected by the rollback. The state machine transition just verifies that there is enough money for the order. Out of scope here.
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 dont agree about you being confused :-)
I think what's happening is exactly what you have described 👌 and that was what I thought was happening 👍
I used some of your description to add code comments. I think it's now better explained, thanks!