1234567891011121314151617181920212223242526272829303132333435363738 |
- <?php
- /**
- * Copyright © Magento, Inc. All rights reserved.
- * See COPYING.txt for license details.
- */
- namespace Magento\Checkout\Controller\Onepage;
- use Magento\Framework\App\Action\HttpGetActionInterface as HttpGetActionInterface;
- /**
- * Onepage checkout success controller class
- */
- class Success extends \Magento\Checkout\Controller\Onepage implements HttpGetActionInterface
- {
- /**
- * Order success action
- *
- * @return \Magento\Framework\Controller\ResultInterface
- */
- public function execute()
- {
- $session = $this->getOnepage()->getCheckout();
- if (!$this->_objectManager->get(\Magento\Checkout\Model\Session\SuccessValidator::class)->isValid()) {
- return $this->resultRedirectFactory->create()->setPath('checkout/cart');
- }
- $session->clearQuote();
- //@todo: Refactor it to match CQRS
- $resultPage = $this->resultPageFactory->create();
- $this->_eventManager->dispatch(
- 'checkout_onepage_controller_success_action',
- [
- 'order_ids' => [$session->getLastOrderId()],
- 'order' => $session->getLastRealOrder()
- ]
- );
- return $resultPage;
- }
- }
|