-
Notifications
You must be signed in to change notification settings - Fork 93
/
Copy pathindex.js
150 lines (146 loc) · 2.96 KB
/
index.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
'use strict';
//list of truckers
//useful for ALL 5 steps
//could be an array of objects that you fetched from api or database
const truckers = [{
'id': 'f944a3ff-591b-4d5b-9b67-c7e08cba9791',
'name': 'les-routiers-bretons',
'pricePerKm': 0.05,
'pricePerVolume': 5
}, {
'id': '165d65ec-5e3f-488e-b371-d56ee100aa58',
'name': 'geodis',
'pricePerKm': 0.1,
'pricePerVolume': 8.5
}, {
'id': '6e06c9c0-4ab0-4d66-8325-c5fa60187cf8',
'name': 'xpo',
'pricePerKm': 0.10,
'pricePerVolume': 10
}];
//list of current shippings
//useful for ALL steps
//The `price` is updated from step 1 and 2
//The `commission` is updated from step 3
//The `options` is useful from step 4
const deliveries = [{
'id': 'bba9500c-fd9e-453f-abf1-4cd8f52af377',
'shipper': 'bio-gourmet',
'truckerId': 'f944a3ff-591b-4d5b-9b67-c7e08cba9791',
'distance': 100,
'volume': 4,
'options': {
'deductibleReduction': false
},
'price': 0,
'commission': {
'insurance': 0,
'treasury': 0,
'convargo': 0
}
}, {
'id': '65203b0a-a864-4dea-81e2-e389515752a8',
'shipper': 'librairie-lu-cie',
'truckerId': '165d65ec-5e3f-488e-b371-d56ee100aa58',
'distance': 650,
'volume': 12,
'options': {
'deductibleReduction': true
},
'price': 0,
'commission': {
'insurance': 0,
'treasury': 0,
'convargo': 0
}
}, {
'id': '94dab739-bd93-44c0-9be1-52dd07baa9f6',
'shipper': 'otacos',
'truckerId': '6e06c9c0-4ab0-4d66-8325-c5fa60187cf8',
'distance': 1250,
'volume': 30,
'options': {
'deductibleReduction': true
},
'price': 0,
'commission': {
'insurance': 0,
'treasury': 0,
'convargo': 0
}
}];
//list of actors for payment
//useful from step 5
const actors = [{
'deliveryId': 'bba9500c-fd9e-453f-abf1-4cd8f52af377',
'payment': [{
'who': 'shipper',
'type': 'debit',
'amount': 0
}, {
'who': 'trucker',
'type': 'credit',
'amount': 0
}, {
'who': 'insurance',
'type': 'credit',
'amount': 0
}, {
'who': 'treasury',
'type': 'credit',
'amount': 0
}, {
'who': 'convargo',
'type': 'credit',
'amount': 0
}]
}, {
'deliveryId': '65203b0a-a864-4dea-81e2-e389515752a8',
'payment': [{
'who': 'shipper',
'type': 'debit',
'amount': 0
}, {
'who': 'trucker',
'type': 'credit',
'amount': 0
}, {
'who': 'insurance',
'type': 'credit',
'amount': 0
}, {
'who': 'treasury',
'type': 'credit',
'amount': 0
}, {
'who': 'convargo',
'type': 'credit',
'amount': 0
}]
}, {
'deliveryId': '94dab739-bd93-44c0-9be1-52dd07baa9f6',
'payment': [{
'who': 'shipper',
'type': 'debit',
'amount': 0
}, {
'who': 'trucker',
'type': 'credit',
'amount': 0
}, {
'who': 'treasury',
'type': 'credit',
'amount': 0
}, {
'who': 'insurance',
'type': 'credit',
'amount': 0
}, {
'who': 'convargo',
'type': 'credit',
'amount': 0
}]
}];
console.log(truckers);
console.log(deliveries);
console.log(actors);