|
1
|
|
|
<?php |
|
2
|
|
|
|
|
3
|
|
|
namespace app\components\payment; |
|
4
|
|
|
|
|
5
|
|
|
use app\modules\shop\models\OrderTransaction; |
|
6
|
|
|
use yii\helpers\Json; |
|
7
|
|
|
|
|
8
|
|
|
class RBKMoneyPayment extends AbstractPayment |
|
9
|
|
|
{ |
|
10
|
|
|
public $eshopId; |
|
11
|
|
|
public $currency; |
|
12
|
|
|
public $language; |
|
13
|
|
|
public $secretKey; |
|
14
|
|
|
public $serviceName; |
|
15
|
|
|
|
|
16
|
|
View Code Duplication |
public function content() |
|
17
|
|
|
{ |
|
18
|
|
|
return $this->render( |
|
19
|
|
|
'rbk-money', |
|
20
|
|
|
[ |
|
21
|
|
|
'currency' => $this->currency, |
|
22
|
|
|
'eshopId' => $this->eshopId, |
|
23
|
|
|
'language' => $this->language, |
|
24
|
|
|
'order' => $this->order, |
|
25
|
|
|
'serviceName' => $this->serviceName, |
|
26
|
|
|
'transaction' => $this->transaction, |
|
27
|
|
|
] |
|
28
|
|
|
); |
|
29
|
|
|
} |
|
30
|
|
|
|
|
31
|
|
|
public function checkResult($hash = '') |
|
32
|
|
|
{ |
|
33
|
|
|
if (isset($_GET['eshopId'], $_GET['orderId'], $_GET['serviceName'], $_GET['eshopAccount'], |
|
34
|
|
|
$_GET['paymentAmount'], $_GET['paymentCurrency'], $_GET['paymentStatus'], $_GET['userName'], |
|
35
|
|
|
$_GET['userEmail'], $_GET['paymentData'], $_GET['hash']) |
|
36
|
|
|
) { |
|
37
|
|
|
$hash = md5( |
|
38
|
|
|
implode( |
|
39
|
|
|
'::', |
|
40
|
|
|
[ |
|
41
|
|
|
$_GET['eshopId'], |
|
42
|
|
|
$_GET['orderId'], |
|
43
|
|
|
$_GET['serviceName'], |
|
44
|
|
|
$_GET['eshopAccount'], |
|
45
|
|
|
$_GET['paymentAmount'], |
|
46
|
|
|
$_GET['paymentCurrency'], |
|
47
|
|
|
$_GET['paymentStatus'], |
|
48
|
|
|
$_GET['userName'], |
|
49
|
|
|
$_GET['userEmail'], |
|
50
|
|
|
$_GET['paymentData'], |
|
51
|
|
|
$this->secretKey, |
|
52
|
|
|
] |
|
53
|
|
|
) |
|
54
|
|
|
); |
|
55
|
|
|
if ($hash == $_GET['hash']) { |
|
56
|
|
|
$transaction = $this->loadTransaction($_GET['orderId']); |
|
57
|
|
|
$transaction->result_data = Json::encode($_GET); |
|
58
|
|
|
$transaction->status = OrderTransaction::TRANSACTION_SUCCESS; |
|
59
|
|
|
$this->redirect($transaction->save(true, ['result_data', 'status']), $transaction->order_id); |
|
|
|
|
|
|
60
|
|
|
} |
|
61
|
|
|
} |
|
62
|
|
|
} |
|
63
|
|
|
} |
|
64
|
|
|
|
It seems like the type of the argument is not accepted by the function/method which you are calling.
In some cases, in particular if PHP’s automatic type-juggling kicks in this might be fine. In other cases, however this might be a bug.
We suggest to add an explicit type cast like in the following example: