Instamojo_Imojo - Version 0.1.3

Version Notes

- Added an option to disable phone in admin backend. This will help prevent issues related to phone numbers.
- All configurations can now be done at store level.
- Updated PHP version to 5.6.20

Download this release

Release Info

Developer Instamojo
Extension Instamojo_Imojo
Version 0.1.3
Comparing to
See all releases


Code changes from version 0.1.2 to 0.1.3

app/code/community/Instamojo/Imojo/controllers/PaymentController.php CHANGED
@@ -21,7 +21,7 @@ class Instamojo_Imojo_PaymentController extends Mage_Core_Controller_Front_Actio
21
  $amount = $order-> getBaseGrandTotal();
22
  $email = $order->getCustomerEmail();
23
  $name = $order->getCustomerName();
24
- $phone = $order->getBillingAddress()->getTelephone();
25
  $rmTranid = time();
26
 
27
  $index = strpos($amount, '.');
@@ -37,13 +37,16 @@ class Instamojo_Imojo_PaymentController extends Mage_Core_Controller_Front_Actio
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
 
43
  $data = Array();
44
  $data['data_email'] = substr($email, 0, 75);
45
  $data['data_name'] = substr($name, 0, 20);
46
- $data['data_phone'] = substr($phone, 0, 20);
 
 
47
  $data['data_amount'] = $amount;
48
  $data['data_' . $custom_field] = $rmTranid . "-". $orderId;
49
 
@@ -62,11 +65,18 @@ class Instamojo_Imojo_PaymentController extends Mage_Core_Controller_Front_Actio
62
  $message = implode('|', $data);
63
  $sign = hash_hmac("sha1", $message, $private_salt);
64
  $data['data_sign'] = $sign;
 
65
 
66
  Mage::log("Signature is: $sign", Zend_Log::DEBUG, $this->LOG_FILE_NAME);
67
 
68
- $link= $url . "?embed=form&";
69
- $link .= "data_readonly=data_email&data_readonly=data_amount&data_readonly=data_phone&data_readonly=data_name&data_readonly=data_$custom_field&data_hidden=data_$custom_field";
 
 
 
 
 
 
70
  $link.="&data_amount=$amount&data_name=$name&data_email=$email&data_phone=$phone&data_$custom_field=$custom_field&data_sign=$sign";
71
  $payment = $order->getPayment();
72
  $payment->setTransactionId($rmTranid); // Make it unique.
@@ -84,7 +94,7 @@ class Instamojo_Imojo_PaymentController extends Mage_Core_Controller_Front_Actio
84
  $order->save();
85
 
86
  $block = $this->getLayout()->createBlock('Mage_Core_Block_Template', 'imojo', array('template' => 'imojo/redirect.phtml'))
87
- ->assign(array_merge($data, array('url'=>$url, 'custom_field_name'=>'data_' . $custom_field)));
88
  $this->getLayout()->getBlock('content')->append($block);
89
  $this->renderLayout();
90
  } catch (Exception $e){
@@ -229,4 +239,4 @@ class Instamojo_Imojo_PaymentController extends Mage_Core_Controller_Front_Actio
229
  return $res;
230
  }
231
 
232
- }
21
  $amount = $order-> getBaseGrandTotal();
22
  $email = $order->getCustomerEmail();
23
  $name = $order->getCustomerName();
24
+ $phone = substr(str_replace(' ', '', $order->getBillingAddress()->getTelephone()), 0, 20);
25
  $rmTranid = time();
26
 
27
  $index = strpos($amount, '.');
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
+ $disable_phone = boolval(Mage::getStoreConfig('payment/imojo/disable_phone', $storeId));
41
 
42
+ Mage::log("Data from Backend: $url | $api_key | $auth_token | $private_salt | $custom_field | $disable_phone", Zend_Log::DEBUG, $this->LOG_FILE_NAME);
43
 
44
  $data = Array();
45
  $data['data_email'] = substr($email, 0, 75);
46
  $data['data_name'] = substr($name, 0, 20);
47
+ if(!$disable_phone){
48
+ $data['data_phone'] = $phone;
49
+ }
50
  $data['data_amount'] = $amount;
51
  $data['data_' . $custom_field] = $rmTranid . "-". $orderId;
52
 
65
  $message = implode('|', $data);
66
  $sign = hash_hmac("sha1", $message, $private_salt);
67
  $data['data_sign'] = $sign;
68
+ $data['data_phone'] = $phone;
69
 
70
  Mage::log("Signature is: $sign", Zend_Log::DEBUG, $this->LOG_FILE_NAME);
71
 
72
+ if(!$disable_phone){
73
+ $link = $url . "?embed=form&data_readonly=data_phone&";
74
+ }
75
+ else{
76
+ $link = $url . "?";
77
+ }
78
+
79
+ $link .= "data_readonly=data_email&data_readonly=data_amount&data_readonly=data_name&data_readonly=data_$custom_field&data_hidden=data_$custom_field";
80
  $link.="&data_amount=$amount&data_name=$name&data_email=$email&data_phone=$phone&data_$custom_field=$custom_field&data_sign=$sign";
