forked from yii-cms/yii2-robokassa
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathResultAction.php
35 lines (27 loc) · 929 Bytes
/
ResultAction.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
<?php
namespace robokassa;
use Yii;
use yii\web\BadRequestHttpException;
class ResultAction extends BaseAction {
/**
* Runs the action.
*/
public function run()
{
if (!isset($_REQUEST['OutSum'], $_REQUEST['InvId'], $_REQUEST['SignatureValue'])) {
throw new BadRequestHttpException;
}
/** @var \robokassa\Merchant $merchant */
$merchant = Yii::$app->get($this->merchant);
$shp = [];
foreach ($_REQUEST as $key => $param) {
if (strpos(strtolower($key), 'shp') === 0) {
$shp[$key] = $param;
}
}
if ($merchant->checkSignature($_REQUEST['SignatureValue'], $_REQUEST['OutSum'], $_REQUEST['InvId'], $merchant->sMerchantPass2, $shp)) {
return $this->callback($merchant, $_REQUEST['InvId'], $_REQUEST['OutSum'], $shp);
}
throw new BadRequestHttpException;
}
}