5 use Omnipay\Tests\TestCase;
11 $httpResponse = $this->getMockHttpResponse(
'RestPurchaseSuccess.txt');
12 $response =
new RestResponse($this->getMockRequest(), $httpResponse->json(), $httpResponse->getStatusCode());
14 $this->assertTrue($response->isSuccessful());
15 $this->assertSame(
'44E89981F8714392Y', $response->getTransactionReference());
16 $this->assertNull($response->getMessage());
21 $httpResponse = $this->getMockHttpResponse(
'RestPurchaseFailure.txt');
22 $response =
new RestResponse($this->getMockRequest(), $httpResponse->json(), $httpResponse->getStatusCode());
24 $this->assertFalse($response->isSuccessful());
25 $this->assertNull($response->getTransactionReference());
26 $this->assertSame(
'Invalid request - see details', $response->getMessage());
31 $httpResponse = $this->getMockHttpResponse(
'RestCompletePurchaseSuccess.txt');
32 $response =
new RestResponse($this->getMockRequest(), $httpResponse->json(), $httpResponse->getStatusCode());
34 $this->assertTrue($response->isSuccessful());
35 $this->assertSame(
'9EA05739TH369572R', $response->getTransactionReference());
36 $this->assertNull($response->getMessage());
41 $httpResponse = $this->getMockHttpResponse(
'RestCompletePurchaseFailure.txt');
42 $response =
new RestResponse($this->getMockRequest(), $httpResponse->json(), $httpResponse->getStatusCode());
44 $this->assertFalse($response->isSuccessful());
45 $this->assertNull($response->getTransactionReference());
46 $this->assertSame(
'This request is invalid due to the current state of the payment', $response->getMessage());
51 $httpResponse = $this->getMockHttpResponse(
'RestTokenFailure.txt');
52 $response =
new RestResponse($this->getMockRequest(), $httpResponse->json(), $httpResponse->getStatusCode());
54 $this->assertFalse($response->isSuccessful());
55 $this->assertSame(
'Client secret does not match for this client', $response->getMessage());
60 $httpResponse = $this->getMockHttpResponse(
'RestAuthorizationSuccess.txt');
61 $response =
new RestResponse($this->getMockRequest(), $httpResponse->json(), $httpResponse->getStatusCode());
63 $this->assertTrue($response->isSuccessful());
64 $this->assertSame(
'58N7596879166930B', $response->getTransactionReference());
65 $this->assertNull($response->getMessage());
70 $httpResponse = $this->getMockHttpResponse(
'RestCreateCardSuccess.txt');
71 $response =
new RestResponse($this->getMockRequest(), $httpResponse->json(), $httpResponse->getStatusCode());
73 $this->assertTrue($response->isSuccessful());
74 $this->assertSame(
'CARD-70E78145XN686604FKO3L6OQ', $response->getCardReference());
75 $this->assertNull($response->getMessage());