Plugin Updates
This commit is contained in:
@@ -289,6 +289,25 @@ class WC_REST_Orders_V2_Controller extends WC_REST_CRUD_Controller {
|
||||
);
|
||||
}
|
||||
|
||||
// Add additional applied coupon information.
|
||||
if ( $item instanceof WC_Order_Item_Coupon ) {
|
||||
$temp_coupon = new WC_Coupon();
|
||||
$coupon_info = $item->get_meta( 'coupon_info', true );
|
||||
if ( $coupon_info ) {
|
||||
$temp_coupon->set_short_info( $coupon_info );
|
||||
} else {
|
||||
$coupon_meta = $item->get_meta( 'coupon_data', true );
|
||||
if ( $coupon_meta ) {
|
||||
$temp_coupon->set_props( (array) $coupon_meta );
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
$data['discount_type'] = $temp_coupon->get_discount_type();
|
||||
$data['nominal_amount'] = (float) $temp_coupon->get_amount();
|
||||
$data['free_shipping'] = $temp_coupon->get_free_shipping();
|
||||
}
|
||||
|
||||
$data['meta_data'] = array_map(
|
||||
array( $this, 'merge_meta_item_with_formatted_meta_display_attributes' ),
|
||||
$data['meta_data'],
|
||||
@@ -1849,29 +1868,47 @@ class WC_REST_Orders_V2_Controller extends WC_REST_CRUD_Controller {
|
||||
'items' => array(
|
||||
'type' => 'object',
|
||||
'properties' => array(
|
||||
'id' => array(
|
||||
'id' => array(
|
||||
'description' => __( 'Item ID.', 'woocommerce' ),
|
||||
'type' => 'integer',
|
||||
'context' => array( 'view', 'edit' ),
|
||||
'readonly' => true,
|
||||
),
|
||||
'code' => array(
|
||||
'code' => array(
|
||||
'description' => __( 'Coupon code.', 'woocommerce' ),
|
||||
'type' => 'mixed',
|
||||
'context' => array( 'view', 'edit' ),
|
||||
),
|
||||
'discount' => array(
|
||||
'discount' => array(
|
||||
'description' => __( 'Discount total.', 'woocommerce' ),
|
||||
'type' => 'string',
|
||||
'context' => array( 'view', 'edit' ),
|
||||
),
|
||||
'discount_tax' => array(
|
||||
'discount_tax' => array(
|
||||
'description' => __( 'Discount total tax.', 'woocommerce' ),
|
||||
'type' => 'string',
|
||||
'context' => array( 'view', 'edit' ),
|
||||
'readonly' => true,
|
||||
),
|
||||
'meta_data' => array(
|
||||
'discount_type' => array(
|
||||
'description' => __( 'Discount type.', 'woocommerce' ),
|
||||
'type' => 'string',
|
||||
'context' => array( 'view' ),
|
||||
'readonly' => true,
|
||||
),
|
||||
'nominal_amount' => array(
|
||||
'description' => __( 'Discount amount as defined in the coupon (absolute value or a percent, depending on the discount type).', 'woocommerce' ),
|
||||
'type' => 'number',
|
||||
'context' => array( 'view' ),
|
||||
'readonly' => true,
|
||||
),
|
||||
'free_shipping' => array(
|
||||
'description' => __( 'Whether the coupon grants free shipping or not.', 'woocommerce' ),
|
||||
'type' => 'boolean',
|
||||
'context' => array( 'view' ),
|
||||
'readonly' => true,
|
||||
),
|
||||
'meta_data' => array(
|
||||
'description' => __( 'Meta data.', 'woocommerce' ),
|
||||
'type' => 'array',
|
||||
'context' => array( 'view', 'edit' ),
|
||||
|
||||
@@ -13,7 +13,8 @@ defined( 'ABSPATH' ) || exit;
|
||||
use Automattic\WooCommerce\Internal\WCCom\ConnectionHelper;
|
||||
use Automattic\WooCommerce\Internal\ProductDownloads\ApprovedDirectories\Register as Download_Directories;
|
||||
use Automattic\WooCommerce\Internal\DataStores\Orders\DataSynchronizer as Order_DataSynchronizer;
|
||||
use Automattic\WooCommerce\Utilities\OrderUtil;
|
||||
use Automattic\WooCommerce\Utilities\{ LoggingUtil, OrderUtil };
|
||||
|
||||
/**
|
||||
* System status controller class.
|
||||
*
|
||||
@@ -632,6 +633,44 @@ class WC_REST_System_Status_V2_Controller extends WC_REST_Controller {
|
||||
'type' => 'string',
|
||||
),
|
||||
),
|
||||
'logging' => array(
|
||||
'description' => __( 'Logging.', 'woocommerce' ),
|
||||
'type' => 'object',
|
||||
'context' => array( 'view' ),
|
||||
'readonly' => true,
|
||||
'properties' => array(
|
||||
'logging_enabled' => array(
|
||||
'description' => __( 'Is logging enabled?', 'woocommerce' ),
|
||||
'type' => 'boolean',
|
||||
'context' => array( 'view' ),
|
||||
'readonly' => true,
|
||||
),
|
||||
'default_handler' => array(
|
||||
'description' => __( 'The logging handler class.', 'woocommerce' ),
|
||||
'type' => 'string',
|
||||
'context' => array( 'view' ),
|
||||
'readonly' => true,
|
||||
),
|
||||
'retention_period_days' => array(
|
||||
'description' => __( 'The number of days log entries are retained.', 'woocommerce' ),
|
||||
'type' => 'integer',
|
||||
'context' => array( 'view' ),
|
||||
'readonly' => true,
|
||||
),
|
||||
'level_threshold' => array(
|
||||
'description' => __( 'Minimum severity level.', 'woocommerce' ),
|
||||
'type' => 'string',
|
||||
'context' => array( 'view' ),
|
||||
'readonly' => true,
|
||||
),
|
||||
'log_directory_size' => array(
|
||||
'description' => __( 'The size of the log directory.', 'woocommerce' ),
|
||||
'type' => 'string',
|
||||
'context' => array( 'view' ),
|
||||
'readonly' => true,
|
||||
),
|
||||
),
|
||||
),
|
||||
),
|
||||
);
|
||||
|
||||
@@ -646,7 +685,7 @@ class WC_REST_System_Status_V2_Controller extends WC_REST_Controller {
|
||||
*/
|
||||
public function get_item_mappings() {
|
||||
return array(
|
||||
'environment' => $this->get_environment_info(),
|
||||
'environment' => $this->get_environment_info_per_fields( array( 'environment' ) ),
|
||||
'database' => $this->get_database_info(),
|
||||
'active_plugins' => $this->get_active_plugins(),
|
||||
'inactive_plugins' => $this->get_inactive_plugins(),
|
||||
@@ -656,6 +695,7 @@ class WC_REST_System_Status_V2_Controller extends WC_REST_Controller {
|
||||
'security' => $this->get_security_info(),
|
||||
'pages' => $this->get_pages(),
|
||||
'post_type_counts' => $this->get_post_type_counts(),
|
||||
'logging' => $this->get_logging_info(),
|
||||
);
|
||||
}
|
||||
|
||||
@@ -704,6 +744,9 @@ class WC_REST_System_Status_V2_Controller extends WC_REST_Controller {
|
||||
case 'post_type_counts':
|
||||
$items['post_type_counts'] = $this->get_post_type_counts();
|
||||
break;
|
||||
case 'logging':
|
||||
$items['logging'] = $this->get_logging_info();
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1421,6 +1464,21 @@ class WC_REST_System_Status_V2_Controller extends WC_REST_Controller {
|
||||
return $pages_output;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get info about the logging system.
|
||||
*
|
||||
* @return array
|
||||
*/
|
||||
protected function get_logging_info() {
|
||||
return array(
|
||||
'logging_enabled' => LoggingUtil::logging_is_enabled(),
|
||||
'default_handler' => LoggingUtil::get_default_handler(),
|
||||
'retention_period_days' => LoggingUtil::get_retention_period(),
|
||||
'level_threshold' => WC_Log_Levels::get_level_label( strtolower( LoggingUtil::get_level_threshold() ) ),
|
||||
'log_directory_size' => size_format( LoggingUtil::get_log_directory_size() ),
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* Get any query params needed.
|
||||
*
|
||||
|
||||
Reference in New Issue
Block a user