Пример #1
0
 /**
  * Set Cookie for msg box when it displays first
  *
  * @param \Magento\Framework\App\FrontController $subject
  * @param \Magento\Framework\App\ResponseInterface $response
  *
  * @return \Magento\Framework\App\ResponseInterface
  * @SuppressWarnings(PHPMD.UnusedFormalParameter)
  */
 public function afterDispatch(\Magento\Framework\App\FrontController $subject, \Magento\Framework\App\ResponseInterface $response)
 {
     if ($this->request->isPost() && $this->messageManager->hasMessages()) {
         $this->cookie->set(self::COOKIE_NAME, 1, self::COOKIE_PERIOD, '/');
     }
     return $response;
 }
Пример #2
0
 /**
  * Handle private content version cookie
  * Set cookie if it is not set.
  * Increment version on post requests.
  * In all other cases do nothing.
  *
  * @return void
  */
 public function process()
 {
     if ($this->request->isPost()) {
         $publicCookieMetadata = $this->cookieMetadataFactory->createPublicCookieMetadata()->setDuration(self::COOKIE_PERIOD)->setPath('/')->setHttpOnly(false);
         $this->cookieManager->setPublicCookie(self::COOKIE_NAME, $this->generateValue(), $publicCookieMetadata);
     }
 }
Пример #3
0
 /**
  * Set Cookie for msg box when it displays first
  *
  * @param FrontController $subject
  * @param \Magento\Framework\App\ResponseInterface|\Magento\Framework\Controller\ResultInterface $result
  *
  * @return \Magento\Framework\App\ResponseInterface|\Magento\Framework\Controller\ResultInterface
  * @SuppressWarnings(PHPMD.UnusedFormalParameter)
  */
 public function afterDispatch(FrontController $subject, $result)
 {
     if ($this->request->isPost() && $this->messageManager->hasMessages()) {
         $publicCookieMetadata = $this->cookieMetadataFactory->createPublicCookieMetadata()->setDuration(self::COOKIE_PERIOD)->setPath('/')->setHttpOnly(false);
         $this->cookieManager->setPublicCookie(self::COOKIE_NAME, 1, $publicCookieMetadata);
     }
     return $result;
 }
Пример #4
0
 /**
  * Handle private content version cookie
  * Set cookie if it is not set.
  * Increment version on post requests.
  * In all other cases do nothing.
  *
  * @return void
  */
 public function process()
 {
     if ($this->request->isPost()) {
         $this->cookie->set(self::COOKIE_NAME, $this->generateValue(), self::COOKIE_PERIOD, '/');
     }
 }
Пример #5
0
 /**
  * @inheritdoc
  */
 public function consumeNotification(\Magento\Framework\App\Request\Http $request)
 {
     if (!$request->isPost()) {
         throw new LocalizedException(new Phrase('POST request is required.'));
     }
     $response = $this->methodCaller->call('orderConsumeNotification', [$request->getContent()]);
     if ($response) {
         return ['payuplOrderId' => $response->order->orderId, 'status' => $response->order->status, 'amount' => (double) $response->order->totalAmount / 100];
     }
     return false;
 }