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\Adminhtml\Config\Form\Field; |
28
|
|
|
|
29
|
|
|
/** |
30
|
|
|
* Admin-block for Iframe creditcard configuration |
31
|
|
|
*/ |
32
|
|
|
class CreditcardTemplate extends \Magento\Config\Block\System\Config\Form\Field\FieldArray\AbstractFieldArray |
33
|
|
|
{ |
34
|
|
|
/** |
35
|
|
|
* Default configuration |
36
|
|
|
* |
37
|
|
|
* @var array |
38
|
|
|
*/ |
39
|
|
|
protected $aDefaultConfig = [ |
40
|
|
|
'Number_type' => 'tel', |
41
|
|
|
'Number_count' => '30', |
42
|
|
|
'Number_max' => '16', |
43
|
|
|
'Number_iframe' => 'standard', |
44
|
|
|
'Number_width' => '202px', |
45
|
|
|
'Number_height' => '20px', |
46
|
|
|
'Number_style' => 'standard', |
47
|
|
|
'Number_css' => '', |
48
|
|
|
'CVC_type' => 'tel', |
49
|
|
|
'CVC_count' => '30', |
50
|
|
|
'CVC_max' => '4', |
51
|
|
|
'CVC_iframe' => 'standard', |
52
|
|
|
'CVC_width' => '202px', |
53
|
|
|
'CVC_height' => '20px', |
54
|
|
|
'CVC_style' => 'standard', |
55
|
|
|
'CVC_css' => '', |
56
|
|
|
'Month_type' => 'select', |
57
|
|
|
'Month_count' => '3', |
58
|
|
|
'Month_max' => '2', |
59
|
|
|
'Month_iframe' => 'custom', |
60
|
|
|
'Month_width' => '120px', |
61
|
|
|
'Month_height' => '20px', |
62
|
|
|
'Month_style' => 'standard', |
63
|
|
|
'Month_css' => '', |
64
|
|
|
'Year_type' => 'select', |
65
|
|
|
'Year_count' => '5', |
66
|
|
|
'Year_max' => '4', |
67
|
|
|
'Year_iframe' => 'custom', |
68
|
|
|
'Year_width' => '120px', |
69
|
|
|
'Year_height' => '20px', |
70
|
|
|
'Year_style' => 'standard', |
71
|
|
|
'Year_css' => '', |
72
|
|
|
'Iframe_width' => '365px', |
73
|
|
|
'Iframe_height' => '30px', |
74
|
|
|
'Standard_input' => "width:223px;height:30px;padding: 0 9px;font-size:14px;font-family:'Helvetica Neue',Verdana,Arial,sans-serif;", |
75
|
|
|
'Standard_selection' => 'width:100px;', |
76
|
|
|
]; |
77
|
|
|
|
78
|
|
|
/** |
79
|
|
|
* Template |
80
|
|
|
* |
81
|
|
|
* @var string |
82
|
|
|
*/ |
83
|
|
|
protected $_template = 'Payone_Core::system/config/form/field/creditcard_template.phtml'; |
84
|
|
|
|
85
|
|
|
/** |
86
|
|
|
* Initialise form fields |
87
|
|
|
* |
88
|
|
|
* @return void |
89
|
|
|
*/ |
90
|
|
|
protected function _construct() |
91
|
|
|
{ |
92
|
|
|
$this->addColumn('txaction', ['label' => __('Transactionstatus-message')]); |
93
|
|
|
$this->_addAfter = false; |
94
|
|
|
$this->_addButtonLabel = __('Add Minimum Qty'); |
95
|
|
|
parent::_construct(); |
96
|
|
|
} |
97
|
|
|
|
98
|
|
|
/** |
99
|
|
|
* Get all field-types |
100
|
|
|
* |
101
|
|
|
* @return array |
102
|
|
|
*/ |
103
|
|
|
public function getCCFields() |
104
|
|
|
{ |
105
|
|
|
return [ |
106
|
|
|
'Number', |
107
|
|
|
'CVC', |
108
|
|
|
'Month', |
109
|
|
|
'Year', |
110
|
|
|
]; |
111
|
|
|
} |
112
|
|
|
|
113
|
|
|
/** |
114
|
|
|
* Get available styles for dropdown |
115
|
|
|
* |
116
|
|
|
* @return array |
117
|
|
|
*/ |
118
|
|
|
public function getCCStyles() |
119
|
|
|
{ |
120
|
|
|
return [ |
121
|
|
|
'standard' => __('Standard'), |
122
|
|
|
'custom' => __('Custom'), |
123
|
|
|
]; |
124
|
|
|
} |
125
|
|
|
|
126
|
|
|
/** |
127
|
|
|
* Get available types for dropdown |
128
|
|
|
* |
129
|
|
|
* @param string $sField |
130
|
|
|
* @return array |
131
|
|
|
*/ |
132
|
|
|
public function getCCTypes($sField) |
133
|
|
|
{ |
134
|
|
|
$aTypes = []; |
135
|
|
|
if ($sField == 'Month' || $sField == 'Year') { |
136
|
|
|
$aTypes['select'] = __('Select'); |
137
|
|
|
} |
138
|
|
|
$aTypes['tel'] = __('Numeric'); |
139
|
|
|
$aTypes['password'] = __('Password'); |
140
|
|
|
$aTypes['text'] = __('Text'); |
141
|
|
|
return $aTypes; |
142
|
|
|
} |
143
|
|
|
|
144
|
|
|
/** |
145
|
|
|
* Get configured value or default value |
146
|
|
|
* |
147
|
|
|
* @param string $sIdent |
148
|
|
|
* @return string |
149
|
|
|
*/ |
150
|
|
|
public function fcpoGetValue($sIdent) |
151
|
|
|
{ |
152
|
|
|
$sReturn = ''; |
153
|
|
|
|
154
|
|
|
$aValues = $this->getElement()->getValue(); |
155
|
|
|
if (isset($aValues[$sIdent])) { |
156
|
|
|
$sReturn = $aValues[$sIdent]; |
157
|
|
|
} elseif (isset($this->aDefaultConfig[$sIdent])) { |
158
|
|
|
$sReturn = $this->aDefaultConfig[$sIdent]; |
159
|
|
|
} |
160
|
|
|
$sReturn = str_replace('"', """, $sReturn); |
161
|
|
|
return $sReturn; |
162
|
|
|
} |
163
|
|
|
} |
164
|
|
|
|