mirror of
https://github.com/openfoodfoundation/openfoodnetwork
synced 2026-03-19 04:49:15 +00:00
Updates order and product factory to consider added tax
This commit is contained in:
@@ -182,6 +182,7 @@ FactoryBot.define do
|
||||
product_price { 0 }
|
||||
tax_rate_amount { 0 }
|
||||
tax_rate_name { "" }
|
||||
included_in_price { "" }
|
||||
zone { create(:zone_with_member) }
|
||||
end
|
||||
|
||||
@@ -193,7 +194,8 @@ FactoryBot.define do
|
||||
product = FactoryBot.create(:taxed_product, zone: proxy.zone,
|
||||
price: proxy.product_price,
|
||||
tax_rate_amount: proxy.tax_rate_amount,
|
||||
tax_rate_name: proxy.tax_rate_name)
|
||||
tax_rate_name: proxy.tax_rate_name,
|
||||
included_in_price: proxy.included_in_price)
|
||||
FactoryBot.create(:line_item, order: order, product: product, price: product.price)
|
||||
order.reload
|
||||
end
|
||||
|
||||
@@ -67,6 +67,7 @@ FactoryBot.define do
|
||||
transient do
|
||||
tax_rate_amount { 0 }
|
||||
tax_rate_name { "" }
|
||||
included_in_price { "" }
|
||||
zone { nil }
|
||||
end
|
||||
|
||||
@@ -77,7 +78,7 @@ FactoryBot.define do
|
||||
|
||||
create(:tax_rate, amount: proxy.tax_rate_amount,
|
||||
tax_category: product.tax_category,
|
||||
included_in_price: true,
|
||||
included_in_price: proxy.included_in_price,
|
||||
calculator: Calculator::DefaultTax.new,
|
||||
zone: proxy.zone,
|
||||
name: proxy.tax_rate_name)
|
||||
|
||||
Reference in New Issue
Block a user