• Модуль: sale
  • Путь к файлу: ~/bitrix/modules/sale/lib/paysystem/restservice.php
  • Класс: BitrixSalePaySystemRestService
  • Вызов: RestService::checkParamsForInvoice
static function checkParamsForInvoice(array $params)
{
	if (!isset($params['BX_REST_HANDLER']) && !isset($params['PAY_SYSTEM_ID']))
	{
		throw new RestException('Empty field BX_REST_HANDLER and PAY_SYSTEM_ID', self::ERROR_CHECK_FAILURE);
	}

	if (isset($params['PAY_SYSTEM_ID']))
	{
		$data = Manager::getById($params['PAY_SYSTEM_ID']);
		if (!$data)
		{
			throw new RestException('Pay system with ID='.$params['PAY_SYSTEM_ID'].' not found', static::ERROR_CHECK_FAILURE);
		}
	}

	if (isset($params['BX_REST_HANDLER']))
	{
		$dbRes = InternalsPaySystemRestHandlersTable::getList(array(
			'filter' => array(
				'=CODE' => $params['BX_REST_HANDLER']
			)
		));
		if (!$dbRes->fetch())
		{
			throw new RestException('Incorrect rest handler code', static::ERROR_CHECK_FAILURE);
		}
	}

	if (empty($params['INVOICE_ID']))
	{
		throw new RestException('Empty field INVOICE_ID!', self::ERROR_CHECK_FAILURE);
	}
}