Completed
Push — master ( ad1942...52091d )
by Joachim
15:28
created

Order::hydrate()   D

Complexity

Conditions 8
Paths 128

Size

Total Lines 33
Code Lines 16

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
cc 8
eloc 16
nc 128
nop 3
dl 0
loc 33
rs 4.6666
c 0
b 0
f 0
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;
0 ignored issues
show
Bug introduced by
The type Loevgaard\DandomainFound...rated\CustomerInterface was not found. Maybe you did not declare it correctly or list all dependencies?

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:

filter:
    dependency_paths: ["lib/*"]

For further information see https://scrutinizer-ci.com/docs/tools/php/php-scrutinizer/#list-dependency-paths

Loading history...
11
use Loevgaard\DandomainFoundation\Entity\Generated\DeliveryInterface;
0 ignored issues
show
Bug introduced by
The type Loevgaard\DandomainFound...rated\DeliveryInterface was not found. Maybe you did not declare it correctly or list all dependencies?

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:

filter:
    dependency_paths: ["lib/*"]

For further information see https://scrutinizer-ci.com/docs/tools/php/php-scrutinizer/#list-dependency-paths

Loading history...
12
use Loevgaard\DandomainFoundation\Entity\Generated\InvoiceInterface;
0 ignored issues
show
Bug introduced by
The type Loevgaard\DandomainFound...erated\InvoiceInterface was not found. Maybe you did not declare it correctly or list all dependencies?

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:

filter:
    dependency_paths: ["lib/*"]

For further information see https://scrutinizer-ci.com/docs/tools/php/php-scrutinizer/#list-dependency-paths

Loading history...
13
use Loevgaard\DandomainFoundation\Entity\Generated\OrderInterface;
0 ignored issues
show
Bug introduced by
The type Loevgaard\DandomainFound...enerated\OrderInterface was not found. Maybe you did not declare it correctly or list all dependencies?

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:

filter:
    dependency_paths: ["lib/*"]

For further information see https://scrutinizer-ci.com/docs/tools/php/php-scrutinizer/#list-dependency-paths

Loading history...
14
use Loevgaard\DandomainFoundation\Entity\Generated\OrderLineInterface;
0 ignored issues
show
Bug introduced by
The type Loevgaard\DandomainFound...ated\OrderLineInterface was not found. Maybe you did not declare it correctly or list all dependencies?

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:

filter:
    dependency_paths: ["lib/*"]

For further information see https://scrutinizer-ci.com/docs/tools/php/php-scrutinizer/#list-dependency-paths

Loading history...
15
use Loevgaard\DandomainFoundation\Entity\Generated\OrderTrait;
0 ignored issues
show
Bug introduced by
The type Loevgaard\DandomainFound...ty\Generated\OrderTrait was not found. Maybe you did not declare it correctly or list all dependencies?

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:

filter:
    dependency_paths: ["lib/*"]

For further information see https://scrutinizer-ci.com/docs/tools/php/php-scrutinizer/#list-dependency-paths

Loading history...
16
use Loevgaard\DandomainFoundation\Entity\Generated\PaymentMethodInterface;
0 ignored issues
show
Bug introduced by
The type Loevgaard\DandomainFound...\PaymentMethodInterface was not found. Maybe you did not declare it correctly or list all dependencies?

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:

filter:
    dependency_paths: ["lib/*"]

For further information see https://scrutinizer-ci.com/docs/tools/php/php-scrutinizer/#list-dependency-paths

Loading history...
17
use Loevgaard\DandomainFoundation\Entity\Generated\ShippingMethodInterface;
0 ignored issues
show
Bug introduced by
The type Loevgaard\DandomainFound...ShippingMethodInterface was not found. Maybe you did not declare it correctly or list all dependencies?

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:

filter:
    dependency_paths: ["lib/*"]

For further information see https://scrutinizer-ci.com/docs/tools/php/php-scrutinizer/#list-dependency-paths

