1
|
|
|
<?php |
2
|
|
|
|
3
|
|
|
declare(strict_types=1); |
4
|
|
|
|
5
|
|
|
namespace SergeyNezbritskiy\NovaPoshta\Models; |
6
|
|
|
|
7
|
|
|
use SergeyNezbritskiy\NovaPoshta\Connection; |
8
|
|
|
use SergeyNezbritskiy\NovaPoshta\ModelInterface; |
9
|
|
|
use SergeyNezbritskiy\NovaPoshta\NovaPoshtaApiException; |
10
|
|
|
|
11
|
|
|
class Common implements ModelInterface |
12
|
|
|
{ |
13
|
|
|
private const MODEL_NAME = 'Common'; |
14
|
|
|
private Connection $connection; |
15
|
|
|
|
16
|
|
|
/** |
17
|
|
|
* @param Connection $connection |
18
|
|
|
*/ |
19
|
|
|
public function __construct(Connection $connection) |
20
|
|
|
{ |
21
|
|
|
$this->connection = $connection; |
22
|
|
|
} |
23
|
|
|
|
24
|
|
|
/** |
25
|
|
|
* @see https://developers.novaposhta.ua/view/model/a55b2c64-8512-11ec-8ced-005056b2dbe1/method/a56d5c1c-8512-11ec-8ced-005056b2dbe1 |
26
|
|
|
* @param string $recipientCityRef |
27
|
|
|
* @param string|null $dateTime |
28
|
|
|
* @return array |
29
|
|
|
* @throws NovaPoshtaApiException |
30
|
|
|
*/ |
31
|
|
|
public function getTimeIntervals(string $recipientCityRef, string $dateTime = null): array |
32
|
|
|
{ |
33
|
|
|
$params = array_filter([ |
34
|
|
|
'RecipientCityRef' => $recipientCityRef, |
35
|
|
|
'DateTime' => $dateTime, |
36
|
|
|
]); |
37
|
|
|
return $this->connection->post(self::MODEL_NAME, 'getTimeIntervals', $params); |
38
|
|
|
} |
39
|
|
|
|
40
|
|
|
/** |
41
|
|
|
* @see https://developers.novaposhta.ua/view/model/a55b2c64-8512-11ec-8ced-005056b2dbe1/method/a5912a1e-8512-11ec-8ced-005056b2dbe1 |
42
|
|
|
* @return array |
43
|
|
|
* @throws NovaPoshtaApiException |
44
|
|
|
*/ |
45
|
|
|
public function getCargoTypes(): array |
46
|
|
|
{ |
47
|
|
|
return $this->connection->post(self::MODEL_NAME, 'getCargoTypes'); |
48
|
|
|
} |
49
|
|
|
|
50
|
|
|
/** |
51
|
|
|
* @see https://developers.novaposhta.ua/view/model/a55b2c64-8512-11ec-8ced-005056b2dbe1/method/a5b46873-8512-11ec-8ced-005056b2dbe1 |
52
|
|
|
* @return array |
53
|
|
|
* @throws NovaPoshtaApiException |
54
|
|
|
*/ |
55
|
|
|
public function getBackwardDeliveryCargoTypes(): array |
56
|
|
|
{ |
57
|
|
|
return $this->connection->post(self::MODEL_NAME, 'getBackwardDeliveryCargoTypes'); |
58
|
|
|
} |
59
|
|
|
|
60
|
|
|
/** |
61
|
|
|
* @see https://developers.novaposhta.ua/view/model/a55b2c64-8512-11ec-8ced-005056b2dbe1/method/a5dd575e-8512-11ec-8ced-005056b2dbe1 |
62
|
|
|
* @return array |
63
|
|
|
* @throws NovaPoshtaApiException |
64
|
|
|
*/ |
65
|
|
|
public function getPalletsList(): array |
66
|
|
|
{ |
67
|
|
|
return $this->connection->post(self::MODEL_NAME, 'getPalletsList'); |
68
|
|
|
} |
69
|
|
|
|
70
|
|
|
/** |
71
|
|
|
* @see https://developers.novaposhta.ua/view/model/a55b2c64-8512-11ec-8ced-005056b2dbe1/method/a6247f2f-8512-11ec-8ced-005056b2dbe1 |
72
|
|
|
* @return array |
73
|
|
|
* @throws NovaPoshtaApiException |
74
|
|
|
*/ |
75
|
|
|
public function getTypesOfPayersForRedelivery(): array |
76
|
|
|
{ |
77
|
|
|
return $this->connection->post(self::MODEL_NAME, 'getTypesOfPayersForRedelivery'); |
78
|
|
|
} |
79
|
|
|
|
80
|
|
|
/** |
81
|
|
|
* @see https://developers.novaposhta.ua/view/model/a55b2c64-8512-11ec-8ced-005056b2dbe1/method/a6492db4-8512-11ec-8ced-005056b2dbe1 |
82
|
|
|
* @return array |
83
|
|
|
* @throws NovaPoshtaApiException |
84
|
|
|
*/ |
85
|
|
|
public function getPackList(): array |
86
|
|
|
{ |
87
|
|
|
return $this->connection->post(self::MODEL_NAME, 'getPackList'); |
88
|
|
|
} |
89
|
|
|
|
90
|
|
|
/** |
91
|
|
|
* @see https://developers.novaposhta.ua/view/model/a55b2c64-8512-11ec-8ced-005056b2dbe1/method/a66fada0-8512-11ec-8ced-005056b2dbe1 |
92
|
|
|
* @return array |
93
|
|
|
* @throws NovaPoshtaApiException |
94
|
|
|
*/ |
95
|
|
|
public function getTiresWheelsList(): array |
96
|
|
|
{ |
97
|
|
|
return $this->connection->post(self::MODEL_NAME, 'getTiresWheelsList'); |
98
|
|
|
} |
99
|
|
|
|
100
|
|
|
/** |
101
|
|
|
* @see https://developers.novaposhta.ua/view/model/a55b2c64-8512-11ec-8ced-005056b2dbe1/method/a697db47-8512-11ec-8ced-005056b2dbe1 |
102
|
|
|
* @param string|null $findByString |
103
|
|
|
* @param int|null $page |
104
|
|
|
* @return array |
105
|
|
|
* @throws NovaPoshtaApiException |
106
|
|
|
*/ |
107
|
|
|
public function getCargoDescriptionList(string $findByString = null, int $page = null): array |
108
|
|
|
{ |
109
|
|
|
$params = array_filter([ |
110
|
|
|
'FindByString' => $findByString, |
111
|
|
|
'Page' => $page, |
112
|
|
|
]); |
113
|
|
|
return $this->connection->post(self::MODEL_NAME, 'getCargoDescriptionList', $params); |
114
|
|
|
} |
115
|
|
|
|
116
|
|
|
/** |
117
|
|
|
* @see https://developers.novaposhta.ua/view/model/a55b2c64-8512-11ec-8ced-005056b2dbe1/method/a697db47-8512-11ec-8ced-005056b2dbe1 |
118
|
|
|
* @return array |
119
|
|
|
* @throws NovaPoshtaApiException |
120
|
|
|
*/ |
121
|
|
|
public function getMessageCodeText(): array |
122
|
|
|
{ |
123
|
|
|
return $this->connection->post('CommonGeneral', 'getMessageCodeText'); |
124
|
|
|
} |
125
|
|
|
|
126
|
|
|
/** |
127
|
|
|
* @see https://developers.novaposhta.ua/view/model/a55b2c64-8512-11ec-8ced-005056b2dbe1/method/a6e189f7-8512-11ec-8ced-005056b2dbe1 |
128
|
|
|
* @return array |
129
|
|
|
* @throws NovaPoshtaApiException |
130
|
|
|
*/ |
131
|
|
|
public function getServiceTypes(): array |
132
|
|
|
{ |
133
|
|
|
return $this->connection->post(self::MODEL_NAME, 'getServiceTypes'); |
134
|
|
|
} |
135
|
|
|
|
136
|
|
|
/** |
137
|
|
|
* @see https://developers.novaposhta.ua/view/model/a55b2c64-8512-11ec-8ced-005056b2dbe1/method/a754ff0d-8512-11ec-8ced-005056b2dbe1 |
138
|
|
|
* @return array |
139
|
|
|
* @throws NovaPoshtaApiException |
140
|
|
|
*/ |
141
|
|
|
public function getOwnershipFormsList(): array |
142
|
|
|
{ |
143
|
|
|
return $this->connection->post(self::MODEL_NAME, 'getOwnershipFormsList'); |
144
|
|
|
} |
145
|
|
|
} |
146
|
|
|
|