Adapt tax_rate_decorator to new spree version. Spree's default tax calculator now is checking line_items tax category, not the product tax category. See Spree's change here: a0a4b91f13 (diff-46e557ca8717d6ab5039470a40d00ea8)

This commit is contained in:
luisramos0
2018-10-02 17:47:15 +01:00
parent f0183cd17e
commit 3fbb98519d

View File

@@ -25,9 +25,8 @@ module Spree
# LineItems or Orders, so we mock out a line item here to fit the interface
# that our calculator (usually DefaultTax) expects.
def compute_tax(amount)
product = OpenStruct.new tax_category: tax_category
line_item = LineItem.new quantity: 1
line_item.define_singleton_method(:product) { product }
line_item.tax_category = tax_category
line_item.define_singleton_method(:price) { amount }
# Tax on adjustments (represented by the included_tax field) is always inclusive of