Version Description
- Bug fix for partial refund shown twice.
- Bug fix for wc-api redirection after payment completed
- Tested upto WordPress 5.4.1 and WooCommerce 4.1.1
Download this release
Release Info
Developer | razorpay |
Plugin | Razorpay for WooCommerce |
Version | 2.4.2 |
Comparing to | |
See all releases |
Code changes from version 2.4.1 to 2.4.2
- includes/razorpay-webhook.php +15 -4
- readme.txt +7 -2
- woo-razorpay.php +18 -10
includes/razorpay-webhook.php
CHANGED
@@ -271,8 +271,16 @@ class RZP_Webhook
|
|
271 |
return;
|
272 |
}
|
273 |
|
|
|
|
|
|
|
|
|
|
|
|
|
274 |
$razorpayPaymentId = $data['payload']['refund']['entity']['payment_id'];
|
275 |
|
|
|
|
|
276 |
$payment = $this->getPaymentEntity($razorpayPaymentId, $data);
|
277 |
|
278 |
//
|
@@ -307,20 +315,23 @@ class RZP_Webhook
|
|
307 |
error_log(json_encode($log));
|
308 |
}
|
309 |
|
310 |
-
$
|
311 |
|
312 |
-
$
|
313 |
|
314 |
try
|
315 |
{
|
316 |
wc_create_refund( array(
|
317 |
-
'amount' => $
|
318 |
-
'reason' => $
|
319 |
'order_id' => $orderId,
|
|
|
320 |
'line_items' => array(),
|
321 |
'refund_payment' => false
|
322 |
));
|
323 |
|
|
|
|
|
324 |
}
|
325 |
catch (Exception $e)
|
326 |
{
|
271 |
return;
|
272 |
}
|
273 |
|
274 |
+
//Avoid to recreate refund, If already refund saved and initiated from woocommerce website.
|
275 |
+
if (isset($data['payload']['refund']['entity']['notes']['refund_from_website']) === true)
|
276 |
+
{
|
277 |
+
return;
|
278 |
+
}
|
279 |
+
|
280 |
$razorpayPaymentId = $data['payload']['refund']['entity']['payment_id'];
|
281 |
|
282 |
+
$refundId = $data['payload']['refund']['entity']['id'];
|
283 |
+
|
284 |
$payment = $this->getPaymentEntity($razorpayPaymentId, $data);
|
285 |
|
286 |
//
|
315 |
error_log(json_encode($log));
|
316 |
}
|
317 |
|
318 |
+
$refundAmount = round(($data['payload']['refund']['entity']['amount'] / 100), 2);
|
319 |
|
320 |
+
$refundReason = $data['payload']['refund']['entity']['notes']['comment'];
|
321 |
|
322 |
try
|
323 |
{
|
324 |
wc_create_refund( array(
|
325 |
+
'amount' => $refundAmount,
|
326 |
+
'reason' => $refundReason,
|
327 |
'order_id' => $orderId,
|
328 |
+
'refund_id' => $refundId,
|
329 |
'line_items' => array(),
|
330 |
'refund_payment' => false
|
331 |
));
|
332 |
|
333 |
+
$order->add_order_note( __( 'Refund Id: ' . $refundId, 'woocommerce' ) );
|
334 |
+
|
335 |
}
|
336 |
catch (Exception $e)
|
337 |
{
|
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.4
|
6 |
-
Stable tag: 2.4.
|
7 |
Requires PHP: 5.6
|
8 |
License: GPLv2 or later
|
9 |
License URI: http://www.gnu.org/licenses/gpl-2.0.html
|
@@ -24,7 +24,7 @@ This is compatible with WooCommerce>=2.4, including the new 3.0 release. It has
|
|
24 |
== Dependencies ==
|
25 |
|
26 |
1. Wordpress v3.9.2 and later
|
27 |
-
2. Woocommerce v2.
|
28 |
3. PHP v5.6.0 and later
|
29 |
4. php-curl extension
|
30 |
|
@@ -41,6 +41,11 @@ This is compatible with WooCommerce>=2.4, including the new 3.0 release. It has
|
|
41 |
|
42 |
== Changelog ==
|
43 |
|
|
|
|
|
|
|
|
|
|
|
44 |
= 2.4.1 =
|
45 |
* Updated WordPress support version info
|
46 |
|
3 |
Tags: razorpay, payments, india, woocommerce, ecommerce
|
4 |
Requires at least: 3.9.2
|
5 |
Tested up to: 5.4
|
6 |
+
Stable tag: 2.4.2
|
7 |
Requires PHP: 5.6
|
8 |
License: GPLv2 or later
|
9 |
License URI: http://www.gnu.org/licenses/gpl-2.0.html
|
24 |
== Dependencies ==
|
25 |
|
26 |
1. Wordpress v3.9.2 and later
|
27 |
+
2. Woocommerce v2.6 and later
|
28 |
3. PHP v5.6.0 and later
|
29 |
4. php-curl extension
|
30 |
|
41 |
|
42 |
== Changelog ==
|
43 |
|
44 |
+
= 2.4.2 =
|
45 |
+
* Bug fix for partial refund shown twice.
|
46 |
+
* Bug fix for wc-api redirection after payment completed
|
47 |
+
* Tested upto WordPress 5.4.1 and WooCommerce 4.1.1
|
48 |
+
|
49 |
= 2.4.1 =
|
50 |
* Updated WordPress support version info
|
51 |
|
woo-razorpay.php
CHANGED
@@ -3,10 +3,10 @@
|
|
3 |
* Plugin Name: Razorpay for WooCommerce
|
4 |
* Plugin URI: https://razorpay.com
|
5 |
* Description: Razorpay Payment Gateway Integration for WooCommerce
|
6 |
-
* Version: 2.4.
|
7 |
-
* Stable tag: 2.4.
|
8 |
* Author: Team Razorpay
|
9 |
-
* WC tested up to:
|
10 |
* Author URI: https://razorpay.com
|
11 |
*/
|
12 |
|
@@ -345,7 +345,7 @@ function woocommerce_razorpay_init()
|
|
345 |
*/
|
346 |
private function getRedirectUrl()
|
347 |
{
|
348 |
-
return
|
349 |
}
|
350 |
|
351 |
/**
|
@@ -696,18 +696,26 @@ EOT;
|
|
696 |
$data = array(
|
697 |
'amount' => (int) round($amount * 100),
|
698 |
'notes' => array(
|
699 |
-
'reason'
|
700 |
-
'order_id'
|
|
|
|
|
701 |
)
|
702 |
);
|
703 |
|
704 |
try
|
705 |
{
|
706 |
$refund = $client->payment
|
707 |
-
|
708 |
-
|
709 |
-
|
710 |
-
$order->add_order_note(__( 'Refund Id: ' . $refund->id, 'woocommerce' ));
|
|
|
|
|
|
|
|
|
|
|
|
|
711 |
|
712 |
return true;
|
713 |
}
|
3 |
* Plugin Name: Razorpay for WooCommerce
|
4 |
* Plugin URI: https://razorpay.com
|
5 |
* Description: Razorpay Payment Gateway Integration for WooCommerce
|
6 |
+
* Version: 2.4.2
|
7 |
+
* Stable tag: 2.4.2
|
8 |
* Author: Team Razorpay
|
9 |
+
* WC tested up to: 4.1.1
|
10 |
* Author URI: https://razorpay.com
|
11 |
*/
|
12 |
|
345 |
*/
|
346 |
private function getRedirectUrl()
|
347 |
{
|
348 |
+
return add_query_arg( 'wc-api', $this->id, trailingslashit( get_home_url() ) );
|
349 |
}
|
350 |
|
351 |
/**
|
696 |
$data = array(
|
697 |
'amount' => (int) round($amount * 100),
|
698 |
'notes' => array(
|
699 |
+
'reason' => $reason,
|
700 |
+
'order_id' => $orderId,
|
701 |
+
'refund_from_website' => true,
|
702 |
+
'source' => 'woocommerce',
|
703 |
)
|
704 |
);
|
705 |
|
706 |
try
|
707 |
{
|
708 |
$refund = $client->payment
|
709 |
+
->fetch( $paymentId )
|
710 |
+
->refund( $data );
|
711 |
+
|
712 |
+
$order->add_order_note( __( 'Refund Id: ' . $refund->id, 'woocommerce' ) );
|
713 |
+
/**
|
714 |
+
* @var $refund ->id -- Provides the RazorPay Refund ID
|
715 |
+
* @var $orderId -> Refunded Order ID
|
716 |
+
* @var $refund -> WooCommerce Refund Instance.
|
717 |
+
*/
|
718 |
+
do_action( 'woo_razorpay_refund_success', $refund->id, $orderId, $refund );
|
719 |
|
720 |
return true;
|
721 |
}
|