Razorpay for WooCommerce - Version 1.6.3

Version Description

  • Allows for null values in displayAmount
  • Better support for international currency conversion
  • Support for custom order success message
Download this release

Release Info

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

Code changes from version 1.6.2 to 1.6.3

Files changed (3) hide show
  1. .editorconfig +13 -0
  2. razorpay-payments.php +35 -20
  3. readme.txt +6 -1
.editorconfig ADDED
@@ -0,0 +1,13 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ ; This file is for unifying the coding style for different editors and IDEs.
2
+ ; More information at http://EditorConfig.org
3
+
4
+ root = true
5
+ ; Use 2 spaces for indentation in all files
6
+
7
+ [*.php]
8
+ end_of_line = lf
9
+ charset = utf-8
10
+ trim_trailing_whitespace = true
11
+ indent_style = space
12
+ indent_size = 4
13
+ insert_final_newline = true
razorpay-payments.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: 1.6.2
7
- * Stable tag: 1.6.2
8
  * Author: Team Razorpay
9
  * WC tested up to: 3.2.1
10
  * Author URI: https://razorpay.com
@@ -48,6 +48,7 @@ function woocommerce_razorpay_init()
48
 
49
  const DEFAULT_LABEL = 'Credit Card/Debit Card/NetBanking';
50
  const DEFAULT_DESCRIPTION = 'Pay securely by Credit or Debit card or Internet Banking through Razorpay.';
 
51
 
52
  protected $visibleSettings = array(
53
  'enabled',
@@ -56,6 +57,7 @@ function woocommerce_razorpay_init()
56
  'key_id',
57
  'key_secret',
58
  'payment_action',
 
59
  'enable_webhook',
60
  'webhook_secret',
61
  );
@@ -110,6 +112,16 @@ function woocommerce_razorpay_init()
110
  return $this->settings[$key];
111
  }
112
 
 
 
 
 
 
 
 
 
 
 
