Razorpay for WooCommerce - Version 3.9.0

Version Description

  • Added Cart line item for magic checkout.
  • Bug fix in COD min/max amount restriction for magic checkout.
  • Reduced the auto enable webhook verification time to 12 hours.
Download this release

Release Info

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

Code changes from version 3.8.3 to 3.9.0

Files changed (3) hide show
  1. includes/api/shipping-info.php +1 -1
  2. readme.txt +6 -1
  3. woo-razorpay.php +27 -3
includes/api/shipping-info.php CHANGED
@@ -281,7 +281,7 @@ function getCodShippingInfo1cc($instanceId, $methodId, $orderId, $address)
281
  $minCODAmount1cc = !empty(get_option('woocommerce_razorpay_settings')['1cc_min_COD_slab_amount']) ? get_option('woocommerce_razorpay_settings')['1cc_min_COD_slab_amount'] : 0;
282
  $maxCODAmount1cc = !empty(get_option('woocommerce_razorpay_settings')['1cc_max_COD_slab_amount']) ? get_option('woocommerce_razorpay_settings')['1cc_max_COD_slab_amount'] : 0;
283
 
284
- if (!isset($availablePaymentMethods['cod']) || 'no' == $availablePaymentMethods['cod']->enabled || !(($minCODAmount1cc <= $amount) && ($maxCODAmount1cc <= $amount))) {
285
  return false;
286
  }
287
 
281
  $minCODAmount1cc = !empty(get_option('woocommerce_razorpay_settings')['1cc_min_COD_slab_amount']) ? get_option('woocommerce_razorpay_settings')['1cc_min_COD_slab_amount'] : 0;
282
  $maxCODAmount1cc = !empty(get_option('woocommerce_razorpay_settings')['1cc_max_COD_slab_amount']) ? get_option('woocommerce_razorpay_settings')['1cc_max_COD_slab_amount'] : 0;
283
 
284
+ if (!isset($availablePaymentMethods['cod']) || 'no' == $availablePaymentMethods['cod']->enabled ) {
285
  return false;
286
  }
287
 
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.8.3
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,11 @@ This is compatible with WooCommerce>=2.4, including the new 3.0 release. It has
41
 
42
  == Changelog ==
43
 
 
 
 
 
 
44
  = 3.8.3 =
45
  * Bug fix for UTM data for pixel your site plugin for magic checkout.
46
 
3
  Tags: razorpay, payments, india, woocommerce, ecommerce
4
  Requires at least: 3.9.2
5
  Tested up to: 5.9
6
+ Stable tag: 3.9.0
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.9.0 =
45
+ * Added Cart line item for magic checkout.
46
+ * Bug fix in COD min/max amount restriction for magic checkout.
47
+ * Reduced the auto enable webhook verification time to 12 hours.
48
+
49
  = 3.8.3 =
50
  * Bug fix for UTM data for pixel your site plugin for magic checkout.
51
 
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.8.3
7
- * Stable tag: 3.8.3
8
  * Author: Team Razorpay
9
  * WC tested up to: 6.4.1
10
  * Author URI: https://razorpay.com
@@ -757,7 +757,7 @@ function woocommerce_razorpay_init()
757
 
758
  if (empty($getWebhookFlag) == false)
759
  {
760
- if ($getWebhookFlag + 86400 < time())
761
  {
762
  $this->autoEnableWebhook();
763
  }
@@ -873,6 +873,30 @@ function woocommerce_razorpay_init()
873
  // TODO: trim to 2 deciamls
874
  $data['line_items_total'] = $order->get_total()*100;
875
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
876
  return $data;
877
  }
878
 
3
  * Plugin Name: Razorpay for WooCommerce
4
  * Plugin URI: https://razorpay.com
5
  * Description: Razorpay Payment Gateway Integration for WooCommerce
6
+ * Version: 3.9.0
7
+ * Stable tag: 3.9.0
8
  * Author: Team Razorpay
9
  * WC tested up to: 6.4.1
10
  * Author URI: https://razorpay.com
757
 
758
  if (empty($getWebhookFlag) == false)
759
  {
760
+ if ($getWebhookFlag + 43200 < time())
761
  {
762
  $this->autoEnableWebhook();
763
  }
873
  // TODO: trim to 2 deciamls
874
  $data['line_items_total'] = $order->get_total()*100;
875
 
876
+ $i = 0;
877
+ // Get and Loop Over Order Items
878
+ foreach ( $order->get_items() as $item_id => $item )
879
+ {
880
+ $product = $item->get_product();
881
+ $productDetails = $product->get_data();
882
+
883
+ $data['line_items'][$i]['type'] = "e-commerce";
884
+ $data['line_items'][$i]['sku'] = $product->get_sku();
885
+ $data['line_items'][$i]['variant_id'] = $item->get_variation_id();
886
+ $data['line_items'][$i]['price'] = (empty($productDetails['price'])=== false) ? round(wc_get_price_excluding_tax($product)*100) + round($item->get_subtotal_tax()*100 / $item->get_quantity()) : 0;
887
+ $data['line_items'][$i]['offer_price'] = (empty($productDetails['sale_price'])=== false) ? (int) $productDetails['sale_price']*100 : $productDetails['price']*100;
888
+ $data['line_items'][$i]['tax_amount'] = (int)$item->get_subtotal_tax()*100;
889
+ $data['line_items'][$i]['quantity'] = $item->get_quantity();
890
+ $data['line_items'][$i]['name'] = $item->get_name();
891
+ $data['line_items'][$i]['description'] = $item->get_name();
892
+ $data['line_items'][$i]['weight'] = $productDetails['weight'];
893
+ $productImage = $product->get_image_id()?? null;
894
+ $data['line_items'][$i]['image_url'] = $productImage? wp_get_attachment_url( $productImage ) : null;
895
+ $data['line_items'][$i]['product_url'] = $product->get_permalink();
896
+
897
+ $i++;
898
+ }
899
+
900
  return $data;
901
  }
902