6 use Omnipay\Tests\TestCase;
8 class ExpressFetchCheckoutRequestTest
extends TestCase
15 public function setUp()
17 $client = $this->getHttpClient();
19 $request = $this->getHttpRequest();
20 $request->query->set(
'token',
'TOKEN1234');
27 $this->request->setUsername(
'testuser');
28 $this->request->setPassword(
'testpass');
29 $this->request->setSignature(
'SIG');
32 $expected[
'METHOD'] =
'GetExpressCheckoutDetails';
33 $expected[
'USER'] =
'testuser';
34 $expected[
'PWD'] =
'testpass';
35 $expected[
'SIGNATURE'] =
'SIG';
36 $expected[
'SUBJECT'] =
null;
38 $expected[
'TOKEN'] =
'TOKEN1234';
40 $this->assertEquals($expected, $this->request->getData());
45 $this->request->setToken(
'TOKEN2000');
47 $data = $this->request->getData();
49 $this->assertSame(
'TOKEN2000', $data[
'TOKEN']);
54 $this->setMockHttpResponse(
'ExpressFetchCheckoutSuccess.txt');
56 $response = $this->request->send();
57 $this->assertFalse($response->isPending());
58 $this->assertTrue($response->isSuccessful());
59 $this->assertFalse($response->isRedirect());
64 $this->setMockHttpResponse(
'ExpressFetchCheckoutFailure.txt');
66 $response = $this->request->send();
67 $this->assertFalse($response->isPending());
68 $this->assertFalse($response->isSuccessful());
69 $this->assertFalse($response->isRedirect());
70 $this->assertSame(
'The amount exceeds the maximum amount for a single transaction.', $response->getMessage());