public function testCaptureFailure() { $this->setMockHttpResponse('AIMCaptureFailure.txt'); $response = $this->gateway->capture($this->captureOptions)->send(); $this->assertFalse($response->isSuccessful()); $this->assertSame('{"approvalCode":"","transId":"0"}', $response->getTransactionReference()); $this->assertSame('The transaction cannot be found.', $response->getMessage()); }
public function testHoldAndCapture() { $request = $this->gateway->authorize(array('amount' => '42.42', 'card' => $this->getValidCard())); $response = $request->send(); $this->assertTrue($response->isSuccessful(), 'Authorization should succeed'); $transactionRef = $response->getTransactionReference(); $request = $this->gateway->capture(array('amount' => '42.42', 'transactionReference' => $transactionRef)); $response = $request->send(); $this->assertTrue($response->isSuccessful(), 'Capture should succeed'); }