Debitway_Interac - Version 2.0.0

Version Notes

The Base currency of the magento should be same as the Currency with which merchant account is processing in Debitway

Download this release

Release Info

Developer ramya
Extension Debitway_Interac
Version 2.0.0
Comparing to
See all releases


Version 2.0.0

app/code/local/Debitway/Interac/Helper/Data.php ADDED
@@ -0,0 +1,5 @@
 
 
 
 
 
1
+ <?php
2
+ class Debitway_Interac_Helper_Data extends Mage_Core_Helper_Abstract
3
+ {
4
+
5
+ }
app/code/local/Debitway/Interac/Model/Service/Quote.php ADDED
@@ -0,0 +1,21 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ class Debitway_Interac_Model_Service_Quote extends Mage_Sales_Model_Service_Quote
4
+ {
5
+
6
+
7
+
8
+ public function submitOrder()
9
+ {
10
+
11
+
12
+ $order = parent::submitOrder();
13
+ if($order->getPayment()->getMethodInstance()->getCode()== 'debitway')
14
+
15
+ $this->_quote->setIsActive(true);
16
+
17
+ return $order;
18
+ }
19
+ }
20
+
21
+ ?>
app/code/local/Debitway/Interac/Model/Standard.php ADDED
@@ -0,0 +1,91 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ class Debitway_Interac_Model_Standard extends Mage_Payment_Model_Method_Abstract {
3
+ protected $_code = 'debitway';
4
+
5
+ protected $_isGateway = false;
6
+ protected $_canUseInternal = true;
7
+ protected $_canUseCheckout = true;
8
+ protected $_canUseForMultishipping = false;
9
+
10
+ protected $_canRefund = true;
11
+ protected $_canCapture = true;
12
+ protected $_canAuthorize = true;
13
+ protected $_canRefundInvoicePartial = true;
14
+
15
+
16
+
17
+ public function getOrderPlaceRedirectUrl() {
18
+ return Mage::getUrl('debitway/payment/redirect', array('_secure' => true));
19
+ }
20
+
21
+ public function refund(Varien_Object $payment, $amount)
22
+ {
23
+
24
+ try{
25
+
26
+ $identifier = trim(Mage::getStoreConfig('payment/debitway/identifier'));
27
+ $vericode = trim(Mage::getStoreConfig('payment/debitway/vericode'));
28
+
29
+
30
+ $order = $payment->getOrder()->getOrderId();
31
+ $transaction_id = $payment->getParentTransactionId();
32
+ if($transaction_id==null){
33
+ Mage::throwException(Mage::helper('payment')->__('null value in transaction id'));
34
+
35
+ }
36
+
37
+
38
+ $comments = "A refund was issued to the customer";
39
+ $ch = curl_init();
40
+ $url="https://www.debitway.com/integration/index.php";
41
+ curl_setopt($ch, CURLOPT_URL,$url);
42
+
43
+ curl_setopt($ch, CURLOPT_POST, true);
44
+
45
+ $post_data = 'identifier='.$identifier.'&vericode='.$vericode.'&comments='.$comments.'&transaction_id='.$transaction_id.'&amount='.$amount.'&action=refund';
46
+ curl_setopt ($ch, CURLOPT_POSTFIELDS, $post_data);
47
+ curl_setopt ($ch, CURLOPT_RETURNTRANSFER, true);
48
+ curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, false);
49
+ curl_setopt($ch, CURLOPT_SSL_VERIFYHOST, 0);
50
+ $result = curl_exec($ch);
51
+
52
+ curl_close($ch);
53
+ $res = explode('" ',$result);
54
+ for($i=0;$i<count($res);$i++){
55
+ if($res[$i]=='result="success'){
56
+ $success = true;
57
+ break;
58
+ }else
59
+ $success = false;
60
+
61
+ }
62
+ if($result == null){
63
+ $success = false;
64
+ }
65
+ if($success==false){
66
+ Mage::throwException(Mage::helper('payment')->__('Problem encountered in Refunding.'));
67
+ }
68
+
69
+
70
+ }catch (Exception $e) {
71
+ Mage::throwException(Mage::helper('payment')->__($e));
72
+ }
73
+
74
+
75
+ if (!$this->canRefund()) {
76
+ Mage::throwException(Mage::helper('payment')->__('Refund action is not available.'));
77
+ }
78
+
79
+
80
+ return $this;
81
+ }
82
+ public function capture(Varien_Object $payment, $amount)
83
+ {
84
+ $payment->setStatus(self::STATUS_APPROVED)
85
+ ->setLastTransId($payment->getParentTransactionId());
86
+
87
+ return $this;
88
+ }
89
+
90
+ }
91
+ ?>
app/code/local/Debitway/Interac/controllers/PaymentController.php ADDED
@@ -0,0 +1,226 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /*
3
+ Debitway Payment Controller
4
+
5
+ */
6
+
7
+ class Debitway_Interac_PaymentController extends Mage_Core_Controller_Front_Action {
8
+
9
+
10
+ protected $_sendNewOrderEmail = true;
11
+
12
+ protected $_order = NULL;
13
+
14
+ protected $_paymentInst = NULL;
15
+
16
+ // The redirect action is triggered when someone places an order
17
+ public function redirectAction() {
18
+
19
+ $session = $this->getCheckout();
20
+ Mage::log($session);
21
+ $session->setInteracQuoteId($session->getQuoteId());
22
+ $order = Mage::getModel('sales/order');
23
+ $order->loadByIncrementId($session->getLastRealOrderId());
24
+ $order->addStatusToHistory($order->getStatus(), Mage::helper('debitway')->__('processing the payment'));
25
+ $order->save();
26
+
27
+ $this->loadLayout();
28
+ $block = $this->getLayout()->createBlock('Mage_Core_Block_Template','debitway',array('template' => 'debitway/redirect.phtml'));
29
+ $this->getLayout()->getBlock('content')->append($block);
30
+ $this->renderLayout();
31
+ $session->unsQuoteId();
32
+ }
33
+
34
+
35
+ // The response action is triggered when your gateway sends back a response after processing the customer's payment
36
+ public function responseAction() {
37
+
38
+ //for backend notification.
39
+ if($this->getRequest()->isPost()) {
40
+
41
+ $identifier = trim(Mage::getStoreConfig('payment/debitway/identifier'));
42
+ $vericode = trim(Mage::getStoreConfig('payment/debitway/vericode'));
43
+ $website_unique_id = trim(Mage::getStoreConfig('payment/debitway/website_unique_id'));
44
+ $return_url = trim(Mage::getStoreConfig('payment/debitway/return_url'));
45
+
46
+ $transaction_id= $_POST["transaction_id"];
47
+ // function for backend notification
48
+ if($_GET['action']=="backend_notification"){
49
+
50
+ if($identifier==$_POST["identifier"]){
51
+
52
+ $ch = curl_init();
53
+ $url="https://www.debitway.com/integration/index.php";
54
+ curl_setopt($ch, CURLOPT_URL,$url);
55
+ echo "RECEIVED";
56
+ curl_setopt($ch, CURLOPT_POST, true);
57
+
58
+ $post_data = 'identifier='.$identifier.'&vericode='.$vericode.'&transaction_id='.$transaction_id.'&action=verify';
59
+ curl_setopt ($ch, CURLOPT_POSTFIELDS, $post_data);
60
+ curl_setopt ($ch, CURLOPT_RETURNTRANSFER, true);
61
+ curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, false);
62
+ curl_setopt($ch, CURLOPT_SSL_VERIFYHOST, 0);
63
+ $result = curl_exec($ch);
64
+ $output = curl_exec($ch);
65
+
66
+ curl_close($ch);
67
+ exit(0);
68
+ }
69
+
70
+ //function of approval
71
+ }else{
72
+
73
+ if($identifier==$_POST["identifier"] && $_POST['transaction_result']=="success"){
74
+
75
+ $ch = curl_init();
76
+ $url="https://www.debitway.com/integration/index.php";
77
+ curl_setopt($ch, CURLOPT_URL,$url);
78
+
79
+ curl_setopt($ch, CURLOPT_POST, true);
80
+
81
+ $post_data = 'identifier='.$identifier.'&vericode='.$vericode.'&transaction_id='.$transaction_id.'&action=verify';
82
+ curl_setopt ($ch, CURLOPT_POSTFIELDS, $post_data);
83
+ curl_setopt ($ch, CURLOPT_RETURNTRANSFER, true);
84
+ curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, false);
85
+ curl_setopt($ch, CURLOPT_SSL_VERIFYHOST, 0);
86
+ $result = curl_exec($ch);
87
+
88
+ curl_close($ch);
89
+
90
+ $output = $this->get_value_from_response($result,'result');
91
+ if($output == "success"){
92
+ $validated = true;
93
+ }else{
94
+
95
+ $validated = false;
96
+
97
+ }
98
+ }
99
+ else{
100
+
101
+ $validated = false;
102
+
103
+ }
104
+ }
105
+
106
+ $orderId =$_POST['transaction_id'];
107
+ // Generally sent by gateway
108
+ $error = $_POST['customer_errors_meaning'];
109
+
110
+
111
+ if($validated) {
112
+
113
+
114
+ //save the transaction id
115
+ $order = Mage::getModel('sales/order')->loadByIncrementId(Mage::getSingleton('checkout/session')->getLastRealOrderId());
116
+
117
+ $msg= "Payment";
118
+ $payment = $order->getPayment();
119
+ $payment->setTransactionId($transaction_id);
120
+ $payment->addTransaction( Mage_Sales_Model_Order_Payment_Transaction::TYPE_ORDER, null, false, $msg );
121
+
122
+
123
+
124
+ if ($order->canInvoice()) {
125
+ $invoice = $order->prepareInvoice();
126
+
127
+ $invoice->register()->capture();
128
+ Mage::getModel('core/resource_transaction')
129
+ ->addObject($invoice)
130
+ ->addObject($invoice->getOrder())
131
+ ->save();
132
+ }
133
+
134
+ $order->setState(Mage_Sales_Model_Order::STATE_PROCESSING, true, 'Gateway has authorized the payment.');
135
+
136
+ $order->sendNewOrderEmail();
137
+ $order->setEmailSent(true);
138
+
139
+
140
+
141
+ $order->save();
142
+ $session = $this->getCheckout();
143
+ $session->setQuoteId($session->getInteracQuoteId(true));
144
+ $session->getQuote()->setIsActive(false)->save();
145
+
146
+ $cartHelper = Mage::helper('checkout/cart');
147
+
148
+
149
+ Mage::getSingleton('core/session')->addSuccess(
150
+ Mage::helper('checkout')->__("Transaction id = ".$_POST['transaction_id'])
151
+ );
152
+
153
+ Mage::getSingleton('checkout/session')->unsQuoteId();
154
+
155
+
156
+
157
+ Mage_Core_Controller_Varien_Action::_redirect('checkout/onepage/success', array('_secure'=>true));
158
+
159
+ }
160
+ else {
161
+
162
+ if($result!=null){
163
+ $error = $this->get_value_from_response($result,'errors_meaning');
164
+ }
165
+
166
+ $session = $this->getCheckout();
167
+ $session->setQuoteId($session->getInteracQuoteId(true));
168
+ $session->getQuote()->setIsActive(true)->save();
169
+
170
+
171
+ $order = Mage::getModel('sales/order');
172
+ $order->load($this->getCheckout()->getLastOrderId());
173
+ $order->cancel();
174
+ $order->addStatusToHistory($order->getStatus(), Mage::helper('debitway')->__('Cancelation of payment'));
175
+ $order->save();
176
+
177
+ //save the transaction id
178
+ $order = Mage::getModel('sales/order')->loadByIncrementId(Mage::getSingleton('checkout/session')->getLastRealOrderId());
179
+ $msg= "Decline";
180
+
181
+
182
+ Mage::getSingleton('core/session')->addError(
183
+ Mage::helper('checkout')->__($error)
184
+ );
185
+
186
+
187
+
188
+
189
+ Mage_Core_Controller_Varien_Action::_redirect('checkout/onepage', array('_secure'=>true));
190
+ }
191
+ }
192
+ else
193
+ Mage_Core_Controller_Varien_Action::_redirect('');
194
+ }
195
+
196
+ // The cancel action is triggered when an order is to be cancelled
197
+ public function cancelAction() {
198
+
199
+ if (Mage::getSingleton('checkout/session')->getLastRealOrderId()) {
200
+ $order = Mage::getModel('sales/order')->loadByIncrementId(Mage::getSingleton('checkout/session')->getLastRealOrderId());
201
+ if($order->getId()) {
202
+ // Flag the order as 'cancelled' and save it
203
+ $order->cancel()->setState(Mage_Sales_Model_Order::STATE_CANCELED, true, 'Gateway has declined the payment.')->save();
204
+ }
205
+ }
206
+ }
207
+ /**
208
+ * Get singleton of Checkout Session Model
209
+ *
210
+ * @return Mage_Checkout_Model_Session
211
+ */
212
+ public function getCheckout()
213
+ {
214
+ return Mage::getSingleton('checkout/session');
215
+ }
216
+
217
+ private function get_value_from_response($l_str, $l_key) {
218
+ if(strpos($l_str, $l_key."=\"")) {
219
+ $l_substr = substr($l_str, strpos($l_str, $l_key."=\"") + strlen($l_key) + 2);
220
+ return substr($l_substr, 0, strpos($l_substr, "\""));
221
+ }
222
+ else return FALSE;
223
+ }
224
+
225
+
226
+ }
app/code/local/Debitway/Interac/etc/config.xml ADDED
@@ -0,0 +1,74 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?xml version="1.0"?>
2
+ <config>
3
+ <modules>
4
+ <Debitway_Interac>
5
+ <version>0.1.0</version>
6
+ </Debitway_Interac>
7
+ </modules>
8
+ <global>
9
+ <models>
10
+ <debitway>
11
+ <class>Debitway_Interac_Model</class>
12
+ </debitway>
13
+ <sales>
14
+ <rewrite>
15
+ <service_quote>Debitway_Interac_Model_Service_Quote</service_quote>
16
+ </rewrite>
17
+ </sales>
18
+ </models>
19
+ <resources>
20
+ <debitway_setup>
21
+ <setup>
22
+ <module>Interac</module>
23
+ </setup>
24
+ <connection>
25
+ <use>core_setup</use>
26
+ </connection>
27
+ </debitway_setup>
28
+ <debitway_write>
29
+ <connection>
30
+ <use>core_write</use>
31
+ </connection>
32
+ </debitway_write>
33
+ <debitway_read>
34
+ <connection>
35
+ <use>core_read</use>
36
+ </connection>
37
+ </debitway_read>
38
+ </resources>
39
+ <helpers>
40
+ <debitway>
41
+ <class>Debitway_Interac_Helper</class>
42
+ </debitway>
43
+ </helpers>
44
+ <blocks>
45
+ <debitway>
46
+ <class>Debitway_Interac_Block</class>
47
+ </debitway>
48
+ </blocks>
49
+ </global>
50
+ <default>
51
+ <payment>
52
+ <debitway>
53
+ <model>debitway/standard</model>
54
+ <active>1</active>
55
+ <order_status>pending</order_status>
56
+ <title>Debitway- Interac online</title>
57
+ <payment_action>sale</payment_action>
58
+ <allowspecific>0</allowspecific>
59
+ <sort_order>1</sort_order>
60
+ </debitway>
61
+ </payment>
62
+ </default>
63
+ <frontend>
64
+ <routers>
65
+ <debitway>
66
+ <use>standard</use>
67
+ <args>
68
+ <module>Debitway_Interac</module>
69
+ <frontName>debitway</frontName>
70
+ </args>
71
+ </debitway>
72
+ </routers>
73
+ </frontend>
74
+ </config>
app/code/local/Debitway/Interac/etc/system.xml ADDED
@@ -0,0 +1,117 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?xml version="1.0"?>
2
+ <config>
3
+ <sections>
4
+ <payment>
5
+ <groups>
6
+ <debitway translate="label comment" module="paygate">
7
+ <label>DebitWay - Interac Online</label>
8
+ <frontend_type>text</frontend_type>
9
+ <sort_order>0</sort_order>
10
+ <show_in_default>1</show_in_default>
11
+ <show_in_website>1</show_in_website>
12
+ <show_in_store>1</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>0</show_in_store>
22
+ </active>
23
+ <title translate="label">
24
+ <label>Title</label>
25
+ <frontend_type>text</frontend_type>
26
+ <comment>It is recommended to set the value to "DebitWay - Interac Online" per store views.</comment>
27
+ <sort_order>20</sort_order>
28
+ <show_in_default>1</show_in_default>
29
+ <show_in_website>1</show_in_website>
30
+ <show_in_store>1</show_in_store>
31
+ </title>
32
+ <order_status translate="label">
33
+ <label>New Order Status</label>
34
+ <frontend_type>select</frontend_type>
35
+ <source_model>adminhtml/system_config_source_order_status</source_model>
36
+ <sort_order>50</sort_order>
37
+ <show_in_default>1</show_in_default>
38
+ <show_in_website>1</show_in_website>
39
+ <show_in_store>0</show_in_store>
40
+ </order_status>
41
+ <allowspecific translate="label">
42
+ <label>Payment Applicable From</label>
43
+ <frontend_type>select</frontend_type>
44
+ <sort_order>61</sort_order>
45
+ <source_model>adminhtml/system_config_source_payment_allspecificcountries</source_model>
46
+ <show_in_default>1</show_in_default>
47
+ <show_in_website>1</show_in_website>
48
+ <show_in_store>0</show_in_store>
49
+ </allowspecific>
50
+ <specificcountry translate="label">
51
+ <label>Countries Payment Applicable From</label>
52
+ <frontend_type>multiselect</frontend_type>
53
+ <sort_order>70</sort_order>
54
+ <source_model>adminhtml/system_config_source_country</source_model>
55
+ <show_in_default>1</show_in_default>
56
+ <show_in_website>1</show_in_website>
57
+ <show_in_store>0</show_in_store>
58
+ <depends>
59
+ <allowspecific>1</allowspecific>
60
+ </depends>
61
+ </specificcountry>
62
+ <sort_order translate="label">
63
+ <label>Sort Order</label>
64
+ <frontend_type>text</frontend_type>
65
+ <sort_order>100</sort_order>
66
+ <show_in_default>1</show_in_default>
67
+ <show_in_website>1</show_in_website>
68
+ <show_in_store>0</show_in_store>
69
+ </sort_order>
70
+
71
+ <merchant_id>
72
+ <label>Merchant ID</label>
73
+ <frontend_type>text</frontend_type>
74
+ <sort_order>120</sort_order>
75
+ <show_in_default>1</show_in_default>
76
+ <show_in_website>1</show_in_website>
77
+ <show_in_store>0</show_in_store>
78
+ </merchant_id>
79
+
80
+ <vericode>
81
+ <label>Vericode</label>
82
+ <frontend_type>text</frontend_type>
83
+ <sort_order>130</sort_order>
84
+ <show_in_default>1</show_in_default>
85
+ <show_in_website>1</show_in_website>
86
+ <show_in_store>0</show_in_store>
87
+ </vericode>
88
+ <identifier>
89
+ <label>Identifier</label>
90
+ <frontend_type>text</frontend_type>
91
+ <sort_order>131</sort_order>
92
+ <show_in_default>1</show_in_default>
93
+ <show_in_website>1</show_in_website>
94
+ <show_in_store>0</show_in_store>
95
+ </identifier>
96
+ <website_unique_id>
97
+ <label>Website Unique Id</label>
98
+ <frontend_type>text</frontend_type>
99
+ <sort_order>132</sort_order>
100
+ <show_in_default>1</show_in_default>
101
+ <show_in_website>1</show_in_website>
102
+ <show_in_store>0</show_in_store>
103
+ </website_unique_id>
104
+ <integration_url>
105
+ <label>Integration Url</label>
106
+ <frontend_type>text</frontend_type>
107
+ <sort_order>133</sort_order>
108
+ <show_in_default>1</show_in_default>
109
+ <show_in_website>1</show_in_website>
110
+ <show_in_store>0</show_in_store>
111
+ </integration_url>
112
+ </fields>
113
+ </debitway>
114
+ </groups>
115
+ </payment>
116
+ </sections>
117
+ </config>
app/design/frontend/base/default/template/debitway/redirect.phtml ADDED
@@ -0,0 +1,98 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ // Retrieve order
3
+ $_order = new Mage_Sales_Model_Order();
4
+ $orderId = Mage::getSingleton('checkout/session')->getLastRealOrderId();
5
+ $_order->loadByIncrementId($orderId);
6
+
7
+
8
+ $items = $_order->getAllItems();
9
+
10
+ $item_name_total ="";
11
+ foreach($items as $item) {
12
+ $qty = round($item->getData('qty_ordered'));
13
+ $name = $item->getName();
14
+ $item_total = $qty.'*'.$name;
15
+ if($item_name_total!=null){
16
+ $item_name_total .='-';
17
+ }
18
+ $item_name_total .=$item_total;
19
+
20
+ }
21
+ $currency_code = $_order->getBaseCurrencyCode();
22
+ $grandTotal1 = number_format($_order->getGrandTotal(),2);
23
+
24
+ //$this->_order = Mage::getSingleton('sales/order')->loadByIncrementId();
25
+
26
+
27
+ $billing = $_order->getBillingAddress();
28
+ $shipping = $_order->getShippingAddress();
29
+ $params = array(
30
+
31
+ 'firstname' => Mage::helper('core')->removeAccents($billing->getFirstname()),
32
+ 'lastname' => Mage::helper('core')->removeAccents($billing->getLastname()),
33
+ 'sContactName' => Mage::helper('core')->removeAccents($shipping->getFirstname().' '.$shipping->getLastname()),
34
+
35
+ // billing address
36
+ 'bAddress1' => $billing->getStreet1(),
37
+ 'bAddress2' => $billing->getStreet2(),
38
+ 'bCity' => $shipping->getCity(),
39
+ 'bProvince' => $billing->getRegionCode(),
40
+ 'bCountry' => $billing->getCountry(),
41
+ 'bPostal' => $billing->getPostcode(),
42
+ 'bPhone' => $billing->getTelephone(),
43
+
44
+ // shipping address
45
+ 'sAddress1' => $shipping->getStreet1(),
46
+ 'sAddress2' => $shipping->getStreet2(),
47
+ 'sCity' => $shipping->getCity(),
48
+ 'sProvince' => $shipping->getRegionCode(),
49
+ 'sCountry' => $shipping->getCountry(),
50
+ 'sPostal' => $shipping->getPostcode(),
51
+ 'sPhone' => $shipping->getTelephone(),
52
+
53
+ 'cPhone' => $_order->getCustomerTelephone(),
54
+ 'oEmail' => $_order->getCustomerEmail(),
55
+ 'cfirstname' => $_order->getCustomerFirstname(),
56
+ 'clastname' => $_order->getCustomerLastname()
57
+
58
+
59
+ );
60
+ $identifier = trim(Mage::getStoreConfig('payment/debitway/identifier'));
61
+ $vericode = trim(Mage::getStoreConfig('payment/debitway/vericode'));
62
+ $website_unique_id = trim(Mage::getStoreConfig('payment/debitway/website_unique_id'));
63
+
64
+ $integration_url = trim(Mage::getStoreConfig('payment/debitway/integration_url'));
65
+ $return_url = Mage::getBaseUrl (Mage_Core_Model_Store::URL_TYPE_WEB);
66
+ $return_url .= 'debitway/payment/response';
67
+ ?>
68
+ <form name="mygatewayform" method="post" action="<?php echo $integration_url; ?>">
69
+ <!-- <input type="hidden" name="orderid" value="<?php echo $orderId; ?>">
70
+ <input type="hidden" name="grandtotal" value="<?php echo $_order->getBaseGrandTotal(); ?>"> -->
71
+ <input type="hidden" name="identifier" value= "<?php echo $identifier; ?>" >
72
+ <input type="hidden" name="website_unique_id" value="<?php echo $website_unique_id; ?>">
73
+ <input type="hidden" name="merchant_transaction_id" value="<?php echo $orderId; ?>">
74
+ <input type="hidden" name="item_name" value="<?php echo $item_name_total; ?>">
75
+ <input type="hidden" name="quantity" value="1">
76
+ <input type="hidden" name="amount" value="<?php echo $grandTotal1; ?>">
77
+ <input type="hidden" name="return_url" value="<?php echo $return_url; ?>">
78
+ <input type="hidden" name="language" value="EN">
79
+ <input type="hidden" name="first_name" value="<?php echo $params['cfirstname']; ?>">
80
+ <input type="hidden" name="last_name" value="<?php echo $params['clastname']; ?>">
81
+ <input type="hidden" name="email" value="<?php echo $params['oEmail']; ?>">
82
+ <input type="hidden" name="address" value="<?php echo $params['bAddress1']; ?>">
83
+ <input type="hidden" name="phone" value="<?php echo $params['sPhone']; ?>">
84
+ <input type="hidden" name="city" value="<?php echo $params['bCity']; ?>">
85
+ <input type="hidden" name="state_or_province" value="<?php echo $params['bProvince']; ?>">
86
+ <input type="hidden" name="zip_or_postal_code" value="<?php echo $params['bPostal']; ?>">
87
+ <input type="hidden" name="country" value="<?php echo $params['bCountry']; ?>">
88
+ <input type="hidden" name="shipping_address" value="<?php echo $params['bAddress1']; ?>">
89
+ <input type="hidden" name="shipping_phone" value="<?php echo $params['sPhone']; ?>">
90
+ <input type="hidden" name="shipping_city" value="<?php echo $params['sCity']; ?>">
91
+ <input type="hidden" name="shipping_state_or_province" value="<?php echo $params['sProvince']; ?>">
92
+ <input type="hidden" name="shipping_zip_or_postal_code" value="<?php echo $params['sPostal']; ?>">
93
+ <input type="hidden" name="shipping_country" value="<?php echo $params['sCountry']; ?>">
94
+ <input type="hidden" name="currency" value="<?php echo $currency_code; ?>">
95
+ </form>
96
+ <script type="text/javascript">
97
+ document.mygatewayform.submit();
98
+ </script>
app/etc/modules/Debitway_Interac.xml ADDED
@@ -0,0 +1,15 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?xml version="1.0"?>
2
+ <config>
3
+ <modules>
4
+ <Debitway_Interac>
5
+ <active>true</active>
6
+ <codePool>local</codePool>
7
+
8
+ <depends>
9
+ <Mage_Payment />
10
+ </depends>
11
+
12
+ </Debitway_Interac>
13
+
14
+ </modules>
15
+ </config>
package.xml ADDED
@@ -0,0 +1,24 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?xml version="1.0"?>
2
+ <package>
3
+ <name>Debitway_Interac</name>
4
+ <version>2.0.0</version>
5
+ <stability>stable</stability>
6
+ <license uri="http://opensource.org/licenses/osl-3.0.php">Open Software License</license>
7
+ <channel>community</channel>
8
+ <extends/>
9
+ <summary>This extension incorporates the DebitWay Credit Card Module&#xD;
10
+ </summary>
11
+ <description>This extension is used for the Interac Payment (Direct Debit) for Debitway.&#xD;
12
+ A redirection is done to Debitway page when user clicks on checkout and user can enter the information in that page. &#xD;
13
+ &#xD;
14
+ The return url brings the user back to magento store displaying the status of the transaction. &#xD;
15
+ &#xD;
16
+ </description>
17
+ <notes>The Base currency of the magento should be same as the Currency with which merchant account is processing in Debitway</notes>
18
+ <authors><author><name>ramya</name><user>tech4</user><email>tech@debitway.ca</email></author></authors>
19
+ <date>2015-03-25</date>
20
+ <time>21:10:16</time>
21
+ <contents><target name="magelocal"><dir name="Debitway"><dir name="Interac"><dir name="Helper"><file name="Data.php" hash="b5b7b369a083dd0e306fedead9c839a3"/></dir><dir name="Model"><dir name="Service"><file name="Quote.php" hash="e05d162eaea3914482d608b6fc7fe1bd"/></dir><file name="Standard.php" hash="2e324fddaa9ad4030f5dc9350df54b89"/></dir><dir name="controllers"><file name="PaymentController.php" hash="031dcb89fcf30ee4827846da52a27dec"/></dir><dir name="etc"><file name="config.xml" hash="783501c2db9438652ffbe9a2b0204e59"/><file name="system.xml" hash="30bd020229230a807654c179e675611e"/></dir></dir></dir></target><target name="mageetc"><dir name="modules"><file name="Debitway_Interac.xml" hash="485aad32d17a9a469deb969d5f27ba79"/></dir></target><target name="magedesign"><dir name="frontend"><dir name="base"><dir name="default"><dir name="template"><dir name="debitway"><file name="redirect.phtml" hash="5c13acb0a9960972ed3b79b0401a966b"/></dir></dir></dir></dir></dir></target></contents>
22
+ <compatible/>
23
+ <dependencies><required><php><min>5.1.0</min><max>6.0.0</max></php><package><name>Mage_Core_Modules</name><channel>community</channel><min>1.6.0.0</min><max>1.7</max></package><extension><name>gd</name><min>2.0.28</min><max>3.0</max></extension></required></dependencies>
24
+ </package>