add events hadler and bonus pay system
This commit is contained in:
parent
0631cb8b78
commit
03f395f925
8 changed files with 23 additions and 91 deletions
|
@ -39,7 +39,7 @@ class intaro_retailcrm extends CModule
|
|||
public const BONUS_PAY_SYSTEM_NAME = 'Оплата бонусами';
|
||||
public const BONUS_PAY_SYSTEM_CODE = 'retailcrmbonus';
|
||||
public const BONUS_PAY_SYSTEM_DESCRIPTION = 'Оплата бонусами программы лояльности retailCRM';
|
||||
|
||||
|
||||
/**
|
||||
* @var string[][]
|
||||
*/
|
||||
|
@ -162,10 +162,10 @@ class intaro_retailcrm extends CModule
|
|||
$infoSale = CModule::CreateModuleObject('sale')->MODULE_VERSION;
|
||||
if (version_compare($infoSale, '16', '<=')) {
|
||||
$APPLICATION->ThrowException(GetMessage("SALE_VERSION_ERR"));
|
||||
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
if (!Loader::includeModule('sale')) {
|
||||
return false;
|
||||
}
|
||||
|
@ -231,7 +231,7 @@ class intaro_retailcrm extends CModule
|
|||
include($this->INSTALL_PATH . '/../lib/repository/persontyperepository.php');
|
||||
include($this->INSTALL_PATH . '/../lib/repository/tomodulerepository.php');
|
||||
include($this->INSTALL_PATH . '/../lib/model/bitrix/orm/tomodule.php');
|
||||
|
||||
|
||||
$this->CopyFiles();
|
||||
$this->addBonusPaySystem();
|
||||
$this->addLPUserFields();
|
||||
|
@ -1511,7 +1511,7 @@ class intaro_retailcrm extends CModule
|
|||
foreach ($persons as $person) {
|
||||
$personId = $person->getID();
|
||||
$groupID = $this->getGroupID($personId);
|
||||
|
||||
|
||||
if (isset($groupID)) {
|
||||
$this->addBonusField($personId, $groupID);
|
||||
}
|
||||
|
@ -1566,13 +1566,10 @@ class intaro_retailcrm extends CModule
|
|||
}
|
||||
|
||||
if ($LPGroup === false) {
|
||||
$groupFields = [
|
||||
return OrderPropsGroupTable::add([
|
||||
'PERSON_TYPE_ID' => $personId,
|
||||
'NAME' => self::LP_ORDER_GROUP_NAME,
|
||||
];
|
||||
$result = OrderPropsGroupTable::add($groupFields);
|
||||
|
||||
return $result->getId();
|
||||
])->getId();
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -1662,7 +1659,7 @@ class intaro_retailcrm extends CModule
|
|||
PaySystemActionTable::update($result->getId(), $updateData);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* create loyalty program events handlers
|
||||
*/
|
||||
|
@ -1670,8 +1667,8 @@ class intaro_retailcrm extends CModule
|
|||
{
|
||||
$eventManager = EventManager::getInstance();
|
||||
|
||||
foreach (self::SUBSCRIBE_LP_EVENTS as $event){
|
||||
|
||||
foreach (self::SUBSCRIBE_LP_EVENTS as $event) {
|
||||
|
||||
try {
|
||||
$events = ToModuleRepository::getCollectionByWhere(
|
||||
['ID'],
|
||||
|
@ -1682,7 +1679,7 @@ class intaro_retailcrm extends CModule
|
|||
['to_class', '=', EventsHandlers::class],
|
||||
]
|
||||
);
|
||||
|
||||
|
||||
if ($events !== null && count($events) === 0) {
|
||||
$eventManager->registerEventHandler(
|
||||
$event['FROM_MODULE'],
|
||||
|
@ -1697,21 +1694,21 @@ class intaro_retailcrm extends CModule
|
|||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* delete loyalty program events handlers
|
||||
*/
|
||||
private function deleteLPEvents(): void
|
||||
{
|
||||
$eventManager = EventManager::getInstance();
|
||||
|
||||
foreach (self::SUBSCRIBE_LP_EVENTS as $event){
|
||||
|
||||
foreach (self::SUBSCRIBE_LP_EVENTS as $event) {
|
||||
$eventManager->unRegisterEventHandler(
|
||||
$event['FROM_MODULE'],
|
||||
$event['EVENT_NAME'],
|
||||
$this->MODULE_ID,
|
||||
EventsHandlers::class,
|
||||
$event['EVENT_NAME'].'Handler'
|
||||
$event['EVENT_NAME'] . 'Handler'
|
||||
);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,5 +0,0 @@
|
|||
<?php
|
||||
|
||||
require_once($_SERVER['DOCUMENT_ROOT'] . BX_ROOT . '/modules/netpay.sale/payment/netpay.sale/.description.php');
|
||||
|
||||
?>
|
|
@ -1,5 +0,0 @@
|
|||
<?php
|
||||
|
||||
require_once($_SERVER['DOCUMENT_ROOT'] . BX_ROOT . '/modules/netpay.sale/payment/netpay.sale/payment.php');
|
||||
|
||||
?>
|
|
@ -27,7 +27,7 @@ class EventsHandlers
|
|||
{
|
||||
AddMessage2Log('OnBeforeSalePaymentSetFieldHandler work! ' . $event->getDebugInfo());
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @return mixed
|
||||
*/
|
||||
|
@ -35,7 +35,7 @@ class EventsHandlers
|
|||
{
|
||||
AddMessage2Log('OnBeforeEndBufferContentHandler work! ');
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @param \Bitrix\Main\Event $event
|
||||
*/
|
||||
|
@ -43,7 +43,7 @@ class EventsHandlers
|
|||
{
|
||||
AddMessage2Log('OnSaleOrderBeforeSavedHandler work! ' . $event->getDebugInfo());
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @param \Bitrix\Main\Event $event
|
||||
*/
|
||||
|
@ -51,7 +51,7 @@ class EventsHandlers
|
|||
{
|
||||
AddMessage2Log('OnSaleOrderPaidHandler work! '. $event->getDebugInfo());
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @param \Bitrix\Main\Event $event
|
||||
*/
|
||||
|
@ -59,7 +59,7 @@ class EventsHandlers
|
|||
{
|
||||
AddMessage2Log('OnSaleStatusOrderChangeHandler work! '. $event->getDebugInfo());
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @param \Bitrix\Main\Event $event
|
||||
*/
|
||||
|
@ -67,7 +67,7 @@ class EventsHandlers
|
|||
{
|
||||
AddMessage2Log('OnSaleOrderSavedHandler work! '. $event->getDebugInfo());
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @param \Bitrix\Main\Event $event
|
||||
*/
|
||||
|
@ -75,7 +75,7 @@ class EventsHandlers
|
|||
{
|
||||
AddMessage2Log('OnSaleOrderCanceledHandler work! '. $event->getDebugInfo());
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @param \Bitrix\Main\Event $event
|
||||
*/
|
||||
|
@ -83,7 +83,7 @@ class EventsHandlers
|
|||
{
|
||||
AddMessage2Log('OnSaleOrderDeletedHandler work! '. $event->getDebugInfo());
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @param $arResult
|
||||
* @param $arUserResult
|
||||
|
|
|
@ -1,14 +0,0 @@
|
|||
<?php
|
||||
if (!defined("B_PROLOG_INCLUDED") || B_PROLOG_INCLUDED !== true) {
|
||||
die();
|
||||
}
|
||||
|
||||
use \Bitrix\Main\Localization\Loc;
|
||||
|
||||
Loc::loadMessages(__FILE__);
|
||||
|
||||
$data = [
|
||||
'NAME' => Loc::getMessage("SALE_HPS_BONUS"),
|
||||
'SORT' => 100,
|
||||
'CODES' => [],
|
||||
];
|
|
@ -1,36 +0,0 @@
|
|||
<?php
|
||||
|
||||
namespace Sale\Handlers\PaySystem;
|
||||
|
||||
use Bitrix\Main\Localization\Loc;
|
||||
use Bitrix\Main\Request;
|
||||
use Bitrix\Sale\PaySystem;
|
||||
use Bitrix\Sale\Payment;
|
||||
|
||||
Loc::loadMessages(__FILE__);
|
||||
|
||||
/**
|
||||
* Class RetailCrmBonusHandler
|
||||
* @package Sale\Handlers\PaySystem
|
||||
*/
|
||||
class RetailCrmBonusHandler extends PaySystem\BaseServiceHandler
|
||||
{
|
||||
/**
|
||||
* @param Payment $payment
|
||||
* @param Request|null $request
|
||||
* @return PaySystem\ServiceResult
|
||||
*/
|
||||
public function initiatePay(Payment $payment, Request $request = null)
|
||||
{
|
||||
return new PaySystem\ServiceResult();
|
||||
}
|
||||
|
||||
/**
|
||||
* @return array
|
||||
*/
|
||||
public function getCurrencyList()
|
||||
{
|
||||
return [];
|
||||
}
|
||||
|
||||
}
|
|
@ -1,3 +0,0 @@
|
|||
<?
|
||||
$MESS["SALE_HPS_BONUS"] = "retailCRM bonus account";
|
||||
?>
|
|
@ -1,2 +0,0 @@
|
|||
<?
|
||||
$MESS["SALE_HPS_BONUS"] = "бонусный счет retailCRM";
|
Loading…
Add table
Reference in a new issue