Improve docs and readability on tax_rate_decorator

This commit is contained in:
luisramos0
2018-10-02 11:57:58 +01:00
parent 795441484d
commit bed4ec4102

View File

@@ -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