Overview.php 1.7 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253
  1. <?php
  2. /**
  3. *
  4. * Copyright © Magento, Inc. All rights reserved.
  5. * See COPYING.txt for license details.
  6. */
  7. namespace Magento\Multishipping\Controller\Checkout;
  8. use Magento\Framework\Exception\LocalizedException;
  9. use Magento\Multishipping\Model\Checkout\Type\Multishipping\State;
  10. use Magento\Payment\Model\Method\AbstractMethod;
  11. use Psr\Log\LoggerInterface;
  12. class Overview extends \Magento\Multishipping\Controller\Checkout
  13. {
  14. /**
  15. * Multishipping checkout place order page
  16. *
  17. * @return void
  18. */
  19. public function execute()
  20. {
  21. if (!$this->_validateMinimumAmount()) {
  22. return;
  23. }
  24. $this->_getState()->setActiveStep(State::STEP_OVERVIEW);
  25. try {
  26. $payment = $this->getRequest()->getPost('payment', []);
  27. if (!empty($payment)) {
  28. $payment['checks'] = [
  29. AbstractMethod::CHECK_USE_FOR_COUNTRY,
  30. AbstractMethod::CHECK_USE_FOR_CURRENCY,
  31. AbstractMethod::CHECK_ORDER_TOTAL_MIN_MAX,
  32. AbstractMethod::CHECK_ZERO_TOTAL,
  33. ];
  34. $this->_getCheckout()->setPaymentMethod($payment);
  35. }
  36. $this->_getState()->setCompleteStep(State::STEP_BILLING);
  37. $this->_view->loadLayout();
  38. $this->_view->renderLayout();
  39. } catch (LocalizedException $e) {
  40. $this->messageManager->addError($e->getMessage());
  41. $this->_redirect('*/*/billing');
  42. } catch (\Exception $e) {
  43. $this->_objectManager->get(LoggerInterface::class)->critical($e);
  44. $this->messageManager->addException($e, __('We cannot open the overview page.'));
  45. $this->_redirect('*/*/billing');
  46. }
  47. }
  48. }