Version Notes
keine
Download this release
Release Info
Developer | Magento Core Team |
Extension | symmetrics_cashticket |
Version | 0.1.8 |
Comparing to | |
See all releases |
Code changes from version 0.1.4 to 0.1.8
- app/code/community/Symmetrics/CashTicket/Block/Adminhtml/Config.php +51 -26
- app/code/community/Symmetrics/CashTicket/Block/Adminhtml/Config/Edit.php +96 -59
- app/code/community/Symmetrics/CashTicket/Block/Adminhtml/Config/Edit/Form.php +225 -145
- app/code/community/Symmetrics/CashTicket/Block/Adminhtml/Config/Grid.php +158 -117
- app/code/community/Symmetrics/CashTicket/Block/Adminhtml/Config/Renderer.php +58 -29
- app/code/community/Symmetrics/CashTicket/Block/Error.php +60 -34
- app/code/community/Symmetrics/CashTicket/Block/Form.php +48 -23
- app/code/community/Symmetrics/CashTicket/Block/Info.php +156 -124
- app/code/community/Symmetrics/CashTicket/Helper/Data.php +37 -13
- app/code/community/Symmetrics/CashTicket/Model/Api.php +98 -40
- app/code/community/Symmetrics/CashTicket/Model/Cashticket.php +277 -237
- app/code/community/Symmetrics/CashTicket/Model/Item.php +84 -44
- app/code/community/Symmetrics/CashTicket/Model/Mysql4/Item.php +46 -16
- app/code/community/Symmetrics/CashTicket/Model/Mysql4/Item/Collection.php +47 -17
- app/code/community/Symmetrics/CashTicket/Model/Source/Businesstype.php +49 -24
- app/code/community/Symmetrics/CashTicket/Model/Source/Currency.php +56 -31
- app/code/community/Symmetrics/CashTicket/Model/Source/Locale.php +51 -26
- app/code/community/Symmetrics/CashTicket/controllers/Adminhtml/CashticketController.php +164 -121
- app/code/community/Symmetrics/CashTicket/controllers/Adminhtml/ConfigController.php +212 -173
- app/code/community/Symmetrics/CashTicket/controllers/ProcessingController.php +246 -200
- app/code/community/Symmetrics/CashTicket/etc/config.xml +40 -8
- app/code/community/Symmetrics/CashTicket/etc/system.xml +20 -6
- app/code/community/Symmetrics/CashTicket/sql/cashticket_setup/mysql4-install-0.1.0.php +50 -36
- app/design/adminhtml/default/default/layout/cashticket.xml +21 -7
- app/design/adminhtml/default/default/template/cashticket/info.phtml +33 -20
- app/design/frontend/default/default/template/cashticket/form.phtml +19 -6
- app/design/frontend/default/default/template/cashticket/info.phtml +20 -7
- app/etc/modules/Symmetrics_CashTicket.xml +24 -1
- app/locale/de_DE/Symmetrics_Cashticket.csv +1 -0
- js/symmetrics/adminhtml/cashticket.js +58 -37
- package.xml +6 -6
app/code/community/Symmetrics/CashTicket/Block/Adminhtml/Config.php
CHANGED
@@ -1,26 +1,51 @@
|
|
1 |
-
<?php
|
2 |
-
/**
|
3 |
-
*
|
4 |
-
*
|
5 |
-
*
|
6 |
-
*
|
7 |
-
*
|
8 |
-
|
9 |
-
|
10 |
-
|
11 |
-
|
12 |
-
|
13 |
-
|
14 |
-
|
15 |
-
|
16 |
-
|
17 |
-
|
18 |
-
|
19 |
-
|
20 |
-
|
21 |
-
|
22 |
-
|
23 |
-
|
24 |
-
|
25 |
-
|
26 |
-
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
1 |
+
<?php
|
2 |
+
/**
|
3 |
+
* Magento
|
4 |
+
*
|
5 |
+
* NOTICE OF LICENSE
|
6 |
+
*
|
7 |
+
* This source file is subject to the Open Software License (OSL 3.0)
|
8 |
+
* that is bundled with this package in the file LICENSE.txt.
|
9 |
+
* It is also available through the world-wide-web at this URL:
|
10 |
+
* http://opensource.org/licenses/osl-3.0.php
|
11 |
+
* If you did not receive a copy of the license and are unable to
|
12 |
+
* obtain it through the world-wide-web, please send an email
|
13 |
+
* to license@magentocommerce.com so we can send you a copy immediately.
|
14 |
+
*
|
15 |
+
* @category Symmetrics
|
16 |
+
* @package Symmetrics_CashTicket
|
17 |
+
* @author symmetrics gmbh <info@symmetrics.de>
|
18 |
+
* @author Eugen Gitin <eg@symmetrics.de>
|
19 |
+
* @copyright 2010 symmetrics gmbh
|
20 |
+
* @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
|
21 |
+
* @link http://www.symmetrics.de/
|
22 |
+
*/
|
23 |
+
|
24 |
+
/**
|
25 |
+
* Symmetrics_CashTicket_Block_Adminhtml_Config
|
26 |
+
*
|
27 |
+
* @category Symmetrics
|
28 |
+
* @package Symmetrics_CashTicket
|
29 |
+
* @author symmetrics gmbh <info@symmetrics.de>
|
30 |
+
* @author Eugen Gitin <eg@symmetrics.de>
|
31 |
+
* @copyright 2010 symmetrics gmbh
|
32 |
+
* @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
|
33 |
+
* @link http://www.symmetrics.de/
|
34 |
+
*/
|
35 |
+
class Symmetrics_CashTicket_Block_Adminhtml_Config extends Mage_Adminhtml_Block_Widget_Grid_Container
|
36 |
+
{
|
37 |
+
/**
|
38 |
+
* Prepare the page with
|
39 |
+
* the grid on it
|
40 |
+
*
|
41 |
+
* @return object
|
42 |
+
*/
|
43 |
+
public function __construct()
|
44 |
+
{
|
45 |
+
$this->_controller = 'adminhtml_config';
|
46 |
+
$this->_blockGroup = 'cashticket';
|
47 |
+
$this->_headerText = Mage::helper('cashticket')->__('Cash-Ticket Configuration');
|
48 |
+
$this->_addButtonLabel = Mage::helper('cashticket')->__('Add Item');
|
49 |
+
parent::__construct();
|
50 |
+
}
|
51 |
+
}
|
app/code/community/Symmetrics/CashTicket/Block/Adminhtml/Config/Edit.php
CHANGED
@@ -1,59 +1,96 @@
|
|
1 |
-
<?php
|
2 |
-
/**
|
3 |
-
*
|
4 |
-
*
|
5 |
-
*
|
6 |
-
*
|
7 |
-
*
|
8 |
-
|
9 |
-
|
10 |
-
|
11 |
-
|
12 |
-
|
13 |
-
|
14 |
-
|
15 |
-
|
16 |
-
|
17 |
-
|
18 |
-
|
19 |
-
|
20 |
-
|
21 |
-
|
22 |
-
|
23 |
-
|
24 |
-
|
25 |
-
|
26 |
-
|
27 |
-
|
28 |
-
|
29 |
-
|
30 |
-
|
31 |
-
|
32 |
-
|
33 |
-
|
34 |
-
|
35 |
-
|
36 |
-
|
37 |
-
|
38 |
-
|
39 |
-
|
40 |
-
|
41 |
-
|
42 |
-
|
43 |
-
|
44 |
-
|
45 |
-
|
46 |
-
|
47 |
-
|
48 |
-
|
49 |
-
|
50 |
-
|
51 |
-
|
52 |
-
|
53 |
-
|
54 |
-
|
55 |
-
|
56 |
-
|
57 |
-
|
58 |
-
|
59 |
-
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
1 |
+
<?php
|
2 |
+
/**
|
3 |
+
* Magento
|
4 |
+
*
|
5 |
+
* NOTICE OF LICENSE
|
6 |
+
*
|
7 |
+
* This source file is subject to the Open Software License (OSL 3.0)
|
8 |
+
* that is bundled with this package in the file LICENSE.txt.
|
9 |
+
* It is also available through the world-wide-web at this URL:
|
10 |
+
* http://opensource.org/licenses/osl-3.0.php
|
11 |
+
* If you did not receive a copy of the license and are unable to
|
12 |
+
* obtain it through the world-wide-web, please send an email
|
13 |
+
* to license@magentocommerce.com so we can send you a copy immediately.
|
14 |
+
*
|
15 |
+
* @category Symmetrics
|
16 |
+
* @package Symmetrics_CashTicket
|
17 |
+
* @author symmetrics gmbh <info@symmetrics.de>
|
18 |
+
* @author Eugen Gitin <eg@symmetrics.de>
|
19 |
+
* @copyright 2010 symmetrics gmbh
|
20 |
+
* @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
|
21 |
+
* @link http://www.symmetrics.de/
|
22 |
+
*/
|
23 |
+
|
24 |
+
/**
|
25 |
+
* Symmetrics_CashTicket_Block_Adminhtml_Config_Edit
|
26 |
+
*
|
27 |
+
* @category Symmetrics
|
28 |
+
* @package Symmetrics_CashTicket
|
29 |
+
* @author symmetrics gmbh <info@symmetrics.de>
|
30 |
+
* @author Eugen Gitin <eg@symmetrics.de>
|
31 |
+
* @copyright 2010 symmetrics gmbh
|
32 |
+
* @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
|
33 |
+
* @link http://www.symmetrics.de/
|
34 |
+
*/
|
35 |
+
class Symmetrics_CashTicket_Block_Adminhtml_Config_Edit extends Mage_Adminhtml_Block_Widget_Form_Container
|
36 |
+
{
|
37 |
+
/**
|
38 |
+
* Add buttons to the edit form
|
39 |
+
*
|
40 |
+
* @return void
|
41 |
+
*/
|
42 |
+
public function __construct()
|
43 |
+
{
|
44 |
+
parent::__construct();
|
45 |
+
|
46 |
+
$this->_objectId = 'id';
|
47 |
+
$this->_blockGroup = 'cashticket';
|
48 |
+
$this->_controller = 'adminhtml_config';
|
49 |
+
|
50 |
+
$this->_updateButton(
|
51 |
+
'save',
|
52 |
+
'label',
|
53 |
+
Mage::helper('cashticket')->__('Save')
|
54 |
+
);
|
55 |
+
$this->_updateButton(
|
56 |
+
'delete',
|
57 |
+
'label',
|
58 |
+
Mage::helper('cashticket')->__('Delete')
|
59 |
+
);
|
60 |
+
|
61 |
+
// add "save and continue" button
|
62 |
+
$this->_addButton(
|
63 |
+
'saveandcontinue',
|
64 |
+
array(
|
65 |
+
'label' => Mage::helper('adminhtml')->__('Save And Continue Edit'),
|
66 |
+
'onclick' => 'saveAndContinueEdit()',
|
67 |
+
'class' => 'save',
|
68 |
+
),
|
69 |
+
-100
|
70 |
+
);
|
71 |
+
|
72 |
+
// js needed for "save and continue"
|
73 |
+
$this->_formScripts[] = "
|
74 |
+
function saveAndContinueEdit(){
|
75 |
+
editForm.submit($('edit_form').action+'back/edit/');
|
76 |
+
}
|
77 |
+
";
|
78 |
+
}
|
79 |
+
|
80 |
+
/**
|
81 |
+
* Set page header
|
82 |
+
*
|
83 |
+
* @return string
|
84 |
+
*/
|
85 |
+
public function getHeaderText()
|
86 |
+
{
|
87 |
+
// if editing an item - set "Edit" as a page header
|
88 |
+
if (Mage::registry('cashticket_data') && Mage::registry('cashticket_data')->getId()) {
|
89 |
+
$currencyCode = Mage::registry('cashticket_data')->getCurrencyCode();
|
90 |
+
return Mage::helper('cashticket')->__('Edit Item "%s"', $this->htmlEscape($currencyCode));
|
91 |
+
} else {
|
92 |
+
// ohterwise set "Add"
|
93 |
+
return Mage::helper('cashticket')->__('Add Item');
|
94 |
+
}
|
95 |
+
}
|
96 |
+
}
|
app/code/community/Symmetrics/CashTicket/Block/Adminhtml/Config/Edit/Form.php
CHANGED
@@ -1,145 +1,225 @@
|
|
1 |
-
<?php
|
2 |
-
/**
|
3 |
-
*
|
4 |
-
*
|
5 |
-
*
|
6 |
-
*
|
7 |
-
*
|
8 |
-
|
9 |
-
|
10 |
-
|
11 |
-
|
12 |
-
|
13 |
-
|
14 |
-
|
15 |
-
|
16 |
-
|
17 |
-
|
18 |
-
|
19 |
-
|
20 |
-
|
21 |
-
|
22 |
-
|
23 |
-
|
24 |
-
|
25 |
-
|
26 |
-
|
27 |
-
|
28 |
-
|
29 |
-
|
30 |
-
|
31 |
-
|
32 |
-
|
33 |
-
|
34 |
-
|
35 |
-
|
36 |
-
|
37 |
-
|
38 |
-
|
39 |
-
|
40 |
-
|
41 |
-
|
42 |
-
|
43 |
-
|
44 |
-
|
45 |
-
|
46 |
-
|
47 |
-
|
48 |
-
|
49 |
-
|
50 |
-
|
51 |
-
|
52 |
-
|
53 |
-
|
54 |
-
|
55 |
-
|
56 |
-
|
57 |
-
'
|
58 |
-
'
|
59 |
-
'
|
60 |
-
|
61 |
-
|
62 |
-
|
63 |
-
|
64 |
-
'
|
65 |
-
|
66 |
-
|
67 |
-
|
68 |
-
|
69 |
-
|
70 |
-
|
71 |
-
|
72 |
-
|
73 |
-
|
74 |
-
|
75 |
-
|
76 |
-
|
77 |
-
|
78 |
-
|
79 |
-
|
80 |
-
|
81 |
-
|
82 |
-
|
83 |
-
|
84 |
-
|
85 |
-
|
86 |
-
|
87 |
-
|
88 |
-
|
89 |
-
|
90 |
-
|
91 |
-
|
92 |
-
|
93 |
-
|
94 |
-
|
95 |
-
|
96 |
-
|
97 |
-
|
98 |
-
|
99 |
-
|
100 |
-
|
101 |
-
|
102 |
-
|
103 |
-
|
104 |
-
|
105 |
-
|
106 |
-
|
107 |
-
|
108 |
-
'
|
109 |
-
'
|
110 |
-
|
111 |
-
|
112 |
-
|
113 |
-
|
114 |
-
|
115 |
-
|
116 |
-
|
117 |
-
|
118 |
-
|
119 |
-
|
120 |
-
'
|
121 |
-
|
122 |
-
|
123 |
-
|
124 |
-
|
125 |
-
|
126 |
-
|
127 |
-
)
|
128 |
-
)
|
129 |
-
|
130 |
-
|
131 |
-
|
132 |
-
|
133 |
-
|
134 |
-
|
135 |
-
|
136 |
-
|
137 |
-
|
138 |
-
|
139 |
-
|
140 |
-
$
|
141 |
-
|
142 |
-
|
143 |
-
|
144 |
-
|
145 |
-
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
1 |
+
<?php
|
2 |
+
/**
|
3 |
+
* Magento
|
4 |
+
*
|
5 |
+
* NOTICE OF LICENSE
|
6 |
+
*
|
7 |
+
* This source file is subject to the Open Software License (OSL 3.0)
|
8 |
+
* that is bundled with this package in the file LICENSE.txt.
|
9 |
+
* It is also available through the world-wide-web at this URL:
|
10 |
+
* http://opensource.org/licenses/osl-3.0.php
|
11 |
+
* If you did not receive a copy of the license and are unable to
|
12 |
+
* obtain it through the world-wide-web, please send an email
|
13 |
+
* to license@magentocommerce.com so we can send you a copy immediately.
|
14 |
+
*
|
15 |
+
* @category Symmetrics
|
16 |
+
* @package Symmetrics_CashTicket
|
17 |
+
* @author symmetrics gmbh <info@symmetrics.de>
|
18 |
+
* @author Eugen Gitin <eg@symmetrics.de>
|
19 |
+
* @copyright 2010 symmetrics gmbh
|
20 |
+
* @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
|
21 |
+
* @link http://www.symmetrics.de/
|
22 |
+
*/
|
23 |
+
|
24 |
+
/**
|
25 |
+
* Symmetrics_CashTicket_Block_Adminhtml_Config_Edit_Form
|
26 |
+
*
|
27 |
+
* @category Symmetrics
|
28 |
+
* @package Symmetrics_CashTicket
|
29 |
+
* @author symmetrics gmbh <info@symmetrics.de>
|
30 |
+
* @author Eugen Gitin <eg@symmetrics.de>
|
31 |
+
* @copyright 2010 symmetrics gmbh
|
32 |
+
* @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
|
33 |
+
* @link http://www.symmetrics.de/
|
34 |
+
*/
|
35 |
+
class Symmetrics_CashTicket_Block_Adminhtml_Config_Edit_Form extends Mage_Adminhtml_Block_Widget_Form
|
36 |
+
{
|
37 |
+
/**
|
38 |
+
* set editForm id
|
39 |
+
*
|
40 |
+
* @return void
|
41 |
+
*/
|
42 |
+
public function __construct()
|
43 |
+
{
|
44 |
+
parent::__construct();
|
45 |
+
$this->setId('editForm');
|
46 |
+
}
|
47 |
+
|
48 |
+
/**
|
49 |
+
* Preparing the form and adding
|
50 |
+
* fields to it
|
51 |
+
*
|
52 |
+
* @return object
|
53 |
+
*/
|
54 |
+
protected function _prepareForm()
|
55 |
+
{
|
56 |
+
$form = new Varien_Data_Form(array(
|
57 |
+
'id' => 'edit_form',
|
58 |
+
'action' => $this->getUrl('*/*/save', array('id' => $this->getRequest()->getParam('id'))),
|
59 |
+
'method' => 'post',
|
60 |
+
'enctype' => 'multipart/form-data'
|
61 |
+
));
|
62 |
+
|
63 |
+
$fieldset = $form->addFieldset(
|
64 |
+
'cashticket_form',
|
65 |
+
array(
|
66 |
+
'legend' => Mage::helper('cashticket')->__('Cash-Ticket Configuration')
|
67 |
+
)
|
68 |
+
);
|
69 |
+
|
70 |
+
if ($this->getRequest()->getParam('id')) {
|
71 |
+
$fieldset->addField(
|
72 |
+
'item_id',
|
73 |
+
'hidden',
|
74 |
+
array(
|
75 |
+
'name' => 'item_id',
|
76 |
+
)
|
77 |
+
);
|
78 |
+
}
|
79 |
+
|
80 |
+
$fieldset->addField(
|
81 |
+
'enable',
|
82 |
+
'select',
|
83 |
+
array(
|
84 |
+
'label' => Mage::helper('cashticket')->__('Enable'),
|
85 |
+
'class' => 'required-entry',
|
86 |
+
'required' => true,
|
87 |
+
'name' => 'enable',
|
88 |
+
'options' => array(
|
89 |
+
0 => Mage::helper('cashticket')->__('No'),
|
90 |
+
1 => Mage::helper('cashticket')->__('Yes'),
|
91 |
+
)
|
92 |
+
)
|
93 |
+
);
|
94 |
+
|
95 |
+
$fieldset->addField(
|
96 |
+
'currency_code',
|
97 |
+
'select',
|
98 |
+
array(
|
99 |
+
'label' => Mage::helper('cashticket')->__('Currency'),
|
100 |
+
'class' => 'required-entry',
|
101 |
+
'required' => true,
|
102 |
+
'name' => 'currency_code',
|
103 |
+
'options' => Mage::getModel('cashticket/source_currency')->getOptionArray()
|
104 |
+
)
|
105 |
+
);
|
106 |
+
|
107 |
+
$fieldset->addField(
|
108 |
+
'merchant_id',
|
109 |
+
'text',
|
110 |
+
array(
|
111 |
+
'label' => Mage::helper('cashticket')->__('Merchant ID'),
|
112 |
+
'class' => 'required-entry',
|
113 |
+
'required' => true,
|
114 |
+
'name' => 'merchant_id',
|
115 |
+
)
|
116 |
+
);
|
117 |
+
|
118 |
+
$fieldset->addField(
|
119 |
+
'business_type',
|
120 |
+
'select',
|
121 |
+
array(
|
122 |
+
'label' => Mage::helper('cashticket')->__('Business Type'),
|
123 |
+
'class' => 'required-entry',
|
124 |
+
'required' => true,
|
125 |
+
'name' => 'business_type',
|
126 |
+
'options' => Mage::getModel('cashticket/source_businesstype')->getOptionArray()
|
127 |
+
)
|
128 |
+
);
|
129 |
+
|
130 |
+
$fieldset->addField(
|
131 |
+
'reporting_criteria',
|
132 |
+
'text',
|
133 |
+
array(
|
134 |
+
'label' => Mage::helper('cashticket')->__('Reporting Criteria'),
|
135 |
+
'required' => false,
|
136 |
+
'name' => 'reporting_criteria',
|
137 |
+
)
|
138 |
+
);
|
139 |
+
|
140 |
+
$fieldset->addField(
|
141 |
+
'locale',
|
142 |
+
'select',
|
143 |
+
array(
|
144 |
+
'label' => Mage::helper('cashticket')->__('Language'),
|
145 |
+
'class' => 'required-entry',
|
146 |
+
'required' => true,
|
147 |
+
'name' => 'locale',
|
148 |
+
'options' => Mage::getModel('cashticket/source_locale')->getOptionArray()
|
149 |
+
)
|
150 |
+
);
|
151 |
+
|
152 |
+
$fieldset->addField(
|
153 |
+
'path_pem_test',
|
154 |
+
'text',
|
155 |
+
array(
|
156 |
+
'label' => Mage::helper('cashticket')->__('Path to PEM Certificate (Test)'),
|
157 |
+
'class' => 'required-entry',
|
158 |
+
'required' => true,
|
159 |
+
'name' => 'path_pem_test',
|
160 |
+
)
|
161 |
+
);
|
162 |
+
|
163 |
+
$fieldset->addField(
|
164 |
+
'path_pem_live',
|
165 |
+
'text',
|
166 |
+
array(
|
167 |
+
'label' => Mage::helper('cashticket')->__('Path to PEM Certificate (Live)'),
|
168 |
+
'class' => 'required-entry',
|
169 |
+
'required' => true,
|
170 |
+
'name' => 'path_pem_live',
|
171 |
+
)
|
172 |
+
);
|
173 |
+
|
174 |
+
$fieldset->addField(
|
175 |
+
'path_cert',
|
176 |
+
'text',
|
177 |
+
array(
|
178 |
+
'label' => Mage::helper('cashticket')->__('Path to the Server Certificate'),
|
179 |
+
'class' => 'required-entry',
|
180 |
+
'required' => true,
|
181 |
+
'name' => 'path_cert',
|
182 |
+
)
|
183 |
+
);
|
184 |
+
|
185 |
+
$fieldset->addField(
|
186 |
+
'sslcert_pass',
|
187 |
+
'text',
|
188 |
+
array(
|
189 |
+
'label' => Mage::helper('cashticket')->__('Keyring Password'),
|
190 |
+
'class' => 'required-entry',
|
191 |
+
'required' => true,
|
192 |
+
'name' => 'sslcert_pass',
|
193 |
+
)
|
194 |
+
);
|
195 |
+
|
196 |
+
$fieldset->addField(
|
197 |
+
'sandbox',
|
198 |
+
'select',
|
199 |
+
array(
|
200 |
+
'label' => Mage::helper('cashticket')->__('Sandbox'),
|
201 |
+
'class' => 'required-entry',
|
202 |
+
'required' => true,
|
203 |
+
'name' => 'sandbox',
|
204 |
+
'options' => array(
|
205 |
+
0 => Mage::helper('cashticket')->__('No'),
|
206 |
+
1 => Mage::helper('cashticket')->__('Yes'),
|
207 |
+
)
|
208 |
+
)
|
209 |
+
);
|
210 |
+
|
211 |
+
// get form values from the session
|
212 |
+
if (Mage::getSingleton('adminhtml/session')->getCashticketData()) {
|
213 |
+
$form->setValues(Mage::getSingleton('adminhtml/session')->getCashticketData());
|
214 |
+
Mage::getSingleton('adminhtml/session')->setCashticketData(null);
|
215 |
+
} elseif (Mage::registry('cashticket_data')) {
|
216 |
+
$form->setValues(Mage::registry('cashticket_data')->getData());
|
217 |
+
}
|
218 |
+
|
219 |
+
$form->setAction($this->getUrl('*/*/save'));
|
220 |
+
$form->setUseContainer(true);
|
221 |
+
$this->setForm($form);
|
222 |
+
|
223 |
+
return parent::_prepareForm();
|
224 |
+
}
|
225 |
+
}
|
app/code/community/Symmetrics/CashTicket/Block/Adminhtml/Config/Grid.php
CHANGED
@@ -1,117 +1,158 @@
|
|
1 |
-
<?php
|
2 |
-
/**
|
3 |
-
*
|
4 |
-
*
|
5 |
-
*
|
6 |
-
*
|
7 |
-
*
|
8 |
-
|
9 |
-
|
10 |
-
|
11 |
-
|
12 |
-
|
13 |
-
|
14 |
-
|
15 |
-
|
16 |
-
|
17 |
-
|
18 |
-
|
19 |
-
|
20 |
-
|
21 |
-
|
22 |
-
|
23 |
-
|
24 |
-
|
25 |
-
|
26 |
-
|
27 |
-
|
28 |
-
|
29 |
-
|
30 |
-
|
31 |
-
|
32 |
-
|
33 |
-
|
34 |
-
|
35 |
-
|
36 |
-
|
37 |
-
|
38 |
-
|
39 |
-
|
40 |
-
|
41 |
-
|
42 |
-
|
43 |
-
|
44 |
-
|
45 |
-
|
46 |
-
|
47 |
-
|
48 |
-
$this->
|
49 |
-
|
50 |
-
|
51 |
-
|
52 |
-
|
53 |
-
|
54 |
-
|
55 |
-
|
56 |
-
|
57 |
-
|
58 |
-
|
59 |
-
|
60 |
-
$
|
61 |
-
|
62 |
-
|
63 |
-
|
64 |
-
|
65 |
-
|
66 |
-
|
67 |
-
|
68 |
-
|
69 |
-
|
70 |
-
|
71 |
-
|
72 |
-
|
73 |
-
|
74 |
-
|
75 |
-
|
76 |
-
|
77 |
-
|
78 |
-
|
79 |
-
|
80 |
-
'
|
81 |
-
|
82 |
-
|
83 |
-
|
84 |
-
|
85 |
-
|
86 |
-
|
87 |
-
|
88 |
-
|
89 |
-
|
90 |
-
|
91 |
-
'
|
92 |
-
'
|
93 |
-
|
94 |
-
|
95 |
-
|
96 |
-
|
97 |
-
|
98 |
-
|
99 |
-
|
100 |
-
|
101 |
-
'
|
102 |
-
'
|
103 |
-
|
104 |
-
|
105 |
-
|
106 |
-
|
107 |
-
|
108 |
-
|
109 |
-
|
110 |
-
|
111 |
-
|
112 |
-
|
113 |
-
|
114 |
-
|
115 |
-
|
116 |
-
|
117 |
-
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
1 |
+
<?php
|
2 |
+
/**
|
3 |
+
* Magento
|
4 |
+
*
|
5 |
+
* NOTICE OF LICENSE
|
6 |
+
*
|
7 |
+
* This source file is subject to the Open Software License (OSL 3.0)
|
8 |
+
* that is bundled with this package in the file LICENSE.txt.
|
9 |
+
* It is also available through the world-wide-web at this URL:
|
10 |
+
* http://opensource.org/licenses/osl-3.0.php
|
11 |
+
* If you did not receive a copy of the license and are unable to
|
12 |
+
* obtain it through the world-wide-web, please send an email
|
13 |
+
* to license@magentocommerce.com so we can send you a copy immediately.
|
14 |
+
*
|
15 |
+
* @category Symmetrics
|
16 |
+
* @package Symmetrics_CashTicket
|
17 |
+
* @author symmetrics gmbh <info@symmetrics.de>
|
18 |
+
* @author Eugen Gitin <eg@symmetrics.de>
|
19 |
+
* @copyright 2010 symmetrics gmbh
|
20 |
+
* @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
|
21 |
+
* @link http://www.symmetrics.de/
|
22 |
+
*/
|
23 |
+
|
24 |
+
/**
|
25 |
+
* Symmetrics_CashTicket_Block_Adminhtml_Config_Grid
|
26 |
+
*
|
27 |
+
* @category Symmetrics
|
28 |
+
* @package Symmetrics_CashTicket
|
29 |
+
* @author symmetrics gmbh <info@symmetrics.de>
|
30 |
+
* @author Eugen Gitin <eg@symmetrics.de>
|
31 |
+
* @copyright 2010 symmetrics gmbh
|
32 |
+
* @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
|
33 |
+
* @link http://www.symmetrics.de/
|
34 |
+
*/
|
35 |
+
class Symmetrics_CashTicket_Block_Adminhtml_Config_Grid extends Mage_Adminhtml_Block_Widget_Grid
|
36 |
+
{
|
37 |
+
/**
|
38 |
+
* Prepare the grid
|
39 |
+
*
|
40 |
+
* @return void
|
41 |
+
*/
|
42 |
+
public function __construct()
|
43 |
+
{
|
44 |
+
parent::__construct();
|
45 |
+
|
46 |
+
$this->setId('cashticketGrid');
|
47 |
+
$this->setDefaultSort('currency_id');
|
48 |
+
$this->setDefaultDir('ASC');
|
49 |
+
$this->setSaveParametersInSession(true);
|
50 |
+
}
|
51 |
+
|
52 |
+
/**
|
53 |
+
* Get collection of config items
|
54 |
+
* and set it into the grid object
|
55 |
+
*
|
56 |
+
* @return string
|
57 |
+
*/
|
58 |
+
protected function _prepareCollection()
|
59 |
+
{
|
60 |
+
$collection = Mage::getModel('cashticket/item')->getCollection();
|
61 |
+
|
62 |
+
$this->setCollection($collection);
|
63 |
+
return parent::_prepareCollection();
|
64 |
+
}
|
65 |
+
|
66 |
+
/**
|
67 |
+
* Set grid columns
|
68 |
+
*
|
69 |
+
* @return object
|
70 |
+
*/
|
71 |
+
protected function _prepareColumns()
|
72 |
+
{
|
73 |
+
$this->addColumn(
|
74 |
+
'enable',
|
75 |
+
array(
|
76 |
+
'header' => Mage::helper('cashticket')->__('Enabled'),
|
77 |
+
'type' => 'options',
|
78 |
+
'index' => 'enable',
|
79 |
+
'sortable' => true,
|
80 |
+
'options' => array(
|
81 |
+
'1' => Mage::helper('cashticket')->__('Yes'),
|
82 |
+
'0' => Mage::helper('cashticket')->__('No')
|
83 |
+
),
|
84 |
+
'width' => '100px'
|
85 |
+
)
|
86 |
+
);
|
87 |
+
|
88 |
+
$this->addColumn(
|
89 |
+
'currency_code',
|
90 |
+
array(
|
91 |
+
'header' => Mage::helper('cashticket')->__('Currency'),
|
92 |
+
'type' => 'text',
|
93 |
+
'index' => 'currency_code',
|
94 |
+
'sortable' => true
|
95 |
+
)
|
96 |
+
);
|
97 |
+
|
98 |
+
$this->addColumn(
|
99 |
+
'merchant_id',
|
100 |
+
array(
|
101 |
+
'header' => Mage::helper('cashticket')->__('Merchant ID'),
|
102 |
+
'type' => 'text',
|
103 |
+
'index' => 'merchant_id',
|
104 |
+
'sortable' => true
|
105 |
+
)
|
106 |
+
);
|
107 |
+
|
108 |
+
$this->addColumn(
|
109 |
+
'sandbox',
|
110 |
+
array(
|
111 |
+
'header' => Mage::helper('cashticket')->__('Sanbox'),
|
112 |
+
'type' => 'options',
|
113 |
+
'index' => 'sandbox',
|
114 |
+
'sortable' => true,
|
115 |
+
'options' => array(
|
116 |
+
'1' => Mage::helper('cashticket')->__('Yes'),
|
117 |
+
'0' => Mage::helper('cashticket')->__('No')
|
118 |
+
),
|
119 |
+
'width' => '100px'
|
120 |
+
)
|
121 |
+
);
|
122 |
+
|
123 |
+
// add "edit" link into the action column
|
124 |
+
$this->addColumn(
|
125 |
+
'action',
|
126 |
+
array(
|
127 |
+
'header' => Mage::helper('cashticket')->__('Action'),
|
128 |
+
'type' => 'action',
|
129 |
+
'getter' => 'getId',
|
130 |
+
'actions' => array(array(
|
131 |
+
'caption' => Mage::helper('catalog')->__('Edit'),
|
132 |
+
'url' => array(
|
133 |
+
'base' => '*/*/edit'
|
134 |
+
),
|
135 |
+
'field' => 'id'
|
136 |
+
)),
|
137 |
+
'filter' => false,
|
138 |
+
'sortable' => false,
|
139 |
+
'index' => 'config',
|
140 |
+
'width' => '100px'
|
141 |
+
)
|
142 |
+
);
|
143 |
+
|
144 |
+
return parent::_prepareColumns();
|
145 |
+
}
|
146 |
+
|
147 |
+
/**
|
148 |
+
* Set the edit url
|
149 |
+
*
|
150 |
+
* @param object $row row
|
151 |
+
*
|
152 |
+
* @return string
|
153 |
+
*/
|
154 |
+
public function getRowUrl($row)
|
155 |
+
{
|
156 |
+
return $this->getUrl('*/*/edit', array('id' => $row->getId()));
|
157 |
+
}
|
158 |
+
}
|
app/code/community/Symmetrics/CashTicket/Block/Adminhtml/Config/Renderer.php
CHANGED
@@ -1,29 +1,58 @@
|
|
1 |
-
<?php
|
2 |
-
/**
|
3 |
-
*
|
4 |
-
*
|
5 |
-
*
|
6 |
-
*
|
7 |
-
*
|
8 |
-
|
9 |
-
|
10 |
-
|
11 |
-
|
12 |
-
|
13 |
-
|
14 |
-
|
15 |
-
|
16 |
-
|
17 |
-
|
18 |
-
|
19 |
-
|
20 |
-
|
21 |
-
|
22 |
-
|
23 |
-
|
24 |
-
|
25 |
-
|
26 |
-
|
27 |
-
|
28 |
-
|
29 |
-
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
1 |
+
<?php
|
2 |
+
/**
|
3 |
+
* Magento
|
4 |
+
*
|
5 |
+
* NOTICE OF LICENSE
|
6 |
+
*
|
7 |
+
* This source file is subject to the Open Software License (OSL 3.0)
|
8 |
+
* that is bundled with this package in the file LICENSE.txt.
|
9 |
+
* It is also available through the world-wide-web at this URL:
|
10 |
+
* http://opensource.org/licenses/osl-3.0.php
|
11 |
+
* If you did not receive a copy of the license and are unable to
|
12 |
+
* obtain it through the world-wide-web, please send an email
|
13 |
+
* to license@magentocommerce.com so we can send you a copy immediately.
|
14 |
+
*
|
15 |
+
* @category Symmetrics
|
16 |
+
* @package Symmetrics_CashTicket
|
17 |
+
* @author symmetrics gmbh <info@symmetrics.de>
|
18 |
+
* @author Eugen Gitin <eg@symmetrics.de>
|
19 |
+
* @copyright 2010 symmetrics gmbh
|
20 |
+
* @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
|
21 |
+
* @link http://www.symmetrics.de/
|
22 |
+
*/
|
23 |
+
|
24 |
+
/**
|
25 |
+
* Symmetrics_CashTicket_Block_Adminhtml_Config_Renderer
|
26 |
+
*
|
27 |
+
* @category Symmetrics
|
28 |
+
* @package Symmetrics_CashTicket
|
29 |
+
* @author symmetrics gmbh <info@symmetrics.de>
|
30 |
+
* @author Eugen Gitin <eg@symmetrics.de>
|
31 |
+
* @copyright 2010 symmetrics gmbh
|
32 |
+
* @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
|
33 |
+
* @link http://www.symmetrics.de/
|
34 |
+
*/
|
35 |
+
class Symmetrics_CashTicket_Block_Adminhtml_Config_Renderer
|
36 |
+
extends Mage_Adminhtml_Block_Widget_Grid_Column_Renderer_Abstract
|
37 |
+
{
|
38 |
+
/**
|
39 |
+
* Rendering of the grid column
|
40 |
+
*
|
41 |
+
* @param Varien_Object $row row
|
42 |
+
*
|
43 |
+
* @return string
|
44 |
+
*/
|
45 |
+
public function render(Varien_Object $row)
|
46 |
+
{
|
47 |
+
$values = array();
|
48 |
+
foreach (Mage::getModel('cashticket/item')->getSizeOptions() as $option) {
|
49 |
+
foreach ($option as $key => $val) {
|
50 |
+
if ($val['value'] == $row->getSize()) {
|
51 |
+
return $val['label'];
|
52 |
+
|
53 |
+
$values[$val['value']] = $val['label'];
|
54 |
+
}
|
55 |
+
}
|
56 |
+
}
|
57 |
+
}
|
58 |
+
}
|
app/code/community/Symmetrics/CashTicket/Block/Error.php
CHANGED
@@ -1,34 +1,60 @@
|
|
1 |
-
<?php
|
2 |
-
/**
|
3 |
-
*
|
4 |
-
*
|
5 |
-
*
|
6 |
-
*
|
7 |
-
*
|
8 |
-
|
9 |
-
|
10 |
-
|
11 |
-
|
12 |
-
|
13 |
-
|
14 |
-
|
15 |
-
|
16 |
-
|
17 |
-
|
18 |
-
|
19 |
-
|
20 |
-
|
21 |
-
|
22 |
-
|
23 |
-
|
24 |
-
|
25 |
-
|
26 |
-
|
27 |
-
|
28 |
-
|
29 |
-
|
30 |
-
|
31 |
-
|
32 |
-
|
33 |
-
|
34 |
-
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
1 |
+
<?php
|
2 |
+
/**
|
3 |
+
* Magento
|
4 |
+
*
|
5 |
+
* NOTICE OF LICENSE
|
6 |
+
*
|
7 |
+
* This source file is subject to the Open Software License (OSL 3.0)
|
8 |
+
* that is bundled with this package in the file LICENSE.txt.
|
9 |
+
* It is also available through the world-wide-web at this URL:
|
10 |
+
* http://opensource.org/licenses/osl-3.0.php
|
11 |
+
* If you did not receive a copy of the license and are unable to
|
12 |
+
* obtain it through the world-wide-web, please send an email
|
13 |
+
* to license@magentocommerce.com so we can send you a copy immediately.
|
14 |
+
*
|
15 |
+
* @category Symmetrics
|
16 |
+
* @package Symmetrics_CashTicket
|
17 |
+
* @author symmetrics gmbh <info@symmetrics.de>
|
18 |
+
* @author Eugen Gitin <eg@symmetrics.de>
|
19 |
+
* @copyright 2010 symmetrics gmbh
|
20 |
+
* @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
|
21 |
+
* @link http://www.symmetrics.de/
|
22 |
+
*/
|
23 |
+
|
24 |
+
/**
|
25 |
+
* Symmetrics_CashTicket_Block_Error
|
26 |
+
*
|
27 |
+
* @category Symmetrics
|
28 |
+
* @package Symmetrics_CashTicket
|
29 |
+
* @author symmetrics gmbh <info@symmetrics.de>
|
30 |
+
* @author Eugen Gitin <eg@symmetrics.de>
|
31 |
+
* @copyright 2010 symmetrics gmbh
|
32 |
+
* @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
|
33 |
+
* @link http://www.symmetrics.de/
|
34 |
+
*/
|
35 |
+
class Symmetrics_CashTicket_Block_Error extends Mage_Core_Block_Abstract
|
36 |
+
{
|
37 |
+
/**
|
38 |
+
* This block is shown when the customer
|
39 |
+
* cancels the payment process from
|
40 |
+
* CashTicket page
|
41 |
+
*
|
42 |
+
* @return string
|
43 |
+
*/
|
44 |
+
protected function _toHtml()
|
45 |
+
{
|
46 |
+
$url = Mage::getUrl('checkout/onepage');
|
47 |
+
|
48 |
+
$html = '';
|
49 |
+
$message = 'Cash-Ticket payment was canceled. Redirecting to checkout...';
|
50 |
+
$html .= '<p>' . Mage::helper('cashticket')->__($message) . '</p>';
|
51 |
+
$html .= '<p><a href="' . $url . '">';
|
52 |
+
$html .= Mage::helper('cashticket')->__('Click here to return to checkout') . '</a></p>';
|
53 |
+
|
54 |
+
$html .= '<script language="javascript">';
|
55 |
+
$html .= 'document.location.href="' . $url . '";';
|
56 |
+
$html .= '</script>';
|
57 |
+
|
58 |
+
return $html;
|
59 |
+
}
|
60 |
+
}
|
app/code/community/Symmetrics/CashTicket/Block/Form.php
CHANGED
@@ -1,23 +1,48 @@
|
|
1 |
-
<?php
|
2 |
-
/**
|
3 |
-
*
|
4 |
-
*
|
5 |
-
*
|
6 |
-
*
|
7 |
-
*
|
8 |
-
|
9 |
-
|
10 |
-
|
11 |
-
|
12 |
-
|
13 |
-
|
14 |
-
|
15 |
-
|
16 |
-
|
17 |
-
|
18 |
-
|
19 |
-
|
20 |
-
|
21 |
-
|
22 |
-
|
23 |
-
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
1 |
+
<?php
|
2 |
+
/**
|
3 |
+
* Magento
|
4 |
+
*
|
5 |
+
* NOTICE OF LICENSE
|
6 |
+
*
|
7 |
+
* This source file is subject to the Open Software License (OSL 3.0)
|
8 |
+
* that is bundled with this package in the file LICENSE.txt.
|
9 |
+
* It is also available through the world-wide-web at this URL:
|
10 |
+
* http://opensource.org/licenses/osl-3.0.php
|
11 |
+
* If you did not receive a copy of the license and are unable to
|
12 |
+
* obtain it through the world-wide-web, please send an email
|
13 |
+
* to license@magentocommerce.com so we can send you a copy immediately.
|
14 |
+
*
|
15 |
+
* @category Symmetrics
|
16 |
+
* @package Symmetrics_CashTicket
|
17 |
+
* @author symmetrics gmbh <info@symmetrics.de>
|
18 |
+
* @author Eugen Gitin <eg@symmetrics.de>
|
19 |
+
* @copyright 2010 symmetrics gmbh
|
20 |
+
* @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
|
21 |
+
* @link http://www.symmetrics.de/
|
22 |
+
*/
|
23 |
+
|
24 |
+
/**
|
25 |
+
* Symmetrics_CashTicket_Block_Form
|
26 |
+
*
|
27 |
+
* @category Symmetrics
|
28 |
+
* @package Symmetrics_CashTicket
|
29 |
+
* @author symmetrics gmbh <info@symmetrics.de>
|
30 |
+
* @author Eugen Gitin <eg@symmetrics.de>
|
31 |
+
* @copyright 2010 symmetrics gmbh
|
32 |
+
* @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
|
33 |
+
* @link http://www.symmetrics.de/
|
34 |
+
*/
|
35 |
+
class Symmetrics_CashTicket_Block_Form extends Mage_Payment_Block_Form
|
36 |
+
{
|
37 |
+
/**
|
38 |
+
* Set template for payment info
|
39 |
+
* below the radio selector
|
40 |
+
*
|
41 |
+
* @return object
|
42 |
+
*/
|
43 |
+
protected function _construct()
|
44 |
+
{
|
45 |
+
parent::_construct();
|
46 |
+
$this->setTemplate('cashticket/form.phtml');
|
47 |
+
}
|
48 |
+
}
|
app/code/community/Symmetrics/CashTicket/Block/Info.php
CHANGED
@@ -1,124 +1,156 @@
|
|
1 |
-
<?php
|
2 |
-
/**
|
3 |
-
*
|
4 |
-
*
|
5 |
-
*
|
6 |
-
*
|
7 |
-
*
|
8 |
-
|
9 |
-
|
10 |
-
|
11 |
-
|
12 |
-
|
13 |
-
|
14 |
-
|
15 |
-
|
16 |
-
|
17 |
-
|
18 |
-
|
19 |
-
|
20 |
-
|
21 |
-
|
22 |
-
|
23 |
-
|
24 |
-
|
25 |
-
|
26 |
-
|
27 |
-
|
28 |
-
|
29 |
-
|
30 |
-
|
31 |
-
|
32 |
-
|
33 |
-
|
34 |
-
|
35 |
-
|
36 |
-
|
37 |
-
|
38 |
-
|
39 |
-
|
40 |
-
*
|
41 |
-
|
42 |
-
|
43 |
-
|
44 |
-
|
45 |
-
|
46 |
-
|
47 |
-
|
48 |
-
|
49 |
-
|
50 |
-
|
51 |
-
|
52 |
-
|
53 |
-
|
54 |
-
|
55 |
-
*
|
56 |
-
*
|
57 |
-
|
58 |
-
|
59 |
-
|
60 |
-
|
61 |
-
|
62 |
-
|
63 |
-
|
64 |
-
|
65 |
-
|
66 |
-
|
67 |
-
|
68 |
-
|
69 |
-
|
70 |
-
|
71 |
-
|
72 |
-
|
73 |
-
|
74 |
-
|
75 |
-
|
76 |
-
|
77 |
-
|
78 |
-
|
79 |
-
|
80 |
-
|
81 |
-
|
82 |
-
|
83 |
-
|
84 |
-
|
85 |
-
|
86 |
-
|
87 |
-
|
88 |
-
|
89 |
-
|
90 |
-
|
91 |
-
|
92 |
-
|
93 |
-
|
94 |
-
|
95 |
-
|
96 |
-
|
97 |
-
|
98 |
-
|
99 |
-
|
100 |
-
|
101 |
-
|
102 |
-
|
103 |
-
|
104 |
-
|
105 |
-
|
106 |
-
|
107 |
-
|
108 |
-
|
109 |
-
}
|
110 |
-
|
111 |
-
|
112 |
-
|
113 |
-
|
114 |
-
|
115 |
-
|
116 |
-
|
117 |
-
|
118 |
-
|
119 |
-
|
120 |
-
|
121 |
-
|
122 |
-
|
123 |
-
|
124 |
-
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
1 |
+
<?php
|
2 |
+
/**
|
3 |
+
* Magento
|
4 |
+
*
|
5 |
+
* NOTICE OF LICENSE
|
6 |
+
*
|
7 |
+
* This source file is subject to the Open Software License (OSL 3.0)
|
8 |
+
* that is bundled with this package in the file LICENSE.txt.
|
9 |
+
* It is also available through the world-wide-web at this URL:
|
10 |
+
* http://opensource.org/licenses/osl-3.0.php
|
11 |
+
* If you did not receive a copy of the license and are unable to
|
12 |
+
* obtain it through the world-wide-web, please send an email
|
13 |
+
* to license@magentocommerce.com so we can send you a copy immediately.
|
14 |
+
*
|
15 |
+
* @category Symmetrics
|
16 |
+
* @package Symmetrics_CashTicket
|
17 |
+
* @author symmetrics gmbh <info@symmetrics.de>
|
18 |
+
* @author Eugen Gitin <eg@symmetrics.de>
|
19 |
+
* @copyright 2010 symmetrics gmbh
|
20 |
+
* @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
|
21 |
+
* @link http://www.symmetrics.de/
|
22 |
+
*/
|
23 |
+
|
24 |
+
/**
|
25 |
+
* Symmetrics_CashTicket_Block_Info
|
26 |
+
*
|
27 |
+
* @category Symmetrics
|
28 |
+
* @package Symmetrics_CashTicket
|
29 |
+
* @author symmetrics gmbh <info@symmetrics.de>
|
30 |
+
* @author Eugen Gitin <eg@symmetrics.de>
|
31 |
+
* @copyright 2010 symmetrics gmbh
|
32 |
+
* @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
|
33 |
+
* @link http://www.symmetrics.de/
|
34 |
+
*/
|
35 |
+
class Symmetrics_CashTicket_Block_Info extends Mage_Payment_Block_Info
|
36 |
+
{
|
37 |
+
/**
|
38 |
+
* Result of the API call
|
39 |
+
*
|
40 |
+
* @var object
|
41 |
+
*/
|
42 |
+
protected $_response;
|
43 |
+
|
44 |
+
/**
|
45 |
+
* API object
|
46 |
+
*
|
47 |
+
* @var object
|
48 |
+
*/
|
49 |
+
protected $_api;
|
50 |
+
|
51 |
+
/**
|
52 |
+
* Set template for payment info
|
53 |
+
* on the right side of the
|
54 |
+
* checkout page
|
55 |
+
*
|
56 |
+
* @return void
|
57 |
+
*/
|
58 |
+
protected function _construct()
|
59 |
+
{
|
60 |
+
parent::_construct();
|
61 |
+
$this->setTemplate('cashticket/info.phtml');
|
62 |
+
}
|
63 |
+
|
64 |
+
/**
|
65 |
+
* Get the API object
|
66 |
+
*
|
67 |
+
* @param int $transactionId transactionId
|
68 |
+
*
|
69 |
+
* @return object
|
70 |
+
*/
|
71 |
+
public function getApi($transactionId)
|
72 |
+
{
|
73 |
+
if (is_null($this->_api)) {
|
74 |
+
$cashticketModel = Mage::getModel('cashticket/cashticket');
|
75 |
+
$this->_api = $cashticketModel->getApi($transactionId);
|
76 |
+
$this->_api->setOrder($this->getInfo()->getOrder());
|
77 |
+
}
|
78 |
+
return $this->_api;
|
79 |
+
}
|
80 |
+
|
81 |
+
/**
|
82 |
+
* Get disposition state from Cash-Ticket
|
83 |
+
* and set the response for later use
|
84 |
+
*
|
85 |
+
* @return object
|
86 |
+
*/
|
87 |
+
public function callGetSerialNumbers()
|
88 |
+
{
|
89 |
+
if (is_null($this->_response)) {
|
90 |
+
$this->_response = $this->_api->call('GetSerialNumbers', array());
|
91 |
+
|
92 |
+
if ($this->_response->errCode != '0') {
|
93 |
+
Mage::throwException(Mage::helper('cashticket')->__('Error getting Cash-Ticket status.'));
|
94 |
+
return $this;
|
95 |
+
}
|
96 |
+
}
|
97 |
+
return $this->_response;
|
98 |
+
}
|
99 |
+
|
100 |
+
/**
|
101 |
+
* Map status codes to strings
|
102 |
+
*
|
103 |
+
* @return string
|
104 |
+
*/
|
105 |
+
public function getPaymentStatus()
|
106 |
+
{
|
107 |
+
if (is_null($this->_response)) {
|
108 |
+
return $this;
|
109 |
+
}
|
110 |
+
|
111 |
+
switch ($this->_response->TransactionState) {
|
112 |
+
case 'R':
|
113 |
+
$status = $this->helper('cashticket')->__('Created (R)');
|
114 |
+
break;
|
115 |
+
case 'S':
|
116 |
+
$status = $this->helper('cashticket')->__('Disposed (S)');
|
117 |
+
break;
|
118 |
+
case 'E':
|
119 |
+
$status = $this->helper('cashticket')->__('Debited (E)');
|
120 |
+
break;
|
121 |
+
case 'O':
|
122 |
+
$status = $this->helper('cashticket')->__('Consumed (O)');
|
123 |
+
break;
|
124 |
+
case 'L':
|
125 |
+
$status = $this->helper('cashticket')->__('Canceled (L)');
|
126 |
+
break;
|
127 |
+
case 'I':
|
128 |
+
$status = $this->helper('cashticket')->__('Invalid (I)');
|
129 |
+
break;
|
130 |
+
case 'X':
|
131 |
+
$status = $this->helper('cashticket')->__('Expired (X)');
|
132 |
+
break;
|
133 |
+
default:
|
134 |
+
$message = Mage::helper('cashticket')->__('Unknown status (%s)', $this->_response->TransactionState);
|
135 |
+
$status = $this->helper('cashticket')->__($message);
|
136 |
+
break;
|
137 |
+
}
|
138 |
+
|
139 |
+
return $status;
|
140 |
+
}
|
141 |
+
|
142 |
+
/**
|
143 |
+
* Get status codes allowed to
|
144 |
+
* continue transactions and debiting
|
145 |
+
*
|
146 |
+
* @return array
|
147 |
+
*/
|
148 |
+
public function getAllowedStats()
|
149 |
+
{
|
150 |
+
return array(
|
151 |
+
'R',
|
152 |
+
'S',
|
153 |
+
'E'
|
154 |
+
);
|
155 |
+
}
|
156 |
+
}
|
app/code/community/Symmetrics/CashTicket/Helper/Data.php
CHANGED
@@ -1,13 +1,37 @@
|
|
1 |
-
<?php
|
2 |
-
/**
|
3 |
-
*
|
4 |
-
*
|
5 |
-
*
|
6 |
-
*
|
7 |
-
*
|
8 |
-
|
9 |
-
|
10 |
-
|
11 |
-
|
12 |
-
|
13 |
-
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
1 |
+
<?php
|
2 |
+
/**
|
3 |
+
* Magento
|
4 |
+
*
|
5 |
+
* NOTICE OF LICENSE
|
6 |
+
*
|
7 |
+
* This source file is subject to the Open Software License (OSL 3.0)
|
8 |
+
* that is bundled with this package in the file LICENSE.txt.
|
9 |
+
* It is also available through the world-wide-web at this URL:
|
10 |
+
* http://opensource.org/licenses/osl-3.0.php
|
11 |
+
* If you did not receive a copy of the license and are unable to
|
12 |
+
* obtain it through the world-wide-web, please send an email
|
13 |
+
* to license@magentocommerce.com so we can send you a copy immediately.
|
14 |
+
*
|
15 |
+
* @category Symmetrics
|
16 |
+
* @package Symmetrics_CashTicket
|
17 |
+
* @author symmetrics gmbh <info@symmetrics.de>
|
18 |
+
* @author Eugen Gitin <eg@symmetrics.de>
|
19 |
+
* @copyright 2010 symmetrics gmbh
|
20 |
+
* @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
|
21 |
+
* @link http://www.symmetrics.de/
|
22 |
+
*/
|
23 |
+
|
24 |
+
/**
|
25 |
+
* Symmetrics_CashTicket_Helper_Data
|
26 |
+
*
|
27 |
+
* @category Symmetrics
|
28 |
+
* @package Symmetrics_CashTicket
|
29 |
+
* @author symmetrics gmbh <info@symmetrics.de>
|
30 |
+
* @author Eugen Gitin <eg@symmetrics.de>
|
31 |
+
* @copyright 2010 symmetrics gmbh
|
32 |
+
* @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
|
33 |
+
* @link http://www.symmetrics.de/
|
34 |
+
*/
|
35 |
+
class Symmetrics_CashTicket_Helper_Data extends Mage_Core_Helper_Abstract
|
36 |
+
{
|
37 |
+
}
|
app/code/community/Symmetrics/CashTicket/Model/Api.php
CHANGED
@@ -1,13 +1,38 @@
|
|
1 |
Â
<?php
|
2 |
Â
/**
|
3 |
-
*
|
4 |
-
*
|
5 |
-
*
|
6 |
-
*
|
7 |
-
*
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
8 |
Â
*/
|
9 |
Â
|
10 |
-
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
11 |
Â
{
|
12 |
Â
/**
|
13 |
Â
* Id of the Cash-Ticket transaction
|
@@ -41,6 +66,9 @@ class Symmetrics_CashTicket_Model_Api extends Varien_Http_Adapter_Curl
|
|
41 |
Â
* Main method for calling API functions
|
42 |
Â
* on Cash-Ticket
|
43 |
Â
*
|
Â
|
|
Â
|
|
Â
|
|
44 |
Â
* @return object
|
45 |
Â
*/
|
46 |
Â
public function call($functionName, array $params)
|
@@ -48,26 +76,35 @@ class Symmetrics_CashTicket_Model_Api extends Varien_Http_Adapter_Curl
|
|
48 |
Â
$callParams = '';
|
49 |
Â
|
50 |
Â
// merge set params with standard params
|
51 |
-
$params = array_merge(
|
52 |
-
|
53 |
-
|
54 |
-
|
55 |
-
|
56 |
-
|
57 |
-
|
58 |
-
|
59 |
-
|
60 |
-
|
61 |
-
|
Â
|
|
Â
|
|
Â
|
|
62 |
Â
|
63 |
Â
// format params for curl
|
64 |
Â
foreach ($params as $key => $value) {
|
65 |
-
$callParams .= '&'
|
66 |
Â
}
|
67 |
Â
|
68 |
Â
try {
|
69 |
Â
// do curl post
|
70 |
-
$this->write(
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
71 |
Â
|
72 |
Â
// read response and convert it to XML
|
73 |
Â
$response = $this->read();
|
@@ -83,23 +120,29 @@ class Symmetrics_CashTicket_Model_Api extends Varien_Http_Adapter_Curl
|
|
83 |
Â
/**
|
84 |
Â
* Writing a method to curl api
|
85 |
Â
*
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
86 |
Â
* @return string
|
87 |
Â
*/
|
88 |
-
public function write($method, $url, $
|
89 |
Â
{
|
90 |
Â
// get keyring password
|
91 |
Â
$sslpass = $this->getConfigValue('sslcert_pass');
|
92 |
Â
|
93 |
Â
// can not process if no keyring password is set
|
94 |
Â
if (empty($sslpass)) {
|
95 |
-
|
Â
|
|
96 |
Â
}
|
97 |
Â
// if testing
|
98 |
Â
if ($this->isSandbox()) {
|
99 |
Â
// set PEM certificate of the test server
|
100 |
Â
$pemCert = Mage::getBaseDir() . $this->getConfigValue('path_pem_test');
|
101 |
-
}
|
102 |
-
else {
|
103 |
Â
// set PEM certificate of the live server
|
104 |
Â
$pemCert = Mage::getBaseDir() . $this->getConfigValue('path_pem_live');
|
105 |
Â
}
|
@@ -138,6 +181,7 @@ class Symmetrics_CashTicket_Model_Api extends Varien_Http_Adapter_Curl
|
|
138 |
Â
public function read()
|
139 |
Â
{
|
140 |
Â
$response = curl_exec($this->_getResource());
|
Â
|
|
141 |
Â
return $response;
|
142 |
Â
}
|
143 |
Â
|
@@ -153,6 +197,7 @@ class Symmetrics_CashTicket_Model_Api extends Varien_Http_Adapter_Curl
|
|
153 |
Â
// return URL for the testing server
|
154 |
Â
return $this->getDefaultConfigValue('url_test');
|
155 |
Â
}
|
Â
|
|
156 |
Â
// otherwise return live URL
|
157 |
Â
return $this->getDefaultConfigValue('url_live');
|
158 |
Â
}
|
@@ -161,6 +206,8 @@ class Symmetrics_CashTicket_Model_Api extends Varien_Http_Adapter_Curl
|
|
161 |
Â
* Get URL to redirect the customer
|
162 |
Â
* after finishing the order
|
163 |
Â
*
|
Â
|
|
Â
|
|
164 |
Â
* @return string
|
165 |
Â
*/
|
166 |
Â
public function getCustomerRedirectUrl(array $params)
|
@@ -169,8 +216,7 @@ class Symmetrics_CashTicket_Model_Api extends Varien_Http_Adapter_Curl
|
|
169 |
Â
if ($this->isSandbox()) {
|
170 |
Â
// get test url
|
171 |
Â
$url = $this->getDefaultConfigValue('customer_url_test');
|
172 |
-
}
|
173 |
-
else {
|
174 |
Â
// get live url
|
175 |
Â
$url = $this->getDefaultConfigValue('customer_url_live');
|
176 |
Â
}
|
@@ -179,12 +225,15 @@ class Symmetrics_CashTicket_Model_Api extends Varien_Http_Adapter_Curl
|
|
179 |
Â
$urlParams = '';
|
180 |
Â
|
181 |
Â
// merge set and standard params
|
182 |
-
$params = array_merge(
|
183 |
-
|
184 |
-
|
185 |
-
|
186 |
-
|
187 |
-
|
Â
|
|
Â
|
|
Â
|
|
188 |
Â
|
189 |
Â
// format params for curl call
|
190 |
Â
foreach ($params as $key => $value) {
|
@@ -197,6 +246,8 @@ class Symmetrics_CashTicket_Model_Api extends Varien_Http_Adapter_Curl
|
|
197 |
Â
/**
|
198 |
Â
* Set transactionId
|
199 |
Â
*
|
Â
|
|
Â
|
|
200 |
Â
* @return void
|
201 |
Â
*/
|
202 |
Â
public function setTransactionId($id)
|
@@ -217,6 +268,8 @@ class Symmetrics_CashTicket_Model_Api extends Varien_Http_Adapter_Curl
|
|
217 |
Â
/**
|
218 |
Â
* Set order
|
219 |
Â
*
|
Â
|
|
Â
|
|
220 |
Â
* @return void
|
221 |
Â
*/
|
222 |
Â
public function setOrder($order)
|
@@ -248,14 +301,14 @@ class Symmetrics_CashTicket_Model_Api extends Varien_Http_Adapter_Curl
|
|
248 |
Â
// configuration and set the flag for this api instance
|
249 |
Â
if ($this->getConfigValue('sandbox')) {
|
250 |
Â
$this->_sandbox = true;
|
251 |
-
}
|
252 |
-
else {
|
253 |
Â
$this->_sandbox = false;
|
254 |
Â
}
|
255 |
Â
}
|
256 |
Â
if ($this->_sandbox == true) {
|
257 |
Â
return true;
|
258 |
Â
}
|
Â
|
|
259 |
Â
return false;
|
260 |
Â
}
|
261 |
Â
|
@@ -263,6 +316,8 @@ class Symmetrics_CashTicket_Model_Api extends Varien_Http_Adapter_Curl
|
|
263 |
Â
* Get value from active configuration
|
264 |
Â
* for current currency
|
265 |
Â
*
|
Â
|
|
Â
|
|
266 |
Â
* @return string
|
267 |
Â
*/
|
268 |
Â
public function getConfigValue($key)
|
@@ -284,17 +339,16 @@ class Symmetrics_CashTicket_Model_Api extends Varien_Http_Adapter_Curl
|
|
284 |
Â
// if more then 1 active configuration found ..
|
285 |
Â
if ($collection->getSize() > 1) {
|
286 |
Â
// throw error
|
287 |
-
|
Â
|
|
288 |
Â
}
|
289 |
Â
// set the config with loaded data
|
290 |
Â
$this->_config = $model->getConfigItem($this->getCurrency());
|
291 |
Â
$value = $this->_config[$key];
|
292 |
-
|
293 |
-
|
294 |
-
elseif (is_array($config)) {
|
295 |
Â
$value = $config[$key];
|
296 |
-
}
|
297 |
-
else {
|
298 |
Â
$value = null;
|
299 |
Â
}
|
300 |
Â
} catch (Exception $e) {
|
@@ -308,6 +362,8 @@ class Symmetrics_CashTicket_Model_Api extends Varien_Http_Adapter_Curl
|
|
308 |
Â
/**
|
309 |
Â
* Get configuration from XML
|
310 |
Â
*
|
Â
|
|
Â
|
|
311 |
Â
* @return string
|
312 |
Â
*/
|
313 |
Â
public function getDefaultConfigValue($key)
|
@@ -346,6 +402,8 @@ class Symmetrics_CashTicket_Model_Api extends Varien_Http_Adapter_Curl
|
|
346 |
Â
/**
|
347 |
Â
* Format price for Cash-Ticket (format 0.00)
|
348 |
Â
*
|
Â
|
|
Â
|
|
349 |
Â
* @return string
|
350 |
Â
*/
|
351 |
Â
public function formatPrice($amount)
|
@@ -354,4 +412,4 @@ class Symmetrics_CashTicket_Model_Api extends Varien_Http_Adapter_Curl
|
|
354 |
Â
$formatted = sprintf('%.2f', $formatted);
|
355 |
Â
return $formatted;
|
356 |
Â
}
|
357 |
-
}
|
1 |
Â
<?php
|
2 |
Â
/**
|
3 |
+
* Magento
|
4 |
+
*
|
5 |
+
* NOTICE OF LICENSE
|
6 |
+
*
|
7 |
+
* This source file is subject to the Open Software License (OSL 3.0)
|
8 |
+
* that is bundled with this package in the file LICENSE.txt.
|
9 |
+
* It is also available through the world-wide-web at this URL:
|
10 |
+
* http://opensource.org/licenses/osl-3.0.php
|
11 |
+
* If you did not receive a copy of the license and are unable to
|
12 |
+
* obtain it through the world-wide-web, please send an email
|
13 |
+
* to license@magentocommerce.com so we can send you a copy immediately.
|
14 |
+
*
|
15 |
+
* @category Symmetrics
|
16 |
+
* @package Symmetrics_CashTicket
|
17 |
+
* @author symmetrics gmbh <info@symmetrics.de>
|
18 |
+
* @author Eugen Gitin <eg@symmetrics.de>
|
19 |
+
* @copyright 2010 symmetrics gmbh
|
20 |
+
* @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
|
21 |
+
* @link http://www.symmetrics.de/
|
22 |
Â
*/
|
23 |
Â
|
24 |
+
/**
|
25 |
+
* Symmetrics_CashTicket_Model_Api
|
26 |
+
*
|
27 |
+
* @category Symmetrics
|
28 |
+
* @package Symmetrics_CashTicket
|
29 |
+
* @author symmetrics gmbh <info@symmetrics.de>
|
30 |
+
* @author Eugen Gitin <eg@symmetrics.de>
|
31 |
+
* @copyright 2010 symmetrics gmbh
|
32 |
+
* @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
|
33 |
+
* @link http://www.symmetrics.de/
|
34 |
+
*/
|
35 |
+
class Symmetrics_CashTicket_Model_Api extends Varien_Http_Adapter_Curl
|
36 |
Â
{
|
37 |
Â
/**
|
38 |
Â
* Id of the Cash-Ticket transaction
|
66 |
Â
* Main method for calling API functions
|
67 |
Â
* on Cash-Ticket
|
68 |
Â
*
|
69 |
+
* @param string $functionName Function name
|
70 |
+
* @param array $params Params
|
71 |
+
*
|
72 |
Â
* @return object
|
73 |
Â
*/
|
74 |
Â
public function call($functionName, array $params)
|
76 |
Â
$callParams = '';
|
77 |
Â
|
78 |
Â
// merge set params with standard params
|
79 |
+
$params = array_merge(
|
80 |
+
array(
|
81 |
+
'currency' => $this->getConfigValue('currency_code'),
|
82 |
+
'mid' => $this->getConfigValue('merchant_id'),
|
83 |
+
'businesstype' => $this->getConfigValue('business_type'),
|
84 |
+
'reportingcriteria' => $this->getConfigValue('reporting_criteria'),
|
85 |
+
'okurl' => Mage::getUrl('cashticket/processing/success'),
|
86 |
+
'nokurl' => Mage::getUrl('cashticket/processing/error'),
|
87 |
+
'locale' => $this->getConfigValue('locale'),
|
88 |
+
'outputFormat' => 'xml_v1',
|
89 |
+
'mtid' => $this->getTransactionId()
|
90 |
+
),
|
91 |
+
$params
|
92 |
+
);
|
93 |
Â
|
94 |
Â
// format params for curl
|
95 |
Â
foreach ($params as $key => $value) {
|
96 |
+
$callParams .= '&' . $key . '=' . urlencode($value);
|
97 |
Â
}
|
98 |
Â
|
99 |
Â
try {
|
100 |
Â
// do curl post
|
101 |
+
$this->write(
|
102 |
+
Zend_Http_Client::POST,
|
103 |
+
$this->getCashTicketUrl() . $functionName . 'Servlet',
|
104 |
+
'1.1',
|
105 |
+
array(),
|
106 |
+
$callParams
|
107 |
+
);
|
108 |
Â
|
109 |
Â
// read response and convert it to XML
|
110 |
Â
$response = $this->read();
|
120 |
Â
/**
|
121 |
Â
* Writing a method to curl api
|
122 |
Â
*
|
123 |
+
* @param string $method Method
|
124 |
+
* @param string $url Url
|
125 |
+
* @param string $httpVer httpVer
|
126 |
+
* @param array $headers Headers
|
127 |
+
* @param string $body Body
|
128 |
+
*
|
129 |
Â
* @return string
|
130 |
Â
*/
|
131 |
+
public function write($method, $url, $httpVer = '1.1', $headers = array(), $body = '')
|
132 |
Â
{
|
133 |
Â
// get keyring password
|
134 |
Â
$sslpass = $this->getConfigValue('sslcert_pass');
|
135 |
Â
|
136 |
Â
// can not process if no keyring password is set
|
137 |
Â
if (empty($sslpass)) {
|
138 |
+
$message = 'SSL Certificate Password is empty. Please set the passwort in the configuration settings.';
|
139 |
+
Mage::throwException(Mage::helper('cashticket')->__($message));
|
140 |
Â
}
|
141 |
Â
// if testing
|
142 |
Â
if ($this->isSandbox()) {
|
143 |
Â
// set PEM certificate of the test server
|
144 |
Â
$pemCert = Mage::getBaseDir() . $this->getConfigValue('path_pem_test');
|
145 |
+
} else {
|
Â
|
|
146 |
Â
// set PEM certificate of the live server
|
147 |
Â
$pemCert = Mage::getBaseDir() . $this->getConfigValue('path_pem_live');
|
148 |
Â
}
|
181 |
Â
public function read()
|
182 |
Â
{
|
183 |
Â
$response = curl_exec($this->_getResource());
|
184 |
+
|
185 |
Â
return $response;
|
186 |
Â
}
|
187 |
Â
|
197 |
Â
// return URL for the testing server
|
198 |
Â
return $this->getDefaultConfigValue('url_test');
|
199 |
Â
}
|
200 |
+
|
201 |
Â
// otherwise return live URL
|
202 |
Â
return $this->getDefaultConfigValue('url_live');
|
203 |
Â
}
|
206 |
Â
* Get URL to redirect the customer
|
207 |
Â
* after finishing the order
|
208 |
Â
*
|
209 |
+
* @param array $params Params
|
210 |
+
*
|
211 |
Â
* @return string
|
212 |
Â
*/
|
213 |
Â
public function getCustomerRedirectUrl(array $params)
|
216 |
Â
if ($this->isSandbox()) {
|
217 |
Â
// get test url
|
218 |
Â
$url = $this->getDefaultConfigValue('customer_url_test');
|
219 |
+
} else {
|
Â
|
|
220 |
Â
// get live url
|
221 |
Â
$url = $this->getDefaultConfigValue('customer_url_live');
|
222 |
Â
}
|
225 |
Â
$urlParams = '';
|
226 |
Â
|
227 |
Â
// merge set and standard params
|
228 |
+
$params = array_merge(
|
229 |
+
array(
|
230 |
+
'currency' => $this->getConfigValue('currency_code'),
|
231 |
+
'mid' => $this->getConfigValue('merchant_id'),
|
232 |
+
'locale' => $this->getConfigValue('locale'),
|
233 |
+
'mtid' => $this->getTransactionId()
|
234 |
+
),
|
235 |
+
$params
|
236 |
+
);
|
237 |
Â
|
238 |
Â
// format params for curl call
|
239 |
Â
foreach ($params as $key => $value) {
|
246 |
Â
/**
|
247 |
Â
* Set transactionId
|
248 |
Â
*
|
249 |
+
* @param int $id Id
|
250 |
+
*
|
251 |
Â
* @return void
|
252 |
Â
*/
|
253 |
Â
public function setTransactionId($id)
|
268 |
Â
/**
|
269 |
Â
* Set order
|
270 |
Â
*
|
271 |
+
* @param object $order Order object
|
272 |
+
*
|
273 |
Â
* @return void
|
274 |
Â
*/
|
275 |
Â
public function setOrder($order)
|
301 |
Â
// configuration and set the flag for this api instance
|
302 |
Â
if ($this->getConfigValue('sandbox')) {
|
303 |
Â
$this->_sandbox = true;
|
304 |
+
} else {
|
Â
|
|
305 |
Â
$this->_sandbox = false;
|
306 |
Â
}
|
307 |
Â
}
|
308 |
Â
if ($this->_sandbox == true) {
|
309 |
Â
return true;
|
310 |
Â
}
|
311 |
+
|
312 |
Â
return false;
|
313 |
Â
}
|
314 |
Â
|
316 |
Â
* Get value from active configuration
|
317 |
Â
* for current currency
|
318 |
Â
*
|
319 |
+
* @param string $key Key
|
320 |
+
*
|
321 |
Â
* @return string
|
322 |
Â
*/
|
323 |
Â
public function getConfigValue($key)
|
339 |
Â
// if more then 1 active configuration found ..
|
340 |
Â
if ($collection->getSize() > 1) {
|
341 |
Â
// throw error
|
342 |
+
$errorMessage = 'Multiply active configuration for this currency.';
|
343 |
+
Mage::throwException(Mage::helper('cashticket')->__($errorMessage));
|
344 |
Â
}
|
345 |
Â
// set the config with loaded data
|
346 |
Â
$this->_config = $model->getConfigItem($this->getCurrency());
|
347 |
Â
$value = $this->_config[$key];
|
348 |
+
// if already set - load from model
|
349 |
+
} elseif (is_array($config)) {
|
Â
|
|
350 |
Â
$value = $config[$key];
|
351 |
+
} else {
|
Â
|
|
352 |
Â
$value = null;
|
353 |
Â
}
|
354 |
Â
} catch (Exception $e) {
|
362 |
Â
/**
|
363 |
Â
* Get configuration from XML
|
364 |
Â
*
|
365 |
+
* @param string $key key
|
366 |
+
*
|
367 |
Â
* @return string
|
368 |
Â
*/
|
369 |
Â
public function getDefaultConfigValue($key)
|
402 |
Â
/**
|
403 |
Â
* Format price for Cash-Ticket (format 0.00)
|
404 |
Â
*
|
405 |
+
* @param string $amount Amount
|
406 |
+
*
|
407 |
Â
* @return string
|
408 |
Â
*/
|
409 |
Â
public function formatPrice($amount)
|
412 |
Â
$formatted = sprintf('%.2f', $formatted);
|
413 |
Â
return $formatted;
|
414 |
Â
}
|
415 |
+
}
|
app/code/community/Symmetrics/CashTicket/Model/Cashticket.php
CHANGED
@@ -1,237 +1,277 @@
|
|
1 |
-
<?php
|
2 |
-
/**
|
3 |
-
*
|
4 |
-
*
|
5 |
-
*
|
6 |
-
*
|
7 |
-
*
|
8 |
-
|
9 |
-
|
10 |
-
|
11 |
-
|
12 |
-
|
13 |
-
|
14 |
-
|
15 |
-
|
16 |
-
|
17 |
-
|
18 |
-
|
19 |
-
|
20 |
-
|
21 |
-
|
22 |
-
|
23 |
-
|
24 |
-
|
25 |
-
|
26 |
-
|
27 |
-
|
28 |
-
|
29 |
-
|
30 |
-
|
31 |
-
|
32 |
-
|
33 |
-
|
34 |
-
|
35 |
-
|
36 |
-
|
37 |
-
|
38 |
-
|
39 |
-
|
40 |
-
|
41 |
-
|
42 |
-
|
43 |
-
|
44 |
-
|
45 |
-
|
46 |
-
|
47 |
-
|
48 |
-
|
49 |
-
|
50 |
-
|
51 |
-
|
52 |
-
|
53 |
-
|
54 |
-
|
55 |
-
|
56 |
-
|
57 |
-
|
58 |
-
|
59 |
-
|
60 |
-
|
61 |
-
|
62 |
-
|
63 |
-
|
64 |
-
|
65 |
-
|
66 |
-
|
67 |
-
|
68 |
-
|
69 |
-
|
70 |
-
|
71 |
-
|
72 |
-
|
73 |
-
|
74 |
-
|
75 |
-
|
76 |
-
|
77 |
-
|
78 |
-
|
79 |
-
|
80 |
-
|
81 |
-
|
82 |
-
|
83 |
-
|
84 |
-
|
85 |
-
|
86 |
-
|
87 |
-
|
88 |
-
|
89 |
-
|
90 |
-
|
91 |
-
|
92 |
-
|
93 |
-
|
94 |
-
|
95 |
-
|
96 |
-
|
97 |
-
|
98 |
-
|
99 |
-
|
100 |
-
|
101 |
-
|
102 |
-
|
103 |
-
|
104 |
-
|
105 |
-
|
106 |
-
|
107 |
-
|
108 |
-
|
109 |
-
|
110 |
-
|
111 |
-
|
112 |
-
|
113 |
-
|
114 |
-
|
115 |
-
|
116 |
-
|
117 |
-
|
118 |
-
|
119 |
-
|
120 |
-
|
121 |
-
|
122 |
-
|
123 |
-
|
124 |
-
|
125 |
-
|
126 |
-
|
127 |
-
|
128 |
-
|
129 |
-
|
130 |
-
|
131 |
-
|
132 |
-
|
133 |
-
|
134 |
-
|
135 |
-
|
136 |
-
|
137 |
-
|
138 |
-
|
139 |
-
*
|
140 |
-
|
141 |
-
|
142 |
-
|
143 |
-
|
144 |
-
|
145 |
-
|
146 |
-
|
147 |
-
|
148 |
-
|
149 |
-
|
150 |
-
|
151 |
-
|
152 |
-
|
153 |
-
|
154 |
-
|
155 |
-
|
156 |
-
|
157 |
-
|
158 |
-
|
159 |
-
*
|
160 |
-
|
161 |
-
|
162 |
-
|
163 |
-
|
164 |
-
|
165 |
-
|
166 |
-
|
167 |
-
|
168 |
-
|
169 |
-
|
170 |
-
|
171 |
-
*
|
172 |
-
|
173 |
-
|
174 |
-
|
175 |
-
|
176 |
-
|
177 |
-
|
178 |
-
|
179 |
-
|
180 |
-
|
181 |
-
|
182 |
-
|
183 |
-
|
184 |
-
|
185 |
-
|
186 |
-
|
187 |
-
return
|
188 |
-
}
|
189 |
-
|
190 |
-
/**
|
191 |
-
*
|
192 |
-
*
|
193 |
-
* @return object
|
194 |
-
*/
|
195 |
-
public function
|
196 |
-
{
|
197 |
-
|
198 |
-
|
199 |
-
|
200 |
-
|
201 |
-
|
202 |
-
|
203 |
-
|
204 |
-
|
205 |
-
|
206 |
-
|
207 |
-
|
208 |
-
|
209 |
-
//
|
210 |
-
|
211 |
-
|
212 |
-
|
213 |
-
|
214 |
-
|
215 |
-
//
|
216 |
-
|
217 |
-
{
|
218 |
-
return
|
219 |
-
}
|
220 |
-
|
221 |
-
|
222 |
-
|
223 |
-
|
224 |
-
|
225 |
-
|
226 |
-
|
227 |
-
|
228 |
-
|
229 |
-
*
|
230 |
-
*
|
231 |
-
|
232 |
-
|
233 |
-
|
234 |
-
|
235 |
-
|
236 |
-
|
237 |
-
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
1 |
+
<?php
|
2 |
+
/**
|
3 |
+
* Magento
|
4 |
+
*
|
5 |
+
* NOTICE OF LICENSE
|
6 |
+
*
|
7 |
+
* This source file is subject to the Open Software License (OSL 3.0)
|
8 |
+
* that is bundled with this package in the file LICENSE.txt.
|
9 |
+
* It is also available through the world-wide-web at this URL:
|
10 |
+
* http://opensource.org/licenses/osl-3.0.php
|
11 |
+
* If you did not receive a copy of the license and are unable to
|
12 |
+
* obtain it through the world-wide-web, please send an email
|
13 |
+
* to license@magentocommerce.com so we can send you a copy immediately.
|
14 |
+
*
|
15 |
+
* @category Symmetrics
|
16 |
+
* @package Symmetrics_CashTicket
|
17 |
+
* @author symmetrics gmbh <info@symmetrics.de>
|
18 |
+
* @author Eugen Gitin <eg@symmetrics.de>
|
19 |
+
* @copyright 2010 symmetrics gmbh
|
20 |
+
* @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
|
21 |
+
* @link http://www.symmetrics.de/
|
22 |
+
*/
|
23 |
+
|
24 |
+
/**
|
25 |
+
* Symmetrics_CashTicket_Model_CashTicket
|
26 |
+
*
|
27 |
+
* @category Symmetrics
|
28 |
+
* @package Symmetrics_CashTicket
|
29 |
+
* @author symmetrics gmbh <info@symmetrics.de>
|
30 |
+
* @author Eugen Gitin <eg@symmetrics.de>
|
31 |
+
* @copyright 2010 symmetrics gmbh
|
32 |
+
* @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
|
33 |
+
* @link http://www.symmetrics.de/
|
34 |
+
*/
|
35 |
+
class Symmetrics_CashTicket_Model_CashTicket extends Mage_Payment_Model_Method_Abstract
|
36 |
+
{
|
37 |
+
/**
|
38 |
+
* Internal payment code
|
39 |
+
*
|
40 |
+
* @var string
|
41 |
+
*/
|
42 |
+
protected $_code = 'cashticket';
|
43 |
+
|
44 |
+
/**
|
45 |
+
* If gateway
|
46 |
+
*
|
47 |
+
* @var boolean
|
48 |
+
*/
|
49 |
+
protected $_isGateway = true;
|
50 |
+
|
51 |
+
/**
|
52 |
+
* If use authorization
|
53 |
+
*
|
54 |
+
* @var boolean
|
55 |
+
*/
|
56 |
+
protected $_canAuthorize = true;
|
57 |
+
|
58 |
+
/**
|
59 |
+
* If use capturing
|
60 |
+
*
|
61 |
+
* @var boolean
|
62 |
+
*/
|
63 |
+
protected $_canCapture = true;
|
64 |
+
|
65 |
+
/**
|
66 |
+
* If capture partial amounts
|
67 |
+
*
|
68 |
+
* @var boolean
|
69 |
+
*/
|
70 |
+
protected $_canCapturePartial = false;
|
71 |
+
|
72 |
+
/**
|
73 |
+
* If using refund
|
74 |
+
*
|
75 |
+
* @var boolean
|
76 |
+
*/
|
77 |
+
protected $_canRefund = false;
|
78 |
+
|
79 |
+
/**
|
80 |
+
* If can void
|
81 |
+
*
|
82 |
+
* @var boolean
|
83 |
+
*/
|
84 |
+
protected $_canVoid = false;
|
85 |
+
|
86 |
+
/**
|
87 |
+
* If using for internal
|
88 |
+
*
|
89 |
+
* @var boolean
|
90 |
+
*/
|
91 |
+
protected $_canUseInternal = true;
|
92 |
+
|
93 |
+
/**
|
94 |
+
* If using on checkout
|
95 |
+
*
|
96 |
+
* @var boolean
|
97 |
+
*/
|
98 |
+
protected $_canUseCheckout = true;
|
99 |
+
|
100 |
+
/**
|
101 |
+
* If using on multishipping
|
102 |
+
*
|
103 |
+
* @var boolean
|
104 |
+
*/
|
105 |
+
protected $_canUseForMultishipping = true;
|
106 |
+
|
107 |
+
/**
|
108 |
+
* If saving creditcards
|
109 |
+
*
|
110 |
+
* @var boolean
|
111 |
+
*/
|
112 |
+
protected $_canSaveCc = false;
|
113 |
+
|
114 |
+
/**
|
115 |
+
* If validating
|
116 |
+
*
|
117 |
+
* @var boolean
|
118 |
+
*/
|
119 |
+
protected $_canValidate = true;
|
120 |
+
|
121 |
+
/**
|
122 |
+
* Define block for payment form
|
123 |
+
*
|
124 |
+
* @var string
|
125 |
+
*/
|
126 |
+
protected $_formBlockType = 'cashticket/form';
|
127 |
+
|
128 |
+
/**
|
129 |
+
* Define block for payment info
|
130 |
+
*
|
131 |
+
* @var string
|
132 |
+
*/
|
133 |
+
protected $_infoBlockType = 'cashticket/info';
|
134 |
+
|
135 |
+
/**
|
136 |
+
* Id of the transaction for
|
137 |
+
* current API call
|
138 |
+
*
|
139 |
+
* @var string
|
140 |
+
*/
|
141 |
+
protected $_transactionId = '';
|
142 |
+
|
143 |
+
/**
|
144 |
+
* Construct
|
145 |
+
*
|
146 |
+
* @return void
|
147 |
+
*/
|
148 |
+
public function _construct()
|
149 |
+
{
|
150 |
+
parent::_construct();
|
151 |
+
$this->_init('cashticket/item');
|
152 |
+
}
|
153 |
+
|
154 |
+
/**
|
155 |
+
* Get API object
|
156 |
+
*
|
157 |
+
* @param int $transactionId Transaction Id
|
158 |
+
*
|
159 |
+
* @return object
|
160 |
+
*/
|
161 |
+
public function getApi($transactionId)
|
162 |
+
{
|
163 |
+
$api = Mage::getModel('cashticket/api');
|
164 |
+
$api->setTransactionId($transactionId);
|
165 |
+
$api->setOrder($this->getQuote());
|
166 |
+
|
167 |
+
return $api;
|
168 |
+
}
|
169 |
+
|
170 |
+
/**
|
171 |
+
* Get checkout from session
|
172 |
+
*
|
173 |
+
* @return object
|
174 |
+
*/
|
175 |
+
public function getCheckout()
|
176 |
+
{
|
177 |
+
return Mage::getSingleton('checkout/session');
|
178 |
+
}
|
179 |
+
|
180 |
+
/**
|
181 |
+
* Get session for Cash-Ticket
|
182 |
+
*
|
183 |
+
* @return object
|
184 |
+
*/
|
185 |
+
public function getSession()
|
186 |
+
{
|
187 |
+
return Mage::getSingleton('cashticket/session');
|
188 |
+
}
|
189 |
+
|
190 |
+
/**
|
191 |
+
* Get quote
|
192 |
+
*
|
193 |
+
* @return object
|
194 |
+
*/
|
195 |
+
public function getQuote()
|
196 |
+
{
|
197 |
+
return $this->getCheckout()->getQuote();
|
198 |
+
}
|
199 |
+
|
200 |
+
/**
|
201 |
|