Update StoreApi namespaces/move files (https://github.com/woocommerce/woocommerce-blocks/pull/2277)
* `use` is never relative - absolute is always used so backslash is not needed * Move process_legacy_payment code to rest api class * Move storeapi directory * Updated namespaces and moved tests
This commit is contained in:
parent
5a2ee88905
commit
953712941b
|
@ -9,10 +9,7 @@ namespace Automattic\WooCommerce\Blocks;
|
||||||
|
|
||||||
defined( 'ABSPATH' ) || exit;
|
defined( 'ABSPATH' ) || exit;
|
||||||
|
|
||||||
use Automattic\WooCommerce\Blocks\Payments\PaymentResult;
|
|
||||||
use Automattic\WooCommerce\Blocks\Payments\PaymentContext;
|
|
||||||
use Automattic\WooCommerce\Blocks\Payments\PaymentMethodRegistry;
|
use Automattic\WooCommerce\Blocks\Payments\PaymentMethodRegistry;
|
||||||
use Automattic\WooCommerce\Blocks\RestApi\StoreApi\Utilities\NoticeHandler;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Library class.
|
* Library class.
|
||||||
|
@ -32,7 +29,6 @@ class Library {
|
||||||
add_filter( 'woocommerce_register_shop_order_post_statuses', array( __CLASS__, 'register_draft_order_post_status' ) );
|
add_filter( 'woocommerce_register_shop_order_post_statuses', array( __CLASS__, 'register_draft_order_post_status' ) );
|
||||||
add_filter( 'woocommerce_valid_order_statuses_for_payment', array( __CLASS__, 'append_draft_order_post_status' ) );
|
add_filter( 'woocommerce_valid_order_statuses_for_payment', array( __CLASS__, 'append_draft_order_post_status' ) );
|
||||||
add_action( 'woocommerce_cleanup_draft_orders', array( __CLASS__, 'delete_expired_draft_orders' ) );
|
add_action( 'woocommerce_cleanup_draft_orders', array( __CLASS__, 'delete_expired_draft_orders' ) );
|
||||||
add_action( 'woocommerce_rest_checkout_process_payment_with_context', array( __CLASS__, 'process_legacy_payment' ), 999, 2 );
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -206,55 +202,4 @@ class Library {
|
||||||
"
|
"
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* Attempt to process a payment for the checkout API if no payment methods support the
|
|
||||||
* woocommerce_rest_checkout_process_payment_with_context action.
|
|
||||||
*
|
|
||||||
* @param PaymentContext $context Holds context for the payment.
|
|
||||||
* @param PaymentResult $result Result of the payment.
|
|
||||||
*/
|
|
||||||
public static function process_legacy_payment( PaymentContext $context, PaymentResult &$result ) {
|
|
||||||
if ( $result->status ) {
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
// phpcs:ignore WordPress.Security.NonceVerification
|
|
||||||
$post_data = $_POST;
|
|
||||||
|
|
||||||
// Set constants.
|
|
||||||
wc_maybe_define_constant( 'WOOCOMMERCE_CHECKOUT', true );
|
|
||||||
|
|
||||||
// Add the payment data from the API to the POST global.
|
|
||||||
$_POST = $context->payment_data;
|
|
||||||
|
|
||||||
// Call the process payment method of the chosen gatway.
|
|
||||||
$payment_method_object = $context->get_payment_method_instance();
|
|
||||||
|
|
||||||
if ( ! $payment_method_object instanceof \WC_Payment_Gateway ) {
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
$payment_method_object->validate_fields();
|
|
||||||
|
|
||||||
// If errors were thrown, we need to abort.
|
|
||||||
NoticeHandler::convert_notices_to_exceptions( 'woocommerce_rest_payment_error' );
|
|
||||||
|
|
||||||
// Process Payment.
|
|
||||||
$gateway_result = $payment_method_object->process_payment( $context->order->get_id() );
|
|
||||||
|
|
||||||
// Restore $_POST data.
|
|
||||||
$_POST = $post_data;
|
|
||||||
|
|
||||||
// If `process_payment` added notices, clear them. Notices are not displayed from the API -- payment should fail,
|
|
||||||
// and a generic notice will be shown instead if payment failed.
|
|
||||||
wc_clear_notices();
|
|
||||||
|
|
||||||
// Handle result.
|
|
||||||
$result->set_status( isset( $gateway_result['result'] ) && 'success' === $gateway_result['result'] ? 'success' : 'failure' );
|
|
||||||
|
|
||||||
// set payment_details from result.
|
|
||||||
$result->set_payment_details( array_merge( $result->payment_details, $gateway_result ) );
|
|
||||||
$result->set_redirect_url( $gateway_result['redirect'] );
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -9,8 +9,12 @@ namespace Automattic\WooCommerce\Blocks;
|
||||||
|
|
||||||
defined( 'ABSPATH' ) || exit;
|
defined( 'ABSPATH' ) || exit;
|
||||||
|
|
||||||
use \Automattic\WooCommerce\Blocks\RestApi\StoreApi\RoutesController;
|
use Automattic\WooCommerce\Blocks\StoreApi\RoutesController;
|
||||||
use \Automattic\WooCommerce\Blocks\RestApi\StoreApi\SchemaController;
|
use Automattic\WooCommerce\Blocks\StoreApi\SchemaController;
|
||||||
|
use Automattic\WooCommerce\Blocks\Payments\PaymentResult;
|
||||||
|
use Automattic\WooCommerce\Blocks\Payments\PaymentContext;
|
||||||
|
use Automattic\WooCommerce\Blocks\Payments\PaymentMethodRegistry;
|
||||||
|
use Automattic\WooCommerce\Blocks\StoreApi\Utilities\NoticeHandler;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* RestApi class.
|
* RestApi class.
|
||||||
|
@ -24,6 +28,7 @@ class RestApi {
|
||||||
add_action( 'rest_api_init', array( __CLASS__, 'register_rest_routes' ), 10 );
|
add_action( 'rest_api_init', array( __CLASS__, 'register_rest_routes' ), 10 );
|
||||||
add_filter( 'rest_authentication_errors', array( __CLASS__, 'maybe_init_cart_session' ), 1 );
|
add_filter( 'rest_authentication_errors', array( __CLASS__, 'maybe_init_cart_session' ), 1 );
|
||||||
add_filter( 'rest_authentication_errors', array( __CLASS__, 'store_api_authentication' ) );
|
add_filter( 'rest_authentication_errors', array( __CLASS__, 'store_api_authentication' ) );
|
||||||
|
add_action( 'woocommerce_rest_checkout_process_payment_with_context', array( __CLASS__, 'process_legacy_payment' ), 999, 2 );
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -129,4 +134,55 @@ class RestApi {
|
||||||
'product-reviews' => __NAMESPACE__ . '\RestApi\Controllers\ProductReviews',
|
'product-reviews' => __NAMESPACE__ . '\RestApi\Controllers\ProductReviews',
|
||||||
];
|
];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Attempt to process a payment for the checkout API if no payment methods support the
|
||||||
|
* woocommerce_rest_checkout_process_payment_with_context action.
|
||||||
|
*
|
||||||
|
* @param PaymentContext $context Holds context for the payment.
|
||||||
|
* @param PaymentResult $result Result of the payment.
|
||||||
|
*/
|
||||||
|
public static function process_legacy_payment( PaymentContext $context, PaymentResult &$result ) {
|
||||||
|
if ( $result->status ) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
// phpcs:ignore WordPress.Security.NonceVerification
|
||||||
|
$post_data = $_POST;
|
||||||
|
|
||||||
|
// Set constants.
|
||||||
|
wc_maybe_define_constant( 'WOOCOMMERCE_CHECKOUT', true );
|
||||||
|
|
||||||
|
// Add the payment data from the API to the POST global.
|
||||||
|
$_POST = $context->payment_data;
|
||||||
|
|
||||||
|
// Call the process payment method of the chosen gatway.
|
||||||
|
$payment_method_object = $context->get_payment_method_instance();
|
||||||
|
|
||||||
|
if ( ! $payment_method_object instanceof \WC_Payment_Gateway ) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
$payment_method_object->validate_fields();
|
||||||
|
|
||||||
|
// If errors were thrown, we need to abort.
|
||||||
|
NoticeHandler::convert_notices_to_exceptions( 'woocommerce_rest_payment_error' );
|
||||||
|
|
||||||
|
// Process Payment.
|
||||||
|
$gateway_result = $payment_method_object->process_payment( $context->order->get_id() );
|
||||||
|
|
||||||
|
// Restore $_POST data.
|
||||||
|
$_POST = $post_data;
|
||||||
|
|
||||||
|
// If `process_payment` added notices, clear them. Notices are not displayed from the API -- payment should fail,
|
||||||
|
// and a generic notice will be shown instead if payment failed.
|
||||||
|
wc_clear_notices();
|
||||||
|
|
||||||
|
// Handle result.
|
||||||
|
$result->set_status( isset( $gateway_result['result'] ) && 'success' === $gateway_result['result'] ? 'success' : 'failure' );
|
||||||
|
|
||||||
|
// set payment_details from result.
|
||||||
|
$result->set_payment_details( array_merge( $result->payment_details, $gateway_result ) );
|
||||||
|
$result->set_redirect_url( $gateway_result['redirect'] );
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -12,9 +12,9 @@ namespace Automattic\WooCommerce\Blocks\RestApi\Controllers;
|
||||||
|
|
||||||
defined( 'ABSPATH' ) || exit;
|
defined( 'ABSPATH' ) || exit;
|
||||||
|
|
||||||
use \WP_Error;
|
use WP_Error;
|
||||||
use \WP_REST_Server;
|
use WP_REST_Server;
|
||||||
use \WP_REST_Controller;
|
use WP_REST_Controller;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Cart API.
|
* Cart API.
|
||||||
|
|
|
@ -12,7 +12,7 @@ namespace Automattic\WooCommerce\Blocks\RestApi\Controllers;
|
||||||
|
|
||||||
defined( 'ABSPATH' ) || exit;
|
defined( 'ABSPATH' ) || exit;
|
||||||
|
|
||||||
use \WC_REST_Product_Attribute_Terms_Controller;
|
use WC_REST_Product_Attribute_Terms_Controller;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* REST API Product Attribute Terms controller class.
|
* REST API Product Attribute Terms controller class.
|
||||||
|
|
|
@ -12,7 +12,7 @@ namespace Automattic\WooCommerce\Blocks\RestApi\Controllers;
|
||||||
|
|
||||||
defined( 'ABSPATH' ) || exit;
|
defined( 'ABSPATH' ) || exit;
|
||||||
|
|
||||||
use \WC_REST_Product_Attributes_Controller;
|
use WC_REST_Product_Attributes_Controller;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* REST API Product Attributes controller class.
|
* REST API Product Attributes controller class.
|
||||||
|
|
|
@ -12,7 +12,7 @@ namespace Automattic\WooCommerce\Blocks\RestApi\Controllers;
|
||||||
|
|
||||||
defined( 'ABSPATH' ) || exit;
|
defined( 'ABSPATH' ) || exit;
|
||||||
|
|
||||||
use \WC_REST_Product_Categories_Controller;
|
use WC_REST_Product_Categories_Controller;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* REST API Product Categories controller class.
|
* REST API Product Categories controller class.
|
||||||
|
|
|
@ -13,7 +13,7 @@ namespace Automattic\WooCommerce\Blocks\RestApi\Controllers;
|
||||||
|
|
||||||
defined( 'ABSPATH' ) || exit;
|
defined( 'ABSPATH' ) || exit;
|
||||||
|
|
||||||
use \WC_REST_Controller;
|
use WC_REST_Controller;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* REST API Product Reviews controller class.
|
* REST API Product Reviews controller class.
|
||||||
|
|
|
@ -12,7 +12,7 @@ namespace Automattic\WooCommerce\Blocks\RestApi\Controllers;
|
||||||
|
|
||||||
defined( 'ABSPATH' ) || exit;
|
defined( 'ABSPATH' ) || exit;
|
||||||
|
|
||||||
use \WC_REST_Product_Tags_Controller;
|
use WC_REST_Product_Tags_Controller;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* REST API Product Tags controller class.
|
* REST API Product Tags controller class.
|
||||||
|
|
|
@ -12,7 +12,7 @@ namespace Automattic\WooCommerce\Blocks\RestApi\Controllers;
|
||||||
|
|
||||||
defined( 'ABSPATH' ) || exit;
|
defined( 'ABSPATH' ) || exit;
|
||||||
|
|
||||||
use \WC_REST_Products_Controller;
|
use WC_REST_Products_Controller;
|
||||||
use Automattic\WooCommerce\Blocks\RestApi\Utilities\ProductImages;
|
use Automattic\WooCommerce\Blocks\RestApi\Utilities\ProductImages;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
|
@ -12,7 +12,7 @@ namespace Automattic\WooCommerce\Blocks\RestApi\Controllers;
|
||||||
|
|
||||||
defined( 'ABSPATH' ) || exit;
|
defined( 'ABSPATH' ) || exit;
|
||||||
|
|
||||||
use \WC_REST_Product_Variations_Controller;
|
use WC_REST_Product_Variations_Controller;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* REST API variations controller class.
|
* REST API variations controller class.
|
||||||
|
|
|
@ -5,11 +5,11 @@
|
||||||
* @package WooCommerce/Blocks
|
* @package WooCommerce/Blocks
|
||||||
*/
|
*/
|
||||||
|
|
||||||
namespace Automattic\WooCommerce\Blocks\RestApi\StoreApi\Routes;
|
namespace Automattic\WooCommerce\Blocks\StoreApi\Routes;
|
||||||
|
|
||||||
defined( 'ABSPATH' ) || exit;
|
defined( 'ABSPATH' ) || exit;
|
||||||
|
|
||||||
use Automattic\WooCommerce\Blocks\RestApi\StoreApi\Utilities\CartController;
|
use Automattic\WooCommerce\Blocks\StoreApi\Utilities\CartController;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Cart class.
|
* Cart class.
|
|
@ -6,11 +6,11 @@
|
||||||
* @package WooCommerce/Blocks
|
* @package WooCommerce/Blocks
|
||||||
*/
|
*/
|
||||||
|
|
||||||
namespace Automattic\WooCommerce\Blocks\RestApi\StoreApi\Routes;
|
namespace Automattic\WooCommerce\Blocks\StoreApi\Routes;
|
||||||
|
|
||||||
defined( 'ABSPATH' ) || exit;
|
defined( 'ABSPATH' ) || exit;
|
||||||
|
|
||||||
use Automattic\WooCommerce\Blocks\RestApi\StoreApi\Schemas\AbstractSchema;
|
use Automattic\WooCommerce\Blocks\StoreApi\Schemas\AbstractSchema;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* AbstractRoute class.
|
* AbstractRoute class.
|
|
@ -5,11 +5,11 @@
|
||||||
* @package WooCommerce/Blocks
|
* @package WooCommerce/Blocks
|
||||||
*/
|
*/
|
||||||
|
|
||||||
namespace Automattic\WooCommerce\Blocks\RestApi\StoreApi\Routes;
|
namespace Automattic\WooCommerce\Blocks\StoreApi\Routes;
|
||||||
|
|
||||||
defined( 'ABSPATH' ) || exit;
|
defined( 'ABSPATH' ) || exit;
|
||||||
|
|
||||||
use Automattic\WooCommerce\Blocks\RestApi\StoreApi\Utilities\CartController;
|
use Automattic\WooCommerce\Blocks\StoreApi\Utilities\CartController;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Cart class.
|
* Cart class.
|
|
@ -5,11 +5,11 @@
|
||||||
* @package WooCommerce/Blocks
|
* @package WooCommerce/Blocks
|
||||||
*/
|
*/
|
||||||
|
|
||||||
namespace Automattic\WooCommerce\Blocks\RestApi\StoreApi\Routes;
|
namespace Automattic\WooCommerce\Blocks\StoreApi\Routes;
|
||||||
|
|
||||||
defined( 'ABSPATH' ) || exit;
|
defined( 'ABSPATH' ) || exit;
|
||||||
|
|
||||||
use Automattic\WooCommerce\Blocks\RestApi\StoreApi\Utilities\CartController;
|
use Automattic\WooCommerce\Blocks\StoreApi\Utilities\CartController;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* CartAddItem class.
|
* CartAddItem class.
|
|
@ -5,11 +5,11 @@
|
||||||
* @package WooCommerce/Blocks
|
* @package WooCommerce/Blocks
|
||||||
*/
|
*/
|
||||||
|
|
||||||
namespace Automattic\WooCommerce\Blocks\RestApi\StoreApi\Routes;
|
namespace Automattic\WooCommerce\Blocks\StoreApi\Routes;
|
||||||
|
|
||||||
defined( 'ABSPATH' ) || exit;
|
defined( 'ABSPATH' ) || exit;
|
||||||
|
|
||||||
use Automattic\WooCommerce\Blocks\RestApi\StoreApi\Utilities\CartController;
|
use Automattic\WooCommerce\Blocks\StoreApi\Utilities\CartController;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* CartApplyCoupon class.
|
* CartApplyCoupon class.
|
|
@ -6,11 +6,11 @@
|
||||||
* @package WooCommerce/Blocks
|
* @package WooCommerce/Blocks
|
||||||
*/
|
*/
|
||||||
|
|
||||||
namespace Automattic\WooCommerce\Blocks\RestApi\StoreApi\Routes;
|
namespace Automattic\WooCommerce\Blocks\StoreApi\Routes;
|
||||||
|
|
||||||
defined( 'ABSPATH' ) || exit;
|
defined( 'ABSPATH' ) || exit;
|
||||||
|
|
||||||
use Automattic\WooCommerce\Blocks\RestApi\StoreApi\Utilities\CartController;
|
use Automattic\WooCommerce\Blocks\StoreApi\Utilities\CartController;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* CartCoupons class.
|
* CartCoupons class.
|
|
@ -6,11 +6,11 @@
|
||||||
* @package WooCommerce/Blocks
|
* @package WooCommerce/Blocks
|
||||||
*/
|
*/
|
||||||
|
|
||||||
namespace Automattic\WooCommerce\Blocks\RestApi\StoreApi\Routes;
|
namespace Automattic\WooCommerce\Blocks\StoreApi\Routes;
|
||||||
|
|
||||||
defined( 'ABSPATH' ) || exit;
|
defined( 'ABSPATH' ) || exit;
|
||||||
|
|
||||||
use Automattic\WooCommerce\Blocks\RestApi\StoreApi\Utilities\CartController;
|
use Automattic\WooCommerce\Blocks\StoreApi\Utilities\CartController;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* CartCouponsByCode class.
|
* CartCouponsByCode class.
|
|
@ -6,11 +6,11 @@
|
||||||
* @package WooCommerce/Blocks
|
* @package WooCommerce/Blocks
|
||||||
*/
|
*/
|
||||||
|
|
||||||
namespace Automattic\WooCommerce\Blocks\RestApi\StoreApi\Routes;
|
namespace Automattic\WooCommerce\Blocks\StoreApi\Routes;
|
||||||
|
|
||||||
defined( 'ABSPATH' ) || exit;
|
defined( 'ABSPATH' ) || exit;
|
||||||
|
|
||||||
use Automattic\WooCommerce\Blocks\RestApi\StoreApi\Utilities\CartController;
|
use Automattic\WooCommerce\Blocks\StoreApi\Utilities\CartController;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* CartItems class.
|
* CartItems class.
|
|
@ -6,11 +6,11 @@
|
||||||
* @package WooCommerce/Blocks
|
* @package WooCommerce/Blocks
|
||||||
*/
|
*/
|
||||||
|
|
||||||
namespace Automattic\WooCommerce\Blocks\RestApi\StoreApi\Routes;
|
namespace Automattic\WooCommerce\Blocks\StoreApi\Routes;
|
||||||
|
|
||||||
defined( 'ABSPATH' ) || exit;
|
defined( 'ABSPATH' ) || exit;
|
||||||
|
|
||||||
use Automattic\WooCommerce\Blocks\RestApi\StoreApi\Utilities\CartController;
|
use Automattic\WooCommerce\Blocks\StoreApi\Utilities\CartController;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* CartItemsByKey class.
|
* CartItemsByKey class.
|
|
@ -5,11 +5,11 @@
|
||||||
* @package WooCommerce/Blocks
|
* @package WooCommerce/Blocks
|
||||||
*/
|
*/
|
||||||
|
|
||||||
namespace Automattic\WooCommerce\Blocks\RestApi\StoreApi\Routes;
|
namespace Automattic\WooCommerce\Blocks\StoreApi\Routes;
|
||||||
|
|
||||||
defined( 'ABSPATH' ) || exit;
|
defined( 'ABSPATH' ) || exit;
|
||||||
|
|
||||||
use Automattic\WooCommerce\Blocks\RestApi\StoreApi\Utilities\CartController;
|
use Automattic\WooCommerce\Blocks\StoreApi\Utilities\CartController;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* CartRemoveCoupon class.
|
* CartRemoveCoupon class.
|
|
@ -5,11 +5,11 @@
|
||||||
* @package WooCommerce/Blocks
|
* @package WooCommerce/Blocks
|
||||||
*/
|
*/
|
||||||
|
|
||||||
namespace Automattic\WooCommerce\Blocks\RestApi\StoreApi\Routes;
|
namespace Automattic\WooCommerce\Blocks\StoreApi\Routes;
|
||||||
|
|
||||||
defined( 'ABSPATH' ) || exit;
|
defined( 'ABSPATH' ) || exit;
|
||||||
|
|
||||||
use Automattic\WooCommerce\Blocks\RestApi\StoreApi\Utilities\CartController;
|
use Automattic\WooCommerce\Blocks\StoreApi\Utilities\CartController;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* CartRemoveItem class.
|
* CartRemoveItem class.
|
|
@ -5,11 +5,11 @@
|
||||||
* @package WooCommerce/Blocks
|
* @package WooCommerce/Blocks
|
||||||
*/
|
*/
|
||||||
|
|
||||||
namespace Automattic\WooCommerce\Blocks\RestApi\StoreApi\Routes;
|
namespace Automattic\WooCommerce\Blocks\StoreApi\Routes;
|
||||||
|
|
||||||
defined( 'ABSPATH' ) || exit;
|
defined( 'ABSPATH' ) || exit;
|
||||||
|
|
||||||
use Automattic\WooCommerce\Blocks\RestApi\StoreApi\Utilities\CartController;
|
use Automattic\WooCommerce\Blocks\StoreApi\Utilities\CartController;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* CartSelectShippingRate class.
|
* CartSelectShippingRate class.
|
|
@ -5,11 +5,11 @@
|
||||||
* @package WooCommerce/Blocks
|
* @package WooCommerce/Blocks
|
||||||
*/
|
*/
|
||||||
|
|
||||||
namespace Automattic\WooCommerce\Blocks\RestApi\StoreApi\Routes;
|
namespace Automattic\WooCommerce\Blocks\StoreApi\Routes;
|
||||||
|
|
||||||
defined( 'ABSPATH' ) || exit;
|
defined( 'ABSPATH' ) || exit;
|
||||||
|
|
||||||
use Automattic\WooCommerce\Blocks\RestApi\StoreApi\Utilities\CartController;
|
use Automattic\WooCommerce\Blocks\StoreApi\Utilities\CartController;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* CartUpdateItem class.
|
* CartUpdateItem class.
|
|
@ -5,11 +5,11 @@
|
||||||
* @package WooCommerce/Blocks
|
* @package WooCommerce/Blocks
|
||||||
*/
|
*/
|
||||||
|
|
||||||
namespace Automattic\WooCommerce\Blocks\RestApi\StoreApi\Routes;
|
namespace Automattic\WooCommerce\Blocks\StoreApi\Routes;
|
||||||
|
|
||||||
defined( 'ABSPATH' ) || exit;
|
defined( 'ABSPATH' ) || exit;
|
||||||
|
|
||||||
use Automattic\WooCommerce\Blocks\RestApi\StoreApi\Utilities\CartController;
|
use Automattic\WooCommerce\Blocks\StoreApi\Utilities\CartController;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* CartUpdateShipping class.
|
* CartUpdateShipping class.
|
|
@ -5,14 +5,14 @@
|
||||||
* @package WooCommerce/Blocks
|
* @package WooCommerce/Blocks
|
||||||
*/
|
*/
|
||||||
|
|
||||||
namespace Automattic\WooCommerce\Blocks\RestApi\StoreApi\Routes;
|
namespace Automattic\WooCommerce\Blocks\StoreApi\Routes;
|
||||||
|
|
||||||
defined( 'ABSPATH' ) || exit;
|
defined( 'ABSPATH' ) || exit;
|
||||||
|
|
||||||
use Automattic\WooCommerce\Blocks\RestApi\StoreApi\Utilities\CartController;
|
use Automattic\WooCommerce\Blocks\StoreApi\Utilities\CartController;
|
||||||
use Automattic\WooCommerce\Blocks\RestApi\StoreApi\Utilities\OrderController;
|
use Automattic\WooCommerce\Blocks\StoreApi\Utilities\OrderController;
|
||||||
use Automattic\WooCommerce\Blocks\RestApi\StoreApi\Utilities\ReserveStock;
|
use Automattic\WooCommerce\Blocks\StoreApi\Utilities\ReserveStock;
|
||||||
use Automattic\WooCommerce\Blocks\RestApi\StoreApi\Utilities\ReserveStockException;
|
use Automattic\WooCommerce\Blocks\StoreApi\Utilities\ReserveStockException;
|
||||||
use Automattic\WooCommerce\Blocks\Payments\PaymentResult;
|
use Automattic\WooCommerce\Blocks\Payments\PaymentResult;
|
||||||
use Automattic\WooCommerce\Blocks\Payments\PaymentContext;
|
use Automattic\WooCommerce\Blocks\Payments\PaymentContext;
|
||||||
|
|
|
@ -6,11 +6,11 @@
|
||||||
* @package WooCommerce/Blocks
|
* @package WooCommerce/Blocks
|
||||||
*/
|
*/
|
||||||
|
|
||||||
namespace Automattic\WooCommerce\Blocks\RestApi\StoreApi\Routes;
|
namespace Automattic\WooCommerce\Blocks\StoreApi\Routes;
|
||||||
|
|
||||||
defined( 'ABSPATH' ) || exit;
|
defined( 'ABSPATH' ) || exit;
|
||||||
|
|
||||||
use Automattic\WooCommerce\Blocks\RestApi\StoreApi\Utilities\TermQuery;
|
use Automattic\WooCommerce\Blocks\StoreApi\Utilities\TermQuery;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* ProductAttributeTerms class.
|
* ProductAttributeTerms class.
|
|
@ -6,7 +6,7 @@
|
||||||
* @package WooCommerce/Blocks
|
* @package WooCommerce/Blocks
|
||||||
*/
|
*/
|
||||||
|
|
||||||
namespace Automattic\WooCommerce\Blocks\RestApi\StoreApi\Routes;
|
namespace Automattic\WooCommerce\Blocks\StoreApi\Routes;
|
||||||
|
|
||||||
defined( 'ABSPATH' ) || exit;
|
defined( 'ABSPATH' ) || exit;
|
||||||
|
|
|
@ -6,7 +6,7 @@
|
||||||
* @package WooCommerce/Blocks
|
* @package WooCommerce/Blocks
|
||||||
*/
|
*/
|
||||||
|
|
||||||
namespace Automattic\WooCommerce\Blocks\RestApi\StoreApi\Routes;
|
namespace Automattic\WooCommerce\Blocks\StoreApi\Routes;
|
||||||
|
|
||||||
defined( 'ABSPATH' ) || exit;
|
defined( 'ABSPATH' ) || exit;
|
||||||
|
|
|
@ -8,11 +8,11 @@
|
||||||
* @package WooCommerce/Blocks
|
* @package WooCommerce/Blocks
|
||||||
*/
|
*/
|
||||||
|
|
||||||
namespace Automattic\WooCommerce\Blocks\RestApi\StoreApi\Routes;
|
namespace Automattic\WooCommerce\Blocks\StoreApi\Routes;
|
||||||
|
|
||||||
defined( 'ABSPATH' ) || exit;
|
defined( 'ABSPATH' ) || exit;
|
||||||
|
|
||||||
use Automattic\WooCommerce\Blocks\RestApi\StoreApi\Utilities\ProductQueryFilters;
|
use Automattic\WooCommerce\Blocks\StoreApi\Utilities\ProductQueryFilters;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* ProductCollectionData route.
|
* ProductCollectionData route.
|
|
@ -6,12 +6,12 @@
|
||||||
* @package WooCommerce/Blocks
|
* @package WooCommerce/Blocks
|
||||||
*/
|
*/
|
||||||
|
|
||||||
namespace Automattic\WooCommerce\Blocks\RestApi\StoreApi\Routes;
|
namespace Automattic\WooCommerce\Blocks\StoreApi\Routes;
|
||||||
|
|
||||||
defined( 'ABSPATH' ) || exit;
|
defined( 'ABSPATH' ) || exit;
|
||||||
|
|
||||||
use Automattic\WooCommerce\Blocks\RestApi\StoreApi\Utilities\Pagination;
|
use Automattic\WooCommerce\Blocks\StoreApi\Utilities\Pagination;
|
||||||
use Automattic\WooCommerce\Blocks\RestApi\StoreApi\Utilities\ProductQuery;
|
use Automattic\WooCommerce\Blocks\StoreApi\Utilities\ProductQuery;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Products class.
|
* Products class.
|
|
@ -6,7 +6,7 @@
|
||||||
* @package WooCommerce/Blocks
|
* @package WooCommerce/Blocks
|
||||||
*/
|
*/
|
||||||
|
|
||||||
namespace Automattic\WooCommerce\Blocks\RestApi\StoreApi\Routes;
|
namespace Automattic\WooCommerce\Blocks\StoreApi\Routes;
|
||||||
|
|
||||||
defined( 'ABSPATH' ) || exit;
|
defined( 'ABSPATH' ) || exit;
|
||||||
|
|
|
@ -5,7 +5,7 @@
|
||||||
* @package WooCommerce/Blocks
|
* @package WooCommerce/Blocks
|
||||||
*/
|
*/
|
||||||
|
|
||||||
namespace Automattic\WooCommerce\Blocks\RestApi\StoreApi\Routes;
|
namespace Automattic\WooCommerce\Blocks\StoreApi\Routes;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* ReserveStockRouteExceptionException class.
|
* ReserveStockRouteExceptionException class.
|
|
@ -5,7 +5,7 @@
|
||||||
* @package WooCommerce/Blocks
|
* @package WooCommerce/Blocks
|
||||||
*/
|
*/
|
||||||
|
|
||||||
namespace Automattic\WooCommerce\Blocks\RestApi\StoreApi\Routes;
|
namespace Automattic\WooCommerce\Blocks\StoreApi\Routes;
|
||||||
|
|
||||||
defined( 'ABSPATH' ) || exit;
|
defined( 'ABSPATH' ) || exit;
|
||||||
|
|
|
@ -6,7 +6,7 @@
|
||||||
* @package WooCommerce/Blocks
|
* @package WooCommerce/Blocks
|
||||||
*/
|
*/
|
||||||
|
|
||||||
namespace Automattic\WooCommerce\Blocks\RestApi\StoreApi;
|
namespace Automattic\WooCommerce\Blocks\StoreApi;
|
||||||
|
|
||||||
defined( 'ABSPATH' ) || exit;
|
defined( 'ABSPATH' ) || exit;
|
||||||
|
|
|
@ -6,7 +6,7 @@
|
||||||
* @package WooCommerce/Blocks
|
* @package WooCommerce/Blocks
|
||||||
*/
|
*/
|
||||||
|
|
||||||
namespace Automattic\WooCommerce\Blocks\RestApi\StoreApi;
|
namespace Automattic\WooCommerce\Blocks\StoreApi;
|
||||||
|
|
||||||
defined( 'ABSPATH' ) || exit;
|
defined( 'ABSPATH' ) || exit;
|
||||||
|
|
|
@ -7,7 +7,7 @@
|
||||||
* @package WooCommerce/Blocks
|
* @package WooCommerce/Blocks
|
||||||
*/
|
*/
|
||||||
|
|
||||||
namespace Automattic\WooCommerce\Blocks\RestApi\StoreApi\Schemas;
|
namespace Automattic\WooCommerce\Blocks\StoreApi\Schemas;
|
||||||
|
|
||||||
defined( 'ABSPATH' ) || exit;
|
defined( 'ABSPATH' ) || exit;
|
||||||
|
|
|
@ -5,7 +5,7 @@
|
||||||
* @package WooCommerce/Blocks
|
* @package WooCommerce/Blocks
|
||||||
*/
|
*/
|
||||||
|
|
||||||
namespace Automattic\WooCommerce\Blocks\RestApi\StoreApi\Schemas;
|
namespace Automattic\WooCommerce\Blocks\StoreApi\Schemas;
|
||||||
|
|
||||||
defined( 'ABSPATH' ) || exit;
|
defined( 'ABSPATH' ) || exit;
|
||||||
|
|
|
@ -5,11 +5,11 @@
|
||||||
* @package WooCommerce/Blocks
|
* @package WooCommerce/Blocks
|
||||||
*/
|
*/
|
||||||
|
|
||||||
namespace Automattic\WooCommerce\Blocks\RestApi\StoreApi\Schemas;
|
namespace Automattic\WooCommerce\Blocks\StoreApi\Schemas;
|
||||||
|
|
||||||
defined( 'ABSPATH' ) || exit;
|
defined( 'ABSPATH' ) || exit;
|
||||||
|
|
||||||
use Automattic\WooCommerce\Blocks\RestApi\StoreApi\Utilities\CartController;
|
use Automattic\WooCommerce\Blocks\StoreApi\Utilities\CartController;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* CartCouponSchema class.
|
* CartCouponSchema class.
|
|
@ -5,7 +5,7 @@
|
||||||
* @package WooCommerce/Blocks
|
* @package WooCommerce/Blocks
|
||||||
*/
|
*/
|
||||||
|
|
||||||
namespace Automattic\WooCommerce\Blocks\RestApi\StoreApi\Schemas;
|
namespace Automattic\WooCommerce\Blocks\StoreApi\Schemas;
|
||||||
|
|
||||||
defined( 'ABSPATH' ) || exit;
|
defined( 'ABSPATH' ) || exit;
|
||||||
|
|
||||||
|
@ -406,7 +406,7 @@ class CartItemSchema extends ProductSchema {
|
||||||
if ( \class_exists( '\Automattic\WooCommerce\Checkout\Helpers\ReserveStock' ) ) {
|
if ( \class_exists( '\Automattic\WooCommerce\Checkout\Helpers\ReserveStock' ) ) {
|
||||||
$reserve_stock = new \Automattic\WooCommerce\Checkout\Helpers\ReserveStock();
|
$reserve_stock = new \Automattic\WooCommerce\Checkout\Helpers\ReserveStock();
|
||||||
} else {
|
} else {
|
||||||
$reserve_stock = new \Automattic\WooCommerce\Blocks\RestApi\StoreApi\Utilities\ReserveStock();
|
$reserve_stock = new \Automattic\WooCommerce\Blocks\StoreApi\Utilities\ReserveStock();
|
||||||
}
|
}
|
||||||
|
|
||||||
$reserved_stock = $reserve_stock->get_reserved_stock( $product, $draft_order );
|
$reserved_stock = $reserve_stock->get_reserved_stock( $product, $draft_order );
|
|
@ -5,9 +5,9 @@
|
||||||
* @package WooCommerce/Blocks
|
* @package WooCommerce/Blocks
|
||||||
*/
|
*/
|
||||||
|
|
||||||
namespace Automattic\WooCommerce\Blocks\RestApi\StoreApi\Schemas;
|
namespace Automattic\WooCommerce\Blocks\StoreApi\Schemas;
|
||||||
|
|
||||||
use Automattic\WooCommerce\Blocks\RestApi\StoreApi\Utilities\CartController;
|
use Automattic\WooCommerce\Blocks\StoreApi\Utilities\CartController;
|
||||||
|
|
||||||
defined( 'ABSPATH' ) || exit;
|
defined( 'ABSPATH' ) || exit;
|
||||||
|
|
|
@ -5,11 +5,11 @@
|
||||||
* @package WooCommerce/Blocks
|
* @package WooCommerce/Blocks
|
||||||
*/
|
*/
|
||||||
|
|
||||||
namespace Automattic\WooCommerce\Blocks\RestApi\StoreApi\Schemas;
|
namespace Automattic\WooCommerce\Blocks\StoreApi\Schemas;
|
||||||
|
|
||||||
defined( 'ABSPATH' ) || exit;
|
defined( 'ABSPATH' ) || exit;
|
||||||
|
|
||||||
use \WC_Shipping_Rate as ShippingRate;
|
use WC_Shipping_Rate as ShippingRate;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* CartShippingRateSchema class.
|
* CartShippingRateSchema class.
|
|
@ -5,7 +5,7 @@
|
||||||
* @package WooCommerce/Blocks
|
* @package WooCommerce/Blocks
|
||||||
*/
|
*/
|
||||||
|
|
||||||
namespace Automattic\WooCommerce\Blocks\RestApi\StoreApi\Schemas;
|
namespace Automattic\WooCommerce\Blocks\StoreApi\Schemas;
|
||||||
|
|
||||||
defined( 'ABSPATH' ) || exit;
|
defined( 'ABSPATH' ) || exit;
|
||||||
|
|
|
@ -5,7 +5,7 @@
|
||||||
* @package WooCommerce/Blocks
|
* @package WooCommerce/Blocks
|
||||||
*/
|
*/
|
||||||
|
|
||||||
namespace Automattic\WooCommerce\Blocks\RestApi\StoreApi\Schemas;
|
namespace Automattic\WooCommerce\Blocks\StoreApi\Schemas;
|
||||||
|
|
||||||
defined( 'ABSPATH' ) || exit;
|
defined( 'ABSPATH' ) || exit;
|
||||||
|
|
|
@ -5,7 +5,7 @@
|
||||||
* @package WooCommerce/Blocks
|
* @package WooCommerce/Blocks
|
||||||
*/
|
*/
|
||||||
|
|
||||||
namespace Automattic\WooCommerce\Blocks\RestApi\StoreApi\Schemas;
|
namespace Automattic\WooCommerce\Blocks\StoreApi\Schemas;
|
||||||
|
|
||||||
defined( 'ABSPATH' ) || exit;
|
defined( 'ABSPATH' ) || exit;
|
||||||
|
|
|
@ -5,7 +5,7 @@
|
||||||
* @package WooCommerce/Blocks
|
* @package WooCommerce/Blocks
|
||||||
*/
|
*/
|
||||||
|
|
||||||
namespace Automattic\WooCommerce\Blocks\RestApi\StoreApi\Schemas;
|
namespace Automattic\WooCommerce\Blocks\StoreApi\Schemas;
|
||||||
|
|
||||||
defined( 'ABSPATH' ) || exit;
|
defined( 'ABSPATH' ) || exit;
|
||||||
|
|
|
@ -7,7 +7,7 @@
|
||||||
* @package WooCommerce/Blocks
|
* @package WooCommerce/Blocks
|
||||||
*/
|
*/
|
||||||
|
|
||||||
namespace Automattic\WooCommerce\Blocks\RestApi\StoreApi\Schemas;
|
namespace Automattic\WooCommerce\Blocks\StoreApi\Schemas;
|
||||||
|
|
||||||
defined( 'ABSPATH' ) || exit;
|
defined( 'ABSPATH' ) || exit;
|
||||||
|
|
|
@ -5,7 +5,7 @@
|
||||||
* @package WooCommerce/Blocks
|
* @package WooCommerce/Blocks
|
||||||
*/
|
*/
|
||||||
|
|
||||||
namespace Automattic\WooCommerce\Blocks\RestApi\StoreApi\Schemas;
|
namespace Automattic\WooCommerce\Blocks\StoreApi\Schemas;
|
||||||
|
|
||||||
defined( 'ABSPATH' ) || exit;
|
defined( 'ABSPATH' ) || exit;
|
||||||
|
|
|
@ -5,7 +5,7 @@
|
||||||
* @package WooCommerce/Blocks
|
* @package WooCommerce/Blocks
|
||||||
*/
|
*/
|
||||||
|
|
||||||
namespace Automattic\WooCommerce\Blocks\RestApi\StoreApi\Schemas;
|
namespace Automattic\WooCommerce\Blocks\StoreApi\Schemas;
|
||||||
|
|
||||||
defined( 'ABSPATH' ) || exit;
|
defined( 'ABSPATH' ) || exit;
|
||||||
|
|
|
@ -5,7 +5,7 @@
|
||||||
* @package WooCommerce/Blocks
|
* @package WooCommerce/Blocks
|
||||||
*/
|
*/
|
||||||
|
|
||||||
namespace Automattic\WooCommerce\Blocks\RestApi\StoreApi\Schemas;
|
namespace Automattic\WooCommerce\Blocks\StoreApi\Schemas;
|
||||||
|
|
||||||
defined( 'ABSPATH' ) || exit;
|
defined( 'ABSPATH' ) || exit;
|
||||||
|
|
|
@ -5,7 +5,7 @@
|
||||||
* @package WooCommerce/Blocks
|
* @package WooCommerce/Blocks
|
||||||
*/
|
*/
|
||||||
|
|
||||||
namespace Automattic\WooCommerce\Blocks\RestApi\StoreApi\Schemas;
|
namespace Automattic\WooCommerce\Blocks\StoreApi\Schemas;
|
||||||
|
|
||||||
defined( 'ABSPATH' ) || exit;
|
defined( 'ABSPATH' ) || exit;
|
||||||
|
|
|
@ -5,7 +5,7 @@
|
||||||
* @package WooCommerce/Blocks
|
* @package WooCommerce/Blocks
|
||||||
*/
|
*/
|
||||||
|
|
||||||
namespace Automattic\WooCommerce\Blocks\RestApi\StoreApi\Schemas;
|
namespace Automattic\WooCommerce\Blocks\StoreApi\Schemas;
|
||||||
|
|
||||||
defined( 'ABSPATH' ) || exit;
|
defined( 'ABSPATH' ) || exit;
|
||||||
|
|
|
@ -5,12 +5,12 @@
|
||||||
* @package WooCommerce/Blocks
|
* @package WooCommerce/Blocks
|
||||||
*/
|
*/
|
||||||
|
|
||||||
namespace Automattic\WooCommerce\Blocks\RestApi\StoreApi\Utilities;
|
namespace Automattic\WooCommerce\Blocks\StoreApi\Utilities;
|
||||||
|
|
||||||
defined( 'ABSPATH' ) || exit;
|
defined( 'ABSPATH' ) || exit;
|
||||||
|
|
||||||
use Automattic\WooCommerce\Blocks\RestApi\StoreApi\Routes\RouteException;
|
use Automattic\WooCommerce\Blocks\StoreApi\Routes\RouteException;
|
||||||
use Automattic\WooCommerce\Blocks\RestApi\StoreApi\Utilities\NoticeHandler;
|
use Automattic\WooCommerce\Blocks\StoreApi\Utilities\NoticeHandler;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Woo Cart Controller class.
|
* Woo Cart Controller class.
|
||||||
|
@ -630,7 +630,7 @@ class CartController {
|
||||||
if ( \class_exists( '\Automattic\WooCommerce\Checkout\Helpers\ReserveStock' ) ) {
|
if ( \class_exists( '\Automattic\WooCommerce\Checkout\Helpers\ReserveStock' ) ) {
|
||||||
$reserve_stock_controller = new \Automattic\WooCommerce\Checkout\Helpers\ReserveStock();
|
$reserve_stock_controller = new \Automattic\WooCommerce\Checkout\Helpers\ReserveStock();
|
||||||
} else {
|
} else {
|
||||||
$reserve_stock_controller = new \Automattic\WooCommerce\Blocks\RestApi\StoreApi\Utilities\ReserveStock();
|
$reserve_stock_controller = new \Automattic\WooCommerce\Blocks\StoreApi\Utilities\ReserveStock();
|
||||||
}
|
}
|
||||||
|
|
||||||
$draft_order = wc()->session->get( 'store_api_draft_order', 0 );
|
$draft_order = wc()->session->get( 'store_api_draft_order', 0 );
|
|
@ -5,11 +5,11 @@
|
||||||
* @package WooCommerce/Blocks
|
* @package WooCommerce/Blocks
|
||||||
*/
|
*/
|
||||||
|
|
||||||
namespace Automattic\WooCommerce\Blocks\RestApi\StoreApi\Utilities;
|
namespace Automattic\WooCommerce\Blocks\StoreApi\Utilities;
|
||||||
|
|
||||||
defined( 'ABSPATH' ) || exit;
|
defined( 'ABSPATH' ) || exit;
|
||||||
|
|
||||||
use Automattic\WooCommerce\Blocks\RestApi\StoreApi\Routes\RouteException;
|
use Automattic\WooCommerce\Blocks\StoreApi\Routes\RouteException;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* NoticeHandler class.
|
* NoticeHandler class.
|
|
@ -5,11 +5,11 @@
|
||||||
* @package WooCommerce/Blocks
|
* @package WooCommerce/Blocks
|
||||||
*/
|
*/
|
||||||
|
|
||||||
namespace Automattic\WooCommerce\Blocks\RestApi\StoreApi\Utilities;
|
namespace Automattic\WooCommerce\Blocks\StoreApi\Utilities;
|
||||||
|
|
||||||
defined( 'ABSPATH' ) || exit;
|
defined( 'ABSPATH' ) || exit;
|
||||||
|
|
||||||
use Automattic\WooCommerce\Blocks\RestApi\StoreApi\Routes\RouteException;
|
use Automattic\WooCommerce\Blocks\StoreApi\Routes\RouteException;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* OrderController class.
|
* OrderController class.
|
|
@ -5,7 +5,7 @@
|
||||||
* @package Automattic/WooCommerce/RestApi
|
* @package Automattic/WooCommerce/RestApi
|
||||||
*/
|
*/
|
||||||
|
|
||||||
namespace Automattic\WooCommerce\Blocks\RestApi\StoreApi\Utilities;
|
namespace Automattic\WooCommerce\Blocks\StoreApi\Utilities;
|
||||||
|
|
||||||
defined( 'ABSPATH' ) || exit;
|
defined( 'ABSPATH' ) || exit;
|
||||||
|
|
|
@ -5,11 +5,11 @@
|
||||||
* @package Automattic/WooCommerce/RestApi
|
* @package Automattic/WooCommerce/RestApi
|
||||||
*/
|
*/
|
||||||
|
|
||||||
namespace Automattic\WooCommerce\Blocks\RestApi\StoreApi\Utilities;
|
namespace Automattic\WooCommerce\Blocks\StoreApi\Utilities;
|
||||||
|
|
||||||
defined( 'ABSPATH' ) || exit;
|
defined( 'ABSPATH' ) || exit;
|
||||||
|
|
||||||
use Automattic\WooCommerce\Blocks\RestApi\StoreApi\Utilities\ProductQuery;
|
use Automattic\WooCommerce\Blocks\StoreApi\Utilities\ProductQuery;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Product Query filters class.
|
* Product Query filters class.
|
|
@ -5,11 +5,11 @@
|
||||||
* @package WooCommerce/Blocks
|
* @package WooCommerce/Blocks
|
||||||
*/
|
*/
|
||||||
|
|
||||||
namespace Automattic\WooCommerce\Blocks\RestApi\StoreApi\Utilities;
|
namespace Automattic\WooCommerce\Blocks\StoreApi\Utilities;
|
||||||
|
|
||||||
defined( 'ABSPATH' ) || exit;
|
defined( 'ABSPATH' ) || exit;
|
||||||
|
|
||||||
use \WC_Tax;
|
use WC_Tax;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Product Query class.
|
* Product Query class.
|
|
@ -5,7 +5,7 @@
|
||||||
* @package WooCommerce/Blocks
|
* @package WooCommerce/Blocks
|
||||||
*/
|
*/
|
||||||
|
|
||||||
namespace Automattic\WooCommerce\Blocks\RestApi\StoreApi\Utilities;
|
namespace Automattic\WooCommerce\Blocks\StoreApi\Utilities;
|
||||||
|
|
||||||
defined( 'ABSPATH' ) || exit;
|
defined( 'ABSPATH' ) || exit;
|
||||||
|
|
|
@ -5,7 +5,7 @@
|
||||||
* @package WooCommerce/Blocks
|
* @package WooCommerce/Blocks
|
||||||
*/
|
*/
|
||||||
|
|
||||||
namespace Automattic\WooCommerce\Blocks\RestApi\StoreApi\Utilities;
|
namespace Automattic\WooCommerce\Blocks\StoreApi\Utilities;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* ReserveStockException class.
|
* ReserveStockException class.
|
|
@ -5,7 +5,7 @@
|
||||||
* @package WooCommerce/Blocks
|
* @package WooCommerce/Blocks
|
||||||
*/
|
*/
|
||||||
|
|
||||||
namespace Automattic\WooCommerce\Blocks\RestApi\StoreApi\Utilities;
|
namespace Automattic\WooCommerce\Blocks\StoreApi\Utilities;
|
||||||
|
|
||||||
defined( 'ABSPATH' ) || exit;
|
defined( 'ABSPATH' ) || exit;
|
||||||
|
|
|
@ -9,7 +9,7 @@
|
||||||
|
|
||||||
namespace Automattic\WooCommerce\Blocks\Utils;
|
namespace Automattic\WooCommerce\Blocks\Utils;
|
||||||
|
|
||||||
use \WP_Query;
|
use WP_Query;
|
||||||
|
|
||||||
defined( 'ABSPATH' ) || exit;
|
defined( 'ABSPATH' ) || exit;
|
||||||
|
|
||||||
|
|
|
@ -5,7 +5,7 @@
|
||||||
* @package WooCommerce\Blocks\Tests
|
* @package WooCommerce\Blocks\Tests
|
||||||
*/
|
*/
|
||||||
|
|
||||||
namespace Automattic\WooCommerce\Blocks\Tests\RestApi\StoreApi\Controllers;
|
namespace Automattic\WooCommerce\Blocks\Tests\StoreApi\Controllers;
|
||||||
|
|
||||||
use \WP_REST_Request;
|
use \WP_REST_Request;
|
||||||
use \WC_REST_Unit_Test_Case as TestCase;
|
use \WC_REST_Unit_Test_Case as TestCase;
|
||||||
|
@ -352,7 +352,7 @@ class Cart extends TestCase {
|
||||||
* Test conversion of cart item to rest response.
|
* Test conversion of cart item to rest response.
|
||||||
*/
|
*/
|
||||||
public function test_prepare_item_for_response() {
|
public function test_prepare_item_for_response() {
|
||||||
$routes = new \Automattic\WooCommerce\Blocks\RestApi\StoreApi\RoutesController( new \Automattic\WooCommerce\Blocks\RestApi\StoreApi\SchemaController() );
|
$routes = new \Automattic\WooCommerce\Blocks\StoreApi\RoutesController( new \Automattic\WooCommerce\Blocks\StoreApi\SchemaController() );
|
||||||
$controller = $routes->get( 'cart' );
|
$controller = $routes->get( 'cart' );
|
||||||
$cart = wc()->cart;
|
$cart = wc()->cart;
|
||||||
$response = $controller->prepare_item_for_response( $cart, new \WP_REST_Request() );
|
$response = $controller->prepare_item_for_response( $cart, new \WP_REST_Request() );
|
||||||
|
@ -372,7 +372,7 @@ class Cart extends TestCase {
|
||||||
* Test schema matches responses.
|
* Test schema matches responses.
|
||||||
*/
|
*/
|
||||||
public function test_schema_matches_response() {
|
public function test_schema_matches_response() {
|
||||||
$routes = new \Automattic\WooCommerce\Blocks\RestApi\StoreApi\RoutesController( new \Automattic\WooCommerce\Blocks\RestApi\StoreApi\SchemaController() );
|
$routes = new \Automattic\WooCommerce\Blocks\StoreApi\RoutesController( new \Automattic\WooCommerce\Blocks\StoreApi\SchemaController() );
|
||||||
$controller = $routes->get( 'cart' );
|
$controller = $routes->get( 'cart' );
|
||||||
$schema = $controller->get_item_schema();
|
$schema = $controller->get_item_schema();
|
||||||
$cart = wc()->cart;
|
$cart = wc()->cart;
|
|
@ -5,7 +5,7 @@
|
||||||
* @package WooCommerce\Blocks\Tests
|
* @package WooCommerce\Blocks\Tests
|
||||||
*/
|
*/
|
||||||
|
|
||||||
namespace Automattic\WooCommerce\Blocks\Tests\RestApi\StoreApi\Controllers;
|
namespace Automattic\WooCommerce\Blocks\Tests\StoreApi\Controllers;
|
||||||
|
|
||||||
use \WP_REST_Request;
|
use \WP_REST_Request;
|
||||||
use \WC_REST_Unit_Test_Case as TestCase;
|
use \WC_REST_Unit_Test_Case as TestCase;
|
||||||
|
@ -156,7 +156,7 @@ class CartCoupons extends TestCase {
|
||||||
* Test conversion of cart item to rest response.
|
* Test conversion of cart item to rest response.
|
||||||
*/
|
*/
|
||||||
public function test_prepare_item_for_response() {
|
public function test_prepare_item_for_response() {
|
||||||
$routes = new \Automattic\WooCommerce\Blocks\RestApi\StoreApi\RoutesController( new \Automattic\WooCommerce\Blocks\RestApi\StoreApi\SchemaController() );
|
$routes = new \Automattic\WooCommerce\Blocks\StoreApi\RoutesController( new \Automattic\WooCommerce\Blocks\StoreApi\SchemaController() );
|
||||||
$controller = $routes->get( 'cart-coupons' );
|
$controller = $routes->get( 'cart-coupons' );
|
||||||
|
|
||||||
$response = $controller->prepare_item_for_response( $this->coupon->get_code(), new \WP_REST_Request() );
|
$response = $controller->prepare_item_for_response( $this->coupon->get_code(), new \WP_REST_Request() );
|
||||||
|
@ -170,7 +170,7 @@ class CartCoupons extends TestCase {
|
||||||
* Test schema matches responses.
|
* Test schema matches responses.
|
||||||
*/
|
*/
|
||||||
public function test_schema_matches_response() {
|
public function test_schema_matches_response() {
|
||||||
$routes = new \Automattic\WooCommerce\Blocks\RestApi\StoreApi\RoutesController( new \Automattic\WooCommerce\Blocks\RestApi\StoreApi\SchemaController() );
|
$routes = new \Automattic\WooCommerce\Blocks\StoreApi\RoutesController( new \Automattic\WooCommerce\Blocks\StoreApi\SchemaController() );
|
||||||
$controller = $routes->get( 'cart-coupons' );
|
$controller = $routes->get( 'cart-coupons' );
|
||||||
$schema = $controller->get_item_schema();
|
$schema = $controller->get_item_schema();
|
||||||
$response = $controller->prepare_item_for_response( $this->coupon->get_code(), new \WP_REST_Request() );
|
$response = $controller->prepare_item_for_response( $this->coupon->get_code(), new \WP_REST_Request() );
|
|
@ -5,7 +5,7 @@
|
||||||
* @package WooCommerce\Blocks\Tests
|
* @package WooCommerce\Blocks\Tests
|
||||||
*/
|
*/
|
||||||
|
|
||||||
namespace Automattic\WooCommerce\Blocks\Tests\RestApi\StoreApi\Controllers;
|
namespace Automattic\WooCommerce\Blocks\Tests\StoreApi\Controllers;
|
||||||
|
|
||||||
use \WP_REST_Request;
|
use \WP_REST_Request;
|
||||||
use \WC_REST_Unit_Test_Case as TestCase;
|
use \WC_REST_Unit_Test_Case as TestCase;
|
||||||
|
@ -212,7 +212,7 @@ class CartItems extends TestCase {
|
||||||
* Test conversion of cart item to rest response.
|
* Test conversion of cart item to rest response.
|
||||||
*/
|
*/
|
||||||
public function test_prepare_item_for_response() {
|
public function test_prepare_item_for_response() {
|
||||||
$routes = new \Automattic\WooCommerce\Blocks\RestApi\StoreApi\RoutesController( new \Automattic\WooCommerce\Blocks\RestApi\StoreApi\SchemaController() );
|
$routes = new \Automattic\WooCommerce\Blocks\StoreApi\RoutesController( new \Automattic\WooCommerce\Blocks\StoreApi\SchemaController() );
|
||||||
$controller = $routes->get( 'cart-items' );
|
$controller = $routes->get( 'cart-items' );
|
||||||
$cart = wc()->cart->get_cart();
|
$cart = wc()->cart->get_cart();
|
||||||
$response = $controller->prepare_item_for_response( current( $cart ), new \WP_REST_Request() );
|
$response = $controller->prepare_item_for_response( current( $cart ), new \WP_REST_Request() );
|
||||||
|
@ -238,7 +238,7 @@ class CartItems extends TestCase {
|
||||||
* Tests schema of both products in cart to cover as much schema as possible.
|
* Tests schema of both products in cart to cover as much schema as possible.
|
||||||
*/
|
*/
|
||||||
public function test_schema_matches_response() {
|
public function test_schema_matches_response() {
|
||||||
$routes = new \Automattic\WooCommerce\Blocks\RestApi\StoreApi\RoutesController( new \Automattic\WooCommerce\Blocks\RestApi\StoreApi\SchemaController() );
|
$routes = new \Automattic\WooCommerce\Blocks\StoreApi\RoutesController( new \Automattic\WooCommerce\Blocks\StoreApi\SchemaController() );
|
||||||
$controller = $routes->get( 'cart-items' );
|
$controller = $routes->get( 'cart-items' );
|
||||||
$schema = $controller->get_item_schema();
|
$schema = $controller->get_item_schema();
|
||||||
$cart = wc()->cart->get_cart();
|
$cart = wc()->cart->get_cart();
|
|
@ -5,7 +5,7 @@
|
||||||
* @package WooCommerce\Blocks\Tests
|
* @package WooCommerce\Blocks\Tests
|
||||||
*/
|
*/
|
||||||
|
|
||||||
namespace Automattic\WooCommerce\Blocks\Tests\RestApi\StoreApi\Controllers;
|
namespace Automattic\WooCommerce\Blocks\Tests\StoreApi\Controllers;
|
||||||
|
|
||||||
use \WP_REST_Request;
|
use \WP_REST_Request;
|
||||||
use \WC_REST_Unit_Test_Case as TestCase;
|
use \WC_REST_Unit_Test_Case as TestCase;
|
||||||
|
@ -68,8 +68,8 @@ class ProductAttributeTerms extends TestCase {
|
||||||
* Test conversion of product to rest response.
|
* Test conversion of product to rest response.
|
||||||
*/
|
*/
|
||||||
public function test_prepare_item_for_response() {
|
public function test_prepare_item_for_response() {
|
||||||
$schema = new \Automattic\WooCommerce\Blocks\RestApi\StoreApi\Schemas\TermSchema();
|
$schema = new \Automattic\WooCommerce\Blocks\StoreApi\Schemas\TermSchema();
|
||||||
$controller = new \Automattic\WooCommerce\Blocks\RestApi\StoreApi\Routes\ProductAttributeTerms( $schema );
|
$controller = new \Automattic\WooCommerce\Blocks\StoreApi\Routes\ProductAttributeTerms( $schema );
|
||||||
$response = $controller->prepare_item_for_response( get_term_by( 'name', 'test', 'pa_size' ), new \WP_REST_Request() );
|
$response = $controller->prepare_item_for_response( get_term_by( 'name', 'test', 'pa_size' ), new \WP_REST_Request() );
|
||||||
$data = $response->get_data();
|
$data = $response->get_data();
|
||||||
|
|
||||||
|
@ -84,7 +84,7 @@ class ProductAttributeTerms extends TestCase {
|
||||||
* Test collection params getter.
|
* Test collection params getter.
|
||||||
*/
|
*/
|
||||||
public function test_get_collection_params() {
|
public function test_get_collection_params() {
|
||||||
$routes = new \Automattic\WooCommerce\Blocks\RestApi\StoreApi\RoutesController( new \Automattic\WooCommerce\Blocks\RestApi\StoreApi\SchemaController() );
|
$routes = new \Automattic\WooCommerce\Blocks\StoreApi\RoutesController( new \Automattic\WooCommerce\Blocks\StoreApi\SchemaController() );
|
||||||
$controller = $routes->get( 'product-attribute-terms' );
|
$controller = $routes->get( 'product-attribute-terms' );
|
||||||
$params = $controller->get_collection_params();
|
$params = $controller->get_collection_params();
|
||||||
|
|
||||||
|
@ -97,7 +97,7 @@ class ProductAttributeTerms extends TestCase {
|
||||||
* Test schema matches responses.
|
* Test schema matches responses.
|
||||||
*/
|
*/
|
||||||
public function test_schema_matches_response() {
|
public function test_schema_matches_response() {
|
||||||
$routes = new \Automattic\WooCommerce\Blocks\RestApi\StoreApi\RoutesController( new \Automattic\WooCommerce\Blocks\RestApi\StoreApi\SchemaController() );
|
$routes = new \Automattic\WooCommerce\Blocks\StoreApi\RoutesController( new \Automattic\WooCommerce\Blocks\StoreApi\SchemaController() );
|
||||||
$controller = $routes->get( 'product-attribute-terms' );
|
$controller = $routes->get( 'product-attribute-terms' );
|
||||||
$schema = $controller->get_item_schema();
|
$schema = $controller->get_item_schema();
|
||||||
$response = $controller->prepare_item_for_response( get_term_by( 'name', 'test', 'pa_size' ), new \WP_REST_Request() );
|
$response = $controller->prepare_item_for_response( get_term_by( 'name', 'test', 'pa_size' ), new \WP_REST_Request() );
|
|
@ -5,7 +5,7 @@
|
||||||
* @package WooCommerce\Blocks\Tests
|
* @package WooCommerce\Blocks\Tests
|
||||||
*/
|
*/
|
||||||
|
|
||||||
namespace Automattic\WooCommerce\Blocks\Tests\RestApi\StoreApi\Controllers;
|
namespace Automattic\WooCommerce\Blocks\Tests\StoreApi\Controllers;
|
||||||
|
|
||||||
use \WP_REST_Request;
|
use \WP_REST_Request;
|
||||||
use \WC_REST_Unit_Test_Case as TestCase;
|
use \WC_REST_Unit_Test_Case as TestCase;
|
||||||
|
@ -78,7 +78,7 @@ class ProductAttributes extends TestCase {
|
||||||
* Test conversion of product to rest response.
|
* Test conversion of product to rest response.
|
||||||
*/
|
*/
|
||||||
public function test_prepare_item_for_response() {
|
public function test_prepare_item_for_response() {
|
||||||
$routes = new \Automattic\WooCommerce\Blocks\RestApi\StoreApi\RoutesController( new \Automattic\WooCommerce\Blocks\RestApi\StoreApi\SchemaController() );
|
$routes = new \Automattic\WooCommerce\Blocks\StoreApi\RoutesController( new \Automattic\WooCommerce\Blocks\StoreApi\SchemaController() );
|
||||||
$controller = $routes->get( 'product-attributes' );
|
$controller = $routes->get( 'product-attributes' );
|
||||||
$response = $controller->prepare_item_for_response( $this->attributes[0], new \WP_REST_Request() );
|
$response = $controller->prepare_item_for_response( $this->attributes[0], new \WP_REST_Request() );
|
||||||
$data = $response->get_data();
|
$data = $response->get_data();
|
||||||
|
@ -95,7 +95,7 @@ class ProductAttributes extends TestCase {
|
||||||
* Test schema matches responses.
|
* Test schema matches responses.
|
||||||
*/
|
*/
|
||||||
public function test_schema_matches_response() {
|
public function test_schema_matches_response() {
|
||||||
$routes = new \Automattic\WooCommerce\Blocks\RestApi\StoreApi\RoutesController( new \Automattic\WooCommerce\Blocks\RestApi\StoreApi\SchemaController() );
|
$routes = new \Automattic\WooCommerce\Blocks\StoreApi\RoutesController( new \Automattic\WooCommerce\Blocks\StoreApi\SchemaController() );
|
||||||
$controller = $routes->get( 'product-attributes' );
|
$controller = $routes->get( 'product-attributes' );
|
||||||
$schema = $controller->get_item_schema();
|
$schema = $controller->get_item_schema();
|
||||||
$response = $controller->prepare_item_for_response( $this->attributes[0], new \WP_REST_Request() );
|
$response = $controller->prepare_item_for_response( $this->attributes[0], new \WP_REST_Request() );
|
|
@ -5,7 +5,7 @@
|
||||||
* @package WooCommerce\Blocks\Tests
|
* @package WooCommerce\Blocks\Tests
|
||||||
*/
|
*/
|
||||||
|
|
||||||
namespace Automattic\WooCommerce\Blocks\Tests\RestApi\StoreApi\Controllers;
|
namespace Automattic\WooCommerce\Blocks\Tests\StoreApi\Controllers;
|
||||||
|
|
||||||
use \WP_REST_Request;
|
use \WP_REST_Request;
|
||||||
use \WC_REST_Unit_Test_Case as TestCase;
|
use \WC_REST_Unit_Test_Case as TestCase;
|
||||||
|
@ -163,7 +163,7 @@ class ProductCollectionData extends TestCase {
|
||||||
* Test collection params getter.
|
* Test collection params getter.
|
||||||
*/
|
*/
|
||||||
public function test_get_collection_params() {
|
public function test_get_collection_params() {
|
||||||
$routes = new \Automattic\WooCommerce\Blocks\RestApi\StoreApi\RoutesController( new \Automattic\WooCommerce\Blocks\RestApi\StoreApi\SchemaController() );
|
$routes = new \Automattic\WooCommerce\Blocks\StoreApi\RoutesController( new \Automattic\WooCommerce\Blocks\StoreApi\SchemaController() );
|
||||||
$controller = $routes->get( 'product-collection-data' );
|
$controller = $routes->get( 'product-collection-data' );
|
||||||
$params = $controller->get_collection_params();
|
$params = $controller->get_collection_params();
|
||||||
|
|
||||||
|
@ -178,7 +178,7 @@ class ProductCollectionData extends TestCase {
|
||||||
public function test_schema_matches_response() {
|
public function test_schema_matches_response() {
|
||||||
ProductHelper::create_variation_product();
|
ProductHelper::create_variation_product();
|
||||||
|
|
||||||
$routes = new \Automattic\WooCommerce\Blocks\RestApi\StoreApi\RoutesController( new \Automattic\WooCommerce\Blocks\RestApi\StoreApi\SchemaController() );
|
$routes = new \Automattic\WooCommerce\Blocks\StoreApi\RoutesController( new \Automattic\WooCommerce\Blocks\StoreApi\SchemaController() );
|
||||||
$controller = $routes->get( 'product-collection-data' );
|
$controller = $routes->get( 'product-collection-data' );
|
||||||
$schema = $controller->get_item_schema();
|
$schema = $controller->get_item_schema();
|
||||||
|
|
|
@ -5,7 +5,7 @@
|
||||||
* @package WooCommerce\Blocks\Tests
|
* @package WooCommerce\Blocks\Tests
|
||||||
*/
|
*/
|
||||||
|
|
||||||
namespace Automattic\WooCommerce\Blocks\Tests\RestApi\StoreApi\Controllers;
|
namespace Automattic\WooCommerce\Blocks\Tests\StoreApi\Controllers;
|
||||||
|
|
||||||
use \WP_REST_Request;
|
use \WP_REST_Request;
|
||||||
use \WC_REST_Unit_Test_Case as TestCase;
|
use \WC_REST_Unit_Test_Case as TestCase;
|
||||||
|
@ -103,8 +103,8 @@ class Products extends TestCase {
|
||||||
* Test conversion of prdouct to rest response.
|
* Test conversion of prdouct to rest response.
|
||||||
*/
|
*/
|
||||||
public function test_prepare_item_for_response() {
|
public function test_prepare_item_for_response() {
|
||||||
$schemas = new \Automattic\WooCommerce\Blocks\RestApi\StoreApi\SchemaController();
|
$schemas = new \Automattic\WooCommerce\Blocks\StoreApi\SchemaController();
|
||||||
$routes = new \Automattic\WooCommerce\Blocks\RestApi\StoreApi\RoutesController( $schemas );
|
$routes = new \Automattic\WooCommerce\Blocks\StoreApi\RoutesController( $schemas );
|
||||||
$schema = $schemas->get( 'product' );
|
$schema = $schemas->get( 'product' );
|
||||||
$controller = $routes->get( 'products' );
|
$controller = $routes->get( 'products' );
|
||||||
$response = $controller->prepare_item_for_response( $this->products[0], new \WP_REST_Request() );
|
$response = $controller->prepare_item_for_response( $this->products[0], new \WP_REST_Request() );
|
||||||
|
@ -131,7 +131,7 @@ class Products extends TestCase {
|
||||||
* Test collection params getter.
|
* Test collection params getter.
|
||||||
*/
|
*/
|
||||||
public function test_get_collection_params() {
|
public function test_get_collection_params() {
|
||||||
$routes = new \Automattic\WooCommerce\Blocks\RestApi\StoreApi\RoutesController( new \Automattic\WooCommerce\Blocks\RestApi\StoreApi\SchemaController() );
|
$routes = new \Automattic\WooCommerce\Blocks\StoreApi\RoutesController( new \Automattic\WooCommerce\Blocks\StoreApi\SchemaController() );
|
||||||
$controller = $routes->get( 'products' );
|
$controller = $routes->get( 'products' );
|
||||||
$params = $controller->get_collection_params();
|
$params = $controller->get_collection_params();
|
||||||
|
|
||||||
|
@ -169,7 +169,7 @@ class Products extends TestCase {
|
||||||
* Test schema matches responses.
|
* Test schema matches responses.
|
||||||
*/
|
*/
|
||||||
public function test_schema_matches_response() {
|
public function test_schema_matches_response() {
|
||||||
$routes = new \Automattic\WooCommerce\Blocks\RestApi\StoreApi\RoutesController( new \Automattic\WooCommerce\Blocks\RestApi\StoreApi\SchemaController() );
|
$routes = new \Automattic\WooCommerce\Blocks\StoreApi\RoutesController( new \Automattic\WooCommerce\Blocks\StoreApi\SchemaController() );
|
||||||
$controller = $routes->get( 'products' );
|
$controller = $routes->get( 'products' );
|
||||||
$schema = $controller->get_item_schema();
|
$schema = $controller->get_item_schema();
|
||||||
$response = $controller->prepare_item_for_response( $this->products[0], new \WP_REST_Request() );
|
$response = $controller->prepare_item_for_response( $this->products[0], new \WP_REST_Request() );
|
|
@ -5,12 +5,12 @@
|
||||||
* @package WooCommerce\Blocks\Tests
|
* @package WooCommerce\Blocks\Tests
|
||||||
*/
|
*/
|
||||||
|
|
||||||
namespace Automattic\WooCommerce\Blocks\Tests\RestApi\StoreApi\Utilities;
|
namespace Automattic\WooCommerce\Blocks\Tests\StoreApi\Utilities;
|
||||||
|
|
||||||
use PHPUnit\Framework\TestCase;
|
use PHPUnit\Framework\TestCase;
|
||||||
use \WC_Helper_Order as OrderHelper;
|
use \WC_Helper_Order as OrderHelper;
|
||||||
use \WC_Helper_Product as ProductHelper;
|
use \WC_Helper_Product as ProductHelper;
|
||||||
use Automattic\WooCommerce\Blocks\RestApi\StoreApi\Utilities\ReserveStock;
|
use Automattic\WooCommerce\Blocks\StoreApi\Utilities\ReserveStock;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* ReserveStock Utility Tests.
|
* ReserveStock Utility Tests.
|
||||||
|
@ -47,7 +47,7 @@ class ReserveStockTests extends TestCase {
|
||||||
/**
|
/**
|
||||||
* Test that trying to reserve stock too much throws an exception.
|
* Test that trying to reserve stock too much throws an exception.
|
||||||
*
|
*
|
||||||
* @expectedException Automattic\WooCommerce\Blocks\RestApi\StoreApi\Utilities\ReserveStockException
|
* @expectedException Automattic\WooCommerce\Blocks\StoreApi\Utilities\ReserveStockException
|
||||||
*/
|
*/
|
||||||
public function test_reserve_stock_for_order_throws_exception() {
|
public function test_reserve_stock_for_order_throws_exception() {
|
||||||
$class = new ReserveStock();
|
$class = new ReserveStock();
|
Loading…
Reference in New Issue