Файл: app/result/payeer.php
Строк: 25
<?php
// обработчик Payeer
// USPAY.RU
if (!in_array($_SERVER['REMOTE_ADDR'], array('185.71.65.92', '185.71.65.189', '149.202.17.210'))) return;
if (isset($_POST['m_operation_id']) && isset($_POST['m_sign']))
{
$m_key = PayeerKey;
$arHash = array(
$_POST['m_operation_id'],
$_POST['m_operation_ps'],
$_POST['m_operation_date'],
$_POST['m_operation_pay_date'],
$_POST['m_shop'],
$_POST['m_orderid'],
$_POST['m_amount'],
$_POST['m_curr'],
$_POST['m_desc'],
$_POST['m_status']
);
if (isset($_POST['m_params']))
{
$arHash[] = $_POST['m_params'];
}
$arHash[] = $m_key;
$sign_hash = strtoupper(hash('sha256', implode(':', $arHash)));
if ($_POST['m_sign'] == $sign_hash and $_POST['m_status'] == 'success')
{
$pay = $db->prepare('select * from `payments` where `id` = ?');
$pay -> execute([$_POST['m_orderid']]);
$pay = $pay -> fetch(PDO :: FETCH_OBJ);
if(!isset($pay->id)) exit;
$pr = method(shop($pay->shop)->method)->payeer/100;
if(shop($pay->shop)->method == 2) $pay->summa = $pay->summa-$pay->summa*$pr;
$price = $db->prepare('update shop set money = ? where id = ?');
$price -> execute([shop($pay->shop)->money+$pay->summa,
$pay->shop
]);
$status = $db->prepare('update payments set status = ?, sum = ? where id = ?');
$status -> execute([2,$pay->summa,$pay->id]);
notifSend(shop($pay->shop)->user,
'Новая оплата на кассе «'.shop($pay->shop)->name.'» '.PHP_EOL.'
Сумма: '.$pay->summa.' RUB '.PHP_EOL.'
Способ оплаты: Payeer '.PHP_EOL.'
Дата: '.date('d.m.Y H:i'));
Curl();
ob_end_clean(); exit($_POST['m_orderid'].'|success');
}
ob_end_clean(); exit($_POST['m_orderid'].'|error');
}