|
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 - 2016 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\Onepage; |
|
28
|
|
|
|
|
29
|
|
|
use Magento\Framework\View\Element\Template; |
|
|
|
|
|
|
30
|
|
|
|
|
31
|
|
|
/** |
|
32
|
|
|
* Block class for checkout debit-mandate page |
|
33
|
|
|
*/ |
|
34
|
|
|
class Debit extends Template |
|
35
|
|
|
{ |
|
36
|
|
|
/** |
|
37
|
|
|
* Checkout session object |
|
38
|
|
|
* |
|
39
|
|
|
* @var \Magento\Checkout\Model\Session |
|
|
|
|
|
|
40
|
|
|
*/ |
|
41
|
|
|
protected $checkoutSession; |
|
42
|
|
|
|
|
43
|
|
|
/** |
|
44
|
|
|
* Error message |
|
45
|
|
|
* |
|
46
|
|
|
* @var string|bool |
|
47
|
|
|
*/ |
|
48
|
|
|
protected $sErrorMessage = false; |
|
49
|
|
|
|
|
50
|
|
|
/** |
|
51
|
|
|
* Constructor |
|
52
|
|
|
* |
|
53
|
|
|
* @param \Magento\Checkout\Model\Session $checkoutSession |
|
54
|
|
|
* @param \Magento\Framework\View\Element\Template\Context $context |
|
55
|
|
|
* @param array $data |
|
56
|
|
|
*/ |
|
57
|
|
|
public function __construct( |
|
58
|
|
|
\Magento\Checkout\Model\Session $checkoutSession, |
|
59
|
|
|
\Magento\Framework\View\Element\Template\Context $context, |
|
|
|
|
|
|
60
|
|
|
array $data = [] |
|
61
|
|
|
) { |
|
62
|
|
|
parent::__construct($context, $data); |
|
63
|
|
|
$this->checkoutSession = $checkoutSession; |
|
64
|
|
|
} |
|
65
|
|
|
|
|
66
|
|
|
/** |
|
67
|
|
|
* Returns the mandate text |
|
68
|
|
|
* |
|
69
|
|
|
* @return string|bool |
|
70
|
|
|
*/ |
|
71
|
|
|
public function getMandateText() |
|
72
|
|
|
{ |
|
73
|
|
|
$aMandate = $this->checkoutSession->getPayoneMandate(); |
|
74
|
|
|
if ($aMandate && |
|
75
|
|
|
isset($aMandate['mandate_status']) && |
|
76
|
|
|
$aMandate['mandate_status'] == 'pending' && |
|
77
|
|
|
isset($aMandate['mandate_text']) |
|
78
|
|
|
) { |
|
79
|
|
|
$sText = $aMandate['mandate_text']; |
|
80
|
|
|
return urldecode($sText); |
|
81
|
|
|
} |
|
82
|
|
|
return false; |
|
83
|
|
|
} |
|
84
|
|
|
|
|
85
|
|
|
/** |
|
86
|
|
|
* Returns the mandate id |
|
87
|
|
|
* |
|
88
|
|
|
* @return string|bool |
|
89
|
|
|
*/ |
|
90
|
|
|
public function getMandateId() |
|
91
|
|
|
{ |
|
92
|
|
|
$aMandate = $this->checkoutSession->getPayoneMandate(); |
|
93
|
|
|
if ($aMandate && isset($aMandate['mandate_identification'])) { |
|
94
|
|
|
return $aMandate['mandate_identification']; |
|
95
|
|
|
} |
|
96
|
|
|
return false; |
|
97
|
|
|
} |
|
98
|
|
|
|
|
99
|
|
|
/** |
|
100
|
|
|
* Returns the basket-url |
|
101
|
|
|
* |
|
102
|
|
|
* @return string |
|
103
|
|
|
*/ |
|
104
|
|
|
public function getCheckoutUrl() |
|
105
|
|
|
{ |
|
106
|
|
|
return $this->getUrl('checkout'); |
|
107
|
|
|
} |
|
108
|
|
|
|
|
109
|
|
|
/** |
|
110
|
|
|
* Returns error message |
|
111
|
|
|
* |
|
112
|
|
|
* @return string |
|
113
|
|
|
*/ |
|
114
|
|
|
public function getErrorMessage() |
|
115
|
|
|
{ |
|
116
|
|
|
if ($this->sErrorMessage === false) { |
|
117
|
|
|
$this->sErrorMessage = $this->checkoutSession->getPayoneDebitError(); |
|
118
|
|
|
$this->checkoutSession->unsPayoneDebitError(); |
|
119
|
|
|
} |
|
120
|
|
|
return $this->sErrorMessage; |
|
121
|
|
|
} |
|
122
|
|
|
} |
|
123
|
|
|
|
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