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

	$cashbox = Manager::getObjectById($params['ID']);
	if (!$cashbox)
	{
		throw new RestException('Cashbox not found', self::ERROR_CASHBOX_NOT_FOUND);
	}

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

	if (isset($params['FIELDS']['EMAIL']) && empty($params['FIELDS']['EMAIL']))
	{
		throw new RestException('Parameter EMAIL cannot be empty', self::ERROR_CHECK_FAILURE);
	}

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

	if (!self::hasAccessToCashbox($cashbox, $params['APP_ID']))
	{
		throw new AccessException();
	}
}