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 ThreeDS2AuthorizationInformation */ |
86
|
|
|
private $threeDS2AuthorizationInformation; |
87
|
|
|
|
88
|
|
|
/** |
89
|
|
|
* Gets the value of id. |
90
|
|
|
* @return mixed |
91
|
|
|
*/ |
92
|
|
|
public function getId() |
93
|
|
|
{ |
94
|
|
|
return $this->id; |
95
|
|
|
} |
96
|
|
|
|
97
|
|
|
/** |
98
|
|
|
* Sets the value of id. |
99
|
|
|
* @param mixed $id the id |
100
|
|
|
* @return void |
101
|
|
|
*/ |
102
|
|
|
public function setId($id) |
103
|
|
|
{ |
104
|
|
|
$this->id = $id; |
105
|
|
|
} |
106
|
|
|
|
107
|
|
|
/** |
108
|
|
|
* Gets the value of amount. |
109
|
|
|
* @return mixed |
110
|
|
|
*/ |
111
|
|
|
public function getAmount() |
112
|
|
|
{ |
113
|
|
|
return $this->amount; |
114
|
|
|
} |
115
|
|
|
|
116
|
|
|
/** |
117
|
|
|
* Sets the value of amount. |
118
|
|
|
* @param mixed $amount the amount |
119
|
|
|
* @return void |
120
|
|
|
*/ |
121
|
|
|
public function setAmount($amount) |
122
|
|
|
{ |
123
|
|
|
$this->amount = $amount; |
124
|
|
|
} |
125
|
|
|
|
126
|
|
|
/** |
127
|
|
|
* Gets the value of currency. |
128
|
|
|
* @return mixed |
129
|
|
|
*/ |
130
|
|
|
public function getCurrency() |
131
|
|
|
{ |
132
|
|
|
return $this->currency; |
133
|
|
|
} |
134
|
|
|
|
135
|
|
|
/** |
136
|
|
|
* Sets the value of currency. |
137
|
|
|
* @param mixed $currency the currency |
138
|
|
|
* @return void |
139
|
|
|
*/ |
140
|
|
|
public function setCurrency($currency) |
141
|
|
|
{ |
142
|
|
|
$this->currency = $currency; |
143
|
|
|
} |
144
|
|
|
|
145
|
|
|
/** |
146
|
|
|
* Gets the value of created. |
147
|
|
|
* @return mixed |
148
|
|
|
*/ |
149
|
|
|
public function getCreated() |
150
|
|
|
{ |
151
|
|
|
return $this->created; |
152
|
|
|
} |
153
|
|
|
|
154
|
|
|
/** |
155
|
|
|
* Sets the value of created. |
156
|
|
|
* @param mixed $created the created |
157
|
|
|
* @return void |
158
|
|
|
*/ |
159
|
|
|
public function setCreated($created) |
160
|
|
|
{ |
161
|
|
|
$this->created = $created; |
162
|
|
|
} |
163
|
|
|
|
164
|
|
|
/** |
165
|
|
|
* Gets the value of type. |
166
|
|
|
* @return mixed |
167
|
|
|
*/ |
168
|
|
|
public function getType() |
169
|
|
|
{ |
170
|
|
|
return $this->type; |
171
|
|
|
} |
172
|
|
|
|
173
|
|
|
/** |
174
|
|
|
* Sets the value of type. |
175
|
|
|
* @param mixed $type the type |
176
|
|
|
* @return void |
177
|
|
|
*/ |
178
|
|
|
public function setType($type) |
179
|
|
|
{ |
180
|
|
|
$this->type = $type; |
181
|
|
|
} |
182
|
|
|
|
183
|
|
|
/** |
184
|
|
|
* Gets the value of live. |
185
|
|
|
* @return mixed |
186
|
|
|
*/ |
187
|
|
|
public function getLive() |
188
|
|
|
{ |
189
|
|
|
return $this->live; |
190
|
|
|
} |
191
|
|
|
|
192
|
|
|
/** |
193
|
|
|
* Sets the value of live. |
194
|
|
|
* @param mixed $live the live |
195
|
|
|
* @return void |
196
|
|
|
*/ |
197
|
|
|
public function setLive($live) |
198
|
|
|
{ |
199
|
|
|
$this->live = $live; |
200
|
|
|
} |
201
|
|
|
|
202
|
|
|
/** |
203
|
|
|
* Gets the value of settle. |
204
|
|
|
* @return mixed |
205
|
|
|
*/ |
206
|
|
|
public function getSettle() |
207
|
|
|
{ |
208
|
|
|
return $this->settle; |
209
|
|
|
} |
210
|
|
|
|
211
|
|
|
/** |
212
|
|
|
* Sets the value of settle. |
213
|
|
|
* @param mixed $settle the settle |
214
|
|
|
* @return void |
215
|
|
|
*/ |
216
|
|
|
public function setSettle($settle) |
217
|
|
|
{ |
218
|
|
|
$this->settle = $settle; |
219
|
|
|
} |
220
|
|
|
|
221
|
|
|
/** |
222
|
|
|
* Gets the value of status. |
223
|
|
|
* @return mixed |
224
|
|
|
*/ |
225
|
|
|
public function getStatus() |
226
|
|
|
{ |
227
|
|
|
return $this->status; |
228
|
|
|
} |
229
|
|
|
|
230
|
|
|
/** |
231
|
|
|
* Sets the value of status. |
232
|
|
|
* @param mixed $status the status |
233
|
|
|
* @return void |
234
|
|
|
*/ |
235
|
|
|
public function setStatus($status) |
236
|
|
|
{ |
237
|
|
|
$this->status = $status; |
238
|
|
|
} |
239
|
|
|
|
240
|
|
|
/** |
241
|
|
|
* Gets the value of error. |
242
|
|
|
* @return mixed |
243
|
|
|
*/ |
244
|
|
|
public function getError() |
245
|
|
|
{ |
246
|
|
|
return $this->error; |
247
|
|
|
} |
248
|
|
|
|
249
|
|
|
/** |
250
|
|
|
* Sets the value of error. |
251
|
|
|
* @param mixed $error the error |
252
|
|
|
* @return void |
253
|
|
|
*/ |
254
|
|
|
public function setError($error) |
255
|
|
|
{ |
256
|
|
|
$this->error = $error; |
257
|
|
|
} |
258
|
|
|
|
259
|
|
|
/** |
260
|
|
|
* Gets the value of orderId. |
261
|
|
|
* @return mixed |
262
|
|
|
*/ |
263
|
|
|
public function getOrderId() |
264
|
|
|
{ |
265
|
|
|
return $this->orderId; |
266
|
|
|
} |
267
|
|
|
|
268
|
|
|
/** |
269
|
|
|
* Sets the value of orderId. |
270
|
|
|
* @param mixed $orderId the order id |
271
|
|
|
* @return void |
272
|
|
|
*/ |
273
|
|
|
public function setOrderId($orderId) |
274
|
|
|
{ |
275
|
|
|
$this->orderId = $orderId; |
276
|
|
|
} |
277
|
|
|
|
278
|
|
|
/** |
279
|
|
|
* Gets the value of description. |
280
|
|
|
* @return mixed |
281
|
|
|
*/ |
282
|
|
|
public function getDescription() |
283
|
|
|
{ |
284
|
|
|
return $this->description; |
285
|
|
|
} |
286
|
|
|
|
287
|
|
|
/** |
288
|
|
|
* Sets the value of description. |
289
|
|
|
* @param mixed $description the description |
290
|
|
|
* @return void |
291
|
|
|
*/ |
292
|
|
|
public function setDescription($description) |
293
|
|
|
{ |
294
|
|
|
$this->description = $description; |
295
|
|
|
} |
296
|
|
|
|
297
|
|
|
/** |
298
|
|
|
* Gets the value of country. |
299
|
|
|
* @return mixed |
300
|
|
|
*/ |
301
|
|
|
public function getCountry() |
302
|
|
|
{ |
303
|
|
|
return $this->country; |
304
|
|
|
} |
305
|
|
|
|
306
|
|
|
/** |
307
|
|
|
* Sets the value of country. |
308
|
|
|
* @param mixed $country the country |
309
|
|
|
* @return void |
310
|
|
|
*/ |
311
|
|
|
public function setCountry($country) |
312
|
|
|
{ |
313
|
|
|
$this->country = $country; |
314
|
|
|
} |
315
|
|
|
|
316
|
|
|
/** |
317
|
|
|
* Gets the value of paymentMethod. |
318
|
|
|
* @return mixed |
319
|
|
|
*/ |
320
|
|
|
public function getPaymentMethod() |
321
|
|
|
{ |
322
|
|
|
return $this->paymentMethod; |
323
|
|
|
} |
324
|
|
|
|
325
|
|
|
/** |
326
|
|
|
* Sets the value of paymentMethod. |
327
|
|
|
* @param mixed $paymentMethod the payment method |
328
|
|
|
* @return void |
329
|
|
|
*/ |
330
|
|
|
public function setPaymentMethod($paymentMethod) |
331
|
|
|
{ |
332
|
|
|
$this->paymentMethod = $paymentMethod; |
333
|
|
|
} |
334
|
|
|
|
335
|
|
|
/** |
336
|
|
|
* Gets the value of paymentInstrument. |
337
|
|
|
* @return PaymentInstrumentInterface |
338
|
|
|
*/ |
339
|
|
|
public function getPaymentInstrument() |
340
|
|
|
{ |
341
|
|
|
return $this->paymentInstrument; |
342
|
|
|
} |
343
|
|
|
|
344
|
|
|
/** |
345
|
|
|
* Sets the value of paymentInstrument. |
346
|
|
|
* @param PaymentInstrumentInterface $paymentInstrument the payment instrument |
347
|
|
|
* @return void |
348
|
|
|
*/ |
349
|
|
|
public function setPaymentInstrument(PaymentInstrumentInterface $paymentInstrument) |
350
|
|
|
{ |
351
|
|
|
$this->paymentInstrument = $paymentInstrument; |
352
|
|
|
} |
353
|
|
|
|
354
|
|
|
/** |
355
|
|
|
* @deprecated method is deprecated and shouldn't be used. |
356
|
|
|
* Gets the value of authorizeData. |
357
|
|
|
* @return mixed |
358
|
|
|
*/ |
359
|
|
|
public function getAuthorizeData() |
360
|
|
|
{ |
361
|
|
|
return $this->authorizeData; |
|
|
|
|
362
|
|
|
} |
363
|
|
|
|
364
|
|
|
/** |
365
|
|
|
* @deprecated method is deprecated and shouldn't be used. |
366
|
|
|
* Sets the value of authorizeData. |
367
|
|
|
* @param mixed $authorizeData the authorize data |
368
|
|
|
* @return void |
369
|
|
|
*/ |
370
|
|
|
public function setAuthorizeData($authorizeData) |
371
|
|
|
{ |
372
|
|
|
$this->authorizeData = $authorizeData; |
|
|
|
|
373
|
|
|
} |
374
|
|
|
|
375
|
|
|
/** |
376
|
|
|
* Gets the value of authorizationInformation. |
377
|
|
|
* @return AuthorizationInformation |
378
|
|
|
*/ |
379
|
|
|
public function getAuthorizationInformation() |
380
|
|
|
{ |
381
|
|
|
return $this->authorizationInformation; |
382
|
|
|
} |
383
|
|
|
|
384
|
|
|
/** |
385
|
|
|
* Sets the value of authorizationInformation. |
386
|
|
|
* @param AuthorizationInformation $authorizationInformation the authorization information |
387
|
|
|
* @return void |
388
|
|
|
*/ |
389
|
|
|
public function setAuthorizationInformation(AuthorizationInformation $authorizationInformation) |
390
|
|
|
{ |
391
|
|
|
$this->authorizationInformation = $authorizationInformation; |
392
|
|
|
} |
393
|
|
|
|
394
|
|
|
/** |
395
|
|
|
* @return ThreeDS2AuthorizationInformation |
396
|
|
|
*/ |
397
|
|
|
public function getThreeds2Data() |
398
|
|
|
{ |
399
|
|
|
return $this->threeDS2AuthorizationInformation; |
400
|
|
|
} |
401
|
|
|
|
402
|
|
|
/** |
403
|
|
|
* @param ThreeDS2AuthorizationInformation |
404
|
|
|
* @return VOID |
405
|
|
|
*/ |
406
|
|
|
public function setThreeds2Data( |
407
|
|
|
ThreeDS2AuthorizationInformation $threeDS2AuthorizationInformation |
408
|
|
|
){ |
409
|
|
|
$this->threeDS2AuthorizationInformation = $threeDS2AuthorizationInformation; |
410
|
|
|
} |
411
|
|
|
|
412
|
|
|
/** |
413
|
|
|
* @return BOOL is it 3D secure v1? |
414
|
|
|
*/ |
415
|
|
|
public function isThreedsV1() : bool |
416
|
|
|
{ |
417
|
|
|
return $this->authorizationInformation != null; |
418
|
|
|
} |
419
|
|
|
|
420
|
|
|
/** |
421
|
|
|
* @return BOOL is it 3D secure v2? |
422
|
|
|
*/ |
423
|
|
|
public function isThreedsV2() : bool |
424
|
|
|
{ |
425
|
|
|
return $this->threeDS2AuthorizationInformation != null; |
426
|
|
|
} |
427
|
|
|
|
428
|
|
|
/** |
429
|
|
|
* Check if payment is pending |
430
|
|
|
* @return boolean |
431
|
|
|
*/ |
432
|
|
|
public function isPending() |
433
|
|
|
{ |
434
|
|
|
return $this->getStatus() === 'pending'; |
435
|
|
|
} |
436
|
|
|
|
437
|
|
|
/** |
438
|
|
|
* Check if payment is approved |
439
|
|
|
* @return boolean |
440
|
|
|
*/ |
441
|
|
|
public function isApproved() |
442
|
|
|
{ |
443
|
|
|
return $this->getStatus() === 'approved'; |
444
|
|
|
} |
445
|
|
|
|
446
|
|
|
/** |
447
|
|
|
* Check if payment is declined |
448
|
|
|
* @return boolean |
449
|
|
|
*/ |
450
|
|
|
public function isDeclined() |
451
|
|
|
{ |
452
|
|
|
return $this->getStatus() === 'declined'; |
453
|
|
|
} |
454
|
|
|
} |
455
|
|
|
|
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.