ACHpayment - Version 1.4

Version Notes

Ach payment

Download this release

Release Info

Developer Magento Core Team
Extension ACHpayment
Version 1.4
Comparing to
See all releases


Version 1.4

app/code/community/Thylak/ACH/Block/Form/Cc.php ADDED
@@ -0,0 +1,28 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
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 available through the world-wide-web at this URL:
10
+ * http://opensource.org/licenses/osl-3.0.php
11
+ *
12
+ * @category Inmedias
13
+ * @package Inmedias_Wirecard
14
+ * @copyright Copyright (c) 2009 Andreas von Studnitz, team in medias GmbH
15
+ * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
16
+ */
17
+
18
+
19
+ class Thylak_ACH_Block_Form_Cc extends Mage_Payment_Block_Form_Cc
20
+ {
21
+
22
+ protected function _construct()
23
+ {
24
+
25
+ parent::_construct();
26
+ $this->setTemplate('Ach_View/form_cc.phtml');
27
+ }
28
+ }
app/code/community/Thylak/ACH/Block/Form/Eft.php ADDED
@@ -0,0 +1,28 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
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 available through the world-wide-web at this URL:
10
+ * http://opensource.org/licenses/osl-3.0.php
11
+ *
12
+ * @category Inmedias
13
+ * @package Inmedias_Wirecard
14
+ * @copyright Copyright (c) 2009 Andreas von Studnitz, team in medias GmbH
15
+ * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
16
+ */
17
+
18
+
19
+ class Thylak_ACH_Block_Form_Eft extends Mage_Payment_Block_Form
20
+ {
21
+
22
+ protected function _construct()
23
+ {
24
+
25
+ parent::_construct();
26
+ $this->setTemplate('Ach_View\form_eft.phtml');
27
+ }
28
+ }
app/code/community/Thylak/ACH/Block/Info/Cc.php ADDED
@@ -0,0 +1,28 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
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 available through the world-wide-web at this URL:
10
+ * http://opensource.org/licenses/osl-3.0.php
11
+ *
12
+ * @category Inmedias
13
+ * @package Inmedias_Wirecard
14
+ * @copyright Copyright (c) 2009 Andreas von Studnitz, team in medias GmbH
15
+ * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
16
+ */
17
+
18
+
19
+ class Thylak_ACH_Block_Info_Cc extends Mage_Payment_Block_Info_Cc
20
+ {
21
+
22
+ protected function _construct()
23
+ {
24
+ parent::_construct();
25
+ $this->setTemplate('Ach_View/info_cc.phtml');
26
+ }
27
+
28
+ }
app/code/community/Thylak/ACH/Block/Info/Eft.php ADDED
@@ -0,0 +1,28 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
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 available through the world-wide-web at this URL:
10
+ * http://opensource.org/licenses/osl-3.0.php
11
+ *
12
+ * @category Inmedias
13
+ * @package Inmedias_Wirecard
14
+ * @copyright Copyright (c) 2009 Andreas von Studnitz, team in medias GmbH
15
+ * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
16
+ */
17
+
18
+
19
+ class Thylak_ACH_Block_Info_Eft extends Mage_Payment_Block_Info
20
+ {
21
+
22
+ protected function _construct()
23
+ {
24
+ parent::_construct();
25
+ $this->setTemplate('Ach_View/info_eft.phtml');
26
+ }
27
+
28
+ }
app/code/community/Thylak/ACH/Helper/Data.php ADDED
@@ -0,0 +1,65 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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
+ * DISCLAIMER
16
+ *
17
+ * Do not edit or add to this file if you wish to upgrade Magento to newer
18
+ * versions in the future. If you wish to customize Magento for your
19
+ * needs please refer to http://www.magentocommerce.com for more information.
20
+ *
21
+ * @category Inmedias
22
+ * @package Inmedias_Wirecard
23
+ * @copyright Copyright (c) 2009 Andreas von Studnitz, team in medias GmbH
24
+ * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
25
+ */
26
+
27
+ class Thylak_ACH_Helper_Data extends Mage_Core_Helper_Abstract
28
+ {
29
+
30
+ /**
31
+ * Save processing data to database log
32
+ *
33
+ * @param string $orderId
34
+ * @param string $requestXml
35
+ * @param string $responseXml
36
+ * @param string $function
37
+ * @return void
38
+ */
39
+ public function saveLog($orderId, $requestXml, $responseXml, $function = '') {
40
+
41
+ $connection = Mage::getSingleton('core/resource')
42
+ ->getConnection('core_write');
43
+ $connection->beginTransaction();
44
+
45
+ $fields = array(
46
+ 'order_id' => $orderId,
47
+ 'request_xml' => $requestXml,
48
+ 'response_xml' => $responseXml,
49
+ 'function' => $function,
50
+ );
51
+
52
+ try
53
+ {
54
+ $connection->insert('log_wirecard', $fields);
55
+
56
+ $connection->commit();
57
+ }
58
+ catch (Exception $e)
59
+ {
60
+ $connection->rollBack();
61
+ Mage::getSingleton('adminhtml/session')->addError($e->getMessage());
62
+ throw $e;
63
+ }
64
+ }
65
+ }
app/code/community/Thylak/ACH/Model/Config/CcTransactiontype.php ADDED
@@ -0,0 +1,48 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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
+ * DISCLAIMER
16
+ *
17
+ * Do not edit or add to this file if you wish to upgrade Magento to newer
18
+ * versions in the future. If you wish to customize Magento for your
19
+ * needs please refer to http://www.magentocommerce.com for more information.
20
+ *
21
+ * @category Inmedias
22
+ * @package Inmedias_Wirecard
23
+ * @copyright Copyright (c) 2009 Andreas von Studnitz, team in medias GmbH
24
+ * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
25
+ */
26
+
27
+ class Thylak_ACH_Model_Config_CcTransactiontype
28
+ {
29
+ public function toOptionArray()
30
+ {
31
+ $options = array(
32
+ array(
33
+ 'value' => 'PREAUTHORIZATION',
34
+ 'label' => mage::helper('ACH')->__('Preauthorization'),
35
+ ),
36
+ array(
37
+ 'value' => 'AUTHORIZATION',
38
+ 'label' => mage::helper('ACH')->__('Authorization'),
39
+ ),
40
+ array(
41
+ 'value' => 'PURCHASE',
42
+ 'label' => mage::helper('ACH')->__('Purchase'),
43
+ ),
44
+ );
45
+
46
+ return $options;
47
+ }
48
+ }
app/code/community/Thylak/ACH/Model/Config/EftTransactiontype.php ADDED
@@ -0,0 +1,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
+ * DISCLAIMER
16
+ *
17
+ * Do not edit or add to this file if you wish to upgrade Magento to newer
18
+ * versions in the future. If you wish to customize Magento for your
19
+ * needs please refer to http://www.magentocommerce.com for more information.
20
+ *
21
+ * @category Inmedias
22
+ * @package Inmedias_Wirecard
23
+ * @copyright Copyright (c) 2009 Andreas von Studnitz, team in medias GmbH
24
+ * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
25
+ */
26
+
27
+ class Thylak_ACH_Model_Config_EftTransactiontype
28
+ {
29
+ public function toOptionArray()
30
+ {
31
+ $options = array(
32
+ array(
33
+ 'value' => 'AUTHORIZATION',
34
+ 'label' => mage::helper('ACH')->__('Authorization'),
35
+ ),
36
+ array(
37
+ 'value' => 'DEBIT',
38
+ 'label' => mage::helper('ACH')->__('Debit'),
39
+ ),
40
+ );
41
+
42
+ return $options;
43
+ }
44
+ }
app/code/community/Thylak/ACH/Model/CreditCard.php ADDED
@@ -0,0 +1,137 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
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 available through the world-wide-web at this URL:
10
+ * http://opensource.org/licenses/osl-3.0.php
11
+ *
12
+ * @category Inmedias
13
+ * @package Inmedias_Wirecard
14
+ * @copyright Copyright (c) 2009 Andreas von Studnitz, team in medias GmbH
15
+ * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
16
+ */
17
+
18
+ class Thylak_ACH_Model_CreditCard extends Mage_Payment_Model_Method_Cc
19
+ {
20
+
21
+ /**
22
+ * unique internal payment method identifier
23
+ */
24
+ protected $_code = 'ACH_cc';
25
+
26
+ /**
27
+ * Is this payment method a gateway (online auth/charge) ?
28
+ */
29
+ protected $_isGateway = true;
30
+
31
+ /**
32
+ * Can authorize online?
33
+ */
34
+ protected $_canAuthorize = true;
35
+
36
+ /**
37
+ * Can capture funds online?
38
+ */
39
+ protected $_canCapture = true;
40
+
41
+ /**
42
+ * Can capture partial amounts online?
43
+ */
44
+ protected $_canCapturePartial = false;
45
+
46
+ /**
47
+ * Can refund online?
48
+ */
49
+ protected $_canRefund = false;
50
+
51
+ /**
52
+ * Can void transactions online?
53
+ */
54
+ protected $_canVoid = false;
55
+
56
+ /**
57
+ * Can use this payment method in administration panel?
58
+ */
59
+ protected $_canUseInternal = true;
60
+
61
+ /**
62
+ * Can show this payment method as an option on checkout payment page?
63
+ */
64
+ protected $_canUseCheckout = true;
65
+
66
+ /**
67
+ * Is this payment method suitable for multi-shipping checkout?
68
+ */
69
+ protected $_canUseForMultishipping = false;
70
+
71
+ /**
72
+ * Can save credit card information for future processing?
73
+ */
74
+ protected $_canSaveCc = false;
75
+
76
+ protected $_formBlockType = 'ACH/form_cc';
77
+ protected $_infoBlockType = 'ACH/info_cc';
78
+
79
+
80
+ /**
81
+ * Send authorize request to gateway
82
+ *
83
+ * @param Varien_Object $payment
84
+ * @param decimal $amount
85
+ * @return Inmedias_Wirecard_Model_CreditCard
86
+ */
87
+ public function authorize(Varien_Object $payment, $amount)
88
+ {
89
+ $error = false;
90
+ if ($amount > 0) {
91
+
92
+ $payment->setAmount($amount);
93
+
94
+ $result = Mage::getModel('ACH/process')
95
+ ->setPayment($payment)
96
+ ->process();
97
+
98
+ } else {
99
+ $error = mage::helper('ACH')->__('Invalid amount for authorization.');
100
+ }
101
+
102
+ if ($error !== false) {
103
+ Mage::throwException($error);
104
+ }
105
+ return $this;
106
+ }
107
+
108
+ /**
109
+ * Send capture request to gateway
110
+ *
111
+ * @param Varien_Object $payment
112
+ * @param decimal $amount
113
+ * @return Inmedias_Wirecard_Model_CreditCard
114
+ */
115
+ public function capture(Varien_Object $payment, $amount)
116
+ {
117
+ $error = false;
118
+
119
+ if ($amount > 0) {
120
+
121
+ $payment->setAmount($amount);
122
+
123
+ $result = Mage::getModel('ACH/process')
124
+ ->setPayment($payment)
125
+ ->setIsCapture()
126
+ ->process();
127
+
128
+ } else {
129
+ $error = mage::helper('ACH')->__('Invalid amount for authorization.');
130
+ }
131
+
132
+ if ($error !== false) {
133
+ Mage::throwException($error);
134
+ }
135
+ return $this;
136
+ }
137
+ }
app/code/community/Thylak/ACH/Model/Eft.php ADDED
@@ -0,0 +1,171 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
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 available through the world-wide-web at this URL:
10
+ * http://opensource.org/licenses/osl-3.0.php
11
+ *
12
+ * @category Inmedias
13
+ * @package Inmedias_Wirecard
14
+ * @copyright Copyright (c) 2009 Andreas von Studnitz, team in medias GmbH
15
+ * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
16
+ */
17
+
18
+ class Thylak_ACH_Model_Eft extends Mage_Payment_Model_Method_Abstract
19
+ {
20
+
21
+ /**
22
+ * unique internal payment method identifier
23
+ */
24
+ protected $_code = 'ACH_eft';
25
+
26
+ /**
27
+ * Is this payment method a gateway (online auth/charge) ?
28
+ */
29
+ protected $_isGateway = true;
30
+
31
+ /**
32
+ * Can authorize online?
33
+ */
34
+ protected $_canAuthorize = true;
35
+
36
+ /**
37
+ * Can capture funds online?
38
+ */
39
+ protected $_canCapture = true;
40
+
41
+ /**
42
+ * Can capture partial amounts online?
43
+ */
44
+ protected $_canCapturePartial = false;
45
+
46
+ /**
47
+ * Can refund online?
48
+ */
49
+ protected $_canRefund = false;
50
+
51
+ /**
52
+ * Can void transactions online?
53
+ */
54
+ protected $_canVoid = false;
55
+
56
+ /**
57
+ * Can use this payment method in administration panel?
58
+ */
59
+ protected $_canUseInternal = true;
60
+
61
+ /**
62
+ * Can show this payment method as an option on checkout payment page?
63
+ */
64
+ protected $_canUseCheckout = true;
65
+
66
+ /**
67
+ * Is this payment method suitable for multi-shipping checkout?
68
+ */
69
+ protected $_canUseForMultishipping = false;
70
+
71
+ /**
72
+ * Can save credit card information for future processing?
73
+ */
74
+
75
+ protected $_formBlockType = 'ACH/form_eft';
76
+ protected $_infoBlockType = 'ACH/info_eft';
77
+
78
+
79
+ /**
80
+ * Assign data to info model instance
81
+ *
82
+ * @param mixed $data
83
+ * @return Mage_Payment_Model_Info
84
+ */
85
+ public function assignData($data)
86
+ {
87
+
88
+
89
+ if (!($data instanceof Varien_Object)) {
90
+ $data = new Varien_Object($data);
91
+ }
92
+ $info = $this->getInfoInstance();
93
+ $info
94
+ ->setAccountOwner($data->getAccountOwner())
95
+ ->setAccountNumber($data->getAccountNumber())
96
+ ->setBankName($data->getBankName())
97
+ ->setBankNumber($data->getBankNumber());
98
+
99
+
100
+ return $this;
101
+ }
102
+
103
+ /**
104
+ * Send authorize request to gateway
105
+ *
106
+ * @param Varien_Object $payment
107
+ * @param decimal $amount
108
+ * @return Inmedias_Wirecard_Model_Eft
109
+ */
110
+ public function authorize(Varien_Object $payment, $amount)
111
+ {
112
+
113
+
114
+ $error = false;
115
+
116
+ if ($amount > 0) {
117
+
118
+ $payment->setAmount($amount);
119
+
120
+ $result = Mage::getModel('ACH/process')
121
+ ->setPayment($payment)
122
+ ->process();
123
+
124
+ } else {
125
+ $error = mage::helper('ACH')->__('Invalid amount for authorization.');
126
+ }
127
+
128
+ if ($error !== false) {
129
+ Mage::throwException($error);
130
+ }
131
+ return $this;
132
+ }
133
+
134
+ /**
135
+ * Send capture request to gateway
136
+ *
137
+ * @param Varien_Object $payment
138
+ * @param decimal $amount
139
+ * @return Inmedias_Wirecard_Model_CreditCard
140
+ */
141
+ public function capture(Varien_Object $payment, $amount)
142
+ {
143
+ $error = false;
144
+
145
+
146
+ if ($amount > 0) {
147
+
148
+ $payment->setAmount($amount);
149
+
150
+ $result = Mage::getModel('ACH/process')
151
+ ->setPayment($payment)
152
+ ->setIsCapture()
153
+ ->process();
154
+
155
+ } else {
156
+ $error = mage::helper('ACH')->__('Invalid amount for authorization.');
157
+ }
158
+
159
+ if ($error !== false) {
160
+ Mage::throwException($error);
161
+ }
162
+ return $this;
163
+ }
164
+
165
+ public function getAccountOwner()
166
+ {
167
+ $info = $this->getInfoInstance();
168
+ return $info->getAccountOwner();
169
+ }
170
+
171
+ }
app/code/community/Thylak/ACH/Model/Process.php ADDED
@@ -0,0 +1,728 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+
4
+
5
+ class Thylak_ACH_Model_Process extends Mage_Core_Model_Abstract
6
+ {
7
+ const XML_PATH_WIRECARD_CC_TEST_MODE = 'payment/ACH_cc/test_mode';
8
+ const XML_PATH_WIRECARD_CC_USERNAME = 'payment/ACH_cc/username';
9
+ const XML_PATH_WIRECARD_CC_BUSINESSCASESIGNATURE = 'payment/ACH_cc/business_case_signature';
10
+ const XML_PATH_WIRECARD_CC_PASSWORD = 'payment/ACH_cc/password';
11
+ const XML_PATH_WIRECARD_CC_USAGE = 'payment/ACH_cc/usage';
12
+ const XML_PATH_WIRECARD_CC_DISPLAYERRORS = 'payment/ACH_cc/display_errors';
13
+ const XML_PATH_WIRECARD_CC_TRANSACTIONTYPE = 'payment/ACH_cc/checkout_transactiontype';
14
+
15
+ const XML_PATH_WIRECARD_EFT_TEST_MODE = 'payment/ACH_eft/test_mode';
16
+ const XML_PATH_WIRECARD_EFT_USERNAME = 'payment/ACH_eft/username';
17
+ const XML_PATH_WIRECARD_EFT_BUSINESSCASESIGNATURE = 'payment/ACH_eft/business_case_signature';
18
+ const XML_PATH_WIRECARD_EFT_PASSWORD = 'payment/ACH_eft/password';
19
+ const XML_PATH_WIRECARD_EFT_USAGE = 'payment/ACH_eft/usage';
20
+ const XML_PATH_WIRECARD_EFT_DISPLAYERRORS = 'payment/ACH_eft/display_errors';
21
+ const XML_PATH_WIRECARD_EFT_TRANSACTIONTYPE = 'payment/ACH_eft/checkout_transactiontype';
22
+
23
+ // standard data for test access
24
+ protected $host = 'c3-test.wirecard.com';
25
+ protected $port = 443;
26
+ protected $path = '/secure/ssl-gateway';
27
+ protected $login = '56500';
28
+ protected $businessCaseSignature = '56500';
29
+ protected $pass = 'TestXAPTER';
30
+ protected $isTestMode = true;
31
+ protected $payment = NULL;
32
+ protected $transactionTypeNodeName = '';
33
+ protected $functionId = '';
34
+ protected $isCapture = false;
35
+ protected $transactionType = '';
36
+ protected $displayErrors = 1;
37
+ protected $transactionNodeName = '';
38
+
39
+
40
+ /**
41
+ * Set transaction type to "capture"
42
+ *
43
+ * @return Inmedias_Wirecard_Model_Process
44
+ */
45
+ public function setIsCapture($capture = true) {
46
+
47
+ if ($capture) {
48
+
49
+ if ($this->getPaymentMethod() == 'ACH_eft' && $this->getPayment()->getWirecardTransactionType() == 'AUTHORIZATION') {
50
+
51
+ $this->transactionTypeNodeName = 'FNC_FT_DEBIT';
52
+ $this->functionId = 'debit';
53
+ }
54
+ else if ($this->getPayment()->getWirecardTransactionType() == 'PREAUTHORIZATION') {
55
+
56
+ $this->transactionTypeNodeName = 'FNC_CC_CAPTURE_PREAUTHORIZATION';
57
+ $this->functionId = 'preauthorization capture';
58
+ }
59
+ else {
60
+
61
+ $this->transactionTypeNodeName = 'FNC_CC_CAPTURE_AUTHORIZATION';
62
+ $this->functionId = 'authorization capture';
63
+ }
64
+ $this->isCapture = true;
65
+ } else {
66
+
67
+ $this->isCapture = false;
68
+ }
69
+
70
+ return $this;
71
+ }
72
+
73
+ /**
74
+ * Set transaction type to "capture"
75
+ *
76
+ * @return Inmedias_Wirecard_Model_Process
77
+ */
78
+ public function getIsCapture() {
79
+
80
+ return $this->isCapture;
81
+ }
82
+
83
+
84
+ /**
85
+ * Set payment data to model
86
+ *
87
+ * @param Varien_Object $payment
88
+ * @return Inmedias_Wirecard_Model_Process
89
+ */
90
+ public function setPayment($payment) {
91
+
92
+ $this->payment = $payment;
93
+ switch ($this->getPaymentMethod()) {
94
+
95
+ case 'ACH_eft':
96
+
97
+ $this->setTransactionType(Mage::getStoreConfig(self::XML_PATH_WIRECARD_EFT_TRANSACTIONTYPE));
98
+
99
+ switch ($this->getTransactionType()) {
100
+
101
+ case 'AUTHORIZATION':
102
+
103
+ $this->transactionTypeNodeName = 'FNC_FT_AUTHORIZATION';
104
+ $this->functionId = 'authorization';
105
+ break;
106
+
107
+ case 'DEBIT':
108
+
109
+ $this->transactionTypeNodeName = 'FNC_FT_DEBIT';
110
+ $this->functionId = 'debit';
111
+ break;
112
+
113
+ default:
114
+
115
+ $error = mage::helper('ACH')->__('Please choose a valid transaction type2.');
116
+ Mage::throwException($error);
117
+ }
118
+ break;
119
+
120
+ default:
121
+
122
+ $this->setTransactionType(Mage::getStoreConfig(self::XML_PATH_WIRECARD_CC_TRANSACTIONTYPE));
123
+
124
+ switch ($this->getTransactionType()) {
125
+
126
+ case 'PREAUTHORIZATION':
127
+
128
+ $this->transactionTypeNodeName = 'FNC_CC_PREAUTHORIZATION';
129
+ $this->functionId = 'preauthorization';
130
+ break;
131
+
132
+ case 'AUTHORIZATION':
133
+
134
+ $this->transactionTypeNodeName = 'FNC_CC_AUTHORIZATION';
135
+ $this->functionId = 'authorization';
136
+ break;
137
+
138
+ case 'PURCHASE':
139
+
140
+ $this->transactionTypeNodeName = 'FNC_CC_PURCHASE';
141
+ $this->functionId = 'purchase';
142
+ break;
143
+
144
+ default:
145
+
146
+ $error = mage::helper('ACH')->__('Please choose a valid transaction type999999992.');
147
+ Mage::throwException($error);
148
+ }
149
+ if ($this->isTestMode && !$this->getIsCapture()) {
150
+
151
+ //$this->payment->setCcNumber('4200000000000000');
152
+ }
153
+
154
+ }
155
+
156
+ return $this;
157
+ }
158
+
159
+ /**
160
+ * Get payment data from model
161
+ *
162
+ * @return Varien_Object
163
+ */
164
+ public function getPayment() {
165
+
166
+ return $this->payment;
167
+ }
168
+
169
+ /**
170
+ * Get payment method from model
171
+ *
172
+ * @return string
173
+ */
174
+ public function getPaymentMethod() {
175
+
176
+ return $this->payment->getMethod();
177
+ }
178
+
179
+ /**
180
+ * Set TransactionType to model
181
+ *
182
+ * @param String $transactionType
183
+ * @return Inmedias_Wirecard_Model_Process
184
+ */
185
+ public function setTransactionType($transactionType) {
186
+
187
+ $this->transactionType = $transactionType;
188
+
189
+ return $this;
190
+ }
191
+
192
+ /**
193
+ * Get TransactionType from model
194
+ *
195
+ * @return String
196
+ */
197
+ public function getTransactionType() {
198
+
199
+ return $this->transactionType;
200
+ }
201
+
202
+ /**
203
+ * Sets different variables which will be used later
204
+ *
205
+ * @return Void
206
+ */
207
+ protected function setBaseData() {
208
+
209
+
210
+ switch($this->getPaymentMethod()) {
211
+
212
+ case 'ACH_eft':
213
+ // check for test mode or live mode
214
+ $this->isTestMode = Mage::getStoreConfig(self::XML_PATH_WIRECARD_EFT_TEST_MODE);
215
+ $username = Mage::getStoreConfig(self::XML_PATH_WIRECARD_EFT_USERNAME);
216
+ $businessCaseSignature = Mage::getStoreConfig(self::XML_PATH_WIRECARD_EFT_BUSINESSCASESIGNATURE);
217
+ $password = Mage::getStoreConfig(self::XML_PATH_WIRECARD_EFT_PASSWORD);
218
+ $this->displayErrors = Mage::getStoreConfig(self::XML_PATH_WIRECARD_EFT_DISPLAYERRORS);
219
+ $this->usage = Mage::getStoreConfig(self::XML_PATH_WIRECARD_EFT_USAGE);
220
+ $this->transactionNodeName = 'FT_TRANSACTION';
221
+ break;
222
+
223
+ case 'ACH_cc':
224
+ // check for test mode or live mode
225
+ $this->isTestMode = Mage::getStoreConfig(self::XML_PATH_WIRECARD_CC_TEST_MODE);
226
+ $username = Mage::getStoreConfig(self::XML_PATH_WIRECARD_CC_USERNAME);
227
+ $businessCaseSignature = Mage::getStoreConfig(self::XML_PATH_WIRECARD_CC_BUSINESSCASESIGNATURE);
228
+ $password = Mage::getStoreConfig(self::XML_PATH_WIRECARD_CC_PASSWORD);
229
+ $this->displayErrors = Mage::getStoreConfig(self::XML_PATH_WIRECARD_CC_DISPLAYERRORS);
230
+ $this->usage = Mage::getStoreConfig(self::XML_PATH_WIRECARD_CC_USAGE);
231
+ $this->transactionNodeName = 'CC_TRANSACTION';
232
+ break;
233
+
234
+ default:
235
+ $this->transactionNodeName = 'Test';
236
+ return;
237
+ }
238
+
239
+ if (!$this->isTestMode && strlen($username) && strlen($password)) {
240
+
241
+ // set live access data instead of test data
242
+ $this->login = $username;
243
+ $this->businessCaseSignature = $businessCaseSignature;
244
+ $this->pass = $password;
245
+ //$this->host = 'c3.wirecard.com';
246
+ $this->host = 'https://www.paymentsgateway.net/cgi-bin/posttest.pl';
247
+ }
248
+ }
249
+
250
+ /**
251
+ * Main method of this class
252
+ * Send xml string to Wirecard server and record response
253
+ *
254
+ * @return void
255
+ */
256
+ public function process() {
257
+
258
+ /*$myFile = "c:/testFile.txt";
259
+ $fh = fopen($myFile, 'w');
260
+ //fwrite($fh, $customerinfo);
261
+ fclose($fh);
262
+ */
263
+ // don't perform capture when a purchase has already happened
264
+ if ($this->getIsCapture() && ($this->getPayment()->getWirecardTransactionType() == 'PURCHASE' || $this->getPayment()->getWirecardTransactionType() == 'DEBIT')) {
265
+
266
+ return;
267
+ }
268
+
269
+
270
+
271
+ $this->setBaseData();
272
+
273
+
274
+
275
+ // generate XML code for request
276
+ $poststring = $this->getRequestXml();
277
+
278
+
279
+ // clean up for logging; delete credit card data
280
+ /* $cleanedPostString = ereg_replace('<CREDIT_CARD_DATA>.*<\/CREDIT_CARD_DATA>', '<CREDIT_CARD_DATA><!-- removed --><\/CREDIT_CARD_DATA>', $poststring);
281
+ $cleanedPostString = ereg_replace('<EXTERNAL_ACCOUNT>.*<\/EXTERNAL_ACCOUNT>', '<EXTERNAL_ACCOUNT><!-- removed --><\/EXTERNAL_ACCOUNT>', $poststring);*/
282
+
283
+ // send request and receive response
284
+ $output = $this->sendRequest($poststring);
285
+ // write log to database
286
+ $orderIncrementId = $this->getPayment()->getOrder()->getIncrementId();
287
+
288
+ if ( $this->processTransactionResponseMessageIntoResponseArray( $output ) === false )
289
+ {
290
+
291
+ Mage::throwException("false");
292
+ }
293
+
294
+
295
+
296
+ // mage::helper('wirecard')->saveLog($orderIncrementId, $cleanedPostString, $output, $this->functionId);
297
+
298
+ // manage response, transfer to array
299
+ //$xmlResponse = simplexml_load_string($output);
300
+
301
+ //$arrayResponse = $this->xmlObject2Array($xmlResponse);
302
+
303
+ // Error handling of general wirecard errors
304
+ /*if (!isset($arrayResponse['W_RESPONSE'])) {
305
+
306
+ $error = mage::helper('wirecard')->__('An error occured, please try later or choose a different payment method.');
307
+ Mage::throwException($error);
308
+ }
309
+ if (isset($arrayResponse['W_RESPONSE']['ERROR'])) {
310
+
311
+ if ($this->displayErrors) {
312
+
313
+ $errorNumber = $arrayResponse['W_RESPONSE']['ERROR']['Number'];
314
+ $errorMessage = $arrayResponse['W_RESPONSE']['ERROR']['Message'];
315
+ $errorAdvice = ( isset($arrayResponse['W_RESPONSE']['ERROR']['Advice']) ? '(' . ( is_array($arrayResponse['W_RESPONSE']['ERROR']['Advice']) ? implode(' ', $arrayResponse['W_RESPONSE']['ERROR']['Advice']) : $arrayResponse['W_RESPONSE']['ERROR']['Advice'] ) . ')' : '' );
316
+
317
+ $error = mage::helper('wirecard')->__('Error %s: %s %s', $errorNumber, $errorMessage, $errorAdvice);
318
+ } else {
319
+
320
+ $error = mage::helper('wirecard')->__('An error occured, please try later or choose a differenty payment method.');
321
+ }
322
+ Mage::throwException($error);
323
+ }
324
+
325
+ switch($this->getPaymentMethod()) {
326
+
327
+ case 'wirecard_eft':
328
+
329
+ $arrayProcessingStatus = $arrayResponse['W_RESPONSE']['W_JOB'][$this->transactionTypeNodeName]['FT_TRANSACTION']['PROCESSING_STATUS'];
330
+ break;
331
+
332
+ case 'wirecard_cc':
333
+
334
+ $arrayProcessingStatus = $arrayResponse['W_RESPONSE']['W_JOB'][$this->transactionTypeNodeName]['CC_TRANSACTION']['PROCESSING_STATUS'];
335
+ break;
336
+ }
337
+
338
+ // Error handling of specific wirecard errors
339
+ if ($arrayProcessingStatus['FunctionResult'] != 'ACK') {
340
+
341
+ if ($this->displayErrors) {
342
+
343
+ if (isset($arrayProcessingStatus['ERROR'])) {
344
+
345
+ $errorNumber = $arrayProcessingStatus['ERROR']['Number'];
346
+ $errorMessage = $arrayProcessingStatus['ERROR']['Message'];
347
+ $errorAdvice = ( isset($arrayProcessingStatus['ERROR']['Advice']) ? '(' . ( is_array($arrayProcessingStatus['ERROR']['Advice']) ? implode(' ', $arrayProcessingStatus['ERROR']['Advice']) : $arrayProcessingStatus['ERROR']['Advice'] ) . ')' : '' );
348
+
349
+ $error = mage::helper('wirecard')->__('Error %s: %s %s', $errorNumber, $errorMessage, $errorAdvice);
350
+ } else {
351
+
352
+ $errorNumber = $arrayProcessingStatus['DETAIL']['ReturnCode'];
353
+ $errorMessage = $arrayProcessingStatus['DETAIL']['Message'];
354
+ $errorAdvice = ( isset($arrayProcessingStatus['ERROR']['Advice']) ? '(' . ( is_array($arrayProcessingStatus['DETAIL']['Advice']) ? implode(' ', $arrayProcessingStatus['DETAIL']['Advice']) : $arrayProcessingStatus['DETAIL']['Advice'] ) . ')' : '' );
355
+
356
+ $error = mage::helper('wirecard')->__('Error %s: %s %s', $errorNumber, $errorMessage, $errorAdvice);
357
+ }
358
+ } else {
359
+
360
+ $error = mage::helper('wirecard')->__('An error occured, please try later or choose a differenty payment method.');
361
+ }
362
+ Mage::throwException($error);
363
+ }
364
+
365
+ // success: get GuWID and add to payment object
366
+ if (!$this->getIsCapture()) {
367
+ $guWID = $arrayProcessingStatus['GuWID'];
368
+ $this->getPayment()
369
+ ->setWirecardGuwid($guWID)
370
+ ->setWirecardTransactionType($this->getTransactionType());
371
+ }*/
372
+
373
+ return;
374
+ }
375
+
376
+ /**
377
+ * Send XML data to Wirecard server via SSL and read response XML data
378
+ * Function taken from Wirecard Documentation
379
+ *
380
+ * @param String $poststring
381
+ * @return String
382
+ */
383
+ /* private function sendRequest( $postURL, $requestMessage )
384
+ {
385
+ $ch = curl_init();
386
+
387
+ // Set up curl parameters
388
+ curl_setopt( $ch, CURLOPT_URL, $postURL ); // set remote address
389
+ curl_setopt( $ch, CURLOPT_RETURNTRANSFER, 1 ); // Make CURL pass the response as a curl_exec return value instead of outputting to STDOUT
390
+ curl_setopt( $ch, CURLOPT_POST, 1 ); // Activate the POST method
391
+ curl_setopt( $ch, CURLOPT_SSL_VERIFYPEER, 0 );
392
+ curl_setopt( $ch, CURLOPT_SSL_VERIFYHOST, 0 );
393
+
394
+ curl_setopt( $ch, CURLOPT_POSTFIELDS, $requestMessage ); // add the request message itself
395
+
396
+ // execute the connexion
397
+ $result = curl_exec( $ch );
398
+ $clean_data = str_replace("\n","&",trim(str_replace("endofdata", "", trim($result))));
399
+
400
+ $debugoutput = curl_getinfo($ch);
401
+ $curl_error_message = curl_error( $ch ); // must retrieve an error message (if any) before closing the curl object
402
+
403
+ curl_close($ch);
404
+
405
+
406
+ if ( $result === false )
407
+ {
408
+ $this->errorString = self::GATEWAY_ERROR_CURL_ERROR.': '.$curl_error_message;
409
+ return false;
410
+ }
411
+
412
+ // we do not need the header part of the response, trim it off the result
413
+ // $pos = strstr( $result, "\n" );
414
+ // $result = substr( $result, $pos );
415
+
416
+ return $clean_data;
417
+ } */
418
+ protected function sendRequest($poststring) {
419
+ $ch = curl_init();
420
+ // Set up curl parameters
421
+ curl_setopt( $ch, CURLOPT_URL, "https://www.paymentsgateway.net/cgi-bin/posttest.pl" ); // set remote address
422
+ curl_setopt( $ch, CURLOPT_RETURNTRANSFER, 1 ); // Make CURL pass the response as a curl_exec return value instead of outputting to STDOUT
423
+ curl_setopt( $ch, CURLOPT_POST, 1 ); // Activate the POST method
424
+ curl_setopt( $ch, CURLOPT_SSL_VERIFYPEER, 0 );
425
+ curl_setopt( $ch, CURLOPT_SSL_VERIFYHOST, 0 );
426
+
427
+ curl_setopt( $ch, CURLOPT_POSTFIELDS, $poststring ); // add the request message itself
428
+
429
+ // execute the connexion
430
+ $result = curl_exec( $ch );
431
+ $clean_data = str_replace("\n","&",trim(str_replace("endofdata", "", trim($result))));
432
+ return $clean_data;
433
+ //Mage::throwException("test1");
434
+ // send to wirecard server via ssl
435
+ //$fp = fsockopen('ssl://'.$this->host, $this->port, $errno, $errstr, 5);
436
+ /* if (!$fp) {
437
+ //error; tell us
438
+ Mage::throwException($errstr . '(' . $errno . ')');
439
+ } else {
440
+ //send the server request
441
+ fputs($fp, "POST $this->path HTTP/1.0\r\n");
442
+ fputs($fp, "Host: $this->host\r\n");
443
+ fputs($fp, "Content-type: text/xml\r\n");
444
+ fputs($fp, "Content-length: ".strlen($poststring)."\r\n");
445
+ fputs($fp, "Authorization:
446
+ Basic ".base64_encode($this->login.":".$this->pass."\r\n"));
447
+ fputs($fp, "Connection: close\r\n");
448
+ fputs($fp, "\r\n");
449
+ fputs($fp, $poststring . "\r\n\r\n");
450
+
451
+ // prepare for reading the response
452
+ stream_set_timeout($fp, 30);
453
+
454
+ // here we save the response body - XML response from WireCard
455
+ $output = '';
456
+
457
+ // here we store the HTTP headers
458
+ $headers = '';
459
+
460
+ // temp. variable for detecting the end of HTTP headers.
461
+ $is_header = 1;
462
+
463
+ while(!feof($fp)) {
464
+
465
+ $buffer = fgets($fp, 128);
466
+
467
+ // fgets on SSL socket
468
+ if ($buffer == FALSE) {
469
+ break;
470
+ }
471
+
472
+ if (!$is_header) {
473
+ $output .= $buffer;
474
+ }
475
+
476
+ if ($buffer == "\r\n") {
477
+ $is_header = 0;
478
+ }
479
+
480
+ if ($is_header) {
481
+ $headers .= $buffer;
482
+ }
483
+ }*/
484
+ //close fp - we are done with it
485
+ //fclose($fp);
486
+
487
+
488
+ // }
489
+ // return $output;
490
+ }
491
+
492
+ /**
493
+ * Create XML string for request based on payment data
494
+ *
495
+ * @return string
496
+ */
497
+ protected function getRequestXml() {
498
+
499
+
500
+ // create Request XML from scratch
501
+ /*$xmlMain = new SimpleXMLElement('<WIRECARD_BXML xmlns:xsi="http://www.w3.org/1999/XMLSchema-instance" xsi:noNamespaceSchemaLocation="wirecard.xsd" />');
502
+
503
+ $xmlRequest = $xmlMain->addChild('W_REQUEST');
504
+
505
+ $xmlJob = $xmlRequest->addChild('W_JOB');
506
+ $xmlJob->addChild('JobID', 2);
507
+ $xmlJob->addChild('BusinessCaseSignature', $this->businessCaseSignature);
508
+
509
+ $xmlTransactionType = $xmlJob->addChild($this->transactionTypeNodeName);
510
+ $xmlTransactionType->addChild('FunctionID', $this->functionId);
511
+
512
+ $xmlTransaction = $xmlTransactionType->addChild($this->transactionNodeName);
513
+
514
+ $xmlTransaction->addChild('TransactionID', $this->getPayment()->getOrder()->getIncrementId());
515
+ $xmlTransaction->addChild('Amount', number_format($this->getPayment()->getAmount() * 100, 0, '', ''));
516
+ $xmlTransaction->addChild('Currency', $this->getPayment()->getOrder()->getGlobalCurrencyCode());
517
+ $xmlTransaction->addChild('CountryCode', $this->getPayment()->getOrder()->getBillingAddress()->getCountryId());
518
+
519
+ if ($this->getIsCapture() || $this->getTransactionType() == 'PURCHASE' || $this->getTransactionType() == 'DEBIT') {
520
+
521
+ // fields only at capture or purchase
522
+ $xmlTransaction->addChild('SalesDate', $this->getPayment()->getOrder()->getCreatedAt());
523
+ $xmlTransaction->addChild('Usage', mage::helper('wirecard')->__($this->usage, $this->getPayment()->getOrder()->getIncrementId()));
524
+ }
525
+
526
+ if ($this->getIsCapture() && $this->getPaymentMethod() != 'wirecard_eft') {
527
+
528
+ // field only at cc capture
529
+ $xmlTransaction->addChild('GuWID', $this->getPayment()->getWirecardGuwid());
530
+ }
531
+ else {
532
+
533
+ if ($this->getPaymentMethod() == 'wirecard_cc') {
534
+
535
+ // fields for initial request
536
+ $xmlCreditCardData = $xmlTransaction->addChild('CREDIT_CARD_DATA');
537
+ $xmlCreditCardData->addChild('CreditCardNumber', $this->getPayment()->getCcNumber());
538
+ $xmlCreditCardData->addChild('CVC2', $this->getPayment()->getCcCid());
539
+ $xmlCreditCardData->addChild('ExpirationYear', $this->getPayment()->getCcExpYear());
540
+ $xmlCreditCardData->addChild('ExpirationMonth', ( strlen($this->getPayment()->getCcExpMonth()) == 2 ? $this->getPayment()->getCcExpMonth() : '0' . $this->getPayment()->getCcExpMonth() ));
541
+ $xmlCreditCardData->addChild('CardHolderName', $this->getPayment()->getCcOwner());
542
+
543
+ }
544
+ }
545
+
546
+ if ($this->getPaymentMethod() == 'wirecard_eft') {
547
+
548
+ $xmlExternalAccount = $xmlTransaction->addChild('EXTERNAL_ACCOUNT');
549
+ $xmlExternalAccount->addChild('FirstName', $this->getPayment()->getAccountOwner());
550
+ $xmlExternalAccount->addChild('LastName', $this->getPayment()->getAccountOwner());
551
+ $xmlExternalAccount->addChild('AccountNumber', $this->getPayment()->getAccountNumber());
552
+ $xmlExternalAccount->addChild('BankCode', $this->getPayment()->getBankNumber());
553
+ $xmlExternalAccount->addChild('Country', $this->getPayment()->getOrder()->getBillingAddress()->getCountryId());
554
+ }
555
+
556
+ $xml = $xmlMain->asXML();
557
+ */
558
+
559
+ switch($this->getPaymentMethod()) {
560
+
561
+ case 'ACH_eft':
562
+ $x = "pg_merchant_id=".$this->login;
563
+ $x .= "&pg_password=".$this->pass;
564
+ $x .= "&pg_transaction_type=20";
565
+ $x .= "&pg_total_amount=".number_format($this->getPayment()->getAmount() * 100, 0, '', '');
566
+ $x .= "&pg_billto_postal_name_company=ACH";
567
+ $x .= "&ecom_billto_postal_name_first=".$this->getPayment()->getOrder()->getBillingAddress()->getFirstname();
568
+ $x .= "&ecom_billto_postal_name_last=".$this->getPayment()->getOrder()->getBillingAddress()->getLastname();
569
+ $x .= "&ecom_billto_postal_street_line1=".$this->getPayment()->getOrder()->getBillingAddress()->getStreet(1);
570
+ $x .= "&ecom_billto_postal_city=".$this->getPayment()->getOrder()->getBillingAddress()->getCity();
571
+ $x .= "&ecom_billto_postal_stateprov=".$this->getPayment()->getOrder()->getBillingAddress()->getRegion();
572
+ $x .= "&ecom_billto_postal_postalcode=".$this->getPayment()->getOrder()->getBillingAddress()->getPostcode();
573
+ $x .= "&ecom_payment_check_account_type=".$this->getPayment()->getBankName();
574
+ $x .= "&ecom_payment_check_account=".$this->getPayment()->getAccountNumber();
575
+ $x .= "&ecom_payment_check_trn=".$this->getPayment()->getBankNumber();
576
+ $x .= "&pg_avs_method=00000";
577
+ $x .= "&endofdata&";break;
578
+ default :
579
+ $ccType =$this->getPayment()->getCcType();
580
+ if ($ccType=='VI')
581
+ $ccType = 'VISA';
582
+ if ($ccType=='MC')
583
+ $ccType = 'Master Card';
584
+ if ($ccType=='DI')
585
+ $ccType = 'Discover';
586
+ if ($ccType=='AE')
587
+ $ccType = 'American Express';
588
+ $x = "pg_merchant_id=".$this->login;
589
+ $x .= "&pg_password=".$this->pass;
590
+ $x .= "&pg_transaction_type=15";
591
+ $x .= "&pg_total_amount=".number_format($this->getPayment()->getAmount() * 100, 0, '', '');
592
+ $x .= "&pg_billto_postal_name_company=ACH";
593
+ $x .= "&ecom_billto_postal_name_first=".$this->getPayment()->getOrder()->getBillingAddress()->getFirstname();
594
+ $x .= "&ecom_billto_postal_name_last=".$this->getPayment()->getOrder()->getBillingAddress()->getLastname();
595
+ $x .= "&ecom_billto_postal_street_line1=".$this->getPayment()->getOrder()->getBillingAddress()->getStreet(1);
596
+ $x .= "&ecom_billto_postal_city=".$this->getPayment()->getOrder()->getBillingAddress()->getCity();
597
+ $x .= "&ecom_billto_postal_stateprov=".$this->getPayment()->getOrder()->getBillingAddress()->getRegion();
598
+ $x .= "&ecom_billto_postal_postalcode=".$this->getPayment()->getOrder()->getBillingAddress()->getPostcode();
599
+ $x .= "&ecom_payment_Card_Name=".$this->getPayment()->getCcOwner();
600
+ $x .= "&ecom_payment_Card_Type=".$ccType;
601
+ $x .= "&ecom_payment_Card_Number=".$this->getPayment()->getCcNumber();
602
+ $x .= "&ecom_payment_Card_ExpDate_Month=". $this->getPayment()->getCcExpMonth();
603
+ $x .= "&ecom_payment_Card_ExpDate_Year=".$this->getPayment()->getCcExpYear();
604
+ $x .= "&pg_Original_authorization_code=42344&endofdata&";
605
+ break;
606
+ }
607
+
608
+ return $x;
609
+
610
+
611
+ // return $xml;
612
+ }
613
+
614
+ /**
615
+ * Convert XML object to Array
616
+ *
617
+ * @param SimpleXmlObject $node
618
+ * @return Array
619
+ */
620
+ protected function xmlObject2Array($node) {
621
+
622
+ $xmlArray = array();
623
+ if(is_object($node)){
624
+ settype($node,'array') ;
625
+ }
626
+ foreach ($node as $key=>$value){
627
+ if(is_array($value)||is_object($value)){
628
+ $xmlArray[$key] = $this->xmlObject2Array($value);
629
+ }else{
630
+ $xmlArray[$key] = $value;
631
+ }
632
+ }
633
+ return $xmlArray;
634
+ }
635
+
636
+ private function processTransactionResponseMessageIntoResponseArray ($responseMessage )
637
+ {
638
+
639
+
640
+
641
+ $xmlres = array();
642
+ $xmlres = parse_str($responseMessage);
643
+ // $xmlres = $responseMessage;
644
+
645
+
646
+ if ( $xmlres === false )
647
+ {
648
+ if ( strlen( $this->errorString ) == 0 )
649
+ {
650
+ Mage::throwException("GATEWAY_ERROR_RESPONSE_XML_MESSAGE_ERROR");
651
+ }
652
+ return false;
653
+ }
654
+
655
+
656
+ $responseArray["raw-XML-response"] = htmlentities($responseMessage);
657
+
658
+ $statusCode = trim( $pg_response_code);
659
+
660
+ $statusDescription = trim($pg_response_description);
661
+
662
+ $responseArray["statusCode"] = $statusCode;
663
+ $responseArray["statusDescription"] = $statusDescription;
664
+
665
+ // Three digit codes indicate a repsonse from the Securepay gateway (error detected by gateway)
666
+
667
+
668
+ $responseArray["messageID"] = trim($pg_trace_number);
669
+
670
+ //$responseArray["messageTimestamp"] = trim($xmlres['SecurePayMessage']['MessageInfo']['messageTimestamp']);
671
+ //$responseArray["apiVersion"] = trim($xmlres['SecurePayMessage']['MessageInfo']['apiVersion']);
672
+ $responseArray["RequestType"] = trim($pg_response_type);
673
+
674
+ if ((strcasecmp( $responseArray["RequestType"], "A" ) != 0) )
675
+ {
676
+ Mage::throwException("GATEWAY_ERROR_TXN_DECLINED"." :".$responseArray["RequestType"].": ".trim($pg_response_description));
677
+ return false;
678
+ }
679
+
680
+
681
+
682
+ //$responseArray["merchantID"] = trim($pg_merchant_id);
683
+ //$responseArray["txnType"] = trim($xmlres['SecurePayMessage']['Payment']['TxnList']['Txn']['txnType']);
684
+ //$responseArray["txnSource"] = trim($xmlres['SecurePayMessage']['Payment']['TxnList']['Txn']['txnSource']);
685
+
686
+ //$responseArray["amount"] = trim($pg_total_amount);
687
+
688
+ $responseArray["approved"] = trim($pg_response_description);
689
+
690
+ //$responseArray["approved"] = trim($pg_preauth_description);
691
+ $responseArray["responseCode"] = trim($pg_response_code);
692
+ //$responseArray["responseCode"] = trim($pg_preauth_code);
693
+
694
+ //$responseArray["responseText"] = trim($pg_preauth_result);
695
+ $responseArray["banktxnID"] = trim($pg_trace_number);
696
+ //
697
+ //$responseArray["banktxnID"] = trim($xmlres['SecurePayMessage']['Payment']['TxnList']['Txn']['txnID']);
698
+ //$responseArray["settlementDate"] = trim($xmlres['SecurePayMessage']['Payment']['TxnList']['Txn']['settlementDate']);
699
+
700
+
701
+
702
+
703
+
704
+ /* field "successful" = "Yes" means "triggered transaction successfully registered", anything else is failure */
705
+ /* responseCodes:
706
+ 00 indicates approved,
707
+ 08 is Honor with ID (approved) and
708
+ 77 is Approved (ANZ only).
709
+ Any other 2 digit code is a decline or error from the bank. */
710
+
711
+ if ((strcasecmp( $responseArray["RequestType"], "A" ) == 0) &&
712
+ (strcmp( $responseArray["responseCode"], "A01" ) === 0 ||
713
+ strcmp( $responseArray["responseCode"], "D" ) === 0 ) )
714
+ {
715
+
716
+ return true;
717
+ }
718
+ else
719
+ {
720
+ Mage::throwException("GATEWAY_ERROR_TXN_DECLINED"." (".$responseArray["approved"]."): ".$responseArray["responseCode"]);
721
+ return false;
722
+ }
723
+
724
+
725
+
726
+
727
+ }
728
+ }
app/code/community/Thylak/ACH/etc/config.xml ADDED
@@ -0,0 +1,114 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?wirecard version="1.0" ?>
2
+ <config>
3
+ <modules>
4
+ <Thylak_ACH>
5
+ <version>1.0.1</version>
6
+ </Thylak_ACH>
7
+ </modules>
8
+
9
+ <global>
10
+ <models>
11
+ <ACH>
12
+ <class>Thylak_ACH_Model</class>
13
+ </ACH>
14
+ </models>
15
+
16
+ <blocks>
17
+ <ACH>
18
+ <class>Thylak_ACH_Block</class>
19
+ </ACH>
20
+ </blocks>
21
+
22
+ <helpers>
23
+ <ACH>
24
+ <class>Thylak_ACH_Helper</class>
25
+ </ACH>
26
+ </helpers>
27
+
28
+ <resources>
29
+ <ACH_setup>
30
+ <connection>
31
+ <use>core_setup</use>
32
+ </connection>
33
+ <setup>
34
+ <module>Thylak_ACH</module>
35
+ </setup>
36
+ </ACH_setup>
37
+
38
+ <ACH_write>
39
+ <connection>
40
+ <use>core_write</use>
41
+ </connection>
42
+ </ACH_write>
43
+
44
+ <ACH_read>
45
+ <connection>
46
+ <use>core_read</use>
47
+ </connection>
48
+ </ACH_read>
49
+ </resources>
50
+
51
+ <fieldsets>
52
+ <sales_convert_quote_payment>
53
+ <account_owner><to_order_payment>*</to_order_payment></account_owner>
54
+ <account_number><to_order_payment>*</to_order_payment></account_number>
55
+ <bank_name><to_order_payment>*</to_order_payment></bank_name>
56
+ <bank_number><to_order_payment>*</to_order_payment></bank_number>
57
+ </sales_convert_quote_payment>
58
+ <sales_convert_order_payment>
59
+ <account_owner><to_quote_payment>*</to_quote_payment></account_owner>
60
+ <account_number><to_quote_payment>*</to_quote_payment></account_number>
61
+ <bank_name><to_quote_payment>*</to_quote_payment></bank_name>
62
+ <bank_number><to_quote_payment>*</to_quote_payment></bank_number>
63
+ </sales_convert_order_payment>
64
+ </fieldsets>
65
+ </global>
66
+
67
+ <default>
68
+ <payment>
69
+ <ACH_cc>
70
+ <active>0</active>
71
+ <model>ACH/CreditCard</model>
72
+ <order_status>1</order_status>
73
+ <title>ACH Credit</title>
74
+ <cctypes>AE,VI,MC,DI</cctypes>
75
+ <payment_action>authorize</payment_action>
76
+ <allowspecific>0</allowspecific>
77
+ <test_mode>1</test_mode>
78
+ </ACH_cc>
79
+ <ACH_eft>
80
+ <active>0</active>
81
+ <model>ACH/Eft</model>
82
+ <order_status>1</order_status>
83
+ <title>EFT</title>
84
+ <payment_action>authorize</payment_action>
85
+ <allowspecific>0</allowspecific>
86
+ <test_mode>1</test_mode>
87
+ </ACH_eft>
88
+ </payment>
89
+ </default>
90
+
91
+ <adminhtml>
92
+ <translate>
93
+ <modules>
94
+ <Thylak_ACH>
95
+ <files>
96
+ <default>THylak_ACH.csv</default>
97
+ </files>
98
+ </Thylak_ACH>
99
+ </modules>
100
+ </translate>
101
+ </adminhtml>
102
+
103
+ <frontend>
104
+ <translate>
105
+ <modules>
106
+ <Thylak_ACH>
107
+ <files>
108
+ <default>Thylak_ACH.csv</default>
109
+ </files>
110
+ </Thylak_ACH>
111
+ </modules>
112
+ </translate>
113
+ </frontend>
114
+ </config>
app/code/community/Thylak/ACH/etc/system.xml ADDED
@@ -0,0 +1,272 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?xml version="1.0"?>
2
+ <config>
3
+ <sections>
4
+ <payment>
5
+ <groups>
6
+ <ACH_cc translate="label" module="payment">
7
+ <label>ACH Creditcard Payment</label>
8
+ <frontend_type>text</frontend_type>
9
+ <sort_order>75</sort_order>
10
+ <show_in_default>1</show_in_default>
11
+ <show_in_website>1</show_in_website>
12
+ <show_in_store>0</show_in_store>
13
+ <fields>
14
+ <active translate="label">
15
+ <label>Enabled</label>
16
+ <frontend_type>select</frontend_type>
17
+ <source_model>adminhtml/system_config_source_yesno</source_model>
18
+ <sort_order>10</sort_order>
19
+ <show_in_default>1</show_in_default>
20
+ <show_in_website>1</show_in_website>
21
+ <show_in_store>1</show_in_store>
22
+ </active>
23
+ <title translate="label">
24
+ <label>Title</label>
25
+ <frontend_type>text</frontend_type>
26
+ <sort_order>20</sort_order>
27
+ <show_in_default>1</show_in_default>
28
+ <show_in_website>1</show_in_website>
29
+ <show_in_store>0</show_in_store>
30
+ </title>
31
+ <order_status translate="label">
32
+ <label>New order status</label>
33
+ <frontend_type>select</frontend_type>
34
+ <source_model>adminhtml/system_config_source_order_status</source_model>
35
+ <sort_order>40</sort_order>
36
+ <show_in_default>1</show_in_default>
37
+ <show_in_website>1</show_in_website>
38
+ <show_in_store>0</show_in_store>
39
+ </order_status>
40
+ <sort_order translate="label">
41
+ <label>Sort order</label>
42
+ <frontend_type>text</frontend_type>
43
+ <sort_order>50</sort_order>
44
+ <show_in_default>1</show_in_default>
45
+ <show_in_website>1</show_in_website>
46
+ <show_in_store>0</show_in_store>
47
+ </sort_order>
48
+ <allowspecific translate="label">
49
+ <label>Payment from applicable countries</label>
50
+ <frontend_type>allowspecific</frontend_type>
51
+ <sort_order>60</sort_order>
52
+ <source_model>adminhtml/system_config_source_payment_allspecificcountries</source_model>
53
+ <show_in_default>1</show_in_default>
54
+ <show_in_website>1</show_in_website>
55
+ <show_in_store>0</show_in_store>
56
+ </allowspecific>
57
+ <specificcountry translate="label">
58
+ <label>Payment from Specific countries</label>
59
+ <frontend_type>multiselect</frontend_type>
60
+ <sort_order>70</sort_order>
61
+ <source_model>adminhtml/system_config_source_country</source_model>
62
+ <show_in_default>1</show_in_default>
63
+ <show_in_website>1</show_in_website>
64
+ <show_in_store>0</show_in_store>
65
+ </specificcountry>
66
+ <cctypes translate="label">
67
+ <label>Credit Card Types</label>
68
+ <frontend_type>multiselect</frontend_type>
69
+ <source_model>adminhtml/system_config_source_payment_cctype</source_model>
70
+ <sort_order>80</sort_order>
71
+ <show_in_default>1</show_in_default>
72
+ <show_in_website>1</show_in_website>
73
+ <show_in_store>0</show_in_store>
74
+ </cctypes>
75
+ <useccv translate="label">
76
+ <label>Credit Card Verification</label>
77
+ <frontend_type>select</frontend_type>
78
+ <source_model>adminhtml/system_config_source_yesno</source_model>
79
+ <sort_order>90</sort_order>
80
+ <show_in_default>1</show_in_default>
81
+ <show_in_website>1</show_in_website>
82
+ <show_in_store>0</show_in_store>
83
+ </useccv>
84
+ <test_mode translate="label">
85
+ <label>Test Mode (Payments are never committed)</label>
86
+ <frontend_type>select</frontend_type>
87
+ <source_model>adminhtml/system_config_source_yesno</source_model>
88
+ <sort_order>100</sort_order>
89
+ <show_in_default>1</show_in_default>
90
+ <show_in_website>1</show_in_website>
91
+ <show_in_store>1</show_in_store>
92
+ </test_mode>
93
+ <username translate="label">
94
+ <label>ACH User Name</label>
95
+ <frontend_type>text</frontend_type>
96
+ <sort_order>110</sort_order>
97
+ <show_in_default>1</show_in_default>
98
+ <show_in_website>1</show_in_website>
99
+ <show_in_store>1</show_in_store>
100
+ </username>
101
+ <business_case_signature translate="label">
102
+ <label>Business Case Signature</label>
103
+ <frontend_type>text</frontend_type>
104
+ <sort_order>115</sort_order>
105
+ <show_in_default>1</show_in_default>
106
+ <show_in_website>1</show_in_website>
107
+ <show_in_store>1</show_in_store>
108
+ </business_case_signature>
109
+ <password translate="label">
110
+ <label>ACH Password</label>
111
+ <frontend_type>text</frontend_type>
112
+ <sort_order>120</sort_order>
113
+ <show_in_default>1</show_in_default>
114
+ <show_in_website>1</show_in_website>
115
+ <show_in_store>1</show_in_store>
116
+ </password>
117
+ <usage translate="label">
118
+ <label>Label on customer's credit card statement</label>
119
+ <frontend_type>text</frontend_type>
120
+ <sort_order>125</sort_order>
121
+ <show_in_default>1</show_in_default>
122
+ <show_in_website>1</show_in_website>
123
+ <show_in_store>1</show_in_store>
124
+ <comment>%s is for Order Number</comment>
125
+ </usage>
126
+ <display_errors translate="label">
127
+ <label>Display Error message to Customer</label>
128
+ <frontend_type>select</frontend_type>
129
+ <source_model>adminhtml/system_config_source_yesno</source_model>
130
+ <sort_order>130</sort_order>
131
+ <show_in_default>1</show_in_default>
132
+ <show_in_website>1</show_in_website>
133
+ <show_in_store>1</show_in_store>
134
+ </display_errors>
135
+ <checkout_transactiontype translate="label">
136
+ <label>Transaction Type at Checkout</label>
137
+ <frontend_type>select</frontend_type>
138
+ <source_model>ACH/config_ccTransactiontype</source_model>
139
+ <sort_order>140</sort_order>
140
+ <show_in_default>1</show_in_default>
141
+ <show_in_website>1</show_in_website>
142
+ <show_in_store>1</show_in_store>
143
+ </checkout_transactiontype>
144
+ </fields>
145
+ </ACH_cc>
146
+ <ACH_eft translate="label" module="payment">
147
+ <label>ACH CHECK Payment</label>
148
+ <frontend_type>text</frontend_type>
149
+ <sort_order>77</sort_order>
150
+ <show_in_default>1</show_in_default>
151
+ <show_in_website>1</show_in_website>
152
+ <show_in_store>0</show_in_store>
153
+ <fields>
154
+ <active translate="label">
155
+ <label>Enabled</label>
156
+ <frontend_type>select</frontend_type>
157
+ <source_model>adminhtml/system_config_source_yesno</source_model>
158
+ <sort_order>10</sort_order>
159
+ <show_in_default>1</show_in_default>
160
+ <show_in_website>1</show_in_website>
161
+ <show_in_store>1</show_in_store>
162
+ </active>
163
+ <title translate="label">
164
+ <label>Title</label>
165
+ <frontend_type>text</frontend_type>
166
+ <sort_order>20</sort_order>
167
+ <show_in_default>1</show_in_default>
168
+ <show_in_website>1</show_in_website>
169
+ <show_in_store>0</show_in_store>
170
+ </title>
171
+ <order_status translate="label">
172
+ <label>New order status</label>
173
+ <frontend_type>select</frontend_type>
174
+ <source_model>adminhtml/system_config_source_order_status</source_model>
175
+ <sort_order>40</sort_order>
176
+ <show_in_default>1</show_in_default>
177
+ <show_in_website>1</show_in_website>
178
+ <show_in_store>0</show_in_store>
179
+ </order_status>
180
+ <sort_order translate="label">
181
+ <label>Sort order</label>
182
+ <frontend_type>text</frontend_type>
183
+ <sort_order>50</sort_order>
184
+ <show_in_default>1</show_in_default>
185
+ <show_in_website>1</show_in_website>
186
+ <show_in_store>0</show_in_store>
187
+ </sort_order>
188
+ <allowspecific translate="label">
189
+ <label>Payment from applicable countries</label>
190
+ <frontend_type>allowspecific</frontend_type>
191
+ <sort_order>60</sort_order>
192
+ <source_model>adminhtml/system_config_source_payment_allspecificcountries</source_model>
193
+ <show_in_default>1</show_in_default>
194
+ <show_in_website>1</show_in_website>
195
+ <show_in_store>0</show_in_store>
196
+ </allowspecific>
197
+ <specificcountry translate="label">
198
+ <label>Payment from Specific countries</label>
199
+ <frontend_type>multiselect</frontend_type>
200
+ <sort_order>70</sort_order>
201
+ <source_model>adminhtml/system_config_source_country</source_model>
202
+ <show_in_default>1</show_in_default>
203
+ <show_in_website>1</show_in_website>
204
+ <show_in_store>0</show_in_store>
205
+ </specificcountry>
206
+
207
+ <test_mode translate="label">
208
+ <label>Test Mode (Payments are never committed)</label>
209
+ <frontend_type>select</frontend_type>
210
+ <source_model>adminhtml/system_config_source_yesno</source_model>
211
+ <sort_order>100</sort_order>
212
+ <show_in_default>1</show_in_default>
213
+ <show_in_website>1</show_in_website>
214
+ <show_in_store>1</show_in_store>
215
+ </test_mode>
216
+ <username translate="label">
217
+ <label>ACH User Name</label>
218
+ <frontend_type>text</frontend_type>
219
+ <sort_order>110</sort_order>
220
+ <show_in_default>1</show_in_default>
221
+ <show_in_website>1</show_in_website>
222
+ <show_in_store>1</show_in_store>
223
+ </username>
224
+ <business_case_signature translate="label">
225
+ <label>Business Case Signature</label>
226
+ <frontend_type>text</frontend_type>
227
+ <sort_order>115</sort_order>
228
+ <show_in_default>1</show_in_default>
229
+ <show_in_website>1</show_in_website>
230
+ <show_in_store>1</show_in_store>
231
+ </business_case_signature>
232
+ <password translate="label">
233
+ <label>ACH Password</label>
234
+ <frontend_type>text</frontend_type>
235
+ <sort_order>120</sort_order>
236
+ <show_in_default>1</show_in_default>
237
+ <show_in_website>1</show_in_website>
238
+ <show_in_store>1</show_in_store>
239
+ </password>
240
+ <usage translate="label">
241
+ <label>Label on customer's bank statement</label>
242
+ <frontend_type>text</frontend_type>
243
+ <sort_order>125</sort_order>
244
+ <show_in_default>1</show_in_default>
245
+ <show_in_website>1</show_in_website>
246
+ <show_in_store>1</show_in_store>
247
+ <comment>%s is for Order Number</comment>
248
+ </usage>
249
+ <display_errors translate="label">
250
+ <label>Display Error message to Customer</label>
251
+ <frontend_type>select</frontend_type>
252
+ <source_model>adminhtml/system_config_source_yesno</source_model>
253
+ <sort_order>130</sort_order>
254
+ <show_in_default>1</show_in_default>
255
+ <show_in_website>1</show_in_website>
256
+ <show_in_store>1</show_in_store>
257
+ </display_errors>
258
+ <checkout_transactiontype translate="label">
259
+ <label>Transaction Type at Checkout</label>
260
+ <frontend_type>select</frontend_type>
261
+ <source_model>ACH/config_eftTransactiontype</source_model>
262
+ <sort_order>140</sort_order>
263
+ <show_in_default>1</show_in_default>
264
+ <show_in_website>1</show_in_website>
265
+ <show_in_store>1</show_in_store>
266
+ </checkout_transactiontype>
267
+ </fields>
268
+ </ACH_eft>
269
+ </groups>
270
+ </payment>
271
+ </sections>
272
+ </config>
app/code/community/Thylak/ACH/sql/ACH_setup/mysql4-install-1.0.1.php ADDED
@@ -0,0 +1,238 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
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 available through the world-wide-web at this URL:
10
+ * http://opensource.org/licenses/osl-3.0.php
11
+ *
12
+ * @category Inmedias
13
+ * @package Inmedias_Wirecard
14
+ * @copyright Copyright (c) 2009 Andreas von Studnitz, team in medias GmbH
15
+ * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
16
+ */
17
+
18
+ $read = Mage::getSingleton('core/resource')
19
+ ->getConnection('core_read');
20
+
21
+ $eid = $read->fetchRow("
22
+ SELECT entity_type_id
23
+ FROM eav_entity_type
24
+ WHERE entity_type_code = 'order_payment';
25
+ ");
26
+ $payment_type_id = $eid['entity_type_id'];
27
+
28
+ $eid = $read->fetchRow("
29
+ SELECT entity_type_id
30
+ FROM eav_entity_type
31
+ WHERE entity_type_code = 'quote_payment';
32
+ ");
33
+ $quote_type_id = $eid['entity_type_id'];
34
+
35
+ $installer = $this;
36
+ $installer->startSetup();
37
+
38
+ // create new payment attribute GuWID
39
+ $attributeData = array(
40
+ 'entity_type_id' => $payment_type_id,
41
+ 'attribute_code' => 'wirecard_guwid',
42
+ 'backend_type' => 'varchar',
43
+ 'frontend_input' => 'text',
44
+ 'is_global' => 1,
45
+ 'is_visible' => 0,
46
+ 'is_required' => 0,
47
+ 'is_user_defined' => 1,
48
+ );
49
+
50
+ $attribute = new Mage_Eav_Model_Entity_Attribute();
51
+ $attribute->loadByCode($attributeData['entity_type_id'], $attributeData['attribute_code'])
52
+ ->setStoreId(0)
53
+ ->addData($attributeData)
54
+ ->save();
55
+
56
+ // create new payment attribute Transaction Type
57
+ $attributeData = array(
58
+ 'entity_type_id' => $payment_type_id,
59
+ 'attribute_code' => 'wirecard_transaction_type',
60
+ 'backend_type' => 'varchar',
61
+ 'frontend_input' => 'text',
62
+ 'is_global' => 1,
63
+ 'is_visible' => 0,
64
+ 'is_required' => 0,
65
+ 'is_user_defined' => 1,
66
+ );
67
+
68
+ $attribute = new Mage_Eav_Model_Entity_Attribute();
69
+ $attribute->loadByCode($attributeData['entity_type_id'], $attributeData['attribute_code'])
70
+ ->setStoreId(0)
71
+ ->addData($attributeData)
72
+ ->save();
73
+
74
+ // create new payment attribute Transaction Type
75
+ $attributeData = array(
76
+ 'entity_type_id' => $payment_type_id,
77
+ 'attribute_code' => 'account_owner',
78
+ 'backend_type' => 'varchar',
79
+ 'frontend_input' => 'text',
80
+ 'is_global' => 1,
81
+ 'is_visible' => 0,
82
+ 'is_required' => 0,
83
+ 'is_user_defined' => 1,
84
+ );
85
+
86
+ $attribute = new Mage_Eav_Model_Entity_Attribute();
87
+ $attribute->loadByCode($attributeData['entity_type_id'], $attributeData['attribute_code'])
88
+ ->setStoreId(0)
89
+ ->addData($attributeData)
90
+ ->save();
91
+
92
+ // create new payment attribute Transaction Type
93
+ $attributeData = array(
94
+ 'entity_type_id' => $payment_type_id,
95
+ 'attribute_code' => 'account_number',
96
+ 'backend_type' => 'varchar',
97
+ 'frontend_input' => 'text',
98
+ 'is_global' => 1,
99
+ 'is_visible' => 0,
100
+ 'is_required' => 0,
101
+ 'is_user_defined' => 1,
102
+ );
103
+
104
+ $attribute = new Mage_Eav_Model_Entity_Attribute();
105
+ $attribute->loadByCode($attributeData['entity_type_id'], $attributeData['attribute_code'])
106
+ ->setStoreId(0)
107
+ ->addData($attributeData)
108
+ ->save();
109
+
110
+ // create new payment attribute Transaction Type
111
+ $attributeData = array(
112
+ 'entity_type_id' => $payment_type_id,
113
+ 'attribute_code' => 'bank_number',
114
+ 'backend_type' => 'varchar',
115
+ 'frontend_input' => 'text',
116
+ 'is_global' => 1,
117
+ 'is_visible' => 0,
118
+ 'is_required' => 0,
119
+ 'is_user_defined' => 1,
120
+ );
121
+
122
+ $attribute = new Mage_Eav_Model_Entity_Attribute();
123
+ $attribute->loadByCode($attributeData['entity_type_id'], $attributeData['attribute_code'])
124
+ ->setStoreId(0)
125
+ ->addData($attributeData)
126
+ ->save();
127
+
128
+ // create new payment attribute Transaction Type
129
+ $attributeData = array(
130
+ 'entity_type_id' => $payment_type_id,
131
+ 'attribute_code' => 'bank_name',
132
+ 'backend_type' => 'varchar',
133
+ 'frontend_input' => 'text',
134
+ 'is_global' => 1,
135
+ 'is_visible' => 0,
136
+ 'is_required' => 0,
137
+ 'is_user_defined' => 1,
138
+ );
139
+
140
+ $attribute = new Mage_Eav_Model_Entity_Attribute();
141
+ $attribute->loadByCode($attributeData['entity_type_id'], $attributeData['attribute_code'])
142
+ ->setStoreId(0)
143
+ ->addData($attributeData)
144
+ ->save();
145
+
146
+
147
+ // create new payment attribute Transaction Type
148
+ $attributeData = array(
149
+ 'entity_type_id' => $quote_type_id,
150
+ 'attribute_code' => 'account_owner',
151
+ 'backend_type' => 'varchar',
152
+ 'frontend_input' => 'text',
153
+ 'is_global' => 1,
154
+ 'is_visible' => 0,
155
+ 'is_required' => 0,
156
+ 'is_user_defined' => 1,
157
+ );
158
+
159
+ $attribute = new Mage_Eav_Model_Entity_Attribute();
160
+ $attribute->loadByCode($attributeData['entity_type_id'], $attributeData['attribute_code'])
161
+ ->setStoreId(0)
162
+ ->addData($attributeData)
163
+ ->save();
164
+
165
+ // create new payment attribute Transaction Type
166
+ $attributeData = array(
167
+ 'entity_type_id' => $quote_type_id,
168
+ 'attribute_code' => 'account_number',
169
+ 'backend_type' => 'varchar',
170
+ 'frontend_input' => 'text',
171
+ 'is_global' => 1,
172
+ 'is_visible' => 0,
173
+ 'is_required' => 0,
174
+ 'is_user_defined' => 1,
175
+ );
176
+
177
+ $attribute = new Mage_Eav_Model_Entity_Attribute();
178
+ $attribute->loadByCode($attributeData['entity_type_id'], $attributeData['attribute_code'])
179
+ ->setStoreId(0)
180
+ ->addData($attributeData)
181
+ ->save();
182
+
183
+ // create new payment attribute Transaction Type
184
+ $attributeData = array(
185
+ 'entity_type_id' => $quote_type_id,
186
+ 'attribute_code' => 'bank_number',
187
+ 'backend_type' => 'varchar',
188
+ 'frontend_input' => 'text',
189
+ 'is_global' => 1,
190
+ 'is_visible' => 0,
191
+ 'is_required' => 0,
192
+ 'is_user_defined' => 1,
193
+ );
194
+
195
+ $attribute = new Mage_Eav_Model_Entity_Attribute();
196
+ $attribute->loadByCode($attributeData['entity_type_id'], $attributeData['attribute_code'])
197
+ ->setStoreId(0)
198
+ ->addData($attributeData)
199
+ ->save();
200
+
201
+ // create new payment attribute Transaction Type
202
+ $attributeData = array(
203
+ 'entity_type_id' => $quote_type_id,
204
+ 'attribute_code' => 'bank_name',
205
+ 'backend_type' => 'varchar',
206
+ 'frontend_input' => 'text',
207
+ 'is_global' => 1,
208
+ 'is_visible' => 0,
209
+ 'is_required' => 0,
210
+ 'is_user_defined' => 1,
211
+ );
212
+
213
+ $attribute = new Mage_Eav_Model_Entity_Attribute();
214
+ $attribute->loadByCode($attributeData['entity_type_id'], $attributeData['attribute_code'])
215
+ ->setStoreId(0)
216
+ ->addData($attributeData)
217
+ ->save();
218
+
219
+ // create database table
220
+ $installer->run("
221
+ CREATE TABLE {$this->getTable('log_wirecard')} (
222
+ `log_wirecard_id` int(10) unsigned NOT NULL auto_increment,
223
+ `request_date` timestamp default NOW(),
224
+ `order_id` int(10) unsigned NOT NULL default 0,
225
+ `function` VARCHAR(32) default NULL,
226
+ `request_xml` TEXT default NULL,
227
+ `response_xml` TEXT default NULL,
228
+ PRIMARY KEY (`log_wirecard_id`)
229
+ ) ENGINE=InnoDB DEFAULT CHARSET=utf8;
230
+
231
+ ALTER TABLE {$this->getTable('sales_flat_quote_payment')}
232
+ ADD `account_owner` VARCHAR( 255 ) NULL ,
233
+ ADD `account_number` VARCHAR( 255 ) NULL ,
234
+ ADD `bank_number` VARCHAR( 255 ) NULL ,
235
+ ADD `bank_name` VARCHAR( 255 ) NULL
236
+ ");
237
+
238
+ $installer->endSetup();
app/design/frontend/default/default/template/Ach_view/form_cc.phtml ADDED
@@ -0,0 +1,86 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * Magento
4
+ *
5
+ * NOTICE OF LICENSE
6
+ *
7
+ * This source file is subject to the Academic Free License (AFL 3.0)
8
+ * that is bundled with this package in the file LICENSE_AFL.txt.
9
+ * It is also available through the world-wide-web at this URL:
10
+ * http://opensource.org/licenses/afl-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
+ * DISCLAIMER
16
+ *
17
+ * Do not edit or add to this file if you wish to upgrade Magento to newer
18
+ * versions in the future. If you wish to customize Magento for your
19
+ * needs please refer to http://www.magentocommerce.com for more information.
20
+ *
21
+ * @category design_default
22
+ * @package Mage
23
+ * @copyright Copyright (c) 2008 Irubin Consulting Inc. DBA Varien (http://www.varien.com)
24
+ * @license http://opensource.org/licenses/afl-3.0.php Academic Free License (AFL 3.0)
25
+ */
26
+ ?>
27
+ <fieldset class="form-list">
28
+ <?php $_code=$this->getMethodCode() ?>
29
+ <ul id="payment_form_<?php echo $_code ?>" style="display:none">
30
+ <li>
31
+ <div class="input-box">
32
+ <label for="<?php echo $_code ?>_cc_owner"><?php echo mage::helper('ACH')->__('Name on Card') ?> <span class="required">*</span></label><br/>
33
+ <input type="text" title="<?php echo mage::helper('ACH')->__('Name on Card') ?>" class="required-entry input-text" id="<?php echo $_code ?>_cc_owner" name="payment[cc_owner]" value="<?php echo $this->htmlEscape($this->getInfoData('cc_owner')) ?>"/>
34
+ </div>
35
+ </li>
36
+ <li>
37
+ <div class="input-box">
38
+ <label for="<?php echo $_code ?>_cc_type"><?php echo mage::helper('ACH')->__('Credit Card Type') ?> <span class="required">*</span></label><br />
39
+ <select id="<?php echo $_code ?>_cc_type" name="payment[cc_type]" class="required-entry validate-cc-type-select">
40
+ <option value=""><?php echo mage::helper('ACH')->__('--Please Select--')?></option>
41
+ <?php $_ccType = $this->getInfoData('cc_type') ?>
42
+ <?php foreach ($this->getCcAvailableTypes() as $_typeCode => $_typeName): ?>
43
+ <option value="<?php echo $_typeCode ?>"<?php if($_typeCode==$_ccType): ?> selected="selected"<?php endif ?>><?php echo $_typeName ?></option>
44
+ <?php endforeach ?>
45
+ </select>
46
+ </div>
47
+ </li>
48
+ <li>
49
+ <div class="input-box">
50
+ <label for="<?php echo $_code ?>_cc_number"><?php echo mage::helper('ACH')->__('Credit Card Number') ?> <span class="required">*</span></label><br/>
51
+ <input type="text" id="<?php echo $_code ?>_cc_number" name="payment[cc_number]" title="<?php echo mage::helper('ACH')->__('Credit Card Number') ?>" class="input-text validate-cc-number validate-cc-type" value="" />
52
+ </div>
53
+ </li>
54
+ <li>
55
+ <div class="input-box">
56
+ <label for="<?php echo $_code ?>_expiration"><?php echo mage::helper('ACH')->__('Expiration Date') ?> <span class="required">*</span></label><br />
57
+ <div class="v-fix">
58
+ <select id="<?php echo $_code ?>_expiration" style="width:140px;" name="payment[cc_exp_month]" class="required-entry">
59
+ <?php $_ccExpMonth = $this->getInfoData('cc_exp_month') ?>
60
+ <?php foreach ($this->getCcMonths() as $k=>$v): ?>
61
+ <option value="<?php echo $k?$k:'' ?>"<?php if($k==$_ccExpMonth): ?> selected="selected"<?php endif ?>><?php echo $v ?></option>
62
+ <?php endforeach ?>
63
+ </select>
64
+ </div>
65
+ <div class="v-fix" style="padding-left:5px;">
66
+ <?php $_ccExpYear = $this->getInfoData('cc_exp_year') ?>
67
+ <select id="<?php echo $_code ?>_expiration_yr" style="width:103px;" name="payment[cc_exp_year]" class="required-entry">
68
+ <?php foreach ($this->getCcYears() as $k=>$v): ?>
69
+ <option value="<?php echo $k?$k:'' ?>"<?php if($k==$_ccExpYear): ?> selected="selected"<?php endif ?>><?php echo $v ?></option>
70
+ <?php endforeach ?>
71
+ </select>
72
+ </div>
73
+ </div>
74
+ </li>
75
+ <?php if($this->hasVerification()): ?>
76
+ <li>
77
+ <div class="input-box">
78
+ <label for="<?php echo $_code ?>_cc_cid"><?php echo mage::helper('ACH')->__('Card Verification Number') ?> <span class="required">*</span></label><br />
79
+ <div class="v-fix"><input type="text" title="<?php echo Mage::helper('ACH')->__('Card Verification Number') ?>" class="required-entry input-text validate-cc-cvn" id="<?php echo $_code ?>_cc_cid" name="payment[cc_cid]" style="width:3em;" value="" /></div>
80
+ &nbsp;
81
+ <a href="#" class="cvv-what-is-this"><?php echo Mage::helper('ACH')->__('What is this?') ?></a>
82
+ </div>
83
+ </li>
84
+ <?php endif; ?>
85
+ </ul>
86
+ </fieldset>
app/design/frontend/default/default/template/Ach_view/form_eft.phtml ADDED
@@ -0,0 +1,65 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * Magento
4
+ *
5
+ * NOTICE OF LICENSE
6
+ *
7
+ * This source file is subject to the Academic Free License (AFL 3.0)
8
+ * that is bundled with this package in the file LICENSE_AFL.txt.
9
+ * It is also available through the world-wide-web at this URL:
10
+ * http://opensource.org/licenses/afl-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
+ * DISCLAIMER
16
+ *
17
+ * Do not edit or add to this file if you wish to upgrade Magento to newer
18
+ * versions in the future. If you wish to customize Magento for your
19
+ * needs please refer to http://www.magentocommerce.com for more information.
20
+ *
21
+ * @category design_default
22
+ * @package Mage
23
+ * @copyright Copyright (c) 2008 Irubin Consulting Inc. DBA Varien (http://www.varien.com)
24
+ * @license http://opensource.org/licenses/afl-3.0.php Academic Free License (AFL 3.0)
25
+ */
26
+ ?>
27
+ <fieldset class="form-list">
28
+ <?php $_code=$this->getMethodCode() ?>
29
+ <ul id="payment_form_<?php echo $_code ?>" style="display:none">
30
+ <li>
31
+ <div class="input-box">
32
+ <label for="<?php echo $_code ?>_account_owner"><?php echo mage::helper('ACH')->__('Account Owner') ?> <span class="required">*</span></label><br/>
33
+ <input type="text" title="<?php echo mage::helper('ACH')->__('Account Owner') ?>" class="required-entry input-text" id="<?php echo $_code ?>_account_owner" name="payment[account_owner]" value="<?php echo $this->htmlEscape($this->getInfoData('account_owner')) ?>"/>
34
+ </div>
35
+ </li>
36
+ <li>
37
+ <div class="input-box">
38
+ <label for="<?php echo $_code ?>_account_number"><?php echo mage::helper('ACH')->__('Account Number') ?> <span class="required">*</span></label><br/>
39
+ <input type="text" id="<?php echo $_code ?>_account_number" name="payment[account_number]" title="<?php echo mage::helper('ACH')->__('Account Number') ?>" class="input-text required-entry" value="<?php echo $this->htmlEscape($this->getInfoData('account_number')) ?>" />
40
+ </div>
41
+ </li>
42
+ <li>
43
+ <div class="input-box">
44
+ <label for="<?php echo $_code ?>_bank_number"><?php echo mage::helper('ACH')->__('Check Number') ?> <span class="required">*</span></label><br/>
45
+ <input type="text" id="<?php echo $_code ?>_bank_number" name="payment[bank_number]" title="<?php echo mage::helper('ACH')->__('Bank Number') ?>" class="input-text required-entry" value="<?php echo $this->htmlEscape($this->getInfoData('bank_number')) ?>" />
46
+ </div>
47
+ </li>
48
+ <li>
49
+ <div class="input-box">
50
+ <label for="<?php echo $_code ?>_bank_name"><?php echo mage::helper('ACH')->__('Acc Type') ?> <span class="required">*</span></label><br/>
51
+ <select id="<?php echo $_code ?>_bank_name" name="payment[bank_name]" class="required-entry ">
52
+ <?php $_bank_name = $this->getInfoData('bank_name') ?>
53
+ <option value=""><?php echo $this->__('--Please Select--')?></option>
54
+ <option value="S"><?php echo $this->__('Savings')?></option>
55
+ <option value="C"><?php echo $this->__('Current')?></option>
56
+ </select>
57
+
58
+ </div>
59
+ </li>
60
+
61
+
62
+
63
+
64
+ </ul>
65
+ </fieldset>
app/design/frontend/default/default/template/Ach_view/info_cc.phtml ADDED
@@ -0,0 +1,35 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * Magento
4
+ *
5
+ * NOTICE OF LICENSE
6
+ *
7
+ * This source file is subject to the Academic Free License (AFL 3.0)
8
+ * that is bundled with this package in the file LICENSE_AFL.txt.
9
+ * It is also available through the world-wide-web at this URL:
10
+ * http://opensource.org/licenses/afl-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
+ * DISCLAIMER
16
+ *
17
+ * Do not edit or add to this file if you wish to upgrade Magento to newer
18
+ * versions in the future. If you wish to customize Magento for your
19
+ * needs please refer to http://www.magentocommerce.com for more information.
20
+ *
21
+ * @category design_default
22
+ * @package Mage
23
+ * @copyright Copyright (c) 2008 Irubin Consulting Inc. DBA Varien (http://www.varien.com)
24
+ * @license http://opensource.org/licenses/afl-3.0.php Academic Free License (AFL 3.0)
25
+ */
26
+ ?>
27
+ <?php if($_info = $this->getInfo()): ?>
28
+ <strong><?php echo mage::helper('ACH')->__('Credit Card') ?></strong><br />
29
+ <?php echo mage::helper('ACH')->__('Credit Card Type: %s', $this->htmlEscape($this->getCcTypeName())) ?><br />
30
+ <?php echo mage::helper('ACH')->__('Credit Card Number: xxxx-%s', $this->htmlEscape($this->getInfo()->getCcLast4())) ?><br />
31
+ <?php echo mage::helper('ACH')->__('Expiration Date: %s/%s', $this->htmlEscape($this->getCcExpMonth()), $this->htmlEscape($this->getInfo()->getCcExpYear())) ?><br />
32
+ <?php echo mage::helper('ACH')->__('Name on the Card: %s', $this->htmlEscape($this->getInfo()->getCcOwner())) ?>
33
+ <?php else: ?>
34
+
35
+ <?php endif; ?>
app/design/frontend/default/default/template/Ach_view/info_eft.phtml ADDED
@@ -0,0 +1,35 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * Magento
4
+ *
5
+ * NOTICE OF LICENSE
6
+ *
7
+ * This source file is subject to the Academic Free License (AFL 3.0)
8
+ * that is bundled with this package in the file LICENSE_AFL.txt.
9
+ * It is also available through the world-wide-web at this URL:
10
+ * http://opensource.org/licenses/afl-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
+ * DISCLAIMER
16
+ *
17
+ * Do not edit or add to this file if you wish to upgrade Magento to newer
18
+ * versions in the future. If you wish to customize Magento for your
19
+ * needs please refer to http://www.magentocommerce.com for more information.
20
+ *
21
+ * @category design_default
22
+ * @package Mage
23
+ * @copyright Copyright (c) 2008 Irubin Consulting Inc. DBA Varien (http://www.varien.com)
24
+ * @license http://opensource.org/licenses/afl-3.0.php Academic Free License (AFL 3.0)
25
+ */
26
+ ?>
27
+ <?php if($_info = $this->getInfo()): ?>
28
+ <strong><?php echo mage::helper('ACH')->__('ACH CHECK') ?></strong><br />
29
+ <?php echo mage::helper('ACH')->__('Account Owner: %s', $this->htmlEscape($this->getInfo()->getAccountOwner())) ?><br />
30
+ <?php echo mage::helper('ACH')->__('Account Number: %s', $this->htmlEscape($this->getInfo()->getAccountNumber())) ?><br />
31
+ <?php echo mage::helper('ACH')->__('Check Number: %s', $this->htmlEscape($this->getInfo()->getBankNumber())) ?><br />
32
+ <?php echo mage::helper('ACH')->__('TYPE: %s', $this->htmlEscape($this->getInfo()->getBankName())) ?>
33
+ <?php else: ?>
34
+
35
+ <?php endif; ?>
app/etc/modules/Thylak_ACH.xml ADDED
@@ -0,0 +1,10 @@
 
 
 
 
 
 
 
 
 
 
1
+ <?xml version="1.0" ?>
2
+ <config>
3
+ <modules>
4
+ <Thylak_ACH>
5
+ <active>true</active>
6
+ <codePool>community</codePool>
7
+ </Thylak_ACH>
8
+ </modules>
9
+ </config>
10
+
package.xml ADDED
@@ -0,0 +1,18 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?xml version="1.0"?>
2
+ <package>
3
+ <name>ACHpayment</name>
4
+ <version>1.4</version>
5
+ <stability>stable</stability>
6
+ <license uri="http://www.opensource.org/licenses/osl-3.0.php">OSL v3.0</license>
7
+ <channel>community</channel>
8
+ <extends/>
9
+ <summary>Ach payment</summary>
10
+ <description>Ach payment</description>
11
+ <notes>Ach payment</notes>
12
+ <authors><author><name>jayakumar</name><user>auto-converted</user><email>jayakumar@thylaksoft.com</email></author></authors>
13
+ <date>2010-05-07</date>
14
+ <time>11:19:03</time>
15
+ <contents><target name="magedesign"><dir name="frontend"><dir name="default"><dir name="default"><dir name="template"><dir name="Ach_view"><file name="form_cc.phtml" hash="45f5a6bc2e9e1628b9dba678eed1d77f"/><file name="form_eft.phtml" hash="86744d8862d533a6a74631d0b2351b31"/><file name="info_cc.phtml" hash="61fd62b4d5d903b1e85f0445984856cc"/><file name="info_eft.phtml" hash="e6f15133f55d8d4a15dfef427062b1af"/></dir></dir></dir></dir></dir></target><target name="mageetc"><dir name="modules"><file name="Thylak_ACH.xml" hash="b63442c4d2c75b129830b5815d4c947b"/></dir></target><target name="magecommunity"><dir name="Thylak"><dir name="ACH"><dir name="Block"><dir name="Form"><file name="Cc.php" hash="925ade9d6cad32233a5b58a1d802f313"/><file name="Eft.php" hash="1b0c42758a68b1897cfc217b071625aa"/></dir><dir name="Info"><file name="Cc.php" hash="7fa334aa638242260856c3d1fcef59fc"/><file name="Eft.php" hash="f8a623359fd3593e562d1d4261aa3b87"/></dir></dir><dir name="etc"><file name="config.xml" hash="cc30136481006efc941bc932a1ffd41d"/><file name="system.xml" hash="271636e0230048f6bb3a8cbcabd11245"/></dir><dir name="Helper"><file name="Data.php" hash="4cbba84463a9ea610f09d164dd2728ec"/></dir><dir name="Model"><file name="CreditCard.php" hash="5b7a710ef344187a074ae8fe97372f5c"/><file name="Eft.php" hash="b8d5fa26c319d140fece4e06ae8cf432"/><file name="Process.php" hash="9228afafbc36a759b070b9e4e33e436e"/><dir name="Config"><file name="CcTransactiontype.php" hash="0ee0a9361e08db8016924e0eb1bec0b5"/><file name="EftTransactiontype.php" hash="d5098e9892bc5ffec8e492e4da3c34cf"/></dir></dir><dir name="sql"><dir name="ACH_setup"><file name="mysql4-install-1.0.1.php" hash="b700e9b25e506d5f12ea0c9e49d037f3"/></dir></dir></dir></dir></target></contents>
16
+ <compatible/>
17
+ <dependencies/>
18
+ </package>