public static function setConfig() { $module = new PayqrModule(); PayqrConfig::$merchantID = $module->getOption("merchantID"); PayqrConfig::$secretKeyIn = $module->getOption("secretKeyIn"); PayqrConfig::$secretKeyOut = $module->getOption("secretKeyOut"); }
/** * Задаём настройки */ private function setModuleConfig() { $user_id = isset($_GET["user_id"]) ? $_GET["user_id"] : 1; $auth = new PayqrModuleAuth($user_id); $module = new PayqrModule(); PayqrConfig::$merchantID = $module->getOption("merchantID"); PayqrConfig::$secretKeyIn = $module->getOption("secretKeyIn"); PayqrConfig::$secretKeyOut = $module->getOption("secretKeyOut"); }
/** * Получить значение для настроек кнопки * * @param string $key * @return string */ private function getOption($key) { $module = new PayqrModule(); $value = $module->getOption($key); return $value; }
public function revertOrder() { //отправка сообщений $module = new PayqrModule(); if ($module->getOption("message-invoice-reverted")) { $message = $this->invoice->getMessage(); if ($message) { $message->article = $module->getOption("message-invoice-reverted-article"); $message->text = $module->getOption("message-invoice-reverted-text"); $message->imageUrl = $module->getOption("message-invoice-reverted-imageUrl"); $message->url = $module->getOption("message-invoice-reverted-url"); $this->invoice->setMessage($message); } } }
public function revertOrder() { PayqrLog::log("revertOrder"); $order_id = $this->invoice->getOrderId(); PayqrLog::log("revertOrder получили номер заказа: " . $order_id); if (!empty($order_id)) { //получаем статус заказа "в обработке" $status_id = DB::query_result("SELECT id FROM {shop_order_status} WHERE status='2' LIMIT 1"); PayqrLog::log("cancelOrder получили статус заказа 'Отменен': " . $status_id); //меняем статус заказа DB::query("UPDATE {shop_order} set status_id=%d WHERE id=%d", $status_id, $order_id); PayqrLog::log("cancelOrder произвели обновление статуса заказа: "); } //отправка сообщений $module = new PayqrModule(); if ($module->getOption("message-invoice-reverted")) { $message = $this->invoice->getMessage(); if ($message) { $message->article = $module->getOption("message-invoice-reverted-article"); $message->text = $module->getOption("message-invoice-reverted-text"); $message->imageUrl = $module->getOption("message-invoice-reverted-imageUrl"); $message->url = $module->getOption("message-invoice-reverted-url"); $this->invoice->setMessage($message); } } }
<?php /* * To change this license header, choose License Headers in Project Properties. * To change this template file, choose Tools | Templates * and open the template in the editor. */ require_once __DIR__ . "/PayqrConfig.php"; $key = PayqrConfig::$logKey; if (empty($key)) { $module = new PayqrModule(); $key = $module->getOption("logKey"); } if (isset($_GET["key"]) && $_GET["key"] == $key) { $text = PayqrLog::showLog(); } else { $text = "Введён неверный ключ доступа к логам"; } echo $text;