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
|
|
|
* @Serializer\Expose() |
136
|
|
|
* @Serializer\Type("string") |
137
|
|
|
* |
138
|
|
|
* @var string |
139
|
|
|
*/ |
140
|
|
|
protected $arrivalTime; |
141
|
|
|
|
142
|
|
|
/** |
143
|
|
|
* ID provided by xotelia |
144
|
|
|
* |
145
|
|
|
* @Serializer\Expose() |
146
|
|
|
* @Serializer\Type("string") |
147
|
|
|
* |
148
|
|
|
* @var string |
149
|
|
|
*/ |
150
|
|
|
protected $internalId; |
151
|
|
|
|
152
|
|
|
/** |
153
|
|
|
* @Serializer\Expose() |
154
|
|
|
* @Serializer\Type("string") |
155
|
|
|
* |
156
|
|
|
* @var string |
157
|
|
|
*/ |
158
|
|
|
protected $comment; |
159
|
|
|
|
160
|
|
|
public function __construct() |
161
|
|
|
{ |
162
|
|
|
$this->rooms = []; |
163
|
|
|
} |
164
|
|
|
|
165
|
|
|
/** |
166
|
|
|
* @param string $code |
167
|
|
|
* |
168
|
|
|
* @return $this |
169
|
|
|
*/ |
170
|
|
|
public function setCode($code) |
171
|
|
|
{ |
172
|
|
|
$this->code = $code; |
173
|
|
|
|
174
|
|
|
return $this; |
175
|
|
|
} |
176
|
|
|
|
177
|
|
|
/** |
178
|
|
|
* @param $name |
179
|
|
|
* |
180
|
|
|
* @return $this |
181
|
|
|
*/ |
182
|
|
|
public function setName($name) |
183
|
|
|
{ |
184
|
|
|
$this->name = $name; |
185
|
|
|
|
186
|
|
|
return $this; |
187
|
|
|
} |
188
|
|
|
|
189
|
|
|
/** |
190
|
|
|
* @param float $price |
191
|
|
|
* |
192
|
|
|
* @return $this |
193
|
|
|
*/ |
194
|
|
|
public function setPrice($price) |
195
|
|
|
{ |
196
|
|
|
$this->price = $price; |
197
|
|
|
|
198
|
|
|
return $this; |
199
|
|
|
} |
200
|
|
|
|
201
|
|
|
/** |
202
|
|
|
* @param Currency $currency |
203
|
|
|
* |
204
|
|
|
* @return $this |
205
|
|
|
*/ |
206
|
|
|
public function setCurrency(Currency $currency) |
207
|
|
|
{ |
208
|
|
|
$this->currency = $currency; |
209
|
|
|
|
210
|
|
|
return $this; |
211
|
|
|
} |
212
|
|
|
|
213
|
|
|
/** |
214
|
|
|
* @param Customer $customer |
215
|
|
|
* |
216
|
|
|
* @return $this |
217
|
|
|
*/ |
218
|
|
|
public function setCustomer(Customer $customer) |
219
|
|
|
{ |
220
|
|
|
$this->customer = $customer; |
221
|
|
|
|
222
|
|
|
return $this; |
223
|
|
|
} |
224
|
|
|
|
225
|
|
|
/** |
226
|
|
|
* @param $ota |
227
|
|
|
* |
228
|
|
|
* @return $this |
229
|
|
|
*/ |
230
|
|
|
public function setOta($ota) |
231
|
|
|
{ |
232
|
|
|
$this->ota = $ota; |
233
|
|
|
|
234
|
|
|
return $this; |
235
|
|
|
} |
236
|
|
|
|
237
|
|
|
/** |
238
|
|
|
* @return string |
239
|
|
|
*/ |
240
|
|
|
public function getCode() |
241
|
|
|
{ |
242
|
|
|
return $this->code; |
243
|
|
|
} |
244
|
|
|
|
245
|
|
|
/** |
246
|
|
|
* @return string |
247
|
|
|
*/ |
248
|
|
|
public function getName() |
249
|
|
|
{ |
250
|
|
|
return $this->name; |
251
|
|
|
} |
252
|
|
|
|
253
|
|
|
/** |
254
|
|
|
* @return float |
255
|
|
|
*/ |
256
|
|
|
public function getPrice() |
257
|
|
|
{ |
258
|
|
|
return $this->price; |
259
|
|
|
} |
260
|
|
|
|
261
|
|
|
/** |
262
|
|
|
* @return Currency |
263
|
|
|
*/ |
264
|
|
|
public function getCurrency() |
265
|
|
|
{ |
266
|
|
|
return $this->currency; |
267
|
|
|
} |
268
|
|
|
|
269
|
|
|
/** |
270
|
|
|
* @return Customer |
271
|
|
|
*/ |
272
|
|
|
public function getCustomer() |
273
|
|
|
{ |
274
|
|
|
return $this->customer; |
275
|
|
|
} |
276
|
|
|
|
277
|
|
|
/** |
278
|
|
|
* @return string |
279
|
|
|
*/ |
280
|
|
|
public function getOta() |
281
|
|
|
{ |
282
|
|
|
return $this->ota; |
283
|
|
|
} |
284
|
|
|
|
285
|
|
|
/** |
286
|
|
|
* @return string |
287
|
|
|
*/ |
288
|
|
|
public function getStatus() |
289
|
|
|
{ |
290
|
|
|
return $this->status; |
291
|
|
|
} |
292
|
|
|
|
293
|
|
|
/** |
294
|
|
|
* @param string $status |
295
|
|
|
* |
296
|
|
|
* @return $this |
297
|
|
|
*/ |
298
|
|
|
public function setStatus($status) |
299
|
|
|
{ |
300
|
|
|
$this->status = $status; |
301
|
|
|
|
302
|
|
|
return $this; |
303
|
|
|
} |
304
|
|
|
|
305
|
|
|
/** |
306
|
|
|
* @return float |
307
|
|
|
*/ |
308
|
|
|
public function getTotalCancellationFee() |
309
|
|
|
{ |
310
|
|
|
return $this->totalCancellationFee; |
311
|
|
|
} |
312
|
|
|
|
313
|
|
|
/** |
314
|
|
|
* @param float $totalCancellationFee |
315
|
|
|
* |
316
|
|
|
* @return $this |
317
|
|
|
*/ |
318
|
|
|
public function setTotalCancellationFee($totalCancellationFee) |
319
|
|
|
{ |
320
|
|
|
$this->totalCancellationFee = $totalCancellationFee; |
321
|
|
|
|
322
|
|
|
return $this; |
323
|
|
|
} |
324
|
|
|
|
325
|
|
|
/** |
326
|
|
|
* @return Room[] |
327
|
|
|
*/ |
328
|
|
|
public function getRooms() |
329
|
|
|
{ |
330
|
|
|
return $this->rooms; |
331
|
|
|
} |
332
|
|
|
|
333
|
|
|
/** |
334
|
|
|
* @param array $rooms |
335
|
|
|
* |
336
|
|
|
* @return $this |
337
|
|
|
*/ |
338
|
|
|
public function setRooms($rooms) |
339
|
|
|
{ |
340
|
|
|
$this->rooms = $rooms; |
341
|
|
|
|
342
|
|
|
return $this; |
343
|
|
|
} |
344
|
|
|
|
345
|
|
|
/** |
346
|
|
|
* @return float |
347
|
|
|
*/ |
348
|
|
|
public function getAlreadyPaid() |
349
|
|
|
{ |
350
|
|
|
return $this->alreadyPaid; |
351
|
|
|
} |
352
|
|
|
|
353
|
|
|
/** |
354
|
|
|
* @param float $alreadyPaid |
355
|
|
|
* |
356
|
|
|
* @return $this |
357
|
|
|
*/ |
358
|
|
|
public function setAlreadyPaid($alreadyPaid) |
359
|
|
|
{ |
360
|
|
|
$this->alreadyPaid = $alreadyPaid; |
361
|
|
|
|
362
|
|
|
return $this; |
363
|
|
|
} |
364
|
|
|
|
365
|
|
|
public function getStartDate() |
366
|
|
|
{ |
367
|
|
|
return $this->rooms[0]->getStartDate(); |
368
|
|
|
} |
369
|
|
|
|
370
|
|
|
public function getEndDate() |
371
|
|
|
{ |
372
|
|
|
return $this->rooms[0]->getEndDate(); |
373
|
|
|
} |
374
|
|
|
|
375
|
|
|
/** |
376
|
|
|
* @return string |
377
|
|
|
*/ |
378
|
|
|
public function getHotelId() |
379
|
|
|
{ |
380
|
|
|
return $this->hotelId; |
381
|
|
|
} |
382
|
|
|
|
383
|
|
|
/** |
384
|
|
|
* @param string $hotelId |
385
|
|
|
* |
386
|
|
|
* @return $this |
387
|
|
|
*/ |
388
|
|
|
public function setHotelId($hotelId) |
389
|
|
|
{ |
390
|
|
|
$this->hotelId = $hotelId; |
391
|
|
|
|
392
|
|
|
return $this; |
393
|
|
|
} |
394
|
|
|
|
395
|
|
|
/** |
396
|
|
|
* @return \DateTime |
397
|
|
|
*/ |
398
|
|
|
public function getCreatedByOtaAt() |
399
|
|
|
{ |
400
|
|
|
return $this->createdByOtaAt; |
401
|
|
|
} |
402
|
|
|
|
403
|
|
|
/** |
404
|
|
|
* @param \DateTime $createdByOtaAt |
405
|
|
|
* |
406
|
|
|
* @return $this |
407
|
|
|
*/ |
408
|
|
|
public function setCreatedByOtaAt($createdByOtaAt) |
409
|
|
|
{ |
410
|
|
|
$this->createdByOtaAt = $createdByOtaAt; |
411
|
|
|
|
412
|
|
|
return $this; |
413
|
|
|
} |
414
|
|
|
|
415
|
|
|
/** |
416
|
|
|
* @return string |
417
|
|
|
*/ |
418
|
|
|
public function getInternalId() |
419
|
|
|
{ |
420
|
|
|
return $this->internalId; |
421
|
|
|
} |
422
|
|
|
|
423
|
|
|
/** |
424
|
|
|
* @param string $internalId |
425
|
|
|
* |
426
|
|
|
* @return $this |
427
|
|
|
*/ |
428
|
|
|
public function setInternalId($internalId) |
429
|
|
|
{ |
430
|
|
|
$this->internalId = $internalId; |
431
|
|
|
|
432
|
|
|
return $this; |
433
|
|
|
} |
434
|
|
|
|
435
|
|
|
/** |
436
|
|
|
* @return string |
437
|
|
|
*/ |
438
|
|
|
public function getArrivalTime() |
439
|
|
|
{ |
440
|
|
|
return $this->arrivalTime; |
441
|
|
|
} |
442
|
|
|
|
443
|
|
|
/** |
444
|
|
|
* @param string $arrivalTime |
445
|
|
|
* |
446
|
|
|
* @return $this |
447
|
|
|
*/ |
448
|
|
|
public function setArrivalTime($arrivalTime) |
449
|
|
|
{ |
450
|
|
|
$this->arrivalTime = $arrivalTime; |
451
|
|
|
|
452
|
|
|
return $this; |
453
|
|
|
} |
454
|
|
|
|
455
|
|
|
/** |
456
|
|
|
* @return string |
457
|
|
|
*/ |
458
|
|
|
public function getComment() |
459
|
|
|
{ |
460
|
|
|
return $this->comment; |
461
|
|
|
} |
462
|
|
|
|
463
|
|
|
/** |
464
|
|
|
* @param string $comment |
465
|
|
|
* |
466
|
|
|
* @return $this |
467
|
|
|
*/ |
468
|
|
|
public function setComment($comment) |
469
|
|
|
{ |
470
|
|
|
$this->comment = $comment; |
471
|
|
|
|
472
|
|
|
return $this; |
473
|
|
|
} |
474
|
|
|
} |
475
|
|
|
|