Files
Moodle/classes/local/protocol/PaymentServer.php
T

41 lines
952 B
PHP

<?php
declare(strict_types=1);
namespace paygw_moneta\local\protocol;
/**
* @package paygw_moneta
* @copyright 2026 Moneta Labs {@link https://moneta.ru/}
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
*/
enum PaymentServer: string
{
case Prod = 'PROD';
case Demo = 'DEMO';
/**
* Адрес платёжной формы MONETA.Assistant.
*/
public function url(): string
{
return match ($this) {
self::Prod => 'https://www.payanyway.ru/assistant.htm',
self::Demo => 'https://demo.moneta.ru/assistant.htm',
};
}
/**
* Ключ строки интерфейса (`server_prod`, `server_demo`).
*/
public function label(): string
{
return 'server_' . strtolower($this->value);
}
public static function fromSetting(?string $value): self
{
return self::tryFrom((string) $value) ?? self::Prod;
}
}