public function testPurchaseError() { $this->setMockHttpResponse('PurchaseFailure.txt'); $response = $this->gateway->purchase($this->options)->send(); $this->assertFalse($response->isSuccessful()); $this->assertFalse($response->isRedirect()); $this->assertSame('Failure', $response->getMessage()); }
public function testPurchaseFailure() { $result = new \stdClass(); $result->State = 0; $result->Status = 2; $result->Message = 'Declined'; $result->Technical = ''; $result->TransactionID = ''; $wrapper = new \stdClass(); $wrapper->ExecuteCreditCardResult = $result; $this->mockSoapClient->expects($this->any())->method('ExecuteCreditCard')->will($this->returnValue($wrapper)); $this->options = array('siteId' => '123', 'amount' => '10.00', 'currency' => 'AUD', 'clientIp' => '123.123.123.123', 'card' => $this->getValidCard()); $response = $this->gateway->purchase($this->options)->send(); $this->assertFalse($response->isSuccessful()); $this->assertFalse($response->isRedirect()); $this->assertSame('Declined', $response->getMessage()); $this->assertSame(2, $response->getCode()); $this->assertEmpty($response->getTransactionReference()); }