public function testAuthorizeFailure() { $this->setMockHttpResponse('AIMAuthorizeFailure.txt'); $response = $this->gateway->authorize($this->purchaseOptions)->send(); $this->assertFalse($response->isSuccessful()); $this->assertSame('0', $response->getTransactionReference()); $this->assertSame('A valid amount is required.', $response->getMessage()); }
public function testAuthorizeFailure() { $this->setMockHttpResponse('AIMAuthorizeFailure.txt'); $response = $this->gateway->authorize($this->purchaseOptions)->send(); $expiry = $this->getExpiry($this->purchaseOptions['card']); $this->assertFalse($response->isSuccessful()); $this->assertSame('{"approvalCode":"","transId":"0","card":{"number":"1111","expiry":"' . $expiry . '"}}', $response->getTransactionReference()); $this->assertSame('A valid amount is required.', $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'); }