81
  $payment = $order->getPayment();
82
  $payment->setTransactionId($rmTranid); // Make it unique.
94
  $order->save();
95
 
96
  $block = $this->getLayout()->createBlock('Mage_Core_Block_Template', 'imojo', array('template' => 'imojo/redirect.phtml'))
97
+ ->assign(array_merge($data, array('url'=>$url, 'custom_field_name'=>'data_' . $custom_field, 'disable_phone'=> $disable_phone)));
98
  $this->getLayout()->getBlock('content')->append($block);
99
  $this->renderLayout();
100
  } catch (Exception $e){
239
  return $res;
240
  }
241
 
242
+ }
app/code/community/Instamojo/Imojo/etc/system.xml CHANGED
@@ -13,7 +13,7 @@
13
  <!-- do not show this configuration options in store scope -->
14
  <show_in_default>1</show_in_default>
15
  <show_in_website>1</show_in_website>
16
- <show_in_store>0</show_in_store>
17
  <fields>
18
  <!-- is this payment method active for the website? -->
19
  <active translate="label">
@@ -28,7 +28,7 @@
28
  <!-- do not show this field in store scope -->
29
  <show_in_default>1</show_in_default>
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>
@@ -37,7 +37,7 @@
37
  <sort_order>4</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
  <api_key translate="label">
43
  <label>API Key</label>
@@ -45,7 +45,7 @@
45
  <sort_order>57</sort_order>
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
  </api_key>
50
  <auth_token translate="label">
51
  <label>Auth Token</label>
@@ -53,7 +53,7 @@
53
  <sort_order>58</sort_order>
54
  <show_in_default>1</show_in_default>
55
  <show_in_website>1</show_in_website>
56
- <show_in_store>0</show_in_store>
57
  </auth_token>
58
  <private_salt translate="label">
59
  <label>Private salt</label>
@@ -61,7 +61,7 @@
61
  <sort_order>59</sort_order>
62
  <show_in_default>1</show_in_default>
63
  <show_in_website>1</show_in_website>
64
- <show_in_store>0</show_in_store>
65
  </private_salt>
66
  <payment_url translate="label">
67
  <label>Payment URL</label>
@@ -69,15 +69,26 @@
69
  <sort_order>60</sort_order>
70
  <show_in_default>1</show_in_default>
71
  <show_in_website>1</show_in_website>
72
- <show_in_store>0</show_in_store>
73
  </payment_url>
74
  <custom_field translate="label">
75
  <label>Custom Field</label>
76
  <frontend_type>text</frontend_type>
77
  <sort_order>61</sort_order>
78
  <show_in_default>1</show_in_default>
79
- <show_in_store>0</show_in_store>
80
  </custom_field>
 
 
 
 
 
 
 
 
 
 
 
81
  <payment_action translate="label">
82
  <label>Payment Action</label>
83
  <frontend_type>select</frontend_type>
@@ -85,7 +96,7 @@
85
  <sort_order>2</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
  </payment_action>
90
  </fields>
91
  </imojo>
13
  <!-- do not show this configuration options in store scope -->
14
  <show_in_default>1</show_in_default>
15
  <show_in_website>1</show_in_website>
16
+ <show_in_store>1</show_in_store>
17
  <fields>
18
  <!-- is this payment method active for the website? -->
19
  <active translate="label">
28
  <!-- do not show this field in store scope -->
29
  <show_in_default>1</show_in_default>
30
  <show_in_website>1</show_in_website>
31
+ <show_in_store>1</show_in_store>
32
  </active>
33
  <order_status translate="label">
34
  <label>New order status</label>
37
  <sort_order>4</sort_order>
38
  <show_in_default>1</show_in_default>
39
  <show_in_website>1</show_in_website>
40
+ <show_in_store>1</show_in_store>
41
  </order_status>
42
  <api_key translate="label">
43
  <label>API Key</label>
45
  <sort_order>57</sort_order>
46
  <show_in_default>1</show_in_default>
47
  <show_in_website>1</show_in_website>
48
+ <show_in_store>1</show_in_store>
49
  </api_key>
50
  <auth_token translate="label">
51
  <label>Auth Token</label>
53
  <sort_order>58</sort_order>
54
  <show_in_default>1</show_in_default>
55
  <show_in_website>1</show_in_website>
56
+ <show_in_store>1</show_in_store>
57
  </auth_token>
58
  <private_salt translate="label">
59
  <label>Private salt</label>
61
  <sort_order>59</sort_order>
62
  <show_in_default>1</show_in_default>
63
  <show_in_website>1</show_in_website>
64
+ <show_in_store>1</show_in_store>
65
  </private_salt>
66
  <payment_url translate="label">
67
  <label>Payment URL</label>
69
  <sort_order>60</sort_order>
70
  <show_in_default>1</show_in_default>
71
  <show_in_website>1</show_in_website>
72
+ <show_in_store>1</show_in_store>
73
  </payment_url>
74
  <custom_field translate="label">
75
  <label>Custom Field</label>
76
  <frontend_type>text</frontend_type>
77
  <sort_order>61</sort_order>