Loading history...
18
use Loevgaard\DandomainFoundation\Entity\Generated\SiteInterface;
0 ignored issues
show
Bug introduced by
The type Loevgaard\DandomainFound...Generated\SiteInterface was not found. Maybe you did not declare it correctly or list all dependencies?

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:

filter:
    dependency_paths: ["lib/*"]

For further information see https://scrutinizer-ci.com/docs/tools/php/php-scrutinizer/#list-dependency-paths

Loading history...
19
use Loevgaard\DandomainFoundation\Entity\Generated\StateInterface;
0 ignored issues
show
Bug introduced by
The type Loevgaard\DandomainFound...enerated\StateInterface was not found. Maybe you did not declare it correctly or list all dependencies?

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:

filter:
    dependency_paths: ["lib/*"]

For further information see https://scrutinizer-ci.com/docs/tools/php/php-scrutinizer/#list-dependency-paths

Loading history...
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
     * @var int|null
272
     *
273
     * @ORM\Column(type="integer", nullable=true)
274
     */
275
    protected $totalPrice;
276
277
    /**
278
     * @var float|null
279
     *
280
     * @ORM\Column(nullable=true, type="decimal", precision=12, scale=2)
281
     */
282
    protected $totalWeight;
283
284
    /**
285
     * @var string|null
286
     *
287
     * @ORM\Column(nullable=true, type="string", length=191)
288
     */
289
    protected $trackingNumber;
290
291
    /**
292
     * @var int|null
293
     *
294
     * @ORM\Column(nullable=true, type="string", length=191)
295
     */
296
    protected $transactionNumber;
297
298
    /**
299
     * @var float|null
300
     *
301
     * @ORM\Column(nullable=true, type="decimal", precision=5, scale=2)
302
     */
303
    protected $vatPct;
304
305
    /**
306
     * @var string|null
307
     *
308
     * @ORM\Column(nullable=true, type="string", length=191)
309
     */
310
    protected $vatRegNumber;
311
312
    /**
313
     * @var string|null
314
     *
315
     * @ORM\Column(nullable=true, type="text")
316
     */
317
    protected $xmlParams;
318
319
    public function __construct()
320
    {
321
        $this->orderLines = new ArrayCollection();
322
    }
323
324
    public function hydrate(array $data, bool $useConversions = false, $scalarsOnly = true)
325
    {
326
        $currency = $data['currencyCode'];
327
328
        if (isset($data['totalPrice'])) {
329
            $data['totalPrice'] = DandomainFoundation\createMoneyFromFloat($currency, $data['totalPrice']);
330
        }
331
332
        if (isset($data['giftCertificateAmount'])) {
333
            $data['giftCertificateAmount'] = DandomainFoundation\createMoneyFromFloat($currency, $data['giftCertificateAmount']);
334
        }
335
336
        if (isset($data['salesDiscount'])) {
337
            $data['salesDiscount'] = DandomainFoundation\createMoneyFromFloat($currency, $data['salesDiscount']);
338
        }
339
340
        if (isset($data['paymentInfo']['fee'])) {
341
            $data['paymentMethodFee'] = DandomainFoundation\createMoneyFromFloat($currency, $data['paymentInfo']['fee']);
342
        }
343
344
        if (isset($data['shippingInfo']['fee'])) {
345
            $data['shippingMethodFee'] = DandomainFoundation\createMoneyFromFloat($currency, $data['shippingInfo']['fee']);
346
        }
347
348
        if ($data['createdDate']) {
349
            $data['createdDate'] = $this->getDateTimeFromJson($data['createdDate']);
350
        }
351
352
        if ($data['modifiedDate']) {
353
            $data['modifiedDate'] = $this->getDateTimeFromJson($data['modifiedDate']);
354
        }
355
356
        parent::hydrate($data, $useConversions, $scalarsOnly);
357
    }
358
359
    /*
360
     * Collection methods
361
     */
362
    public function addOrderLine(OrderLineInterface $orderLine) : OrderInterface
