From a22cc96ea56d92045e89f84aeea5ca6e5734158a Mon Sep 17 00:00:00 2001 From: Matt-Yorkley <9029026+Matt-Yorkley@users.noreply.github.com> Date: Sat, 6 Mar 2021 16:17:46 +0000 Subject: [PATCH] Simplify DefaultTax calculator This logic is handled in TaxRate and doesn't need to be duplicated here. --- app/models/calculator/default_tax.rb | 10 +++------- 1 file changed, 3 insertions(+), 7 deletions(-) diff --git a/app/models/calculator/default_tax.rb b/app/models/calculator/default_tax.rb index fb764340fa..be1447930d 100644 --- a/app/models/calculator/default_tax.rb +++ b/app/models/calculator/default_tax.rb @@ -79,14 +79,10 @@ module Calculator end def compute_shipment_or_line_item(item) - if item.tax_category == rate.tax_category - if rate.included_in_price - deduced_total_by_rate(item.amount, rate) - else - round_to_two_places(item.amount * rate.amount) - end + if rate.included_in_price + deduced_total_by_rate(item.amount, rate) else - 0 + round_to_two_places(item.amount * rate.amount) end end alias_method :compute_shipment, :compute_shipment_or_line_item