Files
Moodle/classes/local/receipt/Vat.php
T

61 lines
1.7 KiB
PHP

<?php
declare(strict_types=1);
namespace paygw_moneta\local\receipt;
/**
* Ставка НДС позиции чека. Значение case — код `vat` для JSON-ответа Check URL
* (`cmsspecification.pdf`), оно же хранится в настройке шлюза и снимке заказа;
* {@see self::tag()} даёт тег `vatTag` для `INVENTORY` Pay URL
* (`kassaspecification.pdf`).
*
* @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 Vat: string
{
case None = 'none';
case Vat0 = 'vat0';
case Vat5 = 'vat5';
case Vat7 = 'vat7';
case Vat10 = 'vat10';
case Vat20 = 'vat20';
case Vat22 = 'vat22';
case Vat105 = 'vat105';
case Vat107 = 'vat107';
case Vat110 = 'vat110';
case Vat120 = 'vat120';
case Vat122 = 'vat122';
/**
* Тег `vatTag` для `INVENTORY` Pay URL (`kassaspecification.pdf`).
*/
public function tag(): string
{
return match ($this) {
self::None => '1105',
self::Vat0 => '1104',
self::Vat5 => '1108',
self::Vat7 => '1109',
self::Vat10 => '1103',
self::Vat20 => '1102',
self::Vat22 => '1113',
self::Vat105 => '1110',
self::Vat107 => '1111',
self::Vat110 => '1107',
self::Vat120 => '1106',
self::Vat122 => '1114',
};
}
/**
* Ключ строки в `lang/{ru,en}/paygw_moneta.php`.
*/
public function langKey(): string
{
return 'vat:' . $this->value;
}
}