- Модуль: sale
- Путь к файлу: ~/bitrix/modules/sale/lib/compatible/eventcompatibility.php
- Класс: BitrixSaleCompatibleEventCompatibility
- Вызов: EventCompatibility::onSalePayOrder
static function onSalePayOrder(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_WRONG_ORDER'),
'sale'
);
}
$id = $order->getId();
$value = $order->getField('PAYED');
static::setDisableEvent(true);
foreach(GetModuleEvents("sale", static::EVENT_COMPATIBILITY_ON_ORDER_PAID, true) as $oldEvent)
{
ExecuteModuleEventEx($oldEvent, array($id, $value));
}
static::setDisableEvent(false);
if ($value == "Y")
{
if (MainLoader::includeModule("statistic"))
{
CStatEvent::AddByEvents("eStore", "order_paid", $id, "", $order->getField("STAT_GID"), $order->getPrice(), $order->getCurrency());
}
}
else
{
if (MainLoader::includeModule("statistic"))
{
CStatEvent::AddByEvents("eStore", "order_chargeback", $id, "", $order->getField("STAT_GID"), $order->getPrice(), $order->getCurrency(), "Y");
}
}
return new MainEventResult( MainEventResult::SUCCESS, null, 'sale');
}