Esempio n. 1
0
 public function match(RequestInterface $request)
 {
     if ($request->getModuleName() == null && method_exists($request, 'getPathInfo')) {
         $route = $this->application['route.resolver']->process($request->getPathInfo());
         if ($route instanceof Route) {
             switch ($route->getName()) {
                 case Ping::getName():
                     return $this->dispatch($request, 'ping');
                     break;
                 case Registered::getName():
                     return $this->dispatch($request, 'registered');
                     break;
                 case UserData::getName():
                     $data = $route->getData();
                     return $this->dispatch($request, 'user', 'index', $data);
                     break;
                 case CampaignPopup::getName():
                     $data = $route->getData();
                     return $this->dispatch($request, 'migration', 'popup', $data);
                     break;
                 case CampaignMigration::getName():
                     $data = $route->getData();
                     return $this->dispatch($request, 'migration', 'migrate', $data);
                     break;
                 case BatchCustomer::getName():
                     return $this->dispatch($request, 'batch', 'customer');
                     break;
                 case BatchInvoice::getName():
                     return $this->dispatch($request, 'batch', 'invoice');
                     break;
             }
         }
         if (http_response_code() === 401) {
             return $this->dispatch($request, 'unauthorized');
         }
     }
     //        return $this->actionFactory->create(Forward::class, ['request' => $request]);
 }
Esempio n. 2
0
 /**
  * Match module front name
  *
  * @param \Magento\Framework\App\RequestInterface $request
  * @param string $param
  * @return string|null
  */
 protected function matchModuleFrontName(\Magento\Framework\App\RequestInterface $request, $param)
 {
     // get module name
     if ($request->getModuleName()) {
         $moduleFrontName = $request->getModuleName();
     } elseif (!empty($param)) {
         $moduleFrontName = $param;
     } else {
         $moduleFrontName = $this->_defaultPath->getPart('module');
         $request->setAlias(\Magento\Framework\Url::REWRITE_REQUEST_PATH_ALIAS, '');
     }
     if (!$moduleFrontName) {
         return null;
     }
     return $moduleFrontName;
 }
 /**
  * Check if a request is session check
  *
  * @return bool
  */
 protected function isSessionCheckRequest()
 {
     return $this->request->getModuleName() == 'security' && $this->request->getActionName() == 'check';
 }
 /**
  * Return whether page is tax configuration
  *
  * @return bool
  */
 protected function isTaxConfigPage()
 {
     return $this->request->getModuleName() == 'admin' && $this->request->getControllerName() == 'system_config' && $this->request->getActionName() == 'edit' && $this->request->getParam('section') == 'tax';
 }
 /**
  * Return whether page is queue page
  *
  * @return bool
  */
 protected function isQueuePage()
 {
     return $this->request->getModuleName() == 'avatax' && $this->request->getControllerName() == 'queue' && $this->request->getActionName() == 'index';
 }
 /**
  * Determine if should apply subtotal
  *
  * @param $address
  * @param $shippingAssignment
  *
  * @return bool
  */
 protected function _getFinancingCondition($address, $shippingAssignment)
 {
     $items = $shippingAssignment->getItems();
     return $address->getAddressType() == \Magento\Customer\Helper\Address::TYPE_SHIPPING && count($items) && $this->_request->getModuleName() == 'mercadopago';
 }