1
|
|
|
<?php |
2
|
|
|
|
3
|
|
|
namespace Daaner\NovaPoshta\Models; |
4
|
|
|
|
5
|
|
|
use Carbon\Carbon; |
6
|
|
|
use Daaner\NovaPoshta\NovaPoshta; |
7
|
|
|
use Daaner\NovaPoshta\Traits\CommonFilter; |
8
|
|
|
use Daaner\NovaPoshta\Traits\DateTimes; |
9
|
|
|
use Daaner\NovaPoshta\Traits\Limit; |
10
|
|
|
|
11
|
|
|
class Common extends NovaPoshta |
12
|
|
|
{ |
13
|
|
|
use Limit, CommonFilter, DateTimes; |
14
|
|
|
|
15
|
|
|
protected $model = 'Common'; |
16
|
|
|
protected $calledMethod; |
17
|
|
|
protected $methodProperties = null; |
18
|
|
|
|
19
|
|
|
/** |
20
|
|
|
* Справочник форм собственности. |
21
|
|
|
* |
22
|
|
|
* @see https://developers.novaposhta.ua/view/model/a55b2c64-8512-11ec-8ced-005056b2dbe1/method/a754ff0d-8512-11ec-8ced-005056b2dbe1 Справочник форм собственности |
23
|
|
|
* |
24
|
|
|
* @return array |
25
|
|
|
*/ |
26
|
|
|
public function getOwnershipFormsList(): array |
27
|
|
|
{ |
28
|
|
|
$this->calledMethod = 'getOwnershipFormsList'; |
29
|
|
|
|
30
|
|
|
return $this->getResponse($this->model, $this->calledMethod, $this->methodProperties); |
31
|
|
|
} |
32
|
|
|
|
33
|
|
|
/** |
34
|
|
|
* Получение справочника формы оплаты. |
35
|
|
|
* |
36
|
|
|
* @deprecated НЕ ДОКУМЕНТИРОВАНО |
37
|
|
|
* |
38
|
|
|
* @return array |
39
|
|
|
*/ |
40
|
|
|
public function getPaymentForms(): array |
41
|
|
|
{ |
42
|
|
|
$this->calledMethod = 'getPaymentForms'; |
43
|
|
|
|
44
|
|
|
return $this->getResponse($this->model, $this->calledMethod, $this->methodProperties); |
45
|
|
|
} |
46
|
|
|
|
47
|
|
|
/** |
48
|
|
|
* Получение справочника типов контрагентов. |
49
|
|
|
* |
50
|
|
|
* @deprecated НЕ ДОКУМЕНТИРОВАНО |
51
|
|
|
* |
52
|
|
|
* @return array |
53
|
|
|
*/ |
54
|
|
|
public function getTypesOfCounterparties(): array |
55
|
|
|
{ |
56
|
|
|
$this->calledMethod = 'getTypesOfCounterparties'; |
57
|
|
|
|
58
|
|
|
return $this->getResponse($this->model, $this->calledMethod, $this->methodProperties); |
59
|
|
|
} |
60
|
|
|
|
61
|
|
|
/** |
62
|
|
|
* Получение справочника технологий доставки. |
63
|
|
|
* |
64
|
|
|
* @see https://developers.novaposhta.ua/view/model/a55b2c64-8512-11ec-8ced-005056b2dbe1/method/a6e189f7-8512-11ec-8ced-005056b2dbe1 Получение справочника технологий доставки |
65
|
|
|
* |
66
|
|
|
* @return array |
67
|
|
|
*/ |
68
|
|
|
public function getServiceTypes(): array |
69
|
|
|
{ |
70
|
|
|
$this->calledMethod = 'getServiceTypes'; |
71
|
|
|
|
72
|
|
|
return $this->getResponse($this->model, $this->calledMethod, $this->methodProperties); |
73
|
|
|
} |
74
|
|
|
|
75
|
|
|
/** |
76
|
|
|
* Получение справочника описаний груза. |
77
|
|
|
* |
78
|
|
|
* @see https://developers.novaposhta.ua/view/model/a55b2c64-8512-11ec-8ced-005056b2dbe1/method/a697db47-8512-11ec-8ced-005056b2dbe1 Получение справочника описаний груза |
79
|
|
|
* |
80
|
|
|
* @param string|null $find Запрос поиска |
81
|
|
|
* @return array |
82
|
|
|
*/ |
83
|
|
|
public function getCargoDescriptionList(?string $find = null): array |
84
|
|
|
{ |
85
|
|
|
$this->calledMethod = 'getCargoDescriptionList'; |
86
|
|
|
$this->getPage(); |
87
|
|
|
|
88
|
|
|
if ($find) { |
89
|
|
|
$this->methodProperties['FindByString'] = $find; |
90
|
|
|
} |
91
|
|
|
|
92
|
|
|
return $this->getResponse($this->model, $this->calledMethod, $this->methodProperties); |
93
|
|
|
} |
94
|
|
|
|
95
|
|
|
/** |
96
|
|
|
* Получение справочника видов шин и дисков. |
97
|
|
|
* |
98
|
|
|
* @see https://developers.novaposhta.ua/view/model/a55b2c64-8512-11ec-8ced-005056b2dbe1/method/a66fada0-8512-11ec-8ced-005056b2dbe1 Получение справочника видов шин и дисков |
99
|
|
|
* |
100
|
|
|
* @return array |
101
|
|
|
*/ |
102
|
|
|
public function getTiresWheelsList(): array |
103
|
|
|
{ |
104
|
|
|
$this->calledMethod = 'getTiresWheelsList'; |
105
|
|
|
|
106
|
|
|
return $this->getResponse($this->model, $this->calledMethod, $this->methodProperties); |
107
|
|
|
} |
108
|
|
|
|
109
|
|
|
/** |
110
|
|
|
* Получение справочника видов упаковки. |
111
|
|
|
* |
112
|
|
|
* @see https://developers.novaposhta.ua/view/model/a55b2c64-8512-11ec-8ced-005056b2dbe1/method/a6492db4-8512-11ec-8ced-005056b2dbe1 Получение справочника видов упаковки |
113
|
|
|
* |
114
|
|
|
* @return array |
115
|
|
|
*/ |
116
|
|
|
public function getPackList(): array |
117
|
|
|
{ |
118
|
|
|
$this->calledMethod = 'getPackList'; |
119
|
|
|
|
120
|
|
|
$this->getLength(); |
121
|
|
|
$this->getWidth(); |
122
|
|
|
$this->getHeight(); |
123
|
|
|
$this->getVolumetricWeight(); |
124
|
|
|
|
125
|
|
|
return $this->getResponse($this->model, $this->calledMethod, $this->methodProperties); |
126
|
|
|
} |
127
|
|
|
|
128
|
|
|
/** |
129
|
|
|
* Получение справочника видов плательщиков обратной доставки. |
130
|
|
|
* |
131
|
|
|
* @see https://developers.novaposhta.ua/view/model/a55b2c64-8512-11ec-8ced-005056b2dbe1/method/a6247f2f-8512-11ec-8ced-005056b2dbe1 Получение справочника видов плательщиков обратной доставки |
132
|
|
|
* |
133
|
|
|
* @return array |
134
|
|
|
*/ |
135
|
|
|
public function getTypesOfPayersForRedelivery(): array |
136
|
|
|
{ |
137
|
|
|
$this->calledMethod = 'getTypesOfPayersForRedelivery'; |
138
|
|
|
|
139
|
|
|
return $this->getResponse($this->model, $this->calledMethod, $this->methodProperties); |
140
|
|
|
} |
141
|
|
|
|
142
|
|
|
/** |
143
|
|
|
* Получение справочника видов плательщиков доставки. |
144
|
|
|
* |
145
|
|
|
* @see https://developers.novaposhta.ua/view/model/a55b2c64-8512-11ec-8ced-005056b2dbe1/method/a6247f2f-8512-11ec-8ced-005056b2dbe1 Получение справочника видов плательщиков доставки |
146
|
|
|
* |
147
|
|
|
* @return array |
148
|
|
|
*/ |
149
|
|
|
public function getTypesOfPayers(): array |
150
|
|
|
{ |
151
|
|
|
$this->calledMethod = 'getTypesOfPayers'; |
152
|
|
|
|
153
|
|
|
return $this->getResponse($this->model, $this->calledMethod, $this->methodProperties); |
154
|
|
|
} |
155
|
|
|
|
156
|
|
|
/** |
157
|
|
|
* Получение справочника видов паллет. |
158
|
|
|
* |
159
|
|
|
* @see https://developers.novaposhta.ua/view/model/a55b2c64-8512-11ec-8ced-005056b2dbe1/method/a5dd575e-8512-11ec-8ced-005056b2dbe1 Получение справочника видов паллет |
160
|
|
|
* |
161
|
|
|
* @return array |
162
|
|
|
*/ |
163
|
|
|
public function getPalletsList(): array |
164
|
|
|
{ |
165
|
|
|
$this->calledMethod = 'getPalletsList'; |
166
|
|
|
|
167
|
|
|
return $this->getResponse($this->model, $this->calledMethod, $this->methodProperties); |
168
|
|
|
} |
169
|
|
|
|
170
|
|
|
/** |
171
|
|
|
* Получение справочника видов обратной доставки груза. |
172
|
|
|
* |
173
|
|
|
* @see https://developers.novaposhta.ua/view/model/a55b2c64-8512-11ec-8ced-005056b2dbe1/method/a5b46873-8512-11ec-8ced-005056b2dbe1 Получение справочника видов обратной доставки груза |
174
|
|
|
* |
175
|
|
|
* @return array |
176
|
|
|
*/ |
177
|
|
|
public function getBackwardDeliveryCargoTypes(): array |
178
|
|
|
{ |
179
|
|
|
$this->calledMethod = 'getBackwardDeliveryCargoTypes'; |
180
|
|
|
|
181
|
|
|
return $this->getResponse($this->model, $this->calledMethod, $this->methodProperties); |
182
|
|
|
} |
183
|
|
|
|
184
|
|
|
/** |
185
|
|
|
* Получение справочника видов груза. |
186
|
|
|
* |
187
|
|
|
* @see https://developers.novaposhta.ua/view/model/a55b2c64-8512-11ec-8ced-005056b2dbe1/method/a5912a1e-8512-11ec-8ced-005056b2dbe1 Получение справочника видов груза |
188
|
|
|
* |
189
|
|
|
* @return array |
190
|
|
|
*/ |
191
|
|
|
public function getCargoTypes(): array |
192
|
|
|
{ |
193
|
|
|
$this->calledMethod = 'getCargoTypes'; |
194
|
|
|
|
195
|
|
|
return $this->getResponse($this->model, $this->calledMethod, $this->methodProperties); |
196
|
|
|
} |
197
|
|
|
|
198
|
|
|
/** |
199
|
|
|
* Получение справочника видов временных интервалов. |
200
|
|
|
* |
201
|
|
|
* @see https://developers.novaposhta.ua/view/model/a55b2c64-8512-11ec-8ced-005056b2dbe1/method/a56d5c1c-8512-11ec-8ced-005056b2dbe1 Получение справочника видов временных интервалов |
202
|
|
|
* |
203
|
|
|
* @param string $recipientCityRef Ref города |
204
|
|
|
* @param string|Carbon|null $dateTime Дата интервалов |
205
|
|
|
* @return array |
206
|
|
|
*/ |
207
|
|
|
public function getTimeIntervals(string $recipientCityRef, $dateTime = null): array |
208
|
|
|
{ |
209
|
|
|
$this->calledMethod = 'getTimeIntervals'; |
210
|
|
|
|
211
|
|
|
$this->methodProperties['RecipientCityRef'] = $recipientCityRef; |
212
|
|
|
|
213
|
|
|
if ($dateTime && $newDate = $this->checkDate($dateTime)) { |
214
|
|
|
$this->methodProperties['DateTime'] = $newDate; |
215
|
|
|
} |
216
|
|
|
|
217
|
|
|
return $this->getResponse($this->model, $this->calledMethod, $this->methodProperties, false); |
218
|
|
|
} |
219
|
|
|
|
220
|
|
|
/** |
221
|
|
|
* Получение данных о персональном менеджере. |
222
|
|
|
* @since 2022-11-05 |
223
|
|
|
* |
224
|
|
|
* @param string $Ref Ref контрагента |
225
|
|
|
* @return array |
226
|
|
|
*/ |
227
|
|
|
public function getPersonalManager(string $Ref): array |
228
|
|
|
{ |
229
|
|
|
$this->calledMethod = 'getPersonalManager'; |
230
|
|
|
|
231
|
|
|
$this->methodProperties['Ref'] = $Ref; |
232
|
|
|
|
233
|
|
|
return $this->getResponse($this->model, $this->calledMethod, $this->methodProperties, true); |
234
|
|
|
} |
235
|
|
|
} |
236
|
|
|
|