mirror of
https://github.com/openfoodfoundation/openfoodnetwork
synced 2026-02-26 01:33:22 +00:00
Do not show zero fees
This commit is contained in:
@@ -19,7 +19,7 @@ module OpenFoodNetwork
|
||||
fees[applicator.enterprise_fee.fee_type.to_sym] ||= 0
|
||||
fees[applicator.enterprise_fee.fee_type.to_sym] += calculate_fee_for variant, applicator
|
||||
fees
|
||||
end
|
||||
end.select { |fee_type, amount| amount > 0 }
|
||||
end
|
||||
|
||||
|
||||
|
||||
@@ -45,6 +45,12 @@ module OpenFoodNetwork
|
||||
it "returns a breakdown of fees" do
|
||||
EnterpriseFeeCalculator.new(distributor, order_cycle).fees_by_type_for(product.master).should == {admin: 1.23, sales: 4.56, packing: 7.89, transport: 0.12}
|
||||
end
|
||||
|
||||
it "filters out zero fees" do
|
||||
ef_admin.calculator.update_attribute :preferred_amount, 0
|
||||
|
||||
EnterpriseFeeCalculator.new(distributor, order_cycle).fees_by_type_for(product.master).should == {sales: 4.56, packing: 7.89, transport: 0.12}
|
||||
end
|
||||
end
|
||||
|
||||
describe "creating adjustments" do
|
||||
|
||||
Reference in New Issue
Block a user