1
|
|
|
<?php |
2
|
|
|
|
3
|
|
|
namespace XoteliaClient\Model; |
4
|
|
|
|
5
|
|
|
use JMS\Serializer\Annotation as Serializer; |
6
|
|
|
|
7
|
|
|
/** |
8
|
|
|
* @Serializer\ExclusionPolicy("all") |
9
|
|
|
*/ |
10
|
|
|
class Booking |
11
|
|
|
{ |
12
|
|
|
const STATUS_NEW = 'new'; |
13
|
|
|
const STATUS_MODIFIED = 'modified'; |
14
|
|
|
const STATUS_CANCELLED = 'cancelled'; |
15
|
|
|
|
16
|
|
|
/** |
17
|
|
|
* OTA Id |
18
|
|
|
* |
19
|
|
|
* @Serializer\Expose() |
20
|
|
|
* @Serializer\Type("string") |
21
|
|
|
* |
22
|
|
|
* @var string |
23
|
|
|
*/ |
24
|
|
|
protected $code; |
25
|
|
|
|
26
|
|
|
/** |
27
|
|
|
* hotel name (optional) |
28
|
|
|
* |
29
|
|
|
* @Serializer\Expose() |
30
|
|
|
* @Serializer\Type("string") |
31
|
|
|
* |
32
|
|
|
* @var string |
33
|
|
|
*/ |
34
|
|
|
protected $name; |
35
|
|
|
|
36
|
|
|
/** |
37
|
|
|
* hotel id (optional) |
38
|
|
|
* |
39
|
|
|
* @Serializer\Expose() |
40
|
|
|
* @Serializer\Type("string") |
41
|
|
|
* |
42
|
|
|
* @var string |
43
|
|
|
*/ |
44
|
|
|
protected $hotelId; |
45
|
|
|
|
46
|
|
|
/** |
47
|
|
|
* array of rooms booked |
48
|
|
|
* |
49
|
|
|
* @Serializer\Expose() |
50
|
|
|
* @Serializer\Type("array<XoteliaClient\Model\Room>") |
51
|
|
|
* |
52
|
|
|
* @var array |
53
|
|
|
*/ |
54
|
|
|
protected $rooms; |
55
|
|
|
|
56
|
|
|
/** |
57
|
|
|
* Not used anymore |
58
|
|
|
* |
59
|
|
|
* @Serializer\Expose() |
60
|
|
|
* @Serializer\Type("float") |
61
|
|
|
* |
62
|
|
|
* @var float |
63
|
|
|
*/ |
64
|
|
|
protected $price = 0; |
65
|
|
|
|
66
|
|
|
/** |
67
|
|
|
* Sum of all payment (deposit, total payment, ...) related to this booking |
68
|
|
|
* |
69
|
|
|
* @Serializer\Expose() |
70
|
|
|
* @Serializer\Type("float") |
71
|
|
|
* |
72
|
|
|
* @var float |
73
|
|
|
*/ |
74
|
|
|
protected $alreadyPaid; |
75
|
|
|
|
76
|
|
|
/** |
77
|
|
|
* Fees to charge on booking cancellation |
78
|
|
|
* |
79
|
|
|
* @Serializer\Expose() |
80
|
|
|
* @Serializer\Type("float") |
81
|
|
|
* |
82
|
|
|
* @var float |
83
|
|
|
*/ |
84
|
|
|
protected $totalCancellationFee; |
85
|
|
|
|
86
|
|
|
/** |
87
|
|
|
* Currency in which payment have to be paid |
88
|
|
|
* |
89
|
|
|
* @Serializer\Expose() |
90
|
|
|
* @Serializer\Type("XoteliaClient\Model\Currency") |
91
|
|
|
* |
92
|
|
|
* @var \XoteliaClient\Model\Currency |
93
|
|
|
*/ |
94
|
|
|
protected $currency; |
95
|
|
|
|
96
|
|
|
/** |
97
|
|
|
* Customer information |
98
|
|
|
* |
99
|
|
|
* @Serializer\Expose() |
100
|
|
|
* @Serializer\Type("XoteliaClient\Model\Customer") |
101
|
|
|
* |
102
|
|
|
* @var \XoteliaClient\Model\Customer |
103
|
|
|
*/ |
104
|
|
|
protected $customer; |
105
|
|
|
|
106
|
|
|
/** |
107
|
|
|
* OTA name |
108
|
|
|
* |
109
|
|
|
* @Serializer\Expose() |
110
|
|
|
* @Serializer\Type("string") |
111
|
|
|
* |
112
|
|
|
* @var string |
113
|
|
|
*/ |
114
|
|
|
protected $ota; |
115
|
|
|
|
116
|
|
|
/** |
117
|
|
|
* new/modified/cancelled |
118
|
|
|
* |
119
|
|
|
* @Serializer\Expose() |
120
|
|
|
* @Serializer\Type("string") |
121
|
|
|
* |
122
|
|
|
* @var string |
123
|
|
|
*/ |
124
|
|
|
protected $status; |
125
|
|
|
|
126
|
|
|
/** |
127
|
|
|
* @Serializer\Expose() |
128
|
|
|
* @Serializer\Type("DateTime") |
129
|
|
|
* |
130
|
|
|
* @var \DateTime |
131
|
|
|
*/ |
132
|
|
|
protected $createdByOtaAt; |
133
|
|
|
|
134
|
|
|
/** |
135
|
|
|
* ID provided by xotelia |
136
|
|
|
* |
137
|
|
|
* @Serializer\Expose() |
138
|
|
|
* @Serializer\Type("string") |
139
|
|
|
* |
140
|
|
|
* @var string |
141
|
|
|
*/ |
142
|
|
|
protected $internalId; |
143
|
|
|
|
144
|
|
|
public function __construct() |
145
|
|
|
{ |
146
|
|
|
$this->rooms = []; |
147
|
|
|
} |
148
|
|
|
|
149
|
|
|
/** |
150
|
|
|
* @param string $code |
151
|
|
|
* |
152
|
|
|
* @return $this |
153
|
|
|
*/ |
154
|
|
|
public function setCode($code) |
155
|
|
|
{ |
156
|
|
|
$this->code = $code; |
157
|
|
|
|
158
|
|
|
return $this; |
159
|
|
|
} |
160
|
|
|
|
161
|
|
|
/** |
162
|
|
|
* @param $name |
163
|
|
|
* |
164
|
|
|
* @return $this |
165
|
|
|
*/ |
166
|
|
|
public function setName($name) |
167
|
|
|
{ |
168
|
|
|
$this->name = $name; |
169
|
|
|
|
170
|
|
|
return $this; |
171
|
|
|
} |
172
|
|
|
|
173
|
|
|
/** |
174
|
|
|
* @param float $price |
175
|
|
|
* |
176
|
|
|
* @return $this |
177
|
|
|
*/ |
178
|
|
|
public function setPrice($price) |
179
|
|
|
{ |
180
|
|
|
$this->price = $price; |
181
|
|
|
|
182
|
|
|
return $this; |
183
|
|
|
} |
184
|
|
|
|
185
|
|
|
/** |
186
|
|
|
* @param Currency $currency |
187
|
|
|
* |
188
|
|
|
* @return $this |
189
|
|
|
*/ |
190
|
|
|
public function setCurrency(Currency $currency) |
191
|
|
|
{ |
192
|
|
|
$this->currency = $currency; |
193
|
|
|
|
194
|
|
|
return $this; |
195
|
|
|
} |
196
|
|
|
|
197
|
|
|
/** |
198
|
|
|
* @param Customer $customer |
199
|
|
|
* |
200
|
|
|
* @return $this |
201
|
|
|
*/ |
202
|
|
|
public function setCustomer(Customer $customer) |
203
|
|
|
{ |
204
|
|
|
$this->customer = $customer; |
205
|
|
|
|
206
|
|
|
return $this; |
207
|
|
|
} |
208
|
|
|
|
209
|
|
|
/** |
210
|
|
|
* @param $ota |
211
|
|
|
* |
212
|
|
|
* @return $this |
213
|
|
|
*/ |
214
|
|
|
public function setOta($ota) |
215
|
|
|
{ |
216
|
|
|
$this->ota = $ota; |
217
|
|
|
|
218
|
|
|
return $this; |
219
|
|
|
} |
220
|
|
|
|
221
|
|
|
/** |
222
|
|
|
* @return string |
223
|
|
|
*/ |
224
|
|
|
public function getCode() |
225
|
|
|
{ |
226
|
|
|
return $this->code; |
227
|
|
|
} |
228
|
|
|
|
229
|
|
|
/** |
230
|
|
|
* @return string |
231
|
|
|
*/ |
232
|
|
|
public function getName() |
233
|
|
|
{ |
234
|
|
|
return $this->name; |
235
|
|
|
} |
236
|
|
|
|
237
|
|
|
/** |
238
|
|
|
* @return float |
239
|
|
|
*/ |
240
|
|
|
public function getPrice() |
241
|
|
|
{ |
242
|
|
|
return $this->price; |
243
|
|
|
} |
244
|
|
|
|
245
|
|
|
/** |
246
|
|
|
* @return Currency |
247
|
|
|
*/ |
248
|
|
|
public function getCurrency() |
249
|
|
|
{ |
250
|
|
|
return $this->currency; |
251
|
|
|
} |
252
|
|
|
|
253
|
|
|
/** |
254
|
|
|
* @return Customer |
255
|
|
|
*/ |
256
|
|
|
public function getCustomer() |
257
|
|
|
{ |
258
|
|
|
return $this->customer; |
259
|
|
|
} |
260
|
|
|
|
261
|
|
|
/** |
262
|
|
|
* @return string |
263
|
|
|
*/ |
264
|
|
|
public function getOta() |
265
|
|
|
{ |
266
|
|
|
return $this->ota; |
267
|
|
|
} |
268
|
|
|
|
269
|
|
|
/** |
270
|
|
|
* @return string |
271
|
|
|
*/ |
272
|
|
|
public function getStatus() |
273
|
|
|
{ |
274
|
|
|
return $this->status; |
275
|
|
|
} |
276
|
|
|
|
277
|
|
|
/** |
278
|
|
|
* @param string $status |
279
|
|
|
* |
280
|
|
|
* @return $this |
281
|
|
|
*/ |
282
|
|
|
public function setStatus($status) |
283
|
|
|
{ |
284
|
|
|
$this->status = $status; |
285
|
|
|
|
286
|
|
|
return $this; |
287
|
|
|
} |
288
|
|
|
|
289
|
|
|
/** |
290
|
|
|
* @return float |
291
|
|
|
*/ |
292
|
|
|
public function getTotalCancellationFee() |
293
|
|
|
{ |
294
|
|
|
return $this->totalCancellationFee; |
295
|
|
|
} |
296
|
|
|
|
297
|
|
|
/** |
298
|
|
|
* @param float $totalCancellationFee |
299
|
|
|
* |
300
|
|
|
* @return $this |
301
|
|
|
*/ |
302
|
|
|
public function setTotalCancellationFee($totalCancellationFee) |
303
|
|
|
{ |
304
|
|
|
$this->totalCancellationFee = $totalCancellationFee; |
305
|
|
|
|
306
|
|
|
return $this; |
307
|
|
|
} |
308
|
|
|
|
309
|
|
|
/** |
310
|
|
|
* @return Room[] |
311
|
|
|
*/ |
312
|
|
|
public function getRooms() |
313
|
|
|
{ |
314
|
|
|
return $this->rooms; |
315
|
|
|
} |
316
|
|
|
|
317
|
|
|
/** |
318
|
|
|
* @param array $rooms |
319
|
|
|
* |
320
|
|
|
* @return $this |
321
|
|
|
*/ |
322
|
|
|
public function setRooms($rooms) |
323
|
|
|
{ |
324
|
|
|
$this->rooms = $rooms; |
325
|
|
|
|
326
|
|
|
return $this; |
327
|
|
|
} |
328
|
|
|
|
329
|
|
|
/** |
330
|
|
|
* @return float |
331
|
|
|
*/ |
332
|
|
|
public function getAlreadyPaid() |
333
|
|
|
{ |
334
|
|
|
return $this->alreadyPaid; |
335
|
|
|
} |
336
|
|
|
|
337
|
|
|
/** |
338
|
|
|
* @param float $alreadyPaid |
339
|
|
|
* |
340
|
|
|
* @return $this |
341
|
|
|
*/ |
342
|
|
|
public function setAlreadyPaid($alreadyPaid) |
343
|
|
|
{ |
344
|
|
|
$this->alreadyPaid = $alreadyPaid; |
345
|
|
|
|
346
|
|
|
return $this; |
347
|
|
|
} |
348
|
|
|
|
349
|
|
|
public function getStartDate() |
350
|
|
|
{ |
351
|
|
|
return $this->rooms[0]->getStartDate(); |
352
|
|
|
} |
353
|
|
|
|
354
|
|
|
public function getEndDate() |
355
|
|
|
{ |
356
|
|
|
return $this->rooms[0]->getEndDate(); |
357
|
|
|
} |
358
|
|
|
|
359
|
|
|
/** |
360
|
|
|
* @return string |
361
|
|
|
*/ |
362
|
|
|
public function getHotelId() |
363
|
|
|
{ |
364
|
|
|
return $this->hotelId; |
365
|
|
|
} |
366
|
|
|
|
367
|
|
|
/** |
368
|
|
|
* @param string $hotelId |
369
|
|
|
* |
370
|
|
|
* @return $this |
371
|
|
|
*/ |
372
|
|
|
public function setHotelId($hotelId) |
373
|
|
|
{ |
374
|
|
|
$this->hotelId = $hotelId; |
375
|
|
|
|
376
|
|
|
return $this; |
377
|
|
|
} |
378
|
|
|
|
379
|
|
|
/** |
380
|
|
|
* @return \DateTime |
381
|
|
|
*/ |
382
|
|
|
public function getCreatedByOtaAt() |
383
|
|
|
{ |
384
|
|
|
return $this->createdByOtaAt; |
385
|
|
|
} |
386
|
|
|
|
387
|
|
|
/** |
388
|
|
|
* @param \DateTime $createdByOtaAt |
389
|
|
|
* |
390
|
|
|
* @return $this |
391
|
|
|
*/ |
392
|
|
|
public function setCreatedByOtaAt($createdByOtaAt) |
393
|
|
|
{ |
394
|
|
|
$this->createdByOtaAt = $createdByOtaAt; |
395
|
|
|
|
396
|
|
|
return $this; |
397
|
|
|
} |
398
|
|
|
|
399
|
|
|
/** |
400
|
|
|
* @return string |
401
|
|
|
*/ |
402
|
|
|
public function getInternalId() |
403
|
|
|
{ |
404
|
|
|
return $this->internalId; |
405
|
|
|
} |
406
|
|
|
|
407
|
|
|
/** |
408
|
|
|
* @param string $internalId |
409
|
|
|
* |
410
|
|
|
* @return $this |
411
|
|
|
*/ |
412
|
|
|
public function setInternalId($internalId) |
413
|
|
|
{ |
414
|
|
|
$this->internalId = $internalId; |
415
|
|
|
|
416
|
|
|
return $this; |
417
|
|
|
} |
418
|
|
|
} |
419
|
|
|
|