-
-
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 validity period for Spree::TaxRate #1953
Add validity period for Spree::TaxRate #1953
Conversation
c7f4cf2
to
c1b7147
Compare
This is also missing validations for dates but I can imaging we want this to have validations so that there can only be one valid tax rate at a time. |
I ended up duplicating code that's in |
a5bd420
to
162d5a2
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.
I think this is a great step forward for the internal taxation system. However would you mind squashing the commits into one? The in-PR refactoring isn't something future readers need to see. :)
@@ -22,6 +22,7 @@ | |||
<col style="width: 10%"> | |||
<col style="width: 10%"> | |||
<col style="width: 10%"> | |||
<col style="width: 10%"> |
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're now way over 100% with these width
values.
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'll see what I can do... I'm not that good with style and html 😅
This code adds a starts_at and expires_at datetime field to Spree::TaxRate so that tax rates can be scoped in time. Null values will be treated as valid so that a tax rate is valid by default and you can just ignore this feature if you don't need it. The Spree::Calculator::DefaultTax will always return 0 in case the tax rate is not valid (either not started or expired). Ref. solidusio#1857
162d5a2
to
10d5260
Compare
This code adds a valid_from and valid_until datetime field to
Spree::TaxRate
so that tax rates can be scoped in time.Null values will be treated as valid so that a tax rate is valid by default and you can just ignore this feature if you don't need it.
The
Spree::Calculator::DefaultTax
will always return 0 in case the tax rate is not in its validity period.I was unsure how to implement it so I started with a scope but ended up thinking it's not really needed. @mamhoff if you could point me in the right direction I'd refactor it.
Ref. #1857