@@ -97,4 +97,32 @@ public function testPurchaseFailure()
9797 $ this ->assertSame ('' , $ response ->getAuthorizationCode ());
9898 $ this ->assertSame ('P ' , $ response ->getAVSCode ());
9999 }
100+
101+ public function testRefundSuccess ()
102+ {
103+ $ httpResponse = $ this ->getMockHttpResponse ('AIMRefundSuccess.txt ' );
104+
105+ $ response = new AIMResponse ($ this ->getMockRequest (), $ httpResponse ->getBody ());
106+
107+ $ this ->assertTrue ($ response ->isSuccessful ());
108+ $ this ->assertSame ('2217770693 ' , $ response ->getTransactionReference ());
109+ $ this ->assertSame ('This transaction has been approved. ' , $ response ->getMessage ());
110+ $ this ->assertSame (1 , $ response ->getResultCode ());
111+ $ this ->assertSame (1 , $ response ->getReasonCode ());
112+ $ this ->assertSame ('P ' , $ response ->getAVSCode ());
113+ }
114+
115+ public function testRefundFailure ()
116+ {
117+ $ httpResponse = $ this ->getMockHttpResponse ('AIMRefundFailure.txt ' );
118+ $ response = new AIMResponse ($ this ->getMockRequest (), $ httpResponse ->getBody ());
119+
120+ $ this ->assertFalse ($ response ->isSuccessful ());
121+ $ this ->assertSame ('0 ' , $ response ->getTransactionReference ());
122+ $ this ->assertSame ('The referenced transaction does not meet the criteria for issuing a credit. ' , $ response ->getMessage ());
123+ $ this ->assertSame (3 , $ response ->getResultCode ());
124+ $ this ->assertSame (54 , $ response ->getReasonCode ());
125+ $ this ->assertSame ('' , $ response ->getAuthorizationCode ());
126+ $ this ->assertSame ('P ' , $ response ->getAVSCode ());
127+ }
100128}
0 commit comments