mirror of
https://github.com/openfoodfoundation/openfoodnetwork
synced 2026-01-24 20:36:49 +00:00
Allow enterprise fee with no tax category
This commit is contained in:
@@ -32,7 +32,9 @@ module OpenFoodNetwork
|
||||
end
|
||||
|
||||
def adjustment_tax(order, adjustment)
|
||||
enterprise_fee.tax_category.tax_rates.match(order).sum do |rate|
|
||||
tax_rates = enterprise_fee.tax_category ? enterprise_fee.tax_category.tax_rates.match(order) : []
|
||||
|
||||
tax_rates.sum do |rate|
|
||||
compute_tax rate, adjustment.amount
|
||||
end
|
||||
end
|
||||
|
||||
@@ -84,7 +84,6 @@ module Spree
|
||||
let!(:zone_member) { ZoneMember.create!(zone: zone, zoneable: Country.find_by_name('Australia')) }
|
||||
let(:tax_rate) { create(:tax_rate, included_in_price: true, calculator: Calculator::DefaultTax.new, zone: zone, amount: 0.1) }
|
||||
let(:tax_category) { create(:tax_category, tax_rates: [tax_rate]) }
|
||||
let(:tax_category_untaxed) { create(:tax_category) }
|
||||
|
||||
let(:coordinator) { create(:distributor_enterprise) }
|
||||
let(:variant) { create(:variant) }
|
||||
@@ -120,7 +119,7 @@ module Spree
|
||||
|
||||
describe "when enterprise fees have no tax" do
|
||||
before do
|
||||
enterprise_fee.tax_category = tax_category_untaxed
|
||||
enterprise_fee.tax_category = nil
|
||||
enterprise_fee.save!
|
||||
order.update_distribution_charge!
|
||||
end
|
||||
|
||||
Reference in New Issue
Block a user