363
    {
364
        if (!$this->hasOrderLine($orderLine)) {
365
            $this->orderLines->add($orderLine);
366
            $orderLine->setOrder($this);
367
        }
368
369
        return $this;
370
    }
371
372
    /**
373
     * @param OrderLineInterface|int $orderLine Either the OrderLineInterface or the external id
374
     * @return bool
375
     */
376
    public function hasOrderLine($orderLine) : bool
377
    {
378
        if ($orderLine instanceof OrderLineInterface) {
379
            $orderLine = $orderLine->getExternalId();
380
        }
381
382
        return $this->orderLines->exists(function ($key, OrderLineInterface $element) use ($orderLine) {
383
            return $element->getExternalId() === $orderLine;
384
        });
385
    }
386
387
    public function removeOrderLine(OrderLineInterface $orderLine) : OrderInterface
388
    {
389
        $this->orderLines->removeElement($orderLine);
390
391
        return $this;
392
    }
393
394
    public function clearOrderLines() : OrderInterface
395
    {
396
        foreach ($this->orderLines as $orderLine) {
397
            $this->removeOrderLine($orderLine);
398
        }
399
400
        return $this;
401
    }
402
403
    /*
404
     * Getters / Setters
405
     */
406
    /**
407
     * @return Money|null
408
     */
409
    public function getTotalPrice() : ?Money
410
    {
411
        return $this->createMoney((int)$this->totalPrice);
412
    }
413
414
    /**
415
     * @param Money $money
416
     * @return OrderInterface
417
     */
418
    public function setTotalPrice(Money $money = null) : OrderInterface
419
    {
420
        $this->totalPrice = $money->getAmount();
0 ignored issues
show
Documentation Bug introduced by
It seems like $money->getAmount() of type string is incompatible with the declared type null|integer of property $totalPrice.

Our type inference engine has found an assignment to a property that is incompatible with the declared type of that property.

Either this assignment is in error or the assigned type should be added to the documentation/type hint for that property..

Loading history...
Bug introduced by
The method getAmount() does not exist on null. ( Ignorable by Annotation )

If this is a false-positive, you can also ignore this issue in your code via the ignore-call  annotation

420
        /** @scrutinizer ignore-call */ 
421
        $this->totalPrice = $money->getAmount();

This check looks for calls to methods that do not seem to exist on a given type. It looks for the method on the type itself as well as in inherited classes or implemented interfaces.

This is most likely a typographical error or the method has been renamed.

Loading history...
421
422
        return $this;
423
    }
424
425
    /**
426
     * @return Money|null
427
     */
428
    public function getSalesDiscount() : ?Money
429
    {
430
        return $this->createMoney((int)$this->salesDiscount);
431
    }
432
433
    /**
434
     * @param Money $money
435
     * @return OrderInterface
436
     */
437
    public function setSalesDiscount(Money $money = null) : OrderInterface
438
    {
439
        $this->salesDiscount = $money->getAmount();
0 ignored issues
show
Documentation Bug introduced by
It seems like $money->getAmount() of type string is incompatible with the declared type null|integer of property $salesDiscount.

Our type inference engine has found an assignment to a property that is incompatible with the declared type of that property.

Either this assignment is in error or the assigned type should be added to the documentation/type hint for that property..

Loading history...
440
441
        return $this;
442
    }
443
444
    /**
445
     * @return Money|null
446
     */
447
    public function getGiftCertificateAmount() : ?Money
448
    {
449
        return $this->createMoney((int)$this->giftCertificateAmount);
450
    }
451
452
    /**
453
     * @param Money $money
454
     * @return OrderInterface
455
     */
456
    public function setGiftCertificateAmount(Money $money = null) : OrderInterface
457
    {
458
        $this->giftCertificateAmount = $money->getAmount();
0 ignored issues
show
Documentation Bug introduced by
It seems like $money->getAmount() of type string is incompatible with the declared type null|integer of property $giftCertificateAmount.

Our type inference engine has found an assignment to a property that is incompatible with the declared type of that property.

Either this assignment is in error or the assigned type should be added to the documentation/type hint for that property..

Loading history...
459
460
        return $this;
461
    }
