Skip to content
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

[FM-1195] Support for Colorado fee by introducing order level tax and flat fee #15

Merged
merged 14 commits into from
Oct 20, 2022

Conversation

gustavomrs
Copy link

@gustavomrs gustavomrs commented Sep 28, 2022

FM-1195

The proposal of this PR is to introduce the concept of order-level tax and flat fee, so we can start to collect the $0.27 tax for orders that are being shipped to Colorado. This solution was proposed by the solidus team, so we cherry-picked the commits from these two PRs:

solidusio#4477
solidusio#4491

For more info on how this new concept works (order level and flat fee) you can check it out those two PRs from solidus (there is also a discussion here with more info)

adammathys and others added 12 commits September 28, 2022 10:07
We'll need to be able to easily pass back order-level tax data to our
classes that apply taxes to the order. This adds in an extra array to
allow for that and reuses the existing Tax::ItemTax class for containing
the data.

Co-Authored-By: Sung Noh <sung@meundies.com>
Will safely check if the passed in Tax::OrderTax object has any
`#order_taxes`. If so, uses our existing adjustment logic to
create/update the tax records on an order-level.

Co-Authored-By: Sung Noh <sung@meundies.com>
`Spree::Order#included_tax_total` and
`Spree::Order#additional_tax_total` should also be updated to account
for order-level tax adjustments. These columns aren't really used for
anything except for some display. The tax adjustments are already
accounted for in `Spree::Order#adjustment_total` which is what is used
for calculating payment amounts and the like.
Very simple calculator that will always return the same amount. Will
hopefully be useful for the Colorado Delivery Fee, but might also be
usable for different fees that come  up.
We unfortunately need to introduce the concept of order-level tax rates
to handle the Colorado Delivery fee. (And maybe other similar things?)
The simplest solution is to add an enum to our TaxRate model to help
distinguish between rates that should be applied on an order-level and
our regular item-level taxes.

Co-Authored-By: Andrew Stewart <andrew@super.gd>
Updates TaxHelpers#rates_for_item to use our new enum to filter for
rates that only apply to items.

Co-Authored-By: Andrew Stewart <andrew@super.gd>
Looks for all order-level tax rates and computes order taxes based on
the ones matching the order's ship address and tax categories.
Just a simple radio input to help set the value in the admin.
Adds the translation entry for the class and makes a small tweak to the
tax rate calculator hint to explain the difference between the two
calculators.
Now that this field can be used in two different ways, as a percentage
or as a flat amount, we want to ensure the explanation is still helpful
for users.
Simple task that can be used to help setup all of the records necessary
for calculating the new Colorado Delivery Fee in stores.
Skips the logic for deciding if the "rate" should be shown in the label,
since that never makes sense for flat fee tax rates.
@gustavomrs gustavomrs changed the title Colorado fee / order level taxes Support for colorado fee / order level taxes Sep 28, 2022
@gustavomrs gustavomrs changed the title Support for colorado fee / order level taxes [FM-1195] Support for Colorado fee by introducing order level tax and flat fee Oct 3, 2022
@vl3 vl3 merged commit cba954b into v2.11-penrose-v2 Oct 20, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

Successfully merging this pull request may close these issues.

4 participants