Open Journal Systems  3.3.0
lib/vendor/omnipay/paypal/tests/ProGatewayTest.php
1 <?php
2 
3 namespace Omnipay\PayPal;
4 
5 use Omnipay\Tests\GatewayTestCase;
7 
8 class ProGatewayTest extends GatewayTestCase
9 {
10  public function setUp()
11  {
12  parent::setUp();
13 
14  $this->gateway = new ProGateway($this->getHttpClient(), $this->getHttpRequest());
15 
16  $this->options = array(
17  'amount' => '10.00',
18  'card' => new CreditCard(array(
19  'firstName' => 'Example',
20  'lastName' => 'User',
21  'number' => '4111111111111111',
22  'expiryMonth' => '12',
23  'expiryYear' => '2017',
24  'cvv' => '123',
25  )),
26  );
27  }
28 
29  public function testAuthorize()
30  {
31  $this->setMockHttpResponse('ProPurchaseSuccess.txt');
32 
33  $response = $this->gateway->authorize($this->options)->send();
34 
35  $this->assertTrue($response->isSuccessful());
36  $this->assertEquals('96U93778BD657313D', $response->getTransactionReference());
37  $this->assertNull($response->getMessage());
38  }
39 
40  public function testPurchase()
41  {
42  $this->setMockHttpResponse('ProPurchaseSuccess.txt');
43 
44  $response = $this->gateway->purchase($this->options)->send();
45 
46  $this->assertTrue($response->isSuccessful());
47  $this->assertEquals('96U93778BD657313D', $response->getTransactionReference());
48  $this->assertNull($response->getMessage());
49  }
50 
51  public function testFetchTransaction()
52  {
53  $request = $this->gateway->fetchTransaction(array('transactionReference' => 'abc123'));
54 
55  $this->assertInstanceOf('\Omnipay\PayPal\Message\FetchTransactionRequest', $request);
56  $this->assertSame('abc123', $request->getTransactionReference());
57  }
58 }
Omnipay\PayPal
Definition: lib/vendor/omnipay/paypal/src/ExpressGateway.php:3
Omnipay\PayPal\ProGatewayTest\testAuthorize
testAuthorize()
Definition: lib/vendor/omnipay/paypal/tests/ProGatewayTest.php:29
Omnipay\PayPal\ProGateway
Definition: lib/vendor/omnipay/paypal/src/ProGateway.php:10
Omnipay\PayPal\ProGatewayTest\setUp
setUp()
Definition: lib/vendor/omnipay/paypal/tests/ProGatewayTest.php:10
Omnipay\PayPal\ProGatewayTest\testPurchase
testPurchase()
Definition: lib/vendor/omnipay/paypal/tests/ProGatewayTest.php:40
Omnipay\PayPal\ProGatewayTest
Definition: lib/vendor/omnipay/paypal/tests/ProGatewayTest.php:8
Omnipay\Common\CreditCard
Definition: lib/vendor/omnipay/common/src/Omnipay/Common/CreditCard.php:94
Omnipay\PayPal\ProGatewayTest\testFetchTransaction
testFetchTransaction()
Definition: lib/vendor/omnipay/paypal/tests/ProGatewayTest.php:51