Пример #1
0
foreach (cot_getextplugins('payments.billing.register') as $pl) {
    include $pl;
}
/* ===== */
// Проверяем платежки на оплату пополнение счета.
if ($balancepays = cot_payments_getallpays('balance', 'paid')) {
    foreach ($balancepays as $pay) {
        if (cot_payments_updatestatus($pay['pay_id'], 'done')) {
            $urr = $db->query("SELECT * FROM {$db_users} WHERE user_id=" . $pay['pay_userid'])->fetch();
            $subject = $L['payments_balance_billing_admin_subject'];
            $body = sprintf($L['payments_balance_billing_admin_body'], $urr['user_name'], $pay['pay_summ'] . ' ' . $cfg['payments']['valuta'], $pay['pay_id'], cot_date('d.m.Y в H:i', $pay['pay_pdate']));
            cot_mail($cfg['adminemail'], $subject, $body);
            if (!empty($pay['pay_code'])) {
                $dpay = cot_payments_payinfo($pay['pay_code']);
                if (!empty($dpay)) {
                    $ubalance = cot_payments_getuserbalance($dpay['pay_userid']);
                    if ($ubalance >= $dpay['pay_summ'] && cot_payments_updatestatus($dpay['pay_id'], 'paid')) {
                        cot_payments_updateuserbalance($dpay['pay_userid'], -$dpay['pay_summ'], $dpay['pay_id']);
                    }
                }
            }
            /* === Hook === */
            foreach (cot_getextplugins('payments.balance.billing.done') as $pl) {
                include $pl;
            }
            /* ===== */
        }
    }
}
if ($cfg['payments']['clearpaymentsdays'] > 0) {
    $clearpaymentsdate = $sys['now'] - $cfg['payments']['clearpaymentsdays'] * 24 * 60 * 60;
Пример #2
0
}
if ($n == 'transfer') {
    cot_block($cfg['payments']['transfers_enabled']);
    if ($a == 'add') {
        $summ = cot_import('summ', 'P', 'NUM');
        $username = cot_import('username', 'P', 'TXT', 100, TRUE);
        $comment = cot_import('comment', 'P', 'TXT');
        $taxsumm = $summ * $cfg['payments']['transfertax'] / 100;
        if ($cfg['payments']['transfertaxfromrecipient']) {
            $sendersumm = $summ;
            $recipientsumm = $summ - $taxsumm;
        } else {
            $sendersumm = $summ + $taxsumm;
            $recipientsumm = $summ;
        }
        $ubalance = cot_payments_getuserbalance($usr['id']);
        $recipient = $db->query("SELECT * FROM {$db_users} WHERE user_name = ? LIMIT 1", array($username))->fetch();
        cot_check(empty($recipient), 'payments_balance_transfer_error_username');
        cot_check(!empty($recipient) && $username == $usr['name'], 'payments_balance_transfer_error_yourself');
        cot_check(empty($comment), 'payments_balance_transfer_error_comment');
        cot_check(empty($summ), 'payments_balance_transfer_error_emptysumm');
        cot_check(!empty($summ) && $summ < 0, 'payments_balance_transfer_error_wrongsumm');
        cot_check($sendersumm > $ubalance, 'payments_balance_transfer_error_balance');
        cot_check($cfg['payments']['transfermin'] > 0 && $summ < $cfg['payments']['transfermin'], sprintf($L['payments_balance_transfer_error_min'], $cfg['payments']['transfermin'], $cfg['payments']['valuta']));
        cot_check($cfg['payments']['transfermax'] > 0 && $summ > $cfg['payments']['transfermax'], sprintf($L['payments_balance_transfer_error_max'], $cfg['payments']['transfermax'], $cfg['payments']['valuta']));
        if (!cot_error_found()) {
            $payinfo['pay_userid'] = $usr['id'];
            $payinfo['pay_area'] = 'transfer';
            $payinfo['pay_code'] = $recipient['user_id'];
            $payinfo['pay_summ'] = $sendersumm;
            $payinfo['pay_cdate'] = $sys['now'];
<?php

/**
 * [BEGIN_COT_EXT]
 * Hooks=header.user.tags
 * [END_COT_EXT]
 */
/**
 * Payments module
 *
 * @package payments
 * @version 1.1.2
 * @author CMSWorks Team
 * @copyright Copyright (c) CMSWorks.ru
 * @license BSD
 */
defined('COT_CODE') or die('Wrong URL.');
require_once cot_incfile('payments', 'module');
if ($cfg['payments']['balance_enabled']) {
    $t->assign(array('HEADER_USER_BALANCE' => cot_payments_getuserbalance($usr['id']), 'HEADER_USER_BALANCE_URL' => cot_url('payments', 'm=balance')));
}