• Модуль: crm
  • Путь к файлу: ~/bitrix/modules/crm/lib/order/tradingplatform/telegram/eventhandler.php
  • Класс: Bitrix\Crm\Order\TradingPlatform\Telegram\EventHandler
  • Вызов: EventHandler::setTelegramTradingPlatform
static function setTelegramTradingPlatform(Main\Event $event): Main\EventResult
{
	/** @var Crm\Order\Order $order */
	$order = $event->getParameter('ENTITY');
	if (!$order instanceof Crm\Order\Order || !self::isTelegramOrder())
	{
		return new Main\EventResult( Main\EventResult::SUCCESS);
	}

	self::setTradeBinding($order);

	$clientInfo = self::getClientInfo();

	if ($clientInfo['DEAL_ID'] > 0 && self::needDealBinding($clientInfo['DEAL_ID']))
	{
		self::setDealBinding($order, $clientInfo['DEAL_ID']);
	}

	if ($clientInfo['CONTACT_ID'] > 0)
	{
		self::setContact($order, $clientInfo['CONTACT_ID']);
	}

	return new Main\EventResult( Main\EventResult::SUCCESS, $order);
}