Razorpay for WooCommerce - Version 4.3.1

Version Description

  • Fixed, automatic injection of affordability widget code.
  • Added, checkbox to enable affordability widget.
Download this release

Release Info

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

Code changes from version 4.3.0 to 4.3.1

includes/razorpay-affordability-widget.php CHANGED
@@ -295,6 +295,13 @@ function getAffordabilityWidgetSettings()
295
  'desc' => '',
296
  'id' => 'rzp_afd_section_title'
297
  ),
 
 
 
 
 
 
 
298
  'enable_test_mode' => array(
299
  'title' => __('Test Mode Enable/Disable'),
300
  'type' => 'checkbox',
@@ -486,6 +493,10 @@ function getCustomisation($customisation)
486
 
487
  function isAffordabilityWidgetTestModeEnabled()
488
  {
 
 
 
 
489
  return (
490
  empty(get_option('rzp_afd_enable_test_mode')) === false and
491
  get_option('rzp_afd_enable_test_mode') === 'yes'
295
  'desc' => '',
296
  'id' => 'rzp_afd_section_title'
297
  ),
298
+ 'enable' => array(
299
+ 'title' => __('Affordability Widget Enable/Disable'),
300
+ 'type' => 'checkbox',
301
+ 'desc' => __('Enable Affordability Widget?'),
302
+ 'default' => 'no',
303
+ 'id' => 'rzp_afd_enable'
304
+ ),
305
  'enable_test_mode' => array(
306
  'title' => __('Test Mode Enable/Disable'),
307
  'type' => 'checkbox',
493
 
494
  function isAffordabilityWidgetTestModeEnabled()
495
  {
496
+ if(empty(get_option('rzp_afd_enable_test_mode')) === true)
497
+ {
498
+ return true;
499
+ }
500
  return (
501
  empty(get_option('rzp_afd_enable_test_mode')) === false and
502
  get_option('rzp_afd_enable_test_mode') === 'yes'
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: 6.0.1
6
- Stable tag: 4.3.0
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,10 @@ This is compatible with WooCommerce>=2.4, including the new 3.0 release. It has
41
 
42
  == Changelog ==
43
 
 
 
 
 
44
  = 4.3.0 =
45
  * Added affordability widget.
46
  * Bug fix, Order properties cannot be accessed directly.
3
  Tags: razorpay, payments, india, woocommerce, ecommerce
4
  Requires at least: 3.9.2
5
  Tested up to: 6.0.1
6
+ Stable tag: 4.3.1
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
+ = 4.3.1 =
45
+ * Fixed, automatic injection of affordability widget code.
46
+ * Added, checkbox to enable affordability widget.
47
+
48
  = 4.3.0 =
49
  * Added affordability widget.
50
  * Bug fix, Order properties cannot be accessed directly.
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: 4.3.0
7
- * Stable tag: 4.3.0
8
  * Author: Team Razorpay
9
  * WC tested up to: 6.7.0
10
  * Author URI: https://razorpay.com
@@ -352,8 +352,9 @@ function woocommerce_razorpay_init()
352
  }
353
  }
354
  }
355
- catch (Exception $e)
356
  {
 
357
  return;
358
  }
359
  }
@@ -2207,17 +2208,27 @@ EOT;
2207
 
2208
  add_filter('plugin_action_links_' . plugin_basename(__FILE__), 'razorpay_woo_plugin_links');
2209
 
2210
- try
2211
- {
2212
- $api = new Api(get_option('woocommerce_razorpay_settings')['key_id'], get_option('woocommerce_razorpay_settings')['key_secret']);
2213
- $validateKeySecret = $api->request->request('GET', 'accounts/me/features');
2214
- add_action ('woocommerce_before_add_to_cart_form', 'addAffordabilityWidgetHTML');
2215
- }
2216
- catch(Exception $e)
2217
  {
2218
- return;
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
2219
  }
2220
-
2221
  }
2222
 
2223
  // This is set to a priority of 10
3
  * Plugin Name: Razorpay for WooCommerce
4
  * Plugin URI: https://razorpay.com
5
  * Description: Razorpay Payment Gateway Integration for WooCommerce
6
+ * Version: 4.3.1
7
+ * Stable tag: 4.3.1
8
  * Author: Team Razorpay
9
  * WC tested up to: 6.7.0
10
  * Author URI: https://razorpay.com
352
  }
353
  }
354
  }
355
+ catch (\Exception $e)
356
  {
357
+ rzpLogError($e->getMessage());
358
  return;
359
  }
360
  }
2208
 
2209
  add_filter('plugin_action_links_' . plugin_basename(__FILE__), 'razorpay_woo_plugin_links');
2210
 
2211
+ if (empty(get_option('rzp_afd_enable')) === false and
2212
+ get_option('rzp_afd_enable') === 'yes')
 
 
 
 
 
2213
  {
2214
+ try
2215
+ {
2216
+ $api = new Api(get_option('woocommerce_razorpay_settings')['key_id'], get_option('woocommerce_razorpay_settings')['key_secret']);
2217
+ $merchantPreferences = $api->request->request('GET', 'accounts/me/features');
2218
+ foreach ($merchantPreferences['assigned_features'] as $preference)
2219
+ {
2220
+ if ($preference['name'] === 'affordability_widget')
2221
+ {
2222
+ add_action ('woocommerce_before_add_to_cart_form', 'addAffordabilityWidgetHTML');
2223
+ }
2224
+ }
2225
+ }
2226
+ catch(\Exception $e)
2227
+ {
2228
+ rzpLogError($e->getMessage());
2229
+ return;
2230
+ }
2231
  }
 
2232
  }
2233
 
2234
  // This is set to a priority of 10