|
1
|
|
|
<?php |
|
2
|
|
|
|
|
3
|
|
|
/** |
|
4
|
|
|
* MagePrince |
|
5
|
|
|
* Copyright (C) 2020 Mageprince <[email protected]> |
|
6
|
|
|
* |
|
7
|
|
|
* @package Mageprince_BuyNow |
|
8
|
|
|
* @copyright Copyright (c) 2020 Mageprince (http://www.mageprince.com/) |
|
9
|
|
|
* @license http://opensource.org/licenses/gpl-3.0.html GNU General Public License,version 3 (GPL-3.0) |
|
10
|
|
|
* @author MagePrince <[email protected]> |
|
11
|
|
|
*/ |
|
12
|
|
|
|
|
13
|
|
|
namespace Mageprince\BuyNow\Controller\Onepage; |
|
14
|
|
|
|
|
15
|
|
|
/** |
|
16
|
|
|
* Onepage checkout success controller class |
|
17
|
|
|
*/ |
|
18
|
|
|
class Success extends \Magento\Checkout\Controller\Onepage\Success |
|
|
|
|
|
|
19
|
|
|
{ |
|
20
|
|
|
/** |
|
21
|
|
|
* Order success action |
|
22
|
|
|
* |
|
23
|
|
|
* @return \Magento\Framework\Controller\ResultInterface |
|
|
|
|
|
|
24
|
|
|
*/ |
|
25
|
|
|
public function execute() |
|
26
|
|
|
{ |
|
27
|
|
|
$session = $this->getOnepage()->getCheckout(); |
|
28
|
|
|
if (!$this->_objectManager->get(\Magento\Checkout\Model\Session\SuccessValidator::class)->isValid()) { |
|
|
|
|
|
|
29
|
|
|
return $this->resultRedirectFactory->create()->setPath('checkout/cart'); |
|
30
|
|
|
} |
|
31
|
|
|
$session->clearQuote(); |
|
32
|
|
|
//@todo: Refactor it to match CQRS |
|
33
|
|
|
$resultPage = $this->resultPageFactory->create(); |
|
34
|
|
|
$this->_eventManager->dispatch( |
|
35
|
|
|
'checkout_onepage_controller_success_action', |
|
36
|
|
|
[ |
|
37
|
|
|
'order_ids' => [$session->getLastOrderId()], |
|
38
|
|
|
'order' => $session->getLastRealOrder(), |
|
39
|
|
|
] |
|
40
|
|
|
); |
|
41
|
|
|
|
|
42
|
|
|
/* Restore Product into Cart */ |
|
43
|
|
|
$this->_eventManager->dispatch( |
|
44
|
|
|
'checkout_product_merge_custom', |
|
45
|
|
|
[ |
|
46
|
|
|
'order' => $session->getLastRealOrder(), |
|
47
|
|
|
'update_data' => 0, |
|
48
|
|
|
] |
|
49
|
|
|
); |
|
50
|
|
|
|
|
51
|
|
|
$this->_eventManager->dispatch( |
|
52
|
|
|
'checkout_product_merge_custom', |
|
53
|
|
|
[ |
|
54
|
|
|
'order' => $session->getLastRealOrder(), |
|
55
|
|
|
'update_data' => 1, |
|
56
|
|
|
] |
|
57
|
|
|
); |
|
58
|
|
|
|
|
59
|
|
|
return $resultPage; |
|
60
|
|
|
} |
|
61
|
|
|
} |
|
62
|
|
|
|
The issue could also be caused by a filter entry in the build configuration. If the path has been excluded in your configuration, e.g.
excluded_paths: ["lib/*"], you can move it to the dependency path list as follows:For further information see https://scrutinizer-ci.com/docs/tools/php/php-scrutinizer/#list-dependency-paths