@@ -8,35 +8,53 @@ class OrderCostsItem extends BaseItem
8
8
{
9
9
10
10
/**
11
- * @var string
11
+ * @var float
12
12
* Total cost of all items
13
13
*/
14
14
public $ subtotal ;
15
15
16
16
/**
17
- * @var string
17
+ * @var float
18
18
* Discount sum
19
19
*/
20
20
public $ discount ;
21
21
22
22
/**
23
- * @var string
23
+ * @var float
24
24
* Shipping costs
25
25
*/
26
26
public $ shipping ;
27
27
28
28
/**
29
- * @var string
29
+ * @var float
30
30
* Sum of taxes (not included in the item price)
31
31
*/
32
32
public $ tax ;
33
33
34
34
/**
35
- * @var string
35
+ * @var float
36
36
* Sum of taxes (not included in the item price)
37
37
*/
38
38
public $ total ;
39
39
40
+ /**
41
+ * @var string
42
+ * 3 letter currency code
43
+ */
44
+ public $ currency ;
45
+
46
+ /**
47
+ * @var float
48
+ * Digitization costs
49
+ */
50
+ public $ digitization ;
51
+
52
+ /**
53
+ * @var float
54
+ * Sum of vat (not included in the item price)
55
+ */
56
+ public $ vat ;
57
+
40
58
/**
41
59
* @param array $raw
42
60
* @return OrderCostsItem
@@ -45,11 +63,14 @@ public static function fromArray(array $raw)
45
63
{
46
64
$ costs = new self ;
47
65
48
- $ costs ->subtotal = $ raw ['subtotal ' ] ? (float )$ raw ['subtotal ' ] : null ;
49
- $ costs ->discount = $ raw ['discount ' ] ? (float )$ raw ['discount ' ] : null ;
50
- $ costs ->shipping = $ raw ['shipping ' ] ? (float )$ raw ['shipping ' ] : null ;
51
- $ costs ->tax = $ raw ['tax ' ] ? (float )$ raw ['tax ' ] : null ;
52
- $ costs ->total = $ raw ['total ' ] ? (float )$ raw ['total ' ] : null ;
66
+ $ costs ->subtotal = isset ($ raw ['subtotal ' ]) ? (float )$ raw ['subtotal ' ] : null ;
67
+ $ costs ->discount = isset ($ raw ['discount ' ]) ? (float )$ raw ['discount ' ] : null ;
68
+ $ costs ->shipping = isset ($ raw ['shipping ' ]) ? (float )$ raw ['shipping ' ] : null ;
69
+ $ costs ->tax = isset ($ raw ['tax ' ]) ? (float )$ raw ['tax ' ] : null ;
70
+ $ costs ->total = isset ($ raw ['total ' ]) ? (float )$ raw ['total ' ] : null ;
71
+ $ costs ->currency = isset ($ raw ['currency ' ]) ? $ raw ['currency ' ] : null ;
72
+ $ costs ->digitization = isset ($ raw ['digitization ' ]) ? (float )$ raw ['digitization ' ] : null ;
73
+ $ costs ->vat = isset ($ raw ['vat ' ]) ? (float )$ raw ['vat ' ] : null ;
53
74
54
75
return $ costs ;
55
76
}
@@ -65,6 +86,9 @@ public function toArray()
65
86
'tax ' => $ this ->tax ,
66
87
'subtotal ' => $ this ->subtotal ,
67
88
'total ' => $ this ->total ,
89
+ 'currency ' => $ this ->currency ,
90
+ 'digitization ' => $ this ->digitization ,
91
+ 'vat ' => $ this ->vat ,
68
92
];
69
93
}
70
94
}
0 commit comments