From 7c9c521c8bde86dc54214ed69608cf8337212fd8 Mon Sep 17 00:00:00 2001 From: ndeet Date: Thu, 4 Apr 2024 08:53:47 +0200 Subject: [PATCH] Fix refunds, (#46) * Fix refunds, no need to check if refund possible, done by WooCommerce already. --- src/Gateway/AbstractGateway.php | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/src/Gateway/AbstractGateway.php b/src/Gateway/AbstractGateway.php index 5e25253..764b067 100644 --- a/src/Gateway/AbstractGateway.php +++ b/src/Gateway/AbstractGateway.php @@ -194,11 +194,14 @@ public function process_refund( $order_id, $amount = null, $reason = '' ) { } // Make sure the refund amount is not greater than the invoice amount. - if ($amount > $order->get_remaining_refund_amount()) { + // This is done by WC and no need to do it here, refund is already saved at this stage so below won't work. + // Leaving it here for future reference. + /*if ($amount > $order->get_remaining_refund_amount()) { $errAmount = __METHOD__ . ': the refund amount can not exceed the order amount, aborting. Remaining amount ' . $order->get_remaining_refund_amount(); Logger::debug($errAmount); return new \WP_Error('1', $errAmount); } + */ // Create the payout on BTCPay Server. // Handle Sats-mode.