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\Block\Adminhtml\Config\Form\Field; |
28
|
|
|
|
29
|
|
|
/** |
30
|
|
|
* Admin-block for displaying Ratepay shop config |
31
|
|
|
*/ |
32
|
|
|
class RatepayShowShopConfig extends \Magento\Config\Block\System\Config\Form\Field\FieldArray\AbstractFieldArray |
|
|
|
|
33
|
|
|
{ |
34
|
|
|
/** |
35
|
|
|
* Template |
36
|
|
|
* |
37
|
|
|
* @var string |
38
|
|
|
*/ |
39
|
|
|
protected $_template = 'Payone_Core::system/config/form/field/ratepay_show_shop_config.phtml'; |
40
|
|
|
|
41
|
|
|
/** |
42
|
|
|
* @var \Payone\Core\Helper\Ratepay |
43
|
|
|
*/ |
44
|
|
|
protected $ratepayHelper; |
45
|
|
|
|
46
|
|
|
/** |
47
|
|
|
* Ratepay profile resource model |
48
|
|
|
* |
49
|
|
|
* @var \Payone\Core\Model\ResourceModel\RatepayProfileConfig |
50
|
|
|
*/ |
51
|
|
|
protected $ratepayProfileResource; |
52
|
|
|
|
53
|
|
|
/** |
54
|
|
|
* Constructor |
55
|
|
|
* |
56
|
|
|
* @param \Magento\Backend\Block\Template\Context $context |
57
|
|
|
* @param \Payone\Core\Helper\Ratepay $ratepayHelper |
58
|
|
|
* @param \Payone\Core\Model\ResourceModel\RatepayProfileConfig $ratepayProfileResource |
59
|
|
|
* @param array $data |
60
|
|
|
*/ |
61
|
|
|
public function __construct( |
62
|
|
|
\Magento\Backend\Block\Template\Context $context, |
|
|
|
|
63
|
|
|
\Payone\Core\Helper\Ratepay $ratepayHelper, |
64
|
|
|
\Payone\Core\Model\ResourceModel\RatepayProfileConfig $ratepayProfileResource, |
65
|
|
|
array $data = [] |
66
|
|
|
) { |
67
|
|
|
parent::__construct($context, $data); |
68
|
|
|
$this->ratepayHelper = $ratepayHelper; |
69
|
|
|
$this->ratepayProfileResource = $ratepayProfileResource; |
70
|
|
|
} |
71
|
|
|
|
72
|
|
|
/** |
73
|
|
|
* Initialise form fields |
74
|
|
|
* |
75
|
|
|
* @return void |
76
|
|
|
*/ |
77
|
|
|
protected function _construct() |
78
|
|
|
{ |
79
|
|
|
$this->addColumn('txaction', ['label' => __('Transactionstatus-message')]); |
|
|
|
|
80
|
|
|
$this->_addAfter = false; |
|
|
|
|
81
|
|
|
$this->_addButtonLabel = __('Add Minimum Qty'); |
|
|
|
|
82
|
|
|
parent::_construct(); |
83
|
|
|
} |
84
|
|
|
|
85
|
|
|
/** |
86
|
|
|
* Returns current payment method |
87
|
|
|
* |
88
|
|
|
* @return string|false |
89
|
|
|
*/ |
90
|
|
|
protected function getCurrentPaymentMethod() |
91
|
|
|
{ |
92
|
|
|
$oElement = $this->getDataByKey('element'); |
93
|
|
|
if ($oElement) { |
94
|
|
|
$aOrigData = $oElement->getOriginalData(); |
95
|
|
|
if (isset($aOrigData['path'])) { |
96
|
|
|
return str_replace('payone_payment/', '', $aOrigData['path']); |
97
|
|
|
} |
98
|
|
|
} |
99
|
|
|
return false; |
100
|
|
|
} |
101
|
|
|
|
102
|
|
|
/** |
103
|
|
|
* Returns Ratepay shop configurations for current payment method |
104
|
|
|
* |
105
|
|
|
* @return array |
106
|
|
|
*/ |
107
|
|
|
public function getRatepayShopConfig() |
108
|
|
|
{ |
109
|
|
|
$sCurrentPaymentMethod = $this->getCurrentPaymentMethod(); |
110
|
|
|
|
111
|
|
|
$aShopIds = $this->ratepayHelper->getRatepayShopConfigIdsByPaymentMethod($sCurrentPaymentMethod); |
|
|
|
|
112
|
|
|
if (empty($aShopIds)) { |
113
|
|
|
return []; |
114
|
|
|
} |
115
|
|
|
return $this->ratepayProfileResource->getProfileConfigsByIds($aShopIds); |
116
|
|
|
} |
117
|
|
|
} |
118
|
|
|
|
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