-
Notifications
You must be signed in to change notification settings - Fork 119
/
Copy pathindex.js
151 lines (147 loc) · 2.93 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
151
'use strict';
//list of bats
//useful for ALL 5 steps
//could be an array of objects that you fetched from api or database
const bars = [{
'id': 'f944a3ff-591b-4d5b-9b67-c7e08cba9791',
'name': 'freemousse-bar',
'pricePerHour': 50,
'pricePerPerson': 20
}, {
'id': '165d65ec-5e3f-488e-b371-d56ee100aa58',
'name': 'solera',
'pricePerHour': 100,
'pricePerPerson': 40
}, {
'id': '6e06c9c0-4ab0-4d66-8325-c5fa60187cf8',
'name': 'la-poudriere',
'pricePerHour': 250,
'pricePerPerson': 80
}];
//list of current booking events
//useful for ALL steps
//the time is hour
//The `price` is updated from step 1 and 2
//The `commission` is updated from step 3
//The `options` is useful from step 4
const events = [{
'id': 'bba9500c-fd9e-453f-abf1-4cd8f52af377',
'booker': 'esilv-bde',
'barId': 'f944a3ff-591b-4d5b-9b67-c7e08cba9791',
'time': 4,
'persons': 8,
'options': {
'deductibleReduction': false
},
'price': 0,
'commission': {
'insurance': 0,
'treasury': 0,
'privateaser': 0
}
}, {
'id': '65203b0a-a864-4dea-81e2-e389515752a8',
'booker': 'societe-generale',
'barId': '165d65ec-5e3f-488e-b371-d56ee100aa58',
'time': 8,
'persons': 30,
'options': {
'deductibleReduction': true
},
'price': 0,
'commission': {
'insurance': 0,
'treasury': 0,
'privateaser': 0
}
}, {
'id': '94dab739-bd93-44c0-9be1-52dd07baa9f6',
'booker': 'otacos',
'barId': '6e06c9c0-4ab0-4d66-8325-c5fa60187cf8',
'time': 5,
'persons': 80,
'options': {
'deductibleReduction': true
},
'price': 0,
'commission': {
'insurance': 0,
'treasury': 0,
'privateaser': 0
}
}];
//list of actors for payment
//useful from step 5
const actors = [{
'eventId': 'bba9500c-fd9e-453f-abf1-4cd8f52af377',
'payment': [{
'who': 'booker',
'type': 'debit',
'amount': 0
}, {
'who': 'bar',
'type': 'credit',
'amount': 0
}, {
'who': 'insurance',
'type': 'credit',
'amount': 0
}, {
'who': 'treasury',
'type': 'credit',
'amount': 0
}, {
'who': 'privateaser',
'type': 'credit',
'amount': 0
}]
}, {
'eventId': '65203b0a-a864-4dea-81e2-e389515752a8',
'payment': [{
'who': 'booker',
'type': 'debit',
'amount': 0
}, {
'who': 'bar',
'type': 'credit',
'amount': 0
}, {
'who': 'insurance',
'type': 'credit',
'amount': 0
}, {
'who': 'treasury',
'type': 'credit',
'amount': 0
}, {
'who': 'privateaser',
'type': 'credit',
'amount': 0
}]
}, {
'eventId': '94dab739-bd93-44c0-9be1-52dd07baa9f6',
'payment': [{
'who': 'booker',
'type': 'debit',
'amount': 0
}, {
'who': 'bar',
'type': 'credit',
'amount': 0
}, {
'who': 'insurance',
'type': 'credit',
'amount': 0
}, {
'who': 'treasury',
'type': 'credit',
'amount': 0
}, {
'who': 'privateaser',
'type': 'credit',
'amount': 0
}]
}];
console.log(bars);
console.log(events);
console.log(actors);