symmetrics_cashticket - Version 0.1.14

Version Notes

keine

Download this release

Release Info

Developer Magento Core Team
Extension symmetrics_cashticket
Version 0.1.14
Comparing to
See all releases


Code changes from version 0.1.10 to 0.1.14

app/code/community/Symmetrics/CashTicket/Block/Adminhtml/Config/Edit/Form.php CHANGED
@@ -61,7 +61,7 @@ class Symmetrics_CashTicket_Block_Adminhtml_Config_Edit_Form extends Mage_Adminh
61
  ));
62
 
63
  $fieldset = $form->addFieldset(
64
- 'cashticket_form',
65
  array(
66
  'legend' => Mage::helper('cashticket')->__('Cash-Ticket Configuration')
67
  )
@@ -69,144 +69,33 @@ class Symmetrics_CashTicket_Block_Adminhtml_Config_Edit_Form extends Mage_Adminh
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()) {
@@ -222,4 +111,89 @@ class Symmetrics_CashTicket_Block_Adminhtml_Config_Edit_Form extends Mage_Adminh
222
 
223
  return parent::_prepareForm();
224
  }
225
- }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
61
  ));
62
 
63
  $fieldset = $form->addFieldset(
64
+ 'cashticket_form',
65
  array(
66
  'legend' => Mage::helper('cashticket')->__('Cash-Ticket Configuration')
67
  )
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
+ //add fields to fieldset
81
+ foreach ($this->_getFormFields() as $field) {
82
+ $params = array(
83
+ 'label' => $field['label'],
84
+ 'class' => $field['class'],
85
+ 'required' => $field['required'],
86
+ 'name' => $field['name'],
87
+ );
88
+
89
+ if ($field['options'] !== false) {
90
+ $params['options'] = $field['options'];
91
+ }
92
+
93
+ $fieldset->addField(
94
+ $field['code'],
95
+ $field['type'],
96
+ $params
97
+ );
98
+ }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
99
 
100
  // get form values from the session
101
  if (Mage::getSingleton('adminhtml/session')->getCashticketData()) {
111
 
112
  return parent::_prepareForm();
113
  }
114
+
115
+ /**
116
+ * Get form field elements
117
+ *
118
+ * @return array
119
+ */
120
+ private function _getFormFields()
121
+ {
122
+ $testLabel = 'Path to PEM Certificate (Test)';
123
+ $liveLabel = 'Path to PEM Certificate (Live)';
124
+ return array(
125
+ $this->_createFieldElement('enable', 'select', 'Enable', 'required-entry', true, true),
126
+ $this->_createFieldElement('currency_code', 'select', 'Currency', 'required-entry', true, true),
127
+ $this->_createFieldElement('merchant_id', 'text', 'Merchant ID', 'required-entry', true),
128
+ $this->_createFieldElement('business_type', 'select', 'Business Type', 'required-entry', true, true),
129
+ $this->_createFieldElement('reporting_criteria', 'text', 'Reporting Criteria', '', false),
130
+ $this->_createFieldElement('locale', 'select', 'Language', 'required-entry', true, 'locale', true),
131
+ $this->_createFieldElement('path_pem_test', 'text', $testLabel, 'required-entry', true),
132
+ $this->_createFieldElement('path_pem_live', 'text', $liveLabel, 'required-entry', true),
133
+ $this->_createFieldElement('path_cert', 'text', 'Path to the Server Certificate', 'required-entry', true),
134
+ $this->_createFieldElement('sslcert_pass', 'text', 'Keyring Password', 'required-entry', true),
135
+ $this->_createFieldElement('sandbox', 'select', 'Sandbox', 'required-entry', true, true)
136
+ );
137
+ }
138
+
139
+ /**
140
+ * Create field element
141
+ *
142
+ * @param string $code Code
143
+ * @param string $type Ínput type
144
+ * @param string $label Label
145
+ * @param string $class Class
146
+ * @param boolean $required Is required flag
147
+ * @param boolean $hasOptions Has options flag
148
+ *
149
+ * @return array
150
+ */
151
+ private function _createFieldElement($code, $type, $label, $class, $required, $hasOptions = false)
152
+ {
153
+ $options = false;
154
+
155
+ if ($hasOptions) {
156
+ $options = $this->_getOptionsByCode($code);
157
+ }
158
+
159
+ return array(
160
+ 'code' => $code,
161
+ 'type' => $type,
162
+ 'label' => $label,
163
+ 'class' => $class,
164
+ 'required' => $required,
165
+ 'name' => $code,
166
+ 'options' => $options
167
+ );
168
+ }
169
+
170
+ /**
171
+ * Return option arrays by code
172
+ *
173
+ * @param string $code Code
174
+ *
175
+ * @return array | boolean
176
+ */
177
+ private function _getOptionsByCode($code)
178
+ {
179
+ $options = array(
180
+ 'currency_code' => Mage::getModel('cashticket/source_currency')->getOptionArray(),
181
+ 'business_type' => Mage::getModel('cashticket/source_businesstype')->getOptionArray(),
182
+ 'locale' => Mage::getModel('cashticket/source_locale')->getOptionArray(),
183
+ 'enable' => array(
184
+ 0 => Mage::helper('cashticket')->__('No'),
185
+ 1 => Mage::helper('cashticket')->__('Yes'),
186
+ ),
187
+ 'sandbox' => array(
188
+ 0 => Mage::helper('cashticket')->__('No'),
189
+ 1 => Mage::helper('cashticket')->__('Yes')
190
+ )
191
+ );
192
+
193
+ if (isset($options[$code])) {
194
+ return $options[$code];
195
+ }
196
+
197
+ return false;
198
+ }
199
+ }
app/code/community/Symmetrics/CashTicket/Block/Adminhtml/Config/Renderer.php DELETED
@@ -1,58 +0,0 @@
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/Model/Api.php CHANGED
@@ -128,49 +128,54 @@ class Symmetrics_CashTicket_Model_Api extends Varien_Http_Adapter_Curl
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
- }
149
- // if PEM certificate not found
150
- if (!file_exists($pemCert)) {
151
- Mage::throwException(Mage::helper('cashticket')->__('File with PEM Certificate does not exist'));
152
- }
153
- // if server certificate not found
154
- if (!file_exists(Mage::getBaseDir() . $this->getConfigValue('path_cert'))) {
155
- Mage::throwException(Mage::helper('cashticket')->__('File with Server Certificate does not exist'));
156
- }
 
 
 
 
 