462
463
    /**
464
     * @return Money|null
465
     */
466
    public function getShippingMethodFee() : ?Money
467
    {
468
        return $this->createMoney((int)$this->shippingMethodFee);
469
    }
470
471
    /**
472
     * @param Money $money
473
     * @return OrderInterface
474
     */
475
    public function setShippingMethodFee(Money $money = null) : OrderInterface
476
    {
477
        $this->shippingMethodFee = $money->getAmount();
0 ignored issues
show
Documentation Bug introduced by
It seems like $money->getAmount() of type string is incompatible with the declared type null|integer of property $shippingMethodFee.

Our type inference engine has found an assignment to a property that is incompatible with the declared type of that property.

Either this assignment is in error or the assigned type should be added to the documentation/type hint for that property..

Loading history...
478
479
        return $this;
480
    }
481
482
    /**
483
     * @return Money|null
484
     */
485
    public function getPaymentMethodFee() : ?Money
486
    {
487
        return $this->createMoney((int)$this->paymentMethodFee);
488
    }
489
490
    /**
491
     * @param Money $money
492
     * @return OrderInterface
493
     */
494
    public function setPaymentMethodFee(Money $money = null) : OrderInterface
495
    {
496
        $this->paymentMethodFee = $money->getAmount();
0 ignored issues
show
Documentation Bug introduced by
It seems like $money->getAmount() of type string is incompatible with the declared type null|integer of property $paymentMethodFee.

Our type inference engine has found an assignment to a property that is incompatible with the declared type of that property.

Either this assignment is in error or the assigned type should be added to the documentation/type hint for that property..

Loading history...
497
498
        return $this;
499
    }
500
501
    /**
502
     * @return int
503
     */
504
    public function getId(): int
505
    {
506
        return (int)$this->id;
507
    }
508
509
    /**
510
     * @param int $id
511
     * @return OrderInterface
512
     */
513
    public function setId($id)
514
    {
515
        $this->id = $id;
516
        return $this;
517
    }
518
519
    /**
520
     * @return int
521
     */
522
    public function getExternalId(): int
523
    {
524
        return (int)$this->externalId;
525
    }
526
527
    /**
528
     * @param int $externalId
529
     * @return OrderInterface
530
     */
531
    public function setExternalId($externalId)
532
    {
533
        $this->externalId = $externalId;
534
        return $this;
535
    }
536
537
    /**
538
     * @return CustomerInterface|null
539
     */
540
    public function getCustomer()
541
    {
542
        return $this->customer;
543
    }
544
545
    /**
546
     * @param CustomerInterface|null $customer
547
     * @return OrderInterface
548
     */
549
    public function setCustomer($customer)
550
    {
551
        $this->customer = $customer;
552
        return $this;
553
    }
554
555
    /**
556
     * @return DeliveryInterface|null
557
     */
558
    public function getDelivery()
559
    {
560
        return $this->delivery;
561
    }
562
563
    /**
564
     * @param DeliveryInterface|null $delivery
565
     * @return OrderInterface
566
     */
567
    public function setDelivery($delivery)
568
    {
569
        $this->delivery = $delivery;
570
        return $this;
571
    }
572
573
    /**
574
     * @return InvoiceInterface|null
575
     */
576
    public function getInvoice()
577
    {
578
        return $this->invoice;
579
    }
580
581
    /**
582
     * @param InvoiceInterface|null $invoice
583
     * @return OrderInterface
584
     */
585
    public function setInvoice($invoice)
586
    {
587
        $this->invoice = $invoice;
588
        return $this;
589
    }
590
591
    /**
592
     * @return ArrayCollection|null
593
     */
594
    public function getOrderLines()
595
    {
596
        return $this->orderLines;
597
    }
