1
|
|
|
<?php |
2
|
|
|
|
3
|
|
|
declare(strict_types=1); |
4
|
|
|
|
5
|
|
|
namespace Billogram\Model\Invoice; |
6
|
|
|
|
7
|
|
|
use Billogram\Model\CreatableFromArray; |
8
|
|
|
|
9
|
|
|
/** |
10
|
|
|
* @author Ibrahim Hizeoui <[email protected]> |
11
|
|
|
*/ |
12
|
|
|
class AdditionalInformation implements CreatableFromArray |
13
|
|
|
{ |
14
|
|
|
/** |
15
|
|
|
* @var string |
16
|
|
|
*/ |
17
|
|
|
private $orderNo; |
18
|
|
|
|
19
|
|
|
/** |
20
|
|
|
* @var string |
21
|
|
|
*/ |
22
|
|
|
private $orderDate; |
23
|
|
|
|
24
|
|
|
/** |
25
|
|
|
* @var string |
26
|
|
|
*/ |
27
|
|
|
private $ourReference; |
28
|
|
|
|
29
|
|
|
/** |
30
|
|
|
* @var string |
31
|
|
|
*/ |
32
|
|
|
private $yourReference; |
33
|
|
|
|
34
|
|
|
/** |
35
|
|
|
* @var string |
36
|
|
|
*/ |
37
|
|
|
private $shippingDate; |
38
|
|
|
|
39
|
|
|
/** |
40
|
|
|
* @var string |
41
|
|
|
*/ |
42
|
|
|
private $deliveryDate; |
43
|
|
|
|
44
|
|
|
/** |
45
|
|
|
* @var string |
46
|
|
|
*/ |
47
|
|
|
private $referenceNumber; |
48
|
|
|
|
49
|
|
|
/** |
50
|
|
|
* @var string |
51
|
|
|
*/ |
52
|
|
|
private $message; |
53
|
|
|
|
54
|
|
|
/** |
55
|
|
|
* @return string |
56
|
|
|
*/ |
57
|
|
|
public function getOrderNo(): string |
58
|
|
|
{ |
59
|
|
|
return $this->orderNo; |
60
|
|
|
} |
61
|
|
|
|
62
|
|
|
/** |
63
|
|
|
* @param string $orderNo |
64
|
|
|
* |
65
|
|
|
* @return AdditionalInformation |
66
|
|
|
*/ |
67
|
|
|
public function withOrderNo(string $orderNo) |
68
|
|
|
{ |
69
|
|
|
$new = clone $this; |
70
|
|
|
$new->orderNo = $orderNo; |
71
|
|
|
|
72
|
|
|
return $new; |
73
|
|
|
} |
74
|
|
|
|
75
|
|
|
/** |
76
|
|
|
* @return string |
77
|
|
|
*/ |
78
|
|
|
public function getOrderDate(): string |
79
|
|
|
{ |
80
|
|
|
return $this->orderDate; |
81
|
|
|
} |
82
|
|
|
|
83
|
|
|
/** |
84
|
|
|
* @param string $orderDate |
85
|
|
|
* |
86
|
|
|
* @return AdditionalInformation |
87
|
|
|
*/ |
88
|
|
|
public function withOrderDate(string $orderDate) |
89
|
|
|
{ |
90
|
|
|
$new = clone $this; |
91
|
|
|
$new->orderDate = $orderDate; |
92
|
|
|
|
93
|
|
|
return $new; |
94
|
|
|
} |
95
|
|
|
|
96
|
|
|
/** |
97
|
|
|
* @return string |
98
|
|
|
*/ |
99
|
|
|
public function getOurReference(): string |
100
|
|
|
{ |
101
|
|
|
return $this->ourReference; |
102
|
|
|
} |
103
|
|
|
|
104
|
|
|
/** |
105
|
|
|
* @param string $ourReference |
106
|
|
|
* |
107
|
|
|
* @return AdditionalInformation |
108
|
|
|
*/ |
109
|
|
|
public function withOurReference(string $ourReference) |
110
|
|
|
{ |
111
|
|
|
$new = clone $this; |
112
|
|
|
$new->ourReference = $ourReference; |
113
|
|
|
|
114
|
|
|
return $new; |
115
|
|
|
} |
116
|
|
|
|
117
|
|
|
/** |
118
|
|
|
* @return string |
119
|
|
|
*/ |
120
|
|
|
public function getYourReference(): string |
121
|
|
|
{ |
122
|
|
|
return $this->yourReference; |
123
|
|
|
} |
124
|
|
|
|
125
|
|
|
/** |
126
|
|
|
* @param string $yourReference |
127
|
|
|
* |
128
|
|
|
* @return AdditionalInformation |
129
|
|
|
*/ |
130
|
|
|
public function withYourReference(string $yourReference) |
131
|
|
|
{ |
132
|
|
|
$new = clone $this; |
133
|
|
|
$new->yourReference = $yourReference; |
134
|
|
|
|
135
|
|
|
return $new; |
136
|
|
|
} |
137
|
|
|
|
138
|
|
|
/** |
139
|
|
|
* @return string |
140
|
|
|
*/ |
141
|
|
|
public function getShippingDate(): string |
142
|
|
|
{ |
143
|
|
|
return $this->shippingDate; |
144
|
|
|
} |
145
|
|
|
|
146
|
|
|
/** |
147
|
|
|
* @param string $shippingDate |
148
|
|
|
* |
149
|
|
|
* @return AdditionalInformation |
150
|
|
|
*/ |
151
|
|
|
public function withShippingDate(string $shippingDate) |
152
|
|
|
{ |
153
|
|
|
$new = clone $this; |
154
|
|
|
$new->shippingDate = $shippingDate; |
155
|
|
|
|
156
|
|
|
return $new; |
157
|
|
|
} |
158
|
|
|
|
159
|
|
|
/** |
160
|
|
|
* @return string |
161
|
|
|
*/ |
162
|
|
|
public function getDeliveryDate(): string |
163
|
|
|
{ |
164
|
|
|
return $this->deliveryDate; |
165
|
|
|
} |
166
|
|
|
|
167
|
|
|
/** |
168
|
|
|
* @param string $deliveryDate |
169
|
|
|
* |
170
|
|
|
* @return AdditionalInformation |
171
|
|
|
*/ |
172
|
|
|
public function withDeliveryDate(string $deliveryDate) |
173
|
|
|
{ |
174
|
|
|
$new = clone $this; |
175
|
|
|
$new->deliveryDate = $deliveryDate; |
176
|
|
|
|
177
|
|
|
return $new; |
178
|
|
|
} |
179
|
|
|
|
180
|
|
|
/** |
181
|
|
|
* @return string |
182
|
|
|
*/ |
183
|
|
|
public function getReferenceNumber(): string |
184
|
|
|
{ |
185
|
|
|
return $this->referenceNumber; |
186
|
|
|
} |
187
|
|
|
|
188
|
|
|
/** |
189
|
|
|
* @param string $referenceNumber |
190
|
|
|
* |
191
|
|
|
* @return AdditionalInformation |
192
|
|
|
*/ |
193
|
|
|
public function withReferenceNumber(string $referenceNumber) |
194
|
|
|
{ |
195
|
|
|
$new = clone $this; |
196
|
|
|
$new->referenceNumber = $referenceNumber; |
197
|
|
|
|
198
|
|
|
return $new; |
199
|
|
|
} |
200
|
|
|
|
201
|
|
|
/** |
202
|
|
|
* @return string |
203
|
|
|
*/ |
204
|
|
|
public function getMessage(): string |
205
|
|
|
{ |
206
|
|
|
return $this->message; |
207
|
|
|
} |
208
|
|
|
|
209
|
|
|
/** |
210
|
|
|
* @param $message |
211
|
|
|
* |
212
|
|
|
* @return AdditionalInformation |
213
|
|
|
*/ |
214
|
|
|
public function withMessage($message) |
215
|
|
|
{ |
216
|
|
|
$new = clone $this; |
217
|
|
|
$new->message = $message; |
218
|
|
|
|
219
|
|
|
return $new; |
220
|
|
|
} |
221
|
|
|
|
222
|
|
|
public function toArray() |
223
|
|
|
{ |
224
|
|
|
$data = []; |
225
|
|
|
if (null !== $this->orderNo) { |
226
|
|
|
$data['order_no'] = $this->orderNo; |
227
|
|
|
} |
228
|
|
|
if (null !== $this->orderDate) { |
229
|
|
|
$data['order_date'] = $this->orderDate; |
230
|
|
|
} |
231
|
|
|
if (null !== $this->ourReference) { |
232
|
|
|
$data['our_reference'] = $this->ourReference; |
233
|
|
|
} |
234
|
|
|
if (null !== $this->yourReference) { |
235
|
|
|
$data['your_reference'] = $this->yourReference; |
236
|
|
|
} |
237
|
|
|
if (null !== $this->shippingDate) { |
238
|
|
|
$data['shipping_date'] = $this->shippingDate; |
239
|
|
|
} |
240
|
|
|
if (null !== $this->deliveryDate) { |
241
|
|
|
$data['delivery_date'] = $this->deliveryDate; |
242
|
|
|
} |
243
|
|
|
if (null !== $this->referenceNumber) { |
244
|
|
|
$data['reference_number'] = $this->referenceNumber; |
245
|
|
|
} |
246
|
|
|
if (null !== $this->message) { |
247
|
|
|
$data['message'] = $this->message; |
248
|
|
|
} |
249
|
|
|
|
250
|
|
|
return $data; |
251
|
|
|
} |
252
|
|
|
|
253
|
|
|
/** |
254
|
|
|
* Create an API response object from the HTTP response from the API server. |
255
|
|
|
* |
256
|
|
|
* @param array $data |
257
|
|
|
* |
258
|
|
|
* @return self |
259
|
|
|
*/ |
260
|
3 |
|
public static function createFromArray(array $data) |
261
|
|
|
{ |
262
|
3 |
|
$info = new self(); |
263
|
3 |
|
$info->orderNo = $data['order_no'] ?? null; |
264
|
3 |
|
$info->orderDate = $data['order_date'] ?? null; |
265
|
3 |
|
$info->ourReference = $data['our_reference'] ?? null; |
266
|
3 |
|
$info->yourReference = $data['your_reference'] ?? null; |
267
|
3 |
|
$info->shippingDate = $data['shipping_date'] ?? null; |
268
|
3 |
|
$info->deliveryDate = $data['delivery_date'] ?? null; |
269
|
3 |
|
$info->referenceNumber = $data['reference_number'] ?? null; |
270
|
3 |
|
$info->message = $data['message'] ?? null; |
271
|
3 |
|
} |
272
|
|
|
} |
273
|
|
|
|