mirror of
https://github.com/openfoodfoundation/openfoodnetwork
synced 2026-03-01 02:03:22 +00:00
Output exchange fees as JSON
This commit is contained in:
@@ -123,10 +123,10 @@ angular.module('order_cycle', ['ngResource'])
|
||||
exchange.showProducts = !exchange.showProducts
|
||||
|
||||
addSupplier: (new_supplier_id) ->
|
||||
this.order_cycle.incoming_exchanges.push({enterprise_id: new_supplier_id, active: true, variants: {}})
|
||||
this.order_cycle.incoming_exchanges.push({enterprise_id: new_supplier_id, active: true, variants: {}, enterprise_fees: []})
|
||||
|
||||
addDistributor: (new_distributor_id) ->
|
||||
this.order_cycle.outgoing_exchanges.push({enterprise_id: new_distributor_id, active: true, variants: {}})
|
||||
this.order_cycle.outgoing_exchanges.push({enterprise_id: new_distributor_id, active: true, variants: {}, enterprise_fees: []})
|
||||
|
||||
addCoordinatorFee: ->
|
||||
this.order_cycle.coordinator_fees.push({})
|
||||
|
||||
@@ -16,6 +16,10 @@ r.element :order_cycle, @order_cycle do
|
||||
|
||||
r.element :variants, Hash[ exchange.variants.map { |v| [v.id, true] } ], {}
|
||||
|
||||
r.list_of :enterprise_fees do |fee|
|
||||
r.element :id
|
||||
end
|
||||
|
||||
r.element :pickup_time
|
||||
r.element :pickup_instructions
|
||||
end
|
||||
|
||||
@@ -334,7 +334,7 @@ describe 'OrderCycle services', ->
|
||||
it 'adds the supplier to incoming exchanges', ->
|
||||
OrderCycle.addSupplier('123')
|
||||
expect(OrderCycle.order_cycle.incoming_exchanges).toEqual [
|
||||
{enterprise_id: '123', active: true, variants: {}}
|
||||
{enterprise_id: '123', active: true, variants: {}, enterprise_fees: []}
|
||||
]
|
||||
|
||||
describe 'adding distributors', ->
|
||||
@@ -343,7 +343,7 @@ describe 'OrderCycle services', ->
|
||||
it 'adds the distributor to outgoing exchanges', ->
|
||||
OrderCycle.addDistributor('123')
|
||||
expect(OrderCycle.order_cycle.outgoing_exchanges).toEqual [
|
||||
{enterprise_id: '123', active: true, variants: {}}
|
||||
{enterprise_id: '123', active: true, variants: {}, enterprise_fees: []}
|
||||
]
|
||||
|
||||
describe 'adding coordinator fees', ->
|
||||
|
||||
Reference in New Issue
Block a user