public function testPurchaseFailure() { $httpResponse = $this->getMockHttpResponse('AIMPurchaseFailure.txt'); $response = new AIMResponse($this->getMockRequest(), $httpResponse->getBody()); $this->assertFalse($response->isSuccessful()); $this->assertSame('0', $response->getTransactionReference()); $this->assertSame('A valid amount is required.', $response->getMessage()); }
public function testRefundFailure() { $httpResponse = $this->getMockHttpResponse('AIMRefundFailure.txt'); $response = new AIMResponse($this->getMockRequest(), $httpResponse->getBody()); $this->assertFalse($response->isSuccessful()); $this->assertSame('{"approvalCode":"","transId":"0"}', $response->getTransactionReference()); $this->assertSame('The referenced transaction does not meet the criteria for issuing a credit.', $response->getMessage()); $this->assertSame(3, $response->getResultCode()); $this->assertSame(54, $response->getReasonCode()); $this->assertSame('', $response->getAuthorizationCode()); $this->assertSame('P', $response->getAVSCode()); }
public function testRefundFailure() { $httpResponse = $this->getMockHttpResponse('AIMRefundFailure.txt'); $response = new AIMResponse($this->getMockRequest(), $httpResponse->getBody()); $this->assertFalse($response->isSuccessful()); $this->assertSame('0', $response->getTransactionReference()); $this->assertSame('The credit card number is invalid.', $response->getMessage()); $this->assertSame('3', $response->getCode()); $this->assertSame('6', $response->getReasonCode()); $this->assertSame('', $response->getAuthorizationCode()); $this->assertSame('P', $response->getAVSCode()); }