• Модуль: sale
  • Путь к файлу: ~/bitrix/modules/sale/lib/cashbox/rest/cashboxservice.php
  • Класс: BitrixSaleCashboxRestCashboxService
  • Вызов: CashboxService::checkParamsBeforeAddCashbox
static function checkParamsBeforeAddCashbox($params)
{
	if (empty($params['NAME']))
	{
		throw new RestException('Parameter NAME is not defined', self::ERROR_CHECK_FAILURE);
	}

	if (empty($params['REST_CODE']))
	{
		throw new RestException('Parameter REST_CODE is not defined', self::ERROR_CHECK_FAILURE);
	}

	$restHandler = CashboxRestHandlerTable::getList(['filter' => ['=CODE' => $params['REST_CODE']]])->fetch();
	if (!$restHandler)
	{
		throw new RestException("Rest handler with code {$params['REST_CODE']} not found", self::ERROR_CHECK_FAILURE);
	}

	if ($params['APP_ID'] && !empty($restHandler['APP_ID']) && $restHandler['APP_ID'] !== $params['APP_ID'])
	{
		throw new AccessException();
	}

	if (empty($params['EMAIL']))
	{
		throw new RestException('Parameter EMAIL is not defined', self::ERROR_CHECK_FAILURE);
	}

	if (!empty($params['OFD']))
	{
		$ofdHandlerClass = self::getOfdHandlerClassByCode($params['OFD']);
		if (is_null($ofdHandlerClass))
		{
			throw new RestException('Ofd handler not found', self::ERROR_CHECK_FAILURE);
		}
	}
}