157
 
158
- // set curl connection options
159
- curl_setopt($this->_getResource(), CURLOPT_URL, $url);
160
- curl_setopt($this->_getResource(), CURLOPT_POST, true);
161
- curl_setopt($this->_getResource(), CURLOPT_POSTFIELDS, $body);
162
- curl_setopt($this->_getResource(), CURLOPT_FOLLOWLOCATION, false);
163
- curl_setopt($this->_getResource(), CURLOPT_RETURNTRANSFER, true);
164
- curl_setopt($this->_getResource(), CURLOPT_TIMEOUT, 30);
165
- curl_setopt($this->_getResource(), CURLOPT_SSLCERT, $pemCert);
166
- curl_setopt($this->_getResource(), CURLOPT_SSLCERTTYPE, 'PEM');
167
- curl_setopt($this->_getResource(), CURLOPT_SSLCERTPASSWD, $sslpass);
168
- curl_setopt($this->_getResource(), CURLOPT_SSL_VERIFYPEER, 1);
169
- curl_setopt($this->_getResource(), CURLOPT_SSL_VERIFYHOST, 2);
170
- curl_setopt($this->_getResource(), CURLOPT_CAINFO, Mage::getBaseDir() . $this->getConfigValue('path_cert'));
171
-
172
- return $body;
173
- }
174
 
