• Модуль: imbot
  • Путь к файлу: ~/bitrix/modules/imbot/lib/bot/network.php
  • Класс: BitrixImBotBotNetwork
  • Вызов: Network::sendNotifyChangeLicence
static function sendNotifyChangeLicence(array $params)
{
	if (!static::getBotId())
	{
		return false;
	}

	if (isset($params['CURRENT_LICENCE_TYPE']))
	{
		$currentLicence = $params['CURRENT_LICENCE_TYPE'];
		$currentLicenceName = $params['CURRENT_LICENCE_NAME'];
		$previousLicence = $params['PREVIOUS_LICENCE_TYPE'];
		$previousLicenceName = $params['PREVIOUS_LICENCE_NAME'];
	}
	elseif (MainLoader::includeModule('bitrix24'))
	{
		$currentLicence = CBitrix24::getLicenseType(CBitrix24::LICENSE_TYPE_CURRENT);
		$currentLicenceName = CBitrix24::getLicenseName($currentLicence);
		$previousLicence = CBitrix24::getLicenseType(CBitrix24::LICENSE_TYPE_PREVIOUS);
		$previousLicenceName = CBitrix24::getLicenseName($previousLicence);
	}
	else
	{
		$currentLicence = 'box';
		$currentLicenceName = 'Box';
		$previousLicence = 'box';
		$previousLicenceName = 'Box';
	}

	$message = $params['MESSAGE'] ?? '';

	$http = self::instanceHttpClient();
	$response = $http->query(
		'clientChangeLicence',
		[
			'BOT_ID' => static::getBotId(),
			'PREVIOUS_LICENCE_TYPE' => $previousLicence,
			'PREVIOUS_LICENCE_NAME' => $previousLicenceName,
			'CURRENT_LICENCE_TYPE' => $currentLicence,
			'CURRENT_LICENCE_NAME' => $currentLicenceName,
			'PREVIOUS_BOT_CODE' => $params['PREVIOUS_BOT_CODE'],
			'CURRENT_BOT_CODE' => $params['CURRENT_BOT_CODE'],
			'MESSAGE' => $message,
		],
		false
	);

	return $response !== false && !isset($response['error']);
}