1
|
|
|
<?php |
2
|
|
|
|
3
|
|
|
/* |
4
|
|
|
* Copyright notice: |
5
|
|
|
* (c) Copyright 2017 RocketGate |
6
|
|
|
* All rights reserved. |
7
|
|
|
* |
8
|
|
|
* The copyright notice must not be removed without specific, prior |
9
|
|
|
* written permission from RocketGate. |
10
|
|
|
* |
11
|
|
|
* This software is protected as an unpublished work under the U.S. copyright |
12
|
|
|
* laws. The above copyright notice is not intended to effect a publication of |
13
|
|
|
* this work. |
14
|
|
|
* This software is the confidential and proprietary information of RocketGate. |
15
|
|
|
* Neither the binaries nor the source code may be redistributed without prior |
16
|
|
|
* written permission from RocketGate. |
17
|
|
|
* |
18
|
|
|
* The software is provided "as-is" and without warranty of any kind, express, implied |
19
|
|
|
* or otherwise, including without limitation, any warranty of merchantability or fitness |
20
|
|
|
* for a particular purpose. In no event shall RocketGate be liable for any direct, |
21
|
|
|
* special, incidental, indirect, consequential or other damages of any kind, or any damages |
22
|
|
|
* whatsoever arising out of or in connection with the use or performance of this software, |
23
|
|
|
* including, without limitation, damages resulting from loss of use, data or profits, and |
24
|
|
|
* whether or not advised of the possibility of damage, regardless of the theory of liability. |
25
|
|
|
*/ |
26
|
|
|
|
27
|
|
|
namespace RocketGate\Sdk; |
28
|
|
|
|
29
|
|
|
class GatewayResponse extends GatewayParameterList |
30
|
|
|
{ |
31
|
|
|
public function __construct() |
32
|
|
|
{ |
33
|
|
|
parent::__construct(); |
34
|
|
|
} |
35
|
|
|
|
36
|
|
|
/** |
37
|
|
|
* Set the response and reason values. |
38
|
|
|
* |
39
|
|
|
* @param string $response |
40
|
|
|
* @param string $reason |
41
|
|
|
*/ |
42
|
|
|
public function setResults(string $response, string $reason) |
43
|
|
|
{ |
44
|
|
|
$this->set(self::responseCode(), $response); |
45
|
|
|
$this->set(self::reasonCode(), $reason); |
46
|
|
|
} |
47
|
|
|
|
48
|
|
|
/** |
49
|
|
|
* Set the internal parameters using the contents of an XML document. |
50
|
|
|
* |
51
|
|
|
* @param string $xmlString |
52
|
|
|
*/ |
53
|
|
|
public function setFromXML(string $xmlString) |
54
|
|
|
{ |
55
|
|
|
$parser = xml_parser_create(''); |
56
|
|
|
xml_parser_set_option($parser, XML_OPTION_CASE_FOLDING, 0); |
57
|
|
|
|
58
|
|
|
if (xml_parse_into_struct($parser, $xmlString, $values, $index) === 0) { |
59
|
|
|
$this->set(self::exception(), xml_error_string(xml_get_error_code($parser))); |
60
|
|
|
$this->setResults(self::RESPONSE_SYSTEM_ERROR, self::REASON_XML_ERROR); |
61
|
|
|
xml_parser_free($parser); |
62
|
|
|
|
63
|
|
|
return; |
64
|
|
|
} |
65
|
|
|
|
66
|
|
|
foreach ($values as $value) { |
67
|
|
|
if (isset($value['value'])) { |
68
|
|
|
$this->set($value['tag'], $value['value']); |
69
|
|
|
} |
70
|
|
|
} |
71
|
|
|
|
72
|
|
|
xml_parser_free($parser); |
73
|
|
|
} |
74
|
|
|
|
75
|
|
|
/** |
76
|
|
|
* @return string |
77
|
|
|
*/ |
78
|
|
|
public static function version() |
79
|
|
|
{ |
80
|
|
|
return 'version'; |
81
|
|
|
} |
82
|
|
|
|
83
|
|
|
/** |
84
|
|
|
* @return string |
85
|
|
|
*/ |
86
|
|
|
public static function acsUrl() |
87
|
|
|
{ |
88
|
|
|
return 'acsURL'; |
89
|
|
|
} |
90
|
|
|
|
91
|
|
|
/** |
92
|
|
|
* @return string |
93
|
|
|
*/ |
94
|
|
|
public static function authNo() |
95
|
|
|
{ |
96
|
|
|
return 'authNo'; |
97
|
|
|
} |
98
|
|
|
|
99
|
|
|
/** |
100
|
|
|
* @return string |
101
|
|
|
*/ |
102
|
|
|
public static function avsResponse() |
103
|
|
|
{ |
104
|
|
|
return 'avsResponse'; |
105
|
|
|
} |
106
|
|
|
|
107
|
|
|
/** |
108
|
|
|
* @return string |
109
|
|
|
*/ |
110
|
|
|
public static function balanceAmount() |
111
|
|
|
{ |
112
|
|
|
return 'balanceAmount'; |
113
|
|
|
} |
114
|
|
|
|
115
|
|
|
/** |
116
|
|
|
* @return string |
117
|
|
|
*/ |
118
|
|
|
public static function balanceCurrency() |
119
|
|
|
{ |
120
|
|
|
return 'balanceCurrency'; |
121
|
|
|
} |
122
|
|
|
|
123
|
|
|
/** |
124
|
|
|
* @return string |
125
|
|
|
*/ |
126
|
|
|
public static function bankResponseCode() |
127
|
|
|
{ |
128
|
|
|
return 'bankResponseCode'; |
129
|
|
|
} |
130
|
|
|
|
131
|
|
|
/** |
132
|
|
|
* @return string |
133
|
|
|
*/ |
134
|
|
|
public static function cardType() |
135
|
|
|
{ |
136
|
|
|
return 'cardType'; |
137
|
|
|
} |
138
|
|
|
|
139
|
|
|
/** |
140
|
|
|
* @return string |
141
|
|
|
*/ |
142
|
|
|
public static function cardHash() |
143
|
|
|
{ |
144
|
|
|
return 'cardHash'; |
145
|
|
|
} |
146
|
|
|
|
147
|
|
|
/** |
148
|
|
|
* @return string |
149
|
|
|
*/ |
150
|
|
|
public static function cardBin() |
151
|
|
|
{ |
152
|
|
|
return 'cardBin'; |
153
|
|
|
} |
154
|
|
|
|
155
|
|
|
/** |
156
|
|
|
* @return string |
157
|
|
|
*/ |
158
|
|
|
public static function cardLastFour() |
159
|
|
|
{ |
160
|
|
|
return 'cardLastFour'; |
161
|
|
|
} |
162
|
|
|
|
163
|
|
|
/** |
164
|
|
|
* @return string |
165
|
|
|
*/ |
166
|
|
|
public static function cardExpiration() |
167
|
|
|
{ |
168
|
|
|
return 'cardExpiration'; |
169
|
|
|
} |
170
|
|
|
|
171
|
|
|
/** |
172
|
|
|
* @return string |
173
|
|
|
*/ |
174
|
|
|
public static function cardCountry() |
175
|
|
|
{ |
176
|
|
|
return 'cardCountry'; |
177
|
|
|
} |
178
|
|
|
|
179
|
|
|
/** |
180
|
|
|
* @return string |
181
|
|
|
*/ |
182
|
|
|
public static function cardRegion() |
183
|
|
|
{ |
184
|
|
|
return 'cardRegion'; |
185
|
|
|
} |
186
|
|
|
|
187
|
|
|
/** |
188
|
|
|
* @return string |
189
|
|
|
*/ |
190
|
|
|
public static function cardDescription() |
191
|
|
|
{ |
192
|
|
|
return 'cardDescription'; |
193
|
|
|
} |
194
|
|
|
|
195
|
|
|
/** |
196
|
|
|
* @return string |
197
|
|
|
*/ |
198
|
|
|
public static function cardDebitCredit() |
199
|
|
|
{ |
200
|
|
|
return 'cardDebitCredit'; |
201
|
|
|
} |
202
|
|
|
|
203
|
|
|
/** |
204
|
|
|
* @return string |
205
|
|
|
*/ |
206
|
|
|
public static function cardIssuerName() |
207
|
|
|
{ |
208
|
|
|
return 'cardIssuerName'; |
209
|
|
|
} |
210
|
|
|
|
211
|
|
|
/** |
212
|
|
|
* @return string |
213
|
|
|
*/ |
214
|
|
|
public static function cardIssuerPhone() |
215
|
|
|
{ |
216
|
|
|
return 'cardIssuerPhone'; |
217
|
|
|
} |
218
|
|
|
|
219
|
|
|
/** |
220
|
|
|
* @return string |
221
|
|
|
*/ |
222
|
|
|
public static function cardIssuerURL() |
223
|
|
|
{ |
224
|
|
|
return 'cardIssuerURL'; |
225
|
|
|
} |
226
|
|
|
|
227
|
|
|
/** |
228
|
|
|
* @return string |
229
|
|
|
*/ |
230
|
|
|
public static function cvv2Code() |
231
|
|
|
{ |
232
|
|
|
return 'cvv2Code'; |
233
|
|
|
} |
234
|
|
|
|
235
|
|
|
/** |
236
|
|
|
* @return string |
237
|
|
|
*/ |
238
|
|
|
public static function exception() |
239
|
|
|
{ |
240
|
|
|
return 'exception'; |
241
|
|
|
} |
242
|
|
|
|
243
|
|
|
/** |
244
|
|
|
* @return string |
245
|
|
|
*/ |
246
|
|
|
public static function eci() |
247
|
|
|
{ |
248
|
|
|
return 'ECI'; |
249
|
|
|
} |
250
|
|
|
|
251
|
|
|
/** |
252
|
|
|
* @return string |
253
|
|
|
*/ |
254
|
|
|
public static function iovationTrackingNo() |
255
|
|
|
{ |
256
|
|
|
return 'IOVATIONTRACKINGNO'; |
257
|
|
|
} |
258
|
|
|
|
259
|
|
|
/** |
260
|
|
|
* @return string |
261
|
|
|
*/ |
262
|
|
|
public static function iovationDevice() |
263
|
|
|
{ |
264
|
|
|
return 'IOVATIONDEVICE'; |
265
|
|
|
} |
266
|
|
|
|
267
|
|
|
/** |
268
|
|
|
* @return string |
269
|
|
|
*/ |
270
|
|
|
public static function iovationResults() |
271
|
|
|
{ |
272
|
|
|
return 'IOVATIONRESULTS'; |
273
|
|
|
} |
274
|
|
|
|
275
|
|
|
/** |
276
|
|
|
* @return string |
277
|
|
|
*/ |
278
|
|
|
public static function iovationScore() |
279
|
|
|
{ |
280
|
|
|
return 'IOVATIONSCORE'; |
281
|
|
|
} |
282
|
|
|
|
283
|
|
|
/** |
284
|
|
|
* @return string |
285
|
|
|
*/ |
286
|
|
|
public static function iovationRuleCount() |
287
|
|
|
{ |
288
|
|
|
return 'IOVATIONRULECOUNT'; |
289
|
|
|
} |
290
|
|
|
|
291
|
|
|
/** |
292
|
|
|
* @return string |
293
|
|
|
*/ |
294
|
|
|
public static function iovationRuleType() |
295
|
|
|
{ |
296
|
|
|
return 'IOVATIONRULETYPE_'; |
297
|
|
|
} |
298
|
|
|
|
299
|
|
|
/** |
300
|
|
|
* @return string |
301
|
|
|
*/ |
302
|
|
|
public static function iovationRuleReason() |
303
|
|
|
{ |
304
|
|
|
return 'IOVATIONRULEREASON_'; |
305
|
|
|
} |
306
|
|
|
|
307
|
|
|
/** |
308
|
|
|
* @return string |
309
|
|
|
*/ |
310
|
|
|
public static function iovationRuleScore() |
311
|
|
|
{ |
312
|
|
|
return 'IOVATIONRULESCORE_'; |
313
|
|
|
} |
314
|
|
|
|
315
|
|
|
/** |
316
|
|
|
* @return string |
317
|
|
|
*/ |
318
|
|
|
public static function joinDate() |
319
|
|
|
{ |
320
|
|
|
return 'joinDate'; |
321
|
|
|
} |
322
|
|
|
|
323
|
|
|
/** |
324
|
|
|
* @return string |
325
|
|
|
*/ |
326
|
|
|
public static function joinAmount() |
327
|
|
|
{ |
328
|
|
|
return 'joinAmount'; |
329
|
|
|
} |
330
|
|
|
|
331
|
|
|
/** |
332
|
|
|
* @return string |
333
|
|
|
*/ |
334
|
|
|
public static function lastBillingDate() |
335
|
|
|
{ |
336
|
|
|
return 'lastBillingDate'; |
337
|
|
|
} |
338
|
|
|
|
339
|
|
|
/** |
340
|
|
|
* @return string |
341
|
|
|
*/ |
342
|
|
|
public static function lastBillingAmount() |
343
|
|
|
{ |
344
|
|
|
return 'lastBillingAmount'; |
345
|
|
|
} |
346
|
|
|
|
347
|
|
|
/** |
348
|
|
|
* @return string |
349
|
|
|
*/ |
350
|
|
|
public static function lastReasonCode() |
351
|
|
|
{ |
352
|
|
|
return 'lastReasonCode'; |
353
|
|
|
} |
354
|
|
|
|
355
|
|
|
/** |
356
|
|
|
* @return string |
357
|
|
|
*/ |
358
|
|
|
public static function merchantAccount() |
359
|
|
|
{ |
360
|
|
|
return 'merchantAccount'; |
361
|
|
|
} |
362
|
|
|
|
363
|
|
|
/** |
364
|
|
|
* @return string |
365
|
|
|
*/ |
366
|
|
|
public static function merchantCustomerID() |
367
|
|
|
{ |
368
|
|
|
return 'merchantCustomerID'; |
369
|
|
|
} |
370
|
|
|
|
371
|
|
|
/** |
372
|
|
|
* @return string |
373
|
|
|
*/ |
374
|
|
|
public static function merchantInvoiceID() |
375
|
|
|
{ |
376
|
|
|
return 'merchantInvoiceID'; |
377
|
|
|
} |
378
|
|
|
|
379
|
|
|
/** |
380
|
|
|
* @return string |
381
|
|
|
*/ |
382
|
|
|
public static function merchantProductID() |
383
|
|
|
{ |
384
|
|
|
return 'merchantProductID'; |
385
|
|
|
} |
386
|
|
|
|
387
|
|
|
/** |
388
|
|
|
* @return string |
389
|
|
|
*/ |
390
|
|
|
public static function merchantSiteID() |
391
|
|
|
{ |
392
|
|
|
return 'merchantSiteID'; |
393
|
|
|
} |
394
|
|
|
|
395
|
|
|
/** |
396
|
|
|
* @return string |
397
|
|
|
*/ |
398
|
|
|
public static function pareq() |
399
|
|
|
{ |
400
|
|
|
return 'PAREQ'; |
401
|
|
|
} |
402
|
|
|
|
403
|
|
|
/** |
404
|
|
|
* @return string |
405
|
|
|
*/ |
406
|
|
|
public static function reasonCode() |
407
|
|
|
{ |
408
|
|
|
return 'reasonCode'; |
409
|
|
|
} |
410
|
|
|
|
411
|
|
|
/** |
412
|
|
|
* @return string |
413
|
|
|
*/ |
414
|
|
|
public static function rebillAmount() |
415
|
|
|
{ |
416
|
|
|
return 'rebillAmount'; |
417
|
|
|
} |
418
|
|
|
|
419
|
|
|
/** |
420
|
|
|
* @return string |
421
|
|
|
*/ |
422
|
|
|
public static function rebillDate() |
423
|
|
|
{ |
424
|
|
|
return 'rebillDate'; |
425
|
|
|
} |
426
|
|
|
|
427
|
|
|
/** |
428
|
|
|
* @return string |
429
|
|
|
*/ |
430
|
|
|
public static function rebillEndDate() |
431
|
|
|
{ |
432
|
|
|
return 'rebillEndDate'; |
433
|
|
|
} |
434
|
|
|
|
435
|
|
|
/** |
436
|
|
|
* @return string |
437
|
|
|
*/ |
438
|
|
|
public static function rebillFrequency() |
439
|
|
|
{ |
440
|
|
|
return 'rebillFrequency'; |
441
|
|
|
} |
442
|
|
|
|
443
|
|
|
/** |
444
|
|
|
* @return string |
445
|
|
|
*/ |
446
|
|
|
public static function rebillStatus() |
447
|
|
|
{ |
448
|
|
|
return 'rebillStatus'; |
449
|
|
|
} |
450
|
|
|
|
451
|
|
|
/** |
452
|
|
|
* @return string |
453
|
|
|
*/ |
454
|
|
|
public static function responseCode() |
455
|
|
|
{ |
456
|
|
|
return 'responseCode'; |
457
|
|
|
} |
458
|
|
|
|
459
|
|
|
/** |
460
|
|
|
* @return string |
461
|
|
|
*/ |
462
|
|
|
public static function transactId() |
463
|
|
|
{ |
464
|
|
|
return 'guidNo'; |
465
|
|
|
} |
466
|
|
|
|
467
|
|
|
/** |
468
|
|
|
* @return string |
469
|
|
|
*/ |
470
|
|
|
public static function scrubResults() |
471
|
|
|
{ |
472
|
|
|
return 'scrubResults'; |
473
|
|
|
} |
474
|
|
|
|
475
|
|
|
/** |
476
|
|
|
* @return string |
477
|
|
|
*/ |
478
|
|
|
public static function settledAmount() |
479
|
|
|
{ |
480
|
|
|
return 'approvedAmount'; |
481
|
|
|
} |
482
|
|
|
|
483
|
|
|
/** |
484
|
|
|
* @return string |
485
|
|
|
*/ |
486
|
|
|
public static function settledCurrency() |
487
|
|
|
{ |
488
|
|
|
return 'approvedCurrency'; |
489
|
|
|
} |
490
|
|
|
} |
491
|
|
|
|