shippingMethodUpdater = $shippingMethodUpdater; } /** * @inheritdoc */ public function execute() { $isAjax = $this->getRequest()->getParam('isAjax'); $quote = $this->checkoutSession->getQuote(); try { $this->validateQuote($quote); $this->shippingMethodUpdater->execute( $this->getRequest()->getParam('shipping_method'), $quote ); if ($isAjax) { /** @var Page $response */ $response = $this->resultFactory->create(ResultFactory::TYPE_PAGE); $layout = $response->addHandle('paypal_express_review_details')->getLayout(); $response = $layout->getBlock('page.block')->toHtml(); $this->getResponse()->setBody($response); return; } } catch (\Exception $e) { $this->messageManager->addExceptionMessage($e, $e->getMessage()); } $path = $this->_url->getUrl('*/*/review', ['_secure' => true]); if ($isAjax) { $this->getResponse()->setBody(sprintf('', $path)); return; } $this->_redirect($path); } }