UpdateShippingMethods.php 1.4 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546
  1. <?php
  2. /**
  3. *
  4. * Copyright © Magento, Inc. All rights reserved.
  5. * See COPYING.txt for license details.
  6. */
  7. namespace Magento\Paypal\Controller\Express\AbstractExpress;
  8. class UpdateShippingMethods extends \Magento\Paypal\Controller\Express\AbstractExpress
  9. {
  10. /**
  11. * Update Order (combined action for ajax and regular request)
  12. *
  13. * @return void
  14. */
  15. public function execute()
  16. {
  17. try {
  18. $this->_initCheckout();
  19. $this->_checkout->prepareOrderReview($this->_initToken());
  20. $this->_view->loadLayout('paypal_express_review');
  21. $this->getResponse()->setBody(
  22. $this->_view
  23. ->getLayout()
  24. ->getBlock('express.review.shipping.method')
  25. ->setQuote($this->_getQuote())
  26. ->toHtml()
  27. );
  28. return;
  29. } catch (\Magento\Framework\Exception\LocalizedException $e) {
  30. $this->messageManager->addExceptionMessage(
  31. $e,
  32. $e->getMessage()
  33. );
  34. } catch (\Exception $e) {
  35. $this->messageManager->addExceptionMessage(
  36. $e,
  37. __('We can\'t update shipping method.')
  38. );
  39. }
  40. $this->getResponse()->setBody(
  41. '<script>window.location.href = ' . $this->_url->getUrl('*/*/review') . ';</script>'
  42. );
  43. }
  44. }