|
1
|
|
|
<?php |
|
2
|
|
|
|
|
3
|
|
|
/* |
|
4
|
|
|
* This file is part of gpupo/netshoes-sdk |
|
5
|
|
|
* Created by Gilmar Pupo <[email protected]> |
|
6
|
|
|
* For the information of copyright and license you should read the file |
|
7
|
|
|
* LICENSE which is distributed with this source code. |
|
8
|
|
|
* Para a informação dos direitos autorais e de licença você deve ler o arquivo |
|
9
|
|
|
* LICENSE que é distribuído com este código-fonte. |
|
10
|
|
|
* Para obtener la información de los derechos de autor y la licencia debe leer |
|
11
|
|
|
* el archivo LICENSE que se distribuye con el código fuente. |
|
12
|
|
|
* For more information, see <https://www.gpupo.com/>. |
|
13
|
|
|
*/ |
|
14
|
|
|
|
|
15
|
|
|
namespace Gpupo\NetshoesSdk\Entity\Order\Shippings\Items; |
|
16
|
|
|
|
|
17
|
|
|
use Gpupo\CommonSdk\Entity\EntityAbstract; |
|
18
|
|
|
use Gpupo\CommonSdk\Entity\EntityInterface; |
|
19
|
|
|
|
|
20
|
|
|
/** |
|
21
|
|
|
* @method string getBrand() Acesso a brand |
|
22
|
|
|
* @method setBrand(string $brand) Define brand |
|
23
|
|
|
* @method string getColor() Acesso a color |
|
24
|
|
|
* @method setColor(string $color) Define color |
|
25
|
|
|
* @method int getDepartmentCode() Acesso a departmentCode |
|
26
|
|
|
* @method setDepartmentCode(integer $departmentCode) Define departmentCode |
|
27
|
|
|
* @method string getDepartmentName() Acesso a departmentName |
|
28
|
|
|
* @method setDepartmentName(string $departmentName) Define departmentName |
|
29
|
|
|
* @method float getDiscountUnitValue() Acesso a discountUnitValue |
|
30
|
|
|
* @method setDiscountUnitValue(float $discountUnitValue) Define discountUnitValue |
|
31
|
|
|
* @method string getEan() Acesso a ean |
|
32
|
|
|
* @method setEan(string $ean) Define ean |
|
33
|
|
|
* @method string getFlavor() Acesso a flavor |
|
34
|
|
|
* @method setFlavor(string $flavor) Define flavor |
|
35
|
|
|
* @method float getGrossUnitValue() Acesso a grossUnitValue |
|
36
|
|
|
* @method setGrossUnitValue(float $grossUnitValue) Define grossUnitValue |
|
37
|
|
|
* @method int getItemId() Acesso a itemId |
|
38
|
|
|
* @method setItemId(integer $itemId) Define itemId |
|
39
|
|
|
* @method string getManufacturerCode() Acesso a manufacturerCode |
|
40
|
|
|
* @method setManufacturerCode(string $manufacturerCode) Define manufacturerCode |
|
41
|
|
|
* @method string getName() Acesso a name |
|
42
|
|
|
* @method setName(string $name) Define name |
|
43
|
|
|
* @method float getNetUnitValue() Acesso a netUnitValue |
|
44
|
|
|
* @method setNetUnitValue(float $netUnitValue) Define netUnitValue |
|
45
|
|
|
* @method float getQuantity() Acesso a quantity |
|
46
|
|
|
* @method setQuantity(float $quantity) Define quantity |
|
47
|
|
|
* @method string getSize() Acesso a size |
|
48
|
|
|
* @method setSize(string $size) Define size |
|
49
|
|
|
* @method string getSku() Acesso a sku |
|
50
|
|
|
* @method setSku(string $sku) Define sku |
|
51
|
|
|
* @method string getStatus() Acesso a status |
|
52
|
|
|
* @method setStatus(string $status) Define status |
|
53
|
|
|
* @method float getTotalCommission() Acesso a totalCommission |
|
54
|
|
|
* @method setTotalCommission(float $totalCommission) Define totalCommission |
|
55
|
|
|
* @method float getTotalDiscount() Acesso a totalDiscount |
|
56
|
|
|
* @method setTotalDiscount(float $totalDiscount) Define totalDiscount |
|
57
|
|
|
* @method float getTotalFreight() Acesso a totalFreight |
|
58
|
|
|
* @method setTotalFreight(float $totalFreight) Define totalFreight |
|
59
|
|
|
* @method float getTotalGross() Acesso a totalGross |
|
60
|
|
|
* @method setTotalGross(float $totalGross) Define totalGross |
|
61
|
|
|
* @method float getTotalNet() Acesso a totalNet |
|
62
|
|
|
* @method setTotalNet(float $totalNet) Define totalNet |
|
63
|
|
|
* @method string getCheckInData() Acesso a checkInData |
|
64
|
|
|
* @method setCheckInData(string $checkInData) Define checkInData |
|
65
|
|
|
* @method string getDevolutionData() Acesso a devolutionData |
|
66
|
|
|
* @method setDevolutionData(string $devolutionData) Define devolutionData |
|
67
|
|
|
* @method string getDevolutionExchangeStatus() Acesso a devolutionExchangeStatus |
|
68
|
|
|
* @method setDevolutionExchangeStatus(string $devolutionExchangeStatus) Define devolutionExchangeStatus |
|
69
|
|
|
* @method int getExchangeProcessCode() Acesso a exchangeProcessCode |
|
70
|
|
|
* @method setExchangeProcessCode(integer $exchangeProcessCode) Define exchangeProcessCode |
|
71
|
|
|
*/ |
|
72
|
|
|
class Item extends EntityAbstract implements EntityInterface |
|
73
|
|
|
{ |
|
74
|
|
|
protected $primaryKey = ''; |
|
75
|
|
|
|
|
76
|
|
|
/** |
|
77
|
|
|
* @codeCoverageIgnore |
|
78
|
|
|
*/ |
|
79
|
|
|
public function getSchema() |
|
80
|
|
|
{ |
|
81
|
|
|
return [ |
|
82
|
|
|
'brand' => 'string', |
|
83
|
|
|
'color' => 'string', |
|
84
|
|
|
'departmentCode' => 'integer', |
|
85
|
|
|
'departmentName' => 'string', |
|
86
|
|
|
'discountUnitValue' => 'number', |
|
87
|
|
|
'ean' => 'string', |
|
88
|
|
|
'flavor' => 'string', |
|
89
|
|
|
'grossUnitValue' => 'number', |
|
90
|
|
|
'itemId' => 'integer', |
|
91
|
|
|
'manufacturerCode' => 'string', |
|
92
|
|
|
'name' => 'string', |
|
93
|
|
|
'netUnitValue' => 'number', |
|
94
|
|
|
'quantity' => 'number', |
|
95
|
|
|
'size' => 'string', |
|
96
|
|
|
'sku' => 'string', |
|
97
|
|
|
'status' => 'string', |
|
98
|
|
|
'totalCommission' => 'number', |
|
99
|
|
|
'totalDiscount' => 'number', |
|
100
|
|
|
'totalFreight' => 'number', |
|
101
|
|
|
'totalGross' => 'number', |
|
102
|
|
|
'totalNet' => 'number', |
|
103
|
|
|
'checkInData' => 'string', |
|
104
|
|
|
'devolutionData' => 'string', |
|
105
|
|
|
'devolutionExchangeStatus' => 'string', |
|
106
|
|
|
'exchangeProcessCode' => 'integer', |
|
107
|
|
|
]; |
|
108
|
|
|
} |
|
109
|
|
|
|
|
110
|
|
|
public function toLog() |
|
111
|
|
|
{ |
|
112
|
|
|
return $this->partitionByArrayKey([ |
|
113
|
|
|
'sku', |
|
114
|
|
|
'ean', |
|
115
|
|
|
'name', |
|
116
|
|
|
'quantity', |
|
117
|
|
|
]); |
|
118
|
|
|
} |
|
119
|
|
|
|
|
120
|
|
|
/** |
|
121
|
|
|
* Entrega array compatível com Schema Comum. |
|
122
|
|
|
* |
|
123
|
|
|
* @see https://github.com/gpupo/common-schema/tree/master/src/Trading |
|
124
|
|
|
*/ |
|
125
|
3 |
|
public function toSchema() |
|
126
|
|
|
{ |
|
127
|
|
|
$array = [ |
|
128
|
|
|
'itemOffered' => [ |
|
129
|
3 |
|
'name' => $this->getName(), |
|
130
|
3 |
|
'sku' => $this->getSku(), |
|
131
|
3 |
|
'gtin' => $this->getEan(), |
|
132
|
3 |
|
'brand' => $this->getBrand(), |
|
133
|
|
|
], |
|
134
|
3 |
|
'price' => $this->getNetUnitValue(), |
|
135
|
3 |
|
'discount' => $this->getTotalDiscount(), |
|
136
|
3 |
|
'quantity' => $this->getQuantity(), |
|
137
|
3 |
|
'freight' => $this->getTotalFreight(), |
|
138
|
3 |
|
'total' => $this->getTotalNet(), |
|
139
|
|
|
]; |
|
140
|
|
|
|
|
141
|
3 |
|
return $array; |
|
142
|
|
|
} |
|
143
|
|
|
} |
|
144
|
|
|
|