1
|
|
|
<?php |
2
|
|
|
/** |
3
|
|
|
* InterKassa driver for the Omnipay PHP payment processing library |
4
|
|
|
* |
5
|
|
|
* @link https://github.com/hiqdev/omnipay-interkassa |
6
|
|
|
* @package omnipay-interkassa |
7
|
|
|
* @license MIT |
8
|
|
|
* @copyright Copyright (c) 2015-2017, HiQDev (http://hiqdev.com/) |
9
|
|
|
*/ |
10
|
|
|
|
11
|
|
|
namespace Omnipay\InterKassa\Tests\Message; |
12
|
|
|
|
13
|
|
|
use Omnipay\InterKassa\Message\OldPurchaseRequest; |
14
|
|
|
use Omnipay\InterKassa\Message\PurchaseResponse; |
15
|
|
|
use Omnipay\InterKassa\Stubs\OldPurchaseResponseStub; |
16
|
|
|
|
17
|
|
|
class OldPurchaseResponseTest extends PurchaseResponseTest |
18
|
|
|
{ |
19
|
|
|
/** |
20
|
|
|
* @var PurchaseResponse |
21
|
|
|
*/ |
22
|
|
|
protected $request; |
23
|
|
|
|
24
|
|
|
/** |
25
|
|
|
* @var OldPurchaseResponseStub |
26
|
|
|
*/ |
27
|
|
|
private $stub; |
|
|
|
|
28
|
|
|
|
29
|
|
View Code Duplication |
public function setUp() |
|
|
|
|
30
|
|
|
{ |
31
|
|
|
parent::setUp(); |
32
|
|
|
|
33
|
|
|
$this->stub = new OldPurchaseResponseStub(); |
34
|
|
|
$stub = $this->stub; |
35
|
|
|
|
36
|
|
|
$this->request = new OldPurchaseRequest($this->getHttpClient(), $this->getHttpRequest()); |
|
|
|
|
37
|
|
|
$this->request->initialize([ |
38
|
|
|
'purse' => $stub->purse, |
39
|
|
|
'signAlgorithm' => $stub->signAlgorithm, |
40
|
|
|
'signKey' => $stub->signKey, |
41
|
|
|
'testKey' => $stub->testKey, |
42
|
|
|
'returnUrl' => $stub->returnUrl, |
43
|
|
|
'cancelUrl' => $stub->cancelUrl, |
44
|
|
|
'notifyUrl' => $stub->notifyUrl, |
45
|
|
|
'returnMethod' => $stub->returnMethod, |
46
|
|
|
'cancelMethod' => $stub->cancelMethod, |
47
|
|
|
'notifyMethod' => $stub->notifyMethod, |
48
|
|
|
'description' => $stub->description, |
49
|
|
|
'transactionId' => $stub->transactionId, |
50
|
|
|
'amount' => $stub->amount, |
51
|
|
|
'currency' => $stub->currency, |
52
|
|
|
]); |
53
|
|
|
} |
54
|
|
|
|
55
|
|
|
public function testSuccess() |
56
|
|
|
{ |
57
|
|
|
/** @var PurchaseResponse $response */ |
58
|
|
|
$response = $this->request->send(); |
|
|
|
|
59
|
|
|
$stub = $this->stub; |
60
|
|
|
|
61
|
|
|
$this->assertFalse($response->isSuccessful()); |
62
|
|
|
$this->assertTrue($response->isRedirect()); |
63
|
|
|
$this->assertNull($response->getCode()); |
64
|
|
|
$this->assertNull($response->getMessage()); |
65
|
|
|
|
66
|
|
|
$this->assertSame('POST', $response->getRedirectMethod()); |
67
|
|
|
$this->assertSame([ |
68
|
|
|
'ik_shop_id' => $stub->purse, |
69
|
|
|
'ik_payment_amount' => $stub->amount, |
70
|
|
|
'ik_payment_id' => $stub->transactionId, |
71
|
|
|
'ik_payment_desc' => $stub->description, |
72
|
|
|
'ik_success_url' => $stub->returnUrl, |
73
|
|
|
'ik_success_method' => $stub->returnMethod, |
74
|
|
|
'ik_fail_url' => $stub->cancelUrl, |
75
|
|
|
'ik_fail_method' => $stub->cancelMethod, |
76
|
|
|
'ik_status_url' => $stub->notifyUrl, |
77
|
|
|
'ik_status_method' => $stub->notifyMethod, |
78
|
|
|
], $response->getRedirectData()); |
79
|
|
|
} |
80
|
|
|
} |
81
|
|
|
|