Passed
Pull Request — master (#74)
by oleksandr
05:10
created

GenericPaymentContainer::getPaydataOrFail()   A

Complexity

Conditions 2
Paths 2

Size

Total Lines 9
Code Lines 4

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
eloc 4
c 0
b 0
f 0
dl 0
loc 9
rs 10
cc 2
nc 2
nop 0
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
     * @SuppressWarnings(PHPMD.UnusedLocalVariable)
192
     *
193
     * @return \SprykerEco\Zed\Payone\Business\Api\Request\Container\GenericPayment\PaydataContainer
194
     */
195
    public function getPaydataOrFail(): PaydataContainer
196
    {
197
        $paydata = $this->paydata;
198
199
        if ($paydata === null) {
200
            $this->throwNullValueException('paydata');
201
        }
202
203
        return $paydata;
204
    }
205
206
207
208
    /**
209
     * @param \SprykerEco\Zed\Payone\Business\Api\Request\Container\GenericPayment\PaydataContainer $paydata
210
     *
211
     * @return void
212
     */
213
    public function setPaydata(PaydataContainer $paydata): void
214
    {
215
        $this->paydata = $paydata;
216
    }
217
218
    /**
219
     * @return string|null
220
     */
221
    public function getWorkOrderId(): ?string
222
    {
223
        return $this->workorderid;
224
    }
225
226
    /**
227
     * @param string|null $workOrderId
228
     *
229
     * @return void
230
     */
231
    public function setWorkOrderId(?string $workOrderId = null): void
232
    {
233
        $this->workorderid = $workOrderId;
234
    }
235
236
    /**
237
     * @return string|null
238
     */
239
    public function getShippingFirstName(): ?string
240
    {
241
        return $this->shipping_firstname;
242
    }
243
244
    /**
245
     * @param string $shippingFirstName
246
     *
247
     * @return void
248
     */
249
    public function setShippingFirstName(string $shippingFirstName): void
250
    {
251
        $this->shipping_firstname = $shippingFirstName;
252
    }
253
254
    /**
255
     * @return string|null
256
     */
257
    public function getShippingLastName(): ?string
258
    {
259
        return $this->shipping_lastname;
260
    }
261
262
    /**
263
     * @param string $shippingLastName
264
     *
265
     * @return void
266
     */
267
    public function setShippingLastName(string $shippingLastName): void
268
    {
269
        $this->shipping_lastname = $shippingLastName;
270
    }
271
272
    /**
273
     * @return string|null
274
     */
275
    public function getShippingCompany(): ?string
276
    {
277
        return $this->shipping_company;
278
    }
279
280
    /**
281
     * @param string $shippingCompany
282
     *
283
     * @return void
284
     */
285
    public function setShippingCompany(string $shippingCompany): void
286
    {
287
        $this->shipping_company = $shippingCompany;
288
    }
289
290
    /**
291
     * @return string|null
292
     */
293
    public function getShippingStreet(): ?string
294
    {
295
        return $this->shipping_street;
296
    }
297
298
    /**
299
     * @param string $shippingStreet
300
     *
301
     * @return void
302
     */
303
    public function setShippingStreet(string $shippingStreet): void
304
    {
305
        $this->shipping_street = $shippingStreet;
306
    }
307
308
    /**
309
     * @return int|null
310
     */
311
    public function getShippingZip(): ?int
312
    {
313
        return $this->shipping_zip;
314
    }
315
316
    /**
317
     * @param int $shippingZip
318
     *
319
     * @return void
320
     */
321
    public function setShippingZip(int $shippingZip): void
322
    {
323
        $this->shipping_zip = $shippingZip;
324
    }
325
326
    /**
327
     * @return string|null
328
     */
329
    public function getShippingCity(): ?string
330
    {
331
        return $this->shipping_city;
332
    }
333
334
    /**
335
     * @param string $shippingCity
336
     *
337
     * @return void
338
     */
339
    public function setShippingCity(string $shippingCity): void
340
    {
341
        $this->shipping_city = $shippingCity;
342
    }
343
344
    /**
345
     * @return string|null
346
     */
347
    public function getShippingState(): ?string
348
    {
349
        return $this->shipping_state;
350
    }
351
352
    /**
353
     * @param string $shippingState
354
     *
355
     * @return void
356
     */
357
    public function setShippingState(string $shippingState): void
358
    {
359
        $this->shipping_state = $shippingState;
360
    }
361
362
    /**
363
     * @return string|null
364
     */
365
    public function getShippingCountry(): ?string
366
    {
367
        return $this->shipping_country;
368
    }
369
370
    /**
371
     * @param string $shippingCountry
372
     *
373
     * @return void
374
     */
375
    public function setShippingCountry(string $shippingCountry): void
376
    {
377
        $this->shipping_country = $shippingCountry;
378
    }
379
380
    /**
381
     * @return string|null
382
     */
383
    public function getWalletType(): ?string
384
    {
385
        return $this->wallettype;
386
    }
387
388
    /**
389
     * @param string $walletType
390
     *
391
     * @return void
392
     */
393
    public function setWalletType(string $walletType): void
394
    {
395
        $this->wallettype = $walletType;
396
    }
397
398
    /**
399
     * @param string $propertyName
400
     *
401
     * @throws \Spryker\Shared\Kernel\Transfer\Exception\NullValueException
402
     *
403
     * @return void
404
     */
405
    protected function throwNullValueException(string $propertyName): void
406
    {
407
        throw new Exception(
408
            sprintf('Property "%s" of container `%s` is null.', $propertyName, static::class),
409
        );
410
    }
411
}
412