2016-02-17 19:29:09 +00:00
|
|
|
<?php
|
|
|
|
/**
|
|
|
|
* REST API Order Refunds controller
|
|
|
|
*
|
|
|
|
* Handles requests to the /orders/<order_id>/refunds endpoint.
|
|
|
|
*
|
|
|
|
* @author WooThemes
|
|
|
|
* @category API
|
|
|
|
* @package WooCommerce/API
|
|
|
|
* @since 2.6.0
|
|
|
|
*/
|
|
|
|
|
|
|
|
if ( ! defined( 'ABSPATH' ) ) {
|
|
|
|
exit;
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* REST API Order Refunds controller class.
|
|
|
|
*
|
|
|
|
* @package WooCommerce/API
|
2016-02-22 19:43:52 +00:00
|
|
|
* @extends WC_REST_Posts_Controller
|
2016-02-17 19:29:09 +00:00
|
|
|
*/
|
2016-02-22 19:43:52 +00:00
|
|
|
class WC_REST_Order_Refunds_Controller extends WC_REST_Posts_Controller {
|
2016-02-17 19:29:09 +00:00
|
|
|
|
2016-03-07 18:36:17 +00:00
|
|
|
/**
|
|
|
|
* Endpoint namespace.
|
|
|
|
*
|
|
|
|
* @var string
|
|
|
|
*/
|
2016-03-07 18:45:10 +00:00
|
|
|
public $namespace = 'wc/v1';
|
2016-03-07 18:36:17 +00:00
|
|
|
|
2016-02-17 19:29:09 +00:00
|
|
|
/**
|
|
|
|
* Route base.
|
|
|
|
*
|
|
|
|
* @var string
|
|
|
|
*/
|
2016-02-22 18:49:38 +00:00
|
|
|
protected $rest_base = 'orders/(?P<order_id>[\d]+)/refunds';
|
2016-02-17 19:29:09 +00:00
|
|
|
|
|
|
|
/**
|
2016-02-22 19:43:52 +00:00
|
|
|
* Post type.
|
2016-02-17 19:29:09 +00:00
|
|
|
*
|
|
|
|
* @var string
|
|
|
|
*/
|
2016-02-22 19:43:52 +00:00
|
|
|
protected $post_type = 'shop_order_refund';
|
2016-02-17 19:29:09 +00:00
|
|
|
|
|
|
|
/**
|
|
|
|
* Register the routes for order refunds.
|
|
|
|
*/
|
|
|
|
public function register_routes() {
|
2016-03-07 18:36:17 +00:00
|
|
|
register_rest_route( $this->namespace, '/' . $this->rest_base . '/(?P<id>[\d]+)', array(
|
2016-02-23 18:34:42 +00:00
|
|
|
array(
|
|
|
|
'methods' => WP_REST_Server::DELETABLE,
|
|
|
|
'callback' => array( $this, 'delete_item' ),
|
|
|
|
'permission_callback' => array( $this, 'delete_item_permissions_check' ),
|
|
|
|
'args' => array(
|
|
|
|
'force' => array(
|
|
|
|
'default' => false,
|
|
|
|
'description' => __( 'Whether to bypass trash and force deletion.', 'woocommerce' ),
|
|
|
|
),
|
|
|
|
),
|
|
|
|
),
|
|
|
|
) );
|
2016-02-17 19:29:09 +00:00
|
|
|
}
|
|
|
|
}
|