| Current Path : /var/www/clients/client3/web2/web/vendor/magento/module-checkout/Controller/Onepage/ |
| Current File : /var/www/clients/client3/web2/web/vendor/magento/module-checkout/Controller/Onepage/Success.php |
<?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;
}
}