598
599
    /**
600
     * @param ArrayCollection|null $orderLines
601
     * @return OrderInterface
602
     */
603
    public function setOrderLines($orderLines)
604
    {
605
        $this->orderLines = $orderLines;
606
        return $this;
607
    }
608
609
    /**
610
     * @return PaymentMethodInterface|null
611
     */
612
    public function getPaymentMethod()
613
    {
614
        return $this->paymentMethod;
615
    }
616
617
    /**
618
     * @param PaymentMethodInterface|null $paymentMethod
619
     * @return OrderInterface
620
     */
621
    public function setPaymentMethod($paymentMethod)
622
    {
623
        $this->paymentMethod = $paymentMethod;
624
        return $this;
625
    }
626
627
    /**
628
     * @return ShippingMethodInterface|null
629
     */
630
    public function getShippingMethod()
631
    {
632
        return $this->shippingMethod;
633
    }
634
635
    /**
636
     * @param ShippingMethodInterface|null $shippingMethod
637
     * @return OrderInterface
638
     */
639
    public function setShippingMethod($shippingMethod)
640
    {
641
        $this->shippingMethod = $shippingMethod;
642
        return $this;
643
    }
644
645
    /**
646
     * @return SiteInterface|null
647
     */
648
    public function getSite()
649
    {
650
        return $this->site;
651
    }
652
653
    /**
654
     * @param SiteInterface|null $site
655
     * @return OrderInterface
656
     */
657
    public function setSite($site)
658
    {
659
        $this->site = $site;
660
        return $this;
661
    }
662
663
    /**
664
     * @return StateInterface|null
665
     */
666
    public function getState()
667
    {
668
        return $this->state;
669
    }
670
671
    /**
672
     * @param StateInterface|null $state
673
     * @return OrderInterface
674
     */
675
    public function setState($state)
676
    {
677
        $this->state = $state;
678
        return $this;
679
    }
680
681
    /**
682
     * @return null|string
683
     */
684
    public function getComment()
685
    {
686
        return $this->comment;
687
    }
688
689
    /**
690
     * @param null|string $comment
691
     * @return OrderInterface
692
     */
693
    public function setComment($comment)
694
    {
695
        $this->comment = $comment;
696
        return $this;
697
    }
698
699
    /**
700
     * @return \DateTimeImmutable|null
701
     */
702
    public function getCreatedDate()
703
    {
704
        return $this->createdDate;
705
    }
706
707
    /**
708
     * @param \DateTimeImmutable|null $createdDate
709
     * @return OrderInterface
710
     */
711
    public function setCreatedDate($createdDate)
712
    {
713
        $this->createdDate = $createdDate;
714
        return $this;
715
    }
716
717
    /**
718
     * @return null|string
719
     */
720
    public function getCreditNoteNumber()
721
    {
722
        return $this->creditNoteNumber;
723
    }
724
725
    /**
726
     * @param null|string $creditNoteNumber
727
     * @return Order
728
     */
729
    public function setCreditNoteNumber($creditNoteNumber)
730
    {
731
        $this->creditNoteNumber = $creditNoteNumber;
732
        return $this;
733
    }
734
735
    /**
736
     * @return null|string
737
     */
738
    public function getCurrencyCode()
739
    {
740
        return $this->currencyCode;
741
    }
742
743
    /**
744
     * @param null|string $currencyCode
745
     * @return OrderInterface
746
     */
747
    public function setCurrencyCode($currencyCode)
748
    {
749
        $this->currencyCode = $currencyCode;
750
        return $this;
751
    }
752
753
    /**
754
     * @return null|string
755
     */
756
    public function getCustomerComment()
757
    {
758
        return $this->customerComment;
759
    }
760
761
    /**
762
     * @param null|string $customerComment
763
     * @return OrderInterface
764
     */
765
    public function setCustomerComment($customerComment)
766
    {
767
        $this->customerComment = $customerComment;
768
        return $this;
769
    }
770
771
    /**
772
     * @return null|string
773
     */
