1
|
|
|
<?php |
2
|
|
|
|
3
|
|
|
/** |
4
|
|
|
* PAYONE Magento 2 Connector is free software: you can redistribute it and/or modify |
5
|
|
|
* it under the terms of the GNU Lesser General Public License as published by |
6
|
|
|
* the Free Software Foundation, either version 3 of the License, or |
7
|
|
|
* (at your option) any later version. |
8
|
|
|
* |
9
|
|
|
* PAYONE Magento 2 Connector is distributed in the hope that it will be useful, |
10
|
|
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of |
11
|
|
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
12
|
|
|
* GNU Lesser General Public License for more details. |
13
|
|
|
* |
14
|
|
|
* You should have received a copy of the GNU Lesser General Public License |
15
|
|
|
* along with PAYONE Magento 2 Connector. If not, see <http://www.gnu.org/licenses/>. |
16
|
|
|
* |
17
|
|
|
* PHP version 5 |
18
|
|
|
* |
19
|
|
|
* @category Payone |
20
|
|
|
* @package Payone_Magento2_Plugin |
21
|
|
|
* @author FATCHIP GmbH <[email protected]> |
22
|
|
|
* @copyright 2003 - 2020 Payone GmbH |
23
|
|
|
* @license <http://www.gnu.org/licenses/> GNU Lesser General Public License |
24
|
|
|
* @link http://www.payone.de |
25
|
|
|
*/ |
26
|
|
|
|
27
|
|
|
namespace Payone\Core\Controller\Adminhtml\Config\Ratepay; |
28
|
|
|
|
29
|
|
|
use Magento\Backend\App\Action; |
|
|
|
|
30
|
|
|
|
31
|
|
|
/** |
32
|
|
|
* Controller for refreshing Ratepay profiles |
33
|
|
|
*/ |
34
|
|
|
class Refresh extends Action |
35
|
|
|
{ |
36
|
|
|
/** |
37
|
|
|
* Result factory for get configuration script |
38
|
|
|
* |
39
|
|
|
* @var \Magento\Framework\Controller\Result\JsonFactory |
|
|
|
|
40
|
|
|
*/ |
41
|
|
|
protected $resultJsonFactory; |
42
|
|
|
|
43
|
|
|
/** |
44
|
|
|
* @var \Payone\Core\Helper\Ratepay |
45
|
|
|
*/ |
46
|
|
|
protected $ratepayHelper; |
47
|
|
|
|
48
|
|
|
/** |
49
|
|
|
* Constructor |
50
|
|
|
* |
51
|
|
|
* @param \Magento\Backend\App\Action\Context $context |
52
|
|
|
* @param \Magento\Framework\Controller\Result\JsonFactory $resultJsonFactory |
53
|
|
|
* @param \Payone\Core\Helper\Ratepay $ratepayHelper |
54
|
|
|
*/ |
55
|
|
|
public function __construct( |
56
|
|
|
\Magento\Backend\App\Action\Context $context, |
|
|
|
|
57
|
|
|
\Magento\Framework\Controller\Result\JsonFactory $resultJsonFactory, |
58
|
|
|
\Payone\Core\Helper\Ratepay $ratepayHelper |
59
|
|
|
) { |
60
|
|
|
parent::__construct($context); |
61
|
|
|
$this->resultJsonFactory = $resultJsonFactory; |
62
|
|
|
$this->ratepayHelper = $ratepayHelper; |
63
|
|
|
} |
64
|
|
|
|
65
|
|
|
/** |
66
|
|
|
* Return if the user has the needed rights to view this page |
67
|
|
|
* |
68
|
|
|
* @return bool |
69
|
|
|
*/ |
70
|
|
|
protected function _isAllowed() |
71
|
|
|
{ |
72
|
|
|
return $this->_authorization->isAllowed('Payone_Core::payone_configuration_payment'); |
73
|
|
|
} |
74
|
|
|
|
75
|
|
|
/** |
76
|
|
|
* Refresh ratepay profiles |
77
|
|
|
* |
78
|
|
|
* @return \Magento\Framework\Controller\Result\Json |
|
|
|
|
79
|
|
|
*/ |
80
|
|
|
public function execute() |
81
|
|
|
{ |
82
|
|
|
$aData = ['success' => true]; |
83
|
|
|
|
84
|
|
|
if ($this->_isAllowed()) { |
85
|
|
|
$sMethod = $this->ratepayHelper->getRequestParameter('method'); |
86
|
|
|
try { |
87
|
|
|
$this->ratepayHelper->refreshProfiles($sMethod); |
88
|
|
|
} catch (\Exception $exc) { |
89
|
|
|
$aData['success'] = false; |
90
|
|
|
$aData['errormessage'] = $exc->getMessage(); |
91
|
|
|
} |
92
|
|
|
} |
93
|
|
|
|
94
|
|
|
/** @var \Magento\Framework\Controller\Result\Json $resultJson */ |
95
|
|
|
$resultJson = $this->resultJsonFactory->create(); |
96
|
|
|
return $resultJson->setData($aData); |
97
|
|
|
} |
98
|
|
|
} |
99
|
|
|
|
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