-
-
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
Add Tax extension point and merge tax updating code #1479
Merged
jhawthorn
merged 5 commits into
solidusio:master
from
jordan-brough:tax-extension-point
Oct 31, 2016
Merged
Add Tax extension point and merge tax updating code #1479
jhawthorn
merged 5 commits into
solidusio:master
from
jordan-brough:tax-extension-point
Oct 31, 2016
Conversation
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
jordan-brough
force-pushed
the
tax-extension-point
branch
from
October 1, 2016 13:28
097a6b3
to
2224499
Compare
Previously we had two different sets of tax updating code. One was Order#create_tax_charge! and the other was the code in OrderUpdater. The effect of the former encompasses the effect of the latter, so functionally we can merge these. This may result in increased load since we're now using the more encompassing method which was more heavyweight.
We had several specs that manually created tax adjustments rather than setting up a real tax rate to be applied to the order. This fixes that.
To allow easier customization of tax calculation in extensions or applications.
jordan-brough
force-pushed
the
tax-extension-point
branch
from
October 12, 2016 15:21
2224499
to
4dbf194
Compare
mamhoff
approved these changes
Oct 12, 2016
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.
👍
jhawthorn
force-pushed
the
tax-extension-point
branch
from
October 31, 2016 22:06
0b71211
to
b3c81cc
Compare
jhawthorn
added a commit
to jhawthorn/solidus
that referenced
this pull request
Oct 31, 2016
As of solidusio#1479 we are doing more work inside of OrderUpdater. We're doing additions and deletions of tax adjustments, which also causes more touching of records. This is all made faster by wrapping the entire update in a transaction. All the writes can be queued together by the DB, and as of rails 5, dependent touching is grouped together to the end of the transaction.
jhawthorn
added a commit
to jhawthorn/solidus
that referenced
this pull request
Nov 7, 2016
Previously, ItemAdjuster#adjust! would always destroy all tax adjustments on the item and recreate them. This was unnecessarily slow in the common case of needing no changes (especially following solidusio#1479). This changes ItemAdjuster#adjust! to instead update the adjustment for a rate if it already exists, create adjustments if they are missing for a matching rate, and destroy adjustments for rates which are no longer matching.
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
To allow easier customization of tax calculation in extensions or
applications.
This should resolve (or get a lot closer to resolving) #1252.
See individual commits.
There is a possible performance hit here, as I've merged two sections of tax updating code, and used the more encompassing method in both places, and the more encompassing method is heavier weight. We could look into optimizing that code if we think we need to. (I've discussed some ideas with the core team around adding a sort of caching, though it's always scary to add caching.)