1
|
|
|
<?php |
2
|
|
|
|
3
|
|
|
namespace DJStarCOM\BookingComSDK\Query; |
4
|
|
|
|
5
|
|
|
use DJStarCOM\BookingComSDK\Models\BookingDetails; |
6
|
|
|
|
7
|
|
|
/** |
8
|
|
|
* Class BookingDetailsQuery |
9
|
|
|
* @package DJStarCOM\BookingComSDK\Query |
10
|
|
|
*/ |
11
|
|
|
class BookingDetailsQuery extends Query |
12
|
|
|
{ |
13
|
|
|
public const EXTRAS_CANCELLATION_INFO = 'cancellation_info'; |
14
|
|
|
public const EXTRAS_NO_SHOW = 'no_show'; |
15
|
|
|
public const EXTRAS_KEY_COLLECTION_INFO = 'key_collection_info'; |
16
|
|
|
public const EXTRAS_TOTAL_ROOM_NIGHTS = 'total_room_nights'; |
17
|
|
|
public const EXTRAS_HOTEL_PAGE_URL = 'hotel_page_url'; |
18
|
|
|
|
19
|
|
|
public const OPTIONS_USE_BOOKER_COUNTRY = 'use_booker_country'; |
20
|
|
|
public const OPTIONS_FRONT_DESK_24H = 'front_desk_24h'; |
21
|
|
|
public const OPTIONS_BOOKER_MAILINGLIST_SIGNUP = 'booker_mailinglist_signup'; |
22
|
|
|
public const OPTIONS_USE_GUEST_QUANTITIES_FOR_CHARGES = 'use_guest_quantities_for_charges'; |
23
|
|
|
public const OPTIONS_ALLOW_PAST = 'allow_past'; |
24
|
|
|
|
25
|
|
|
/** |
26
|
|
|
* This endpoint only supports POST http request method. |
27
|
|
|
* |
28
|
|
|
* @var string |
29
|
|
|
*/ |
30
|
|
|
protected static $uri = '/bookingDetails'; |
31
|
|
|
|
32
|
|
|
/** |
33
|
|
|
* Booking with guest checked in from this date. |
34
|
|
|
* |
35
|
|
|
* @var string |
36
|
|
|
*/ |
37
|
|
|
protected $checkin_from; |
38
|
|
|
|
39
|
|
|
/** |
40
|
|
|
* Booking with guest checked in until this date. |
41
|
|
|
* |
42
|
|
|
* @var string |
43
|
|
|
*/ |
44
|
|
|
protected $checkin_until; |
45
|
|
|
|
46
|
|
|
/** |
47
|
|
|
* Booking with guest checked out from this date. |
48
|
|
|
* |
49
|
|
|
* @var string |
50
|
|
|
*/ |
51
|
|
|
protected $checkout_from; |
52
|
|
|
|
53
|
|
|
/** |
54
|
|
|
* Booking with guest checked out until this date. |
55
|
|
|
* |
56
|
|
|
* @var string |
57
|
|
|
*/ |
58
|
|
|
protected $checkout_until; |
59
|
|
|
|
60
|
|
|
/** |
61
|
|
|
* Starting date to search bookings by creation timestamp. |
62
|
|
|
* |
63
|
|
|
* @var |
64
|
|
|
*/ |
65
|
|
|
protected $created_from; |
66
|
|
|
|
67
|
|
|
/** |
68
|
|
|
* Ending date to search bookings by creation timestamp. |
69
|
|
|
* |
70
|
|
|
* @var |
71
|
|
|
*/ |
72
|
|
|
protected $created_until; |
73
|
|
|
|
74
|
|
|
/** |
75
|
|
|
* Specify here what extra items of the result should be included. |
76
|
|
|
* See the endpoint description for more detailed information about each extra |
77
|
|
|
* |
78
|
|
|
* Possible values: |
79
|
|
|
* - cancellation_info |
80
|
|
|
* - no_show |
81
|
|
|
* - key_collection_info |
82
|
|
|
* - total_room_nights |
83
|
|
|
* - hotel_page_url |
84
|
|
|
* |
85
|
|
|
* @var array |
86
|
|
|
*/ |
87
|
|
|
protected $extras; |
88
|
|
|
|
89
|
|
|
/** |
90
|
|
|
* Limit the results to all data that has been changed since this date. |
91
|
|
|
* |
92
|
|
|
* @var string |
93
|
|
|
*/ |
94
|
|
|
protected $last_change; |
95
|
|
|
|
96
|
|
|
/** |
97
|
|
|
* The local fee currency code. |
98
|
|
|
* |
99
|
|
|
* @var string |
100
|
|
|
*/ |
101
|
|
|
protected $local_fee_currency; |
102
|
|
|
|
103
|
|
|
/** |
104
|
|
|
* Where in the resulting list to start. |
105
|
|
|
* |
106
|
|
|
* @var integer |
107
|
|
|
*/ |
108
|
|
|
protected $offset; |
109
|
|
|
|
110
|
|
|
/** |
111
|
|
|
* Specify here the options for this request. |
112
|
|
|
* See the endpoint description for more detailed information about each option. |
113
|
|
|
* |
114
|
|
|
* @var array |
115
|
|
|
*/ |
116
|
|
|
protected $options; |
117
|
|
|
|
118
|
|
|
/** |
119
|
|
|
* Id of a booking to show. |
120
|
|
|
* |
121
|
|
|
* @var integer |
122
|
|
|
*/ |
123
|
|
|
protected $reservation_id; |
124
|
|
|
|
125
|
|
|
/** |
126
|
|
|
* The maximum number of entries to return. |
127
|
|
|
* This can be used together with {offset} to get the data in parts. |
128
|
|
|
* |
129
|
|
|
* @var int |
130
|
|
|
*/ |
131
|
|
|
protected $rows; |
132
|
|
|
|
133
|
|
|
/** |
134
|
|
|
* Limit the results to all data that has the stay intent greater than this score. |
135
|
|
|
* |
136
|
|
|
* @var float|null |
137
|
|
|
*/ |
138
|
|
|
protected $stay_probability_from; |
139
|
|
|
|
140
|
|
|
/** |
141
|
|
|
*Limit the results to all data that has the stay intent less than this score. |
142
|
|
|
* |
143
|
|
|
* @var float|null |
144
|
|
|
*/ |
145
|
|
|
protected $stay_probability_to; |
146
|
|
|
|
147
|
|
|
/** |
148
|
|
|
* @return bool |
149
|
|
|
*/ |
150
|
|
|
public function isSecure(): bool |
151
|
|
|
{ |
152
|
|
|
return true; |
153
|
|
|
} |
154
|
|
|
|
155
|
|
|
/** |
156
|
|
|
* @return string |
157
|
|
|
*/ |
158
|
|
|
public function getCheckinFrom(): string |
159
|
|
|
{ |
160
|
|
|
return $this->checkin_from; |
161
|
|
|
} |
162
|
|
|
|
163
|
|
|
/** |
164
|
|
|
* @param string $checkin_from |
165
|
|
|
* @return $this |
166
|
|
|
*/ |
167
|
|
|
public function setCheckinFrom($checkin_from): self |
168
|
|
|
{ |
169
|
|
|
$this->checkin_from = $checkin_from; |
170
|
|
|
|
171
|
|
|
return $this; |
172
|
|
|
} |
173
|
|
|
|
174
|
|
|
/** |
175
|
|
|
* @return string |
176
|
|
|
*/ |
177
|
|
|
public function getCheckinUntil(): string |
178
|
|
|
{ |
179
|
|
|
return $this->checkin_until; |
180
|
|
|
} |
181
|
|
|
|
182
|
|
|
/** |
183
|
|
|
* @param string $checkin_until |
184
|
|
|
* @return $this |
185
|
|
|
*/ |
186
|
|
|
public function setCheckinUntil($checkin_until): self |
187
|
|
|
{ |
188
|
|
|
$this->checkin_until = $checkin_until; |
189
|
|
|
|
190
|
|
|
return $this; |
191
|
|
|
} |
192
|
|
|
|
193
|
|
|
/** |
194
|
|
|
* @return string |
195
|
|
|
*/ |
196
|
|
|
public function getCheckoutFrom(): string |
197
|
|
|
{ |
198
|
|
|
return $this->checkout_from; |
199
|
|
|
} |
200
|
|
|
|
201
|
|
|
/** |
202
|
|
|
* @param string $checkout_from |
203
|
|
|
* @return $this |
204
|
|
|
*/ |
205
|
|
|
public function setCheckoutFrom($checkout_from): self |
206
|
|
|
{ |
207
|
|
|
$this->checkout_from = $checkout_from; |
208
|
|
|
|
209
|
|
|
return $this; |
210
|
|
|
} |
211
|
|
|
|
212
|
|
|
/** |
213
|
|
|
* @return string |
214
|
|
|
*/ |
215
|
|
|
public function getCheckoutUntil(): string |
216
|
|
|
{ |
217
|
|
|
return $this->checkout_until; |
218
|
|
|
} |
219
|
|
|
|
220
|
|
|
/** |
221
|
|
|
* @param string $checkout_until |
222
|
|
|
* @return $this |
223
|
|
|
*/ |
224
|
|
|
public function setCheckoutUntil($checkout_until): self |
225
|
|
|
{ |
226
|
|
|
$this->checkout_until = $checkout_until; |
227
|
|
|
|
228
|
|
|
return $this; |
229
|
|
|
} |
230
|
|
|
|
231
|
|
|
/** |
232
|
|
|
* @return string |
233
|
|
|
*/ |
234
|
|
|
public function getCreatedFrom(): string |
235
|
|
|
{ |
236
|
|
|
return $this->created_from; |
237
|
|
|
} |
238
|
|
|
|
239
|
|
|
/** |
240
|
|
|
* @param mixed $created_from |
241
|
|
|
* @return $this |
242
|
|
|
*/ |
243
|
|
|
public function setCreatedFrom($created_from): self |
244
|
|
|
{ |
245
|
|
|
$this->created_from = $created_from; |
246
|
|
|
|
247
|
|
|
return $this; |
248
|
|
|
} |
249
|
|
|
|
250
|
|
|
/** |
251
|
|
|
* @return string |
252
|
|
|
*/ |
253
|
|
|
public function getCreatedUntil(): string |
254
|
|
|
{ |
255
|
|
|
return $this->created_until; |
256
|
|
|
} |
257
|
|
|
|
258
|
|
|
/** |
259
|
|
|
* @param mixed $created_until |
260
|
|
|
* @return $this |
261
|
|
|
*/ |
262
|
|
|
public function setCreatedUntil($created_until): self |
263
|
|
|
{ |
264
|
|
|
$this->created_until = $created_until; |
265
|
|
|
|
266
|
|
|
return $this; |
267
|
|
|
} |
268
|
|
|
|
269
|
|
|
/** |
270
|
|
|
* @return int |
271
|
|
|
*/ |
272
|
|
|
public function getReservationId(): int |
273
|
|
|
{ |
274
|
|
|
return $this->reservation_id; |
275
|
|
|
} |
276
|
|
|
|
277
|
|
|
/** |
278
|
|
|
* @param int $reservation_id |
279
|
|
|
* @return $this |
280
|
|
|
*/ |
281
|
|
|
public function setReservationId($reservation_id): self |
282
|
|
|
{ |
283
|
|
|
$this->reservation_id = $reservation_id; |
284
|
|
|
|
285
|
|
|
return $this; |
286
|
|
|
} |
287
|
|
|
|
288
|
|
|
/** |
289
|
|
|
* @return string |
290
|
|
|
*/ |
291
|
|
|
public function getLastChange(): string |
292
|
|
|
{ |
293
|
|
|
return $this->last_change; |
294
|
|
|
} |
295
|
|
|
|
296
|
|
|
/** |
297
|
|
|
* @param string $last_change |
298
|
|
|
* @return $this |
299
|
|
|
*/ |
300
|
|
|
public function setLastChange($last_change): self |
301
|
|
|
{ |
302
|
|
|
$this->last_change = $last_change; |
303
|
|
|
|
304
|
|
|
return $this; |
305
|
|
|
} |
306
|
|
|
|
307
|
|
|
/** |
308
|
|
|
* @return string |
309
|
|
|
*/ |
310
|
|
|
public function getLocalFeeCurrency(): string |
311
|
|
|
{ |
312
|
|
|
return $this->local_fee_currency; |
313
|
|
|
} |
314
|
|
|
|
315
|
|
|
/** |
316
|
|
|
* @param string $local_fee_currency |
317
|
|
|
* @return $this |
318
|
|
|
*/ |
319
|
|
|
public function setLocalFeeCurrency($local_fee_currency): self |
320
|
|
|
{ |
321
|
|
|
$this->local_fee_currency = $local_fee_currency; |
322
|
|
|
|
323
|
|
|
return $this; |
324
|
|
|
} |
325
|
|
|
|
326
|
|
|
/** |
327
|
|
|
* @return int |
328
|
|
|
*/ |
329
|
|
|
public function getOffset(): ?int |
330
|
|
|
{ |
331
|
|
|
return $this->offset; |
332
|
|
|
} |
333
|
|
|
|
334
|
|
|
/** |
335
|
|
|
* @param int $offset |
336
|
|
|
* @return $this |
337
|
|
|
*/ |
338
|
|
|
public function setOffset($offset): self |
339
|
|
|
{ |
340
|
|
|
$this->offset = $offset; |
341
|
|
|
|
342
|
|
|
return $this; |
343
|
|
|
} |
344
|
|
|
|
345
|
|
|
/** |
346
|
|
|
* @return int |
347
|
|
|
*/ |
348
|
|
|
public function getRows(): ?int |
349
|
|
|
{ |
350
|
|
|
return $this->rows; |
351
|
|
|
} |
352
|
|
|
|
353
|
|
|
/** |
354
|
|
|
* @param int $rows |
355
|
|
|
* @return BookingDetailsQuery |
356
|
|
|
*/ |
357
|
|
|
public function setRows($rows): self |
358
|
|
|
{ |
359
|
|
|
$this->rows = $rows; |
360
|
|
|
|
361
|
|
|
return $this; |
362
|
|
|
} |
363
|
|
|
|
364
|
|
|
/** |
365
|
|
|
* @return array|null |
366
|
|
|
*/ |
367
|
|
|
public function getExtras(): ?array |
368
|
|
|
{ |
369
|
|
|
return $this->extras; |
370
|
|
|
} |
371
|
|
|
|
372
|
|
|
/** |
373
|
|
|
* @param array $extras |
374
|
|
|
* @return self |
375
|
|
|
*/ |
376
|
|
|
public function setExtras(array $extras): self |
377
|
|
|
{ |
378
|
|
|
$this->extras = $extras; |
379
|
|
|
|
380
|
|
|
return $this; |
381
|
|
|
} |
382
|
|
|
|
383
|
|
|
/** |
384
|
|
|
* @return BookingDetailsQuery |
385
|
|
|
*/ |
386
|
|
|
public function withExtras(): self |
387
|
|
|
{ |
388
|
|
|
$this->extras = [ |
389
|
|
|
self::EXTRAS_CANCELLATION_INFO, |
390
|
|
|
self::EXTRAS_NO_SHOW, |
391
|
|
|
self::EXTRAS_KEY_COLLECTION_INFO, |
392
|
|
|
self::EXTRAS_TOTAL_ROOM_NIGHTS, |
393
|
|
|
self::EXTRAS_HOTEL_PAGE_URL, |
394
|
|
|
]; |
395
|
|
|
|
396
|
|
|
return $this; |
397
|
|
|
} |
398
|
|
|
|
399
|
|
|
/** |
400
|
|
|
* @return array|null |
401
|
|
|
*/ |
402
|
|
|
public function getOptions(): ?array |
403
|
|
|
{ |
404
|
|
|
return $this->options; |
405
|
|
|
} |
406
|
|
|
|
407
|
|
|
/** |
408
|
|
|
* @param array $options |
409
|
|
|
* @return self |
410
|
|
|
*/ |
411
|
|
|
public function setOptions(array $options): self |
412
|
|
|
{ |
413
|
|
|
$this->options = $options; |
414
|
|
|
|
415
|
|
|
return $this; |
416
|
|
|
} |
417
|
|
|
|
418
|
|
|
/** |
419
|
|
|
* @return BookingDetailsQuery |
420
|
|
|
*/ |
421
|
|
|
public function withOptions(): self |
422
|
|
|
{ |
423
|
|
|
$this->options = [ |
424
|
|
|
self::OPTIONS_USE_BOOKER_COUNTRY, |
425
|
|
|
self::OPTIONS_FRONT_DESK_24H, |
426
|
|
|
self::OPTIONS_BOOKER_MAILINGLIST_SIGNUP, |
427
|
|
|
self::OPTIONS_USE_GUEST_QUANTITIES_FOR_CHARGES, |
428
|
|
|
self::OPTIONS_ALLOW_PAST, |
429
|
|
|
]; |
430
|
|
|
|
431
|
|
|
return $this; |
432
|
|
|
} |
433
|
|
|
|
434
|
|
|
/** |
435
|
|
|
* @param mixed $stay_probability_from |
436
|
|
|
* @return $this |
437
|
|
|
*/ |
438
|
|
|
public function setStayProbabilityFrom($stay_probability_from): self |
439
|
|
|
{ |
440
|
|
|
$this->stay_probability_from = $stay_probability_from; |
441
|
|
|
|
442
|
|
|
return $this; |
443
|
|
|
} |
444
|
|
|
|
445
|
|
|
/** |
446
|
|
|
* @param mixed $stay_probability_to |
447
|
|
|
* @return $this |
448
|
|
|
*/ |
449
|
|
|
public function setStayProbabilityTo($stay_probability_to): self |
450
|
|
|
{ |
451
|
|
|
$this->stay_probability_to = $stay_probability_to; |
452
|
|
|
|
453
|
|
|
return $this; |
454
|
|
|
} |
455
|
|
|
|
456
|
|
|
/** |
457
|
|
|
* @return array |
458
|
|
|
*/ |
459
|
|
|
protected function getAttributeMap(): array |
460
|
|
|
{ |
461
|
|
|
return [ |
462
|
|
|
'checkin_from' => 'string', |
463
|
|
|
'checkin_until' => 'string', |
464
|
|
|
'checkout_from' => 'string', |
465
|
|
|
'checkout_until' => 'string', |
466
|
|
|
'created_from' => 'string', |
467
|
|
|
'created_until' => 'string', |
468
|
|
|
'extras' => 'array', |
469
|
|
|
'last_change' => 'string', |
470
|
|
|
'local_fee_currency' => 'string', |
471
|
|
|
'offset' => 'integer', |
472
|
|
|
'options' => 'array', |
473
|
|
|
'reservation_id' => 'integer', |
474
|
|
|
'rows' => 'integer', |
475
|
|
|
'stay_probability_from' => 'string', |
476
|
|
|
'stay_probability_to' => 'string', |
477
|
|
|
]; |
478
|
|
|
} |
479
|
|
|
|
480
|
|
|
/** |
481
|
|
|
* @return string |
482
|
|
|
*/ |
483
|
|
|
protected function getRequestMethod(): string |
484
|
|
|
{ |
485
|
|
|
return self::REQUEST_METHOD_POST; |
486
|
|
|
} |
487
|
|
|
|
488
|
|
|
/** |
489
|
|
|
* {@inheritDoc} |
490
|
|
|
*/ |
491
|
|
|
protected function model(): string |
492
|
|
|
{ |
493
|
|
|
return BookingDetails::class; |
494
|
|
|
} |
495
|
|
|
} |
496
|
|
|
|