<?php $eventName = $modx->event->name; $_isAdmin = $modx->user->sudo == 1; if (!defined('YANDEXMONEY_PATH')) { define('YANDEXMONEY_PATH', MODX_CORE_PATH . "components/yandexmoney/"); } require_once YANDEXMONEY_PATH . 'model/yandexmoney.class.php'; $snippet = $modx->getObject('modSnippet', array('name' => 'YandexMoney')); $config = $snippet->getProperties(); $ym = new Yandexmoney($modx, $config); if (!empty($_SESSION['shk_lastOrder']) && !empty($_SESSION['shk_lastOrder']['id'])) { $ym->pay_method = !empty($_SESSION['shk_lastOrder']['payment']) ? $_SESSION['shk_lastOrder']['payment'] : ''; $order_id = (int) $_SESSION['shk_lastOrder']['id']; } if (!empty($_POST['payment'])) { $ym->pay_method = $_POST['payment']; } if (!$ym->checkPayMethod()) { return true; } $modx->addPackage('shopkeeper', MODX_CORE_PATH . "components/shopkeeper/model/"); $order = $modx->getObject('SHKorder', array('id' => $order_id)); if (!$order) { return false; } $output = ''; if ($order_id && $_POST['order']) { $ym->userId = $modx->getLoginUserID('web') ? $modx->getLoginUserID('web') : 0; $ym->orderId = $order_id; $ym->orderTotal = $_SESSION['shk_lastOrder']['price'];
require_once dirname(dirname(dirname(dirname(__FILE__)))) . '/config.core.php'; require_once MODX_CORE_PATH . 'config/' . MODX_CONFIG_KEY . '.inc.php'; require_once MODX_CORE_PATH . 'model/modx/modx.class.php'; $modx = new modX(); $modx->initialize('web'); $snippet = $modx->getObject('modSnippet', array('name' => 'YandexMoney')); $config = $snippet->getProperties(); $config['payStatusOut'] = $modx->getOption('yandexmoney.payStatusOut', null, 5); if (!defined('YANDEXMONEY_PATH')) { define('YANDEXMONEY_PATH', MODX_CORE_PATH . "components/yandexmoney/"); } if ($_GET['fail'] == 1) { if ($res = $modx->getObject('modResource', $config['fail_page_id'])) { $modx->sendRedirect($modx->makeUrl($config['fail_page_id'], '', '', 'full')); } exit; } elseif ($_GET['success'] == 1) { if ($res = $modx->getObject('modResource', $config['success_page_id'])) { $modx->sendRedirect($modx->makeUrl($config['success_page_id'], '', '', 'full')); } exit; } require_once YANDEXMONEY_PATH . 'model/yandexmoney.class.php'; $ym = new Yandexmoney($modx, $config); $order_id = $ym->ProcessResult(); if ($order_id) { $modx->addPackage('shopkeeper3', MODX_CORE_PATH . "components/shopkeeper3/model/"); $order = $modx->getObject('shk_order', array('id' => $order_id)); $order->set('status', $config['payStatusOut']); $order->save(); }
<?php $_isAdmin = $modx->user->sudo == 1; if (!defined('YANDEXMONEY_PATH')) { define('YANDEXMONEY_PATH', MODX_CORE_PATH . "components/yandexmoney/"); } require_once YANDEXMONEY_PATH . 'model/yandexmoney.class.php'; $ym = new Yandexmoney($modx, $scriptProperties); if (!empty($_SESSION['shk_lastOrder']) && !empty($_SESSION['shk_lastOrder']['id'])) { $ym->pay_method = !empty($_SESSION['shk_lastOrder']['payment']) ? $_SESSION['shk_lastOrder']['payment'] : ''; $order_id = (int) $_SESSION['shk_lastOrder']['id']; } if (!empty($_POST['payment'])) { $ym->pay_method = $_POST['payment']; } if ($scriptProperties['action'] == 'showMethods') { $org_mode = $scriptProperties['mode'] == 2; $output = $ym->getSelectHtml(); return $output; } else { if ($scriptProperties['action'] == 'startPayment') { $output = $ym->createFormHtml(); return $output; } }
<?php $eventName = $modx->event->name; $_isAdmin = $modx->user->sudo == 1; if (!defined('YANDEXMONEY_PATH')) { define('YANDEXMONEY_PATH', MODX_CORE_PATH . "components/yandexmoney/"); } require_once YANDEXMONEY_PATH . 'model/yandexmoney.class.php'; $ym = new Yandexmoney($modx, $scriptProperties); if (!empty($_SESSION['shk_lastOrder']) && !empty($_SESSION['shk_lastOrder']['id'])) { $ym->pay_method = !empty($_SESSION['shk_lastOrder']['payment']) ? $_SESSION['shk_lastOrder']['payment'] : ''; $order_id = (int) $_SESSION['shk_lastOrder']['id']; } if (!empty($_POST['payment'])) { $ym->pay_method = $_POST['payment']; } if ($scriptProperties['action'] == 'showMethods') { $org_mode = $scriptProperties['mode'] == 2; $output = $ym->getSelectHtml(); return $output; }