774
    public function getGiftCertificateNumber()
775
    {
776
        return $this->giftCertificateNumber;
777
    }
778
779
    /**
780
     * @param null|string $giftCertificateNumber
781
     * @return OrderInterface
782
     */
783
    public function setGiftCertificateNumber($giftCertificateNumber)
784
    {
785
        $this->giftCertificateNumber = $giftCertificateNumber;
786
        return $this;
787
    }
788
789
    /**
790
     * @return bool|null
791
     */
792
    public function getIncomplete()
793
    {
794
        return $this->incomplete;
795
    }
796
797
    /**
798
     * @param bool|null $incomplete
799
     * @return OrderInterface
800
     */
801
    public function setIncomplete($incomplete)
802
    {
803
        $this->incomplete = $incomplete;
804
        return $this;
805
    }
806
807
    /**
808
     * @return null|string
809
     */
810
    public function getIp()
811
    {
812
        return $this->ip;
813
    }
814
815
    /**
816
     * @param null|string $ip
817
     * @return OrderInterface
818
     */
819
    public function setIp($ip)
820
    {
821
        $this->ip = $ip;
822
        return $this;
823
    }
824
825
    /**
826
     * @return bool|null
827
     */
828
    public function getModified()
829
    {
830
        return $this->modified;
831
    }
832
833
    /**
834
     * @param bool|null $modified
835
     * @return OrderInterface
836
     */
837
    public function setModified($modified)
838
    {
839
        $this->modified = $modified;
840
        return $this;
841
    }
842
843
    /**
844
     * @return \DateTimeImmutable|null
845
     */
846
    public function getModifiedDate()
847
    {
848
        return $this->modifiedDate;
849
    }
850
851
    /**
852
     * @param \DateTimeImmutable|null $modifiedDate
853
     * @return OrderInterface
854
     */
855
    public function setModifiedDate($modifiedDate)
856
    {
857
        $this->modifiedDate = $modifiedDate;
858
        return $this;
859
    }
860
861
    /**
862
     * @return null|string
863
     */
864
    public function getReferenceNumber()
865
    {
866
        return $this->referenceNumber;
867
    }
868
869
    /**
870
     * @param null|string $referenceNumber
871
     * @return OrderInterface
872
     */
873
    public function setReferenceNumber($referenceNumber)
874
    {
875
        $this->referenceNumber = $referenceNumber;
876
        return $this;
877
    }
878
879
    /**
880
     * @return null|string
881
     */
882
    public function getReferrer()
883
    {
884
        return $this->referrer;
885
    }
886
887
    /**
888
     * @param null|string $referrer
889
     * @return OrderInterface
890
     */
891
    public function setReferrer($referrer)
892
    {
893
        $this->referrer = $referrer;
894
        return $this;
895
    }
896
897
    /**
898
     * @return null|string
899
     */
900
    public function getReservedField1()
901
    {
902
        return $this->reservedField1;
903
    }
904
905
    /**
906
     * @param null|string $reservedField1
907
     * @return OrderInterface
908
     */
909
    public function setReservedField1($reservedField1)
910
    {
911
        $this->reservedField1 = $reservedField1;
912
        return $this;
913
    }
914
915
    /**
916
     * @return null|string
917
     */
918
    public function getReservedField2()
919
    {
920
        return $this->reservedField2;
921
    }
922
923
    /**
924
     * @param null|string $reservedField2
925
     * @return OrderInterface
926
     */
927
    public function setReservedField2($reservedField2)
928
    {
929
        $this->reservedField2 = $reservedField2;
930
        return $this;
931
    }
932
933
    /**
934
     * @return null|string
935
     */
936
    public function getReservedField3()
937
    {
938
        return $this->reservedField3;
939
    }
940
941
    /**
942
     * @param null|string $reservedField3
943
     * @return OrderInterface
944
     */
945
    public function setReservedField3($reservedField3)
