WC_REST_Payment_Gateways_V2_Controller::get_item()publicWC 1.0

Get a single payment gateway.

Метод класса: WC_REST_Payment_Gateways_V2_Controller{}

Хуков нет.

Возвращает

WP_REST_Response|WP_Error.

Использование

$WC_REST_Payment_Gateways_V2_Controller = new WC_REST_Payment_Gateways_V2_Controller();
$WC_REST_Payment_Gateways_V2_Controller->get_item( $request );
$request(WP_REST_Request) (обязательный)
Request data.

Код WC_REST_Payment_Gateways_V2_Controller::get_item() WC 9.3.3

public function get_item( $request ) {
	$gateway = $this->get_gateway( $request );

	if ( is_null( $gateway ) ) {
		return new WP_Error( 'woocommerce_rest_payment_gateway_invalid', __( 'Resource does not exist.', 'woocommerce' ), array( 'status' => 404 ) );
	}

	$gateway = $this->prepare_item_for_response( $gateway, $request );
	return rest_ensure_response( $gateway );
}