1
|
|
|
<?php |
2
|
|
|
/* |
3
|
|
|
* This file is part of the PayBreak/paybreak-sdk-php package. |
4
|
|
|
* |
5
|
|
|
* (c) PayBreak <[email protected]> |
6
|
|
|
* |
7
|
|
|
* For the full copyright and license information, please view the LICENSE |
8
|
|
|
* file that was distributed with this source code. |
9
|
|
|
*/ |
10
|
|
|
|
11
|
|
|
namespace PayBreak\Sdk\Gateways; |
12
|
|
|
|
13
|
|
|
use PayBreak\Sdk\Entities\InstallationEntity; |
14
|
|
|
use PayBreak\Sdk\SdkException; |
15
|
|
|
|
16
|
|
|
/** |
17
|
|
|
* Installation Gateway |
18
|
|
|
* |
19
|
|
|
* @author WN |
20
|
|
|
* @package PayBreak\Sdk\Gateways |
21
|
|
|
*/ |
22
|
|
|
class InstallationGateway extends AbstractGateway |
23
|
|
|
{ |
24
|
|
|
/** |
25
|
|
|
* @param string $id |
26
|
|
|
* @param string $token |
27
|
|
|
* @return InstallationEntity |
28
|
|
|
* @throws SdkException |
29
|
|
|
*/ |
30
|
3 |
|
public function getInstallation($id, $token) |
31
|
|
|
{ |
32
|
3 |
|
return InstallationEntity::make($this->fetchDocument('/v4/installations/' . $id, $token, 'Installation')); |
33
|
|
|
} |
34
|
|
|
|
35
|
|
|
/** |
36
|
|
|
* @author WN |
37
|
|
|
* @param $token |
38
|
|
|
* @return InstallationEntity[] |
39
|
|
|
* @throws SdkException |
40
|
|
|
*/ |
41
|
2 |
|
public function getInstallations($token) |
42
|
|
|
{ |
43
|
2 |
|
return $this->fetchCollection( |
44
|
2 |
|
$token, |
45
|
2 |
|
'/v4/installations', |
46
|
|
|
'\PayBreak\Sdk\Entities\InstallationEntity' |
47
|
2 |
|
); |
48
|
|
|
} |
49
|
|
|
|
50
|
|
|
/** |
51
|
|
|
* @author EB |
52
|
|
|
* @param $id |
53
|
|
|
* @param $body |
54
|
|
|
* @param $token |
55
|
|
|
* @return mixed |
56
|
|
|
*/ |
57
|
|
|
public function patchInstallation($id, $body, $token) |
58
|
|
|
{ |
59
|
|
|
return $this->patchDocument('/v4/installations/' . $id, $token, 'updateInstallation', $body); |
60
|
|
|
} |
61
|
|
|
|
62
|
|
|
/** |
63
|
|
|
* @author EB |
64
|
|
|
* @param string $extId |
65
|
|
|
* @param string $token |
66
|
|
|
* @return array |
67
|
|
|
*/ |
68
|
1 |
|
public function getProductGroups($extId, $token) |
69
|
|
|
{ |
70
|
1 |
|
return $this->fetchDocument('/v4/installations/' . $extId . '/product-groups/', $token, 'listProductGroups'); |
71
|
|
|
} |
72
|
|
|
|
73
|
|
|
/** |
74
|
|
|
* @author EB |
75
|
|
|
* @param string $extId |
76
|
|
|
* @param string $token |
77
|
|
|
* @param string $productGroup |
78
|
|
|
* @return array |
79
|
|
|
*/ |
80
|
1 |
|
public function listProducts($extId, $token, $productGroup) |
81
|
|
|
{ |
82
|
1 |
|
return $this->fetchDocument( |
83
|
1 |
|
'/v4/installations/' . $extId . '/product-groups/' . $productGroup . '/products', |
84
|
1 |
|
$token, |
85
|
|
|
'listProducts' |
86
|
1 |
|
); |
87
|
|
|
} |
88
|
|
|
} |
89
|
|
|
|