175
  /**
176
  * Exec curl function and
@@ -246,13 +251,13 @@ class Symmetrics_CashTicket_Model_Api extends Varien_Http_Adapter_Curl
246
  /**
247
  * Set transactionId
248
  *
249
- * @param int $id Id
250
  *
251
  * @return void
252
  */
253
- public function setTransactionId($id)
254
  {
255
- $this->_transactionId = $id;
256
  }
257
 
258
  /**
128
  *
129
  * @return string
130
  */
131
+ public function write($method, $url, $httpVer = '1.1', $headers = array(), $body = '')
132
+ {
133
+ //unused vars, but cannot remove from parameters
134
+ $method = '';
135
+ $httpVer = '';
136
+ $headers = array();
137
+
138
+ // get keyring password
139
+ $sslpass = $this->getConfigValue('sslcert_pass');
140
+
141
+ // can not process if no keyring password is set
142
+ if (empty($sslpass)) {
143
+ $message = 'SSL Certificate Password is empty. Please set the passwort in the configuration settings.';
144
+ Mage::throwException(Mage::helper('cashticket')->__($message));
145
+ }
146
+ // if testing
147
+ if ($this->isSandbox()) {
148
+ // set PEM certificate of the test server
149
+ $pemCert = Mage::getBaseDir() . $this->getConfigValue('path_pem_test');
150
+ } else {
151
+ // set PEM certificate of the live server
152
+ $pemCert = Mage::getBaseDir() . $this->getConfigValue('path_pem_live');
153
+ }
154
+ // if PEM certificate not found
155
+ if (!file_exists($pemCert)) {
156
+ Mage::throwException(Mage::helper('cashticket')->__('File with PEM Certificate does not exist'));
157
+ }
158
+ // if server certificate not found
159
+ if (!file_exists(Mage::getBaseDir() . $this->getConfigValue('path_cert'))) {
160
+ Mage::throwException(Mage::helper('cashticket')->__('File with Server Certificate does not exist'));
161
+ }
162
 
163
+ // set curl connection options
164
+ curl_setopt($this->_getResource(), CURLOPT_URL, $url);
165
+ curl_setopt($this->_getResource(), CURLOPT_POST, true);
166
+ curl_setopt($this->_getResource(), CURLOPT_POSTFIELDS, $body);
167
+ curl_setopt($this->_getResource(), CURLOPT_FOLLOWLOCATION, false);
168
+ curl_setopt($this->_getResource(), CURLOPT_RETURNTRANSFER, true);
169
+ curl_setopt($this->_getResource(), CURLOPT_TIMEOUT, 30);
170
+ curl_setopt($this->_getResource(), CURLOPT_SSLCERT, $pemCert);
171
+ curl_setopt($this->_getResource(), CURLOPT_SSLCERTTYPE, 'PEM');
172
+ curl_setopt($this->_getResource(), CURLOPT_SSLCERTPASSWD, $sslpass);
173
+ curl_setopt($this->_getResource(), CURLOPT_SSL_VERIFYPEER, 1);
174
+ curl_setopt($this->_getResource(), CURLOPT_SSL_VERIFYHOST, 2);
175
+ curl_setopt($this->_getResource(), CURLOPT_CAINFO, Mage::getBaseDir() . $this->getConfigValue('path_cert'));
176
+
177
+ return $body;
178
+ }
179
 
180
  /**
181
  * Exec curl function and
251
  /**
252
  * Set transactionId
253
  *
254
+ * @param int $transId Id
255
  *
256
  * @return void
257
  */
258
+ public function setTransactionId($transId)
259
  {
260
+ $this->_transactionId = $transId;
261
  }
262
 
263
  /**
app/code/community/Symmetrics/CashTicket/Model/Cashticket.php CHANGED
@@ -35,113 +35,105 @@
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
  */
@@ -152,7 +144,7 @@ class Symmetrics_CashTicket_Model_CashTicket extends Mage_Payment_Model_Method_A
152
  }
153
 
