|
1
|
|
|
<?php |
|
2
|
|
|
/** |
|
3
|
|
|
* Copyright © Wirecard Brasil. All rights reserved. |
|
4
|
|
|
* |
|
5
|
|
|
* @author Bruno Elisei <[email protected]> |
|
6
|
|
|
* See COPYING.txt for license details. |
|
7
|
|
|
*/ |
|
8
|
|
|
|
|
9
|
|
|
declare(strict_types=1); |
|
10
|
|
|
|
|
11
|
|
|
namespace Moip\Magento2\Controller\Adminhtml\System\Config; |
|
12
|
|
|
|
|
13
|
|
|
use Magento\Backend\App\Action\Context; |
|
|
|
|
|
|
14
|
|
|
use Magento\Config\Model\ResourceModel\Config; |
|
|
|
|
|
|
15
|
|
|
use Magento\Framework\App\Cache\Frontend\Pool; |
|
|
|
|
|
|
16
|
|
|
use Magento\Framework\App\Cache\TypeListInterface; |
|
|
|
|
|
|
17
|
|
|
use Magento\Framework\App\Config\ConfigResource\ConfigInterface; |
|
|
|
|
|
|
18
|
|
|
use Magento\Framework\Controller\Result\JsonFactory; |
|
|
|
|
|
|
19
|
|
|
use Magento\Store\Model\StoreManagerInterface; |
|
|
|
|
|
|
20
|
|
|
use Moip\Magento2\Gateway\Config\Config as ConfigBase; |
|
21
|
|
|
|
|
22
|
|
|
class Logout extends \Magento\Backend\App\Action |
|
|
|
|
|
|
23
|
|
|
{ |
|
24
|
|
|
protected $cacheTypeList; |
|
25
|
|
|
|
|
26
|
|
|
protected $cacheFrontendPool; |
|
27
|
|
|
|
|
28
|
|
|
protected $resultJsonFactory; |
|
29
|
|
|
|
|
30
|
|
|
protected $configInterface; |
|
31
|
|
|
|
|
32
|
|
|
protected $resourceConfig; |
|
33
|
|
|
|
|
34
|
|
|
protected $storeManager; |
|
35
|
|
|
|
|
36
|
|
|
protected $configBase; |
|
37
|
|
|
|
|
38
|
|
|
public function __construct( |
|
39
|
|
|
Context $context, |
|
40
|
|
|
TypeListInterface $cacheTypeList, |
|
41
|
|
|
Pool $cacheFrontendPool, |
|
42
|
|
|
JsonFactory $resultJsonFactory, |
|
43
|
|
|
ConfigInterface $configInterface, |
|
44
|
|
|
Config $resourceConfig, |
|
45
|
|
|
ConfigBase $configBase, |
|
46
|
|
|
StoreManagerInterface $storeManager |
|
47
|
|
|
) { |
|
48
|
|
|
$this->cacheTypeList = $cacheTypeList; |
|
49
|
|
|
$this->cacheFrontendPool = $cacheFrontendPool; |
|
50
|
|
|
$this->resultJsonFactory = $resultJsonFactory; |
|
51
|
|
|
$this->configInterface = $configInterface; |
|
52
|
|
|
$this->resourceConfig = $resourceConfig; |
|
53
|
|
|
$this->configBase = $configBase; |
|
54
|
|
|
$this->storeManager = $storeManager; |
|
55
|
|
|
parent::__construct($context); |
|
56
|
|
|
} |
|
57
|
|
|
|
|
58
|
|
|
protected function _isAllowed() |
|
59
|
|
|
{ |
|
60
|
|
|
return $this->_authorization->isAllowed('Moip_Magento2::logout'); |
|
61
|
|
|
} |
|
62
|
|
|
|
|
63
|
|
|
public function execute() |
|
64
|
|
|
{ |
|
65
|
|
|
$params = $this->getRequest()->getParams(); |
|
|
|
|
|
|
66
|
|
|
$resultJson = $this->resultJsonFactory->create(); |
|
67
|
|
|
|
|
68
|
|
|
$this->setClearOauth(); |
|
69
|
|
|
$this->setClearMpa(); |
|
70
|
|
|
$this->cacheTypeList->cleanType('config'); |
|
71
|
|
|
|
|
72
|
|
|
return $resultJson->setData([ |
|
73
|
|
|
'messages' => 'Successfully.', |
|
74
|
|
|
'error' => false, |
|
75
|
|
|
]); |
|
76
|
|
|
} |
|
77
|
|
|
|
|
78
|
|
|
private function setClearOauth() |
|
79
|
|
|
{ |
|
80
|
|
|
$environment = $this->configBase->getEnvironmentMode(); |
|
81
|
|
|
$this->resourceConfig->deleteConfig( |
|
82
|
|
|
'payment/moip_magento2/oauth_'.$environment, |
|
83
|
|
|
'default', |
|
84
|
|
|
0 |
|
85
|
|
|
); |
|
86
|
|
|
$this->resourceConfig->deleteConfig( |
|
87
|
|
|
'payment/moip_magento2/publickey_'.$environment, |
|
88
|
|
|
'default', |
|
89
|
|
|
0 |
|
90
|
|
|
); |
|
91
|
|
|
|
|
92
|
|
|
return $this; |
|
93
|
|
|
} |
|
94
|
|
|
|
|
95
|
|
|
private function setClearMpa() |
|
96
|
|
|
{ |
|
97
|
|
|
$environment = $this->configBase->getEnvironmentMode(); |
|
98
|
|
|
$this->resourceConfig->deleteConfig( |
|
99
|
|
|
'payment/moip_magento2/mpa_'.$environment, |
|
100
|
|
|
'default', |
|
101
|
|
|
0 |
|
102
|
|
|
); |
|
103
|
|
|
$this->resourceConfig->deleteConfig( |
|
104
|
|
|
'payment/moip_magento2/mpa_'.$environment, |
|
105
|
|
|
'default', |
|
106
|
|
|
0 |
|
107
|
|
|
); |
|
108
|
|
|
|
|
109
|
|
|
return $this; |
|
110
|
|
|
} |
|
111
|
|
|
} |
|
112
|
|
|
|
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