From 44aba6d73eca10c5ec7a0e2a7fbe1ba3a0d1cc91 Mon Sep 17 00:00:00 2001 From: Martin Meyerhoff Date: Tue, 12 Jan 2016 10:14:09 -0600 Subject: [PATCH] Simplify `Spree::TaxRate#compute_amount` The current taxation system does this strange trick when refunding VAT: When there should be a refund because the order's tax zone is outside the default vat zone, the computed amount is turned negative. This commit makes this behaviour a little bit clearer. --- core/app/models/spree/tax_rate.rb | 10 +++------- 1 file changed, 3 insertions(+), 7 deletions(-) diff --git a/core/app/models/spree/tax_rate.rb b/core/app/models/spree/tax_rate.rb index bf24a60d5b7..3a808c97dbb 100644 --- a/core/app/models/spree/tax_rate.rb +++ b/core/app/models/spree/tax_rate.rb @@ -173,13 +173,9 @@ def adjust(order_tax_zone, item) # This method is used by Adjustment#update to recalculate the cost. def compute_amount(item) - if included_in_price - if default_zone_or_zone_match?(item.order.tax_zone) - calculator.compute(item) - else - # In this case, it's a refund. - calculator.compute(item) * - 1 - end + if included_in_price && !default_zone_or_zone_match?(item.order.tax_zone) + # In this case, it's a refund. + calculator.compute(item) * - 1 else calculator.compute(item) end