946
    {
947
        $this->reservedField3 = $reservedField3;
948
        return $this;
949
    }
950
951
    /**
952
     * @return null|string
953
     */
954
    public function getReservedField4()
955
    {
956
        return $this->reservedField4;
957
    }
958
959
    /**
960
     * @param null|string $reservedField4
961
     * @return OrderInterface
962
     */
963
    public function setReservedField4($reservedField4)
964
    {
965
        $this->reservedField4 = $reservedField4;
966
        return $this;
967
    }
968
969
    /**
970
     * @return null|string
971
     */
972
    public function getReservedField5()
973
    {
974
        return $this->reservedField5;
975
    }
976
977
    /**
978
     * @param null|string $reservedField5
979
     * @return OrderInterface
980
     */
981
    public function setReservedField5($reservedField5)
982
    {
983
        $this->reservedField5 = $reservedField5;
984
        return $this;
985
    }
986
987
    /**
988
     * @return float|null
989
     */
990
    public function getTotalWeight()
991
    {
992
        return $this->totalWeight;
993
    }
994
995
    /**
996
     * @param float|null $totalWeight
997
     * @return OrderInterface
998
     */
999
    public function setTotalWeight($totalWeight)
1000
    {
1001
        $this->totalWeight = $totalWeight;
1002
        return $this;
1003
    }
1004
1005
    /**
1006
     * @return null|string
1007
     */
1008
    public function getTrackingNumber()
1009
    {
1010
        return $this->trackingNumber;
1011
    }
1012
1013
    /**
1014
     * @param null|string $trackingNumber
1015
     * @return OrderInterface
1016
     */
1017
    public function setTrackingNumber($trackingNumber)
1018
    {
1019
        $this->trackingNumber = $trackingNumber;
1020
        return $this;
1021
    }
1022
1023
    /**
1024
     * @return int|null
1025
     */
1026
    public function getTransactionNumber()
1027
    {
1028
        return $this->transactionNumber;
1029
    }
1030
1031
    /**
1032
     * @param int|null $transactionNumber
1033
     * @return OrderInterface
1034
     */
1035
    public function setTransactionNumber($transactionNumber)
1036
    {
1037
        $this->transactionNumber = $transactionNumber;
1038
        return $this;
1039
    }
1040
1041
    /**
1042
     * @return float|null
1043
     */
1044
    public function getVatPct()
1045
    {
1046
        return $this->vatPct;
1047
    }
1048
1049
    /**
1050
     * @param float|null $vatPct
1051
     * @return OrderInterface
1052
     */
1053
    public function setVatPct($vatPct)
1054
    {
1055
        $this->vatPct = $vatPct;
1056
        return $this;
1057
    }
1058
1059
    /**
1060
     * @return null|string
1061
     */
1062
    public function getVatRegNumber()
1063
    {
1064
        return $this->vatRegNumber;
1065
    }
1066
1067
    /**
1068
     * @param null|string $vatRegNumber
1069
     * @return OrderInterface
1070
     */
1071
    public function setVatRegNumber($vatRegNumber)
1072
    {
1073
        $this->vatRegNumber = $vatRegNumber;
1074
        return $this;
1075
    }
1076
1077
    /**
1078
     * @return null|string
1079
     */
1080
    public function getXmlParams()
1081
    {
1082
        return $this->xmlParams;
1083
    }
1084
1085
    /**
1086
     * @param null|string $xmlParams
1087
     * @return OrderInterface
1088
     */
1089
    public function setXmlParams($xmlParams)
1090
    {
1091
        $this->xmlParams = $xmlParams;
1092
        return $this;
1093
    }
1094
1095
    /**
1096
     * A helper method for creating a Money object from a float based on the shared currency
1097
     *
1098
     * @param int $amount
1099
     * @return Money|null
1100
     */
1101
    private function createMoney(int $amount = 0) : ?Money
1102
    {
1103
        return DandomainFoundation\createMoney((string)$this->currencyCode, $amount);
1104
    }
1105
}
1106