154
  /**
155
- * Get API object
156
  *
157
  * @param int $transactionId Transaction Id
158
  *
@@ -168,7 +160,7 @@ class Symmetrics_CashTicket_Model_CashTicket extends Mage_Payment_Model_Method_A
168
  }
169
 
170
  /**
171
- * Get checkout from session
172
  *
173
  * @return object
174
  */
@@ -178,7 +170,7 @@ class Symmetrics_CashTicket_Model_CashTicket extends Mage_Payment_Model_Method_A
178
  }
179
 
180
  /**
181
- * Get session for Cash-Ticket
182
  *
183
  * @return object
184
  */
@@ -188,7 +180,7 @@ class Symmetrics_CashTicket_Model_CashTicket extends Mage_Payment_Model_Method_A
188
  }
189
 
190
  /**
191
- * Get quote
192
  *
193
  * @return object
194
  */
@@ -198,7 +190,7 @@ class Symmetrics_CashTicket_Model_CashTicket extends Mage_Payment_Model_Method_A
198
  }
199
 
200
  /**
201
- * Check if payment method is available
202
  *
203
  * @param object $quote Quote
204
  *
@@ -226,7 +218,7 @@ class Symmetrics_CashTicket_Model_CashTicket extends Mage_Payment_Model_Method_A
226
  }
227
 
228
  /**
229
- * Create disposition on Cash-Ticket
230
  *
231
  * @param Varien_Object $payment Payment Object
232
  * @param int $amount Amount
@@ -270,7 +262,8 @@ class Symmetrics_CashTicket_Model_CashTicket extends Mage_Payment_Model_Method_A
270
  }
271
 
272
  /**
273
- * Get redirect URL
 
274
  *
275
  * @return string
276
  */
@@ -278,4 +271,4 @@ class Symmetrics_CashTicket_Model_CashTicket extends Mage_Payment_Model_Method_A
278
  {
279
  return Mage::getUrl('cashticket/processing/redirect');
280
  }
281
- }
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
+ * Flag for if gateway is used.
46
  *
47
  * @var boolean
48
  */
49
  protected $_isGateway = true;
50
 
51
  /**
52
+ * Flag for if use authorization.
53
  *
54
  * @var boolean
55
  */
56
  protected $_canAuthorize = true;
57
 
58
  /**
59
+ * Flag for if use capturing.
60
  *
61
  * @var boolean
62
  */
63
  protected $_canCapture = true;
64
 
65
  /**
66
+ * Flag for if capture partial amounts.
67
  *
68
  * @var boolean
69
  */
70
  protected $_canCapturePartial = false;
71
 
72
  /**
73
+ * Flag for if using refund.
74
  *
75
  * @var boolean
76
  */
77
  protected $_canRefund = false;
78
 
79
  /**
80
+ * Flag for if can void.
81
  *
82
  * @var boolean
83
  */
84
  protected $_canVoid = false;
85
 
86
  /**
87
+ * Flag for if using for internal.
88
  *
89
  * @var boolean
90
  */
91
+ protected $_canUseInternal = false;
92
 
93
  /**
94
+ * Flag for if using on checkout.
95
  *
96
  * @var boolean
97
  */
98
  protected $_canUseCheckout = true;
99
 
100
  /**
101
+ * Flag for if saving creditcards .
 
 
 
 
 
 
 
102
  *
103
  * @var boolean
104
  */
105
  protected $_canSaveCc = false;
106
 
107
  /**
108
+ * Flag for if validating validating.
109
  *
110
  * @var boolean
111
  */
112
  protected $_canValidate = true;
113
 
114
  /**
115
+ * Define block for payment form.
116
  *
117
  * @var string
118
  */
119
  protected $_formBlockType = 'cashticket/form';
120
 
121
  /**
122
+ * Define block for payment info.
123
  *
124
  * @var string
125
  */
126
  protected $_infoBlockType = 'cashticket/info';
127
 
128
  /**
129
+ * Id of the transaction for current API call.
 
130
  *
131
  * @var string
132
  */
