Output exchange fees as JSON

This commit is contained in:
Rohan Mitchell
2013-08-13 14:33:00 +10:00
parent 293661377e
commit 4120bc3dca
3 changed files with 8 additions and 4 deletions

View File

@@ -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({})

View File

@@ -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

View File

@@ -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', ->