-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathShipment.php
More file actions
349 lines (295 loc) · 7.25 KB
/
Shipment.php
File metadata and controls
349 lines (295 loc) · 7.25 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
<?php
namespace WeDesignIt\ParcelPro\Resources;
use WeDesignIt\ParcelPro\Resources\Shipment\Receiver;
use WeDesignIt\ParcelPro\Resources\Shipment\Sender;
class Shipment extends Resource
{
public const CARRIER = 'Carrier';
public const TYPE = 'Type';
public const SIGNATURE_ON_DELIVERY = 'HandtekeningBijAflevering';
public const NO_NEIGHBOR_DELIVERY = 'NietLeverenBijDeBuren';
public const EVENING_DELIVERY = 'DirecteAvondlevering';
public const SATURDAY_DELIVERY = 'Zaterdaglevering';
public const ELEVENHUNDRED_DELIVERY = '1100levering'; // DHL only
public const HAND_IN_AT_SERVICEPOINT = 'InleverenOpServicepoint'; // DHL only
public const REMBOURS_COSTS = 'Rembours';
public const INSURED_AMOUNT = 'VerzekerdBedrag';
public const LETTERBOX_DELIVERY = 'Brievenbuslevering';
public const BANK_ACCOUNT_NUMBER = 'Rekeningnummer';
public const REFERENCE = 'Referentie';
public const PICKUP_DATETIME = 'PickupTijdstip';
public const PACKAGE_COUNT = 'AantalPakketten';
public const WEIGHT = 'Gewicht';
public const LENGTH = 'Lengte';
public const WIDTH = 'Breedte';
public const HEIGHT = 'Hoogte';
public const REMARK = 'Opmerking';
/**
* @return string[]
*/
public function getRequiredFields(): array
{
return [
self::CARRIER, self::TYPE, self::PACKAGE_COUNT, self::WEIGHT,
self::REMARK,
];
}
/**
* Fluent setter
*
* @param string $carrier
*
* @return $this
*/
public function carrier(string $carrier): Shipment
{
$this->offsetSet(self::CARRIER, $carrier);
return $this;
}
/**
* Fluent setter
*
* @param string $type
*
* @return $this
*/
public function type(string $type): Shipment
{
$this->offsetSet(self::TYPE, $type);
return $this;
}
/**
* @param bool $signature
*
* @return $this
*/
public function signatureOnDelivery(bool $signature = true): Shipment
{
$this->offsetSet(self::SIGNATURE_ON_DELIVERY, $signature);
return $this;
}
/**
* @return $this
*/
public function allowNeighborDelivery(): Shipment
{
return $this->noNeighborDelivery(false);
}
public function noNeighborDelivery(bool $notAllowed = true)
{
$this->offsetSet(self::NO_NEIGHBOR_DELIVERY, $notAllowed);
return $this;
}
/**
* @param bool $eveningDelivery
*
* @return $this
*/
public function eveningDelivery(bool $eveningDelivery = true): Shipment
{
$this->offsetSet(self::EVENING_DELIVERY, $eveningDelivery);
return $this;
}
/**
* @param bool $saturdayDelivery
*
* @return $this
*/
public function saturdayDelivery(bool $saturdayDelivery = true): Shipment
{
$this->offsetSet(self::SATURDAY_DELIVERY, $saturdayDelivery);
return $this;
}
/**
* @param bool $elevenHundredDelivery
*
* @return $this
*/
public function elevenHundredDelivery(bool $elevenHundredDelivery = true): Shipment
{
$this->offsetSet(self::ELEVENHUNDRED_DELIVERY, $elevenHundredDelivery);
return $this;
}
/**
* @param bool $handIn
*
* @return $this
*/
public function handInAtServicePoint(bool $handIn = true): Shipment
{
$this->offsetSet(self::HAND_IN_AT_SERVICEPOINT, $handIn);
return $this;
}
/**
* @param float $amount
*
* @return $this
*/
public function remboursCosts(float $amount): Shipment
{
$this->offsetSet(self::REMBOURS_COSTS, $amount);
return $this;
}
/**
* @param float $amount
*
* @return $this
*/
public function insturedAmount(float $amount): Shipment
{
$this->offsetSet(self::INSURED_AMOUNT, $amount);
return $this;
}
/**
* @param bool $letterboxDelivery
*
* @return $this
*/
public function letterboxDelivery(bool $letterboxDelivery = true): Shipment
{
$this->offsetSet(self::LETTERBOX_DELIVERY, $letterboxDelivery);
return $this;
}
/**
* @param string $bankAccount
*
* @return $this
*/
public function bankAccountNumber(string $bankAccount): Shipment
{
$this->offsetSet(self::BANK_ACCOUNT_NUMBER, $bankAccount);
return $this;
}
/**
* @param string $reference
*
* @return $this
*/
public function reference(string $reference): Shipment
{
$this->offsetSet(self::REFERENCE, $reference);
return $this;
}
/**
* @param \DateTime $moment
*
* @return $this
*/
public function pickupDateTime(\DateTime $moment): Shipment
{
$this->offsetSet(self::PICKUP_DATETIME, $moment->format('Y-m-d H:i:s'));
return $this;
}
/**
* @param Sender $sender
*
* @return $this
*/
public function sender(Sender $sender): Shipment
{
$this->data = array_merge_recursive(
$this->data,
$sender->toArray()
);
return $this;
}
/**
* @param Sender $sender
*
* @return $this
*/
public function distributionLocation(Sender $sender): Shipment
{
$this->data = array_merge_recursive(
$this->data,
$sender->toArray()
);
return $this;
}
/**
* @param Receiver $receiver
*
* @return $this
*/
public function receiver(Receiver $receiver): Shipment
{
$this->data = array_merge_recursive(
$this->data,
$receiver->toArray()
);
return $this;
}
/**
* @param int $packageCount
*
* @return $this
*/
public function packageCount(int $packageCount): Shipment
{
$this->offsetSet(self::PACKAGE_COUNT, $packageCount);
return $this;
}
/**
* @param float $weight
*
* @return $this
*/
public function weight(float $weight): Shipment
{
$this->offsetSet(self::WEIGHT, $weight);
return $this;
}
/**
* @param int $length
*
* @return $this
*/
public function length(int $length): Shipment
{
$this->offsetSet(self::LENGTH, $length);
return $this;
}
/**
* @param int $width
*
* @return $this
*/
public function width(int $width): Shipment
{
$this->offsetSet(self::WIDTH, $width);
return $this;
}
/**
* @param int $height
*
* @return $this
*/
public function height(int $height): Shipment
{
$this->offsetSet(self::HEIGHT, $height);
return $this;
}
/**
* @param int $length
* @param int $width
* @param int $height
*
* @return $this
*/
public function dimensions(int $length, int $width, int $height): Shipment
{
return $this->length($length)
->width($width)
->height($height);
}
/**
* @param string $remark
*
* @return $this
*/
public function remark(string $remark): Shipment
{
$this->offsetSet(self::REMARK, $remark);
return $this;
}
}