133
  protected $_transactionId = '';
134
 
135
  /**
136
+ * Construct, init resource model.
137
  *
138
  * @return void
139
  */
144
  }
145
 
146
  /**
147
+ * Get API object by transaction id
148
  *
149
  * @param int $transactionId Transaction Id
150
  *
160
  }
161
 
162
  /**
163
+ * Get checkout from session.
164
  *
165
  * @return object
166
  */
170
  }
171
 
172
  /**
173
+ * Get session for Cash-Ticket.
174
  *
175
  * @return object
176
  */
180
  }
181
 
182
  /**
183
+ * Get quote object from checkout session.
184
  *
185
  * @return object
186
  */
190
  }
191
 
192
  /**
193
+ * Check if payment method is available.
194
  *
195
  * @param object $quote Quote
196
  *
218
  }
219
 
220
  /**
221
+ * Create disposition on Cash-Ticket.
222
  *
223
  * @param Varien_Object $payment Payment Object
224
  * @param int $amount Amount
262
  }
263
 
264
  /**
265
+ * Get URL which is called when customer finished
266
+ * the checkout process.
267
  *
268
  * @return string
269
  */
271
  {
272
  return Mage::getUrl('cashticket/processing/redirect');
273
  }
274
+ }
app/code/community/Symmetrics/CashTicket/controllers/Adminhtml/CashticketController.php CHANGED
@@ -28,6 +28,7 @@
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/
@@ -53,12 +54,7 @@ class Symmetrics_CashTicket_Adminhtml_CashticketController extends Mage_Adminhtm
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
 
@@ -107,25 +103,61 @@ class Symmetrics_CashTicket_Adminhtml_CashticketController extends Mage_Adminhtm
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
28
  * @package Symmetrics_CashTicket
29
  * @author symmetrics gmbh <info@symmetrics.de>
30
  * @author Eugen Gitin <eg@symmetrics.de>
31
+ * @author Siegfried Schmitz <ss@symmetrics.de>
32
  * @copyright 2010 symmetrics gmbh
33
  * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
34
  * @link http://www.symmetrics.de/
54
  // get entered amount
55
  $amount = $api->formatPrice($postParams['amount']);
56
 
57
+ if ($this->_checkAmount($amount, $action)) {
 
 
 
 
 
58
  return $this;
59
  }
60
 
103
  'amount' => $amount
104
  )
105
  );
106
+
107
+ $this->_checkStatus($order, $response, $amount, $api);
108
+
109
+ return $this;
 
 
 
 
 
 
 
 
 
 
 
110
  }
111
 
112
  return $this;
113
  }
114
+
115
+ /**
116
+ * Check amount
117
+ *
118
+ * @param string $amount Amount
119
+ * @param string $action Action
120
+ *
121
+ * @return boolean
122
+ */
123
+ private function _checkAmount($amount, $action)
124
+ {
125
+ if ($amount <= 0 && $action == 'modify') {
126
+ // return error message
127
+ $message = 'Debit amount must be greater then zero.';
128
+ Mage::getSingleton('adminhtml/session')->addError(Mage::helper('cashticket')->__($message));
129
+
130
+ return true;
131
+ }
132
+
133
+ return false;
134
+ }
135
+
136
+ /**
137
+ * Check status
138
+ *
139
+ * @param object $order Order object
140
+ * @param object $response Response object
141
+ * @param string $amount Amount
142
+ * @param object $api Api object
143
+ *
144
+ * @return string
145
+ */
146
+ private function _checkStatus($order, $response, $amount, $api)
147
+ {
148
+ if (is_object($response) && $response->errCode == '0') {
149
+ // if everything was ok - save the new status and add info to order history
150
+ $statusString = sprintf('Disposition modified. New value: %s %s', $amount, $api->getCurrency());
151
+ $order->addStatusToHistory(Mage_Sales_Model_Order::STATE_PROCESSING, $statusString);
152
+ $order->save();
153
+ $successMessage = 'Disposition was successfully modified (%s %s).';
154
+ $success = Mage::helper('cashticket')->__($successMessage, $amount, $api->getCurrency());
155
+ Mage::getSingleton('adminhtml/session')->addSuccess($success);
156
+ } else {
157
+ $errorMessage = Mage::helper('cashticket')->__('Error processing the Cash-Ticket request.');
158
+ Mage::getSingleton('adminhtml/session')->addError($errorMessage);
159
+ }
160
+ }
161
 
