<?php
if (!defined('FLUX_ROOT')) exit;
if (empty($_REQUEST['merchant_id'])) {
die('bad request!');
}
$merchant =Flux::config('enot_merchant_id'); // id вашего магазина
$secret_word2 = Flux::config('enot_secret_key2'); // секретный ключ 2
$sign = md5($merchant.':'.$_REQUEST['amount'].':'.$secret_word2.':'.$_REQUEST['merchant_id']);
if ($sign != $_REQUEST['sign_2']) {
die('bad sign!');
}
$credits = floor($_REQUEST['credited'] + $_REQUEST['commission']);
$account_id = $_REQUEST['custom_field'];
$order_id = $_REQUEST['intid'];
$sql = "insert into {$server->loginDatabase}.unitpay_payments (`unitpayId`, `account`, `sum`, `itemsCount`, `dateCreate`, `dateComplete`, `status`, `state`) values (?,?,?,?,?,?,?,'waiting');";
$sth = $server->connection->getStatement($sql);
$sth->execute(array($order_id, $account_id, $credits, $credits, date('Y-m-d H:i:s'), date('Y-m-d H:i:s'), 1));
$server->loginServer->depositCredits($account_id, $credits, $credits);
die();