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 |
+
* Check if payment method is available
|
202 |
+
*
|
203 |
+
* @param object $quote Quote
|
204 |
+
*
|
205 |
+
* @return bool
|
206 |
+
*/
|
207 |
+
public function isAvailable($quote = null)
|
208 |
+
{
|
209 |
+
// if quote is not set - something went wrong
|
210 |
+
if (is_null($quote)) {
|
211 |
+
return false;
|
212 |
+
}
|
213 |
+
|
214 |
+
// if cart value > 1000 - cancel
|
215 |
+
// cash-ticket does not support orders
|
216 |
+
// with value > 1000 at this time
|
217 |
+
if (Mage::app()->getStore()->roundPrice($quote->getGrandTotal()) <= 1000) {
|
218 |
+
return true;
|
219 |
+
}
|
220 |
+
|
221 |
+
return false;
|
222 |
+
}
|
223 |
+
|
224 |
+
/**
|
225 |
+
* Create disposition on Cash-Ticket
|
226 |
+
*
|
227 |
+
* @param Varien_Object $payment Payment Object
|
228 |
+
* @param int $amount Amount
|
229 |
+
*
|
230 |
+
* @return object
|
231 |
+
*/
|
232 |
+
public function authorize(Varien_Object $payment, $amount)
|
233 |
+
{
|
234 |
+
// generate random transaction number (number from 100 to 999 + orderid)
|
235 |
+
$transactionId = rand(100, 999) . $payment->getOrder()->increment_id;
|
236 |
+
$api = $this->getApi($transactionId);
|
237 |
+
|
238 |
+
// override the amount to get the really order amount
|
239 |
+
// needed for currency operations
|
240 |
+
$amount = $api->formatPrice($this->getQuote()->getGrandTotal());
|
241 |
+
|
242 |
+
$params = array(
|
243 |
+
'amount' => $amount
|
244 |
+
);
|
245 |
+
|
246 |
+
// save transactionid in payment data
|
247 |
+
$payment->setAdditionalData($transactionId);
|
248 |
+
|
249 |
+
// get response from api
|
250 |
+
$response = $api->call(
|
251 |
+
'CreateDisposition',
|
252 |
+
$params
|
253 |
+
);
|
254 |
+
|
255 |
+
// if response could be parsed and no error happened
|
256 |
+
if (is_object($response) && $response->errCode == '0') {
|
257 |
+
return $this;
|
258 |
+
} else {
|
259 |
+
$message = 'There is an error occurred. Probably it`s a temporary error and ';
|
260 |
+
$message .= 'the payment can be finished by a site reload. If this problem exist further, ';
|
261 |
+
$message .= 'please contact our support.';
|
262 |
+
Mage::throwException(Mage::helper('cashticket')->__($message));
|
263 |
+
}
|
264 |
+
|
265 |
+
return $this;
|
266 |
+
}
|
267 |
+
|
268 |
+
/**
|
269 |
+
* Get redirect URL
|
270 |
+
*
|
271 |
+
* @return string
|
272 |
+
*/
|
273 |
+
public function getOrderPlaceRedirectUrl()
|
274 |
+
{
|
275 |
+
return Mage::getUrl('cashticket/processing/redirect');
|
276 |
+
}
|
277 |
+
}
|
app/code/community/Symmetrics/CashTicket/Model/Item.php
CHANGED
@@ -1,44 +1,84 @@
|
|
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 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
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_Item
|
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_Item extends Mage_Core_Model_Abstract
|
36 |
+
{
|
37 |
+
/**
|
38 |
+
* Construct
|
39 |
+
*
|
40 |
+
* @return void
|
41 |
+
*/
|
42 |
+
public function _construct()
|
43 |
+
{
|
44 |
+
parent::_construct();
|
45 |
+
$this->_init('cashticket/item');
|
46 |
+
}
|
47 |
+
|
48 |
+
/**
|
49 |
+
* Get config item object
|
50 |
+
* and load by currency
|
51 |
+
*
|
52 |
+
* @param string $currency Currency
|
53 |
+
*
|
54 |
+
* @return array
|
55 |
+
*/
|
56 |
+
public function getConfigItem($currency)
|
57 |
+
{
|
58 |
+
$ids = $this->getItemsCollection($currency)->getAllIds();
|
59 |
+
return $this->load($ids[0])->toArray();
|
60 |
+
}
|
61 |
+
|
62 |
+
/**
|
63 |
+
* Get all enabled config items
|
64 |
+
* for current currency
|
65 |
+
*
|
66 |
+
* @param string $currency Currency
|
67 |
+
*
|
68 |
+
* @return object
|
69 |
+
*/
|
70 |
+
public function getItemsCollection($currency)
|
71 |
+
{
|
72 |
+
$collection = $this->getCollection()
|
73 |
+
->addFieldToFilter(
|
74 |
+
'currency_code',
|
75 |
+
$currency
|
76 |
+
)
|
77 |
+
->addFieldToFilter(
|
78 |
+
'enable',
|
79 |
+
1
|
80 |
+
);
|
81 |
+
|
82 |
+
return $collection;
|
83 |
+
}
|
84 |
+
}
|
app/code/community/Symmetrics/CashTicket/Model/Mysql4/Item.php
CHANGED
@@ -1,16 +1,46 @@
|
|
1 |
-
<?php
|
2 |
-
/**
|
3 |
-
*
|
4 |
-
*
|
5 |
-
*
|
6 |
-
*
|
7 |
-
*
|
8 |
-
|
9 |
-
|
10 |
-
|
11 |
-
|
12 |
-
|
13 |
-
|
14 |
-
|
15 |
-
|
16 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
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_Mysql4_Item
|
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_Mysql4_Item extends Mage_Core_Model_Mysql4_Abstract
|
36 |
+
{
|
37 |
+
/**
|
38 |
+
* Init model
|
39 |
+
*
|
40 |
+
* @return void
|
41 |
+
*/
|
42 |
+
public function _construct()
|
43 |
+
{
|
44 |
+
$this->_init('cashticket/item', 'item_id');
|
45 |
+
}
|
46 |
+
}
|
app/code/community/Symmetrics/CashTicket/Model/Mysql4/Item/Collection.php
CHANGED
@@ -1,17 +1,47 @@
|
|
1 |
-
<?php
|
2 |
-
/**
|
3 |
-
*
|
4 |
-
*
|
5 |
-
*
|
6 |
-
*
|
7 |
-
*
|
8 |
-
|
9 |
-
|
10 |
-
|
11 |
-
|
12 |
-
|
13 |
-
|
14 |
-
|
15 |
-
|
16 |
-
|
17 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
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_Mysql4_Item_Collection
|
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_Mysql4_Item_Collection extends Mage_Core_Model_Mysql4_Collection_Abstract
|
36 |
+
{
|
37 |
+
/**
|
38 |
+
* Init model
|
39 |
+
*
|
40 |
+
* @return void
|
41 |
+
*/
|
42 |
+
public function _construct()
|
43 |
+
{
|
44 |
+
parent::_construct();
|
45 |
+
$this->_init('cashticket/item');
|
46 |
+
}
|
47 |
+
}
|
app/code/community/Symmetrics/CashTicket/Model/Source/Businesstype.php
CHANGED
@@ -1,24 +1,49 @@
|
|
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 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
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_Source_BusinessType
|
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_Source_BusinessType
|
36 |
+
{
|
37 |
+
/**
|
38 |
+
* Get possible business types
|
39 |
+
*
|
40 |
+
* @return array
|
41 |
+
*/
|
42 |
+
public function getOptionArray()
|
43 |
+
{
|
44 |
+
return array(
|
45 |
+
'T' => Mage::helper('cashticket')->__('Tangible'),
|
46 |
+
'I' => Mage::helper('cashticket')->__('Intangible')
|
47 |
+
);
|
48 |
+
}
|
49 |
+
}
|
app/code/community/Symmetrics/CashTicket/Model/Source/Currency.php
CHANGED
@@ -1,31 +1,56 @@
|
|
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 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
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_Source_Currency
|
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_Source_Currency
|
36 |
+
{
|
37 |
+
/**
|
38 |
+
* Get possible currencies
|
39 |
+
*
|
40 |
+
* @return array
|
41 |
+
*/
|
42 |
+
public function getOptionArray()
|
43 |
+
{
|
44 |
+
return array(
|
45 |
+
'CHF' => 'CHF',
|
46 |
+
'DKK' => 'DKK',
|
47 |
+
'SEK' => 'SEK',
|
48 |
+
'SEK' => 'SEK',
|
49 |
+
'PLN' => 'PLN',
|
50 |
+
'GBP' => 'GBP',
|
51 |
+
'EUR' => 'EUR',
|
52 |
+
'USD' => 'USD',
|
53 |
+
'CZK' => 'CZK'
|
54 |
+
);
|
55 |
+
}
|
56 |
+
}
|
app/code/community/Symmetrics/CashTicket/Model/Source/Locale.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_Model_Source_Locale
|
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_Source_Locale
|
36 |
+
{
|
37 |
+
/**
|
38 |
+
* Get locales
|
39 |
+
*
|
40 |
+
* @return array
|
41 |
+
*/
|
42 |
+
public function getOptionArray()
|
43 |
+
{
|
44 |
+
return array(
|
45 |
+
'de_de' => Mage::helper('cashticket')->__('German Germany'),
|
46 |
+
'de_at' => Mage::helper('cashticket')->__('German Austria'),
|
47 |
+
'en_uk' => Mage::helper('cashticket')->__('British English'),
|
48 |
+
'en_us' => Mage::helper('cashticket')->__('American English')
|
49 |
+
);
|
50 |
+
}
|
51 |
+
}
|
app/code/community/Symmetrics/CashTicket/controllers/Adminhtml/CashticketController.php
CHANGED
@@ -1,121 +1,164 @@
|
|
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 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
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_Adminhtml_CashticketController
|
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_Adminhtml_CashticketController extends Mage_Adminhtml_Controller_Action
|
36 |
+
{
|
37 |
+
/**
|
38 |
+
* Default action called by pressing
|
39 |
+
* the "send" button in order info
|
40 |
+
* performed by AJAX
|
41 |
+
*
|
42 |
+
* @return object
|
43 |
+
*/
|
44 |
+
public function defaultAction()
|
45 |
+
{
|
46 |
+
$postParams = $this->getRequest()->getParams();
|
47 |
+
// get action variable from post
|
48 |
+
$action = $postParams['cashticketAction'];
|
49 |
+
// get order by id
|
50 |
+
$order = $this->getOrder($postParams['orderId']);
|
51 |
+
// get api and set the transaction id
|
52 |
+
$api = $this->getApi($postParams['transactionId']);
|
53 |
+
// get entered amount
|
54 |
+
$amount = $api->formatPrice($postParams['amount']);
|
55 |
+
|
56 |
+
// if entered amount is less then zero by modifying transaction
|
57 |
+
if ($amount <= 0 && $action == 'modify') {
|
58 |
+
// return error message
|
59 |
+
$message = 'Debit amount must be greater then zero.';
|
60 |
+
Mage::getSingleton('adminhtml/session')->addError(Mage::helper('cashticket')->__($message));
|
61 |
+
|
62 |
+
return $this;
|
63 |
+
}
|
64 |
+
|
65 |
+
// switch between two functions (debit and modify) selected from order info box
|
66 |
+
if ($action == 'debit') {
|
67 |
+
// get disposition state from Cash-Ticket
|
68 |
+
$response = $api->call('GetDispositionState', array());
|
69 |
+
// if allow to debit
|
70 |
+
// @codingStandardsIgnoreStart
|
71 |
+
if (is_object($response) && $response->errCode == '0' && $response->Amount > 0 && $response->TransactionState == 'D') {
|
72 |
+
// @codingStandardsIgnoreEnd
|
73 |
+
$params = array(
|
74 |
+
'amount' => $amount,
|
75 |
+
'close' => '0',
|
76 |
+
);
|
77 |
+
// call Cash-Ticket debit function with entered amount
|
78 |
+
$debitResponse = $api->call('Debit', $params);
|
79 |
+
if ($debitResponse->errCode == '0') {
|
80 |
+
// if everything was ok - save the new status and add info to order history
|
81 |
+
$statusMessage = 'Amount %s %s was successfully captured from customers Cash-Tickets.';
|
82 |
+
$status = Mage::helper('cashticket')->__($statusMessage, $amount, $api->getCurrency());
|
83 |
+
$order->addStatusToHistory(Mage_Sales_Model_Order::STATE_PROCESSING, $status);
|
84 |
+
$order->save();
|
85 |
+
$successMessage = 'Amount of %s %s was successfully debited.';
|
86 |
+
$success = Mage::helper('cashticket')->__($successMessage, $amount, $api->getCurrency());
|
87 |
+
Mage::getSingleton('adminhtml/session')->addSuccess($success);
|
88 |
+
return $this;
|
89 |
+
} else {
|
90 |
+
$errorMessage = preg_replace('/&/', '', $debitResponse->errMessage);
|
91 |
+
$errorMessage = preg_replace('/;/', '', $errorMessage);
|
92 |
+
Mage::getSingleton('adminhtml/session')->addError($errorMessage);
|
93 |
+
return $this;
|
94 |
+
}
|
95 |
+
} else {
|
96 |
+
// if can not process debit
|
97 |
+
$errorString = 'Error processing the Cash-Ticket request.';
|
98 |
+
$error = Mage::helper('cashticket')->__($errorString);
|
99 |
+
Mage::getSingleton('adminhtml/session')->addError($error);
|
100 |
+
return $this;
|
101 |
+
}
|
102 |
+
} elseif ($action == 'modify') {
|
103 |
+
// call Cash-Ticket modify function and modify the transaction amount
|
104 |
+
$response = $api->call(
|
105 |
+
'ModifyDisposition',
|
106 |
+
array(
|
107 |
+
'amount' => $amount
|
108 |
+
)
|
109 |
+
);
|
110 |
+
|
111 |
+
if (is_object($response) && $response->errCode == '0') {
|
112 |
+
// if everything was ok - save the new status and add info to order history
|
113 |
+
$statusString = sprintf('Disposition modified. New value: %s %s', $amount, $api->getCurrency());
|
114 |
+
$order->addStatusToHistory(Mage_Sales_Model_Order::STATE_PROCESSING, $statusString);
|
115 |
+
$order->save();
|
116 |
+
$successMessage = 'Disposition was successfully modified (%s %s).';
|
117 |
+
$success = Mage::helper('cashticket')->__($successMessage, $amount, $api->getCurrency());
|
118 |
+
Mage::getSingleton('adminhtml/session')->addSuccess($success);
|
119 |
+
return $this;
|
120 |
+
} else {
|
121 |
+
$errorMessage = Mage::helper('cashticket')->__('Error processing the Cash-Ticket request.');
|
122 |
+
Mage::getSingleton('adminhtml/session')->addError($errorMessage);
|
123 |
+
return $this;
|
124 |
+
}
|
125 |
+
}
|
126 |
+
|
127 |
+
return $this;
|
128 |
+
}
|
129 |
+
|
130 |
+
/**
|
131 |
+
* Get order object and load
|
132 |
+
* order by id
|
133 |
+
*
|
134 |
+
* @param int $orderId Order id
|
135 |
+
*
|
136 |
+
* @return object
|
137 |
+
*/
|
138 |
+
public function getOrder($orderId = null)
|
139 |
+
{
|
140 |
+
$order = Mage::getModel('sales/order');
|
141 |
+
$order->load($orderId);
|
142 |
+
|
143 |
+
return $order;
|
144 |
+
}
|
145 |
+
|
146 |
+
/**
|
147 |
+
* Get API object and set
|
148 |
+
* the transaction
|
149 |
+
*
|
150 |
+
* @param int $transactionId Transaction Id
|
151 |
+
*
|
152 |
+
* @return object
|
153 |
+
*/
|
154 |
+
public function getApi($transactionId = null)
|
155 |
+
{
|
156 |
+
$postParams = $this->getRequest()->getParams();
|
157 |
+
$cashTicketModel = Mage::getModel('cashticket/cashticket');
|
158 |
+
$api = $cashTicketModel->getApi($transactionId);
|
159 |
+
$api->setTransactionId($transactionId);
|
160 |
+
$api->setOrder($this->getOrder($postParams['orderId']));
|
161 |
+
|
162 |
+
return $api;
|
163 |
+
}
|
164 |
+
}
|
app/code/community/Symmetrics/CashTicket/controllers/Adminhtml/ConfigController.php
CHANGED
@@ -1,173 +1,212 @@
|
|
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 |
-
Mage::getSingleton('adminhtml/session')->
|
164 |
-
|
165 |
-
|
166 |
-
|
167 |
-
|
168 |
-
|
169 |
-
|
170 |
-
|
171 |
-
|
172 |
-
|
173 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
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_Adminhtml_ConfigController
|
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_Adminhtml_ConfigController extends Mage_Adminhtml_Controller_Action
|
36 |
+
{
|
37 |
+
/**
|
38 |
+
* Initialize the controller
|
39 |
+
*
|
40 |
+
* @return object
|
41 |
+
*/
|
42 |
+
protected function _initAction()
|
43 |
+
{
|
44 |
+
$this->loadLayout()
|
45 |
+
->_setActiveMenu('cashticket/items')
|
46 |
+
->_addBreadcrumb(
|
47 |
+
Mage::helper('adminhtml')->__('Items Manager'),
|
48 |
+
Mage::helper('adminhtml')->__('Item Manager')
|
49 |
+
);
|
50 |
+
|
51 |
+
return $this;
|
52 |
+
}
|
53 |
+
|
54 |
+
/**
|
55 |
+
* Default action
|
56 |
+
*
|
57 |
+
* @return void
|
58 |
+
*/
|
59 |
+
public function indexAction()
|
60 |
+
{
|
61 |
+
$this->_initAction()->renderLayout();
|
62 |
+
}
|
63 |
+
|
64 |
+
/**
|
65 |
+
* Redirect to edit action
|
66 |
+
*
|
67 |
+
* @return void
|
68 |
+
*/
|
69 |
+
public function newAction()
|
70 |
+
{
|
71 |
+
$this->_forward('edit');
|
72 |
+
}
|
73 |
+
|
74 |
+
/**
|
75 |
+
* Edit form action
|
76 |
+
*
|
77 |
+
* @return string
|
78 |
+
*/
|
79 |
+
public function editAction()
|
80 |
+
{
|
81 |
+
$id = $this->getRequest()->getParam('id');
|
82 |
+
// load the item model by id
|
83 |
+
$model = Mage::getModel('cashticket/item')->load($id);
|
84 |
+
// if id was found
|
85 |
+
if ($model->getId() || $id == 0) {
|
86 |
+
$data = Mage::getSingleton('adminhtml/session')->getFormData(true);
|
87 |
+
|
88 |
+
if (!empty($data)) {
|
89 |
+
$model->setData($data);
|
90 |
+
}
|
91 |
+
|
92 |
+
// set the model to register for later use
|
93 |
+
Mage::register('cashticket_data', $model);
|
94 |
+
|
95 |
+
$this->loadLayout();
|
96 |
+
$this->_setActiveMenu('cashticket/items');
|
97 |
+
|
98 |
+
$this->_addBreadcrumb(
|
99 |
+
Mage::helper('adminhtml')->__('Item Manager'),
|
100 |
+
Mage::helper('adminhtml')->__('Item Manager')
|
101 |
+
);
|
102 |
+
$this->_addBreadcrumb(
|
103 |
+
Mage::helper('adminhtml')->__('Item News'),
|
104 |
+
Mage::helper('adminhtml')->__('Item News')
|
105 |
+
);
|
106 |
+
|
107 |
+
$this->getLayout()->getBlock('head')->setCanLoadExtJs(true);
|
108 |
+
|
109 |
+
$this->_addContent($this->getLayout()->createBlock('cashticket/adminhtml_config_edit'));
|
110 |
+
|
111 |
+
$this->renderLayout();
|
112 |
+
} else {
|
113 |
+
// otherwise show error
|
114 |
+
$error = Mage::helper('cashticket')->__('Item does not exist');
|
115 |
+
Mage::getSingleton('adminhtml/session')->addError($error);
|
116 |
+
$this->_redirect('*/*/');
|
117 |
+
}
|
118 |
+
}
|
119 |
+
|
120 |
+
/**
|
121 |
+
* Save form action
|
122 |
+
*
|
123 |
+
* @return void
|
124 |
+
*/
|
125 |
+
public function saveAction()
|
126 |
+
{
|
127 |
+
// if have data in post
|
128 |
+
if ($data = $this->getRequest()->getPost()) {
|
129 |
+
// load the config item model and set the id
|
130 |
+
$model = Mage::getModel('cashticket/item');
|
131 |
+
$model->setData($data)->setId($this->getRequest()->getParam('item_id'));
|
132 |
+
|
133 |
+
try {
|
134 |
+
// get all enabled configs for the currency
|
135 |
+
$collection = Mage::getModel('cashticket/item')->getCollection()
|
136 |
+
->addFilter('currency_code', $model->getCurrencyCode())
|
137 |
+
->addFilter('enable', 1);
|
138 |
+
|
139 |
+
$size = $collection->getSize();
|
140 |
+
$ids = $collection->getAllIds();
|
141 |
+
|
142 |
+
// if there are already saved active config items
|
143 |
+
if ($size > 0 && $ids[0] != $model->getItemId()) {
|
144 |
+
// throw error
|
145 |
+
$errorMessage = 'You have already an active configuration for currency %s.';
|
146 |
+
$error = Mage::helper('cashticket')->__($errorMessage, $model->getCurrencyCode());
|
147 |
+
Mage::throwException($error);
|
148 |
+
}
|
149 |
+
|
150 |
+
// set update and creation time to now if saving the new item
|
151 |
+
if ($model->getCreatedTime == NULL || $model->getUpdateTime() == NULL) {
|
152 |
+
$model->setCreatedTime(now())->setUpdateTime(now());
|
153 |
+
} else {
|
154 |
+
$model->setUpdateTime(now());
|
155 |
+
}
|
156 |
+
|
157 |
+
$model->save();
|
158 |
+
|
159 |
+
// add success message
|
160 |
+
$successMessage = 'Configuration for %s was successfully saved';
|
161 |
+
$success = Mage::helper('cashticket')->__($successMessage, $model->getData('currency_code'));
|
162 |
+
Mage::getSingleton('adminhtml/session')->addSuccess($success);
|
163 |
+
Mage::getSingleton('adminhtml/session')->setFormData(false);
|
164 |
+
|
165 |
+
// if save and continue
|
166 |
+
if ($this->getRequest()->getParam('back')) {
|
167 |
+
// redirect to the edit form with the same id
|
168 |
+
$this->_redirect('*/*/edit', array('id' => $model->getId()));
|
169 |
+
return true;
|
170 |
+
}
|
171 |
+
|
172 |
+
$this->_redirect('*/*/');
|
173 |
+
return true;
|
174 |
+
|
175 |
+
} catch (Exception $e) {
|
176 |
+
Mage::getSingleton('adminhtml/session')->addError($e->getMessage());
|
177 |
+
Mage::getSingleton('adminhtml/session')->setFormData($data);
|
178 |
+
$this->_redirect('*/*/edit', array('id' => $this->getRequest()->getParam('item_id')));
|
179 |
+
return false;
|
180 |
+
}
|
181 |
+
}
|
182 |
+
$errorMessage = Mage::helper('cashticket')->__('Unable to find item to save');
|
183 |
+
Mage::getSingleton('adminhtml/session')->addError($errorMessage);
|
184 |
+
$this->_redirect('*/*/');
|
185 |
+
}
|
186 |
+
|
187 |
+
/**
|
188 |
+
* Delete action
|
189 |
+
*
|
190 |
+
* @return void
|
191 |
+
*/
|
192 |
+
public function deleteAction()
|
193 |
+
{
|
194 |
+
// if id is set
|
195 |
+
if ($this->getRequest()->getParam('id') > 0) {
|
196 |
+
try {
|
197 |
+
// delete config item
|
198 |
+
$model = Mage::getModel('cashticket/item');
|
199 |
+
$model->setId($this->getRequest()->getParam('id'))
|
200 |
+
->delete();
|
201 |
+
$success = Mage::helper('adminhtml')->__('Item was successfully deleted');
|
202 |
+
Mage::getSingleton('adminhtml/session')->addSuccess($success);
|
203 |
+
$this->_redirect('*/*/');
|
204 |
+
} catch (Exception $e) {
|
205 |
+
Mage::getSingleton('adminhtml/session')->addError($e->getMessage());
|
206 |
+
$this->_redirect('*/*/edit', array('id' => $this->getRequest()->getParam('id')));
|
207 |
+
}
|
208 |
+
}
|
209 |
+
// redirect to back to grid
|
210 |
+
$this->_redirect('*/*/');
|
211 |
+
}
|
212 |
+
}
|
app/code/community/Symmetrics/CashTicket/controllers/ProcessingController.php
CHANGED
@@ -1,200 +1,246 @@
|
|
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 |
-
* Get the
|
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 |
-
$order
|
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 |
-
|
188 |
-
|
189 |
-
|
190 |
-
|
191 |
-
|
192 |
-
|
193 |
-
|
194 |
-
|
195 |
-
|
196 |
-
|
197 |
-
|
198 |
-
|
199 |
-
|
200 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
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_ProcessingController
|
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_ProcessingController extends Mage_Core_Controller_Front_Action
|
36 |
+
{
|
37 |
+
/**
|
38 |
+
* Standard expire ajax function
|
39 |
+
*
|
40 |
+
* @return void
|
41 |
+
*/
|
42 |
+
protected function _expireAjax()
|
43 |
+
{
|
44 |
+
if (!Mage::getSingleton('checkout/session')->getQuote()->hasItems()) {
|
45 |
+
$this->getResponse()->setHeader('HTTP/1.1', '403 Session Expired');
|
46 |
+
exit;
|
47 |
+
}
|
48 |
+
}
|
49 |
+
|
50 |
+
/**
|
51 |
+
* Get the checkout object
|
52 |
+
*
|
53 |
+
* @return object
|
54 |
+
*/
|
55 |
+
public function getCheckout()
|
56 |
+
{
|
57 |
+
return Mage::getSingleton('checkout/session');
|
58 |
+
}
|
59 |
+
|
60 |
+
/**
|
61 |
+
* Get the API object and
|
62 |
+
* set transaction
|
63 |
+
*
|
64 |
+
* @param int $transactionId Transaction Id
|
65 |
+
*
|
66 |
+
* @return object
|
67 |
+
*/
|
68 |
+
public function getApi($transactionId = null)
|
69 |
+
{
|
70 |
+
$cashTicketModel = Mage::getModel('cashticket/cashticket');
|
71 |
+
$api = $cashTicketModel->getApi($transactionId);
|
72 |
+
$api->setTransactionId($transactionId);
|
73 |
+
|
74 |
+
return $api;
|
75 |
+
}
|
76 |
+
|
77 |
+
/**
|
78 |
+
* Get the order object and
|
79 |
+
* load by id
|
80 |
+
*
|
81 |
+
* @param int $orderId Order Id
|
82 |
+
*
|
83 |
+
* @return object
|
84 |
+
*/
|
85 |
+
public function getOrder($orderId = null)
|
86 |
+
{
|
87 |
+
$order = Mage::getModel('sales/order');
|
88 |
+
$order->loadByIncrementId($orderId);
|
89 |
+
|
90 |
+
return $order;
|
91 |
+
}
|
92 |
+
|
93 |
+
/**
|
94 |
+
* Action called when customer finishes
|
95 |
+
* the checkout process
|
96 |
+
*
|
97 |
+
* @return object
|
98 |
+
*/
|
99 |
+
public function redirectAction()
|
100 |
+
{
|
101 |
+
$checkout = $this->getCheckout();
|
102 |
+
$order = $this->getOrder($checkout->getLastRealOrderId());
|
103 |
+
$payment = $order->getPayment();
|
104 |
+
$api = $this->getApi($payment->getAdditionalData());
|
105 |
+
|
106 |
+
// get order total price and format it for the Cash-Ticket API
|
107 |
+
$params = array(
|
108 |
+
'amount' => $api->formatPrice(Mage::app()->getStore()->roundPrice($order->getGrandTotal()))
|
109 |
+
);
|
110 |
+
|
111 |
+
// set new order status and save info for order history
|
112 |
+
$statusMessage = 'Customer was redirected to Cash-Ticket. Transaction ID: %s';
|
113 |
+
$status = Mage::helper('cashticket')->__($statusMessage, $payment->getAdditionalData());
|
114 |
+
$order->addStatusToHistory(
|
115 |
+
$order->getStatus(),
|
116 |
+
$status
|
117 |
+
);
|
118 |
+
|
119 |
+
$order->save();
|
120 |
+
|
121 |
+
// unset the quoteId
|
122 |
+
$checkout->unsQuoteId();
|
123 |
+
|
124 |
+
// redirect customer to the Cash-Ticket page
|
125 |
+
$this->getResponse()->setRedirect($api->getCustomerRedirectUrl($params));
|
126 |
+
|
127 |
+
return $this;
|
128 |
+
}
|
129 |
+
|
130 |
+
/**
|
131 |
+
* Action called when customer
|
132 |
+
* returns from the Cash-Ticket page
|
133 |
+
*
|
134 |
+
* @return object
|
135 |
+
*/
|
136 |
+
public function successAction()
|
137 |
+
{
|
138 |
+
$checkout = $this->getCheckout();
|
139 |
+
$order = $this->getOrder($checkout->getLastRealOrderId());
|
140 |
+
$payment = $order->getPayment();
|
141 |
+
$api = $this->getApi($payment->getAdditionalData());
|
142 |
+
|
143 |
+
// get disposition state
|
144 |
+
$response = $api->call('GetSerialNumbers', array());
|
145 |
+
|
146 |
+
if (is_object($response) && $response->errCode == '0') {
|
147 |
+
// s = cash tickets successfully assigned to disposition
|
148 |
+
// @codingStandardsIgnoreStart
|
149 |
+
if ($response->TransactionState == 'S') {
|
150 |
+
// @codingStandardsIgnoreEnd
|
151 |
+
$amount = Mage::app()->getStore()->roundPrice($order->getGrandTotal());
|
152 |
+
// if intangible
|
153 |
+
if ($api->getConfigValue('business_type') == 'I') {
|
154 |
+
// further debits not possible
|
155 |
+
// close transaction and debit the full amount
|
156 |
+
$cashTicketAmount = $amount;
|
157 |
+
$closeFlag = '1';
|
158 |
+
// if tangible
|
159 |
+
} else {
|
160 |
+
// further debits are possible
|
161 |
+
// enable manual debiting
|
162 |
+
$cashTicketAmount = '0.00';
|
163 |
+
$closeFlag = '0';
|
164 |
+
}
|
165 |
+
|
166 |
+
$params = array(
|
167 |
+
'amount' => $api->formatPrice($cashTicketAmount),
|
168 |
+
'close' => $closeFlag,
|
169 |
+
);
|
170 |
+
|
171 |
+
// call the debit function on Cash-Ticket
|
172 |
+
$response = $api->call('Debit', $params);
|
173 |
+
|
174 |
+
if (is_object($response) && $response->errCode == '0') {
|
175 |
+
if ($api->getConfigValue('business_type') == 'I') {
|
176 |
+
$message = 'Transaction successful. %s %s debited';
|
177 |
+
$currency = $api->getCurrency();
|
178 |
+
$statusMessage = Mage::helper('cashticket')->__($message, $cashTicketAmount, $currency);
|
179 |
+
} else {
|
180 |
+
$message = 'Cash-Ticket cards were successfully assigned to disposition. ';
|
181 |
+
$message .= 'The amount of %s %s can be debited.';
|
182 |
+
$statusMessage = Mage::helper('cashticket')->__($message, $amount, $api->getCurrency());
|
183 |
+
}
|
184 |
+
|
185 |
+
// set the new order status and save comment
|
186 |
+
$newOrderStatus = $api->getDefaultConfigValue(
|
187 |
+
'order_status',
|
188 |
+
$order->getStoreId()
|
189 |
+
);
|
190 |
+
|
191 |
+
if (empty($newOrderStatus)) {
|
192 |
+
$newOrderStatus = Mage_Sales_Model_Order::STATE_PROCESSING;
|
193 |
+
}
|
194 |
+
|
195 |
+
$order->addStatusToHistory($newOrderStatus, $statusMessage);
|
196 |
+
$order->save();
|
197 |
+
|
198 |
+
$checkout->getQuote()->setIsActive(false)->save();
|
199 |
+
|
200 |
+
// redirect to success page
|
201 |
+
$this->_redirect(
|
202 |
+
'checkout/onepage/success',
|
203 |
+
array(
|
204 |
+
'_secure'=>true
|
205 |
+
)
|
206 |
+
);
|
207 |
+
|
208 |
+
return $this;
|
209 |
+
} else {
|
210 |
+
// debit was not successful
|
211 |
+
Mage::throwException($response->errMessage);
|
212 |
+
return $this;
|
213 |
+
}
|
214 |
+
} else {
|
215 |
+
// do not process payment because something went wrong on the Cash-Ticket page
|
216 |
+
$errorMessage = 'Error processing payment. It could have following reasons: ';
|
217 |
+
$errorMessage .= 'no cards assigned to disposition, disposition already debited, ';
|
218 |
+
$errorMessage .= 'disposition canceled by customer or expired by Cash-Ticket.';
|
219 |
+
Mage::throwException(Mage::helper('cashticket')->__($errorMessage));
|
220 |
+
return $this;
|
221 |
+
}
|
222 |
+
} else {
|
223 |
+
Mage::throwException($response->errMessage);
|
224 |
+
return $this;
|
225 |
+
}
|
226 |
+
}
|
227 |
+
|
228 |
+
/**
|
229 |
+
* Action called when customer hits
|
230 |
+
* cancel button on the Cash-Ticket
|
231 |
+
* page
|
232 |
+
*
|
233 |
+
* @return string
|
234 |
+
*/
|
235 |
+
public function errorAction()
|
236 |
+
{
|
237 |
+
// show error block
|
238 |
+
$this->getResponse()->setBody(
|
239 |
+
$this->getLayout()
|
240 |
+
->createBlock('cashticket/error')
|
241 |
+
->toHtml()
|
242 |
+
);
|
243 |
+
|
244 |
+
return $this;
|
245 |
+
}
|
246 |
+
}
|
app/code/community/Symmetrics/CashTicket/etc/config.xml
CHANGED
@@ -1,17 +1,31 @@
|
|
1 |
-
<?xml version="1.0"?>
|
2 |
<!--
|
3 |
/**
|
4 |
-
*
|
5 |
-
*
|
6 |
-
*
|
7 |
-
*
|
8 |
-
*
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
9 |
*/
|
10 |
-->
|
11 |
<config>
|
12 |
<modules>
|
13 |
<Symmetrics_CashTicket>
|
14 |
-
<version>0.1.
|
15 |
<depends>
|
16 |
<Mage_Payment />
|
17 |
</depends>
|
@@ -84,6 +98,15 @@
|
|
84 |
</args>
|
85 |
</cashticket>
|
86 |
</routers>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
87 |
</frontend>
|
88 |
<adminhtml>
|
89 |
<layout>
|
@@ -93,6 +116,15 @@
|
|
93 |
</cashticket>
|
94 |
</updates>
|
95 |
</layout>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
96 |
<acl>
|
97 |
<resources>
|
98 |
<all>
|
@@ -143,4 +175,4 @@
|
|
143 |
</cashticket>
|
144 |
</payment>
|
145 |
</default>
|
146 |
-
</config>
|
1 |
+
<?xml version="1.0" encoding="UTF-8"?>
|
2 |
<!--
|
3 |
/**
|
4 |
+
* Magento
|
5 |
+
*
|
6 |
+
* NOTICE OF LICENSE
|
7 |
+
*
|
8 |
+
* This source file is subject to the Open Software License (OSL 3.0)
|
9 |
+
* that is bundled with this package in the file LICENSE.txt.
|
10 |
+
* It is also available through the world-wide-web at this URL:
|
11 |
+
* http://opensource.org/licenses/osl-3.0.php
|
12 |
+
* If you did not receive a copy of the license and are unable to
|
13 |
+
* obtain it through the world-wide-web, please send an email
|
14 |
+
* to license@magentocommerce.com so we can send you a copy immediately.
|
15 |
+
*
|
16 |
+
* @category Symmetrics
|
17 |
+
* @package Symmetrics_CashTicket
|
18 |
+
* @author symmetrics gmbh <info@symmetrics.de>
|
19 |
+
* @author Eugen Gitin <eg@symmetrics.de>
|
20 |
+
* @copyright 2010 symmetrics gmbh
|
21 |
+
* @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
|
22 |
+
* @link http://www.symmetrics.de/
|
23 |
*/
|
24 |
-->
|
25 |
<config>
|
26 |
<modules>
|
27 |
<Symmetrics_CashTicket>
|
28 |
+
<version>0.1.8</version>
|
29 |
<depends>
|
30 |
<Mage_Payment />
|
31 |
</depends>
|
98 |
</args>
|
99 |
</cashticket>
|
100 |
</routers>
|
101 |
+
<translate>
|
102 |
+
<modules>
|
103 |
+
<Symmetrics_CashTicket>
|
104 |
+
<files>
|
105 |
+
<cashticket>Symmetrics_Cashticket.csv</cashticket>
|
106 |
+
</files>
|
107 |
+
</Symmetrics_CashTicket>
|
108 |
+
</modules>
|
109 |
+
</translate>
|
110 |
</frontend>
|
111 |
<adminhtml>
|
112 |
<layout>
|
116 |
</cashticket>
|
117 |
</updates>
|
118 |
</layout>
|
119 |
+
<translate>
|
120 |
+
<modules>
|
121 |
+
<Symmetrics_CashTicket>
|
122 |
+
<files>
|
123 |
+
<cashticket>Symmetrics_Cashticket.csv</cashticket>
|
124 |
+
</files>
|
125 |
+
</Symmetrics_CashTicket>
|
126 |
+
</modules>
|
127 |
+
</translate>
|
128 |
<acl>
|
129 |
<resources>
|
130 |
<all>
|
175 |
</cashticket>
|
176 |
</payment>
|
177 |
</default>
|
178 |
+
</config>
|
app/code/community/Symmetrics/CashTicket/etc/system.xml
CHANGED
@@ -1,11 +1,25 @@
|
|
1 |
-
<?xml version="1.0"?>
|
2 |
<!--
|
3 |
/**
|
4 |
-
*
|
5 |
-
*
|
6 |
-
*
|
7 |
-
*
|
8 |
-
*
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
9 |
*/
|
10 |
-->
|
11 |
<config>
|
1 |
+
<?xml version="1.0" encoding="UTF-8"?>
|
2 |
<!--
|
3 |
/**
|
4 |
+
* Magento
|
5 |
+
*
|
6 |
+
* NOTICE OF LICENSE
|
7 |
+
*
|
8 |
+
* This source file is subject to the Open Software License (OSL 3.0)
|
9 |
+
* that is bundled with this package in the file LICENSE.txt.
|
10 |
+
* It is also available through the world-wide-web at this URL:
|
11 |
+
* http://opensource.org/licenses/osl-3.0.php
|
12 |
+
* If you did not receive a copy of the license and are unable to
|
13 |
+
* obtain it through the world-wide-web, please send an email
|
14 |
+
* to license@magentocommerce.com so we can send you a copy immediately.
|
15 |
+
*
|
16 |
+
* @category Symmetrics
|
17 |
+
* @package Symmetrics_CashTicket
|
18 |
+
* @author symmetrics gmbh <info@symmetrics.de>
|
19 |
+
* @author Eugen Gitin <eg@symmetrics.de>
|
20 |
+
* @copyright 2010 symmetrics gmbh
|
21 |
+
* @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
|
22 |
+
* @link http://www.symmetrics.de/
|
23 |
*/
|
24 |
-->
|
25 |
<config>
|
app/code/community/Symmetrics/CashTicket/sql/cashticket_setup/mysql4-install-0.1.0.php
CHANGED
@@ -1,36 +1,50 @@
|
|
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 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
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 |
+
$installer = $this;
|
25 |
+
|
26 |
+
$installer->startSetup();
|
27 |
+
|
28 |
+
// create table for saving cashticket configurations
|
29 |
+
$installer->run(
|
30 |
+
"DROP TABLE IF EXISTS {$this->getTable('symmetrics_cashticket')};
|
31 |
+
CREATE TABLE {$this->getTable('symmetrics_cashticket')} (
|
32 |
+
`item_id` int(11) NOT NULL auto_increment,
|
33 |
+
`enable` tinyint NOT NULL,
|
34 |
+
`currency_code` varchar(3) NOT NULL,
|
35 |
+
`merchant_id` varchar(20) NOT NULL,
|
36 |
+
`business_type` varchar(5) NOT NULL,
|
37 |
+
`reporting_criteria` varchar(8) NOT NULL,
|
38 |
+
`locale` varchar(10) NOT NULL,
|
39 |
+
`path_pem_test` varchar(255) NOT NULL,
|
40 |
+
`path_pem_live` varchar(255) NOT NULL,
|
41 |
+
`path_cert` varchar(255) NOT NULL,
|
42 |
+
`sslcert_pass` varchar(255) NOT NULL,
|
43 |
+
`sandbox` enum('1', '0') NOT NULL,
|
44 |
+
`created_time` datetime default NULL,
|
45 |
+
`update_time` datetime default NULL,
|
46 |
+
PRIMARY KEY (`item_id`)
|
47 |
+
) ENGINE=InnoDB DEFAULT CHARSET=utf8;"
|
48 |
+
);
|
49 |
+
|
50 |
+
$installer->endSetup();
|
app/design/adminhtml/default/default/layout/cashticket.xml
CHANGED
@@ -1,11 +1,25 @@
|
|
1 |
-
<?xml version="1.0"?>
|
2 |
<!--
|
3 |
/**
|
4 |
-
*
|
5 |
-
*
|
6 |
-
*
|
7 |
-
*
|
8 |
-
*
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
9 |
*/
|
10 |
-->
|
11 |
<layout>
|
@@ -19,4 +33,4 @@
|
|
19 |
<block type="cashticket/adminhtml_config" name="cashticket.config" />
|
20 |
</reference>
|
21 |
</cashticket_adminhtml_config_index>
|
22 |
-
</layout>
|
1 |
+
<?xml version="1.0" encoding="UTF-8"?>
|
2 |
<!--
|
3 |
/**
|
4 |
+
* Magento
|
5 |
+
*
|
6 |
+
* NOTICE OF LICENSE
|
7 |
+
*
|
8 |
+
* This source file is subject to the Open Software License (OSL 3.0)
|
9 |
+
* that is bundled with this package in the file LICENSE.txt.
|
10 |
+
* It is also available through the world-wide-web at this URL:
|
11 |
+
* http://opensource.org/licenses/osl-3.0.php
|
12 |
+
* If you did not receive a copy of the license and are unable to
|
13 |
+
* obtain it through the world-wide-web, please send an email
|
14 |
+
* to license@magentocommerce.com so we can send you a copy immediately.
|
15 |
+
*
|
16 |
+
* @category Symmetrics
|
17 |
+
* @package Symmetrics_CashTicket
|
18 |
+
* @author symmetrics gmbh <info@symmetrics.de>
|
19 |
+
* @author Eugen Gitin <eg@symmetrics.de>
|
20 |
+
* @copyright 2010 symmetrics gmbh
|
21 |
+
* @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
|
22 |
+
* @link http://www.symmetrics.de/
|
23 |
*/
|
24 |
-->
|
25 |
<layout>
|
33 |
<block type="cashticket/adminhtml_config" name="cashticket.config" />
|
34 |
</reference>
|
35 |
</cashticket_adminhtml_config_index>
|
36 |
+
</layout>
|
app/design/adminhtml/default/default/template/cashticket/info.phtml
CHANGED
@@ -1,31 +1,44 @@
|
|
1 |
<?php
|
2 |
/**
|
3 |
-
*
|
4 |
-
*
|
5 |
-
*
|
6 |
-
*
|
7 |
-
*
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
8 |
*/
|
9 |
-
|
10 |
-
// Get current order
|
11 |
-
$_order = $this->getInfo()->getOrder();
|
12 |
-
// Get api instance and set transaction id from current order
|
13 |
-
$_api = $this->getApi($_order->getPayment()->getAdditionalData());
|
14 |
-
// Get a response from api
|
15 |
-
$response = $this->callGetSerialNumbers();
|
16 |
-
// Get amount debited from Cash-Ticket
|
17 |
-
$debitedAmount = (float)$response->Amount;
|
18 |
-
// Get order amount and format it for the API call
|
19 |
-
$orderAmount = (float)number_format($_order->getGrandTotal(), 2, '.', '');
|
20 |
-
// Get all allowed stats of current transaction
|
21 |
-
$allowedStatus = $this->getAllowedStats();
|
22 |
?>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
23 |
|
24 |
<p><?php echo $this->htmlEscape($this->getMethod()->getTitle()) ?></p>
|
25 |
<p><?php echo $this->helper('cashticket')->__('Status - ') ?><strong><?php echo $this->getPaymentStatus() ?></strong></p>
|
26 |
<p><?php echo $this->helper('cashticket')->__('Already debited or modified:') ?> <strong><?php echo ($orderAmount - $debitedAmount) ?> <?php echo $_api->getCurrency() ?></strong></p>
|
27 |
|
28 |
-
<?php if($debitedAmount > 0 && in_array($response->TransactionState, $allowedStatus)) : ?>
|
29 |
<div class="grid">
|
30 |
<table cellspacing="0" class="data" id="cashticket_debit_table">
|
31 |
<thead>
|
@@ -52,4 +65,4 @@ $allowedStatus = $this->getAllowedStats();
|
|
52 |
<input type="hidden" id="cashticket_transaction_id" value="<?php echo $_api->getTransactionId() ?>" />
|
53 |
<?php else : ?>
|
54 |
<p><em><?php echo $this->__('No Cash-Ticket actions are possible') ?></em></p>
|
55 |
-
<?php endif; ?>
|
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 |
+
<!-- Get current order -->
|
25 |
+
<?php $_order = $this->getInfo()->getOrder() ?>
|
26 |
+
<!-- Get api instance and set transaction id from current order -->
|
27 |
+
<?php $_api = $this->getApi($_order->getPayment()->getAdditionalData()) ?>
|
28 |
+
<!-- Get a response from api -->
|
29 |
+
<?php $response = $this->callGetSerialNumbers() ?>
|
30 |
+
<!-- Get amount debited from Cash-Ticket -->
|
31 |
+
<?php $debitedAmount = (float)$response->Amount ?>
|
32 |
+
<!-- Get order amount and format it for the API call -->
|
33 |
+
<?php $orderAmount = (float)number_format($_order->getGrandTotal(), 2, '.', '') ?>
|
34 |
+
<!-- Get all allowed stats of current transaction -->
|
35 |
+
<?php $allowedStatus = $this->getAllowedStats() ?>
|
36 |
|
37 |
<p><?php echo $this->htmlEscape($this->getMethod()->getTitle()) ?></p>
|
38 |
<p><?php echo $this->helper('cashticket')->__('Status - ') ?><strong><?php echo $this->getPaymentStatus() ?></strong></p>
|
39 |
<p><?php echo $this->helper('cashticket')->__('Already debited or modified:') ?> <strong><?php echo ($orderAmount - $debitedAmount) ?> <?php echo $_api->getCurrency() ?></strong></p>
|
40 |
|
41 |
+
<?php if ($debitedAmount > 0 && in_array($response->TransactionState, $allowedStatus)) : ?>
|
42 |
<div class="grid">
|
43 |
<table cellspacing="0" class="data" id="cashticket_debit_table">
|
44 |
<thead>
|
65 |
<input type="hidden" id="cashticket_transaction_id" value="<?php echo $_api->getTransactionId() ?>" />
|
66 |
<?php else : ?>
|
67 |
<p><em><?php echo $this->__('No Cash-Ticket actions are possible') ?></em></p>
|
68 |
+
<?php endif; ?>
|
app/design/frontend/default/default/template/cashticket/form.phtml
CHANGED
@@ -1,13 +1,26 @@
|
|
1 |
<?php
|
2 |
/**
|
3 |
-
*
|
4 |
-
*
|
5 |
-
*
|
6 |
-
*
|
7 |
-
*
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
8 |
*/
|
9 |
?>
|
10 |
-
|
11 |
<fieldset class="form-list">
|
12 |
<?php $_code = $this->getMethodCode() ?>
|
13 |
<ul id="payment_form_<?php echo $_code ?>" style="display:none">
|
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 |
<fieldset class="form-list">
|
25 |
<?php $_code = $this->getMethodCode() ?>
|
26 |
<ul id="payment_form_<?php echo $_code ?>" style="display:none">
|
app/design/frontend/default/default/template/cashticket/info.phtml
CHANGED
@@ -1,11 +1,24 @@
|
|
1 |
<?php
|
2 |
/**
|
3 |
-
*
|
4 |
-
*
|
5 |
-
*
|
6 |
-
*
|
7 |
-
*
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
8 |
*/
|
9 |
?>
|
10 |
-
|
11 |
-
<p><?php echo $this->getMethod()->getTitle() ?></p>
|
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 |
+
<p><?php echo $this->getMethod()->getTitle() ?></p>
|
|
app/etc/modules/Symmetrics_CashTicket.xml
CHANGED
@@ -1,4 +1,27 @@
|
|
1 |
-
<?xml version="1.0"?>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2 |
<config>
|
3 |
<modules>
|
4 |
<Symmetrics_CashTicket>
|
1 |
+
<?xml version="1.0" encoding="UTF-8"?>
|
2 |
+
<!--
|
3 |
+
/**
|
4 |
+
* Magento
|
5 |
+
*
|
6 |
+
* NOTICE OF LICENSE
|
7 |
+
*
|
8 |
+
* This source file is subject to the Open Software License (OSL 3.0)
|
9 |
+
* that is bundled with this package in the file LICENSE.txt.
|
10 |
+
* It is also available through the world-wide-web at this URL:
|
11 |
+
* http://opensource.org/licenses/osl-3.0.php
|
12 |
+
* If you did not receive a copy of the license and are unable to
|
13 |
+
* obtain it through the world-wide-web, please send an email
|
14 |
+
* to license@magentocommerce.com so we can send you a copy immediately.
|
15 |
+
*
|
16 |
+
* @category Symmetrics
|
17 |
+
* @package Symmetrics_CashTicket
|
18 |
+
* @author symmetrics gmbh <info@symmetrics.de>
|
19 |
+
* @author Eugen Gitin <eg@symmetrics.de>
|
20 |
+
* @copyright 2010 symmetrics gmbh
|
21 |
+
* @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
|
22 |
+
* @link http://www.symmetrics.de/
|
23 |
+
*/
|
24 |
+
-->
|
25 |
<config>
|
26 |
<modules>
|
27 |
<Symmetrics_CashTicket>
|
app/locale/de_DE/Symmetrics_Cashticket.csv
ADDED
@@ -0,0 +1 @@
|
|
|
1 |
+
"There is an error occurred. Probably it`s a temporary error and the payment can be finished by a site reload. If this problem exist further, please contact our support.","Bei der Bezahlung ist ein Fehler aufgetreten. Vermutlich ist dies ein temporärer Fehler und die Bezahlung kann durch Neu-Laden der Seite abgeschlossen werden. Falls dieses Problem weiterhin besteht, kontaktieren Sie bitte unseren Support."
|
js/symmetrics/adminhtml/cashticket.js
CHANGED
@@ -1,38 +1,59 @@
|
|
1 |
-
|
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 |
var symmetrics_cashticket = new SymmetricsCashTicket();
|
1 |
+
/**
|
2 |
+
* Magento
|
3 |
+
*
|
4 |
+
* NOTICE OF LICENSE
|
5 |
+
*
|
6 |
+
* This source file is subject to the Open Software License (OSL 3.0)
|
7 |
+
* that is bundled with this package in the file LICENSE.txt.
|
8 |
+
* It is also available through the world-wide-web at this URL:
|
9 |
+
* http://opensource.org/licenses/osl-3.0.php
|
10 |
+
* If you did not receive a copy of the license and are unable to
|
11 |
+
* obtain it through the world-wide-web, please send an email
|
12 |
+
* to license@magentocommerce.com so we can send you a copy immediately.
|
13 |
+
*
|
14 |
+
* @category Symmetrics
|
15 |
+
* @package Symmetrics_CashTicket
|
16 |
+
* @author symmetrics gmbh <info@symmetrics.de>
|
17 |
+
* @author Eugen Gitin <eg@symmetrics.de>
|
18 |
+
* @copyright 2010 symmetrics gmbh
|
19 |
+
* @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
|
20 |
+
* @link http://www.symmetrics.de/
|
21 |
+
*/
|
22 |
+
var SymmetricsCashTicket = Class.create();
|
23 |
+
// Create a new prototype class
|
24 |
+
SymmetricsCashTicket.prototype = {
|
25 |
+
initialize: function(name) {
|
26 |
+
this.name = name;
|
27 |
+
// Get base url from blank_img path
|
28 |
+
this.baseUrl = BLANK_IMG.substr (0, BLANK_IMG.length-13);
|
29 |
+
// Define action url
|
30 |
+
this.actionUrl = 'index.php/cashticket/adminhtml_cashticket/default/';
|
31 |
+
},
|
32 |
+
// Post an ajax request with selected values
|
33 |
+
doCashTicketAction: function(action) {
|
34 |
+
var url = this.baseUrl + this.actionUrl;
|
35 |
+
var postData = {
|
36 |
+
// Value from selectbox - modify or debit
|
37 |
+
'cashticketAction': $F('cashticket_action'),
|
38 |
+
// Amount to be modified or debited
|
39 |
+
'amount': $('cashticket_amount').getValue(),
|
40 |
+
// Current order ID
|
41 |
+
'orderId': $('cashticket_order_id').getValue(),
|
42 |
+
// Current transaction ID
|
43 |
+
'transactionId': $('cashticket_transaction_id').getValue(),
|
44 |
+
// Total disposition value
|
45 |
+
'totalDispo': $('cashticket_disposition_total').getValue()
|
46 |
+
};
|
47 |
+
// Post the request and reload the page on success
|
48 |
+
new Ajax.Request(url, {
|
49 |
+
method: 'post',
|
50 |
+
parameters: postData,
|
51 |
+
onSuccess: function() {
|
52 |
+
window.location.reload()
|
53 |
+
}
|
54 |
+
}
|
55 |
+
);
|
56 |
+
}
|
57 |
+
}
|
58 |
+
|
59 |
var symmetrics_cashticket = new SymmetricsCashTicket();
|
package.xml
CHANGED
@@ -1,18 +1,18 @@
|
|
1 |
<?xml version="1.0"?>
|
2 |
<package>
|
3 |
<name>symmetrics_cashticket</name>
|
4 |
-
<version>0.1.
|
5 |
<stability>stable</stability>
|
6 |
-
<license uri="http://opensource.org/licenses/osl-3.0.php">OSL 3.0</license>
|
7 |
<channel>community</channel>
|
8 |
<extends/>
|
9 |
<summary>Payment Gateway Cash-Ticket</summary>
|
10 |
<description>Payment Gateway for Cash-Ticket</description>
|
11 |
<notes>keine</notes>
|
12 |
-
<authors><author><name>Boris Lokschin</name><user>auto-converted</user><email>bl@symmetrics.de</email></author><author><name>Eugen Gitin</name><user>auto-converted</user><email>eg@symmetrics.de</email></author></authors>
|
13 |
-
<date>
|
14 |
-
<time>
|
15 |
-
<contents><target name="magedesign"><dir name="adminhtml"><dir name="default"><dir name="default"><dir name="layout"><file name="cashticket.xml" hash="
|
16 |
<compatible/>
|
17 |
<dependencies/>
|
18 |
</package>
|
1 |
<?xml version="1.0"?>
|
2 |
<package>
|
3 |
<name>symmetrics_cashticket</name>
|
4 |
+
<version>0.1.8</version>
|
5 |
<stability>stable</stability>
|
6 |
+
<license uri="http://www.opensource.org/licenses/osl-3.0.php">OSL 3.0</license>
|
7 |
<channel>community</channel>
|
8 |
<extends/>
|
9 |
<summary>Payment Gateway Cash-Ticket</summary>
|
10 |
<description>Payment Gateway for Cash-Ticket</description>
|
11 |
<notes>keine</notes>
|
12 |
+
<authors><author><name>Boris Lokschin</name><user>auto-converted</user><email>bl@symmetrics.de</email></author><author><name>Sergej Braznikov</name><user>auto-converted</user><email>sb@symmetrics.de</email></author><author><name>Eugen Gitin</name><user>auto-converted</user><email>eg@symmetrics.de</email></author><author><name>Siegfried Schmitz</name><user>auto-converted</user><email>ss@symmetrics.de</email></author><author><name>Eric Reiche</name><user>auto-converted</user><email>er@symmetrics.de</email></author></authors>
|
13 |
+
<date>2010-06-08</date>
|
14 |
+
<time>13:31:34</time>
|
15 |
+
<contents><target name="magedesign"><dir name="adminhtml"><dir name="default"><dir name="default"><dir name="layout"><file name="cashticket.xml" hash="1a663de292f648f7b21dc84001c36909"/></dir><dir name="template"><dir name="cashticket"><file name="info.phtml" hash="50a0cff433d42c35f253c72dc4e60d1c"/></dir></dir></dir></dir></dir><dir name="frontend"><dir name="default"><dir name="default"><dir name="template"><dir name="cashticket"><file name="form.phtml" hash="ebae81e87701d9350f51a7781fc0ffe5"/><file name="info.phtml" hash="371a3b9cf39260ab1f2baa3332607417"/></dir></dir></dir></dir></dir></target><target name="magelocale"><dir name="de_DE"><file name="Symmetrics_Cashticket.csv" hash="f79f6220feb2dccc6c4feb73451ef82b"/></dir></target><target name="mageskin"><dir name="frontend"><dir name="default"><dir name="default"><dir name="images"><dir name="cashticket"><file name="cashticket-logo.png" hash="1feb49eb4493530107dfd9fd0a19eefe"/></dir></dir></dir></dir></dir></target><target name="mageweb"><dir name="js"><dir name="symmetrics"><dir name="adminhtml"><file name="cashticket.js" hash="f8ab823c383534848e3fb062db0e25e8"/></dir></dir></dir></target><target name="mageetc"><dir name="modules"><file name="Symmetrics_CashTicket.xml" hash="f22cc69c42a252c809ab3f3a38f2a36b"/></dir></target><target name="magecommunity"><dir name="Symmetrics"><dir name="CashTicket"><dir name="Block"><dir name="Adminhtml"><dir name="Config"><dir name="Edit"><file name="Form.php" hash="c0c9a8859c0f6cdf0fa02ee2a703e46d"/></dir><file name="Edit.php" hash="29f90fe1d1095d93bd296ba49f55a05a"/><file name="Grid.php" hash="5f60e8227e92621ffc4730ea4109e9fa"/><file name="Renderer.php" hash="ec897230b9ae689be19e153f80c614d6"/></dir><file name="Config.php" hash="54680651f2a4325e1c01fd4cd64a9cff"/></dir><file name="Error.php" hash="be7ac2ce482cb3972e36756275194222"/><file name="Form.php" hash="68bdaf6798a347a3d170182ac690a877"/><file name="Info.php" hash="2214f0366505981d3e3300cfb438f54a"/></dir><dir name="controllers"><dir name="Adminhtml"><file name="CashticketController.php" hash="5cde087ac0b13f889e3c77791c2cce39"/><file name="ConfigController.php" hash="c94ba8969e37baf2bca6b11f4e436b5b"/></dir><file name="ProcessingController.php" hash="4e5ecea81f29e5fe11ae34ef6301da9f"/></dir><dir name="etc"><file name="config.xml" hash="4b6ad85354a7b001b1482d58f7c0cffc"/><file name="system.xml" hash="f28d7a9a74a95e29d6a39e3fef0b3bcd"/></dir><dir name="Helper"><file name="Data.php" hash="43735bfa77b1821987e44e154fbc1ff9"/></dir><dir name="Model"><dir name="Mysql4"><dir name="Item"><file name="Collection.php" hash="f7bed687996fb9bbd26fc9c6efee0d92"/></dir><file name="Item.php" hash="a06c44cce43b45211bb9778cc3b07b26"/></dir><dir name="Source"><file name="Businesstype.php" hash="52faf34f9d4b030da3651587b7b5631e"/><file name="Currency.php" hash="a607c4c2a61f9b6218a103481c831cb5"/><file name="Locale.php" hash="6174f5fa5b0753acefcec9b73269bc92"/></dir><file name="Api.php" hash="40bcaef10425eb5f552f443c5e17512e"/><file name="Cashticket.php" hash="72c46763151f6988946845ed333cd0d0"/><file name="Item.php" hash="eb4dbe8e5759ef033f454ff3779e7dc3"/></dir><dir name="sql"><dir name="cashticket_setup"><file name="mysql4-install-0.1.0.php" hash="e8571359d60a648f921547e86dd94c7d"/></dir></dir></dir></dir></target><target name="mage"><dir name="var"><dir name="cashticket"><file name="paysafecard-CA.pem" hash="1cc27c5763294f6c99cdb37f0b8ad528"/></dir></dir></target></contents>
|
16 |
<compatible/>
|
17 |
<dependencies/>
|
18 |
</package>
|