mirror of
https://github.com/openfoodfoundation/openfoodnetwork
synced 2026-04-04 07:09:14 +00:00
Fix for broken percentage Enterprise Fees in place, no test yet
This commit is contained in:
@@ -147,7 +147,8 @@ class OrderCycle < ActiveRecord::Base
|
||||
enterprise_fees_for(variant, distributor).sum do |fee|
|
||||
# Spree's Calculator interface accepts Orders or LineItems,
|
||||
# so we meet that interface with a struct.
|
||||
line_item = OpenStruct.new variant: variant, quantity: 1
|
||||
# Amount is faked, this is a method on LineItem
|
||||
line_item = OpenStruct.new variant: variant, quantity: 1, amount: (variant.price)
|
||||
fee[:enterprise_fee].compute_amount(line_item)
|
||||
end
|
||||
end
|
||||
@@ -159,7 +160,6 @@ class OrderCycle < ActiveRecord::Base
|
||||
enterprise_fees_for(variant, distributor).each { |fee| create_adjustment_for_fee line_item, fee[:enterprise_fee], fee[:label], fee[:role] }
|
||||
end
|
||||
|
||||
|
||||
private
|
||||
|
||||
# -- Fees
|
||||
|
||||
@@ -323,6 +323,9 @@ describe OrderCycle do
|
||||
|
||||
order_cycle.fees_for(product.master, distributor).should == 23
|
||||
end
|
||||
|
||||
|
||||
it "sums percentage fees for the variant"
|
||||
end
|
||||
|
||||
describe "creating adjustments for a line item" do
|
||||
|
||||
Reference in New Issue
Block a user