|
1
|
|
|
<?php |
|
2
|
|
|
|
|
3
|
|
|
/* |
|
4
|
|
|
* eCoin driver for Omnipay PHP payment library |
|
5
|
|
|
* |
|
6
|
|
|
* @link https://github.com/hiqdev/omnipay-ecoin |
|
7
|
|
|
* @package omnipay-ecoin |
|
8
|
|
|
* @license MIT |
|
9
|
|
|
* @copyright Copyright (c) 2015-2016, HiQDev (http://hiqdev.com/) |
|
10
|
|
|
*/ |
|
11
|
|
|
|
|
12
|
|
|
namespace Omnipay\eCoin; |
|
13
|
|
|
|
|
14
|
|
|
use Omnipay\Tests\GatewayTestCase; |
|
15
|
|
|
|
|
16
|
|
|
class GatewayTest extends GatewayTestCase |
|
17
|
|
|
{ |
|
18
|
|
|
public $gateway; |
|
19
|
|
|
|
|
20
|
|
|
private $purse = '[email protected]'; |
|
21
|
|
|
private $secret = 'sDf#$Sdf#$%'; |
|
22
|
|
|
private $testMode = true; |
|
23
|
|
|
private $transactionId = 'sadf2345asf'; |
|
24
|
|
|
private $description = 'Test completePurchase description'; |
|
25
|
|
|
private $currency = 'USD'; |
|
26
|
|
|
private $amount = '12.46'; |
|
27
|
|
|
|
|
28
|
|
|
public function setUp() |
|
29
|
|
|
{ |
|
30
|
|
|
parent::setUp(); |
|
31
|
|
|
|
|
32
|
|
|
$this->gateway = new Gateway($this->getHttpClient(), $this->getHttpRequest()); |
|
33
|
|
|
$this->gateway->setPurse($this->purse); |
|
34
|
|
|
$this->gateway->setSecret($this->secret); |
|
35
|
|
|
$this->gateway->setTestMode($this->testMode); |
|
36
|
|
|
} |
|
37
|
|
|
|
|
38
|
|
|
public function testGateway() |
|
39
|
|
|
{ |
|
40
|
|
|
$this->assertSame($this->purse, $this->gateway->getPurse()); |
|
41
|
|
|
$this->assertSame($this->secret, $this->gateway->getSecret()); |
|
42
|
|
|
$this->assertSame($this->testMode, $this->gateway->getTestMode()); |
|
43
|
|
|
} |
|
44
|
|
|
|
|
45
|
|
|
public function testCompletePurchase() |
|
46
|
|
|
{ |
|
47
|
|
|
$request = $this->gateway->completePurchase([ |
|
48
|
|
|
'transactionId' => $this->transactionId, |
|
49
|
|
|
]); |
|
50
|
|
|
|
|
51
|
|
|
$this->assertSame($this->purse, $request->getPurse()); |
|
52
|
|
|
$this->assertSame($this->secret, $request->getSecret()); |
|
53
|
|
|
$this->assertSame($this->testMode, $request->getTestMode()); |
|
54
|
|
|
$this->assertSame($this->transactionId, $request->getTransactionId()); |
|
55
|
|
|
} |
|
56
|
|
|
|
|
57
|
|
|
public function testPurchase() |
|
58
|
|
|
{ |
|
59
|
|
|
$request = $this->gateway->purchase([ |
|
60
|
|
|
'transactionId' => $this->transactionId, |
|
61
|
|
|
'description' => $this->description, |
|
62
|
|
|
'currency' => $this->currency, |
|
63
|
|
|
'amount' => $this->amount, |
|
64
|
|
|
]); |
|
65
|
|
|
|
|
66
|
|
|
$this->assertSame($this->transactionId, $request->getTransactionId()); |
|
67
|
|
|
$this->assertSame($this->description, $request->getDescription()); |
|
68
|
|
|
$this->assertSame($this->currency, $request->getCurrency()); |
|
69
|
|
|
$this->assertSame($this->amount, $request->getAmount()); |
|
70
|
|
|
} |
|
71
|
|
|
} |
|
72
|
|
|
|