Test Failed
Pull Request — master (#12)
by
unknown
02:05
created

Payment::getThreeds2data()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 4

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
dl 0
loc 4
rs 10
c 0
b 0
f 0
cc 1
nc 1
nop 0
1
<?php
2
3
namespace Cardinity\Method\Payment;
4
5
use Cardinity\Method\ResultObject;
6
use Cardinity\Method\Payment\ThreeDS2Data;
7
use Cardinity\Method\Payment\ThreeDS2AuthorizationInformation;
8
9
class Payment extends ResultObject
10
{
11
    /** @type string ID of the payment.
12
        Value assigned by Cardinity. */
13
    private $id;
14
15
    /** @type float Amount charged shown in #0.00 format. */
16
    private $amount;
17
18
    /** @type string Three-letter ISO currency code representing the currency in
19
        which the charge was made.
20
        Supported currencies: EUR, USD. */
21
    private $currency;
22
23
    /** @type string Payment creation time as defined in RFC 3339 Section 5.6.
24
        UTC timezone.
25
        Value assigned by Cardinity. */
26
    private $created;
27
28
    /** @type string Payment type.
29
        Can be one of the following: authorization, purchase.
30
        Value assigned by Cardinity. */
31
    private $type;
32
33
    /** @type boolean Indicates whether a payment was made in live or testing
34
        mode.
35
        Value assigned by Cardinity. */
36
    private $live;
37
38
    /** @type boolean Optional. Default: true.
39
        Used to indicate a transaction type while creating a payment: true -
40
        purchase, false - authorization. */
41
    private $settle;
42
43
    /** @type string Payment status.
44
        Can be one of the following: pending, approved, declined.
45
        Value assigned by Cardinity. */
46
    private $status;
47
48
    /** @type string Error message.
49
        Returned only if status is declined.
50
        Provides human readable information why the payment failed.
51
        Value assigned by Cardinity. */
52
    private $error;
53
54
    /** @type string Optional. Order ID provided by a merchant.
55
        Must be between 2 and 50 characters [A-Za-z0-9'.-]. */
56
    private $orderId;
57
58
    /** @type string Payment description provided by a merchant.
59
        Maximum length 255 characters. */
60
    private $description;
61
62
    /** @type string Country of a customer provided by a merchant.
63
        ISO 3166-1 alpha-2 country code. */
64
    private $country;
65
66
    /** @type string Can be one the following: card, recurring. */
67
    private $paymentMethod;
68
69
    /** @type PaymentInstrumentInterface Payment instrument representing earlier described
70
        payment_method.
71
        Can be one of the following: card or recurring.
72
     */
73
    private $paymentInstrument;
74
75
    /** @deprecated 
76
     * @type string Used to provide additional information (PATCH verb) once
77
        customer completes authorization process. */
78
    private $authorizeData;
79
80
    /** @type AuthorizationInformation Specific authorization object returned in case additional
81
        payment authorization is needed (i.e. payment status is pending).
82
        Value assigned by Cardinity. */
83
    private $authorizationInformation;
84
85
    /** @type array of 3D secure data for payment object */
86
    private $threeDS2Data;
87
    
88
    /** @type ThreeDS2AuthorizationInformation */
89
    private $threeDS2AuthorizationInformation;
90
91
    /**
92
     * Gets the value of id.
93
     * @return mixed
94
     */
95
    public function getId()
96
    {
97
        return $this->id;
98
    }
99
100
    /**
101
     * Sets the value of id.
102
     * @param mixed $id the id
103
     * @return void
104
     */
105
    public function setId($id)
106
    {
107
        $this->id = $id;
108
    }
109
110
    /**
111
     * Gets the value of amount.
112
     * @return mixed
113
     */
114
    public function getAmount()
115
    {
116
        return $this->amount;
117
    }
118
119
    /**
120
     * Sets the value of amount.
121
     * @param mixed $amount the amount
122
     * @return void
123
     */
124
    public function setAmount($amount)
125
    {
126
        $this->amount = $amount;
127
    }
128
129
    /**
130
     * Gets the value of currency.
131
     * @return mixed
132
     */
133
    public function getCurrency()
134
    {
135
        return $this->currency;
136
    }
137
138
    /**
139
     * Sets the value of currency.
140
     * @param mixed $currency the currency
141
     * @return void
142
     */
143
    public function setCurrency($currency)
144
    {
145
        $this->currency = $currency;
146
    }
147
148
    /**
149
     * Gets the value of created.
150
     * @return mixed
151
     */
152
    public function getCreated()
153
    {
154
        return $this->created;
155
    }
156
157
    /**
158
     * Sets the value of created.
159
     * @param mixed $created the created
160
     * @return void
161
     */
162
    public function setCreated($created)
163
    {
164
        $this->created = $created;
165
    }
166
167
    /**
168
     * Gets the value of type.
169
     * @return mixed
170
     */
171
    public function getType()
172
    {
173
        return $this->type;
174
    }
175
176
    /**
177
     * Sets the value of type.
178
     * @param mixed $type the type
179
     * @return void
180
     */
181
    public function setType($type)
182
    {
183
        $this->type = $type;
184
    }
185
186
    /**
187
     * Gets the value of live.
188
     * @return mixed
189
     */
190
    public function getLive()
191
    {
192
        return $this->live;
193
    }
194
195
    /**
196
     * Sets the value of live.
197
     * @param mixed $live the live
198
     * @return void
199
     */
200
    public function setLive($live)
201
    {
202
        $this->live = $live;
203
    }
204
205
    /**
206
     * Gets the value of settle.
207
     * @return mixed
208
     */
209
    public function getSettle()
210
    {
211
        return $this->settle;
212
    }
213
214
    /**
215
     * Sets the value of settle.
216
     * @param mixed $settle the settle
217
     * @return void
218
     */
219
    public function setSettle($settle)
220
    {
221
        $this->settle = $settle;
222
    }
223
224
    /**
225
     * Gets the value of status.
226
     * @return mixed
227
     */
228
    public function getStatus()
229
    {
230
        return $this->status;
231
    }
232
233
    /**
234
     * Sets the value of status.
235
     * @param mixed $status the status
236
     * @return void
237
     */
238
    public function setStatus($status)
239
    {
240
        $this->status = $status;
241
    }
242
243
    /**
244
     * Gets the value of error.
245
     * @return mixed
246
     */
247
    public function getError()
248
    {
249
        return $this->error;
250
    }
251
252
    /**
253
     * Sets the value of error.
254
     * @param mixed $error the error
255
     * @return void
256
     */
257
    public function setError($error)
258
    {
259
        $this->error = $error;
260
    }
261
262
    /**
263
     * Gets the value of orderId.
264
     * @return mixed
265
     */
266
    public function getOrderId()
267
    {
268
        return $this->orderId;
269
    }
270
271
    /**
272
     * Sets the value of orderId.
273
     * @param mixed $orderId the order id
274
     * @return void
275
     */
276
    public function setOrderId($orderId)
277
    {
278
        $this->orderId = $orderId;
279
    }
280
281
    /**
282
     * Gets the value of description.
283
     * @return mixed
284
     */
285
    public function getDescription()
286
    {
287
        return $this->description;
288
    }
289
290
    /**
291
     * Sets the value of description.
292
     * @param mixed $description the description
293
     * @return void
294
     */
295
    public function setDescription($description)
296
    {
297
        $this->description = $description;
298
    }
299
300
    /**
301
     * Gets the value of country.
302
     * @return mixed
303
     */
304
    public function getCountry()
305
    {
306
        return $this->country;
307
    }
308
309
    /**
310
     * Sets the value of country.
311
     * @param mixed $country the country
312
     * @return void
313
     */
314
    public function setCountry($country)
315
    {
316
        $this->country = $country;
317
    }
318
319
    /**
320
     * Gets the value of paymentMethod.
321
     * @return mixed
322
     */
323
    public function getPaymentMethod()
324
    {
325
        return $this->paymentMethod;
326
    }
327
328
    /**
329
     * Sets the value of paymentMethod.
330
     * @param mixed $paymentMethod the payment method
331
     * @return void
332
     */
333
    public function setPaymentMethod($paymentMethod)
334
    {
335
        $this->paymentMethod = $paymentMethod;
336
    }
337
338
    /**
339
     * Gets the value of paymentInstrument.
340
     * @return PaymentInstrumentInterface
341
     */
342
    public function getPaymentInstrument()
343
    {
344
        return $this->paymentInstrument;
345
    }
346
347
    /**
348
     * Sets the value of paymentInstrument.
349
     * @param PaymentInstrumentInterface $paymentInstrument the payment instrument
350
     * @return void
351
     */
352
    public function setPaymentInstrument(PaymentInstrumentInterface $paymentInstrument)
353
    {
354
        $this->paymentInstrument = $paymentInstrument;
355
    }
356
357
    /**
358
     * @deprecated method is deprecated and shouldn't be used.
359
     * Gets the value of authorizeData.
360
     * @return mixed
361
     */
362
    public function getAuthorizeData()
363
    {
364
        return $this->authorizeData;
0 ignored issues
show
Deprecated Code introduced by
The property Cardinity\Method\Payment\Payment::$authorizeData has been deprecated.

This property has been deprecated. The supplier of the class has supplied an explanatory message.

The explanatory message should give you some clue as to whether and when the property will be removed from the class and what other property to use instead.

Loading history...
365
    }
366
367
    /**
368
     * @deprecated method is deprecated and shouldn't be used.
369
     * Sets the value of authorizeData.
370
     * @param mixed $authorizeData the authorize data
371
     * @return void
372
     */
373
    public function setAuthorizeData($authorizeData)
374
    {
375
        $this->authorizeData = $authorizeData;
0 ignored issues
show
Deprecated Code introduced by
The property Cardinity\Method\Payment\Payment::$authorizeData has been deprecated.

This property has been deprecated. The supplier of the class has supplied an explanatory message.

The explanatory message should give you some clue as to whether and when the property will be removed from the class and what other property to use instead.

Loading history...
376
    }
377
378
    /**
379
     * Gets the value of authorizationInformation.
380
     * @return AuthorizationInformation
381
     */
382
    public function getAuthorizationInformation()
383
    {
384
        return $this->authorizationInformation;
385
    }
386
387
    /**
388
     * Sets the value of authorizationInformation.
389
     * @param AuthorizationInformation $authorizationInformation the authorization information
390
     * @return void
391
     */
392
    public function setAuthorizationInformation(AuthorizationInformation $authorizationInformation)
393
    {
394
        $this->authorizationInformation = $authorizationInformation;
395
    }
396
397
    /**
398
     * @return ThreeDS2AuthorizationInformation
399
     */
400
    public function getThreeds2data()
401
    {
402
        return $this->threeDS2AuthorizationInformation;
403
    }
404
405
    /**
406
     * @param ThreeDS2AuthorizationInformation
407
     * @return VOID
408
     */
409
    public function setThreeds2data(
410
        ThreeDS2AuthorizationInformation $threeDS2AuthorizationInformation
411
    ){
412
        $this->threeDS2AuthorizationInformation = $threeDS2AuthorizationInformation;
413
    }
414
415
    /**
416
     * @return ThreeDS2AuthorizationInformation
417
     */
418
    public function getThreeDS2AuthorizationInformation()
419
    {
420
        return $this->threeDS2AuthorizationInformation;
421
    }
422
423
    /**
424
     * @param ThreeDS2AuthorizationInformation
425
     * @return VOID
426
     */
427
    public function setThreeDS2AuthorizationInformation(
428
        ThreeDS2AuthorizationInformation $threeDS2AuthorizationInformation
429
    ){
430
        $this->threeDS2AuthorizationInformation = $threeDS2AuthorizationInformation;
431
    }
432
433
    /**
434
     * @return BOOL is it 3D secure v1?
435
     */
436
    public function isThreedsV1() : bool
437
    {
438
        return $this->authorizationInformation != null;
439
    }
440
441
    /**
442
     * @return BOOL is it 3D secure v2?
443
     */
444
    public function isThreedsV2() : bool
445
    {
446
        return $this->threeDS2AuthorizationInformation != null;
447
    }
448
449
    /**
450
     * Check if payment is pending
451
     * @return boolean
452
     */
453
    public function isPending()
454
    {
455
        return $this->getStatus() === 'pending';
456
    }
457
458
    /**
459
     * Check if payment is approved
460
     * @return boolean
461
     */
462
    public function isApproved()
463
    {
464
        return $this->getStatus() === 'approved';
465
    }
466
467
    /**
468
     * Check if payment is declined
469
     * @return boolean
470
     */
471
    public function isDeclined()
472
    {
473
        return $this->getStatus() === 'declined';
474
    }
475
}
476