From 215da5fc7da069b5c921197b5b882a4583a78de9 Mon Sep 17 00:00:00 2001 From: daniel21703 Date: Thu, 12 Oct 2023 16:59:00 +0300 Subject: [PATCH] update ReepayGateway::refund_payment --- includes/Gateways/ReepayGateway.php | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/includes/Gateways/ReepayGateway.php b/includes/Gateways/ReepayGateway.php index 80a75ad8..f6bd3574 100644 --- a/includes/Gateways/ReepayGateway.php +++ b/includes/Gateways/ReepayGateway.php @@ -685,6 +685,10 @@ public function refund_payment( $order, $amount = null, $reason = '' ) { throw new Exception( 'Payment can\'t be refunded.' ); } + if ( .0 === (float) $amount ) { + throw new Exception( 'Refund amount must be greater than 0.' ); + } + $result = reepay()->api( $this )->refund( $order, $amount, $reason ); if ( is_wp_error( $result ) ) {