WC_Gateway_Paypal_Refund{}└─ WC_Gateway_Paypal_API_Handler
Here for backwards compatibility.
No Hooks.
Usage
$WC_Gateway_Paypal_Refund = new WC_Gateway_Paypal_Refund(); // use class methods
Methods
- public static get_request( $order, $amount = null, $reason = '' )
- public static refund_order( $order, $amount = null, $reason = '', $sandbox = false )
Changelog
| Since 3.0.0 | Introduced. |
WC_Gateway_Paypal_Refund{} WC Gateway Paypal Refund{} code WC 10.6.2
class WC_Gateway_Paypal_Refund extends WC_Gateway_Paypal_API_Handler {
/**
* Get refund request args. Proxy to WC_Gateway_Paypal_API_Handler::get_refund_request().
*
* @param WC_Order $order Order object.
* @param float $amount Refund amount.
* @param string $reason Refund reason.
*
* @return array
*/
public static function get_request( $order, $amount = null, $reason = '' ) {
return self::get_refund_request( $order, $amount, $reason );
}
/**
* Process an order refund.
*
* @param WC_Order $order Order object.
* @param float $amount Refund amount.
* @param string $reason Refund reason.
* @param bool $sandbox Whether to use sandbox mode or not.
* @return object Either an object of name value pairs for a success, or a WP_ERROR object.
*/
public static function refund_order( $order, $amount = null, $reason = '', $sandbox = false ) {
if ( $sandbox ) {
self::$sandbox = $sandbox;
}
$result = self::refund_transaction( $order, $amount, $reason );
if ( is_wp_error( $result ) ) {
return $result;
} else {
return (array) $result;
}
}
}