mirror of
https://github.com/openfoodfoundation/openfoodnetwork
synced 2026-01-24 20:36:49 +00:00
Handling tax categories without tax rates
This commit is contained in:
@@ -39,7 +39,7 @@ module OpenFoodNetwork
|
||||
|
||||
def gst(variant)
|
||||
tax_category = variant.product.tax_category
|
||||
if tax_category
|
||||
if tax_category && tax_category.tax_rates.present?
|
||||
tax_rate = tax_category.tax_rates.first
|
||||
line_item = mock_line_item(variant, tax_category)
|
||||
tax_rate.calculator.compute line_item
|
||||
|
||||
@@ -21,5 +21,11 @@ module OpenFoodNetwork
|
||||
report.send(:grower_and_method, v).should == "Producer (Method)"
|
||||
end
|
||||
end
|
||||
|
||||
describe "gst" do
|
||||
it "handles tax category without rates" do
|
||||
report.send(:gst, v).should == 0
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
Reference in New Issue
Block a user