• Модуль: sale
  • Путь к файлу: ~/bitrix/modules/sale/lib/compatible/eventcompatibility.php
  • Класс: BitrixSaleCompatibleEventCompatibility
  • Вызов: EventCompatibility::onSaleOrderPaidSendMail
static function onSaleOrderPaidSendMail(MainEvent $event)
{
	if (static::$disableEvent === true)
	{
		return new MainEventResult( MainEventResult::SUCCESS, null, 'sale');
	}

	$parameters = $event->getParameters();

	/** @var SaleOrder $order */
	$order = $parameters['ENTITY'];
	if (!$order instanceof SaleOrder)
	{
		return new MainEventResult(
			MainEventResult::ERROR,
			new SaleResultError(MainLocalizationLoc::getMessage('SALE_EVENT_COMPATIBILITY_WRONG_ORDER'), 'SALE_EVENT_COMPATIBILITY_ORDER_PAY_SEND_EMAIL_WRONG_ORDER'),
			'sale'
		);
	}

	$value = $order->getField('PAYED');

	if ($value == "Y")
	{
		$registry = SaleRegistry::getInstance($order::getRegistryType());

		/** @var SaleNotify $notifyClassName */
		$notifyClassName = $registry->getNotifyClassName();
		$notifyClassName::sendOrderPaid($order);
	}
	return new MainEventResult( MainEventResult::SUCCESS, null, 'sale');
}