Server IP : 80.87.202.40 / Your IP : 216.73.216.169 Web Server : Apache System : Linux rospirotorg.ru 5.14.0-539.el9.x86_64 #1 SMP PREEMPT_DYNAMIC Thu Dec 5 22:26:13 UTC 2024 x86_64 User : bitrix ( 600) PHP Version : 8.2.27 Disable Function : NONE MySQL : OFF | cURL : ON | WGET : ON | Perl : ON | Python : OFF | Sudo : ON | Pkexec : ON Directory : /home/bitrix/ext_www/cvetdv.ru/bitrix/modules/yandex.market/lib/ui/trading/ |
Upload File : |
<?php namespace Yandex\Market\Ui\Trading; use Bitrix\Main; use Yandex\Market; use Yandex\Market\Trading\Service as TradingService; class NotificationTemplate extends Market\Ui\Reference\Page { public function processRequest() { $service = $this->getService(); $repository = $this->getRepository(); $notification = $this->getAction($service)->getNotification(); $siteId = $this->getSiteId(); $messageId = $repository->search($notification, $siteId); if ($messageId === null) { $messageId = $repository->make($notification, $siteId); } $url = $repository->url($messageId); LocalRedirect($url); } protected function getService() { $code = $this->getServiceCode(); return TradingService\Manager::createProvider($code); } protected function getServiceCode() { $setup = $this->request->get('service'); Market\Reference\Assert::notNull($setup, 'service'); return $setup; } /** * @param TradingService\Reference\Provider $service * * @return TradingService\Reference\Action\HasNotification */ protected function getAction(TradingService\Reference\Provider $service) { $path = $this->getActionPath(); $environment = Market\Trading\Entity\Manager::createEnvironment(); $action = $service->getRouter()->getHttpAction($path, $environment); Market\Reference\Assert::typeOf($action, TradingService\Reference\Action\HasNotification::class, 'action'); return $action; } protected function getActionPath() { $path = $this->request->get('path'); Market\Reference\Assert::notNull($path, 'path'); return $path; } protected function getSiteId() { $path = $this->request->get('site'); Market\Reference\Assert::notNull($path, 'site'); return $path; } protected function getRepository() { $type = $this->request->get('type'); Market\Reference\Assert::notNull($type, 'type'); switch ($type) { case 'EMAIL': $result = new Notification\MailRepository(); break; case 'SMS': $result = new Notification\SmsRepository(); break; default: throw new Main\NotSupportedException('unknown notification type'); } return $result; } }