1
|
|
|
<?php |
2
|
|
|
|
3
|
|
|
declare(strict_types=1); |
4
|
|
|
|
5
|
|
|
namespace ParcelValue\Api\JsonApi\ResourceObjects; |
6
|
|
|
|
7
|
|
|
class Shipment extends \WebServCo\Api\JsonApi\AbstractResourceObject |
8
|
|
|
{ |
9
|
|
|
public const DATE_FORMAT = 'Y-m-d'; |
10
|
|
|
public const SERVICE_ECONOMY = 'economy'; |
11
|
|
|
public const SERVICE_EXPRESS = 'express'; |
12
|
|
|
public const CURRENCY_EUR = 'EUR'; |
13
|
|
|
public const TYPE = 'shipment'; |
14
|
|
|
|
15
|
|
|
public function __construct(?string $id = null) |
16
|
|
|
{ |
17
|
|
|
parent::__construct(self::TYPE); |
18
|
|
|
|
19
|
|
|
if (!$id) { |
20
|
|
|
return; |
21
|
|
|
} |
22
|
|
|
|
23
|
|
|
$this->setId($id); |
24
|
|
|
} |
25
|
|
|
|
26
|
|
|
public function getCarrier(): ?string |
27
|
|
|
{ |
28
|
|
|
return (string) $this->getMeta('carrier'); |
29
|
|
|
} |
30
|
|
|
|
31
|
|
|
public function getReference(): string |
32
|
|
|
{ |
33
|
|
|
return (string) $this->getMeta('reference'); |
34
|
|
|
} |
35
|
|
|
|
36
|
|
|
public function getScheduledProcessing(): bool |
37
|
|
|
{ |
38
|
|
|
return (bool) $this->getMeta('scheduledProcessing'); |
39
|
|
|
} |
40
|
|
|
|
41
|
|
|
public function getService(): string |
42
|
|
|
{ |
43
|
|
|
return (string) $this->getMeta('service'); |
44
|
|
|
} |
45
|
|
|
|
46
|
|
|
public function getStatus(): int |
47
|
|
|
{ |
48
|
|
|
return (int) $this->getMeta('status'); |
49
|
|
|
} |
50
|
|
|
|
51
|
|
|
public function setCarrier(string $carrier): bool |
52
|
|
|
{ |
53
|
|
|
$this->setMeta('carrier', $carrier); |
54
|
|
|
return true; |
55
|
|
|
} |
56
|
|
|
|
57
|
|
|
public function setScheduledProcessing(bool $scheduledProcessing): bool |
58
|
|
|
{ |
59
|
|
|
$this->setMeta('scheduledProcessing', $scheduledProcessing); |
60
|
|
|
return true; |
61
|
|
|
} |
62
|
|
|
|
63
|
|
|
public function setService(string $service): bool |
64
|
|
|
{ |
65
|
|
|
$this->setMeta('service', $service); |
66
|
|
|
return true; |
67
|
|
|
} |
68
|
|
|
|
69
|
|
|
public function setStatus(int $status): bool |
70
|
|
|
{ |
71
|
|
|
$this->setMeta('status', $status); |
72
|
|
|
return true; |
73
|
|
|
} |
74
|
|
|
} |
75
|
|
|
|