@@ 305-309 (lines=5) @@ | ||
302 | if ( isset( $payment_gateways[ $order->payment_method ] ) && $payment_gateways[ $order->payment_method ]->supports( 'refunds' ) ) { |
|
303 | $result = $payment_gateways[ $order->payment_method ]->process_refund( $order_id, $refund->get_refund_amount(), $refund->get_refund_reason() ); |
|
304 | ||
305 | if ( is_wp_error( $result ) ) { |
|
306 | return $result; |
|
307 | } elseif ( ! $result ) { |
|
308 | return new WP_Error( 'woocommerce_rest_create_order_refund_api_failed', __( 'An error occurred while attempting to create the refund using the payment gateway API.', 'woocommerce' ), 500 ); |
|
309 | } |
|
310 | } |
|
311 | } |
|
312 |
@@ 610-612 (lines=3) @@ | ||
607 | $test = wp_safe_remote_post( $this->get_delivery_url(), $args ); |
|
608 | $response_code = wp_remote_retrieve_response_code( $test ); |
|
609 | ||
610 | if ( is_wp_error( $test ) ) { |
|
611 | return new WP_Error( 'error', sprintf( __( 'Error: Delivery URL cannot be reached: %s', 'woocommerce' ), $test->get_error_message() ) ); |
|
612 | } |
|
613 | ||
614 | if ( 200 !== $response_code ) { |
|
615 | return new WP_Error( 'error', sprintf( __( 'Error: Delivery URL returned response code: %s', 'woocommerce' ), absint( $response_code ) ) ); |