1
|
|
|
<?php |
2
|
|
|
|
3
|
|
|
/* |
4
|
|
|
* InterKassa driver for the Omnipay PHP payment processing library |
5
|
|
|
* |
6
|
|
|
* @link https://github.com/hiqdev/omnipay-interkassa |
7
|
|
|
* @package omnipay-interkassa |
8
|
|
|
* @license MIT |
9
|
|
|
* @copyright Copyright (c) 2015-2016, HiQDev (http://hiqdev.com/) |
10
|
|
|
*/ |
11
|
|
|
|
12
|
|
|
namespace Omnipay\InterKassa\Tests; |
13
|
|
|
|
14
|
|
|
use Omnipay\InterKassa\Gateway; |
15
|
|
|
use Omnipay\Tests\GatewayTestCase; |
16
|
|
|
|
17
|
|
|
class GatewayTest extends GatewayTestCase |
18
|
|
|
{ |
19
|
|
|
/** |
20
|
|
|
* @var Gateway |
21
|
|
|
*/ |
22
|
|
|
public $gateway; |
23
|
|
|
|
24
|
|
|
protected $purse = '887ac1234c1eeee1488b156b'; |
25
|
|
|
protected $secret = 'Zp2zfdSJzbS61L32'; |
26
|
|
|
protected $transactionId = 'ID_123456'; |
27
|
|
|
protected $description = 'Test completePurchase description'; |
28
|
|
|
protected $currency = 'USD'; |
29
|
|
|
protected $amount = '12.46'; |
30
|
|
|
|
31
|
|
|
public function setUp() |
32
|
|
|
{ |
33
|
|
|
parent::setUp(); |
34
|
|
|
|
35
|
|
|
$this->gateway = new Gateway($this->getHttpClient(), $this->getHttpRequest()); |
36
|
|
|
$this->gateway->setPurse($this->purse); |
37
|
|
|
$this->gateway->setSecret($this->secret); |
38
|
|
|
} |
39
|
|
|
|
40
|
|
|
public function testGateway() |
41
|
|
|
{ |
42
|
|
|
$this->assertSame($this->purse, $this->gateway->getPurse()); |
43
|
|
|
$this->assertSame($this->secret, $this->gateway->getSecret()); |
44
|
|
|
} |
45
|
|
|
|
46
|
|
|
public function testCompletePurchase() |
47
|
|
|
{ |
48
|
|
|
$request = $this->gateway->completePurchase([ |
49
|
|
|
'transactionId' => $this->transactionId, |
50
|
|
|
]); |
51
|
|
|
|
52
|
|
|
$this->assertSame($this->purse, $request->getPurse()); |
53
|
|
|
$this->assertSame($this->secret, $request->getSecret()); |
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
|
|
|
|