Passed
Pull Request — master (#74)
by oleksandr
04:55
created

GenericPaymentContainer::throwNullValueException()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 4
Code Lines 2

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
eloc 2
c 0
b 0
f 0
dl 0
loc 4
rs 10
cc 1
nc 1
nop 1
1
<?php
2
3
/**
4
 * MIT License
5
 * Use of this software requires acceptance of the Evaluation License Agreement. See LICENSE file.
6
 */
7
8
namespace SprykerEco\Zed\Payone\Business\Api\Request\Container;
9
10
use Exception;
11
use SprykerEco\Shared\Payone\PayoneApiConstants;
12
use SprykerEco\Zed\Payone\Business\Api\Request\Container\GenericPayment\PaydataContainer;
13
14
class GenericPaymentContainer extends AbstractRequestContainer
15
{
16
    /**
17
     * @var string
18
     */
19
    protected $request = PayoneApiConstants::REQUEST_TYPE_GENERICPAYMENT;
20
21
    /**
22
     * @var string|null
23
     */
24
    protected $clearingtype;
25
26
    /**
27
     * @var int|null
28
     */
29
    protected $amount;
30
31
    /**
32
     * @var string|null
33
     */
34
    protected $currency;
35
36
    /**
37
     * @var string|null
38
     */
39
    protected $narrative_text;
40
41
    /**
42
     * @var \SprykerEco\Zed\Payone\Business\Api\Request\Container\GenericPayment\PaydataContainer|null
43
     */
44
    protected $paydata;
45
46
    /**
47
     * @var string|null
48
     */
49
    protected $workorderid;
50
51
    /**
52
     * @var string|null
53
     */
54
    protected $shipping_firstname;
55
56
    /**
57
     * @var string|null
58
     */
59
    protected $shipping_lastname;
60
61
    /**
62
     * @var string|null
63
     */
64
    protected $shipping_company;
65
66
    /**
67
     * @var string|null
68
     */
69
    protected $shipping_street;
70
71
    /**
72
     * @var int|null
73
     */
74
    protected $shipping_zip;
75
76
    /**
77
     * @var string|null
78
     */
79
    protected $shipping_city;
80
81
    /**
82
     * @var string|null
83
     */
84
    protected $shipping_state;
85
86
    /**
87
     * @var string|null
88
     */
89
    protected $shipping_country;
90
91
    /**
92
     * @var string|null
93
     */
94
    protected $wallettype;
95
96
    /**
97
     * @var string
98
     */
99
    protected $successurl;
100
101
    /**
102
     * @var string
103
     */
104
    protected $errorurl;
105
106
    /**
107
     * @var string
108
     */
109
    protected $backurl;
110
111
    /**
112
     * @return string|null
113
     */
114
    public function getClearingType(): ?string
115
    {
116
        return $this->clearingtype;
117
    }
118
119
    /**
120
     * @param string $clearingType
121
     *
122
     * @return void
123
     */
124
    public function setClearingType(string $clearingType): void
125
    {
126
        $this->clearingtype = $clearingType;
127
    }
128
129
    /**
130
     * @return int|null
131
     */
132
    public function getAmount(): ?int
133
    {
134
        return $this->amount;
135
    }
136
137
    /**
138
     * @param int $amount
139
     *
140
     * @return void
141
     */
142
    public function setAmount(int $amount): void
143
    {
144
        $this->amount = $amount;
145
    }
146
147
    /**
148
     * @return string|null
149
     */
150
    public function getCurrency(): ?string
151
    {
152
        return $this->currency;
153
    }
154
155
    /**
156
     * @param string $currency
157
     *
158
     * @return void
159
     */
160
    public function setCurrency(string $currency): void
161
    {
162
        $this->currency = $currency;
163
    }
164
165
    /**
166
     * @return string|null
167
     */
168
    public function getNarrativeText(): ?string
169
    {
170
        return $this->narrative_text;
171
    }
172
173
    /**
174
     * @param string $narrativeText
175
     *
176
     * @return void
177
     */
178
    public function setNarrativeText(string $narrativeText): void
179
    {
180
        $this->narrative_text = $narrativeText;
181
    }
182
183
    /**
184
     * @return \SprykerEco\Zed\Payone\Business\Api\Request\Container\GenericPayment\PaydataContainer|null
185
     */
186
    public function getPaydata(): ?PaydataContainer
187
    {
188
        return $this->paydata;
189
    }
190
191
    /**
192
     * @SuppressWarnings(PHPMD.UnusedLocalVariable)
193
     *
194
     * @return \SprykerEco\Zed\Payone\Business\Api\Request\Container\GenericPayment\PaydataContainer
195
     */
196
    public function getPaydataOrFail(): PaydataContainer
197
    {
198
        $paydata = $this->paydata;
199
200
        if ($paydata === null) {
201
            $this->throwNullValueException('paydata');
202
        }
203
204
        return $paydata;
205
    }
206
207
    /**
208
     * @param \SprykerEco\Zed\Payone\Business\Api\Request\Container\GenericPayment\PaydataContainer $paydata
209
     *
210
     * @return void
211
     */
212
    public function setPaydata(PaydataContainer $paydata): void
213
    {
214
        $this->paydata = $paydata;
215
    }
216
217
    /**
218
     * @return string|null
219
     */
220
    public function getWorkOrderId(): ?string
221
    {
222
        return $this->workorderid;
223
    }
224
225
    /**
226
     * @param string|null $workOrderId
227
     *
228
     * @return void
229
     */
230
    public function setWorkOrderId(?string $workOrderId = null): void
231
    {
232
        $this->workorderid = $workOrderId;
233
    }
234
235
    /**
236
     * @return string|null
237
     */
238
    public function getShippingFirstName(): ?string
239
    {
240
        return $this->shipping_firstname;
241
    }
242
243
    /**
244
     * @param string $shippingFirstName
245
     *
246
     * @return void
247
     */
248
    public function setShippingFirstName(string $shippingFirstName): void
249
    {
250
        $this->shipping_firstname = $shippingFirstName;
251
    }
252
253
    /**
254
     * @return string|null
255
     */
256
    public function getShippingLastName(): ?string
257
    {
258
        return $this->shipping_lastname;
259
    }
260
261
    /**
262
     * @param string $shippingLastName
263
     *
264
     * @return void
265
     */
266
    public function setShippingLastName(string $shippingLastName): void
267
    {
268
        $this->shipping_lastname = $shippingLastName;
269
    }
270
271
    /**
272
     * @return string|null
273
     */
274
    public function getShippingCompany(): ?string
275
    {
276
        return $this->shipping_company;
277
    }
278
279
    /**
280
     * @param string $shippingCompany
281
     *
282
     * @return void
283
     */
284
    public function setShippingCompany(string $shippingCompany): void
285
    {
286
        $this->shipping_company = $shippingCompany;
287
    }
288
289
    /**
290
     * @return string|null
291
     */
292
    public function getShippingStreet(): ?string
293
    {
294
        return $this->shipping_street;
295
    }
296
297
    /**
298
     * @param string $shippingStreet
299
     *
300
     * @return void
301
     */
302
    public function setShippingStreet(string $shippingStreet): void
303
    {
304
        $this->shipping_street = $shippingStreet;
305
    }
306
307
    /**
308
     * @return int|null
309
     */
310
    public function getShippingZip(): ?int
311
    {
312
        return $this->shipping_zip;
313
    }
314
315
    /**
316
     * @param int $shippingZip
317
     *
318
     * @return void
319
     */
320
    public function setShippingZip(int $shippingZip): void
321
    {
322
        $this->shipping_zip = $shippingZip;
323
    }
324
325
    /**
326
     * @return string|null
327
     */
328
    public function getShippingCity(): ?string
329
    {
330
        return $this->shipping_city;
331
    }
332
333
    /**
334
     * @param string $shippingCity
335
     *
336
     * @return void
337
     */
338
    public function setShippingCity(string $shippingCity): void
339
    {
340
        $this->shipping_city = $shippingCity;
341
    }
342
343
    /**
344
     * @return string|null
345
     */
346
    public function getShippingState(): ?string
347
    {
348
        return $this->shipping_state;
349
    }
350
351
    /**
352
     * @param string $shippingState
353
     *
354
     * @return void
355
     */
356
    public function setShippingState(string $shippingState): void
357
    {
358
        $this->shipping_state = $shippingState;
359
    }
360
361
    /**
362
     * @return string|null
363
     */
364
    public function getShippingCountry(): ?string
365
    {
366
        return $this->shipping_country;
367
    }
368
369
    /**
370
     * @param string $shippingCountry
371
     *
372
     * @return void
373
     */
374
    public function setShippingCountry(string $shippingCountry): void
375
    {
376
        $this->shipping_country = $shippingCountry;
377
    }
378
379
    /**
380
     * @return string|null
381
     */
382
    public function getWalletType(): ?string
383
    {
384
        return $this->wallettype;
385
    }
386
387
    /**
388
     * @param string $walletType
389
     *
390
     * @return void
391
     */
392
    public function setWalletType(string $walletType): void
393
    {
394
        $this->wallettype = $walletType;
395
    }
396
397
    /**
398
     * @param string $propertyName
399
     *
400
     * @throws \Exception
401
     *
402
     * @return void
403
     */
404
    protected function throwNullValueException(string $propertyName): void
405
    {
406
        throw new Exception(
407
            sprintf('Property "%s" of container `%s` is null.', $propertyName, static::class),
408
        );
409
    }
410
}
411