mirror of
https://github.com/openfoodfoundation/openfoodnetwork
synced 2026-01-24 20:36:49 +00:00
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:
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user