symmetrics_cashticket - Version 0.1.8

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

Files changed (31) hide show
  1. app/code/community/Symmetrics/CashTicket/Block/Adminhtml/Config.php +51 -26
  2. app/code/community/Symmetrics/CashTicket/Block/Adminhtml/Config/Edit.php +96 -59
  3. app/code/community/Symmetrics/CashTicket/Block/Adminhtml/Config/Edit/Form.php +225 -145
  4. app/code/community/Symmetrics/CashTicket/Block/Adminhtml/Config/Grid.php +158 -117
  5. app/code/community/Symmetrics/CashTicket/Block/Adminhtml/Config/Renderer.php +58 -29
  6. app/code/community/Symmetrics/CashTicket/Block/Error.php +60 -34
  7. app/code/community/Symmetrics/CashTicket/Block/Form.php +48 -23
  8. app/code/community/Symmetrics/CashTicket/Block/Info.php +156 -124
  9. app/code/community/Symmetrics/CashTicket/Helper/Data.php +37 -13
  10. app/code/community/Symmetrics/CashTicket/Model/Api.php +98 -40
  11. app/code/community/Symmetrics/CashTicket/Model/Cashticket.php +277 -237
  12. app/code/community/Symmetrics/CashTicket/Model/Item.php +84 -44
  13. app/code/community/Symmetrics/CashTicket/Model/Mysql4/Item.php +46 -16
  14. app/code/community/Symmetrics/CashTicket/Model/Mysql4/Item/Collection.php +47 -17
  15. app/code/community/Symmetrics/CashTicket/Model/Source/Businesstype.php +49 -24
  16. app/code/community/Symmetrics/CashTicket/Model/Source/Currency.php +56 -31
  17. app/code/community/Symmetrics/CashTicket/Model/Source/Locale.php +51 -26
  18. app/code/community/Symmetrics/CashTicket/controllers/Adminhtml/CashticketController.php +164 -121
  19. app/code/community/Symmetrics/CashTicket/controllers/Adminhtml/ConfigController.php +212 -173
  20. app/code/community/Symmetrics/CashTicket/controllers/ProcessingController.php +246 -200
  21. app/code/community/Symmetrics/CashTicket/etc/config.xml +40 -8
  22. app/code/community/Symmetrics/CashTicket/etc/system.xml +20 -6
  23. app/code/community/Symmetrics/CashTicket/sql/cashticket_setup/mysql4-install-0.1.0.php +50 -36
  24. app/design/adminhtml/default/default/layout/cashticket.xml +21 -7
  25. app/design/adminhtml/default/default/template/cashticket/info.phtml +33 -20
  26. app/design/frontend/default/default/template/cashticket/form.phtml +19 -6
  27. app/design/frontend/default/default/template/cashticket/info.phtml +20 -7
  28. app/etc/modules/Symmetrics_CashTicket.xml +24 -1
  29. app/locale/de_DE/Symmetrics_Cashticket.csv +1 -0
  30. js/symmetrics/adminhtml/cashticket.js +58 -37
  31. package.xml +6 -6
app/code/community/Symmetrics/CashTicket/Block/Adminhtml/Config.php CHANGED
@@ -1,26 +1,51 @@
1
- <?php
2
- /**
3
- * @category Symmetrics
4
- * @package Symmetrics_CashTicket
5
- * @author symmetrics gmbh <info@symmetrics.de>, Eugen Gitin <eg@symmetrics.de>
6
- * @copyright symmetrics gmbh
7
- * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
8
- */
9
-
10
- class Symmetrics_CashTicket_Block_Adminhtml_Config extends Mage_Adminhtml_Block_Widget_Grid_Container
11
- {
12
- /**
13
- * Prepare the page with
14
- * the grid on it
15
- *
16
- * @return object
17
- */
18
- public function __construct()
19
- {
20
- $this->_controller = 'adminhtml_config';
21
- $this->_blockGroup = 'cashticket';
22
- $this->_headerText = Mage::helper('cashticket')->__('Cash-Ticket Configuration');
23
- $this->_addButtonLabel = Mage::helper('cashticket')->__('Add Item');
24
- parent::__construct();
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
- * @category Symmetrics
4
- * @package Symmetrics_CashTicket
5
- * @author symmetrics gmbh <info@symmetrics.de>, Eugen Gitin <eg@symmetrics.de>
6
- * @copyright symmetrics gmbh
7
- * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
8
- */
9
-
10
- class Symmetrics_CashTicket_Block_Adminhtml_Config_Edit extends Mage_Adminhtml_Block_Widget_Form_Container
11
- {
12
- /**
13
- * Add buttons to the edit form
14
- *
15
- * @return void
16
- */
17
- public function __construct()
18
- {
19
- parent::__construct();
20
-
21
- $this->_objectId = 'id';
22
- $this->_blockGroup = 'cashticket';
23
- $this->_controller = 'adminhtml_config';
24
-
25
- $this->_updateButton('save', 'label', Mage::helper('cashticket')->__('Save'));
26
- $this->_updateButton('delete', 'label', Mage::helper('cashticket')->__('Delete'));
27
-
28
- // add "save and continue" button
29
- $this->_addButton('saveandcontinue', array(
30
- 'label' => Mage::helper('adminhtml')->__('Save And Continue Edit'),
31
- 'onclick' => 'saveAndContinueEdit()',
32
- 'class' => 'save',
33
- ), -100);
34
-
35
- // js needed for "save and continue"
36
- $this->_formScripts[] = "
37
- function saveAndContinueEdit(){
38
- editForm.submit($('edit_form').action+'back/edit/');
39
- }
40
- ";
41
- }
42
-
43
- /**
44
- * Set page header
45
- *
46
- * @return string
47
- */
48
- public function getHeaderText()
49
- {
50
- // if editing an item - set "Edit" as a page header
51
- if (Mage::registry('cashticket_data') && Mage::registry('cashticket_data')->getId()) {
52
- return Mage::helper('cashticket')->__('Edit Item "%s"', $this->htmlEscape(Mage::registry('cashticket_data')->getCurrencyCode()));
53
- }
54
- else {
55
- // ohterwise set "Add"
56
- return Mage::helper('cashticket')->__('Add Item');
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
- * @category Symmetrics
4
- * @package Symmetrics_CashTicket
5
- * @author symmetrics gmbh <info@symmetrics.de>, Eugen Gitin <eg@symmetrics.de>
6
- * @copyright symmetrics gmbh
7
- * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
8
- */
9
-
10
- class Symmetrics_CashTicket_Block_Adminhtml_Config_Edit_Form extends Mage_Adminhtml_Block_Widget_Form
11
- {
12
- public function __construct()
13
- {
14
- parent::__construct();
15
- $this->setId('editForm');
16
- }
17
-
18
- /**
19
- * Preparing the form and adding
20
- * fields to it
21
- *
22
- * @return object
23
- */
24
- protected function _prepareForm()
25
- {
26
- $form = new Varien_Data_Form(array(
27
- 'id' => 'edit_form',
28
- 'action' => $this->getUrl('*/*/save', array('id' => $this->getRequest()->getParam('id'))),
29
- 'method' => 'post',
30
- 'enctype' => 'multipart/form-data'
31
- ));
32
-
33
- $fieldset = $form->addFieldset('cashticket_form', array(
34
- 'legend' => Mage::helper('cashticket')->__('Cash-Ticket Configuration'))
35
- );
36
-
37
- if ($this->getRequest()->getParam('id')) {
38
- $fieldset->addField('item_id', 'hidden', array(
39
- 'name' => 'item_id',
40
- ));
41
- }
42
-
43
- $fieldset->addField('enable', 'select', array(
44
- 'label' => Mage::helper('cashticket')->__('Enable'),
45
- 'class' => 'required-entry',
46
- 'required' => true,
47
- 'name' => 'enable',
48
- 'options' => array(
49
- 0 => Mage::helper('cashticket')->__('No'),
50
- 1 => Mage::helper('cashticket')->__('Yes'),
51
- )
52
- ));
53
-
54
- $fieldset->addField('currency_code', 'select', array(
55
- 'label' => Mage::helper('cashticket')->__('Currency'),
56
- 'class' => 'required-entry',
57
- 'required' => true,
58
- 'name' => 'currency_code',
59
- 'options' => Mage::getModel('cashticket/source_currency')->getOptionArray()
60
- ));
61
-
62
- $fieldset->addField('merchant_id', 'text', array(
63
- 'label' => Mage::helper('cashticket')->__('Merchant ID'),
64
- 'class' => 'required-entry',
65
- 'required' => true,
66
- 'name' => 'merchant_id',
67
- ));
68
-
69
- $fieldset->addField('business_type', 'select', array(
70
- 'label' => Mage::helper('cashticket')->__('Business Type'),
71
- 'class' => 'required-entry',
72
- 'required' => true,
73
- 'name' => 'business_type',
74
- 'options' => Mage::getModel('cashticket/source_businesstype')->getOptionArray()
75
- ));
76
-
77
- $fieldset->addField('reporting_criteria', 'text', array(
78
- 'label' => Mage::helper('cashticket')->__('Reporting Criteria'),
79
- 'required' => false,
80
- 'name' => 'reporting_criteria',
81
- ));
82
-
83
- $fieldset->addField('locale', 'select', array(
84
- 'label' => Mage::helper('cashticket')->__('Language'),
85
- 'class' => 'required-entry',
86
- 'required' => true,
87
- 'name' => 'locale',
88
- 'options' => Mage::getModel('cashticket/source_locale')->getOptionArray()
89
- ));
90
-
91
- $fieldset->addField('path_pem_test', 'text', array(
92
- 'label' => Mage::helper('cashticket')->__('Path to PEM Certificate (Test)'),
93
- 'class' => 'required-entry',
94
- 'required' => true,
95
- 'name' => 'path_pem_test',
96
- ));
97
-
98
- $fieldset->addField('path_pem_live', 'text', array(
99
- 'label' => Mage::helper('cashticket')->__('Path to PEM Certificate (Live)'),
100
- 'class' => 'required-entry',
101
- 'required' => true,
102
- 'name' => 'path_pem_live',
103
- ));
104
-
105
- $fieldset->addField('path_cert', 'text', array(
106
- 'label' => Mage::helper('cashticket')->__('Path to the Server Certificate'),
107
- 'class' => 'required-entry',
108
- 'required' => true,
109
- 'name' => 'path_cert',
110
- ));
111
-
112
- $fieldset->addField('sslcert_pass', 'text', array(
113
- 'label' => Mage::helper('cashticket')->__('Keyring Password'),
114
- 'class' => 'required-entry',
115
- 'required' => true,
116
- 'name' => 'sslcert_pass',
117
- ));
118
-
119
- $fieldset->addField('sandbox', 'select', array(
120
- 'label' => Mage::helper('cashticket')->__('Sandbox'),
121
- 'class' => 'required-entry',
122
- 'required' => true,
123
- 'name' => 'sandbox',
124
- 'options' => array(
125
- 0 => Mage::helper('cashticket')->__('No'),
126
- 1 => Mage::helper('cashticket')->__('Yes'),
127
- )
128
- ));
129
-
130
- // get form values from the session
131
- if (Mage::getSingleton('adminhtml/session')->getCashticketData()) {
132
- $form->setValues(Mage::getSingleton('adminhtml/session')->getCashticketData());
133
- Mage::getSingleton('adminhtml/session')->setCashticketData(null);
134
- }
135
- elseif (Mage::registry('cashticket_data')) {
136
- $form->setValues(Mage::registry('cashticket_data')->getData());
137
- }
138
-
139
- $form->setAction($this->getUrl('*/*/save'));
140
- $form->setUseContainer(true);
141
- $this->setForm($form);
142
-
143
- return parent::_prepareForm();
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
- * @category Symmetrics
4
- * @package Symmetrics_CashTicket
5
- * @author symmetrics gmbh <info@symmetrics.de>, Eugen Gitin <eg@symmetrics.de>
6
- * @copyright symmetrics gmbh
7
- * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
8
- */
9
-
10
- class Symmetrics_CashTicket_Block_Adminhtml_Config_Grid extends Mage_Adminhtml_Block_Widget_Grid
11
- {
12
- /**
13
- * Prepare the grid
14
- *
15
- * @return void
16
- */
17
- public function __construct()
18
- {
19
- parent::__construct();
20
-
21
- $this->setId('cashticketGrid');
22
- $this->setDefaultSort('currency_id');
23
- $this->setDefaultDir('ASC');
24
- $this->setSaveParametersInSession(true);
25
- }
26
-
27
- /**
28
- * Get collection of config items
29
- * and set it into the grid object
30
- *
31
- * @return string
32
- */
33
- protected function _prepareCollection()
34
- {
35
- $collection = Mage::getModel('cashticket/item')->getCollection();
36
-
37
- $this->setCollection($collection);
38
- return parent::_prepareCollection();
39
- }
40
-
41
- /**
42
- * Set grid columns
43
- *
44
- * @return object
45
- */
46
- protected function _prepareColumns()
47
- {
48
- $this->addColumn('enable', array(
49
- 'header' => Mage::helper('cashticket')->__('Enabled'),
50
- 'type' => 'options',
51
- 'index' => 'enable',
52
- 'sortable' => true,
53
- 'options' => array(
54
- '1' => Mage::helper('cashticket')->__('Yes'),
55
- '0' => Mage::helper('cashticket')->__('No')
56
- ),
57
- 'width' => '100px'
58
- ));
59
-
60
- $this->addColumn('currency_code', array(
61
- 'header' => Mage::helper('cashticket')->__('Currency'),
62
- 'type' => 'text',
63
- 'index' => 'currency_code',
64
- 'sortable' => true
65
- ));
66
-
67
- $this->addColumn('merchant_id', array(
68
- 'header' => Mage::helper('cashticket')->__('Merchant ID'),
69
- 'type' => 'text',
70
- 'index' => 'merchant_id',
71
- 'sortable' => true
72
- ));
73
-
74
- $this->addColumn('sandbox', array(
75
- 'header' => Mage::helper('cashticket')->__('Sanbox'),
76
- 'type' => 'options',
77
- 'index' => 'sandbox',
78
- 'sortable' => true,
79
- 'options' => array(
80
- '1' => Mage::helper('cashticket')->__('Yes'),
81
- '0' => Mage::helper('cashticket')->__('No')
82
- ),
83
- 'width' => '100px'
84
- ));
85
-
86
- // add "edit" link into the action column
87
- $this->addColumn('action',
88
- array(
89
- 'header' => Mage::helper('cashticket')->__('Action'),
90
- 'type' => 'action',
91
- 'getter' => 'getId',
92
- 'actions' => array(array(
93
- 'caption' => Mage::helper('catalog')->__('Edit'),
94
- 'url' => array(
95
- 'base' => '*/*/edit'
96
- ),
97
- 'field' => 'id'
98
- )),
99
- 'filter' => false,
100
- 'sortable' => false,
101
- 'index' => 'config',
102
- 'width' => '100px'
103
- ));
104
-
105
- return parent::_prepareColumns();
106
- }
107
-
108
- /**
109
- * Set the edit url
110
- *
111
- * @return string
112
- */
113
- public function getRowUrl($row)
114
- {
115
- return $this->getUrl('*/*/edit', array('id' => $row->getId()));
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
- * @category Symmetrics
4
- * @package Symmetrics_CashTicket
5
- * @author symmetrics gmbh <info@symmetrics.de>, Eugen Gitin <eg@symmetrics.de>
6
- * @copyright symmetrics gmbh
7
- * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
8
- */
9
-
10
- class Symmetrics_CashTicket_Block_Adminhtml_Config_Renderer extends Mage_Adminhtml_Block_Widget_Grid_Column_Renderer_Abstract
11
- {
12
- /**
13
- * Rendering of the grid column
14
- *
15
- * @return string
16
- */
17
- public function render(Varien_Object $row)
18
- {
19
- $values = array();
20
- foreach (Mage::getModel('cashticket/item')->getSizeOptions() as $option) {
21
- foreach ($option as $key => $val) {
22
- if ($val['value'] == $row->getSize()) {
23
- return $val['label'];
24
- $values[$val['value']] = $val['label'];
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
- * @category Symmetrics
4
- * @package Symmetrics_CashTicket
5
- * @author symmetrics gmbh <info@symmetrics.de>, Eugen Gitin <eg@symmetrics.de>
6
- * @copyright symmetrics gmbh
7
- * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
8
- */
9
-
10
- class Symmetrics_CashTicket_Block_Error extends Mage_Core_Block_Abstract
11
- {
12
- /**
13
- * This block is shown when the customer
14
- * cancels the payment process from
15
- * CashTicket page
16
- *
17
- * @return string
18
- */
19
- protected function _toHtml()
20
- {
21
- $url = Mage::getUrl('checkout/onepage');
22
-
23
- $html = '';
24
-
25
- $html .= '<p>'.Mage::helper('cashticket')->__('Cash-Ticket payment was canceled. Redirecting to checkout...').'</p>';
26
- $html .= '<p><a href="'.$url.'">'.Mage::helper('cashticket')->__('Click here to return to checkout').'</a></p>';
27
-
28
- $html .= '<script language="javascript">';
29
- $html .= 'document.location.href="'.$url.'";';
30
- $html .= '</script>';
31
-
32
- return $html;
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
- * @category Symmetrics
4
- * @package Symmetrics_CashTicket
5
- * @author symmetrics gmbh <info@symmetrics.de>, Eugen Gitin <eg@symmetrics.de>
6
- * @copyright symmetrics gmbh
7
- * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
8
- */
9
-
10
- class Symmetrics_CashTicket_Block_Form extends Mage_Payment_Block_Form
11
- {
12
- /**
13
- * Set template for payment info
14
- * below the radio selector
15
- *
16
- * @return object
17
- */
18
- protected function _construct()
19
- {
20
- $this->setTemplate('cashticket/form.phtml');
21
- parent::_construct();
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
- * @category Symmetrics
4
- * @package Symmetrics_CashTicket
5
- * @author symmetrics gmbh <info@symmetrics.de>, Eugen Gitin <eg@symmetrics.de>
6
- * @copyright symmetrics gmbh
7
- * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
8
- */
9
-
10
- class Symmetrics_CashTicket_Block_Info extends Mage_Payment_Block_Info
11
- {
12
- /**
13
- * Result of the API call
14
- *
15
- * @var object
16
- */
17
- protected $_response;
18
-
19
- /**
20
- * API object
21
- *
22
- * @var object
23
- */
24
- protected $_api;
25
-
26
- /**
27
- * Set template for payment info
28
- * on the right side of the
29
- * checkout page
30
- *
31
- * @return void
32
- */
33
- protected function _construct()
34
- {
35
- parent::_construct();
36
- $this->setTemplate('cashticket/info.phtml');
37
- }
38
-
39
- /**
40
- * Get the API object
41
- *
42
- * @return object
43
- */
44
- public function getApi($transactionId)
45
- {
46
- if (is_null($this->_api)) {
47
- $cashticketModel = Mage::getModel('cashticket/cashticket');
48
- $this->_api = $cashticketModel->getApi($transactionId);
49
- $this->_api->setOrder($this->getInfo()->getOrder());
50
- }
51
- return $this->_api;
52
- }
53
-
54
- /**
55
- * Get disposition state from Cash-Ticket
56
- * and set the response for later use
57
- *
58
- * @return object
59
- */
60
- public function callGetSerialNumbers()
61
- {
62
- if (is_null($this->_response)) {
63
- $this->_response = $this->_api->call('GetSerialNumbers', array());
64
-
65
- if ($this->_response->errCode != '0') {
66
- Mage::throwException(Mage::helper('cashticket')->__('Error getting Cash-Ticket status.'));
67
- return $this;
68
- }
69
- }
70
- return $this->_response;
71
- }
72
-
73
- /**
74
- * Map status codes to strings
75
- *
76
- * @return string
77
- */
78
- public function getPaymentStatus()
79
- {
80
- if (is_null($this->_response)) {
81
- return $this;
82
- }
83
-
84
- switch ($this->_response->TransactionState) {
85
- case 'R':
86
- $status = $this->helper('cashticket')->__('Created (R)');
87
- break;
88
- case 'S':
89
- $status = $this->helper('cashticket')->__('Disposed (S)');
90
- break;
91
- case 'E':
92
- $status = $this->helper('cashticket')->__('Debited (E)');
93
- break;
94
- case 'O':
95
- $status = $this->helper('cashticket')->__('Consumed (O)');
96
- break;
97
- case 'L':
98
- $status = $this->helper('cashticket')->__('Canceled (L)');
99
- break;
100
- case 'I':
101
- $status = $this->helper('cashticket')->__('Invalid (I)');
102
- break;
103
- case 'X':
104
- $status = $this->helper('cashticket')->__('Expired (X)');
105
- break;
106
- default:
107
- $status = $this->helper('cashticket')->__(sprintf(Mage::helper('cashticket')->__('Unknown status (%s)'), $response->TransactionState));
108
- break;
109
- }
110
-
111
- return $status;
112
- }
113
-
114
- /**
115
- * Get status codes allowed to
116
- * continue transactions and debiting
117
- *
118
- * @return array
119
- */
120
- public function getAllowedStats()
121
- {
122
- return array('R', 'S', 'E');
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
- * @category Symmetrics
4
- * @package Symmetrics_CashTicket
5
- * @author symmetrics gmbh <info@symmetrics.de>, Eugen Gitin <eg@symmetrics.de>
6
- * @copyright symmetrics gmbh
7
- * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
8
- */
9
-
10
- class Symmetrics_CashTicket_Helper_Data extends Mage_Core_Helper_Abstract
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
- * @category Symmetrics
4
- * @package Symmetrics_CashTicket
5
- * @author symmetrics gmbh <info@symmetrics.de>, Eugen Gitin <eg@symmetrics.de>
6
- * @copyright symmetrics gmbh
7
- * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
 
 
 
 
 
 
 
 
 
 
 
 
 
 
8
  */
9
 
10
- class Symmetrics_CashTicket_Model_Api extends Varien_Http_Adapter_Curl
 
 
 
 
 
 
 
 
 
 
 
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(array(
52
- 'currency' => $this->getConfigValue('currency_code'),
53
- 'mid' => $this->getConfigValue('merchant_id'),
54
- 'businesstype' => $this->getConfigValue('business_type'),
55
- 'reportingcriteria' => $this->getConfigValue('reporting_criteria'),
56
- 'okurl' => Mage::getUrl('cashticket/processing/success'),
57
- 'nokurl' => Mage::getUrl('cashticket/processing/error'),
58
- 'locale' => $this->getConfigValue('locale'),
59
- 'outputFormat' => 'xml_v1',
60
- 'mtid' => $this->getTransactionId()
61
- ), $params);
 
 
 
62
 
63
  // format params for curl
64
  foreach ($params as $key => $value) {
65
- $callParams .= '&'.$key.'='.urlencode($value);
66
  }
67
 
68
  try {
69
  // do curl post
70
- $this->write(Zend_Http_Client::POST, $this->getCashTicketUrl().$functionName . 'Servlet', '1.1', array(), $callParams);
 
 
 
 
 
 
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, $http_ver = '1.1', $headers = array(), $body = '')
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
- Mage::throwException(Mage::helper('cashticket')->__('SSL Certificate Password is empty. Please set the passwort in the configuration settings.'));
 
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(array(
183
- 'currency' => $this->getConfigValue('currency_code'),
184
- 'mid' => $this->getConfigValue('merchant_id'),
185
- 'locale' => $this->getConfigValue('locale'),
186
- 'mtid' => $this->getTransactionId()
187
- ), $params);
 
 
 
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
- Mage::throwException(Mage::helper('cashticket')->__('Multiply active configuration for this currency.'));
 
288
  }
289
  // set the config with loaded data
290
  $this->_config = $model->getConfigItem($this->getCurrency());
291
  $value = $this->_config[$key];
292
- }
293
- // if already set - load from model
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
- * @category Symmetrics
4
- * @package Symmetrics_CashTicket
5
- * @author symmetrics gmbh <info@symmetrics.de>, Eugen Gitin <eg@symmetrics.de>
6
- * @copyright symmetrics gmbh
7
- * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
8
- */
9
-
10
- class Symmetrics_CashTicket_Model_CashTicket extends Mage_Payment_Model_Method_Abstract
11
- {
12
- /**
13
- * Internal payment code
14
- *
15
- * @var string
16
- */
17
- protected $_code = 'cashticket';
18
-
19
- /**
20
- * If gateway
21
- *
22
- * @var boolean
23
- */
24
- protected $_isGateway = true;
25
-
26
- /**
27
- * If use authorization
28
- *
29
- * @var boolean
30
- */
31
- protected $_canAuthorize = true;
32
-
33
- /**
34
- * If use capturing
35
- *
36
- * @var boolean
37
- */
38
- protected $_canCapture = true;
39
-
40
- /**
41
- * If capture partial amounts
42
- *
43
- * @var boolean
44
- */
45
- protected $_canCapturePartial = false;
46
-
47
- /**
48
- * If using refund
49
- *
50
- * @var boolean
51
- */
52
- protected $_canRefund = false;
53
-
54
- /**
55
- * If can void
56
- *
57
- * @var boolean
58
- */
59
- protected $_canVoid = false;
60
-
61
- /**
62
- * If using for internal
63
- *
64
- * @var boolean
65
- */
66
- protected $_canUseInternal = true;
67
-
68
- /**
69
- * If using on checkout
70
- *
71
- * @var boolean
72
- */
73
- protected $_canUseCheckout = true;
74
-
75
- /**
76
- * If using on multishipping
77
- *
78
- * @var boolean
79
- */
80
- protected $_canUseForMultishipping = true;
81
-
82
- /**
83
- * If saving creditcards
84
- *
85
- * @var boolean
86
- */
87
- protected $_canSaveCc = false;
88
-
89
- /**
90
- * If validating
91
- *
92
- * @var boolean
93
- */
94
- protected $_canValidate = true;
95
-
96
- /**
97
- * Define block for payment form
98
- *
99
- * @var string
100
- */
101
- protected $_formBlockType = 'cashticket/form';
102
-
103
- /**
104
- * Define block for payment info
105
- *
106
- * @var string
107
- */
108
- protected $_infoBlockType = 'cashticket/info';
109
-
110
- /**
111
- * Id of the transaction for
112
- * current API call
113
- *
114
- * @var string
115
- */
116
- protected $_transactionId = '';
117
-
118
- public function _construct()
119
- {
120
- parent::_construct();
121
- $this->_init('cashticket/item');
122
- }
123
-
124
- /**
125
- * Get API object
126
- *
127
- * @return object
128
- */
129
- public function getApi($transactionId)
130
- {
131
- $api = Mage::getModel('cashticket/api');
132
- $api->setTransactionId($transactionId);
133
- $api->setOrder($this->getQuote());
134
-
135
- return $api;
136
- }
137
-
138
- /**
139
- * Get checkout from session
140
- *
141
- * @return object
142
- */
143
- public function getCheckout()
144
- {
145
- return Mage::getModel('checkout/session');
146
- }
147
-
148
- /**
149
- * Get session for Cash-Ticket
150
- *
151
- * @return object
152
- */
153
- public function getSession()
154
- {
155
- return Mage::getModel('cashticket/session');
156
- }
157
-
158
- /**
159
- * Get quote
160
- *
161
- * @return object
162
- */
163
- public function getQuote()
164
- {
165
- return $this->getCheckout()->getQuote();
166
- }
167
-
168
- /**
169
- * Check if payment method is available
170
- *
171
- * @return bool
172
- */
173
- public function isAvailable($quote = null)
174
- {
175
- // if quote is not set - something went wrong
176
- if (is_null($quote)) {
177
- return false;
178
- }
179
-
180
- // if cart value > 1000 - cancel
181
- // cash-ticket does not support orders
182
- // with value > 1000 at this time
183
- if (Mage::app()->getStore()->roundPrice($quote->getGrandTotal()) <= 1000) {
184
- return true;
185
- }
186
-
187
- return false;
188
- }
189
-
190
- /**
191
- * Create disposition on Cash-Ticket
192
- *
193
- * @return object
194
- */
195
- public function authorize(Varien_Object $payment, $amount)
196
- {
197
- // generate random transaction number (number from 100 to 999 + orderid)
198
- $transactionId = rand(100, 999) . $payment->getOrder()->increment_id;
199
- $api = $this->getApi($transactionId);
200
-
201
- // override the amount to get the really order amount
202
- // needed for currency operations
203
- $amount = $api->formatPrice($this->getQuote()->getGrandTotal());
204
-
205
- $params = array(
206
- 'amount' => $amount
207
- );
208
-
209
- // save transactionid in payment data
210
- $payment->setAdditionalData($transactionId);
211
-
212
- // get response from api
213
- $response = $api->call('CreateDisposition', $params);
214
-
215
- // if response could be parsed and no error happened
216
- if (is_object($response) && $response->errCode == '0')
217
- {
218
- return $this;
219
- }
220
- else {
221
- // TODO: Translate
222
- Mage::throwException(Mage::helper('cashticket')->__('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.'));
223
- }
224
-
225
- return $this;
226
- }
227
-
228
- /**
229
- * Get redirect URL
230
- *
231
- * @return string
232
- */
233
- public function getOrderPlaceRedirectUrl()
234
- {
235
- return Mage::getUrl('cashticket/processing/redirect');
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
- * @category Symmetrics
4
- * @package Symmetrics_CashTicket
5
- * @author symmetrics gmbh <info@symmetrics.de>, Eugen Gitin <eg@symmetrics.de>
6
- * @copyright symmetrics gmbh
7
- * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
8
- */
9
-
10
- class Symmetrics_CashTicket_Model_Item extends Mage_Core_Model_Abstract
11
- {
12
- public function _construct()
13
- {
14
- parent::_construct();
15
- $this->_init('cashticket/item');
16
- }
17
-
18
- /**
19
- * Get config item object
20
- * and load by currency
21
- *
22
- * @return string
23
- */
24
- public function getConfigItem($currency)
25
- {
26
- $ids = $this->getItemsCollection($currency)->getAllIds();
27
- return $this->load($ids[0])->toArray();
28
- }
29
-
30
- /**
31
- * Get all enabled config items
32
- * for current currency
33
- *
34
- * @return string
35
- */
36
- public function getItemsCollection($currency)
37
- {
38
- $collection = $this->getCollection()
39
- ->addFieldToFilter('currency_code', $currency)
40
- ->addFieldToFilter('enable', 1);
41
-
42
- return $collection;
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
- * @category Symmetrics
4
- * @package Symmetrics_CashTicket
5
- * @author symmetrics gmbh <info@symmetrics.de>, Eugen Gitin <eg@symmetrics.de>
6
- * @copyright symmetrics gmbh
7
- * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
8
- */
9
-
10
- class Symmetrics_CashTicket_Model_Mysql4_Item extends Mage_Core_Model_Mysql4_Abstract
11
- {
12
- public function _construct()
13
- {
14
- $this->_init('cashticket/item', 'item_id');
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
- * @category Symmetrics
4
- * @package Symmetrics_CashTicket
5
- * @author symmetrics gmbh <info@symmetrics.de>, Eugen Gitin <eg@symmetrics.de>
6
- * @copyright symmetrics gmbh
7
- * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
8
- */
9
-
10
- class Symmetrics_CashTicket_Model_Mysql4_Item_Collection extends Mage_Core_Model_Mysql4_Collection_Abstract
11
- {
12
- public function _construct()
13
- {
14
- parent::_construct();
15
- $this->_init('cashticket/item');
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
- * @category Symmetrics
4
- * @package Symmetrics_CashTicket
5
- * @author symmetrics gmbh <info@symmetrics.de>, Eugen Gitin <eg@symmetrics.de>
6
- * @copyright symmetrics gmbh
7
- * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
8
- */
9
-
10
- class Symmetrics_CashTicket_Model_Source_BusinessType
11
- {
12
- /**
13
- * Get possible business types
14
- *
15
- * @return array
16
- */
17
- public function getOptionArray()
18
- {
19
- return array(
20
- 'T' => Mage::helper('cashticket')->__('Tangible'),
21
- 'I' => Mage::helper('cashticket')->__('Intangible')
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
- * @category Symmetrics
4
- * @package Symmetrics_CashTicket
5
- * @author symmetrics gmbh <info@symmetrics.de>, Eugen Gitin <eg@symmetrics.de>
6
- * @copyright symmetrics gmbh
7
- * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
8
- */
9
-
10
- class Symmetrics_CashTicket_Model_Source_Currency
11
- {
12
- /**
13
- * Get possible currencies
14
- *
15
- * @return array
16
- */
17
- public function getOptionArray()
18
- {
19
- return array(
20
- 'CHF' => 'CHF',
21
- 'DKK' => 'DKK',
22
- 'SEK' => 'SEK',
23
- 'SEK' => 'SEK',
24
- 'PLN' => 'PLN',
25
- 'GBP' => 'GBP',
26
- 'EUR' => 'EUR',
27
- 'USD' => 'USD',
28
- 'CZK' => 'CZK'
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
- * @category Symmetrics
4
- * @package Symmetrics_CashTicket
5
- * @author symmetrics gmbh <info@symmetrics.de>, Eugen Gitin <eg@symmetrics.de>
6
- * @copyright symmetrics gmbh
7
- * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
8
- */
9
-
10
- class Symmetrics_CashTicket_Model_Source_Locale
11
- {
12
- /**
13
- * Get locales
14
- *
15
- * @return array
16
- */
17
- public function getOptionArray()
18
- {
19
- return array(
20
- 'de_de' => Mage::helper('cashticket')->__('German Germany'),
21
- 'de_at' => Mage::helper('cashticket')->__('German Austria'),
22
- 'en_uk' => Mage::helper('cashticket')->__('British English'),
23
- 'en_us' => Mage::helper('cashticket')->__('American English')
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
- * @category Symmetrics
4
- * @package Symmetrics_CashTicket
5
- * @author symmetrics gmbh <info@symmetrics.de>, Eugen Gitin <eg@symmetrics.de>
6
- * @copyright symmetrics gmbh
7
- * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
8
- */
9
-
10
- class Symmetrics_CashTicket_Adminhtml_CashticketController extends Mage_Adminhtml_Controller_Action
11
- {
12
- /**
13
- * Default action called by pressing
14
- * the "send" button in order info
15
- * performed by AJAX
16
- *
17
- * @return object
18
- */
19
- public function defaultAction()
20
- {
21
- $postParams = $this->getRequest()->getParams();
22
- // get action variable from post
23
- $action = $postParams['cashticketAction'];
24
- // get order by id
25
- $order = $this->getOrder($postParams['orderId']);
26
- // get api and set the transaction id
27
- $api = $this->getApi($postParams['transactionId']);
28
- // get entered amount
29
- $amount = $api->formatPrice($postParams['amount']);
30
-
31
- // if entered amount is less then zero by modifying transaction
32
- if ($amount <= 0 && $action == 'modify') {
33
- // return error message
34
- Mage::getSingleton('adminhtml/session')->addError(Mage::helper('cashticket')->__('Debit amount must be greater then zero.'));
35
- return $this;
36
- }
37
-
38
- // switch between two functions (debit and modify) selected from order info box
39
- if ($action == 'debit') {
40
- // get disposition state from Cash-Ticket
41
- $response = $api->call('GetDispositionState', array());
42
- // if allow to debit
43
- if (is_object($response) && $response->errCode == '0' && $response->Amount > 0 && $response->TransactionState == 'D') {
44
- $params = array(
45
- 'amount' => $amount,
46
- 'close' => '0',
47
- );
48
- // call Cash-Ticket debit function with entered amount
49
- $debitResponse = $api->call('Debit', $params);
50
- if ($debitResponse->errCode == '0') {
51
- // if everything was ok - save the new status and add info to order history
52
- $order->addStatusToHistory(Mage_Sales_Model_Order::STATE_PROCESSING, sprintf(Mage::helper('cashticket')->__('Amount %s %s was successfully captured from customers Cash-Tickets.'), $amount, $api->getCurrency()));
53
- $order->save();
54
-
55
- Mage::getSingleton('adminhtml/session')->addSuccess(Mage::helper('cashticket')->__(sprintf(Mage::helper('cashticket')->__('Amount of %s %s was successfully debited.'), $amount, $api->getCurrency())));
56
- return $this;
57
- }
58
- else {
59
- $errorMessage = preg_replace('/&/', '', $debitResponse->errMessage);
60
- $errorMessage = preg_replace('/;/', '', $errorMessage);
61
- Mage::getSingleton('adminhtml/session')->addError($errorMessage);
62
- return $this;
63
- }
64
- }
65
- else {
66
- // if can not process debit
67
- Mage::getSingleton('adminhtml/session')->addError(Mage::helper('cashticket')->__('Error processing the Cash-Ticket request.'));
68
- return $this;
69
- }
70
- }
71
- elseif ($action == 'modify') {
72
- // call Cash-Ticket modify function and modify the transaction amount
73
- $response = $api->call('ModifyDisposition', array('amount' => $amount));
74
-
75
- if (is_object($response) && $response->errCode == '0') {
76
- // if everything was ok - save the new status and add info to order history
77
- $order->addStatusToHistory(Mage_Sales_Model_Order::STATE_PROCESSING, sprintf('Disposition modified. New value: %s %s', $amount, $api->getCurrency()));
78
- $order->save();
79
- Mage::getSingleton('adminhtml/session')->addSuccess(Mage::helper('cashticket')->__(sprintf('Disposition was successfully modified (%s %s).', $amount, $api->getCurrency())));
80
- return $this;
81
- }
82
- else {
83
- Mage::getSingleton('adminhtml/session')->addError(Mage::helper('cashticket')->__('Error processing the Cash-Ticket request.'));
84
- return $this;
85
- }
86
- }
87
-
88
- return $this;
89
- }
90
-
91
- /**
92
- * Get order object and load
93
- * order by id
94
- *
95
- * @return object
96
- */
97
- public function getOrder($orderId = null)
98
- {
99
- $order = Mage::getModel('sales/order');
100
- $order->load($orderId);
101
-
102
- return $order;
103
- }
104
-
105
- /**
106
- * Get API object and set
107
- * the transaction
108
- *
109
- * @return object
110
- */
111
- public function getApi($transactionId = null)
112
- {
113
- $postParams = $this->getRequest()->getParams();
114
- $cashTicketModel = Mage::getModel('cashticket/cashticket');
115
- $api = $cashTicketModel->getApi($transactionId);
116
- $api->setTransactionId($transactionId);
117
- $api->setOrder($this->getOrder($postParams['orderId']));
118
-
119
- return $api;
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
- * @category Symmetrics
4
- * @package Symmetrics_CashTicket
5
- * @author symmetrics gmbh <info@symmetrics.de>, Eugen Gitin <eg@symmetrics.de>
6
- * @copyright symmetrics gmbh
7
- * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
8
- */
9
-
10
- class Symmetrics_CashTicket_Adminhtml_ConfigController extends Mage_Adminhtml_Controller_Action
11
- {
12
- /**
13
- * Initialize the controller
14
- *
15
- * @return object
16
- */
17
- protected function _initAction()
18
- {
19
- $this->loadLayout()
20
- ->_setActiveMenu('cashticket/items')
21
- ->_addBreadcrumb(Mage::helper('adminhtml')->__('Items Manager'), Mage::helper('adminhtml')->__('Item Manager'));
22
-
23
- return $this;
24
- }
25
-
26
- /**
27
- * Default action
28
- *
29
- * @return void
30
- */
31
- public function indexAction()
32
- {
33
- $this->_initAction()->renderLayout();
34
- }
35
-
36
- /**
37
- * Redirect to edit action
38
- *
39
- * @return void
40
- */
41
- public function newAction()
42
- {
43
- $this->_forward('edit');
44
- }
45
-
46
- /**
47
- * Edit form action
48
- *
49
- * @return string
50
- */
51
- public function editAction()
52
- {
53
- $id = $this->getRequest()->getParam('id');
54
- // load the item model by id
55
- $model = Mage::getModel('cashticket/item')->load($id);
56
- // if id was found
57
- if ($model->getId() || $id == 0) {
58
- $data = Mage::getSingleton('adminhtml/session')->getFormData(true);
59
-
60
- if (!empty($data)) {
61
- $model->setData($data);
62
- }
63
-
64
- // set the model to register for later use
65
- Mage::register('cashticket_data', $model);
66
-
67
- $this->loadLayout();
68
- $this->_setActiveMenu('cashticket/items');
69
-
70
- $this->_addBreadcrumb(Mage::helper('adminhtml')->__('Item Manager'), Mage::helper('adminhtml')->__('Item Manager'));
71
- $this->_addBreadcrumb(Mage::helper('adminhtml')->__('Item News'), Mage::helper('adminhtml')->__('Item News'));
72
-
73
- $this->getLayout()->getBlock('head')->setCanLoadExtJs(true);
74
-
75
- $this->_addContent($this->getLayout()->createBlock('cashticket/adminhtml_config_edit'));
76
-
77
- $this->renderLayout();
78
- }
79
- else {
80
- // otherwise show error
81
- Mage::getSingleton('adminhtml/session')->addError(Mage::helper('cashticket')->__('Item does not exist'));
82
- $this->_redirect('*/*/');
83
- }
84
- }
85
-
86
- /**
87
- * Save form action
88
- *
89
- * @return
90
- */
91
- public function saveAction()
92
- {
93
- // if have data in post
94
- if ($data = $this->getRequest()->getPost()) {
95
- // load the config item model and set the id
96
- $model = Mage::getModel('cashticket/item');
97
- $model->setData($data)->setId($this->getRequest()->getParam('item_id'));
98
-
99
- try {
100
- // get all enabled configs for the currency
101
- $collection = Mage::getModel('cashticket/item')->getCollection()
102
- ->addFilter('currency_code', $model->getCurrencyCode())
103
- ->addFilter('enable', 1);
104
-
105
- $size = $collection->getSize();
106
- $ids = $collection->getAllIds();
107
-
108
- // if there are already saved active config items
109
- if ($size > 0 && $ids[0] != $model->getItemId()) {
110
- // throw error
111
- Mage::throwException(Mage::helper('cashticket')->__(sprintf('You have already an active configuration for currency %s.', $model->getCurrencyCode())));
112
- }
113
-
114
- // set update and creation time to now if saving the new item
115
- if ($model->getCreatedTime == NULL || $model->getUpdateTime() == NULL) {
116
- $model->setCreatedTime(now())->setUpdateTime(now());
117
- }
118
- else {
119
- $model->setUpdateTime(now());
120
- }
121
-
122
- $model->save();
123
-
124
- // add success message
125
- Mage::getSingleton('adminhtml/session')->addSuccess(Mage::helper('cashticket')->__(sprintf('Configuration for %s was successfully saved', $model->getData('currency_code'))));
126
- Mage::getSingleton('adminhtml/session')->setFormData(false);
127
-
128
- // if save and continue
129
- if ($this->getRequest()->getParam('back')) {
130
- // redirect to the edit form with the same id
131
- $this->_redirect('*/*/edit', array('id' => $model->getId()));
132
- return;
133
- }
134
-
135
- $this->_redirect('*/*/');
136
- return;
137
-
138
- } catch (Exception $e) {
139
- Mage::getSingleton('adminhtml/session')->addError($e->getMessage());
140
- Mage::getSingleton('adminhtml/session')->setFormData($data);
141
- $this->_redirect('*/*/edit', array('id' => $this->getRequest()->getParam('item_id')));
142
- return;
143
- }
144
- }
145
- Mage::getSingleton('adminhtml/session')->addError(Mage::helper('cashticket')->__('Unable to find item to save'));
146
- $this->_redirect('*/*/');
147
- }
148
-
149
- /**
150
- * Delete action
151
- *
152
- * @return
153
- */
154
- public function deleteAction()
155
- {
156
- // if id is set
157
- if ($this->getRequest()->getParam('id') > 0) {
158
- try {
159
- // delete config item
160
- $model = Mage::getModel('cashticket/item');
161
- $model->setId($this->getRequest()->getParam('id'))
162
- ->delete();
163
- Mage::getSingleton('adminhtml/session')->addSuccess(Mage::helper('adminhtml')->__('Item was successfully deleted'));
164
- $this->_redirect('*/*/');
165
- } catch (Exception $e) {
166
- Mage::getSingleton('adminhtml/session')->addError($e->getMessage());
167
- $this->_redirect('*/*/edit', array('id' => $this->getRequest()->getParam('id')));
168
- }
169
- }
170
- // redirect to back to grid
171
- $this->_redirect('*/*/');
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
- * @category Symmetrics
4
- * @package Symmetrics_CashTicket
5
- * @author symmetrics gmbh <info@symmetrics.de>, Eugen Gitin <eg@symmetrics.de>
6
- * @copyright symmetrics gmbh
7
- * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
8
- */
9
-
10
- class Symmetrics_CashTicket_ProcessingController extends Mage_Core_Controller_Front_Action
11
- {
12
- /**
13
- * Standard expire ajax function
14
- *
15
- * @return void
16
- */
17
- protected function _expireAjax()
18
- {
19
- if (!Mage::getSingleton('checkout/session')->getQuote()->hasItems()) {
20
- $this->getResponse()->setHeader('HTTP/1.1', '403 Session Expired');
21
- exit;
22
- }
23
- }
24
-
25
- /**
26
- * Get the checkout object
27
- *
28
- * @return object
29
- */
30
- public function getCheckout()
31
- {
32
- return Mage::getSingleton('checkout/session');
33
- }
34
-
35
- /**
36
- * Get the API object and
37
- * set transaction
38
- *
39
- * @return object
40
- */
41
- public function getApi($transactionId = null)
42
- {
43
- $cashTicketModel = Mage::getModel('cashticket/cashticket');
44
- $api = $cashTicketModel->getApi($transactionId);
45
- $api->setTransactionId($transactionId);
46
-
47
- return $api;
48
- }
49
-
50
- /**
51
- * Get the order object and
52
- * load by id
53
- *
54
- * @return object
55
- */
56
- public function getOrder($orderId = null)
57
- {
58
- $order = Mage::getModel('sales/order');
59
- $order->loadByIncrementId($orderId);
60
-
61
- return $order;
62
- }
63
-
64
- /**
65
- * Action called when customer finishes
66
- * the checkout process
67
- *
68
- * @return object
69
- */
70
- public function redirectAction()
71
- {
72
- $checkout = $this->getCheckout();
73
- $order = $this->getOrder($checkout->getLastRealOrderId());
74
- $payment = $order->getPayment();
75
- $api = $this->getApi($payment->getAdditionalData());
76
-
77
- // get order total price and format it for the Cash-Ticket API
78
- $params = array(
79
- 'amount' => $api->formatPrice(Mage::app()->getStore()->roundPrice($order->getGrandTotal()))
80
- );
81
-
82
- // set new order status and save info for order history
83
- $order->addStatusToHistory(
84
- $order->getStatus(),
85
- sprintf(Mage::helper('cashticket')->__('Customer was redirected to Cash-Ticket. Transaction ID: %s', $payment->getAdditionalData())));
86
-
87
- $order->save();
88
-
89
- // unset the quoteId
90
- $checkout->unsQuoteId();
91
-
92
- // redirect customer to the Cash-Ticket page
93
- $this->getResponse()->setRedirect($api->getCustomerRedirectUrl($params));
94
-
95
- return $this;
96
- }
97
-
98
- /**
99
- * Action called when customer
100
- * returns from the Cash-Ticket page
101
- *
102
- * @return object
103
- */
104
- public function successAction()
105
- {
106
- $checkout = $this->getCheckout();
107
- $order = $this->getOrder($checkout->getLastRealOrderId());
108
- $payment = $order->getPayment();
109
- $api = $this->getApi($payment->getAdditionalData());
110
-
111
- // get disposition state
112
- $response = $api->call('GetSerialNumbers', array());
113
-
114
- if (is_object($response) && $response->errCode == '0') {
115
- // s = cash tickets successfully assigned to disposition
116
- if ($response->TransactionState == 'S') {
117
- $amount = Mage::app()->getStore()->roundPrice($order->getGrandTotal());
118
- // if intangible
119
- if ($api->getConfigValue('business_type') == 'I') {
120
- // further debits not possible
121
- // close transaction and debit the full amount
122
- $cashTicketAmount = $amount;
123
- $closeFlag = '1';
124
- }
125
- // if tangible
126
- else {
127
- // further debits are possible
128
- // enable manual debiting
129
- $cashTicketAmount = '0.00';
130
- $closeFlag = '0';
131
- }
132
-
133
- $params = array(
134
- 'amount' => $api->formatPrice($cashTicketAmount),
135
- 'close' => $closeFlag,
136
- );
137
-
138
- // call the debit function on Cash-Ticket
139
- $response = $api->call('Debit', $params);
140
-
141
- if (is_object($response) && $response->errCode == '0') {
142
- if ($api->getConfigValue('business_type') == 'I') {
143
- $statusMessage = Mage::helper('cashticket')->__(sprintf('Transaction successful. %s %s debited', $cashTicketAmount, $api->getCurrency()));
144
- }
145
- else {
146
- $statusMessage = Mage::helper('cashticket')->__(sprintf('Cash-Ticket cards were successfully assigned to disposition. The amount of %s %s can be debited.', $amount, $api->getCurrency()));
147
- }
148
-
149
- // set the new order status and save comment
150
- $newOrderStatus = $api->getDefaultConfigValue('order_status', $order->getStoreId());
151
- if (empty($newOrderStatus)) {
152
- $newOrderStatus = Mage_Sales_Model_Order::STATE_PROCESSING;
153
- }
154
-
155
- $order->addStatusToHistory($newOrderStatus, $statusMessage);
156
- $order->save();
157
-
158
- $checkout->getQuote()->setIsActive(false)->save();
159
-
160
- // redirect to success page
161
- $this->_redirect('checkout/onepage/success', array('_secure'=>true));
162
- return $this;
163
- }
164
- else {
165
- // debit was not successful
166
- Mage::throwException($response->errMessage);
167
- return $this;
168
- }
169
- }
170
- else {
171
- // do not process payment because something went wrong on the Cash-Ticket page
172
- Mage::throwException(Mage::helper('cashticket')->__('Error processing payment. It could have following reasons: no cards assigned to disposition, disposition already debited, disposition canceled by customer or expired by Cash-Ticket.'));
173
- return $this;
174
- }
175
- }
176
- else {
177
- Mage::throwException($response->errMessage);
178
- return $this;
179
- }
180
- }
181
-
182
- /**
183
- * Action called when customer hits
184
- * cancel button on the Cash-Ticket
185
- * page
186
- *
187
- * @return string
188
- */
189
- public function errorAction()
190
- {
191
- // show error block
192
- $this->getResponse()->setBody(
193
- $this->getLayout()
194
- ->createBlock('cashticket/error')
195
- ->toHtml()
196
- );
197
-
198
- return $this;
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
- * @category Symmetrics
5
- * @package Symmetrics_CashTicket
6
- * @author symmetrics gmbh <info@symmetrics.de>, Eugen Gitin <eg@symmetrics.de>
7
- * @copyright symmetrics gmbh
8
- * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
 
 
 
 
 
 
 
 
 
 
 
 
 
 
9
  */
10
  -->
11
  <config>
12
  <modules>
13
  <Symmetrics_CashTicket>
14
- <version>0.1.4</version>
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
- * @category Symmetrics
5
- * @package Symmetrics_CashTicket
6
- * @author symmetrics gmbh <info@symmetrics.de>, Eugen Gitin <eg@symmetrics.de>
7
- * @copyright symmetrics gmbh
8
- * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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
- * @category Symmetrics
4
- * @package Symmetrics_CashTicket
5
- * @author symmetrics gmbh <info@symmetrics.de>, Eugen Gitin <eg@symmetrics.de>
6
- * @copyright symmetrics gmbh
7
- * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
8
- */
9
-
10
- $installer = $this;
11
-
12
- $installer->startSetup();
13
-
14
- // create table for saving cashticket configurations
15
- $installer->run("
16
- DROP TABLE IF EXISTS {$this->getTable('symmetrics_cashticket')};
17
- CREATE TABLE {$this->getTable('symmetrics_cashticket')} (
18
- `item_id` int(11) NOT NULL auto_increment,
19
- `enable` tinyint NOT NULL,
20
- `currency_code` varchar(3) NOT NULL,
21
- `merchant_id` varchar(20) NOT NULL,
22
- `business_type` varchar(5) NOT NULL,
23
- `reporting_criteria` varchar(8) NOT NULL,
24
- `locale` varchar(10) NOT NULL,
25
- `path_pem_test` varchar(255) NOT NULL,
26
- `path_pem_live` varchar(255) NOT NULL,
27
- `path_cert` varchar(255) NOT NULL,
28
- `sslcert_pass` varchar(255) NOT NULL,
29
- `sandbox` enum('1', '0') NOT NULL,
30
- `created_time` datetime default NULL,
31
- `update_time` datetime default NULL,
32
- PRIMARY KEY (`item_id`)
33
- ) ENGINE=InnoDB DEFAULT CHARSET=utf8;
34
- ");
35
-
36
- $installer->endSetup();
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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
- * @category Symmetrics
5
- * @package Symmetrics_CashTicket
6
- * @author symmetrics gmbh <info@symmetrics.de>, Eugen Gitin <eg@symmetrics.de>
7
- * @copyright symmetrics gmbh
8
- * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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
- * @category Symmetrics
4
- * @package Symmetrics_CashTicket
5
- * @author symmetrics gmbh <info@symmetrics.de>, Eugen Gitin <eg@symmetrics.de>
6
- * @copyright symmetrics gmbh
7
- * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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
- * @category Symmetrics
4
- * @package Symmetrics_CashTicket
5
- * @author symmetrics gmbh <info@symmetrics.de>, Eugen Gitin <eg@symmetrics.de>
6
- * @copyright symmetrics gmbh
7
- * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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
- * @category Symmetrics
4
- * @package Symmetrics_CashTicket
5
- * @author symmetrics gmbh <info@symmetrics.de>, Eugen Gitin <eg@symmetrics.de>
6
- * @copyright symmetrics gmbh
7
- * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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
- var SymmetricsCashTicket = Class.create();
2
- // Create a new prototype class
3
- SymmetricsCashTicket.prototype = {
4
- initialize: function(name) {
5
- this.name = name;
6
- // Get base url from blank_img path
7
- this.baseUrl = BLANK_IMG.substr (0, BLANK_IMG.length-13);
8
- // Define action url
9
- this.actionUrl = 'index.php/cashticket/adminhtml_cashticket/default/';
10
- },
11
- // Post an ajax request with selected values
12
- doCashTicketAction: function(action) {
13
- var url = this.baseUrl + this.actionUrl;
14
- var postData = {
15
- // Value from selectbox - modify or debit
16
- 'cashticketAction': $F('cashticket_action'),
17
- // Amount to be modified or debited
18
- 'amount': $('cashticket_amount').getValue(),
19
- // Current order ID
20
- 'orderId': $('cashticket_order_id').getValue(),
21
- // Current transaction ID
22
- 'transactionId': $('cashticket_transaction_id').getValue(),
23
- // Total disposition value
24
- 'totalDispo': $('cashticket_disposition_total').getValue()
25
- };
26
- // Post the request and reload the page on success
27
- new Ajax.Request(url, {
28
- method: 'post',
29
- parameters: postData,
30
- onSuccess: function() {
31
- window.location.reload()
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.4</version>
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>2009-10-30</date>
14
- <time>23:54:36</time>
15
- <contents><target name="magedesign"><dir name="adminhtml"><dir name="default"><dir name="default"><dir name="layout"><file name="cashticket.xml" hash="517ee82fda047a77bd1aac0eec6fe13c"/></dir><dir name="template"><dir name="cashticket"><file name="info.phtml" hash="168f860600142dc4b730dcd05912ad0a"/></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="47ee3374f66bf07c1d7939ba53b3bc19"/><file name="info.phtml" hash="339455fe8872a71feec8c707a65072d7"/></dir></dir></dir></dir></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="1a907ecac3076b1553780efaab46f336"/></dir></dir></dir><dir name="var"><dir name="cashticket"><file name="paysafecard-CA.pem" hash="1cc27c5763294f6c99cdb37f0b8ad528"/></dir></dir></target><target name="mageetc"><dir name="modules"><file name="Symmetrics_CashTicket.xml" hash="ec86cfd342d3c978144735cbf543f056"/></dir></target><target name="magecommunity"><dir name="Symmetrics"><dir name="CashTicket"><dir name="Block"><file name="Error.php" hash="64f7842274232fed92a25848933d09d1"/><file name="Form.php" hash="e4af33eb0afd4e81a7dc329a23f861f9"/><file name="Info.php" hash="30a26959337457765b6c34e80c722fdb"/><dir name="Adminhtml"><file name="Config.php" hash="daa7f93fcc46aaf2fb2b2a4430d67b55"/><dir name="Config"><file name="Edit.php" hash="8a33b119f83816cc8f66db959e12f029"/><file name="Grid.php" hash="c02adcee871db3e97a8373360a5ca57d"/><file name="Renderer.php" hash="db327725ffef45574312cf2170bbd763"/><dir name="Edit"><file name="Form.php" hash="cbbd69a0f1c93c9d00cab9bb3d60021a"/></dir></dir></dir></dir><dir name="controllers"><file name="ProcessingController.php" hash="0a580e59af0baa6b6e6ec9c8a1c23530"/><dir name="Adminhtml"><file name="CashticketController.php" hash="102e6fcfb4fc6c48e423c787bbeff0b4"/><file name="ConfigController.php" hash="707d9649ccbb4f56923f82c57b7da4a1"/></dir></dir><dir name="etc"><file name="config.xml" hash="23f1f021750d515ffd895a491ddf5769"/><file name="system.xml" hash="bde51f891edd77cfae4afe855ce0e976"/></dir><dir name="Helper"><file name="Data.php" hash="22a6518029af102ba0e65182b9f9340b"/></dir><dir name="Model"><file name="Api.php" hash="52ed134166c5335181fe9ba52c27efbb"/><file name="Cashticket.php" hash="e1753d23301568172262ada4a96b65e9"/><file name="Item.php" hash="6fffa0acb8a8f5335ec9ea45500824ed"/><dir name="Mysql4"><file name="Item.php" hash="7d5f7fa5bdb4b7b3e097cc1972a42809"/><dir name="Item"><file name="Collection.php" hash="b6fccb231212da2eaf9ad98c608e099d"/></dir></dir><dir name="Source"><file name="Businesstype.php" hash="5fe80229d3b67b38952fd3c3de35a6ac"/><file name="Currency.php" hash="14f70b66f41ac84ddefa513bade4a24e"/><file name="Locale.php" hash="87ef49c2d7028ee0a0a2e756778894fa"/></dir></dir><dir name="sql"><dir name="cashticket_setup"><file name="mysql4-install-0.1.0.php" hash="305fa391662ceb32e6b2b5630c62cefe"/></dir></dir></dir></dir></target></contents>
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>