78
  <show_in_default>1</show_in_default>
79
+ <show_in_store>1</show_in_store>
80
  </custom_field>
81
+ <disable_phone translate="label">
82
+ <label>Disable Phone</label>
83
+ <comment>If disabled then user will have to enter phone number on Instamojo again. Useful in preventing phone number errors.</comment>
84
+ <frontend_type>select</frontend_type>
85
+ <source_model>adminhtml/system_config_source_yesno</source_model>
86
+ <sort_order>10</sort_order>
87
+ <sort_order>62</sort_order>
88
+ <show_in_default>1</show_in_default>
89
+ <show_in_website>1</show_in_website>
90
+ <show_in_store>1</show_in_store>
91
+ </disable_phone>
92
  <payment_action translate="label">
93
  <label>Payment Action</label>
94
  <frontend_type>select</frontend_type>
96
  <sort_order>2</sort_order>
97
  <show_in_default>1</show_in_default>
98
  <show_in_website>1</show_in_website>
99
+ <show_in_store>1</show_in_store>
100
  </payment_action>
101
  </fields>
102
  </imojo>
app/design/frontend/base/default/template/imojo/redirect.phtml CHANGED
@@ -21,11 +21,19 @@ $custom_field = $$custom_field_name;
21
  <input type="hidden" name="data_amount" value="<?php echo $data_amount;?>">
22
  <input type="hidden" name="data_email" value="<?php echo $data_email;?>">
23
  <input type="hidden" name="data_name" value="<?php echo $data_name;?>">
24
- <input type="hidden" name="data_phone" value="<?php echo $data_phone;?>">
 
 
 
 
25
  <input type="hidden" name="data_readonly" value="data_email">
26
  <input type="hidden" name="data_readonly" value="data_name">
27
  <input type="hidden" name="data_readonly" value="data_amount">
28
- <input type="hidden" name="data_readonly" value="data_phone">
 
 
 
 
29
  <input type="hidden" name="data_readonly" value="<?php echo $custom_field_name;?>">
30
  <input type="hidden" name="data_hidden" value="<?php echo $custom_field_name;?>">
31
  <input type="hidden" name="data_sign" value="<?php echo $data_sign;?>">
21
  <input type="hidden" name="data_amount" value="<?php echo $data_amount;?>">
22
  <input type="hidden" name="data_email" value="<?php echo $data_email;?>">
23
  <input type="hidden" name="data_name" value="<?php echo $data_name;?>">
24
+ <?php
25
+ if(!$disable_phone){
26
+ echo "<input type='hidden' name='data_phone' value='$data_phone'>";
27
+ }
28
+ ?>
29
  <input type="hidden" name="data_readonly" value="data_email">
30
  <input type="hidden" name="data_readonly" value="data_name">
31
  <input type="hidden" name="data_readonly" value="data_amount">
32
+ <?php
33
+ if(!$disable_phone){
34
+ echo '<input type="hidden" name="data_readonly" value="data_phone">';
35
+ }
36
+ ?>
37
  <input type="hidden" name="data_readonly" value="<?php echo $custom_field_name;?>">
38
  <input type="hidden" name="data_hidden" value="<?php echo $custom_field_name;?>">
39
  <input type="hidden" name="data_sign" value="<?php echo $data_sign;?>">
package.xml CHANGED
@@ -1,7 +1,7 @@
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,12 +70,13 @@ This is what we are going to enter in the plugin's settings in Magento backend.&
70
  &lt;br /&gt;&#xD;
71
  &#xD;
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&#xD;
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>
1
  <?xml version="1.0"?>
2
  <package>
3
  <name>Instamojo_Imojo</name>
4
+ <version>0.1.3</version>
5
  <stability>stable</stability>
6
  <license uri="http://opensource.org/licenses/MIT">MIT</license>
7
  <channel>community</channel>
70
  &lt;br /&gt;&#xD;
71
  &#xD;
72
  For detailed steps with screenshots visit our GitHub page: https://github.com/Instamojo/Instamojo-Magento</description>
73
+ <notes>- Added an option to disable phone in admin backend. This will help prevent issues related to phone numbers.&#xD;
74
+ - All configurations can now be done at store level.&#xD;
75
+ - Updated PHP version to 5.6.20</notes>
76
  <authors><author><name>Instamojo</name><user>Instamojo</user><email>dev@instamojo.com</email></author></authors>
77
+ <date>2016-04-06</date>
78
+ <time>08:26:01</time>
79
+ <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="e6483c7d9a32370e62897f0afb4577dc"/></dir><dir name="etc"><file name="config.xml" hash="b829d8aa887ce2461fb050cecbce4099"/><file name="system.xml" hash="cb0e00d7cd4a7d7fb33c58bd79faf0a4"/></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="4e2252a9605cfbc035cc9d809498f333"/><file name="success.phtml" hash="ad5d2318608673f5ba6ea85bd784198f"/></dir></dir></dir></dir></dir></target></contents>
80
  <compatible/>
81
+ <dependencies><required><php><min>5.2.0</min><max>5.6.20</max></php></required></dependencies>
82
  </package>