-
-
Notifications
You must be signed in to change notification settings - Fork 1.3k
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
Spree::Payment::Processing refactor #4823
Conversation
Codecov Report
@@ Coverage Diff @@
## master #4823 +/- ##
=======================================
Coverage 86.23% 86.23%
=======================================
Files 578 578
Lines 14674 14671 -3
=======================================
- Hits 12654 12652 -2
+ Misses 2020 2019 -1
📣 We’re building smart automated test selection to slash your CI/CD build times. Learn more |
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.
Thanks for clearing this up! 🙏🏻
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.
Left some comments here and there but I think that this change is worth it, there was a lot of premature optimization in this class, while we probably need more simplicity.
894fb65
to
d00ddb9
Compare
68acd75
to
609ed5f
Compare
@elia I think you pushed the wrong branch here. Can you please check? |
@kennyadsl 🤦♂️ on it thanks |
609ed5f
to
4882cc6
Compare
@kennyadsl done 👍 |
@elia please rebase! |
This turns a deeply nested set of `if`s into a list of guard clauses.
4882cc6
to
5a34895
Compare
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.
Very nice job ❤️
The internal helpers were adding more noise and indirection than clarity. Now the calls to `#purchase` and `#authorize` are clearly
This way we group simple checks and checks that would raise exceptions in different groups for better readability.
Remove some indirection and unnecessary meta-programming. Have it return either true or false leaving the "success" state call as a responsibility of the caller (the "failure_state" was always the same). Also remove one nesting level in the implementation.
5a34895
to
a5ec43b
Compare
Summary
While working on solidus_stripe I had a deeper look at how the processing is handled and took the chance to straight out a few indirections.
Since it's only touching private APIs we shouldn't need any special handling or deprecations.
Checklist
Check out our PR guidelines for more details.
The following are mandatory for all PRs:
The following are not always needed (
cross them outif they are not):- [ ] I have added automated tests to cover my changes. - [ ] I have attached screenshots to demo visual changes. - [ ] I have opened a PR to update the [guides](https://github.com/solidusio/edgeguides). - [ ] I have updated the README to account for my changes.