Common::getCargoDescriptionList()   A
last analyzed

Complexity

Conditions 2
Paths 2

Size

Total Lines 10
Code Lines 5

Duplication

Lines 0
Ratio 0 %

Importance

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