public function testVoidFailure()
 {
     $this->setMockHttpResponse('AIMVoidFailure.txt');
     $response = $this->gateway->void($this->voidOptions)->send();
     $this->assertFalse($response->isSuccessful());
     $this->assertSame('0', $response->getTransactionReference());
     $this->assertSame('A valid referenced transaction ID is required.', $response->getMessage());
 }
 public function testPurchaseAndVoid()
 {
     $request = $this->gateway->purchase(array('amount' => '10.01', 'card' => $this->getValidCard()));
     $response = $request->send();
     $this->assertTrue($response->isSuccessful(), 'Purchase should succeed');
     $transactionRef = $response->getTransactionReference();
     $request = $this->gateway->void(array('transactionReference' => $transactionRef));
     $response = $request->send();
     $this->assertTrue($response->isSuccessful(), 'Void should succeed');
 }
 public function testAuthCaptureVoid()
 {
     // Authorize
     $request = $this->gateway->authorize(array('amount' => '42.42', 'card' => $this->getValidCard()));
     $response = $request->send();
     $this->assertTrue($response->isSuccessful(), 'Authorization should succeed');
     $transactionRef = $response->getTransactionReference();
     // Capture
     $request = $this->gateway->capture(array('amount' => '42.42', 'transactionReference' => $transactionRef));
     $response = $request->send();
     $this->assertTrue($response->isSuccessful(), 'Capture should succeed');
     // Void
     $request = $this->gateway->void(array('transactionReference' => $transactionRef));
     $response = $request->send();
     $this->assertTrue($response->isSuccessful(), 'Void should succeed');
 }
示例#4
0
 public function testVoidFailure()
 {
     $this->setMockHttpResponse('AIMVoidFailure.txt');
     $response = $this->gateway->void($this->voidOptions)->send();
     $this->assertFalse($response->isSuccessful());
     $this->assertSame('{"approvalCode":"","transId":"0"}', $response->getTransactionReference());
     $this->assertSame('The transaction cannot be found.', $response->getMessage());
 }