1
|
|
|
<?php |
2
|
|
|
/** |
3
|
|
|
* Copyright © Wirecard Brasil. All rights reserved. |
4
|
|
|
* |
5
|
|
|
* @author Bruno Elisei <[email protected]> |
6
|
|
|
* See COPYING.txt for license details. |
7
|
|
|
*/ |
8
|
|
|
|
9
|
|
|
namespace Moip\Magento2\Gateway\Data\Order; |
10
|
|
|
|
11
|
|
|
use Magento\Payment\Gateway\Data\AddressAdapterInterface; |
|
|
|
|
12
|
|
|
use Magento\Payment\Gateway\Data\OrderAdapterInterface; |
|
|
|
|
13
|
|
|
use Magento\Sales\Model\Order; |
|
|
|
|
14
|
|
|
|
15
|
|
|
/** |
16
|
|
|
* Class OrderAdapter - Adds necessary information to the order. |
17
|
|
|
*/ |
18
|
|
|
class OrderAdapter implements OrderAdapterInterface |
19
|
|
|
{ |
20
|
|
|
/** |
21
|
|
|
* @var Order |
22
|
|
|
*/ |
23
|
|
|
private $order; |
24
|
|
|
|
25
|
|
|
/** |
26
|
|
|
* @var AddressAdapter |
27
|
|
|
*/ |
28
|
|
|
private $addAdapterFactory; |
29
|
|
|
|
30
|
|
|
/** |
31
|
|
|
* OrderAdapter constructor. |
32
|
|
|
* |
33
|
|
|
* @param Order |
34
|
|
|
* @param AddressAdapterFactory |
35
|
|
|
*/ |
36
|
|
|
public function __construct( |
37
|
|
|
Order $order, |
38
|
|
|
AddressAdapterFactory $addAdapterFactory |
|
|
|
|
39
|
|
|
) { |
40
|
|
|
$this->order = $order; |
41
|
|
|
$this->addAdapterFactory = $addAdapterFactory; |
42
|
|
|
} |
43
|
|
|
|
44
|
|
|
/** |
45
|
|
|
* Returns currency code. |
46
|
|
|
* |
47
|
|
|
* @return string |
48
|
|
|
*/ |
49
|
|
|
public function getCurrencyCode() |
50
|
|
|
{ |
51
|
|
|
return $this->order->getBaseCurrencyCode(); |
52
|
|
|
} |
53
|
|
|
|
54
|
|
|
/** |
55
|
|
|
* Returns order increment id. |
56
|
|
|
* |
57
|
|
|
* @return string |
58
|
|
|
*/ |
59
|
|
|
public function getOrderIncrementId() |
60
|
|
|
{ |
61
|
|
|
return $this->order->getIncrementId(); |
62
|
|
|
} |
63
|
|
|
|
64
|
|
|
/** |
65
|
|
|
* Returns customer ID. |
66
|
|
|
* |
67
|
|
|
* @return int|null |
68
|
|
|
*/ |
69
|
|
|
public function getCustomerId() |
70
|
|
|
{ |
71
|
|
|
return $this->order->getCustomerId(); |
72
|
|
|
} |
73
|
|
|
|
74
|
|
|
/** |
75
|
|
|
* Returns billing address. |
76
|
|
|
* |
77
|
|
|
* @return AddressAdapterInterface|null |
78
|
|
|
*/ |
79
|
|
|
public function getBillingAddress() |
80
|
|
|
{ |
81
|
|
|
if ($this->order->getBillingAddress()) { |
82
|
|
|
return $this->addAdapterFactory->create( |
83
|
|
|
['address' => $this->order->getBillingAddress()] |
84
|
|
|
); |
85
|
|
|
} |
86
|
|
|
|
87
|
|
|
return null; |
88
|
|
|
} |
89
|
|
|
|
90
|
|
|
/** |
91
|
|
|
* Returns shipping address. |
92
|
|
|
* |
93
|
|
|
* @return AddressAdapterInterface|null |
94
|
|
|
*/ |
95
|
|
|
public function getShippingAddress() |
96
|
|
|
{ |
97
|
|
|
if ($this->order->getShippingAddress()) { |
98
|
|
|
return $this->addAdapterFactory->create( |
99
|
|
|
['address' => $this->order->getShippingAddress()] |
100
|
|
|
); |
101
|
|
|
} |
102
|
|
|
|
103
|
|
|
return null; |
104
|
|
|
} |
105
|
|
|
|
106
|
|
|
/** |
107
|
|
|
* Returns order store id. |
108
|
|
|
* |
109
|
|
|
* @return int |
110
|
|
|
*/ |
111
|
|
|
public function getStoreId() |
112
|
|
|
{ |
113
|
|
|
return $this->order->getStoreId(); |
114
|
|
|
} |
115
|
|
|
|
116
|
|
|
/** |
117
|
|
|
* Returns order id. |
118
|
|
|
* |
119
|
|
|
* @return int |
120
|
|
|
*/ |
121
|
|
|
public function getId() |
122
|
|
|
{ |
123
|
|
|
return $this->order->getEntityId(); |
124
|
|
|
} |
125
|
|
|
|
126
|
|
|
/** |
127
|
|
|
* Returns order grand total amount. |
128
|
|
|
* |
129
|
|
|
* @return float|null |
130
|
|
|
*/ |
131
|
|
|
public function getGrandTotalAmount() |
132
|
|
|
{ |
133
|
|
|
return $this->order->getBaseGrandTotal(); |
134
|
|
|
} |
135
|
|
|
|
136
|
|
|
/** |
137
|
|
|
* Returns list of line items in the cart. |
138
|
|
|
* |
139
|
|
|
* @return \Magento\Sales\Api\Data\OrderItemInterface[] |
140
|
|
|
*/ |
141
|
|
|
public function getItems() |
142
|
|
|
{ |
143
|
|
|
return $this->order->getItems(); |
144
|
|
|
} |
145
|
|
|
|
146
|
|
|
/** |
147
|
|
|
* Gets the remote IP address for the order. |
148
|
|
|
* |
149
|
|
|
* @return string|null Remote IP address. |
150
|
|
|
*/ |
151
|
|
|
public function getRemoteIp() |
152
|
|
|
{ |
153
|
|
|
return $this->order->getRemoteIp(); |
154
|
|
|
} |
155
|
|
|
|
156
|
|
|
/** |
157
|
|
|
* Gets the Dob for the customer. |
158
|
|
|
* |
159
|
|
|
* @return date|null Dob. |
|
|
|
|
160
|
|
|
*/ |
161
|
|
|
public function getCustomerDob() |
162
|
|
|
{ |
163
|
|
|
return $this->order->getCustomerDob(); |
164
|
|
|
} |
165
|
|
|
|
166
|
|
|
/** |
167
|
|
|
* Gets the Tax/Vat for the customer. |
168
|
|
|
* |
169
|
|
|
* @return string|null Tax/Vat. |
170
|
|
|
*/ |
171
|
|
|
public function getCustomerTaxvat() |
172
|
|
|
{ |
173
|
|
|
return $this->order->getCustomerTaxvat(); |
174
|
|
|
} |
175
|
|
|
|
176
|
|
|
/** |
177
|
|
|
* Returns order shipping total amount. |
178
|
|
|
* |
179
|
|
|
* @return float|null |
180
|
|
|
*/ |
181
|
|
|
public function getShippingAmount() |
182
|
|
|
{ |
183
|
|
|
return $this->order->getShippingAmount(); |
184
|
|
|
} |
185
|
|
|
|
186
|
|
|
/** |
187
|
|
|
* Returns order discount total amount. |
188
|
|
|
* |
189
|
|
|
* @return float|null |
190
|
|
|
*/ |
191
|
|
|
public function getDiscountAmount() |
192
|
|
|
{ |
193
|
|
|
return $this->order->getDiscountAmount(); |
194
|
|
|
} |
195
|
|
|
|
196
|
|
|
/** |
197
|
|
|
* Returns order tax total amount. |
198
|
|
|
* |
199
|
|
|
* @return float|null |
200
|
|
|
*/ |
201
|
|
|
public function getTaxAmount() |
202
|
|
|
{ |
203
|
|
|
return $this->order->getTaxAmount(); |
204
|
|
|
} |
205
|
|
|
|
206
|
|
|
/** |
207
|
|
|
* Returns order base moip interest amount. |
208
|
|
|
* |
209
|
|
|
* @return float|null |
210
|
|
|
*/ |
211
|
|
|
public function getBaseMoipInterestAmount() |
212
|
|
|
{ |
213
|
|
|
return $this->order->getBaseMoipInterestAmount(); |
214
|
|
|
} |
215
|
|
|
|
216
|
|
|
/** |
217
|
|
|
* Returns order quote id. |
218
|
|
|
* |
219
|
|
|
* @return float|null |
220
|
|
|
*/ |
221
|
|
|
public function getQuoteId() |
222
|
|
|
{ |
223
|
|
|
return $this->order->getQuoteId(); |
224
|
|
|
} |
225
|
|
|
|
226
|
|
|
/** |
227
|
|
|
* Set order moip interest amount. |
228
|
|
|
* |
229
|
|
|
* @return float|null |
230
|
|
|
*/ |
231
|
|
|
public function setMoipInterestAmount($interest) |
232
|
|
|
{ |
233
|
|
|
return $this->order->setMoipInterestAmount($interest); |
234
|
|
|
} |
235
|
|
|
|
236
|
|
|
/** |
237
|
|
|
* Set order base moip interest amount. |
238
|
|
|
* |
239
|
|
|
* @return float|null |
240
|
|
|
*/ |
241
|
|
|
public function setBaseMoipInterestAmount($interest) |
242
|
|
|
{ |
243
|
|
|
return $this->order->setBaseMoipInterestAmount($interest); |
244
|
|
|
} |
245
|
|
|
} |
246
|
|
|
|
The issue could also be caused by a filter entry in the build configuration. If the path has been excluded in your configuration, e.g.
excluded_paths: ["lib/*"]
, you can move it to the dependency path list as follows:For further information see https://scrutinizer-ci.com/docs/tools/php/php-scrutinizer/#list-dependency-paths