Файл: app/result/interkassa.php
Строк: 10
<?php
$ik_co_id = '5dd583bd1ae1bd69048b456a';
if(isset($_POST)){
$method = explode('_', $_POST['ik_pw_via']);
$pay = $db->preapre('SELECT * FROM `payments` WHERE `id` = ?');
$pay -> execute([$_POST['ik_pm_no']]);
$pay = $pay -> fetch(PDO :: FETCH_ASSOC);
if(!isset($pay['id']) or $pay['summa'] < $_POST['ik_am'] or $ik_co_id != $_POST['ik_co_id'] or $_POST['ik_inv_st'] != 'success'){
exit('NO');
}
$shop = $db->prepare('SELECT * FROM `shop` WHERE `id` = ?');
$shop ->execute([$pay['shop']]);
$shop = $shop -> fetch(PDO :: FETCH_ASSOC);
$method = $db->prepare('SELECT * FROM `method` WHERE `id` = ?');
$method -> execute([1]);
$method = $method -> fetch(PDO :: FETCH_ASSOC);
$pr = $method['megafon']/100;
if($shop['method'] == 2) $pay['summa'] = $pay['summa']-$pay['summa']*$pr;
$shopOp = $db->prepare('UPDATE `shop` SET `money` = ? WHERE `id` = ?');
$shopOp -> execute([$shop['money']+$pay['summa'],$shop['id']]);
$payUp = $db->prepare('UPDATE `payments` SET `status` = ? WHERE `id` = ?');
$payUp -> execute([2,$pay['id']]);
echo 200;
notifSend($shop['user'],'Новая оплата на кассе ID'.$shop['id'].' <br> Сумма: '.$pay['summa'].' <br> Способ оплаты: Яндекс Деньги <br> Дата: '.date('c',$pay['time']));
}