From bd31348b944971ee2d2793836134ae6487330fe0 Mon Sep 17 00:00:00 2001 From: luisramos0 Date: Tue, 2 Oct 2018 11:57:58 +0100 Subject: [PATCH] Improve docs and readability on tax_rate_decorator --- app/models/spree/tax_rate_decorator.rb | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) diff --git a/app/models/spree/tax_rate_decorator.rb b/app/models/spree/tax_rate_decorator.rb index fd111084ce..8c8998735e 100644 --- a/app/models/spree/tax_rate_decorator.rb +++ b/app/models/spree/tax_rate_decorator.rb @@ -8,19 +8,18 @@ module Spree alias_method_chain :match, :sales_tax_registration end - def adjust_with_included_tax(order) adjust_without_included_tax(order) order.adjustments(:reload) order.line_items(:reload) - (order.adjustments.tax + order.price_adjustments).each do |a| - a.set_absolute_included_tax! a.amount + # TaxRate adjustments (order.adjustments.tax) and price adjustments (tax included on line items) consist of 100% tax + (order.adjustments.tax + order.price_adjustments).each do |adjustment| + adjustment.set_absolute_included_tax! adjustment.amount end end alias_method_chain :adjust, :included_tax - # Manually apply a TaxRate to a particular amount. TaxRates normally compute against # LineItems or Orders, so we mock out a line item here to fit the interface # that our calculator (usually DefaultTax) expects. @@ -41,7 +40,6 @@ module Spree end end - private def with_tax_included_in_price