Razorpay for WooCommerce - Version 3.9.2

Version Description

  • Bug fix cart line item char limit issue for magic checkout.
  • Bug fix callback issue in order placed through admin panel.
Download this release

Release Info

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

Code changes from version 3.9.1 to 3.9.2

Files changed (2) hide show
  1. readme.txt +5 -1
  2. woo-razorpay.php +16 -13
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.9.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,10 @@ This is compatible with WooCommerce>=2.4, including the new 3.0 release. It has
41
 
42
  == Changelog ==
43
 
 
 
 
 
44
  = 3.9.1 =
45
  * Bug fix cart line item int issue 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.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.9.2 =
45
+ * Bug fix cart line item char limit issue for magic checkout.
46
+ * Bug fix callback issue in order placed through admin panel.
47
+
48
  = 3.9.1 =
49
  * Bug fix cart line item int issue for magic checkout.
50
 
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.9.1
7
- * Stable tag: 3.9.1
8
  * Author: Team Razorpay
9
  * WC tested up to: 6.4.1
10
  * Author URI: https://razorpay.com
@@ -885,11 +885,9 @@ function woocommerce_razorpay_init()
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'] = 0; // Quick fix to handle the int issue from BE
889
  $data['line_items'][$i]['quantity'] = (int)$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'] = 0; // Quick fix to handle the int issue from BE
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();
@@ -1123,15 +1121,20 @@ EOT;
1123
 
1124
  rzpLogInfo("Called check_razorpay_response: $post_password");
1125
 
1126
- $postData = $wpdb->get_results( $wpdb->prepare("SELECT ID, post_status FROM $wpdb->posts AS P WHERE post_type=%s AND post_password = %s", $post_type, $post_password ) );
1127
-
1128
- $arrayPost = json_decode(json_encode($postData), true);
1129
-
1130
- if (!empty($arrayPost) && count($arrayPost[0]) > 0)
 
 
 
 
 
1131
  {
1132
- $orderId = $postData[0]->ID;
1133
 
1134
- if($postData[0]->post_status == 'draft')
1135
  {
1136
  updateOrderStatus($orderId, 'wc-pending');
1137
  }
3
  * Plugin Name: Razorpay for WooCommerce
4
  * Plugin URI: https://razorpay.com
5
  * Description: Razorpay Payment Gateway Integration for WooCommerce
6
+ * Version: 3.9.2
7
+ * Stable tag: 3.9.2
8
  * Author: Team Razorpay
9
  * WC tested up to: 6.4.1
10
  * Author URI: https://razorpay.com
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]['quantity'] = (int)$item->get_quantity();
889
+ $data['line_items'][$i]['name'] = substr($item->get_name(), 0, 125);
890
+ $data['line_items'][$i]['description'] = substr($item->get_name(), 0, 250);
 
891
  $productImage = $product->get_image_id()?? null;
892
  $data['line_items'][$i]['image_url'] = $productImage? wp_get_attachment_url( $productImage ) : null;
893
  $data['line_items'][$i]['product_url'] = $product->get_permalink();
1121
 
1122
  rzpLogInfo("Called check_razorpay_response: $post_password");
1123
 
1124
+ $meta_key = '_order_key';
1125
+
1126
+ $postMetaData = $wpdb->get_row( $wpdb->prepare("SELECT post_id FROM $wpdb->postmeta AS P WHERE meta_key = %s AND meta_value = %s", $meta_key, $post_password ) );
1127
+
1128
+ $postData = $wpdb->get_row( $wpdb->prepare("SELECT post_status FROM $wpdb->posts AS P WHERE post_type=%s and ID=%s", $post_type, $postMetaData->post_id) );
1129
+
1130
+ $arrayPost = json_decode(json_encode($postMetaData), true);
1131
+
1132
+ if (!empty($arrayPost) and
1133
+ $arrayPost != null)
1134
  {
1135
+ $orderId = $postMetaData->post_id;
1136
 
1137
+ if ($postData->post_status === 'draft')
1138
  {
1139
  updateOrderStatus($orderId, 'wc-pending');
1140
  }