feat: paygw_moneta 1.0.0, MONETA.Assistant payment gateway for Moodle
This commit is contained in:
Vendored
+13
@@ -0,0 +1,13 @@
|
||||
define("paygw_moneta/gateways_modal",["exports","core/config"],(function(_exports,_config){var obj;
|
||||
/**
|
||||
* Запуск оплаты через Moneta из модального окна «Выберите способ оплаты».
|
||||
*
|
||||
* Заказ создаёт pay.php по POST с sesskey — поэтому здесь не редирект,
|
||||
* а отправка скрытой формы.
|
||||
*
|
||||
* @module paygw_moneta/gateways_modal
|
||||
* @copyright 2026 Moneta Labs {@link https://moneta.ru/}
|
||||
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
|
||||
*/Object.defineProperty(_exports,"__esModule",{value:!0}),_exports.process=void 0,_config=(obj=_config)&&obj.__esModule?obj:{default:obj};_exports.process=(component,paymentArea,itemId,description)=>{const form=document.createElement("form");form.method="post",form.action="".concat(_config.default.wwwroot,"/payment/gateway/moneta/pay.php"),form.style.display="none";const fields={sesskey:_config.default.sesskey,component:component,paymentarea:paymentArea,itemid:itemId,description:description};return Object.entries(fields).forEach((_ref=>{let[name,value]=_ref;const input=document.createElement("input");input.type="hidden",input.name=name,input.value=value,form.appendChild(input)})),document.body.appendChild(form),form.submit(),new Promise((()=>null))}}));
|
||||
|
||||
//# sourceMappingURL=gateways_modal.min.js.map
|
||||
@@ -0,0 +1 @@
|
||||
{"version":3,"file":"gateways_modal.min.js","sources":["../src/gateways_modal.js"],"sourcesContent":["// This file is part of Moodle - http://moodle.org/\n//\n// Moodle is free software: you can redistribute it and/or modify\n// it under the terms of the GNU General Public License as published by\n// the Free Software Foundation, either version 3 of the License, or\n// (at your option) any later version.\n//\n// Moodle is distributed in the hope that it will be useful,\n// but WITHOUT ANY WARRANTY; without even the implied warranty of\n// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\n// GNU General Public License for more details.\n//\n// You should have received a copy of the GNU General Public License\n// along with Moodle. If not, see <http://www.gnu.org/licenses/>.\n\n/**\n * Запуск оплаты через Moneta из модального окна «Выберите способ оплаты».\n *\n * Заказ создаёт pay.php по POST с sesskey — поэтому здесь не редирект,\n * а отправка скрытой формы.\n *\n * @module paygw_moneta/gateways_modal\n * @copyright 2026 Moneta Labs {@link https://moneta.ru/}\n * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later\n */\nimport Config from 'core/config';\n\n/**\n * Обработчик, который ядро вызывает после выбора шлюза.\n *\n * @param {string} component компонент оплачиваемого объекта\n * @param {string} paymentArea область оплаты\n * @param {number} itemId идентификатор объекта\n * @param {string} description описание из модального окна\n * @returns {Promise<void>} никогда не разрешается: страница уходит на pay.php\n */\nexport const process = (component, paymentArea, itemId, description) => {\n const form = document.createElement('form');\n form.method = 'post';\n form.action = `${Config.wwwroot}/payment/gateway/moneta/pay.php`;\n form.style.display = 'none';\n const fields = {\n sesskey: Config.sesskey,\n component,\n paymentarea: paymentArea,\n itemid: itemId,\n description,\n };\n Object.entries(fields).forEach(([name, value]) => {\n const input = document.createElement('input');\n input.type = 'hidden';\n input.name = name;\n input.value = value;\n form.appendChild(input);\n });\n document.body.appendChild(form);\n form.submit();\n\n return new Promise(() => null);\n};\n"],"names":["component","paymentArea","itemId","description","form","document","createElement","method","action","Config","wwwroot","style","display","fields","sesskey","paymentarea","itemid","Object","entries","forEach","_ref","name","value","input","type","appendChild","body","submit","Promise"],"mappings":";;;;;;;;;;8JAoCuB,CAACA,UAAWC,YAAaC,OAAQC,qBAC9CC,KAAOC,SAASC,cAAc,QACpCF,KAAKG,OAAS,OACdH,KAAKI,iBAAYC,gBAAOC,2CACxBN,KAAKO,MAAMC,QAAU,aACfC,OAAS,CACXC,QAASL,gBAAOK,QAChBd,UAAAA,UACAe,YAAad,YACbe,OAAQd,OACRC,YAAAA,oBAEJc,OAAOC,QAAQL,QAAQM,SAAQC,WAAEC,KAAMC,kBAC7BC,MAAQlB,SAASC,cAAc,SACrCiB,MAAMC,KAAO,SACbD,MAAMF,KAAOA,KACbE,MAAMD,MAAQA,MACdlB,KAAKqB,YAAYF,UAErBlB,SAASqB,KAAKD,YAAYrB,MAC1BA,KAAKuB,SAEE,IAAIC,SAAQ,IAAM"}
|
||||
@@ -0,0 +1,60 @@
|
||||
// This file is part of Moodle - http://moodle.org/
|
||||
//
|
||||
// Moodle is free software: you can redistribute it and/or modify
|
||||
// it under the terms of the GNU General Public License as published by
|
||||
// the Free Software Foundation, either version 3 of the License, or
|
||||
// (at your option) any later version.
|
||||
//
|
||||
// Moodle is distributed in the hope that it will be useful,
|
||||
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
// GNU General Public License for more details.
|
||||
//
|
||||
// You should have received a copy of the GNU General Public License
|
||||
// along with Moodle. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
/**
|
||||
* Запуск оплаты через Moneta из модального окна «Выберите способ оплаты».
|
||||
*
|
||||
* Заказ создаёт pay.php по POST с sesskey — поэтому здесь не редирект,
|
||||
* а отправка скрытой формы.
|
||||
*
|
||||
* @module paygw_moneta/gateways_modal
|
||||
* @copyright 2026 Moneta Labs {@link https://moneta.ru/}
|
||||
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
|
||||
*/
|
||||
import Config from 'core/config';
|
||||
|
||||
/**
|
||||
* Обработчик, который ядро вызывает после выбора шлюза.
|
||||
*
|
||||
* @param {string} component компонент оплачиваемого объекта
|
||||
* @param {string} paymentArea область оплаты
|
||||
* @param {number} itemId идентификатор объекта
|
||||
* @param {string} description описание из модального окна
|
||||
* @returns {Promise<void>} никогда не разрешается: страница уходит на pay.php
|
||||
*/
|
||||
export const process = (component, paymentArea, itemId, description) => {
|
||||
const form = document.createElement('form');
|
||||
form.method = 'post';
|
||||
form.action = `${Config.wwwroot}/payment/gateway/moneta/pay.php`;
|
||||
form.style.display = 'none';
|
||||
const fields = {
|
||||
sesskey: Config.sesskey,
|
||||
component,
|
||||
paymentarea: paymentArea,
|
||||
itemid: itemId,
|
||||
description,
|
||||
};
|
||||
Object.entries(fields).forEach(([name, value]) => {
|
||||
const input = document.createElement('input');
|
||||
input.type = 'hidden';
|
||||
input.name = name;
|
||||
input.value = value;
|
||||
form.appendChild(input);
|
||||
});
|
||||
document.body.appendChild(form);
|
||||
form.submit();
|
||||
|
||||
return new Promise(() => null);
|
||||
};
|
||||
Reference in New Issue
Block a user