1
|
|
|
<?php |
2
|
|
|
|
3
|
|
|
namespace Bookeo\Endpoints; |
4
|
|
|
|
5
|
|
|
use Bookeo\Client; |
6
|
|
|
use Bookeo\Interfaces\QueryInterface; |
7
|
|
|
use Bookeo\Models\Hold; |
8
|
|
|
use Bookeo\Models\HoldCreate; |
9
|
|
|
|
10
|
|
|
/** |
11
|
|
|
* Access account settings |
12
|
|
|
* |
13
|
|
|
* @package Bookeo\Endpoints |
14
|
|
|
*/ |
15
|
|
|
class Holds extends Client |
16
|
|
|
{ |
17
|
|
|
/** |
18
|
|
|
* Retrieve a hold previously generated |
19
|
|
|
* |
20
|
|
|
* @param string $hold_id |
21
|
|
|
* |
22
|
|
|
* @return $this |
23
|
|
|
*/ |
24
|
|
|
public function __invoke(string $hold_id) |
25
|
|
|
{ |
26
|
|
|
$this->hold_id = $hold_id; |
|
|
|
|
27
|
|
|
|
28
|
|
|
// Set HTTP params |
29
|
|
|
$this->type = 'get'; |
30
|
|
|
$this->endpoint = '/holds/' . $hold_id . '?' . $this->getQuery(); |
31
|
|
|
$this->response = Hold::class; |
|
|
|
|
32
|
|
|
|
33
|
|
|
return $this; |
34
|
|
|
} |
35
|
|
|
|
36
|
|
|
/** |
37
|
|
|
* Create a temporary hold to finalize the booking |
38
|
|
|
* |
39
|
|
|
* Performs a final check of the booking, and reserves required resources/seats to allow finalization of the booking process (ex. process payment). |
40
|
|
|
* The returned object also contains the updated price calculations. |
41
|
|
|
* Normally your application should have no more than one hold in place during a customer booking process. |
42
|
|
|
* Make sure to not leave many holds around. In any case, holds are deleted automatically after a fixed time from creation. |
43
|
|
|
* Note that when creating a hold, the customer field of the booking can be missing, in which case Bookeo will assume a default customer coming from the same country as the account. |
44
|
|
|
* The successful response also contains a "Location" HTTP header, which can be used to access the created resource in future invocations. |
45
|
|
|
* |
46
|
|
|
* @param \Bookeo\Models\HoldCreate $create |
47
|
|
|
* |
48
|
|
|
* @return \Bookeo\Interfaces\QueryInterface |
49
|
|
|
*/ |
50
|
|
|
public function create(HoldCreate $create): QueryInterface |
|
|
|
|
51
|
|
|
{ |
52
|
|
|
// Set HTTP params |
53
|
|
|
$this->type = 'post'; |
54
|
|
|
$this->endpoint = '/holds?' . $this->getQuery(); |
55
|
|
|
$this->response = Hold::class; |
|
|
|
|
56
|
|
|
|
57
|
|
|
return $this; |
58
|
|
|
} |
59
|
|
|
|
60
|
|
|
/** |
61
|
|
|
* Delete a temporary hold |
62
|
|
|
* |
63
|
|
|
* Delete a temporary hold previously created. |
64
|
|
|
* Note that you can also delete a hold when creating a new hold (ex. when the customer goes back in the booking process and selects a different time), or when creating a booking (i.e. when the customer checks out), without having to make a separate call to this endpoint. |
65
|
|
|
* |
66
|
|
|
* @return \Bookeo\Interfaces\QueryInterface |
67
|
|
|
*/ |
68
|
|
|
public function delete(): QueryInterface |
69
|
|
|
{ |
70
|
|
|
// Set HTTP params |
71
|
|
|
$this->type = 'delete'; |
72
|
|
|
$this->endpoint = '/holds/' . $this->hold_id . '?' . $this->getQuery(); |
|
|
|
|
73
|
|
|
|
74
|
|
|
return $this; |
75
|
|
|
} |
76
|
|
|
} |
77
|
|
|
|
Since your code implements the magic setter
_set
, this function will be called for any write access on an undefined variable. You can add the@property
annotation to your class or interface to document the existence of this variable.Since the property has write access only, you can use the @property-write annotation instead.
Of course, you may also just have mistyped another name, in which case you should fix the error.
See also the PhpDoc documentation for @property.