Razorpay for WooCommerce - Version 2.3.1

Version Description

  • Bug fix for hosted checkout.
  • Tested upto WordPress 5.2.4 and WooCommerce 3.7.1
Download this release

Release Info

Developer ramprak
Plugin Icon 128x128 Razorpay for WooCommerce
Version 2.3.1
Comparing to
See all releases

Code changes from version 2.3.0 to 2.3.1

Files changed (2) hide show
  1. readme.txt +7 -2
  2. woo-razorpay.php +22 -6
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.2.4
6
- Stable tag: 2.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,8 +41,13 @@ This is compatible with WooCommerce>=2.4, including the new 3.0 release. It has
41
 
42
  == Changelog ==
43
 
 
 
 
 
 
44
  = 2.3.0 =
45
- * Support for HDFC VAS merchant with hosted checkout.
46
  * Tested upto WordPress 5.2.4 and WooCommerce 3.7.1
47
 
48
 
3
  Tags: razorpay, payments, india, woocommerce, ecommerce
4
  Requires at least: 3.9.2
5
  Tested up to: 5.2.4
6
+ Stable tag: 2.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
+ = 2.3.1 =
45
+ * Bug fix for hosted checkout.
46
+ * Tested upto WordPress 5.2.4 and WooCommerce 3.7.1
47
+
48
+
49
  = 2.3.0 =
50
+ * Support for hosted checkout.
51
  * Tested upto WordPress 5.2.4 and WooCommerce 3.7.1
52
 
53
 
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: 2.3.0
7
- * Stable tag: 2.3.0
8
  * Author: Team Razorpay
9
  * WC tested up to: 3.7.1
10
  * Author URI: https://razorpay.com
@@ -39,6 +39,7 @@ function woocommerce_razorpay_init()
39
  const RAZORPAY_PAYMENT_ID = 'razorpay_payment_id';
40
  const RAZORPAY_ORDER_ID = 'razorpay_order_id';
41
  const RAZORPAY_SIGNATURE = 'razorpay_signature';
 
42
 
43
  const INR = 'INR';
44
  const CAPTURE = 'capture';
@@ -610,7 +611,7 @@ function woocommerce_razorpay_init()
610
  <input type="hidden" name="description" value="'.$data['description'].'">
611
  <input type="hidden" name="image" value="'.$data['preference']['image'].'">
612
  <input type="hidden" name="callback_url" value="'.$data['callback_url'].'">
613
- <input type="hidden" name="cancel_url" value="'.$data['callback_url'].'">
614
  '. $formFields .'
615
  </form>';
616
 
@@ -623,6 +624,7 @@ function woocommerce_razorpay_init()
623
  function generateOrderForm($data)
624
  {
625
  $redirectUrl = $this->getRedirectUrl();
 
626
 
627
  $api = new Api($this->getSetting('key_id'),"");
628
 
@@ -790,9 +792,23 @@ EOT;
790
  }
791
  else
792
  {
793
- $success = false;
794
- $error = 'Customer cancelled the payment';
795
- $this->handleErrorCase($order);
 
 
 
 
 
 
 
 
 
 
 
 
 
 
796
  }
797
 
798
  $this->updateOrder($order, $success, $error, $razorpayPaymentId);
3
  * Plugin Name: Razorpay for WooCommerce
4
  * Plugin URI: https://razorpay.com
5
  * Description: Razorpay Payment Gateway Integration for WooCommerce
6
+ * Version: 2.3.1
7
+ * Stable tag: 2.3.1
8
  * Author: Team Razorpay
9
  * WC tested up to: 3.7.1
10
  * Author URI: https://razorpay.com
39
  const RAZORPAY_PAYMENT_ID = 'razorpay_payment_id';
40
  const RAZORPAY_ORDER_ID = 'razorpay_order_id';
41
  const RAZORPAY_SIGNATURE = 'razorpay_signature';
42
+ const RAZORPAY_WC_FORM_SUBMIT = 'razorpay_wc_form_submit';
43
 
44
  const INR = 'INR';
45
  const CAPTURE = 'capture';
611
  <input type="hidden" name="description" value="'.$data['description'].'">
612
  <input type="hidden" name="image" value="'.$data['preference']['image'].'">
613
  <input type="hidden" name="callback_url" value="'.$data['callback_url'].'">
614
+ <input type="hidden" name="cancel_url" value="'.$data['cancel_url'].'">
615
  '. $formFields .'
616
  </form>';
617
 
624
  function generateOrderForm($data)
625
  {
626
  $redirectUrl = $this->getRedirectUrl();
627
+ $data['cancel_url'] = wc_get_checkout_url();
628
 
629
  $api = new Api($this->getSetting('key_id'),"");
630
 
792
  }
793
  else
794
  {
795
+ if($_POST[self::RAZORPAY_WC_FORM_SUBMIT] ==1)
796
+ {
797
+ $success = false;
798
+ $error = 'Customer cancelled the payment';
799
+ $this->handleErrorCase($order);
800
+
801
+ }
802
+ else
803
+ {
804
+ $success = false;
805
+ $error = "Payment Failed.";
806
+
807
+ $this->updateOrder($order, $success, $error, $razorpayPaymentId);
808
+
809
+ wp_redirect(wc_get_checkout_url());
810
+ exit;
811
+ }
812
  }
813
 
814
  $this->updateOrder($order, $success, $error, $razorpayPaymentId);