162
  /**
163
  * Get order object and load
app/code/community/Symmetrics/CashTicket/controllers/Adminhtml/ConfigController.php CHANGED
@@ -78,11 +78,11 @@ class Symmetrics_CashTicket_Adminhtml_ConfigController extends Mage_Adminhtml_Co
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)) {
78
  */
79
  public function editAction()
80
  {
81
+ $itemId = $this->getRequest()->getParam('id');
82
  // load the item model by id
83
+ $model = Mage::getModel('cashticket/item')->load($itemId);
84
  // if id was found
85
+ if ($model->getId() || $itemId == 0) {
86
  $data = Mage::getSingleton('adminhtml/session')->getFormData(true);
87
 
88
  if (!empty($data)) {
app/code/community/Symmetrics/CashTicket/controllers/ProcessingController.php CHANGED
@@ -43,7 +43,7 @@ class Symmetrics_CashTicket_ProcessingController extends Mage_Core_Controller_Fr
43
  {
44
  if (!Mage::getSingleton('checkout/session')->getQuote()->hasItems()) {
45
  $this->getResponse()->setHeader('HTTP/1.1', '403 Session Expired');
46
- exit;
47
  }
48
  }
49
 
43
  {
44
  if (!Mage::getSingleton('checkout/session')->getQuote()->hasItems()) {
45
  $this->getResponse()->setHeader('HTTP/1.1', '403 Session Expired');
46
+ return null;
47
  }
48
  }
49
 
app/code/community/Symmetrics/CashTicket/etc/config.xml CHANGED
@@ -25,7 +25,7 @@
25
  <config>
26
  <modules>
27
  <Symmetrics_CashTicket>
28
- <version>0.1.10</version>
29
  <depends>
30
  <Mage_Payment />
31
  </depends>
25
  <config>
26
  <modules>
27
  <Symmetrics_CashTicket>
28
+ <version>0.1.14</version>
29
  <depends>
30
  <Mage_Payment />
31
  </depends>
package.xml CHANGED
@@ -1,7 +1,7 @@
1
  <?xml version="1.0"?>
2
  <package>
3
  <name>symmetrics_cashticket</name>
4
- <version>0.1.10</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>
@@ -10,9 +10,9 @@
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-10</date>
14
- <time>14:48:26</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="63bb32076b10bd29728cb636034f4a6d"/><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="6a9b5ef7d0ffa3086030aedf59b9da8a"/><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>
1
  <?xml version="1.0"?>
2
  <package>
3
  <name>symmetrics_cashticket</name>
4
+ <version>0.1.14</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>
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-10-20</date>
14
+ <time>10:00:18</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="d46f70025bfa7b7a79a862fd520ffaf1"/></dir><file name="Edit.php" hash="29f90fe1d1095d93bd296ba49f55a05a"/><file name="Grid.php" hash="5f60e8227e92621ffc4730ea4109e9fa"/></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="8d421570ce798eb04e042ea4e4a7d50c"/><file name="ConfigController.php" hash="f4abd8c8e0effe2c856ee65bbab74dc5"/></dir><file name="ProcessingController.php" hash="2ab910e12174a5a1761f8e5568e8eb4f"/></dir><dir name="etc"><file name="config.xml" hash="7f4f5ec8ec1b515c4e7729b12c84e5ba"/><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="f921007729440725626a48f17ec77423"/><file name="Cashticket.php" hash="b5696ef487cfc82ace60774bc208f623"/><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>