1
|
|
|
<?php |
2
|
|
|
|
3
|
|
|
namespace Speicher210\Fastbill\Api\Service\Subscription\ChangeArticle; |
4
|
|
|
|
5
|
|
|
use JMS\Serializer\Annotation as JMS; |
6
|
|
|
use Speicher210\Fastbill\Api\AbstractRequestData; |
7
|
|
|
use Speicher210\Fastbill\Api\Model\Addon; |
8
|
|
|
use Speicher210\Fastbill\Api\Model\Feature; |
9
|
|
|
|
10
|
|
|
/** |
11
|
|
|
* The request data for changing article of a subscription. |
12
|
|
|
*/ |
13
|
|
|
final class RequestData extends AbstractRequestData |
14
|
|
|
{ |
15
|
|
|
/** |
16
|
|
|
* The subscription ID. |
17
|
|
|
* |
18
|
|
|
* @var integer |
19
|
|
|
* |
20
|
|
|
* @JMS\Type("integer") |
21
|
|
|
* @JMS\SerializedName("SUBSCRIPTION_ID") |
22
|
|
|
*/ |
23
|
|
|
protected $subscriptionId; |
24
|
|
|
|
25
|
|
|
/** |
26
|
|
|
* The subscription quantity. |
27
|
|
|
* |
28
|
|
|
* @var integer |
29
|
|
|
* |
30
|
|
|
* @JMS\Type("integer") |
31
|
|
|
* @JMS\SerializedName("QUANTITY") |
32
|
|
|
*/ |
33
|
|
|
protected $quantity; |
34
|
|
|
|
35
|
|
|
/** |
36
|
|
|
* The subscription article number. |
37
|
|
|
* |
38
|
|
|
* @var string |
39
|
|
|
* |
40
|
|
|
* @JMS\Type("string") |
41
|
|
|
* @JMS\SerializedName("ARTICLE_NUMBER") |
42
|
|
|
*/ |
43
|
|
|
protected $articleNumber; |
44
|
|
|
|
45
|
|
|
/** |
46
|
|
|
* The title of the article. |
47
|
|
|
* |
48
|
|
|
* @var string |
49
|
|
|
* |
50
|
|
|
* @JMS\Type("string") |
51
|
|
|
* @JMS\SerializedName("TITLE") |
52
|
|
|
*/ |
53
|
|
|
protected $title; |
54
|
|
|
|
55
|
|
|
/** |
56
|
|
|
* The description of the article. |
57
|
|
|
* |
58
|
|
|
* @var string |
59
|
|
|
* |
60
|
|
|
* @JMS\Type("string") |
61
|
|
|
* @JMS\SerializedName("DESCRIPTION") |
62
|
|
|
*/ |
63
|
|
|
protected $description; |
64
|
|
|
|
65
|
|
|
/** |
66
|
|
|
* The unit price. |
67
|
|
|
* |
68
|
|
|
* @var float |
69
|
|
|
* |
70
|
|
|
* @JMS\Type("float") |
71
|
|
|
* @JMS\SerializedName("UNIT_PRICE") |
72
|
|
|
*/ |
73
|
|
|
protected $unitPrice; |
74
|
|
|
|
75
|
|
|
/** |
76
|
|
|
* The currency code. |
77
|
|
|
* |
78
|
|
|
* @var string |
79
|
|
|
* |
80
|
|
|
* @JMS\Type("string") |
81
|
|
|
* @JMS\SerializedName("CURRENCY_CODE") |
82
|
|
|
*/ |
83
|
|
|
protected $currencyCode; |
84
|
|
|
|
85
|
|
|
/** |
86
|
|
|
* Flag if reset addons. |
87
|
|
|
* |
88
|
|
|
* @var integer |
89
|
|
|
* |
90
|
|
|
* @JMS\Type("integer") |
91
|
|
|
* @JMS\SerializedName("RESET_ADDONS") |
92
|
|
|
*/ |
93
|
|
|
protected $resetAddons; |
94
|
|
|
|
95
|
|
|
/** |
96
|
|
|
* The coupon code. |
97
|
|
|
* |
98
|
|
|
* @var string |
99
|
|
|
* |
100
|
|
|
* @JMS\Type("string") |
101
|
|
|
* @JMS\SerializedName("COUPON") |
102
|
|
|
*/ |
103
|
|
|
protected $coupon; |
104
|
|
|
|
105
|
|
|
/** |
106
|
|
|
* Addons. |
107
|
|
|
* |
108
|
|
|
* @var array |
109
|
|
|
* |
110
|
|
|
* @JMS\Type("array<Speicher210\Fastbill\Api\Model\Addon>") |
111
|
|
|
* @JMS\SerializedName("ADDONS") |
112
|
|
|
*/ |
113
|
|
|
protected $addons; |
114
|
|
|
|
115
|
|
|
/** |
116
|
|
|
* Product features. |
117
|
|
|
* |
118
|
|
|
* @var array |
119
|
|
|
* |
120
|
|
|
* @JMS\Type("array<Speicher210\Fastbill\Api\Model\Feature>") |
121
|
|
|
* @JMS\SerializedName("FEATURES") |
122
|
|
|
*/ |
123
|
|
|
protected $features = array(); |
124
|
|
|
|
125
|
|
|
/** |
126
|
|
|
* Flag if suppress confirmation mail to customer. |
127
|
|
|
* |
128
|
|
|
* @var integer |
129
|
|
|
* |
130
|
|
|
* @JMS\Type("integer") |
131
|
|
|
* @JMS\SerializedName("SUPPRESS_MAIL") |
132
|
|
|
*/ |
133
|
|
|
protected $suppressMail; |
134
|
|
|
|
135
|
|
|
/** |
136
|
|
|
* Constructor. |
137
|
|
|
* |
138
|
|
|
* @param integer $subscriptionId The subscription ID. |
139
|
|
|
* @param string $articleNumber The article number. |
140
|
|
|
*/ |
141
|
3 |
|
public function __construct($subscriptionId, $articleNumber) |
142
|
|
|
{ |
143
|
3 |
|
$this->setSubscriptionId($subscriptionId); |
144
|
3 |
|
$this->setArticleNumber($articleNumber); |
145
|
3 |
|
} |
146
|
|
|
|
147
|
|
|
/** |
148
|
|
|
* Get the subscription ID. |
149
|
|
|
* |
150
|
|
|
* @return integer |
151
|
|
|
*/ |
152
|
|
|
public function getSubscriptionId() |
153
|
|
|
{ |
154
|
|
|
return $this->subscriptionId; |
155
|
|
|
} |
156
|
|
|
|
157
|
|
|
/** |
158
|
|
|
* Set the subscription ID. |
159
|
|
|
* |
160
|
|
|
* @param integer $subscriptionId The subscription ID. |
161
|
|
|
* @return RequestData |
162
|
|
|
*/ |
163
|
3 |
|
public function setSubscriptionId($subscriptionId) |
164
|
|
|
{ |
165
|
3 |
|
$this->subscriptionId = $subscriptionId; |
166
|
|
|
|
167
|
3 |
|
return $this; |
168
|
|
|
} |
169
|
|
|
|
170
|
|
|
/** |
171
|
|
|
* Get the quantity. |
172
|
|
|
* |
173
|
|
|
* @return integer |
174
|
|
|
*/ |
175
|
|
|
public function getQuantity() |
176
|
|
|
{ |
177
|
|
|
return $this->quantity; |
178
|
|
|
} |
179
|
|
|
|
180
|
|
|
/** |
181
|
|
|
* Set the quantity. |
182
|
|
|
* |
183
|
|
|
* @param integer $quantity The quantity. |
184
|
|
|
* @return RequestData |
185
|
|
|
*/ |
186
|
|
|
public function setQuantity($quantity) |
187
|
|
|
{ |
188
|
|
|
if ($quantity < 1) { |
189
|
|
|
throw new \InvalidArgumentException('Quantity must be bigger than 0.'); |
190
|
|
|
} |
191
|
|
|
$this->quantity = $quantity; |
192
|
|
|
|
193
|
|
|
return $this; |
194
|
|
|
} |
195
|
|
|
|
196
|
|
|
/** |
197
|
|
|
* Get the article number. |
198
|
|
|
* |
199
|
|
|
* @return integer |
200
|
|
|
*/ |
201
|
|
|
public function getArticleNumber() |
202
|
|
|
{ |
203
|
|
|
return $this->articleNumber; |
204
|
|
|
} |
205
|
|
|
|
206
|
|
|
/** |
207
|
|
|
* Set the article number. |
208
|
|
|
* |
209
|
|
|
* @param string $articleNumber The article number. |
210
|
|
|
* @return RequestData |
211
|
|
|
*/ |
212
|
3 |
|
public function setArticleNumber($articleNumber) |
213
|
|
|
{ |
214
|
3 |
|
$this->articleNumber = $articleNumber; |
215
|
|
|
|
216
|
3 |
|
return $this; |
217
|
|
|
} |
218
|
|
|
|
219
|
|
|
/** |
220
|
|
|
* Get the title. |
221
|
|
|
* |
222
|
|
|
* @return string |
223
|
|
|
*/ |
224
|
|
|
public function getTitle() |
225
|
|
|
{ |
226
|
|
|
return $this->title; |
227
|
|
|
} |
228
|
|
|
|
229
|
|
|
/** |
230
|
|
|
* Set the title. |
231
|
|
|
* |
232
|
|
|
* @param string $title The title. |
233
|
|
|
* @return RequestData |
234
|
|
|
*/ |
235
|
|
|
public function setTitle($title) |
236
|
|
|
{ |
237
|
|
|
$this->title = $title; |
238
|
|
|
|
239
|
|
|
return $this; |
240
|
|
|
} |
241
|
|
|
|
242
|
|
|
/** |
243
|
|
|
* Get the description. |
244
|
|
|
* |
245
|
|
|
* @return string |
246
|
|
|
*/ |
247
|
|
|
public function getDescription() |
248
|
|
|
{ |
249
|
|
|
return $this->description; |
250
|
|
|
} |
251
|
|
|
|
252
|
|
|
/** |
253
|
|
|
* Set the description. |
254
|
|
|
* |
255
|
|
|
* @param string $description The description. |
256
|
|
|
* @return RequestData |
257
|
|
|
*/ |
258
|
|
|
public function setDescription($description) |
259
|
|
|
{ |
260
|
|
|
$this->description = $description; |
261
|
|
|
|
262
|
|
|
return $this; |
263
|
|
|
} |
264
|
|
|
|
265
|
|
|
/** |
266
|
|
|
* Get the unit price. |
267
|
|
|
* |
268
|
|
|
* @return float |
269
|
|
|
*/ |
270
|
|
|
public function getUnitPrice() |
271
|
|
|
{ |
272
|
|
|
return $this->unitPrice; |
273
|
|
|
} |
274
|
|
|
|
275
|
|
|
/** |
276
|
|
|
* Set the unit price. |
277
|
|
|
* |
278
|
|
|
* @param float $unitPrice The price. |
279
|
|
|
* @return RequestData |
280
|
|
|
*/ |
281
|
|
|
public function setUnitPrice($unitPrice) |
282
|
|
|
{ |
283
|
|
|
$this->unitPrice = $unitPrice; |
284
|
|
|
|
285
|
|
|
return $this; |
286
|
|
|
} |
287
|
|
|
|
288
|
|
|
/** |
289
|
|
|
* Get the currency code. |
290
|
|
|
* |
291
|
|
|
* @return string |
292
|
|
|
*/ |
293
|
|
|
public function getCurrencyCode() |
294
|
|
|
{ |
295
|
|
|
return $this->currencyCode; |
296
|
|
|
} |
297
|
|
|
|
298
|
|
|
/** |
299
|
|
|
* Set the currency code. |
300
|
|
|
* |
301
|
|
|
* @param string $currencyCode The currency code. |
302
|
|
|
* @return RequestData |
303
|
|
|
*/ |
304
|
|
|
public function setCurrencyCode($currencyCode) |
305
|
|
|
{ |
306
|
|
|
$this->currencyCode = $currencyCode; |
307
|
|
|
|
308
|
|
|
return $this; |
309
|
|
|
} |
310
|
|
|
|
311
|
|
|
/** |
312
|
|
|
* Check if the addons should be reset. |
313
|
|
|
* |
314
|
|
|
* @return boolean |
315
|
|
|
*/ |
316
|
|
|
public function isResetAddons() |
317
|
|
|
{ |
318
|
|
|
return (boolean)$this->resetAddons; |
319
|
|
|
} |
320
|
|
|
|
321
|
|
|
/** |
322
|
|
|
* Set if the addons should be reset. |
323
|
|
|
* |
324
|
|
|
* @param boolean $resetAddons Flag if reset addons. |
325
|
|
|
* @return RequestData |
326
|
|
|
*/ |
327
|
|
|
public function setResetAddons($resetAddons) |
328
|
|
|
{ |
329
|
|
|
$this->resetAddons = (integer)(boolean)$resetAddons; |
330
|
|
|
|
331
|
|
|
return $this; |
332
|
|
|
} |
333
|
|
|
|
334
|
|
|
/** |
335
|
|
|
* Get the coupon code. |
336
|
|
|
* |
337
|
|
|
* @return string |
338
|
|
|
*/ |
339
|
|
|
public function getCoupon() |
340
|
|
|
{ |
341
|
|
|
return $this->coupon; |
342
|
|
|
} |
343
|
|
|
|
344
|
|
|
/** |
345
|
|
|
* Set the coupon code. |
346
|
|
|
* |
347
|
|
|
* @param string $coupon The coupon code. |
348
|
|
|
* @return RequestData |
349
|
|
|
*/ |
350
|
|
|
public function setCoupon($coupon) |
351
|
|
|
{ |
352
|
|
|
$this->coupon = $coupon; |
353
|
|
|
|
354
|
|
|
return $this; |
355
|
|
|
} |
356
|
|
|
|
357
|
|
|
/** |
358
|
|
|
* Get the addons. |
359
|
|
|
* |
360
|
|
|
* @return array |
361
|
|
|
*/ |
362
|
|
|
public function getAddons() |
363
|
|
|
{ |
364
|
|
|
return $this->addons; |
365
|
|
|
} |
366
|
|
|
|
367
|
|
|
/** |
368
|
|
|
* Set the addons. |
369
|
|
|
* |
370
|
|
|
* @param Addon[] $addons The addons. |
371
|
|
|
* @return RequestData |
372
|
|
|
*/ |
373
|
|
|
public function setAddons(array $addons) |
374
|
|
|
{ |
375
|
|
|
$this->addons = $addons; |
376
|
|
|
|
377
|
|
|
return $this; |
378
|
|
|
} |
379
|
|
|
|
380
|
|
|
/** |
381
|
|
|
* Get the features. |
382
|
|
|
* |
383
|
|
|
* @return array |
384
|
|
|
*/ |
385
|
|
|
public function getFeatures() |
386
|
|
|
{ |
387
|
|
|
return $this->features; |
388
|
|
|
} |
389
|
|
|
|
390
|
|
|
/** |
391
|
|
|
* Set the features. |
392
|
|
|
* |
393
|
|
|
* @param Feature[] $features The features. |
394
|
|
|
* @return RequestData |
395
|
|
|
*/ |
396
|
|
|
public function setFeatures(array $features) |
397
|
|
|
{ |
398
|
|
|
$this->features = $features; |
399
|
|
|
|
400
|
|
|
return $this; |
401
|
|
|
} |
402
|
|
|
|
403
|
|
|
/** |
404
|
|
|
* Check if suppress mail. |
405
|
|
|
* |
406
|
|
|
* @return boolean |
407
|
|
|
*/ |
408
|
|
|
public function getSuppressMail() |
409
|
|
|
{ |
410
|
|
|
return (boolean)$this->suppressMail; |
411
|
|
|
} |
412
|
|
|
|
413
|
|
|
/** |
414
|
|
|
* Set if suppress mail. |
415
|
|
|
* |
416
|
|
|
* @param boolean $suppressMail Flag if suppress confirmation mail to customer. |
417
|
|
|
* @return RequestData |
418
|
|
|
*/ |
419
|
|
|
public function setSuppressMail($suppressMail) |
420
|
|
|
{ |
421
|
|
|
$this->suppressMail = (integer)(boolean)$suppressMail; |
422
|
|
|
|
423
|
|
|
return $this; |
424
|
|
|
} |
425
|
|
|
} |
426
|
|
|
|