$user_content->releaseDelayedStreams(); $user_content->getQueueCounts(); $user_content->getStreamsQueueCounts(); if (date('i') % 5 == 0) { walletAlpha::checkProgressOrders(); } // аждые 20 минут пересчитываем счетчики остальных сообществ if (date('i') % 20 == 0) { commune::recalcThemesCountCommunes(null, commune::COMMUNE_BLOGS_ID); } if (date('i') % 15 == 0) { // проверка статусов платежей paymaster при возврате require_once $_SERVER['DOCUMENT_ROOT'] . "/classes/pmpay.php"; $pm = new pmpay(); if (DEBUG) { $pm->setDebugUrl($GLOBALS['host'] . '/norisk2/admin/pm-server-test.php'); } $pm->checkRefund(); } if (SERVER === 'release') { /* * @todo: https://beta.free-lance.ru/mantis/view.php?id=29134#c87337 * require_once($_SERVER['DOCUMENT_ROOT'] . "/classes/qiwipay.php"); $qiwipay = new qiwipay(); $qiwipay->checkBillsStatus($error); */ if (date('i') % 10 == 0) { // проверка статусов платежей paymaster require_once $_SERVER['DOCUMENT_ROOT'] . "/classes/pmpay.php"; $pm = new pmpay();
/** * Возврат денежных средств. * * @global type $DB * * @param type $payment_id ИД операции в paymaster * * @return bool */ public function refund($payment_id = null, $stage = null, $debug = false) { global $DB; $log = new log('pmpay/refundPayments-%d%m%Y.log', 'a', '%d.%m.%Y %H:%M:%S : '); $log->writeln("payment_id = [{$payment_id}], stage = [{$stage}], debug = [{$debug}]"); if (!$payment_id) { return false; } require_once $_SERVER['DOCUMENT_ROOT'] . '/classes/pmpay.php'; require_once $_SERVER['DOCUMENT_ROOT'] . '/classes/exrates.php'; $pmpay = new pmpay(); // Возврат осуществляется только при резервировании через WMR $sql = 'SELECT * FROM sbr_stages_payouts WHERE stage_id = ?i AND user_id = ?i AND is_refund IS NULL;'; $row = $DB->row($sql, $stage->id, $stage->sbr->emp_id); // Возврат осуществляется только для работодателей if ($row) { if (DEBUG) { $log->writeln('debug_mode = ON'); $pmpay->setDebugUrl($GLOBALS['host'] . '/norisk2/admin/pm-server-test.php'); } $operation = (array) $pmpay->refundPayments($payment_id, $row['credit_sum']); if ($operation && $operation['Status'] != 'FAILURE' && $operation['ErrorCode'] == 0) { if ($operation['Status'] == 'EXECUTING' || $operation['Status'] == 'PENDING') { $update = array('is_refund' => false, 'refund_id' => $operation['RefundID']); $this->refundStatusUpdate($update, $row['id']); } elseif ($operation['Status'] == 'SUCCESS') { $update = array('is_refund' => true, 'refund_id' => $operation['RefundID'], 'completed' => 'NOW()'); $this->refundStatusUpdate($update, $row['id']); } else { $update = array('is_refund' => null, 'refund_id' => $operation['RefundID']); $this->refundStatusUpdate($update, $row['id']); } } } else { $log = new log('pmpay/refundPayments-%d%m%Y.log', 'a', '%d.%m.%Y %H:%M:%S : '); $log->writeln("Ошибка выдачи SQL -- [{$DB->sql}]."); } }