Issues (24)

src/Models/Order.php (2 issues)

1
<?php
2
3
declare(strict_types=1);
4
5
namespace DalliSDK\Models;
6
7
use DalliSDK\Models\Responses\Error;
8
use DalliSDK\Traits\Fillable;
9
use JMS\Serializer\Annotation as JMS;
10
11
/**
12
 * Модель заявки (заказа)
13
 *
14
 * @see https://api.dalli-service.com/v1/doc/createbasket
15
 * @JMS\XmlRoot("order")
16
 */
17
class Order
18
{
19
    use Fillable;
20
21
    /**
22
     * Штрих-код заказа в системе Dalli (аттрибут)
23
     *
24
     * @JMS\Type("string")
25
     * @JMS\SerializedName("barcode")
26
     */
27
    private ?string $barcode = null;
28
29
    /**
30
     * Номер заявки в учетной системе ИМ (обязательный атрибут)
31
     *
32
     * @JMS\XmlAttribute()
33
     * @JMS\Type("string")
34
     * @JMS\SerializedName("number")
35
     */
36
    private string $number;
37
38
    /**
39
     * Информации о получателе (обязательный тег)
40
     *
41
     * @JMS\Type("DalliSDK\Models\Receiver")
42
     * @JMS\SerializedName("receiver")
43
     */
44
    private Receiver $receiver;
45
46
    /**
47
     * Код торговой точки (для использования необходимо согласование с персональным менеджером).
48
     * Работает только для экспресс доставки (код 2).
49
     * При другом типе доставки игнорируется
50
     *
51
     * @JMS\Type("string")
52
     * @JMS\SerializedName("department")
53
     */
54
    private ?string $department = null;
55
56
    /**
57
     * Код адреса забора.
58
     * Чтобы получить код адреса - обратитесь к вашему менеджеру.
59
     * Требуется для расчёта стоимости внутригородской доставки по Екатеринбургу и Нижнему Новгороду
60
     *
61
     * @JMS\Type("string")
62
     * @JMS\SerializedName("sendercode")
63
     */
64
    private ?string $senderCode = null;
65
66
    /**
67
     * Тип доставки (код из соответствующего справочника). Обязательный тег
68
     *
69
     * @see https://api.dalli-service.com/v1/doc/request-types-of-delivery
70
     * @JMS\Type("int")
71
     * @JMS\SerializedName("service")
72
     */
73
    private int $service;
74
75
    /**
76
     * Общий вес в килограммах (если пусто = 0.1)
77
     *
78
     * @JMS\Type("float")
79
     * @JMS\SerializedName("weight")
80
     *
81
     * @deprecated since version 1.5.0
82
     */
83
    private ?float $weight = null;
84
85
    /**
86
     * Количество мест, не путать с количеством товара (если пусто = 1)
87
     *
88
     * @JMS\Type("int")
89
     * @JMS\SerializedName("quantity")
90
     */
91
    private int $quantity;
92
93
    /**
94
     * Тип оплаты получателем (если пусто или неверно = cash)
95
     * Может быть:
96
     *  CASH - наличными, при получении (по умолчанию)
97
     *  CARD - картой, при получении
98
     *  NO - без оплаты, поле price будет обнулено
99
     *
100
     * @JMS\Type("string")
101
     * @JMS\SerializedName("paytype")
102
     */
103
    private ?string $payType = null;
104
105
106
    /**
107
     * Тип услуги Почты России
108
     * Может быть:
109
     *  1 - Посылка онлайн
110
     *  2 - Курьер онлайн
111
     *  3 - Посылка нестандартная
112
     *  4 - Посылка 1-го класса
113
     *
114
     * @JMS\Type("int")
115
     * @JMS\SerializedName("type")
116
     */
117
    private ?int $ruPostType = null;
118
119
    /**
120
     * Сумма наложенного платежа
121
     *
122
     * @JMS\Type("float")
123
     * @JMS\SerializedName("price")
124
     */
125
    private ?float $price = null;
126
127
    /**
128
     * Стоимость доставки.
129
     * Её возьмут с получателя в любом случае, если курьер был на адресе
130
     *
131
     * @JMS\Type("float")
132
     * @JMS\SerializedName("priced")
133
     */
134
    private ?float $priced = null;
135
136
    /**
137
     * Объявленная ценность
138
     *
139
     * @JMS\Type("float")
140
     * @JMS\SerializedName("inshprice")
141
     */
142
    private ?float $inshPrice = null;
143
144
    /**
145
     * Признак необходимости возврата (T - нужен возврат, F -  не нужен возврат)
146
     *
147
     * @JMS\Type("string")
148
     * @JMS\SerializedName("upsnak")
149
     */
150
    private ?string $upsnak = null;
151
152
    /**
153
     * Поручение, примечание для курьера
154
     *
155
     * @JMS\Type("string")
156
     * @JMS\SerializedName("instruction")
157
     */
158
    private ?string $instruction = null;
159
160
    /**
161
     * Разрешение/запрет частичного выкупа.
162
     * Принимает значения:
163
     *  YES - когда частичный выкуп доступен,
164
     *  NO - если не доступен.
165
     * По-умолчанию берётся значение из карточки клиента
166
     *
167
     * @JMS\Type("string")
168
     * @JMS\SerializedName("acceptpartially")
169
     */
170
    private ?string $acceptpartially = null;
171
172
    /**
173
     * Настройка дифференциальной стоимости доставки
174
     * Внимание! При явном указании дифференциальной стоимости доставки игнорируется тег priced, а так же настройки Личного Кабинета.
175
     * Если у вас одинаковые условия по стоимости доставки для всех заявок, тогда вы можете задать их глобально в Личном Кабинете
176
     *
177
     * @see https://api.dalli-service.com/v1/doc/request-types-of-delivery
178
     * @JMS\Type("DalliSDK\Models\DeliverySet")
179
     * @JMS\SerializedName("deliveryset")
180
     */
181
    private DeliverySet $deliverySet;
182
183
    /**
184
     * Корневой контейнер вложений (товаров)
185
     *
186
     * @JMS\Type("array<DalliSDK\Models\Item>")
187
     * @JMS\XmlList(entry = "item")
188
     * @JMS\SerializedName("items")
189
     * @var Item[]
190
     */
191
    private ?array $items = null;
192
193
    /**
194
     * Корневой контейнер мест (грузоместа)
195
     * Для получения доступа к добавлению мест обратитесь к вашему менеджеру. По умолчанию, данная опция недоступна.
196
     *
197
     * @JMS\Type("array<DalliSDK\Models\Packages>")
198
     * @JMS\XmlList(entry = "package")
199
     * @JMS\SerializedName("packages")
200
     * @var Package[]
201
     */
202
    private ?array $packages = null;
203
204
    /**
205
     * Если запрос был с ошибкой, то ответ мапится сюда
206
     *
207
     * @JMS\Type("array<DalliSDK\Models\Responses\Error>")
208
     * @JMS\XmlList(inline = false, entry = "error")
209
     * @var Error[]
210
     *
211
     */
212
    private ?array $errors = null;
213
214
    /**
215
     * @return string
216
     */
217 2
    public function getNumber(): string
218
    {
219 2
        return $this->number;
220
    }
221
222
    /**
223
     * @param string $number
224
     *
225
     * @return Order
226
     */
227 5
    public function setNumber(string $number): Order
228
    {
229 5
        $this->number = $number;
230 5
        return $this;
231
    }
232
233
    /**
234
     * @return Receiver
235
     */
236 1
    public function getReceiver(): Receiver
237
    {
238 1
        return $this->receiver;
239
    }
240
241
    /**
242
     * @param Receiver $receiver
243
     *
244
     * @return Order
245
     */
246 5
    public function setReceiver(Receiver $receiver): Order
247
    {
248 5
        $this->receiver = $receiver;
249 5
        return $this;
250
    }
251
252
    /**
253
     * @return string|null
254
     */
255 1
    public function getDepartment(): ?string
256
    {
257 1
        return $this->department;
258
    }
259
260
    /**
261
     * @param string|null $department
262
     *
263
     * @return Order
264
     */
265 1
    public function setDepartment(?string $department): Order
266
    {
267 1
        $this->department = $department;
268 1
        return $this;
269
    }
270
271
    /**
272
     * @return string|null
273
     */
274 1
    public function getSenderCode(): ?string
275
    {
276 1
        return $this->senderCode;
277
    }
278
279
    /**
280
     * @param string|null $senderCode
281
     *
282
     * @return Order
283
     */
284 2
    public function setSenderCode(?string $senderCode): Order
285
    {
286 2
        $this->senderCode = $senderCode;
287 2
        return $this;
288
    }
289
290
    /**
291
     * @return int
292
     */
293 1
    public function getService(): int
294
    {
295 1
        return $this->service;
296
    }
297
298
    /**
299
     * @param int $service
300
     *
301
     * @return Order
302
     */
303 4
    public function setService(int $service): Order
304
    {
305 4
        $this->service = $service;
306 4
        return $this;
307
    }
308
309
    /**
310
     * @return float|null
311
     * @deprecated deprecated since version 1.5.0
312
     */
313 1
    public function getWeight(): ?float
314
    {
315 1
        return $this->weight;
0 ignored issues
show
Deprecated Code introduced by
The property DalliSDK\Models\Order::$weight has been deprecated: since version 1.5.0 ( Ignorable by Annotation )

If this is a false-positive, you can also ignore this issue in your code via the ignore-deprecated  annotation

315
        return /** @scrutinizer ignore-deprecated */ $this->weight;

This property has been deprecated. The supplier of the class has supplied an explanatory message.

The explanatory message should give you some clue as to whether and when the property will be removed from the class and what other property to use instead.

Loading history...
316
    }
317
318
    /**
319
     * @param float|null $weight
320
     * @deprecated deprecated since version 1.5.0
321
     * @return Order
322
     */
323 4
    public function setWeight(?float $weight): Order
324
    {
325 4
        $this->weight = $weight;
0 ignored issues
show
Deprecated Code introduced by
The property DalliSDK\Models\Order::$weight has been deprecated: since version 1.5.0 ( Ignorable by Annotation )

If this is a false-positive, you can also ignore this issue in your code via the ignore-deprecated  annotation

325
        /** @scrutinizer ignore-deprecated */ $this->weight = $weight;

This property has been deprecated. The supplier of the class has supplied an explanatory message.

The explanatory message should give you some clue as to whether and when the property will be removed from the class and what other property to use instead.

Loading history...
326 4
        return $this;
327
    }
328
329
    /**
330
     * @return int
331
     */
332 1
    public function getQuantity(): int
333
    {
334 1
        return $this->quantity;
335
    }
336
337
    /**
338
     * @param int $quantity
339
     *
340
     * @return Order
341
     */
342 4
    public function setQuantity(int $quantity): Order
343
    {
344 4
        $this->quantity = $quantity;
345 4
        return $this;
346
    }
347
348
    /**
349
     * @return string|null
350
     */
351 1
    public function getPayType(): ?string
352
    {
353 1
        return $this->payType;
354
    }
355
356
    /**
357
     * @param string|null $payType
358
     *
359
     * @return Order
360
     */
361 4
    public function setPayType(?string $payType): Order
362
    {
363 4
        $this->payType = $payType;
364 4
        return $this;
365
    }
366
367
    /**
368
     * @return float|null
369
     */
370 1
    public function getPrice(): ?float
371
    {
372 1
        return $this->price;
373
    }
374
375
    /**
376
     * @param float|null $price
377
     *
378
     * @return Order
379
     */
380 5
    public function setPrice(?float $price): Order
381
    {
382 5
        $this->price = $price;
383 5
        return $this;
384
    }
385
386
    /**
387
     * @return float|null
388
     */
389 1
    public function getPriced(): ?float
390
    {
391 1
        return $this->priced;
392
    }
393
394
    /**
395
     * @param float|null $priced
396
     *
397
     * @return Order
398
     */
399 4
    public function setPriced(?float $priced): Order
400
    {
401 4
        $this->priced = $priced;
402 4
        return $this;
403
    }
404
405
    /**
406
     * @return float|null
407
     */
408 1
    public function getInshPrice(): ?float
409
    {
410 1
        return $this->inshPrice;
411
    }
412
413
    /**
414
     * @param float|null $inshPrice
415
     *
416
     * @return Order
417
     */
418 5
    public function setInshPrice(?float $inshPrice): Order
419
    {
420 5
        $this->inshPrice = $inshPrice;
421 5
        return $this;
422
    }
423
424
    /**
425
     * @return string|null
426
     */
427 1
    public function getUpsnak(): ?string
428
    {
429 1
        return $this->upsnak;
430
    }
431
432
    /**
433
     * @param string|null $upsnak
434
     *
435
     * @return Order
436
     */
437 2
    public function setUpsnak(?string $upsnak): Order
438
    {
439 2
        $this->upsnak = $upsnak;
440 2
        return $this;
441
    }
442
443
    /**
444
     * @return string|null
445
     */
446 1
    public function getInstruction(): ?string
447
    {
448 1
        return $this->instruction;
449
    }
450
451
    /**
452
     * @param string|null $instruction
453
     *
454
     * @return Order
455
     */
456 5
    public function setInstruction(?string $instruction): Order
457
    {
458 5
        $this->instruction = $instruction;
459 5
        return $this;
460
    }
461
462
    /**
463
     * @return string|null
464
     */
465 1
    public function getAcceptpartially(): ?string
466
    {
467 1
        return $this->acceptpartially;
468
    }
469
470
    /**
471
     * @param string|null $acceptpartially
472
     *
473
     * @return Order
474
     */
475 2
    public function setAcceptpartially(?string $acceptpartially): Order
476
    {
477 2
        $this->acceptpartially = $acceptpartially;
478 2
        return $this;
479
    }
480
481
    /**
482
     * @return DeliverySet
483
     */
484 1
    public function getDeliverySet(): DeliverySet
485
    {
486 1
        return $this->deliverySet;
487
    }
488
489
    /**
490
     * @param DeliverySet $deliverySet
491
     *
492
     * @return Order
493
     */
494 2
    public function setDeliverySet(DeliverySet $deliverySet): Order
495
    {
496 2
        $this->deliverySet = $deliverySet;
497 2
        return $this;
498
    }
499
500
    /**
501
     * @return array|null
502
     */
503 2
    public function getItems(): ?array
504
    {
505 2
        return $this->items;
506
    }
507
508
    /**
509
     * @param array|null $items
510
     *
511
     * @return Order
512
     */
513 4
    public function setItems(?array $items): Order
514
    {
515 4
        $this->items = $items;
516 4
        return $this;
517
    }
518
519
    /**
520
     * @return array|null
521
     */
522 1
    public function getPackages(): ?array
523
    {
524 1
        return $this->packages;
525
    }
526
527
    /**
528
     * @param array|null $packages
529
     *
530
     * @return Order
531
     */
532 1
    public function setPackages(?array $packages): Order
533
    {
534 1
        $this->packages = $packages;
535 1
        return $this;
536
    }
537
538
    /**
539
     * @return string|null
540
     */
541 2
    public function getBarcode(): ?string
542
    {
543 2
        return $this->barcode;
544
    }
545
546
    /**
547
     * @param string $barcode
548
     *
549
     * @return Order
550
     */
551 2
    public function setBarcode(string $barcode): Order
552
    {
553 2
        $this->barcode = $barcode;
554 2
        return $this;
555
    }
556
557
    /**
558
     * @return array|null
559
     */
560 1
    public function getErrors(): ?array
561
    {
562 1
        return $this->errors;
563
    }
564
565
    /**
566
     * @return int|null
567
     */
568 1
    public function getRuPostType(): ?int
569
    {
570 1
        return $this->ruPostType;
571
    }
572
573
    /**
574
     * @param int|null $ruPostType
575
     *
576
     * @return Order
577
     */
578 2
    public function setRuPostType(?int $ruPostType): Order
579
    {
580 2
        $this->ruPostType = $ruPostType;
581 2
        return $this;
582
    }
583
}
584