Razorpay for WooCommerce - Version 3.2.2

Version Description

  • Bug fix in admin config page for magic checkout
Download this release

Release Info

Developer razorpay
Plugin Icon 128x128 Razorpay for WooCommerce
Version 3.2.2
Comparing to
See all releases

Code changes from version 3.2.1 to 3.2.2

Files changed (2) hide show
  1. readme.txt +4 -1
  2. woo-razorpay.php +16 -22
readme.txt CHANGED
@@ -3,7 +3,7 @@ Contributors: razorpay
3
  Tags: razorpay, payments, india, woocommerce, ecommerce
4
  Requires at least: 3.9.2
5
  Tested up to: 5.9
6
- Stable tag: 3.2.1
7
  Requires PHP: 5.6
8
  License: GPLv2 or later
9
  License URI: http://www.gnu.org/licenses/gpl-2.0.html
@@ -41,6 +41,9 @@ This is compatible with WooCommerce>=2.4, including the new 3.0 release. It has
41
 
42
  == Changelog ==
43
 
 
 
 
44
  = 3.2.1 =
45
  * Fix the latency issue.
46
  * Bug fix in coupon fetch API.
3
  Tags: razorpay, payments, india, woocommerce, ecommerce
4
  Requires at least: 3.9.2
5
  Tested up to: 5.9
6
+ Stable tag: 3.2.2
7
  Requires PHP: 5.6
8
  License: GPLv2 or later
9
  License URI: http://www.gnu.org/licenses/gpl-2.0.html
41
 
42
  == Changelog ==
43
 
44
+ = 3.2.2 =
45
+ * Bug fix in admin config page for magic checkout
46
+
47
  = 3.2.1 =
48
  * Fix the latency issue.
49
  * Bug fix in coupon fetch API.
woo-razorpay.php CHANGED
@@ -3,8 +3,8 @@
3
  * Plugin Name: Razorpay for WooCommerce
4
  * Plugin URI: https://razorpay.com
5
  * Description: Razorpay Payment Gateway Integration for WooCommerce
6
- * Version: 3.2.1
7
- * Stable tag: 3.2.1
8
  * Author: Team Razorpay
9
  * WC tested up to: 6.2.2
10
  * Author URI: https://razorpay.com
@@ -148,31 +148,25 @@ function woocommerce_razorpay_init()
148
  $this->icon = "https://cdn.razorpay.com/static/assets/logo/payment.svg";
149
  // 1cc flags should be enabled only if merchant has access to 1cc feature
150
  $is1ccAvailable = false;
151
-
152
- // Check whether the get_current_screen function exists because it is loaded only after 'admin_init' hook.
153
- if (function_exists('get_current_screen'))
154
  {
155
- $current_screen = get_current_screen();
156
-
157
- // Load preference API call only in woocommerce admin settings page.
158
- if ($current_screen->id == 'woocommerce_page_wc-settings')
159
  {
160
- if (!empty($this->getSetting('key_id')) && !empty($this->getSetting('key_secret')))
161
- {
162
- try {
163
 
164
- $api = $this->getRazorpayApiInstance();
165
- $merchantPreferences = $api->request->request('GET', 'merchant/1cc_preferences');
166
 
167
- if (!empty($merchantPreferences['features']['one_click_checkout'])) {
168
- $is1ccAvailable = true;
169
- }
170
-
171
- } catch (\Exception $e) {
172
- rzpLogError($e->getMessage());
173
- }
174
 
 
 
175
  }
 
176
  }
177
  }
178
 
@@ -1268,7 +1262,7 @@ EOT;
1268
  {
1269
  $message = 'An error occured while processing this payment';
1270
  }
1271
- if (isset($_POST['error']) === true)
1272
  {
1273
  $error = $_POST['error'];
1274
 
3
  * Plugin Name: Razorpay for WooCommerce
4
  * Plugin URI: https://razorpay.com
5
  * Description: Razorpay Payment Gateway Integration for WooCommerce
6
+ * Version: 3.2.2
7
+ * Stable tag: 3.2.2
8
  * Author: Team Razorpay
9
  * WC tested up to: 6.2.2
10
  * Author URI: https://razorpay.com
148
  $this->icon = "https://cdn.razorpay.com/static/assets/logo/payment.svg";
149
  // 1cc flags should be enabled only if merchant has access to 1cc feature
150
  $is1ccAvailable = false;
151
+
152
+ // Load preference API call only for administrative interface page.
153
+ if (is_admin())
154
  {
155
+ if (!empty($this->getSetting('key_id')) && !empty($this->getSetting('key_secret')))
 
 
 
156
  {
157
+ try {
 
 
158
 
159
+ $api = $this->getRazorpayApiInstance();
160
+ $merchantPreferences = $api->request->request('GET', 'merchant/1cc_preferences');
161
 
162
+ if (!empty($merchantPreferences['features']['one_click_checkout'])) {
163
+ $is1ccAvailable = true;
164
+ }
 
 
 
 
165
 
166
+ } catch (\Exception $e) {
167
+ rzpLogError($e->getMessage());
168
  }
169
+
170
  }
171
  }
172
 
1262
  {
1263
  $message = 'An error occured while processing this payment';
1264
  }
1265
+ if (isset($_POST['error']) === true && is_array($_POST['error']))
1266
  {
1267
  $error = $_POST['error'];
1268