Server IP : 80.87.202.40 / Your IP : 216.73.216.169 Web Server : Apache System : Linux rospirotorg.ru 5.14.0-539.el9.x86_64 #1 SMP PREEMPT_DYNAMIC Thu Dec 5 22:26:13 UTC 2024 x86_64 User : bitrix ( 600) PHP Version : 8.2.27 Disable Function : NONE MySQL : OFF | cURL : ON | WGET : ON | Perl : ON | Python : OFF | Sudo : ON | Pkexec : ON Directory : /home/bitrix/ext_www/rospirotorg.ru/bitrix/modules/sale/lib/cashbox/rest/ |
Upload File : |
<?php namespace Bitrix\Sale\Cashbox\Rest; use Bitrix\Main; use Bitrix\Rest\RestException; use Bitrix\Sale\Cashbox\CheckManager; use Bitrix\Sale\Helpers; use Bitrix\Sale\Cashbox; if (!Main\Loader::includeModule('rest')) { return; } /** * Class CheckService * @package Bitrix\Sale\Cashbox\Rest */ class CheckService extends RestService { private const ERROR_CHECK_NOT_FOUND = 'ERROR_CHECK_NOT_FOUND'; private const ERROR_CHECK_APPLY = 'ERROR_CHECK_APPLY'; /** * @param $params * @throws Main\ArgumentException * @throws RestException */ private static function checkParamsBeforeApplyCheck($params) { if (!$params['UUID']) { throw new RestException('Parameter UUID is not defined', self::ERROR_CHECK_FAILURE); } $checkInfo = CheckManager::getCheckInfoByExternalUuid($params['UUID']); if (!$checkInfo) { throw new RestException('Check not found', self::ERROR_CHECK_NOT_FOUND); } } /** * @param $params * @return bool * @throws Main\ArgumentException * @throws Main\LoaderException * @throws RestException * @throws \Bitrix\Rest\AccessException */ public static function applyCheck($params) { Helpers\Rest\AccessChecker::checkAccessPermission(); $params = self::prepareIncomingParams($params); self::checkParamsBeforeApplyCheck($params); $result = Cashbox\CashboxRest::applyCheckResult($params); if ($result->isSuccess()) { return true; } $errors = implode("\n", $result->getErrorMessages()); throw new RestException($errors, self::ERROR_CHECK_APPLY); } }