feat: paygw_moneta 1.0.0, MONETA.Assistant payment gateway for Moodle
This commit is contained in:
@@ -0,0 +1,53 @@
|
||||
<?php
|
||||
// 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/>.
|
||||
|
||||
/**
|
||||
* Check URL и Pay URL протокола MONETA.Assistant.
|
||||
*
|
||||
* @package paygw_moneta
|
||||
* @copyright 2026 Moneta Labs {@link https://moneta.ru/}
|
||||
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
|
||||
*/
|
||||
|
||||
define('NO_MOODLE_COOKIES', true);
|
||||
define('NO_DEBUG_DISPLAY', true);
|
||||
|
||||
require_once(__DIR__ . '/../../../config.php');
|
||||
|
||||
use paygw_moneta\local\callback\CallbackHandler;
|
||||
use paygw_moneta\local\ErrorLogLogger;
|
||||
use paygw_moneta\local\protocol\CallbackResponse;
|
||||
|
||||
$method = $_SERVER['REQUEST_METHOD'] ?? '';
|
||||
$fields = match ($method) {
|
||||
'POST' => $_POST,
|
||||
'GET' => $_GET,
|
||||
default => null,
|
||||
};
|
||||
|
||||
$response = null;
|
||||
if ($fields !== null) {
|
||||
try {
|
||||
$response = (new CallbackHandler())->handle($fields);
|
||||
} catch (\Throwable $exception) {
|
||||
(new ErrorLogLogger())->error('Колбэк отклонён: ' . get_class($exception));
|
||||
}
|
||||
}
|
||||
$response ??= CallbackResponse::fail();
|
||||
|
||||
header('Cache-Control: no-store');
|
||||
header('Content-Type: ' . $response->contentType);
|
||||
echo $response->body;
|
||||
Reference in New Issue
Block a user