Skip to content

Commit f871149

Browse files
Unit test for fetching error message
1 parent d22c493 commit f871149

File tree

2 files changed

+23
-0
lines changed

2 files changed

+23
-0
lines changed

tests/Message/AIMResponseTest.php

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -64,6 +64,16 @@ public function testAuthorizeInvalid()
6464
$this->assertSame('', $response->getAVSCode());
6565
}
6666

67+
public function testAuthorizeInvalidOTSToken()
68+
{
69+
$httpResponse = $this->getMockHttpResponse('AIMAuthorizeInvalidOTSToken.txt');
70+
$response = new AIMResponse($this->getMockRequest(), $httpResponse->getBody());
71+
72+
$this->assertFalse($response->isSuccessful());
73+
$this->assertSame('E00114', $response->getReasonCode());
74+
$this->assertSame('Invalid OTS Token.', $response->getMessage());
75+
}
76+
6777
public function testCaptureSuccess()
6878
{
6979
$httpResponse = $this->getMockHttpResponse('AIMCaptureSuccess.txt');
Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
HTTP/1.1 200 OK
2+
Date: Sat, 02 Aug 2014 05:20:38 GMT
3+
Server: Microsoft-IIS/6.0
4+
Access-Control-Allow-Origin: *
5+
Access-Control-Allow-Methods: GET, POST, OPTIONS
6+
Access-Control-Allow-Headers: x-requested-with, cache-control, content-type, origin, method
7+
X-Powered-By: ASP.NET
8+
X-AspNet-Version: 2.0.50727
9+
Cache-Control: private
10+
Content-Type: text/xml; charset=utf-8
11+
Content-Length: 844
12+
13+
<?xml version="1.0" encoding="utf-8"?><createTransactionResponse><messages><resultCode>Error</resultCode><message><code>E00114</code><text>Invalid OTS Token.</text></message></messages><transactionResponse/></createTransactionResponse>

0 commit comments

Comments
 (0)