Пример #1
0
                    }
                }
            }
        }
        // Поддержка передачи данных для многошаговых платежных систем
        if (is_array($pay_link['DATA'])) {
            foreach ($pay_link['DATA'] as $key => $value) {
                $template->assign_block_vars('pay_link_data', array('FIELD' => $key, 'VALUE' => $value));
            }
        }
        if (is_array($pay_link) && in_array($pay_link['PAY_LINK_METHOD'], array('POST', 'GET', 'LINK', 'STEP'))) {
            // TODO Переделать это под assign_vars_recursive и возвращать пустые строки если нет платежного метода - для унификации формы в темплейте
            $template->assign_vars(array('PAY_LINK_METHOD' => $pay_link['PAY_LINK_METHOD'], 'PAY_LINK_URL' => $pay_link['PAY_LINK_URL']));
        } else {
            throw new exception($lang['pay_msg_request_paylink_unsupported'], ERR_ERROR);
        }
    } catch (exception $e) {
        $template->assign_block_vars('result', $response = array('STATUS' => $e->getCode(), 'MESSAGE' => $e->getMessage()));
        $debug->warning('Результат операции: код ' . $e->getCode() . ' сообщение "' . $e->getMessage() . '"', 'Ошибка платежа', LOG_INFO_PAYMENT);
    }
}
// Прегенерированные пакеты
foreach ($unit_available_amount_list as $unit_amount => $discount) {
    $temp = sn_module_payment::currency_convert($unit_amount, 'MM_', $player_currency);
    $template->assign_block_vars('mm_amount', array('VALUE' => $unit_amount, 'PRICE_TEXT' => pretty_number($temp, 2), 'CURRENCY' => $player_currency, 'DISCOUNT' => $discount, 'DISCOUNT_PERCENT' => $discount * 100, 'DISCOUNTED' => $unit_amount * (1 + $discount), 'TEXT' => pretty_number($unit_amount), 'TEXT_DISCOUNTED' => pretty_number($unit_amount * (1 + $discount))));
}
$currency = $payment_module ? sn_module_payment::$payment_methods[$payment_type_selected][$payment_method_selected]['currency'] : '';
$bonus_percent = round(sn_module_payment::bonus_calculate($request['metamatter'], true, true) * 100);
$income_metamatter_text = pretty_number(sn_module_payment::bonus_calculate($request['metamatter']), true, true);
$template->assign_vars(array('PAGE_HEADER' => $lang['sys_metamatter'], 'URL_PURCHASE' => $config->url_purchase_metamatter, 'PAYMENT_TYPE' => $payment_type_selected, 'PAYMENT_METHOD' => $payment_method_selected, 'PAYMENT_METHOD_NAME' => $lang['pay_methods'][$payment_method_selected], 'PAYMENT_MODULE' => $payment_module, 'PAYMENT_MODULE_NAME' => $lang["module_{$payment_module}_name"], 'PAYMENT_MODULE_DESCRIPTION' => $lang["module_{$payment_module}_description"], 'PLAYER_CURRENCY' => $player_currency, 'PLAYER_CURRENCY_PRICE_PER_MM' => sn_module_payment::currency_convert(1, $player_currency, 'MM_', 10), 'UNIT_AMOUNT' => (double) $request['metamatter'], 'UNIT_AMOUNT_TEXT' => pretty_number($request['metamatter']), 'UNIT_AMOUNT_BONUS_PERCENT' => $bonus_percent, 'UNIT_AMOUNT_TEXT_DISCOUNTED' => $income_metamatter_text, 'UNIT_AMOUNT_TEXT_COST_BASE' => pretty_number(sn_module_payment::currency_convert($request['metamatter'], 'MM_', $player_currency), 2), 'PAYMENT_CURRENCY_EXCHANGE_DEFAULT' => pretty_number(get_mm_cost(), true, true), 'PAYMENT_CURRENCY_DEFAULT_TEXT' => $lang['pay_currency_list'][$config->payment_currency_default], 'METAMATTER' => mrc_get_level($user, '', RES_METAMATTER), 'METAMATTER_COST_TEXT' => sprintf($lang['pay_mm_buy_conversion_cost'], pretty_number($request['metamatter'], true, true), pretty_number(sn_module_payment::currency_convert($request['metamatter'], 'MM_', $currency), 2, true), $currency), 'METAMATTER_COST_BONUS_TEXT' => $bonus_percent ? sprintf($lang['pay_mm_buy_real_income'], pretty_number($bonus_percent, true, true), $income_metamatter_text) : '', 'DARK_MATTER_DESCRIPTION' => $lang['info'][RES_DARK_MATTER]['description'], 'PAYMENT_AVAILABLE' => sn_module_get_active_count('payment') && !defined('SN_GOOGLE')));
display($template, $lang['sys_metamatter']);
Пример #2
0
    if (!is_object($module) || $module->manifest['package'] != 'payment' || !$module->manifest['active']) {
        continue;
    }
    lng_include($module_name, $module->manifest['root_relative']);
    $template->assign_block_vars('payment_module', array('ID' => $module_name, 'NAME' => $lang["module_{$module_name}_name"], 'DESCRIPTION' => $lang["module_{$module_name}_description"]));
    $payment_module_valid = $payment_module_valid || $module_name == $payment_module;
}
// If payment_module invalid - making it empty OR if there is only one payment_module - selecting it
$payment_module = $payment_module_valid ? $payment_module : (count($template->_tpldata['payment_module']) == 1 ? $template->_tpldata['payment_module'][0]['ID'] : '');
foreach ($lang['pay_currency_list'] as $key => $value) {
    $var_name = 'payment_currency_exchange_' . strtolower($key);
    $course = $config->{$var_name};
    if (!$course || $key == $config->payment_currency_default) {
        continue;
    }
    $template->assign_block_vars('exchange', array('SYMBOL' => $key, 'TEXT' => $value, 'COURSE_DIRECT' => pretty_number($course, 4), 'COURSE_REVERSE' => pretty_number(1 / $course, 4), 'DM_PER_UNIT' => sn_module_payment::currency_convert(1, $key, 'DM_'), 'UNIT_PER_LOT' => sn_module_payment::currency_convert(2500, 'DM_', $key)));
}
// 1/0,24712 = 4,046617028164
if ($request['dark_matter'] && $payment_module) {
    try {
        // Any possible errors about generating paylink should be raised in module!
        $pay_link = $sn_module[$payment_module]->compile_request($request);
        if (is_array($pay_link['RENDER'])) {
            foreach ($pay_link['RENDER'] as $html_data) {
                $template->assign_block_vars('render', $html_data);
                if (isset($html_data['VALUE']) && is_array($html_data['VALUE'])) {
                    foreach ($html_data['VALUE'] as $value_id => $value_value) {
                        $template->assign_block_vars('render.value', array('FIELD' => $value_id, 'VALUE' => $value_value));
                    }
                }
            }