diff --git a/classes/wc-gateway-paypal-express-angelleye.php b/classes/wc-gateway-paypal-express-angelleye.php index 9077b79d3..018e0038f 100644 --- a/classes/wc-gateway-paypal-express-angelleye.php +++ b/classes/wc-gateway-paypal-express-angelleye.php @@ -1484,8 +1484,12 @@ public function free_signup_order_payment($order_id) { public function process_refund($order_id, $amount = null, $reason = '') { require_once( PAYPAL_FOR_WOOCOMMERCE_PLUGIN_DIR . '/angelleye-includes/express-checkout/class-wc-gateway-paypal-express-request-angelleye.php' ); $paypal_express_request = new WC_Gateway_PayPal_Express_Request_AngellEYE($this); - $bool = $paypal_express_request->angelleye_process_refund($order_id, $amount, $reason); - if($bool == true) { + $response = $paypal_express_request->angelleye_process_refund($order_id, $amount, $reason); + if ( is_wp_error( $response ) ) { + self::log('Refund Error: ' . $response->get_error_message()); + throw new Exception( $response->get_error_message() ); + } + if($response == true) { return true; } }