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\Message; |
13
|
|
|
|
14
|
|
|
use Omnipay\InterKassa\Message\OldPurchaseRequest; |
15
|
|
|
use Omnipay\InterKassa\Message\PurchaseResponse; |
16
|
|
|
use Omnipay\InterKassa\Stubs\OldPurchaseResponseStub; |
17
|
|
|
|
18
|
|
|
class OldPurchaseResponseTest extends PurchaseResponseTest |
19
|
|
|
{ |
20
|
|
|
/** |
21
|
|
|
* @var PurchaseResponse |
22
|
|
|
*/ |
23
|
|
|
protected $request; |
24
|
|
|
|
25
|
|
|
/** |
26
|
|
|
* @var OldPurchaseResponseStub |
27
|
|
|
*/ |
28
|
|
|
private $stub; |
|
|
|
|
29
|
|
|
|
30
|
|
View Code Duplication |
public function setUp() |
|
|
|
|
31
|
|
|
{ |
32
|
|
|
parent::setUp(); |
33
|
|
|
|
34
|
|
|
$this->stub = new OldPurchaseResponseStub(); |
35
|
|
|
$stub = $this->stub; |
36
|
|
|
|
37
|
|
|
$this->request = new OldPurchaseRequest($this->getHttpClient(), $this->getHttpRequest()); |
|
|
|
|
38
|
|
|
$this->request->initialize([ |
39
|
|
|
'purse' => $stub->purse, |
40
|
|
|
'signAlgorithm' => $stub->signAlgorithm, |
41
|
|
|
'signKey' => $stub->signKey, |
42
|
|
|
'testKey' => $stub->testKey, |
43
|
|
|
'returnUrl' => $stub->returnUrl, |
44
|
|
|
'cancelUrl' => $stub->cancelUrl, |
45
|
|
|
'notifyUrl' => $stub->notifyUrl, |
46
|
|
|
'returnMethod' => $stub->returnMethod, |
47
|
|
|
'cancelMethod' => $stub->cancelMethod, |
48
|
|
|
'notifyMethod' => $stub->notifyMethod, |
49
|
|
|
'description' => $stub->description, |
50
|
|
|
'transactionId' => $stub->transactionId, |
51
|
|
|
'amount' => $stub->amount, |
52
|
|
|
'currency' => $stub->currency, |
53
|
|
|
]); |
54
|
|
|
} |
55
|
|
|
|
56
|
|
|
public function testSuccess() |
57
|
|
|
{ |
58
|
|
|
/** @var PurchaseResponse $response */ |
59
|
|
|
$response = $this->request->send(); |
|
|
|
|
60
|
|
|
$stub = $this->stub; |
61
|
|
|
|
62
|
|
|
$this->assertFalse($response->isSuccessful()); |
63
|
|
|
$this->assertTrue($response->isRedirect()); |
64
|
|
|
$this->assertNull($response->getCode()); |
65
|
|
|
$this->assertNull($response->getMessage()); |
66
|
|
|
|
67
|
|
|
$this->assertSame('POST', $response->getRedirectMethod()); |
68
|
|
|
$this->assertSame([ |
69
|
|
|
'ik_shop_id' => $stub->purse, |
70
|
|
|
'ik_payment_amount' => $stub->amount, |
71
|
|
|
'ik_payment_id' => $stub->transactionId, |
72
|
|
|
'ik_payment_desc' => $stub->description, |
73
|
|
|
'ik_success_url' => $stub->returnUrl, |
74
|
|
|
'ik_success_method' => $stub->returnMethod, |
75
|
|
|
'ik_fail_url' => $stub->cancelUrl, |
76
|
|
|
'ik_fail_method' => $stub->cancelMethod, |
77
|
|
|
'ik_status_url' => $stub->notifyUrl, |
78
|
|
|
'ik_status_method' => $stub->notifyMethod, |
79
|
|
|
], $response->getRedirectData()); |
80
|
|
|
} |
81
|
|
|
} |
82
|
|
|
|