Item::setVatRate()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 4
Code Lines 2

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 3
CRAP Score 1

Importance

Changes 1
Bugs 0 Features 0
Metric Value
cc 1
eloc 2
c 1
b 0
f 0
nc 1
nop 1
dl 0
loc 4
ccs 3
cts 3
cp 1
crap 1
rs 10
1
<?php
2
3
declare(strict_types=1);
4
5
namespace DalliSDK\Models;
6
7
use DalliSDK\Traits\Fillable;
8
use JMS\Serializer\Annotation as JMS;
9
10
/**
11
 * Модель с информацией о позиции (товаре) в заказе
12
 *
13
 * @see https://api.dalli-service.com/v1/doc/createbasket
14
 * @JMS\XmlRoot("item")
15
 */
16
class Item
17
{
18
    use Fillable;
19
20
    /**
21
     * Количество товаров
22
     *
23
     * @JMS\XmlAttribute()
24
     * @JMS\Type("int")
25
     * @JMS\SerializedName("quantity")
26
     */
27
    private int $quantity;
28
29
    /**
30
     * Масса единицы товара в килограммах
31
     *
32
     * @JMS\XmlAttribute()
33
     * @JMS\Type("float")
34
     * @JMS\SerializedName("weight")
35
     */
36
    private ?float $weight = null;
37
38
    /**
39
     * Масса единицы товара в килограммах (иногда ответ приходит именно в этом аттрибуте)
40
     *
41
     * @JMS\XmlAttribute()
42
     * @JMS\Type("float")
43
     * @JMS\SerializedName("mass")
44
     */
45
    private ?float $mass = null;
46
47
    /**
48
     * Цена за штуку
49
     *
50
     * @JMS\XmlAttribute()
51
     * @JMS\Type("float")
52
     * @JMS\SerializedName("retprice")
53
     */
54
    private float $retPrice;
55
56
    /**
57
     * Оценочная стоимость за штуку
58
     *
59
     * @JMS\XmlAttribute()
60
     * @JMS\Type("float")
61
     * @JMS\SerializedName("inshprice")
62
     */
63
    private ?float $inshPrice = null;
64
65
    /**
66
     * Штрих-код товара
67
     *
68
     * @JMS\XmlAttribute()
69
     * @JMS\Type("string")
70
     * @JMS\SerializedName("barcode")
71
     */
72
    private ?string $barcode = null;
73
74
    /**
75
     * Артикул товара(необязательный). После добавления заявки в Забор (выгрузки из корзины)
76
     * будет объединен с наименованием в формате "АРТИКУЛ - НАЗВАНИЕ"
77
     *
78
     * @JMS\XmlAttribute()
79
     * @JMS\Type("string")
80
     * @JMS\SerializedName("article")
81
     */
82
    private ?string $article = null;
83
84
85
    /**
86
     * Ставка НДС - целое число процентов. Если значение не указано, подставляется значение "20".
87
     * Значение "0" означает ставку "Без НДС", ставка "0%" на данный момент не поддерживается.
88
     *
89
     * @JMS\XmlAttribute()
90
     * @JMS\Type("int")
91
     * @JMS\SerializedName("VATrate")
92
     */
93
    private ?int $vatRate = null;
94
95
    /**
96
     * Код страны-производителя в соответствии с стандартом ISO_3166-1, например, "RU", "RUS" или "643" для России.
97
     *
98
     * @JMS\XmlAttribute()
99
     * @JMS\Type("string")
100
     * @JMS\SerializedName("origincountry")
101
     */
102
    private ?string $originCountry = null;
103
104
    /**
105
     * Номер ГТД
106
     *
107
     * @JMS\XmlAttribute()
108
     * @JMS\Type("string")
109
     * @JMS\SerializedName("GTD")
110
     */
111
    private ?string $gtd = null;
112
113
    /**
114
     * Сумма акциза
115
     *
116
     * @JMS\XmlAttribute()
117
     * @JMS\Type("float")
118
     */
119
    private ?float $excise = null;
120
121
    /**
122
     * Наименование компании поставщика, если отличается от заказчика
123
     *
124
     * @JMS\XmlAttribute()
125
     * @JMS\Type("string")
126
     * @JMS\SerializedName("suppcompany")
127
     */
128
    private ?string $suppCompany = null;
129
130
    /**
131
     * Номер телефона компании поставщика, если отличается от заказчика
132
     *
133
     * @JMS\XmlAttribute()
134
     * @JMS\Type("string")
135
     * @JMS\SerializedName("suppphone")
136
     */
137
    private ?string $suppPhone = null;
138
139
    /**
140
     * ИНН компании поставщика, если отличается от заказчика
141
     *
142
     * @JMS\XmlAttribute()
143
     * @JMS\Type("string")
144
     * @JMS\SerializedName("suppINN")
145
     */
146
    private ?string $suppINN = null;
147
148
    /**
149
     * Код товарной номенклатуры. Используется для маркированных товаров ("Честный знак").
150
     * Нужно указывать все данные из нанесенного QR-кода, кроме нечитаемых символов (#29).
151
     * Если поле заполнено - поле quantity должно содержать только "1"
152
     *
153
     * @JMS\XmlAttribute()
154
     * @JMS\Type("string")
155
     * @JMS\SerializedName("governmentcode")
156
     */
157
    private ?string $governmentCode = null;
158
159
    /**
160
     * Тип вложения. Принимает значения:
161
     *      1 - Товар. По умолчанию
162
     *      7 - Забор товара.
163
     * Если товар нужно у получателя забрать, возможно - вернуть деньги,
164
     * или его стоимость вычитается из суммы других товаров.
165
     * У такого товара в заявке будет отрицательное количество независимо от знака в запросе
166
     *
167
     * @JMS\XmlAttribute()
168
     * @JMS\Type("int")
169
     */
170
    private int $type = 1;
171
172
    /**
173
     * Внутренний код товарной позиции
174
     *
175
     * @JMS\XmlAttribute()
176
     * @JMS\Type("string")
177
     * @JMS\SerializedName("extcode")
178
     */
179
    private ?string $extCode = null;
180
181
    /**
182
     * Строка в формате JSON для отправки в ОФД.
183
     *
184
     * @JMS\XmlAttribute()
185
     * @JMS\Type("string")
186
     * @JMS\SerializedName("extraTags")
187
     */
188
    private ?string $extraTags = null;
189
190
    /**
191
     * Название товара
192
     *
193
     * @JMS\XmlValue
194
     * @JMS\Type("string")
195
     */
196
    private string $name;
197
198
    /**
199
     * @return int
200
     */
201 2
    public function getQuantity(): int
202
    {
203 2
        return $this->quantity;
204
    }
205
206
    /**
207
     * @param int $quantity
208
     *
209
     * @return Item
210
     */
211 22
    public function setQuantity(int $quantity): Item
212
    {
213 22
        $this->quantity = $quantity;
214 22
        return $this;
215
    }
216
217
    /**
218
     * @return float|null
219
     */
220 2
    public function getWeight(): ?float
221
    {
222 2
        return max($this->weight, $this->mass);
223
    }
224
225
    /**
226
     * @param float|null $weight
227
     *
228
     * @return Item
229
     */
230 21
    public function setWeight(?float $weight): Item
231
    {
232 21
        $this->weight = $weight;
233 21
        return $this;
234
    }
235
236
    /**
237
     * @return float|null
238
     */
239 2
    public function getMass(): ?float
240
    {
241 2
        return $this->mass;
242
    }
243
244
    /**
245
     * @param float|null $mass
246
     *
247
     * @return Item
248
     */
249 1
    public function setMass(?float $mass): Item
250
    {
251 1
        $this->mass = $mass;
252 1
        return $this;
253
    }
254
255
    /**
256
     * @return float
257
     */
258 2
    public function getRetPrice(): float
259
    {
260 2
        return $this->retPrice;
261
    }
262
263
    /**
264
     * @param float $retPrice
265
     *
266
     * @return Item
267
     */
268 22
    public function setRetPrice(float $retPrice): Item
269
    {
270 22
        $this->retPrice = $retPrice;
271 22
        return $this;
272
    }
273
274
    /**
275
     * @return float|null
276
     */
277 2
    public function getInshPrice(): ?float
278
    {
279 2
        return $this->inshPrice;
280
    }
281
282
    /**
283
     * @param float|null $inshPrice
284
     *
285
     * @return Item
286
     */
287 21
    public function setInshPrice(?float $inshPrice): Item
288
    {
289 21
        $this->inshPrice = $inshPrice;
290 21
        return $this;
291
    }
292
293
    /**
294
     * @return string|null
295
     */
296 2
    public function getBarcode(): ?string
297
    {
298 2
        return $this->barcode;
299
    }
300
301
    /**
302
     * @param string|null $barcode
303
     *
304
     * @return Item
305
     */
306 1
    public function setBarcode(?string $barcode): Item
307
    {
308 1
        $this->barcode = $barcode;
309 1
        return $this;
310
    }
311
312
    /**
313
     * @return string|null
314
     */
315 3
    public function getArticle(): ?string
316
    {
317 3
        return $this->article;
318
    }
319
320
    /**
321
     * @param string|null $article
322
     *
323
     * @return Item
324
     */
325 1
    public function setArticle(?string $article): Item
326
    {
327 1
        $this->article = $article;
328 1
        return $this;
329
    }
330
331
    /**
332
     * @return int|null
333
     */
334 3
    public function getVatRate(): ?int
335
    {
336 3
        return $this->vatRate;
337
    }
338
339
    /**
340
     * @param int|null $vatRate
341
     *
342
     * @return Item
343
     */
344 1
    public function setVatRate(?int $vatRate): Item
345
    {
346 1
        $this->vatRate = $vatRate;
347 1
        return $this;
348
    }
349
350
    /**
351
     * @return string|null
352
     */
353 2
    public function getOriginCountry(): ?string
354
    {
355 2
        return $this->originCountry;
356
    }
357
358
    /**
359
     * @param string|null $originCountry
360
     *
361
     * @return Item
362
     */
363 21
    public function setOriginCountry(?string $originCountry): Item
364
    {
365 21
        $this->originCountry = $originCountry;
366 21
        return $this;
367
    }
368
369
    /**
370
     * @return string|null
371
     */
372 2
    public function getGtd(): ?string
373
    {
374 2
        return $this->gtd;
375
    }
376
377
    /**
378
     * @param string|null $gtd
379
     *
380
     * @return Item
381
     */
382 21
    public function setGtd(?string $gtd): Item
383
    {
384 21
        $this->gtd = $gtd;
385 21
        return $this;
386
    }
387
388
    /**
389
     * @return float|null
390
     */
391 3
    public function getExcise(): ?float
392
    {
393 3
        return $this->excise;
394
    }
395
396
    /**
397
     * @param float|null $excise
398
     *
399
     * @return Item
400
     */
401 1
    public function setExcise(?float $excise): Item
402
    {
403 1
        $this->excise = $excise;
404 1
        return $this;
405
    }
406
407
    /**
408
     * @return string|null
409
     */
410 2
    public function getSuppCompany(): ?string
411
    {
412 2
        return $this->suppCompany;
413
    }
414
415
    /**
416
     * @param string|null $suppCompany
417
     *
418
     * @return Item
419
     */
420 21
    public function setSuppCompany(?string $suppCompany): Item
421
    {
422 21
        $this->suppCompany = $suppCompany;
423 21
        return $this;
424
    }
425
426
    /**
427
     * @return string|null
428
     */
429 2
    public function getSuppPhone(): ?string
430
    {
431 2
        return $this->suppPhone;
432
    }
433
434
    /**
435
     * @param string|null $suppPhone
436
     *
437
     * @return Item
438
     */
439 21
    public function setSuppPhone(?string $suppPhone): Item
440
    {
441 21
        $this->suppPhone = $suppPhone;
442 21
        return $this;
443
    }
444
445
    /**
446
     * @return string|null
447
     */
448 2
    public function getSuppINN(): ?string
449
    {
450 2
        return $this->suppINN;
451
    }
452
453
    /**
454
     * @param string|null $suppINN
455
     *
456
     * @return Item
457
     */
458 21
    public function setSuppINN(?string $suppINN): Item
459
    {
460 21
        $this->suppINN = $suppINN;
461 21
        return $this;
462
    }
463
464
    /**
465
     * @return string|null
466
     */
467 3
    public function getGovernmentCode(): ?string
468
    {
469 3
        return $this->governmentCode;
470
    }
471
472
    /**
473
     * @param string|null $governmentCode
474
     *
475
     * @return Item
476
     */
477 1
    public function setGovernmentCode(?string $governmentCode): Item
478
    {
479 1
        $this->governmentCode = $governmentCode;
480 1
        return $this;
481
    }
482
483
    /**
484
     * @return int
485
     */
486 2
    public function getType(): int
487
    {
488 2
        return $this->type;
489
    }
490
491
    /**
492
     * @param int $type
493
     *
494
     * @return Item
495
     */
496 21
    public function setType(int $type): Item
497
    {
498 21
        $this->type = $type;
499 21
        return $this;
500
    }
501
502
    /**
503
     * @return string|null
504
     */
505 3
    public function getExtCode(): ?string
506
    {
507 3
        return $this->extCode;
508
    }
509
510
    /**
511
     * @param string|null $extCode
512
     *
513
     * @return Item
514
     */
515 1
    public function setExtCode(?string $extCode): Item
516
    {
517 1
        $this->extCode = $extCode;
518 1
        return $this;
519
    }
520
521
    /**
522
     * @return string
523
     */
524 3
    public function getName(): string
525
    {
526 3
        return $this->name;
527
    }
528
529
    /**
530
     * @param string $name
531
     *
532
     * @return Item
533
     */
534 22
    public function setName(string $name): Item
535
    {
536 22
        $this->name = $name;
537 22
        return $this;
538
    }
539
540
    /**
541
     * @return null|string
542
     */
543 1
    public function getExtraTags(): ?string
544
    {
545 1
        return $this->extraTags;
546
    }
547
548
    /**
549
     * @param null|string $extraTags
550
     *
551
     * @return Item
552
     */
553 2
    public function setExtraTags(?string $extraTags): Item
554
    {
555 2
        $this->extraTags = $extraTags;
556 2
        return $this;
557
    }
558
}
559