| 1 |
<?php |
| 2 |
/** |
| 3 |
* REST API WC Shipping Methods controller |
| 4 |
* |
| 5 |
* @package WCPOS\WooCommercePOS |
| 6 |
*/ |
| 7 |
|
| 8 |
namespace WCPOS\WooCommercePOS\API\V1; |
| 9 |
|
| 10 |
\defined( 'ABSPATH' ) || die; |
| 11 |
|
| 12 |
if ( ! class_exists( 'WC_REST_Shipping_Methods_Controller' ) ) { |
| 13 |
return; |
| 14 |
} |
| 15 |
|
| 16 |
use WCPOS\WooCommercePOS\Services\Permission_Rules; |
| 17 |
use WC_REST_Shipping_Methods_Controller; |
| 18 |
|
| 19 |
/** |
| 20 |
* Shipping methods controller class. |
| 21 |
*/ |
| 22 |
class Shipping_Methods_Controller extends WC_REST_Shipping_Methods_Controller { |
| 23 |
|
| 24 |
/** |
| 25 |
* Endpoint namespace. |
| 26 |
* |
| 27 |
* @var string |
| 28 |
*/ |
| 29 |
protected $namespace = 'wcpos/v1'; |
| 30 |
|
| 31 |
/** Delegate the read decision, preserving WooCommerce's request-dependent checks. |
| 32 |
* |
| 33 |
* @param \WP_REST_Request $request Full request details. |
| 34 |
*/ |
| 35 |
public function get_items_permissions_check( $request ) { |
| 36 |
return Permission_Rules::verdict( 'shipping_methods', 'read', (int) $request['id'], 0, 'v1', $request->get_params() ); |
| 37 |
} |
| 38 |
} |
| 39 |
|