1 | <?php |
||
18 | trait TSummaryAmounts |
||
19 | { |
||
20 | /** @var float */ |
||
21 | protected $totalAmount; |
||
22 | /** @var float */ |
||
23 | protected $taxAmount; |
||
24 | /** @var float */ |
||
25 | protected $subtotalAmount; |
||
26 | /** @var float */ |
||
27 | protected $dutyAmount; |
||
28 | /** @var float */ |
||
29 | protected $feesAmount; |
||
30 | /** @var float */ |
||
31 | protected $discountAmount; |
||
32 | |||
33 | /** |
||
34 | * Grand total |
||
35 | * |
||
36 | * xsd restriction: 2 decimal, non-negative |
||
37 | * @return float |
||
38 | */ |
||
39 | public function getTotalAmount() |
||
43 | /** |
||
44 | * @param float |
||
45 | * @return self |
||
46 | */ |
||
47 | public function setTotalAmount($totalAmount) |
||
52 | /** |
||
53 | * Tax amount for the order |
||
54 | * |
||
55 | * xsd restriction: 2 decimal, non-negative |
||
56 | * @return float |
||
57 | */ |
||
58 | public function getTaxAmount() |
||
62 | /** |
||
63 | * @param float |
||
64 | * @return self |
||
65 | */ |
||
66 | public function setTaxAmount($taxAmount) |
||
71 | /** |
||
72 | * Order subtotal |
||
73 | * |
||
74 | * xsd restriction: 2 decimal, non-negative |
||
75 | * @return float |
||
76 | */ |
||
77 | public function getSubtotalAmount() |
||
81 | /** |
||
82 | * @param float |
||
83 | * @return self |
||
84 | */ |
||
85 | public function setSubtotalAmount($subtotalAmount) |
||
90 | /** |
||
91 | * Duty amount for the order |
||
92 | * |
||
93 | * xsd restriction: 2 decimal, non-negative |
||
94 | * @return float |
||
95 | */ |
||
96 | public function getDutyAmount() |
||
100 | /** |
||
101 | * @param float |
||
102 | * @return self |
||
103 | */ |
||
104 | public function setDutyAmount($dutyAmount) |
||
109 | /** |
||
110 | * Fees amount for the order |
||
111 | * |
||
112 | * xsd restriction: 2 decimal, non-negative |
||
113 | * @return float |
||
114 | */ |
||
115 | public function getFeesAmount() |
||
119 | /** |
||
120 | * @param float |
||
121 | * @return self |
||
122 | */ |
||
123 | public function setFeesAmount($feesAmount) |
||
128 | /** |
||
129 | * Discount amount for the order. |
||
130 | * |
||
131 | * xsd restriction: 2 decimal, non-negative |
||
132 | * @return float |
||
133 | */ |
||
134 | public function getDiscountAmount() |
||
138 | /** |
||
139 | * @param float |
||
140 | * @return self |
||
141 | */ |
||
142 | public function setDiscountAmount($discountAmount) |
||
147 | |||
148 | /** |
||
149 | * ensure the amount is rounded to two decimal places. |
||
150 | * |
||
151 | * @param mixed any numeric value |
||
152 | * @return float|null rounded to 2 places, null if amount is not numeric |
||
153 | */ |
||
154 | abstract protected function sanitizeAmount($amount); |
||
155 | } |
||
156 |