NetpayIntl_PaymentInt_CheckOut - Version 1.0.8

Version Notes

*support both HPP and silent post
*support for authorization then capture
*support refund
*fixed email send and order status in HPP

Download this release

Release Info

Developer Udi
Extension NetpayIntl_PaymentInt_CheckOut
Version 1.0.8
Comparing to
See all releases


Version 1.0.8

app/code/community/NetpayIntl/PaymentInt/Block/Form/Cc.php ADDED
@@ -0,0 +1,30 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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 Mage
13
+ * @package Mage_BankPayment
14
+ * @copyright Copyright (c) 2008 Andrej Sinicyn
15
+ * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
16
+ */
17
+
18
+
19
+ class NetpayIntl_PaymentInt_Block_Form_Cc extends Mage_Payment_Block_Form_Cc
20
+ {
21
+ public function getChildHtml(){
22
+ if ($this->getMethod()->ShowOwnerID() != '1') return;
23
+ return '<li>' .
24
+ '<label for="' . $_code . '_cc_ownerID" class="required"><em>*</em>' . $this->__('Card Owner ID') . '</label>' .
25
+ ' <div class="input-box">' .
26
+ ' <input type="text" title=""' . $this->__('Card Owner ID') . '" class="input-text required-entry" id="' . $_code . '_cc_ownerID" name="payment[cc_ownerID]" value="' . $this->htmlEscape($this->getInfoData('cc_ownerID')) . '" />' .
27
+ ' </div>' .
28
+ '</li>';
29
+ }
30
+ }
app/code/community/NetpayIntl/PaymentInt/Block/Info/Cc.php ADDED
@@ -0,0 +1,41 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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 Mage
22
+ * @package Mage_Payment
23
+ * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com)
24
+ * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
25
+ */
26
+
27
+ /**
28
+ * Credit card generic payment info
29
+ */
30
+ class NetpayIntl_PaymentInt_Block_Info_Cc extends Mage_Payment_Block_Info_Cc
31
+ {
32
+ protected function _prepareSpecificInformation($transport = null)
33
+ {
34
+ //if (null !== $this->_paymentSpecificInformation) return $this->_paymentSpecificInformation;
35
+ $transport = parent::_prepareSpecificInformation($transport);
36
+ $data = array();
37
+ $ownerID = $this->getInfo()->getAdditionalInformation('OwnerID');
38
+ if ($ownerID) $data[Mage::helper('payment')->__('Owner ID')] = $ownerID;
39
+ return $transport->setData(array_merge($data, $transport->getData()));
40
+ }
41
+ }
app/code/community/NetpayIntl/PaymentInt/Block/Redirect.php ADDED
@@ -0,0 +1,30 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ class NetpayIntl_PaymentInt_Block_Redirect extends Mage_Core_Block_Abstract
3
+ {
4
+ protected function _toHtml()
5
+ {
6
+ $session = Mage::getSingleton('checkout/session');
7
+ $order = Mage::getModel('sales/order')->loadByIncrementId($session->getLastRealOrderId());
8
+ if (!$order->getId()) {
9
+ Mage::throwException('No order for processing found');
10
+ }
11
+ $pmModel = Mage::getModel('NetpayIntl_PaymentInt/PaymentMethod');
12
+ $form = new Varien_Data_Form();
13
+ $form->setAction($pmModel->getNetpayIntlUrl())
14
+ ->setId('pay')
15
+ ->setName('pay')
16
+ ->setMethod('GET')
17
+ ->setUseContainer(true);
18
+ foreach ($pmModel->getCheckoutFormFields($order) as $field=>$value)
19
+ $form->addField($field, 'hidden', array('name'=>$field, 'value'=>$value));
20
+ $html = '<html><body>';
21
+ $html.= $this->__('You will be redirected to NetpayIntl in a few seconds.');
22
+ $html.= '<br>';
23
+ $html.= $form->toHtml();
24
+ $html.= '<br>';
25
+ $html.= '<script type="text/javascript">document.getElementById("pay").submit();</script>';
26
+ $html.= '</body></html>';
27
+ return $html;
28
+ }
29
+ }
30
+ ?>
app/code/community/NetpayIntl/PaymentInt/Model/PaymentMethod.php ADDED
@@ -0,0 +1,307 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ class NetpayIntl_PaymentInt_Model_PaymentMethod extends Mage_Payment_Model_Method_Abstract
3
+ {
4
+ const CGI_URL = 'https://process.netpay-intl.com/member/remote_charge.asp';
5
+ const REDIRECT_URL = 'https://services.netpay-intl.com/hosted/';
6
+ const RESPONSE_CODE_APPROVED = '000';
7
+
8
+ protected $_code = 'NetpayIntl_PaymentInt';
9
+ protected $_isGateway = true;
10
+ protected $_canAuthorize = true;
11
+ protected $_canCapture = true;
12
+ protected $_canCapturePartial = true;
13
+ protected $_canRefund = true;
14
+ protected $_canRefundInvoicePartial = true;
15
+ protected $_canVoid = false;
16
+ protected $_canUseInternal = false;
17
+ protected $_canUseCheckout = true;
18
+ protected $_canUseForMultishipping = false;
19
+
20
+ protected $_formBlockType = 'NetpayIntl_PaymentInt/form_cc';
21
+ protected $_infoBlockType = 'NetpayIntl_PaymentInt/info_cc';
22
+
23
+ public function ShowOwnerID() { return $this->getConfigData('ShowOwnerID'); }
24
+ public function getUseRedirect() { return $this->getConfigData('UseRedirect'); }
25
+
26
+ public function assignData($data)
27
+ {
28
+ $result = parent::assignData($data);
29
+ $this->getInfoInstance()->setAdditionalInformation('OwnerID', $data['cc_ownerID']);
30
+ return $result;
31
+ }
32
+
33
+ /**
34
+ * Send authorize request to gateway
35
+ *
36
+ * @param Varien_Object $payment
37
+ * @param decimal $amount
38
+ * @throws Mage_Core_Exception
39
+ */
40
+
41
+ public function getShouldRedirect(Varien_Object $payment)
42
+ {
43
+ if(!$this->getUseRedirect()) return false;
44
+ if($payment != null && $payment->getTransactionId()) return false;
45
+ return true;
46
+ }
47
+
48
+ public function authorize(Varien_Object $payment, $amount)
49
+ {
50
+ if ($this->getShouldRedirect($payment)) return $this;
51
+ if ($amount <= 0) {
52
+ Mage::throwException(Mage::helper('paygate')->__('Invalid amount for authorization.'));
53
+ }
54
+ $payment->setAmount($amount);
55
+
56
+ $request= $this->_buildRequest($payment, 1, 1);
57
+ $result = $this->_postRequest($request);
58
+
59
+ $payment->setCcApproval($result->getApprovalCode())
60
+ ->setLastTransId($result->getTransactionId())
61
+ ->setTransactionId($result->getTransactionId())
62
+ ->setIsTransactionClosed(0);
63
+
64
+ switch ($result->getResponseCode()) {
65
+ case self::RESPONSE_CODE_APPROVED:
66
+ $payment->setStatus(self::STATUS_APPROVED);
67
+ return $this;
68
+ default:
69
+ Mage::throwException(Mage::helper('paygate')->__('Payment authorization error:') . ' ' . $result->getResponseReasonText());
70
+ }
71
+ }
72
+
73
+ /**
74
+ * Send capture request to gateway
75
+ *
76
+ * @param Varien_Object $payment
77
+ * @param decimal $amount
78
+ * @throws Mage_Core_Exception
79
+ */
80
+ public function capture(Varien_Object $payment, $amount)
81
+ {
82
+ if ($this->getShouldRedirect($payment)) return $this;
83
+ $nTransType = 0;
84
+ $authTransaction = $payment->getAuthorizationTransaction();
85
+ $payment->setAmount($amount);
86
+ if ($authTransaction) $nTransType = 2;
87
+ $request = $this->_buildRequest($payment, $nTransType, 1);
88
+ if ($authTransaction){
89
+ $request .= "&TransApprovalID=" . $authTransaction->getTxnId();
90
+ $request .= "&RefTransID=" . $authTransaction->getTxnId();
91
+ }
92
+ $result = $this->_postRequest($request);
93
+ if ($result->getResponseCode() == self::RESPONSE_CODE_APPROVED) {
94
+ $payment->setStatus(self::STATUS_APPROVED);
95
+ $payment->setLastTransId($result->getTransactionId());
96
+ if (!$payment->getParentTransactionId() || $result->getTransactionId() != $payment->getParentTransactionId()) {
97
+ $payment->setTransactionId($result->getTransactionId());
98
+ }
99
+ return $this;
100
+ }
101
+ if ($result->getResponseReasonText()) Mage::throwException($this->_wrapGatewayError($result->getResponseReasonText()));
102
+ Mage::throwException(Mage::helper('paygate')->__('Error in capturing the payment.'));
103
+ }
104
+
105
+ /**
106
+ * refund the amount with transaction id
107
+ *
108
+ * @param string $payment Varien_Object object
109
+ * @throws Mage_Core_Exception
110
+ */
111
+ public function refund(Varien_Object $payment, $amount)
112
+ {
113
+ $captureTrans = $payment->lookupTransaction(false, Mage_Sales_Model_Order_Payment_Transaction::TYPE_CAPTURE);
114
+ if ($captureTrans && $amount > 0) {
115
+ $payment->setAmount($amount);
116
+ $request = $this->_buildRequest($payment, 0, 0);
117
+ $request .= "&RefTransID=" . $captureTrans->getTxnId();
118
+
119
+ $result = $this->_postRequest($request);
120
+ if ($result->getResponseCode()==self::RESPONSE_CODE_APPROVED) {
121
+ $payment->setStatus(self::STATUS_SUCCESS);
122
+ $payment->setTransactionId($result->getTransactionId());
123
+ $payment->setLastTransId($result->getTransactionId());
124
+ return $this;
125
+ }
126
+ Mage::throwException($this->_wrapGatewayError($result->getResponseReasonText()));
127
+ }
128
+ Mage::throwException(Mage::helper('paygate')->__('Error in refunding the payment.'));
129
+ }
130
+
131
+ /**
132
+ * Prepare request to gateway
133
+ *
134
+ * @link http://process.NetpayIntl.co.il/
135
+ * @param Mage_Sales_Model_Document $order
136
+ * @return unknown
137
+ */
138
+ protected function _buildRequest(Varien_Object $payment, int $nTransType, int $nTypeCredit)
139
+ {
140
+ $order = $payment->getOrder();
141
+ $this->setStore($order->getStoreId());
142
+ $ReqStr = '?CompanyNum=' . $this->getConfigData('CompanyNum');
143
+ if ($order && $order->getIncrementId()) $ReqStr .= "&Order=" . $order->getIncrementId();
144
+ //$payment->getCcTransId() $payment->getCcAuthCode()
145
+ if($payment->getAmount()){
146
+ $ReqStr .= "&Amount=" . $payment->getAmount();
147
+ $ReqStr .= "&Currency=" . $order->getBaseCurrencyCode();
148
+ }
149
+ $ReqStr .= "&TypeCredit=" . $nTypeCredit;
150
+ $ReqStr .= "&TransType=" . $nTransType;
151
+ if (!empty($order)) {
152
+ $ReqStr .= "&ClientIP=" . $order->getRemoteIp();
153
+ $billing = $order->getBillingAddress();
154
+ if (!empty($billing)) {
155
+ $ReqStr .= "&Member=" . urlencode($billing->getFirstname() . ' ' . $billing->getLastname());
156
+ $ReqStr .= "&BillingAddress1=" . urlencode($billing->getStreet(1));
157
+ $ReqStr .= "&BillingAddress2=" . urlencode($billing->getRegion());
158
+ $ReqStr .= "&BillingCity=" . urlencode($billing->getCity());
159
+ $ReqStr .= "&BillingZipCode=" . urlencode($billing->getPostcode());
160
+ $ReqStr .= "&BillingState=" . urlencode($billing->getState());
161
+ $ReqStr .= "&BillingCountry=" . urlencode($billing->getCountry());
162
+ $ReqStr .= "&PhoneNumber=" . urlencode($billing->getTelephone());
163
+ $ReqStr .= "&PersonalNum=" . urlencode($payment->getAdditionalInformation('OwnerID'));
164
+ if($billing->getCustomerEmail()) $ReqStr .= "&Email=" . urlencode($billing->getCustomerEmail());
165
+ }
166
+ }
167
+ if ($payment->getCcExpMonth()) $ReqStr .= "&ExpMonth=" . sprintf('%02d', $payment->getCcExpMonth());
168
+ if ($payment->getCcExpYear()) $ReqStr .= "&ExpYear=" . sprintf('%04d', $payment->getCcExpYear());
169
+ if($nTypeCredit != 0 && $nTransType != 2){
170
+ $ReqStr .= "&CardNum=" . $payment->getCcNumber();
171
+ $ReqStr .= "&CVV2=" . $payment->getCcCid();
172
+ }
173
+ $ReqStr .= "&Payments=1";
174
+ if ($this->getConfigData('UseCCStorage')) $ReqStr .= "&StoreCc=1";
175
+ //echo $ReqStr; exit();
176
+ return $ReqStr;
177
+ }
178
+
179
+ protected function _postRequest($request)
180
+ {
181
+ $debugData = array('request' => $request);
182
+ $result = new Varien_Object();
183
+
184
+ $client = new Varien_Http_Client();
185
+ $uri = $this->getConfigData('cgi_url');
186
+ $client->setUri(($uri ? $uri : self::CGI_URL) . $request);
187
+ $client->setConfig( array('maxredirects'=>0, 'timeout'=>30));
188
+
189
+ $client->setParameterPost($request);
190
+ //$client->setMethod(Zend_Http_Client::POST);
191
+
192
+ try { $response = $client->setUrlEncodeBody(false)->request(); /*$client->request();*/ }
193
+ catch (Exception $e) {
194
+ $result->setResponseCode(-1)
195
+ ->setResponseReasonCode($e->getCode())
196
+ ->setResponseReasonText($e->getMessage());
197
+
198
+ $debugData['result'] = $result->getData();
199
+ $this->_debug($debugData);
200
+ Mage::throwException($this->_wrapGatewayError($e->getMessage()));
201
+ }
202
+ $responseBody = $response->getBody();
203
+ //echo $uri . $request . ' ' . $responseBody; Exit();
204
+ parse_str($responseBody, $r);
205
+ if ($r) {
206
+ $result->setResponseCode((int)str_replace('"','',$r['Reply']))
207
+ ->setResponseReasonText($r['ReplyDesc'])
208
+ ->setApprovalCode($r['ConfirmationNum'])
209
+ ->setTransactionId($r['TransID'])
210
+ ->setAmount($r['Amount']);
211
+ } else {
212
+ Mage::throwException( Mage::helper('paygate')->__('Error in payment gateway.') );
213
+ }
214
+ $debugData['result'] = $result->getData();
215
+ $this->_debug($debugData);
216
+ return $result;
217
+ }
218
+
219
+ /**
220
+ * Gateway response wrapper
221
+ *
222
+ * @param string $text
223
+ * @return string
224
+ */
225
+ protected function _wrapGatewayError($text)
226
+ {
227
+ return Mage::helper('paygate')->__('Gateway error: %s', $text);
228
+ }
229
+
230
+
231
+ /*************************************************************************************************/
232
+ /* HOSTED */
233
+ /*************************************************************************************************/
234
+ public function getNetpayIntlUrl() { return self::REDIRECT_URL; }
235
+ public function getFormBlockType() { if ($this->getShouldRedirect(null)) return 'payment/form'; return $this->_formBlockType; }
236
+ public function getInfoBlockType() { if ($this->getShouldRedirect(null)) return 'payment/info'; return $this->_infoBlockType; }
237
+ public function getCanUseForMultishipping() { return !getUseRedirect(); }
238
+
239
+ public function getConfigPaymentAction()
240
+ {
241
+ if ($this->getShouldRedirect(null)) return null;
242
+ return $this->getConfigData('payment_action');
243
+ }
244
+
245
+ public function getOrderPlaceRedirectUrl() {
246
+ if (!$this->getShouldRedirect(null)) return null;
247
+ return Mage::getUrl('NetpayIntl_PaymentInt/Redirect', array('_secure' => true));
248
+ }
249
+
250
+ public function doPostRedirect(Varien_Object $payment, $request)
251
+ {
252
+ $trans_id = $request->getParam('trans_id');
253
+ $auth_code = $request->getParam('auth_code');
254
+ $transCustomData = array('GW TransID' => $trans_id, 'Auth Code' => $auth_code);
255
+
256
+ $order = $payment->getOrder();
257
+ $payment->setTransactionId($trans_id);
258
+ $payment->setTransactionAdditionalInfo($transCustomData);
259
+ $transType = Mage_Sales_Model_Order_Payment_Transaction::TYPE_CAPTURE;
260
+ if ($this->getConfigData('payment_action') == 'authorize') {
261
+ $payment->setIsTransactionClosed(0);
262
+ $payment->registerAuthorizationNotification($order->getGrandTotal());
263
+ } else $payment->registerCaptureNotification($order->getGrandTotal());
264
+ $order->sendNewOrderEmail();
265
+ $order->setEmailSent(true);
266
+ $order->save();
267
+ }
268
+
269
+ public function getCheckoutFormFields($order)
270
+ {
271
+ $nTransType = 0;
272
+ if ($this->getConfigData('payment_action') == 'authorize') $nTransType = 1;
273
+ $order_id = $order->getRealOrderId();
274
+ $signature = base64_encode(md5($this->getConfigData('CompanyNum') . trim(round($order->getGrandTotal(), 2)) . $order->getBaseCurrencyCode() . $this->getConfigData('HashKey'), true));
275
+
276
+ $params = array();
277
+ $params['trans_refNum'] = $order_id;
278
+ $params['merchantID'] = $this->getConfigData('CompanyNum');
279
+ $params['disp_payFor'] = 'Payment for order #'.$order_id;
280
+ $params['trans_amount'] = trim(round($order->getGrandTotal(), 2));
281
+ $params['trans_currency'] = $order->getBaseCurrencyCode();
282
+ $params['trans_type'] = $nTransType;
283
+ if ($this->getConfigData('UseCCStorage')) $params['trans_storePm'] = "1";
284
+ $params['signature'] = $signature;
285
+ $params['disp_lng'] = $this->getConfigData('UILanguage');
286
+ $params['url_redirect'] = Mage::getUrl('NetpayIntl_PaymentInt/Redirect/success');
287
+
288
+ if (!empty($order)) {
289
+ $billing = $order->getBillingAddress();
290
+ if (!empty($billing)) {
291
+ $params['client_fullName'] = $billing->getFirstname() . ' ' . $billing->getLastname();
292
+ $params['client_billAddress1'] = $billing->getStreet(1);
293
+ $params['client_billAddress2'] = $billing->getRegion();
294
+ $params['client_billCity'] = $billing->getCity();
295
+ $params['client_billZipcode'] = $billing->getPostcode();
296
+ $params['client_billState'] = $billing->getState();
297
+ $params['client_billCountry'] = $billing->getCountry();
298
+ $params['client_phoneNum'] = $billing->getTelephone();
299
+ if ($billing->getCustomerEmail()) $params['client_email'] = $billing->getCustomerEmail();
300
+ }
301
+ }
302
+ $order->setState(Mage_Sales_Model_Order::STATE_PENDING_PAYMENT, Mage_Sales_Model_Order::STATE_PENDING_PAYMENT, 'the customer redirected to NetpayIntl');
303
+ $order->save();
304
+ return $params;
305
+ }
306
+ }
307
+ ?>
app/code/community/NetpayIntl/PaymentInt/controllers/RedirectController.php ADDED
@@ -0,0 +1,44 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+
4
+ class NetpayIntl_PaymentInt_RedirectController extends Mage_Core_Controller_Front_Action {
5
+ const RESPONSE_CODE_APPROVED = '000';
6
+ protected function _expireAjax() {
7
+ if (!Mage::getSingleton('checkout/session')->getQuote()->hasItems()) {
8
+ $this->getResponse()->setHeader('HTTP/1.1','403 Session Expired');
9
+ exit;
10
+ }
11
+ }
12
+
13
+ public function indexAction() {
14
+ $this->getResponse()
15
+ ->setHeader('Content-type', 'text/html; charset=utf8')
16
+ ->setBody($this->getLayout()
17
+ ->createBlock('NetpayIntl_PaymentInt/Redirect')
18
+ ->toHtml());
19
+ }
20
+
21
+ public function successAction()
22
+ {
23
+ $session = Mage::getSingleton('checkout/session');
24
+ $realOrderId = $this->getRequest()->getParam('trans_refNum');
25
+ $replyCode = $this->getRequest()->getParam('replyCode');
26
+ $order = Mage::getModel('sales/order')->loadByIncrementId($realOrderId);
27
+ if ($replyCode == self::RESPONSE_CODE_APPROVED) {
28
+ $payment = $order->getPayment();
29
+ $method = $payment->getMethodInstance();
30
+ $method->doPostRedirect($payment, $this->getRequest());
31
+ $this->_redirect('checkout/onepage/success', array('_secure'=>true));
32
+ }else{
33
+ $session->addError($this->getRequest()->getParam('replyDesc'));
34
+ $quote = Mage::getModel('sales/quote')->load($order->getQuoteId());
35
+ if ($quote->getId()) {
36
+ $quote->setIsActive(true)->save();
37
+ $session->setQuoteId($quoteId);
38
+ }
39
+ $this->_redirect('checkout/cart');
40
+ }
41
+ }
42
+ }
43
+
44
+ ?>
app/code/community/NetpayIntl/PaymentInt/etc/config.xml ADDED
@@ -0,0 +1,68 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?xml version="1.0"?>
2
+ <config>
3
+ <modules>
4
+ <NetpayIntl_PaymentInt>
5
+ <version>1.0.8</version>
6
+ </NetpayIntl_PaymentInt>
7
+ </modules>
8
+
9
+ <global>
10
+ <blocks>
11
+ <NetpayIntl_PaymentInt>
12
+ <class>NetpayIntl_PaymentInt_Block</class>
13
+ </NetpayIntl_PaymentInt>
14
+ </blocks>
15
+ <models>
16
+ <NetpayIntl_PaymentInt>
17
+ <class>NetpayIntl_PaymentInt_Model</class>
18
+ </NetpayIntl_PaymentInt>
19
+ </models>
20
+ <resources>
21
+ <NetpayIntl_PaymentInt_setup>
22
+ <setup>
23
+ <module>NetpayIntl_PaymentInt</module>
24
+ </setup>
25
+ <connection>
26
+ <use>core_setup</use>
27
+ </connection>
28
+ </NetpayIntl_PaymentInt_setup>
29
+ <NetpayIntl_PaymentInt_write>
30
+ <connection>
31
+ <use>core_write</use>
32
+ </connection>
33
+ </NetpayIntl_PaymentInt_write>
34
+ <NetpayIntl_PaymentInt_read>
35
+ <connection>
36
+ <use>core_read</use>
37
+ </connection>
38
+ </NetpayIntl_PaymentInt_read>
39
+
40
+ </resources>
41
+ </global>
42
+ <frontend>
43
+ <routers>
44
+ <NetpayIntl_PaymentInt>
45
+ <use>standard</use>
46
+ <args>
47
+ <module>NetpayIntl_PaymentInt</module>
48
+ <frontName>NetpayIntl_PaymentInt</frontName>
49
+ </args>
50
+ </NetpayIntl_PaymentInt>
51
+ </routers>
52
+ </frontend>
53
+
54
+ <default>
55
+ <payment>
56
+ <NetpayIntl_PaymentInt>
57
+ <active>0</active>
58
+ <model>NetpayIntl_PaymentInt/PaymentMethod</model>
59
+ <order_status>pending_payment</order_status>
60
+ <title>NetpayIntl</title>
61
+ <UseRedirect>1</UseRedirect>
62
+ <UseCCStorage>0</UseCCStorage>
63
+ <payment_action>authorize</payment_action>
64
+ <allowspecific>0</allowspecific>
65
+ </NetpayIntl_PaymentInt>
66
+ </payment>
67
+ </default>
68
+ </config>
app/code/community/NetpayIntl/PaymentInt/etc/system.xml ADDED
@@ -0,0 +1,96 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?xml version="1.0"?>
2
+ <config>
3
+ <sections>
4
+ <payment>
5
+ <groups>
6
+ <NetpayIntl_PaymentInt translate="label" module="paygate">
7
+ <label>NetpayIntl Payment Services</label>
8
+ <sort_order>670</sort_order>
9
+ <show_in_default>1</show_in_default>
10
+ <show_in_website>1</show_in_website>
11
+ <show_in_store>0</show_in_store>
12
+ <fields>
13
+ <active translate="label">
14
+ <label>Enabled</label>
15
+ <frontend_type>select</frontend_type>
16
+ <source_model>adminhtml/system_config_source_yesno</source_model>
17
+ <sort_order>0</sort_order>
18
+ <show_in_default>1</show_in_default>
19
+ <show_in_website>1</show_in_website>
20
+ <show_in_store>0</show_in_store>
21
+ </active>
22
+ <title translate="label">
23
+ <label>Title</label>
24
+ <frontend_type>text</frontend_type>
25
+ <sort_order>1</sort_order>
26
+ <show_in_default>1</show_in_default>
27
+ <show_in_website>1</show_in_website>
28
+ <show_in_store>0</show_in_store>
29
+ </title>
30
+ <payment_action translate="label">
31
+ <label>Payment Action</label>
32
+ <frontend_type>select</frontend_type>
33
+ <source_model>paygate/authorizenet_source_paymentAction</source_model>
34
+ <sort_order>2</sort_order>
35
+ <show_in_default>1</show_in_default>
36
+ <show_in_website>1</show_in_website>
37
+ <show_in_store>0</show_in_store>
38
+ </payment_action>
39
+ <UseRedirect translate="label">
40
+ <label>Use Redirect method</label>
41
+ <frontend_type>select</frontend_type>
42
+ <source_model>adminhtml/system_config_source_yesno</source_model>
43
+ <sort_order>3</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
+ </UseRedirect>
48
+ <CompanyNum translate="label">
49
+ <label>Company Number</label>
50
+ <frontend_type>text</frontend_type>
51
+ <sort_order>4</sort_order>
52
+ <show_in_default>1</show_in_default>
53
+ <show_in_website>0</show_in_website>
54
+ <show_in_store>0</show_in_store>
55
+ </CompanyNum>
56
+ <HashKey translate="label">
57
+ <label>Hash Key</label>
58
+ <frontend_type>text</frontend_type>
59
+ <sort_order>5</sort_order>
60
+ <show_in_default>1</show_in_default>
61
+ <show_in_website>0</show_in_website>
62
+ <show_in_store>0</show_in_store>
63
+ </HashKey>
64
+ <UILanguage translate="label">
65
+ <label>UI Language</label>
66
+ <frontend_type>text</frontend_type>
67
+ <sort_order>6</sort_order>
68
+ <show_in_default>1</show_in_default>
69
+ <show_in_website>1</show_in_website>
70
+ <show_in_store>0</show_in_store>
71
+ </UILanguage>
72
+ <ShowOwnerID translate="label">
73
+ <label>Show Card Owner ID Field</label>
74
+ <frontend_type>select</frontend_type>
75
+ <source_model>adminhtml/system_config_source_yesno</source_model>
76
+ <sort_order>7</sort_order>
77
+ <show_in_default>1</show_in_default>
78
+ <show_in_website>1</show_in_website>
79
+ <show_in_store>0</show_in_store>
80
+ </ShowOwnerID>
81
+ <UseCCStorage translate="label">
82
+ <label>Use Token System</label>
83
+ <frontend_type>select</frontend_type>
84
+ <source_model>adminhtml/system_config_source_yesno</source_model>
85
+ <sort_order>8</sort_order>
86
+ <show_in_default>1</show_in_default>
87
+ <show_in_website>1</show_in_website>
88
+ <show_in_store>0</show_in_store>
89
+ </UseCCStorage>
90
+ </fields>
91
+ </NetpayIntl_PaymentInt>
92
+
93
+ </groups>
94
+ </payment>
95
+ </sections>
96
+ </config>
app/etc/modules/NetpayIntl_PaymentInt.xml ADDED
@@ -0,0 +1,11 @@
 
 
 
 
 
 
 
 
 
 
 
