Skip to content

Commit 72a224a

Browse files
committed
First plugin commit to the Github repository.
0 parents  commit 72a224a

File tree

209 files changed

+21522
-0
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

209 files changed

+21522
-0
lines changed
Lines changed: 159 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,159 @@
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+
* Prepare to render
87+
*
88+
* @return void
89+
*/
90+
protected function _prepareToRender()
91+
{
92+
$this->addColumn('txaction', ['label' => __('Transactionstatus-message')]);
93+
$this->_addAfter = false;
94+
$this->_addButtonLabel = __('Add Minimum Qty');
95+
}
96+
97+
/**
98+
* Get all field-types
99+
*
100+
* @return array
101+
*/
102+
public function getCCFields()
103+
{
104+
return [
105+
'Number',
106+
'CVC',
107+
'Month',
108+
'Year',
109+
];
110+
}
111+
112+
/**
113+
* Get available styles for dropdown
114+
*
115+
* @return array
116+
*/
117+
public function getCCStyles()
118+
{
119+
return [
120+
'standard' => __('Standard'),
121+
'custom' => __('Custom'),
122+
];
123+
}
124+
125+
/**
126+
* Get available types for dropdown
127+
*
128+
* @param string $sField
129+
* @return array
130+
*/
131+
public function getCCTypes($sField)
132+
{
133+
$aTypes = [];
134+
if ($sField == 'Month' || $sField == 'Year') {
135+
$aTypes['select'] = __('Select');
136+
}
137+
$aTypes['tel'] = __('Numeric');
138+
$aTypes['password'] = __('Password');
139+
$aTypes['text'] = __('Text');
140+
return $aTypes;
141+
}
142+
143+
/**
144+
* Get configured value or default value
145+
*
146+
* @param string $sIdent
147+
* @return string
148+
*/
149+
public function fcpoGetValue($sIdent)
150+
{
151+
$aValues = $this->getElement()->getValue();
152+
if (isset($aValues[$sIdent])) {
153+
return $aValues[$sIdent];
154+
} elseif (isset($this->aDefaultConfig[$sIdent])) {
155+
return $this->aDefaultConfig[$sIdent];
156+
}
157+
return '';
158+
}
159+
}
Lines changed: 40 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,40 @@
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\FieldArray;
28+
29+
/**
30+
* Block to enable multiselect functionality
31+
*/
32+
class Multiselect 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/multiselect.phtml';
40+
}
Lines changed: 101 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,101 @@
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+
* Block class for Klarna store-id grid-element
31+
*/
32+
class KlarnaStoreId extends \Payone\Core\Block\Adminhtml\Config\Form\Field\FieldArray\Multiselect
33+
{
34+
/**
35+
* Element factory
36+
*
37+
* @var \Magento\Framework\Data\Form\Element\Factory
38+
*/
39+
protected $elementFactory;
40+
41+
/**
42+
* List of all possible TransactionStatus types
43+
*
44+
* @var \Payone\Core\Model\Source\KlarnaCountry
45+
*/
46+
protected $klarnaCountries;
47+
48+
/**
49+
* Constructor
50+
*
51+
* @param \Magento\Backend\Block\Template\Context $context
52+
* @param \Magento\Framework\Data\Form\Element\Factory $elementFactory
53+
* @param \Payone\Core\Model\Source\TransactionStatus $klarnaCountries
54+
* @param array $data
55+
* @return void
56+
*/
57+
public function __construct(
58+
\Magento\Backend\Block\Template\Context $context,
59+
\Magento\Framework\Data\Form\Element\Factory $elementFactory,
60+
\Payone\Core\Model\Source\KlarnaCountry $klarnaCountries,
61+
array $data = []
62+
) {
63+
parent::__construct($context, $data);
64+
$this->elementFactory = $elementFactory;
65+
$this->klarnaCountries = $klarnaCountries;
66+
}
67+
68+
/**
69+
* Initialise form fields
70+
*
71+
* @return void
72+
*/
73+
protected function _construct()
74+
{
75+
$this->addColumn('store_id', ['label' => __('Store-ID')]);
76+
$this->addColumn('countries', ['label' => __('Countries')]);
77+
$this->_addAfter = false;
78+
$this->_addButtonLabel = __('Add Store-ID');
79+
parent::_construct();
80+
}
81+
82+
/**
83+
* Render array cell for prototypeJS template
84+
*
85+
* @param string $sColumnName
86+
* @return string
87+
*/
88+
public function renderCellTemplate($sColumnName)
89+
{
90+
if ($sColumnName == 'countries' && isset($this->_columns[$sColumnName])) {
91+
$aOptions = $this->klarnaCountries->toOptionArray();
92+
$oElement = $this->elementFactory->create('multiselect');
93+
$oElement->setForm($this->getForm());
94+
$oElement->setName($this->_getCellInputElementName($sColumnName));
95+
$oElement->setHtmlId($this->_getCellInputElementId('<%- _id %>', $sColumnName));
96+
$oElement->setValues($aOptions);
97+
return str_replace("\n", '', $oElement->getElementHtml());
98+
}
99+
return parent::renderCellTemplate($sColumnName);
100+
}
101+
}

0 commit comments

Comments
 (0)