• Модуль: seo
  • Путь к файлу: ~/bitrix/modules/seo/lib/engine/yandexdirect.php
  • Класс: BitrixSeoEngineYandexDirect
  • Вызов: YandexDirect::finance_query
public function finance_query($method, $masterToken, $operationNum, $param = array(), $skipRefreshAuth = false)
{
	if ($this->engineSettings['AUTH'])
	{
		$http = new HttpClient();
		$http->setRedirect(false);
		$http->setHeader("Content-Type", "application/json; charset=utf-8");
		
		$auth = $this->getCurrentUser();
		
		$financeToken = hash(
			"sha256",
			$masterToken . $operationNum . $method . $auth['login']);
		
		$postData = array(
			"method" => $method,
			"finance_token" => $financeToken,
			"operation_num" => $operationNum,
			"locale" => $this->locale,
			"token" => $this->engineSettings['AUTH']['access_token'],
		);
		
		if (!empty($param))
		{
			$postData["param"] = $param;
		}
		
		$postData = YandexJson::encode($postData, JSON_UNESCAPED_UNICODE);
		
		$http->post(self::API_URL, $postData);
		
		if ($http->getStatus() == 401 && !$skipRefreshAuth)
		{
			if ($this->checkAuthExpired())
			{
				$this->query("", $method, $param, true);
			}
		}
		
		return $http;
	}
	else
	{
		throw new SystemException("No Yandex auth data");
	}
}