1
|
|
|
<?php |
2
|
|
|
|
3
|
|
|
namespace Loevgaard\DandomainFoundation\Entity; |
4
|
|
|
|
5
|
|
|
use Doctrine\Common\Collections\ArrayCollection; |
6
|
|
|
use Doctrine\ORM\Mapping as ORM; |
7
|
|
|
use Knp\DoctrineBehaviors\Model\SoftDeletable\SoftDeletable; |
8
|
|
|
use Knp\DoctrineBehaviors\Model\Timestampable\Timestampable; |
9
|
|
|
use Loevgaard\DandomainFoundation; |
10
|
|
|
use Loevgaard\DandomainFoundation\Entity\Generated\CustomerInterface; |
|
|
|
|
11
|
|
|
use Loevgaard\DandomainFoundation\Entity\Generated\DeliveryInterface; |
|
|
|
|
12
|
|
|
use Loevgaard\DandomainFoundation\Entity\Generated\InvoiceInterface; |
|
|
|
|
13
|
|
|
use Loevgaard\DandomainFoundation\Entity\Generated\OrderInterface; |
|
|
|
|
14
|
|
|
use Loevgaard\DandomainFoundation\Entity\Generated\OrderLineInterface; |
|
|
|
|
15
|
|
|
use Loevgaard\DandomainFoundation\Entity\Generated\OrderTrait; |
|
|
|
|
16
|
|
|
use Loevgaard\DandomainFoundation\Entity\Generated\PaymentMethodInterface; |
|
|
|
|
17
|
|
|
use Loevgaard\DandomainFoundation\Entity\Generated\ShippingMethodInterface; |
|
|
|
|
18
|
|
|
use Loevgaard\DandomainFoundation\Entity\Generated\SiteInterface; |
|
|
|
|
19
|
|
|
use Loevgaard\DandomainFoundation\Entity\Generated\StateInterface; |
|
|
|
|
20
|
|
|
use Money\Money; |
21
|
|
|
|
22
|
|
|
/** |
23
|
|
|
* We use the Money library for amounts, and we use a shared currency, namely the property $currencyCode |
24
|
|
|
* |
25
|
|
|
* @ORM\Entity() |
26
|
|
|
* @ORM\Table(name="ldf_orders") |
27
|
|
|
*/ |
28
|
|
|
class Order extends AbstractEntity implements OrderInterface |
29
|
|
|
{ |
30
|
|
|
use OrderTrait; |
31
|
|
|
use Timestampable; |
32
|
|
|
use SoftDeletable; |
33
|
|
|
|
34
|
|
|
protected $hydrateConversions = [ |
35
|
|
|
'id' => 'externalId' |
36
|
|
|
]; |
37
|
|
|
|
38
|
|
|
/** |
39
|
|
|
* @var int |
40
|
|
|
* |
41
|
|
|
* @ORM\Id |
42
|
|
|
* @ORM\GeneratedValue |
43
|
|
|
* @ORM\Column(type="integer") |
44
|
|
|
**/ |
45
|
|
|
protected $id; |
46
|
|
|
|
47
|
|
|
/** |
48
|
|
|
* This is the order id in Dandomain |
49
|
|
|
* |
50
|
|
|
* @var int |
51
|
|
|
* |
52
|
|
|
* @ORM\Column(type="integer", unique=true) |
53
|
|
|
*/ |
54
|
|
|
protected $externalId; |
55
|
|
|
|
56
|
|
|
/** |
57
|
|
|
* @var CustomerInterface|null |
58
|
|
|
* |
59
|
|
|
* @ORM\JoinColumn(onDelete="SET NULL") |
60
|
|
|
* @ORM\ManyToOne(targetEntity="Customer", cascade={"persist", "remove"}) |
61
|
|
|
*/ |
62
|
|
|
protected $customer; |
63
|
|
|
|
64
|
|
|
/** |
65
|
|
|
* @var DeliveryInterface|null |
66
|
|
|
* |
67
|
|
|
* @ORM\JoinColumn(onDelete="SET NULL") |
68
|
|
|
* @ORM\ManyToOne(targetEntity="Delivery", cascade={"persist", "remove"}) |
69
|
|
|
*/ |
70
|
|
|
protected $delivery; |
71
|
|
|
|
72
|
|
|
/** |
73
|
|
|
* @var InvoiceInterface|null |
74
|
|
|
* |
75
|
|
|
* @ORM\JoinColumn(onDelete="SET NULL") |
76
|
|
|
* @ORM\ManyToOne(targetEntity="Invoice", cascade={"persist", "remove"}) |
77
|
|
|
*/ |
78
|
|
|
protected $invoice; |
79
|
|
|
|
80
|
|
|
/** |
81
|
|
|
* @var OrderLine[]|ArrayCollection |
82
|
|
|
* |
83
|
|
|
* @ORM\OneToMany(mappedBy="order", targetEntity="OrderLine", cascade={"persist", "remove"}, orphanRemoval=true) |
84
|
|
|
*/ |
85
|
|
|
protected $orderLines; |
86
|
|
|
|
87
|
|
|
/** |
88
|
|
|
* @var PaymentMethodInterface|null |
89
|
|
|
* |
90
|
|
|
* @ORM\JoinColumn(onDelete="SET NULL") |
91
|
|
|
* @ORM\ManyToOne(targetEntity="PaymentMethod", cascade={"persist", "remove"}) |
92
|
|
|
*/ |
93
|
|
|
protected $paymentMethod; |
94
|
|
|
|
95
|
|
|
/** |
96
|
|
|
* Because the fee can change on the payment method we have a field for here for the fee on this order |
97
|
|
|
* |
98
|
|
|
* @var integer|null |
99
|
|
|
* |
100
|
|
|
* @ORM\Column(type="integer", nullable=true) |
101
|
|
|
*/ |
102
|
|
|
protected $paymentMethodFee; |
103
|
|
|
|
104
|
|
|
/** |
105
|
|
|
* @var ShippingMethodInterface|null |
106
|
|
|
* |
107
|
|
|
* @ORM\JoinColumn(onDelete="SET NULL") |
108
|
|
|
* @ORM\ManyToOne(targetEntity="ShippingMethod", cascade={"persist", "remove"}) |
109
|
|
|
*/ |
110
|
|
|
protected $shippingMethod; |
111
|
|
|
|
112
|
|
|
/** |
113
|
|
|
* Because the fee can change on the shipping method we have a field for here for the fee on this order |
114
|
|
|
* |
115
|
|
|
* @var integer|null |
116
|
|
|
* |
117
|
|
|
* @ORM\Column(type="integer", nullable=true) |
118
|
|
|
*/ |
119
|
|
|
protected $shippingMethodFee; |
120
|
|
|
|
121
|
|
|
/** |
122
|
|
|
* @var SiteInterface|null |
123
|
|
|
* |
124
|
|
|
* @ORM\JoinColumn(onDelete="SET NULL") |
125
|
|
|
* @ORM\ManyToOne(targetEntity="Site", cascade={"persist", "remove"}) |
126
|
|
|
*/ |
127
|
|
|
protected $site; |
128
|
|
|
|
129
|
|
|
/** |
130
|
|
|
* @var StateInterface|null |
131
|
|
|
* |
132
|
|
|
* @ORM\JoinColumn(onDelete="SET NULL") |
133
|
|
|
* @ORM\ManyToOne(targetEntity="State", cascade={"persist", "remove"}) |
134
|
|
|
*/ |
135
|
|
|
protected $state; |
136
|
|
|
|
137
|
|
|
/** |
138
|
|
|
* @var string|null |
139
|
|
|
* |
140
|
|
|
* @ORM\Column(nullable=true, type="text") |
141
|
|
|
*/ |
142
|
|
|
protected $comment; |
143
|
|
|
|
144
|
|
|
/** |
145
|
|
|
* @var \DateTimeImmutable|null |
146
|
|
|
* |
147
|
|
|
* @ORM\Column(nullable=true, type="datetime_immutable", options={"comment"="Created info from Dandomain"}) |
148
|
|
|
*/ |
149
|
|
|
protected $createdDate; |
150
|
|
|
|
151
|
|
|
/** |
152
|
|
|
* @var string|null |
153
|
|
|
* |
154
|
|
|
* @ORM\Column(nullable=true, type="string", length=191) |
155
|
|
|
*/ |
156
|
|
|
protected $creditNoteNumber; |
157
|
|
|
|
158
|
|
|
/** |
159
|
|
|
* @var string|null |
160
|
|
|
* |
161
|
|
|
* @ORM\Column(type="string", length=3, nullable=true) |
162
|
|
|
*/ |
163
|
|
|
protected $currencyCode; |
164
|
|
|
|
165
|
|
|
/** |
166
|
|
|
* @var string|null |
167
|
|
|
* |
168
|
|
|
* @ORM\Column(nullable=true, type="text") |
169
|
|
|
*/ |
170
|
|
|
protected $customerComment; |
171
|
|
|
|
172
|
|
|
/** |
173
|
|
|
* @var integer|null |
174
|
|
|
* |
175
|
|
|
* @ORM\Column(type="integer", nullable=true) |
176
|
|
|
*/ |
177
|
|
|
protected $giftCertificateAmount; |
178
|
|
|
|
179
|
|
|
/** |
180
|
|
|
* @var string|null |
181
|
|
|
* |
182
|
|
|
* @ORM\Column(nullable=true, type="string", length=191) |
183
|
|
|
*/ |
184
|
|
|
protected $giftCertificateNumber; |
185
|
|
|
|
186
|
|
|
/** |
187
|
|
|
* @var bool|null |
188
|
|
|
* |
189
|
|
|
* @ORM\Column(type="boolean", nullable=true) |
190
|
|
|
*/ |
191
|
|
|
protected $incomplete; |
192
|
|
|
|
193
|
|
|
/** |
194
|
|
|
* @var string|null |
195
|
|
|
* |
196
|
|
|
* @ORM\Column(nullable=true, type="string", length=191) |
197
|
|
|
*/ |
198
|
|
|
protected $ip; |
199
|
|
|
|
200
|
|
|
/** |
201
|
|
|
* @var bool|null |
202
|
|
|
* |
203
|
|
|
* @ORM\Column(type="boolean", nullable=true) |
204
|
|
|
*/ |
205
|
|
|
protected $modified; |
206
|
|
|
|
207
|
|
|
/** |
208
|
|
|
* @var \DateTimeImmutable|null |
209
|
|
|
* |
210
|
|
|
* @ORM\Column(nullable=true, type="datetime_immutable", options={"comment"="Modified info from Dandomain"}) |
211
|
|
|
*/ |
212
|
|
|
protected $modifiedDate; |
213
|
|
|
|
214
|
|
|
/** |
215
|
|
|
* @var string|null |
216
|
|
|
* |
217
|
|
|
* @ORM\Column(nullable=true, type="string", length=191) |
218
|
|
|
*/ |
219
|
|
|
protected $referenceNumber; |
220
|
|
|
|
221
|
|
|
/** |
222
|
|
|
* @var string|null |
223
|
|
|
* |
224
|
|
|
* @ORM\Column(nullable=true, type="text") |
225
|
|
|
*/ |
226
|
|
|
protected $referrer; |
227
|
|
|
|
228
|
|
|
/** |
229
|
|
|
* @var string|null |
230
|
|
|
* |
231
|
|
|
* @ORM\Column(nullable=true, type="string", length=191) |
232
|
|
|
*/ |
233
|
|
|
protected $reservedField1; |
234
|
|
|
|
235
|
|
|
/** |
236
|
|
|
* @var string|null |
237
|
|
|
* |
238
|
|
|
* @ORM\Column(nullable=true, type="string", length=191) |
239
|
|
|
*/ |
240
|
|
|
protected $reservedField2; |
241
|
|
|
|
242
|
|
|
/** |
243
|
|
|
* @var string|null |
244
|
|
|
* |
245
|
|
|
* @ORM\Column(nullable=true, type="string", length=191) |
246
|
|
|
*/ |
247
|
|
|
protected $reservedField3; |
248
|
|
|
|
249
|
|
|
/** |
250
|
|
|
* @var string|null |
251
|
|
|
* |
252
|
|
|
* @ORM\Column(nullable=true, type="string", length=191) |
253
|
|
|
*/ |
254
|
|
|
protected $reservedField4; |
255
|
|
|
|
256
|
|
|
/** |
257
|
|
|
* @var string|null |
258
|
|
|
* |
259
|
|
|
* @ORM\Column(nullable=true, type="string", length=191) |
260
|
|
|
*/ |
261
|
|
|
protected $reservedField5; |
262
|
|
|
|
263
|
|
|
/** |
264
|
|
|
* @var int|null |
265
|
|
|
* |
266
|
|
|
* @ORM\Column(type="integer", nullable=true) |
267
|
|
|
*/ |
268
|
|
|
protected $salesDiscount; |
269
|
|
|
|
270
|
|
|
/** |
271
|
|
|
* This price is incl vat |
272
|
|
|
* |
273
|
|
|
* @var int|null |
274
|
|
|
* |
275
|
|
|
* @ORM\Column(type="integer", nullable=true) |
276
|
|
|
*/ |
277
|
|
|
protected $totalPrice; |
278
|
|
|
|
279
|
|
|
/** |
280
|
|
|
* @var float|null |
281
|
|
|
* |
282
|
|
|
* @ORM\Column(nullable=true, type="decimal", precision=12, scale=2) |
283
|
|
|
*/ |
284
|
|
|
protected $totalWeight; |
285
|
|
|
|
286
|
|
|
/** |
287
|
|
|
* @var string|null |
288
|
|
|
* |
289
|
|
|
* @ORM\Column(nullable=true, type="string", length=191) |
290
|
|
|
*/ |
291
|
|
|
protected $trackingNumber; |
292
|
|
|
|
293
|
|
|
/** |
294
|
|
|
* @var int|null |
295
|
|
|
* |
296
|
|
|
* @ORM\Column(nullable=true, type="string", length=191) |
297
|
|
|
*/ |
298
|
|
|
protected $transactionNumber; |
299
|
|
|
|
300
|
|
|
/** |
301
|
|
|
* @var float|null |
302
|
|
|
* |
303
|
|
|
* @ORM\Column(nullable=true, type="decimal", precision=5, scale=2) |
304
|
|
|
*/ |
305
|
|
|
protected $vatPct; |
306
|
|
|
|
307
|
|
|
/** |
308
|
|
|
* @var string|null |
309
|
|
|
* |
310
|
|
|
* @ORM\Column(nullable=true, type="string", length=191) |
311
|
|
|
*/ |
312
|
|
|
protected $vatRegNumber; |
313
|
|
|
|
314
|
|
|
/** |
315
|
|
|
* @var string|null |
316
|
|
|
* |
317
|
|
|
* @ORM\Column(nullable=true, type="text") |
318
|
|
|
*/ |
319
|
|
|
protected $xmlParams; |
320
|
|
|
|
321
|
|
|
public function __construct() |
322
|
|
|
{ |
323
|
|
|
$this->orderLines = new ArrayCollection(); |
324
|
|
|
} |
325
|
|
|
|
326
|
|
|
public function hydrate(array $data, bool $useConversions = false, $scalarsOnly = true) |
327
|
|
|
{ |
328
|
|
|
$currency = $data['currencyCode']; |
329
|
|
|
|
330
|
|
|
if (isset($data['totalPrice'])) { |
331
|
|
|
$data['totalPrice'] = DandomainFoundation\createMoneyFromFloat($currency, $data['totalPrice']); |
332
|
|
|
} |
333
|
|
|
|
334
|
|
|
if (isset($data['giftCertificateAmount'])) { |
335
|
|
|
$data['giftCertificateAmount'] = DandomainFoundation\createMoneyFromFloat($currency, $data['giftCertificateAmount']); |
336
|
|
|
} |
337
|
|
|
|
338
|
|
|
if (isset($data['salesDiscount'])) { |
339
|
|
|
$data['salesDiscount'] = DandomainFoundation\createMoneyFromFloat($currency, $data['salesDiscount']); |
340
|
|
|
} |
341
|
|
|
|
342
|
|
|
if (isset($data['paymentInfo']['fee'])) { |
343
|
|
|
$data['paymentMethodFee'] = DandomainFoundation\createMoneyFromFloat($currency, $data['paymentInfo']['fee']); |
344
|
|
|
} |
345
|
|
|
|
346
|
|
|
if (isset($data['shippingInfo']['fee'])) { |
347
|
|
|
$data['shippingMethodFee'] = DandomainFoundation\createMoneyFromFloat($currency, $data['shippingInfo']['fee']); |
348
|
|
|
} |
349
|
|
|
|
350
|
|
|
if ($data['createdDate']) { |
351
|
|
|
$data['createdDate'] = $this->getDateTimeFromJson($data['createdDate']); |
352
|
|
|
} |
353
|
|
|
|
354
|
|
|
if ($data['modifiedDate']) { |
355
|
|
|
$data['modifiedDate'] = $this->getDateTimeFromJson($data['modifiedDate']); |
356
|
|
|
} |
357
|
|
|
|
358
|
|
|
parent::hydrate($data, $useConversions, $scalarsOnly); |
359
|
|
|
} |
360
|
|
|
|
361
|
|
|
/* |
362
|
|
|
* Helper methods |
363
|
|
|
*/ |
364
|
|
|
public function getTotalPriceInclVat() : ?Money |
365
|
|
|
{ |
366
|
|
|
return $this->getTotalPrice(); |
367
|
|
|
} |
368
|
|
|
|
369
|
|
|
public function getTotalPriceExclVat() : ?Money |
370
|
|
|
{ |
371
|
|
|
$totalPrice = $this->getTotalPrice(); |
372
|
|
|
if(!$totalPrice) { |
373
|
|
|
return null; |
374
|
|
|
} |
375
|
|
|
|
376
|
|
|
$multiplier = 100 / (100 + $this->vatPct); |
377
|
|
|
|
378
|
|
|
return $totalPrice->multiply($multiplier); |
379
|
|
|
} |
380
|
|
|
|
381
|
|
|
public function totalPriceWithoutFees() : ?Money |
382
|
|
|
{ |
383
|
|
|
$totalPrice = $this->getTotalPrice(); |
384
|
|
|
if(!$totalPrice) { |
385
|
|
|
return null; |
386
|
|
|
} |
387
|
|
|
|
388
|
|
|
$paymentMethodFee = $this->getPaymentMethodFee(); |
389
|
|
|
if($paymentMethodFee) { |
390
|
|
|
$totalPrice = $totalPrice->subtract($paymentMethodFee); |
391
|
|
|
} |
392
|
|
|
|
393
|
|
|
$shippingMethodFee = $this->getShippingMethodFee(); |
394
|
|
|
if($shippingMethodFee) { |
395
|
|
|
$totalPrice = $totalPrice->subtract($shippingMethodFee); |
396
|
|
|
} |
397
|
|
|
|
398
|
|
|
return $totalPrice; |
399
|
|
|
} |
400
|
|
|
|
401
|
|
|
/* |
402
|
|
|
* Collection methods |
403
|
|
|
*/ |
404
|
|
|
public function addOrderLine(OrderLineInterface $orderLine) : OrderInterface |
405
|
|
|
{ |
406
|
|
|
if (!$this->hasOrderLine($orderLine)) { |
407
|
|
|
$this->orderLines->add($orderLine); |
408
|
|
|
$orderLine->setOrder($this); |
409
|
|
|
} |
410
|
|
|
|
411
|
|
|
return $this; |
412
|
|
|
} |
413
|
|
|
|
414
|
|
|
/** |
415
|
|
|
* @param OrderLineInterface|int $orderLine Either the OrderLineInterface or the external id |
416
|
|
|
* @return bool |
417
|
|
|
*/ |
418
|
|
|
public function hasOrderLine($orderLine) : bool |
419
|
|
|
{ |
420
|
|
|
if ($orderLine instanceof OrderLineInterface) { |
421
|
|
|
$orderLine = $orderLine->getExternalId(); |
422
|
|
|
} |
423
|
|
|
|
424
|
|
|
return $this->orderLines->exists(function ($key, OrderLineInterface $element) use ($orderLine) { |
425
|
|
|
return $element->getExternalId() === $orderLine; |
426
|
|
|
}); |
427
|
|
|
} |
428
|
|
|
|
429
|
|
|
public function removeOrderLine(OrderLineInterface $orderLine) : OrderInterface |
430
|
|
|
{ |
431
|
|
|
$this->orderLines->removeElement($orderLine); |
432
|
|
|
|
433
|
|
|
return $this; |
434
|
|
|
} |
435
|
|
|
|
436
|
|
|
public function clearOrderLines() : OrderInterface |
437
|
|
|
{ |
438
|
|
|
foreach ($this->orderLines as $orderLine) { |
439
|
|
|
$this->removeOrderLine($orderLine); |
440
|
|
|
} |
441
|
|
|
|
442
|
|
|
return $this; |
443
|
|
|
} |
444
|
|
|
|
445
|
|
|
/* |
446
|
|
|
* Getters / Setters |
447
|
|
|
*/ |
448
|
|
|
/** |
449
|
|
|
* @return Money|null |
450
|
|
|
*/ |
451
|
|
|
public function getTotalPrice() : ?Money |
452
|
|
|
{ |
453
|
|
|
return $this->createMoney((int)$this->totalPrice); |
454
|
|
|
} |
455
|
|
|
|
456
|
|
|
/** |
457
|
|
|
* @param Money $money |
458
|
|
|
* @return OrderInterface |
459
|
|
|
*/ |
460
|
|
|
public function setTotalPrice(Money $money = null) : OrderInterface |
461
|
|
|
{ |
462
|
|
|
$this->totalPrice = $money->getAmount(); |
|
|
|
|
463
|
|
|
|
464
|
|
|
return $this; |
465
|
|
|
} |
466
|
|
|
|
467
|
|
|
/** |
468
|
|
|
* @return Money|null |
469
|
|
|
*/ |
470
|
|
|
public function getSalesDiscount() : ?Money |
471
|
|
|
{ |
472
|
|
|
return $this->createMoney((int)$this->salesDiscount); |
473
|
|
|
} |
474
|
|
|
|
475
|
|
|
/** |
476
|
|
|
* @param Money $money |
477
|
|
|
* @return OrderInterface |
478
|
|
|
*/ |
479
|
|
|
public function setSalesDiscount(Money $money = null) : OrderInterface |
480
|
|
|
{ |
481
|
|
|
$this->salesDiscount = $money->getAmount(); |
|
|
|
|
482
|
|
|
|
483
|
|
|
return $this; |
484
|
|
|
} |
485
|
|
|
|
486
|
|
|
/** |
487
|
|
|
* @return Money|null |
488
|
|
|
*/ |
489
|
|
|
public function getGiftCertificateAmount() : ?Money |
490
|
|
|
{ |
491
|
|
|
return $this->createMoney((int)$this->giftCertificateAmount); |
492
|
|
|
} |
493
|
|
|
|
494
|
|
|
/** |
495
|
|
|
* @param Money $money |
496
|
|
|
* @return OrderInterface |
497
|
|
|
*/ |
498
|
|
|
public function setGiftCertificateAmount(Money $money = null) : OrderInterface |
499
|
|
|
{ |
500
|
|
|
$this->giftCertificateAmount = $money->getAmount(); |
|
|
|
|
501
|
|
|
|
502
|
|
|
return $this; |
503
|
|
|
} |
504
|
|
|
|
505
|
|
|
/** |
506
|
|
|
* @return Money|null |
507
|
|
|
*/ |
508
|
|
|
public function getShippingMethodFee() : ?Money |
509
|
|
|
{ |
510
|
|
|
return $this->createMoney((int)$this->shippingMethodFee); |
511
|
|
|
} |
512
|
|
|
|
513
|
|
|
/** |
514
|
|
|
* @param Money $money |
515
|
|
|
* @return OrderInterface |
516
|
|
|
*/ |
517
|
|
|
public function setShippingMethodFee(Money $money = null) : OrderInterface |
518
|
|
|
{ |
519
|
|
|
$this->shippingMethodFee = $money->getAmount(); |
|
|
|
|
520
|
|
|
|
521
|
|
|
return $this; |
522
|
|
|
} |
523
|
|
|
|
524
|
|
|
/** |
525
|
|
|
* @return Money|null |
526
|
|
|
*/ |
527
|
|
|
public function getPaymentMethodFee() : ?Money |
528
|
|
|
{ |
529
|
|
|
return $this->createMoney((int)$this->paymentMethodFee); |
530
|
|
|
} |
531
|
|
|
|
532
|
|
|
/** |
533
|
|
|
* @param Money $money |
534
|
|
|
* @return OrderInterface |
535
|
|
|
*/ |
536
|
|
|
public function setPaymentMethodFee(Money $money = null) : OrderInterface |
537
|
|
|
{ |
538
|
|
|
$this->paymentMethodFee = $money->getAmount(); |
|
|
|
|
539
|
|
|
|
540
|
|
|
return $this; |
541
|
|
|
} |
542
|
|
|
|
543
|
|
|
/** |
544
|
|
|
* @return int |
545
|
|
|
*/ |
546
|
|
|
public function getId(): int |
547
|
|
|
{ |
548
|
|
|
return (int)$this->id; |
549
|
|
|
} |
550
|
|
|
|
551
|
|
|
/** |
552
|
|
|
* @param int $id |
553
|
|
|
* @return OrderInterface |
554
|
|
|
*/ |
555
|
|
|
public function setId($id) |
556
|
|
|
{ |
557
|
|
|
$this->id = $id; |
558
|
|
|
return $this; |
559
|
|
|
} |
560
|
|
|
|
561
|
|
|
/** |
562
|
|
|
* @return int |
563
|
|
|
*/ |
564
|
|
|
public function getExternalId(): int |
565
|
|
|
{ |
566
|
|
|
return (int)$this->externalId; |
567
|
|
|
} |
568
|
|
|
|
569
|
|
|
/** |
570
|
|
|
* @param int $externalId |
571
|
|
|
* @return OrderInterface |
572
|
|
|
*/ |
573
|
|
|
public function setExternalId($externalId) |
574
|
|
|
{ |
575
|
|
|
$this->externalId = $externalId; |
576
|
|
|
return $this; |
577
|
|
|
} |
578
|
|
|
|
579
|
|
|
/** |
580
|
|
|
* @return CustomerInterface|null |
581
|
|
|
*/ |
582
|
|
|
public function getCustomer() |
583
|
|
|
{ |
584
|
|
|
return $this->customer; |
585
|
|
|
} |
586
|
|
|
|
587
|
|
|
/** |
588
|
|
|
* @param CustomerInterface|null $customer |
589
|
|
|
* @return OrderInterface |
590
|
|
|
*/ |
591
|
|
|
public function setCustomer($customer) |
592
|
|
|
{ |
593
|
|
|
$this->customer = $customer; |
594
|
|
|
return $this; |
595
|
|
|
} |
596
|
|
|
|
597
|
|
|
/** |
598
|
|
|
* @return DeliveryInterface|null |
599
|
|
|
*/ |
600
|
|
|
public function getDelivery() |
601
|
|
|
{ |
602
|
|
|
return $this->delivery; |
603
|
|
|
} |
604
|
|
|
|
605
|
|
|
/** |
606
|
|
|
* @param DeliveryInterface|null $delivery |
607
|
|
|
* @return OrderInterface |
608
|
|
|
*/ |
609
|
|
|
public function setDelivery($delivery) |
610
|
|
|
{ |
611
|
|
|
$this->delivery = $delivery; |
612
|
|
|
return $this; |
613
|
|
|
} |
614
|
|
|
|
615
|
|
|
/** |
616
|
|
|
* @return InvoiceInterface|null |
617
|
|
|
*/ |
618
|
|
|
public function getInvoice() |
619
|
|
|
{ |
620
|
|
|
return $this->invoice; |
621
|
|
|
} |
622
|
|
|
|
623
|
|
|
/** |
624
|
|
|
* @param InvoiceInterface|null $invoice |
625
|
|
|
* @return OrderInterface |
626
|
|
|
*/ |
627
|
|
|
public function setInvoice($invoice) |
628
|
|
|
{ |
629
|
|
|
$this->invoice = $invoice; |
630
|
|
|
return $this; |
631
|
|
|
} |
632
|
|
|
|
633
|
|
|
/** |
634
|
|
|
* @return ArrayCollection|null |
635
|
|
|
*/ |
636
|
|
|
public function getOrderLines() |
637
|
|
|
{ |
638
|
|
|
return $this->orderLines; |
639
|
|
|
} |
640
|
|
|
|
641
|
|
|
/** |
642
|
|
|
* @param ArrayCollection|null $orderLines |
643
|
|
|
* @return OrderInterface |
644
|
|
|
*/ |
645
|
|
|
public function setOrderLines($orderLines) |
646
|
|
|
{ |
647
|
|
|
$this->orderLines = $orderLines; |
648
|
|
|
return $this; |
649
|
|
|
} |
650
|
|
|
|
651
|
|
|
/** |
652
|
|
|
* @return PaymentMethodInterface|null |
653
|
|
|
*/ |
654
|
|
|
public function getPaymentMethod() |
655
|
|
|
{ |
656
|
|
|
return $this->paymentMethod; |
657
|
|
|
} |
658
|
|
|
|
659
|
|
|
/** |
660
|
|
|
* @param PaymentMethodInterface|null $paymentMethod |
661
|
|
|
* @return OrderInterface |
662
|
|
|
*/ |
663
|
|
|
public function setPaymentMethod($paymentMethod) |
664
|
|
|
{ |
665
|
|
|
$this->paymentMethod = $paymentMethod; |
666
|
|
|
return $this; |
667
|
|
|
} |
668
|
|
|
|
669
|
|
|
/** |
670
|
|
|
* @return ShippingMethodInterface|null |
671
|
|
|
*/ |
672
|
|
|
public function getShippingMethod() |
673
|
|
|
{ |
674
|
|
|
return $this->shippingMethod; |
675
|
|
|
} |
676
|
|
|
|
677
|
|
|
/** |
678
|
|
|
* @param ShippingMethodInterface|null $shippingMethod |
679
|
|
|
* @return OrderInterface |
680
|
|
|
*/ |
681
|
|
|
public function setShippingMethod($shippingMethod) |
682
|
|
|
{ |
683
|
|
|
$this->shippingMethod = $shippingMethod; |
684
|
|
|
return $this; |
685
|
|
|
} |
686
|
|
|
|
687
|
|
|
/** |
688
|
|
|
* @return SiteInterface|null |
689
|
|
|
*/ |
690
|
|
|
public function getSite() |
691
|
|
|
{ |
692
|
|
|
return $this->site; |
693
|
|
|
} |
694
|
|
|
|
695
|
|
|
/** |
696
|
|
|
* @param SiteInterface|null $site |
697
|
|
|
* @return OrderInterface |
698
|
|
|
*/ |
699
|
|
|
public function setSite($site) |
700
|
|
|
{ |
701
|
|
|
$this->site = $site; |
702
|
|
|
return $this; |
703
|
|
|
} |
704
|
|
|
|
705
|
|
|
/** |
706
|
|
|
* @return StateInterface|null |
707
|
|
|
*/ |
708
|
|
|
public function getState() |
709
|
|
|
{ |
710
|
|
|
return $this->state; |
711
|
|
|
} |
712
|
|
|
|
713
|
|
|
/** |
714
|
|
|
* @param StateInterface|null $state |
715
|
|
|
* @return OrderInterface |
716
|
|
|
*/ |
717
|
|
|
public function setState($state) |
718
|
|
|
{ |
719
|
|
|
$this->state = $state; |
720
|
|
|
return $this; |
721
|
|
|
} |
722
|
|
|
|
723
|
|
|
/** |
724
|
|
|
* @return null|string |
725
|
|
|
*/ |
726
|
|
|
public function getComment() |
727
|
|
|
{ |
728
|
|
|
return $this->comment; |
729
|
|
|
} |
730
|
|
|
|
731
|
|
|
/** |
732
|
|
|
* @param null|string $comment |
733
|
|
|
* @return OrderInterface |
734
|
|
|
*/ |
735
|
|
|
public function setComment($comment) |
736
|
|
|
{ |
737
|
|
|
$this->comment = $comment; |
738
|
|
|
return $this; |
739
|
|
|
} |
740
|
|
|
|
741
|
|
|
/** |
742
|
|
|
* @return \DateTimeImmutable|null |
743
|
|
|
*/ |
744
|
|
|
public function getCreatedDate() |
745
|
|
|
{ |
746
|
|
|
return $this->createdDate; |
747
|
|
|
} |
748
|
|
|
|
749
|
|
|
/** |
750
|
|
|
* @param \DateTimeImmutable|null $createdDate |
751
|
|
|
* @return OrderInterface |
752
|
|
|
*/ |
753
|
|
|
public function setCreatedDate($createdDate) |
754
|
|
|
{ |
755
|
|
|
$this->createdDate = $createdDate; |
756
|
|
|
return $this; |
757
|
|
|
} |
758
|
|
|
|
759
|
|
|
/** |
760
|
|
|
* @return null|string |
761
|
|
|
*/ |
762
|
|
|
public function getCreditNoteNumber() |
763
|
|
|
{ |
764
|
|
|
return $this->creditNoteNumber; |
765
|
|
|
} |
766
|
|
|
|
767
|
|
|
/** |
768
|
|
|
* @param null|string $creditNoteNumber |
769
|
|
|
* @return Order |
770
|
|
|
*/ |
771
|
|
|
public function setCreditNoteNumber($creditNoteNumber) |
772
|
|
|
{ |
773
|
|
|
$this->creditNoteNumber = $creditNoteNumber; |
774
|
|
|
return $this; |
775
|
|
|
} |
776
|
|
|
|
777
|
|
|
/** |
778
|
|
|
* @return null|string |
779
|
|
|
*/ |
780
|
|
|
public function getCurrencyCode() |
781
|
|
|
{ |
782
|
|
|
return $this->currencyCode; |
783
|
|
|
} |
784
|
|
|
|
785
|
|
|
/** |
786
|
|
|
* @param null|string $currencyCode |
787
|
|
|
* @return OrderInterface |
788
|
|
|
*/ |
789
|
|
|
public function setCurrencyCode($currencyCode) |
790
|
|
|
{ |
791
|
|
|
$this->currencyCode = $currencyCode; |
792
|
|
|
return $this; |
793
|
|
|
} |
794
|
|
|
|
795
|
|
|
/** |
796
|
|
|
* @return null|string |
797
|
|
|
*/ |
798
|
|
|
public function getCustomerComment() |
799
|
|
|
{ |
800
|
|
|
return $this->customerComment; |
801
|
|
|
} |
802
|
|
|
|
803
|
|
|
/** |
804
|
|
|
* @param null|string $customerComment |
805
|
|
|
* @return OrderInterface |
806
|
|
|
*/ |
807
|
|
|
public function setCustomerComment($customerComment) |
808
|
|
|
{ |
809
|
|
|
$this->customerComment = $customerComment; |
810
|
|
|
return $this; |
811
|
|
|
} |
812
|
|
|
|
813
|
|
|
/** |
814
|
|
|
* @return null|string |
815
|
|
|
*/ |
816
|
|
|
public function getGiftCertificateNumber() |
817
|
|
|
{ |
818
|
|
|
return $this->giftCertificateNumber; |
819
|
|
|
} |
820
|
|
|
|
821
|
|
|
/** |
822
|
|
|
* @param null|string $giftCertificateNumber |
823
|
|
|
* @return OrderInterface |
824
|
|
|
*/ |
825
|
|
|
public function setGiftCertificateNumber($giftCertificateNumber) |
826
|
|
|
{ |
827
|
|
|
$this->giftCertificateNumber = $giftCertificateNumber; |
828
|
|
|
return $this; |
829
|
|
|
} |
830
|
|
|
|
831
|
|
|
/** |
832
|
|
|
* @return bool|null |
833
|
|
|
*/ |
834
|
|
|
public function getIncomplete() |
835
|
|
|
{ |
836
|
|
|
return $this->incomplete; |
837
|
|
|
} |
838
|
|
|
|
839
|
|
|
/** |
840
|
|
|
* @param bool|null $incomplete |
841
|
|
|
* @return OrderInterface |
842
|
|
|
*/ |
843
|
|
|
public function setIncomplete($incomplete) |
844
|
|
|
{ |
845
|
|
|
$this->incomplete = $incomplete; |
846
|
|
|
return $this; |
847
|
|
|
} |
848
|
|
|
|
849
|
|
|
/** |
850
|
|
|
* @return null|string |
851
|
|
|
*/ |
852
|
|
|
public function getIp() |
853
|
|
|
{ |
854
|
|
|
return $this->ip; |
855
|
|
|
} |
856
|
|
|
|
857
|
|
|
/** |
858
|
|
|
* @param null|string $ip |
859
|
|
|
* @return OrderInterface |
860
|
|
|
*/ |
861
|
|
|
public function setIp($ip) |
862
|
|
|
{ |
863
|
|
|
$this->ip = $ip; |
864
|
|
|
return $this; |
865
|
|
|
} |
866
|
|
|
|
867
|
|
|
/** |
868
|
|
|
* @return bool|null |
869
|
|
|
*/ |
870
|
|
|
public function getModified() |
871
|
|
|
{ |
872
|
|
|
return $this->modified; |
873
|
|
|
} |
874
|
|
|
|
875
|
|
|
/** |
876
|
|
|
* @param bool|null $modified |
877
|
|
|
* @return OrderInterface |
878
|
|
|
*/ |
879
|
|
|
public function setModified($modified) |
880
|
|
|
{ |
881
|
|
|
$this->modified = $modified; |
882
|
|
|
return $this; |
883
|
|
|
} |
884
|
|
|
|
885
|
|
|
/** |
886
|
|
|
* @return \DateTimeImmutable|null |
887
|
|
|
*/ |
888
|
|
|
public function getModifiedDate() |
889
|
|
|
{ |
890
|
|
|
return $this->modifiedDate; |
891
|
|
|
} |
892
|
|
|
|
893
|
|
|
/** |
894
|
|
|
* @param \DateTimeImmutable|null $modifiedDate |
895
|
|
|
* @return OrderInterface |
896
|
|
|
*/ |
897
|
|
|
public function setModifiedDate($modifiedDate) |
898
|
|
|
{ |
899
|
|
|
$this->modifiedDate = $modifiedDate; |
900
|
|
|
return $this; |
901
|
|
|
} |
902
|
|
|
|
903
|
|
|
/** |
904
|
|
|
* @return null|string |
905
|
|
|
*/ |
906
|
|
|
public function getReferenceNumber() |
907
|
|
|
{ |
908
|
|
|
return $this->referenceNumber; |
909
|
|
|
} |
910
|
|
|
|
911
|
|
|
/** |
912
|
|
|
* @param null|string $referenceNumber |
913
|
|
|
* @return OrderInterface |
914
|
|
|
*/ |
915
|
|
|
public function setReferenceNumber($referenceNumber) |
916
|
|
|
{ |
917
|
|
|
$this->referenceNumber = $referenceNumber; |
918
|
|
|
return $this; |
919
|
|
|
} |
920
|
|
|
|
921
|
|
|
/** |
922
|
|
|
* @return null|string |
923
|
|
|
*/ |
924
|
|
|
public function getReferrer() |
925
|
|
|
{ |
926
|
|
|
return $this->referrer; |
927
|
|
|
} |
928
|
|
|
|
929
|
|
|
/** |
930
|
|
|
* @param null|string $referrer |
931
|
|
|
* @return OrderInterface |
932
|
|
|
*/ |
933
|
|
|
public function setReferrer($referrer) |
934
|
|
|
{ |
935
|
|
|
$this->referrer = $referrer; |
936
|
|
|
return $this; |
937
|
|
|
} |
938
|
|
|
|
939
|
|
|
/** |
940
|
|
|
* @return null|string |
941
|
|
|
*/ |
942
|
|
|
public function getReservedField1() |
943
|
|
|
{ |
944
|
|
|
return $this->reservedField1; |
945
|
|
|
} |
946
|
|
|
|
947
|
|
|
/** |
948
|
|
|
* @param null|string $reservedField1 |
949
|
|
|
* @return OrderInterface |
950
|
|
|
*/ |
951
|
|
|
public function setReservedField1($reservedField1) |
952
|
|
|
{ |
953
|
|
|
$this->reservedField1 = $reservedField1; |
954
|
|
|
return $this; |
955
|
|
|
} |
956
|
|
|
|
957
|
|
|
/** |
958
|
|
|
* @return null|string |
959
|
|
|
*/ |
960
|
|
|
public function getReservedField2() |
961
|
|
|
{ |
962
|
|
|
return $this->reservedField2; |
963
|
|
|
} |
964
|
|
|
|
965
|
|
|
/** |
966
|
|
|
* @param null|string $reservedField2 |
967
|
|
|
* @return OrderInterface |
968
|
|
|
*/ |
969
|
|
|
public function setReservedField2($reservedField2) |
970
|
|
|
{ |
971
|
|
|
$this->reservedField2 = $reservedField2; |
972
|
|
|
return $this; |
973
|
|
|
} |
974
|
|
|
|
975
|
|
|
/** |
976
|
|
|
* @return null|string |
977
|
|
|
*/ |
978
|
|
|
public function getReservedField3() |
979
|
|
|
{ |
980
|
|
|
return $this->reservedField3; |
981
|
|
|
} |
982
|
|
|
|
983
|
|
|
/** |
984
|
|
|
* @param null|string $reservedField3 |
985
|
|
|
* @return OrderInterface |
986
|
|
|
*/ |
987
|
|
|
public function setReservedField3($reservedField3) |
988
|
|
|
{ |
989
|
|
|
$this->reservedField3 = $reservedField3; |
990
|
|
|
return $this; |
991
|
|
|
} |
992
|
|
|
|
993
|
|
|
/** |
994
|
|
|
* @return null|string |
995
|
|
|
*/ |
996
|
|
|
public function getReservedField4() |
997
|
|
|
{ |
998
|
|
|
return $this->reservedField4; |
999
|
|
|
} |
1000
|
|
|
|
1001
|
|
|
/** |
1002
|
|
|
* @param null|string $reservedField4 |
1003
|
|
|
* @return OrderInterface |
1004
|
|
|
*/ |
1005
|
|
|
public function setReservedField4($reservedField4) |
1006
|
|
|
{ |
1007
|
|
|
$this->reservedField4 = $reservedField4; |
1008
|
|
|
return $this; |
1009
|
|
|
} |
1010
|
|
|
|
1011
|
|
|
/** |
1012
|
|
|
* @return null|string |
1013
|
|
|
*/ |
1014
|
|
|
public function getReservedField5() |
1015
|
|
|
{ |
1016
|
|
|
return $this->reservedField5; |
1017
|
|
|
} |
1018
|
|
|
|
1019
|
|
|
/** |
1020
|
|
|
* @param null|string $reservedField5 |
1021
|
|
|
* @return OrderInterface |
1022
|
|
|
*/ |
1023
|
|
|
public function setReservedField5($reservedField5) |
1024
|
|
|
{ |
1025
|
|
|
$this->reservedField5 = $reservedField5; |
1026
|
|
|
return $this; |
1027
|
|
|
} |
1028
|
|
|
|
1029
|
|
|
/** |
1030
|
|
|
* @return float|null |
1031
|
|
|
*/ |
1032
|
|
|
public function getTotalWeight() |
1033
|
|
|
{ |
1034
|
|
|
return $this->totalWeight; |
1035
|
|
|
} |
1036
|
|
|
|
1037
|
|
|
/** |
1038
|
|
|
* @param float|null $totalWeight |
1039
|
|
|
* @return OrderInterface |
1040
|
|
|
*/ |
1041
|
|
|
public function setTotalWeight($totalWeight) |
1042
|
|
|
{ |
1043
|
|
|
$this->totalWeight = $totalWeight; |
1044
|
|
|
return $this; |
1045
|
|
|
} |
1046
|
|
|
|
1047
|
|
|
/** |
1048
|
|
|
* @return null|string |
1049
|
|
|
*/ |
1050
|
|
|
public function getTrackingNumber() |
1051
|
|
|
{ |
1052
|
|
|
return $this->trackingNumber; |
1053
|
|
|
} |
1054
|
|
|
|
1055
|
|
|
/** |
1056
|
|
|
* @param null|string $trackingNumber |
1057
|
|
|
* @return OrderInterface |
1058
|
|
|
*/ |
1059
|
|
|
public function setTrackingNumber($trackingNumber) |
1060
|
|
|
{ |
1061
|
|
|
$this->trackingNumber = $trackingNumber; |
1062
|
|
|
return $this; |
1063
|
|
|
} |
1064
|
|
|
|
1065
|
|
|
/** |
1066
|
|
|
* @return int|null |
1067
|
|
|
*/ |
1068
|
|
|
public function getTransactionNumber() |
1069
|
|
|
{ |
1070
|
|
|
return $this->transactionNumber; |
1071
|
|
|
} |
1072
|
|
|
|
1073
|
|
|
/** |
1074
|
|
|
* @param int|null $transactionNumber |
1075
|
|
|
* @return OrderInterface |
1076
|
|
|
*/ |
1077
|
|
|
public function setTransactionNumber($transactionNumber) |
1078
|
|
|
{ |
1079
|
|
|
$this->transactionNumber = $transactionNumber; |
1080
|
|
|
return $this; |
1081
|
|
|
} |
1082
|
|
|
|
1083
|
|
|
/** |
1084
|
|
|
* @return float|null |
1085
|
|
|
*/ |
1086
|
|
|
public function getVatPct() |
1087
|
|
|
{ |
1088
|
|
|
return $this->vatPct; |
1089
|
|
|
} |
1090
|
|
|
|
1091
|
|
|
/** |
1092
|
|
|
* @param float|null $vatPct |
1093
|
|
|
* @return OrderInterface |
1094
|
|
|
*/ |
1095
|
|
|
public function setVatPct($vatPct) |
1096
|
|
|
{ |
1097
|
|
|
$this->vatPct = $vatPct; |
1098
|
|
|
return $this; |
1099
|
|
|
} |
1100
|
|
|
|
1101
|
|
|
/** |
1102
|
|
|
* @return null|string |
1103
|
|
|
*/ |
1104
|
|
|
public function getVatRegNumber() |
1105
|
|
|
{ |
1106
|
|
|
return $this->vatRegNumber; |
1107
|
|
|
} |
1108
|
|
|
|
1109
|
|
|
/** |
1110
|
|
|
* @param null|string $vatRegNumber |
1111
|
|
|
* @return OrderInterface |
1112
|
|
|
*/ |
1113
|
|
|
public function setVatRegNumber($vatRegNumber) |
1114
|
|
|
{ |
1115
|
|
|
$this->vatRegNumber = $vatRegNumber; |
1116
|
|
|
return $this; |
1117
|
|
|
} |
1118
|
|
|
|
1119
|
|
|
/** |
1120
|
|
|
* @return null|string |
1121
|
|
|
*/ |
1122
|
|
|
public function getXmlParams() |
1123
|
|
|
{ |
1124
|
|
|
return $this->xmlParams; |
1125
|
|
|
} |
1126
|
|
|
|
1127
|
|
|
/** |
1128
|
|
|
* @param null|string $xmlParams |
1129
|
|
|
* @return OrderInterface |
1130
|
|
|
*/ |
1131
|
|
|
public function setXmlParams($xmlParams) |
1132
|
|
|
{ |
1133
|
|
|
$this->xmlParams = $xmlParams; |
1134
|
|
|
return $this; |
1135
|
|
|
} |
1136
|
|
|
|
1137
|
|
|
/** |
1138
|
|
|
* A helper method for creating a Money object from a float based on the shared currency |
1139
|
|
|
* |
1140
|
|
|
* @param int $amount |
1141
|
|
|
* @return Money|null |
1142
|
|
|
*/ |
1143
|
|
|
private function createMoney(int $amount = 0) : ?Money |
1144
|
|
|
{ |
1145
|
|
|
return DandomainFoundation\createMoney((string)$this->currencyCode, $amount); |
1146
|
|
|
} |
1147
|
|
|
} |
1148
|
|
|
|
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