1
|
|
|
<?php |
2
|
|
|
|
3
|
|
|
namespace Ups\Entity; |
4
|
|
|
|
5
|
|
|
use DateTime; |
6
|
|
|
use Exception as BaseException; |
7
|
|
|
|
8
|
|
|
class TimeInTransitRequest |
9
|
|
|
{ |
10
|
|
|
/** |
11
|
|
|
* @var |
12
|
|
|
*/ |
13
|
|
|
private $transitFrom; |
14
|
|
|
|
15
|
|
|
/** |
16
|
|
|
* @var |
17
|
|
|
*/ |
18
|
|
|
private $transitTo; |
19
|
|
|
|
20
|
|
|
/** |
21
|
|
|
* @var |
22
|
|
|
*/ |
23
|
|
|
private $shipmentWeight; |
24
|
|
|
|
25
|
|
|
/** |
26
|
|
|
* @var |
27
|
|
|
*/ |
28
|
|
|
private $totalPackagesInShipment; |
29
|
|
|
|
30
|
|
|
/** |
31
|
|
|
* @var |
32
|
|
|
*/ |
33
|
|
|
private $invoiceLineTotal; |
34
|
|
|
|
35
|
|
|
/** |
36
|
|
|
* @var |
37
|
|
|
*/ |
38
|
|
|
private $pickupDate; |
39
|
|
|
|
40
|
|
|
/** |
41
|
|
|
* @var bool |
42
|
|
|
*/ |
43
|
|
|
private $documentsOnlyIndicator = false; |
44
|
|
|
|
45
|
|
|
public function __construct() |
46
|
|
|
{ |
47
|
|
|
$this->setTransitFrom(new AddressArtifactFormat()); |
48
|
|
|
$this->setTransitTo(new AddressArtifactFormat()); |
49
|
|
|
$this->setShipmentWeight(new ShipmentWeight()); |
50
|
|
|
$this->setInvoiceLineTotal(new InvoiceLineTotal()); |
51
|
|
|
$this->setPickupDate(new DateTime()); |
52
|
|
|
} |
53
|
|
|
|
54
|
|
|
public function setDocumentsOnlyIndicator() |
55
|
|
|
{ |
56
|
|
|
$this->documentsOnlyIndicator = true; |
57
|
|
|
} |
58
|
|
|
|
59
|
|
|
/** |
60
|
|
|
* @return bool |
61
|
|
|
*/ |
62
|
|
|
public function getDocumentsOnlyIndicator() |
63
|
|
|
{ |
64
|
|
|
return $this->documentsOnlyIndicator; |
65
|
|
|
} |
66
|
|
|
|
67
|
|
|
/** |
68
|
|
|
* @param DateTime $date |
69
|
|
|
*/ |
70
|
|
|
public function setPickupDate(DateTime $date) |
71
|
|
|
{ |
72
|
|
|
$this->pickupDate = $date; |
73
|
|
|
} |
74
|
|
|
|
75
|
|
|
/** |
76
|
|
|
* @return mixed |
77
|
|
|
*/ |
78
|
|
|
public function getPickupDate() |
79
|
|
|
{ |
80
|
|
|
return $this->pickupDate; |
81
|
|
|
} |
82
|
|
|
|
83
|
|
|
/** |
84
|
|
|
* @param AddressArtifactFormat $address |
85
|
|
|
*/ |
86
|
|
|
public function setTransitFrom(AddressArtifactFormat $address) |
87
|
|
|
{ |
88
|
|
|
$this->transitFrom = $address; |
89
|
|
|
} |
90
|
|
|
|
91
|
|
|
/** |
92
|
|
|
* @return mixed |
93
|
|
|
*/ |
94
|
|
|
public function getTransitFrom() |
95
|
|
|
{ |
96
|
|
|
return $this->transitFrom; |
97
|
|
|
} |
98
|
|
|
|
99
|
|
|
/** |
100
|
|
|
* @param AddressArtifactFormat $address |
101
|
|
|
*/ |
102
|
|
|
public function setTransitTo(AddressArtifactFormat $address) |
103
|
|
|
{ |
104
|
|
|
$this->transitTo = $address; |
105
|
|
|
} |
106
|
|
|
|
107
|
|
|
/** |
108
|
|
|
* @return mixed |
109
|
|
|
*/ |
110
|
|
|
public function getTransitTo() |
111
|
|
|
{ |
112
|
|
|
return $this->transitTo; |
113
|
|
|
} |
114
|
|
|
|
115
|
|
|
/** |
116
|
|
|
* @param ShipmentWeight $shipmentWeight |
117
|
|
|
*/ |
118
|
|
|
public function setShipmentWeight(ShipmentWeight $shipmentWeight) |
119
|
|
|
{ |
120
|
|
|
$this->shipmentWeight = $shipmentWeight; |
121
|
|
|
} |
122
|
|
|
|
123
|
|
|
/** |
124
|
|
|
* @return mixed |
125
|
|
|
*/ |
126
|
|
|
public function getShipmentWeight() |
127
|
|
|
{ |
128
|
|
|
return $this->shipmentWeight; |
129
|
|
|
} |
130
|
|
|
|
131
|
|
|
/** |
132
|
|
|
* @param $amount |
133
|
|
|
* |
134
|
|
|
* @throws BaseException |
135
|
|
|
*/ |
136
|
|
|
public function setTotalPackagesInShipment($amount) |
137
|
|
|
{ |
138
|
|
|
if (!is_int($amount) || $amount < 0) { |
139
|
|
|
throw new BaseException('Amount of packages should be integer and above 0'); |
140
|
|
|
} |
141
|
|
|
|
142
|
|
|
$this->totalPackagesInShipment = $amount; |
143
|
|
|
} |
144
|
|
|
|
145
|
|
|
/** |
146
|
|
|
* @return mixed |
147
|
|
|
*/ |
148
|
|
|
public function getTotalPackagesInShipment() |
149
|
|
|
{ |
150
|
|
|
return $this->totalPackagesInShipment; |
151
|
|
|
} |
152
|
|
|
|
153
|
|
|
/** |
154
|
|
|
* @param InvoiceLineTotal $invoiceLineTotal |
155
|
|
|
*/ |
156
|
|
|
public function setInvoiceLineTotal(InvoiceLineTotal $invoiceLineTotal) |
157
|
|
|
{ |
158
|
|
|
$this->invoiceLineTotal = $invoiceLineTotal; |
159
|
|
|
} |
160
|
|
|
|
161
|
|
|
/** |
162
|
|
|
* @return mixed |
163
|
|
|
*/ |
164
|
|
|
public function getInvoiceLineTotal() |
165
|
|
|
{ |
166
|
|
|
return $this->invoiceLineTotal; |
167
|
|
|
} |
168
|
|
|
} |
169
|
|
|
|