1
|
|
|
<?php |
2
|
|
|
|
3
|
|
|
declare(strict_types=1); |
4
|
|
|
|
5
|
|
|
namespace VasilDakov\Speedy\Service\Shipment; |
6
|
|
|
|
7
|
|
|
use JMS\Serializer\Annotation as Serializer; |
8
|
|
|
use VasilDakov\Speedy\Traits\ToArray; |
9
|
|
|
|
10
|
|
|
/** |
11
|
|
|
* Class CreateShipmentRequest |
12
|
|
|
* |
13
|
|
|
* @Serializer\AccessType("public_method") |
14
|
|
|
* @author Valentin Valkanov <[email protected]> |
15
|
|
|
* @author Vasil Dakov <[email protected]> |
16
|
|
|
* @copyright |
17
|
|
|
* @version |
18
|
|
|
*/ |
19
|
|
|
class CreateShipmentRequest |
20
|
|
|
{ |
21
|
|
|
use ToArray; |
22
|
|
|
|
23
|
|
|
/** |
24
|
|
|
* @var ShipmentSender |
25
|
|
|
* @Serializer\Type("VasilDakov\Speedy\Service\Shipment\ShipmentSender") |
26
|
|
|
*/ |
27
|
|
|
private ShipmentSender $sender; |
28
|
|
|
|
29
|
|
|
/** |
30
|
|
|
* @var ShipmentRecipient |
31
|
|
|
* @Serializer\Type("VasilDakov\Speedy\Service\Shipment\ShipmentRecipient") |
32
|
|
|
*/ |
33
|
|
|
private ShipmentRecipient $recipient; |
34
|
|
|
|
35
|
|
|
/** |
36
|
|
|
* @var ShipmentService |
37
|
|
|
* @Serializer\Type("VasilDakov\Speedy\Service\Shipment\ShipmentService") |
38
|
|
|
*/ |
39
|
|
|
private ShipmentService $service; |
40
|
|
|
|
41
|
|
|
/** |
42
|
|
|
* @var ShipmentContent |
43
|
|
|
* @Serializer\Type("VasilDakov\Speedy\Service\Shipment\ShipmentContent") |
44
|
|
|
*/ |
45
|
|
|
private ShipmentContent $content; |
46
|
|
|
|
47
|
|
|
/** |
48
|
|
|
* @var ShipmentPayment |
49
|
|
|
* @Serializer\Type("VasilDakov\Speedy\Service\Shipment\ShipmentPayment") |
50
|
|
|
*/ |
51
|
|
|
private ShipmentPayment $payment; |
52
|
|
|
|
53
|
|
|
/** |
54
|
|
|
* @var string|null |
55
|
|
|
* @Serializer\Type("string") |
56
|
|
|
*/ |
57
|
|
|
private ?string $shipmentNote = null; |
58
|
|
|
|
59
|
|
|
/** |
60
|
|
|
* @var string|null |
61
|
|
|
* @Serializer\Type("string") |
62
|
|
|
*/ |
63
|
|
|
private ?string $ref1 = null; |
64
|
|
|
|
65
|
|
|
/** |
66
|
|
|
* @var string|null |
67
|
|
|
* @Serializer\Type("string") |
68
|
|
|
*/ |
69
|
|
|
private ?string $ref2 = null; |
70
|
|
|
|
71
|
|
|
/** |
72
|
|
|
* @var string|null |
73
|
|
|
* @Serializer\Type("string") |
74
|
|
|
*/ |
75
|
|
|
private ?string $consolidationRef = null; |
76
|
|
|
|
77
|
|
|
/** |
78
|
|
|
* @var bool |
79
|
|
|
* @Serializer\Type("bool") |
80
|
|
|
*/ |
81
|
|
|
private bool $requireUnsuccessfulDeliveryStickerImage = false; |
82
|
|
|
|
83
|
|
|
/** |
84
|
|
|
* @param ShipmentSender $sender |
85
|
|
|
* @param ShipmentRecipient $recipient |
86
|
|
|
* @param ShipmentService $service |
87
|
|
|
* @param ShipmentContent $content |
88
|
|
|
* @param ShipmentPayment $payment |
89
|
|
|
*/ |
90
|
12 |
|
public function __construct( |
91
|
|
|
ShipmentSender $sender, |
92
|
|
|
ShipmentRecipient $recipient, |
93
|
|
|
ShipmentService $service, |
94
|
|
|
ShipmentContent $content, |
95
|
|
|
ShipmentPayment $payment |
96
|
|
|
) { |
97
|
12 |
|
$this->setSender($sender); |
98
|
12 |
|
$this->setRecipient($recipient); |
99
|
12 |
|
$this->setService($service); |
100
|
12 |
|
$this->setContent($content); |
101
|
12 |
|
$this->setPayment($payment); |
102
|
|
|
} |
103
|
|
|
|
104
|
|
|
/** |
105
|
|
|
* @return ShipmentRecipient |
106
|
|
|
*/ |
107
|
2 |
|
public function getRecipient(): ShipmentRecipient |
108
|
|
|
{ |
109
|
2 |
|
return $this->recipient; |
110
|
|
|
} |
111
|
|
|
|
112
|
|
|
/** |
113
|
|
|
* @param ShipmentRecipient $recipient |
114
|
|
|
* @return void |
115
|
|
|
*/ |
116
|
15 |
|
public function setRecipient(ShipmentRecipient $recipient): void |
117
|
|
|
{ |
118
|
15 |
|
$this->recipient = $recipient; |
119
|
|
|
} |
120
|
|
|
|
121
|
|
|
/** |
122
|
|
|
* @return ShipmentService |
123
|
|
|
*/ |
124
|
2 |
|
public function getService(): ShipmentService |
125
|
|
|
{ |
126
|
2 |
|
return $this->service; |
127
|
|
|
} |
128
|
|
|
|
129
|
|
|
/** |
130
|
|
|
* @param ShipmentService $service |
131
|
|
|
* @return void |
132
|
|
|
*/ |
133
|
15 |
|
public function setService(ShipmentService $service): void |
134
|
|
|
{ |
135
|
15 |
|
$this->service = $service; |
136
|
|
|
} |
137
|
|
|
|
138
|
|
|
/** |
139
|
|
|
* @return ShipmentContent |
140
|
|
|
*/ |
141
|
2 |
|
public function getContent(): ShipmentContent |
142
|
|
|
{ |
143
|
2 |
|
return $this->content; |
144
|
|
|
} |
145
|
|
|
|
146
|
|
|
/** |
147
|
|
|
* @param ShipmentContent $content |
148
|
|
|
* @return void |
149
|
|
|
*/ |
150
|
15 |
|
public function setContent(ShipmentContent $content): void |
151
|
|
|
{ |
152
|
15 |
|
$this->content = $content; |
153
|
|
|
} |
154
|
|
|
|
155
|
|
|
/** |
156
|
|
|
* @return ShipmentPayment |
157
|
|
|
*/ |
158
|
2 |
|
public function getPayment(): ShipmentPayment |
159
|
|
|
{ |
160
|
2 |
|
return $this->payment; |
161
|
|
|
} |
162
|
|
|
|
163
|
|
|
/** |
164
|
|
|
* @param ShipmentPayment $payment |
165
|
|
|
* @return void |
166
|
|
|
*/ |
167
|
15 |
|
public function setPayment(ShipmentPayment $payment): void |
168
|
|
|
{ |
169
|
15 |
|
$this->payment = $payment; |
170
|
|
|
} |
171
|
|
|
|
172
|
|
|
/** |
173
|
|
|
* @return ShipmentSender |
174
|
|
|
*/ |
175
|
1 |
|
public function getSender(): ShipmentSender |
176
|
|
|
{ |
177
|
1 |
|
return $this->sender; |
178
|
|
|
} |
179
|
|
|
|
180
|
|
|
/** |
181
|
|
|
* @param ShipmentSender $sender |
182
|
|
|
* @return $this |
183
|
|
|
*/ |
184
|
15 |
|
public function setSender(ShipmentSender $sender): self |
185
|
|
|
{ |
186
|
15 |
|
$this->sender = $sender; |
187
|
|
|
|
188
|
15 |
|
return $this; |
189
|
|
|
} |
190
|
|
|
|
191
|
|
|
/** |
192
|
|
|
* @return string|null |
193
|
|
|
*/ |
194
|
1 |
|
public function getShipmentNote(): ?string |
195
|
|
|
{ |
196
|
1 |
|
return $this->shipmentNote; |
197
|
|
|
} |
198
|
|
|
|
199
|
|
|
/** |
200
|
|
|
* @param string $shipmentNote |
201
|
|
|
* @return $this |
202
|
|
|
*/ |
203
|
4 |
|
public function setShipmentNote(string $shipmentNote): self |
204
|
|
|
{ |
205
|
4 |
|
$this->shipmentNote = $shipmentNote; |
206
|
|
|
|
207
|
4 |
|
return $this; |
208
|
|
|
} |
209
|
|
|
|
210
|
|
|
/** |
211
|
|
|
* @return string|null |
212
|
|
|
*/ |
213
|
1 |
|
public function getRef1(): ?string |
214
|
|
|
{ |
215
|
1 |
|
return $this->ref1; |
216
|
|
|
} |
217
|
|
|
|
218
|
|
|
/** |
219
|
|
|
* @param string $ref1 |
220
|
|
|
* @return $this |
221
|
|
|
*/ |
222
|
4 |
|
public function setRef1(string $ref1): self |
223
|
|
|
{ |
224
|
4 |
|
$this->ref1 = $ref1; |
225
|
|
|
|
226
|
4 |
|
return $this; |
227
|
|
|
} |
228
|
|
|
|
229
|
|
|
/** |
230
|
|
|
* @return string |
231
|
|
|
*/ |
232
|
1 |
|
public function getRef2(): ?string |
233
|
|
|
{ |
234
|
1 |
|
return $this->ref2; |
235
|
|
|
} |
236
|
|
|
|
237
|
|
|
/** |
238
|
|
|
* @param string $ref2 |
239
|
|
|
* @return $this|null |
240
|
|
|
*/ |
241
|
4 |
|
public function setRef2(string $ref2): ?self |
242
|
|
|
{ |
243
|
4 |
|
$this->ref2 = $ref2; |
244
|
|
|
|
245
|
4 |
|
return $this; |
246
|
|
|
} |
247
|
|
|
|
248
|
|
|
/** |
249
|
|
|
* @return string|null |
250
|
|
|
*/ |
251
|
1 |
|
public function getConsolidationRef(): ?string |
252
|
|
|
{ |
253
|
1 |
|
return $this->consolidationRef; |
254
|
|
|
} |
255
|
|
|
|
256
|
|
|
/** |
257
|
|
|
* @param string $consolidationRef |
258
|
|
|
* @return void |
259
|
|
|
*/ |
260
|
1 |
|
public function setConsolidationRef(string $consolidationRef): void |
261
|
|
|
{ |
262
|
1 |
|
$this->consolidationRef = $consolidationRef; |
263
|
|
|
} |
264
|
|
|
|
265
|
|
|
/** |
266
|
|
|
* @return bool |
267
|
|
|
*/ |
268
|
1 |
|
public function getRequireUnsuccessfulDeliveryStickerImage(): bool |
269
|
|
|
{ |
270
|
1 |
|
return $this->requireUnsuccessfulDeliveryStickerImage; |
271
|
|
|
} |
272
|
|
|
|
273
|
|
|
/** |
274
|
|
|
* @param bool $requireUnsuccessfulDeliveryStickerImage |
275
|
|
|
* @return $this |
276
|
|
|
*/ |
277
|
1 |
|
public function setRequireUnsuccessfulDeliveryStickerImage(bool $requireUnsuccessfulDeliveryStickerImage): self |
278
|
|
|
{ |
279
|
1 |
|
$this->requireUnsuccessfulDeliveryStickerImage = $requireUnsuccessfulDeliveryStickerImage; |
280
|
|
|
|
281
|
1 |
|
return $this; |
282
|
|
|
} |
283
|
|
|
} |
284
|
|
|
|