Version Notes
Migs Vpc Payment Method Integration
Download this release
Release Info
Developer | Nikul Doshi |
Extension | ND_MigsVpc |
Version | 0.1.1 |
Comparing to | |
See all releases |
Code changes from version 0.1.0 to 0.1.1
- app/code/local/ND/MigsVpc/Model/Merchant.php +1 -1
- app/code/local/ND/MigsVpc/Model/Merchantnew.php +4 -4
- app/code/local/ND/MigsVpc/Model/Server.php +20 -5
- app/code/local/ND/MigsVpc/controllers/ServerController.php +13 -1
- app/code/local/ND/MigsVpc/etc/config.xml +1 -1
- app/code/local/ND/MigsVpc/etc/system.xml +10 -1
- package.xml +6 -6
app/code/local/ND/MigsVpc/Model/Merchant.php
CHANGED
@@ -138,7 +138,7 @@ class ND_MigsVpc_Model_Merchant extends Mage_Payment_Model_Method_Cc
|
|
138 |
public function getMerchantId()
|
139 |
{
|
140 |
if(Mage::getStoreConfig('payment/' . $this->getCode() . '/test_gateway'))
|
141 |
-
$merchant_id = Mage::getStoreConfig('payment/' . $this->getCode() . '/merchant_id');
|
142 |
else
|
143 |
$merchant_id = Mage::getStoreConfig('payment/' . $this->getCode() . '/merchant_id');
|
144 |
|
138 |
public function getMerchantId()
|
139 |
{
|
140 |
if(Mage::getStoreConfig('payment/' . $this->getCode() . '/test_gateway'))
|
141 |
+
$merchant_id = 'TEST'.Mage::getStoreConfig('payment/' . $this->getCode() . '/merchant_id');
|
142 |
else
|
143 |
$merchant_id = Mage::getStoreConfig('payment/' . $this->getCode() . '/merchant_id');
|
144 |
|
app/code/local/ND/MigsVpc/Model/Merchantnew.php
CHANGED
@@ -65,15 +65,15 @@ class ND_MigsVpc_Model_Merchantnew extends Mage_Payment_Model_Method_Abstract
|
|
65 |
*/
|
66 |
private function _getAmount()
|
67 |
{
|
68 |
-
|
69 |
{
|
70 |
return 1000;
|
71 |
}
|
72 |
else
|
73 |
-
{
|
74 |
$_amount = (double)$this->getOrder()->getBaseGrandTotal();
|
75 |
return $_amount*100;
|
76 |
-
|
77 |
}
|
78 |
|
79 |
/**
|
@@ -84,7 +84,7 @@ class ND_MigsVpc_Model_Merchantnew extends Mage_Payment_Model_Method_Abstract
|
|
84 |
public function getMerchantId()
|
85 |
{
|
86 |
if(Mage::getStoreConfig('payment/' . $this->getCode() . '/test_gateway'))
|
87 |
-
$merchant_id = Mage::getStoreConfig('payment/' . $this->getCode() . '/merchant_id');
|
88 |
else
|
89 |
$merchant_id = Mage::getStoreConfig('payment/' . $this->getCode() . '/merchant_id');
|
90 |
|
65 |
*/
|
66 |
private function _getAmount()
|
67 |
{
|
68 |
+
if(Mage::getStoreConfig('payment/' . $this->getCode() . '/test_gateway'))
|
69 |
{
|
70 |
return 1000;
|
71 |
}
|
72 |
else
|
73 |
+
{
|
74 |
$_amount = (double)$this->getOrder()->getBaseGrandTotal();
|
75 |
return $_amount*100;
|
76 |
+
}
|
77 |
}
|
78 |
|
79 |
/**
|
84 |
public function getMerchantId()
|
85 |
{
|
86 |
if(Mage::getStoreConfig('payment/' . $this->getCode() . '/test_gateway'))
|
87 |
+
$merchant_id = 'TEST'.Mage::getStoreConfig('payment/' . $this->getCode() . '/merchant_id');
|
88 |
else
|
89 |
$merchant_id = Mage::getStoreConfig('payment/' . $this->getCode() . '/merchant_id');
|
90 |
|
app/code/local/ND/MigsVpc/Model/Server.php
CHANGED
@@ -132,6 +132,9 @@ class ND_MigsVpc_Model_Server extends Mage_Payment_Model_Method_Abstract
|
|
132 |
$fieldsArr = array();
|
133 |
$lengs = 0;
|
134 |
$paymentInfo = $this->getInfoInstance();
|
|
|
|
|
|
|
135 |
$fields = array(
|
136 |
"vpc_AccessCode"=>$this->getAccessCode(),
|
137 |
"vpc_Amount"=>$this->_getAmount(), // 1000 - For Testing
|
@@ -139,7 +142,7 @@ class ND_MigsVpc_Model_Server extends Mage_Payment_Model_Method_Abstract
|
|
139 |
"vpc_Locale"=>"en",
|
140 |
"vpc_MerchTxnRef"=>$paymentInfo->getOrder()->getRealOrderId(),
|
141 |
"vpc_Merchant"=>$this->getMerchantId(),
|
142 |
-
"vpc_OrderInfo"=>$paymentInfo->getOrder()->getRealOrderId(),
|
143 |
"vpc_ReturnURL"=>Mage::getUrl('migsvpc/' . $this->_paymentMethod . '/response', array('_secure' => true)),
|
144 |
"vpc_TicketNo"=>'1',
|
145 |
"vpc_Version"=>'1'
|
@@ -147,10 +150,12 @@ class ND_MigsVpc_Model_Server extends Mage_Payment_Model_Method_Abstract
|
|
147 |
$str = '';
|
148 |
foreach($fields as $key => $val)
|
149 |
{
|
150 |
-
|
|
|
151 |
}
|
152 |
|
153 |
-
|
|
|
154 |
|
155 |
$fieldsArr['vpc_AccessCode'] = $this->getAccessCode();
|
156 |
$fieldsArr['vpc_Amount'] = $this->_getAmount();
|
@@ -163,7 +168,12 @@ class ND_MigsVpc_Model_Server extends Mage_Payment_Model_Method_Abstract
|
|
163 |
$fieldsArr['vpc_ReturnURL'] = Mage::getUrl('migsvpc/' . $this->_paymentMethod . '/response', array('_secure' => true));
|
164 |
$fieldsArr['vpc_TicketNo'] = '1';
|
165 |
$fieldsArr['vpc_Version'] = '1';
|
166 |
-
$fieldsArr['vpc_SecureHash'] = $secure_hash_key;
|
|
|
|
|
|
|
|
|
|
|
167 |
|
168 |
return $fieldsArr;
|
169 |
}
|
@@ -188,7 +198,7 @@ class ND_MigsVpc_Model_Server extends Mage_Payment_Model_Method_Abstract
|
|
188 |
*/
|
189 |
public function getDebug()
|
190 |
{
|
191 |
-
return Mage::getStoreConfig('payment/' . $this->getCode() . '/
|
192 |
}
|
193 |
|
194 |
public function capture(Varien_Object $payment, $amount)
|
@@ -241,6 +251,11 @@ class ND_MigsVpc_Model_Server extends Mage_Payment_Model_Method_Abstract
|
|
241 |
|
242 |
public function afterSuccessOrder($response)
|
243 |
{
|
|
|
|
|
|
|
|
|
|
|
244 |
$order = Mage::getModel('sales/order');
|
245 |
$order->loadByIncrementId($response['vpc_OrderInfo']);
|
246 |
$paymentInst = $order->getPayment()->getMethodInstance();
|
132 |
$fieldsArr = array();
|
133 |
$lengs = 0;
|
134 |
$paymentInfo = $this->getInfoInstance();
|
135 |
+
|
136 |
+
$this->validateByRMS();
|
137 |
+
|
138 |
$fields = array(
|
139 |
"vpc_AccessCode"=>$this->getAccessCode(),
|
140 |
"vpc_Amount"=>$this->_getAmount(), // 1000 - For Testing
|
142 |
"vpc_Locale"=>"en",
|
143 |
"vpc_MerchTxnRef"=>$paymentInfo->getOrder()->getRealOrderId(),
|
144 |
"vpc_Merchant"=>$this->getMerchantId(),
|
145 |
+
"vpc_OrderInfo"=>$paymentInfo->getOrder()->getRealOrderId(),
|
146 |
"vpc_ReturnURL"=>Mage::getUrl('migsvpc/' . $this->_paymentMethod . '/response', array('_secure' => true)),
|
147 |
"vpc_TicketNo"=>'1',
|
148 |
"vpc_Version"=>'1'
|
150 |
$str = '';
|
151 |
foreach($fields as $key => $val)
|
152 |
{
|
153 |
+
//$str .= $val;
|
154 |
+
$str .= $key . "=" . $val . "&";
|
155 |
}
|
156 |
|
157 |
+
//$secure_hash_key = strtoupper(md5($this->getSecureHashKey().$str));
|
158 |
+
$secure_hash_key = strtoupper(hash_hmac('SHA256', $str, pack('H*',$this->getSecureHashKey()))); // New secured method
|
159 |
|
160 |
$fieldsArr['vpc_AccessCode'] = $this->getAccessCode();
|
161 |
$fieldsArr['vpc_Amount'] = $this->_getAmount();
|
168 |
$fieldsArr['vpc_ReturnURL'] = Mage::getUrl('migsvpc/' . $this->_paymentMethod . '/response', array('_secure' => true));
|
169 |
$fieldsArr['vpc_TicketNo'] = '1';
|
170 |
$fieldsArr['vpc_Version'] = '1';
|
171 |
+
$fieldsArr['vpc_SecureHash'] = $secure_hash_key;
|
172 |
+
$fieldsArr['vpc_SecureHashType'] = "SHA256";
|
173 |
+
$debugData = array(
|
174 |
+
'request' => $fieldsArr
|
175 |
+
);
|
176 |
+
$this->_debug($debugData);
|
177 |
|
178 |
return $fieldsArr;
|
179 |
}
|
198 |
*/
|
199 |
public function getDebug()
|
200 |
{
|
201 |
+
return Mage::getStoreConfig('payment/' . $this->getCode() . '/debug');
|
202 |
}
|
203 |
|
204 |
public function capture(Varien_Object $payment, $amount)
|
251 |
|
252 |
public function afterSuccessOrder($response)
|
253 |
{
|
254 |
+
$debugData = array(
|
255 |
+
'response' => $response
|
256 |
+
);
|
257 |
+
$this->_debug($debugData);
|
258 |
+
|
259 |
$order = Mage::getModel('sales/order');
|
260 |
$order->loadByIncrementId($response['vpc_OrderInfo']);
|
261 |
$paymentInst = $order->getPayment()->getMethodInstance();
|
app/code/local/ND/MigsVpc/controllers/ServerController.php
CHANGED
@@ -32,12 +32,18 @@ class ND_MigsVpc_ServerController extends ND_MigsVpc_Controller_Abstract
|
|
32 |
$this->renderLayout();*/
|
33 |
if($responseParams['vpc_TxnResponseCode']=='7')
|
34 |
{
|
|
|
|
|
|
|
|
|
|
|
|
|
35 |
Mage::getSingleton('core/session')->addError(Mage::helper('core')->__($responseParams['vpc_Message']));
|
36 |
$this->_redirect('checkout/cart');
|
37 |
return;
|
38 |
}
|
39 |
elseif($responseParams['vpc_TxnResponseCode']=='0')
|
40 |
-
{
|
41 |
Mage::getModel('migsvpc/server')->afterSuccessOrder($responseParams);
|
42 |
//Mage::getSingleton('core/session')->addSuccess(Mage::helper('core')->__($responseParams['vpc_Message']));
|
43 |
$this->_redirect('checkout/onepage/success');
|
@@ -45,6 +51,12 @@ class ND_MigsVpc_ServerController extends ND_MigsVpc_Controller_Abstract
|
|
45 |
}
|
46 |
else
|
47 |
{
|
|
|
|
|
|
|
|
|
|
|
|
|
48 |
Mage::getSingleton('core/session')->addError(Mage::helper('core')->__($responseParams['vpc_Message']));
|
49 |
$this->_redirect('checkout/cart');
|
50 |
return;
|
32 |
$this->renderLayout();*/
|
33 |
if($responseParams['vpc_TxnResponseCode']=='7')
|
34 |
{
|
35 |
+
$orderIncId = $responseParams['vpc_MerchTxnRef'];
|
36 |
+
if(isset($orderIncId)) {
|
37 |
+
$order = Mage::getModel('sales/order')->loadByIncrementId($orderIncId);
|
38 |
+
$order->cancel();
|
39 |
+
$order->save();
|
40 |
+
}
|
41 |
Mage::getSingleton('core/session')->addError(Mage::helper('core')->__($responseParams['vpc_Message']));
|
42 |
$this->_redirect('checkout/cart');
|
43 |
return;
|
44 |
}
|
45 |
elseif($responseParams['vpc_TxnResponseCode']=='0')
|
46 |
+
{
|
47 |
Mage::getModel('migsvpc/server')->afterSuccessOrder($responseParams);
|
48 |
//Mage::getSingleton('core/session')->addSuccess(Mage::helper('core')->__($responseParams['vpc_Message']));
|
49 |
$this->_redirect('checkout/onepage/success');
|
51 |
}
|
52 |
else
|
53 |
{
|
54 |
+
$orderIncId = $responseParams['vpc_MerchTxnRef'];
|
55 |
+
if(isset($orderIncId)) {
|
56 |
+
$order = Mage::getModel('sales/order')->loadByIncrementId($orderIncId);
|
57 |
+
$order->cancel();
|
58 |
+
$order->save();
|
59 |
+
}
|
60 |
Mage::getSingleton('core/session')->addError(Mage::helper('core')->__($responseParams['vpc_Message']));
|
61 |
$this->_redirect('checkout/cart');
|
62 |
return;
|
app/code/local/ND/MigsVpc/etc/config.xml
CHANGED
@@ -24,7 +24,7 @@
|
|
24 |
<config>
|
25 |
<modules>
|
26 |
<ND_MigsVpc>
|
27 |
-
<version>0.
|
28 |
</ND_MigsVpc>
|
29 |
</modules>
|
30 |
<global>
|
24 |
<config>
|
25 |
<modules>
|
26 |
<ND_MigsVpc>
|
27 |
+
<version>0.1.1</version>
|
28 |
</ND_MigsVpc>
|
29 |
</modules>
|
30 |
<global>
|
app/code/local/ND/MigsVpc/etc/system.xml
CHANGED
@@ -134,7 +134,16 @@
|
|
134 |
<show_in_default>1</show_in_default>
|
135 |
<show_in_website>1</show_in_website>
|
136 |
<show_in_store>1</show_in_store>
|
137 |
-
</specificcountry>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
138 |
</fields>
|
139 |
</migsvpc_server>
|
140 |
<migsvpc_merchant translate="label">
|
134 |
<show_in_default>1</show_in_default>
|
135 |
<show_in_website>1</show_in_website>
|
136 |
<show_in_store>1</show_in_store>
|
137 |
+
</specificcountry>
|
138 |
+
<debug translate="label">
|
139 |
+
<label>Debug</label>
|
140 |
+
<frontend_type>select</frontend_type>
|
141 |
+
<source_model>adminhtml/system_config_source_yesno</source_model>
|
142 |
+
<sort_order>110</sort_order>
|
143 |
+
<show_in_default>1</show_in_default>
|
144 |
+
<show_in_website>1</show_in_website>
|
145 |
+
<show_in_store>0</show_in_store>
|
146 |
+
</debug>
|
147 |
</fields>
|
148 |
</migsvpc_server>
|
149 |
<migsvpc_merchant translate="label">
|
package.xml
CHANGED
@@ -1,7 +1,7 @@
|
|
1 |
<?xml version="1.0"?>
|
2 |
<package>
|
3 |
<name>ND_MigsVpc</name>
|
4 |
-
<version>0.1.
|
5 |
<stability>stable</stability>
|
6 |
<license>GNU General Public License</license>
|
7 |
<channel>community</channel>
|
@@ -9,10 +9,10 @@
|
|
9 |
<summary>Migs Vpc Payment Method Integration</summary>
|
10 |
<description>Migs Vpc Payment Method Integration</description>
|
11 |
<notes>Migs Vpc Payment Method Integration</notes>
|
12 |
-
<authors><author><name>Nikul Doshi</name><user>
|
13 |
-
<date>
|
14 |
-
<time>
|
15 |
-
<contents><target name="
|
16 |
<compatible/>
|
17 |
-
<dependencies
|
18 |
</package>
|
1 |
<?xml version="1.0"?>
|
2 |
<package>
|
3 |
<name>ND_MigsVpc</name>
|
4 |
+
<version>0.1.1</version>
|
5 |
<stability>stable</stability>
|
6 |
<license>GNU General Public License</license>
|
7 |
<channel>community</channel>
|
9 |
<summary>Migs Vpc Payment Method Integration</summary>
|
10 |
<description>Migs Vpc Payment Method Integration</description>
|
11 |
<notes>Migs Vpc Payment Method Integration</notes>
|
12 |
+
<authors><author><name>Nikul Doshi</name><user>nikulonline</user><email>nikulonline@gmail.com</email></author></authors>
|
13 |
+
<date>2016-11-12</date>
|
14 |
+
<time>09:36:16</time>
|
15 |
+
<contents><target name="magelocal"><dir name="ND"><dir name="MigsVpc"><dir name="Block"><file name="Form.php" hash="9bfa1576dbee91381d5bc3d88be89b8a"/><file name="Info.php" hash="15b0d73d67daf5f715b033051f8c4046"/><dir name="Merchant"><file name="Failure.php" hash="5f1f743dace0a09a61c0c0c58c08eed6"/><file name="Form.php" hash="8176c4b9cda4154f32afa6fccfedc1fb"/><file name="Redirect.php" hash="261419acaf998fc996fd1110b66ee1ec"/><file name="Response.php" hash="6b3a0b34b4b9a4243a6b0d0936e454b3"/></dir><dir name="Merchantnew"><file name="Failure.php" hash="79ea368d4e064d0ee4dac92137bcbf01"/><file name="Form.php" hash="0be3582637f6ea37cd2f8e23ddca10ef"/><file name="Redirect.php" hash="537697e878c2035fd1ae4c5d4b320432"/><file name="Response.php" hash="6b3a0b34b4b9a4243a6b0d0936e454b3"/></dir><dir name="Payment"><file name="Info.php" hash="fa2d2c7203d0db98e0f771c5d9d758eb"/></dir><dir name="Server"><file name="Failure.php" hash="0f8b90ca3429f970c1b9849f2f31ded9"/><file name="Form.php" hash="cf14cad1c35633092c8135302efd4631"/><file name="Redirect.php" hash="03bc949549248141ba30da25e4d0242d"/><file name="Response.php" hash="231a710147cdbcdde7f82b1c5aca255b"/></dir></dir><dir name="Controller"><file name="Abstract.php" hash="612926a0f65dee33aca9f7f001174cb4"/></dir><dir name="Helper"><file name="Data.php" hash="7765cabdc1ebd4757f4d6ef12aff47d3"/></dir><dir name="Model"><file name="Info.php" hash="a5d4ba9f6c9141695cd488337d92f789"/><file name="Merchant.php" hash="a3936a7f7d6fc493a79103d73e54b06a"/><file name="Merchantnew.php" hash="6e0323385c7406706391c7aea286f649"/><file name="Server.php" hash="95a195a9bf5eeb960bb5c7a96f97f2f0"/><dir name="Source"><file name="Cctype.php" hash="ebe06d3cc1a8ba7276ccd84e7ec1ad91"/><file name="PaymentAction.php" hash="ebd82b8c937493ba1a4ecb59ad8234d3"/><file name="PaymentType.php" hash="35bcd65cea5e229341aeb51b0435770e"/></dir></dir><dir name="controllers"><file name="MerchantController.php" hash="144bb7186e574c4f3303e05558bcd180"/><file name="MerchantnewController.php" hash="ee2c2a1400537e7e790d3ad249333ed6"/><file name="ServerController.php" hash="211d96f35a947d8726ebdd941ca5ac89"/></dir><dir name="etc"><file name="config.xml" hash="f78e0d88870d7e7f56d14e5c17b2afe9"/><file name="system.xml" hash="961ebc4ee806edc9f93542c402d720cf"/></dir><dir name="sql"><dir name="migsvpc_setup"><file name="mysql4-install-0.1.0.php" hash="ef8ea8980f9d100518ddc7e96cef7a11"/></dir></dir></dir></dir></target><target name="mageetc"><dir name="modules"><file name="ND_MigsVpc.xml" hash="21e3a64831d2a6468cac3aa3f5a25d92"/></dir></target><target name="magedesign"><dir name="frontend"><dir name="default"><dir name="default"><dir name="layout"><file name="migsvpc.xml" hash="687447707eadb42a5f346431339278bf"/></dir><dir name="template"><dir name="migsvpc"><file name="form.phtml" hash="416411ec28758fa15de6c4d8ba6b102c"/><file name="info.phtml" hash="c13fe64ae97929b3b732d25b695527ea"/><dir name="merchant"><file name="form.phtml" hash="90aa033b12327f8b4b1e241fa2c77383"/><file name="response.phtml" hash="8a3f5b9be4901568104472399b1b1398"/></dir><dir name="merchantnew"><file name="form.phtml" hash="416411ec28758fa15de6c4d8ba6b102c"/><file name="mark.phtml" hash="0f413e1a1245fda6c493f18ddd9d88d4"/><file name="response.phtml" hash="8a3f5b9be4901568104472399b1b1398"/></dir><dir name="method"><dir name="payment"><dir name="bpay"><file name="form.phtml" hash="4ec688f6b5e63186a91ff2414a567f81"/><file name="info.phtml" hash="7d010d2286e619e4a51de4f086ab71c1"/><file name="success.phtml" hash="55572c890d2fb68ded98b051502c31bd"/></dir><dir name="directdeposit"><file name="form.phtml" hash="ed7e15aa93805a227c00997961f7fb93"/><file name="info.phtml" hash="025c3e3b932f9864b0ccb46a58b6df78"/><file name="success.phtml" hash="d460923ed13b3e27abdebed921689490"/></dir></dir><file name="postcode-checkout.phtml" hash="dba2b90faf906a4ff17c72229600a259"/><file name="postcode.phtml" hash="e7c5e5c23f5c7750772321e1c4ffe06b"/></dir><dir name="server"><file name="form.phtml" hash="009abf5f52c3a8c72462c2ea16bfedad"/><file name="response.phtml" hash="8a3f5b9be4901568104472399b1b1398"/></dir></dir></dir></dir></dir></dir></target></contents>
|
16 |
<compatible/>
|
17 |
+
<dependencies><required><php><min>5.2.0</min><max>6.0.0</max></php></required></dependencies>
|
18 |
</package>
|