Version Notes
fixed email send, fixed order status
Download this release
Release Info
Developer | Udi |
Extension | Netpay_HostedPage_Check_Out |
Version | 1.0.6 |
Comparing to | |
See all releases |
Code changes from version 1.0.5 to 1.0.6
- app/code/community/Netpay/HostedPage/Block/Redirect.php +1 -1
- app/code/community/Netpay/HostedPage/controllers/RedirectController.php +31 -24
- app/code/community/Netpay/HostedPage/etc/config.xml +1 -1
- app/code/community/Netpay/HostedPage/etc/system.xml +0 -9
- app/code/community/Netpay/HostedPage/model/PaymentMethod.php +17 -15
- package.xml +5 -5
app/code/community/Netpay/HostedPage/Block/Redirect.php
CHANGED
@@ -8,7 +8,7 @@ class Netpay_HostedPage_Block_Redirect extends Mage_Core_Block_Abstract
|
|
8 |
$form->setAction($hpp->getNetpayUrl())
|
9 |
->setId('pay')
|
10 |
->setName('pay')
|
11 |
-
->setMethod('
|
12 |
->setUseContainer(true);
|
13 |
foreach ($hpp->getNetpayCheckoutFormFields() as $field=>$value)
|
14 |
$form->addField($field, 'hidden', array('name'=>$field, 'value'=>$value));
|
8 |
$form->setAction($hpp->getNetpayUrl())
|
9 |
->setId('pay')
|
10 |
->setName('pay')
|
11 |
+
->setMethod('GET')
|
12 |
->setUseContainer(true);
|
13 |
foreach ($hpp->getNetpayCheckoutFormFields() as $field=>$value)
|
14 |
$form->addField($field, 'hidden', array('name'=>$field, 'value'=>$value));
|
app/code/community/Netpay/HostedPage/controllers/RedirectController.php
CHANGED
@@ -18,31 +18,38 @@ class Netpay_HostedPage_RedirectController extends Mage_Core_Controller_Front_Ac
|
|
18 |
->toHtml());
|
19 |
}
|
20 |
|
21 |
-
public function successAction()
|
22 |
-
|
23 |
-
|
24 |
-
|
25 |
-
|
26 |
-
|
27 |
-
|
28 |
-
|
29 |
-
|
30 |
-
|
31 |
-
|
32 |
-
|
33 |
-
|
34 |
-
|
35 |
-
|
36 |
-
|
37 |
-
|
38 |
-
|
39 |
-
|
40 |
-
|
41 |
-
|
42 |
-
|
43 |
-
|
44 |
-
|
|
|
|
|
|
|
|
|
|
|
45 |
}
|
|
|
|
|
46 |
}
|
47 |
}
|
48 |
|
18 |
->toHtml());
|
19 |
}
|
20 |
|
21 |
+
public function successAction()
|
22 |
+
{
|
23 |
+
$session = Mage::getSingleton('checkout/session');
|
24 |
+
$order = Mage::getModel('sales/order')->loadByIncrementId($session->getLastRealOrderId());
|
25 |
+
//$order->load(Mage::getSingleton('checkout/session')->getLastOrderId());
|
26 |
+
if ($this->getRequest()->getParam('replyCode') == self::RESPONSE_CODE_APPROVED) {
|
27 |
+
$trans_id = $this->getRequest()->getParam('trans_id');
|
28 |
+
$session->setQuoteId($trans_id);
|
29 |
+
$order->sendNewOrderEmail();
|
30 |
+
$order->setEmailSent(true);
|
31 |
+
$order->setStatus('pending');
|
32 |
+
$order->save();
|
33 |
+
/*
|
34 |
+
$payment = Mage::getSingleton('sales/order_payment');
|
35 |
+
$payment->setAdditionalData($trans_id);
|
36 |
+
$payment->setStatus('APPROVED');
|
37 |
+
$payment->setLastTransId($trans_id);
|
38 |
+
$session->getQuote()->setIsActive(false)->collectTotals()->save();
|
39 |
+
$order->addPayment($payment);
|
40 |
+
$payment->save();
|
41 |
+
$order->save();
|
42 |
+
echo $payment->getAdditionalData() . ' ' . $payment->getId() . ' ' . $session->getQuote()->getId();
|
43 |
+
exit();
|
44 |
+
*/
|
45 |
+
$this->_redirect('checkout/onepage/success', array('_secure'=>true));
|
46 |
+
}else{
|
47 |
+
if ($order->getId()) {
|
48 |
+
$order->setStatus('canceled');
|
49 |
+
$order->cancel()->save();
|
50 |
}
|
51 |
+
$this->_redirect('checkout/cart');
|
52 |
+
}
|
53 |
}
|
54 |
}
|
55 |
|
app/code/community/Netpay/HostedPage/etc/config.xml
CHANGED
@@ -58,7 +58,7 @@
|
|
58 |
<HostedPage>
|
59 |
<active>1</active>
|
60 |
<model>HostedPage/paymentMethod</model>
|
61 |
-
<order_status>
|
62 |
<title>Netpay-intl</title>
|
63 |
<payment_action>authorize</payment_action>
|
64 |
<allowspecific>0</allowspecific>
|
58 |
<HostedPage>
|
59 |
<active>1</active>
|
60 |
<model>HostedPage/paymentMethod</model>
|
61 |
+
<order_status>pending_payment</order_status>
|
62 |
<title>Netpay-intl</title>
|
63 |
<payment_action>authorize</payment_action>
|
64 |
<allowspecific>0</allowspecific>
|
app/code/community/Netpay/HostedPage/etc/system.xml
CHANGED
@@ -30,15 +30,6 @@
|
|
30 |
<show_in_website>1</show_in_website>
|
31 |
<show_in_store>0</show_in_store>
|
32 |
</active>
|
33 |
-
<order_status translate="label">
|
34 |
-
<label>New Order Status</label>
|
35 |
-
<frontend_type>select</frontend_type>
|
36 |
-
<source_model>adminhtml/system_config_source_order_status_newprocessing</source_model>
|
37 |
-
<sort_order>2</sort_order>
|
38 |
-
<show_in_default>1</show_in_default>
|
39 |
-
<show_in_website>1</show_in_website>
|
40 |
-
<show_in_store>0</show_in_store>
|
41 |
-
</order_status>
|
42 |
<payment_action translate="label">
|
43 |
<label>Payment Action</label>
|
44 |
<frontend_type>select</frontend_type>
|
30 |
<show_in_website>1</show_in_website>
|
31 |
<show_in_store>0</show_in_store>
|
32 |
</active>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
33 |
<payment_action translate="label">
|
34 |
<label>Payment Action</label>
|
35 |
<frontend_type>select</frontend_type>
|
app/code/community/Netpay/HostedPage/model/PaymentMethod.php
CHANGED
@@ -3,7 +3,7 @@ class Netpay_HostedPage_Model_PaymentMethod extends Mage_Payment_Model_Method_Ab
|
|
3 |
{
|
4 |
const CGI_URL = 'https://services.netpay-intl.com/hosted/';
|
5 |
protected $_code = 'HostedPage';
|
6 |
-
protected $_isGateway =
|
7 |
protected $_canAuthorize = true;
|
8 |
protected $_canCapture = true;
|
9 |
protected $_canCapturePartial = false;
|
@@ -31,22 +31,22 @@ class Netpay_HostedPage_Model_PaymentMethod extends Mage_Payment_Model_Method_Ab
|
|
31 |
}
|
32 |
|
33 |
public function getNetpayCheckoutFormFields() {
|
34 |
-
|
|
|
35 |
$order_id = $this->getCheckout()->getLastRealOrderId();
|
36 |
$order = Mage::getModel('sales/order')->loadByIncrementId($order_id);
|
37 |
-
|
38 |
-
|
39 |
-
$params = array(
|
40 |
-
|
41 |
-
|
42 |
-
|
43 |
-
|
44 |
-
|
45 |
-
'trans_type'
|
46 |
-
'signature'
|
47 |
-
'disp_lng'
|
48 |
-
'url_redirect'
|
49 |
-
);
|
50 |
if (!empty($order)) {
|
51 |
$billing = $order->getBillingAddress();
|
52 |
if (!empty($billing)) {
|
@@ -61,6 +61,8 @@ class Netpay_HostedPage_Model_PaymentMethod extends Mage_Payment_Model_Method_Ab
|
|
61 |
if ($billing->getCustomerEmail()) $params['client_email'] = $billing->getCustomerEmail();
|
62 |
}
|
63 |
}
|
|
|
|
|
64 |
return $params;
|
65 |
}
|
66 |
}
|
3 |
{
|
4 |
const CGI_URL = 'https://services.netpay-intl.com/hosted/';
|
5 |
protected $_code = 'HostedPage';
|
6 |
+
protected $_isGateway = true;
|
7 |
protected $_canAuthorize = true;
|
8 |
protected $_canCapture = true;
|
9 |
protected $_canCapturePartial = false;
|
31 |
}
|
32 |
|
33 |
public function getNetpayCheckoutFormFields() {
|
34 |
+
$nTransType = 0;
|
35 |
+
if ($this->getConfigData('payment_action') == 'authorize') $nTransType = 1;
|
36 |
$order_id = $this->getCheckout()->getLastRealOrderId();
|
37 |
$order = Mage::getModel('sales/order')->loadByIncrementId($order_id);
|
38 |
+
$signature = base64_encode(md5($this->getConfigData('CompanyNum') . trim(round($order->getGrandTotal(), 2)) . $order->getBaseCurrencyCode() . $this->getConfigData('HashKey'), true));
|
39 |
+
|
40 |
+
$params = array();
|
41 |
+
$params['trans_refNum'] = $order_id;
|
42 |
+
$params['merchantID'] = $this->getConfigData('CompanyNum');
|
43 |
+
$params['disp_payFor'] = 'Payment for order #'.$order_id;
|
44 |
+
$params['trans_amount'] = trim(round($order->getGrandTotal(), 2));
|
45 |
+
$params['trans_currency'] = $order->getBaseCurrencyCode();
|
46 |
+
$params['trans_type'] = $nTransType;
|
47 |
+
$params['signature'] = $signature;
|
48 |
+
$params['disp_lng'] = $this->getConfigData('UILanguage');
|
49 |
+
$params['url_redirect'] = Mage::getUrl('HostedPage/Redirect/success');
|
|
|
50 |
if (!empty($order)) {
|
51 |
$billing = $order->getBillingAddress();
|
52 |
if (!empty($billing)) {
|
61 |
if ($billing->getCustomerEmail()) $params['client_email'] = $billing->getCustomerEmail();
|
62 |
}
|
63 |
}
|
64 |
+
$order->setStatus('pending_payment');
|
65 |
+
$order->save();
|
66 |
return $params;
|
67 |
}
|
68 |
}
|
package.xml
CHANGED
@@ -1,18 +1,18 @@
|
|
1 |
<?xml version="1.0"?>
|
2 |
<package>
|
3 |
<name>Netpay_HostedPage_Check_Out</name>
|
4 |
-
<version>1.0.
|
5 |
<stability>stable</stability>
|
6 |
<license uri="http://www.netpay-intl.com">Freeware</license>
|
7 |
<channel>community</channel>
|
8 |
<extends/>
|
9 |
<summary>Netpay's HostedPage magento integration</summary>
|
10 |
<description>This module is use to process from you magento online store</description>
|
11 |
-
<notes>
|
12 |
<authors><author><name>Udi</name><user>Udi</user><email>udi@ctrlz.co.il</email></author></authors>
|
13 |
-
<date>2012-01-
|
14 |
-
<time>15:
|
15 |
-
<contents><target name="magecommunity"><dir name="Netpay"><dir name="HostedPage"><dir name="Block"><file name="Redirect.php" hash="
|
16 |
<compatible/>
|
17 |
<dependencies><required><php><min>5.2.0</min><max>5.6.0</max></php></required></dependencies>
|
18 |
</package>
|
1 |
<?xml version="1.0"?>
|
2 |
<package>
|
3 |
<name>Netpay_HostedPage_Check_Out</name>
|
4 |
+
<version>1.0.6</version>
|
5 |
<stability>stable</stability>
|
6 |
<license uri="http://www.netpay-intl.com">Freeware</license>
|
7 |
<channel>community</channel>
|
8 |
<extends/>
|
9 |
<summary>Netpay's HostedPage magento integration</summary>
|
10 |
<description>This module is use to process from you magento online store</description>
|
11 |
+
<notes>fixed email send, fixed order status</notes>
|
12 |
<authors><author><name>Udi</name><user>Udi</user><email>udi@ctrlz.co.il</email></author></authors>
|
13 |
+
<date>2012-01-12</date>
|
14 |
+
<time>15:01:33</time>
|
15 |
+
<contents><target name="magecommunity"><dir name="Netpay"><dir name="HostedPage"><dir name="Block"><file name="Redirect.php" hash="5ec95ad443aa4fd0c864fbd04264eab9"/></dir><dir name="controllers"><file name="RedirectController.php" hash="4dfd5ff83879c6f25fc74e57d7aca426"/></dir><dir name="etc"><file name="config.xml" hash="6eed430d0cdc5211b7f050ba1790e35e"/><file name="system.xml" hash="1b5ec31bfcd5964bfa59c5d33bd0bedf"/></dir><dir name="model"><file name="PaymentMethod.php" hash="c4223c5d2a30623743ec883be6f343e8"/></dir></dir></dir></target><target name="mage"><dir name="app"><dir name="etc"><dir name="modules"><file name="Netpay_HostedPage.xml" hash="946d3d21576ddac0a349b3ea1b07b13a"/></dir></dir></dir></target></contents>
|
16 |
<compatible/>
|
17 |
<dependencies><required><php><min>5.2.0</min><max>5.6.0</max></php></required></dependencies>
|
18 |
</package>
|