Файл: app/result/yandex.php
Строк: 18
<?php
// обработчик Яндекс Деньги
// USPAY.RU
// Генереруем HASH
$hash = $_POST['notification_type'] . '&'. $_POST['operation_id']. '&' . $_POST['amount'] . '&643&' . $_POST['datetime'] . '&'. $_POST['sender'] . '&' . $_POST['codepro'] . '&' .YandexKey. '&' . $_POST['label'];
$sha1 = hash('sha1', $hash);
if($sha1 != $_POST['sha1_hash']) exit();
$pay = $db->prepare('select * from `payments` where `id` = ?');
$pay -> execute([$_POST['label']]);
$pay = $pay -> fetch(PDO :: FETCH_OBJ);
if(!isset($pay->id) or $_POST['withdraw_amount'] < $pay->summa) exit;
$pr = method(shop($pay->shop)->method)->yandex/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 = ?, operation = ?, sum = ? where id = ?');
$status -> execute([2,$_POST['operation_id'],$pay->summa,$pay->id]);
notifSend(shop($pay->shop)->user,
'Новая оплата на кассе «'.shop($pay->shop)->name.'» '.PHP_EOL.'
Сумма: '.$pay->summa.' RUB '.PHP_EOL.'
Способ оплаты: Яндекс Деньги'.PHP_EOL.'
Дата: '.date('d.m.Y H:i'));
Curl();
exit('OK');