113
  /**
114
  * @param boolean $hooks Whether or not to
115
  * setup the hooks on
@@ -195,6 +207,12 @@ function woocommerce_razorpay_init()
195
  self::CAPTURE => 'Authorize and Capture'
196
  )
197
  ),
 
 
 
 
 
 
198
  'enable_webhook' => array(
199
  'title' => __('Enable Webhook', $this->id),
200
  'type' => 'checkbox',
@@ -384,7 +402,7 @@ function woocommerce_razorpay_init()
384
  {
385
  $callbackUrl = $this->getRedirectUrl();
386
 
387
- $orderId = $this->getOrderId($order);
388
 
389
  $productinfo = "Order $orderId";
390
 
@@ -436,8 +454,15 @@ function woocommerce_razorpay_init()
436
 
437
  if ($currency !== self::INR)
438
  {
439
- $args['display_currency'] = $currency;
440
- $args['display_amount'] = $this->getDisplayAmount($order);
 
 
 
 
 
 
 
441
  }
442
 
443
  $args = array_merge($args, $params);
@@ -666,17 +691,7 @@ EOT;
666
 
667
  return $order->order_key;
668
  }
669
-
670
- protected function getOrderId($order)
671
- {
672
- if (version_compare(WOOCOMMERCE_VERSION, '2.7.0', '>='))
673
- {
674
- return $order->get_id();
675
- }
676
-
677
- return $order->id;
678
- }
679
-
680
  public function process_refund($orderId, $amount = null, $reason = '')
681
  {
682
  $order = new WC_Order($orderId);
@@ -868,11 +883,11 @@ EOT;
868
  {
869
  global $woocommerce;
870
 
871
- $orderId = $this->getOrderId($order);
872
 
873
- if ($success === true)
874
  {
875
- $this->msg['message'] = "Thank you for shopping with us. Your account has been charged and your transaction is successful. We will be processing your order soon. Order Id: $orderId";
876
  $this->msg['class'] = 'success';
877
 
878
  $order->payment_complete($razorpayPaymentId);
@@ -906,7 +921,7 @@ EOT;
906
 
907
  protected function handleErrorCase(& $order)
908
  {
909
- $orderId = $this->getOrderId($order);
910
 
911
  $this->msg['class'] = 'error';
912
  $this->msg['message'] = $this->getErrorMessage($orderId);
3
  * Plugin Name: Razorpay for WooCommerce
4
  * Plugin URI: https://razorpay.com
5
  * Description: Razorpay Payment Gateway Integration for WooCommerce
6
+ * Version: 1.6.3
7
+ * Stable tag: 1.6.3
8
  * Author: Team Razorpay
9
  * WC tested up to: 3.2.1
10
  * Author URI: https://razorpay.com
48
 
49
  const DEFAULT_LABEL = 'Credit Card/Debit Card/NetBanking';
50
  const DEFAULT_DESCRIPTION = 'Pay securely by Credit or Debit card or Internet Banking through Razorpay.';
51
+ const DEFAULT_SUCCESS_MESSAGE = 'Thank you for shopping with us. Your account has been charged and your transaction is successful. We will be processing your order soon.';
52
 
53
  protected $visibleSettings = array(
54
  'enabled',
57
  'key_id',
58
  'key_secret',
59
  'payment_action',
60
+ 'order_success_message',
61
  'enable_webhook',
62
  'webhook_secret',
63
  );
112
  return $this->settings[$key];
113
  }
114
 
115
+ protected function getCustomOrdercreationMessage()
116
+ {
117
+ $message = $this->getSetting('order_success_message');
118
+ if (isset($message) === false)
119
+ {
120
+ $message = STATIC::DEFAULT_SUCCESS_MESSAGE;
121
+ }
122
+ return $message;
123
+ }
124
+
125
  /**
126
  * @param boolean $hooks Whether or not to
127
  * setup the hooks on
207
  self::CAPTURE => 'Authorize and Capture'
208
  )
209
  ),
210
+ 'order_success_message' => array(
211
+ 'title' => __('Order Completion Message', $this->id),
212
+ 'type' => 'textarea',
213
+ 'description' => __('Message to be displayed after a successful order', $this->id),
214
+ 'default' => __(STATIC::DEFAULT_SUCCESS_MESSAGE, $this->id),
215
+ ),
216
  'enable_webhook' => array(
217
  'title' => __('Enable Webhook', $this->id),
218
  'type' => 'checkbox',
402
  {
403
  $callbackUrl = $this->getRedirectUrl();
404
 
405
+ $orderId = $order->get_order_number();
406
 
407
  $productinfo = "Order $orderId";
408
 
454
 
455
  if ($currency !== self::INR)
456
  {
457
+ // A null is passed if displayAmount is to remain unset
458
+ $displayAmount = $this->getDisplayAmount($order);
459
+
460
+ if ($displayAmount)
461
+ {
462
+ $args['display_currency'] = $currency;
463
+ $args['display_amount'] = $displayAmount;
464
+ }
465
+
466
  }
467
 
468
  $args = array_merge($args, $params);
691
 
692
  return $order->order_key;
693
  }
694
+
 
 
 
 
 
 
 
 
 
 
695
  public function process_refund($orderId, $amount = null, $reason = '')
696
  {
697
  $order = new WC_Order($orderId);
883
  {
884
  global $woocommerce;
885
 
886
+ $orderId = $order->get_order_number();
887
 
888
+ if (($success === true) and ($order->needs_payment() === true))
889
  {
890
+ $this->msg['message'] = $this->getCustomOrdercreationMessage() . "  Order Id: $orderId";
891
  $this->msg['class'] = 'success';
892
 
893
  $order->payment_complete($razorpayPaymentId);
921
 
922
  protected function handleErrorCase(& $order)
923
  {
924
+ $orderId = $order->get_order_number();
925
 
926
  $this->msg['class'] = 'error';
927
  $this->msg['message'] = $this->getErrorMessage($orderId);
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: 4.8
6
- Stable tag: 1.6.2
7
  License: GPLv2 or later
8
  License URI: http://www.gnu.org/licenses/gpl-2.0.html
9
 
@@ -36,6 +36,11 @@ This is compatible with WooCommerce>=2.4, including the new 3.0 release. It has
36
 
37
  == Changelog ==
38
 
 
 
 
 
 
39
  = 1.6.2 =
40
  * Fixes webhook capture flow by re-fetching payment and checking for status
41
 
3
  Tags: razorpay, payments, india, woocommerce, ecommerce
4
  Requires at least: 3.9.2
5
  Tested up to: 4.8
6
+ Stable tag: 1.6.3
7
  License: GPLv2 or later
8
  License URI: http://www.gnu.org/licenses/gpl-2.0.html
9
 
36
 
37
  == Changelog ==
38
 
39
+ = 1.6.3 =
40
+ * Allows for null values in displayAmount
41
+ * Better support for international currency conversion
42
+ * Support for custom order success message
43
+
44
  = 1.6.2 =
45
  * Fixes webhook capture flow by re-fetching payment and checking for status
46