Skip to content

Commit cd177e9

Browse files
committed
Add full error messages
1 parent 8dce7f1 commit cd177e9

File tree

3 files changed

+148
-4
lines changed

3 files changed

+148
-4
lines changed

src/Omnipay/Eway/Message/RapidResponse.php

Lines changed: 145 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,144 @@
1010
*/
1111
class RapidResponse extends AbstractResponse implements RedirectResponseInterface
1212
{
13+
static $MESSAGES = array(
14+
'A2000' => 'Transaction Approved',
15+
'A2008' => 'Honour With Identification',
16+
'A2010' => 'Approved For Partial Amount',
17+
'A2011' => 'Approved, VIP',
18+
'A2016' => 'Approved, Update Track 3',
19+
'D4401' => 'Refer to Issuer',
20+
'D4402' => 'Refer to Issuer, special',
21+
'D4403' => 'No Merchant',
22+
'D4404' => 'Pick Up Card',
23+
'D4405' => 'Do Not Honour',
24+
'D4406' => 'Error',
25+
'D4407' => 'Pick Up Card, Special',
26+
'D4409' => 'Request In Progress',
27+
'D4412' => 'Invalid Transaction',
28+
'D4413' => 'Invalid Amount',
29+
'D4414' => 'Invalid Card Number',
30+
'D4415' => 'No Issuer',
31+
'D4419' => 'Re-enter Last Transaction',
32+
'D4421' => 'No Action Taken',
33+
'D4422' => 'Suspected Malfunction',
34+
'D4423' => 'Unacceptable Transaction Fee',
35+
'D4425' => 'Unable to Locate Record On File',
36+
'D4430' => 'Format Error',
37+
'D4431' => 'Bank Not Supported By Switch',
38+
'D4433' => 'Expired Card, Capture',
39+
'D4434' => 'Suspected Fraud, Retain Card',
40+
'D4435' => 'Card Acceptor, Contact Acquirer, Retain Card',
41+
'D4436' => 'Restricted Card, Retain Card',
42+
'D4437' => 'Contact Acquirer Security Department, Retain Card',
43+
'D4438' => 'PIN Tries Exceeded, Capture',
44+
'D4439' => 'No Credit Account',
45+
'D4440' => 'Function Not Supported',
46+
'D4441' => 'Lost Card',
47+
'D4442' => 'No Universal Account',
48+
'D4443' => 'Stolen Card',
49+
'D4444' => 'No Investment Account',
50+
'D4451' => 'Insufficient Funds',
51+
'D4452' => 'No Cheque Account',
52+
'D4453' => 'No Savings Account',
53+
'D4454' => 'Expired Card',
54+
'D4455' => 'Incorrect PIN',
55+
'D4456' => 'No Card Record',
56+
'D4457' => 'Function Not Permitted to Cardholder',
57+
'D4458' => 'Function Not Permitted to Terminal',
58+
'D4459' => 'Suspected Fraud',
59+
'D4460' => 'Acceptor Contact Acquirer',
60+
'D4461' => 'Exceeds Withdrawal Limit',
61+
'D4462' => 'Restricted Card',
62+
'D4463' => 'Security Violation',
63+
'D4464' => 'Original Amount Incorrect',
64+
'D4466' => 'Acceptor Contact Acquirer, Security',
65+
'D4467' => 'Capture Card',
66+
'D4475' => 'PIN Tries Exceeded',
67+
'D4482' => 'CVV Validation Error',
68+
'D4490' => 'Cut off In Progress',
69+
'D4491' => 'Card Issuer Unavailable',
70+
'D4492' => 'Unable To Route Transaction',
71+
'D4493' => 'Cannot Complete, Violation Of The Law',
72+
'D4494' => 'Duplicate Transaction',
73+
'D4496' => 'System Error',
74+
'S5000' => 'System Error',
75+
'S5085' => 'Started 3dSecure',
76+
'S5086' => 'Routed 3dSecure',
77+
'S5087' => 'Completed 3dSecure',
78+
'S5099' => 'Incomplete (Access Code in progress/incomplete)',
79+
'V6000' => 'Validation error',
80+
'V6001' => 'Invalid CustomerIP',
81+
'V6002' => 'Invalid DeviceID',
82+
'V6011' => 'Invalid Payment TotalAmount',
83+
'V6012' => 'Invalid Payment InvoiceDescription',
84+
'V6013' => 'Invalid Payment InvoiceNumber',
85+
'V6014' => 'Invalid Payment InvoiceReference',
86+
'V6015' => 'Invalid Payment CurrencyCode',
87+
'V6016' => 'Payment Required',
88+
'V6017' => 'Payment CurrencyCode Required',
89+
'V6018' => 'Unknown Payment CurrencyCode',
90+
'V6021' => 'EWAY_CARDNAME Required',
91+
'V6022' => 'EWAY_CARDNUMBER Required',
92+
'V6023' => 'EWAY_CARDCVN Required',
93+
'V6033' => 'Invalid Expiry Date',
94+
'V6034' => 'Invalid Issue Number',
95+
'V6035' => 'Invalid Valid From Date',
96+
'V6040' => 'Invalid TokenCustomerID',
97+
'V6041' => 'Customer Required',
98+
'V6042' => 'Customer FirstName Required',
99+
'V6043' => 'Customer LastName Required',
100+
'V6044' => 'Customer CountryCode Required',
101+
'V6045' => 'Customer Title Required',
102+
'V6046' => 'TokenCustomerID Required',
103+
'V6047' => 'RedirectURL Required',
104+
'V6051' => 'Invalid Customer FirstName',
105+
'V6052' => 'Invalid Customer LastName',
106+
'V6053' => 'Invalid Customer CountryCode',
107+
'V6058' => 'Invalid Customer Title',
108+
'V6059' => 'Invalid RedirectURL',
109+
'V6060' => 'Invalid TokenCustomerID',
110+
'V6061' => 'Invalid Customer Reference',
111+
'V6062' => 'Invalid Customer CompanyName',
112+
'V6063' => 'Invalid Customer JobDescription',
113+
'V6064' => 'Invalid Customer Street1',
114+
'V6065' => 'Invalid Customer Street2',
115+
'V6066' => 'Invalid Customer City',
116+
'V6067' => 'Invalid Customer State',
117+
'V6068' => 'Invalid Customer PostalCode',
118+
'V6069' => 'Invalid Customer Email',
119+
'V6070' => 'Invalid Customer Phone',
120+
'V6071' => 'Invalid Customer Mobile',
121+
'V6072' => 'Invalid Customer Comments',
122+
'V6073' => 'Invalid Customer Fax',
123+
'V6074' => 'Invalid Customer URL',
124+
'V6075' => 'Invalid ShippingAddress FirstName',
125+
'V6076' => 'Invalid ShippingAddress LastName',
126+
'V6077' => 'Invalid ShippingAddress Street1',
127+
'V6078' => 'Invalid ShippingAddress Street2',
128+
'V6079' => 'Invalid ShippingAddress City',
129+
'V6080' => 'Invalid ShippingAddress State',
130+
'V6081' => 'Invalid ShippingAddress PostalCode',
131+
'V6082' => 'Invalid ShippingAddress Email',
132+
'V6083' => 'Invalid ShippingAddress Phone',
133+
'V6084' => 'Invalid ShippingAddress Country',
134+
'V6085' => 'Invalid ShippingAddress ShippingMethod',
135+
'V6086' => 'Invalid ShippingAddress Fax',
136+
'V6091' => 'Unknown Customer CountryCode',
137+
'V6092' => 'Unknown ShippingAddress CountryCode',
138+
'V6100' => 'Invalid EWAY_CARDNAME',
139+
'V6101' => 'Invalid EWAY_CARDEXPIRYMONTH',
140+
'V6102' => 'Invalid EWAY_CARDEXPIRYYEAR',
141+
'V6103' => 'Invalid EWAY_CARDSTARTMONTH',
142+
'V6104' => 'Invalid EWAY_CARDSTARTYEAR',
143+
'V6105' => 'Invalid EWAY_CARDISSUENUMBER',
144+
'V6106' => 'Invalid EWAY_CARDCVN',
145+
'V6107' => 'Invalid EWAY_ACCESSCODE',
146+
'V6108' => 'Invalid CustomerHostAddress',
147+
'V6109' => 'Invalid UserAgent',
148+
'V6110' => 'Invalid EWAY_CARDNUMBER',
149+
);
150+
13151
public function isSuccessful()
14152
{
15153
return isset($this->data['TransactionStatus']) && $this->data['TransactionStatus'];
@@ -46,7 +184,13 @@ public function getTransactionReference()
46184

47185
public function getMessage()
48186
{
49-
return $this->getCode();
187+
$code = $this->getCode();
188+
189+
if (isset(static::$MESSAGES[$code])) {
190+
return static::$MESSAGES[$code];
191+
} else {
192+
return $code;
193+
}
50194
}
51195

52196
public function getCode()

tests/Omnipay/Eway/Message/RapidCompletePurchaseRequestTest.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@ public function testSendSuccess()
3535
$this->assertNull($response->getRedirectUrl());
3636
$this->assertNull($response->getRedirectData());
3737
$this->assertSame('10204029', $response->getTransactionReference());
38-
$this->assertSame('A2000', $response->getMessage());
38+
$this->assertSame('Transaction Approved', $response->getMessage());
3939
$this->assertSame('A2000', $response->getCode());
4040
}
4141

@@ -49,7 +49,7 @@ public function testSendFailure()
4949
$this->assertNull($response->getRedirectUrl());
5050
$this->assertNull($response->getRedirectData());
5151
$this->assertNull($response->getTransactionReference());
52-
$this->assertSame('V6021', $response->getMessage());
52+
$this->assertSame('EWAY_CARDNAME Required', $response->getMessage());
5353
$this->assertSame('V6021', $response->getCode());
5454
}
5555
}

tests/Omnipay/Eway/Message/RapidPurchaseRequestTest.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -71,7 +71,7 @@ public function testSendFailure()
7171
$this->assertNull($response->getRedirectUrl());
7272
$this->assertNull($response->getRedirectData());
7373
$this->assertNull($response->getTransactionReference());
74-
$this->assertSame('V6011', $response->getMessage());
74+
$this->assertSame('Invalid Payment TotalAmount', $response->getMessage());
7575
$this->assertSame('V6011', $response->getCode());
7676
}
7777
}

0 commit comments

Comments
 (0)