Request::send

  1. Bitrix24 API (v. 23.675.0)
  2. seo
  3. Request
  4. send
  • Модуль: seo
  • Путь к файлу: ~/bitrix/modules/seo/lib/checkout/request.php
  • Класс: Bitrix\Seo\Checkout\Request
  • Вызов: Request::send
public function send(array $params = array())
{
	if (!$this->adapter)
	{
		throw new SystemException('AuthAdapter not applied.');
	}

	$options = [
		'socketTimeout' => 5
	];
	$this->client = new AdsHttpClient($options);

	$data = $this->query($params);
	$response = Response::create($this->type);
	$response->setRequest($this);
	$response->setResponseText($data);
	try
	{
		$response->parse($data);
	}
	catch (\Exception $exception)
	{
		$response->addError(new Error($exception->getMessage(), $exception->getCode()));
	}

	if ($response->getErrorCollection()->count() > 0)
	{
		$errors = $response->getErrors();
		foreach ($errors as $error)
		{
			if (!$error->getMessage())
			{
				continue;
			}

			ServiceLogTable::add(array(
				'GROUP_ID' => 'checkout',
				'TYPE' => static::TYPE_CODE,
				'CODE' => $error->getCode(),
				'MESSAGE' => $error->getMessage()
			));
		}
	}

	return $response;
}

Добавить комментарий