1
+ <config>
2
+ <modules>
3
+ <NetpayIntl_PaymentInt>
4
+ <active>true</active>
5
+ <codePool>community</codePool>
6
+ <depends>
7
+ <Mage_Payment />
8
+ </depends>
9
+ </NetpayIntl_PaymentInt>
10
+ </modules>
11
+ </config>
package.xml ADDED
@@ -0,0 +1,22 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?xml version="1.0"?>
2
+ <package>
3
+ <name>NetpayIntl_PaymentInt_CheckOut</name>
4
+ <version>1.0.8</version>
5
+ <stability>stable</stability>
6
+ <license uri="http://www.netpay-intl.com">Freeware</license>
7
+ <channel>community</channel>
8
+ <extends/>
9
+ <summary>NetpayIntl's magento integration for magento versions 1.6 to 1.8</summary>
10
+ <description>This module is use to process from you magento online store</description>
11
+ <notes>*support both HPP and silent post&#xD;
12
+ *support for authorization then capture&#xD;
13
+ *support refund&#xD;
14
+ *fixed email send and order status in HPP&#xD;
15
+ </notes>
16
+ <authors><author><name>Udi</name><user>Udi</user><email>udi@ctrlz.co.il</email></author></authors>
17
+ <date>2014-02-25</date>
18
+ <time>15:46:33</time>
19
+ <contents><target name="magecommunity"><dir name="NetpayIntl"><dir name="PaymentInt"><dir name="Block"><dir name="Form"><file name="Cc.php" hash="42aba28ee76c01318b03cdf14600eca2"/></dir><dir name="Info"><file name="Cc.php" hash="522c8caeb4c4ee1f19b1830543304d27"/></dir><file name="Redirect.php" hash="d386ae50f986b3b79d94d2af3146e2e2"/></dir><dir name="Model"><file name="PaymentMethod.php" hash="af04b5d13d0bc9a2d4059f1731f10a80"/></dir><dir name="controllers"><file name="RedirectController.php" hash="e1089d13bfb4a315dc27d9ab1ab4c954"/></dir><dir name="etc"><file name="config.xml" hash="acea593db40bb32aea2b937cfe0339ae"/><file name="system.xml" hash="f7f27cded9c6e40081c3180297f93250"/></dir></dir></dir></target><target name="mage"><dir name="app"><dir name="etc"><dir name="modules"><file name="NetpayIntl_PaymentInt.xml" hash="de444be58ec40ca344b4f69f0e17eb56"/></dir></dir></dir></target></contents>
20
+ <compatible/>
21
+ <dependencies><required><php><min>5.2.0</min><max>5.6.0</max></php></required></dependencies>
22
+ </package>