Version Notes
- Updated PHP version to 5.6.19
- Now preserving cart's content after a failed payment.
Download this release
Release Info
Developer | Instamojo |
Extension | Instamojo_Imojo |
Version | 0.1.2 |
Comparing to | |
See all releases |
Code changes from version 0.1.1 to 0.1.2
app/code/community/Instamojo/Imojo/.DS_Store
ADDED
Binary file
|
app/code/community/Instamojo/Imojo/controllers/PaymentController.php
CHANGED
@@ -28,12 +28,15 @@ class Instamojo_Imojo_PaymentController extends Mage_Core_Controller_Front_Actio
|
|
28 |
if ($index !== False){
|
29 |
$amount = substr($amount, 0, $index+3);
|
30 |
}
|
31 |
-
|
32 |
-
$
|
33 |
-
$
|
34 |
-
$
|
35 |
-
$
|
36 |
-
$
|
|
|
|
|
|
|
37 |
|
38 |
Mage::log("Data from Backend: $url | $api_key | $auth_token | $private_salt | $custom_field", Zend_Log::DEBUG, $this->LOG_FILE_NAME);
|
39 |
|
@@ -97,7 +100,11 @@ class Instamojo_Imojo_PaymentController extends Mage_Core_Controller_Front_Actio
|
|
97 |
|
98 |
Mage::log("Running response action", Zend_Log::DEBUG, $this->LOG_FILE_NAME);
|
99 |
|
100 |
-
$
|
|
|
|
|
|
|
|
|
101 |
$status = $this->getRequest()->getParam('status');
|
102 |
$insta_id = $this->getRequest()->getParam('payment_id');
|
103 |
$this->loadLayout();
|
@@ -117,7 +124,9 @@ class Instamojo_Imojo_PaymentController extends Mage_Core_Controller_Front_Actio
|
|
117 |
|
118 |
// Get order details
|
119 |
$order = Mage::getModel('sales/order');
|
|
|
120 |
$order->loadByIncrementId($orderId);
|
|
|
121 |
|
122 |
if($payment_status === "Credit"){
|
123 |
Mage::log("Payment was successfull for $insta_id", Zend_Log::DEBUG, $this->LOG_FILE_NAME);
|
@@ -144,7 +153,21 @@ class Instamojo_Imojo_PaymentController extends Mage_Core_Controller_Front_Actio
|
|
144 |
}
|
145 |
else if($payment_status === "Failed"){
|
146 |
$order->cancel()->setState(Mage_Sales_Model_Order::STATE_CANCELED, true, 'Payment failed.')->save();
|
147 |
-
$
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
148 |
|
149 |
}
|
150 |
else if($payment_status === "Initiated"){
|
@@ -173,9 +196,13 @@ class Instamojo_Imojo_PaymentController extends Mage_Core_Controller_Front_Actio
|
|
173 |
private function _getcurlInfo($iTransactionId){
|
174 |
try {
|
175 |
|
|
|
|
|
|
|
|
|
176 |
$cUrl = 'https://www.instamojo.com/api/1.1/payments/' . $iTransactionId . '/';
|
177 |
-
$api_key = Mage::getStoreConfig('payment/imojo/api_key');
|
178 |
-
$auth_token = Mage::getStoreConfig('payment/imojo/auth_token');
|
179 |
|
180 |
$ch = curl_init();
|
181 |
curl_setopt($ch, CURLOPT_URL, $cUrl);
|
28 |
if ($index !== False){
|
29 |
$amount = substr($amount, 0, $index+3);
|
30 |
}
|
31 |
+
|
32 |
+
$storeId = Mage::app()->getStore()->getStoreId();
|
33 |
+
$storeCode = Mage::app()->getStore()->getCode();
|
34 |
+
Mage::log("Store ID and Code: $storeId | $storeCode", Zend_Log::DEBUG, $this->LOG_FILE_NAME);
|
35 |
+
$url = Mage::getStoreConfig('payment/imojo/payment_url', $storeId);
|
36 |
+
$api_key = Mage::getStoreConfig('payment/imojo/api_key', $storeId);
|
37 |
+
$auth_token = Mage::getStoreConfig('payment/imojo/auth_token', $storeId);
|
38 |
+
$private_salt = Mage::getStoreConfig('payment/imojo/private_salt', $storeId);
|
39 |
+
$custom_field = Mage::getStoreConfig('payment/imojo/custom_field', $storeId);
|
40 |
|
41 |
Mage::log("Data from Backend: $url | $api_key | $auth_token | $private_salt | $custom_field", Zend_Log::DEBUG, $this->LOG_FILE_NAME);
|
42 |
|
100 |
|
101 |
Mage::log("Running response action", Zend_Log::DEBUG, $this->LOG_FILE_NAME);
|
102 |
|
103 |
+
$storeId = Mage::app()->getStore()->getStoreId();
|
104 |
+
$storeCode = Mage::app()->getStore()->getCode();
|
105 |
+
Mage::log("Store ID and Code: $storeId | $storeCode", Zend_Log::DEBUG, $this->LOG_FILE_NAME);
|
106 |
+
|
107 |
+
$custom_field = Mage::getStoreConfig('payment/imojo/custom_field', $storeId);
|
108 |
$status = $this->getRequest()->getParam('status');
|
109 |
$insta_id = $this->getRequest()->getParam('payment_id');
|
110 |
$this->loadLayout();
|
124 |
|
125 |
// Get order details
|
126 |
$order = Mage::getModel('sales/order');
|
127 |
+
$cart = Mage::getSingleton('checkout/cart');
|
128 |
$order->loadByIncrementId($orderId);
|
129 |
+
$session = Mage::getSingleton('checkout/session');
|
130 |
|
131 |
if($payment_status === "Credit"){
|
132 |
Mage::log("Payment was successfull for $insta_id", Zend_Log::DEBUG, $this->LOG_FILE_NAME);
|
153 |
}
|
154 |
else if($payment_status === "Failed"){
|
155 |
$order->cancel()->setState(Mage_Sales_Model_Order::STATE_CANCELED, true, 'Payment failed.')->save();
|
156 |
+
$items = $order->getItemsCollection();
|
157 |
+
|
158 |
+
foreach ($items as $item) {
|
159 |
+
try {
|
160 |
+
$cart->addOrderItem($item);
|
161 |
+
} catch (Mage_Core_Exception $e) {
|
162 |
+
$session->addError($this->__($e->getMessage()));
|
163 |
+
Mage::logException($e);
|
164 |
+
continue;
|
165 |
+
}
|
166 |
+
}
|
167 |
+
$cart->save();
|
168 |
+
Mage::getSingleton('core/session')->addError('Your payment failed. Please try again later');
|
169 |
+
$this->_redirect('checkout/cart');
|
170 |
+
return;
|
171 |
|
172 |
}
|
173 |
else if($payment_status === "Initiated"){
|
196 |
private function _getcurlInfo($iTransactionId){
|
197 |
try {
|
198 |
|
199 |
+
$storeId = Mage::app()->getStore()->getStoreId();
|
200 |
+
$storeCode = Mage::app()->getStore()->getCode();
|
201 |
+
Mage::log("Store ID and Code: $storeId | $storeCode", Zend_Log::DEBUG, $this->LOG_FILE_NAME);
|
202 |
+
|
203 |
$cUrl = 'https://www.instamojo.com/api/1.1/payments/' . $iTransactionId . '/';
|
204 |
+
$api_key = Mage::getStoreConfig('payment/imojo/api_key', $storeId);
|
205 |
+
$auth_token = Mage::getStoreConfig('payment/imojo/auth_token', $storeId);
|
206 |
|
207 |
$ch = curl_init();
|
208 |
curl_setopt($ch, CURLOPT_URL, $cUrl);
|
package.xml
CHANGED
@@ -1,7 +1,7 @@
|
|
1 |
<?xml version="1.0"?>
|
2 |
<package>
|
3 |
<name>Instamojo_Imojo</name>
|
4 |
-
<version>0.1.
|
5 |
<stability>stable</stability>
|
6 |
<license uri="http://opensource.org/licenses/MIT">MIT</license>
|
7 |
<channel>community</channel>
|
@@ -70,11 +70,12 @@ This is what we are going to enter in the plugin's settings in Magento backend.&
|
|
70 |
<br />
|
71 |

|
72 |
For detailed steps with screenshots visit our GitHub page: https://github.com/Instamojo/Instamojo-Magento</description>
|
73 |
-
<notes>- Updated PHP version to 5.6.
|
|
|
74 |
<authors><author><name>Instamojo</name><user>Instamojo</user><email>dev@instamojo.com</email></author></authors>
|
75 |
-
<date>2016-
|
76 |
-
<time>
|
77 |
-
<contents><target name="magecommunity"><dir name="Instamojo"><dir name="Imojo"><dir name="Helper"><file name="Data.php" hash="e53c6598fa917d8791e046b20d76d221"/></dir><dir name="Model"><file name="PaymentMethod.php" hash="43002098206ee603c86b0b166d359f11"/></dir><dir name="controllers"><file name="PaymentController.php" hash="
|
78 |
<compatible/>
|
79 |
-
<dependencies><required><php><min>5.2.0</min><max>5.6.
|
80 |
</package>
|
1 |
<?xml version="1.0"?>
|
2 |
<package>
|
3 |
<name>Instamojo_Imojo</name>
|
4 |
+
<version>0.1.2</version>
|
5 |
<stability>stable</stability>
|
6 |
<license uri="http://opensource.org/licenses/MIT">MIT</license>
|
7 |
<channel>community</channel>
|
70 |
<br />
|
71 |

|
72 |
For detailed steps with screenshots visit our GitHub page: https://github.com/Instamojo/Instamojo-Magento</description>
|
73 |
+
<notes>- Updated PHP version to 5.6.19
|
74 |
+
- Now preserving cart's content after a failed payment.</notes>
|
75 |
<authors><author><name>Instamojo</name><user>Instamojo</user><email>dev@instamojo.com</email></author></authors>
|
76 |
+
<date>2016-03-22</date>
|
77 |
+
<time>21:43:16</time>
|
78 |
+
<contents><target name="magecommunity"><dir name="Instamojo"><dir name="Imojo"><dir name="Helper"><file name="Data.php" hash="e53c6598fa917d8791e046b20d76d221"/></dir><dir name="Model"><file name="PaymentMethod.php" hash="43002098206ee603c86b0b166d359f11"/></dir><dir name="controllers"><file name="PaymentController.php" hash="83f657a21ac53122436188f5d6f074f9"/></dir><dir name="etc"><file name="config.xml" hash="b829d8aa887ce2461fb050cecbce4099"/><file name="system.xml" hash="428898819cd38b15ab4a222964179e65"/></dir><file name=".DS_Store" hash="822777d708619165d544d3256174adc2"/></dir></dir></target><target name="mageetc"><dir name="modules"><file name="Instamojo_Imojo.xml" hash="9a80f70915e53671e26ea6476fdbe6a4"/></dir></target><target name="magedesign"><dir name="frontend"><dir name="base"><dir name="default"><dir name="template"><dir name="imojo"><file name="deposit_failure.phtml" hash="a01f8d2f503ccaf5d3f6a4682b9caf2b"/><file name="deposit_success.phtml" hash="6952afc4383fbf0eab18ee94e185f329"/><file name="redirect.phtml" hash="3e020d960f533b2e71e68c169bb90f22"/><file name="success.phtml" hash="ad5d2318608673f5ba6ea85bd784198f"/></dir></dir></dir></dir></dir></target></contents>
|
79 |
<compatible/>
|
80 |
+
<dependencies><required><php><min>5.2.0</min><max>5.6.19</max></php></required></dependencies>
|
81 |
</package>
|