report classes to determine which reports need to be updated on certain events. * * The index for each report's class is specified as its used later to determine when to schedule the report and we want * it to be consistently at the same time, regardless of the hook which triggered the cache update. The indexes are based * on the order of the reports in the menu on the WooCommerce > Reports > Subscriptions screen, which is why the indexes * are not sequential (because not all reports need caching). * */ private $update_events_and_classes = array('woocommerce_subscriptions_reports_schedule_cache_updates' => array( // a custom hook that can be called to schedule a full cache update, used by WC_Subscriptions_Upgrader 0 => 'WCS_Report_Dashboard', 1 => 'WCS_Report_Subscription_Events_By_Date', 2 => 'WCS_Report_Upcoming_Recurring_Revenue', 4 => 'WCS_Report_Subscription_By_Product', 5 => 'WCS_Report_Subscription_By_Customer', ), 'woocommerce_subscription_payment_complete' => array( // this hook takes care of renewal, switch and initial payments 0 => 'WCS_Report_Dashboard', 1 => 'WCS_Report_Subscription_Events_By_Date', 5 => 'WCS_Report_Subscription_By_Customer', ), 'woocommerce_subscriptions_switch_completed' => array(1 => 'WCS_Report_Subscription_Events_By_Date'), 'woocommerce_subscription_status_changed' => array( 0 => 'WCS_Report_Dashboard', 1 => 'WCS_Report_Subscription_Events_By_Date', // we really only need cancelled, expired and active status here, but we'll use a more generic hook for convenience 5 => 'WCS_Report_Subscription_By_Customer', ), 'woocommerce_subscription_status_active' => array(2 => 'WCS_Report_Upcoming_Recurring_Revenue'), 'woocommerce_new_order_item' => array(4 => 'WCS_Report_Subscription_By_Product'), 'woocommerce_update_order_item' => array(4 => 'WCS_Report_Subscription_By_Product')); /** * Record of all the report classes to need to have the cache updated during this request. Prevents duplicate updates in the same request for different events. */ private $reports_to_update = array(); /** * The hook name to use for our WP-Cron entry for updating report cache. */ private $cron_hook = 'wcs_report_update_cache'; /** * The hook name to use for our WP-Cron entry for updating report cache. */ protected $use_large_site_cache; /** * Attach callbacks to manage cache updates * * @since 2.1 */ public function __construct() { } /** * Check if the given hook has reports associated with it, and if so, add them to our $this->reports_to_update * property so we know to schedule an event to update their cache at the end of the request. * * This function is attached as a callback on the events in the $update_events_and_classes property. * * @since 2.1 * @return null */ public function set_reports_to_update() { } /** * At the end of the request, schedule cache updates for any events that occured during this request. * * For large sites, cache updates are run only once per day to avoid overloading the DB where the queries are very resource intensive * (as reported during beta testing in https://github.com/Prospress/woocommerce-subscriptions/issues/1732). We do this at 4am in the * site's timezone, which helps avoid running the queries during busy periods and also runs them after all the renewals for synchronised * subscriptions should have finished for the day (which begins at 3am and rarely takes more than 1 hours of processing to get through * an entire queue). * * This function is attached as a callback on 'shutdown' and will schedule cache updates for any reports found to need updates by * @see $this->set_reports_to_update(). * * @since 2.1 */ public function schedule_cache_updates() { } /** * Update the cache data for a given report, as specified with $report_class, by call it's get_data() method. * * @since 2.1 * @return null */ public function update_cache($report_class) { } /** * Boolean flag to check whether to use a the large site cache method or not, which is determined based on the number of * subscriptions and orders on the site (using arbitrary counts). * * @since 2.1 * @return bool */ protected function use_large_site_cache() { } /** * Make it clear to store owners that data for some reports can be out-of-date. * * @since 2.1 */ public function admin_notices() { } /** * Handle error instances that lead to an unexpected shutdown. * * This attempts to detect if there was an error, and proactively prevent errors * from piling up. * * @author Jeremy Pry */ public function catch_unexpected_shutdown() { } /** * Add system status information to include failure count and cache update status. * * @author Jeremy Pry * * @param array $data Existing status data. * * @return array Filtered status data. */ public function add_system_status_info($data) { } /** * Get the scheduled update cache time for large sites. * * @return int The timestamp of the next occurring 4 am in the site's timezone converted to UTC. */ protected function get_large_site_cache_update_timestamp() { } /** * Transfers the 'wcs_report_use_large_site_cache' option to the new 'wcs_is_large_site' option. * * In 3.0.7 we introduced a more general use option, 'wcs_is_large_site', replacing the need for one specifically * for report caching. This function migrates the existing option value if it was previously set. * * @since 3.0.7 * * @param string $new_version The new Subscriptions plugin version. * @param string $previous_version The version of Subscriptions prior to upgrade. */ public function transfer_large_site_cache_option($new_version, $previous_version) { } } class WCS_Report_Dashboard { /** * Hook in additional reporting to WooCommerce dashboard widget */ public function __construct() { } /** * Get all data needed for this report and store in the class */ public static function get_data($args = array()) { } /** * Add the subscription specific details to the bottom of the dashboard widget * * @since 2.1 */ public static function add_stats_to_dashboard() { } /** * Add the subscription specific details to the bottom of the dashboard widget * * @since 2.1 */ public static function dashboard_scripts() { } /** * Clears the cached report data. * * @since 3.0.10 */ public static function clear_cache() { } } /** * Subscriptions Admin Report - Retention Rate * * Find the number of periods between when each subscription is created and ends or ended * then plot all subscriptions using this data to provide a curve of retention rates. * * @package WooCommerce Subscriptions * @subpackage WC_Subscriptions_Admin_Reports * @category Class * @author Prospress * @since 2.1 */ class WCS_Report_Retention_Rate extends \WC_Admin_Report { public $chart_colours = array(); private $report_data; /** * Get report data * * @since 2.1 * @return array */ public function get_report_data() { } /** * Get the number of periods each subscription has between sign-up and end. * * This function uses a new "living" and "age" terminology to refer to the time between when a subscription * is created and when it ends (i.e. expires or is cancelled). The function can't use "active" because the * subscription may not have been active all of that time. Instead, it may have been on-hold for part of it. * * @since 2.1 * @return null */ private function query_report_data() { } /** * Output the report * * Use a custom report as we don't need the date filters provided by the WooCommerce html-report-by-date.php template. * * @since 2.1 * @return null */ public function output_report() { } /** * Output the HTML and JavaScript to plot the chart * * @since 2.1 * @return null */ public function get_main_chart() { } } /** * Subscriptions Admin Report - Subscriptions by customer * * Creates the subscription admin reports area. * * @package WooCommerce Subscriptions * @subpackage WC_Subscriptions_Admin_Reports * @category Class * @author Prospress * @since 2.1 */ class WCS_Report_Subscription_By_Customer extends \WP_List_Table { private $totals; /** * Constructor. */ public function __construct() { } /** * No subscription products found text. */ public function no_items() { } /** * Output the report. */ public function output_report() { } /** * Get column value. * * @param WP_User $user * @param string $column_name * @return string */ public function column_default($user, $column_name) { } /** * Get columns. * * @return array */ public function get_columns() { } /** * Prepare subscription list items. */ public function prepare_items() { } /** * Gather totals for customers */ public static function get_data($args = array()) { } /** * Clears the cached report data. * * @since 3.0.10 */ public static function clear_cache() { } } /** * Subscriptions Admin Report - Subscriptions by product * * Creates the subscription admin reports area. * * @package WooCommerce Subscriptions * @subpackage WC_Subscriptions_Admin_Reports * @category Class * @author Prospress * @since 2.1 */ class WCS_Report_Subscription_By_Product extends \WP_List_Table { /** * Constructor. */ public function __construct() { } /** * No subscription products found text. */ public function no_items() { } /** * Output the report. */ public function output_report() { } /** * Get column value. * * @param object $report_item * @param string $column_name * @return string */ public function column_default($report_item, $column_name) { } /** * Get columns. * * @return array */ public function get_columns() { } /** * Prepare subscription list items. */ public function prepare_items() { } /** * Get subscription product data, either from the cache or the database. */ public static function get_data($args = array()) { } /** * Output product breakdown chart. */ public function product_breakdown_chart() { } /** * Clears the cached report data. * * @since 3.0.10 */ public static function clear_cache() { } } /** * Subscriptions Admin Report - Subscription Events by Date * * Display important historical data for subscription revenue and events, like switches and cancellations. * * @package WooCommerce Subscriptions * @subpackage WC_Subscriptions_Admin_Reports * @category Class * @author Prospress * @since 2.1 */ class WCS_Report_Subscription_Events_By_Date extends \WC_Admin_Report { public $chart_colours = array(); private $report_data; private $generating_report; /** * Sets the query hash for saving the results to enable listing later. * * @since 2.6.0 * @param array $query The report query clause array. * @return array $query */ public function set_query_hash($query) { } /** * Get report data * @return array */ public function get_report_data() { } /** * Get all data needed for this report and store in the class */ public function get_data($args = array()) { } /** * Get the legend for the main chart sidebar * * @return array */ public function get_chart_legend() { } /** * Output the report */ public function output_report() { } /** * Output an export link */ public function get_export_button() { } /** * Get the main chart * * @return string */ public function get_main_chart() { } /** * Round our totals correctly. * @param string $amount * @return string */ private function round_chart_totals($amount) { } /** * Put data with post_date's into an array of times averaged by day * * If the data is grouped by day already, we can just call @see $this->prepare_chart_data() otherwise, * we need to figure out how many days in each period and average the aggregate over that count. * * @param array $data array of your data * @param string $date_key key for the 'date' field. e.g. 'post_date' * @param string $data_key key for the data you are charting * @param int $interval * @param string $start_date * @param string $group_by * @return array */ private function prepare_chart_data_daily_average($data, $date_key, $data_key, $interval, $start_date, $group_by) { } /** * Clears the cached report data. * * @since 3.0.10 */ public function clear_cache() { } } /** * Subscriptions Admin Report - Subscription Events by Date * * Creates the subscription admin reports area. * * @package WooCommerce Subscriptions * @subpackage WC_Subscriptions_Admin_Reports * @category Class * @author Prospress * @since 2.1 */ class WCS_Report_Subscription_Payment_Retry extends \WC_Admin_Report { private $chart_colours = array(); private $report_data; /** * Get report data * @return array */ public function get_report_data() { } /** * Get all data needed for this report and store in the class */ private function query_report_data() { } /** * Get the legend for the main chart sidebar * @return array */ public function get_chart_legend() { } /** * Output the report */ public function output_report() { } /** * Output an export link */ public function get_export_button() { } /** * Get the main chart * * @return string */ public function get_main_chart() { } /** * Round our totals correctly. * @param string $amount * @return string */ private function round_chart_totals($amount) { } } /** * Subscriptions Admin Report - Upcoming Recurring Revenue * * Display the renewal order count and revenue that will be processed for all currently active subscriptions * for a given period of time in the future. * * @package WooCommerce Subscriptions * @subpackage WC_Subscriptions_Admin_Reports * @category Class * @author Prospress * @since 2.1 */ class WCS_Report_Upcoming_Recurring_Revenue extends \WC_Admin_Report { public $chart_colours = array(); public $order_ids_recurring_totals = \null; public $average_sales = 0; /** * Get the legend for the main chart sidebar * @return array */ public function get_chart_legend() { } /** * Get report data. * @return stdClass */ public function get_data($args = array()) { } /** * Output the report */ public function output_report() { } /** * Output an export link */ public function get_export_button() { } /** * Get the main chart * @return string */ public function get_main_chart() { } /** * Get the current range and calculate the start and end dates * * @param string $current_range */ public function calculate_current_range($current_range) { } /** * Helper function to get the report's current range */ protected function get_current_range() { } /** * Clears the cached query results. * * @since 3.0.10 */ public function clear_cache() { } } /** * Subscriptions Admin Report - Retention Rate * * Find the number of periods between when each subscription is created and ends or ended * then plot all subscriptions using this data to provide a curve of retention rates. * * @package WooCommerce Subscriptions * @subpackage WC_Subscriptions_Admin_Reports * @category Class * @author Prospress * @since 2.1 * @deprecated in favor of WCS_Report_Retention_Rate */ class WC_Report_Retention_Rate extends \WCS_Report_Retention_Rate { public function __construct() { } } /** * Subscriptions Admin Report - Subscriptions by customer * * Creates the subscription admin reports area. * * @package WooCommerce Subscriptions * @subpackage WC_Subscriptions_Admin_Reports * @category Class * @author Prospress * @since 2.1 * @deprecated in favor of WCS_Report_Subscription_By_Customer */ class WC_Report_Subscription_By_Customer extends \WCS_Report_Subscription_By_Customer { public function __construct() { } } /** * Subscriptions Admin Report - Subscriptions by product * * Creates the subscription admin reports area. * * @package WooCommerce Subscriptions * @subpackage WC_Subscriptions_Admin_Reports * @category Class * @author Prospress * @since 2.1 * @deprecated In favor of WCS_Report_Subscription_By_Product */ class WC_Report_Subscription_By_Product extends \WCS_Report_Subscription_By_Product { public function __construct() { } } /** * Subscriptions Admin Report - Subscription Events by Date * * Display important historical data for subscription revenue and events, like switches and cancellations. * * @package WooCommerce Subscriptions * @subpackage WC_Subscriptions_Admin_Reports * @category Class * @author Prospress * @since 2.1 * @deprecated In favor of WCS_Report_Subscription_Events_By_Date */ class WC_Report_Subscription_Events_By_Date extends \WCS_Report_Subscription_Events_By_Date { public function __construct() { } } /** * Subscriptions Admin Report - Subscription Events by Date * * Creates the subscription admin reports area. * * @package WooCommerce Subscriptions * @subpackage WC_Subscriptions_Admin_Reports * @category Class * @author Prospress * @since 2.1 * @deprecated In favor of WCS_Report_Subscription_Payment_Retry */ class WC_Report_Subscription_Payment_Retry extends \WCS_Report_Subscription_Payment_Retry { public function __construct() { } } /** * Subscriptions Admin Report - Upcoming Recurring Revenue * * Display the renewal order count and revenue that will be processed for all currently active subscriptions * for a given period of time in the future. * * @package WooCommerce Subscriptions * @subpackage WC_Subscriptions_Admin_Reports * @category Class * @author Prospress * @since 2.1 * @deprecated In favor of WCS_Report_Upcoming_Recurring_Revenue */ class WC_Report_Upcoming_Recurring_Revenue extends \WCS_Report_Upcoming_Recurring_Revenue { public function __construct() { } } class WC_REST_Subscription_notes_Controller extends \WC_REST_Order_Notes_Controller { /** * Route base. * * @var string */ protected $rest_base = 'subscriptions/(?P[\\d]+)/notes'; /** * Post type. * * @var string */ protected $post_type = 'shop_subscription'; /** * Prepare links for the request. * * @since 3.1.0 * * @param WP_Comment $note * @return array Links for the given order note. */ protected function prepare_links($note) { } } class WC_REST_Subscription_System_Status_Manager { /** * Attach callbacks. */ public static function init() { } /** * Adds subscription fields to System Status response. * * @since 3.1.0 * @deprecated 4.8.0 * * @param WP_REST_Response $response The base system status response. * @return WP_REST_Response */ public static function add_subscription_fields_to_reponse($response) { } /** * Adds subscription fields to System Status response. * * @since 4.8.0 * * @param WP_REST_Response $response The base system status response. * @return WP_REST_Response */ public static function add_subscription_fields_to_response($response) { } /** * Gets the store's payment gateways and the features they support. * * @since 3.1.0 * @return array Payment gateway and their features. */ private static function get_payment_gateway_feature_support() { } /** * Adds subscription system status fields the system status schema. * * @since 3.1.0 * @param array $schema * * @return array the system status schema. */ public static function add_additional_fields_to_schema($schema) { } } class WC_REST_Subscriptions_Controller extends \WC_REST_Orders_Controller { /** * Route base. * * @var string */ protected $rest_base = 'subscriptions'; /** * The post type. * * @var string */ protected $post_type = 'shop_subscription'; /** * Register the routes for the subscriptions endpoint. * * -- Inherited -- * GET|POST /subscriptions * GET|PUT|DELETE /subscriptions/ * * -- Subscription specific -- * GET /subscriptions/status * GET /subscriptions//orders * * @since 3.1.0 */ public function register_routes() { } /** * Gets the request object. Return false if the ID is not a subscription. * * @since 3.1.0 * @param int $id Object ID. * @return WC_Subscription|bool */ protected function get_object($id) { } /** * Prepare a single subscription output for response. * * @since 3.1.0 * * @param WC_Data $object Subscription object. * @param WP_REST_Request $request Request object. * @return WP_REST_Response */ public function prepare_object_for_response($object, $request) { } /** * Gets the /subscriptions/statuses response. * * @since 3.1.0 * @return WP_REST_Response The response object. */ public function get_statuses() { } /** * Gets the /subscriptions/[id]/orders response. * * @since 3.1.0 * * @param WP_REST_Request $request The request object. * @return WP_Error|WP_REST_Response $response The response or an error if one occurs. */ public function get_subscription_orders($request) { } /** * Overrides WC_REST_Orders_Controller::get_order_statuses() so that subscription statuses are * validated correctly. * * @since 3.1.0 * @return array An array of valid subscription statuses. */ protected function get_order_statuses() { } /** * Prepares a single subscription for creation or update. * * @since 3.1.0 * * @param WP_REST_Request $request Request object. * @param bool $creating If the request is for creating a new object. * @return WP_Error|WC_Subscription */ public function prepare_object_for_database($request, $creating = \false) { } /** * Adds additional item schema information for subscription requests. * * @since 3.1.0 * @return array */ public function get_item_schema() { } /** * Get the query params for collections. * * @since 3.1.0 * @return array */ public function get_collection_params() { } /** * Gets an object's links to include in the response. * * Because this class also handles retreiving order data, we need * to edit the links generated so the correct REST API href is included * when its generated for an order. * * @since 3.1.0 * * @param WC_Data $object Object data. * @param WP_REST_Request $request Request object. * @return array Links for the given object. */ protected function prepare_links($object, $request) { } /** * Updates a subscription's payment method and meta from data provided in a REST API request. * * @since 3.1.0 * * @param WC_Subscription $subscription The subscription to update. * @param string $payment_method The ID of the payment method to set. * @param array $payment_meta The payment method meta. */ public function update_payment_method($subscription, $payment_method, $payment_meta) { } /** * Creates subscriptions from an order. * * @param WP_REST_Request $request * @return array Subscriptions created from the order. */ public function create_subscriptions_from_order($request) { } /** * Set the subscription item total to its recurring product price. * * This function ensures that sign-up fees and/or $0 trial periods are not carried over from the initial order to the subscription. * Note: If the line item has a custom total set by the merchant, don't override it with the recurring price. * * @param WC_Order_Item $item Subscription line item. * */ private function maybe_set_recurring_item_total(&$item) { } } /** * WC REST API Subscriptions Settings class. * * Adds subscription settings to the wc//settings and wc//settings/{group_id} endpoint. */ class WC_REST_Subscriptions_Settings { /** * Init class and attach callbacks. */ public function __construct() { } /** * Register the subscriptions settings group for use in the WC REST API /settings endpoint * * @param array $groups Array of setting groups. * * @return array */ public function add_settings_group($groups) { } /** * Add subscriptions specific settings to the WC REST API /settings/subscriptions endpoint. * * @param array $settings Array of settings. * * @return array */ public function add_settings($settings) { } /** * Checks if a setting type is a valid supported setting type. * * @param string $type Type. * * @return bool */ private function is_setting_type_valid($type) { } /** * Returns the subscriptions setting in the format expected by the WC /settings REST API. * * @param array $setting Subscription setting. * * @return array|bool */ private function format_setting($setting) { } } /** * Class: WC_Subscription_API_Customers * extends @see WC_API_Customer to provide functionality to subscriptions * * @since 2.0 */ class WC_API_Subscriptions_Customers extends \WC_API_Customers { public function __construct(\WC_API_Server $server) { } /** * Register the routes for this class * * GET /customers//subscriptions * * @since 2.0 * @param array $routes * @return array */ public function register_routes($routes) { } /** * WCS API function to get all the subscriptions tied to a particular customer. * * @since 2.0 * @param $id int * @param $fields array */ public function get_customer_subscriptions($id, $fields = \null, $filter = array()) { } } class WC_API_Subscriptions extends \WC_API_Orders { /* @var string $base the route base */ protected $base = '/subscriptions'; /** * Register the routes for this class * * GET|POST /subscriptions * GET /subscriptions/count * GET|PUT|DELETE /subscriptions/ * GET /subscriptions//notes * GET /subscriptions//notes/ * GET /subscriptions//orders * * @since 2.0 * @param array $routes * @return array $routes */ public function register_routes($routes) { } /** * Ensures the statuses are in the correct format and are valid subscription statues. * * @since 2.0 * @param $status string | array */ protected function format_statuses($status = \null) { } /** * Gets all subscriptions * * @since 2.0 * @param null $fields * @param array $filter * @param null $status * @param null $page * @return array */ public function get_subscriptions($fields = \null, $filter = array(), $status = \null, $page = 1) { } /** * Creating Subscription. * * @since 2.0 * @param array data raw order data * @return array */ public function create_subscription($data) { } /** * Edit Subscription * * @since 2.0 * @return array */ public function edit_subscription($subscription_id, $data, $fields = \null) { } /** * Setup the new payment information to call WC_Subscription::set_payment_method() * * @param $subscription WC_Subscription * @param $payment_details array payment data from api request * @since 2.0 */ public function update_payment_method($subscription, $payment_details, $updating) { } /** * Override WC_API_Order::create_base_order() to create a subscription * instead of a WC_Order when calling WC_API_Order::create_order(). * * @since 2.0 * @param $array * @return WC_Subscription */ protected function create_base_order($args, $data) { } /** * Update all subscription specific meta (i.e. Billing interval/period and date fields ) * * @since 2.0 * @param $data array * @param $subscription WC_Subscription */ protected function update_schedule($subscription, $data) { } /** * Delete subscription * * @since 2.0 */ public function delete_subscription($subscription_id, $force = \false) { } /** * Retrieves the subscription by the given id. * * Called by: /subscriptions/ * * @since 2.0 * @param int $subscription_id * @param array $fields * @param array $filter * @return array */ public function get_subscription($subscription_id, $fields = \null, $filter = array()) { } /** * Returns a list of all the available subscription statuses. * * @see wcs_get_subscription_statuses() in wcs-functions.php * @since 2.0 * @return array * */ public function get_statuses() { } /** * Get the total number of subscriptions * * Called by: /subscriptions/count * @since 2.0 * @param $status string * @param $filter array * @return int | WP_Error */ public function get_subscription_count($status = \null, $filter = array()) { } /** * Returns all the notes tied to the subscription * * Called by: subscription//notes * @since 2.0 * @param $subscription_id * @param $fields * @return WP_Error|array */ public function get_subscription_notes($subscription_id, $fields = \null) { } /** * Get information about a subscription note. * * @since 2.0 * @param int $subscription_id * @param int $id * @param array $fields * * @return array Subscription note */ public function get_subscription_note($subscription_id, $id, $fields = \null) { } /** * Get information about a subscription note. * * @param int $subscription_id * @param int $id * @param array $fields * * @return WP_Error|array Subscription note */ public function create_subscription_note($subscription_id, $data) { } /** * Verify and edit subscription note. * * @since 2.0 * @param int $subscription_id * @param int $id * * @return WP_Error|array Subscription note edited */ public function edit_subscription_note($subscription_id, $id, $data) { } /** * Verify and delete subscription note. * * @since 2.0 * @param int $subscription_id * @param int $id * @return WP_Error|array deleted subscription note status */ public function delete_subscription_note($subscription_id, $id) { } /** * Get information about the initial order and renewal orders of a subscription. * * Called by: /subscriptions//orders * @since 2.0 * @param $subscription_id * @param $fields */ public function get_all_subscription_orders($subscription_id, $filters = \null) { } /** * Get a certain date for a subscription, if it exists, formatted for return * * @since 2.0 * @param $subscription * @param $date_type */ protected function get_formatted_datetime($subscription, $date_type) { } /** * Helper method to get order post objects * * We need to override WC_API_Orders::query_orders() because it uses wc_get_order_statuses() * for the query, but subscriptions use the values returned by wcs_get_subscription_statuses(). * * @since 2.0 * @param array $args request arguments for filtering query * @return WP_Query */ protected function query_orders($args) { } } /** * REST API Subscription Notes controller class. * * @package WooCommerce_Subscriptions/API * @extends WC_REST_Order_Notes_Controller */ class WC_REST_Subscription_Notes_Controller extends \WC_REST_Order_Notes_Controller { /** * Route base. * * @var string */ protected $rest_base = 'subscriptions/(?P[\\d]+)/notes'; /** * Post type. * * @var string */ protected $post_type = 'shop_subscription'; } /** * REST API Subscription Notes controller class. * * @package WooCommerce_Subscriptions/API * @extends WC_REST_Order_Notes_Controller */ class WC_REST_Subscription_Notes_V1_Controller extends \WC_REST_Order_Notes_V1_Controller { /** * Route base. * * @var string */ protected $rest_base = 'subscriptions/(?P[\\d]+)/notes'; /** * Post type. * * @var string */ protected $post_type = 'shop_subscription'; } /** * REST API Subscriptions controller class. * * @package WooCommerce_Subscriptions/API * @extends WC_REST_Orders_Controller */ class WC_REST_Subscriptions_V1_Controller extends \WC_REST_Orders_V1_Controller { /** * Route base. * * @var string */ protected $rest_base = 'subscriptions'; /** * Post type. * * @var string */ protected $post_type = 'shop_subscription'; /** * Initialize subscription actions and filters */ public function __construct() { } /** * Register the routes for subscriptions. */ public function register_routes() { } /** * Filter WC_REST_Orders_Controller::get_item response for subscription post types * * @since 2.1 * @param WP_REST_Response $response * @param WP_POST $post * @param WP_REST_Request $request */ public function filter_get_subscription_response($response, $post, $request) { } /** * Sets the order_total value on the subscription after WC_REST_Orders_Controller::create_order * calls calculate_totals(). This allows store admins to create a recurring payment via the api * without needing to attach a product to the subscription. * * @since 2.1 * @param WP_REST_Request $request */ protected function create_order($request) { } /** * Overrides WC_REST_Orders_Controller::update_order to update subscription specific meta * calls parent::update_order to update the rest. * * @since 2.1 * @param WP_REST_Request $request * @param WP_POST $post */ protected function update_order($request) { } /** * Get subscription orders * * @since 2.1 * @param WP_REST_Request $request * @return WP_Error|WP_REST_Response $response */ public function get_subscription_orders($request) { } /** * Get subscription statuses * * @since 2.1 */ public function get_statuses() { } /** * Overrides WC_REST_Orders_Controller::get_order_statuses() so that subscription statuses are * validated correctly in WC_REST_Orders_Controller::get_collection_params() * * @since 2.1 */ protected function get_order_statuses() { } /** * Validate and update payment method on a subscription * * @since 2.1 * @param WC_Subscription $subscription * @param array $data * @param bool $updating */ public function update_payment_method($subscription, $data, $updating = \false) { } /** * Prepare a single subscription for create. * * @param WP_REST_Request $request Request object. * @return WP_Error|WC_Subscription $data Object. */ protected function prepare_item_for_database($request) { } /** * Adds additional item schema information for subscription requests * * @since 2.1 */ public function get_item_schema() { } /** * Deprecated functions */ /** * Prepare subscription data for create. * * Now that we override WC_REST_Orders_V1_Controller::prepare_item_for_database() function, * we no longer need to prepare these args * * @since 2.1 * @param stdClass $data * @param WP_REST_Request $request Request object. * @return stdClass * @deprecated 2.2 */ public function prepare_subscription_args($data, $request) { } /** * Update or set the subscription schedule with the request data. * * * @since 2.1 * @param WC_Subscription $subscription * @param array $data * @deprecated 2.2 */ public function update_schedule($subscription, $data) { } } class WC_Subscriptions_Dependency_Manager { /** * The minimum supported WooCommerce version. * * @var string */ private $minimum_supported_wc_version; /** * @var string|null The active WooCommerce version, or null if WooCommerce is not active. */ private $wc_active_version = \null; /** * @var bool Whether the active WooCommerce version has been cached. */ private $wc_version_cached = \false; /** * Constructor. */ public function __construct($minimum_supported_wc_version) { } /** * Checks if the required dependencies are met. * * @since 5.0.0 * @return bool True if the required dependencies are met. Otherwise, false. */ public function has_valid_dependencies() { } /** * Determines if the WooCommerce plugin is active. * * @since 5.0.0 * @return bool True if the plugin is active, false otherwise. */ public function is_woocommerce_active() { } /** * Determines if the WooCommerce version is supported by Subscriptions. * * The minimum supported WooCommerce version is defined in the WC_Subscriptions::$wc_minimum_supported_version property. * * @return bool true if the WooCommerce version is supported, false otherwise. */ public function is_woocommerce_version_supported() { } /** * This method detects the active version of WooCommerce. * * If the WC_VERSION constant is already defined, use that as a first preference. * If it's not defined, fetch the version based on the WooCommerce plugin data. * * The WooCommerce plugin is determined by this logic: * 1. Installed at 'woocommerce/woocommerce.php' * 2. Installed at any '{x}/woocommerce.php' where the plugin name is 'WooCommerce' * * @return string|null The active WooCommerce version, or null if WooCommerce is not active. */ private function get_woocommerce_active_version() { } /** * Displays an admin notice if the required dependencies are not met. * * @since 5.0.0 */ public function display_dependency_admin_notice() { } } class WC_Subscriptions_Core_Plugin { /** * The version of subscriptions-core library. * @var string */ protected $library_version = '7.1.1'; // WRCS: DEFINED_VERSION. /** * The subscription scheduler instance. * * @var WCS_Action_Scheduler */ protected $scheduler = \null; /** * The plugin's autoloader instance. * * @var WCS_Autoloader */ protected $autoloader = \null; /** * The plugin's cache manager instance. * * @var WCS_Cache_Manager */ public $cache = \null; /** * The subscriptions instance. * * @var WC_Subscriptions_Core_Plugin */ protected static $instance = \null; /** * An array of cart handler objects. * * Use @see WC_Subscriptions_Core_Plugin::instance()->get_cart_handler( '{class}' ) to fetch a cart handler instance. * eg WC_Subscriptions_Core_Plugin::instance()->get_cart_handler( 'WCS_Cart_Renewal' ). * * @var WCS_Cart_Renewal[] */ protected $cart_handlers = []; /** * Initialise class and attach callbacks. */ public function __construct($autoloader = \null) { } /** * Gets the Subscriptions Core instance. * * @since 1.0.0 - Migrated from WooCommerce Subscriptions v4.0.0 * @return WC_Subscriptions_Core_Plugin */ public static function instance() { } /** * Defines WC Subscriptions constants. */ protected function define_constants() { } /** * Includes required files. */ protected function includes() { } /** * Initialise the plugin. */ public function init() { } /** * Initialises classes which need to be loaded after other plugins have loaded. * * Hooked onto 'plugins_loaded' by @see WC_Subscriptions_Plugin::init() */ public function init_version_dependant_classes() { } /** * Attaches the hooks to init/setup the plugin. * * @since 1.0.0 - Migrated from WooCommerce Subscriptions v4.0.0 */ public function init_hooks() { } /** * Gets the subscriptions core directory. * * @since 1.0.0 - Migrated from WooCommerce Subscriptions v4.0.0 * @param string $path Optional. The path to append. * @return string */ public function get_subscriptions_core_directory($path = '') { } /** * Gets the subscriptions core directory url. * * @since 1.0.0 - Migrated from WooCommerce Subscriptions v4.0.0 * @param string $path Optional. The path to append. * @return string */ public function get_subscriptions_core_directory_url($path = '') { } /** * Gets the plugin's version * * @deprecated 5.0.0 This function is no longer recommended for version detection. Use get_library_version() instead. * @since 1.0.0 - Migrated from WooCommerce Subscriptions v4.0.0 */ public function get_plugin_version() { } /** * Gets the subscription-core library version. * * @since 5.0.0 */ public function get_library_version() { } /** * Gets the plugin file name * * @return string The plugin file */ public function get_plugin_file() { } /** * Gets the autoloader instance. * * @return WCS_Autoloader */ public function get_autoloader() { } /** * Gets the product type name. * * @return string The product type name. */ public function get_product_type_name() { } /** * Gets the activation transient name. * * @return string The transient name used to record when the plugin was activated. */ public function get_activation_transient() { } /** * Gets the core Payment Gateways handler class * * @since 1.0.0 - Migrated from WooCommerce Subscriptions v4.0.0 * @return string */ public function get_gateways_handler_class() { } /** * Gets the cart handler instance. * * @param string $class The class name of the cart handler. eg 'WCS_Cart_Renewal'. * @return WCS_Cart_Renewal|null The cart handler instance or null if not found. */ public function get_cart_handler($class) { } /** * Adds a cart handler instance. * * This is used to add cart handlers for different cart types. For example, renewal, resubscribe, initial, switch etc. * To access a cart handler instance, use WC_Subscriptions_Core_Plugin::instance()->get_cart_handler( $class ). * * @param WCS_Cart_Renewal $cart_handler An instance of a cart handler. */ protected function add_cart_handler($cart_handler) { } /** * Registers Subscriptions order types. * * @since 1.0.0 - Migrated from WooCommerce Subscriptions v4.0.0 */ public function register_order_types() { } /** * Registers data stores. * * @since 1.0.0 - Migrated from WooCommerce Subscriptions v4.0.0 * @return string[] */ public function add_data_stores($data_stores) { } /** * Registers our custom post statuses, used for subscription statuses. * * @since 1.0.0 - Migrated from WooCommerce Subscriptions v4.0.0 */ public function register_post_statuses() { } /** * Runs the required processes when the plugin is deactivated. * * @since 1.0.0 - Migrated from WooCommerce Subscriptions v4.0.0 */ public function deactivate_plugin() { } /** * Runs the required process on plugin activation. * * @since 1.0.0 - Migrated from WooCommerce Subscriptions v4.0.0 */ public function activate_plugin() { } /** * Registers plugin translation files. * * @since 1.0.0 - Migrated from WooCommerce Subscriptions v4.0.0 */ public function load_plugin_textdomain() { } /** * Adds the settings, docs and support links to the plugin screen. * * @since 1.0.0 - Migrated from WooCommerce Subscriptions v4.0.0 * * @param string[] $links The plugin's links displayed on the plugin screen. * @return string[] */ public function add_plugin_action_links($links) { } /** * Displays an upgrade notice for stores upgrading to 2.0.0. * * @since 1.0.0 - Migrated from WooCommerce Subscriptions v4.0.0 * * @param array $plugin_data Information about the plugin. * @param array $r response from the server about the new version. */ public function update_notice($plugin_data, $r) { } /** * Sets up the Blocks integration class. * * @since 1.0.0 - Migrated from WooCommerce Subscriptions v4.0.0 */ public function setup_blocks_integration() { } /** * Reduces the default Action Scheduler batch size on multi-sites. * * Renewals use a lot more memory on WordPress multisite (10-15mb instead of 0.1-1mb) so * we need to reduce the number of renewals run in each request. * * @since 1.0.0 - Migrated from WooCommerce Subscriptions v4.0.0 * * @param int $batch_size The default Action Scheduler batch size. * @return int */ public function reduce_multisite_action_scheduler_batch_size($batch_size) { } } /** * @method static WC_Subscriptions_Plugin instance() */ class WC_Subscriptions_Plugin extends \WC_Subscriptions_Core_Plugin { /** * Initialise the WC Subscriptions plugin. * * @since 4.0.0 */ public function init() { } /** * Initialises classes which need to be loaded after other plugins have loaded. * * Hooked onto 'plugins_loaded' by @see WC_Subscriptions_Core_Plugin::init() * * @since 4.0.0 */ public function init_version_dependant_classes() { } /** * Gets the plugin's directory url. * * @since 4.0.0 * @param string $path Optional. The path to append. * @return string */ public function get_plugin_directory_url($path = '') { } /** * Gets the plugin's directory. * * @since 4.0.0 * @param string $path Optional. The path to append. * @return string */ public function get_plugin_directory($path = '') { } /** * Gets the activation transient name. * * @since 4.0.0 * @return string The transient name used to record when the plugin was activated. */ public function get_activation_transient() { } /** * Gets the product type name. * * @since 4.0.0 * @return string The product type name. */ public function get_product_type_name() { } /** * Gets the version of WooCommerce Subscriptions. * * NOTE: This function should only be used to get the version of WooCommerce Subscriptions. * `WC_Subscriptions_Core_Plugin::instance()->get_plugin_version()` will return either the version of WooCommerce Subscriptions (if installed) or the version of WooCommerce Subscriptions Core. * `WC_Subscriptions_Core_Plugin::instance()->get_library_version()` should be used to get the version of WooCommerce Subscriptions Core. * * @since 4.0.0 * @see get_library_version() * @return string The plugin version. */ public function get_plugin_version() { } /** * Gets the plugin file name * * @since 4.0.0 * @return string The plugin file */ public function get_plugin_file() { } /** * Gets the Payment Gateways handler class * * @since 4.0.0 * @return string */ public function get_gateways_handler_class() { } /** * Adds welcome message after activating the plugin */ public function maybe_show_welcome_message() { } /** * Outputs a welcome message. Called when the Subscriptions extension is activated. * * @since 1.0 */ public function admin_installed_notice() { } } class WCS_API { public static function init() { } /** * Include the required files for the REST API and add register the subscription * API class in the WC_API_Server. * * @since 2.0 * @param Array $wc_api_classes WC_API::registered_resources list of api_classes * @return array */ public static function includes($wc_api_classes) { } /** * Load the new REST API subscription endpoints * * @since 2.1 */ public static function register_routes() { } /** * Register classes which override base endpoints. * * @since 3.1.0 */ public static function register_route_overrides() { } /** * Adds sign-up fees to order items added/edited via the REST API. * * @since 6.3.0 * * @param WC_Order_Item $item Order item object. */ public static function add_sign_up_fee_to_order_item($item) { } /** * Determines if a WP version compatible with REST API requests. * * @since 3.1.0 * @return boolean */ protected static function is_wp_compatible() { } /** * Determines if the current request is a REST API request for orders. * * @since 6.3.0 * * @return boolean */ protected static function is_orders_api_request() { } } class WCS_Auth { /** * Setup class * * @since 2.0.0 */ public function __construct() { } /** * Return a list of permissions a scope allows * * @param array $permissions * @param string $scope * @since 2.0.0 * @return array */ public function get_permissions_in_scope($permissions, $scope) { } } /** * WooCommerce Subscriptions Core Autoloader. * * @class WCS_Autoloader */ class WCS_Core_Autoloader { /** * The base path for autoloading. * * @var string */ protected $base_path = ''; /** * WCS_Autoloader constructor. * * @param string $base_path */ public function __construct($base_path) { } /** * Destructor. */ public function __destruct() { } /** * Register the autoloader. */ public function register() { } /** * Unregister the autoloader. */ public function unregister() { } /** * Autoload a class. * * @param string $class The class name to autoload. */ public function autoload($class) { } /** * Gets the base path for a given class. * * @since 1.0.0 - Migrated from WooCommerce Subscriptions v4.0.0 * @return string */ public function get_class_base_path($class) { } /** * Determine whether we should autoload a given class. * * @param string $class The class name. * * @return bool */ protected function should_autoload($class) { } /** * Convert the class name into an appropriate file name. * * @param string $class The class name. * * @return string The file name. */ protected function get_file_name($class) { } /** * Determine if the class is one of our abstract classes. * * @param string $class The class name. * * @return bool */ protected function is_class_abstract($class) { } /** * Determine if the class is one of our class interfaces. * * @param string $class The class name. * @return bool */ protected function is_class_interface($class) { } /** * Determine if the class is one of our data stores. * * @param string $class The class name. * @return bool */ protected function is_class_data_store($class) { } /** * Get the relative path for the class location. * * This handles all of the special class locations and exceptions. * * @param string $class The class name. * * @return string The relative path (from the plugin root) to the class file. */ protected function get_relative_class_path($class) { } } class WCS_Autoloader extends \WCS_Core_Autoloader { /** * Whether to use the legacy API classes. * * @var bool */ protected $legacy_api = \false; /** * The classes the Subscriptions plugin has ownership of. * * Note: needs to be lowercase. * * @var array */ private $classes = array('wc_subscriptions_plugin' => \true, 'wc_subscriptions_switcher' => \true, 'wcs_cart_switch' => \true, 'wcs_switch_totals_calculator' => \true, 'wcs_switch_cart_item' => \true, 'wcs_add_cart_item' => \true, 'wc_order_item_pending_switch' => \true, 'wcs_manual_renewal_manager' => \true, 'wcs_customer_suspension_manager' => \true, 'wcs_drip_downloads_manager' => \true, 'wcs_zero_initial_payment_checkout_manager' => \true, 'wcs_meta_box_payment_retries' => \true, 'wcs_limited_recurring_coupon_manager' => \true, 'wcs_call_to_action_button_text_manager' => \true, 'wcs_subscriber_role_manager' => \true, 'wc_subscriptions_payment_gateways' => \true, 'wcs_api' => \true, 'wcs_webhooks' => \true, 'wcs_auth' => \true, 'wcs_upgrade_notice_manager' => \true); /** * The substrings of the classes that the Subscriptions plugin has ownership of. * * @var array */ private $class_substrings = array('wc_reports', 'report', 'retry', 'early_renewal', 'rest_subscription', 'wc_api_subscriptions'); /** * Gets the class's base path. * * If the a class is one the plugin is responsible for, we return the plugin's path. Otherwise we let the library handle it. * * @since 4.0.0 * @return string */ public function get_class_base_path($class) { } /** * Get the relative path for the class location. * * @param string $class The class name. * @return string The relative path (from the plugin root) to the class file. */ protected function get_relative_class_path($class) { } /** * Determine whether we should autoload a given class. * * @param string $class The class name. * @return bool */ protected function should_autoload($class) { } /** * Is the given class found in the Subscriptions plugin * * @since 4.0.0 * @param string $class * @return bool */ private function is_plugin_class($class) { } /** * Gets a retry class's relative path. * * @param string $class The retry class being loaded. * @return string The relative path to the retry class. */ private function get_payment_retry_class_relative_path($class) { } /** * Determine if the class is one of our abstract classes. * * @param string $class The class name. * @return bool */ protected function is_class_abstract($class) { } /** * Set whether the legacy API should be used. * * @author Jeremy Pry * * @param bool $use_legacy_api Whether to use the legacy API classes. * * @return $this */ public function use_legacy_api($use_legacy_api) { } /** * Gets the correct subdirectory for a version of the a REST API class. * * @param string $class The rest API class name. * @return string The subdirectory for a rest API class. */ protected function get_rest_api_directory($class) { } } class WCS_Call_To_Action_Button_Text_Manager { /** * Initialise the class's callbacks. */ public static function init() { } /** * Adds the subscription add to cart and place order button text settings. * * @since 4.0.0 * * @param array $settings The WC Subscriptions settings. * @return array $settings */ public static function add_settings($settings) { } /** * Filters subscription products add to cart text to honour the setting. * * @since 4.0.0 * * @param string $add_to_cart_text The product's add to cart text. * @param WC_Abstract_Product $product The product. * * @return string */ public static function filter_add_to_cart_text($add_to_cart_text) { } /** * Filters the place order text while there's a subscription in the cart. * * @since 4.0.0 * * @param string $button_text The default place order button text. * @return string The button text. */ public static function filter_place_subscription_order_text($button_text) { } } class WCS_Customer_Suspension_Manager { /** * Initialise the class. */ public static function init() { } /** * Adds the customer suspension setting. * * @since 4.0.0 * * @param array $settings Subscriptions settings. * @return array Subscriptions settings. */ public static function add_settings($settings) { } /** * Filters whether the current user can suspend the subscription. * * Allows the customer to suspend the subscription if the _max_customer_suspensions setting hasn't been reached. * * @since 4.0.0 * * @param bool $can_user_suspend Whether the current user can suspend the subscrption determined by @see wcs_can_user_put_subscription_on_hold(). * @param WC_Subscription $subscription The subscription. * @param WP_User $user The current user. * * @return bool Whether the subscription can be suspended by the user. */ public static function can_customer_put_subscription_on_hold($can_user_suspend, $subscription, $user) { } /** * Adds the customer suspension action, if allowed. * * @since 4.0.0 * * @param array $actions The actions a customer/user can make with a subscription. * @param WC_Subscription $subscription The subscription. * @param int $user_id The user viewing the subscription. * * @return array The customer's subscription actions. */ public static function add_customer_suspension_action($actions, $subscription, $user_id) { } /** * Gets the number of suspensions a customer can make per billing period. * * @since 4.0.0 * @return string The number of suspensions a customer can make per billing period. Can 'unlimited' or the number of suspensions allowed. */ public static function get_allowed_customer_suspensions() { } } class WCS_Drip_Downloads_Manager { /** * Initialise the class. * * @since 4.0.0 */ public static function init() { } /** * Checks if the drip downloads feature is enabled. * * @since 4.0.0 * @return bool Whether download dripping is enabled or not. */ public static function are_drip_downloads_enabled() { } /** * Prevent granting download permissions to subscriptions and related-orders when new files are added to a product. * * @since 4.0.0 * * @param bool $grant_access Whether to grant access to the file/download ID. * @param string $download_id The ID of the download being added. * @param int $product_id The ID of the downloadable product. * @param WC_Order $order The order/subscription's ID. * * @return bool Whether to grant access to the file/download ID. */ public static function maybe_revoke_immediate_access($grant_access, $download_id, $product_id, $order) { } /** * Adds the Drip Downloadable Content setting. * * @since 4.0.0 * * @param array $settings The WC Subscriptions settings array. * @return array Settings. */ public static function add_setting($settings) { } } class WCS_Limited_Recurring_Coupon_Manager { /** * The meta key used for the number of renewals. * * @var string */ private static $coupons_renewals = '_wcs_number_payments'; /** * Initialize the class hooks and callbacks. */ public static function init() { } /** * Adds custom fields to the coupon data form. * * @since 4.0.0 */ public static function add_coupon_fields($id) { } /** * Saves our custom coupon fields. * * @since 4.0.0 * @param int $id The coupon's ID. */ public static function save_coupon_fields($id) { } /** * Get the number of renewals for a limited coupon. * * @since 4.0.0 * @param string $code The coupon code. * @return false|int False for non-recurring coupons, or the limit number for recurring coupons. * A value of 0 is for unlimited usage. */ public static function get_coupon_limit($code) { } /** * Determines if a given coupon is limited to a certain number of renewals. * * @since 4.0.0 * * @param string $code The coupon code. * @return bool */ public static function coupon_is_limited($code) { } /** * Determines whether the cart contains a recurring coupon with set number of renewals. * * @since 4.0.0 * @return bool Whether the cart contains a limited recurring coupon. */ public static function cart_contains_limited_recurring_coupon() { } /** * Determines if a given order has a limited use coupon. * * @since 4.0.0 * @param WC_Order|WC_Subscription $order * * @return bool Whether the order contains a limited recurring coupon. */ public static function order_has_limited_recurring_coupon($order) { } /** * Limits payment gateways to those that support changing subscription amounts. * * @since 4.0.0 * @param WC_Payment_Gateway[] $gateways The current available gateways. * @return WC_Payment_Gateway[] */ private static function limit_gateways_subscription_amount_changes($gateways) { } /** * Determines how many subscription renewals the coupon has been applied to and removes coupons which have reached their expiry. * * @since 4.0.0 * @param WC_Subscription $subscription The current subscription. */ public static function check_coupon_usages($subscription) { } /** * Add our limited coupon data to the Coupon list table. * * @since 4.0.0 * * @param string $column_name The name of the current column in the table. * @param int $id The coupon ID. */ public static function add_limit_to_list_table($column_name, $id) { } /** * Determines if a given recurring cart contains a limited use coupon which when applied to a subscription will reach its usage limit within the subscription's length. * * @since 4.0.0 * * @param WC_Cart $recurring_cart The recurring cart object. * @return bool */ public static function recurring_cart_contains_expiring_coupon($recurring_cart) { } /** * Filters the available gateways when there is a recurring coupon. * * @since 4.0.0 * * @param WC_Payment_Gateway[] $gateways The available payment gateways. * @return WC_Payment_Gateway[] The filtered payment gateways. */ public static function gateways_subscription_amount_changes($gateways) { } /** * Filter the message for when no payment gateways are available. * * @since 4.0.0 * * @param string $message The current message indicating there are no payment methods available.. * @return string The filtered message indicating there are no payment methods available. */ public static function no_available_payment_methods_message() { } /** * Removes limited coupons from the recurring cart if the coupons limit is reached in the initial cart. * * @since 4.0.0 * * @param bool $bypass_default_checks Whether to bypass WC Subscriptions default conditions for removing a coupon. * @param WC_Coupon $coupon The coupon to check. * @param string $coupon_type The coupon's type. * @param string $calculation_type The WC Subscriptions cart calculation mode. Can be 'recurring_total' or 'none'. @see WC_Subscriptions_Cart::get_calculation_type() * * @return bool Whether to bypass WC Subscriptions default conditions for removing a coupon. */ public static function maybe_remove_coupons_from_recurring_cart($bypass_default_checks, $coupon, $coupon_type, $calculation_type, $cart) { } } class WCS_Manual_Renewal_Manager { /** * Initalise the class and attach callbacks. */ public static function init() { } /** * Adds the manual renewal settings. * * @since 4.0.0 * @param $settings The full subscription settings array. * @return $settings. */ public static function add_settings($settings) { } /** * Checks if manual renewals are required - automatic renewals are disabled. * * @since 4.0.0 * @return bool Weather manual renewal is required. */ public static function is_manual_renewal_required() { } /** * Checks if manual renewals are enabled. * * @since 4.0.0 * @return bool Weather manual renewal is enabled. */ public static function is_manual_renewal_enabled() { } } class WCS_Subscriber_Role_Manager { /** * Initialise the class. */ public static function init() { } /** * Adds the subscription customer role setting. * * @since 4.0.0 * * @param array $settings Subscriptions settings. * @return array Subscriptions settings. */ public static function add_settings($settings) { } /** * Gets the subscriber role. * * @since 4.0.0 * * @return string The role to apply to subscribers. */ public static function get_subscriber_role() { } /** * Gets the inactive subscriber role. * * @since 4.0.0 * * @return string The role to apply to inactive subscribers. */ public static function get_inactive_subscriber_role() { } } class WCS_Upgrade_Notice_Manager { /** * The version this notice relates to. * * @var string */ protected static $version = '3.1.0'; /** * The number of times the notice will be displayed before being dismissed automatically. * * @var int */ protected static $display_count = 2; /** * The option name which stores information about the admin notice. * * @var string */ protected static $option_name = 'wcs_display_upgrade_notice'; /** * Attach callbacks. * * @since 2.3.0 */ public static function init() { } /** * Store an option to display an upgrade notice when the store is upgraded. * * @param string $current_version The new version the site has been updated to. * @param string $previously_active_version The version of Subscriptions the store was running prior to upgrading. * @since 2.3.0 */ public static function maybe_record_upgrade($current_version, $previously_active_version) { } /** * Display the upgrade notice including details about the update if it hasn't been dismissed. * * @since 2.3.0 */ public static function maybe_show_admin_notice() { } /** * Determine if this admin notice should be displayed. * * @return bool Whether this admin notice should be displayed. * @since 2.3.0 */ protected static function display_notice() { } /** * Increment the notice display counter signalling the notice has been displayed. * * The option triggering this notice will be deleted if the display count has been reached. * * @since 2.3.0 */ protected static function increment_display_count() { } } class WCS_Webhooks { /** * Setup webhook for subscriptions * * @since 2.0 */ public static function init() { } /** * Trigger `order.create` every time an order is created by Subscriptions. * * @param WC_Order $order WC_Order Object */ public static function add_subscription_created_order_callback($order) { } /** * Add Subscription webhook topics * * @param array $topic_hooks * @since 2.0 */ public static function add_topics($topic_hooks, $webhook) { } /** * Add Subscription topics to the Webhooks dropdown menu in when creating a new webhook. * * @since 2.0 */ public static function add_topics_admin_menu($topics) { } /** * Setup payload for subscription webhook delivery. * * @since 2.0 */ public static function create_payload($payload, $resource, $resource_id, $id) { } /** * Add webhook resource for subscription. * * @param array $resources * @since 2.0 */ public static function add_resource($resources) { } /** * Add webhook event for subscription switched. * * @param array $events * @since 2.1 */ public static function add_event($events) { } /** * Call a "subscription created" action hook with the first parameter being a subscription id so that it can be used * for webhooks. * * @since 2.0 */ public static function add_subscription_created_callback($subscription) { } /** * Call a "subscription updated" action hook with a subscription id as the first parameter to be used for webhooks payloads. * * @since 2.0 */ public static function add_subscription_updated_callback($subscription) { } /** * For each switched subscription in an order, call a "subscription switched" action hook with a subscription id as the first parameter to be used for webhooks payloads. * * @since 2.1 */ public static function add_subscription_switched_callback($order) { } } class WCS_Zero_Initial_Payment_Checkout_Manager { /** * Initialise the class. */ public static function init() { } /** * Adds the $0 initial checkout setting. * * @since 4.0.0 * @return array WC Subscriptions settings. */ public static function add_settings($settings) { } /** * Checks if a $0 checkout requires a payment method. * * @since 4.0.0 * @return bool Whether a $0 initial checkout requires a payment method. */ public static function zero_initial_checkout_requires_payment() { } /** * Unhooks core Subscriptions functionality that requires payment on checkout for $0 subscription purchases, * if the store has opted to bypass that via this feature. * * @since 4.0.0 * * @param bool $cart_needs_payment Whether the cart requires payment. * @return bool */ public static function cart_needs_payment($cart_needs_payment) { } /** * Unhooks core Subscriptions functionality that requires payment for a $0 subscription order, * if the store has opted to bypass that via this feature. * * @since 4.0.0 * * @param bool $needs_payment * @return bool */ public static function order_needs_payment($needs_payment) { } } /** * Implement renewing to a subscription via the cart. * * For manual renewals and the renewal of a subscription after a failed automatic payment, the customer must complete * the renewal via checkout in order to pay for the renewal. This class handles that. * * @package WooCommerce Subscriptions * @subpackage WCS_Cart_Renewal * @category Class * @author Prospress * @since 1.0.0 - Migrated from WooCommerce Subscriptions v2.0 */ class WCS_Cart_Renewal { /* The flag used to indicate if a cart item is a renewal */ public $cart_item_key = 'subscription_renewal'; /** * Bootstraps the class and hooks required actions & filters. * * @since 1.0.0 - Migrated from WooCommerce Subscriptions v2.0 */ public function __construct() { } /** * Attach WooCommerce version dependent hooks * * @since 1.0.0 - Migrated from WooCommerce Subscriptions v2.2.0 */ public function attach_dependant_hooks() { } /** * Bootstraps the class and hooks required actions & filters. * * @since 1.0.0 - Migrated from WooCommerce Subscriptions v2.0 */ public function setup_hooks() { } /** * Attach callbacks dependant on WC versions * * @since 1.0.0 - Migrated from WooCommerce Subscriptions v2.2.11 */ public function attach_dependant_callbacks() { } /** * Check if a payment is being made on a renewal order from 'My Account'. If so, * redirect the order into a cart/checkout payment flow so that the customer can * choose payment method, apply discounts set shipping and pay for the order. * * @since 1.0.0 - Migrated from WooCommerce Subscriptions v2.0 */ public function maybe_setup_cart() { } /** * Updates the WooCommerce session variables so that an order can be resumed/paid for without a new order being * created. * * @internal Core checkout uses order_awaiting_payment, Blocks checkout uses store_api_draft_order. Both validate the * cart hash to ensure the order matches the cart. * * @param int $order_id The order ID that is awaiting payment, or 0 to unset it. */ protected function set_order_awaiting_payment($order_id) { } /** * Set up cart item meta data to complete a subscription renewal via the cart. * * @since 1.0.0 - Migrated from WooCommerce Subscriptions v2.2.0 * * @param WC_Abstract_Order $subscription The subscription or Order object to set up the cart from. * @param array $cart_item_data Additional cart item data to set on the cart items. * @param string $validation_type Whether all items are required or not. Optional. Can be 'all_items_not_required' or 'all_items_required'. 'all_items_not_required' by default. * 'all_items_not_required' - If an order/subscription line item fails to be added to the cart, the remaining items will be added. * 'all_items_required' - If an order/subscription line item fails to be added to the cart, all items will be removed and the cart setup will be aborted. */ protected function setup_cart($subscription, $cart_item_data, $validation_type = 'all_items_not_required') { } /** * Does some housekeeping. Fires after the items have been passed through the get items from session filter. Because * that filter is not good for removing cart items, we need to work around that by doing it later, in the cart * loaded from session action. * * This checks cart items whether underlying subscriptions / renewal orders they depend exist. If not, they are * removed from the cart. * * @param $cart WC_Cart the one we got from session */ public function cart_items_loaded_from_session($cart) { } /** * Restore renewal flag when cart is reset and modify Product object with renewal order related info * * @since 1.0.0 - Migrated from WooCommerce Subscriptions v2.0 * * @param array $cart_item_session_data Cart item session data. * @param array $cart_item Cart item data. * @param string $key Cart item key. */ public function get_cart_item_from_session($cart_item_session_data, $cart_item, $key) { } /** * Returns address details from the renewal order if the checkout is for a renewal. * * @param string $value Default checkout field value. * @param string $key The checkout form field name/key. * * @return string $value Checkout field value. */ public function checkout_get_value($value, $key) { } /** * If the cart contains a renewal order that needs to ship to an address that is different * to the order's billing address, tell the checkout to toggle the ship to a different address * checkbox and make sure the shipping fields are displayed by default. * * @deprecated subscriptions-core 5.3.0 - This method has moved to the WC_Subscriptions_Checkout class. * * @param bool $ship_to_different_address Whether the order will ship to a different address * @return bool $ship_to_different_address */ public function maybe_check_ship_to_different_address($ship_to_different_address) { } /** * When completing checkout for a subscription renewal, update the address on the subscription to use * the shipping/billing address entered in case it has changed since the subscription was first created. * * @since 1.0.0 - Migrated from WooCommerce Subscriptions v2.0 */ public function maybe_update_subscription_customer_data($update_customer_data, $checkout_object) { } /** * If a product is being marked as not purchasable because it is limited and the customer has a subscription, * but the current request is to resubscribe to the subscription, then mark it as purchasable. * * @since 1.0.0 - Migrated from WooCommerce Subscriptions v2.0 * @return bool */ public function is_purchasable($is_purchasable, $product) { } /** * Flag payment of manual renewal orders via an extra URL param. * * This is particularly important to ensure renewals of limited subscriptions can be completed. * * @since 1.0.0 - Migrated from WooCommerce Subscriptions v2.0 */ public function get_checkout_payment_url($pay_url, $order) { } /** * Customise which actions are shown against a subscription renewal order on the My Account page. * * @since 1.0.0 - Migrated from WooCommerce Subscriptions v2.0 */ public function filter_my_account_my_orders_actions($actions, $order) { } /** * Removes all the linked renewal/resubscribe items from the cart if a renewal/resubscribe item is removed. * * @param string $cart_item_key The cart item key of the item removed from the cart. * @since 1.0.0 - Migrated from WooCommerce Subscriptions v2.0 */ public function maybe_remove_items($cart_item_key) { } /** * Checks the cart to see if it contains a subscription renewal item. * * @see wcs_cart_contains_renewal() * @return bool | Array The cart item containing the renewal, else false. * @since 1.0.0 - Migrated from WooCommerce Subscriptions v2.0.10 */ protected function cart_contains() { } /** * Formats the title of the product removed from the cart. Because we have removed all * linked renewal/resubscribe items from the cart we need a product title to reflect that. * * @param string $product_title * @param $cart_item * @return string $product_title * @since 1.0.0 - Migrated from WooCommerce Subscriptions v2.0 */ public function items_removed_title($product_title, $cart_item) { } /** * Restores all linked renewal/resubscribe items to the cart if the customer has restored one. * * @param string $cart_item_key The cart item key of the item being restored to the cart. * @since 1.0.0 - Migrated from WooCommerce Subscriptions v2.0 */ public function maybe_restore_items($cart_item_key) { } /** * Return our custom pseudo coupon data for renewal coupons * * @param array $data the coupon data * @param string $code the coupon code that data is being requested for * @return array the custom coupon data * @since 1.0.0 - Migrated from WooCommerce Subscriptions v2.0.10 */ public function renewal_coupon_data($data, $code) { } /** * Get original products for a renewal order - so that we can ensure renewal coupons are only applied to those * * @param object WC_Order | WC_Subscription $order * @return array $product_ids an array of product ids on a subscription/order * @since 1.0.0 - Migrated from WooCommerce Subscriptions v2.0.10 */ protected function get_products($order) { } /** * Store renewal coupon information in a session variable so we can access it later when coupon data is being retrieved * * @param int $subscription_id subscription id * @param object $coupon coupon * @since 1.0.0 - Migrated from WooCommerce Subscriptions v2.0.10 */ protected function store_coupon($order_id, $coupon) { } /** * Clear renewal coupons - protects against confusing customer facing notices if customers add one renewal order to the cart with a set of coupons and then decide to add another renewal order with a different set of coupons * * @since 1.0.0 - Migrated from WooCommerce Subscriptions v2.0.10 */ public function clear_coupons() { } /** * Add order/subscription fee line items to the cart when a renewal order, initial order or resubscribe is in the cart. * * @param WC_Cart $cart * @since 1.0.0 - Migrated from WooCommerce Subscriptions v2.0.13 */ public function maybe_add_fees($cart) { } /** * When restoring the cart from the session, if the cart item contains addons, as well as * a renewal or resubscribe, do not adjust the price because the original order's price will * be used, and this includes the addons amounts. * * @since 1.0.0 - Migrated from WooCommerce Subscriptions v2.0 */ public function product_addons_adjust_price($adjust_price, $cart_item) { } /** * Get the order object used to construct the renewal cart. * * @param Array The renewal cart item. * @return WC_Order | The order object * @since 1.0.0 - Migrated from WooCommerce Subscriptions v2.0.13 */ protected function get_order($cart_item = '') { } /** * Before allowing payment on an order awaiting payment via checkout, WC >= 2.6 validates * order items haven't changed by checking for a cart hash on the order, so we need to set * that here. @see WC_Checkout::create_order() * * @param WC_Order|int $order The order object or order ID. * * @since 1.0.0 - Migrated from WooCommerce Subscriptions v2.0.14 */ protected function set_cart_hash($order) { } /** * Right before WC processes a renewal cart through the checkout, set the cart hash. * This ensures legitimate changes to taxes and shipping methods don't cause a new order to be created. * * @param Mixed | An order generated by third party plugins * @return Mixed | The unchanged order param * @since 1.0.0 - Migrated from WooCommerce Subscriptions v2.2.11 */ public function update_cart_hash($order) { } /** * Redirect back to pay for an order after successfully logging in. * * @param string The redirect URL after successful login. * @param WP_User The newly logged in user object. * @return string * @since 1.0.0 - Migrated from WooCommerce Subscriptions v2.1.0 */ public function maybe_redirect_after_login($redirect, $user = \null) { } /** * Force an update to the session cart after updating renewal order line items. * * This is required so that changes made by @see WCS_Cart_Renewal->add_line_item_meta() (or @see * WCS_Cart_Renewal->update_line_item_cart_data() for WC < 3.0), are also reflected * in the session cart. * * @since 1.0.0 - Migrated from WooCommerce Subscriptions v2.1.3 */ public function update_session_cart_after_updating_renewal_order() { } /** * Prevent compounding dynamic discounts on cart items. * Dynamic discounts are copied from the subscription to the renewal order and so don't need to be applied again in the cart. * * @param bool Whether to apply the dynamic discount * @param string The cart item key of the cart item the dynamic discount is being applied to. * @return bool * @since 1.0.0 - Migrated from WooCommerce Subscriptions v2.1.4 */ function prevent_compounding_dynamic_discounts($adjust_price, $cart_item_key) { } /** * For order items created as part of a renewal, keep a record of the cart item key so that we can match it * later in @see this->set_order_item_id() once the order item has been saved and has an ID. * * Attached to WC 3.0+ hooks and uses WC 3.0 methods. * * @param WC_Order_Item_Product $order_item * @param string $cart_item_key The hash used to identify the item in the cart * @param array $cart_item The cart item's data. * @since 1.0.0 - Migrated from WooCommerce Subscriptions v2.2.0 */ public function add_line_item_meta($order_item, $cart_item_key, $cart_item) { } /** * After order meta is saved, get the order line item ID for this renewal and keep a record of it in * the cart so we can update it later. * * @param int|WC_Order $order_id * @param array $checkout_posted_data * @since 1.0.0 - Migrated from WooCommerce Subscriptions v2.2.1 */ public function set_order_item_id($order_id, $posted_checkout_data = array()) { } /** * After updating renewal order line items, update the values stored in cart item data * which would now reference old line item IDs. * * Used when WC 3.0 or newer is active. When prior versions are active, * @see WCS_Cart_Renewal->update_line_item_cart_data() * * @param string $cart_item_key * @param int $order_item_id * @since 1.0.0 - Migrated from WooCommerce Subscriptions v2.2.1 */ protected function set_cart_item_order_item_id($cart_item_key, $order_item_id) { } /** * Do not display cart item key order item meta keys unless Subscriptions is in debug mode. * * @since 1.0.0 - Migrated from WooCommerce Subscriptions v2.2.1 */ public function hidden_order_itemmeta($hidden_meta_keys) { } /** * When completing checkout for a subscription renewal, update the subscription's address to match * the shipping/billing address entered on checkout. * * @param int $customer_id * @param array $checkout_data the posted checkout data * @since 1.0.0 - Migrated from WooCommerce Subscriptions v2.2.7 */ public function maybe_update_subscription_address_data($customer_id, $checkout_data) { } /** * When completing checkout for a subscription renewal, update the subscription's address to match * the shipping/billing address entered on checkout. * * @param \WC_Customer $customer * @param \WP_REST_Request $request Full details about the request. * @since 4.1.1 */ public function maybe_update_subscription_address_data_from_store_api($customer, $request) { } /** * Add custom line item meta to the cart item data so it's displayed in the cart. * * @param array $cart_item_data * @param array $cart_item * @since 1.0.0 - Migrated from WooCommerce Subscriptions v2.2.11 */ public function display_line_item_data_in_cart($cart_item_data, $cart_item) { } /** * Add custom line item meta from the old line item into the new line item meta. * * Used when WC versions prior to 3.0 are active. When WC 3.0 or newer is active, * @see WCS_Cart_Renewal->add_order_line_item_meta() replaces this function * * @param int $item_id * @param array $cart_item_data * @since 1.0.0 - Migrated from WooCommerce Subscriptions v2.2.11 */ public function add_order_item_meta($item_id, $cart_item_data) { } /** * Add custom line item meta from the old line item into the new line item meta. * * Used when WC 3.0 or newer is active. When prior versions are active, * @see WCS_Cart_Renewal->add_order_item_meta() replaces this function * * @param WC_Order_Item_Product * @param string $cart_item_key * @param array $cart_item_data * @since 1.0.0 - Migrated from WooCommerce Subscriptions v2.2.11 */ public function add_order_line_item_meta($item, $cart_item_key, $cart_item_data) { } /** * Remove any fees applied to the renewal cart which aren't recurring. * * @param WC_Cart $cart A WooCommerce cart object. */ public function remove_non_recurring_fees($cart) { } /** * Filters the shipping packages to remove subscriptions that have "one time shipping" enabled and, as such, * shouldn't have a shipping amount associated during a renewal. * * @since 1.0.0 - Migrated from WooCommerce Subscriptions v2.3.3 */ public function maybe_update_shipping_packages($packages) { } /** * Check if the order has any discounts applied and if so reapply them to the cart * or add pseudo coupon equivalents if the coupons no longer exist. * * @param WC_Order $order The order to copy coupons and discounts from. * @since 1.0.0 - Migrated from WooCommerce Subscriptions v2.4.3 */ public function setup_discounts($order) { } /** * Create coupon objects from coupon line items. * * @param WC_Order_Item_Coupon[] $coupon_line_items The coupon line items to apply to the cart. * @return array $coupons */ protected function get_line_item_coupons($coupon_line_items) { } /** * Apply a pseudo coupon to the cart for a specific discount amount. * * @param float $discount The discount amount. * @return WC_Coupon */ protected function get_pseudo_coupon($discount) { } /** * Apply an order coupon to the cart. * * @param WC_Order $order The order the discount should apply to. * @param WC_Coupon $coupon The coupon to add to the cart. */ protected function apply_order_coupon($order, $coupon) { } /** * Makes sure a renewal order's "created via" meta is not changed to "checkout" by WC during checkout. * * @param WC_Order $order * @since 1.0.0 - Migrated from WooCommerce Subscriptions v2.5.4 */ public function maybe_preserve_order_created_via($order) { } /** * Determines if the cart should honor the grandfathered subscription/order line item total. * * @since 1.0.0 - Migrated from WooCommerce Subscriptions v3.0.10 * * @param array $cart_item The cart item to check. * @return bool Whether the cart should honor the order's prices. */ public function should_honor_subscription_prices($cart_item) { } /** * Disables renewal cart stock validation if the store has switched it off via a filter. * * @since 1.0.0 - Migrated from WooCommerce Subscriptions v2.6.0 */ public function maybe_disable_manual_renewal_stock_validation() { } /** * Overrides the place order button text on the checkout when the cart contains renewal order items, exclusively. * * @since 1.0.0 - Migrated from WooCommerce Subscriptions v3.1.0 * * @param string $place_order_text The place order button text. * @return string The place order button text. 'Renew subscription' if the cart contains only renewals, otherwise the default. */ public function order_button_text($place_order_text) { } /** * Verifies if the cart being loaded from the session belongs to the current user. * * If a customer is logged out via the session cookie expiring or being killed, it's possible that * their cart session persists. Before WC load it, we need to verify if it contains a * subscription-related order and if so, whether the current user has permission to pay for it. * * This function will destroy any session which contains a subscription-related payment that doesn't belong to the current user. * * @since 1.6.3 */ public function verify_session_belongs_to_customer() { } /** * Checks if the current user can pay for the order. * * @since 1.6.3 * * @param WC_Order $order The order to check the current user against. * @return bool Whether the current user can pay for this order. */ public function validate_current_user($order) { } /** * Sets the order cart hash when paying for a renewal order via the Block Checkout. * * This function is hooked onto the 'woocommerce_order_has_status' filter, is only applied during REST API requests, only applies to the * 'checkout-draft' status (which only Block Checkout orders use) and to renewal orders that are currently being paid for in the cart. * All other order statuses, orders and scenarios remain unaffected by this function. * * This function is necessary to override the default logic in @see DraftOrderTrait::is_valid_draft_order(). * This function behaves similarly to @see WCS_Cart_Renewal::update_cart_hash() for the standard checkout and is hooked onto the 'woocommerce_create_order' filter. * * @param bool $has_status Whether the order has the status. * @param WC_Order $order The order. * @param string $status The status to check. * * @return bool Whether the order has the status. Unchanged by this function. */ public function set_renewal_order_cart_hash_on_block_checkout($has_status, $order, $status) { } /* Deprecated */ /** * For subscription renewal via cart, use original order discount * * @since 1.0.0 - Migrated from WooCommerce Subscriptions v2.0 */ public function set_renewal_discounts($cart) { } /** * For subscription renewal via cart, previously adjust item price by original order discount * * No longer required as of 1.3.5 as totals are calculated correctly internally. * * @since 1.0.0 - Migrated from WooCommerce Subscriptions v2.0 */ public function get_discounted_price_for_renewal($price, $cart_item, $cart) { } /** * Add subscription fee line items to the cart when a renewal order or resubscribe is in the cart. * * @param WC_Cart $cart * @since 1.0.0 - Migrated from WooCommerce Subscriptions v2.0.10 */ public function maybe_add_subscription_fees($cart) { } /** * After updating renewal order line items, update the values stored in cart item data * which would now reference old line item IDs. * * @since 1.0.0 - Migrated from WooCommerce Subscriptions v2.1.3 */ public function update_line_item_cart_data($item_id, $cart_item_data, $cart_item_key) { } /** * After updating renewal order line items, update the values stored in cart item data * which would now reference old line item IDs. * * Used when WC 3.0 or newer is active. When prior versions are active, * @see WCS_Cart_Renewal->update_line_item_cart_data() * * @deprecated 1.0.0 - Migrated from WooCommerce Subscriptions v2.2.1 * @since 1.0.0 - Migrated from WooCommerce Subscriptions v2.2.0 */ public function update_order_item_data_in_cart($order_item, $cart_item_key, $cart_item) { } /** * Right before WC processes a renewal cart through the checkout, set the cart hash. * This ensures legitimate changes to taxes and shipping methods don't cause a new order to be created. * * @param Mixed | An order generated by third party plugins * @return Mixed | The unchanged order param * @since 1.0.0 - Migrated from WooCommerce Subscriptions v2.1.0 */ public function set_renewal_order_cart_hash($order) { } /** * Check if a renewal order subscription has any coupons applied and if so add pseudo renewal coupon equivalents to ensure the discount is still applied * * @param WC_Subscription $subscription subscription * @param WC_Order $order * * @since 1.0.0 - Migrated from WooCommerce Subscriptions v2.0.10 * @deprecated 1.0.0 - Migrated from WooCommerce Subscriptions v2.4.3 */ public function maybe_setup_discounts($subscription, $order = \null) { } /** * When a failed renewal order is being paid for via checkout, make sure WC_Checkout::create_order() preserves its * status as 'failed' until it is paid. By default, it will always set it to 'pending', but we need it left as 'failed' * so that we can correctly identify the status change in @see self::maybe_change_subscription_status(). * * @param string Default order status for orders paid for via checkout. Default 'pending' * @since 1.0.0 - Migrated from WooCommerce Subscriptions v2.0 * * @deprecated 6.3.0 */ public function maybe_preserve_order_status($order_status) { } } class WCS_Cart_Early_Renewal extends \WCS_Cart_Renewal { /** * The meta key used to store whether the subscription dates have been updated for an early renewal. * * @var string */ const SUBSCRIPTION_DATES_UPDATED_META_KEY = '_wcs_early_renewal_subscription_dates_updated'; /** * Bootstraps the class and hooks required actions & filters. */ public function __construct() { } /** * Adds a "Renew Now" button to the "View Subscription" page. * * @param array $actions The $subscription_key => $actions array with all actions that will be displayed for a subscription on the "View Subscription" page. * @param WC_Subscription $subscription The current subscription being viewed. * @since 2.3.0 * @return array $actions The subscription actions with the "Renew Now" action added if it's permitted. */ public function add_renew_now_action($actions, $subscription) { } /** * Check if a payment is being made on an early renewal order. */ public function maybe_setup_cart() { } /** * Copies the metadata from the subscription to the order created on checkout. * * @param WC_Order $order The WC Order object. * * @since 2.5.2 */ public function copy_subscription_meta_to_order($order) { } /** * Adds the early renewal metadata to the order created on checkout. * * @param WC_Order $order The WC Order object. * @param array $data The data posted on checkout. * @since 2.3.0 */ public function add_early_renewal_metadata_to_order($order, $data = array()) { } /** * Checks the cart to see if it contains a subscription renewal item. * * @see wcs_cart_contains_early_renewal(). * @return bool|array The cart item containing the renewal, else false. * @since 2.3.0 */ protected function cart_contains() { } /** * Get the subscription object used to construct the early renewal cart. * * @param array The resubscribe cart item. * @return WC_Subscription The subscription object. * @since 2.3.0 */ protected function get_order($cart_item = '') { } /** * Add a note to the subscription to record the creation of the early renewal order. * * @param int $order_id The order ID created on checkout. * @since 2.3.0 */ public function add_note_to_record_early_renewal($order_id) { } /** * Set the renewal order ID in early renewal order cart items. * * Hooked onto the 'woocommerce_checkout_update_order_meta' hook after the renewal order has been * created on checkout. Required so the line item ID set by @see WCS_Cart_Renewal->set_order_item_id() * matches the order. * * @param int $order_id The WC Order ID created on checkout. * @since 2.3.0 */ public function set_cart_item_renewal_order_data($order_id) { } /** * Filters the list of actions customers can make on an order from their My Account page. * * Unlike standard renewal orders early renewal orders can be cancelled and cannot be paid. * * This function is intended to run after @see WCS_Cart_Renewal::filter_my_account_my_orders_actions() which removes the cancel and pay option. * * @param array $actions A list of actions customers can make on an order from their My Account page. * @param WC_Order $order The order. * * @return array $actions */ public static function filter_early_renewal_order_actions($actions, $order) { } /** * Allow customers to cancel early renewal orders from their account page. * * Renewal orders are usually not cancellable because @see WC_Subscriptions_Renewal_Order::prevent_cancelling_renewal_orders() prevents the request from being processed. * In the case of early renewals, the customer has opted for early renewal and so should be able to cancel it. * * @since 2.3.0 */ public static function allow_early_renewal_order_cancellation() { } /** * Excludes core properties from being copied to the renewal order when an early renewal is created. * * These core order properties are set when the order is created via the checkout and should not be * copied from the subscription in case they were changed via the checkout process. * * @since 4.8.0 * * @param array $order_data The data to be copied to the early renewal order. Each value is keyed by the meta key. Example format [ '_meta_key' => 'meta_value' ]. * @return array $order_data The filtered set of order data. */ public function exclude_core_properties_from_copy($order_data) { } /** * Excludes core order meta properties from the meta copied from the subscription. * * Attached to the dynamic hook 'wcs_renewal_order_meta' which is triggered by wcs_copy_order_meta * when copying meta from the subscription to the early renewal order. * * @since 2.5.6 * @deprecated 4.8.0 * * @param array $order_meta The meta keys and values to copy from the subscription to the early renewal order. * @return array The subscription meta to copy to the early renewal order. */ public function exclude_core_order_meta_properties($order_meta) { } /** * Records successful and unsuccessful subscription payments for early renewal orders. * * @param int $order_id The ID of the order transitioned. * @param string $old_status The old order's status. * @param string $new_status The new order's status. * @param WC_Order $order The order object. Optional. Older versions of WC didn't provide this. Falls back to the order_id if not provided. */ public function maybe_record_subscription_payment($order_id, $old_status, $new_status, $order = \null) { } /** * Reattaches the function which handles renewal order payment status transitions. * * The default renewal order status transition is detached when processing an early renewal * order but needs to be reattached otherwise any renewal order status updates later in * this request will not be processed. * * @see self::maybe_record_subscription_payment() * * @since 5.2.0 */ public function reattach_renewal_order_status_handling() { } // DEPRECATED FUNCTIONS. /** * Update the next payment and end dates on a subscription to extend them and account * for early renewal. * * @deprecated 5.2.0 * * @param int $order_id The WC Order ID which contains an early renewal. * @since 2.3.0 */ public function maybe_update_dates($order_id) { } /** * Reactivates an on hold subscription when an early renewal order * is cancelled by the user. * * @param int $order_id The WC Order ID which contains an early renewal. * @since 2.3.0 */ public function maybe_reactivate_subscription($order_id) { } /** * Records an early renewal against order created on checkout (only for WooCommerce < 3.0). * * @param int $order_id The post_id of a shop_order post/WC_Order object. * @param array $posted_data The data posted on checkout. * @since 2.3.0 */ public function maybe_record_early_renewal($order_id, $posted_data) { } /** * Ensure customers can cancel early renewal orders. * * Renewal orders are usually not cancellable because @see WCS_Cart_Renewal::filter_my_account_my_orders_actions() prevents it. * In the case of early renewals, the customer has opted for early renewal and so should be able to cancel it. * * @param array $actions A list of actions customers can make on an order from their My Account page * @param WC_Order $order The order the list of actions relate to. * @return array $actions * @since 2.3.0 */ public static function add_cancel_order_action($actions, $order) { } } class WCS_Early_Renewal_Manager { /** * The early renewal enabled setting ID. * * @var string */ protected static $setting_id; /** * The early renewal via modal enabled setting ID. * * @var string */ protected static $via_modal_setting_id; /** * Initialize filters and hooks for class. * * @since 2.3.0 */ public static function init() { } /** * Add a setting to enable/disable the early renewal feature. * * @since 2.3.0 * @param array Settings array. * @return array */ public static function add_settings($settings) { } /** * A helper function to check if the early renewal feature is enabled or not. * * If the setting hasn't been set yet, by default it is off for existing stores and on for new stores. * * @since 2.3.0 * @return bool */ public static function is_early_renewal_enabled() { } /** * Finds if the store has enabled early renewal via a modal. * * @since 2.6.0 * @return bool */ public static function is_early_renewal_via_modal_enabled() { } /** * Gets the dates which need to be updated after an early renewal is processed. * * @since 2.6.0 * * @param WC_Subscription $subscription The subscription to calculate the dates for. * @return array The subscription dates which need to be updated. For example array( $date_type => $mysql_form_date_string ). */ public static function get_dates_to_update($subscription) { } } class WCS_Early_Renewal_Modal_Handler { /** * Attach callbacks. * * @since 2.6.0 */ public static function init() { } /** * Prints the early renewal modal for a specific subscription. If eligible. * * @since 2.6.0 * * @param WC_Subscription $subscription The subscription to print the modal for. */ public static function maybe_print_early_renewal_modal($subscription) { } /** * Prints the early renewal modal HTML. * * @since 2.6.0 * @param WC_Subscription $subscription The subscription to print the modal for. */ public static function output_early_renewal_modal($subscription) { } /** * Processes the request to renew early via the modal. * * @since 2.6.0 */ public static function process_early_renewal_request() { } /** * Checks if a user can renew a subscription early via the modal window. * * @param int|WC_Subscription $subscription Post ID of a 'shop_subscription' post, or instance of a WC_Subscription object. * @param int $user_id The ID of a user. Defaults to the current user. * @return boolean * * @since 3.0.5 */ public static function can_user_renew_early_via_modal($subscription, $user_id = 0) { } /** * Redirect the user after processing their early renewal request. * * @since 2.6.0 */ private static function redirect() { } /** * Removes filters which shouldn't run while processing early renewals via the modal. * * @since 2.6.0 */ private static function detach_renewal_callbacks() { } } /** * Subscriptions Core Payment Gateways * Hooks into the WooCommerce payment gateways class to add subscription specific functionality. * * @since 1.0.0 - Migrated from WooCommerce Subscriptions v4.0.0 */ class WC_Subscriptions_Core_Payment_Gateways { protected static $one_gateway_supports = array(); /** * @var bool $is_displaying_mini_cart */ protected static $is_displaying_mini_cart = \false; /** * Bootstraps the class and hooks required actions & filters. * * @since 1.0.0 - Migrated from WooCommerce Subscriptions v1.0 */ public static function init() { } /** * Instantiate our custom PayPal class * * @since 1.0.0 - Migrated from WooCommerce Subscriptions v2.0 */ public static function init_paypal() { } /** * Returns a payment gateway object by gateway's ID, or false if it could not find the gateway. * * @since 1.0.0 - Migrated from WooCommerce Subscriptions v1.2.4 */ public static function get_payment_gateway($gateway_id) { } /** * Only display the gateways which subscriptions-core supports * * @since 1.0.0 - Migrated from WooCommerce Subscriptions v4.0.0 * @param array $available_gateways * @return array */ public static function get_available_payment_gateways($available_gateways) { } /** * Check the content of the cart and add required payment methods. * * @param array $features of required features for the cart checkout. * * @return array list of features required by cart items. */ public static function inject_payment_feature_requirements_for_cart_api() { } /** * Helper function to check if at least one payment gateway on the site supports a certain subscription feature. * * @since 1.0.0 - Migrated from WooCommerce Subscriptions v2.0 */ public static function one_gateway_supports($supports_flag) { } /** * Improve message displayed on checkout when a subscription is in the cart but not gateways support subscriptions. * * @since 1.0.0 - Migrated from WooCommerce Subscriptions v1.5.2 */ public static function no_available_payment_methods_message($no_gateways_message) { } /** * Fire a gateway specific whenever a subscription's status is changed. * * @since 1.0.0 - Migrated from WooCommerce Subscriptions v2.0 */ public static function trigger_gateway_status_updated_hook($subscription, $new_status) { } /** * Display a list of each gateway supported features in a tooltip * * @since 1.0.0 - Migrated from WooCommerce Subscriptions v2.5.0 */ public static function payment_gateways_support_tooltip($status_html, $gateway) { } /** * Returns whether the subscription has an available payment gateway that's supported by subscriptions-core. * * @since 1.0.0 - Migrated from WooCommerce Subscriptions v1.0.0 * @param WC_Subscription $subscription Subscription to check if the gateway is available. * @return bool */ public static function has_available_payment_method($subscription) { } /** * Determines if subscriptions with a total of nothing (0) are allowed. * * @return bool */ public static function are_zero_total_subscriptions_allowed() { } /** * Returns whether the gateway supports subscriptions and automatic renewals. * * @since 1.3.0 * @param WC_Gateway $gateway Gateway to check if it supports subscriptions. * @return bool */ public static function gateway_supports_subscriptions($gateway) { } /** * The PayPal Checkout plugin checks for available payment methods on this hook * before enqueuing their SPB JS when displaying the buttons in the mini-cart widget. * * This function is hooked on to 0 priority to make sure we set $is_displaying_mini_cart to true before displaying the mini-cart. * * @since 1.6.0 * * @param string $title Widget title. * @param array $instance Array of widget data. * @param string $widget ID/name of the widget being displayed. * * @return string */ public static function before_displaying_mini_cart($title, $instance = array(), $widget_id = \null) { } /** * The PayPal Checkout plugin checks for available payment methods on this hook * before enqueuing their SPB JS when displaying the buttons in the mini-cart widget. * * This function is hooked on to priority 1000 to make sure we set $is_displaying_mini_cart back to false after any JS is enqueued for the mini-cart. * * @since 1.6.0 * * @param string $title Widget title. * @param array $instance Array of widget data. * @param string $widget ID/name of the widget being displayed. * * @return string */ public static function after_displaying_mini_cart($title, $instance = array(), $widget_id = \null) { } /** * Fire a gateway specific hook for when a subscription is activated. * * @since 1.0.0 - Migrated from WooCommerce Subscriptions v1.0 */ public static function trigger_gateway_activated_subscription_hook($user_id, $subscription_key) { } /** * Fire a gateway specific hook for when a subscription is activated. * * @since 1.0.0 - Migrated from WooCommerce Subscriptions v1.0 */ public static function trigger_gateway_reactivated_subscription_hook($user_id, $subscription_key) { } /** * Fire a gateway specific hook for when a subscription is on-hold. * * @since 1.0.0 - Migrated from WooCommerce Subscriptions v1.2 */ public static function trigger_gateway_subscription_put_on_hold_hook($user_id, $subscription_key) { } /** * Fire a gateway specific when a subscription is cancelled. * * @since 1.0.0 - Migrated from WooCommerce Subscriptions v1.0 */ public static function trigger_gateway_cancelled_subscription_hook($user_id, $subscription_key) { } /** * Fire a gateway specific hook when a subscription expires. * * @since 1.0.0 - Migrated from WooCommerce Subscriptions v1.0 */ public static function trigger_gateway_subscription_expired_hook($user_id, $subscription_key) { } } /** * Subscriptions Payment Gateways * * Hooks into the WooCommerce payment gateways class to add subscription specific functionality. * * @package WooCommerce Subscriptions * @subpackage WC_Subscriptions_Payment_Gateways * @category Class * @author Brent Shepherd * @since 1.0 */ class WC_Subscriptions_Payment_Gateways extends \WC_Subscriptions_Core_Payment_Gateways { /** * Init WC_Subscriptions_Payment_Gateways actions & filters. * * @since 4.0.0 */ public static function init() { } /** * Display the gateways which support subscriptions if manual payments are not allowed. * * @since 1.0 */ public static function get_available_payment_gateways($available_gateways) { } /** * Fire a gateway specific hook for when a subscription payment is due. * * @since 1.0 */ public static function gateway_scheduled_subscription_payment($subscription_id, $deprecated = \null) { } /** * Fire a gateway specific hook for when a subscription renewal payment is due. * * @param WC_Order $renewal_order The renewal order to trigger the payment gateway hook for. * @since 2.1.0 */ public static function trigger_gateway_renewal_payment_hook($renewal_order) { } /** * Returns whether the subscription payment gateway has an available gateway. * * @since 4.0.0 * @param WC_Subscription $subscription Subscription to check if the gateway is available. * @return bool */ public static function has_available_payment_method($subscription) { } /** * Returns whether the gateway supports subscriptions and automatic renewals. * * @since 4.0.0 * @param WC_Gateway $gateway Gateway to check if it supports subscriptions. * @return bool */ public static function gateway_supports_subscriptions($gateway) { } /** * Add links to find additional payment gateways to information after the Settings->Payments->Payment Methods table. */ public static function add_recurring_payment_gateway_information($settings, $option_prefix) { } } /** * WCS_Meta_Box_Payment_Retries Class */ class WCS_Meta_Box_Payment_Retries { /** * Outputs the Payment retry metabox. * * @param WC_Order|WP_Post $order The order object or post object. */ public static function output($order) { } } class WCS_Retry_Admin { /** * @var string The ID of the setting to enable/disable the retry system. */ public $setting_id; /** * Constructor */ public function __construct($setting_id) { } /** * Add a meta box to the Edit Order screen to display the retries relating to that order * * @param string $post_type Optional. Post type. Default empty. * @param WC_Order|WP_Post $order Optional. The Order object. Default null. If null, the global $post is used. */ public function add_meta_boxes($post_type = '', $order = \null) { } /** * Only display the retry payment date on the Edit Subscription screen if the subscription has a pending retry * and when that is the case, do not display the next payment date (because it will still be set to the original * payment date, in the past). * * @param bool $show_date_type * @param string $date_key * @param WC_Subscription $the_subscription * * @return bool */ public function maybe_hide_date_type($show_date_type, $date_key, $the_subscription) { } /** * Dispay the number of retries on a renewal order in the Orders list table. * * @param string $column The string of the current column * @param int $post_id The ID of the order * * @since 2.1 */ public static function add_column_content($column, $post_id) { } /** * Add a setting to enable/disable the retry system * * @param array * * @return null */ public function add_settings($settings) { } /** * Add system status information about custom retry rules. * * @param array $data * * @return array */ public static function add_system_status_content($data) { } } // Exit if accessed directly /** * WCS_Background_Updater Class * * Provide APIs for a debug tool to update data in the background using Action Scheduler. */ abstract class WCS_Background_Updater { /** * @var int The amount of time, in seconds, to give the background process to run the update. */ protected $time_limit; /** * @var string The hook used to schedule background updates. */ protected $scheduled_hook; /** * Attach callbacks to hooks */ public function init() { } /** * Get the items to be updated, if any. * * @return array An array of items to update, or empty array if there are no items to update. */ protected abstract function get_items_to_update(); /** * Run the update for a single item. * * @param mixed $item The item to update. */ protected abstract function update_item($item); /** * Update a set of items in the background. * * This method will loop over until there are no more items to update, or the process has been running for the * time limit set on the class @see $this->time_limit, which is 60 seconds by default (wall clock time, not * execution time). * * The $scheduler_hook is rescheduled before updating any items something goes wrong when processing a batch - it's * scheduled for $this->time_limit in future, so there's little chance of duplicate processes running at the same * time with WP Cron, but importantly, there is some chance so it should not be used for critical data, like * payments. Instead, it is intended for use for things like cache updates. It's also a good idea to use an atomic * update methods to avoid updating something that has already been updated in a separate request. * * Importantly, the overlap between the next scheduled update and the current batch is also useful for running * Action Scheduler via WP CLI, because it will allow for continuous execution of updates (i.e. updating a new * batch as soon as one batch has exceeded the time limit rather than having to run Action Scheduler via WP CLI * again later). */ public function run_update() { } /** * Schedule the instance's hook to run in $this->time_limit seconds, if it's not already scheduled. */ protected function schedule_background_update() { } /** * Unschedule the instance's hook in Action Scheduler */ protected function unschedule_background_updates() { } /** * Check whether the current request is via WP CLI * * @return bool */ protected function is_wp_cli_request() { } } abstract class WCS_Background_Upgrader extends \WCS_Background_Updater { /** * WC Logger instance for logging messages. * * @var WC_Logger_Interface */ protected $logger; /** * @var string The log file handle to write messages to. */ protected $log_handle; /** * Schedule the @see $this->scheduled_hook action to start repairing subscriptions in * @see $this->time_limit seconds (60 seconds by default). * * @since 1.0.0 - Migrated from WooCommerce Subscriptions v2.3.0 */ public function schedule_repair() { } /** * Add a message to the wcs-upgrade-subscriptions-paypal-suspended log * * @param string $message The message to be logged * @since 1.0.0 - Migrated from WooCommerce Subscriptions v2.3.0 */ protected function log($message) { } } /** * Class WCS_Retry_Background_Migrator. * * Updates our retries on background. * @since 2.4.0 */ class WCS_Retry_Background_Migrator extends \WCS_Background_Upgrader { /** * Where we're saving/migrating our data. * * @var WCS_Retry_Store */ private $destination_store; /** * Where the data comes from. * * @var WCS_Retry_Store */ private $source_store; /** * Our migration class. * * @var WCS_Retry_Migrator */ private $migrator; /** * construct. * * @param WC_Logger_Interface $logger The WC_Logger instance. * * @since 2.4.0 */ public function __construct(\WC_Logger_Interface $logger) { } /** * Get the items to be updated, if any. * * @return array An array of items to update, or empty array if there are no items to update. * @since 2.4.0 */ protected function get_items_to_update() { } /** * Run the update for a single item. * * @param WCS_Retry $retry The item to update. * * @return int|null * @since 2.4.0 */ protected function update_item($retry) { } /** * Unscheduled the instance's hook in Action Scheduler * @since 2.4.1 */ protected function unschedule_background_updates() { } } /** * Manage the process of retrying a failed renewal payment that previously failed. * * @package WooCommerce Subscriptions * @subpackage WCS_Retry_Manager * @category Class * @author Prospress * @since 2.1 */ class WCS_Retry_Manager { /* the rules that control the retry schedule and behaviour of each retry */ protected static $retry_rules = array(); /* an instance of the class responsible for storing retry data */ protected static $store; /* the setting ID for enabling/disabling the automatic retry system */ protected static $setting_id; /* property to store the instance of WCS_Retry_Admin */ protected static $admin; /** * Background updater to process retries from old store. * * @var WCS_Retry_Background_Migrator */ protected static $background_migrator; /** * Our table maker instance. * * @var WCS_Table_Maker */ protected static $table_maker; /** * Attach callbacks and set the retry rules * * @codeCoverageIgnore * @since 2.1 */ public static function init() { } /** * Attaches hooks that depend on WooCommerce being loaded. * * We need to use different hooks on stores that have HPOS enabled but to check if this feature * is enabled, we must wait for WooCommerce to be loaded first. * * @since 4.8.0 */ public static function attach_wc_dependant_hooks() { } /** * Adds any extra status that may be needed for a given order to check if it may * need payment * * @param array $statuses * @param WC_Order $order * @return array * @since 2.2.1 */ public static function check_order_statuses_for_payment($statuses, $order = \null) { } /** * A helper function to check if the retry system has been enabled or not * * @since 2.1 */ public static function is_retry_enabled() { } /** * Add a renewal retry date type to Subscriptions date types * * @since 2.1 */ public static function add_retry_date_type($subscription_date_types) { } /** * When a subscription's status is updated, if the new status isn't the expected retry subscription status, cancel the retry. * * @param object $subscription An instance of a WC_Subscription object * @param string $new_status A valid subscription status * @param string $old_status A valid subscription status */ public static function maybe_cancel_retry($subscription, $new_status, $old_status) { } /** * When a (renewal) order is trashed or deleted, make sure its retries are also trashed/deleted. * * @param int $order_id */ public static function maybe_cancel_retry_for_order($order_id) { } /** * When a retry's status is updated, if it's no longer pending or processing and it's the most recent retry, * delete the retry date on the subscriptions related to the order * * @param object $retry An instance of a WCS_Retry object * @param string $new_status A valid retry status */ public static function maybe_delete_payment_retry_date($retry, $new_status) { } /** * When a payment fails, apply a retry rule, if one exists that applies to this failure. * * @param WC_Subscription $subscription The subscription on which the payment failed. * @param WC_Order $last_order The order on which the payment failed (will be the most recent order on the subscription specified with the subscription param). * * @since 2.1 */ public static function maybe_apply_retry_rule($subscription, $last_order) { } /** * (Maybe) reapply last retry rule if: * - Payment is no-scheduled * - $last_order contains a Retry * - Retry contains a rule * * @param WC_Subscription $subscription The subscription on which the payment failed. * @param WC_Order $last_order The order on which the payment failed (will be the most recent order on the subscription specified with the subscription param). * * @since 2.5.0 */ public static function maybe_reapply_last_retry_rule($subscription, $last_order) { } /** * When a retry hook is triggered, check if the rules for that retry are still valid * and if so, retry the payment. * * @since 2.1.0 * @param WC_Order|int The order on which the payment failed. */ public static function maybe_retry_payment($order_id) { } /** * Determines if a renewal order and the last retry statuses are the same (used to determine if a payment method * change is needed) * * @since 2.2.8 */ public static function compare_order_and_retry_statuses($is_failed_order, $order_id, $order_status) { } /** * Loads/init our depended classes. * * @since 2.4 */ public static function load_dependant_classes() { } /** * Runs our upgrade background scripts. * * @param string $new_version Version we're upgrading to. * @param string $old_version Version we're upgrading from. * * @since 2.4 */ public static function upgrade($new_version, $old_version) { } /** * Is `woocommerce_scheduled_subscription_payment` or `woocommerce_scheduled_subscription_payment_retry` current action? * * @return boolean * * @since 2.5.0 */ protected static function is_scheduled_payment_attempt() { } /** * Access the object used to interface with the store. * * @return WCS_Retry_Store * @since 2.4 */ public static function store() { } /** * Get the class used for instantiating retry storage via self::store() * * @since 2.4 */ protected static function get_store_class() { } /** * Setup and access the object used to interface with retry rules * * @since 2.1 */ public static function rules() { } /** * Get the class used for instantiating retry rules via self::rules() * * @since 2.1 */ protected static function get_rules_class() { } /** * Initialise the store object used to interface with retry data. * * Hooked onto 'init' to allow third-parties to use their own data store * and to ensure WordPress is fully loaded. * * @since 2.4.1 */ public static function init_store() { } } abstract class WCS_Migrator { /** * @var mixed */ protected $source_store; /** * @var mixed */ protected $destination_store; /** * @var WC_Logger_Interface */ protected $logger; /** * @var string */ protected $log_handle; /** * WCS_Migrator constructor. * * @param mixed $source_store Source store. * @param mixed $destination_store $destination store. * @param WC_Logger $logger Logger component. * * @since 1.0.0 - Migrated from WooCommerce Subscriptions v2.4 */ public function __construct($source_store, $destination_store, $logger) { } /** * Should this entry be migrated. * * @param int $entry_id * * @return bool * @since 1.0.0 - Migrated from WooCommerce Subscriptions v2.4 */ public abstract function should_migrate_entry($entry_id); /** * Gets the item from the source store. * * @param int $entry_id * * @return mixed * @since 1.0.0 - Migrated from WooCommerce Subscriptions v2.4 */ public abstract function get_source_store_entry($entry_id); /** * save the item to the destination store. * * @param int $entry_id * * @return mixed * @since 1.0.0 - Migrated from WooCommerce Subscriptions v2.4 */ public abstract function save_destination_store_entry($entry_id); /** * deletes the item from the source store. * * @param int $entry_id * * @return mixed * @since 1.0.0 - Migrated from WooCommerce Subscriptions v2.4 */ public abstract function delete_source_store_entry($entry_id); /** * Runs after a entry has been migrated. * * @param int $old_entry_id * @param mixed $new_entry * * @return mixed */ protected abstract function migrated_entry($old_entry_id, $new_entry); /** * Migrates our entry. * * @param int $entry_id * * @return mixed * @since 1.0.0 - Migrated from WooCommerce Subscriptions v2.4 */ public function migrate_entry($entry_id) { } /** * Add a message to the log * * @param string $message The message to be logged * * @since 1.0.0 - Migrated from WooCommerce Subscriptions v2.4.0 */ protected function log($message) { } } class WCS_Retry_Migrator extends \WCS_Migrator { /** * @var WCS_Retry_Store */ protected $source_store; /** * @var WCS_Retry_Store */ protected $destination_store; /** * @var string */ protected $log_handle = 'wcs-retry-migrator'; /** * @var string */ protected static $needs_migration_option_name = 'wcs_payment_retry_needs_migration'; /** * Should this retry be migrated. * * @param int $retry_id * * @return bool * @since 2.4 */ public function should_migrate_entry($retry_id) { } /** * Gets the item from the source store. * * @param int $entry_id * * @return WCS_Retry * @since 2.4 */ public function get_source_store_entry($entry_id) { } /** * save the item to the destination store. * * @param int $entry_id * * @return mixed * @since 2.4 */ public function save_destination_store_entry($entry_id) { } /** * deletes the item from the source store. * * @param int $entry_id * * @return bool * @since 2.4 */ public function delete_source_store_entry($entry_id) { } /** * Add a message to the log * * @param int $old_retry_id Old retry id. * @param int $new_retry_id New retry id. */ protected function migrated_entry($old_retry_id, $new_retry_id) { } /** * If options exists, we need to run migration. * * @since 2.4.1 * @return bool */ public static function needs_migration() { } /** * Sets needs migration option. * * @since 2.4.1 */ public static function set_needs_migration() { } } /** * An instance of a failed payment retry rule. * * @package WooCommerce Subscriptions * @subpackage WCS_Retry_Rule * @category Class * @author Prospress * @since 2.1 */ class WCS_Retry_Rule { /* the rule_data that control the retry schedule and behaviour of each retry */ protected $rule_data = array(); /** * Set up the retry rules * * @since 2.1 */ public function __construct($rule_data) { } /** * Get the time to wait between when this rule is applied (i.e. payment failed) and the retry * should be processed. * * @return int * @since 2.1 */ public function get_retry_interval() { } /** * Check if this rule has an email template defined for sending to a specified recipient. * * @param string $recipient The email type based on recipient, either 'customer' or 'admin' * @return bool * @since 2.1 */ public function has_email_template($recipient = 'customer') { } /** * Get the email template this rule defined for sending to a specified recipient. * * @param string $recipient The email type based on recipient, either 'customer' or 'admin' * @return string * @since 2.1 */ public function get_email_template($recipient = 'customer') { } /** * Get the status to apply to one of the related objects when this rule is applied. * * @param string $object The object type the status should be applied to, either 'order' or 'subscription' * @return string * @since 2.1 */ public function get_status_to_apply($object = 'order') { } /** * Get rule data as a raw array. * * @return array * @since 2.1 */ public function get_raw_data() { } } /** * Setup the rules for retrying failed automatic renewal payments and provide methods for working with them. * * @package WooCommerce Subscriptions * @subpackage WCS_Retry_Rules * @category Class * @author Prospress * @since 2.1 */ class WCS_Retry_Rules { /* the class used to instantiate an individual retry rule */ protected $retry_rule_class; /* the rules that control the retry schedule and behaviour of each retry */ protected $default_retry_rules = array(); /** * Set up the retry rules * * @since 2.1 */ public function __construct() { } /** * Check if a retry rule exists for a certain stage of the retry process. * * @param int The retry queue position to check for a rule * @param int The ID of a WC_Order object to which the failed payment relates * @return bool * @since 2.1 */ public function has_rule($retry_number, $order_id) { } /** * Get an instance of a retry rule for a given order and stage of the retry queue (if any). * * @param int The retry queue position to check for a rule * @param int The ID of a WC_Order object to which the failed payment relates * @return null|WCS_Retry_Rule If a retry rule exists for this stage of the retry queue and order, WCS_Retry_Rule, otherwise null. * @since 2.1 */ public function get_rule($retry_number, $order_id) { } /** * Get the PHP class used ti instaniate a set of raw retry rule data. * * @since 2.1 */ public function get_rule_class() { } } // Exit if accessed directly abstract class WCS_Table_Maker { /** * @var int Increment this value to trigger a schema update */ protected $schema_version = 1; /** * @var array Names of tables that will be registered by this class */ protected $tables = array(); /** * Register tables with WordPress, and create them if needed */ public function register_tables() { } /** * @param string $table The name of the table * * @return string The CREATE TABLE statement, suitable for passing to dbDelta */ protected abstract function get_table_definition($table); /** * Determine if the database schema is out of date * by comparing the integer found in $this->schema_version * with the option set in the WordPress options table * * @return bool */ private function schema_update_required() { } /** * Gets the schema version name. * * @return string */ private function get_schema_option_name() { } /** * Gets the schema version we have. * * @return mixed */ private function get_schema_option() { } /** * Update the option in WordPress to indicate that * our schema is now up to date */ private function mark_schema_update_complete() { } /** * Update the schema for the given table * * @param string $table The name of the table to update */ private function update_table($table) { } /** * @param string $table * * @return string The full name of the table, including the * table prefix for the current blog */ protected function get_full_table_name($table) { } } // Exit if accessed directly class WCS_Retry_Table_Maker extends \WCS_Table_Maker { /** * @inheritDoc */ protected $schema_version = 1; /** * WCS_Retry_Table_Maker constructor. */ public function __construct() { } /** * @param string $table * * @return string * @since 2.4 */ protected function get_table_definition($table) { } } /** * An instance of a failed payment retry. * * @package WooCommerce Subscriptions * @subpackage WCS_Retry * @category Class * @author Prospress * @since 2.1 */ class WCS_Retry { /* the retry's ID */ protected $id; /* the renewal order to which the retry relates */ protected $order_id; /* the status of this retry */ protected $status; /* the date/time in UTC timezone on which this retry was run */ protected $date_gmt; /* an instance of the retry rules (WCS_Retry_Rule by default) applied for this retry */ protected $rule; /* the raw retry rules applied for this retry */ protected $rule_raw; /** * Get the Renewal Order which this retry was run for * * @return null */ public function __construct($args) { } /** * Get the Renewal Order which this retry was run for * * @return int */ public function get_id() { } /** * Get the ID of the renewal order which this retry was run for * * @return int */ public function get_order_id() { } /** * Get the Renewal Order which this retry was run for * * @return string */ public function get_status() { } /** * Update the status of a retry * * @since 2.1 */ public function update_status($new_status) { } /** * Get the date in the site's timezone when this retry was recorded * * @return string */ public function get_date() { } /** * Get the date in GMT/UTC timezone when this retry was recorded * * @return string */ public function get_date_gmt() { } /** * Update the status of a retry and set the date to reflect that * * @since 2.1 */ public function update_date_gmt($new_date) { } /** * Get the timestamp (in GMT/UTC timezone) when this retry was recorded * * @return string */ public function get_time() { } /** * Get an instance of the retry rule applied for this retry * * @return WCS_Retry_Rule */ public function get_rule() { } } /** * An interface for creating a store for retry details. * * @package WooCommerce Subscriptions * @subpackage WCS_Retry_Store * @category Class * @author Prospress * @since 2.1 */ abstract class WCS_Retry_Store { /** @var ActionScheduler_Store */ private static $store = \null; /** * Save the details of a retry to the database * * @param WCS_Retry $retry * * @return int the retry's ID */ public abstract function save(\WCS_Retry $retry); /** * Get the details of a retry from the database * * @param int $retry_id * * @return WCS_Retry */ public abstract function get_retry($retry_id); /** * Deletes a retry. * * @param int $retry_id * * @since 2.4 */ public function delete_retry($retry_id) { } /** * Get a set of retries from the database * * @param array $args A set of filters: * 'status': filter to only retries of a certain status, either 'pending', 'processing', 'failed' or 'complete'. Default: 'any', which will return all retries. * 'date_query': array of dates to filter retries to those that occur 'after' or 'before' a certain date (or between those two dates). Should be a MySQL formated date/time string. * 'orderby': Order by which property? * 'order': Order in ASC/DESC. * 'order_id': filter retries to those which belong to a certain order ID. * 'limit': How many retries we want to get. * @param string $return Defines in which format return the entries. options: * 'objects': Returns an array of WCS_Retry objects * 'ids': Returns an array of ids. * * @return array An array of WCS_Retry objects or ids. * @since 2.4 */ public abstract function get_retries($args = array(), $return = 'objects'); /** * Get the IDs of all retries from the database for a given order * * @param int $order_id * * @return array * @since 2.4 */ public function get_retry_ids_for_order($order_id) { } /** * Setup the class, if required * * @return null */ public abstract function init(); /** * Get the details of all retries (if any) for a given order * * @param int $order_id * * @return array */ public function get_retries_for_order($order_id) { } /** * Get the details of the last retry (if any) recorded for a given order * * @param int $order_id * * @return WCS_Retry | null */ public function get_last_retry_for_order($order_id) { } /** * Get the number of retries stored in the database for a given order * * @param int $order_id * * @return int */ public function get_retry_count_for_order($order_id) { } } // Exit if accessed directly class WCS_Retry_Database_Store extends \WCS_Retry_Store { /** * Custom table name we're using to store our retries data. * * @var string */ const TABLE_NAME = 'wcs_payment_retries'; /** * Init method. */ public function init() { } /** * Save the details of a retry to the database * * @param WCS_Retry $retry the Retry we want to save. * * @return int the retry's ID * @since 2.4 */ public function save(\WCS_Retry $retry) { } /** * Get the details of a retry from the database * * @param int $retry_id The retry we want to get. * * @return null|WCS_Retry * @since 2.4 */ public function get_retry($retry_id) { } /** * Deletes a retry. * * @param int $retry_id * * @return bool * @since 2.4 */ public function delete_retry($retry_id) { } /** * Get a set of retries from the database * * @param array $args A set of filters: * 'status': filter to only retries of a certain status, either 'pending', 'processing', 'failed' or 'complete'. Default: 'any', which will return all retries. * 'date_query': array of dates to filter retries to those that occur 'after' or 'before' a certain date (or between those two dates). Should be a MySQL formated date/time string. * 'orderby': Order by which property? * 'order': Order in ASC/DESC. * 'order_id': filter retries to those which belong to a certain order ID. * 'limit': How many retries we want to get. * @param string $return Defines in which format return the entries. options: * 'objects': Returns an array of WCS_Retry objects * 'ids': Returns an array of ids. * * @return array An array of WCS_Retry objects or ids. * @since 2.4 */ public function get_retries($args = array(), $return = 'objects') { } /** * Adds our table column to WP_Date_Query valid columns. * * @param array $columns Columns array we want to modify. * * @return array * @since 2.4 */ public function add_date_valid_column($columns) { } /** * Returns our table name with no prefix. * * @return string * @since 2.4 */ public static function get_table_name() { } /** * Returns the table name with prefix. * * @return string * @since 2.4 */ public static function get_full_table_name() { } } // Exit if accessed directly class WCS_Retry_Hybrid_Store extends \WCS_Retry_Store { /** * Where we're saving/migrating our data. * * @var WCS_Retry_Store */ private $database_store; /** * Where the data comes from. * * @var WCS_Retry_Store */ private $post_store; /** * Our migration class. * * @var WCS_Migrator */ private $migrator; /** * Setup the class, if required * * @since 2.4 */ public function init() { } /** * Save the details of a retry to the database * * @param WCS_Retry $retry Retry to save. * * @return int the retry's ID * @since 2.4 */ public function save(\WCS_Retry $retry) { } /** * Get the details of a retry from the database, and migrates when necessary. * * @param int $retry_id Retry we want to get. * * @return WCS_Retry * @since 2.4 */ public function get_retry($retry_id) { } /** * Deletes a retry. * * @param int $retry_id * * @return bool * @since 2.4 */ public function delete_retry($retry_id) { } /** * Get a set of retries from the database * * @param array $args A set of filters: * 'status': filter to only retries of a certain status, either 'pending', 'processing', 'failed' or 'complete'. Default: 'any', which will return all retries. * 'date_query': array of dates to filter retries to those that occur 'after' or 'before' a certain date (or between those two dates). Should be a MySQL formated date/time string. * 'orderby': Order by which property? * 'order': Order in ASC/DESC. * 'order_id': filter retries to those which belong to a certain order ID. * 'limit': How many retries we want to get. * @param string $return Defines in which format return the entries. options: * 'objects': Returns an array of WCS_Retry objects * 'ids': Returns an array of ids. * * @return array An array of WCS_Retry objects or ids. * @since 2.4 */ public function get_retries($args = array(), $return = 'objects') { } /** * Get the IDs of all retries from the database for a given order * * @param int $order_id order we want to look for. * * @return array * @since 2.4 */ public function get_retry_ids_for_order($order_id) { } } /** * Store retry details in the WordPress posts table as a custom post type * * @package WooCommerce Subscriptions * @subpackage WCS_Retry_Store * @category Class * @author Prospress * @since 2.1 */ class WCS_Retry_Post_Store extends \WCS_Retry_Store { protected static $post_type = 'payment_retry'; /** * Setup the class, if required * * @return null */ public function init() { } /** * Save the details of a retry to the database * * @param WCS_Retry $retry * @return int the retry's ID */ public function save(\WCS_Retry $retry) { } /** * Get the details of a retry from the database * * @param int $retry_id * @return WCS_Retry */ public function get_retry($retry_id) { } /** * Deletes a retry. * * @param int $retry_id * * @return bool */ public function delete_retry($retry_id) { } /** * Get a set of retries from the database * * @param array $args A set of filters: * 'status': filter to only retries of a certain status, either 'pending', 'processing', 'failed' or 'complete'. Default: 'any', which will return all retries. * 'date_query': array of dates to filter retries to those that occur 'after' or 'before' a certain date (or between those two dates). Should be a MySQL formated date/time string. * 'orderby': Order by which property? * 'order': Order in ASC/DESC. * 'order_id': filter retries to those which belong to a certain order ID. * 'limit': How many retries we want to get. * @param string $return Defines in which format return the entries. options: * 'objects': Returns an array of WCS_Retry objects * 'ids': Returns an array of ids. * * @return array An array of WCS_Retry objects or ids. * @since 2.4 */ public function get_retries($args = array(), $return = 'objects') { } } // Exit if accessed directly class WCS_Retry_Stores { /** * Where we're saving/migrating our data. * * @var WCS_Retry_Store */ private static $database_store; /** * Where the data comes from. * * @var WCS_Retry_Store */ private static $post_store; /** * Access the object used to interface with the destination store. * * @return WCS_Retry_Store * @since 2.4 */ public static function get_database_store() { } /** * Get the class used for instantiating retry storage via self::destination_store() * * @return string * @since 2.4 */ public static function get_database_store_class() { } /** * Access the object used to interface with the source store. * * @return WCS_Retry_Store * @since 2.4 */ public static function get_post_store() { } /** * Get the class used for instantiating retry storage via self::source_store() * * @return string * @since 2.4 */ public static function get_post_store_class() { } } /** * Customer Invoice * * An email sent to the customer via admin. * * @class WCS_Email_Customer_Renewal_Invoice * @version 1.0.0 - Migrated from WooCommerce Subscriptions v1.4 * @package WooCommerce_Subscriptions/Includes/Emails * @author Prospress * @extends WC_Email_Customer_Invoice */ class WCS_Email_Customer_Renewal_Invoice extends \WC_Email_Customer_Invoice { /** * Strings to find in subjects/headings. * @var array */ public $find = array(); /** * Strings to replace in subjects/headings. * @var array */ public $replace = array(); // fields used in WC_Email_Customer_Invoice this class doesn't need var $subject_paid = \null; var $heading_paid = \null; /** * Constructor */ function __construct() { } /** * Get the default e-mail subject. * * @param bool $paid Whether the order has been paid or not. * @since 1.0.0 - Migrated from WooCommerce Subscriptions v2.5.3 * @return string */ public function get_default_subject($paid = \false) { } /** * Get the default e-mail heading. * * @param bool $paid Whether the order has been paid or not. * @since 1.0.0 - Migrated from WooCommerce Subscriptions v2.5.3 * @return string */ public function get_default_heading($paid = \false) { } /** * trigger function. * * We need to override WC_Email_Customer_Invoice's trigger method because it expects to be run only once * per request (but multiple subscription renewal orders can be generated per request). * * @access public * @return void */ function trigger($order_id, $order = \null) { } /** * get_subject function. * * @access public * @return string */ function get_subject() { } /** * get_heading function. * * @access public * @return string */ function get_heading() { } /** * get_content_html function. * * @access public * @return string */ function get_content_html() { } /** * get_content_plain function. * * @access public * @return string */ function get_content_plain() { } /** * Initialise Settings Form Fields, but add an enable/disable field * to this email as WC doesn't include that for customer Invoices. * * @access public * @return void */ function init_form_fields() { } } /** * Customer Retry * * Email sent to the customer when an attempt to automatically process a subscription renewal payment has failed * and a retry rule has been applied to retry the payment in the future. * * @version 2.1 * @package WooCommerce_Subscriptions/Includes/Emails * @author Prospress * @extends WCS_Email_Customer_Renewal_Invoice */ class WCS_Email_Customer_Payment_Retry extends \WCS_Email_Customer_Renewal_Invoice { /** * Constructor */ function __construct() { } /** * Get the default e-mail subject. * * @param bool $paid Whether the order has been paid or not. * @since 2.5.3 * @return string */ public function get_default_subject($paid = \false) { } /** * Get the default e-mail heading. * * @param bool $paid Whether the order has been paid or not. * @since 2.5.3 * @return string */ public function get_default_heading($paid = \false) { } /** * trigger function. * * We can use most of WCS_Email_Customer_Renewal_Invoice's trigger method but we need to set up the * retry data ourselves before calling it as WCS_Email_Customer_Renewal_Invoice has no retry * associated with it. * * @access public * @return void */ function trigger($order_id, $order = \null) { } /** * get_subject function. * * @access public * @return string */ function get_subject() { } /** * get_heading function. * * @access public * @return string */ function get_heading() { } /** * get_content_html function. * * @access public * @return string */ function get_content_html() { } /** * get_content_plain function. * * @access public * @return string */ function get_content_plain() { } } /** * Admin payment retry email * * Email sent to admins when an attempt to automatically process a subscription renewal payment has failed * and a retry rule has been applied to retry the payment in the future. * * @class WCS_Email_Payment_Retry * @version 2.1 * @package WooCommerce_Subscriptions/Includes/Emails * @author Prospress * @extends WC_Email_Failed_Order */ class WCS_Email_Payment_Retry extends \WC_Email_Failed_Order { /** * Constructor */ public function __construct() { } /** * Get the default e-mail subject. * * @since 2.5.3 * @return string */ public function get_default_subject() { } /** * Get the default e-mail heading. * * @since 2.5.3 * @return string */ public function get_default_heading() { } /** * Trigger. * * @param int $order_id */ public function trigger($order_id, $order = \null) { } /** * Get content html. * * @access public * @return string */ public function get_content_html() { } /** * Get content plain. * * @return string */ public function get_content_plain() { } } /** * Manage the emails sent as part of the retry process * * @package WooCommerce Subscriptions * @subpackage WCS_Retry_Email * @category Class * @author Prospress * @since 2.1 */ class WCS_Retry_Email { /* a property to cache the order ID when detaching/reattaching default emails in favour of retry emails */ protected static $removed_emails_for_order_id; /** * Attach callbacks and set the retry rules * * @since 2.1 */ public static function init() { } /** * Add default retry email classes to the available WooCommerce emails * * @since 2.1 */ public static function add_emails($email_classes) { } /** * After a retry rule has been applied, send relevant emails for that rule. * * Attached to 'woocommerce_subscriptions_after_apply_retry_rule' with a low priority. * * @param WCS_Retry_Rule The retry rule applied. * @param WC_Order The order to which the retry rule was applied. * @since 2.1 */ public static function send_email($retry_rule, $last_order) { } /** * Don't send the renewal order invoice email to the customer or failed order email to the admin * when a payment fails if there are retry rules to apply as they define which email/s to send. * * @since 2.1 */ public static function maybe_detach_email($order_id) { } /** * Check if we removed emails for a given order, and if we did, reattach them to the corresponding hooks * * @since 2.1 */ public static function maybe_reattach_email($order_id, $old_status, $new_status) { } } /** * Line Item (product) Pending Switch * * Line items added to a subscription to record a switch are first given this line item type before transitioning to a fully fledged WC_Order_Item_Product. * * @author Prospress * @category Class * @package WooCommerce Subscriptions * @since 2.2.0 */ class WC_Order_Item_Pending_Switch extends \WC_Order_Item_Product { /** * Get item type. * * @return string * @since 2.2.0 */ public function get_type() { } } /** * A class to make it possible to switch between different subscriptions (i.e. upgrade/downgrade a subscription) * * @package WooCommerce Subscriptions * @subpackage WC_Subscriptions_Switcher * @category Class * @author Brent Shepherd * @since 1.4 */ class WC_Subscriptions_Switcher { /** * The last known switch total calculator instance which was calculated. * * @since 2.6.1 * @var WCS_Switch_Totals_Calculator */ protected static $switch_totals_calculator; /** * Bootstraps the class and hooks required actions & filters. * * @since 1.4 */ public static function init() { } /** * Attach WooCommerce version dependent hooks * * @since 2.2.0 */ public static function attach_dependant_hooks() { } /** * Handles the subscription upgrade/downgrade process. * * @since 1.4 */ public static function subscription_switch_handler() { } /** * When switching between grouped products, the Switch Subscription will take people to the grouped product's page. From there if they * click through to the individual products, they lose the switch. * * WooCommerce added a filter so we're able to modify the permalinks, passing through the switch parameter to the individual products' * pages. * * @param string $permalink The permalink of the product belonging to that group */ public static function add_switch_query_arg_grouped($permalink) { } /** * Slightly more awkward implementation for WooCommerce versions that do not have the woocommerce_grouped_product_list_link filter. * * @param string $permalink The permalink of the product belonging to the group * @param WP_Post $post The WP_Post object * * @return string modified string with the query arg present */ public static function add_switch_query_arg_post_link($permalink, $post) { } /** * Add Switch settings to the Subscription's settings page. * * @since 1.4 */ public static function add_settings($settings) { } /** * Render the wcs_switching_options setting field. * * @since 2.6.0 * @param array $data */ public static function switching_options_field_html($data) { } /** * Adds an Upgrade/Downgrade link on the View Subscription page for each item that can be switched. * * @param int $item_id The order item ID of a subscription line item * @param array $item An order line item * @param object $subscription A WC_Subscription object * @since 1.4 */ public static function print_switch_link($item_id, $item, $subscription) { } /** * The link for switching a subscription - the product page for variable subscriptions, or grouped product page for grouped subscriptions. * * @param WC_Subscription $subscription An instance of WC_Subscription * @param array $item An order item on the subscription * @since 2.0 */ public static function get_switch_url($item_id, $item, $subscription) { } /** * Add the switch parameters to a URL for a given subscription and item. * * @param int $subscription_id A subscription's post ID * @param int $item_id The order item ID of a subscription line item * @param string $permalink The permalink of the product * @param array $additional_query_args (optional) Additional query args to add to the switch URL * @since 2.0 */ protected static function add_switch_query_args($subscription_id, $item_id, $permalink, $additional_query_args = array()) { } /** * Check if a given cart item can be added to a subscription, or if a given subscription line item can be switched. * * For an item to be switchable, switching must be enabled, and the item must be for a variable subscription or * part of a grouped product (at the time the check is made, not at the time the subscription was purchased). * * The subscription must also be active and use manual renewals or use a payment method which supports cancellation. * * @since 2.6.0 * * @param string $action The action to perform ("add" or "switch"). * @param array|WC_Order_Item_Product $item An order item on the subscription to switch, or cart item to add. * @param WC_Subscription $subscription An instance of WC_Subscription */ protected static function is_action_allowed($action, $item, $subscription = \null) { } /** * Check if a cart item can be added to a subscription. * * The subscription must be active and use manual renewals or use a payment method which supports cancellation. * * @since 2.6.0 * * @param array $item A cart to add to a subscription. * @param WC_Subscription $subscription An instance of WC_Subscription */ public static function can_item_be_added($item, $subscription = \null) { } /** * Check if a given item on a subscription can be switched. * * For an item to be switchable, switching must be enabled, and the item must be for a variable subscription or * part of a grouped product (at the time the check is made, not at the time the subscription was purchased) * * The subscription must also be active and use manual renewals or use a payment method which supports cancellation. * * @param WC_Order_Item_Product $item An order item on the subscription to switch, or cart item to add. * @param WC_Subscription $subscription An instance of WC_Subscription * @since 2.0 */ public static function can_item_be_switched($item, $subscription = \null) { } /** * Checks if a user can perform a cart item "add" or order item "switch" action, given a subscription. * * @since 2.6.0 * * @param string $action An action to perform with the item ('add' or 'switch'). * @param WC_Order_Item_Product $item An order item to switch, or cart item to add. * @param WC_Subscription $subscription An instance of WC_Subscription. * @param int $user_id (optional) The ID of a user. Defaults to currently logged in user. */ protected static function can_user_perform_action($action, $item, $subscription, $user_id = 0) { } /** * Check if a given item can be added to a subscription by a given user. * * @since 2.6.0 * * @param array $item A cart item to add to a subscription. * @param WC_Subscription $subscription An instance of WC_Subscription. * @param int $user_id (optional) The ID of a user. Defaults to currently logged in user. */ public static function can_item_be_added_by_user($item, $subscription, $user_id = 0) { } /** * Check if a given item on a subscription can be switched by a given user. * * @param WC_Order_Item_Product $item An order item to switch. * @param WC_Subscription $subscription An instance of WC_Subscription. * @param int $user_id (optional) The ID of a user. Defaults to currently logged in user. * @since 2.0 */ public static function can_item_be_switched_by_user($item, $subscription, $user_id = 0) { } /** * If the order being generated is for switching a subscription, keep a record of some of the switch * routines meta against the order. * * @param int|\WC_Order $order_id The ID of a WC_Order object * @param array $posted The data posted on checkout * @since 1.4 */ public static function add_order_meta($order_id, $posted = array()) { } /** * To prorate sign-up fee and recurring amounts correctly when the customer switches a subscription multiple times, keep a record of the * amount for each on the order item. * * @param int $order_item_id The ID of a WC_Order_Item object. * @param array $cart_item The cart item's data. * @param string $cart_item_key The hash used to identify the item in the cart * @since 2.0 */ public static function add_order_item_meta($order_item_id, $cart_item, $cart_item_key) { } /** * Store switch related data on the line item on the subscription and switch order. * * For subscriptions: items on a new billing schedule are left to be added as new subscriptions, but we also want * to keep a record of them being a switch, so we do that here. * * For orders: to prorate sign-up fee and recurring amounts correctly when the customer switches a subscription * multiple times, keep a record of the amount for each on the order item. * * Attached to WC 3.0+ hooks and uses WC 3.0 methods. * * @param WC_Order_Item_Product $order_item * @param string $cart_item_key The hash used to identify the item in the cart * @param array $cart_item The cart item's data. * @param WC_Order $order The order or subscription object to which the line item relates * @since 2.2.0 */ public static function add_line_item_meta($order_item, $cart_item_key, $cart_item, $order) { } /** * Subscription items on a new billing schedule are left to be added as new subscriptions, but we also * want to keep a record of them being a switch, so we do that here. * * @param int $order_item_id The ID of a WC_Order_Item object. * @param array $cart_item The cart item's data. * @param string $cart_item_key The hash used to identify the item in the cart * @since 2.0 */ public static function set_subscription_item_meta($item_id, $cart_item, $cart_item_key) { } /** * Handle any subscription switch items on checkout (and before WC_Subscriptions_Checkout::process_checkout()) * * If the item is on the same billing schedule as the old subscription (and the next payment date is the same) or the * item is the only item on the subscription, the subscription item will be updated (and a note left on the order). * If the item is on a new billing schedule and there are other items on the existing subscription, the old item will * be removed and the new item will be added to a new subscription by @see WC_Subscriptions_Checkout::process_checkout() * * @param int|\WC_Order $order_id The post_id of a shop_order post/WC_Order * object * @param array $posted_data The data posted on checkout * @since 2.0 */ public static function process_checkout($order_id, $posted_data = array()) { } /** * Update shipping method on the subscription if the order changed anything * * @param WC_Order $order The new order * @param WC_Subscription $subscription The original subscription * @param WC_Cart $recurring_cart A recurring cart * @deprecated 4.8.0 */ public static function update_shipping_methods($subscription, $recurring_cart) { } /** * Updates address on the subscription if one of them is changed. * * @param WC_Order $order The new order * @param WC_Subscription $subscription The original subscription */ public static function maybe_update_subscription_address($order, $subscription) { } /** * Check if the cart includes any items which are to switch an existing subscription's contents. * * @since 2.0 * @param string $item_action Types of items to include ("any", "switch", or "add"). * @return bool|array Returns cart items that modify subscription contents, or false if no such items exist. */ public static function cart_contains_switches($item_action = 'switch') { } /** * Check if the cart includes any items which are to switch an existing subscription's item. * * @param int|object Either a product ID (not variation ID) or product object * @return bool True if the cart contains a switch for a given product, or false if it does not. * @since 2.0 */ public static function cart_contains_switch_for_product($product) { } /** * Triggers the woocommerce_subscriptions_switch_added_to_cart action hook when a subscription switch is added to the cart. * * @since 2.6.0 * * @param string $cart_item_key The new cart item's key. * @param int $product_id The product added to the cart. * @param int $quantity The cart item's quantity. * @param int $variation_id ID of the variation being added to the cart or 0. * @param array $variation_attributes The variation's attributes, if any. * @param array $cart_item_data The cart item's custom data. */ public static function trigger_switch_added_to_cart_hook($cart_item_key, $product_id, $quantity, $variation_id, $variation_attributes, $cart_item_data) { } /** * When a switch is added to the cart, add coupons which should be retained during switch. * * By default subscription coupons are not retained. Use woocommerce_subscriptions_retain_coupon_on_switch * and return true to copy coupons from the subscription into the cart. * * @since 2.6.0 * @param WC_Subscription $subscription */ public static function retain_coupons($subscription) { } /** * When a product is added to the cart, check if it is being added to switch a subscription and if so, * make sure it's valid (i.e. not the same subscription). * * @since 1.4 */ public static function validate_switch_request($is_valid, $product_id, $quantity, $variation_id = '') { } /** * When a subscription switch is added to the cart, store a record of pertinent meta about the switch. * * @since 1.4 */ public static function set_switch_details_in_cart($cart_item_data, $product_id, $variation_id) { } /** * Get the recurring amounts values from the session * * @since 1.4 */ public static function get_cart_from_session($cart_item_data, $cart_item, $key) { } /** * Make sure the sign-up fee on a subscription line item takes into account sign-up fees paid for switching. * * @param WC_Subscription $subscription * @param string $tax_inclusive_or_exclusive Defaults to the value tax setting stored on the subscription. * @return array $cart_item Details of an item in WC_Cart for a switch * @since 2.0 */ public static function subscription_items_sign_up_fee($sign_up_fee, $line_item, $subscription, $tax_inclusive_or_exclusive = '') { } /** * Set the subscription prices to be used in calculating totals by @see WC_Subscriptions_Cart::calculate_subscription_totals() * * @since 2.0 * @param WC_Cart The cart object which totals are being calculated. */ public static function calculate_prorated_totals($cart) { } /** * Make sure when displaying the first payment date for a switched subscription, the date takes into * account the switch (i.e. prepaid days and possibly a downgrade). * * @since 2.0 */ public static function recurring_cart_next_payment_date($first_renewal_date, $cart) { } /** * Make sure the end date of the switched subscription starts after already paid term * * @since 2.0 */ public static function recurring_cart_end_date($end_date, $cart, $product) { } /** * Make sure that a switch items cart key is based on it's first renewal date, not the date calculated for the product. * * @since 2.0 */ public static function get_recurring_cart_key($cart_key, $cart_item) { } /** * If the current request is to switch subscriptions, don't show a product's free trial period (because there is no * free trial for subscription switches) and also if the length is being prorateed, don't display the length until * checkout. * * @since 1.4 */ public static function customise_product_string_inclusions($inclusions, $product) { } /** * If a product is being marked as not purchasable because it is limited and the customer has a subscription, * but the current request is to switch the subscription, then mark it as purchasable. * * @since 1.4.4 * @return bool * @deprecated 2.1 */ public static function is_purchasable($is_purchasable, $product) { } /** * Do not carry over switch related meta data to renewal orders. * * @since 4.7.0 * * @see wc_subscriptions_renewal_order_data * * @param array $order_meta An order's meta data. * * @return array Filtered order meta data to be copied. */ public static function remove_renewal_order_meta($order_meta) { } /** * Do not carry over switch related meta data to renewal orders. * * @deprecated 4.7.0 * * @since 1.5.4 */ public static function remove_renewal_order_meta_query($order_meta_query) { } /** * Make the switch process persist even if the subscription product has Product Addons that need to be set. * * @since 1.5.6 */ public static function addons_add_to_cart_url($add_to_cart_url) { } /** * Completes subscription switches on completed order status changes. * * Commits all the changes calculated and saved by @see WC_Subscriptions_Switcher::process_checkout(), updating subscription * line items, schedule, dates and totals to reflect the changes made in this switch order. * * @param int $order_id The post_id of a shop_order post/WC_Order object * @param array $order_old_status The old order status * @param array $order_new_status The new order status * @since 2.1 */ public static function process_subscription_switches($order_id, $order_old_status, $order_new_status) { } /** * Checks if a product can be switched based on it's type and the types which can be switched * * @since 1.5.21 */ public static function is_product_of_switchable_type($product) { } /** * Check if a given subscription item was for upgrading/downgrading an existing item. * * @since 2.0 */ protected static function is_item_switched($item) { } /** * Do not display switch related order item meta keys unless Subscriptions is in debug mode. * * @since 2.0 */ public static function hidden_order_itemmeta($hidden_meta_keys) { } /** * Stop the switch link from printing on email templates * * @since 2.0 */ public static function remove_print_switch_link() { } /** * Add the print switch link filter back after the subscription items table has been created in email template * * @since 2.0 */ public static function add_print_switch_link($table_content) { } /** * Add the cart item upgrade/downgrade/crossgrade direction for display * * @since 2.0 */ public static function add_cart_item_switch_direction($product_subtotal, $cart_item, $cart_item_key) { } /** * Gets the switch direction of a cart item. * * @param array $cart_item Cart item object. * @return string|null Cart item subscription switch direction or null. */ public static function get_cart_item_switch_type($cart_item) { } /** * Creates a 2.0 updated version of the "subscriptions_switched" callback for developers to hook onto. * * The subscription passed to the new `woocommerce_subscriptions_switched_item` callback is strictly the subscription * to which the `$new_order_item` belongs to; this may be a new or the original subscription. * * @since 2.0.5 * @param WC_Order $order */ public static function maybe_add_switched_callback($order) { } /** * Revoke download permissions granted on the old switch item. * * @since 2.0.9 * @param WC_Subscription $subscription * @param array $new_item * @param array $old_item */ public static function remove_download_permissions_after_switch($subscription, $new_item, $old_item) { } /** * Completes subscription switches for switch order. * * Performs all the changes calculated and saved by @see WC_Subscriptions_Switcher::process_checkout(), updating subscription * line items, schedule, dates and totals to reflect the changes made in this switch order. * * @param WC_Order $order * @since 2.1 */ public static function complete_subscription_switches($order) { } /** * If we are switching a $0 / period subscription to a non-zero $ / period subscription, and the existing * subscription is using manual renewals but manual renewals are not forced on the site, we need to set a * flag to force WooCommerce to require payment so that we can switch the subscription to automatic renewals * because it was probably only set to manual because it was $0. * * We need to determine this here instead of on the 'woocommerce_cart_needs_payment' because when payment is being * processed, we will have changed the associated subscription data already, so we can't check that subscription's * values anymore. We determine it here, then ue the 'force_payment' flag on 'woocommerce_cart_needs_payment' to * require payment. * * @param int $total * @since 2.0.16 */ public static function set_force_payment_flag_in_cart($total) { } /** * Require payment when switching from a $0 / period subscription to a non-zero subscription to process * automatic payments for future renewals, as indicated by the 'force_payment' flag on the switch, set in * @see self::set_force_payment_flag_in_cart(). * * @param bool $needs_payment * @param object $cart * @since 2.0.16 */ public static function cart_needs_payment($needs_payment, $cart) { } /** * Once payment is processed on a switch from a $0 / period subscription to a non-zero $ / period subscription, if * payment was completed with a payment method which supports automatic payments, update the payment on the subscription * and the manual renewals flag so that future renewals are processed automatically. * * @param WC_Order $order * @since 2.1 */ public static function maybe_set_payment_method_after_switch($order) { } /** * Delay granting download permissions to the subscription until the switch is processed. * * @param int $order_id The order the download permissions are being granted for. * @since 2.2.13 */ public static function delay_granting_download_permissions($order_id) { } /** * Grant the download permissions to the subscription after the switch is processed. * * @param WC_Order The switch order. * @since 2.2.13 */ public static function grant_download_permissions($order) { } /** * Calculates the total amount a customer has paid in early renewals and switches since the last non-early renewal or parent order (inclusive). * * This function will map the current item back through multiple switches to make sure it finds the item that was present at the time of last parent/scheduled renewal. * * @since 2.6.0 * * @param WC_Subscription $subscription The Subscription. * @param WC_Order_Item $subscription_item The current line item on the subscription to map back through the related orders. * @param string $include_sign_up_fees Optional. Whether to include the sign-up fees paid. Can be 'include_sign_up_fees' or 'exclude_sign_up_fees'. Default 'include_sign_up_fees'. * @param WC_Order[] $orders_to_include Optional. The orders to include in the total. * * @return float The total amount paid for an existing subscription line item. */ public static function calculate_total_paid_since_last_order($subscription, $subscription_item, $include_sign_up_fees = 'include_sign_up_fees', $orders_to_include = array()) { } /** * Logs information about all the switches in the cart to the wcs-switch-cart-items log. * * @since 2.6.0 */ public static function log_switches() { } /** * Determines if a subscription item being switched is the last remaining item on the subscription after previous switches. * * If the item being switched is the last remaining item on the subscription after previous switches, then the subscription * can be updated even if the billing schedule is being changed. * * @param WC_Subscription $subscription The subscription being switched. * @param WC_Order_Item_Product $switched_item The subscription line item being switched. * @param array $switch_data Data about the switches that will occur on the subscription. * * @return bool True if the item being switched is the last remaining item on the subscription after previous switches. */ private static function is_last_remaining_item_after_previous_switches($subscription, $switched_item, $switch_data) { } /** * Adds switch orders or switched subscriptions to the related order meta box. * * @since 3.1.0 * * @param WC_Abstract_Order[] $orders_to_display The list of related orders to display. * @param WC_Subscription[] $subscriptions The list of related subscriptions. * @param WC_Order $order The order or subscription post being viewed. * * @return $orders_to_display The orders/subscriptions to display in the meta box. */ public static function display_switches_in_related_order_metabox($orders_to_display, $subscriptions, $order) { } /** Deprecated Methods **/ /** * Automatically set a switch order's status to complete (even if the items require shipping because * the order is simply a record of the switch and not indicative of an item needing to be shipped) * * @since 1.5 */ public static function subscription_switch_autocomplete($new_order_status, $order_id) { } /** * Once payment is processed on a switch from a $0 / period subscription to a non-zero $ / period subscription, if * payment was completed with a payment method which supports automatic payments, update the payment on the subscription * and the manual renewals flag so that future renewals are processed automatically. * * @param array $payment_processing_result * @param int $order_id * @since 2.0.16 * @deprecated 2.1 */ public static function maybe_set_payment_method($payment_processing_result, $order_id) { } /** * Override the order item quantity used to reduce stock levels when the order item is to record a switch and where no * prorated amount is being charged. * * @param int $quantity the original order item quantity used to reduce stock * @param WC_Order $order * @param array $order_item * * @return int */ public static function maybe_do_not_reduce_stock($quantity, $order, $order_item) { } /** * Make sure switch cart item price doesn't include any recurring amount by setting a free trial. * * @since 2.0.18 */ public static function maybe_set_free_trial($total = '') { } /** * Remove mock free trials from switch cart items. * * @since 2.0.18 */ public static function maybe_unset_free_trial($total = '') { } /** * Check if a cart item has a different billing schedule (period and interval) to the subscription being switched. * * Used to determine if a new subscription should be created as the result of a switch request. * @see self::cart_contains_subscription_creating_switch() and self::process_checkout(). * * @param array $cart_item * @param WC_Subscription $subscription * @since 2.2.19 */ protected static function has_different_billing_schedule($cart_item, $subscription) { } /** * Check if a cart item contains a different payment timestamp to the subscription being switched. * * Used to determine if a new subscription should be created as the result of a switch request. * @see self::cart_contains_subscription_creating_switch() and self::process_checkout(). * * @param array $cart_item * @param WC_Subscription $subscription * @since 2.2.19 */ protected static function has_different_payment_date($cart_item, $subscription) { } /** * Determine if a recurring cart has a different length (end date) to a subscription. * * Used to determine if a new subscription should be created as the result of a switch request. * @see self::cart_contains_subscription_creating_switch() and self::process_checkout(). * * @param WC_Cart $recurring_cart * @param WC_Subscription $subscription * @return bool * @since 2.2.19 */ protected static function has_different_length($recurring_cart, $subscription) { } /** * Checks if a subscription has a single line item. * * Used to determine if a new subscription should be created as the result of a switch request. * @see self::cart_contains_subscription_creating_switch() and self::process_checkout(). * * @param WC_Subscription $subscription * @return bool * @since 2.2.19 */ protected static function is_single_item_subscription($subscription) { } /** * Check if the cart contains a subscription switch which will result in a new subscription being created. * * New subscriptions will be created when: * - The current subscription has more than 1 line item @see self::is_single_item_subscription() and * - the recurring cart has a different length @see self::has_different_length() or * - the switched cart item has a different payment date @see self::has_different_payment_date() or * - the switched cart item has a different billing schedule @see self::has_different_billing_schedule() * * @return bool * @since 2.2.19 */ public static function cart_contains_subscription_creating_switch() { } /** * Filters the add to cart text for products during a switch request. * * @since 3.1.0 * * @param string $add_to_cart_text The product's default add to cart text. * @return string 'Switch subscription' during a switch, or the default add to cart text if switch args aren't present. */ public static function display_switch_add_to_cart_text($add_to_cart_text) { } /** * Don't allow switched subscriptions to be cancelled. * * @param bool $subscription_can_be_changed * @param array $subscription A subscription of the form created by @see WC_Subscriptions_Manager::get_subscription() * @since 1.4 * @deprecated 2.0 */ public static function can_subscription_be_cancelled($subscription_can_be_changed, $subscription) { } /** * Adds a "Switch" button to the "My Subscriptions" table for those subscriptions can be upgraded/downgraded. * * @param array $all_actions The $subscription_key => $actions array with all actions that will be displayed for a subscription on the "My Subscriptions" table * @param array $subscriptions All of a given users subscriptions that will be displayed on the "My Subscriptions" table * @since 1.4 * @deprecated 2.0 */ public static function add_switch_button($all_actions, $subscriptions) { } /** * The link for switching a subscription - the product page for variable subscriptions, or grouped product page for grouped subscriptions. * * @param string $subscription_key A subscription key of the form created by @see self::get_subscription_key() * @since 1.4 * @deprecated 2.0 */ public static function get_switch_link($subscription_key) { } /** * Add a 'new-subscription' handler to the WC_Subscriptions_Manager::can_subscription_be_changed_to() function. * * For the subscription to be switchable, switching must be enabled, and the subscription must: * - be active or on-hold * - be a variable subscription or part of a grouped product (at the time the check is made, not at the time the subscription was purchased) * - be using manual renewals or use a payment method which supports cancellation * * @param bool $subscription_can_be_changed Flag of whether the subscription can be changed to * @param string $new_status_or_meta The status or meta data you want to change the subscription to. Can be 'active', 'on-hold', 'cancelled', 'expired', 'trash', 'deleted', 'failed', 'AMQPChannel to the 'woocommerce_can_subscription_be_changed_to' filter. * @param object $args Set of values used in @see WC_Subscriptions_Manager::can_subscription_be_changed_to() for determining if a subscription can be changed * @since 1.4 * @deprecated 2.0 */ public static function can_subscription_be_changed_to($subscription_can_be_changed, $new_status_or_meta, $args) { } /** * Check if the cart includes a request to switch a subscription. * * @return bool Returns true if any item in the cart is a subscription switch request, otherwise, false. * @since 1.4 * @deprecated 2.0 */ public static function cart_contains_subscription_switch() { } /** * Previously, we used a trial period to make sure totals are calculated correctly (i.e. order total does not include any recurring * amounts) but we didn't want switched subscriptions to actually have a trial period, so reset the value on the order after checkout. * * This is all redundant now that trial period isn't stored on a subscription item. The first payment date will be used instead. * * @since 1.4 * @deprecated 2.0 */ public static function fix_order_item_meta($item_id, $values) { } /** * Add the next payment date to the end of the subscription to clarify when the new rate will be charged * * @since 1.4 * @deprecated 2.0 */ public static function customise_subscription_price_string($subscription_string) { } /** * Never display the trial period for a subscription switch (we're only setting it to calculate correct totals) * * @since 1.4 * @deprecated 2.0 */ public static function customise_cart_subscription_string_details($subscription_details) { } /** * Make sure when calculating the first payment date for a switched subscription, the date takes into * account the switch (i.e. prepaid days and possibly a downgrade). * * @since 1.4 * @deprecated 2.0 */ public static function calculate_first_payment_date($next_payment_date, $order, $product_id, $type) { } /** * Make sure anything requesting the first payment date for a switched subscription receives a date which * takes into account the switch (i.e. prepaid days and possibly a downgrade). * * This is necessary as the self::calculate_first_payment_date() is not called when the subscription is active * (which it isn't until the first payment is completed and the subscription is activated). * * @deprecated 2.0 */ public static function get_first_payment_date($next_payment_date, $subscription_key, $user_id, $type) { } /** * Add an i18n'ified string for the "switched" subscription status. * * @since 1.4 * @deprecated 2.0 */ public static function add_switched_status_string($status_string) { } /** * Set the subscription prices to be used in calculating totals by @see WC_Subscriptions_Cart::calculate_subscription_totals() * * @since 1.4 * @deprecated 2.0 */ public static function maybe_set_apporitioned_totals($total) { } /** * If the subscription purchased in an order has since been switched, include a link to the order placed to switch the subscription * in the "Related Orders" meta box (displayed on the Edit Order screen). * * @param WC_Order $order The current order. * @since 1.4 * @deprecated 2.0 */ public static function switch_order_meta_box_section($order) { } /** * After payment is completed on an order for switching a subscription, complete the switch. * * @param WC_Order|int $order A WC_Order object or ID of a WC_Order order. * @since 1.4 * @deprecated 2.0 */ public static function maybe_complete_switch($order_id) { } /** * Check if a given order was created to switch a subscription. * * @param WC_Order $order An order to check. * @return bool Returns true if the order switched a subscription, otherwise, false. * @since 1.4 */ public static function order_contains_subscription_switch($order_id) { } /** * Store the order line item id so it can be retrieved when we're processing the switch on checkout * * @param int $order_id * @param array $checkout_posted_data * @since 2.2.0 */ public static function set_switch_order_item_id($order_id, $posted_checkout_data) { } /** * Filter the WC_Subscription::get_related_orders() method to include switch orders. * * @since 2.0 * @deprecated * * @param array $related_orders * @param WC_Subscription $subscription * @param string $return_fields * @param string $order_type * * @return array */ public static function add_related_orders($related_orders, $subscription, $return_fields, $order_type) { } /** * If the subscription purchased in an order has since been switched, include a link to the order placed to switch the subscription * in the "Related Orders" meta box (displayed on the Edit Order screen). * * @param WC_Order $order The current order. * @since 1.4 * @deprecated 3.1.0 */ public static function switch_order_meta_box_rows($post) { } } /** * WooCommerce Subscriptions Switch Cart Item. * * A class to assist in the calculations required to record a switch. * * @package WooCommerce Subscriptions * @author Prospress * @since 2.6.0 */ class WCS_Switch_Cart_Item { /** * The cart item. * @var array */ public $cart_item; /** * The subscription being switched. * @var WC_Subscription */ public $subscription; /** * The existing subscription line item being switched. * @var WC_Order_Item_Product */ public $existing_item; /** * The instance of the new product in the cart. * @var WC_Product */ public $product; /** * The new product's variation or product ID. * @var int */ public $canonical_product_id; /** * The subscription's next payment timestamp. * @var int */ public $next_payment_timestamp; /** * The subscription's end timestamp. * @var int */ public $end_timestamp; /** * The subscription's last non-early renewal or parent order paid timestamp. * @var int */ public $last_order_paid_time; /** * The number of days since the @see $last_order_created_time. * @var int */ public $days_since_last_payment; /** * The number of days until the @see $next_payment_timestamp. * @var int */ public $days_until_next_payment; /** * The number of days in the old subscription's billing cycle. * @var int */ public $days_in_old_cycle; /** * The total paid for the existing item (@see $existing_item) in early renewals and switch orders since the last non-early renewal or parent order. * @var float */ public $total_paid_for_current_period; /** * The existing subscription item's price per day. * @var float */ public $old_price_per_day; /** * The number of days in the new subscription's billing cycle. * @var float */ public $days_in_new_cycle; /** * The new subscription product's price per day. * @var float */ public $new_price_per_day; /** * The switch type. * @var string Can be upgrade, downgrade or crossgrade. */ public $switch_type; /** * Whether the last order was a switch and was a fully reduced pre-paid term. * @var bool */ public $is_switch_after_fully_reduced_prepaid_term; /** * Constructor. * * @since 2.6.0 * * @param array $cart_item The cart item. * @param WC_Subscription $subscription The subscription being switched. * @param WC_Order_Item_Product $existing_item The subscription line item being switched. * * @throws Exception If WC_Subscriptions_Product::get_expiration_date() returns an invalid date. */ public function __construct($cart_item, $subscription, $existing_item) { } /** Getters */ /** * Gets the number of days until the next payment. * * @since 2.6.0 * @return int */ public function get_days_until_next_payment() { } /** * Gets the number of days in the old billing cycle. * * @since 2.6.0 * @return int */ public function get_days_in_old_cycle() { } /** * Gets the old subscription's price per day. * * @since 2.6.0 * @return float */ public function get_old_price_per_day() { } /** * Gets the number of days in the new billing cycle. * * @since 2.6.0 * @return int */ public function get_days_in_new_cycle() { } /** * Gets the number of days in the new billing cycle. * * @since 2.6.0 * @return float */ public function get_new_price_per_day() { } /** * Gets the subscription's last order paid time. * * @since 2.6.0 * @return int The paid timestamp of the subscription's last non-early renewal or parent order. If none of those are present, the subscription's start time will be returned. */ public function get_last_order_paid_time() { } /** * Gets the total paid for the existing item (@see $this->existing_item) in early renewals and switch orders since the last non-early renewal or parent order. * * @since 2.6.0 * @return float */ public function get_total_paid_for_current_period() { } /** * Gets the number of days since the last payment. * * @since 2.6.0 * @return int The number of days since the last non-early renewal or parent payment - rounded down. */ public function get_days_since_last_payment() { } /** * Gets the switch type. * * @since 2.6.0 * @return string Can be upgrade, downgrade or crossgrade. */ public function get_switch_type() { } /** Calculator functions */ /** * Calculates the number of days in the old cycle. * * @since 2.6.0 * @return int */ public function calculate_days_in_old_cycle() { } /** * Calculates the number of days in the new cycle. * * @since 2.6.0 * @return int */ public function calculate_days_in_new_cycle() { } /** Helper functions */ /** * Determines whether the new product is virtual or not. * * @since 2.6.0 * @return bool */ public function is_virtual_product() { } /** * Determines whether the new product's trial period matches the old product's trial period. * * @since 2.6.0 * @return bool */ public function trial_periods_match() { } /** * Determines whether the switch is happening while the subscription is still on trial. * * @since 2.6.0 * @return bool */ public function is_switch_during_trial() { } /** * Retrieves the subscription's last switch order. * * @since 3.0.7 * @return WC_Order|Null The last switch order or null if one doesn't exist. */ protected function get_last_switch_order() { } /** * Determines if the last order was a switch and the outcome of that was a fully reduced pre-paid term. * * A fully reduced pre-paid term occurs when the amount the customer has paid (in total including switches) doesn't cover the amount of time that has elapsed already at the new price per day. * * For example: * - Original purchase of a $70 / week subscription. * - 5 days into the subscription the customer switches to a $120 / 3 days. The lower freqency triggers the pre-paid term to be reduced. * - The $70 paid at $40 a day only entitles the customer to 1.75 days. * - Because they are already 5 days into the subscription, that $70 is fully absorbed at the new price and no time is 'owed'. * - The subscription starts today and the customer pays full price. * * @see https://docs.woocommerce.com/document/subscriptions/switching-guide/#section-11 * @see WCS_Switch_Totals_Calculator::reduce_prepaid_term() * * @since 3.0.7 * @return bool Whether the last order was a switch and it fully reduced the prepaid term. */ protected function is_switch_after_fully_reduced_prepaid_term() { } /** * Determines whether the customer is switching to a subscription with a length of 1 - one off payment. * * @since 3.0.12 * @return bool */ public function is_switch_to_one_payment_subscription() { } } /** * WooCommerce Subscriptions Add Cart Item. * * A class to assist in the calculations required to add an item to an existing subscription. * To enable proration, adding a product to a subscription inherits all the switch item (@see WCS_Switch_Cart_Item) functionality, however, doesn't have an existing item (@see WCS_Switch_Cart_Item::$existing_item) to replace. * * @package WooCommerce Subscriptions * @author Prospress * @since 2.6.0 */ class WCS_Add_Cart_Item extends \WCS_Switch_Cart_Item { /** * Constructor. * * An item being added to a subscription is just a switch item, without an existing item. * * @since 2.6.0 * * @param array $cart_item The cart item. * @param WC_Subscription $subscription The subscription being switched. * * @throws Exception If WC_Subscriptions_Product::get_expiration_date() returns an invalid date. */ public function __construct($cart_item, $subscription) { } /** Getters */ /** * Gets the old subscription's price per day. * * For items being added to a subscription, there is no old item's price and so 0 should be returned. * * @since 2.6.0 * @return float */ public function get_old_price_per_day() { } /** * Gets the total paid for the current period. * * For items being added to a subscription there isn't anything paid which needs to be honoured and so 0 has been paid. * * @since 2.6.0 * @return float */ public function get_total_paid_for_current_period() { } /** * Determines if the last order was a switch and the outcome of that was a fully reduced pre-paid term. * Since the last order didn't contain this item, we can safely return false here. * * @since 3.0.7 * @return bool Whether the last order was a switch and it fully reduced the prepaid term. */ protected function is_switch_after_fully_reduced_prepaid_term() { } /** Helper functions */ /** * Determines whether the new product's trial period matches the old product's trial period. * * For items being added to a subscription there isn't an existing item to match so false is returned. * * @since 2.6.0 * @return bool */ public function trial_periods_match() { } } /** * Subscriptions switching cart * * @author Prospress * @since 2.1 */ class WCS_Cart_Switch extends \WCS_Cart_Renewal { /* The flag used to indicate if a cart item is a subscription switch */ public $cart_item_key = 'subscription_switch'; /** * Initialise class hooks & filters when the file is loaded * * @since 2.1 */ public function __construct() { } /** * Attach WooCommerce version dependent hooks * * @since 2.2.0 */ public function attach_dependant_hooks() { } /** * Add flag to payment url for failed/ pending switch orders. * * @since 2.1 */ public function get_checkout_payment_url($pay_url, $order) { } /** * Check if a payment is being made on a switch order from 'My Account'. If so, * reconstruct the cart with the order contents. If the order item is part of a switch, load the necessary data * into $_GET and $_POST to ensure the switch validation occurs and the switch cart item meta is correctly loaded. * * @since 2.1 */ public function maybe_setup_cart() { } /** * Store the order line item id so it can be retrieved when we're processing the switch on checkout. * * @param string $cart_item_key * @param int $order_item_id * @since 2.2.1 */ protected function set_cart_item_order_item_id($cart_item_key, $order_item_id) { } /** * Overrides the place order button text on the checkout when the cart contains only switch requests. * * @since 3.1.0 * * @param string $place_order_text The place order button text. * @return string The place order button text. 'Switch subscription' if the cart contains only switches, otherwise the default. */ public function order_button_text($place_order_text) { } } /** * WooCommerce Subscriptions Switch Totals Calculator. * * A class to assist in calculating the upgrade cost, and next payment dates for switch items in the cart. * * @package WooCommerce Subscriptions * @author Prospress * @since 2.6.0 */ class WCS_Switch_Totals_Calculator { /** * Reference to the cart object. * * @var WC_Cart */ protected $cart = \null; /** * Whether to prorate the recurring price for all product types ('yes', 'yes-upgrade') or only for virtual products ('virtual', 'virtual-upgrade'). * * @var string */ protected $apportion_recurring_price = ''; /** * Whether to charge the full sign-up fee, a prorated sign-up fee or no sign-up fee. * * @var string Can be 'full', 'yes', or 'no'. */ protected $apportion_sign_up_fee = ''; /** * Whether to take into account the number of payments completed when determining how many payments the subscriber needs to make for the new subscription. * * @var string Can be 'virtual' (for virtual products only), 'yes', or 'no' */ protected $apportion_length = ''; /** * Whether store prices include tax. * * @var bool */ protected $prices_include_tax; /** * A cache of the cart item switch objects after they have had their totals calculated. * * @var WCS_Switch_Cart_Item[] */ protected $calculated_switch_items = array(); /** * Constructor. * * @since 2.6.0 * * @param WC_Cart $cart Cart object to calculate totals for. * @throws Exception If $cart is invalid WC_Cart object. */ public function __construct(&$cart = \null) { } /** * Loads the store's switch settings. * * @since 2.6.0 */ protected function load_settings() { } /** * Calculates the upgrade cost, and next payment dates for switch cart items. * * @since 2.6.0 */ public function calculate_prorated_totals() { } /** * Gets all the switch items in the cart as instances of @see WCS_Switch_Cart_Item. * * @since 2.6.0 * @return WCS_Switch_Cart_Item[] */ protected function get_switches_from_cart() { } /** Logic Functions */ /** * Determines whether the recurring price should be prorated based on the store's switch settings. * * @since 2.6.0 * @param WCS_Switch_Cart_Item $switch_item * @return bool */ protected function should_prorate_recurring_price($switch_item) { } /** * Determines whether the current subscription's prepaid term should reduced. * * @since 2.6.0 * @param WCS_Switch_Cart_Item $switch_item * @return bool */ protected function should_reduce_prepaid_term($switch_item) { } /** * Determines whether the current subscription's prepaid term should extended based on the store's switch settings. * * @since 2.6.0 * @return bool */ protected function should_extend_prepaid_term() { } /** * Determines whether the subscription length should be apportioned based on the store's switch settings and product type. * * @since 2.6.0 * @param WCS_Switch_Cart_Item $switch_item * @return bool */ protected function should_apportion_length($switch_item) { } /** Total Calculators */ /** * Apportions any sign-up fees if required. * * Implements the store's apportion sign-up fee setting (@see $this->apportion_sign_up_fee). * * @since 2.6.0 * @param WCS_Switch_Cart_Item $switch_item */ protected function apportion_sign_up_fees($switch_item) { } /** * Calculates the number of days the customer is entitled to at the new product's price per day and reduce the subscription's prepaid term to match. * * @since 2.6.0 * @param string $cart_item_key * @param WCS_Switch_Cart_Item $switch_item */ protected function reduce_prepaid_term($cart_item_key, $switch_item) { } /** * Calculates the upgrade cost for a given switch. * * @since 2.6.0 * @param WCS_Switch_Cart_Item $switch_item * @return float The amount to pay for the upgrade. */ protected function calculate_upgrade_cost($switch_item) { } /** * Calculates the number of days that have already been paid. * * @since 2.6.0 * @param int $old_total_paid The amount paid previously, such as the old recurring total * @param int $new_price_per_day The amount per day price for the new subscription * @return int $pre_paid_days The number of days paid for already */ protected function calculate_pre_paid_days($old_total_paid, $new_price_per_day) { } /** * Calculates the number of days the customer is owed at the new product's price per day and extend the subscription's prepaid term accordingly. * * @since 2.6.0 * @param string $cart_item_key * @param WCS_Switch_Cart_Item $switch_item */ protected function extend_prepaid_term($cart_item_key, $switch_item) { } /** * Calculates the new subscription's remaining length based on the expected number of payments and the number of payments which have already occurred. * * @since 2.6.0 * @param WCS_Switch_Cart_Item $switch_item */ protected function apportion_length($switch_item) { } /** Setters */ /** * Sets the first payment timestamp on the cart item. * * @since 2.6.0 * @param string $cart_item_key The cart item key. * @param int $first_payment_timestamp The first payment timestamp. */ public function set_first_payment_timestamp($cart_item_key, $first_payment_timestamp) { } /** * Sets the end timestamp on the cart item. * * @since 2.6.0 * @param string $cart_item_key The cart item key. * @param int $end_timestamp The subscription's end date timestamp. */ public function set_end_timestamp($cart_item_key, $end_timestamp) { } /** * Sets the switch type on the cart item. * * To preserve past tense for backward compatibility 'd' will be appended to the $switch_type. * * @since 2.6.0 * @param string $cart_item_key The cart item's key. * @param string $switch_type Can be upgrade, downgrade or crossgrade. */ public function set_switch_type_in_cart($cart_item_key, $switch_type) { } /** * Resets any previously calculated prorated price. * * @since 2.6.0 * @param WCS_Switch_Cart_Item $switch_item */ public function reset_prorated_price($switch_item) { } /** * Sets the upgrade cost on the cart item product instance as a sign up fee. * * @since 2.6.0 * @param WCS_Switch_Cart_Item $switch_item * @param float $extra_to_pay The upgrade cost. */ public function set_upgrade_cost($switch_item, $extra_to_pay) { } /** Getters */ /** * Gets the first payment timestamp. * * @since 2.6.0 * @param string $cart_item_key The cart item's key. * @return int */ protected function get_first_payment_timestamp($cart_item_key) { } /** * Calculates the cost of the upgrade when the customer pays the new product's full price minus the amount paid and still owing. * * This function is used when a switch results in a negative upgrade cost which typically occurs when stores use the `wcs_switch_proration_switch_type` filter to change the default switch type. * For example, if a customer is switching from a monthly subscription to a yearly subscription, they will pay the yearly product's full price minus whatever is still owed on the monthly product's price. * * eg $20/month switched to a $200 yearly product. The upgrade cost would be 200 - ((20/30) * days-left-in-the-current-billing-term). * Switching on the first day of the month would result in the following calculation: 200 - ((20/30) * 30) = 200 - 20 = 180. The full $20 is owed. * Switching halfway through the month would result in the following calculation: 200 - ((20/30) * 15) = 200 - 10 = 190. The customer is owed $10 or half what they paid. * * @param string $cart_item_key The switch item's cart item key. * @param WCS_Switch_Cart_Item $switch_item The switch item. * * @return float The upgrade cost. */ protected function calculate_fully_reduced_upgrade_cost($cart_item_key, $switch_item) { } /** Helpers */ /** * Logs the switch item data to the wcs-switch-cart-items file. * * @since 2.6.0 * @param WCS_Switch_Cart_Item $switch_item */ protected function log_switch($switch_item) { } /** * Logs information about all the calculated switches currently in the cart. * * @since 2.6.0 */ public function log_switches() { } } abstract class WCS_Background_Repairer extends \WCS_Background_Upgrader { /** * @var string The hook used to schedule background repairs for a specific object. */ protected $repair_hook; /** * An internal cache of items which need to be repaired. Used in cases where the updater runs out of processing time, so we can ensure remaining items are processed in the next request. * * @var array */ protected $items_to_repair = array(); /** * Attaches callbacks to hooks. * * @since 1.0.0 - Migrated from WooCommerce Subscriptions v2.6.0 * @see WCS_Background_Updater::init() for additional hooks and callbacks. */ public function init() { } /** * Schedules the @see $this->scheduled_hook action to run in * @see $this->time_limit seconds (60 seconds by default). * * Sets the page to 1. * * @since 1.0.0 - Migrated from WooCommerce Subscriptions v2.6.0 */ public function schedule_repair() { } /** * Gets a batch of items which need to be repaired. * * @since 1.0.0 - Migrated from WooCommerce Subscriptions v2.6.0 * @return array An array of items which need to be repaired. */ protected function get_items_to_update() { } /** * Runs the update and save any items which didn't get processed. * * @since 1.0.0 - Migrated from WooCommerce Subscriptions v2.6.0 */ public function run_update() { } /** * Schedules the repair event for this item. * * @since 1.0.0 - Migrated from WooCommerce Subscriptions v2.6.0 */ protected function update_item($item) { } /** * Gets the current page number. * * @since 1.0.0 - Migrated from WooCommerce Subscriptions v2.6.0 * @return int */ protected function get_page() { } /** * Sets the current page number. * * @since 1.0.0 - Migrated from WooCommerce Subscriptions v2.6.0 * @param int $page. */ protected function set_page($page) { } /** * Gets items from the last request which weren't processed. * * @since 1.0.0 - Migrated from WooCommerce Subscriptions v2.6.0 * @return array */ protected function get_unprocessed_items() { } /** * Saves any items which haven't been handled. * * @since 1.0.0 - Migrated from WooCommerce Subscriptions v2.6.0 */ protected function save_unprocessed_items() { } /** * Deletes any items stored in the unprocessed cache stored in an option. * * @since 1.0.0 - Migrated from WooCommerce Subscriptions v2.6.0 */ protected function clear_unprocessed_items_cache() { } /** * Unschedules the instance's hook in Action Scheduler and deletes the page counter. * * This function is called when there are no longer any items to update. * * @since 1.0.0 - Migrated from WooCommerce Subscriptions v2.6.0 */ protected function unschedule_background_updates() { } /** * Repairs an item. */ protected abstract function repair_item($item); /** * Get a batch of items which need to be repaired. * * @param int $page The page number to return results from. * @return array The items to repair. Each item must be a string or int. */ protected abstract function get_items_to_repair($page); } /** * Abstract Subscription Cache Manager Class * * Implements methods to deal with the soft caching layer * * @class WCS_Cache_Manager * @version 1.0.0 - Migrated from WooCommerce Subscriptions v2.0 * @package WooCommerce Subscriptions/Classes * @category Class * @author Gabor Javorszky */ abstract class WCS_Cache_Manager { public static final function get_instance() { } /** * WCS_Cache_Manager constructor. * * Loads the logger if it's not overwritten. */ abstract function __construct(); /** * Initialises some form of logger */ public abstract function load_logger(); /** * This method should implement adding to the log file * @return mixed */ public abstract function log($message); /** * Caches and returns data. Implementation can vary by classes. * * @return mixed */ public abstract function cache_and_get($key, $callback, $params = array(), $expires = \WEEK_IN_SECONDS); /** * Deletes a cached version of data. * * @return mixed */ public abstract function delete_cached($key); } /** * Define requirements for a customer data store and provide method for accessing active data store. * * A unified way to query customer data for subscriptions makes it possible to add a caching layer * to that data in the short term, and in the longer term seamlessly handle different storage for * customer data defined by WooCommerce core. This is important because at the time of writing, * the customer ID for an order is stored in a post meta field with the key '_customer_user', but * it is being moved to use the 'post_author' column of the posts table from WC v2.4 or v2.5. It * will eventually also be moved quite likely to custom tables. * * @version 1.0.0 - Migrated from WooCommerce Subscriptions v2.3.0 * @since 1.0.0 - Migrated from WooCommerce Subscriptions v2.3.0 * @category Class * @author Prospress */ abstract class WCS_Customer_Store { /** @var WCS_Customer_Store */ private static $instance = \null; /** * Get the IDs for a given user's subscriptions. * * @param int $user_id The id of the user whose subscriptions you want. * @return array */ public abstract function get_users_subscription_ids($user_id); /** * Get the active customer data store. * * @return WCS_Customer_Store */ public static final function instance() { } /** * Stub for initialising the class outside the constructor, for things like attaching callbacks to hooks. */ protected function init() { } } // Exit if accessed directly /** * WCS_Debug_Tool Class * * Add a debug tool to the WooCommerce > System Status > Tools page. */ abstract class WCS_Debug_Tool { /** * @var string $tool_key The key used to add the tool to the array of available tools. */ protected $tool_key; /** * @var array $tool_data Data for this tool, containing: * - 'name': The section name given to the tool * - 'button': The text displayed on the tool's button * - 'desc': The long description for the tool. * - 'callback': The callback used to perform the tool's action. */ protected $tool_data; /** * Attach callbacks to hooks and validate required properties are assigned values. */ public function init() { } /** * Add subscription related tools to display on the WooCommerce > System Status > Tools administration screen * * @param array $tools Arrays defining the tools displayed on the System Status screen * @return array */ public function add_debug_tools($tools) { } } // Exit if accessed directly /** * WCS_Debug_Tool_Cache_Updater Class * * Shared methods for tool on the WooCommerce > System Status > Tools page that need to * update a cached data store's cache. */ abstract class WCS_Debug_Tool_Cache_Updater extends \WCS_Debug_Tool { /** * @var mixed $data_Store The store used for updating the cache. */ protected $data_store; /** * Attach callbacks and hooks, if the class's data store is using caching. */ public function init() { } /** * Check if the store is a cache updater, and has methods required to erase or generate cache. */ protected function is_data_store_cached() { } } abstract class WCS_Deprecated_Functions_Handler { /** * The class this handler is responsible for. * * @var string */ protected $class = ''; /** * An array of functions which have been deprecated with their replacement (optional) and version they were deprecated. * * '{deprecated_function}' => array( * 'replacement' => string|array The replacement function to call. * 'version' => string The version the function was deprecated. * )... * * @var array[] */ protected $deprecated_functions = array(); /** * Determines if a function is deprecated and handled by this class. * * @since 1.0.0 - Migrated from WooCommerce Subscriptions v4.0.0 * * @param string $function The function to check. * @return bool */ public function is_deprecated($function) { } /** * Determines if there's a replacement function to call. * * @since 1.0.0 - Migrated from WooCommerce Subscriptions v4.0.0 * * @param string $function The deprecated function to check if there's a replacement for. * @return bool */ public function has_replacement($function) { } /** * Calls the replacement function if one exists. * * @since 1.0.0 - Migrated from WooCommerce Subscriptions v4.0.0 * * @param string $function The deprecated function. * @param array $arguments The deprecated function arguments. * * @return mixed Returns what ever the replacement function returns. */ public function call_replacement($function, $arguments = array()) { } /** * Triggers the deprecated notice. * * @since 1.0.0 - Migrated from WooCommerce Subscriptions v4.0.0 * @param string $function The deprecated function. */ public function trigger_notice($function) { } } /** * Provide shared utilities for deprecating actions and filters. * * Because Subscriptions v2.0 changed the way subscription data is stored and accessed, it needed * to deprecate a number of hooks which passed callbacks deprecated data structions, like the old * subscription array instead of a WC_Subscription object. * * This is the base class for handling those deprecated hooks. * * @package WooCommerce Subscriptions * @subpackage WCS_Hook_Deprecator * @category Class * @author Prospress * @since 1.0.0 - Migrated from WooCommerce Subscriptions v2.0 */ abstract class WCS_Hook_Deprecator { /* The hooks that have been deprecated, 'new_hook' => 'old_hook' */ protected $deprecated_hooks = array(); /** * Bootstraps the class and hooks required actions & filters. * * @since 1.0.0 - Migrated from WooCommerce Subscriptions v2.0 */ public function __construct() { } /** * Check if an old hook still has callbacks attached to it, and if so, display a notice and trigger the old hook. * * @since 1.0.0 - Migrated from WooCommerce Subscriptions v2.0 */ public function maybe_handle_deprecated_hook() { } /** * Check if an old hook still has callbacks attached to it, and if so, display a notice and trigger the old hook. * * @since 1.0.0 - Migrated from WooCommerce Subscriptions v2.0 */ protected function handle_deprecated_hook($new_hook, $old_hook, $new_callback_args, $return_value) { } /** * Display a deprecated notice for old hooks. * * @since 1.0.0 - Migrated from WooCommerce Subscriptions v2.0 */ protected static function display_notice($old_hook, $new_hook) { } /** * Trigger the old hook with the original callback parameters * * @since 1.0.0 - Migrated from WooCommerce Subscriptions v2.0 */ protected abstract function trigger_hook($old_hook, $new_callback_args); /** * Get the order for a subscription to pass to callbacks. * * Because a subscription can exist without an order in Subscriptions 2.0, the order might actually * fallback to being the subscription rather than the order used to purchase the subscription. * * @since 1.0.0 - Migrated from WooCommerce Subscriptions v2.0 */ protected static function get_order($subscription) { } /** * Get the order ID for a subscription to pass to callbacks. * * Because a subscription can exist without an order in Subscriptions 2.0, the order might actually * fallback to being the subscription rather than the order used to purchase the subscription. * * @since 1.0.0 - Migrated from WooCommerce Subscriptions v2.0 */ protected static function get_order_id($subscription) { } /** * Get the first product ID for a subscription to pass to callbacks. * * @since 1.0.0 - Migrated from WooCommerce Subscriptions v2.0 */ protected static function get_product_id($subscription) { } } /** * Deprecate actions and filters that use a dynamic hook by appending a variable, like a payment gateway's name. * * @package WooCommerce Subscriptions * @subpackage WCS_Hook_Deprecator * @category Class * @author Prospress * @since 1.0.0 - Migrated from WooCommerce Subscriptions v2.0 */ abstract class WCS_Dynamic_Hook_Deprecator extends \WCS_Hook_Deprecator { /* The prefixes of hooks that have been deprecated, 'new_hook' => 'old_hook_prefix' */ protected $deprecated_hook_prefixes = array(); /** * Bootstraps the class and hooks required actions & filters. * * We need to use the special 'all' hook here because we don't actually know the full hook names * in advance, just their prefix. We can't simply hook in to 'plugins_loaded' and check the * $wp_filter global for our hooks either, because sometime, hooks are dynamically hooked based * on other hooks. Sigh. * * @since 1.0.0 - Migrated from WooCommerce Subscriptions v2.0 */ public function __construct() { } /** * Check if the current hook contains the prefix of any dynamic hook that has been deprecated. * * @since 1.0.0 - Migrated from WooCommerce Subscriptions v2.0 */ public function check_for_deprecated_hooks() { } /** * Check if a given hook contains the prefix and if it does, attach the @see $this->maybe_handle_deprecated_hook() method * as a callback to it. * * @since 1.0.0 - Migrated from WooCommerce Subscriptions v2.0 */ protected function check_for_deprecated_hook($current_hook, $new_hook_prefix, $old_hook_prefix) { } } /** * Define requirements for a related order data store and provide method for accessing active data store. * * Orders can have a special relationship with a subscription if they are used to record a subscription related * transaction, like a renewal, upgrade/downgrade (switch) or resubscribe. The related order data store provides * a set of public APIs that can be used to query and manage that relationship. * * Parent orders are not managed via this data store as the order data stores inherited by Subscriptions already * provide APIs for managing the parent relationship. * * @version 1.0.0 - Migrated from WooCommerce Subscriptions v2.3.0 * @since 1.0.0 - Migrated from WooCommerce Subscriptions v2.3.0 * @category Class * @author Prospress */ abstract class WCS_Related_Order_Store { /** @var WCS_Related_Order_Store */ private static $instance = \null; /** * Types of relationships the data store supports. * * @var array */ private static $relation_types = array('renewal', 'switch', 'resubscribe'); /** * An array using @see self::$relation_types as keys for more performant checks by @see $this->check_relation_type(). * * Set when instantiated. * * @var array */ private static $relation_type_keys = array(); /** * Get the active related order data store. * * @return WCS_Related_Order_Store */ public static final function instance() { } /** * Stub for initialising the class outside the constructor, for things like attaching callbacks to hooks. */ protected function init() { } /** * Get orders related to a given subscription with a given relationship type. * * @param WC_Order $subscription The order or subscription for which calling code wants to find related orders. * @param string $relation_type The relationship between the subscription and the orders. Must be 'renewal', 'switch' or 'resubscribe' unless custom relationships are implemented. * * @return array */ public abstract function get_related_order_ids(\WC_Order $subscription, $relation_type); /** * Find subscriptions related to a given order in a given way, if any. * * @param WC_Order $order An order that may be linked with subscriptions. * @param string $relation_type The relationship between the subscription and the orders. Must be 'renewal', 'switch' or 'resubscribe. * @return array */ public abstract function get_related_subscription_ids(\WC_Order $order, $relation_type); /** * Helper function for linking an order to a subscription via a given relationship. * * @param WC_Order $order The order to link with the subscription. * @param WC_Order $subscription The order or subscription to link the order to. * @param string $relation_type The relationship between the subscription and the order. Must be 'renewal', 'switch' or 'resubscribe' unless custom relationships are implemented. */ public abstract function add_relation(\WC_Order $order, \WC_Order $subscription, $relation_type); /** * Remove the relationship between a given order and subscription. * * @param WC_Order $order An order that may be linked with subscriptions. * @param WC_Order $subscription A subscription or order to unlink the order with, if a relation exists. * @param string $relation_type The relationship between the subscription and the order. Must be 'renewal', 'switch' or 'resubscribe' unless custom relationships are implemented. */ public abstract function delete_relation(\WC_Order $order, \WC_Order $subscription, $relation_type); /** * Remove all related orders/subscriptions of a given type from an order. * * @param WC_Order $order An order that may be linked with subscriptions. * @param string $relation_type The relationship between the subscription and the order. Must be 'renewal', 'switch' or 'resubscribe' unless custom relationships are implemented. */ public abstract function delete_relations(\WC_Order $order, $relation_type); /** * Types of relationships the data store supports. * * @return array The possible relationships between a subscription and orders. Includes 'renewal', 'switch' or 'resubscribe' by default. */ public function get_relation_types() { } /** * Check if a given relationship is supported by the data store. * * @param string $relation_type The relationship between the subscription and the order. Must be 'renewal', 'switch' or 'resubscribe' unless custom relationships are implemented. * * @throws InvalidArgumentException If the given order relation is not a known type. */ protected function check_relation_type($relation_type) { } } /** * Base class for creating a scheduler * * Schedulers are responsible for triggering subscription events/action, like when a payment is due * or subscription expires. * * @class WCS_Scheduler * @version 1.0.0 - Migrated from WooCommerce Subscriptions v2.0.0 * @package WooCommerce Subscriptions/Abstracts * @category Abstract Class * @author Prospress */ abstract class WCS_Scheduler { /** @protected array The types of dates which this class should schedule */ protected $date_types_to_schedule; public function __construct() { } public function set_date_types_to_schedule() { } protected function get_date_types_to_schedule() { } /** * When a subscription's date is updated, maybe schedule an event * * @param object $subscription An instance of a WC_Subscription object * @param string $date_type Can be 'trial_end', 'next_payment', 'end', 'end_of_prepaid_term' or a custom date type * @param string $datetime A MySQL formatted date/time string in the GMT/UTC timezone. */ public abstract function update_date($subscription, $date_type, $datetime); /** * When a subscription's date is deleted, clear it from the scheduler * * @param object $subscription An instance of a WC_Subscription object * @param string $date_type Can be 'trial_end', 'next_payment', 'end', 'end_of_prepaid_term' or a custom date type */ public abstract function delete_date($subscription, $date_type); /** * When a subscription's status is updated, maybe schedule an event * * @param object $subscription An instance of a WC_Subscription object * @param string $new_status A valid subscription status * @param string $old_status A valid subscription status */ public abstract function update_status($subscription, $new_status, $old_status); } /** * Subscriptions Admin Class * * Adds a Subscription setting tab and saves subscription settings. Adds a Subscriptions Management page. Adds * Welcome messages and pointers to streamline learning process for new users. * * @package WooCommerce Subscriptions * @subpackage WC_Subscriptions_Admin * @category Class * @since 1.0.0 - Migrated from WooCommerce Subscriptions v1.0 */ class WC_Subscriptions_Admin { /** * The WooCommerce settings tab name * * @since 1.0.0 - Migrated from WooCommerce Subscriptions v1.0 */ public static $tab_name = 'subscriptions'; /** * The prefix for subscription settings * * @since 1.0.0 - Migrated from WooCommerce Subscriptions v1.0 */ public static $option_prefix = 'woocommerce_subscriptions'; /** * Store an instance of the list table * * @since 1.0.0 - Migrated from WooCommerce Subscriptions v1.4.6 */ private static $subscriptions_list_table; /** * Store an instance of the list table * * @since 1.0.0 - Migrated from WooCommerce Subscriptions v2.0 */ private static $found_related_orders = \false; /** * Is meta boxes saved once? * * @var boolean * @since 1.0.0 - Migrated from WooCommerce Subscriptions v2.2.0 */ private static $saved_product_meta = \false; /** * Bootstraps the class and hooks required actions & filters. * * @since 1.0.0 - Migrated from WooCommerce Subscriptions v1.0 */ public static function init() { } /** * Clear all transients data we have when the WooCommerce::Tools::Clear Transients action is * triggered. * * @since 1.0.0 - Migrated from WooCommerce Subscriptions v2.1.1 * * @return null */ public static function clear_subscriptions_transients() { } /** * Add the 'subscriptions' product type to the WooCommerce product type select box. * * @param array Array of Product types & their labels, excluding the Subscription product type. * @return array Array of Product types & their labels, including the Subscription product type. * @since 1.0.0 - Migrated from WooCommerce Subscriptions v1.0 */ public static function add_subscription_products_to_select($product_types) { } /** * Add options for downloadable and virtual subscription products to the product type selector on the WooCommerce products screen. * * @param array $product_types * @return array * @since 1.0.0 - Migrated from WooCommerce Subscriptions v2.5.1 */ public static function add_downloadable_and_virtual_filters($product_types) { } /** * Modifies the main query on the WooCommerce products screen to correctly handle filtering by virtual and downloadable * product types. * * @param array $query_vars * @return array $query_vars * @since 1.0.0 - Migrated from WooCommerce Subscriptions v2.5.1 */ public static function modify_downloadable_and_virtual_product_queries($query_vars) { } /** * Output the subscription specific pricing fields on the "Edit Product" admin page. * * @since 1.0.0 - Migrated from WooCommerce Subscriptions v1.0 */ public static function subscription_pricing_fields() { } /** * Output subscription shipping options on the "Edit Product" admin screen * * @since 1.0.0 - Migrated from WooCommerce Subscriptions v2.0 */ public static function subscription_shipping_fields() { } /** * Output advanced subscription options on the "Edit Product" admin screen * @deprecated 1.0.0 - Migrated from WooCommerce Subscriptions v2.1 * @since 1.0.0 - Migrated from WooCommerce Subscriptions v1.3.5 */ public static function subscription_advanced_fields() { } /** * Output the subscription specific pricing fields on the "Edit Product" admin page. * * @since 1.0.0 - Migrated from WooCommerce Subscriptions v1.3 */ public static function variable_subscription_pricing_fields($loop, $variation_data, $variation) { } /** * Output extra options in the Bulk Edit select box for editing Subscription terms. * * @since 1.0.0 - Migrated from WooCommerce Subscriptions v1.3 */ public static function variable_subscription_bulk_edit_actions() { } /** * Save meta data for simple subscription product type when the "Edit Product" form is submitted. * * @param array Array of Product types & their labels, excluding the Subscription product type. * @return array Array of Product types & their labels, including the Subscription product type. * @since 1.0.0 - Migrated from WooCommerce Subscriptions v1.0 */ public static function save_subscription_meta($post_id) { } /** * Save meta data for variable subscription product type when the "Edit Product" form is submitted. * * @param array Array of Product types & their labels, excluding the Subscription product type. * @return array Array of Product types & their labels, including the Subscription product type. * @since 1.0.0 - Migrated from WooCommerce Subscriptions v2.0 */ public static function save_variable_subscription_meta($post_id) { } /** * Calculate and set a simple subscription's prices when edited via the bulk edit * * @param object $product An instance of a WC_Product_* object. * @return null * @since 1.0.0 - Migrated from WooCommerce Subscriptions v1.3.9 */ public static function bulk_edit_save_subscription_meta($product) { } /** * Save a variable subscription's details when the edit product page is submitted for a variable * subscription product type (or the bulk edit product is saved). * * @param int $post_id ID of the parent WC_Product_Variable_Subscription * @return null * @since 1.0.0 - Migrated from WooCommerce Subscriptions v1.3 */ public static function process_product_meta_variable_subscription($post_id) { } /** * Save meta info for subscription variations * * @param int $variation_id * @param int $i * return void * @since 1.0.0 - Migrated from WooCommerce Subscriptions v2.0 */ public static function save_product_variation($variation_id, $index) { } /** * Make sure when saving a subscription via the admin to activate it, it has a valid customer set on it. * * When you click "Add New Subscription", the status is already going to be pending to begin with. This will prevent * changing the status to anything else besides pending if no customer is specified, or the customer specified is * not a valid WP_User. * * Hooked into `woocommerce_subscription_pre_update_status` * * @param string $old_status Previous status of the subscription in update_status * @param string $new_status New status of the subscription in update_status * @param WC_Subscription $subscription The subscription being saved * * @return null * @throws Exception in case there was no user found / there's no customer attached to it */ public static function check_customer_is_set($old_status, $new_status, $subscription) { } /** * Set default values for subscription dropdown fields when bulk adding variations to fix issue #1342 * * @param int $variation_id ID the post_id of the variation being added * @return null */ public static function set_variation_meta_defaults_on_bulk_add($variation_id) { } /** * Adds all necessary admin styles. * * @param array Array of Product types & their labels, excluding the Subscription product type. * @return array Array of Product types & their labels, including the Subscription product type. * @since 1.0.0 - Migrated from WooCommerce Subscriptions v1.0 */ public static function enqueue_styles_scripts() { } /** * Add the "Active Subscriber?" column to the User's admin table */ public static function add_user_columns($columns) { } /** * Hooked to the users table to display a check mark if a given user has an active subscription. * * @param string $value The string to output in the column specified with $column_name * @param string $column_name The string key for the current column in an admin table * @param int $user_id The ID of the user to which this row relates * @return string $value A check mark if the column is the active_subscriber column and the user has an active subscription. * @since 1.0.0 - Migrated from WooCommerce Subscriptions v1.0 */ public static function user_column_values($value, $column_name, $user_id) { } /** * Outputs the Subscription Management admin page with a sortable @see WC_Subscriptions_List_Table used to * display all the subscriptions that have been purchased. * * @uses WC_Subscriptions_List_Table * @since 1.0.0 - Migrated from WooCommerce Subscriptions v1.0 */ public static function subscriptions_management_page() { } /** * Outputs the screen options on the Subscription Management admin page. * * @since 1.0.0 - Migrated from WooCommerce Subscriptions v1.3.1 */ public static function add_manage_subscriptions_screen_options() { } /** * Sets the correct value for screen options on the Subscription Management admin page. * * @since 1.0.0 - Migrated from WooCommerce Subscriptions v1.3.1 */ public static function set_manage_subscriptions_screen_option($status, $option, $value) { } /** * Returns the columns for the Manage Subscriptions table, specifically used for adding the * show/hide column screen options. * * @since 1.0.0 - Migrated from WooCommerce Subscriptions v1.3.1 */ public static function get_subscription_table_columns($columns) { } /** * Returns the columns for the Manage Subscriptions table, specifically used for adding the * show/hide column screen options. * * @since 1.0.0 - Migrated from WooCommerce Subscriptions v1.3.1 */ public static function get_subscriptions_list_table() { } /** * Uses the WooCommerce options API to save settings via the @see woocommerce_update_options() function. * * @uses woocommerce_update_options() * @uses self::get_settings() * @since 1.0.0 - Migrated from WooCommerce Subscriptions v1.0 */ public static function update_subscription_settings() { } /** * Uses the WooCommerce admin fields API to output settings via the @see woocommerce_admin_fields() function. * * @uses woocommerce_admin_fields() * @uses self::get_settings() * @since 1.0.0 - Migrated from WooCommerce Subscriptions v1.0 */ public static function subscription_settings_page() { } /** * Add the Subscriptions settings tab to the WooCommerce settings tabs array. * * @param array $settings_tabs Array of WooCommerce setting tabs & their labels, excluding the Subscription tab. * @return array $settings_tabs Array of WooCommerce setting tabs & their labels, including the Subscription tab. * @since 1.0.0 - Migrated from WooCommerce Subscriptions v1.0 */ public static function add_subscription_settings_tab($settings_tabs) { } /** * Sets default values for all the WooCommerce Subscription options. Called on plugin activation. * * @see WC_Subscriptions::activate_woocommerce_subscriptions * @since 1.0.0 - Migrated from WooCommerce Subscriptions v1.0 */ public static function add_default_settings() { } /** * Deteremines if the subscriptions settings have been setup. * * @since 1.0.0 - Migrated from WooCommerce Subscriptions v4.0.0 * @return bool Whether any subscription settings exist. */ public static function has_settings() { } /** * Get all the settings for the Subscriptions extension in the format required by the @see woocommerce_admin_fields() function. * * @return array Array of settings in the format required by the @see woocommerce_admin_fields() function. * @since 1.0.0 - Migrated from WooCommerce Subscriptions v1.0 */ public static function get_settings() { } /** * Displays instructional information for a WooCommerce setting. * * @since 1.0.0 - Migrated from WooCommerce Subscriptions v1.0 */ public static function add_informational_admin_field($field_details) { } /** * Checks whether a user should be shown pointers or not, based on whether a user has previously dismissed pointers. * * @since 1.0.0 - Migrated from WooCommerce Subscriptions v1.0 */ public static function show_user_pointers() { } /** * Returns a URL for adding/editing a subscription, which special parameters to define whether pointers should be shown. * * The 'select_subscription' flag is picked up by JavaScript to set the value of the product type to "Subscription". * * @since 1.0.0 - Migrated from WooCommerce Subscriptions v1.0 */ public static function add_subscription_url($show_pointers = \true) { } /** * Searches through the list of active plugins to find WooCommerce. Just in case * WooCommerce resides in a folder other than /woocommerce/ * * @since 1.0.0 - Migrated from WooCommerce Subscriptions v1.0 */ public static function get_woocommerce_plugin_dir_file() { } /** * Filter the "Orders" list to show only orders associated with a specific subscription. * * @param string $where * @return string * @since 1.0.0 - Migrated from WooCommerce Subscriptions v2.0 */ public static function filter_orders($where) { } /** * Filters the Orders Table in HPOS to display_renewal_filter_noticehow only orders associated with a specific subscription. * * @since 5.2.0 * * @param array $query_vars The query variables. * * @return array The query variables. */ public static function filter_orders_table_by_related_orders($query_vars) { } /** * Filters the Admin orders and subscriptions table results in HPOS based on a list of IDs returned by a report query. * * @since 7.1.0 * * @param array $clauses The query clause. * * @return array $clauses The query clause with additional `where` clause . */ public static function filter_orders_and_subscriptions_from_order_table($clauses) { } /** * Filters the Admin orders and subscriptions table results based on a list of IDs returned by a report query. * * @since 1.0.0 - Migrated from WooCommerce Subscriptions v2.6.2 * * @param string $where The query WHERE clause. * @return string $where */ public static function filter_orders_and_subscriptions_from_list($where) { } /** * Filter the "Orders" list to show only paid subscription orders for a particular user * * @param string $where * @return string * @since 1.0.0 - Migrated from WooCommerce Subscriptions v2.5.3 */ public static function filter_paid_subscription_orders_for_user($where) { } /** * Display a notice indicating that the "Orders" list is filtered. * @see self::filter_orders() */ public static function display_renewal_filter_notice() { } /** * Returns either a string or array of strings describing the allowable trial period range * for a subscription. * * @since 1.0.0 - Migrated from WooCommerce Subscriptions v1.0 */ public static function get_trial_period_validation_message($form = 'combined') { } /** * Displays the content for the [subscriptions] shortcode. * * The subscriptions shortcode can be used to display customer subscriptions similar to the my account list page. * Shortcode args enable filtering by status and user ID. * * @param array $attributes shortcode attributes. * @return string The shortcode content. */ public static function do_subscriptions_shortcode($attributes) { } /** * Adds Subscriptions specific details to the WooCommerce System Status report. * * @param array $attributes Shortcode attributes. * @return array */ public static function add_system_status_items($debug_data) { } /** * A WooCommerce version aware function for getting the Subscriptions admin settings * tab URL. * * @since 1.0.0 - Migrated from WooCommerce Subscriptions v1.4.5 * @return string */ public static function settings_tab_url() { } /** * Add a column to the Payment Gateway table to show whether the gateway supports automated renewals. * * @param array $header * * @since 1.0.0 - Migrated from WooCommerce Subscriptions v2.5.3 * @return array */ public static function payment_gateways_renewal_column($header) { } /** * Add a column to the Payment Gateway table to show whether the gateway supports automated renewals. * * @since 1.0.0 - Migrated from WooCommerce Subscriptions v1.5 * @deprecated 1.0.0 - Migrated from WooCommerce Subscriptions v2.5.3 * @return string */ public static function payment_gateways_rewewal_column($header) { } /** * Check whether the payment gateway passed in supports automated renewals or not. * Automatically flag support for Paypal since it is included with subscriptions. * Display in the Payment Gateway column. * * @param WC_Payment_Gateway $gateway * * @since 1.0.0 - Migrated from WooCommerce Subscriptions v2.5.3 */ public static function payment_gateways_renewal_support($gateway) { } /** * Check whether the payment gateway passed in supports automated renewals or not. * Automatically flag support for Paypal since it is included with subscriptions. * Display in the Payment Gateway column. * * @since 1.0.0 - Migrated from WooCommerce Subscriptions v1.5 * @deprecated 1.0.0 - Migrated from WooCommerce Subscriptions v2.5.3 */ public static function payment_gateways_rewewal_support($gateway) { } /** * Do not display formatted order total on the Edit Order administration screen * * @since 1.0.0 - Migrated from WooCommerce Subscriptions v1.5.17 */ public static function maybe_remove_formatted_order_total_filter($formatted_total, $order) { } /** * Only attach the gettext callback when on admin shop subscription screen * * @since 1.0.0 - Migrated from WooCommerce Subscriptions v2.2.7 */ public static function maybe_attach_gettext_callback() { } /** * Only unattach the gettext callback when it was attached * * @since 1.0.0 - Migrated from WooCommerce Subscriptions v2.2.7 */ public static function maybe_unattach_gettext_callback() { } /** * When subscription items not editable (such as due to the payment gateway not supporting modifications), * change the text to explain why * * @since 1.0.0 - Migrated from WooCommerce Subscriptions v2.2.7 */ public static function change_order_item_editable_text($translated_text, $text, $domain) { } /** * Add recurring payment gateway information after the Settings->Payments->Payment Methods table. * This includes information about manual renewals and a warning if no payment gateway which supports automatic recurring payments is enabled/setup correctly. * * @since 1.0.0 - Migrated from WooCommerce Subscriptions v2.1 */ public static function add_recurring_payment_gateway_information($settings) { } /** * Check if subscription product meta data should be saved for the current request. * * @param array Array of product types. * @since 1.0.0 - Migrated from WooCommerce Subscriptions v2.2.9 */ private static function is_subscription_product_save_request($post_id, $product_types) { } /** * Insert a setting or an array of settings after another specific setting by its ID. * * @since 1.0.0 - Migrated from WooCommerce Subscriptions v2.2.20 * @param array $settings The original list of settings. Passed by reference. * @param string $insert_after_setting_id The setting id to insert the new setting after. * @param array $new_setting The new setting to insert. Can be a single setting or an array of settings. * @param string $insert_type The type of insert to perform. Can be 'single_setting' or 'multiple_settings'. Optional. Defaults to a single setting insert. * @param string $insert_after The setting type to insert the new settings after. Optional. Default is 'first' - the setting will be inserted after the first occurring setting with the matching ID (no specific type). Pass a setting type (like 'sectionend') to insert after a setting type. */ public static function insert_setting_after(&$settings, $insert_after_setting_id, $new_setting, $insert_type = 'single_setting', $insert_after = 'first') { } /** * Add a reminder on the enable guest checkout setting that subscriptions still require an account * @since 1.0.0 - Migrated from WooCommerce Subscriptions v2.3.0 * @param array $settings The list of settings */ public static function add_guest_checkout_setting_note($settings) { } /** * Gets the product type warning message displayed for products associated with subscriptions * * @since 1.0.0 - Migrated from WooCommerce Subscriptions v3.0.7 * @return string The change product type warning message. */ private static function get_change_product_type_warning() { } /** * Validates the product type change before other product data is saved. * * Subscription products associated with subscriptions cannot be changed. Doing so * can cause issues. For example when customers who try to manually renew where the subscription * products are placed in the cart. * * @since 1.0.0 - Migrated from WooCommerce Subscriptions v3.0.7 * @param int $product_id The product ID being saved. */ public static function validate_product_type_change($product_id) { } /** * Adds a setting to allow customer registration on checkout specifically for subscription purchases. * * If the store allows registration on the checkout, this setting is hidden because that higher level * setting overrides any need for a specific subscription setting. * * This setting allows stores to enable users to create an account when purchasing a subscription, but * not allow an account to be created when they are making one off/standard purchases. * * @since 1.0.0 - Migrated from WooCommerce Subscriptions v3.1.0 * * @param array $settings The Accounts & Privacy settings. * @return array $settings. */ public static function add_registration_for_subscription_purchases_setting($settings) { } /** * Renders the Subscription information in the WC status page */ public static function render_system_status_items() { } /** * Outputs the contents of the "Renewal Orders" meta box. * * @param object $post Current post data. */ public static function related_orders_meta_box($post) { } /** * Add users with subscriptions to the "Customers" report in WooCommerce -> Reports. * * @param WP_User_Query $user_query */ public static function add_subscribers_to_customers($user_query) { } /** * Set a translation safe screen ID for Subscriptions * * @since 1.0.0 - Migrated from WooCommerce Subscriptions v1.3.3 */ public static function set_admin_screen_id() { } /** * Once we have set a correct admin page screen ID, we can use it for adding the Manage Subscriptions table's columns. * * @since 1.0.0 - Migrated from WooCommerce Subscriptions v1.3.3 */ public static function add_subscriptions_table_column_filter() { } /** * Filter the "Orders" list to show only renewal orders associated with a specific parent order. * * @param array $request * @return array */ public static function filter_orders_by_renewal_parent($request) { } /** * Registers the "Renewal Orders" meta box for the "Edit Order" page. * @deprecated 1.0.0 - Migrated from WooCommerce Subscriptions v2.0 */ public static function add_meta_boxes() { } /** * Output the metabox */ public static function recurring_totals_meta_box($post) { } /** * Filters the Admin orders table results based on a list of IDs returned by a report query. * * @deprecated 1.0.0 - Migrated from WooCommerce Subscriptions v2.6.2 * * @param string $where The query WHERE clause. * @return string $where * @since 1.0.0 - Migrated from WooCommerce Subscriptions v2.6.0 */ public static function filter_orders_from_list($where) { } /** * Filters the Admin subscriptions table results based on a list of IDs returned by a report query. * * @deprecated 1.0.0 - Migrated from WooCommerce Subscriptions v2.6.2 * * @param string $where The query WHERE clause. * @return string * @since 1.0.0 - Migrated from WooCommerce Subscriptions v2.6.0 */ public static function filter_subscriptions_from_list($where) { } /** * Prevents variations from being deleted if switching from a variable product type to a subscription variable product type (and vice versa). * * @since 1.0.0 - Migrated from WooCommerce Subscriptions v3.0.14 * * @param bool $delete_variations A boolean value of true will delete the variations. * @param WC_Product $product Product data. * @return string $from Origin type. * @param string $to New type. * * @return bool Whether the variations should be deleted. */ public static function maybe_keep_variations($delete_variations, $product, $from, $to) { } } /** * A class for managing the content displayed in the WooCommerce → Subscriptions admin list table when no results are found. */ class WCS_Admin_Empty_List_Content_Manager { /** * Initializes the class and attach callbacks. */ public static function init() { } /** * Gets the content to display in the WooCommerce → Subscriptions admin list table when no results are found. * * @return string The HTML content for the empty state if no subscriptions exist, otherwise a string indicating no results. */ public static function get_content() { } /** * Enqueues the scripts and styles for the empty state. */ public static function enqueue_scripts_and_styles() { } /** * Determines if the empty state content should be displayed. * * Uses the `woocommerce_subscriptions_not_empty` filter to determine if subscriptions exist on the store. * * @return bool True if subscriptions don't exist and the empty state should be displayed, otherwise false. */ private static function should_display_empty_state() { } } /** * WC_Admin_Meta_Boxes */ class WCS_Admin_Meta_Boxes { /** * Constructor */ public function __construct() { } /** * Add WC Meta boxes * * @see add_meta_boxes * * @param string $post_type The post type of the current post being edited. * @param WP_Post|WC_Order|null $post_or_order_object The post or order currently being edited. */ public function add_meta_boxes($post_type = '', $post_or_order_object = \null) { } /** * Removes the core Order Data meta box as we add our own Subscription Data meta box */ public function remove_meta_boxes() { } /** * Don't save some order related meta boxes. * * @see woocommerce_process_shop_order_meta * * @param int $order_id * @param WC_Order $order */ public function remove_meta_box_save($order_id, $order) { } /** * Print admin styles/scripts */ public function enqueue_styles_scripts() { } /** * Adds actions to the admin edit subscriptions page, if the subscription hasn't ended and the payment method supports them. * * @param array $actions An array of available actions * @return array An array of updated actions * @since 1.0.0 - Migrated from WooCommerce Subscriptions v2.0 */ public static function add_subscription_actions($actions) { } /** * Handles the action request to process a renewal order. * * @param array $subscription * @since 1.0.0 - Migrated from WooCommerce Subscriptions v2.0 */ public static function process_renewal_action_request($subscription) { } /** * Handles the action request to create a pending renewal order. * * @param array $subscription * @since 1.0.0 - Migrated from WooCommerce Subscriptions v2.0 */ public static function create_pending_renewal_action_request($subscription) { } /** * Handles the action request to create a pending parent order. * * @param array $subscription * @since 1.0.0 - Migrated from WooCommerce Subscriptions v2.3 */ public static function create_pending_parent_action_request($subscription) { } /** * Removes order related emails from the available actions. * * @param array $available_emails * @since 1.0.0 - Migrated from WooCommerce Subscriptions v2.0 */ public static function remove_order_email_actions($email_actions) { } /** * Process the action request to retry renewal payment for failed renewal orders. * * @param WC_Order $order * @since 1.0.0 - Migrated from WooCommerce Subscriptions v2.1 */ public static function process_retry_renewal_payment_action_request($order) { } /** * Determines if a renewal order payment can be retried. A renewal order payment can only be retried when: * - Order is a renewal order * - Order status is failed * - Order payment method isn't empty * - Order total > 0 * - Subscription/s aren't manual * - Subscription payment method supports date changes * - Order payment method has_action('woocommerce_scheduled_subscription_payment_..') * * @param WC_Order $order * @return bool * @since 1.0.0 - Migrated from WooCommerce Subscriptions v2.1 */ private static function can_renewal_order_be_retried($order) { } /** * Disables stock management while adding items to a subscription via the edit subscription screen. * * @since 1.0.0 - Migrated from WooCommerce Subscriptions v3.0.6 * * @param string $manage_stock The default manage stock setting. * @return string Whether the stock should be managed. */ public static function override_stock_management($manage_stock) { } /** * Displays a checkbox allowing admin to lock in prices increases in the edit order line items meta box. * * This checkbox is only displayed if the following criteria is met: * - The order is unpaid. * - The order is a subscription parent order. Renewal orders already lock in the subscription recurring price. * - The order's currency matches the base store currency. * - The order contains a line item with a subtotal greater than the product's current live price. * * @since 1.0.0 - Migrated from WooCommerce Subscriptions v3.0.10 * * @param WC_Order $order The order being edited. */ public static function output_price_lock_html($order) { } /** * Saves the manual price increase lock via Edit order save and ajax request. * * @since 1.0.0 - Migrated from WooCommerce Subscriptions v3.0.10 * * @param string $order_id Optional. The order ID. For non-ajax requests, this parameter is required. */ public static function save_increased_price_lock($order_id = '') { } /** * Stores the subtracted base location tax totals for subscription and renewal line items. * * @since 1.0.0 - Migrated from WooCommerce Subscriptions v3.0.10 * * @param int $item_id The ID of the order item added. * @param WC_Order_Item_Product $line_item The line item added. * @param WC_Abstract_Order $order The order or subscription the product was added to. */ public static function store_item_base_location_tax($item_id, $line_item, $order) { } /** * Prevents WC core's handling of stock for subscriptions saved via the edit subscription screen. * * Hooked onto 'woocommerce_prevent_adjust_line_item_product_stock' which is triggered in * wc_maybe_adjust_line_item_product_stock() via: * - WC_AJAX::remove_order_item(). * - wc_save_order_items(). * * @since 1.0.0 - Migrated from WooCommerce Subscriptions v3.1.0 * * @param WC_Order_Item $item The line item being saved/updated via the edit subscription screen. * @return bool Whether to reduce stock for the line item. */ public static function prevent_subscription_line_item_stock_handling($prevent_stock_handling, $item) { } /** * Updates the `_subtracted_base_location_tax` meta when admin users update a line item's quantity. * * @since 1.0.0 - Migrated from WooCommerce Subscriptions v3.0.14 * * @param int $order_id The edited order or subscription ID. * @param array $item_data An array of data about all line item changes. */ public static function update_subtracted_base_location_tax_meta($order_id, $item_data) { } /** * Updates the `_subtracted_base_location_taxes` meta when admin users update a line item's price. * * @since 1.0.0 - Migrated from WooCommerce Subscriptions v3.1.0 * * @param int $order_id The edited order or subscription ID. * @param array $item_data An array of data about all line item changes. */ public static function update_subtracted_base_location_taxes_amount($order_id, $item_data) { } /** * Gets a list of customer orders via ajax. * * Populates the parent order list on the edit subscription screen with orders belonging to the customer. * * @since 1.0.0 - Migrated from WooCommerce Subscriptions v4.0.0 */ public static function get_customer_orders() { } /** * Reorders the edit subscription screen meta boxes. * * Removes and readds the order items meta box so it appears after the subscription data. * * On HPOS environments, WC core registers the order-data and order-items meta boxes on a high priority before we've had a chance to add ours. * This means, on the edit subscription screen, when we remove the order-data meta box and add our own, it will appear after the line items. * * In order to keep the correct ordering of the meta boxes on the edit subscription screen, we need to remove the line items meta box and * readd it after we've added the subscription-data meta box. */ private static function reorder_subscription_line_items_meta_box() { } } class WCS_Admin_Notice { /** * The notice type. Can be notice, notice-info, updated, error or a custom notice type. * * @var string */ protected $type; /** * The notice heading. Optional property. * * @var string */ protected $heading; /** * The notice's main content. * * @var string */ protected $content; /** * The notice's content type. Can be 'simple' or 'html'. * * @var string */ protected $content_type; /** * The container div's attributes. Optional property. * * @see WCS_Admin_Notice::__construct() for example format. * @var array */ protected $attributes; /** * The URL used to dismiss the notice. Optional property. * * @var string */ protected $dismiss_url; /** * A list of actions the user can take * * @see WCS_Admin_Notice::set_actions() for example format. * @var array */ protected $actions; /** * Constructor. * * @param string $type The notice type. Can be notice, notice-info, updated, error or a custom notice type. * @param array $attributes The container div's attributes. Optional. * @param string $dismiss_url The URL used to dismiss the notice. Optional. * @since 1.0.0 - Migrated from WooCommerce Subscriptions v2.3.0 */ public function __construct($type, array $attributes = array(), $dismiss_url = '') { } /** * Display the admin notice. * * Will print the notice if called during the 'admin_notices' action. Otherwise will attach a callback and display the notice when the 'admin_notices' is triggered. * * @since 1.0.0 - Migrated from WooCommerce Subscriptions v2.3.0 */ public function display() { } /** * Whether the admin notice is dismissible. * * @since 1.0.0 - Migrated from WooCommerce Subscriptions v2.3.0 * @return boolean */ public function is_dismissible() { } /** * Whether the admin notice has a heading or not. * * @since 1.0.0 - Migrated from WooCommerce Subscriptions v2.3.0 * @return boolean */ public function has_heading() { } /** * Whether the admin notice has actions or not. * * @since 1.0.0 - Migrated from WooCommerce Subscriptions v2.3.0 * @return boolean */ public function has_actions() { } /* Printers */ /** * Print the notice's heading. * * @since 1.0.0 - Migrated from WooCommerce Subscriptions v2.3.0 */ public function print_heading() { } /** * Get the notice's content. * * Will wrap simple notices in paragraph elements (

) for correct styling and print HTML notices unchanged. * * @since 1.0.0 - Migrated from WooCommerce Subscriptions v2.3.0 */ public function print_content() { } /** * Print the notice's attributes. * * Turns the attributes array into 'id="id" class="class class class"' strings. * * @since 1.0.0 - Migrated from WooCommerce Subscriptions v2.3.0 */ public function print_attributes() { } /** * Print the notice's dismiss URL. * * @since 1.0.0 - Migrated from WooCommerce Subscriptions v2.3.0 */ public function print_dismiss_url() { } /* Getters */ /** * Get the notice's actions. * * @since 1.0.0 - Migrated from WooCommerce Subscriptions v2.3.0 * @return array */ public function get_actions() { } /* Setters */ /** * Set the notice's content to a simple string. * * @param string $content The notice content. */ public function set_simple_content($content) { } /** * Set the notice's content to a string containing HTML elements. * * @param string $html The notice content. */ public function set_html_content($html) { } /** * Set the notice's content to a string containing HTML elements. * * @since 1.0.0 - Migrated from WooCommerce Subscriptions v2.3.0 * @param string $template_name Template name. * @param string $template_path Template path. * @param array $args Arguments. (default: array). */ public function set_content_template($template_name, $template_path, $args = array()) { } /** * Set actions the user can make in response to this notice. * * @since 1.0.0 - Migrated from WooCommerce Subscriptions v2.3.0 * @param array $actions The actions the user can make. Example format: * array( * array( * 'name' => 'The actions's name', // This arg will appear as the button text. * 'url' => 'url', // The url the user will be directed to if clicked. * 'class' => 'class string', // The class attribute string used in the link element. Optional. Will default to 'docs button' - a plain button. * ) * ) */ public function set_actions(array $actions) { } /** * Set notice's heading. If set this will appear at the top of the notice wrapped in a h2 element. * * @since 1.0.0 - Migrated from WooCommerce Subscriptions v2.3.0 * @param string $heading The notice heading. */ public function set_heading($heading) { } } /** * WC_Admin_Post_Types Class * * Handles the edit posts views and some functionality on the edit post screen for WC post types. */ class WCS_Admin_Post_Types { /** * The value to use for the 'post__in' query param when no results should be returned. * * We can't use an empty array, because WP returns all posts when post__in is an empty * array. Source: https://core.trac.wordpress.org/ticket/28099 * * This would ideally be a private CONST but visibility modifiers are only allowed for * class constants in PHP >= 7.1. * * @var array */ private static $post__in_none = array(0); /** * Constructor */ public function __construct() { } /** * Modifies the actual SQL that is needed to order by last payment date on subscriptions. Data is pulled from related * but independent posts, so subqueries are needed. That's something we can't get by filtering the request. This is hooked * in @see WCS_Admin_Post_Types::request_query function. * * @param array $pieces all the pieces of the resulting SQL once WordPress has finished parsing it * @param WP_Query $query the query object that forms the basis of the SQL * @return array modified pieces of the SQL query */ public function posts_clauses($pieces, $query) { } /** * Check is database user is capable of doing high performance things, such as creating temporary tables, * indexing them, and then dropping them after. * * @return bool */ public function is_db_user_privileged() { } /** * Return the privileges a database user has out of CREATE TEMPORARY TABLES, INDEX and DROP. This is so we can use * these discrete values on a debug page. * * @return array */ public function get_special_database_privileges() { } /** * Modifies the query for a slightly faster, yet still pretty slow query in case the user does not have * the necessary privileges to run * * @param $pieces * * @return mixed */ private function posts_clauses_low_performance($pieces) { } /** * Modifies the query in such a way that makes use of the CREATE TEMPORARY TABLE, DROP and INDEX * MySQL privileges. * * @param array $pieces * * @return array $pieces */ private function posts_clauses_high_performance($pieces) { } /** * Displays the dropdown for the product filter * * @param string $order_type The type of order. This will be 'shop_subscription' for Subscriptions. * * @return string the html dropdown element */ public function restrict_by_product($order_type = '') { } /** * Remove "edit" from the bulk actions. * * @param array $actions * @return array */ public function remove_bulk_actions($actions) { } /** * Alters the default bulk actions for the subscription object type. * * Removes the default "edit", "mark_processing", "mark_on-hold", "mark_completed", "mark_cancelled" options from the bulk actions. * Adds subscription-related actions for activating, suspending and cancelling. * * @param array $actions An array of bulk actions admin users can take on subscriptions. In the format ( 'name' => 'i18n_text' ). * @return array The bulk actions. */ public function filter_bulk_actions($actions) { } /** * Deals with bulk actions. The style is similar to what WooCommerce is doing. Extensions will have to define their * own logic by copying the concept behind this method. */ public function parse_bulk_actions() { } /** * Shows confirmation message that subscription statuses were changed via bulk action. */ public function bulk_admin_notices() { } /** * Define custom columns for subscription * * Column names that have a corresponding `WC_Order` column use the `order_` prefix here * to take advantage of core WooCommerce assets, like JS/CSS. * * @param array $existing_columns * @return array */ public function shop_subscription_columns($existing_columns) { } /** * Outputs column content for the admin subscriptions list table. * * @param string $column The column name. * @param WC_Order|int $subscription Optional. The subscription being displayed. Defaults to the global $post object. */ public function render_shop_subscription_columns($column, $subscription = \null) { } /** * Return the content for a date column on the Edit Subscription screen * * @param WC_Subscription $subscription * @param string $column * @return string * @since 1.0.0 - Migrated from WooCommerce Subscriptions v2.3.0 */ public static function get_date_column_content($subscription, $column) { } /** * Make columns sortable * * @param array $columns * @return array */ public function shop_subscription_sortable_columns($columns) { } /** * Search custom fields as well as content. * * @param WP_Query $wp * @return void */ public function shop_subscription_search_custom_fields($wp) { } /** * Change the label when searching orders. * * @param mixed $query * @return string */ public function shop_subscription_search_label($query) { } /** * Query vars for custom searches. * * @param mixed $public_query_vars * @return array */ public function add_custom_query_var($public_query_vars) { } /** * Filters and sorts the request for subscriptions stored in WP Post tables. * * @param array $vars * * @return array */ public function request_query($vars) { } /** * Filters the List Table request for Subscriptions stored in HPOS. * * @since 5.2.0 * * @param array $request_query The query args sent to wc_get_orders(). * * @return array $request_query */ public function filter_subscription_list_table_request_query($request_query) { } /** * Adds default query arguments for displaying subscriptions in the admin list table. * * By default, WC will fetch items to display in the list table by query the DB using * order params (eg order statuses). This function is responsible for making sure the * default request includes required values to return subscriptions. * * @param array $query_args The admin subscription's list table query args. * @return array $query_args */ public function add_subscription_list_table_query_default_args($query_args) { } /** * Checks if the current request is filtering query by customer user and then fetches the subscriptions * that belong to that customer and sets the post__in query var to filter the request. * * @since 5.2.0 * * @param array $request_query The query args sent to wc_get_orders(). * * @return array $request_query */ private function set_filter_by_customer_query($request_query) { } /** * Checks if the current request is filtering query by product and then fetches all subscription IDs for that product * and sets the post__in query var to filter the request for the given array of subscription IDs. * * @since 5.2.0 * * @param array $request_query The query args sent to wc_get_orders(). * * @return array $request_query */ private function set_filter_by_product_query($request_query) { } /** * Checks if the current request is filtering query by payment method and then fetches all subscription IDs * for that payment method and sets the post__in query var to filter the request. * * @since 5.2.0 * * @param array $request_query The query args sent to wc_get_orders(). * * @return array $request_query */ private function set_filter_by_payment_method_query($request_query) { } /** * Sets the order by query args for the subscriptions list table request on HPOS enabled sites. * * This function is similar to the posts table equivalent function (self::request_query()) except it only sets the order by. * * @param array $request_query The query args sent to wc_get_orders() to populate the list table. * @return array $request_query */ private function set_order_by_query_args($request_query) { } /** * Set the 'post__in' query var with a given set of post ids. * * There are a few special conditions for handling the post__in value. Namely: * - if there are no matching post_ids, the value should be array( 0 ), not an empty array() * - if there are existing IDs in post__in, we only want to return posts with an ID in both * the existing set and the new set * * While this method is public, it should not be used as it will eventually be deprecated and * it's only made publicly available for other Subscriptions methods until Subscriptions * requires WC 3.0, and can rely on using methods in the data store rather than a hack like * pulling this for use outside of the admin context. * * @param array $query_vars * @param array $post_ids * @return array */ public static function set_post__in_query_var($query_vars, $post_ids) { } /** * Change messages when a post type is updated. * * @param array $messages * @return array */ public function post_updated_messages($messages) { } /** * Returns a clickable link that takes you to a collection of orders relating to the subscription. * * @uses self::get_related_orders() * @since 1.0.0 - Migrated from WooCommerce Subscriptions v2.0 * @return string the link string */ public function get_related_orders_link($the_subscription) { } /** * Displays the dropdown for the payment method filter. * * @param string $order_type The type of order. This will be 'shop_subscription' for Subscriptions. * * @since 1.0.0 - Migrated from WooCommerce Subscriptions v2.0 */ public static function restrict_by_payment_method($order_type = '') { } /** * Sets post table primary column subscriptions. * * @param string $default * @param string $screen_id * @return string */ public function list_table_primary_column($default, $screen_id) { } /** * Don't display default Post actions on Subscription post types (we display our own set of * actions when rendering the column content). * * @param array $actions * @param object $post * @return array */ public function shop_subscription_row_actions($actions, $post) { } /** * Gets the HTML for a line item's meta to display on the Subscription list table. * * @param WC_Order_Item $item The line item object. * @param mixed $deprecated * * @return string The line item meta html string generated by @see wc_display_item_meta(). */ protected static function get_item_meta_html($item, $deprecated = '') { } /** * Get the HTML for order item meta to display on the Subscription list table. * * @param WC_Order_Item $item * @param WC_Product $product * @return string */ protected static function get_item_name_html($item, $_product, $include_quantity = 'include_quantity') { } /** * Gets the table row HTML content for a subscription line item. * * On the Subscriptions list table, subscriptions with multiple items display those line items in a table. * This function generates an individual row for a specific line item. * * @param WC_Line_Item_Product $item The line item product object. * @param string $item_name The line item's name. * @param string $item_meta_html The line item's meta HTML generated by @see wc_display_item_meta(). * * @return string The table row HTML content for a line item. */ protected static function get_item_display_row($item, $item_name, $item_meta_html) { } /** * Renders the dropdown for the customer filter. * * @param string $order_type The type of order. This will be 'shop_subscription' for Subscriptions. * * @since 1.0.0 - Migrated from WooCommerce Subscriptions v2.2.17 */ public static function restrict_by_customer($order_type = '') { } /** * Generates the list of actions available on the Subscriptions list table. * * @param WC_Subscription $subscription The subscription to generate the actions for. * @return array $actions The actions. Array keys are the action names, values are the action link () tags. */ private function get_subscription_list_table_actions($subscription) { } /** * Handles bulk action requests for Subscriptions. * * @param string $redirect_to The default URL to redirect to after handling the bulk action request. * @param string $action The action to take against the list of subscriptions. * @param array $subscription_ids The list of subscription to run the action against. * * @return string The URL to redirect to after handling the bulk action request. */ public function handle_subscription_bulk_actions($redirect_to, $action, $subscription_ids) { } /** * Handles bulk updating the status subscriptions. * * @param array $ids Subscription IDs to be trashed or deleted. * @param string $new_status The new status to update the subscriptions to. * * @return array Array of query args to redirect to after handling the bulk action request. */ private function do_bulk_action_update_status($subscription_ids, $new_status) { } /** * Handles bulk trashing and deleting of subscriptions. * * @param array $ids Subscription IDs to be trashed or deleted. * @param bool $force_delete When set, the subscription will be completed deleted. Otherwise, it will be trashed. * * @return array Array of query args to redirect to after handling the bulk action request. */ private function do_bulk_action_delete_subscriptions($subscription_ids, $force_delete = \false) { } /** * Handles bulk untrashing of subscriptions. * * @param array $ids Subscription IDs to be restored. * * @return array Array of query args to redirect to after handling the bulk action request. */ private function do_bulk_action_untrash_subscriptions($subscription_ids) { } /** * Filters the list of available list table views for Subscriptions when HPOS enabled. * * This function adds links to the top of the Subscriptions List Table to filter the table by status while also showing status count. * * In HPOS, WooCommerce extends the WP_List_Table class and generates these views for Orders, but we need to override this and * manually add the views for Subscriptions which is done by this function. * * @since 5.2.0 * * @param array $views * * @return array */ public function filter_subscription_list_table_views($views) { } /** * Returns a HTML link to filter the subscriptions list table view by status. * * @param string $status_slug Status slug used to identify the view. * @param string $status_name Human-readable name of the view. * @param int $status_count Number of statuses in this view. * @param bool $current If this is the current view. * * @return string */ private function get_list_table_view_status_link($status_slug, $status_name, $status_count, $current) { } /** * Returns a list of subscription status slugs and labels that should be visible in the status list. * * @return array slug => label array of order statuses. */ private function get_list_table_view_statuses() { } /** * Generates an admin trash or delete subscription URL in a HPOS environment compatible way. * * @param int $subscription_id The subscription to generate a trash or delete URL for. * @param string $base_action_url The base URL to add the query args to. * @param string $status The status to generate the URL for. Should be 'trash' or 'delete'. * * @return string The admin trash or delete subscription URL. */ private function get_trash_or_delete_subscription_link($subscription_id, $base_action_url, $status) { } /** Deprecated Functions */ /** * Get the HTML for an order item to display on the Subscription list table. * * @deprecated 1.0.0 - Migrated from WooCommerce Subscriptions v3.0.7 * * @param WC_Line_Item_Product $item The subscription line item object. * @param WC_Subscription $subscription The subscription object. This variable is no longer used. * @param string $element The type of element to generate. Can be 'div' or 'row'. Default is 'div'. * * @return string The line item column HTML content for a line item. */ protected static function get_item_display($item, $subscription = '', $element = 'div') { } /** * Gets the HTML for order item to display on the Subscription list table using a div element * as the wrapper, which is done for subscriptions with a single line item. * * @deprecated 1.0.0 - Migrated from WooCommerce Subscriptions v3.0.7 * * @param WC_Line_Item_Product $item The line item object. * @param string $item_name The line item's name. * @param string $item_meta_html The line item's meta HTML. * * @return string The subscription line item column HTML content. */ protected static function get_item_display_div($item, $item_name, $item_meta_html) { } /** * Add extra options to the bulk actions dropdown * * It's only on the All Shop Subscriptions screen. * Introducing new filter: woocommerce_subscription_bulk_actions. This has to be done through jQuery as the * 'bulk_actions' filter that WordPress has can only be used to remove bulk actions, not to add them. * * This is a filterable array where the key is the action (will become query arg), and the value is a translatable * string. The same array is used to * * @deprecated 5.3.0 */ public function print_bulk_actions_script() { } /** * Adds Order table query clauses to order the subscriptions list table by last payment date. * * There are 2 methods we use to order the subscriptions list table by last payment date: * - High performance: This method uses a temporary table to store the last payment date for each subscription. * - Low performance: This method uses a subquery to get the last payment date for each subscription. * * @param string[] $pieces Associative array of the clauses for the query. * @param OrdersTableQuery $query The query object. * @param array $args Query args. * * @return string[] $pieces Associative array of the clauses for the query. */ public function orders_table_query_clauses($pieces, $query, $args) { } /** * Adds order table query clauses to sort the subscriptions list table by last payment date. * * This function provides a lower performance method using a subquery to sort by last payment date. * It is a HPOS version of @see self::posts_clauses_low_performance(). * * @param string[] $pieces Associative array of the clauses for the query. * @return string[] $pieces Updated associative array of clauses for the query. */ private function orders_table_clauses_low_performance($pieces) { } /** * Adds order table query clauses to sort the subscriptions list table by last payment date. * * This function provides a higher performance method using a temporary table to sort by last payment date. * It is a HPOS version of @see self::posts_clauses_high_performance(). * * @param string[] $pieces Associative array of the clauses for the query. * @return string[] $pieces Updated associative array of clauses for the query. */ private function orders_table_clauses_high_performance($pieces) { } } class WCS_Admin_Product_Import_Export_Manager { /** * Attaches callbacks and initializes the class. */ public static function init() { } /** * Registers the subscription variation product type with the exporter. * * @param array $types The product type keys and labels. * @return array $types */ public static function register_susbcription_variation_type($types) { } /** * Filters the product export query args to separate standard variations and subscription variations. * * In the database subscription variations appear exactly the same as standard product variations. To * enforce this distinction when exporting subscription variations, we exclude products with a standard variable product as a parent and vice versa. * * @param array $args The product export query args. * @return array */ public static function filter_export_query($args) { } /** * Filters product import data so subscription variations are imported correctly (as variations). * * Subscription variations are the exact same as standard variations. What sets them apart is the fact they are linked * to a variable subscription parent rather than a standard variable product. With that in mind, we need to import them just * like a variation. * * @param array $data The product's import data. * @return array $data */ public static function import_subscription_variations($data) { } } /** * Subscriptions System Status * * Adds additional Subscriptions related information to the WooCommerce System Status. * * @package WooCommerce Subscriptions * @subpackage WC_Subscriptions_Admin * @category Class * @since 1.0.0 - Migrated from WooCommerce Subscriptions v2.3.0 */ class WCS_Admin_System_Status { /** * @var int Subscriptions' WooCommerce Marketplace product ID */ const WCS_PRODUCT_ID = 27147; /** * Attach callbacks * * @since 1.0.0 - Migrated from WooCommerce Subscriptions v2.3.0 */ public static function init() { } /** * Renders the Subscription information in the WC status page * * @since 1.0.0 - Migrated from WooCommerce Subscriptions v2.3.0 */ public static function render_system_status_items() { } /** * Include WCS_DEBUG flag */ private static function set_debug_mode(&$debug_data) { } /** * Include the staging/live mode the store is running in. * * @param array $debug_data */ private static function set_staging_mode(&$debug_data) { } /** * @param array $debug_data */ private static function set_live_site_url(&$debug_data) { } /** * @param array $debug_data */ private static function set_library_version(&$debug_data) { } /** * List any Subscriptions template overrides. */ private static function set_theme_overrides(&$debug_data) { } /** * Determine which of our files have been overridden by the theme. * * @return array Theme override data. */ private static function get_theme_overrides() { } /** * Add a breakdown of Subscriptions per status. */ private static function set_subscription_statuses(&$debug_data) { } /** * Include information about whether the store is linked to a WooCommerce account and whether they have an active WCS product key. */ private static function set_woocommerce_account_data(&$debug_data) { } /** * Add a breakdown of subscriptions per payment gateway. */ private static function set_subscriptions_by_payment_gateway(&$debug_data) { } /** * List the enabled payment gateways and the features they support. */ private static function set_subscriptions_payment_gateway_support(&$debug_data) { } /** * Add the store's country and state information. */ private static function set_store_location(&$debug_data) { } /** * Gets the store's subscription broken down by payment gateway and status. * * @since 1.0.0 - Migrated from WooCommerce Subscriptions v3.1.0 * @return array The subscription gateway and status data array( 'gateway_id' => array( 'status' => count ) ); */ public static function get_subscriptions_by_gateway() { } /** * Gets the store's subscriptions by status. * * @since 1.0.0 - Migrated from WooCommerce Subscriptions v3.1.0 * @return array */ public static function get_subscription_statuses() { } } class WCS_WC_Admin_Manager { /** * Initialise the class and attach hook callbacks. */ public static function init() { } /** * Connects existing WooCommerce Subscription admin pages to WooCommerce Admin. */ public static function register_subscription_admin_pages() { } /** * Register the navigation items in the WooCommerce navigation. * * @since 1.0.0 - Migrated from WooCommerce Subscriptions v3.0.12 */ public static function register_navigation_items() { } } // Exit if accessed directly /** * WCS_Debug_Tool_Cache_Background_Updater Class * * Provide APIs for a debug tool to update a cached data store's data in the background using Action Scheduler. */ class WCS_Debug_Tool_Cache_Background_Updater extends \WCS_Background_Updater { /** * @var WCS_Cache_Updater The data store used to manage the cache. */ protected $data_store; /** * WCS_Debug_Tool_Cache_Background_Updater constructor. * * @param string $scheduled_hook The hook to schedule to run the update. * @param WCS_Cache_Updater $data_store */ public function __construct($scheduled_hook, \WCS_Cache_Updater $data_store) { } /** * Get the items to be updated, if any. * * @return array An array of items to update, or empty array if there are no items to update. */ protected function get_items_to_update() { } /** * Run the update for a single item. * * @param mixed $item The item to update. */ protected function update_item($item) { } } // Exit if accessed directly /** * WCS_Debug_Tool_Cache_Eraser Class * * Add a debug tool to the WooCommerce > System Status > Tools page for * deleting a data store's cache/s. */ class WCS_Debug_Tool_Cache_Eraser extends \WCS_Debug_Tool_Cache_Updater { /** * WCS_Debug_Tool_Cache_Eraser constructor. * * @param string $tool_key The key used to add the tool to the array of available tools. * @param string $tool_name The section name given to the tool on the admin screen. * @param string $tool_description The long description for the tool displayed on the admin screen. * @param WCS_Cache_Updater $data_store The cached data store this tool will use for erasing cache. */ public function __construct($tool_key, $tool_name, $tool_description, \WCS_Cache_Updater $data_store) { } /** * Clear all of the data store's caches. */ public function delete_caches() { } } // Exit if accessed directly /** * WCS_Debug_Tool_Cache_Generator Class * * Add a debug tool to the WooCommerce > System Status > Tools page for generating a cache. */ class WCS_Debug_Tool_Cache_Generator extends \WCS_Debug_Tool_Cache_Updater { /** * @var WCS_Background_Updater $update The instance used to generate the cache data in the background. */ protected $cache_updater; /** * WCS_Debug_Tool_Cache_Generator constructor. * * @param string $tool_key The key used to add the tool to the array of available tools. * @param string $tool_name The section name given to the tool on the admin screen. * @param string $tool_description The long description for the tool displayed on the admin screen. * @param WCS_Cache_Updater $data_store * @param WCS_Background_Updater $cache_updater */ public function __construct($tool_key, $tool_name, $tool_description, \WCS_Cache_Updater $data_store, \WCS_Background_Updater $cache_updater) { } /** * Attach callbacks and hooks, if the store supports getting uncached items, which is required to generate cache * and also acts as a proxy to determine if the related order store is using caching */ public function init() { } /** * Generate the data store's cache by calling the @see $this->>cache_updater's update method. */ public function generate_caches() { } } // Exit if accessed directly /** * WCS_Debug_Tool_Factory Class * * Add debug tools to the WooCommerce > System Status > Tools page. */ final class WCS_Debug_Tool_Factory { /** * Add a debug tool for manually managing a data store's cache. * * @param string $tool_type A known type of cache tool. Known types are 'eraser' or 'generator'. * @param string $tool_name The section name given to the tool on the admin screen. * @param string $tool_desc The long description for the tool on the admin screen. * @param WCS_Cache_Updater $data_store * @throws InvalidArgumentException When a class for the given tool is not found. */ public static function add_cache_tool($tool_type, $tool_name, $tool_desc, \WCS_Cache_Updater $data_store) { } /** * Get the string used to identify the tool. * * @param string The name of the cache tool being created * @return string The key used to identify the tool - sanitized name with wcs_ prefix. */ protected static function get_tool_key($tool_name) { } /** * Get a cache tool's class name by passing in the cache name and type. * * For example, get_cache_tool_class_name( 'related-order', 'generator' ) will return WCS_Debug_Tool_Related_Order_Cache_Generator. * * To make sure the class's file is loaded, call @see self::load_cache_tool_class() first. * * @param string $cache_tool_type The type of cache tool. Known tools are 'eraser' and 'generator'. * @return string The cache tool's class name. */ protected static function get_cache_tool_class_name($cache_tool_type) { } } /** * WCS_Meta_Box_Related_Orders Class */ class WCS_Meta_Box_Related_Orders { /** * Output the metabox * @param WP_Post|WC_Order $post_or_order_object The post object or order object currently being edited. */ public static function output($post_or_order_object) { } /** * Displays the renewal orders in the Related Orders meta box. * * @param WC_Order|WC_Subscription $order The order or subscription object being used to display the related orders. * @since 1.0.0 - Migrated from WooCommerce Subscriptions v2.0 */ public static function output_rows($order) { } } /** * WCS_Meta_Box_Schedule */ class WCS_Meta_Box_Schedule { /** * Outputs the subscription schedule metabox. * * @param WC_Subscription|WP_Post $subscription The subscription object to display the schedule metabox for. This will be a WP Post object on CPT stores. */ public static function output($subscription) { } /** * Saves the subscription schedule meta box data. * * @see woocommerce_process_shop_order_meta * * @param int $subscription_id The subscription ID to save the schedule for. * @param WC_Subscription/WP_Post $subscription The subscription object to save the schedule for. */ public static function save($subscription_id, $subscription) { } } /** * WCS_Meta_Box_Subscription_Data Class */ class WCS_Meta_Box_Subscription_Data extends \WC_Meta_Box_Order_Data { /** * Outputs the Subscription data metabox. * * @param WC_Subscription|WP_Post $subscription The subscription object to display the data metabox for. On CPT stores, this will be a WP Post object. */ public static function output($subscription) { } /** * Saves the subscription data meta box. * * @see woocommerce_process_shop_order_meta * * @param int $subscription_id Subscription ID. * @param WC_Subscription $subscription Optional. Subscription object. Default null - will be loaded from the ID. */ public static function save($subscription_id, $subscription = \null) { } } class WC_Product_Subscription_Variation extends \WC_Product_Variation { /** * A way to access the old array property. */ protected $subscription_variation_level_meta_data; /** * Create a simple subscription product object. * * @access public * @param mixed $product */ public function __construct($product = 0) { } /** * Magic __get method for backwards compatibility. Map legacy vars to WC_Subscriptions_Product getters. * * @param string $key Key name. * @return mixed */ public function __get($key) { } /** * Get internal type. * * @return string */ public function get_type() { } /** * Get variation price HTML. Prices are not inherited from parents. * * @return string containing the formatted price */ public function get_price_html($price = '') { } /** * Get the add to cart button text * * @access public * @return string */ public function add_to_cart_text() { } /** * Get the add to cart button text for the single page * * @access public * @return string */ public function single_add_to_cart_text() { } /** * Checks if the variable product this variation belongs to is purchasable. * * @access public * @return bool */ public function is_purchasable() { } /** * Checks the product type to see if it is either this product's type or the parent's * product type. * * @access public * @param mixed $type Array or string of types * @return bool */ public function is_type($type) { } /* Deprecated Functions */ /** * Return the sign-up fee for this product * * @return string */ public function get_sign_up_fee() { } /** * Returns the sign up fee (including tax) by filtering the products price used in * @see WC_Product::get_price_including_tax( $qty ) * * @return string */ public function get_sign_up_fee_including_tax($qty = 1, $price = '') { } /** * Returns the sign up fee (excluding tax) by filtering the products price used in * @see WC_Product::get_price_excluding_tax( $qty ) * * @return string */ public function get_sign_up_fee_excluding_tax($qty = 1, $price = '') { } } class WC_Product_Subscription extends \WC_Product_Simple { /** * Get internal type. * * @return string */ public function get_type() { } /** * Auto-load in-accessible properties on demand. * * @param mixed $key * @return mixed */ public function __get($key) { } /** * Get subscription's price HTML. * * @return string containing the formatted price */ public function get_price_html($price = '') { } /** * Get the add to cart button text * * @return string */ public function add_to_cart_text() { } /** * Get the add to cart button text for the single page * * @return string The single product page add to cart text. */ public function single_add_to_cart_text() { } /** * Checks if the store manager has requested the current product be limited to one purchase * per customer, and if so, checks whether the customer already has an active subscription to * the product. * * @access public * @return bool */ function is_purchasable() { } /* Deprecated Functions */ /** * Return the sign-up fee for this product * * @return string */ public function get_sign_up_fee() { } /** * Returns the sign up fee (including tax) by filtering the products price used in * @see WC_Product::get_price_including_tax( $qty ) * * @return string */ public function get_sign_up_fee_including_tax($qty = 1) { } /** * Returns the sign up fee (excluding tax) by filtering the products price used in * @see WC_Product::get_price_excluding_tax( $qty ) * * @return string */ public function get_sign_up_fee_excluding_tax($qty = 1) { } } class WC_Product_Variable_Subscription extends \WC_Product_Variable { /** * A cache of the variable product's min and max data generated by @see wcs_get_min_max_variation_data(). * * @var array */ protected $min_max_variation_data = array(); /** * A cache of the variable product's sorted variation prices. * * @var array */ private $sorted_variation_prices = array(); /** * Get internal type. * * @return string */ public function get_type() { } /** * Auto-load in-accessible properties on demand. * * @param mixed $key * @return mixed */ public function __get($key) { } /** * Get the add to cart button text for the single page * * @access public * @return string */ public function single_add_to_cart_text() { } /** * Returns the price in html format. * * @access public * @param string $price (default: '') * @return string */ public function get_price_html($price = '') { } /** * Checks if the store manager has requested the current product be limited to one purchase * per customer, and if so, checks whether the customer already has an active subscription to * the product. * * @access public * @return bool */ function is_purchasable() { } /** * Checks the product type to see if it is either this product's type or the parent's * product type. * * @access public * @param mixed $type Array or string of types * @return bool */ public function is_type($type) { } /** * Sort an associative array of $variation_id => $price pairs in order of min and max prices. * * @param array $prices Associative array of $variation_id => $price pairs * @return array */ protected function sort_variation_prices($prices) { } /** * Set the product's min and max variation data. * * @param array $min_and_max_data The min and max variation data returned by @see wcs_get_min_max_variation_data(). Optional. * @param array $variation_ids The child variation IDs. Optional. By default this value be generated by @see WC_Product_Variable->get_visible_children(). * @since 1.0.0 - Migrated from WooCommerce Subscriptions v2.3.0 */ public function set_min_and_max_variation_data($min_and_max_data = array(), $variation_ids = array()) { } /** * Get the min and max variation data. * * This is a wrapper for @see wcs_get_min_max_variation_data() but to avoid calling * that resource intensive function multiple times per request, check the value * stored in meta or cached in memory before calling that function. * * @param array $variation_ids An array of variation IDs. * @return array The variable product's min and max variation data. * @since 1.0.0 - Migrated from WooCommerce Subscriptions v2.3.0 */ public function get_min_and_max_variation_data($variation_ids) { } /** * Generate a unique hash from an array of variation IDs. * * @param array $variation_ids * @return string */ protected static function get_variation_ids_hash($variation_ids) { } /* Deprecated Functions */ /** * Return the sign-up fee for this product * * @return string */ public function get_sign_up_fee() { } /** * Returns the sign up fee (including tax) by filtering the products price used in * @see WC_Product::get_price_including_tax( $qty ) * * @return string */ public function get_sign_up_fee_including_tax($qty = 1) { } /** * Returns the sign up fee (excluding tax) by filtering the products price used in * @see WC_Product::get_price_excluding_tax( $qty ) * * @return string */ public function get_sign_up_fee_excluding_tax($qty = 1) { } /** * * @param string $product_type A string representation of a product type */ public function add_to_cart_handler($handler, $product) { } /** * Sync variable product prices with the children lowest/highest prices. * * @access public * @return void */ public function variable_product_sync($product_id = '') { } /** * Get the suffix to display before prices. * * @return string */ protected function get_price_prefix($prices) { } /** * Gets an array of available variations. * * @param string $return Optional. The format to return the results in. Can be 'array' to return an array of variation data or 'objects' for the product objects. Default 'array'. * @return array|WC_Product_Subscription_Variation[] */ public function get_available_variations($return = 'array') { } } /** * Coupon Pending Switch * * Coupons which have been added during switch by a customer have the coupon_pending_switch type. This class extends WC_Order_Item_Coupon to implement this coupon item type. * * @author Prospress * @category Class * @package WooCommerce Subscriptions * @since 1.0.0 - Migrated from WooCommerce Subscriptions v2.6.0 */ class WC_Subscription_Item_Coupon_Pending_Switch extends \WC_Order_Item_Coupon { /** * Get item type. * * @return string * @since 1.0.0 - Migrated from WooCommerce Subscriptions v2.6.0 */ public function get_type() { } } /** * Subscription Fee Item Pending Switch * * Fee items which have been added during switch by a customer have the fee_pending_switch type. This class extends WC_Order_Item_Fee to implement this fee item type. * * @author Prospress * @category Class * @package WooCommerce Subscriptions * @since 1.0.0 - Migrated from WooCommerce Subscriptions v2.6.0 */ class WC_Subscription_Item_Fee_Pending_Switch extends \WC_Order_Item_Fee { /** * Get item type. * * @return string * @since 1.0.0 - Migrated from WooCommerce Subscriptions v2.6.0 */ public function get_type() { } } /** * Subscription Line Item (product) Removed * * Line items removed from a subscription by a customer have the line_item_removed line item type. This class extends WC_Order_Item_Product to implement this line item type. * * @author Prospress * @category Class * @package WooCommerce Subscriptions * @since 1.0.0 - Migrated from WooCommerce Subscriptions v2.6.0 */ class WC_Subscription_Line_Item_Removed extends \WC_Order_Item_Product { /** * Get item type. * * @return string * @since 1.0.0 - Migrated from WooCommerce Subscriptions v2.6.0 */ public function get_type() { } } /** * Subscription Line Item (product) Switched * * Line items which have been switched by a customer have the line_item_switched line item type. This class extends WC_Order_Item_Product to implement this line item type. * * @author Prospress * @category Class * @package WooCommerce Subscriptions * @since 1.0.0 - Migrated from WooCommerce Subscriptions v2.6.0 */ class WC_Subscription_Line_Item_Switched extends \WC_Order_Item_Product { /** * Get item type. * * @return string * @since 1.0.0 - Migrated from WooCommerce Subscriptions v2.6.0 */ public function get_type() { } } /** * Subscription Object * * Extends WC_Order because the Edit Order/Subscription interface requires some of the refund related methods * from WC_Order that don't exist in WC_Abstract_Order (which would seem the more appropriate choice) * * @class WC_Subscription * @version 1.0.0 - Migrated from WooCommerce Subscriptions v2.0 * @package WooCommerce Subscriptions/Classes * @category Class * @author Brent Shepherd */ class WC_Subscription extends \WC_Order { /** @public WC_Order Stores order data for the order in which the subscription was purchased (if any) */ protected $order = \null; /** @public string Order type */ public $order_type = 'shop_subscription'; /** @private int Stores get_payment_count when used multiple times */ private $cached_payment_count = \null; /** * Which data store to load. WC 3.0+ property. * * @var string */ protected $data_store_name = 'subscription'; /** * This is the name of this object type. WC 3.0+ property. * * @var string */ protected $object_type = 'subscription'; /** * Stores the $this->is_editable() returned value in memory * * @var bool */ private $editable; /** * Extra data for this object. Name value pairs (name + default value). Used to add additional information to parent. * * WC 3.0+ property. * * @var array */ protected $extra_data = array( // Extra data with getters/setters 'billing_period' => '', 'billing_interval' => 1, 'suspension_count' => 0, 'requires_manual_renewal' => \true, 'cancelled_email_sent' => \false, 'trial_period' => '', // Extra data that requires manual getting/setting because we don't define getters/setters for it 'schedule_trial_end' => \null, 'schedule_next_payment' => \null, 'schedule_cancelled' => \null, 'schedule_end' => \null, 'schedule_payment_retry' => \null, 'schedule_start' => \null, 'switch_data' => array(), ); /** @private array The set of valid date types that can be set on the subscription */ protected $valid_date_types = array(); /** * List of properties deprecated for direct access due to WC 3.0+ & CRUD. * * @var array */ private $deprecated_properties = array('start_date', 'trial_end_date', 'next_payment_date', 'end_date', 'last_payment_date', 'order', 'payment_gateway', 'requires_manual_renewal', 'suspension_count'); /** * The meta key used to flag that the subscription's payment failed. * * Stored on the renewal order itself. * * Payments via the Block checkout transition the order status from failed to pending and then to processing. * This makes it impossible for us to know if the order was initially failed. This meta key flags that the order was initially failed. * * @var string */ const RENEWAL_FAILED_META_KEY = '_failed_renewal_order'; /** * Initializes a specific subscription if the ID is passed, otherwise a new and empty instance of a subscription. * * This class should NOT be instantiated, instead the functions wcs_create_subscription() and wcs_get_subscription() * should be used. * * @param int|WC_Subscription $subscription Subscription to read. */ public function __construct($subscription = 0) { } /** * Get internal type. * * @return string */ public function get_type() { } /** * __isset function. * * @param mixed $key * @return mixed */ public function __isset($key) { } /** * Set deprecated properties via new methods. * * @param mixed $key * @param mixed $value * @return mixed */ public function __set($key, $value) { } /** * __get function. * * @param mixed $key * @return mixed */ public function __get($key) { } /** * Checks if the subscription needs payment. * * A subscription requires payment if it: * - is pending or failed, * - has an unpaid parent order, or * - has an unpaid order or renewal order (and therefore, needs payment) * * @since 1.0.0 - Migrated from WooCommerce Subscriptions v2.0 * * @return bool True if the subscription requires payment, otherwise false. */ public function needs_payment() { } /** * Check if the subscription's payment method supports a certain feature, like date changes. * * If the subscription uses manual renewals as the payment method, it supports all features. * Otherwise, the feature will only be supported if the payment gateway set as the payment * method supports for the feature. * * @param string $payment_gateway_feature one of: * 'subscription_suspension' * 'subscription_reactivation' * 'subscription_cancellation' * 'subscription_date_changes' * 'subscription_amount_changes' * @since 1.0.0 - Migrated from WooCommerce Subscriptions v2.0 */ public function payment_method_supports($payment_gateway_feature) { } /** * Check if a the subscription can be changed to a new status or date */ public function can_be_updated_to($new_status) { } /** * Updates status of the subscription * * @param string $new_status Status to change the order to. No internal wc- prefix is required. * @param string $note (default: '') Optional note to add */ public function update_status($new_status, $note = '', $manual = \false) { } /** * Handle the status transition. */ protected function status_transition() { } /** * Checks if the subscription requires manual renewal payments. * * This differs to the @see self::get_requires_manual_renewal() method in that it also conditions outside * of the 'requires_manual_renewal' property which would force a subscription to require manual renewal * payments, like an inactive payment gateway or a site in staging mode. * * @access public * @return bool */ public function is_manual() { } /** * Sets the subscription status. * * Overrides the WC Order set_status() function to handle 'draft' and 'auto-draft' statuses for a subscription. * * 'draft' and 'auto-draft' statuses are WP statuses applied to the post when a subscription is created via admin. When * a subscription is being read from the database, and the status is set to the post's 'draft' or 'auto-draft' status, the * subscription status is treated as the default status - 'pending'. * * @since 5.1.0 * * @param string $new_status The new status. * @param string $note Optional. The note to add to the subscription. * @param bool $manual Optional. Is the status change triggered manually? Default is false. */ public function set_status($new_status, $note = '', $manual_update = \false) { } /** * Get valid order status keys * * @since 1.0.0 - Migrated from WooCommerce Subscriptions v2.2.0 * @return array details of change */ public function get_valid_statuses() { } /** * WooCommerce handles statuses without the wc- prefix in has_status, get_status and update_status, however in the database * it stores it with the prefix. This makes it hard to use the same filters / status names in both WC's methods AND WP's * get_posts functions. This function bridges that gap and returns the prefixed versions of completed statuses. * * @since 1.0.0 - Migrated from WooCommerce Subscriptions v2.0 * @return array By default: wc-processing and wc-completed */ public function get_paid_order_statuses() { } /** * Get the number of payments for a subscription. * * Default payment count includes all renewal orders and potentially an initial order * (if the subscription was created as a result of a purchase from the front end * rather than manually by the store manager). * * @param string $payment_type Type of count (completed|refunded|net). Optional. Default completed. * @param string|array $order_types Type of order relation(s) to count. Optional. Default array(parent,renewal). * @return integer Count. * @since 1.0.0 - Migrated from WooCommerce Subscriptions v2.6.0 */ public function get_payment_count($payment_type = 'completed', $order_types = '') { } /** * Get the number of payments failed * * Failed orders are the number of orders that have wc-failed as the status * * @since 1.0.0 - Migrated from WooCommerce Subscriptions v2.0 */ public function get_failed_payment_count() { } /** * Returns the total amount charged at the outset of the Subscription. * * This may return 0 if there is a free trial period or the subscription was synchronised, and no sign up fee, * otherwise it will be the sum of the sign up fee and price per period. * * @return float The total initial amount charged when the subscription product in the order was first purchased, if any. * @since 1.0.0 - Migrated from WooCommerce Subscriptions v2.0 */ public function get_total_initial_payment() { } /** * Get billing period. * * @return string * @since 1.0.0 - Migrated from WooCommerce Subscriptions v2.2.0 */ public function get_billing_period($context = 'view') { } /** * Get billing interval. * * @return string * @since 1.0.0 - Migrated from WooCommerce Subscriptions v2.2.0 */ public function get_billing_interval($context = 'view') { } /** * Get trial period. * * @return string * @since 1.0.0 - Migrated from WooCommerce Subscriptions v2.2.0 */ public function get_trial_period($context = 'view') { } /** * Get suspension count. * * @return int * @since 1.0.0 - Migrated from WooCommerce Subscriptions v2.2.0 */ public function get_suspension_count($context = 'view') { } /** * Checks if the subscription requires manual renewal payments. * * @access public * @return bool * @since 1.0.0 - Migrated from WooCommerce Subscriptions v2.2.0 */ public function get_requires_manual_renewal($context = 'view') { } /** * Get the switch data. * * @since 1.0.0 - Migrated from WooCommerce Subscriptions v2.2.0 * @return string */ public function get_switch_data($context = 'view') { } /** * Get the flag about whether the cancelled email has been sent or not. * * @return string */ public function get_cancelled_email_sent($context = 'view') { } /*** Setters *****************************************************/ /** * Set billing period. * * @since 1.0.0 - Migrated from WooCommerce Subscriptions v2.2.0 * @param string $value */ public function set_billing_period($value) { } /** * Set billing interval. * * @since 1.0.0 - Migrated from WooCommerce Subscriptions v2.2.0 * @param int $value */ public function set_billing_interval($value) { } /** * Set trial period. * * @param string $value * @since 1.0.0 - Migrated from WooCommerce Subscriptions v2.2.0 */ public function set_trial_period($value) { } /** * Set suspension count. * * @since 1.0.0 - Migrated from WooCommerce Subscriptions v2.2.0 * @param int $value */ public function set_suspension_count($value) { } /** * Set schedule start date. * * This function should not be used. It only exists to support setting the start date on subscription creation without * having to call update_dates() which results in a save. * * The more aptly named set_schedule_start() cannot exist because then WC core thinks the _schedule_start meta is an * internal meta key and throws errors. * * @param string $schedule_start The date to set the start date to. Should be a WC_DateTime or a string in the format 'Y-m-d H:i:s' (UTC). */ public function set_start_date($schedule_start) { } /** * Set schedule trial end date. * * Note: This function is intended for internal use only and should not be accessed directly. * It only exists to support setting the trial end date prop from the data store. * Calling this function does not automatically schedule the trial end date as a Scheduled Action. * * Use WC_Subscription::update_dates() instead. * * @param string $schedule_trial_end */ public function set_trial_end_date($schedule_trial_end) { } /** * Set schedule next payment date. * * Note: This function is intended for internal use only and should not be accessed directly. * It only exists to support setting the next payment date prop from the data store. * Calling this function does not automatically schedule the next payment date as a Scheduled Action. * * Use WC_Subscription::update_dates() instead. * * @param string $schedule_next_payment */ public function set_next_payment_date($schedule_next_payment) { } /** * Set schedule cancelled date. * * Note: This function is intended for internal use only and should not be accessed directly. * It only exists to support setting the cancelled date prop from the data store. * * Use WC_Subscription::update_dates() instead. * * @param string $schedule_cancelled */ public function set_cancelled_date($schedule_cancelled) { } /** * Set schedule end date. * * Note: This function is intended for internal use only and should not be accessed directly. * It only exists to support setting the end date prop from the data store. * Calling this function does not automatically schedule the end date as a Scheduled Action. * * Use WC_Subscription::update_dates() instead. * * @param string $schedule_end */ public function set_end_date($schedule_end) { } /** * Set schedule payment retry date. * * Note: This function is intended for internal use only and should not be accessed directly. * It only exists to support setting the payment retry date prop from the data store. * Calling this function does not automatically schedule the payment retry date as a Scheduled Action. * * Use WC_Subscription::update_dates() instead. * * @param string $schedule_payment_retry */ public function set_payment_retry_date($schedule_payment_retry) { } /** * Set parent order ID. We don't use WC_Abstract_Order::set_parent_id() because we want to allow false * parent IDs, like 0. * * @since 1.0.0 - Migrated from WooCommerce Subscriptions v2.2.0 * @param int $value */ public function set_parent_id($value) { } /** * Set the manual renewal flag on the subscription. * * The manual renewal flag is stored in database as string 'true' or 'false' when set, and empty string when not set * (which means it doesn't require manual renewal), but we want to consistently use it via get/set as a boolean, * for sanity's sake. * * @since 1.0.0 - Migrated from WooCommerce Subscriptions v2.2.0 * @param bool $value */ public function set_requires_manual_renewal($value) { } /** * Set the switch data on the subscription. * * @since 1.0.0 - Migrated from WooCommerce Subscriptions v2.2.0 */ public function set_switch_data($value) { } /** * Set the flag about whether the cancelled email has been sent or not. * * @since 1.0.0 - Migrated from WooCommerce Subscriptions v2.2.0 */ public function set_cancelled_email_sent($value) { } /*** Date methods *****************************************************/ /** * Get the MySQL formatted date for a specific piece of the subscriptions schedule * * @param string $date_type 'date_created', 'trial_end', 'next_payment', 'last_order_date_created' or 'end' * @param string $timezone The timezone of the $datetime param, either 'gmt' or 'site'. Default 'gmt'. */ public function get_date($date_type, $timezone = 'gmt') { } /** * Get the stored date. * * Used for WC 3.0 compatibility and for WC_Subscription_Legacy to override. * * @param string $date_type 'trial_end', 'next_payment', 'last_order_date_created', 'cancelled', 'payment_retry' or 'end' * @return WC_DateTime|NULL object if the date is set or null if there is no date. */ protected function get_date_prop($date_type) { } /** * Set the stored date. * * Used for WC 3.0 compatibility and for WC_Subscription_Legacy to override. * * @param string $date_type 'trial_end', 'next_payment', 'cancelled', 'payment_retry' or 'end' * @param string|integer|null $date UTC timestamp, or ISO 8601 DateTime. If the DateTime string has no timezone or offset, WordPress site timezone will be assumed. Null if their is no date. */ protected function set_date_prop($date_type, $value) { } /** * Get the key used to refer to the date type in the set of props * * @param string $date_type 'trial_end', 'next_payment', 'last_order_date_created', 'cancelled', 'payment_retry' or 'end' * @return string The key used to refer to the date in props */ protected function get_date_prop_key($date_type) { } /** * Get date_paid prop of most recent related order that has been paid. * * A subscription's paid date is actually determined by the most recent related order, * with a paid date set, not a prop on the subscription itself. * * @param string $context * @return WC_DateTime|NULL object if the date is set or null if there is no date. */ public function get_date_paid($context = 'view') { } /** * Set date_paid. * * A subscription's paid date is actually determined by the last order, not a prop on WC_Subscription. * * @param string|integer|null $date UTC timestamp, or ISO 8601 DateTime. If the DateTime string has no timezone or offset, WordPress site timezone will be assumed. Null if their is no date. * @throws WC_Data_Exception */ public function set_date_paid($date = \null) { } /** * Get date_completed. * * A subscription's completed date is actually determined by the last order, not a prop. * * @param string $context * @return WC_DateTime|NULL object if the date is set or null if there is no date. */ public function get_date_completed($context = 'view') { } /** * Set date_completed. * * A subscription's completed date is actually determined by the last order, not a prop. * * @param string|integer|null $date UTC timestamp, or ISO 8601 DateTime. If the DateTime string has no timezone or offset, WordPress site timezone will be assumed. Null if their is no date. * @throws WC_Data_Exception */ public function set_date_completed($date = \null) { } /** * Get a certain date type for the most recent order on the subscription with that date type, * or the last order, if the order type is specified as 'last'. * * @since 1.0.0 - Migrated from WooCommerce Subscriptions v2.2.0 * @param string $date_type Any valid WC 3.0 date property, including 'date_paid', 'date_completed', 'date_created', or 'date_modified' * @param string $order_type The type of orders to return, can be 'last', 'parent', 'switch', 'renewal' or 'any'. Default 'any'. Use 'last' to only check the last order. * @return WC_DateTime|NULL object if the date is set or null if there is no date. */ protected function get_related_orders_date($date_type, $order_type = 'any') { } /** * Set a certain date type for the last order on the subscription. * * @since 1.0.0 - Migrated from WooCommerce Subscriptions v2.2.0 * @param string $date_type One of 'date_paid', 'date_completed', 'date_modified', or 'date_created'. */ protected function set_last_order_date($date_type, $date = \null) { } /** * Returns a string representation of a subscription date in the site's time (i.e. not GMT/UTC timezone). * * @param string $date_type 'date_created', 'trial_end', 'next_payment', 'last_order_date_created', 'end' or 'end_of_prepaid_term' */ public function get_date_to_display($date_type = 'next_payment') { } /** * Get the timestamp for a specific piece of the subscriptions schedule * * @param string $date_type 'date_created', 'trial_end', 'next_payment', 'last_order_date_created', 'end' or 'end_of_prepaid_term' * @param string $timezone The timezone of the $datetime param. Default 'gmt'. */ public function get_time($date_type, $timezone = 'gmt') { } /** * Set the dates on the subscription. * * Because dates are interdependent on each other, this function will take an array of dates, make sure that all * dates are in the right order in the right format, that there is at least something to update. * * @param array $dates array containing dates with keys: 'date_created', 'trial_end', 'next_payment', 'last_order_date_created' or 'end'. Values are MySQL formatted date/time strings in UTC timezone. * @param string $timezone The timezone of the $datetime param. Default 'gmt'. */ public function update_dates($dates, $timezone = 'gmt') { } /** * Remove a date from a subscription. * * @param string $date_type 'trial_end', 'next_payment' or 'end'. The 'date_created' and 'last_order_date_created' date types will throw an exception. */ public function delete_date($date_type) { } /** * Check if a given date type can be updated for this subscription. * * @param string $date_type 'date_created', 'trial_end', 'next_payment', 'last_order_date_created' or 'end' */ public function can_date_be_updated($date_type) { } /** * Calculate a given date for the subscription in GMT/UTC. * * @param string $date_type 'trial_end', 'next_payment', 'end_of_prepaid_term' or 'end' */ public function calculate_date($date_type) { } /** * Calculates the next payment date for a subscription. * * Although an inactive subscription does not have a next payment date, this function will still calculate the date * so that it can be used to determine the date the next payment should be charged for inactive subscriptions. * * @return int | string Zero if the subscription has no next payment date, or a MySQL formatted date time if there is a next payment date */ protected function calculate_next_payment_date() { } /** * Complete a partial save, saving subscription date changes to the database. * * Sometimes it's necessary to only save changes to date properties, for example, when you * don't want status transitions to be triggered by a full object @see $this->save(). * * @since 1.0.0 - Migrated from WooCommerce Subscriptions v2.2.6 */ public function save_dates() { } /** Formatted Totals Methods *******************************************************/ /** * Gets line subtotal - formatted for display. * * @param array $item * @param string $tax_display * @return string */ public function get_formatted_line_subtotal($item, $tax_display = '') { } /** * Gets order total - formatted for display. * * @param string $tax_display only used for method signature match * @param bool $display_refunded only used for method signature match * @return string */ public function get_formatted_order_total($tax_display = '', $display_refunded = \true) { } /** * Gets subtotal - subtotal is shown before discounts, but with localised taxes. * * @param bool $compound (default: false) * @param string $tax_display (default: the tax_display_cart value) * @return string */ public function get_subtotal_to_display($compound = \false, $tax_display = '') { } /** * Get the details of the subscription for use with @see wcs_price_string() * * This is protected because it should not be used directly by outside methods. If you need * to display the price of a subscription, use the @see $this->get_formatted_order_total(), * @see $this->get_subtotal_to_display() or @see $this->get_formatted_line_subtotal() method. * If you want to customise which aspects of a price string are displayed for all subscriptions, * use the filter 'woocommerce_subscription_price_string_details'. * * @return array */ protected function get_price_string_details($amount = 0, $display_ex_tax_label = \false) { } /** * Cancel the order and restore the cart (before payment) * * @param string $note (default: '') Optional note to add */ public function cancel_order($note = '') { } /** * Allow subscription amounts/items to bed edited if the gateway supports it. * * @access public * @return bool */ public function is_editable() { } /** * Process payment on the subscription, which mainly means processing it for the last order on the subscription. * * @param $transaction_id string Optional transaction id to store in post meta */ public function payment_complete($transaction_id = '') { } /** * When payment is completed for a related order, reset any renewal related counters and reactive the subscription. * * @param WC_Order $order */ public function payment_complete_for_order($last_order) { } /** * When a payment fails, either for the original purchase or a renewal payment, this function processes it. * * @since 1.0.0 - Migrated from WooCommerce Subscriptions v2.0 */ public function payment_failed($new_status = 'on-hold') { } /*** Refund related functions are required for the Edit Order/Subscription screen, but they aren't used on a subscription ************/ /** * Get order refunds * * @since 1.0.0 - Migrated from WooCommerce Subscriptions v2.2 * @return array */ public function get_refunds() { } /** * Get amount already refunded * * @since 1.0.0 - Migrated from WooCommerce Subscriptions v2.2 * @return int|float */ public function get_total_refunded() { } /** * Get the refunded amount for a line item * * @param int $item_id ID of the item we're checking * @param string $item_type type of the item we're checking, if not a line_item * @return integer */ public function get_qty_refunded_for_item($item_id, $item_type = 'line_item') { } /** * Get the refunded amount for a line item * * @param int $item_id ID of the item we're checking * @param string $item_type type of the item we're checking, if not a line_item * @return integer */ public function get_total_refunded_for_item($item_id, $item_type = 'line_item') { } /** * Get the refunded amount for a line item * * @param int $item_id ID of the item we're checking * @param int $tax_id ID of the tax we're checking * @param string $item_type type of the item we're checking, if not a line_item * @return integer */ public function get_tax_refunded_for_item($item_id, $tax_id, $item_type = 'line_item') { } /** * Get parent order object. * * @return mixed WC_Order|bool */ public function get_parent() { } /** * Extracting the query from get_related_orders and get_last_order so it can be moved in a cached * value. * * @deprecated 1.0.0 - Migrated from WooCommerce Subscriptions v2.3.0, Moved to WCS_Subscription_Data_Store_CPT::get_related_order_ids() to separate cache logic from subscription instances and to avoid confusion from the misnomer on this method's name - it gets renewal orders, not related orders - and its ambiguity - it runs a query and returns order IDs, it does not return a SQL query string or order objects. * @return array */ public function get_related_orders_query($subscription_id) { } /** * Get the related orders for a subscription, including renewal orders and the initial order (if any) * * @param string $return_fields The columns to return, either 'all' or 'ids' * @param array|string $order_types Can include 'any', 'parent', 'renewal', 'resubscribe' and/or 'switch'. Custom types possible via the 'woocommerce_subscription_related_orders' filter. Defaults to array( 'parent', 'renewal', 'switch' ). * @since 1.0.0 - Migrated from WooCommerce Subscriptions v2.0 * @return array */ public function get_related_orders($return_fields = 'ids', $order_types = array('parent', 'renewal', 'switch')) { } /** * Get the related order IDs for a subscription based on an order type. * * @param string $order_type Can include 'any', 'parent', 'renewal', 'resubscribe' and/or 'switch'. Defaults to 'any'. * @return array List of related order IDs. * @since 1.0.0 - Migrated from WooCommerce Subscriptions v2.3.0 */ protected function get_related_order_ids($order_type = 'any') { } /** * Gets the most recent order that relates to a subscription, including renewal orders and the initial order (if any). * * @param string $return_fields The columns to return, either 'all' or 'ids' * @param array $order_types Can include any combination of 'parent', 'renewal', 'switch' or 'any' which will return the latest renewal order of any type. Defaults to 'parent' and 'renewal'. * @since 1.0.0 - Migrated from WooCommerce Subscriptions v2.0 */ public function get_last_order($return_fields = 'ids', $order_types = array('parent', 'renewal')) { } /** * Determine how the payment method should be displayed for a subscription. * * @param string $context The context the payment method is being displayed in. Can be 'admin' or 'customer'. Default 'admin'. * * @since 1.0.0 - Migrated from WooCommerce Subscriptions v2.0 */ public function get_payment_method_to_display($context = 'admin') { } /** * Save new payment method for a subscription * * @since 1.0.0 - Migrated from WooCommerce Subscriptions v2.0.0 * * @throws InvalidArgumentException An exception is thrown via @see WC_Subscription::set_payment_method_meta() if the payment meta passed is invalid. * @param WC_Payment_Gateway|string $payment_method * @param array $payment_meta Associated array of the form: $database_table => array( value, ) */ public function set_payment_method($payment_method = '', $payment_meta = array()) { } /** * Save payment method meta data for the Subscription * * @since 1.0.0 - Migrated from WooCommerce Subscriptions v2.0.0 * * @throws InvalidArgumentException An exception if the payment meta variable isn't an array. * * @param string $payment_method_id The payment method's ID. * @param array $payment_meta Associated array of the form: $database_table => array( value, ) */ protected function set_payment_method_meta($payment_method_id, $payment_meta) { } /** * Now uses the URL /my-account/view-subscription/{post-id} when viewing a subscription from the My Account Page. * * @since 1.0.0 - Migrated from WooCommerce Subscriptions v2.0 */ public function get_view_order_url() { } /** * Checks if product download is permitted * * @return bool */ public function is_download_permitted() { } /** * Check if the subscription has a line item for a specific product, by ID. * * @param int A product or variation ID to check for. * @return bool */ public function has_product($product_id) { } /** * Check if the subscription has a payment gateway. * * @since 1.0.0 - Migrated from WooCommerce Subscriptions v2.5.0 * @return bool */ public function has_payment_gateway() { } /** * The total sign-up fee for the subscription if any. * * @return int * @since 1.0.0 - Migrated from WooCommerce Subscriptions v2.0 */ public function get_sign_up_fee() { } /** * Check if a given line item on the subscription had a sign-up fee, and if so, return the value of the sign-up fee. * * The single quantity sign-up fee will be returned instead of the total sign-up fee paid. For example, if 3 x a product * with a 10 BTC sign-up fee was purchased, a total 30 BTC was paid as the sign-up fee but this function will return 10 BTC. * * @param array|int Either an order item (in the array format returned by self::get_items()) or the ID of an order item. * @param string $tax_inclusive_or_exclusive Whether or not to adjust sign up fee if prices inc tax - ensures that the sign up fee paid amount includes the paid tax if inc * @return bool * @since 1.0.0 - Migrated from WooCommerce Subscriptions v2.0 */ public function get_items_sign_up_fee($line_item, $tax_inclusive_or_exclusive = 'exclusive_of_tax') { } /** * Determine if the subscription is for one payment only. * * @return bool whether the subscription is for only one payment * @since 1.0.0 - Migrated from WooCommerce Subscriptions v2.0.17 */ public function is_one_payment() { } /** * Get the downloadable files for an item in this subscription if the subscription is active * * @param array $item * @return array */ public function get_item_downloads($item) { } /** * Validates subscription date updates ensuring the proposed date changes are in the correct format and are compatible with * the current subscription dates. Also returns the dates in the gmt timezone - ready for setting/deleting. * * @param array $dates array containing dates with keys: 'date_created', 'trial_end', 'next_payment', 'last_order_date_created' or 'end'. Values are MySQL formatted date/time strings in UTC timezone. * @param string $timezone The timezone of the $datetime param. Default 'gmt'. * @return array $dates array of dates in gmt timezone. */ public function validate_date_updates($dates, $timezone = 'gmt') { } /** * Add a product line item to the subscription. * * @since 1.0.0 - Migrated from WooCommerce Subscriptions v2.1.4 * @param WC_Product product * @param int line item quantity. * @param array args * @return int|bool Item ID or false. */ public function add_product($product, $qty = 1, $args = array()) { } /** * Get the set of date types that can be set/get from this subscription. * * The allowed dates includes both subscription date dates, and date types for related orders, like 'last_order_date_created'. * * @since 1.0.0 - Migrated from WooCommerce Subscriptions v2.2.0 * @return array */ protected function get_valid_date_types() { } /** * Generates a URL to add or change the subscription's payment method from the my account page. * * @return string * @since 1.0.0 - Migrated from WooCommerce Subscriptions v2.5.0 */ public function get_change_payment_method_url() { } /* Get the subscription's payment method meta. * * @since 1.0.0 - Migrated from WooCommerce Subscriptions v2.4.3 * @return array The subscription's payment meta in the format returned by the woocommerce_subscription_payment_meta filter. */ public function get_payment_method_meta() { } /************************ * WC_Order overrides * * Make some WC_Order methods do nothing. ************************/ /** * Avoid running the expensive get_date_paid() query on related orders. * * @since 1.0.0 - Migrated from WooCommerce Subscriptions v2.2.19 */ public function maybe_set_date_paid() { } /** * Avoid running the expensive get_date_completed() query on related orders. * * @since 1.0.0 - Migrated from WooCommerce Subscriptions v2.2.19 */ protected function maybe_set_date_completed() { } /** * Get totals for display on pages and in emails. * * @param mixed $tax_display Excl or incl tax display mode. * @return array */ public function get_order_item_totals($tax_display = '') { } /************************ * Deprecated Functions * ************************/ /** * Set or change the WC_Order ID which records the subscription's initial purchase. * * @param int|WC_Order $order */ public function update_parent($order) { } /** * Update the internal tally of suspensions on this subscription since the last payment. * * @return int The count of suspensions * @since 1.0.0 - Migrated from WooCommerce Subscriptions v2.0 */ public function update_suspension_count($new_count) { } /** * Checks if the subscription requires manual renewal payments. * * @access public * @return bool */ public function update_manual($is_manual = \true) { } /** * Get the "last payment date" for a subscription, in GMT/UTC. * * The "last payment date" is based on the original order used to purchase the subscription or * it's last renewal order, which ever is more recent. * * The "last payment date" is in quotation marks because this function didn't and still doesn't * accurately return the last payment date. Instead, it returned and still returns the date of the * last order, regardless of its paid status. This is partly why this function has been deprecated * in favour of self::get_date_paid() (or self::get_related_orders_date( 'date_created', 'last' ). * * For backward compatibility we have to use the date created here, see: https://github.com/Prospress/woocommerce-subscriptions/issues/1943 * * @deprecated 1.0.0 - Migrated from WooCommerce Subscriptions v2.2.0 * @since 1.0.0 - Migrated from WooCommerce Subscriptions v2.0 */ protected function get_last_payment_date() { } /** * Updated both the _paid_date and post date GMT with the WooCommerce < 3.0 date storage structures. * * @deprecated 1.0.0 - Migrated from WooCommerce Subscriptions v2.2.0 * @param string $datetime A MySQL formatted date/time string in GMT/UTC timezone. */ protected function update_last_payment_date($datetime) { } /** * Get the number of payments completed for a subscription * * Completed payment include all renewal orders and potentially an initial order (if the * subscription was created as a result of a purchase from the front end rather than * manually by the store manager). * * @deprecated 1.0.0 - Migrated from WooCommerce Subscriptions v2.6.0 */ public function get_completed_payment_count() { } /** * Apply the deprecated 'woocommerce_subscription_payment_completed_count' filter * to maintain backward compatibility. * * @param int $count * * @return int * * @deprecated 1.0.0 - Migrated from WooCommerce Subscriptions v2.6.0 */ protected function apply_deprecated_completed_payment_count_filter($count) { } } /** * Subscriptions Address Class * * Hooks into WooCommerce to handle editing addresses for subscriptions (by editing the original order for the subscription) * * @package WooCommerce Subscriptions * @subpackage WC_Subscriptions_Addresses * @category Class * @author Brent Shepherd * @since 1.0.0 - Migrated from WooCommerce Subscriptions v1.3 */ class WC_Subscriptions_Addresses { /** * Bootstraps the class and hooks required actions & filters. * * @since 1.0.0 - Migrated from WooCommerce Subscriptions v1.3 */ public static function init() { } /** * Checks if a user can edit a subscription's address. * * @param int|WC_Subscription $subscription Post ID of a 'shop_subscription' post, or instance of a WC_Subscription object. * @param int $user_id The ID of a user. * @return bool Whether the user can edit the subscription's address. * @since 1.0.0 - Migrated from WooCommerce Subscriptions v3.0.15 */ private static function can_user_edit_subscription_address($subscription, $user_id = 0) { } /** * Add a "Change Shipping Address" button to the "My Subscriptions" table for those subscriptions * which require shipping. * * @param array $actions The $subscription_id => $actions array with all actions that will be displayed for a subscription on the "My Subscriptions" table * @param \WC_Subscription $subscription the Subscription object that is being viewed. * @since 1.0.0 - Migrated from WooCommerce Subscriptions v1.3 */ public static function add_edit_address_subscription_action($actions, $subscription) { } /** * Redirects to "My Account" when attempting to edit the address on a subscription that doesn't belong to the user. * * @since 1.0.0 - Migrated from WooCommerce Subscriptions v3.0.15 */ public static function maybe_restrict_edit_address_endpoint() { } /** * Outputs the necessary markup on the "My Account" > "Edit Address" page for editing a single subscription's * address or to check if the customer wants to update the addresses for all of their subscriptions. * * If editing their default shipping address, this function adds a checkbox to the to allow subscribers to * also update the address on their active subscriptions. If editing a single subscription's address, the * subscription key is added as a hidden field. * * @since 1.0.0 - Migrated from WooCommerce Subscriptions v1.3 */ public static function maybe_add_edit_address_checkbox() { } /** * When a subscriber's billing or shipping address is successfully updated, check if the subscriber * has also requested to update the addresses on existing subscriptions and if so, go ahead and update * the addresses on the initial order for each subscription. * * @param int $user_id The ID of a user who own's the subscription (and address) * @since 1.0.0 - Migrated from WooCommerce Subscriptions v1.3 */ public static function maybe_update_subscription_addresses($user_id, $address_type) { } /** * Prepopulate the address fields on a subscription item * * @param array $address A WooCommerce address array * @since 1.0.0 - Migrated from WooCommerce Subscriptions v1.5 */ public static function maybe_populate_subscription_addresses($address) { } /** * Update the address fields on an order * * @param array $subscription A WooCommerce Subscription array * @param array $address_fields Locale aware address fields of the form returned by WC_Countries->get_address_fields() for a given country * @since 1.0.0 - Migrated from WooCommerce Subscriptions v1.3 */ public static function maybe_update_order_address($subscription, $address_fields) { } /** * Replace the change address breadcrumbs structure to include a link back to the subscription. * * @param array $crumbs * @return array * @since 1.0.0 - Migrated from WooCommerce Subscriptions v2.4.2 */ public static function change_addresses_breadcrumb($crumbs) { } } /** * Subscriptions Cart Validator Class * * Validates the Cart contents * * @package WooCommerce Subscriptions * @subpackage WC_Subscriptions_Cart_Validator * @category Class * @since 1.0.0 - Migrated from WooCommerce Subscriptions v2.6.0 */ class WC_Subscriptions_Cart_Validator { /** * Bootstraps the class and hooks required actions & filters. */ public static function init() { } /** * When a subscription is added to the cart, remove other products/subscriptions to * work with PayPal Standard, which only accept one subscription per checkout. * * If multiple purchase flag is set, allow them to be added at the same time. * * @since 1.0.0 - Migrated from WooCommerce Subscriptions v2.6.0 */ public static function maybe_empty_cart($valid, $product_id, $quantity, $variation_id = '', $variations = array()) { } /** * This checks cart items for mixed checkout. * * @param $cart WC_Cart the one we got from session * @return WC_Cart $cart * * @since 1.0.0 - Migrated from WooCommerce Subscriptions v2.6.0 */ public static function validate_cart_contents_for_mixed_checkout($cart) { } /** * Don't allow new subscription products to be added to the cart if it contains a subscription renewal already. * * @since 1.0.0 - Migrated from WooCommerce Subscriptions v2.6.0 */ public static function can_add_subscription_product_to_cart($can_add, $product_id, $quantity, $variation_id = '', $variations = array(), $item_data = array()) { } /** * Adds the required cart AJAX args and filter callbacks to cause an error and redirect the customer. * * Attached by @see WC_Subscriptions_Cart_Validator::validate_cart_contents_for_mixed_checkout() and * @see WC_Subscriptions_Cart_Validator::maybe_empty_cart() when the store has multiple subscription * purchases disabled, the cart already contains products and the customer adds a new item or logs in * causing a cart merge. * * @since 1.0.0 - Migrated from WooCommerce Subscriptions v4.0.0 * * @param array $fragments The add to cart AJAX args. * @return array $fragments */ public static function add_to_cart_ajax_redirect($fragments) { } } /** * Subscriptions Cart Class * * Mirrors a few functions in the WC_Cart class to work for subscriptions. * * @package WooCommerce Subscriptions * @subpackage WC_Subscriptions_Cart * @category Class * @author Brent Shepherd * @since 1.0.0 - Migrated from WooCommerce Subscriptions v1.0 */ class WC_Subscriptions_Cart { /** * A flag to control how to modify the calculation of totals by WC_Cart::calculate_totals() * * Can take any one of these values: * - 'none' used to calculate the initial total. * - 'combined_total' used to calculate the total of sign-up fee + recurring amount. * - 'sign_up_fee_total' used to calculate the initial amount when there is a free trial period and a sign-up fee. Different to 'combined_total' because shipping is not charged on a sign-up fee. * - 'recurring_total' used to calculate the totals for the recurring amount when the recurring amount differs to to 'combined_total' because of coupons or sign-up fees. * - 'free_trial_total' used to calculate the initial total when there is a free trial period and no sign-up fee. Different to 'combined_total' because shipping is not charged up-front when there is a free trial. * * @since 1.0.0 - Migrated from WooCommerce Subscriptions v1.2 */ private static $calculation_type = 'none'; /** * An internal pointer to the current recurring cart calculation (if any) * * @since 1.0.0 - Migrated from WooCommerce Subscriptions v2.0.12 */ private static $recurring_cart_key = 'none'; /** * A cache of the calculated recurring shipping packages * * @since 1.0.0 - Migrated from WooCommerce Subscriptions v2.0.13 */ private static $recurring_shipping_packages = array(); /** * A cache of the current recurring cart being calculated * * @since 1.0.0 - Migrated from WooCommerce Subscriptions v2.0.20 */ private static $cached_recurring_cart = \null; /** * Bootstraps the class and hooks required actions & filters. * * @since 1.0.0 - Migrated from WooCommerce Subscriptions v1.0 */ public static function init() { } /** * Attach dependant callbacks. * * @since 1.0.0 - Migrated from WooCommerce Subscriptions v2.5.6 */ public static function attach_dependant_hooks() { } /** * Attaches the "set_subscription_prices_for_calculation" filter to the WC Product's woocommerce_get_price hook. * * This function is hooked to "woocommerce_before_calculate_totals" so that WC will calculate a subscription * product's total based on the total of it's price per period and sign up fee (if any). * * @since 1.0.0 - Migrated from WooCommerce Subscriptions v1.2 */ public static function add_calculation_price_filter() { } /** * Removes the "set_subscription_prices_for_calculation" filter from the WC Product's woocommerce_get_price hook once * calculations are complete. * * @since 1.0.0 - Migrated from WooCommerce Subscriptions v1.2 */ public static function remove_calculation_price_filter() { } /** * Use WC core add-to-cart handlers for subscription products. * * @param string $handler The name of the handler to use when adding product to the cart * @param WC_Product $product */ public static function add_to_cart_handler($handler, $product) { } /** * If we are running a custom calculation, we need to set the price returned by a product * to be the appropriate value. This may include just the sign-up fee, a combination of the * sign-up fee and recurring amount or just the recurring amount (default). * * If there are subscriptions in the cart and the product is not a subscription, then * set the recurring total to 0. * * @since 1.0.0 - Migrated from WooCommerce Subscriptions v1.2 */ public static function set_subscription_prices_for_calculation($price, $product) { } /** * Calculate the initial and recurring totals for all subscription products in the cart. * * We need to group subscriptions by billing schedule to make the display and creation of recurring totals sane, * when there are multiple subscriptions in the cart. To do that, we use an array with keys of the form: * '{billing_interval}_{billing_period}_{trial_interval}_{trial_period}_{length}_{billing_period}'. This key * is used to reference WC_Cart objects for each recurring billing schedule and these are stored in the master * cart with the billing schedule key. * * After we have calculated and grouped all recurring totals, we need to checks the structure of the subscription * product prices to see whether they include sign-up fees and/or free trial periods and then recalculates the * appropriate totals by using the @see self::$calculation_type flag and cloning the cart to run @see WC_Cart::calculate_totals() * * @since 1.0.0 - Migrated from WooCommerce Subscriptions v1.3.5 * @version 1.0.0 - Migrated from WooCommerce Subscriptions v2.0 */ public static function calculate_subscription_totals($total, $cart) { } /** * Check whether shipping should be charged on the initial order. * * When the cart contains a physical subscription with a free trial and no other physical items, shipping * should not be charged up-front. * * @internal self::all_cart_items_have_free_trial() is false if non-subscription products are in the cart. * * @since 1.0.0 - Migrated from WooCommerce Subscriptions v1.5.4 */ public static function charge_shipping_up_front() { } /** * The cart needs shipping only if it needs shipping up front and/or for recurring items. * * @since 1.0.0 - Migrated from WooCommerce Subscriptions v2.0 * @param boolean $needs_shipping True if shipping is needed for the cart. * @return boolean */ public static function cart_needs_shipping($needs_shipping) { } /** * The cart needs a shipping address if any item needs shipping, including recurring items. * * @param boolean $needs_shipping_address True if a shipping address is needed for the cart. * @return boolean */ public static function cart_needs_shipping_address($needs_shipping_address) { } /** * Remove all recurring shipping methods stored in the session (i.e. methods with a key that is a string) * * This is attached as a callback to hooks triggered whenever a product is removed from the cart. * * @param $cart_item_key string The key for a cart item about to be removed from the cart. * @return null * @since 1.0.0 - Migrated from WooCommerce Subscriptions v2.0.15 */ public static function maybe_reset_chosen_shipping_methods($cart_item_key) { } /** * When shipping subscriptions, changes the original package to "initial shipment". * * @param string $package_name Package name. * @param string|int $package_id Package ID. * @return array $package Package contents. */ public static function change_initial_shipping_package_name($package_name, $package_id, $package) { } /** * Create a shipping package index for a given shipping package on a recurring cart. * * @param string $recurring_cart_key a cart key of the form returned by @see self::get_recurring_cart_key() * @param int $package_index the index of a package * @since 1.0.0 - Migrated from WooCommerce Subscriptions v2.0.12 */ public static function get_recurring_shipping_package_key($recurring_cart_key, $package_index) { } /** * Create a shipping package index for a given shipping package on a recurring cart. * * @return array */ public static function get_recurring_shipping_packages() { } /** * Add the shipping packages stored in @see self::$recurring_shipping_packages to WooCommerce's global * set of packages in WC()->shipping->packages so that plugins attempting to get the details of recurring * packages can get them with WC()->shipping->get_packages() like any other packages. * * @since 1.0.0 - Migrated from WooCommerce Subscriptions v2.0.13 */ public static function set_global_recurring_shipping_packages() { } /** * Check whether all the subscription product items in the cart have a free trial. * * Useful for determining if certain up-front amounts should be charged. * * @since 1.0.0 - Migrated from WooCommerce Subscriptions v2.0 */ public static function all_cart_items_have_free_trial() { } /** * Check if the cart contains a subscription which requires shipping. * * @since 1.0.0 - Migrated from WooCommerce Subscriptions v1.5.4 */ public static function cart_contains_subscriptions_needing_shipping($cart = \null) { } /** * Filters the cart contents to remove any subscriptions with free trials (or synchronised to a date in the future) * to make sure no shipping amount is calculated for them. * * @since 1.0.0 - Migrated from WooCommerce Subscriptions v2.0 */ public static function set_cart_shipping_packages($packages) { } /** * Checks whether or not the COD gateway should be available on checkout when a subscription has a free trial. * * @since 1.0.0 - Migrated from WooCommerce Subscriptions v3.0.6 * * @param array $available_gateways The currently available payment gateways. * @return array All of the available payment gateways. */ public static function check_cod_gateway_for_free_trials($available_gateways) { } /* Formatted Totals Functions */ /** * Returns the subtotal for a cart item including the subscription period and duration details * * @since 1.0.0 - Migrated from WooCommerce Subscriptions v1.0 */ public static function get_formatted_product_subtotal($product_subtotal, $product, $quantity, $cart) { } /* * Helper functions for extracting the details of subscriptions in the cart */ /** * Checks the cart to see if it contains a subscription product. * * @since 1.0.0 - Migrated from WooCommerce Subscriptions v1.0 * @return boolean */ public static function cart_contains_subscription() { } /** * Checks the cart to see if it contains a subscription product with a free trial * * @since 1.0.0 - Migrated from WooCommerce Subscriptions v1.2 */ public static function cart_contains_free_trial() { } /** * Gets the cart calculation type flag * * @since 1.0.0 - Migrated from WooCommerce Subscriptions v1.2 */ public static function get_calculation_type() { } /** * Sets the cart calculation type flag * * @since 1.0.0 - Migrated from WooCommerce Subscriptions v2.0 */ public static function set_calculation_type($calculation_type) { } /** * Sets the recurring cart key flag. * * @internal While this is indeed stored to the cart object, some hooks such as woocommerce_cart_shipping_packages * do not have access to this property. So we can properly set package IDs we make use of this flag. * * @param string $recurring_cart_key Recurring cart key used to identify the current recurring cart being processed. */ public static function set_recurring_cart_key($recurring_cart_key) { } /** * Update the cached recurring cart. * * @param \WC_Cart $recurring_cart Cart object. */ public static function set_cached_recurring_cart($recurring_cart) { } /** * Gets the subscription sign up fee for the cart and returns it * * Currently short-circuits to return just the sign-up fee of the first subscription, because only * one subscription can be purchased at a time. * * @since 1.0.0 - Migrated from WooCommerce Subscriptions v1.0 */ public static function get_cart_subscription_sign_up_fee() { } /** * Check whether the cart needs payment even if the order total is $0 * * @param bool $needs_payment The existing flag for whether the cart needs payment or not. * @param WC_Cart $cart The WooCommerce cart object. * @return bool */ public static function cart_needs_payment($needs_payment, $cart) { } /** * Restore shipping method, as well as cost and tax estimate when on the cart page. * * The WC_Shortcode_Cart actually calculates shipping when the "Calculate Shipping" form is submitted on the * cart page. Because of that, our own @see self::calculate_totals() method calculates incorrect values on * the cart page because it triggers the method multiple times for multiple different pricing structures. * This uses the same logic found in WC_Shortcode_Cart::output() to determine the correct estimate. * * @since 1.0.0 - Migrated from WooCommerce Subscriptions v1.4.10 */ private static function maybe_restore_shipping_methods() { } /** * Make sure cart product prices correctly include/exclude taxes. * * @since 1.0.0 - Migrated from WooCommerce Subscriptions v1.5.8 */ public static function cart_product_price($price, $product) { } /** * Displays the recurring totals for items in the cart. * * @since 1.0.0 - Migrated from WooCommerce Subscriptions v2.0 */ public static function display_recurring_totals() { } /** * Construct a cart key based on the billing schedule of a subscription product. * * Subscriptions groups products by billing schedule when calculating cart totals, so that shipping and other "per order" amounts * can be calculated for each group of items for each renewal. This method constructs a cart key based on the billing schedule * to allow products on the same billing schedule to be grouped together - free trials and synchronisation is accounted for by * using the first renewal date (if any) for the subscription. * * @since 1.0.0 - Migrated from WooCommerce Subscriptions v2.0 */ public static function get_recurring_cart_key($cart_item, $renewal_time = '') { } /** * When calculating shipping for recurring carts, return a revised list of shipping methods that apply to this recurring cart. * * When WooCommerce determines the taxable address for local pick up methods, we only want to return pick up shipping methods * chosen for the recurring cart being calculated instead of all methods. * * @param array $shipping_methods * * @since 1.0.0 - Migrated from WooCommerce Subscriptions v2.0.13 */ public static function filter_recurring_cart_chosen_shipping_method($shipping_methods) { } /** * Validate the chosen recurring shipping methods for each recurring shipping package. * Ensures there is at least one chosen shipping method and that the chosen method is valid considering the available * package rates. * * @since 1.0.0 - Migrated from WooCommerce Subscriptions v2.0.14 */ public static function validate_recurring_shipping_methods() { } /** * Checks the cart to see if it contains a specific product. * * @param int The product ID or variation ID to look for. * @return bool Whether the product is in the cart. * @since 1.0.0 - Migrated from WooCommerce Subscriptions v2.0.13 */ public static function cart_contains_product($product_id) { } /** * Checks the cart to see if it contains any subscription product other than a specific product. * * @param int The product ID or variation ID other than which to look for. * @return bool Whether another subscription product is in the cart. * @since 1.0.0 - Migrated from WooCommerce Subscriptions v3.0.5 */ public static function cart_contains_other_subscription_products($product_id) { } /** * When calculating the free shipping method availability, WC uses the WC->cart object. During shipping calculations for * recurring carts we need the recurring cart's total and coupons to be the base for checking its availability * * @param bool $is_available * @param array $package * @return bool $is_available a revised version of is_available based off the recurring cart object * * @since 1.0.0 - Migrated from WooCommerce Subscriptions v2.0.20 */ public static function maybe_recalculate_shipping_method_availability($is_available, $package) { } /** * Calculates whether a shipping method is available for the recurring cart. * * By default WooCommerce core checks the initial cart for shipping method availability. For recurring carts, * shipping method availability is based whether the recurring total and coupons meet the requirements. * * @since 1.0.0 - Migrated from WooCommerce Subscriptions v2.5.6 * * @param bool $is_available Whether the shipping method is available or not. * @param array $package a shipping package. * @param WC_Shipping_Method $shipping_method An instance of a shipping method. * @return bool Whether the shipping method is available for the recurring cart or not. */ public static function recalculate_shipping_method_availability($is_available, $package, $shipping_method) { } /** * Allow third-parties to apply fees which apply to the cart to recurring carts. * * @param WC_Cart * @since 1.0.0 - Migrated from WooCommerce Subscriptions v2.2.16 */ public static function apply_recurring_fees($cart) { } /** * Update the chosen recurring package shipping methods from posted checkout form data. * * Between requests, the presence of recurring package chosen shipping methods in posted * checkout data can change. For example, when the number of available shipping methods * change and cause the hidden elements (generated by @see wcs_cart_print_shipping_input()) * to be displayed or not displayed. * * When this occurs, we need to remove those chosen shipping methods from the session so * that those packages no longer use the previously selected shipping method. * * @param string $encoded_form_data Encoded checkout form data. * @since 1.0.0 - Migrated from WooCommerce Subscriptions v2.3.0 */ public static function update_chosen_shipping_methods($encoded_form_data) { } /** * Removes all subscription products from the shopping cart. * * @since 1.0.0 - Migrated from WooCommerce Subscriptions v2.6.0 */ public static function remove_subscriptions_from_cart() { } /** * Records the cart item base location tax total for later storage. * * If the customer is outside of the base location, WC core removes the taxes * which apply to the base location. @see WC_Cart_Totals::adjust_non_base_location_price(). * * We need to record these base tax rates to be able to honour grandfathered subscription * recurring prices in renewal carts. * * @since 1.0.0 - Migrated from WooCommerce Subscriptions v3.0.10 * @param WC_Cart $cart The cart object. Could be the global (initial cart) or a recurring cart. */ public static function record_base_tax_rates($cart) { } /** * Set the chosen shipping method for recurring cart calculations * * In WC_Shipping::calculate_shipping(), WooCommerce tries to determine the chosen shipping method * based on the package index and stores rates. However, for recurring cart shipping selection, we * use the recurring cart key instead of numeric index. Therefore, we need to hook in to override * the default shipping method when WooCommerce could not find a matching shipping method. * * @since 1.0.0 - Migrated from WooCommerce Subscriptions v2.0.12 * * @param string $default_method the default shipping method for the customer/store returned by WC_Shipping::get_default_method() * @param array $available_methods set of shipping rates for this calculation * @param int $package_index WC doesn't pass the package index to callbacks on the 'woocommerce_shipping_chosen_method' filter (yet) so we set a default value of 0 for it in the function params * * @return $default_method */ public static function set_chosen_shipping_method($default_method, $available_methods, $package_index = 0) { } /** * Redirects the customer to the cart after they add a subscription to the cart. * * Only enabled if multiple checkout is not enabled. * * @since 1.0.0 - Migrated from WooCommerce Subscriptions v4.0.0 * * @param string $url The cart redirect $url. * @return string $url. */ public static function add_to_cart_redirect($url) { } /* Deprecated */ /** * Calculates the shipping rates for a package. * * This function will check cached rates based on a hash of the package contents to avoid re-calculation per page load. * If there are no rates stored in the cache for this package, it will fall back to @see WC_Shipping::calculate_shipping_for_package() * * @deprecated 5.4.0 * * @param array $package A shipping package in the form returned by @see WC_Cart->get_shipping_packages() * @return array $package * @since 1.0.0 - Migrated from WooCommerce Subscriptions v2.0.18 */ public static function get_calculated_shipping_for_package($package) { } /** * Cache the package rates calculated by @see WC_Shipping::calculate_shipping_for_package() to avoid multiple calls of calculate_shipping_for_package() per request. * * @deprecated 5.4.0 * * @param array $rates A set of WC_Shipping_Rate objects. * @param array $package A shipping package in the form returned by @see WC_Cart->get_shipping_packages() * @return array $rates An unaltered set of WC_Shipping_Rate objects passed to the function * @since 1.0.0 - Migrated from WooCommerce Subscriptions v2.0.18 */ public static function cache_package_rates($rates, $package) { } /** * Don't allow new subscription products to be added to the cart if it contains a subscription renewal already. * * @deprecated 1.0.0 - Migrated from WooCommerce Subscriptions v2.6.0 * @since 1.0.0 - Migrated from WooCommerce Subscriptions v2.0 */ public static function check_valid_add_to_cart($is_valid, $product_id, $quantity, $variation_id = '', $variations = array(), $item_data = array()) { } /** * Make sure cart totals are calculated when the cart widget is populated via the get_refreshed_fragments() method * so that @see self::get_formatted_cart_subtotal() returns the correct subtotal price string. * * @since 1.0.0 - Migrated from WooCommerce Subscriptions v1.5.11 * @deprecated 1.0.0 - Migrated from WooCommerce Subscriptions v2.5.0 */ public static function pre_get_refreshed_fragments() { } /** * Checks the cart to see if it contains a subscription product renewal. * * Returns the cart_item containing the product renewal, else false. * * @deprecated 1.0.0 - Migrated from WooCommerce Subscriptions v2.0 * @since 1.0.0 - Migrated from WooCommerce Subscriptions v1.3 */ public static function cart_contains_subscription_renewal($role = '') { } /** * Checks the cart to see if it contains a subscription product renewal. * * Returns the cart_item containing the product renewal, else false. * * @deprecated 1.0.0 - Migrated from WooCommerce Subscriptions v2.0 * @since 1.0.0 - Migrated from WooCommerce Subscriptions v1.4 */ public static function cart_contains_failed_renewal_order_payment() { } /** * Restore renewal flag when cart is reset and modify Product object with * renewal order related info * * @since 1.0.0 - Migrated from WooCommerce Subscriptions v1.3 */ public static function get_cart_item_from_session($session_data, $values, $key) { } /** * For subscription renewal via cart, use original order discount * * @since 1.0.0 - Migrated from WooCommerce Subscriptions v1.3 */ public static function before_calculate_totals($cart) { } /** * For subscription renewal via cart, previously adjust item price by original order discount * * No longer required as of 1.3.5 as totals are calculated correctly internally. * * @since 1.0.0 - Migrated from WooCommerce Subscriptions v1.3 */ public static function get_discounted_price_for_renewal($price, $values, $cart) { } /** * Returns a string with the cart discount and subscription period. * * @return mixed formatted price or false if there are none * @since 1.0.0 - Migrated from WooCommerce Subscriptions v1.2 * @deprecated 1.0.0 - Migrated from WooCommerce Subscriptions v2.0 */ public static function get_formatted_discounts_before_tax($discount, $cart) { } /** * Gets the order discount amount - these are applied after tax * * @return mixed formatted price or false if there are none * @since 1.0.0 - Migrated from WooCommerce Subscriptions v1.2 * @deprecated 1.0.0 - Migrated from WooCommerce Subscriptions v2.0 */ public static function get_formatted_discounts_after_tax($discount, $cart) { } /** * Returns an individual coupon's formatted discount amount for WooCommerce 2.1+ * * @param string $discount_html String of the coupon's discount amount * @param string $coupon WC_Coupon object for the coupon to which this line item relates * @return string formatted subscription price string if the cart includes a coupon being applied to recurring amount * @since 1.0.0 - Migrated from WooCommerce Subscriptions v1.4.6 * @deprecated 1.0.0 - Migrated from WooCommerce Subscriptions v2.0 */ public static function cart_coupon_discount_amount_html($discount_html, $coupon) { } /** * Returns individual coupon's formatted discount amount for WooCommerce 2.1+ * * @param string $discount_html String of the coupon's discount amount * @param string $coupon WC_Coupon object for the coupon to which this line item relates * @return string formatted subscription price string if the cart includes a coupon being applied to recurring amount * @since 1.0.0 - Migrated from WooCommerce Subscriptions v1.4.6 * @deprecated 1.0.0 - Migrated from WooCommerce Subscriptions v2.0 */ public static function cart_totals_fee_html($cart_totals_fee_html, $fee) { } /** * Includes the sign-up fee total in the cart total (after calculation). * * @since 1.0.0 - Migrated from WooCommerce Subscriptions v1.5.10 * @return string formatted price * @deprecated 1.0.0 - Migrated from WooCommerce Subscriptions v2.0 */ public static function get_formatted_cart_total($cart_contents_total) { } /** * Includes the sign-up fee subtotal in the subtotal displayed in the cart. * * @since 1.0.0 - Migrated from WooCommerce Subscriptions v1.2 * @deprecated 1.0.0 - Migrated from WooCommerce Subscriptions v2.0 */ public static function get_formatted_cart_subtotal($cart_subtotal, $compound, $cart) { } /** * Returns an array of taxes merged by code, formatted with recurring amount ready for output. * * @return array Array of tax_id => tax_amounts for items in the cart * @since 1.0.0 - Migrated from WooCommerce Subscriptions v1.3.5 * @deprecated 1.0.0 - Migrated from WooCommerce Subscriptions v2.0 */ public static function get_recurring_tax_totals($tax_totals, $cart) { } /** * Returns a string of the sum of all taxes in the cart for initial payment and * recurring amount. * * @return array Array of tax_id => tax_amounts for items in the cart * @since 1.0.0 - Migrated from WooCommerce Subscriptions v1.4.10 * @deprecated 1.0.0 - Migrated from WooCommerce Subscriptions v2.0 */ public static function get_taxes_total_html($total) { } /** * Appends the cart subscription string to a cart total using the @see self::get_cart_subscription_string and then returns it. * * @return string Formatted subscription price string for the cart total. * @since 1.0.0 - Migrated from WooCommerce Subscriptions v1.2 * @deprecated 1.0.0 - Migrated from WooCommerce Subscriptions v2.0 */ public static function get_formatted_total($total) { } /** * Appends the cart subscription string to a cart total using the @see self::get_cart_subscription_string and then returns it. * * @return string Formatted subscription price string for the cart total. * @since 1.0.0 - Migrated from WooCommerce Subscriptions v1.2 * @deprecated 1.0.0 - Migrated from WooCommerce Subscriptions v2.0 */ public static function get_formatted_total_ex_tax($total_ex_tax) { } /** * Returns an array of the recurring total fields * * @since 1.0.0 - Migrated from WooCommerce Subscriptions v1.2 * @deprecated 1.0.0 - Migrated from WooCommerce Subscriptions v2.0 */ public static function get_recurring_totals_fields() { } /** * Gets the subscription period from the cart and returns it as an array (eg. array( 'month', 'day' ) ) * * Deprecated because a cart can now contain multiple subscription products, so there is no single period for the entire cart. * * @since 1.0.0 - Migrated from WooCommerce Subscriptions v1.0 * @deprecated 1.0.0 - Migrated from WooCommerce Subscriptions v2.0 */ public static function get_cart_subscription_period() { } /** * Gets the subscription period from the cart and returns it as an array (eg. array( 'month', 'day' ) ) * * Deprecated because a cart can now contain multiple subscription products, so there is no single interval for the entire cart. * * @since 1.0.0 - Migrated from WooCommerce Subscriptions v1.0 * @deprecated 1.0.0 - Migrated from WooCommerce Subscriptions v2.0 */ public static function get_cart_subscription_interval() { } /** * Gets the subscription length from the cart and returns it as an array (eg. array( 'month', 'day' ) ) * * Deprecated because a cart can now contain multiple subscription products, so there is no single length for the entire cart. * * @since 1.0.0 - Migrated from WooCommerce Subscriptions v1.1 * @deprecated 1.0.0 - Migrated from WooCommerce Subscriptions v2.0 */ public static function get_cart_subscription_length() { } /** * Gets the subscription length from the cart and returns it as an array (eg. array( 'month', 'day' ) ) * * Deprecated because a cart can now contain multiple subscription products, so there is no single trial length for the entire cart. * * @since 1.0.0 - Migrated from WooCommerce Subscriptions v1.1 * @deprecated 1.0.0 - Migrated from WooCommerce Subscriptions v2.0 */ public static function get_cart_subscription_trial_length() { } /** * Gets the subscription trial period from the cart and returns it as an array (eg. array( 'month', 'day' ) ) * * Deprecated because a cart can now contain multiple subscription products, so there is no single trial period for the entire cart. * * @since 1.0.0 - Migrated from WooCommerce Subscriptions v1.2 * @deprecated 1.0.0 - Migrated from WooCommerce Subscriptions v2.0 */ public static function get_cart_subscription_trial_period() { } /** * Get tax row amounts with or without compound taxes includes * * Deprecated because the cart can now contain subscriptions on multiple billing schedules so there is no one "total" * * @return float price * @deprecated 1.0.0 - Migrated from WooCommerce Subscriptions v2.0 */ public static function get_recurring_cart_contents_total() { } /** * Returns the proportion of cart discount that is recurring for the product specified with $product_id * * Deprecated because the cart can now contain subscriptions on multiple billing schedules so there is no one "total" * * @return double The total recurring item subtotal amount less tax for items in the cart. * @since 1.0.0 - Migrated from WooCommerce Subscriptions v1.2 */ public static function get_recurring_subtotal_ex_tax() { } /** * Returns the proportion of cart discount that is recurring for the product specified with $product_id * * Deprecated because the cart can now contain subscriptions on multiple billing schedules so there is no one "total" * * @return double The total recurring item subtotal amount for items in the cart. * @since 1.0.0 - Migrated from WooCommerce Subscriptions v1.2 */ public static function get_recurring_subtotal() { } /** * Returns the proportion of cart discount that is recurring for the product specified with $product_id * * Deprecated because the cart can now contain subscriptions on multiple billing schedules so there is no one "total" * * @return double The total recurring cart discount amount for items in the cart. * @since 1.0.0 - Migrated from WooCommerce Subscriptions v1.2 */ public static function get_recurring_discount_cart() { } /** * Returns the cart discount tax amount for WC 2.3 and newer * * Deprecated because the cart can now contain subscriptions on multiple billing schedules so there is no one "total" * * @return double * @since 1.0.0 - Migrated from WooCommerce Subscriptions v2.0 */ public static function get_recurring_discount_cart_tax() { } /** * Returns the proportion of total discount that is recurring for the product specified with $product_id * * Deprecated because the cart can now contain subscriptions on multiple billing schedules so there is no one "total" * * @return double The total recurring discount amount for items in the cart. * @since 1.0.0 - Migrated from WooCommerce Subscriptions v1.2 */ public static function get_recurring_discount_total() { } /** * Returns the amount of shipping tax that is recurring. As shipping only applies * to recurring payments, and only 1 subscription can be purchased at a time, * this is equal to @see WC_Cart::$shipping_tax_total * * Deprecated because the cart can now contain subscriptions on multiple billing schedules so there is no one "total" * * @return double The total recurring shipping tax amount for items in the cart. * @since 1.0.0 - Migrated from WooCommerce Subscriptions v1.2 */ public static function get_recurring_shipping_tax_total() { } /** * Returns the recurring shipping price . As shipping only applies to recurring * payments, and only 1 subscription can be purchased at a time, this is * equal to @see WC_Cart::shipping_total * * Deprecated because the cart can now contain subscriptions on multiple billing schedules so there is no one "total" * * @return double The total recurring shipping amount for items in the cart. * @since 1.0.0 - Migrated from WooCommerce Subscriptions v1.2 */ public static function get_recurring_shipping_total() { } /** * Returns an array of taxes on an order with their recurring totals. * * Deprecated because the cart can now contain subscriptions on multiple billing schedules so there is no one "total" * * @return array Array of tax_id => tax_amounts for items in the cart * @since 1.0.0 - Migrated from WooCommerce Subscriptions v1.2 */ public static function get_recurring_taxes() { } /** * Returns an array of recurring fees. * * Deprecated because the cart can now contain subscriptions on multiple billing schedules so there is no one "total" * * @return array Array of fee_id => fee_details for items in the cart * @since 1.0.0 - Migrated from WooCommerce Subscriptions v1.4.9 */ public static function get_recurring_fees() { } /** * Get tax row amounts with or without compound taxes includes * * Deprecated because the cart can now contain subscriptions on multiple billing schedules so there is no one "total" * * @return double The total recurring tax amount tax for items in the cart (maybe not including compound taxes) * @since 1.0.0 - Migrated from WooCommerce Subscriptions v1.2 */ public static function get_recurring_taxes_total($compound = \true) { } /** * Returns the proportion of total tax on an order that is recurring for the product specified with $product_id * * Deprecated because the cart can now contain subscriptions on multiple billing schedules so there is no one "total" * * @return double The total recurring tax amount tax for items in the cart. * @since 1.0.0 - Migrated from WooCommerce Subscriptions v1.2 */ public static function get_recurring_total_tax() { } /** * Returns the proportion of total before tax on an order that is recurring for the product specified with $product_id * * Deprecated because the cart can now contain subscriptions on multiple billing schedules so there is no one "total" * * @return double The total recurring amount less tax for items in the cart. * @since 1.0.0 - Migrated from WooCommerce Subscriptions v1.2 */ public static function get_recurring_total_ex_tax() { } /** * Returns the price per period for a subscription in an order. * * Deprecated because the cart can now contain subscriptions on multiple billing schedules so there is no one "total" * * @return double The total recurring amount for items in the cart. * @since 1.0.0 - Migrated from WooCommerce Subscriptions v1.2 */ public static function get_recurring_total() { } /** * Calculate the total amount of recurring shipping needed. Removes any item from the calculation that * is not a subscription and calculates the totals. * * @since 1.0.0 - Migrated from WooCommerce Subscriptions v1.5 * @deprecated 1.0.0 - Migrated from WooCommerce Subscriptions v2.0 */ public static function calculate_recurring_shipping() { } /** * Creates a string representation of the subscription period/term for each item in the cart * * @param string $initial_amount The initial amount to be displayed for the subscription as passed through the @see woocommerce_price() function. * @param float $recurring_amount The price to display in the subscription. * @param array $args (optional) Flags to customise to display the trial and length of the subscription. Default to false - don't display. * @since 1.0.0 - Migrated from WooCommerce Subscriptions v1.0 * @deprecated 1.0.0 - Migrated from WooCommerce Subscriptions v2.0 */ public static function get_cart_subscription_string($initial_amount, $recurring_amount, $args = array()) { } /** * Uses the a subscription's combined price total calculated by WooCommerce to determine the * total price that should be charged per period. * * @since 1.0.0 - Migrated from WooCommerce Subscriptions v1.2 * @deprecated 1.0.0 - Migrated from WooCommerce Subscriptions v2.0 */ public static function set_calculated_total($total) { } /** * Get the recurring amounts values from the session * * @since 1.0.0 - Migrated from WooCommerce Subscriptions v1.0 */ public static function get_cart_from_session() { } /** * Store the sign-up fee cart values in the session * * @since 1.0.0 - Migrated from WooCommerce Subscriptions v1.0 */ public static function set_session() { } /** * Reset the sign-up fee fields in the current session * * @since 1.0.0 - Migrated from WooCommerce Subscriptions v1.0 */ public static function reset() { } /** * Returns a cart item's product ID. For a variation, this will be a variation ID, for a simple product, * it will be the product's ID. * * @since 1.0.0 - Migrated from WooCommerce Subscriptions v1.5 */ public static function get_items_product_id($cart_item) { } /** * Store how much discount each coupon grants. * * @param mixed $code * @param mixed $amount * @return void */ public static function increase_coupon_discount_amount($code, $amount) { } /** * Don't display shipping prices if the initial order won't require shipping (i.e. all the products in the cart are subscriptions with a free trial or synchronised to a date in the future) * * @return string Label for a shipping method * @since 1.0.0 - Migrated from WooCommerce Subscriptions v1.3 */ public static function get_cart_shipping_method_full_label($label, $method) { } /** * One time shipping can null the need for shipping needs. WooCommerce treats that as no need to ship, therefore it will call * WC()->shipping->reset() on it, which will wipe the preferences saved. That can cause the chosen shipping method for the one * time shipping feature to be lost, and the first default to be applied instead. To counter that, we save the chosen shipping * method to a key that's not going to get wiped by WC's method, and then later restore it. */ public static function maybe_restore_chosen_shipping_method() { } /** * Return a localized free trial period string. * * @param int An interval in the range 1-6 * @param string One of day, week, month or year. */ public static function format_free_trial_period($number, $period) { } /** * Return a localized sync string, copied from WC_Subscriptions_Product::get_price_string * * @param WC_Product_Subscription $product The synced product. * @param string $period One of day, week, month or year. * @param int $interval An interval in the range 1-6 * @return string The new sync string. */ public static function format_sync_period($product, string $period, int $interval) { } /** * Adds meta data so it can be displayed in the Cart. */ public static function woocommerce_get_item_data($other_data, $cart_item) { } /** * Parse recurring shipping rates from the front end and put them into the $_POST['shipping_method'] used by WooCommerce. * * When WooCommerce takes the value of inputs for shipping methods selection from the cart and checkout pages, it uses a * JavaScript array and therefore, can only use numerical indexes. This works for WC core, because it only needs shipping * selection for different packages. However, we want to use string indexes to differentiate between different recurring * cart shipping selection inputs *and* packages. To do this, we need to get our shipping methods from the $_POST['post_data'] * values and manually add them $_POST['shipping_method'] array. * * We can't do this on the cart page unfortunately because it doesn't pass the entire forms post data and instead only * sends the shipping methods with a numerical index. * * @deprecated 1.0.0 - Migrated from WooCommerce Subscriptions v3.1.0 * @return null * @since 1.0.0 - Migrated from WooCommerce Subscriptions v2.0.12 */ public static function add_shipping_method_post_data() { } /** * When WooCommerce calculates rates for a recurring shipping package, we need to make sure there is a * different number of rates to make sure WooCommerce updates the chosen method for the recurring cart * and the 'woocommerce_shipping_chosen_method' filter is called, which we use to make sure the chosen * method is the recurring method, not the initial method. * * This function is hooked to 'woocommerce_shipping_packages' called by WC_Shipping->calculate_shipping() * which is why it accepts and returns the $packages array. It is also attached with a very high priority * to avoid conflicts with any 3rd party plugins that may use the method count session value (only a couple * of other hooks, including 'woocommerce_shipping_chosen_method' and 'woocommerce_shipping_method_chosen' * are triggered between when this callback runs on 'woocommerce_shipping_packages' and when the session * value is set again by WC_Shipping->calculate_shipping()). * * For more details, see: https://github.com/Prospress/woocommerce-subscriptions/pull/1187#issuecomment-186091152 * * @deprecated 1.0.0 - Migrated from WooCommerce Subscriptions v3.1.0 * * @param array $packages An array of shipping package of the form returned by WC_Cart->get_shipping_packages() which includes the package's contents, cost, customer, destination and alternative rates * @since 1.0.0 - Migrated from WooCommerce Subscriptions v2.0.19 */ public static function reset_shipping_method_counts($packages) { } /** * Checks to see if payment method is required on a subscription product with a $0 initial payment. * * @since 1.0.0 - Migrated from WooCommerce Subscriptions v2.5.0 * @deprecated 1.0.0 - Migrated from WooCommerce Subscriptions v4.0.0 */ public static function zero_initial_payment_requires_payment() { } } /** * Make it possible for customers to change the payment gateway used for an existing subscription. * * @package WooCommerce Subscriptions * @subpackage WC_Subscriptions_Change_Payment_Gateway * @category Class * @author Brent Shepherd * @since 1.0.0 - Migrated from WooCommerce Subscriptions v1.4 */ class WC_Subscriptions_Change_Payment_Gateway { public static $is_request_to_change_payment = \false; /** * An internal cache of WooCommerce customer notices. * * @var array */ private static $notices = array(); /** * Bootstraps the class and hooks required actions & filters. * * @since 1.0.0 - Migrated from WooCommerce Subscriptions v1.4 */ public static function init() { } /** * Set a flag to indicate that the current request is for changing payment. Better than requiring other extensions * to check the $_GET global as it allows for the flag to be overridden. * * @since 1.0.0 - Migrated from WooCommerce Subscriptions v1.4 */ public static function set_change_payment_method_flag() { } /** * Store any messages or errors added by other plugins. * * This is particularly important for those occasions when the new payment method caused and error or failure. * * @since 1.0.0 - Migrated from WooCommerce Subscriptions v2.3.6 */ public static function store_pay_shortcode_messages() { } /** * Store messages ore errors added by other plugins. * * @since 1.0.0 - Migrated from WooCommerce Subscriptions v1.4 * @deprecated 1.0.0 - Migrated from WooCommerce Subscriptions v2.3.6, Deprecated in favor of the method with proper spelling. */ public static function store_pay_shortcode_mesages() { } /** * If requesting a payment method change, replace the woocommerce_pay_shortcode() with a change payment form. * * @since 1.0.0 - Migrated from WooCommerce Subscriptions v1.4 */ public static function maybe_replace_pay_shortcode() { } /** * Validates the request to change a subscription's payment method. * * Will display a customer facing notice if the request is invalid. * * @since 1.0.0 - Migrated from WooCommerce Subscriptions v3.0.0 * * @param WC_Subscription $subscription * @return bool Whether the request is valid or not. */ private static function validate_change_payment_request($subscription) { } /** * Add a "Change Payment Method" button to the "My Subscriptions" table. * * @param array $all_actions The $subscription_key => $actions array with all actions that will be displayed for a subscription on the "My Subscriptions" table * @param array $subscriptions All of a given users subscriptions that will be displayed on the "My Subscriptions" table * @since 1.0.0 - Migrated from WooCommerce Subscriptions v1.4 */ public static function change_payment_method_button($actions, $subscription) { } /** * Process the change payment form. * * Based on the @see woocommerce_pay_action() function. * * @access public * @return void * @since 1.0.0 - Migrated from WooCommerce Subscriptions v1.4 */ public static function change_payment_method_via_pay_shortcode() { } /** * Update the recurring payment method on all current subscriptions to the payment method on this subscription. * * @param WC_Subscription $subscription An instance of a WC_Subscription object. * @param string $new_payment_method The ID of the new payment method. * @return bool Were other subscriptions updated. * @since 1.0.0 - Migrated from WooCommerce Subscriptions v2.5.0 */ public static function update_all_payment_methods_from_subscription($subscription, $new_payment_method) { } /** * Check whether a payment method supports updating all current subscriptions' payment method. * * @param WC_Payment_Gateway $gateway The payment gateway to check. * @param WC_Subscription $subscription An instance of a WC_Subscription object. * @return bool Gateway supports updating all current subscriptions. * @since 1.0.0 - Migrated from WooCommerce Subscriptions v2.5.0 */ public static function can_update_all_subscription_payment_methods($gateway, $subscription) { } /** * Check whether a subscription will update all current subscriptions' payment method. * * @param WC_Subscription $subscription An instance of a WC_Subscription object. * @return bool Subscription will update all current subscriptions. * @since 1.0.0 - Migrated from WooCommerce Subscriptions v2.5.0 */ public static function will_subscription_update_all_payment_methods($subscription) { } /** * Update the recurring payment method on a subscription order. * * @param WC_Subscription $subscription An instance of a WC_Subscription object. * @param string $new_payment_method The ID of the new payment method. * @param array $new_payment_method_meta The meta for the new payment method. Optional. Default false. * @since 1.0.0 - Migrated from WooCommerce Subscriptions v1.4 */ public static function update_payment_method($subscription, $new_payment_method, $new_payment_method_meta = \false) { } /** * Only display gateways which support changing payment method when paying for a failed renewal order or * when requesting to change the payment method. * * @param array $available_gateways The payment gateways which are currently being allowed. * @since 1.0.0 - Migrated from WooCommerce Subscriptions v1.4 */ public static function get_available_payment_gateways($available_gateways) { } /** * Make sure certain totals are set to 0 when the request is to change the payment method without charging anything. * * @since 1.0.0 - Migrated from WooCommerce Subscriptions v1.4 */ public static function maybe_zero_total($total, $subscription) { } /** * Redirect back to the "My Account" page instead of the "Thank You" page after changing the payment method. * * @since 1.0.0 - Migrated from WooCommerce Subscriptions v1.4 */ public static function get_return_url($return_url) { } /** * Update the recurring payment method for a subscription after a customer has paid for a failed renewal order * (which usually failed because of an issue with the existing payment, like an expired card or token). * * Also trigger a hook for payment gateways to update any meta on the original order for a subscription. * * @param WC_Order $renewal_order The order which recorded the successful payment (to make up for the failed automatic payment). * @param WC_Order $original_order The original order in which the subscription was purchased. * @since 1.0.0 - Migrated from WooCommerce Subscriptions v1.4 */ public static function change_failing_payment_method($renewal_order, $subscription) { } /** * Add a 'new-payment-method' handler to the @see WC_Subscription::can_be_updated_to() function * to determine whether the recurring payment method on a subscription can be changed. * * For the recurring payment method to be changeable, the subscription must be active, have future (automatic) payments * and use a payment gateway which allows the subscription to be cancelled. * * @param bool $subscription_can_be_changed Flag of whether the subscription can be changed. * @param WC_Subscription $subscription The subscription to check. * @return bool Flag indicating whether the subscription payment method can be updated. * @since 1.0.0 - Migrated from WooCommerce Subscriptions v1.4 */ public static function can_subscription_be_updated_to_new_payment_method($subscription_can_be_changed, $subscription) { } /** * Replace a page title with the endpoint title * * @param string $title * @return string * @since 1.0.0 - Migrated from WooCommerce Subscriptions v2.0 */ public static function change_payment_method_page_title($title) { } /** * Replace the breadcrumbs structure to add a link to the subscription page and change the current page to "Change Payment Method" * * @param array $crumbs * @return array * @since 1.0.0 - Migrated from WooCommerce Subscriptions v2.4.2 */ public static function change_payment_method_breadcrumb($crumbs) { } /** * Get the Change Payment Method page title (also used for the page breadcrumb) * * @since 1.0.0 - Migrated from WooCommerce Subscriptions v4.0.0 * @param WC_Subscription $subscription * @return string */ public static function get_change_payment_method_page_title($subscription) { } /** * When processing a change_payment_method request on a subscription that has a failed or pending renewal, * we don't want the `$order->needs_payment()` check inside WC_Shortcode_Checkout::order_pay() to pass. * This is causing `$gateway->payment_fields()` to be called multiple times. * * @param bool $needs_payment * @param WC_Subscription $subscription * @return bool * @since 1.0.0 - Migrated from WooCommerce Subscriptions v2.0.7 */ public static function maybe_override_needs_payment($needs_payment) { } /** * Display a login form on the change payment method page if the customer isn't logged in. * * @param string $content The default HTML page content. * @return string $content. * @since 1.0.0 - Migrated from WooCommerce Subscriptions v2.5.0 */ public static function maybe_request_log_in($content) { } /** Deprecated Functions **/ /** * Update the recurring payment method on a subscription order. * * @param array $available_gateways The payment gateways which are currently being allowed. * @since 1.0.0 - Migrated from WooCommerce Subscriptions v1.4 * @deprecated 1.0.0 - Migrated from WooCommerce Subscriptions v2.0 */ public static function update_recurring_payment_method($subscription_key, $order, $new_payment_method) { } /** * Keep a record of an order's dates if we're marking it as completed during a request to change the payment method. * * Deprecated as we now operate on a WC_Subscription object instead of the parent order, so we don't need to hack around date changes. * * @since 1.0.0 - Migrated from WooCommerce Subscriptions v1.4 * @deprecated 1.0.0 - Migrated from WooCommerce Subscriptions v2.0 */ public static function store_original_order_dates($new_order_status, $subscription_id) { } /** * Restore an order's dates if we marked it as completed during a request to change the payment method. * * Deprecated as we now operate on a WC_Subscription object instead of the parent order, so we don't need to hack around date changes. * * @since 1.0.0 - Migrated from WooCommerce Subscriptions v1.4 * @deprecated 1.0.0 - Migrated from WooCommerce Subscriptions v2.0 */ public static function restore_original_order_dates($order_id) { } /** * Add a 'new-payment-method' handler to the @see WC_Subscription::can_be_updated_to() function * to determine whether the recurring payment method on a subscription can be changed. * * For the recurring payment method to be changeable, the subscription must be active, have future (automatic) payments * and use a payment gateway which allows the subscription to be cancelled. * * @param bool $subscription_can_be_changed Flag of whether the subscription can be changed to * @param string $new_status_or_meta The status or meta data you want to change th subscription to. Can be 'active', 'on-hold', 'cancelled', 'expired', 'trash', 'deleted', 'failed', 'new-payment-date' or some other value attached to the 'woocommerce_can_subscription_be_changed_to' filter. * @param object $args Set of values used in @see WC_Subscriptions_Manager::can_subscription_be_changed_to() for determining if a subscription can be changes, include: * 'subscription_key' string A subscription key of the form created by @see WC_Subscriptions_Manager::get_subscription_key() * 'subscription' array Subscription of the form returned by @see WC_Subscriptions_Manager::get_subscription() * 'user_id' int The ID of the subscriber. * 'order' WC_Order The order which recorded the successful payment (to make up for the failed automatic payment). * 'payment_gateway' WC_Payment_Gateway The subscription's recurring payment gateway * 'order_uses_manual_payments' bool A boolean flag indicating whether the subscription requires manual renewal payment. * @since 1.0.0 - Migrated from WooCommerce Subscriptions v1.4 */ public static function can_subscription_be_changed_to($subscription_can_be_changed, $new_status_or_meta, $args) { } /** * Attach WooCommerce version dependent hooks * * @since 1.0.0 * * @deprecated 1.6.4 */ public static function attach_dependant_hooks() { } } /** * Subscriptions Checkout * * Extends the WooCommerce checkout class to add subscription meta on checkout. * * @package WooCommerce Subscriptions * @subpackage WC_Subscriptions_Checkout * @category Class * @author Brent Shepherd */ class WC_Subscriptions_Checkout { private static $guest_checkout_option_changed = \false; /** * Bootstraps the class and hooks required actions & filters. * * @since 1.0.0 - Migrated from WooCommerce Subscriptions v1.0 */ public static function init() { } /** * @since 1.0.0 - Migrated from WooCommerce Subscriptions v2.2.17 */ public static function attach_dependant_hooks() { } /** * Create subscriptions purchased on checkout. * * @param int $order_id The post_id of a shop_order post/WC_Order object * @param array $posted_data The data posted on checkout * @since 1.0.0 - Migrated from WooCommerce Subscriptions v2.0 */ public static function process_checkout($order_id, $posted_data = array()) { } /** * Create a new subscription from a cart item on checkout. * * The function doesn't validate whether the cart item is a subscription product, meaning it can be used for any cart item, * but the item will need a `subscription_period` and `subscription_period_interval` value set on it, at a minimum. * * @param WC_Order $order * @param WC_Cart $cart * @since 1.0.0 - Migrated from WooCommerce Subscriptions v2.0 */ public static function create_subscription($order, $cart, $posted_data) { } /** * Stores shipping info on the subscription * * @param WC_Subscription $subscription instance of a subscriptions object * @param WC_Cart $cart A cart with recurring items in it */ public static function add_shipping($subscription, $cart) { } /** * Remove the Backordered meta data from subscription line items added on the checkout. * * @param WC_Order_Item_Product $order_item * @param string $cart_item_key The hash used to identify the item in the cart * @param array $cart_item The cart item's data. * @param WC_Order|WC_Subscription $subscription The order or subscription object to which the line item relates * @since 1.0.0 - Migrated from WooCommerce Subscriptions v2.2.0 */ public static function remove_backorder_meta_from_subscription_line_item($item, $cart_item_key, $cart_item, $subscription) { } /** * Set a flag in subscription line item meta if the line item has a free trial. * * @param WC_Order_Item_Product $item The item being added to the subscription. * @param string $cart_item_key The item's cart item key. * @param array $cart_item The cart item. * @param WC_Subscription $subscription The subscription the item is being added to. * @since 1.0.0 - Migrated from WooCommerce Subscriptions v2.6.0 */ public static function maybe_add_free_trial_item_meta($item, $cart_item_key, $cart_item, $subscription) { } /** * Add a cart item to a subscription. * * @since 1.0.0 - Migrated from WooCommerce Subscriptions v2.0 */ public static function add_cart_item($subscription, $cart_item, $cart_item_key) { } /** * When a new order is inserted, add subscriptions related order meta. * * @since 1.0.0 - Migrated from WooCommerce Subscriptions v1.0 */ public static function add_order_meta($order_id, $posted) { } /** * Add each subscription product's details to an order so that the state of the subscription persists even when a product is changed * * @since 1.0.0 - Migrated from WooCommerce Subscriptions v1.2.5 */ public static function add_order_item_meta($item_id, $values) { } /** * Also make sure the guest checkout option value passed to the woocommerce.js forces registration. * Otherwise the registration form is hidden by woocommerce.js. * * @param string $handle Default empty string (''). * @param array $woocommerce_params * * @since 1.0.0 - Migrated from WooCommerce Subscriptions v2.5.3 * @return array */ public static function filter_woocommerce_script_parameters($woocommerce_params, $handle = '') { } /** * Stores the subtracted base location tax totals in the subscription line item meta. * * @since 1.0.0 - Migrated from WooCommerce Subscriptions v3.0.10 * * @param WC_Line_Item_Product $line_item The line item added to the order/subscription. * @param string $cart_item_key The key of the cart item being added to the cart. * @param array $cart_item The cart item data. */ public static function store_line_item_base_location_taxes($line_item, $cart_item_key, $cart_item) { } /** * Also make sure the guest checkout option value passed to the woocommerce.js forces registration. * Otherwise the registration form is hidden by woocommerce.js. * * @since 1.0.0 - Migrated from WooCommerce Subscriptions v1.1 * @deprecated 1.0.0 - Migrated from WooCommerce Subscriptions v2.5.3 */ public static function filter_woocommerce_script_paramaters($woocommerce_params, $handle = '') { } /** * Enables the 'registration required' (guest checkout) setting when purchasing subscriptions. * * @since 1.0.0 - Migrated from WooCommerce Subscriptions v3.1.0 * * @param bool $account_required Whether an account is required to checkout. * @return bool */ public static function require_registration_during_checkout($account_required) { } /** * During the checkout process, force registration when the cart contains a subscription. * * @since 1.0.0 - Migrated from WooCommerce Subscriptions v1.1 * @param $woocommerce_params This parameter is not used. */ public static function force_registration_during_checkout($woocommerce_params) { } /** * Generates a registration failed error message depending on the store's registration settings. * * When a customer wasn't created on checkout because checkout registration is disabled, * this function generates the error message displayed to the customer. * * The message will redirect the customer to the My Account page if registration is enabled there, otherwise a generic 'you need an account' message will be displayed. * * @since 1.0.0 - Migrated from WooCommerce Subscriptions v3.0.11 * @return string The error message. */ private static function get_registration_error_message() { } /** * Enables registration for carts containing subscriptions if admin allow it. * * @since 1.0.0 - Migrated from WooCommerce Subscriptions v3.1.0 * * @param bool $registration_enabled Whether registration is enabled on checkout by default. * @return bool */ public static function maybe_enable_registration($registration_enabled) { } /** * When creating an order at checkout, if the checkout is to renew a subscription from a failed * payment, hijack the order creation to make a renewal order - not a plain WooCommerce order. * * @since 1.0.0 - Migrated from WooCommerce Subscriptions v1.3 * @deprecated 1.0.0 - Migrated from WooCommerce Subscriptions v2.0 */ public static function filter_woocommerce_create_order($order_id, $checkout_object) { } /** * Customise which actions are shown against a subscriptions order on the My Account page. * * @since 1.0.0 - Migrated from WooCommerce Subscriptions v1.3 */ public static function filter_woocommerce_my_account_my_orders_actions($actions, $order) { } /** * If shopping cart contains subscriptions, make sure a user can register on the checkout page * * @since 1.0.0 - Migrated from WooCommerce Subscriptions v1.0 * @deprecated 1.0.0 - Migrated from WooCommerce Subscriptions v3.1.0 */ public static function make_checkout_registration_possible($checkout = '') { } /** * Make sure account fields display the required "*" when they are required. * * @since 1.0.0 - Migrated from WooCommerce Subscriptions v1.3.5 * @deprecated 1.0.0 - Migrated from WooCommerce Subscriptions v3.1.0 */ public static function make_checkout_account_fields_required($checkout_fields) { } /** * After displaying the checkout form, restore the store's original registration settings. * * @since 1.0.0 - Migrated from WooCommerce Subscriptions v1.1 * @deprecated 1.0.0 - Migrated from WooCommerce Subscriptions v3.1.0 */ public static function restore_checkout_registration_settings($checkout = '') { } /** * Overrides the "Place order" button text with "Sign up now" when the cart contains initial subscription purchases. * * @since 1.0.0 - Migrated from WooCommerce Subscriptions v4.0.0 * * @param string $button_text The place order button text. * @return string $button_text */ public static function order_button_text($button_text) { } /** * If the cart contains a renewal order, resubscribe order or a subscription switch * that needs to ship to an address that is different to the order's billing address, * tell the checkout to check the "Ship to different address" checkbox. * * @since 5.3.0 * * @param bool $ship_to_different_address Whether the order will check the "Ship to different address" checkbox * @return bool $ship_to_different_address */ public static function maybe_check_ship_to_different_address($ship_to_different_address) { } } /** * Subscriptions Coupon Class * * Mirrors a few functions in the WC_Cart class to handle subscription-specific discounts * * @package WooCommerce Subscriptions * @subpackage WC_Subscriptions_Coupon * @category Class * @author Max Rice * @since 1.0.0 - Migrated from WooCommerce Subscriptions v1.2 */ class WC_Subscriptions_Coupon { /** * The meta key used for the number of renewals. * * @var string */ protected static $coupons_renewals = '_wcs_number_payments'; /** @var string error message for invalid subscription coupons */ public static $coupon_error; /** * Stores the coupons not applied to a given calculation (so they can be applied later) * * @since 1.0.0 - Migrated from WooCommerce Subscriptions v1.3.5 * @deprecated */ private static $removed_coupons = array(); /** * Subscription coupon types. * * @var array */ private static $recurring_coupons = array('recurring_fee' => 1, 'recurring_percent' => 1); /** * Subscription sign up fee coupon types. * * @var array */ private static $sign_up_fee_coupons = array('sign_up_fee_percent' => 1, 'sign_up_fee' => 1); /** * Virtual renewal coupon types. * * @var array */ private static $renewal_coupons = array('renewal_cart' => 1, 'renewal_fee' => 1, 'renewal_percent' => 1); /** * Set up the class, including it's hooks & filters, when the file is loaded. * * @since 1.0.0 - Migrated from WooCommerce Subscriptions v1.2 **/ public static function init() { } /** * When all items in the cart have free trial, a recurring coupon should not be applied to the main cart. * Mark such recurring coupons with a dummy span with class wcs-hidden-coupon so that it can be hidden. * * @param string $coupon_html Html string of the recurring coupon's cell in the Cart totals table * @param WC_coupon $coupon WC_Coupon object of the recurring coupon * @return string $coupon_html Modified html string of the coupon containing the marking * @since 1.0.0 - Migrated from WooCommerce Subscriptions v2.3 */ public static function mark_recurring_coupon_in_initial_cart_for_hiding($coupon_html, $coupon) { } /** * Add discount types * * @since 1.0.0 - Migrated from WooCommerce Subscriptions v1.2 */ public static function add_discount_types($discount_types) { } /** * Get the discount amount for Subscriptions coupon types * * @since 1.0.0 - Migrated from WooCommerce Subscriptions v2.0.10 */ public static function get_discount_amount($discount, $discounting_amount, $item, $single, $coupon) { } /** * Get the discount amount which applies for a cart item for subscription coupon types * * @since 1.0.0 - Migrated from WooCommerce Subscriptions v2.2.13 * @param array $cart_item * @param float $discount the original discount amount * @param float $discounting_amount the cart item price/total which the coupon should apply to * @param boolean $single True if discounting a single qty item, false if it's the line * @param WC_Coupon $coupon * @return float the discount amount which applies to the cart item */ public static function get_discount_amount_for_cart_item($cart_item, $discount, $discounting_amount, $single, $coupon) { } /** * Get the discount amount which applies for a line item for subscription coupon types * * Uses methods and data structures introduced in WC 3.0. * * @since 1.0.0 - Migrated from WooCommerce Subscriptions v2.2.13 * @param WC_Order_Item $line_item * @param float $discount the original discount amount * @param float $discounting_amount the line item price/total * @param boolean $single True if discounting a single qty item, false if it's the line * @param WC_Coupon $coupon * @return float the discount amount which applies to the line item */ public static function get_discount_amount_for_line_item($line_item, $discount, $discounting_amount, $single, $coupon) { } /** * Determine if the cart contains a discount code of a given coupon type. * * Used internally for checking if a WooCommerce discount coupon ('core') has been applied, or for if a specific * subscription coupon type, like 'recurring_fee' or 'sign_up_fee', has been applied. * * @param string $coupon_type Any available coupon type or a special keyword referring to a class of coupons. Can be: * - 'any' to check for any type of discount * - 'core' for any core WooCommerce coupon * - 'recurring_fee' for the recurring amount subscription coupon * - 'sign_up_fee' for the sign-up fee subscription coupon * * @since 1.0.0 - Migrated from WooCommerce Subscriptions v1.3.5 */ public static function cart_contains_discount($coupon_type = 'any') { } /** * Check if a subscription coupon is valid before applying * * @param boolean $valid * @param WC_Coupon $coupon * @param WC_Discounts $discount Added in WC 3.2 the WC_Discounts object contains information about the coupon being applied to either carts or orders - Optional * @return boolean Whether the coupon is valid or not * @since 1.0.0 - Migrated from WooCommerce Subscriptions v1.2 */ public static function validate_subscription_coupon($valid, $coupon, $discount = \null) { } /** * Check if a subscription coupon is valid for the cart. * * @since 1.0.0 - Migrated from WooCommerce Subscriptions v2.2.13 * @param boolean $valid * @param WC_Coupon $coupon * @return bool whether the coupon is valid */ public static function validate_subscription_coupon_for_cart($valid, $coupon) { } /** * Check if a subscription coupon is valid for an order/subscription. * * @since 1.0.0 - Migrated from WooCommerce Subscriptions v2.2.13 * @param WC_Coupon $coupon The subscription coupon being validated. Can accept recurring_fee, recurring_percent, sign_up_fee or sign_up_fee_percent coupon types. * @param WC_Order|WC_Subscription $order The order or subscription object to which the coupon is being applied * @return bool whether the coupon is valid */ public static function validate_subscription_coupon_for_order($valid, $coupon, $order) { } /** * Returns a subscription coupon-specific error if validation failed * * @since 1.0.0 - Migrated from WooCommerce Subscriptions v1.2 */ public static function add_coupon_error($error) { } /** * Sets which coupons should be applied for this calculation. * * This function is hooked to "woocommerce_before_calculate_totals" so that WC will calculate a subscription * product's total based on the total of it's price per period and sign up fee (if any). * * @since 1.0.0 - Migrated from WooCommerce Subscriptions v1.3.5 * * @param WC_Cart $cart */ public static function remove_coupons($cart) { } /** * Add our recurring product coupon types to the list of coupon types that apply to individual products. * Used to control which validation rules will apply. * * @param array $product_coupon_types * @return array $product_coupon_types */ public static function filter_product_coupon_types($product_coupon_types) { } /** * Get subtotals for a renewal subscription so that our pseudo renewal_cart discounts can be applied correctly even if other items have been added to the cart * * @param string $code coupon code * @return array subtotal * @since 1.0.0 - Migrated from WooCommerce Subscriptions v2.0.10 */ private static function get_renewal_subtotal($code) { } /** * Check if a product is a renewal order line item (rather than a "subscription") - to pick up non-subscription products added to a subscription manually * * @param int|WC_Product $product_id * @param array $cart_item * @return boolean whether a product is a renewal order line item * @since 1.0.0 - Migrated from WooCommerce Subscriptions v2.0.10 */ private static function is_subscription_renewal_line_item($product_id, $cart_item) { } /** * Add our pseudo renewal coupon types to the list of supported types. * * @param array $coupon_types * @return array supported coupon types * @since 1.0.0 - Migrated from WooCommerce Subscriptions v2.2 */ public static function add_pseudo_coupon_types($coupon_types) { } /** * Filter the default coupon cart label for renewal pseudo coupons * * @param string $label * @param WC_Coupon $coupon * @return string * @since 1.0.0 - Migrated from WooCommerce Subscriptions v2.2.8 */ public static function get_pseudo_coupon_label($label, $coupon) { } /** * Get a normal coupon from one of our virtual coupons. * * This is necessary when manually processing a renewal to ensure that we are correctly * identifying limited payment coupons. * * @author Jeremy Pry * * @param string $code The virtual coupon code. * * @return WC_Coupon The original coupon. */ public static function map_virtual_coupon($code) { } /** * Checks if a coupon is one of our virtual coupons applied to renewal carts. * * @since 1.0.0 - Migrated from WooCommerce Subscriptions v4.0.0 * * @param string $coupon_type The coupon's type. * @return bool Whether the coupon is a recurring cart virtual coupon. */ public static function is_renewal_cart_coupon($coupon_type) { } /** * Checks if a coupon is one of our recurring coupons. * * @since 1.0.0 - Migrated from WooCommerce Subscriptions v4.0.0 * * @param string $coupon_type The coupon's type. * @return bool Whether the coupon is a recurring cart virtual coupon. */ public static function is_recurring_coupon($coupon_type) { } /* Deprecated */ /** * Apply sign up fee or recurring fee discount * * @since 1.0.0 - Migrated from WooCommerce Subscriptions v1.2 */ public static function apply_subscription_discount($original_price, $cart_item, $cart) { } /** * Validates a subscription coupon's use for a given product. * * @since 1.0.0 - Migrated from WooCommerce Subscriptions v2.5.4 * * @param bool $is_valid Whether the coupon is valid for the product. * @param WC_Product $product The product object. * @param WC_Coupon $coupon The coupon object. * * @return bool Whether the coupon is valid for the product. */ public static function validate_subscription_coupon_for_product($is_valid, $product, $coupon) { } /** * Store how much discount each coupon grants. * * @since 1.0.0 - Migrated from WooCommerce Subscriptions v2.0 * @param WC_Cart $cart The WooCommerce cart object. * @param mixed $code * @param mixed $amount * @return WC_Cart $cart */ public static function increase_coupon_discount_amount($cart, $code, $amount) { } /** * Restores discount coupons which had been removed for special subscription calculations. * * @since 1.0.0 - Migrated from WooCommerce Subscriptions v1.3.5 */ public static function restore_coupons($cart) { } /** * Override the quantity to apply limited coupons to recurring cart items. * * Limited coupons can only apply to x number of items. By default that limit applies * to items in each cart instance. Because recurring carts are separate, the limit applies to * each recurring cart leading to the limit really being x * number-of-recurring-carts. * * This function overrides that by ensuring the limit is accounted for across all recurring carts. * The items which the coupon applied to in initial cart are the items in recurring carts that the coupon will apply to. * * @since 1.0.0 - Migrated from WooCommerce Subscriptions v3.0.0 * * @param int $apply_quantity The item quantity to apply the coupon to. * @param object $item The stdClass cart item object. @see WC_Discounts::set_items_from_cart() for an example of object properties. * @param WC_Coupon $coupon The coupon being applied * * @return int The item quantity to apply the coupon to. */ public static function override_applied_quantity_for_recurring_carts($apply_quantity, $item, $coupon) { } /** * Apply sign up fee or recurring fee discount before tax is calculated * * @since 1.0.0 - Migrated from WooCommerce Subscriptions v1.2 */ public static function apply_subscription_discount_before_tax($original_price, $cart_item, $cart) { } /** * Apply sign up fee or recurring fee discount after tax is calculated * * @since 1.0.0 - Migrated from WooCommerce Subscriptions v1.2 * @version 1.0.0 - Migrated from WooCommerce Subscriptions v1.3.6 */ public static function apply_subscription_discount_after_tax($coupon, $cart_item, $price) { } /** * Maybe add Recurring Coupon functionality. * * WC 3.2 added many API enhancements, especially around coupons. It would be very challenging to implement * this functionality in older versions of WC, so we require 3.2+ to enable this. * * @author Jeremy Pry * @deprecated 1.0.0 - Migrated from WooCommerce Subscriptions v4.0.0 */ public static function maybe_add_recurring_coupon_hooks() { } /** * Add custom fields to the coupon data form. * * @see WC_Meta_Box_Coupon_Data::output() * @author Jeremy Pry * * @param int $id The coupon ID. * @deprecated 1.0.0 - Migrated from WooCommerce Subscriptions v4.0.0 */ public static function add_coupon_fields($id) { } /** * Save our custom coupon fields. * * @see WC_Meta_Box_Coupon_Data::save() * @author Jeremy Pry * * @param int $post_id * @deprecated 1.0.0 - Migrated from WooCommerce Subscriptions v4.0.0 */ public static function save_coupon_fields($post_id) { } /** * Determine how many subscriptions the coupon has been applied to. * * @author Jeremy Pry * * @param WC_Subscription $subscription The current subscription. * @deprecated 1.0.0 - Migrated from WooCommerce Subscriptions v4.0.0 */ public static function check_coupon_usages($subscription) { } /** * Add our limited coupon data to the Coupon list table. * * @author Jeremy Pry * * @param string $column_name The name of the current column in the table. * @param int $post_id The coupon post ID. * @deprecated 1.0.0 - Migrated from WooCommerce Subscriptions v4.0.0 */ public static function add_limit_to_list_table($column_name, $post_id) { } /** * Filter the available gateways when there is a recurring coupon. * * @author Jeremy Pry * * @param WC_Payment_Gateway[] $gateways The available payment gateways. * * @return array The filtered payment gateways. * @deprecated 1.0.0 - Migrated from WooCommerce Subscriptions v4.0.0 */ public static function gateways_subscription_amount_changes($gateways) { } /** * Filter the message for when no payment gateways are available. * * @author Jeremy Pry * * @param string $message The current message indicating there are no payment methods available.. * * @return string The filtered message indicating there are no payment methods available. * @deprecated 1.0.0 - Migrated from WooCommerce Subscriptions v4.0.0 */ public static function no_available_payment_methods_message($message) { } /** * Determine if a given coupon is limited to a certain number of renewals. * * @author Jeremy Pry * * @param string $code The coupon code. * * @return bool * @deprecated 1.0.0 - Migrated from WooCommerce Subscriptions v4.0.0 */ public static function coupon_is_limited($code) { } /** * Determine whether the cart contains a recurring coupon with set number of renewals. * * @author Jeremy Pry * @return bool * @deprecated 1.0.0 - Migrated from WooCommerce Subscriptions v4.0.0 */ public static function cart_contains_limited_recurring_coupon() { } /** * Determine if a given order has a limited use coupon. * * @author Jeremy Pry * * @param WC_Order|WC_Subscription $order * * @return bool * @deprecated 1.0.0 - Migrated from WooCommerce Subscriptions v4.0.0 */ public static function order_has_limited_recurring_coupon($order) { } /** * Get the number of renewals for a limited coupon. * * @author Jeremy Pry * * @param string $code The coupon code. * * @return false|int False for non-recurring coupons, or the limit number for recurring coupons. * A value of 0 is for unlimited usage. * @deprecated 1.0.0 - Migrated from WooCommerce Subscriptions v4.0.0 */ public static function get_coupon_limit($code) { } /** * Determine if a given recurring cart contains a limited use coupon which when applied to a subscription will reach its usage limit within the subscription's length. * * @param WC_Cart $recurring_cart The recurring cart object. * @return bool * @deprecated 1.0.0 - Migrated from WooCommerce Subscriptions v4.0.0 */ public static function recurring_cart_contains_expiring_coupon($recurring_cart) { } } class WC_Subscriptions_Data_Copier { /** * The default copy type. */ const DEFAULT_COPY_TYPE = 'subscription'; /** * The default data keys that are excluded from the copy. * * @var string[] */ const DEFAULT_EXCLUDED_META_KEYS = ['_paid_date', '_date_paid', '_completed_date', '_date_completed', '_edit_last', '_subscription_switch_data', '_order_key', '_edit_lock', '_wc_points_earned', '_transaction_id', '_billing_interval', '_billing_period', '_subscription_resubscribe', '_subscription_renewal', '_subscription_switch', '_payment_method', '_payment_method_title', '_suspension_count', '_requires_manual_renewal', '_cancelled_email_sent', '_trial_period', '_created_via', '_order_stock_reduced']; /** * The subscription or order being copied. * * @var WC_Order */ private $from_object = \null; /** * The subscription or order being copied to. * * @var WC_Order */ private $to_object = \null; /** * The type of copy. Can be 'subscription' or 'renewal'. * * Used in dynamic filters to allow third parties to target specific meta keys in different copying contexts. * * @var string */ private $copy_type = ''; /** * Copies data from one object to another. * * This function acts as a publicly accessible wrapper for obtaining an instance of the copier and completing the copy. * * @param WC_Order $from_object The object to copy data from. * @param WC_Order $to_object The object to copy data to. * @param string $copy_type Optional. The type of copy. Can be 'subscription', 'parent', 'renewal_order' or 'resubscribe_order'. Default is 'subscription'. */ public static function copy($from_object, $to_object, $copy_type = self::DEFAULT_COPY_TYPE) { } /** * Constructor. * * @param WC_Order $from_object The object to copy data from. * @param WC_Order $to_object The object to copy data to. * @param string $copy_type Optional. The type of copy. Can be 'subscription', 'parent', 'renewal_order' or 'resubscribe_order'. Default is 'subscription'. */ public function __construct($from_object, $to_object, $copy_type = self::DEFAULT_COPY_TYPE) { } /** * Copies the data from the "from" object to the "to" object. */ public function copy_data() { } /** * Sets a piece of data on the "to" object. * * This function uses a setter where appropriate, otherwise it sets the data directly. * Values which are stored as a bool in memory are converted before being set. eg 'no' -> false, 'yes' -> true. * * @param string $key The data key to set. * @param mixed $value The value to set. */ private function set_data($key, $value) { } /** * Determines if there are callbacks attached to the deprecated "wcs_{$this->copy_type}_meta_query" filter. * * @return bool True if there are callbacks attached to the deprecated "wcs_{$this->copy_type}_meta_query" filter. False otherwise. */ private function has_filter_on_meta_query_hook() { } /** * Gets the "from" object's meta data. * * @return string[] The meta data. */ private function get_meta_data() { } /** * Gets the "from" object's operational data that was previously stored in wp post meta. * * @return string[] The operational data with the legacy meta key. */ private function get_operational_data() { } /** * Gets the "from" object's core data that was previously stored in wp post meta. * * @return string[] The core data with the legacy meta keys. */ private function get_order_data() { } /** * Gets the "from" object's address data that was previously stored in wp post meta. * * @return string[] The address data with the legacy meta keys. */ private function get_address_data() { } /** * Removes the meta keys excluded via the deprecated from the set of data to be copied. * * @param array $data The data to be copied. * @return array The data to be copied with the excluded keys removed. */ public function filter_excluded_meta_keys_via_query($data) { } /** * Returns the deprecated meta database query that returns the "from" objects meta data. * * Triggers a deprecation notice if the deprecated "wcs_{$this->copy_type}_meta_query" filter is in use by at least 1 third-party. * * @return string SQL SELECT query. */ private function get_deprecated_meta_query() { } /** * Applies the deprecated "wcs_{$this->copy_type}_meta filter. * * Triggers a deprecation notice if the deprecated "wcs_{$this->copy_type}_meta" filter is in use by at least 1 third-party. * * @param array $data The data to copy. * @return array The filtered set of data to copy. */ private function apply_deprecated_filter($data) { } /** * Gets a list of meta keys to exclude from the copy. * * If third-parties are hooked onto the "wcs_{$this->copy_type}_meta_query" filter, this function will attempt * to pluck the excluded meta keys from the filtered SQL query. There is no guarantee that this will work for all * queries, however it should work under most standard circumstances. * * If no third-parties are hooked onto the "wcs_{$this->copy_type}_meta_query" filter, this function will simply return * the default list of excluded meta keys. * * @return string[][] An array of excluded meta keys. The array has two keys: 'in' and 'regex'. The 'in' key contains an array of meta keys to exclude. The 'regex' key contains an array of regular expressions to exclude. */ private function get_excluded_data_keys() { } /** * Gets a list of meta keys from a SQL IN clause. * * @param string $in_clause The concatenated string of meta keys from the IN clause. eg: '_paid_date', '_date_paid', '_completed_date' ... * @return string[] The meta keys from the IN clause. eg: [ '_paid_date', '_date_paid', '_completed_date' ] */ private function get_keys_from_in_clause($in_clause) { } /** * Formats a LIKE clause into a regex pattern. * * @param string $like_clause A SQL LIKE clause. eg: '_schedule_%%' * @return string A regex pattern. eg: '/^_schedule_.*$/' */ private function get_keys_from_like_clause($like_clause) { } } /** * Subscriptions Email Class * * Modifies the base WooCommerce email class and extends it to send subscription emails. * * @package WooCommerce Subscriptions * @subpackage WC_Subscriptions_Email * @category Class * @author Prospress */ class WC_Subscriptions_Email { /** * Bootstraps the class and hooks required actions & filters. * * @since 1.0.0 - Migrated from WooCommerce Subscriptions v1.0 */ public static function init() { } /** * Add Subscriptions' email classes. * * @since 1.0.0 - Migrated from WooCommerce Subscriptions v1.4 */ public static function add_emails($email_classes) { } /** * Hooks up all of Subscription's transaction emails after the WooCommerce object is constructed. * * @since 1.0.0 - Migrated from WooCommerce Subscriptions v1.4 */ public static function hook_transactional_emails() { } /** * Init the mailer and call for the cancelled email notification hook. * * @param $subscription WC Subscription * @since 1.0.0 - Migrated from WooCommerce Subscriptions v2.0 */ public static function send_cancelled_email($subscription) { } /** * Init the mailer and call for the expired email notification hook. * * @param $subscription WC Subscription * @since 1.0.0 - Migrated from WooCommerce Subscriptions v2.1 */ public static function send_expired_email($subscription) { } /** * Init the mailer and call for the suspended email notification hook. * * @param $subscription WC Subscription * @since 1.0.0 - Migrated from WooCommerce Subscriptions v2.1 */ public static function send_on_hold_email($subscription) { } /** * Init the mailer and call the notifications for the renewal orders. * * @param int $order_id The order ID. */ public static function send_renewal_order_email($order_id) { } /** * If the order is a renewal order or a switch order, don't send core emails. * * @param int $order_id The order ID. */ public static function maybe_remove_woocommerce_email($order_id) { } /** * If the order is a renewal order or a switch order, send core emails * * @param int $order_id The order ID. */ public static function maybe_reattach_woocommerce_email($order_id) { } /** * If viewing a renewal order on the the Edit Order screen, set the available email actions for the order to use * renewal order emails, not core WooCommerce order emails. * * @param array $available_emails The emails available to send from the edit order screen. */ public static function renewal_order_emails_available($available_emails) { } /** * Init the mailer and call the notifications for subscription switch orders. * * @param int $order_id The order ID. */ public static function send_switch_order_email($order_id) { } /** * Generate an order items table using a WC compatible version of the function. * * @param object $order * @param array $args { * @type bool 'show_download_links' * @type bool 'show_sku' * @type bool 'show_purchase_note' * @type array 'image_size' * @type bool 'plain_text' * } * @return string email order items table html */ public static function email_order_items_table($order, $args = array()) { } /** * Show the order details table * * @param WC_Order $order * @param bool $sent_to_admin Whether the email is sent to admin - defaults to false * @param bool $plain_text Whether the email should use plain text templates - defaults to false * @param WC_Email $email * @since 1.0.0 - Migrated from WooCommerce Subscriptions v2.1 */ public static function order_details($order, $sent_to_admin = \false, $plain_text = \false, $email = '') { } /** * Detach WC transactional emails from a specific hook. * * @param string Optional. The action hook or filter to detach WC core's transactional emails from. Defaults to the current filter. * @param int Optional. The priority the function runs on. Default 10. * @since 1.0.0 - Migrated from WooCommerce Subscriptions v2.2.3 */ public static function detach_woocommerce_transactional_email($hook = '', $priority = 10) { } /** * Attach WC transactional emails to a specific hook. * * @param string Optional. The action hook or filter to attach WC core's transactional emails to. Defaults to the current filter. * @param int Optional. The priority the function should run on. Default 10. * @param int Optional. The number of arguments the function accepts. Default 10. * @since 1.0.0 - Migrated from WooCommerce Subscriptions v2.2.3 */ public static function attach_woocommerce_transactional_email($hook = '', $priority = 10, $accepted_args = 10) { } /** * With WooCommerce 3.2+ active display the downloads table. * * @param WC_Order $order * @param bool $sent_to_admin Whether the email is sent to admin - defaults to false * @param bool $plain_text Whether the email should use plain text templates - defaults to false * @param WC_Email $email * @since 1.0.0 - Migrated from WooCommerce Subscriptions v2.2.17 */ public static function order_download_details($order, $sent_to_admin = \false, $plain_text = \false, $email = '') { } /** * Init the mailer and call the notifications for the current filter. * * @param int $user_id The ID of the user who the subscription belongs to * @param string $subscription_key A subscription key of the form created by @see self::get_subscription_key() * @return void * @deprecated 1.0.0 - Migrated from WooCommerce Subscriptions v2.0 */ public static function send_subscription_email($user_id, $subscription_key) { } } class WC_Subscriptions_Extend_Store_Endpoint { /** * Stores Rest Schema Controller. * * @var Automattic\WooCommerce\StoreApi\SchemaController */ private static $schema; /** * Stores Money formatter instance. * * @var Automattic\WooCommerce\StoreApi\Formatters\FormatterInterface */ private static $money_formatter; /** * Stores Currency formatter instance. * * @var Automattic\WooCommerce\StoreApi\Formatters\FormatterInterface */ private static $currency_formatter; /** * Plugin Identifier, unique to each plugin. * * @var string */ const IDENTIFIER = 'subscriptions'; /** * Bootstraps the class and hooks required data. * * @since 1.0.0 - Migrated from WooCommerce Subscriptions */ public static function init() { } /** * Register endpoint data with the API. * * @param array $args Endpoint data to register. */ protected static function register_endpoint_data($args) { } /** * Register payment requirements with the API. * * @param array $args Data to register. */ protected static function register_payment_requirements($args) { } /** * Registers the actual data into each endpoint. */ public static function extend_store() { } /** * Register subscription product data into cart/items endpoint. * * @param array $cart_item Current cart item data. * * @return array $item_data Registered data or empty array if condition is not satisfied. */ public static function extend_cart_item_data($cart_item) { } /** * Register subscription product schema into cart/items endpoint. * * @return array Registered schema. */ public static function extend_cart_item_schema() { } /** * Get packages from the recurring carts. * * @param string $cart_key Recurring cart key. * @param array $cart Recurring cart data. * @return array */ private static function get_packages_for_recurring_cart($cart_key, $cart) { } /** * Changes the shipping package name to add more meaningful information about it's content. * * @param array $package All shipping package data. * @param array $cart Recurring cart data. * @return string */ private static function get_shipping_package_name($package, $cart) { } /** * Register future subscriptions into cart endpoint. * * @return array $future_subscriptions Registered data or empty array if condition is not satisfied. */ public static function extend_cart_data() { } /** * Format sign-up fees. * * @param \WC_Product $product current product. * @return array */ private static function format_sign_up_fees($product) { } /** * Format sync data to the correct so it either returns a day integer or an object of day and month. * * @param WC_Product_Subscription $product current cart item product. * * @return object|int|null synchronization_date; */ private static function format_sync_data($product) { } /** * Register future subscriptions schema into cart endpoint. * * @return array Registered schema. */ public static function extend_cart_schema() { } /** * Get tax lines from the cart and format to match schema. * * TODO: This function is copied from WooCommerce Blocks, remove it once https://github.com/woocommerce/woocommerce-gutenberg-products-block/issues/3264 is closed. * * @param \WC_Cart $cart Cart class instance. * @return array */ protected static function get_tax_lines($cart) { } } class WC_Subscriptions_Frontend_Scripts { /** * Attach hooks and callbacks to enqueue frontend scripts and styles. */ public static function init() { } /** * Gets the plugin URL for an assets file. * * @since 1.0.0 - Migrated from WooCommerce Subscriptions v3.1.3 * @return string The file URL. */ public static function get_file_url($file_relative_url = '') { } /** * Enqueues scripts for frontend. * * @since 1.0.0 - Migrated from WooCommerce Subscriptions v3.1.3 */ public static function enqueue_scripts() { } /** * Enqueues stylesheets. * * @since 1.0.0 - Migrated from WooCommerce Subscriptions v3.1.3 */ public static function enqueue_styles($styles) { } } /** * Subscriptions Management Class * * An API of Subscription utility functions and Account Management functions. * * Subscription activation and cancellation functions are hooked directly to order status changes * so your payment gateway only needs to work with WooCommerce APIs. You can however call other * management functions directly when necessary. * * @package WooCommerce Subscriptions * @subpackage WC_Subscriptions_Manager * @category Class * @author Brent Shepherd * @since 1.0.0 - Migrated from WooCommerce Subscriptions v1.0 */ class WC_Subscriptions_Manager { /** * The database key for user's subscriptions. * * @since 1.0.0 - Migrated from WooCommerce Subscriptions v1.0 */ public static $users_meta_key = 'woocommerce_subscriptions'; /** * Set up the class, including it's hooks & filters, when the file is loaded. * * @since 1.0.0 - Migrated from WooCommerce Subscriptions v1.0 **/ public static function init() { } /** * Attaches hooks that depend on WooCommerce being loaded. * * We need to use different hooks on stores that have HPOS enabled but to check if this feature * is enabled, we must wait for WooCommerce to be loaded first. * * @since 5.2.0 */ public static function attach_wc_dependant_hooks() { } /** * Sets up renewal for subscriptions managed by Subscriptions. * * This function is hooked early on the scheduled subscription payment hook. * * @param int $subscription_id The ID of a 'shop_subscription' post * @since 1.0.0 - Migrated from WooCommerce Subscriptions v2.0 */ public static function prepare_renewal($subscription_id) { } /** * Process renewal for a subscription. * * @param int $subscription_id The ID of a 'shop_subscription' post * @param string $required_status The subscription status required to process a renewal order * @param string $order_note Reason for subscription status change * @since 1.0.0 - Migrated from WooCommerce Subscriptions v2.2.12 */ public static function process_renewal($subscription_id, $required_status, $order_note) { } /** * Expires a single subscription on a users account. * * @param int $subscription_id The ID of a 'shop_subscription' post * @since 1.0.0 - Migrated from WooCommerce Subscriptions v1.0 */ public static function expire_subscription($subscription_id, $deprecated = \null) { } /** * Fires when a cancelled subscription reaches the end of its prepaid term. * * @param int $subscription_id The ID of a 'shop_subscription' post * @since 1.0.0 - Migrated from WooCommerce Subscriptions v1.3 */ public static function subscription_end_of_prepaid_term($subscription_id, $deprecated = \null) { } /** * Trigger action hook after a subscription's trial period has ended. * * @since 5.5.0 * * @param int $subscription_id */ public static function trigger_subscription_trial_ended_hook($subscription_id) { } /** * Records a payment on a subscription. * * @param int $user_id The id of the user who owns the subscription. * @param string $subscription_key A subscription key of the form obtained by @see get_subscription_key( $order_id, $product_id ) * @since 1.0.0 - Migrated from WooCommerce Subscriptions v1.0 */ public static function process_subscription_payment($user_id, $subscription_key) { } /** * Processes a failed payment on a subscription by recording the failed payment and cancelling the subscription if it exceeds the * maximum number of failed payments allowed on the site. * * @param int $user_id The id of the user who owns the expiring subscription. * @param string $subscription_key A subscription key of the form obtained by @see get_subscription_key( $order_id, $product_id ) * @since 1.0.0 - Migrated from WooCommerce Subscriptions v1.0 */ public static function process_subscription_payment_failure($user_id, $subscription_key) { } /** * This function should be called whenever a subscription payment is made on an order. This includes * when the subscriber signs up and for a recurring payment. * * The function is a convenience wrapper for @see self::process_subscription_payment(), so if calling that * function directly, do not call this function also. * * @param WC_Order|int $order The order or ID of the order for which subscription payments should be marked against. * @since 1.0.0 - Migrated from WooCommerce Subscriptions v1.0 */ public static function process_subscription_payments_on_order($order, $product_id = '') { } /** * This function should be called whenever a subscription payment has failed on a parent order. * * The function is a convenience wrapper for @see self::process_subscription_payment_failure(), so if calling that * function directly, do not call this function also. * * @param int|WC_Order $order The order or ID of the order for which subscription payments should be marked against. * @since 1.0.0 - Migrated from WooCommerce Subscriptions v1.0 */ public static function process_subscription_payment_failure_on_order($order, $product_id = '') { } /** * Activates all the subscriptions created by a given order. * * @param WC_Order|int $order The order or ID of the order for which subscriptions should be marked as activated. * @since 1.0.0 - Migrated from WooCommerce Subscriptions v1.0 */ public static function activate_subscriptions_for_order($order) { } /** * Suspends all the subscriptions on an order by changing their status to "on-hold". * * @param WC_Order|int $order The order or ID of the order for which subscriptions should be marked as activated. * @since 1.0.0 - Migrated from WooCommerce Subscriptions v1.0 */ public static function put_subscription_on_hold_for_order($order) { } /** * Mark all subscriptions in an order as cancelled on the user's account. * * @param WC_Order|int $order The order or ID of the order for which subscriptions should be marked as cancelled. * @since 1.0.0 - Migrated from WooCommerce Subscriptions v1.0 */ public static function cancel_subscriptions_for_order($order) { } /** * Marks all the subscriptions in an order as expired * * @param WC_Order|int $order The order or ID of the order for which subscriptions should be marked as expired. * @since 1.0.0 - Migrated from WooCommerce Subscriptions v1.0 */ public static function expire_subscriptions_for_order($order) { } /** * Called when a sign up fails during the payment processing step. * * @param WC_Order|int $order The order or ID of the order for which subscriptions should be marked as failed. * @since 1.0.0 - Migrated from WooCommerce Subscriptions v1.0 */ public static function failed_subscription_sign_ups_for_order($order) { } /** * Uses the details of an order to create a pending subscription on the customers account * for a subscription product, as specified with $product_id. * * @param int|WC_Order $order The order ID or WC_Order object to create the subscription from. * @param int $product_id The ID of the subscription product on the order, if a variation, it must be the variation's ID. * @param array $args An array of name => value pairs to customise the details of the subscription, including: * 'start_date' A MySQL formatted date/time string on which the subscription should start, in UTC timezone * 'expiry_date' A MySQL formatted date/time string on which the subscription should expire, in UTC timezone * @since 1.0.0 - Migrated from WooCommerce Subscriptions v1.1 */ public static function create_pending_subscription_for_order($order, $product_id, $args = array()) { } /** * Excludes subscriptions from the order cleanup process. * * @param bool $should_cancel Whether the order should be cancelled. * @param WC_Order $order The order object. * * @return bool Whether the order should be cancelled. */ public static function exclude_subscription_from_order_cleanup($should_cancel, $order) { } /** * Creates subscriptions against a users account with a status of pending when a user creates * an order containing subscriptions. * * @param int|WC_Order $order The order ID or WC_Order object to create the subscription from. * @since 1.0.0 - Migrated from WooCommerce Subscriptions v1.0 */ public static function process_subscriptions_on_checkout($order) { } /** * Updates a user's subscriptions for each subscription product in the order. * * @param WC_Order $order The order to get subscriptions and user details from. * @param string $status (optional) A status to change the subscriptions in an order to. Default is 'active'. * @since 1.0.0 - Migrated from WooCommerce Subscriptions v1.0 */ public static function update_users_subscriptions_for_order($order, $status = 'pending') { } /** * Takes a user ID and array of subscription details and updates the users subscription details accordingly. * * @uses wp_parse_args To allow only part of a subscription's details to be updated, like status. * @param int $user_id The ID of the user for whom subscription details should be updated * @param array $subscriptions An array of arrays with a subscription key and corresponding 'detail' => 'value' pair. Can alter any of these details: * 'start_date' The date the subscription was activated * 'expiry_date' The date the subscription expires or expired, false if the subscription will never expire * 'failed_payments' The date the subscription's trial expires or expired, false if the subscription has no trial period * 'end_date' The date the subscription ended, false if the subscription has not yet ended * 'status' Subscription status can be: cancelled, active, expired or failed * 'completed_payments' An array of MySQL formatted dates for all payments that have been made on the subscription * 'failed_payments' An integer representing a count of failed payments * 'suspension_count' An integer representing a count of the number of times the subscription has been suspended for this billing period * @since 1.0.0 - Migrated from WooCommerce Subscriptions v1.0 */ public static function update_users_subscriptions($user_id, $subscriptions) { } /** * Takes a subscription key and array of subscription details and updates the users subscription details accordingly. * * @uses wp_parse_args To allow only part of a subscription's details to be updated, like status. * @param string $subscription_key A subscription key of the form created by @see self::get_subscription_key() * @param array $new_subscription_details An array of arrays with a subscription key and corresponding 'detail' => 'value' pair. Can alter any of these details: * 'start_date' The date the subscription was activated * 'expiry_date' The date the subscription expires or expired, false if the subscription will never expire * 'failed_payments' The date the subscription's trial expires or expired, false if the subscription has no trial period * 'end_date' The date the subscription ended, false if the subscription has not yet ended * 'status' Subscription status can be: cancelled, active, expired or failed * 'completed_payments' An array of MySQL formatted dates for all payments that have been made on the subscription * 'failed_payments' An integer representing a count of failed payments * 'suspension_count' An integer representing a count of the number of times the subscription has been suspended for this billing period * @since 1.0.0 - Migrated from WooCommerce Subscriptions v1.4 */ public static function update_subscription($subscription_key, $new_subscription_details) { } /** * Takes a user ID and cancels any subscriptions that user has. * * @uses wp_parse_args To allow only part of a subscription's details to be updated, like status. * @param int $user_id The ID of the user for whom subscription details should be updated * @since 1.0.0 - Migrated from WooCommerce Subscriptions v1.3.8 */ public static function cancel_users_subscriptions($user_id) { } /** * Takes a user ID and cancels any subscriptions that user has on any site in a WordPress network * * @uses wp_parse_args To allow only part of a subscription's details to be updated, like status. * @param int $user_id The ID of the user for whom subscription details should be updated * @since 1.0.0 - Migrated from WooCommerce Subscriptions v1.3.8 */ public static function cancel_users_subscriptions_for_network($user_id) { } /** * Clear all subscriptions for a given order. * * @param WC_Order $order The order for which subscriptions should be cleared. * @since 1.0.0 - Migrated from WooCommerce Subscriptions v1.0 */ public static function clear_users_subscriptions_from_order($order) { } /** * Trash all subscriptions attached to an order when it's trashed. * * Also make sure all related scheduled actions are cancelled when deleting a subscription. * * @since 1.0.0 - Migrated from WooCommerce Subscriptions v1.0 * * @param int $order_id The order ID of the WC Subscription or WC Order being trashed */ public static function maybe_trash_subscription($order_id) { } /** * Untrash all subscriptions attached to an order when it's restored. * * @since 1.0.0 - Migrated from WooCommerce Subscriptions v2.2.17 * * @param int $order_id The Order ID of the order being restored */ public static function maybe_untrash_subscription($order_id) { } /** * Delete related subscriptions when an order is deleted. * * @param int $order_id The post ID being deleted. */ public static function maybe_delete_subscription($order_id) { } /** * Make sure a subscription is cancelled before it is trashed or deleted * * @param int $id * @since 1.0.0 - Migrated from WooCommerce Subscriptions v2.0 */ public static function maybe_cancel_subscription($id) { } /** * When an order is trashed, store the '_wp_trash_meta_status' meta value with a cancelled subscription status * to prevent subscriptions being restored with an active status. * * When WordPress and WooCommerce set this meta value, they use the status of the order in memory. * If that status is changed on the before trashed or before deleted hooks, * as is the case with a subscription, which is cancelled before being trashed if it is active or on-hold, * then the '_wp_trash_meta_status' value will be incorrectly set to its status before being trashed. * * This function fixes that by setting '_wp_trash_meta_status' to 'wc-cancelled' whenever its former status * is something that can not be restored. * * @since 1.0.0 - Migrated from WooCommerce Subscriptions v2.0 * * @param int $id */ public static function fix_trash_meta_status($id) { } /** * Trigger action hook after a subscription has been trashed. * * @param int $id * @since 1.0.0 - Migrated from WooCommerce Subscriptions v2.0 */ public static function trigger_subscription_trashed_hook($id) { } /** * Takes a user ID and trashes any subscriptions that user has. * * @param int $user_id The ID of the user whose subscriptions will be trashed * @since 1.0.0 - Migrated from WooCommerce Subscriptions v2.0 */ public static function trash_users_subscriptions($user_id) { } /** * Takes a user ID and trashes any subscriptions that user has on any site in a WordPress network * * @param int $user_id The ID of the user whose subscriptions will be trashed * @since 1.0.0 - Migrated from WooCommerce Subscriptions v2.0 */ public static function trash_users_subscriptions_for_network($user_id) { } /** * Trigger action hook after a subscription has been deleted. * * @param int $id * @since 1.0.0 - Migrated from WooCommerce Subscriptions v2.0 */ public static function trigger_subscription_deleted_hook($id) { } /** * Checks if the current request is by a user to change the status of their subscription, and if it is * validate the subscription cancellation request and maybe processes the cancellation. * * @since 1.0.0 - Migrated from WooCommerce Subscriptions v1.0 * @deprecated 1.0.0 - Migrated from WooCommerce Subscriptions v2.0 */ public static function maybe_change_users_subscription() { } /** * Check if a given subscription can be changed to a given a status. * * The function checks the subscription's current status and if the payment gateway used to purchase the * subscription allows for the given status to be set via its API. * * @param string $new_status_or_meta The status or meta data you want to change th subscription to. Can be 'active', 'on-hold', 'cancelled', 'expired', 'trash', 'deleted', 'failed', 'new-payment-date' or some other value attached to the 'woocommerce_can_subscription_be_changed_to' filter. * @param string $subscription_key A subscription key of the form created by @see self::get_subscription_key() * @param int $user_id The ID of the user who owns the subscriptions. Although this parameter is optional, if you have the User ID you should pass it to improve performance. * @since 1.0.0 - Migrated from WooCommerce Subscriptions v1.0 */ public static function can_subscription_be_changed_to($new_status_or_meta, $subscription_key, $user_id = '') { } /* * Subscription Getters & Property functions */ /** * Return an associative array of a given subscriptions details (if it exists). * * @param string $subscription_key A subscription key of the form created by @see self::get_subscription_key() * @param deprecated don't use * @return array Subscription details * @since 1.0.0 - Migrated from WooCommerce Subscriptions v1.1 */ public static function get_subscription($subscription_key, $deprecated = \null) { } /** * Return an i18n'ified string for a given subscription status. * * @param string $status An subscription status of it's internal form. * @return string A translated subscription status string for display. * @since 1.0.0 - Migrated from WooCommerce Subscriptions v1.2.3 */ public static function get_status_to_display($status, $subscription_key = '', $user_id = 0) { } /** * Return an i18n'ified associative array of all possible subscription periods. * * @since 1.0.0 - Migrated from WooCommerce Subscriptions v1.1 * @deprecated 1.0.0 - Migrated from WooCommerce Subscriptions v2.0 */ public static function get_subscription_period_strings($number = 1, $period = '') { } /** * Return an i18n'ified associative array of all possible subscription periods. * * @since 1.0.0 - Migrated from WooCommerce Subscriptions v1.0 * @deprecated 1.0.0 - Migrated from WooCommerce Subscriptions v2.0 */ public static function get_subscription_period_interval_strings($interval = '') { } /** * Returns an array of subscription lengths. * * PayPal Standard Allowable Ranges * D – for days; allowable range is 1 to 90 * W – for weeks; allowable range is 1 to 52 * M – for months; allowable range is 1 to 24 * Y – for years; allowable range is 1 to 5 * * @param subscription_period string (optional) One of day, week, month or year. If empty, all subscription ranges are returned. * @since 1.0.0 - Migrated from WooCommerce Subscriptions v1.0 * @deprecated 1.0.0 - Migrated from WooCommerce Subscriptions v2.0 */ public static function get_subscription_ranges($subscription_period = '') { } /** * Returns an array of allowable trial periods. * * @see self::get_subscription_ranges() * @param subscription_period string (optional) One of day, week, month or year. If empty, all subscription ranges are returned. * @since 1.0.0 - Migrated from WooCommerce Subscriptions v1.1 * @deprecated 1.0.0 - Migrated from WooCommerce Subscriptions v2.0 */ public static function get_subscription_trial_lengths($subscription_period = '') { } /** * Return an i18n'ified associative array of all possible subscription trial periods. * * @since 1.0.0 - Migrated from WooCommerce Subscriptions v1.2 * @deprecated 1.0.0 - Migrated from WooCommerce Subscriptions v2.0 */ public static function get_subscription_trial_period_strings($number = 1, $period = '') { } /** * Return an i18n'ified associative array of all time periods allowed for subscriptions. * * @param string $form Either 'singular' for singular trial periods or 'plural'. * @since 1.0.0 - Migrated from WooCommerce Subscriptions v1.2 * @deprecated 1.0.0 - Migrated from WooCommerce Subscriptions v2.0 */ public static function get_available_time_periods($form = 'singular') { } /** * Returns the string key for a subscription purchased in an order specified by $order_id * * @param order_id int The ID of the order in which the subscription was purchased. * @param product_id int The ID of the subscription product. * @return string The key representing the given subscription. * @since 1.0.0 - Migrated from WooCommerce Subscriptions v1.0 */ public static function get_subscription_key($order_id, $product_id = '') { } /** * Returns the number of failed payments for a given subscription. * * @param string $subscription_key A subscription key of the form created by @see self::get_subscription_key() * @param int $user_id The ID of the user who owns the subscriptions. Although this parameter is optional, if you have the User ID you should pass it to improve performance. * @return int The number of outstanding failed payments on the subscription, if any. * @since 1.0.0 - Migrated from WooCommerce Subscriptions v1.0 * @deprecated 1.0.0 - Migrated from WooCommerce Subscriptions v2.0 */ public static function get_subscriptions_failed_payment_count($subscription_key, $user_id = '') { } /** * Returns the number of completed payments for a given subscription (including the initial payment). * * @param string $subscription_key A subscription key of the form created by @see self::get_subscription_key() * @param int $user_id The ID of the user who owns the subscriptions. Although this parameter is optional, if you have the User ID you should pass it to improve performance. * @return int The number of outstanding failed payments on the subscription, if any. * @since 1.0.0 - Migrated from WooCommerce Subscriptions v1.4 * @deprecated 1.0.0 - Migrated from WooCommerce Subscriptions v2.0 */ public static function get_subscriptions_completed_payment_count($subscription_key) { } /** * Takes a subscription key and returns the date on which the subscription is scheduled to expire * or 0 if it is cancelled, expired, or never going to expire. * * @param string $subscription_key A subscription key of the form created by @see self::get_subscription_key() * @param int $user_id The ID of the user who owns the subscriptions. Although this parameter is optional, if you have the User ID you should pass it to improve performance. * @param string $type (optional) The format for the Either 'mysql' or 'timestamp'. * @since 1.0.0 - Migrated from WooCommerce Subscriptions v1.1 * @deprecated 1.0.0 - Migrated from WooCommerce Subscriptions v2.0 */ public static function get_subscription_expiration_date($subscription_key, $user_id = '', $type = 'mysql') { } /** * Updates a subscription's expiration date as scheduled in WP-Cron and in the subscription details array. * * @param string $subscription_key A subscription key of the form created by @see self::get_subscription_key() * @param int $user_id (optional) The ID of the user who owns the subscriptions. Although this parameter is optional, if you have the User ID you should pass it to improve performance. * @param (optional) $next_payment string | int The date and time the next payment is due, either as MySQL formatted datetime string or a Unix timestamp. If empty, @see self::calculate_subscription_expiration_date() will be called. * @return mixed If the expiration does not get set, returns false, otherwise it will return a MySQL datetime formatted string for the new date when the subscription will expire * @since 1.0.0 - Migrated from WooCommerce Subscriptions v1.2.4 * @deprecated 1.0.0 - Migrated from WooCommerce Subscriptions v2.0 */ public static function set_expiration_date($subscription_key, $user_id = '', $expiration_date = '') { } /** * A subscription now either has an end date or it doesn't, there is no way to calculate it based on the original subscription * product (because a WC_Subscription object can have more than one product and syncing length with expiration date was both * cumbersome and error prone). * * Takes a subscription key and calculates the date on which the subscription is scheduled to expire * or 0 if it will never expire. * * @param string $subscription_key A subscription key of the form created by @see self::get_subscription_key() * @param int $user_id The ID of the user who owns the subscriptions. Although this parameter is optional, if you have the User ID you should pass it to improve performance. * @param string $type (optional) The format for the Either 'mysql' or 'timestamp'. * @since 1.0.0 - Migrated from WooCommerce Subscriptions v1.1 * @deprecated 1.0.0 - Migrated from WooCommerce Subscriptions v2.0 */ public static function calculate_subscription_expiration_date($subscription_key, $user_id = '', $type = 'mysql') { } /** * Takes a subscription key and returns the date on which the next recurring payment is to be billed, if any. * * @param string $subscription_key A subscription key of the form created by @see self::get_subscription_key() * @param int $user_id The ID of the user who owns the subscriptions. Although this parameter is optional, if you have the User ID you should pass it to improve performance. * @param string $type (optional) The format for the Either 'mysql' or 'timestamp'. * @return mixed If there is no future payment set, returns 0, otherwise it will return a date of the next payment in the form specified by $type * @since 1.0.0 - Migrated from WooCommerce Subscriptions v1.2 * @deprecated 1.0.0 - Migrated from WooCommerce Subscriptions v2.0 */ public static function get_next_payment_date($subscription_key, $user_id = '', $type = 'mysql') { } /** * Clears the payment schedule for a subscription and schedules a new date for the next payment. * * If updating the an existing next payment date (instead of setting a new date, you should use @see self::update_next_payment_date() instead * as it will validate the next payment date and update the WP-Cron lock. * * @param string $subscription_key A subscription key of the form created by @see self::get_subscription_key() * @param int $user_id (optional) The ID of the user who owns the subscriptions. Although this parameter is optional, if you have the User ID you should pass it to improve performance. * @param (optional) $next_payment string | int The date and time the next payment is due, either as MySQL formatted datetime string or a Unix timestamp. If empty, @see self::calculate_next_payment_date() will be called. * @return mixed If there is no future payment set, returns 0, otherwise it will return a MySQL datetime formatted string for the date of the next payment * @since 1.0.0 - Migrated from WooCommerce Subscriptions v1.2 * @deprecated 1.0.0 - Migrated from WooCommerce Subscriptions v2.0 */ public static function set_next_payment_date($subscription_key, $user_id = '', $next_payment = '') { } /** * Takes a subscription key and returns the date on which the next recurring payment is to be billed, if any. * * @param string $subscription_key A subscription key of the form created by @see self::get_subscription_key() * @param int $user_id The ID of the user who owns the subscriptions. Although this parameter is optional, if you have the User ID you should pass it to improve performance. * @param string $type (optional) The format for the Either 'mysql' or 'timestamp'. * @return mixed If there is no future payment set, returns 0, otherwise it will return a date of the next payment in the form specified by $type * @since 1.0.0 - Migrated from WooCommerce Subscriptions v1.2 * @deprecated 1.0.0 - Migrated from WooCommerce Subscriptions v2.0 */ public static function get_last_payment_date($subscription_key, $user_id = '', $type = 'mysql') { } /** * Changes the transient used to safeguard against firing scheduled_subscription_payments during a payment period. * * @param string $subscription_key A subscription key of the form created by @see self::get_subscription_key() * @param int $lock_time The amount of time to lock for in seconds from now, the lock will be set 1 hour before this time * @param int $user_id (optional) The ID of the user who owns the subscriptions. Although this parameter is optional, if you have the User ID you should pass it to improve performance. * @since 1.0.0 - Migrated from WooCommerce Subscriptions v1.2 * @deprecated 1.0.0 - Migrated from WooCommerce Subscriptions v2.0 */ public static function update_wp_cron_lock($subscription_key, $lock_time, $user_id = '') { } /** * Clears the payment schedule for a subscription and sets a net date * * @param string $subscription_key A subscription key of the form created by @see self::get_subscription_key() * @param int $user_id (optional) The ID of the user who owns the subscriptions. Although this parameter is optional, if you have the User ID you should pass it to improve performance. * @param string $type (optional) The format for the Either 'mysql' or 'timestamp'. * @return mixed If there is no future payment set, returns 0, otherwise it will return a date of the next payment of the type specified with $type * @since 1.0.0 - Migrated from WooCommerce Subscriptions v1.2 * @deprecated 1.0.0 - Migrated from WooCommerce Subscriptions v2.0 */ public static function calculate_next_payment_date($subscription_key, $user_id = '', $type = 'mysql', $from_date = '') { } /** * Takes a subscription key and returns the date on which the trial for the subscription ended or is going to end, if any. * * @param string $subscription_key A subscription key of the form created by @see self::get_subscription_key() * @param int $user_id The ID of the user who owns the subscriptions. Although this parameter is optional, if you have the User ID you should pass it to improve performance. * @return mixed If the subscription has no trial period, returns 0, otherwise it will return the date the trial period ends or ended in the form specified by $type * @since 1.0.0 - Migrated from WooCommerce Subscriptions v1.2 */ public static function get_trial_expiration_date($subscription_key, $user_id = '', $type = 'mysql') { } /** * Updates the trial expiration date as scheduled in WP-Cron and in the subscription details array. * * @param string $subscription_key A subscription key of the form created by @see self::get_subscription_key() * @param int $user_id (optional) The ID of the user who owns the subscription. Although this parameter is optional, if you have the User ID you should pass it to improve performance. * @param (optional) $next_payment string | int The date and time the next payment is due, either as MySQL formatted datetime string or a Unix timestamp. If empty, @see self::calculate_next_payment_date() will be called. * @return mixed If the trial expiration does not get set, returns false, otherwise it will return a MySQL datetime formatted string for the new date when the trial will expire * @since 1.0.0 - Migrated from WooCommerce Subscriptions v1.2.4 */ public static function set_trial_expiration_date($subscription_key, $user_id = '', $trial_expiration_date = '') { } /** * Takes a subscription key and calculates the date on which the subscription's trial should end * or 0 if no trial is set. * * @param string $subscription_key A subscription key of the form created by @see self::get_subscription_key() * @param int $user_id The ID of the user who owns the subscriptions. Although this parameter is optional, if you have the User ID you should pass it to improve performance. * @param string $type (optional) The format for the Either 'mysql' or 'timestamp'. * @since 1.0.0 - Migrated from WooCommerce Subscriptions v1.1 */ public static function calculate_trial_expiration_date($subscription_key, $user_id = '', $type = 'mysql') { } /** * Takes a subscription key and returns the user who owns the subscription (based on the order ID in the subscription key). * * @param string $subscription_key A subscription key of the form created by @see self::get_subscription_key() * @return int The ID of the user who owns the subscriptions, or 0 if no user can be found with the subscription * @since 1.0.0 - Migrated from WooCommerce Subscriptions v1.2 */ public static function get_user_id_from_subscription_key($subscription_key) { } /** * Checks if a subscription requires manual payment because the payment gateway used to purchase the subscription * did not support automatic payments at the time of the subscription sign up. * * @param string $subscription_key A subscription key of the form created by @see self::get_subscription_key() * @param int $user_id The ID of the user who owns the subscriptions. Although this parameter is optional, if you have the User ID you should pass it to improve performance. * @return bool | null True if the subscription exists and requires manual payments, false if the subscription uses automatic payments, null if the subscription doesn't exist. * @since 1.0.0 - Migrated from WooCommerce Subscriptions v1.2 * @deprecated 1.0.0 - Migrated from WooCommerce Subscriptions v2.0 */ public static function requires_manual_renewal($subscription_key, $user_id = '') { } /** * Checks if a subscription has an unpaid renewal order. * * @param string $subscription_key A subscription key of the form created by @see self::get_subscription_key() * @param int $user_id The ID of the user who owns the subscriptions. Although this parameter is optional, if you have the User ID you should pass it to improve performance. * @return bool True if the subscription has an unpaid renewal order, false if the subscription has no unpaid renewal orders. * @since 1.0.0 - Migrated from WooCommerce Subscriptions v1.2 */ public static function subscription_requires_payment($subscription_key, $user_id) { } /* * User API Functions */ /** * Check if a user owns a subscription, as specified with $subscription_key. * * If no user is specified, the currently logged in user will be used. * * @param string $subscription_key A subscription key of the form created by @see self::get_subscription_key() * @param int $user_id (optional) int The ID of the user to check against. Defaults to the currently logged in user. * @return bool True if the user has the subscription (or any subscription if no subscription specified), otherwise false. * @since 1.0.0 - Migrated from WooCommerce Subscriptions v1.3 * @deprecated 1.0.0 - Migrated from WooCommerce Subscriptions v2.0 */ public static function user_owns_subscription($subscription_key, $user_id = 0) { } /** * Check if a user has a subscription, optionally specified with $product_id. * * @param int $user_id (optional) The id of the user whose subscriptions you want. Defaults to the currently logged in user. * @param product_id int (optional) The ID of a subscription product. * @param status string (optional) A subscription status to check against. For example, for a $status of 'active', a subscriber must have an active subscription for a return value of true. * @return bool True if the user has the subscription (or any subscription if no subscription specified), otherwise false. * @version 1.0.0 - Migrated from WooCommerce Subscriptions v1.3.5 */ public static function user_has_subscription($user_id = 0, $product_id = '', $status = 'any') { } /** * Gets all the active and inactive subscriptions for all users. * * @return array An associative array containing all users with subscriptions and the details of their subscriptions: 'user_id' => $subscriptions * @since 1.0.0 - Migrated from WooCommerce Subscriptions v1.0 */ public static function get_all_users_subscriptions() { } /** * Gets all the active and inactive subscriptions for a user, as specified by $user_id * * @param int $user_id (optional) The id of the user whose subscriptions you want. Defaults to the currently logged in user. * @param array $order_ids (optional) An array of post_ids of WC_Order objects as a way to get only subscriptions for certain orders. Defaults to null, which will return subscriptions for all orders. * @since 1.0.0 - Migrated from WooCommerce Subscriptions v1.0 */ public static function get_users_subscriptions($user_id = 0, $order_ids = array()) { } /** * Gets all the subscriptions for a user that have been trashed, as specified by $user_id * * @param int $user_id (optional) The id of the user whose subscriptions you want. Defaults to the currently logged in user. * @since 1.0.0 - Migrated from WooCommerce Subscriptions v1.0 */ public static function get_users_trashed_subscriptions($user_id = '') { } /** * A convenience wrapper to assign the inactive subscriber role to a user. * * @param int $user_id The id of the user whose role should be changed * @since 1.0.0 - Migrated from WooCommerce Subscriptions v1.2 * @deprecated 1.0.0 - Migrated from WooCommerce Subscriptions v2.0 */ public static function make_user_inactive($user_id) { } /** * A convenience wrapper to assign the cancelled subscriber role to a user. * * Hooked to 'subscription_end_of_prepaid_term' hook. * * @param int $user_id The id of the user whose role should be changed * @since 1.0.0 - Migrated from WooCommerce Subscriptions v1.3.2 * @deprecated 1.0.0 - Migrated from WooCommerce Subscriptions v2.0 */ public static function maybe_assign_user_cancelled_role($user_id) { } /** * A convenience wrapper for changing a users role. * * @param int $user_id The id of the user whose role should be changed * @param string $role_name Either a WordPress role or one of the WCS keys: 'default_subscriber_role' or 'default_cancelled_role' * @since 1.0.0 - Migrated from WooCommerce Subscriptions v1.0 * @deprecated 1.0.0 - Migrated from WooCommerce Subscriptions v2.0 */ public static function update_users_role($user_id, $role_name) { } /** * Marks a customer as a paying customer when their subscription is activated. * * A wrapper for the @see woocommerce_paying_customer() function. * * @param int $order_id The id of the order for which customers should be pulled from and marked as paying. * @since 1.0.0 - Migrated from WooCommerce Subscriptions v1.0 * @deprecated 1.0.0 - Migrated from WooCommerce Subscriptions v2.0 */ public static function mark_paying_customer($order) { } /** * Unlike someone making a once-off payment, a subscriber can cease to be a paying customer. This function * changes a user's status to non-paying. * * Deprecated as orders now take care of the customer's status as paying or not paying * * @param object $order The order for which a customer ID should be pulled from and marked as paying. * @since 1.0.0 - Migrated from WooCommerce Subscriptions v1.0 * @deprecated 1.0.0 - Migrated from WooCommerce Subscriptions v2.0 */ public static function mark_not_paying_customer($order) { } /** * Return a link for subscribers to change the status of their subscription, as specified with $status parameter * * @param string $subscription_key A subscription key of the form created by @see self::get_subscription_key() * @since 1.0.0 - Migrated from WooCommerce Subscriptions v1.0 * @deprecated 1.0.0 - Migrated from WooCommerce Subscriptions v2.0 */ public static function get_users_change_status_link($subscription_key, $status) { } /** * Change a subscription's next payment date. * * @param mixed $new_payment_date Either a MySQL formatted Date/time string or a Unix timestamp. * @param string $subscription_key A subscription key of the form created by @see self::get_subscription_key() * @param int $user_id The id of the user who purchased the subscription * @param string $timezone Either 'server' or 'user' to describe the timezone of the $new_payment_date. * @since 1.0.0 - Migrated from WooCommerce Subscriptions v1.2 * @deprecated 1.0.0 - Migrated from WooCommerce Subscriptions v2.0 */ public static function update_next_payment_date($new_payment_date, $subscription_key, $user_id = '', $timezone = 'server') { } /* * Helper Functions */ /** * Because neither PHP nor WP include a real array merge function that works recursively. * * @since 1.0.0 - Migrated from WooCommerce Subscriptions v1.0 */ public static function array_merge_recursive_for_real($first_array, $second_array) { } /** * Takes a total and calculates the recurring proportion of that based on $proportion and then fixes any rounding bugs to * make sure the totals add up. * * Used mainly to calculate the recurring amount from a total which may also include a sign up fee. * * @param float $total The total amount * @since 1.0.0 - Migrated from WooCommerce Subscriptions v1.2 * @return float $proportion A proportion of the total (e.g. 0.5 is half of the total) */ public static function get_amount_from_proportion($total, $proportion) { } /** * Creates a subscription price string from an array of subscription details. For example, ""$5 / month for 12 months". * * @param array $subscription_details A set of name => value pairs for the subscription details to include in the string. Available keys: * 'initial_amount': The upfront payment for the subscription, including sign up fees, as a string from the @see woocommerce_price(). Default empty string (no initial payment) * 'initial_description': The word after the initial payment amount to describe the amount. Examples include "now" or "initial payment". Defaults to "up front". * 'recurring_amount': The amount charged per period. Default 0 (no recurring payment). * 'subscription_interval': How regularly the subscription payments are charged. Default 1, meaning each period e.g. per month. * 'subscription_period': The temporal period of the subscription. Should be one of {day|week|month|year} as used by @see self::get_subscription_period_strings() * 'subscription_length': The total number of periods the subscription should continue for. Default 0, meaning continue indefinitely. * 'trial_length': The total number of periods the subscription trial period should continue for. Default 0, meaning no trial period. * 'trial_period': The temporal period for the subscription's trial period. Should be one of {day|week|month|year} as used by @see self::get_subscription_period_strings() * @since 1.0.0 - Migrated from WooCommerce Subscriptions v1.2 * @deprecated 1.0.0 - Migrated from WooCommerce Subscriptions v2.0 * @return float $proportion A proportion of the total (e.g. 0.5 is half of the total) */ public static function get_subscription_price_string($subscription_details) { } /** * Copy of the WordPress "touch_time" template function for use with a variety of different times * * @param array $args A set of name => value pairs to customise how the function operates. Available keys: * 'date': (string) the date to display in the selector in MySQL format ('Y-m-d H:i:s'). Required. * 'tab_index': (int) the tab index for the element. Optional. Default 0. * 'multiple': (bool) whether there will be multiple instances of the element on the same page (determines whether to include an ID or not). Default false. * 'echo': (bool) whether to return and print the element or simply return it. Default true. * 'include_time': (bool) whether to include a specific time for the selector. Default true. * 'include_year': (bool) whether to include a the year field. Default true. * 'include_buttons': (bool) whether to include submit buttons on the selector. Default true. * @since 1.0.0 - Migrated from WooCommerce Subscriptions v1.2 */ public static function touch_time($args = array()) { } /** * If a gateway doesn't manage payment schedules, then we should suspend the subscription until it is paid (i.e. for manual payments * or token gateways like Stripe). If the gateway does manage the scheduling, then we shouldn't suspend the subscription because a * gateway may use batch processing on the time payments are charged and a subscription could end up being incorrectly suspended. * * @param int $user_id The id of the user whose subscription should be put on-hold. * @param string $subscription_key A subscription key of the form created by @see self::get_subscription_key() * @since 1.0.0 - Migrated from WooCommerce Subscriptions v1.2.5 * @deprecated 1.0.0 - Migrated from WooCommerce Subscriptions v2.0 */ public static function maybe_put_subscription_on_hold($user_id, $subscription_key) { } /** * Check if the subscription needs to use the failed payment process to repair its status after it incorrectly expired due to a date migration * bug in upgrade process for 2.0.0 of Subscriptions (i.e. not 2.0.1 or newer). See WCS_Repair_2_0_2::maybe_repair_status() for more details. * * @param int $subscription_id The ID of a 'shop_subscription' post * @since 1.0.0 - Migrated from WooCommerce Subscriptions v2.0.2 */ public static function maybe_process_failed_renewal_for_repair($subscription_id) { } /* Deprecated Functions */ /** * When a scheduled subscription payment hook is fired, automatically process the subscription payment * if the amount is for $0 (and therefore, there is no payment to be processed by a gateway, and likely * no gateway used on the initial order). * * If a subscription has a $0 recurring total and is not already active (after being activated by something else * handling the 'scheduled_subscription_payment' with the default priority of 10), then this function will call * @see self::process_subscription_payment() to reactive the subscription, generate a renewal order etc. * * @param int $user_id The id of the user who the subscription belongs to * @param string $subscription_key A subscription key of the form created by @see self::get_subscription_key() * @since 1.0.0 - Migrated from WooCommerce Subscriptions v1.3.2 * @deprecated 1.0.0 - Migrated from WooCommerce Subscriptions v2.0 */ public static function maybe_process_subscription_payment($user_id, $subscription_key) { } /** * Return a link for subscribers to change the status of their subscription, as specified with $status parameter * * @param string $subscription_key A subscription key of the form created by @see self::get_subscription_key() * @since 1.0.0 - Migrated from WooCommerce Subscriptions v1.0 */ public static function current_user_can_suspend_subscription($subscription_key) { } /** * Return a multi-dimensional associative array of subscriptions with a certain value, grouped by user ID. * * A slow PHP based search routine which can't use the speed of MySQL because subscription details. If you * know the key for the value you are search by, use @see self::get_subscriptions() for better performance. * * @param string $search_query The query to search the database for. * @return array Subscription details * @since 1.0.0 - Migrated from WooCommerce Subscriptions v1.1 * @deprecated 1.0.0 - Migrated from WooCommerce Subscriptions v2.0 */ public static function search_subscriptions($search_query) { } /** * Marks a single subscription as active on a users account. * * @param int $user_id The id of the user whose subscription is to be activated. * @param string $subscription_key A subscription key of the form created by @see self::get_subscription_key() * @since 1.0.0 - Migrated from WooCommerce Subscriptions v1.0 */ public static function activate_subscription($user_id, $subscription_key) { } /** * Changes a single subscription from on-hold to active on a users account. * * @param int $user_id The id of the user whose subscription is to be activated. * @param string $subscription_key A subscription key of the form created by @see self::get_subscription_key() * @since 1.0.0 - Migrated from WooCommerce Subscriptions v1.0 */ public static function reactivate_subscription($user_id, $subscription_key) { } /** * Suspends a single subscription on a users account by placing it in the "on-hold" status. * * @param int $user_id The id of the user whose subscription should be put on-hold. * @param string $subscription_key A subscription key of the form created by @see self::get_subscription_key() * @since 1.0.0 - Migrated from WooCommerce Subscriptions v1.0 */ public static function put_subscription_on_hold($user_id, $subscription_key) { } /** * Cancels a single subscription on a users account. * * @param int $user_id The id of the user whose subscription should be cancelled. * @param string $subscription_key A subscription key of the form created by @see self::get_subscription_key() * @since 1.0.0 - Migrated from WooCommerce Subscriptions v1.0 */ public static function cancel_subscription($user_id, $subscription_key) { } /** * Sets a single subscription on a users account to be 'on-hold' and keeps a record of the failed sign up on an order. * * @param int $user_id The id of the user whose subscription should be cancelled. * @param string $subscription_key A subscription key of the form created by @see self::get_subscription_key() * @since 1.0.0 - Migrated from WooCommerce Subscriptions v1.0 */ public static function failed_subscription_signup($user_id, $subscription_key) { } /** * Trashes a single subscription on a users account. * * @param int $user_id The ID of the user who the subscription belongs to * @param string $subscription_key A subscription key of the form created by @see self::get_subscription_key() * @since 1.0.0 - Migrated from WooCommerce Subscriptions v1.0 */ public static function trash_subscription($user_id, $subscription_key) { } /** * Permanently deletes a single subscription on a users account. * * @param int $user_id The ID of the user who the subscription belongs to * @param string $subscription_key A subscription key of the form created by @see self::get_subscription_key() * @since 1.0.0 - Migrated from WooCommerce Subscriptions v1.2 */ public static function delete_subscription($user_id, $subscription_key) { } /** * Processes an ajax request to change a subscription's next payment date. * * Deprecated because editing a subscription's next payment date is now done from the Edit Subscription screen. * * @since 1.0.0 - Migrated from WooCommerce Subscriptions v1.2 * @deprecated 1.0.0 - Migrated from WooCommerce Subscriptions v2.0 */ public static function ajax_update_next_payment_date() { } /** * WP-Cron occasionally gets itself into an infinite loop on scheduled events, this function is * designed to create a non-cron related safeguard against payments getting caught up in such a loop. * * When the scheduled subscription payment hook is fired by WP-Cron, this function is attached before * any other to make sure the hook hasn't already fired for this period. * * A transient is used to keep a record of any payment for each period. The transient expiration is * set to one billing period in the future, minus 1 hour, if there is a future payment due, otherwise, * it is set to 23 hours in the future. This later option provides a safeguard in case a subscription's * data is corrupted and the @see self::calculate_next_payment_date() is returning an * invalid value. As no subscription can charge a payment more than once per day, the 23 hours is a safe * throttle period for billing that still removes the possibility of a catastrophic failure (payments * firing every few seconds until a credit card is maxed out). * * The transient keys use both the user ID and subscription key to ensure it is unique per subscription * (even on multisite) * * @param int $user_id The id of the user who purchased the subscription * @param string $subscription_key A subscription key of the form created by @see self::get_subscription_key() * @since 1.0.0 - Migrated from WooCommerce Subscriptions v1.1.2 * @deprecated 1.0.0 - Migrated from WooCommerce Subscriptions v2.0 */ public static function safeguard_scheduled_payments($user_id, $subscription_key) { } /** * When a subscription payment hook is fired, reschedule the hook to run again on the * time/date of the next payment (if any). * * WP-Cron's built in wp_schedule_event() function can not be used because the recurrence * must be a timestamp, which creates inaccurate schedules for month and year billing periods. * * @param int $user_id The id of the user who the subscription belongs to * @param string $subscription_key A subscription key of the form created by @see self::get_subscription_key() * @since 1.0.0 - Migrated from WooCommerce Subscriptions v1.1.5 * @deprecated 1.0.0 - Migrated from WooCommerce Subscriptions v2.0 */ public static function maybe_reschedule_subscription_payment($user_id, $subscription_key) { } /** * Fires when the trial period for a subscription has completed. * * @param int $subscription_id The ID of a 'shop_subscription' post * @since 1.0.0 - Migrated from WooCommerce Subscriptions v1.0 * @deprecated 1.0.0 - Migrated from WooCommerce Subscriptions v2.0 */ public static function subscription_trial_end($subscription_id, $deprecated = \null) { } } /** * Subscriptions Order Class * * Mirrors and overloads a few functions in the WC_Order class to work for subscriptions. * * @package WooCommerce Subscriptions * @subpackage WC_Subscriptions_Order * @category Class */ class WC_Subscriptions_Order { /** * A flag to indicate whether subscription price strings should include the subscription length */ public static $recurring_only_price_strings = \false; /** * Bootstraps the class and hooks required actions & filters. * * @since 1.0.0 - Migrated from WooCommerce Subscriptions v1.0 */ public static function init() { } /* * Helper functions for extracting the details of subscriptions in an order */ /** * Returns the total amount to be charged for non-subscription products at the outset of a subscription. * * This may return 0 if there no non-subscription products in the cart, or otherwise it will be the sum of the * line totals for each non-subscription product. * * @param mixed $order A WC_Order object or the ID of the order which the subscription was purchased in. * @since 1.0.0 - Migrated from WooCommerce Subscriptions v1.5.3 */ public static function get_non_subscription_total($order) { } /** * Returns the total sign-up fee for all subscriptions in an order. * * Similar to WC_Subscription::get_sign_up_fee() except that it sums the sign-up fees for all subscriptions purchased in an order. * * @param mixed $order A WC_Order object or the ID of the order which the subscription was purchased in. * @param int $product_id (optional) The post ID of the subscription WC_Product object purchased in the order. Defaults to the ID of the first product purchased in the order. * @return float The initial sign-up fee charged when the subscription product in the order was first purchased, if any. * @since 1.0.0 - Migrated from WooCommerce Subscriptions v1.0 */ public static function get_sign_up_fee($order, $product_id = '') { } /** * Gets the product ID for an order item in a way that is backwards compatible with WC 1.x. * * Version 2.0 of WooCommerce changed the ID of an order item from its product ID to a unique ID for that particular item. * This function checks if the 'product_id' field exists on an order item before falling back to 'id'. * * @param array $order_item An order item in the structure returned by WC_Order::get_items() * @since 1.0.0 - Migrated from WooCommerce Subscriptions v1.2.5 */ public static function get_items_product_id($order_item) { } /** * Gets an item by product id from an order. * * @param WC_Order|int $order The WC_Order object or ID of the order for which the meta should be sought. * @param int $product_id The product/post ID of a subscription product. * @since 1.0.0 - Migrated from WooCommerce Subscriptions v1.2.5 */ public static function get_item_by_product_id($order, $product_id = '') { } /** * Gets an item by a subscription key of the form created by @see WC_Subscriptions_Manager::get_subscription_key(). * * @param WC_Order|int $order The WC_Order object or ID of the order for which the meta should be sought. * @param int $product_id The product/post ID of a subscription product. * @since 1.0.0 - Migrated from WooCommerce Subscriptions v1.2.5 */ public static function get_item_by_subscription_key($subscription_key) { } /** * Gets the ID of a subscription item which belongs to a subscription key of the form created * by @see WC_Subscriptions_Manager::get_subscription_key(). * * @param WC_Order|int $order The WC_Order object or ID of the order for which the meta should be sought. * @param int $product_id The product/post ID of a subscription product. * @since 1.0.0 - Migrated from WooCommerce Subscriptions v1.4 */ public static function get_item_id_by_subscription_key($subscription_key) { } /** * Gets an individual order item by ID without requiring the order ID associated with it. * * @param WC_Order|int $order The WC_Order object or ID of the order for which the meta should be sought. * @param int $item_id The product/post ID of a subscription. Option - if no product id is provided, the first item's meta will be returned * @return array $item An array containing the order_item_id, order_item_name, order_item_type, order_id and any item_meta. Array structure matches that returned by WC_Order::get_items() * @since 1.0.0 - Migrated from WooCommerce Subscriptions v1.2.5 */ public static function get_item_by_id($order_item_id) { } /** * A unified API for accessing product specific meta on an order. * * @param WC_Order|int $order The WC_Order object or ID of the order for which the meta should be sought. * @param string $meta_key The key as stored in the post meta table for the meta item. * @param int $product_id The product/post ID of a subscription. Option - if no product id is provided, we will loop through the order and find the subscription * @param mixed $default (optional) The default value to return if the meta key does not exist. Default 0. * @since 1.0.0 - Migrated from WooCommerce Subscriptions v1.2 */ public static function get_item_meta($order, $meta_key, $product_id = '', $default = 0) { } /** * Access an individual piece of item metadata (@see woocommerce_get_order_item_meta returns all metadata for an item) * * You may think it would make sense if this function was called "get_item_meta", and you would be correct, but a function * with that name was created before the item meta data API of WC 2.0, so it needs to persist with it's own different * set of parameters. * * @param int $meta_id The order item meta data ID of the item you want to get. * @since 1.0.0 - Migrated from WooCommerce Subscriptions v1.2.5 */ public static function get_item_meta_data($meta_id) { } /** * Gets the name of a subscription item by product ID from an order. * * @param WC_Order|int $order The WC_Order object or ID of the order for which the meta should be sought. * @param int $product_id The product/post ID of a subscription. Option - if no product id is provided, it is expected that only one item exists and the last item's meta will be returned * @since 1.0.0 - Migrated from WooCommerce Subscriptions v1.2 */ public static function get_item_name($order, $product_id = '') { } /** * Displays a few details about what happens to their subscription. Hooked * to the thank you page. * * @param int $order_id * * @since 1.0.0 - Migrated from WooCommerce Subscriptions v1.0 */ public static function subscription_thank_you($order_id) { } /** * Output a hidden element in the order status of the orders list table to provide information about whether * the order displayed in that row contains a subscription or not. * * It would be more semantically correct to display a hidden input element than a span element with data, but * that can result in "requested URL's length exceeds the capacity limit" errors when bulk editing orders. * * @param string $column The string of the current column. * @since 1.0.0 - Migrated from WooCommerce Subscriptions v1.1 */ public static function add_contains_subscription_hidden_field($column) { } /** * Output a hidden element on the Edit Order screen to provide information about whether the order displayed * in that row contains a subscription or not. * * @param string $column The string of the current column. * @since 1.0.0 - Migrated from WooCommerce Subscriptions v1.1 */ public static function contains_subscription_hidden_field($order_id) { } /** * Add a column to the WooCommerce -> Orders admin screen to indicate whether an order is a * parent of a subscription, a renewal order for a subscription, or a regular order. * * @param array $columns The current list of columns * @since 1.0.0 - Migrated from WooCommerce Subscriptions v2.1 */ public static function add_contains_subscription_column($columns) { } /** * Add column content to the WooCommerce -> Orders admin screen to indicate whether an * order is a parent of a subscription, a renewal order for a subscription, or a regular order. * * @see add_contains_subscription_column_content_orders_table For when HPOS is enabled. * * @param string $column The string of the current column * @since 1.0.0 - Migrated from WooCommerce Subscriptions v2.1 */ public static function add_contains_subscription_column_content($column) { } /** * Add column content to the WooCommerce -> Orders admin screen to indicate whether an * order is a parent of a subscription, a renewal order for a subscription, or a regular order. * * @see add_contains_subscription_column_content For when HPOS is disabled. * * @since 6.3.0 * * @param string $column_name Identifier for the custom column. * @param WC_Order $order Current WooCommerce order object. */ public static function add_contains_subscription_column_content_orders_table(string $column_name, \WC_Order $order) { } /** * Records the initial payment against a subscription. * * This function is called when an order's status is changed to completed or processing * for those gateways which never call @see WC_Order::payment_complete(), like the core * WooCommerce Cheque and Bank Transfer gateways. * * It will also set the start date on the subscription to the time the payment is completed. * * @since 1.0.0 - Migrated from WooCommerce Subscriptions v2.0 * * @param int|WC_Order $order_id The order ID or WC_Order object. * @param string $old_order_status The old order status. * @param string $new_order_status The new order status. */ public static function maybe_record_subscription_payment($order_id, $old_order_status, $new_order_status) { } /* Order Price Getters */ /** * Checks if a given order item matches a line item from a subscription purchased in the order. * * @param WC_Order|int $order A WC_Order object or ID of a WC_Order order. * @param array $item | int An array representing an order item or a product ID of an item in an order (not an order item ID) * @since 1.0.0 - Migrated from WooCommerce Subscriptions v1.2 */ public static function is_item_subscription($order, $order_item) { } /* Edit Order Page Content */ /** * Returns all parent subscription orders for a user, specified with $user_id * * @return array An array of order IDs. * @since 1.0.0 - Migrated from WooCommerce Subscriptions v1.4 */ public static function get_users_subscription_orders($user_id = 0) { } /** * Check whether an order needs payment even if the order total is $0 (because it has a recurring total and * automatic payments are not switched off) * * @param bool $needs_payment The existing flag for whether the cart needs payment or not. * @param WC_Order $order A WooCommerce WC_Order object. * @return bool */ public static function order_needs_payment($needs_payment, $order, $valid_order_statuses) { } /** * Adds the subscription information to our order emails. * * @since 1.0.0 - Migrated from WooCommerce Subscriptions v1.5 */ public static function add_sub_info_email($order, $is_admin_email, $plaintext = \false) { } /** * Add admin dropdown for order types to Woocommerce -> Orders screen * * @since 1.0.0 - Migrated from WooCommerce Subscriptions v1.5 */ public static function restrict_manage_subscriptions() { } /** * When HPOS is active, adds admin dropdown for order types to Woocommerce -> Orders screen * * @since 6.3.0 * * @param string $order_type The order type. */ public static function restrict_manage_subscriptions_hpos(string $order_type) { } /** * Add request filter for order types to Woocommerce -> Orders screen * * Including or excluding posts with a '_subscription_renewal' meta value includes or excludes * renewal orders, as required. * * @since 1.0.0 - Migrated from WooCommerce Subscriptions v1.5 */ public static function orders_by_type_query($vars) { } /** * Filters the arguments to be passed to `wc_get_orders()` under the Woocommerce -> Orders screen. * * @since 6.3.0 * * @param array $order_query_args Arguments to be passed to `wc_get_orders()`. * * @return array */ public static function maybe_modify_orders_by_type_query_from_request(array $order_query_args) : array { } /** * Add related subscriptions below order details tables. * * @since 1.0.0 - Migrated from WooCommerce Subscriptions v2.0 */ public static function add_subscriptions_to_view_order_templates($order_id) { } /** * Loads the related orders table on the view subscription page * * @since 1.0.0 - Migrated from WooCommerce Subscriptions v2.0 */ public static function get_related_orders_template($subscription) { } /** * Unset pay action for an order if a more recent order exists * * @since 1.0.0 - Migrated from WooCommerce Subscriptions v2.2.9 */ public static function maybe_remove_pay_action($actions, $order) { } /** * Allow subscription order items to be edited in WC 2.2. until Subscriptions 2.0 introduces * its own WC_Subscription object. * * @since 1.0.0 - Migrated from WooCommerce Subscriptions v1.5.10 */ public static function is_order_editable($is_editable, $order) { } /** * Get a subscription that has an item with the same product/variation ID as an order item, if any. * * In Subscriptions v1.n, a subscription's meta data, like recurring total, billing period etc. were stored * against the line item on the original order for that subscription. * * In v2.0, this data was moved to a distinct subscription object which had its own line items for those amounts. * This function bridges the two data structures to support deprecated functions used to retrieve a subscription's * meta data from the original order rather than the subscription itself. * * @param WC_Order $order A WC_Order object * @param int $product_id The product/post ID of a subscription * @return null|object A subscription from the order, either with an item to the product ID (if any) or just the first subscription purchase in the order. * @since 1.0.0 - Migrated from WooCommerce Subscriptions v2.0 */ private static function get_matching_subscription($order, $product_id = '') { } /** * Get the subscription item that has the same product/variation ID as an order item, if any. * * In Subscriptions v1.n, a subscription's meta data, like recurring total, billing period etc. were stored * against the line item on the original order for that subscription. * * In v2.0, this data was moved to a distinct subscription object which had its own line items for those amounts. * This function bridges the two data structures to support deprecated functions used to retrieve a subscription's * meta data from the original order rather than the subscription itself. * * @param WC_Order $order A WC_Order object * @param int $product_id The product/post ID of a subscription * @return array The line item for this product on the subscription object * @since 1.0.0 - Migrated from WooCommerce Subscriptions v2.0 */ private static function get_matching_subscription_item($order, $product_id = '') { } /** * Don't display migrated subscription meta data on the Edit Order screen * * @since 1.0.0 - Migrated from WooCommerce Subscriptions v1.4 */ public static function hide_order_itemmeta($hidden_meta_keys) { } /** * If the subscription is pending cancellation and a latest order is refunded, cancel the subscription. * * @param $order_id * * @since 1.0.0 - Migrated from WooCommerce Subscriptions v2.0 */ public static function maybe_cancel_subscription_on_full_refund($order) { } /** * Handles partial refunds on orders in WC versions pre 2.5 which would be considered full refunds in WC 2.5. * * @param $order_id * * @since 1.0.0 - Migrated from WooCommerce Subscriptions v2.0 * @deprecated 1.0.0 - Migrated from WooCommerce Subscriptions v2.3.3 */ public static function maybe_cancel_subscription_on_partial_refund($order_id) { } /** * If the order doesn't contain shipping methods because it contains synced or trial products but the related subscription(s) does have a shipping method. * This function will ensure the shipping address is still displayed in order emails and on the order received and view order pages. * * @param bool $needs_shipping * @param array $hidden_shipping_methods shipping method IDs which should hide shipping addresses (defaulted to array( 'local_pickup' )) * @param WC_Order $order * * @return bool $needs_shipping whether an order needs to display the shipping address * * @since 1.0.0 - Migrated from WooCommerce Subscriptions v2.0.14 */ public static function maybe_display_shipping_address($needs_shipping, $hidden_shipping_methods, $order) { } /** * Automatically set the order's status to complete if the order total is zero and all the subscriptions * in an order are synced or the order contains a resubscribe. * * @param string $new_order_status * @param int $order_id * @param WC_Order $order * * @return string $new_order_status * * @since 1.0.0 - Migrated from WooCommerce Subscriptions v2.1.3 */ public static function maybe_autocomplete_order($new_order_status, $order_id, $order = \null) { } /** * Map subscription related order arguments passed to @see wc_get_orders() to WP_Query args. * * @since 1.0.0 - Migrated from WooCommerce Subscriptions v2.2.20 * @param array $query WP_Query arguments. * @param array $args @see wc_get_orders() arguments. * @return array The WP_Query query arguments. */ public static function add_subscription_order_query_args($query, $args) { } /** * Filter the query_vars of a wc_get_orders() query to map 'any' to be all valid subscription statuses instead of * defaulting to only valid order statuses. * * @param $query_vars * * @return mixed */ public static function map_order_query_args_for_subscriptions($query_vars) { } /** * Modifies the query clauses of a wc_get_orders() query to include/exclude parent orders based on the 'subscription_parent' argument. * * @param array $query_clauses The query clauses. * @param OrdersTableQuery $order_query The order query object. * * @return $query_clauses The modified query clauses to include/exclude parent orders. */ public static function filter_orders_query_by_parent_orders($query_clauses, $order_query) { } /* Deprecated Functions */ /** * Checks an order to see if it contains a subscription. * * @param mixed $order A WC_Order object or the ID of the order which the subscription was purchased in. * @return bool True if the order contains a subscription, otherwise false. * @version 1.0.0 - Migrated from WooCommerce Subscriptions v1.2 * @since 1.0.0 - Migrated from WooCommerce Subscriptions v1.0 */ public static function order_contains_subscription($order) { } /** * This function once made sure the recurring payment method was set correctly on an order when a customer placed an order * with one payment method (like PayPal), and then returned and completed payment using a different payment method. * * With the advent of a separate subscription object in 2.0, this became unnecessary. * * @since 1.0.0 - Migrated from WooCommerce Subscriptions v1.4 */ public static function set_recurring_payment_method($order_id) { } /** * Checks if an order contains an in active subscription and if it does, denies download access * to files purchased on the order. * * @return bool False if the order contains a subscription that has expired or is cancelled/on-hold, otherwise, the original value of $download_permitted * @since 1.0.0 - Migrated from WooCommerce Subscriptions v1.3 */ public static function is_download_permitted($download_permitted, $order) { } /** * Add subscription related order item meta when a subscription product is added as an item to an order via Ajax. * * Deprecated because editing a subscription's values is now done from the Edit Subscription screen and those values * are stored against a 'shop_subscription' post, not the 'shop_order' used to purchase the subscription. * * @param item_id int An order_item_id as returned by the insert statement of @see woocommerce_add_order_item() * @since 1.0.0 - Migrated from WooCommerce Subscriptions v1.2.5 * @version 1.0.0 - Migrated from WooCommerce Subscriptions v1.4 * @return void */ public static function prefill_order_item_meta($item, $item_id) { } /** * Calculate recurring line taxes when a store manager clicks the "Calc Line Tax" button on the "Edit Order" page. * * Deprecated because editing a subscription's values is now done from the Edit Subscription screen and those values * are stored against a 'shop_subscription' post, not the 'shop_order' used to purchase the subscription. * * Based on the @see woocommerce_calc_line_taxes() function. * @since 1.0.0 - Migrated from WooCommerce Subscriptions v1.2.4 * @return void */ public static function calculate_recurring_line_taxes() { } /** * Removes a line tax item from an order by ID. Hooked to * an Ajax call from the "Edit Order" page and mirrors the * @see woocommerce_remove_line_tax() function. * * Deprecated because editing a subscription's values is now done from the Edit Subscription screen and those values * are stored against a 'shop_subscription' post, not the 'shop_order' used to purchase the subscription. * * @return void */ public static function remove_line_tax() { } /** * Adds a line tax item from an order by ID. Hooked to * an Ajax call from the "Edit Order" page and mirrors the * @see woocommerce_add_line_tax() function. * * Deprecated because editing a subscription's values is now done from the Edit Subscription screen and those values * are stored against a 'shop_subscription' post, not the 'shop_order' used to purchase the subscription. * * @return void */ public static function add_line_tax() { } /** * Display recurring order totals on the "Edit Order" page. * * Deprecated because editing a subscription's values is now done from the Edit Subscription screen and those values * are stored against a 'shop_subscription' post, not the 'shop_order' used to purchase the subscription. * * @param int $post_id The post ID of the shop_order post object. * @since 1.0.0 - Migrated from WooCommerce Subscriptions v1.2.4 * @return void */ public static function recurring_order_totals_meta_box_section($post_id) { } /** * When an order is added or updated from the admin interface, check if a subscription product * has been manually added to the order or the details of the subscription have been modified, * and create/update the subscription as required. * * Deprecated because editing a subscription's values is now done from the Edit Subscription screen and those values * are stored against a 'shop_subscription' post, not the 'shop_order' used to purchase the subscription. * * @param int $post_id The ID of the post which is the WC_Order object. * @param Object $post The post object of the order. * @since 1.0.0 - Migrated from WooCommerce Subscriptions v1.1 */ public static function pre_process_shop_order_meta($post_id, $post) { } /** * Worked around a bug in WooCommerce which ignores order item meta values of 0. * * Deprecated because editing a subscription's values is now done from the Edit Subscription screen and those values * are stored against a 'shop_subscription' post, not the 'shop_order' used to purchase the subscription. * * @param int $post_id The ID of the post which is the WC_Order object. * @param Object $post The post object of the order. * @since 1.0.0 - Migrated from WooCommerce Subscriptions v1.2.4 */ public static function process_shop_order_item_meta($post_id, $post) { } /** * Checks if a subscription requires manual payment because the payment gateway used to purchase the subscription * did not support automatic payments at the time of the subscription sign up. Or because we're on a staging site. * * @param mixed $order A WC_Order object or the ID of the order which the subscription was purchased in. * @return bool True if the subscription exists and requires manual payments, false if the subscription uses automatic payments (defaults to false for backward compatibility). * @since 1.0.0 - Migrated from WooCommerce Subscriptions v1.2 */ public static function requires_manual_renewal($order) { } /** * Returns the total amount to be charged at the outset of the Subscription. * * This may return 0 if there is a free trial period and no sign up fee, otherwise it will be the sum of the sign up * fee and price per period. This function should be used by payment gateways for the initial payment. * * @param mixed $order A WC_Order object or the ID of the order which the subscription was purchased in. * @return float The total initial amount charged when the subscription product in the order was first purchased, if any. * @since 1.0.0 - Migrated from WooCommerce Subscriptions v1.1 */ public static function get_total_initial_payment($order, $product_id = '') { } /** * Returns the recurring amount for an item * * @param WC_Order $order A WC_Order object * @param int $product_id The product/post ID of a subscription * @return float The total amount to be charged for each billing period, if any, not including failed payments. * @since 1.0.0 - Migrated from WooCommerce Subscriptions v1.2 */ public static function get_item_recurring_amount($order, $product_id) { } /** * Returns the proportion of cart discount that is recurring for the product specified with $product_id * * @param WC_Order|int $order A WC_Order object or ID of a WC_Order order. * @since 1.0.0 - Migrated from WooCommerce Subscriptions v1.2 */ public static function get_recurring_discount_cart($order, $product_id = '') { } /** * Returns the proportion of cart discount tax that is recurring for the product specified with $product_id * * @param WC_Order|int $order A WC_Order object or ID of a WC_Order order. * @since 1.0.0 - Migrated from WooCommerce Subscriptions v1.2 */ public static function get_recurring_discount_cart_tax($order, $product_id = '') { } /** * Returns the proportion of total discount that is recurring for the product specified with $product_id * * @param WC_Order|int $order A WC_Order object or ID of a WC_Order order. * @since 1.0.0 - Migrated from WooCommerce Subscriptions v1.2 */ public static function get_recurring_discount_total($order, $product_id = '') { } /** * Returns the amount of shipping tax that is recurring. As shipping only applies * to recurring payments, and only 1 subscription can be purchased at a time, * this is equal to @see WC_Order::get_total_tax() * * @param WC_Order|int $order A WC_Order object or ID of a WC_Order order. * @since 1.0.0 - Migrated from WooCommerce Subscriptions v1.2 */ public static function get_recurring_shipping_tax_total($order, $product_id = '') { } /** * Returns the recurring shipping price . As shipping only applies to recurring * payments, and only 1 subscription can be purchased at a time, this is * equal to @see WC_Order::get_total_shipping() * * @param WC_Order|int $order A WC_Order object or ID of a WC_Order order. * @since 1.0.0 - Migrated from WooCommerce Subscriptions v1.2 */ public static function get_recurring_shipping_total($order, $product_id = '') { } /** * Return an array of shipping costs within this order. * * @return array */ public static function get_recurring_shipping_methods($order) { } /** * Returns an array of taxes on an order with their recurring totals. * * @param WC_Order|int $order A WC_Order object or ID of a WC_Order order. * @since 1.0.0 - Migrated from WooCommerce Subscriptions v1.2 */ public static function get_recurring_taxes($order) { } /** * Returns the proportion of total tax on an order that is recurring for the product specified with $product_id * * @param WC_Order|int $order A WC_Order object or ID of a WC_Order order. * @since 1.0.0 - Migrated from WooCommerce Subscriptions v1.2 */ public static function get_recurring_total_tax($order, $product_id = '') { } /** * Returns the proportion of total before tax on an order that is recurring for the product specified with $product_id * * @param WC_Order|int $order A WC_Order object or ID of a WC_Order order. * @since 1.0.0 - Migrated from WooCommerce Subscriptions v1.2 */ public static function get_recurring_total_ex_tax($order, $product_id = '') { } /** * Returns the price per period for a subscription in an order. * * @param mixed $order A WC_Order object or the ID of the order which the subscription was purchased in. * @param int $product_id (optional) The post ID of the subscription WC_Product object purchased in the order. Defaults to the ID of the first product purchased in the order. * @since 1.0.0 - Migrated from WooCommerce Subscriptions v1.2 */ public static function get_recurring_total($order) { } /** * Creates a string representation of the subscription period/term for each item in the cart * * @param WC_Order $order A WC_Order object. * @param mixed $deprecated Never used. * @param mixed $deprecated Never used. * @since 1.0.0 - Migrated from WooCommerce Subscriptions v1.0 */ public static function get_order_subscription_string($order, $deprecated_price = '', $deprecated_sign_up_fee = '') { } /** * Returns an array of items in an order which are recurring along with their recurring totals. * * @param WC_Order|int $order A WC_Order object or ID of a WC_Order order. * @since 1.0.0 - Migrated from WooCommerce Subscriptions v1.2 */ public static function get_recurring_items($order) { } /** * Returns the period (e.g. month) for a each subscription product in an order. * * @param mixed $order A WC_Order object or the ID of the order which the subscription was purchased in. * @param int $product_id (optional) The post ID of the subscription WC_Product object purchased in the order. Defaults to the ID of the first product purchased in the order. * @return string A string representation of the period for the subscription, i.e. day, week, month or year. * @since 1.0.0 - Migrated from WooCommerce Subscriptions v1.0 */ public static function get_subscription_period($order, $product_id = '') { } /** * Returns the billing interval for a each subscription product in an order. * * For example, this would return 3 for a subscription charged every 3 months or 1 for a subscription charged every month. * * @param mixed $order A WC_Order object or the ID of the order which the subscription was purchased in. * @param int $product_id (optional) The post ID of the subscription WC_Product object purchased in the order. Defaults to the ID of the first product purchased in the order. * @return int The billing interval for a each subscription product in an order. * @since 1.0.0 - Migrated from WooCommerce Subscriptions v1.0 */ public static function get_subscription_interval($order, $product_id = '') { } /** * Returns the length for a subscription in an order. * * There must be only one subscription in an order for this to be accurate. * * @param mixed $order A WC_Order object or the ID of the order which the subscription was purchased in. * @param int $product_id (optional) The post ID of the subscription WC_Product object purchased in the order. Defaults to the ID of the first product purchased in the order. * @return int The number of periods for which the subscription will recur. For example, a $5/month subscription for one year would return 12. A $10 every 3 month subscription for one year would also return 12. * @since 1.0.0 - Migrated from WooCommerce Subscriptions v1.0 */ public static function get_subscription_length($order, $product_id = '') { } /** * Returns the length for a subscription product's trial period as set when added to an order. * * The trial period is the same as the subscription period, as derived from @see self::get_subscription_period(). * * For now, there must be only one subscription in an order for this to be accurate. * * @param mixed $order A WC_Order object or the ID of the order which the subscription was purchased in. * @param int $product_id (optional) The post ID of the subscription WC_Product object purchased in the order. Defaults to the ID of the first product purchased in the order. * @return int The number of periods the trial period lasts for. For no trial, this will return 0, for a 3 period trial, it will return 3. * @since 1.0.0 - Migrated from WooCommerce Subscriptions v1.1 */ public static function get_subscription_trial_length($order, $product_id = '') { } /** * Returns the period (e.g. month) for a subscription product's trial as set when added to an order. * * As of 1.2.x, a subscriptions trial period may be different than the recurring period * * For now, there must be only one subscription in an order for this to be accurate. * * @param mixed $order A WC_Order object or the ID of the order which the subscription was purchased in. * @param int $product_id (optional) The post ID of the subscription WC_Product object purchased in the order. Defaults to the ID of the first product purchased in the order. * @return string A string representation of the period for the subscription, i.e. day, week, month or year. * @since 1.0.0 - Migrated from WooCommerce Subscriptions v1.2 */ public static function get_subscription_trial_period($order, $product_id = '') { } /** * Takes a subscription product's ID and returns the timestamp on which the next payment is due. * * A convenience wrapper for @see WC_Subscriptions_Manager::get_next_payment_date() to get the * next payment date for a subscription when all you have is the order and product. * * @param mixed $order A WC_Order object or the ID of the order which the subscription was purchased in. * @param int $product_id The product/post ID of the subscription * @param mixed $deprecated Never used. * @return int If no more payments are due, returns 0, otherwise returns a timestamp of the date the next payment is due. * @version 1.0.0 - Migrated from WooCommerce Subscriptions v1.2 * @since 1.0.0 - Migrated from WooCommerce Subscriptions v1.0 */ public static function get_next_payment_timestamp($order, $product_id, $deprecated = \null) { } /** * Takes a subscription product's ID and the order it was purchased in and returns the date on * which the next payment is due. * * A convenience wrapper for @see WC_Subscriptions_Manager::get_next_payment_date() to get the next * payment date for a subscription when all you have is the order and product. * * @param mixed $order A WC_Order object or the ID of the order which the subscription was purchased in. * @param int $product_id The product/post ID of the subscription * @param mixed $deprecated Never used. * @return mixed If no more payments are due, returns 0, otherwise it returns the MySQL formatted date/time string for the next payment date. * @version 1.0.0 - Migrated from WooCommerce Subscriptions v1.2 * @since 1.0.0 - Migrated from WooCommerce Subscriptions v1.0 */ public static function get_next_payment_date($order, $product_id, $deprecated = \null) { } /** * Takes a subscription product's ID and the order it was purchased in and returns the date on * which the last payment was made. * * A convenience wrapper for @see WC_Subscriptions_Manager::get_last_payment_date() to get the next * payment date for a subscription when all you have is the order and product. * * @param mixed $order A WC_Order object or the ID of the order which the subscription was purchased in. * @param int $product_id The product/post ID of the subscription * @param mixed $deprecated Never used. * @return mixed If no more payments are due, returns 0, otherwise it returns the MySQL formatted date/time string for the next payment date. * @version 1.0.0 - Migrated from WooCommerce Subscriptions v1.2.1 * @since 1.0.0 - Migrated from WooCommerce Subscriptions v1.0 */ public static function get_last_payment_date($order, $product_id) { } /** * Takes a subscription product's ID and calculates the date on which the next payment is due. * * Calculation is based on $from_date if specified, otherwise it will fall back to the last * completed payment, the subscription's start time, or the current date/time, in that order. * * The next payment date will occur after any free trial period and up to any expiration date. * * @param mixed $order A WC_Order object or the ID of the order which the subscription was purchased in. * @param int $product_id The product/post ID of the subscription * @param string $type (optional) The format for the Either 'mysql' or 'timestamp'. * @param mixed $from_date A MySQL formatted date/time string from which to calculate the next payment date, or empty (default), which will use the last payment on the subscription, or today's date/time if no previous payments have been made. * @return mixed If there is no future payment set, returns 0, otherwise it will return a date of the next payment in the form specified by $type * @since 1.0.0 - Migrated from WooCommerce Subscriptions v1.0 */ public static function calculate_next_payment_date($order, $product_id, $type = 'mysql', $from_date = '') { } /** * Returns the number of failed payments for a given subscription. * * @param WC_Order $order The WC_Order object of the order for which you want to determine the number of failed payments. * @param product_id int The ID of the subscription product. * @return string The key representing the given subscription. * @since 1.0.0 - Migrated from WooCommerce Subscriptions v1.0 */ public static function get_failed_payment_count($order, $product_id) { } /** * Returns the amount outstanding on a subscription product. * * Deprecated because the subscription outstanding balance on a subscription is no longer added and an order can contain more * than one subscription. * * @param WC_Order $order The WC_Order object of the order for which you want to determine the number of failed payments. * @param product_id int The ID of the subscription product. * @return string The key representing the given subscription. * @since 1.0.0 - Migrated from WooCommerce Subscriptions v1.0 */ public static function get_outstanding_balance($order, $product_id) { } /** * Once payment is completed on an order, set a lock on payments until the next subscription payment period. * * @param int $user_id The id of the user who purchased the subscription * @param string $subscription_key A subscription key of the form created by @see WC_Subscriptions_Manager::get_subscription_key() * @since 1.0.0 - Migrated from WooCommerce Subscriptions v1.1.2 */ public static function safeguard_scheduled_payments($order_id) { } /** * Appends the subscription period/duration string to order total * * @since 1.0.0 - Migrated from WooCommerce Subscriptions v1.0 */ public static function get_formatted_line_total($formatted_total, $item, $order) { } /** * Appends the subscription period/duration string to order subtotal * * @since 1.0.0 - Migrated from WooCommerce Subscriptions v1.0 */ public static function get_subtotal_to_display($subtotal, $compound, $order) { } /** * Appends the subscription period/duration string to order total * * @since 1.0.0 - Migrated from WooCommerce Subscriptions v1.0 */ public static function get_cart_discount_to_display($discount, $order) { } /** * Appends the subscription period/duration string to order total * * @since 1.0.0 - Migrated from WooCommerce Subscriptions v1.0 */ public static function get_order_discount_to_display($discount, $order) { } /** * Appends the subscription period/duration string to order total * * @since 1.0.0 - Migrated from WooCommerce Subscriptions v1.0 */ public static function get_formatted_order_total($formatted_total, $order) { } /** * Appends the subscription period/duration string to shipping fee * * @since 1.0.0 - Migrated from WooCommerce Subscriptions v1.0 */ public static function get_shipping_to_display($shipping_to_display, $order) { } /** * Individual totals are taken care of by filters, but taxes and fees are not, so we need to override them here. * * @since 1.0.0 - Migrated from WooCommerce Subscriptions v1.0 */ public static function get_order_item_totals($total_rows, $order) { } /** * Load Subscription related order data when populating an order * * @since 1.0.0 - Migrated from WooCommerce Subscriptions v1.4 */ public static function load_order_data($order_data) { } /** * Add request filter for order types to Woocommerce -> Orders screen * * @since 1.0.0 - Migrated from WooCommerce Subscriptions v1.5.4 */ public static function order_shipping_method($shipping_method, $order) { } /** * Returns the sign up fee for an item * * @param WC_Order $order A WC_Order object * @param int $product_id The product/post ID of a subscription * @since 1.0.0 - Migrated from WooCommerce Subscriptions v1.2 * @deprecated 1.0.0 - Migrated from WooCommerce Subscriptions v2.0 */ public static function get_item_sign_up_fee($order, $product_id = '') { } /** * Records the initial payment against a subscription. * * This function is called when a gateway calls @see WC_Order::payment_complete() and payment * is completed on an order. It is also called when an orders status is changed to completed or * processing for those gateways which never call @see WC_Order::payment_complete(), like the * core WooCommerce Cheque and Bank Transfer gateways. * * It will also set the start date on the subscription to the time the payment is completed. * * @param WC_Order|int $order A WC_Order object or ID of a WC_Order order. * @since 1.0.0 - Migrated from WooCommerce Subscriptions v1.1.2 * @deprecated 1.0.0 - Migrated from WooCommerce Subscriptions v2.0 */ public static function maybe_record_order_payment($order) { } /** * Wrapper around @see WC_Order::get_order_currency() for versions of WooCommerce prior to 2.1. * * @since 1.0.0 - Migrated from WooCommerce Subscriptions v1.4.9 * @deprecated 1.0.0 - Migrated from WooCommerce Subscriptions v2.2.0 */ public static function get_order_currency($order) { } /** * A unified API for accessing subscription order meta, especially for sign-up fee related order meta. * * Because WooCommerce 2.1 deprecated WC_Order::$order_custom_fields, this function is also used to provide * version independent meta data access to non-subscription meta data. * * Deprecated in Subscriptions Core 2.0 since we have the wcs_get_objects_property() which serves the same purpose. * * @deprecated 2.0 * @since 1.0 * * @param WC_Order|int $order The WC_Order object or ID of the order for which the meta should be sought. * @param string $meta_key The key as stored in the post meta table for the meta item. * @param mixed $default The default value to return if the meta key does not exist. Default 0. * * @return mixed Order meta data found by key. */ public static function get_meta($order, $meta_key, $default = 0) { } /** * Prints the HTML for the admin dropdown for order types to Woocommerce -> Orders screen. * * @since 6.3.0 */ private static function render_restrict_manage_subscriptions_dropdown() { } /** * Renders the contents of the "contains_subscription" column. * * This column indicates whether an order is a parent of a subscription, * a renewal order for a subscription, or a regular order. * * @since 6.3.0 * * @param integer $order_id The ID of the order in the current row. */ private static function render_contains_subscription_column_content(int $order_id) { } } /** * Individual Subscription Product API * * An API for accessing details of a subscription product. * * @package WooCommerce Subscriptions * @subpackage WC_Subscriptions_Product * @category Class * @author Brent Shepherd * @since 1.0.0 - Migrated from WooCommerce Subscriptions v1.0 */ class WC_Subscriptions_Product { /* cache the check on whether the session has an order awaiting payment for a given product */ protected static $order_awaiting_payment_for_product = array(); protected static $subscription_meta_fields = array('_subscription_price', '_subscription_sign_up_fee', '_subscription_period', '_subscription_period_interval', '_subscription_length', '_subscription_trial_period', '_subscription_trial_length'); /** * Set up the class, including it's hooks & filters, when the file is loaded. * * @since 1.0.0 - Migrated from WooCommerce Subscriptions v1.0 **/ public static function init() { } /** * Returns the raw sign up fee value (ignoring tax) by filtering the products price. * * @return string */ public static function get_sign_up_fee_filter($price, $product) { } /** * Checks a given product to determine if it is a subscription. * When the received arg is a product object, make sure it is passed into the filter intact in order to retain any properties added on the fly. * * @param int|WC_Product $product Either a product object or product's post ID. * @since 1.0.0 - Migrated from WooCommerce Subscriptions v1.0 */ public static function is_subscription($product) { } /** * Output subscription string as the price html for grouped products and make sure that * sign-up fees are taken into account for price. * * @since 1.0.0 - Migrated from WooCommerce Subscriptions v1.3.4 */ public static function get_grouped_price_html($price, $grouped_product) { } /** * Output subscription string in Gravity Form fields. * * @since 1.0.0 - Migrated from WooCommerce Subscriptions v1.1 */ public static function get_gravity_form_prices($price, $product) { } /** * Returns a string representing the details of the subscription. * * For example "$20 per Month for 3 Months with a $10 sign-up fee". * * @param WC_Product|int $product A WC_Product object or ID of a WC_Product. * @param array $inclusions An associative array of flags to indicate how to calculate the price and what to include, values: * 'tax_calculation' => false to ignore tax, 'include_tax' or 'exclude_tax' To indicate that tax should be added or excluded respectively * 'subscription_length' => true to include subscription's length (default) or false to exclude it * 'sign_up_fee' => true to include subscription's sign up fee (default) or false to exclude it * 'price' => string a price to short-circuit the price calculations and use in a string for the product * @since 1.0.0 - Migrated from WooCommerce Subscriptions v1.0 */ public static function get_price_string($product, $include = array()) { } /** * Returns the active price per period for a product if it is a subscription. * * @param mixed $product A WC_Product object or product ID * @return string The price charged per period for the subscription, or an empty string if the product is not a subscription. * @since 1.0.0 - Migrated from WooCommerce Subscriptions v1.0 */ public static function get_price($product) { } /** * Returns the sale price per period for a product if it is a subscription. * * @param mixed $product A WC_Product object or product ID * @return string * @since 1.0.0 - Migrated from WooCommerce Subscriptions v2.2.0 */ public static function get_regular_price($product, $context = 'view') { } /** * Returns the regular price per period for a product if it is a subscription. * * @param mixed $product A WC_Product object or product ID * @return string * @since 1.0.0 - Migrated from WooCommerce Subscriptions v2.2.0 */ public static function get_sale_price($product, $context = 'view') { } /** * Returns the subscription period for a product, if it's a subscription. * * @param mixed $product A WC_Product object or product ID * @return string A string representation of the period, either Day, Week, Month or Year, or an empty string if product is not a subscription. * @since 1.0.0 - Migrated from WooCommerce Subscriptions v1.0 */ public static function get_period($product) { } /** * Returns the subscription interval for a product, if it's a subscription. * * @param mixed $product A WC_Product object or product ID * @return int An integer representing the subscription interval, or 1 if the product is not a subscription or there is no interval * @since 1.0.0 - Migrated from WooCommerce Subscriptions v1.0 */ public static function get_interval($product) { } /** * Returns the length of a subscription product, if it is a subscription. * * @param mixed $product A WC_Product object or product ID * @return int An integer representing the length of the subscription, or 0 if the product is not a subscription or the subscription continues for perpetuity * @since 1.0.0 - Migrated from WooCommerce Subscriptions v1.0 */ public static function get_length($product) { } /** * Returns the trial length of a subscription product, if it is a subscription. * * @param mixed $product A WC_Product object or product ID * @return int An integer representing the length of the subscription trial, or 0 if the product is not a subscription or there is no trial * @since 1.0.0 - Migrated from WooCommerce Subscriptions v1.0 */ public static function get_trial_length($product) { } /** * Returns the trial period of a subscription product, if it is a subscription. * * @param mixed $product A WC_Product object or product ID * @return string A string representation of the period, either Day, Week, Month or Year, or an empty string if product is not a subscription or there is no trial * @since 1.0.0 - Migrated from WooCommerce Subscriptions v1.2 */ public static function get_trial_period($product) { } /** * Returns the sign-up fee for a subscription, if it is a subscription. * * @param mixed $product A WC_Product object or product ID * @return int|string The value of the sign-up fee, or 0 if the product is not a subscription or the subscription has no sign-up fee * @since 1.0.0 - Migrated from WooCommerce Subscriptions v1.0 */ public static function get_sign_up_fee($product) { } /** * Takes a subscription product's ID and returns the date on which the first renewal payment will be processed * based on the subscription's length and calculated from either the $from_date if specified, or the current date/time. * * @param int|WC_Product $product The product instance or product/post ID of a subscription product. * @param mixed $from_date A MySQL formatted date/time string from which to calculate the expiration date, or empty (default), which will use today's date/time. * @param string $type The return format for the date, either 'mysql', or 'timezone'. Default 'mysql'. * @param string $timezone The timezone for the returned date, either 'site' for the site's timezone, or 'gmt'. Default, 'site'. * @since 1.0.0 - Migrated from WooCommerce Subscriptions v2.0 */ public static function get_first_renewal_payment_date($product, $from_date = '', $timezone = 'gmt') { } /** * Takes a subscription product's ID and returns the date on which the first renewal payment will be processed * based on the subscription's length and calculated from either the $from_date if specified, or the current date/time. * * @param int|WC_Product $product The product instance or product/post ID of a subscription product. * @param mixed $from_date A MySQL formatted date/time string from which to calculate the expiration date, or empty (default), which will use today's date/time. * @param string $type The return format for the date, either 'mysql', or 'timezone'. Default 'mysql'. * @param string $timezone The timezone for the returned date, either 'site' for the site's timezone, or 'gmt'. Default, 'site'. * @since 1.0.0 - Migrated from WooCommerce Subscriptions v2.0 */ public static function get_first_renewal_payment_time($product, $from_date = '', $timezone = 'gmt') { } /** * Takes a subscription product's ID and returns the date on which the subscription product will expire, * based on the subscription's length and calculated from either the $from_date if specified, or the current date/time. * * @param int|WC_Product $product The product instance or product/post ID of a subscription product. * @param mixed $from_date A MySQL formatted date/time string from which to calculate the expiration date, or empty (default), which will use today's date/time. * @since 1.0.0 - Migrated from WooCommerce Subscriptions v1.0 */ public static function get_expiration_date($product, $from_date = '') { } /** * Takes a subscription product's ID and returns the date on which the subscription trial will expire, * based on the subscription's trial length and calculated from either the $from_date if specified, * or the current date/time. * * @param int|WC_Product $product The product instance or product/post ID of a subscription product. * @param mixed $from_date A MySQL formatted date/time string from which to calculate the expiration date (in UTC timezone), or empty (default), which will use today's date/time (in UTC timezone). * @since 1.0.0 - Migrated from WooCommerce Subscriptions v1.0 */ public static function get_trial_expiration_date($product, $from_date = '') { } /** * Checks the classname being used for a product variation to see if it should be a subscription product * variation, and if so, returns this as the class which should be instantiated (instead of the default * WC_Product_Variation class). * * @return string $classname The name of the WC_Product_* class which should be instantiated to create an instance of this product. * @since 1.0.0 - Migrated from WooCommerce Subscriptions v1.3 */ public static function set_subscription_variation_class($classname, $product_type, $post_type, $product_id) { } /** * Ensures a price is displayed for subscription variation where WC would normally ignore it (i.e. when prices are equal). * * @return array $variation_details Set of name/value pairs representing the subscription. * @since 1.0.0 - Migrated from WooCommerce Subscriptions v1.3.6 */ public static function maybe_set_variations_price_html($variation_details, $variable_product, $variation) { } /** * Do not allow any user to delete a subscription product if it is associated with an order. * * Those with appropriate capabilities can still trash the product, but they will not be able to permanently * delete the product if it is associated with an order (i.e. been purchased). * * @since 1.0.0 - Migrated from WooCommerce Subscriptions v1.4.9 */ public static function user_can_not_delete_subscription($allcaps, $caps, $args) { } /** * Make sure the 'untrash' (i.e. "Restore") row action is displayed. * * In @see self::user_can_not_delete_subscription() we prevent a store manager being able to delete a subscription product. * However, WooCommerce also uses the `delete_post` capability to check whether to display the 'trash' and 'untrash' row actions. * We want a store manager to be able to trash and untrash subscriptions, so this function adds them again. * * @return array $actions Array of actions that can be performed on the post. * @return array $post Array of post values for the current product (or post object if it is not a product). * @since 1.0.0 - Migrated from WooCommerce Subscriptions v1.4.9 */ public static function subscription_row_actions($actions, $post) { } /** * Remove the "Delete Permanently" action from the bulk actions select element on the Products admin screen. * * Because any subscription products associated with an order can not be permanently deleted (as a result of * @see self::user_can_not_delete_subscription() ), leaving the bulk action in can lead to the store manager * hitting the "You are not allowed to delete this item" brick wall and not being able to continue with the * deletion (or get any more detailed information about which item can't be deleted and why). * * @return array $actions Array of actions that can be performed on the post. * @since 1.0.0 - Migrated from WooCommerce Subscriptions v1.4.9 */ public static function subscription_bulk_actions($actions) { } /** * Check whether a product has one-time shipping only. * * @param mixed $product A WC_Product object or product ID * @return bool True if the product requires only one time shipping, false otherwise. * @since 1.0.0 - Migrated from WooCommerce Subscriptions v2.2.0 */ public static function needs_one_time_shipping($product) { } /** * Hooked to the @see 'wp_scheduled_delete' WP-Cron scheduled task to rename the '_wp_trash_meta_time' meta value * as '_wc_trash_meta_time'. This is the flag used by WordPress to determine which posts should be automatically * purged from the trash. We want to make sure Subscriptions products are not automatically purged (but still want * to keep a record of when the product was trashed). * * @since 1.0.0 - Migrated from WooCommerce Subscriptions v1.4.9 */ public static function prevent_scheduled_deletion() { } /** * Trash subscription variations - don't delete them permanently. * * This is hooked to 'wp_ajax_woocommerce_remove_variation' & 'wp_ajax_woocommerce_remove_variations' * before WooCommerce's WC_AJAX::remove_variation() or WC_AJAX::remove_variations() functions are run. * The WooCommerce functions will still run after this, but if the variation is a subscription, the * request will either terminate or in the case of bulk deleting, the variation's ID will be removed * from the $_POST. * * @since 1.0.0 - Migrated from WooCommerce Subscriptions v1.4.9 */ public static function remove_variations() { } /** * Save variation meta data when it is bulk edited from the Edit Product screen * * @param string $bulk_action The bulk edit action being performed * @param array $data An array of data relating to the bulk edit action. $data['value'] represents the new value for the meta. * @param int $variable_product_id The post ID of the parent variable product. * @param array $variation_ids An array of post IDs for the variable product's variations. * @since 1.0.0 - Migrated from WooCommerce Subscriptions v1.5.29 */ public static function bulk_edit_variations($bulk_action, $data, $variable_product_id, $variation_ids) { } /** * * Hooked to `woocommerce_product_after_variable_attributes`. * This function adds a hidden field to the backend's HTML output of product variations indicating whether the * variation is being used in subscriptions or not. * This is used by some admin JS code to prevent removal of certain variations and also display a tooltip message to the * admin. * * @param int $loop Position of the variation inside the variations loop. * @param array $variation_data Array of variation data. * @param WP_Post $variation The variation's WP post. * @since 1.0.0 - Migrated from WooCommerce Subscriptions v2.2.17 */ public static function add_variation_removal_flag($loop, $variation_data, $variation) { } /** * Processes an AJAX request to check if a product has a variation which is either sync'd or has a trial. * Once at least one variation with a trial or sync date is found, this will terminate and return true, otherwise false. * * @since 1.0.0 - Migrated from WooCommerce Subscriptions v2.0.18 */ public static function check_product_variations_for_syncd_or_trial() { } /** * Processes an AJAX request to update a product's One Time Shipping setting after a bulk variation edit has been made. * After bulk edits (variation level saving as well as variation bulk actions), variation data has been updated in the * database and therefore doesn't require the product global settings to be updated by the user for the changes to take effect. * This function, triggered after saving variations or triggering the trial length bulk action, ensures one time shipping settings * are updated after determining if one time shipping is still available to the product. * * @since 1.0.0 - Migrated from WooCommerce Subscriptions v2.0.18 */ public static function maybe_update_one_time_shipping_on_variation_edits() { } /** * Wrapper to check whether we have a product ID or product and if we have the former, return the later. * * @param mixed $product A WC_Product object or product ID * @return WC_Product * @since 1.0.0 - Migrated from WooCommerce Subscriptions v2.2.0 */ private static function maybe_get_product_instance($product) { } /** * Get a piece of subscription related meta data for a product in a version compatible way. * * @param mixed $product A WC_Product object or product ID * @param string $meta_key The string key for the meta data * @param mixed $default_value The value to return if the meta doesn't exist or isn't set * @param string $empty_handling (optional) How empty values should be handled -- can be 'use_default_value' or 'allow_empty'. Defaults to 'allow_empty' returning the empty value. * @return mixed * @since 1.0.0 - Migrated from WooCommerce Subscriptions v2.2.0 */ public static function get_meta_data($product, $meta_key, $default_value, $empty_handling = 'allow_empty') { } /** * sync variable product min/max prices with WC 3.0 * * @param WC_Product_Variable $product * @since 1.0.0 - Migrated from WooCommerce Subscriptions v2.2.0 */ public static function variable_subscription_product_sync($product) { } /** * Get an array of parent IDs from a potential child product, used to determine if a product belongs to a group. * * @param WC_Product The product object to get parents from. * @return array Parent IDs * @since 1.0.0 - Migrated from WooCommerce Subscriptions v2.2.4 */ public static function get_parent_ids($product) { } /** * Get a product's list of parent IDs which are a grouped type. * * Unlike @see WC_Subscriptions_Product::get_parent_ids(), this function will return parent products which still exist, are visible and are a grouped product. * * @param WC_Product The product object to get parents from. * @return array The product's grouped parent IDs. * @since 1.0.0 - Migrated from WooCommerce Subscriptions v2.3.0 */ public static function get_visible_grouped_parent_product_ids($product) { } /** * Gets the add to cart text for subscription products. * * @since 1.0.0 - Migrated from WooCommerce Subscriptions v3.0.7 * @return string The add to cart text. */ public static function get_add_to_cart_text() { } /** * Validates an ajax request to delete a subscription variation. * * @since 1.0.0 - Migrated from WooCommerce Subscriptions v3.x.x */ public static function validate_variation_deletion() { } /************************ * Deprecated Functions * ************************/ /** * Override the WooCommerce "Add to cart" text with "Sign up now". * * @since 1.0.0 - Migrated from WooCommerce Subscriptions v1.0 * @deprecated 1.0.0 - Migrated from WooCommerce Subscriptions v3.0.7 */ public static function add_to_cart_text($button_text, $product_type = '') { } /** * If a product is being marked as not purchasable because it is limited and the customer has a subscription, * but the current request is to resubscribe to the subscription, then mark it as purchasable. * * @since 1.0.0 - Migrated from WooCommerce Subscriptions v2.0 * @return bool */ public static function is_purchasable($is_purchasable, $product) { } /** * Check if the current session has an order awaiting payment for a subscription to a specific product line item. * * @return 2.0.13 * @return bool **/ protected static function order_awaiting_payment_for_product($product_id) { } /** * Returns the sign up fee (including tax) by filtering the products price used in * @see WC_Product::get_price_including_tax( $qty ) * * @return string */ public static function get_sign_up_fee_including_tax($product, $qty = 1) { } /** * Returns the sign up fee (excluding tax) by filtering the products price used in * @see WC_Product::get_price_excluding_tax( $qty ) * * @return string */ public static function get_sign_up_fee_excluding_tax($product, $qty = 1) { } } /** * Subscriptions Renewal Order Class * * Provides an API for creating and handling renewal orders. * * @package WooCommerce Subscriptions * @subpackage WC_Subscriptions_Order * @category Class * @author Brent Shepherd * @since 1.0.0 - Migrated from WooCommerce Subscriptions v1.2 */ class WC_Subscriptions_Renewal_Order { /** * Bootstraps the class and hooks required actions & filters. * * @since 1.0.0 - Migrated from WooCommerce Subscriptions v1.0 */ public static function init() { } /* Helper functions */ /** * Trigger a special hook for payments on a completed renewal order. * * @since 1.0.0 - Migrated from WooCommerce Subscriptions v1.5.4 */ public static function trigger_renewal_payment_complete($order_id) { } /** * Check if a given renewal order was created to replace a failed renewal order. * * @since 1.0.0 - Migrated from WooCommerce Subscriptions v1.5.12 * @param int ID of the renewal order you want to check against * @return mixed If the renewal order did replace a failed order, the ID of the fail order, else false */ public static function get_failed_order_replaced_by($renewal_order_id) { } /** * Whenever a renewal order's status is changed, check if a corresponding subscription's status should be changed * * This function is hooked to 'woocommerce_order_status_changed', rather than 'woocommerce_payment_complete', to ensure * subscriptions are updated even if payment is processed by a manual payment gateways (which would never trigger the * 'woocommerce_payment_complete' hook) or by some other means that circumvents that hook. * * @since 1.0.0 - Migrated from WooCommerce Subscriptions v2.0 */ public static function maybe_record_subscription_payment($order_id, $orders_old_status, $orders_new_status) { } /** * Add order note to subscription to record the renewal order * * @param WC_Order|int $renewal_order * @param WC_Subscription|int $subscription * @since 1.0.0 - Migrated from WooCommerce Subscriptions v2.0 */ public static function add_order_note($renewal_order, $subscription) { } /** * Do not allow customers to cancel renewal orders. * * @since 1.0.0 - Migrated from WooCommerce Subscriptions v2.0 */ public static function prevent_cancelling_renewal_orders() { } /** * Removes switch line item meta data so it isn't copied to renewal order line items * * @since 1.0.0 - Migrated from WooCommerce Subscriptions v2.0.16 * @param array $order_items * @return array $order_items */ public static function remove_switch_item_meta_keys($order_items) { } /* Deprecated functions */ /** * Generate an order to record an automatic subscription payment. * * This function is hooked to the 'process_subscription_payment' which is fired when a payment gateway calls * the @see WC_Subscriptions_Manager::process_subscription_payment() function. Because manual payments will * also call this function, the function only generates a renewal order if the @see WC_Order::payment_complete() * will be called for the renewal order. * * @param int $user_id The id of the user who purchased the subscription * @param string $subscription_key A subscription key of the form created by @see WC_Subscriptions_Manager::get_subscription_key() * @since 1.0.0 - Migrated from WooCommerce Subscriptions v1.2 * @deprecated 1.0.0 - Migrated from WooCommerce Subscriptions v2.0 */ public static function generate_paid_renewal_order($user_id, $subscription_key) { } /** * Generate an order to record a subscription payment failure. * * This function is hooked to the 'processed_subscription_payment_failure' hook called when a payment * gateway calls the @see WC_Subscriptions_Manager::process_subscription_payment_failure() * * @param int $user_id The id of the user who purchased the subscription * @param string $subscription_key A subscription key of the form created by @see WC_Subscriptions_Manager::get_subscription_key() * @since 1.0.0 - Migrated from WooCommerce Subscriptions v1.2 * @deprecated 1.0.0 - Migrated from WooCommerce Subscriptions v2.0 */ public static function generate_failed_payment_renewal_order($user_id, $subscription_key) { } /** * Generate an order to record a subscription payment. * * This function is hooked to the scheduled subscription payment hook to create a pending * order for each scheduled subscription payment. * * When a payment gateway calls the @see WC_Subscriptions_Manager::process_subscription_payment() * @see WC_Order::payment_complete() will be called for the renewal order. * * @param int $user_id The id of the user who purchased the subscription * @param string $subscription_key A subscription key of the form created by @see WC_Subscriptions_Manager::get_subscription_key() * @since 1.0.0 - Migrated from WooCommerce Subscriptions v1.2 */ public static function maybe_generate_manual_renewal_order($user_id, $subscription_key) { } /** * Get the ID of the parent order for a subscription renewal order. * * Deprecated because a subscription's details are now stored in a WC_Subscription object, not the * parent order. * * @param WC_Order|int $order The WC_Order object or ID of a WC_Order order. * @since 1.0.0 - Migrated from WooCommerce Subscriptions v1.2 * @deprecated 1.0.0 - Migrated from WooCommerce Subscriptions v2.0 */ public static function get_parent_order_id($renewal_order) { } /** * Get the parent order for a subscription renewal order. * * Deprecated because a subscription's details are now stored in a WC_Subscription object, not the * parent order. * * @param WC_Order|int $order The WC_Order object or ID of a WC_Order order. * @since 1.0.0 - Migrated from WooCommerce Subscriptions v1.2 * @deprecated 1.0.0 - Migrated from WooCommerce Subscriptions v2.0, self::get_parent_subscription() is the better function to use now as a renewal order */ public static function get_parent_order($renewal_order) { } /** * Returns the number of renewals for a given parent order * * @param int $order_id The ID of a WC_Order object. * @since 1.0.0 - Migrated from WooCommerce Subscriptions v1.2 * @deprecated 1.0.0 - Migrated from WooCommerce Subscriptions v2.0 */ public static function get_renewal_order_count($order_id) { } /** * Returns a URL including required parameters for an authenticated user to renew a subscription * * Deprecated because the use of a $subscription_key is deprecated. * * @param string $subscription_key A subscription key of the form created by @see WC_Subscriptions_Manager::get_subscription_key() * @since 1.0.0 - Migrated from WooCommerce Subscriptions v1.2 * @deprecated 1.0.0 - Migrated from WooCommerce Subscriptions v2.0 */ public static function get_users_renewal_link($subscription_key, $role = 'parent') { } /** * Returns a URL including required parameters for an authenticated user to renew a subscription by product ID. * * Deprecated because the use of a $subscription_key is deprecated. * * @param string $subscription_key A subscription key of the form created by @see WC_Subscriptions_Manager::get_subscription_key() * @since 1.0.0 - Migrated from WooCommerce Subscriptions v1.2 * @deprecated 1.0.0 - Migrated from WooCommerce Subscriptions v2.0 */ public static function get_users_renewal_link_for_product($product_id) { } /** * Check if a given subscription can be renewed. * * Deprecated because the use of a $subscription_key is deprecated. * * @param string $subscription_key A subscription key of the form created by @see WC_Subscriptions_Manager::get_subscription_key() * @param int $user_id The ID of the user who owns the subscriptions. Although this parameter is optional, if you have the User ID you should pass it to improve performance. * @since 1.0.0 - Migrated from WooCommerce Subscriptions v1.2 * @deprecated 1.0.0 - Migrated from WooCommerce Subscriptions v2.0 */ public static function can_subscription_be_renewed($subscription_key, $user_id = '') { } /** * Checks if the current request is by a user to renew their subscription, and if it is * set up a subscription renewal via the cart for the product/variation that is being renewed. * * @since 1.0.0 - Migrated from WooCommerce Subscriptions v1.2 * @deprecated 1.0.0 - Migrated from WooCommerce Subscriptions v2.0 */ public static function maybe_create_renewal_order_for_user() { } /** * When restoring the cart from the session, if the cart item contains addons, but is also * a subscription renewal, do not adjust the price because the original order's price will * be used, and this includes the addons amounts. * * @since 1.0.0 - Migrated from WooCommerce Subscriptions v1.5.5 * @deprecated 1.0.0 - Migrated from WooCommerce Subscriptions v2.0 */ public static function product_addons_adjust_price($adjust_price, $cart_item) { } /** * Created a new order for renewing a subscription product based on the details of a previous order. * * @param WC_Order|int $order The WC_Order object or ID of the order for which the a new order should be created. * @param string $product_id The ID of the subscription product in the order which needs to be added to the new order. * @param array $args (optional) An array of name => value flags: * 'new_order_role' string A flag to indicate whether the new order should become the master order for the subscription. Accepts either 'parent' or 'child'. Defaults to 'parent' - replace the existing order. * 'checkout_renewal' bool Indicates if invoked from an interactive cart/checkout session and certain order items are not set, like taxes, shipping as they need to be set in the calling function, like @see WC_Subscriptions_Checkout::filter_woocommerce_create_order(). Default false. * 'failed_order_id' int For checkout_renewal true, indicates order id being replaced * @since 1.0.0 - Migrated from WooCommerce Subscriptions v1.2 * @deprecated 1.0.0 - Migrated from WooCommerce Subscriptions v2.0 */ public static function generate_renewal_order($original_order, $product_id, $args = array()) { } /** * If a product is being marked as not purchasable because it is limited and the customer has a subscription, * but the current request is to resubscribe to the subscription, then mark it as purchasable. * * @since 1.0.0 - Migrated from WooCommerce Subscriptions v1.5 * @deprecated 1.0.0 - Migrated from WooCommerce Subscriptions v2.0 */ public static function is_purchasable($is_purchasable, $product) { } /** * Check if a given order is a subscription renewal order and optionally, if it is a renewal order of a certain role. * * @param WC_Order|int $order The WC_Order object or ID of a WC_Order order. * @param array $args (optional) An array of name => value flags: * 'order_role' string (optional) A specific role to check the order against. Either 'parent' or 'child'. * 'via_checkout' Indicates whether to check if the renewal order was via the cart/checkout process. * @since 1.0.0 - Migrated from WooCommerce Subscriptions v1.2 */ public static function is_renewal($order, $args = array()) { } /** * Returns the renewal orders for a given parent order * * @param int $order_id The ID of a WC_Order object. * @param string $output (optional) How you'd like the result. Can be 'ID' for IDs only or 'WC_Order' for order objects. * @since 1.0.0 - Migrated from WooCommerce Subscriptions v1.2 * @deprecated 1.0.0 - Migrated from WooCommerce Subscriptions v2.0 */ public static function get_renewal_orders($order_id, $output = 'ID') { } /** * Flag payment of manual renewal orders. * * This is particularly important to ensure renewals of limited subscriptions can be completed. * * @since 1.0.0 - Migrated from WooCommerce Subscriptions v1.5.5 * @deprecated 1.0.0 - Migrated from WooCommerce Subscriptions v2.0 */ public static function get_checkout_payment_url($pay_url, $order) { } /** * Process a renewal payment when a customer has completed the payment for a renewal payment which previously failed. * * @since 1.0.0 - Migrated from WooCommerce Subscriptions v1.3 * @deprecated 1.0.0 - Migrated from WooCommerce Subscriptions v2.0 */ public static function maybe_process_failed_renewal_order_payment($order_id) { } /** * If the payment for a renewal order has previously failed and is then paid, then the * @see WC_Subscriptions_Manager::process_subscription_payments_on_order() function would * never be called. This function makes sure it is called. * * @param WC_Order|int $order A WC_Order object or ID of a WC_Order order. * @since 1.0.0 - Migrated from WooCommerce Subscriptions v1.2 * @deprecated 1.0.0 - Migrated from WooCommerce Subscriptions v2.0 */ public static function process_failed_renewal_order_payment($order_id) { } /** * Records manual payment of a renewal order against a subscription. * * @param WC_Order|int $order A WC_Order object or ID of a WC_Order order. * @since 1.0.0 - Migrated from WooCommerce Subscriptions v1.2 * @deprecated 1.0.0 - Migrated from WooCommerce Subscriptions v2.0 */ public static function maybe_record_renewal_order_payment($order_id) { } /** * Records manual payment of a renewal order against a subscription. * * @param WC_Order|int $order A WC_Order object or ID of a WC_Order order. * @since 1.0.0 - Migrated from WooCommerce Subscriptions v1.2 * @deprecated 1.0.0 - Migrated from WooCommerce Subscriptions v2.0 */ public static function maybe_record_renewal_order_payment_failure($order_id) { } /** * If the payment for a renewal order has previously failed and is then paid, we need to make sure the * subscription payment function is called. * * @param int $user_id The id of the user who purchased the subscription * @param string $subscription_key A subscription key of the form created by @see WC_Subscriptions_Manager::get_subscription_key() * @since 1.0.0 - Migrated from WooCommerce Subscriptions v1.2 * @deprecated 1.0.0 - Migrated from WooCommerce Subscriptions v2.0 */ public static function process_subscription_payment_on_child_order($order_id, $payment_status = 'completed') { } /** * Adds a renewal orders section to the Related Orders meta box displayed on subscription orders. * * @deprecated 1.0.0 - Migrated from WooCommerce Subscriptions v2.0 * @since 1.0.0 - Migrated from WooCommerce Subscriptions v1.2 */ public static function renewal_orders_meta_box_section($order, $post) { } /** * Trigger a hook when a subscription suspended due to a failed renewal payment is reactivated * * @since 1.0.0 - Migrated from WooCommerce Subscriptions v1.3 */ public static function trigger_processed_failed_renewal_order_payment_hook($user_id, $subscription_key) { } } /** * Allow for payment dates to be synchronised to a specific day of the week, month or year. * * @package WooCommerce Subscriptions * @subpackage WC_Subscriptions_Sync * @category Class * @author Brent Shepherd * @since 1.0.0 - Migrated from WooCommerce Subscriptions v1.5 */ class WC_Subscriptions_Synchroniser { public static $setting_id; public static $setting_id_proration; public static $setting_id_days_no_fee; public static $post_meta_key = '_subscription_payment_sync_date'; public static $post_meta_key_day = '_subscription_payment_sync_date_day'; public static $post_meta_key_month = '_subscription_payment_sync_date_month'; public static $sync_field_label; public static $sync_description; public static $sync_description_year; public static $billing_period_ranges; // strtotime() only handles English, so can't use $wp_locale->weekday in some places protected static $weekdays = array(1 => 'Monday', 2 => 'Tuesday', 3 => 'Wednesday', 4 => 'Thursday', 5 => 'Friday', 6 => 'Saturday', 7 => 'Sunday'); /** * Bootstraps the class and hooks required actions & filters. * * @since 1.0.0 - Migrated from WooCommerce Subscriptions v1.5 */ public static function init() { } /** * Set default value of 'no' for our options. * * This only sets the default * * @author Jeremy Pry * * @param mixed $default The default value for the option. * @param string $option The option name. * @param bool $passed_default Whether get_option() was passed a default value. * * @return mixed The default option value. */ public static function option_default($default, $option, $passed_default = \null) { } /** * Sanitize our options when they are saved in the admin area. * * @author Jeremy Pry * * @param mixed $value The value being saved. * @param array $option The option data array. * * @return mixed The sanitized option value. */ public static function sanitize_option($value, $option) { } /** * Check if payment syncing is enabled on the store. * * @since 1.0.0 - Migrated from WooCommerce Subscriptions v1.5 */ public static function is_syncing_enabled() { } /** * Check if payments can be prorated on the store. * * @since 1.0.0 - Migrated from WooCommerce Subscriptions v1.5 */ public static function is_sync_proration_enabled() { } /** * Add sync settings to the Subscription's settings page. * * @since 1.0.0 - Migrated from WooCommerce Subscriptions v1.5 */ public static function add_settings($settings) { } /** * Add the sync setting fields to the Edit Product screen * * @since 1.0.0 - Migrated from WooCommerce Subscriptions v1.5 */ public static function subscription_product_fields() { } /** * Add the sync setting fields to the variation section of the Edit Product screen * * @since 1.0.0 - Migrated from WooCommerce Subscriptions v1.5 */ public static function variable_subscription_product_fields($loop, $variation_data, $variation) { } /** * Save sync options when a subscription product is saved * * @since 1.0.0 - Migrated from WooCommerce Subscriptions v1.5 */ public static function save_subscription_meta($post_id) { } /** * Save sync options when a variable subscription product is saved * * @since 1.0.0 - Migrated from WooCommerce Subscriptions v1.5 */ public static function process_product_meta_variable_subscription($post_id) { } /** * Save sync options when a variable subscription product is saved * * @since 1.0.0 - Migrated from WooCommerce Subscriptions v1.5 */ public static function save_product_variation($variation_id, $index) { } /** * Add translated syncing options for our client side script * * @since 1.0.0 - Migrated from WooCommerce Subscriptions v1.5 */ public static function admin_script_parameters($script_parameters) { } /** * Determine whether a product, specified with $product, needs to have its first payment processed on a * specific day (instead of at the time of sign-up). * * @return (bool) True is the product's first payment will be synced to a certain day. * @since 1.0.0 - Migrated from WooCommerce Subscriptions v1.5 */ public static function is_product_synced($product) { } /** * Determine whether a product, specified with $product, should have its first payment processed on a * at the time of sign-up but prorated to the sync day. * * @since 1.0.0 - Migrated from WooCommerce Subscriptions v1.5.10 * * @param WC_Product $product * * @return bool */ public static function is_product_prorated($product) { } /** * Determine whether the payment for a subscription should be the full price upfront. * * This method is particularly concerned with synchronized subscriptions. It will only return * true when the following conditions are met: * * - There is no free trial * - The subscription is synchronized * - The store owner has determined that new subscribers need to pay for their subscription upfront. * * Additionally, if the store owner sets a number of days prior to the synchronization day that do not * require an upfront payment, this method will check to see whether the current date falls within that * period for the given product. * * @author Jeremy Pry * * @param WC_Product $product The product to check. * @param string $from_date Optional. A MySQL formatted date/time string from which to calculate from. The default is an empty string which is today's date/time. * * @return bool Whether an upfront payment is required for the product. */ public static function is_payment_upfront($product, $from_date = '') { } /** * Get the day of the week, month or year on which a subscription's payments should be * synchronised to. * * @return int The day the products payments should be processed, or 0 if the payments should not be sync'd to a specific day. * @since 1.0.0 - Migrated from WooCommerce Subscriptions v1.5 */ public static function get_products_payment_day($product) { } /** * Calculate the first payment date for a synced subscription. * * The date is calculated in UTC timezone. * * @param WC_Product $product A subscription product. * @param string $type (optional) The format to return the first payment date in, either 'mysql' or 'timestamp'. Default 'mysql'. * @param string $from_date (optional) The date to calculate the first payment from in GMT/UTC timezone. If not set, it will use the current date. This should not include any trial period on the product. * @since 1.0.0 - Migrated from WooCommerce Subscriptions v1.5 */ public static function calculate_first_payment_date($product, $type = 'mysql', $from_date = '') { } /** * Return an i18n'ified associative array of sync options for 'year' as billing period * * @since 1.0.0 - Migrated from WooCommerce Subscriptions v3.0.0 */ public static function get_year_sync_options() { } /** * Return an i18n'ified associative array of all possible subscription periods. * * @since 1.0.0 - Migrated from WooCommerce Subscriptions v1.5 */ public static function get_billing_period_ranges($billing_period = '') { } /** * Add the first payment date to a products summary section * * @since 1.0.0 - Migrated from WooCommerce Subscriptions v1.5 */ public static function products_first_payment_date($echo = \false) { } /** * Return a string explaining when the first payment will be completed for the subscription. * * @since 1.0.0 - Migrated from WooCommerce Subscriptions v1.5 */ public static function get_products_first_payment_date($product) { } /** * If a product is synchronised to a date in the future, make sure that is set as the product's first payment date * * @since 1.0.0 - Migrated from WooCommerce Subscriptions v2.0 */ public static function products_first_renewal_payment_time($first_renewal_timestamp, $product_id, $from_date, $timezone) { } /** * Make sure a synchronised subscription's price includes a free trial, unless it's first payment is today. * * @since 1.0.0 - Migrated from WooCommerce Subscriptions v1.5 */ public static function maybe_set_free_trial($total = '') { } /** * Make sure a synchronised subscription's price includes a free trial, unless it's first payment is today. * * @since 1.0.0 - Migrated from WooCommerce Subscriptions v1.5 */ public static function maybe_unset_free_trial($total = '') { } /** * Check if the cart includes a subscription that needs to be synced. * * @return bool Returns true if any item in the cart is a subscription sync request, otherwise, false. * @since 1.0.0 - Migrated from WooCommerce Subscriptions v1.5 */ public static function cart_contains_synced_subscription($cart = \null) { } /** * Maybe set the time of a product's trial expiration to be the same as the synced first payment date for products where the first * renewal payment date falls on the same day as the trial expiration date, but the trial expiration time is later in the day. * * When making sure the first payment is after the trial expiration in @see self::calculate_first_payment_date() we only check * whether the first payment day comes after the trial expiration day, because we don't want to pushing the first payment date * a month or year in the future because of a few hours difference between it and the trial expiration. However, this means we * could still end up with a trial end time after the first payment time, even though they are both on the same day because the * trial end time is normally calculated from the start time, which can be any time of day, but the first renewal time is always * set to be 3am in the site's timezone. For example, the first payment date might be calculate to be 3:00 on the 21st April 2017, * while the trial end date is on the same day at 3:01 (or any time after that on the same day). So we need to check both the time and day. We also don't want to make the first payment date/time skip a year because of a few hours difference. That means we need to either modify the trial end time to be 3:00am or make the first payment time occur at the same time as the trial end time. The former is pretty hard to change, but the later will sync'd payments will be at a different times if there is a free trial ending on the same day, which could be confusing. o_0 * * Fixes #1328 * * @param mixed $trial_expiration_date MySQL formatted date on which the subscription's trial will end, or 0 if it has no trial * @param mixed $product_id The product object or post ID of the subscription product * @return mixed MySQL formatted date on which the subscription's trial is set to end, or 0 if it has no trial * @since 1.0.0 - Migrated from WooCommerce Subscriptions v2.0.13 */ public static function recalculate_product_trial_expiration_date($trial_expiration_date, $product_id) { } /** * Make sure the expiration date is calculated from the synced start date for products where the start date * will be synced. * * @param string $expiration_date MySQL formatted date on which the subscription is set to expire * @param mixed $product_id The product/post ID of the subscription * @param mixed $from_date A MySQL formatted date/time string from which to calculate the expiration date, or empty (default), which will use today's date/time. * @since 1.0.0 - Migrated from WooCommerce Subscriptions v1.5 */ public static function recalculate_product_expiration_date($expiration_date, $product_id, $from_date) { } /** * Check if a given timestamp (in the UTC timezone) is equivalent to today in the site's time. * * @param int $timestamp A time in UTC timezone to compare to today. */ public static function is_today($timestamp) { } /** * Filters WC_Subscriptions_Order::get_sign_up_fee() to make sure the sign-up fee for a subscription product * that is synchronised is returned correctly. * * @param float The initial sign-up fee charged when the subscription product in the order was first purchased, if any. * @param mixed $order A WC_Order object or the ID of the order which the subscription was purchased in. * @param int $product_id The post ID of the subscription WC_Product object purchased in the order. Defaults to the ID of the first product purchased in the order. * @return float The initial sign-up fee charged when the subscription product in the order was first purchased, if any. * @since 1.0.0 - Migrated from WooCommerce Subscriptions v2.0 */ public static function get_synced_sign_up_fee($sign_up_fee, $subscription, $product_id) { } /** * Removes the "set_subscription_prices_for_calculation" filter from the WC Product's woocommerce_get_price hook once * * @since 1.0.0 - Migrated from WooCommerce Subscriptions v1.5.10 * * @param int $price The current price. * @param WC_Product $product The product object. * * @return int */ public static function set_prorated_price_for_calculation($price, $product) { } /** * Retrieve the full translated weekday word. * * Week starts on translated Monday and can be fetched * by using 1 (one). So the week starts with 1 (one) * and ends on Sunday with is fetched by using 7 (seven). * * @since 1.0.0 - Migrated from WooCommerce Subscriptions v1.5.8 * @access public * * @param int $weekday_number 1 for Monday through 7 Sunday * @return string Full translated weekday */ public static function get_weekday($weekday_number) { } /** * Override quantities used to lower stock levels by when using synced subscriptions. If it's a synced product * that does not have proration enabled and the payment date is not today, do not lower stock levels. * * @param integer $qty the original quantity that would be taken out of the stock level * @param array $order order data * @param array $item item data for each item in the order * * @return int */ public static function maybe_do_not_reduce_stock($qty, $order, $order_item) { } /** * Adds meta on a subscription that contains a synced product. * * @since 1.0.0 - Migrated from WooCommerce Subscriptions v2.0 * * @param WC_Subscription|int Subscription object or ID. */ public static function maybe_add_subscription_meta($subscription) { } /** * When adding an item to an order/subscription via the Add/Edit Subscription administration interface, check if we should be setting * the sync meta on the subscription. * * @param int The order item ID of an item that was just added to the order * @param array The order item details * @since 1.0.0 - Migrated from WooCommerce Subscriptions v2.0 */ public static function ajax_maybe_add_meta_for_item($item_id, $item) { } /** * When adding a product to an order/subscription via the WC_Subscription::add_product() method, check if we should be setting * the sync meta on the subscription. * * @param int The post ID of a WC_Order or child object * @param int The order item ID of an item that was just added to the order * @param object The WC_Product for which an item was just added * @since 1.0.0 - Migrated from WooCommerce Subscriptions v2.0 */ public static function maybe_add_meta_for_new_product($subscription_id, $item_id, $product) { } /** * Checks if a given subscription is synced to a certain day. * * @since 1.0.0 - Migrated from WooCommerce Subscriptions v2.0 * * @param int|WC_Subscription Accepts either a subscription object or ID. * @return bool True if the subscription is synced, false otherwise. */ public static function subscription_contains_synced_product($subscription) { } /** * Alters the subscription grouping key to ensure synced products are grouped separately. * * @param string $key The subscription product's grouping key. * @param array|WC_Order_Item_Product $item The cart item or order item that the key is being generated for. * * @return string The subscription product grouping key with a synced product flag if the product is synced. */ public static function add_to_recurring_product_grouping_key($key, $item) { } /** * When adding a product line item to an order/subscription via the WC_Abstract_Order::add_product() method, check if we should be setting * the sync meta on the subscription. * * Attached to WC 3.0+ hooks and uses WC 3.0 methods. * * @param int The new line item id * @param WC_Order_Item * @param int The post ID of a WC_Subscription * @since 1.0.0 - Migrated from WooCommerce Subscriptions v2.2.3 */ public static function maybe_add_meta_for_new_line_item($item_id, $item, $subscription_id) { } /** * Store a synced product's signup fee on the line item on the subscription and order. * * When calculating prorated sign up fees during switches it's necessary to get the sign-up fee paid. * For synced product purchases we cannot rely on the order line item price as that might include a prorated recurring price or no recurring price all. * * Attached to WC 3.0+ hooks and uses WC 3.0 methods. * * @param WC_Order_Item_Product $item The order item object. * @param string $cart_item_key The hash used to identify the item in the cart * @param array $cart_item The cart item's data. * @since 1.0.0 - Migrated from WooCommerce Subscriptions v2.3.0 */ public static function maybe_add_line_item_meta($item, $cart_item_key, $cart_item) { } /** * Store a synced product's signup fee on the line item on the subscription and order. * * This function is a pre WooCommerce 3.0 version of @see WC_Subscriptions_Synchroniser::maybe_add_line_item_meta() * * @param int $item_id The order item ID. * @param array $cart_item The cart item's data. * @since 1.0.0 - Migrated from WooCommerce Subscriptions v2.3.0 */ public static function maybe_add_order_item_meta($item_id, $cart_item) { } /** * Hides synced subscription meta on the edit order and subscription screen on non-debug sites. * * @since 1.0.0 - Migrated from WooCommerce Subscriptions v2.6.2 * @param array $hidden_meta_keys the list of meta keys hidden on the edit order and subscription screen. * @return array $hidden_meta_keys */ public static function hide_order_itemmeta($hidden_meta_keys) { } /** * Gets the number of sign-up grace period days. * * @since 1.0.0 - Migrated from WooCommerce Subscriptions v3.0.6 * @return int The number of days in the grace period. 0 will be returned if the store isn't charging the full recurring price on sign-up -- a prerequisite for setting a grace period. */ private static function get_number_of_grace_period_days() { } /* Deprecated Functions */ /** * Automatically set the order's status to complete if all the subscriptions in an order * are synced and the order total is zero. * * @since 1.0.0 - Migrated from WooCommerce Subscriptions v1.5.17 */ public static function order_autocomplete($new_order_status, $order_id) { } /** * Add the first payment date to the end of the subscription to clarify when the first payment will be processed * * Deprecated because the first renewal date is displayed by default now on recurring totals. * * @since 1.0.0 - Migrated from WooCommerce Subscriptions v1.5 * @deprecated 1.0.0 - Migrated from WooCommerce Subscriptions v2.0 */ public static function customise_subscription_price_string($subscription_string) { } /** * Hid the trial period for a synchronised subscription unless the related product actually has a trial period (because * we use a trial period to set the original order totals to 0). * * Deprecated because free trials are no longer displayed on cart totals, only the first renewal date is displayed. * * @since 1.0.0 - Migrated from WooCommerce Subscriptions v1.5 * @deprecated 1.0.0 - Migrated from WooCommerce Subscriptions v2.0 */ public static function maybe_hide_free_trial($subscription_details) { } /** * Let other functions know shipping should not be charged on the initial order when * the cart contains a synchronised subscription and no other items which need shipping. * * @since 1.0.0 - Migrated from WooCommerce Subscriptions v1.5.8 * @deprecated 1.0.0 - Migrated from WooCommerce Subscriptions v2.0 */ public static function charge_shipping_up_front($charge_shipping_up_front) { } /** * Make sure anything requesting the first payment date for a synced subscription on the front-end receives * a date which takes into account the day on which payments should be processed. * * This is necessary as the self::calculate_first_payment_date() is not called when the subscription is active * (which it isn't until the first payment is completed and the subscription is activated). * * @since 1.0.0 - Migrated from WooCommerce Subscriptions v1.5 * @deprecated 1.0.0 - Migrated from WooCommerce Subscriptions v2.0 */ public static function get_first_payment_date($first_payment_date, $order, $product_id, $type) { } /** * Tell anything hooking to 'woocommerce_subscriptions_calculated_next_payment_date' * to use the synchronised first payment date as the next payment date (if the first * payment date isn't today, meaning the first payment won't be charged today). * * @since 1.0.0 - Migrated from WooCommerce Subscriptions v1.5.14 * @deprecated 1.0.0 - Migrated from WooCommerce Subscriptions v2.0 */ public static function maybe_set_payment_date($payment_date, $order, $product_id, $type) { } /** * Check if a given order included a subscription that is synced to a certain day. * * Deprecated because _order_contains_synced_subscription is no longer stored on the order @see self::subscription_contains_synced_product * * @param int $order_id The ID or a WC_Order item to check. * @return bool Returns true if the order contains a synced subscription, otherwise, false. * @since 1.0.0 - Migrated from WooCommerce Subscriptions v1.5 * @deprecated 1.0.0 - Migrated from WooCommerce Subscriptions v2.0 */ public static function order_contains_synced_subscription($order_id) { } /** * If the order being generated is for a synced subscription, keep a record of the syncing related meta data. * * Deprecated because _order_contains_synced_subscription is no longer stored on the order @see self::add_subscription_sync_meta * * @since 1.0.0 - Migrated from WooCommerce Subscriptions v1.5 * @deprecated 1.0.0 - Migrated from WooCommerce Subscriptions v2.0 */ public static function add_order_meta($order_id, $posted) { } /** * If the subscription being generated is synced, set the syncing related meta data correctly. * * Deprecated because editing a subscription's values is now done from the Edit Subscription screen. * * @since 1.0.0 - Migrated from WooCommerce Subscriptions v1.5 * @deprecated 1.0.0 - Migrated from WooCommerce Subscriptions v2.0 */ public static function prefill_order_item_meta($item, $item_id) { } /** * Filters WC_Subscriptions_Order::get_sign_up_fee() to make sure the sign-up fee for a subscription product * that is synchronised is returned correctly. * * @param float The initial sign-up fee charged when the subscription product in the order was first purchased, if any. * @param mixed $order A WC_Order object or the ID of the order which the subscription was purchased in. * @param int $product_id The post ID of the subscription WC_Product object purchased in the order. Defaults to the ID of the first product purchased in the order. * @return float The initial sign-up fee charged when the subscription product in the order was first purchased, if any. * @since 1.0.0 - Migrated from WooCommerce Subscriptions v1.5.3 * @deprecated 1.0.0 - Migrated from WooCommerce Subscriptions v2.0 */ public static function get_sign_up_fee($sign_up_fee, $order, $product_id, $non_subscription_total) { } /** * Check if the cart includes a subscription that needs to be prorated. * * @return bool Returns any item in the cart that is synced and requires proration, otherwise, false. * @since 1.0.0 - Migrated from WooCommerce Subscriptions v1.5 * @deprecated 1.0.0 - Migrated from WooCommerce Subscriptions v2.0 */ public static function cart_contains_prorated_subscription() { } /** * Maybe recalculate the trial end date for synced subscription products that contain the unnecessary * "one day trial" period. * * @since 1.0.0 - Migrated from WooCommerce Subscriptions v2.0 * @deprecated 1.0.0 - Migrated from WooCommerce Subscriptions v2.0.14 */ public static function recalculate_trial_end_date($trial_end_date, $recurring_cart, $product) { } /** * Maybe recalculate the end date for synced subscription products that contain the unnecessary * "one day trial" period. * * @since 1.0.0 - Migrated from WooCommerce Subscriptions v2.0.9 * @deprecated 1.0.0 - Migrated from WooCommerce Subscriptions v2.0.14 */ public static function recalculate_end_date($end_date, $recurring_cart, $product) { } /** * Alters the recurring cart item key to ensure synced products are grouped separately. * * @since 1.0.0 - Migrated from WooCommerce Subscriptions v2.0 * @deprecated 6.5.0 * * @param string $cart_key The recurring cart item key. * @param array $cart_item The cart item's data. * * @return string The cart item recurring cart key with a synced product flag if the product is synced. */ public static function add_to_recurring_cart_key($cart_key, $cart_item) { } } class WC_Subscriptions_Tracker { /** * Initialize the Tracker. */ public static function init() { } /** * Adds Subscriptions data to the WC tracked data. * * @param array $data * @return array all the tracking data. */ public static function add_subscriptions_tracking_data($data) { } /** * Gets the tracked Subscriptions options data. * * @return array Subscriptions options data. */ private static function get_subscriptions_options() { } /** * Gets the combined subscription dates, count, and totals data. * * @return array */ private static function get_subscriptions() { } /** * Gets subscription counts. * * @return array Subscription count by status. Keys are subscription status slugs, values are subscription counts (string). */ private static function get_subscription_counts() { } /** * Gets subscription order counts and totals. * * @return array Subscription order counts and totals by type (initial, switch, renewal, resubscribe). Values are returned as strings. */ private static function get_subscription_orders() { } /** * Gets first and last subscription created dates. * * @return array 'first' and 'last' created subscription dates as a string in the date format 'Y-m-d H:i:s' or '-'. */ private static function get_subscription_dates() { } } /** * Scheduler for subscription events that uses the Action Scheduler * * @class WCS_Action_Scheduler * @version 1.0.0 - Migrated from WooCommerce Subscriptions v2.0.0 * @package WooCommerce Subscriptions/Classes * @category Class * @author Prospress */ class WCS_Action_Scheduler extends \WCS_Scheduler { /** * An internal cache of action hooks and corresponding date types. * * This variable has been deprecated and will be removed completely in the future. You should use WCS_Action_Scheduler::get_scheduled_action_hook() and WCS_Action_Scheduler::get_date_types_to_schedule() instead. * * @deprecated 1.0.0 - Migrated from WooCommerce Subscriptions v2.6.0 * @var array An array of $action_hook => $date_type values */ protected $action_hooks = array('woocommerce_scheduled_subscription_trial_end' => 'trial_end', 'woocommerce_scheduled_subscription_payment' => 'next_payment', 'woocommerce_scheduled_subscription_payment_retry' => 'payment_retry', 'woocommerce_scheduled_subscription_expiration' => 'end'); /** * Maybe set a schedule action if the new date is in the future * * @param object $subscription An instance of a WC_Subscription object * @param string $date_type Can be 'trial_end', 'next_payment', 'payment_retry', 'end', 'end_of_prepaid_term' or a custom date type * @param string $datetime A MySQL formatted date/time string in the GMT/UTC timezone. */ public function update_date($subscription, $date_type, $datetime) { } /** * Delete a date from the action scheduler queue * * @param object $subscription An instance of a WC_Subscription object * @param string $date_type Can be 'trial_end', 'next_payment', 'end', 'end_of_prepaid_term' or a custom date type */ public function delete_date($subscription, $date_type) { } /** * When a subscription's status is updated, maybe schedule an event * * @param object $subscription An instance of a WC_Subscription object * @param string $date_type Can be 'trial_end', 'next_payment', 'end', 'end_of_prepaid_term' or a custom date type * @param string $datetime A MySQL formatted date/time string in the GMT/UTC timezone. */ public function update_status($subscription, $new_status, $old_status) { } /** * Get the hook to use in the action scheduler for the date type * * @param object $subscription An instance of WC_Subscription to get the hook for * @param string $date_type Can be 'trial_end', 'next_payment', 'expiration', 'end_of_prepaid_term' or a custom date type */ protected function get_scheduled_action_hook($subscription, $date_type) { } /** * Get the args to set on the scheduled action. * * @param string $date_type Can be 'trial_end', 'next_payment', 'expiration', 'end_of_prepaid_term' or a custom date type * @param object $subscription An instance of WC_Subscription to get the hook for * @return array Array of name => value pairs stored against the scheduled action. */ protected function get_action_args($date_type, $subscription) { } /** * Get the args to set on the scheduled action. * * @param string $$action_hook Name of event used as the hook for the scheduled action. * @param array $action_args Array of name => value pairs stored against the scheduled action. */ protected function unschedule_actions($action_hook, $action_args) { } } /** * Class for integrating with WooCommerce Blocks * * @package WooCommerce Subscriptions * @since 1.0.0 - Migrated from WooCommerce Subscriptions v3.1.0 */ class WCS_Blocks_Integration implements \Automattic\WooCommerce\Blocks\Integrations\IntegrationInterface { /** * The name of the integration. * * @return string */ public function get_name() { } /** * When called invokes any initialization/setup for the integration. */ public function initialize() { } /** * Returns an array of script handles to enqueue in the frontend context. * * @return string[] */ public function get_script_handles() { } /** * Returns an array of script handles to enqueue in the editor context. * * @return string[] */ public function get_editor_script_handles() { } /** * An array of key, value pairs of data made available to the block on the client side. * * @return array */ public function get_script_data() { } /** * Get the file modified time as a cache buster if we're in dev mode. * * @param string $file Local path to the file. * @return string The cache buster value to use for the given file. */ protected function get_file_version($file) { } /** * Fetches the place order button text if it has been overridden by one of Woo Subscription's methods. * * @return string|null The overridden place order button text or null if it hasn't been overridden. */ protected function get_place_order_button_text_override() { } } /** * Subscription Cached Data Manager Class * * @class WCS_Cached_Data_Manager * @version 1.0.0 - Migrated from WooCommerce Subscriptions v2.3.0 * @since 1.0.0 - Migrated from WooCommerce Subscriptions v2.1.2 * @package WooCommerce Subscriptions/Classes * @category Class * @author Prospress */ class WCS_Cached_Data_Manager extends \WCS_Cache_Manager { /** * @var WC_Logger_Interface|null */ public $logger = \null; public function __construct() { } /** * Attaches logger */ public function load_logger() { } /** * Wrapper function around WC_Logger->log * * @param string $message Message to log */ public function log($message) { } /** * Helper function for fetching cached data or updating and storing new data provided by callback. * * @param string $key The key to cache/fetch the data with * @param string|array $callback name of function, or array of class - method that fetches the data * @param array $params arguments passed to $callback * @param integer $expires number of seconds to keep the cache. Don't set it to 0, as the cache will be autoloaded. Default is a week. * * @return bool|mixed */ public function cache_and_get($key, $callback, $params = array(), $expires = \WEEK_IN_SECONDS) { } /** * Clearing cache when a post is deleted * * @param int $post_id The ID of a post * @param WP_Post $post The post object (on certain hooks). */ public function purge_delete($post_id, $post = \null) { } /** * When subscription related metadata is added / deleted / updated on an order, we need to invalidate the subscription related orders cache. * * @param $meta_id integer the ID of the meta in the meta table * @param $object_id integer the ID of the post we're updating on, only concerned with order IDs * @param $meta_key string the meta_key in the table, only concerned with the '_customer_user' key * @param $meta_value mixed the ID of the subscription that relates to the order */ public function purge_from_metadata($meta_id, $object_id, $meta_key, $meta_value) { } /** * Wrapper function to clear the cache that relates to related orders * * @param null $subscription_id * @deprecated 1.0.0 - Migrated from WooCommerce Subscriptions v2.3.0 */ protected function clear_related_order_cache($subscription_id) { } /** * Delete cached data with key * * @param string $key Key that needs deleting * * @return bool */ public function delete_cached($key) { } /** * If the log is bigger than a threshold it will be * truncated to 0 bytes. */ public static function cleanup_logs() { } /** * Check once each week if the log file has exceeded the limits. * * @since 1.0.0 - Migrated from WooCommerce Subscriptions v2.2.9 */ public function initialize_cron_check_size() { } /** * Add a weekly schedule for clearing up the cache * * @param $scheduled array * @since 1.0.0 - Migrated from WooCommerce Subscriptions v2.2.9 */ function add_weekly_cron_schedule($schedules) { } /** * Purge the cache for the subscription's user. * * @author Jeremy Pry * * @param int $subscription_id The subscription to purge. */ protected function purge_subscription_user_cache($subscription_id) { } } /** * Handles the initial payment for a pending subscription via the cart. * * @package WooCommerce Subscriptions * @subpackage WCS_Cart_Initial_Payment * @category Class * @author Prospress * @since 1.0.0 - Migrated from WooCommerce Subscriptions v2.0 */ class WCS_Cart_Initial_Payment extends \WCS_Cart_Renewal { /* The flag used to indicate if a cart item is for a initial payment */ public $cart_item_key = 'subscription_initial_payment'; /** * Bootstraps the class and hooks required actions & filters. * * @since 1.0.0 - Migrated from WooCommerce Subscriptions v2.0 */ public function __construct() { } /** * Setup the cart for paying for a delayed initial payment for a subscription. * * @since 1.0.0 - Migrated from WooCommerce Subscriptions v2.0 */ public function maybe_setup_cart() { } /** * Checks the cart to see if it contains an initial payment item. * * @return bool | Array The cart item containing the initial payment, else false. * @since 1.0.0 - Migrated from WooCommerce Subscriptions v2.0.13 */ protected function cart_contains() { } /** * Get the order object used to construct the initial payment cart. * * @param Array The initial payment cart item. * @return WC_Order | The order object * @since 1.0.0 - Migrated from WooCommerce Subscriptions v2.0.13 */ protected function get_order($cart_item = '') { } /** * Determines if the cart should honor the grandfathered subscription/order line item total. * * @since 1.0.0 - Migrated from WooCommerce Subscriptions v3.0.10 * * @param array $cart_item The cart item to check. * @return bool Whether the cart should honor the order's prices. */ public function should_honor_subscription_prices($cart_item) { } } /** * Implement resubscribing to a subscription via the cart. * * Resubscribing is a similar process to renewal via checkout (which is why this class extends WCS_Cart_Renewal), only it: * - creates a new subscription with similar terms to the existing subscription, where as a renewal resumes the existing subscription * - is for an expired or cancelled subscription only. * * @package WooCommerce Subscriptions * @subpackage WCS_Cart_Resubscribe * @category Class * @author Prospress * @since 1.0.0 - Migrated from WooCommerce Subscriptions v2.0 */ class WCS_Cart_Resubscribe extends \WCS_Cart_Renewal { /* The flag used to indicate if a cart item is a renewal */ public $cart_item_key = 'subscription_resubscribe'; /** * Bootstraps the class and hooks required actions & filters. * * @since 1.0.0 - Migrated from WooCommerce Subscriptions v2.0 */ public function __construct() { } /** * Checks if the current request is by a user to resubcribe to a subscription, and if it is setup a * subscription resubcribe process via the cart for the product/variation/s that are being renewed. * * @since 1.0.0 - Migrated from WooCommerce Subscriptions v2.0 */ public function maybe_setup_cart() { } /** * When creating an order at checkout, if the checkout is to resubscribe to an expired or cancelled * subscription, make sure we record that on the order and new subscription. * * @since 1.0.0 - Migrated from WooCommerce Subscriptions v2.0 */ public function maybe_record_resubscribe($new_subscription, $order, $recurring_cart) { } /** * Restore renewal flag when cart is reset and modify Product object with renewal order related info * * @since 1.0.0 - Migrated from WooCommerce Subscriptions v2.0 */ public function get_cart_item_from_session($cart_item_session_data, $cart_item, $key) { } /** * If a product is being marked as not purchasable because it is limited and the customer has a subscription, * but the current request is to resubscribe to the subscription, then mark it as purchasable. * * @since 1.0.0 - Migrated from WooCommerce Subscriptions v2.0 * @return bool */ public function is_purchasable($is_purchasable, $product) { } /** * Checks the cart to see if it contains a subscription resubscribe item. * * @see wcs_cart_contains_resubscribe() * @param WC_Cart $cart The cart object to search in. * @return bool | Array The cart item containing the renewal, else false. * @since 1.0.0 - Migrated from WooCommerce Subscriptions v2.0.10 */ protected function cart_contains($cart = '') { } /** * Get the subscription object used to construct the resubscribe cart. * * @param Array The resubscribe cart item. * @return WC_Subscription | The subscription object. * @since 1.0.0 - Migrated from WooCommerce Subscriptions v2.0.13 */ protected function get_order($cart_item = '') { } /** * Make sure that a resubscribe item's cart key is based on the end of the pre-paid term if the user already has a subscription that is pending-cancel, not the date calculated for the product. * * @since 1.0.0 - Migrated from WooCommerce Subscriptions v2.1 */ public function get_recurring_cart_key($cart_key, $cart_item) { } /** * Make sure when displaying the next payment date for a subscription, the date takes into * account the end of the pre-paid term if the user is resubscribing to a subscription that is pending-cancel. * * @since 1.0.0 - Migrated from WooCommerce Subscriptions v2.1 */ public function recurring_cart_next_payment_date($first_renewal_date, $cart) { } /** * Make sure resubscribe cart item price doesn't include any recurring amount by setting a free trial. * * @since 1.0.0 - Migrated from WooCommerce Subscriptions v2.1 * @param mixed $total This parameter is unused. Its sole purpose is for returning an unchanged variable while setting the mock trial when hooked onto filters. Optional. * @return mixed $total The unchanged $total parameter. */ public function maybe_set_free_trial($total = '') { } /** * Remove mock free trials from resubscribe cart items. * * @since 1.0.0 - Migrated from WooCommerce Subscriptions v2.1 * @param mixed $total This parameter is unused. Its sole purpose is for returning an unchanged variable while unsetting the mock trial when hooked onto filters. Optional. * @return mixed $total The unchanged $total parameter. */ public function maybe_unset_free_trial($total = '') { } /** * When the user resubscribes to a subscription that is pending-cancel, cancel the existing subscription. * * @since 1.0.0 - Migrated from WooCommerce Subscriptions v2.1 */ public function maybe_cancel_existing_subscription($order_id, $old_order_status, $new_order_status) { } /** * Overrides the place order button text on the checkout when the cart contains only resubscribe requests. * * @since 1.0.0 - Migrated from WooCommerce Subscriptions v3.1.0 * * @param string $place_order_text The place order button text. * @return string The place order button text. 'Resubscribe' if the cart contains only resubscribe requests, otherwise the default. */ public function order_button_text($place_order_text) { } /** * Determines if the customer is resubscribe prior to the subscription being cancelled. * * @since 1.0.0 - Migrated from WooCommerce Subscriptions v3.1.0 * * @param WC_Subscription $subscription * @return bool */ private function is_pre_cancelled_resubscribe($subscription) { } /** * Checks if the current user can resubscribe to the subscription. * * @since 1.6.3 * * @param WC_Subscription $subscription The WC subscription to validate the current user against. * @return bool Whether the current user can resubscribe to the subscription. */ public function validate_current_user($subscription) { } } /** * Class to handle everything to do with changing a payment method for a subscription on the * edit subscription admin page. * * @class WCS_Change_Payment_Method_Admin * @version 1.0.0 - Migrated from WooCommerce Subscriptions v2.0 * @package WooCommerce Subscriptions/Includes * @category Class * @author Prospress */ class WCS_Change_Payment_Method_Admin { /** * Display the edit payment gateway option under * * @since 1.0.0 - Migrated from WooCommerce Subscriptions v2.0 */ public static function display_fields($subscription) { } /** * Get the new payment data from POST and check the new payment method supports * the new admin change hook. * * @since 1.0.0 - Migrated from WooCommerce Subscriptions v2.0 * @param $subscription WC_Subscription */ public static function save_meta($subscription) { } /** * Get a list of possible gateways that a subscription could be changed to by admins. * * @since 1.0.0 - Migrated from WooCommerce Subscriptions v2.0 * @param $subscription int | WC_Subscription * @return */ public static function get_valid_payment_methods($subscription) { } } /** * Subscriptions Custom Order Item Manager * * @author Prospress * @since 1.0.0 - Migrated from WooCommerce Subscriptions v2.6.0 */ class WCS_Custom_Order_Item_Manager { /** * The custom line item types managed by this class. * * @var array Each item type should have: * - A 'group' arg which is registered with WC_Abstract_Order::get_items() APIs via the woocommerce_order_type_to_group hook. * - A 'class' arg which WooCommerce's WC_Abstract_Order::get_item() APIs will use to instantiate the line item object. * - Optional. A 'data_store' arg. If provided, the line item will use this data store to load the line item data. Default is WC_Order_Item_Product_Data_Store. */ protected static $line_item_type_args = array('line_item_removed' => array('group' => 'removed_line_items', 'class' => 'WC_Subscription_Line_Item_Removed'), 'line_item_switched' => array('group' => 'switched_line_items', 'class' => 'WC_Subscription_Line_Item_Switched'), 'coupon_pending_switch' => array('group' => 'pending_switch_coupons', 'class' => 'WC_Subscription_Item_Coupon_Pending_Switch', 'data_store' => 'WC_Order_Item_Coupon_Data_Store'), 'fee_pending_switch' => array('group' => 'pending_switch_fees', 'class' => 'WC_Subscription_Item_Fee_Pending_Switch', 'data_store' => 'WC_Order_Item_Fee_Data_Store')); /** * Initialise class hooks & filters when the file is loaded * * @since 1.0.0 - Migrated from WooCommerce Subscriptions v2.6.0 */ public static function init() { } /** * Adds extra groups. * * @param array $type_to_group_list Existing list of types and their groups * @return array $type_to_group_list * @since 1.0.0 - Migrated from WooCommerce Subscriptions v2.6.0 */ public static function add_extra_groups($type_to_group_list) { } /** * Maps the classname for extra items. * * @param string $classname * @param string $item_type * @return string $classname * @since 1.0.0 - Migrated from WooCommerce Subscriptions v2.6.0 */ public static function map_classname_for_extra_items($classname, $item_type) { } /** * Register the data stores to be used for our custom line item types. * * @param array $data_stores The registered data stores. * @return array * @since 1.0.0 - Migrated from WooCommerce Subscriptions v2.6.0 */ public static function register_data_stores($data_stores) { } } class WCS_Dependent_Hook_Manager { /** * An array of callbacks which need to be attached on for certain WC versions. * * @var array */ protected static $dependent_callbacks = array(); /** * Initialise the class. * * @since 1.0.0 - Migrated from WooCommerce Subscriptions v2.6.0 */ public static function init() { } /** * Attach all the WooCommerce version dependent hooks. * * This attaches all the hooks registered via @see add_woocommerce_dependent_action() * if the WooCommerce version requirements are met. * * @since 1.0.0 - Migrated from WooCommerce Subscriptions v2.6.0 */ public static function attach_woocommerce_dependent_hooks() { } /** * Attach function callback if a certain WooCommerce version is present. * * @since 1.0.0 - Migrated from WooCommerce Subscriptions v2.6.0 * * @param string $tag The action or filter tag to attach the callback too. * @param string|array $function The callable function to attach to the hook. * @param string $woocommerce_version The WooCommerce version to do a compare on. For example '3.0.0'. * @param string $operator The version compare operator to use. @see https://www.php.net/manual/en/function.version-compare.php * @param integer $priority The priority to attach this callback to. * @param integer $number_of_args The number of arguments to pass to the callback function */ public static function add_woocommerce_dependent_action($tag, $function, $woocommerce_version, $operator, $priority = 10, $number_of_args = 1) { } } class WCS_Download_Handler { /** * Initialize filters and hooks for class. * * @since 1.0.0 - Migrated from WooCommerce Subscriptions v2.0 */ public static function init() { } /** * Attach hooks that depend on WooCommerce being loaded. * * @since 5.2 */ public static function attach_wc_dependent_hooks() { } /** * Save the download permissions on the individual subscriptions as well as the order. Hooked into * 'woocommerce_grant_product_download_permissions', which is strictly after the order received all the info * it needed, so we don't need to play with priorities. * * @param integer $order_id the ID of the order. At this point it is guaranteed that it has files in it and that it hasn't been granted permissions before */ public static function save_downloadable_product_permissions($order_id) { } /** * Revokes download permissions from permissions table if a file has permissions on a subscription. If a product has * multiple files, all permissions will be revoked from the original order. * * @param int $product_id the ID for the product (the downloadable file) * @param int $order_id the ID for the original order * @param int $user_id the user we're removing the permissions from * @return boolean true on success, false on error */ public static function revoke_downloadable_file_permission($product_id, $order_id, $user_id) { } /** * WooCommerce's function receives the original order ID, the item and the list of files. This does not work for * download permissions stored on the subscription rather than the original order as the URL would have the wrong order * key. This function takes the same parameters, but queries the database again for download ids belonging to all the * subscriptions that were in the original order. Then for all subscriptions, it checks all items, and if the item * passed in here is in that subscription, it creates the correct download link to be passed to the email. * * @param array $files List of files already included in the list * @param array $item An item (you get it by doing $order->get_items()) * @param WC_Order $order The original order * @return array List of files with correct download urls */ public static function get_item_downloads($files, $item, $order) { } /** * Repairs a glitch in WordPress's save function. You cannot save a null value on update, see * https://github.com/woocommerce/woocommerce/issues/7861 for more info on this. * * @param integer $id The ID of the subscription */ public static function repair_permission_data($id) { } /** * Gives customers access to downloadable products in a subscription. * Hooked into 'woocommerce_admin_created_subscription' to grant permissions to admin created subscriptions. * * @param WC_Subscription $subscription * @since 1.0.0 - Migrated from WooCommerce Subscriptions v2.4.2 */ public static function grant_download_permissions($subscription) { } /** * Remove download permissions attached to a subscription when it is permanently deleted. * * @since 1.0.0 - Migrated from WooCommerce Subscriptions v2.0 * * @param $id The ID of the subscription whose downloadable product permission being deleted. */ public static function delete_subscription_permissions($id) { } /** * Remove download permissions attached to a subscription when it is permanently deleted. * * @since 5.2.0 * * @param $id The ID of the subscription whose downloadable product permission being deleted. */ public static function delete_subscription_download_permissions($id) { } /** * Grant downloadable file access to any newly added files on any existing subscriptions * which don't have existing permissions pre WC3.0 and all subscriptions post WC3.0. * * @param int $product_id * @param int $variation_id * @param array $downloadable_files product downloadable files * @since 1.0.0 - Migrated from WooCommerce Subscriptions v2.0.18 */ public static function grant_new_file_product_permissions($product_id, $variation_id, $downloadable_files) { } /** * When adding new downloadable content to a subscription product, check if we don't * want to automatically add the new downloadable files to the subscription or initial and renewal orders. * * @deprecated 1.0.0 - Migrated from WooCommerce Subscriptions v4.0.0 * * @param bool $grant_access * @param string $download_id * @param int $product_id * @param WC_Order $order * @return bool * @since 1.0.0 - Migrated from WooCommerce Subscriptions v2.0 */ public static function maybe_revoke_immediate_access($grant_access, $download_id, $product_id, $order) { } } class WCS_Failed_Scheduled_Action_Manager { /** * Action hooks we're interested in tracking. * * @var array */ protected $tracked_scheduled_actions = array('woocommerce_scheduled_subscription_trial_end' => 1, 'woocommerce_scheduled_subscription_payment' => 1, 'woocommerce_scheduled_subscription_payment_retry' => 1, 'woocommerce_scheduled_subscription_expiration' => 1, 'woocommerce_scheduled_subscription_end_of_prepaid_term' => 1); /** * WC Logger instance for logging messages. * * @var WC_Logger */ protected $logger; /** * Exceptions caught by WC while this class is listening to the `woocommerce_caught_exception` action. * * @var Exception[] */ protected $exceptions = []; /** * Constructor. * * @param WC_Logger_Interface $logger The WC Logger instance. * * @since 1.0.0 - Migrated from WooCommerce Subscriptions v2.2.19 */ public function __construct(\WC_Logger_Interface $logger) { } /** * Attach callbacks. * * @since 1.0.0 - Migrated from WooCommerce Subscriptions v2.2.19 */ public function init() { } /** * Log a message to the failed-scheduled-actions log. * * @since 1.0.0 - Migrated from WooCommerce Subscriptions v2.2.19 * * @param string $message the message to be written to the log. * @param array $context the context to be included in the log. Optional. Default is an empty array. */ protected function log($message, $context = []) { } /** * When a scheduled action failure is triggered, log information about the failed action to a WC logger. * * @param int $action_id The ID of the action which failed. * @param int|Exception|array $error The number of seconds an action timeouts out after or the exception/error that caused the error/shutdown. * @since 1.0.0 - Migrated from WooCommerce Subscriptions v2.2.19 */ public function log_action_scheduler_failure($action_id, $error) { } /** * Creates a new exception listener when processing subscription-related scheduled actions. * * @param int $action_id The ID of the scheduled action being ran. */ public function maybe_attach_exception_listener($action_id) { } /** * Adds an exception to the list of exceptions caught by WC. * * @param Exception $exception The exception that was caught. */ public function handle_exception($exception) { } /** * Clears the list of exceptions caught by WC and detaches the listener. * * This function is called directly and attached to an action that runs after a scheduled action has finished being executed. */ public function clear_exceptions_and_detach_listener() { } /** * Display an admin notice when a scheduled action failure has occurred. * * @since 1.0.0 - Migrated from WooCommerce Subscriptions v2.2.19 */ public function maybe_show_admin_notice() { } /** * Handle requests to disable the failed scheduled actions admin notice. * * @since 1.0.0 - Migrated from WooCommerce Subscriptions v2.2.19 */ protected function maybe_disable_admin_notice() { } /** * Retrieve a user friendly description of the scheduled action from the action hook. * * @param string $hook the scheduled action hook * @return string * @since 1.0.0 - Migrated from WooCommerce Subscriptions v2.2.19 */ protected function get_action_hook_label($hook) { } /** * Retrieve a list of scheduled action args as a string. * * @param mixed $args the scheduled action args * @return string * @since 1.0.0 - Migrated from WooCommerce Subscriptions v2.2.19 */ protected function get_action_args_string($args) { } /** * Get a scheduled action object * * @param int $action_id the scheduled action ID * @return ActionScheduler_Action * @since 1.0.0 - Migrated from WooCommerce Subscriptions v2.2.19 */ protected function get_action($action_id) { } /** * Generates a message from an exception. * * @param Exception $exception The exception to generate a message from. * @return string The message. */ protected function get_message_from_exception($exception) { } /** * Generates a message from an error array. * * The $error variable is obtained from get_last_error() and has standard keys message, file and line. * * @param array $error The error data to generate a message from. * @return string The message including the file and line number if available.s */ protected function get_message_from_error($error) { } /** * Generates the additional context data that will be recorded with the error log entry. * The context includes the action args, a backtrace and any exception messages caught. * * @param ActionScheduler_Action $action The ActionScheduler_Action that failed. * @param int|Exception|array $error The error data that caused the failure. */ protected function get_context_from_action_error($action, $error) { } } class WCS_Renewal_Cart_Stock_Manager { /** * Bootstraps the class and hooks required actions & filters. * * @since 1.0.0 - Migrated from WooCommerce Subscriptions v2.6.0 */ public static function attach_callbacks() { } /** * Attaches filters that allow a manual renewal to add to the cart an otherwise out of stock product. * * Hooked onto 'wcs_before_renewal_setup_cart_subscription'. * * @since 1.0.0 - Migrated from WooCommerce Subscriptions v2.6.0 * * @param WC_Subscription $subscription The subscription object. This param is unused. It is the first parameter of the hook. * @param WC_Order $order The renewal order object. */ public static function maybe_adjust_stock_cart($subscription, $order) { } /** * Attaches filters that allow manual renewal carts to pass checkout validity checks for an otherwise out of stock product. * * @since 1.0.0 - Migrated from WooCommerce Subscriptions v2.6.0 */ public static function maybe_adjust_stock_checkout() { } /** * Attaches stock override filters for out of stock renewal products. * * @since 1.0.0 - Migrated from WooCommerce Subscriptions v2.6.0 * @param WC_Order $order Renewal order. */ protected static function maybe_attach_stock_filters($order) { } /** * Adjusts the stock status of a product that is an out-of-stock renewal. * * @since 1.0.0 - Migrated from WooCommerce Subscriptions v2.6.0 * * @param bool $is_in_stock Whether the product is in stock or not * @param WC_Product $product The product which stock is being checked * * @return bool $is_in_stock */ public static function adjust_is_in_stock($is_in_stock, $product) { } /** * Adjusts whether backorders are allowed so out-of-stock renewal item products bypass stock validation. * * @since 1.0.0 - Migrated from WooCommerce Subscriptions v2.6.0 * * @param bool $backorders_allowed If the product has backorders enabled. * @param int $product_id The product ID. * @param WC_Product $product The product on which stock management is being changed. * * @return bool $backorders_allowed Whether backorders are allowed. */ public static function adjust_backorder_status($backorders_allowed, $product_id, $product) { } /** * Removes the filters that adjust stock on out of stock renewals items. * * @since 1.0.0 - Migrated from WooCommerce Subscriptions v2.6.0 */ public static function remove_filters() { } /** * Determines if the cart contains a renewal order with a specific product. * * @since 1.0.0 - Migrated from WooCommerce Subscriptions v2.6.0 * @param WC_Product $product The product object to look for. * @return bool Whether the cart contains a renewal order to the given product. */ protected static function cart_contains_renewal_to_product($product) { } /** * Gets the renewal order from the cart. * * @since 1.0.0 - Migrated from WooCommerce Subscriptions v2.6.0 * @return WC_Order|bool Renewal order obtained from the cart contents or false if the cart doesn't contain a renewal order. */ protected static function get_order_from_cart() { } /** * Gets the renewal order from order-pay query vars. * * @since 1.0.0 - Migrated from WooCommerce Subscriptions v2.6.0 * @return WC_Order|bool Renewal order obtained from query vars or false if not set. */ protected static function get_order_from_query_vars() { } } class WCS_Initial_Cart_Stock_Manager extends \WCS_Renewal_Cart_Stock_Manager { /** * Bootstraps the class and hooks required actions & filters. * * @since 1.0.0 - Migrated from WooCommerce Subscriptions v3.0.6 */ public static function attach_callbacks() { } /** * Gets the parent order from the cart. * * @since 1.0.0 - Migrated from WooCommerce Subscriptions v3.0.6 * @return WC_Order|bool Parent order obtained from the cart contents or false if the cart doesn't contain a parent order which has handled stock. */ protected static function get_order_from_cart() { } /** * Gets the parent order from order-pay query vars. * * @since 1.0.0 - Migrated from WooCommerce Subscriptions v3.0.6 * @return WC_Order|bool Parent order obtained from query vars or false if not set or if no handling is required. */ protected static function get_order_from_query_vars() { } /** * Checks if an order has already reduced stock. * * @since 1.0.0 - Migrated from WooCommerce Subscriptions v3.0.6 * @param WC_Order $order * @return bool Whether the order has reduced stock. */ protected static function has_handled_stock($order) { } } /** * A class to make it possible to limit a subscription product. * * @package WooCommerce Subscriptions * @category Class * @since 1.0.0 - Migrated from WooCommerce Subscriptions v2.1 */ class WCS_Limiter { /* cache whether a given product is purchasable or not to save running lots of queries for the same product in the same request */ protected static $is_purchasable_cache = array(); /* cache the check on whether the session has an order awaiting payment for a given product */ protected static $order_awaiting_payment_for_product = array(); public static function init() { } /** * Adds limit options to 'Edit Product' screen. * * @since 1.0.0 - Migrated from WooCommerce Subscriptions v2.1, Moved from WC_Subscriptions_Admin */ public static function admin_edit_product_fields() { } /** * Canonical is_purchasable method to be called by product classes. * * @since 1.0.0 - Migrated from WooCommerce Subscriptions v2.1 * @param bool $purchasable Whether the product is purchasable as determined by parent class * @param mixed $product The product in question to be checked if it is purchasable. * * @return bool */ public static function is_purchasable($purchasable, $product) { } /** * If a product is limited and the customer already has a subscription, mark it as not purchasable. * * @since 1.0.0 - Migrated from WooCommerce Subscriptions v2.1, Moved from WC_Subscriptions_Product * @return bool */ public static function is_purchasable_product($is_purchasable, $product) { } /** * If a product is being marked as not purchasable because it is limited and the customer has a subscription, * but the current request is to switch the subscription, then mark it as purchasable. * * @since 1.0.0 - Migrated from WooCommerce Subscriptions v2.1, Moved from WC_Subscriptions_Switcher::is_purchasable * @return bool */ public static function is_purchasable_switch($is_purchasable, $product) { } /** * Determines whether a product is purchasable based on whether the cart is to resubscribe or renew. * * @since 1.0.0 - Migrated from WooCommerce Subscriptions v2.1, Combines WCS_Cart_Renewal::is_purchasable and WCS_Cart_Resubscribe::is_purchasable * @return bool */ public static function is_purchasable_renewal($is_purchasable, $product) { } /** * Check if the current session has an order awaiting payment for a subscription to a specific product line item. * * @since 1.0.0 - Migrated from WooCommerce Subscriptions v2.1.0 * @param int $product_id The product to look for a subscription awaiting payment. * @return bool **/ protected static function order_awaiting_payment_for_product($product_id) { } /** * Filters the order statuses that enable the order again button and functionality. * * This function will return no statuses if the order contains non purchasable or limited products. * * @since 1.0.0 - Migrated from WooCommerce Subscriptions v3.0.2 * * @param array $statuses The order statuses that enable the order again button. * @return array $statuses An empty array if the order contains limited products, otherwise the default statuses are returned. */ public static function filter_order_again_statuses_for_limited_subscriptions($statuses) { } /** * Gets a list of the customer subscriptions to a product with a particular limited status. * * @param WC_Product|int $product The product object or product ID. * @param int $user_id The user's ID. * @param string $limit_status The limit status. * * @return WC_Subscription[] An array of a customer's subscriptions with a specific status and product. */ protected static function get_user_subscriptions_to_product($product, $user_id, $limit_status) { } } class WCS_Modal { /** * The content to display inside the modal body. * * Can be plain text, raw HTML, a template file path or a PHP callback function. * * @var string */ private $content; /** * The type of content to display. * * Can be 'plain-text', 'html', 'template' or 'callback'. * * @var string */ private $content_type; /** * A selector of the element which triggers the modal to be displayed. * * @var string */ private $trigger = ''; /** * The modal heading. * * @var string */ private $heading = ''; /** * The modal actions. * * @var array */ private $actions = array(); /** * Registers the scripts and stylesheets needed to display the modals. * * The required files will only be enqueued once. Subsequent calls will do nothing. * * @since 1.0.0 - Migrated from WooCommerce Subscriptions v2.6.0 */ public static function register_scripts_and_styles() { } /** * Enqueues the modal scripts and styles. * * @since 1.0.0 - Migrated from WooCommerce Subscriptions v2.6.0 */ public static function enqueue_scripts_and_styles() { } /** * Constructor. * * @since 1.0.0 - Migrated from WooCommerce Subscriptions v2.6.0 * * @param string|callable $content The content to display in the modal. This should be a string when $content_type is either 'plain-text' or 'html', * a WooCommerce template filename when $content_type is 'template' or a function that echoes out the content when $content_type is 'callback'. * @param string $trigger A jQuery selector of the element which triggers the modal to be displayed. * @param string $content_type Optional. The modal content type. Can be 'plain-text', 'html', 'template' or 'callback'. Default is 'plain-text'. * @param string $heading Optional. The modal heading text. * @param array $actions Optional. An array of actions to add to the modal. See {@see 'WCS_Modal::add_action'} for details on the action array format. */ function __construct($content, $trigger, $content_type = 'plain-text', $heading = '', $actions = array()) { } /** * Prints the modal HTML. * * @since 1.0.0 - Migrated from WooCommerce Subscriptions v2.6.0 */ public function print_html() { } /** * Prints the modal inner content. * * @since 1.0.0 - Migrated from WooCommerce Subscriptions v2.6.0 */ public function print_content() { } /** * Determines if the modal has a heading. * * @since 1.0.0 - Migrated from WooCommerce Subscriptions v2.6.0 * * @return bool */ public function has_heading() { } /** * Determines if the modal has actions. * * @since 1.0.0 - Migrated from WooCommerce Subscriptions v2.6.0 * * @return bool */ public function has_actions() { } /** * Adds a button or link action which will be printed in the modal footer. * * @since 1.0.0 - Migrated from WooCommerce Subscriptions v2.6.0 * * @param array $action_args { * Action button or link details. * * @type string $type Optional. The element type. Can be 'button' or 'a'. Default 'a' (link element). * @type array $attributes Optional. An array of HTML attributes in a array( 'attribute' => 'value' ) format. The value can also be an array of attribute values. Default is empty array. * @type string $text Optional. The text should appear inside the button or a tag. Default is empty string. * } */ public function add_action($action_args) { } /** * Returns the modal heading. * * @since 1.0.0 - Migrated from WooCommerce Subscriptions v2.6.0 * * @return string */ public function get_heading() { } /** * Returns the array of actions. * * @since 1.0.0 - Migrated from WooCommerce Subscriptions v2.6.0 * * @return array The modal actions. */ public function get_actions() { } /** * Returns the modal's trigger selector. * * @since 1.0.0 - Migrated from WooCommerce Subscriptions v2.6.0 * * @return string The trigger element's selector. */ public function get_trigger() { } /** * Returns a flattened string of HTML element attributes from an array of attributes and values. * * @since 1.0.0 - Migrated from WooCommerce Subscriptions v2.6.0 * * @param array $attributes An array of attributes in a array( 'attribute' => 'value' ) or array( 'attribute' => array( 'value', 'value ) ). * @return string */ public function get_attribute_string($attributes) { } } /** * Class for managing Auto Renew Toggle on View Subscription page of My Account * * @package WooCommerce Subscriptions * @category Class * @author Prospress * @since 1.0.0 - Migrated from WooCommerce Subscriptions v2.5.0 */ class WCS_My_Account_Auto_Renew_Toggle { /** * The auto-renewal toggle setting ID. * * @var string */ protected static $setting_id; /** * Initialize filters and hooks for class. * * @since 1.0.0 - Migrated from WooCommerce Subscriptions v2.5.0 */ public static function init() { } /** * Check all conditions for whether auto-renewal can be changed is possible * * @param WC_Subscription $subscription The subscription for which the checks for auto-renewal needs to be made * @return boolean * @since 1.0.0 - Migrated from WooCommerce Subscriptions v2.5.0 */ public static function can_subscription_auto_renewal_be_changed($subscription) { } /** * Determines if a subscription is eligible for toggling auto renewal and whether the user, or current user has permission to do so. * * @since 1.0.0 - Migrated from WooCommerce Subscriptions v3.0.1 * * @param WC_Subscription $subscription The subscription to check if auto renewal is allowed. * @param int $user_id The user ID to check if they have permission. Optional. Default is current user. * * @return bool Whether the subscription can be toggled and the user has the permission to do so. */ public static function can_user_toggle_auto_renewal($subscription, $user_id = 0) { } /** * Disable auto renewal of subscription * * @since 1.0.0 - Migrated from WooCommerce Subscriptions v2.5.0 */ public static function disable_auto_renew() { } /** * Enable auto renewal of subscription * * @since 1.0.0 - Migrated from WooCommerce Subscriptions v2.5.0 */ public static function enable_auto_renew() { } /** * Send a response after processing the AJAX request so the page can be updated. * * @param WC_Subscription $subscription */ protected static function send_ajax_response($subscription) { } /** * Add a setting to allow store managers to enable or disable the auto-renewal toggle. * * @param array $settings * @return array * @since 1.0.0 - Migrated from WooCommerce Subscriptions v2.5.0 */ public static function add_setting($settings) { } /** * Checks if the store has enabled the auto-renewal toggle. * * @return bool true if the toggle is enabled, otherwise false. * @since 1.0.0 - Migrated from WooCommerce Subscriptions v2.5.0 */ public static function is_enabled() { } } /** * Manage the process of deleting, adding, assigning default payment tokens associated with automatic subscriptions * * @package WooCommerce Subscriptions * @category Class * @author Prospress * @since 1.0.0 - Migrated from WooCommerce Subscriptions v2.2.7 */ class WCS_My_Account_Payment_Methods { /** * Initialize filters and hooks for class. * * @since 1.0.0 - Migrated from WooCommerce Subscriptions v2.2.7 */ public static function init() { } /** * Add additional query args to delete token URLs which are being used for subscription automatic payments. * * @param array data about the token including a list of actions which can be triggered by the customer from their my account page * @param WC_Payment_Token payment token object * @return array payment token data * @since 1.0.0 - Migrated from WooCommerce Subscriptions v2.2.7 */ public static function flag_subscription_payment_token_deletions($payment_token_data, $payment_token) { } /** * Update subscriptions using a deleted token to use a new token. Subscriptions with the * old token value stored in post meta will be updated using the same meta key to use the * new token value. * * @param int $deleted_token_id The deleted token id. * @param WC_Payment_Token $deleted_token The deleted token object. * @since 1.0.0 - Migrated from WooCommerce Subscriptions v2.2.7 */ public static function maybe_update_subscriptions_payment_meta($deleted_token_id, $deleted_token) { } /** * Get a WC_Payment_Token label. eg Visa ending in 1234 * * @deprecated 1.0.0 - Migrated from WooCommerce Subscriptions v2.7.2 * * @param WC_Payment_Token payment token object * @return string WC_Payment_Token label * @since 1.0.0 - Migrated from WooCommerce Subscriptions v2.2.7 */ public static function get_token_label($token) { } /** * Display a notice when a customer sets a new default token notifying them of what this means for their subscriptions. * * @param int $default_token_id The default token id. * @param WC_Payment_Token $default_token The default token object. * @since 1.0.0 - Migrated from WooCommerce Subscriptions v2.3.3 */ public static function display_default_payment_token_change_notice($default_token_id, $default_token) { } /** * Update the customer's subscription tokens if they opted to from their My Account page. * * @since 1.0.0 - Migrated from WooCommerce Subscriptions v2.3.3 */ public static function update_subscription_tokens() { } /** * Enqueues the frontend scripts for the My account > Payment methods page. * * @since 1.0.0 - Migrated from WooCommerce Subscriptions v3.1.0 */ public static function enqueue_frontend_scripts() { } /** * Prints an error notice stub, to be used when a customer attempts to delete a payment token used by a subscription. * * @see self::enqueue_frontend_scripts() For the error message content. * @see self::flag_subscription_payment_token_deletions() For the determination of when a token cannot be deleted. * * @since 1.0.0 - Migrated from WooCommerce Subscriptions v3.1.0 */ public static function print_deleting_notices() { } /** * Get subscriptions by a WC_Payment_Token. All automatic subscriptions with the token's payment method, * customer id and token value stored in post meta will be returned. * * @since 1.0.0 - Migrated from WooCommerce Subscriptions v2.2.7 * @deprecated 1.0.0 - Migrated from WooCommerce Subscriptions v2.5.0 */ public static function get_subscriptions_by_token($payment_token) { } /** * Get a list of customer payment tokens. Caches results to avoid multiple database queries per request * * @since 1.0.0 - Migrated from WooCommerce Subscriptions v2.2.7 * @deprecated 1.0.0 - Migrated from WooCommerce Subscriptions v2.5.0 */ public static function get_customer_tokens($gateway_id = '', $customer_id = '') { } /** * Get the customer's alternative token. * * @since 1.0.0 - Migrated from WooCommerce Subscriptions v2.2.7 * @deprecated 1.0.0 - Migrated from WooCommerce Subscriptions v2.5.0 */ public static function get_customers_alternative_token($token) { } /** * Determine if the customer has an alternative token. * * @since 1.0.0 - Migrated from WooCommerce Subscriptions v2.2.7 * @deprecated 1.0.0 - Migrated from WooCommerce Subscriptions v2.5.0 */ public static function customer_has_alternative_token($token) { } } /** * Class for managing caches of post meta. * * This class is intended to be used on stores using WP post architecture. * Post related APIs and references in this class are expected, and shouldn't be replaced with CRUD equivalents. * * @version 1.0.0 - Migrated from WooCommerce Subscriptions v2.3.0 * @category Class */ class WCS_Post_Meta_Cache_Manager { /** @var string The post type this cache manage acts on. */ protected $post_type; /** @var array The post meta keys this cache manager should act on. */ protected $meta_keys; /** * Constructor * * @param string The post type this cache manage acts on. * @param array The post meta keys this cache manager should act on. */ public function __construct($post_type, $meta_keys) { } /** * Attach callbacks to keep related order caches up-to-date. */ public function init() { } /** * Check if the post meta change is one to act on or ignore, based on the post type and meta key being changed. * * One gotcha here: the 'delete_post_metadata' hook can be triggered with a $post_id of null. This is done when * meta is deleted by key (i.e. delete_post_meta_by_key()) or when meta is being deleted for a specific value for * all posts (as done by wp_delete_attachment() to remove the attachment from posts). To handle these cases, * we only check the post type when the $post_id is non-null. * * @param int $post_id The post the meta is being changed on. * @param string $meta_key The post meta key being changed. * @return bool False if the change should not be ignored, true otherwise. */ protected function is_change_to_ignore($post_id, $meta_key = '') { } /* Callbacks for post meta hooks */ /** * When post meta is added, check if this class instance cares about updating its cache * to reflect the change. * * @param int $meta_id The ID of the post meta row in the database. * @param int $post_id The post the meta is being changed on. * @param string $meta_key The post meta key being changed. * @param mixed $meta_value The value being set in the database. */ public function meta_added($meta_id, $post_id, $meta_key, $meta_value) { } /** * When post meta is deleted, check if this class instance cares about updating its cache * to reflect the change. * * @param int $meta_id The ID of the post meta row in the database. * @param int $post_id The post the meta is being changed on. * @param string $meta_key The post meta key being changed. * @param mixed $meta_value The value being delete from the database. */ public function meta_deleted($meta_id, $post_id, $meta_key, $meta_value) { } /** * When post meta is updated from a previous value, check if this class instance cares about * updating its cache to reflect the change. * * @param mixed $check Whether to update the meta or not. By default, this is null, meaning it will be updated. Callbacks may override it to prevent that. * @param int $post_id The post the meta is being changed on. * @param string $meta_key The post meta key being changed. * @param mixed $meta_value The new value being saved in the database. * @param mixed $prev_value The previous value stored in the database. * @return mixed $check This method is attached to the "update_{$meta_type}_metadata" filter, which is used as a pre-check on whether to update meta data, so it needs to return the $check value passed in. */ public function meta_updated_with_previous($check, $post_id, $meta_key, $meta_value, $prev_value) { } /** * When post meta is updated, check if this class instance cares about updating its cache * to reflect the change. * * @param int $meta_id The ID of the post meta row in the database. * @param int $post_id The post the meta is being changed on. * @param string $meta_key The post meta key being changed. * @param mixed $meta_value The value being deleted from the database. */ public function meta_updated($meta_id, $post_id, $meta_key, $meta_value) { } /** * When all post meta rows for a given key are about to be deleted, check if this class instance * cares about updating its cache to reflect the change. * * WordPress has special handling for meta deletion on all posts rather than a specific post ID. * This method handles that case. * * @param mixed $check Whether to delete the meta or not. By default, this is null, meaning it will be deleted. Callbacks may override it to prevent that. * @param int $post_id The post the meta is being changed on. * @param string $meta_key The post meta key being changed. * @param mixed $meta_value The value being deleted from the database. * @param bool $delete_all Whether meta data is being deleted on all posts, not a specific post. * @return mixed $check This method is attached to the "update_{$meta_type}_metadata" filter, which is used as a pre-check on whether to update meta data, so it needs to return the $check value passed in. */ public function meta_deleted_all($check, $post_id, $meta_key, $meta_value, $delete_all) { } /* Callbacks for post hooks */ /** * When a post object is restored from the trash, check if this class instance cares about updating its cache * to reflect the change. * * @param int $post_id The post being restored. */ public function post_untrashed($post_id) { } /** * When a post object is deleted or trashed, check if this class instance cares about updating its cache * to reflect the change. * * @param int $post_id The post being restored. */ public function post_deleted($post_id) { } /** * When a post object is changed, check if this class instance cares about updating its cache * to reflect the change. * * @param string $update_type The type of update to check. Only 'add' or 'delete' should be used. * @param int $post_id The post being changed. * @throws InvalidArgumentException If the given update type is not 'add' or 'delete'. */ protected function maybe_update_for_post_change($update_type, $post_id) { } /** * When post data is changed, check if this class instance cares about updating its cache * to reflect the change. * * @param string $update_type The type of update to check. Only 'add' or 'delete' should be used. * @param int $post_id The post the meta is being changed on. * @param string $meta_key The post meta key being changed. * @param mixed $meta_value The meta value. * @param mixed $prev_value The previous value stored in the database. Optional. */ protected function maybe_trigger_update_cache_hook($update_type, $post_id, $meta_key, $meta_value, $prev_value = '') { } /** * Trigger a hook to allow 3rd party code to update its cache for data that it cares about. * * @param string $update_type The type of update to check. Only 'add' or 'delete' should be used. * @param int $post_id The post the meta is being changed on. * @param string $meta_key The post meta key being changed. * @param mixed $meta_value The meta value. * @param mixed $prev_value The previous value stored in the database. Optional. */ protected function trigger_update_cache_hook($update_type, $post_id, $meta_key, $meta_value, $prev_value = '') { } /** * Trigger a hook to allow 3rd party code to delete its cache for data that it cares about. * * @param string $meta_key The post meta key being changed. */ protected function trigger_delete_all_caches_hook($meta_key) { } /** * Abstract the check against get_post_type() so that it can be mocked for unit tests. * * @param int $post_id Post ID or post object. * @return bool Whether the post type for the given post ID is the post type this instance manages. */ protected function is_managed_post_type($post_id) { } } /** * Class for managing caches of object data. * * This class will track changes to an object (specified by the object type value) and trigger an action hook for each change to any specific meta key or object (specified by the $data_keys variable). * Interested parties (like our cache store classes), can then listen for these hooks and update their caches accordingly. * * @version 5.2.0 * @category Class */ class WCS_Object_Data_Cache_Manager extends \WCS_Post_Meta_Cache_Manager { /** * The WC_Data object type this cache manager will track changes to. eg 'order', 'subscription'. * * @var string */ protected $object_type; /** * The object's data keys this cache manager will keep track of changes to. Can be an object property key ('customer_id') or meta key ('_subscription_renewal'). * * @var array */ protected $data_keys; /** * An internal record of changes to the object that this manager is tracking. * * This internal record is generated before the object is saved, so we can determine * if the value has changed, what the previous value was, and what the new value is. * * In the event that the object is being created (doesn't have an ID prior to save), this * record will be generated after the object is saved, and all the data this manager * is tracking will be pulled from the created object. * * @var array Each element is keyed by the object's ID, and contains an array of tracked changes { * Data about the change that was made to the object. * * @type mixed $new The new value. * @type mixed $previous The previous value before it was changed. * @type string $type The type of change. Can be 'update', 'add' or 'delete'. * } */ protected $object_changes = []; /** * Constructor. * * @param string The post type this cache manage acts on. * @param array The post meta keys this cache manager should act on. */ public function __construct($object_type, $data_keys) { } /** * Attaches callbacks to keep the caches up-to-date. */ public function init() { } /** * Generates a set of changes for tracked meta keys and properties. * * This method is hooked onto an action which is fired before the object is saved. * Relevant changes to the object's data is stored in the $this->object_changes property * to be processed after the object is saved. See $this->action_object_cache_changes(). * * @param WC_Data $object The object which is being saved. * @param string $generate_type Optional. The data to generate the changes from. Defaults to 'changes_only' which will generate the data from changes to the object. 'all_fields' will fetch data from the object for all tracked data keys. */ public function prepare_object_changes($object, $generate_type = 'changes_only') { } /** * Actions all the tracked data changes that were made to the object by triggering the update cache hook. * * This method is hooked onto an action which is fired after the object is saved. * * @param WC_Data $object The object which was saved. */ public function action_object_cache_changes($object) { } /** * When an object is restored from the trash, action on object changes. * * @param int $object_id The object id being restored. */ public function untrashed($object_id) { } /** * When an object is to be deleted, prepare object changes to update all fields * and mark those changes as deletes. * * @param int $object_id The id of the object being deleted. * @param mixed $object The object being deleted. */ public function prepare_object_to_be_deleted($object_id, $object) { } /** * When an object is trashed, action on object changes. * * @param int $object_id The id of object being restored. */ public function trashed($object_id) { } /** * When an object has been deleted, trigger update cache hook on all the object changes. * We cannot use action_object_cache_changes(), which requires an object, here because * object has been deleted. * * @param int $object_id The id of the object being deleted. */ public function deleted($object_id) { } /** * Triggers the update cache hook for an object change. * * @param WC_Data $object The object that was changed. * @param string $key The object's key that was changed. Can be a base property ('customer_id') or a meta key ('_subscription_renewal'). * @param array $change { * Data about the change that was made to the object. * * @type mixed $new The new value. * @type mixed $previous The previous value before it was changed. * @type string $type The type of change. Can be 'update', 'add' or 'delete'. * } */ protected function trigger_update_cache_hook_from_change($object, $key, $change) { } /** * Fetches an instance of the object with the given ID. * * @param int $object_id The ID of the object to fetch. * * @return mixed The object instance, or null if it doesn't exist. */ private function get_object($id) { } } /** * Class for managing caches of object data that have a many-to-one relationship. * * This applies to caches where only one should exist for the meta value. This differs to WCS_Object_Data_Cache_Manager * which allows multiple caches for the same meta value i.e. a many-to-many relationship. * * @version 5.2.0 * @category Class */ class WCS_Object_Data_Cache_Manager_Many_To_One extends \WCS_Object_Data_Cache_Manager { /** * Triggers the update cache hook for an object change. * * In a one-to-many relationship, we need to pass the previous value to the hook so that * any existing relationships are also deleted because we know the data should not allow * relationships with multiple other values. e.g. a subscription can only belong to one customer. * * @param WC_Data $object The object that was changed. * @param string $key The object's key that was changed. Can be a base property ('customer_id') or a meta key ('_subscription_renewal'). * @param array $change { * Data about the change that was made to the object. * * @type mixed $new The new value. * @type mixed $previous The previous value before it was changed. * @type string $type The type of change. Can be 'update', 'add' or 'delete'. * } */ protected function trigger_update_cache_hook_from_change($object, $key, $change) { } } /** * A class to sort objects by an object property. * * @author Prospress * @category Class * @package WooCommerce Subscriptions * @since 1.0.0 - Migrated from WooCommerce Subscriptions v2.6.0 */ class WCS_Object_Sorter { /** * The object property to compare. * * Used to generate the getter by prepending the 'get_' prefix. For example id -> get_id() * * @var string A valid object property. Could be 'date_created', 'date_modified', 'date_paid', 'date_completed' or 'id' for WC_Order or WC_Subscription objects, for example. */ protected $sort_by_property = ''; /** * Constructor. * * @since 1.0.0 - Migrated from WooCommerce Subscriptions v2.6.0 * * @param string $property The object property to use in comparisons. This will be used to generate the object getter by prepending 'get_'. */ public function __construct($property) { } /** * Compares two objects using the @see $this->sort_by_property getter. * * Designed to be used by uasort(), usort() or uksort() functions. * * @since 1.0.0 - Migrated from WooCommerce Subscriptions v2.6.0 * * @param object $object_one * @param object $object_two * @return int 0. -1 or 1 Depending on the result of the comparison. */ public function ascending_compare($object_one, $object_two) { } /** * Compares two objects using the @see $this->sort_by_property getter in reverse order. * * Designed to be used by uasort(), or usort() style functions. * * @since 1.0.0 - Migrated from WooCommerce Subscriptions v2.6.0 * * @param object $object_one * @param object $object_two * @return int 0. -1 or 1 Depending on the result of the comparison. */ public function descending_compare($object_one, $object_two) { } } class WCS_Payment_Tokens extends \WC_Payment_Tokens { // A cache of a customer's payment tokens to avoid running multiple queries in the same request. protected static $customer_tokens = array(); /** * Update the subscription payment meta to change from an old payment token to a new one. * * @param WC_Subscription $subscription The subscription to update. * @param WC_Payment_Token $new_token The new payment token. * @param WC_Payment_Token $old_token The old payment token. * @return bool Whether the subscription was updated or not. */ public static function update_subscription_token($subscription, $new_token, $old_token) { } /** * Get all payment meta on a subscription for a gateway. * * @param WC_Subscription $subscription The subscription to update. * @param string $gateway_id The target gateway ID. * @return bool|array Payment meta data. False if no meta is found. * @since 1.0.0 - Migrated from WooCommerce Subscriptions v2.5.0 */ public static function get_subscription_payment_meta($subscription, $gateway_id) { } /** * Get subscriptions by a WC_Payment_Token. All automatic subscriptions with the token's payment method, * customer id and token value stored in post meta will be returned. * * @param WC_Payment_Token $payment_token Payment token object. * @return array subscription posts * @since 1.0.0 - Migrated from WooCommerce Subscriptions v2.5.0 */ public static function get_subscriptions_from_token($payment_token) { } /** * Get a list of customer payment tokens. Caches results to avoid multiple database queries per request * * @param int (optional) The customer id - defaults to the current user. * @param string (optional) Gateway ID for getting tokens for a specific gateway. * @return array of WC_Payment_Token objects. * @since 1.0.0 - Migrated from WooCommerce Subscriptions v2.2.7 */ public static function get_customer_tokens($customer_id = '', $gateway_id = '') { } /** * Get the customer's alternative token. * * @param WC_Payment_Token $token The token to find an alternative for. * @return WC_Payment_Token The customer's alternative token. * @since 1.0.0 - Migrated from WooCommerce Subscriptions v2.2.7 */ public static function get_customers_alternative_token($token) { } /** * Determine if the customer has an alternative token. * * @param WC_Payment_Token $token Payment token object. * @return bool * @since 1.0.0 - Migrated from WooCommerce Subscriptions v2.2.7 */ public static function customer_has_alternative_token($token) { } } /** * Class WCS_Permalink_Manager */ class WCS_Permalink_Manager { /** * If the notice has been trigger, set to true to avoid duplicate notices. * * @var bool * @since 1.0.0 - Migrated from WooCommerce Subscriptions v2.5.3 */ protected static $notice_triggered = \false; /** * The options saved in DB related to permalinks. * * @var array * @since 1.0.0 - Migrated from WooCommerce Subscriptions v2.5.3 */ protected static $permalink_options = array('woocommerce_myaccount_subscriptions_endpoint', 'woocommerce_myaccount_view_subscription_endpoint', 'woocommerce_myaccount_subscription_payment_method_endpoint'); /** * Hooks. * * @since 1.0.0 - Migrated from WooCommerce Subscriptions v2.5.3 */ public static function init() { } /** * Validates that we're not passing the same endpoint. * * @param mixed $value The new desired value. * @param string $option The option being updated. * @param mixed $old_value The previous option value. * * @return mixed * @since 1.0.0 - Migrated from WooCommerce Subscriptions v2.5.3 */ public static function maybe_allow_permalink_update($value, $option, $old_value) { } /** * Display a warning informing that the endpoints changes has been ignored. * * @since 1.0.0 - Migrated from WooCommerce Subscriptions v2.5.3 */ protected static function show_duplicate_permalink_notice() { } } /** * Class for managing caches of post meta data that have a many-to-one relationship, meaning * only one cache should exist for the meta value. This differs to WCS_Post_Meta_Cache_Manager * which allows multiple caches for the same meta value i.e. a many-to-many relationship. * * @version 1.0.0 - Migrated from WooCommerce Subscriptions v2.3.0 * @category Class * @author Prospress */ class WCS_Post_Meta_Cache_Manager_Many_To_One extends \WCS_Post_Meta_Cache_Manager { /** * When post meta is updated, check if this class instance cares about updating its cache * to reflect the change. Always pass the previous value, to make sure that any existing * relationships are also deleted because we know the data should not allow relationships * with multiple other values. e.g. a subscription can only belong to one customer. * * @param int $meta_id The ID of the post meta row in the database. * @param int $post_id The post the meta is being changed on. * @param string $meta_key The post meta key being changed. * @param mixed $meta_value The value being deleted from the database. */ public function meta_updated($meta_id, $post_id, $meta_key, $meta_value) { } } /** * WooCommerce Subscriptions Query Handler * * @version 1.0.0 - Migrated from WooCommerce Subscriptions v2.0 * @author Prospress */ class WCS_Query extends \WC_Query { public function __construct() { } /** * Init query vars by loading options. * * @since 1.0.0 - Migrated from WooCommerce Subscriptions v2.0 */ public function init_query_vars() { } /** * Changes page title on view subscription page * * @param string $title original title * @return string changed title */ public function change_endpoint_title($title) { } /** * Hooks onto `woocommerce_endpoint_{$endpoint}_title` to return the correct page title for subscription endpoints * in My Account. * * @param string $title * @param string $endpoint * @return string * * @since 1.0.0 - Migrated from WooCommerce Subscriptions v3.0.10 */ public function change_my_account_endpoint_title($title, $endpoint) { } /** * Insert the new endpoint into the My Account menu. * * @param array $items * @return array */ public function add_menu_items($menu_items) { } /** * Changes the URL for the subscriptions endpoint when there's only one user subscription. * * @since 1.0.0 - Migrated from WooCommerce Subscriptions v2.2.17 * @param string $url * @param string $endpoint * @return string */ public function maybe_redirect_to_only_subscription($url, $endpoint) { } /** * Endpoint HTML content. * * @param int $current_page */ public function endpoint_content($current_page = 1) { } /** * Check if the current query is for a type we want to override. * * @param string $query_var the string for a query to check for * @return bool */ protected function is_query($query_var) { } /** * Fix for endpoints on the homepage * * Based on WC_Query->pre_get_posts(), but only applies the fix for endpoints on the homepage from it * instead of duplicating all the code to handle the main product query. * * @param mixed $q query object */ public function pre_get_posts($q) { } /** * Redirect to order-pay flow for Subscription Payment Method endpoint. * * @param WP_Query $query WordPress query object * @since 1.0.0 - Migrated from WooCommerce Subscriptions v2.5.0 */ public function maybe_redirect_payment_methods($query) { } /** * Reset the woocommerce_myaccount_view_subscriptions_endpoint option name to woocommerce_myaccount_view_subscription_endpoint * * @return mixed Value set for the option * @since 1.0.0 - Migrated from WooCommerce Subscriptions v2.2.18 */ private function get_view_subscription_endpoint() { } /** * Add UI option for changing Subscription endpoints in WC settings * * @param mixed $account_settings * @return mixed $account_settings */ public function add_endpoint_account_settings($settings) { } /** * Get endpoint URL. * * Gets the URL for an endpoint, which varies depending on permalink settings. * * @param string $endpoint * @param string $value * @param string $permalink * * @return string $url */ public function get_endpoint_url($url, $endpoint, $value = '', $permalink = '') { } /** * Hooks into `woocommerce_get_query_vars` to make sure query vars defined in * this class are also considered `WC_Query` query vars. * * @param array $query_vars * @return array * @since 1.0.0 - Migrated from WooCommerce Subscriptions v2.3.0 */ public function add_wcs_query_vars($query_vars) { } /** * Adds `is-active` class to Subscriptions label when we're viewing a single Subscription. * * @param array $classes The classes present in the current endpoint. * @param string $endpoint The endpoint/label we're filtering. * * @return array * @since 1.0.0 - Migrated from WooCommerce Subscriptions v2.5.6 */ public function maybe_add_active_class($classes, $endpoint) { } /** * Adds endpoint breadcrumb when viewing subscription. * * Deprecated as we now use the `woocommerce_endpoint_{$endpoint}_title` hook which automatically integrates with * breadcrumb generation. * * @param array $crumbs already assembled breadcrumb data * @return array $crumbs if we're on a view-subscription page, then augmented breadcrumb data * * @deprecated 1.0.0 - Migrated from WooCommerce Subscriptions v3.0.10 */ public function add_breadcrumb($crumbs) { } } /** * Subscriptions Remove Item * * * @author Prospress * @since 1.0.0 - Migrated from WooCommerce Subscriptions v2.0 */ class WCS_Remove_Item { /** * Initialise class hooks & filters when the file is loaded * * @since 1.0.0 - Migrated from WooCommerce Subscriptions v2.0 */ public static function init() { } /** * Returns the link used to remove an item from a subscription * * @param int $subscription_id * @param int $order_item_id * @since 1.0.0 - Migrated from WooCommerce Subscriptions v2.0 */ public static function get_remove_url($subscription_id, $order_item_id) { } /** * Returns the link to undo removing an item from a subscription * * @param int $subscription_id * @param int $order_item_id * @param string $base_url * @since 1.0.0 - Migrated from WooCommerce Subscriptions v2.0 */ public static function get_undo_remove_url($subscription_id, $order_item_id, $base_url) { } /** * Process the remove or re-add a line item from a subscription request. * * @since 1.0.0 - Migrated from WooCommerce Subscriptions v2.0 */ public static function maybe_remove_or_add_item_to_subscription() { } /** * Validate the incoming request to either remove an item or add and item back to a subscription that was previously removed. * Add an descriptive notice to the page whether or not the request was validated or not. * * @since 1.0.0 - Migrated from WooCommerce Subscriptions v2.0 * @param WC_Subscription $subscription * @param int $order_item_id * @param bool $undo_request bool * @return bool */ private static function validate_remove_items_request($subscription, $order_item_id, $undo_request = \false) { } } class WCS_Select2 { protected $default_attributes = array('type' => 'hidden', 'placeholder' => '', 'class' => ''); protected $attributes = array(); /** * Constructor. * * @param array $attributes The attributes that make up the Select2 element * @since 1.0.0 - Migrated from WooCommerce Subscriptions v2.2 */ public function __construct(array $attributes) { } /** * Render a select2 element given an array of attributes. * * @param array $attributes Select2 attributes * @since 1.0.0 - Migrated from WooCommerce Subscriptions v2.2 */ public static function render(array $attributes) { } /** * Get a property name. * * @param string $property * @return string class, name, id or data-$property; * @since 1.0.0 - Migrated from WooCommerce Subscriptions v2.2 */ protected function get_property_name($property) { } /** * Returns a list of properties/values (HTML) from an array. All the values * are escaped. * * @param $attributes List of HTML attributes with values * @return string * @since 1.0.0 - Migrated from WooCommerce Subscriptions v2.2 */ protected function attributes_to_html(array $attributes) { } /** * Prints the HTML to show the Select2 field. * * @since 1.0.0 - Migrated from WooCommerce Subscriptions v2.2 */ public function print_html() { } /** * Returns the HTML needed to show the Select2 field * * @return string * @since 1.0.0 - Migrated from WooCommerce Subscriptions v2.2 */ public function get_html() { } } class WCS_SQL_Transaction { /** * The query to run when a fatal shutdown occurs. * * @var string */ public $on_fatal = ''; /** * The query to run if the PHP request ends without error. * * @var string */ public $on_shutdown = ''; /** * Whether there's an active MYSQL transaction. * * @var bool */ public $active_transaction = \false; /** * Constructor * * @since 1.0.0 - Migrated from WooCommerce Subscriptions v3.1.0 * * @param string $on_fatal Optional. The type of query to run on fatal shutdown if this transaction is still active. Can be 'rollback' or 'commit'. Default is 'rollback'. * @param string $on_shutdown Optional. The type of query to run if a non-error shutdown occurs but there's still an active transaction. Can be 'rollback' or 'commit'. Default is 'commit'. */ public function __construct($on_fatal = 'rollback', $on_shutdown = 'commit') { } /** * Starts a MYSQL Transaction. * * @since 1.0.0 - Migrated from WooCommerce Subscriptions v3.1.0 */ public function start() { } /** * Commits the MYSQL Transaction. * * @since 1.0.0 - Migrated from WooCommerce Subscriptions v3.1.0 */ public function commit() { } /** * Rolls back any changes made during the MYSQL Transaction. * * @since 1.0.0 - Migrated from WooCommerce Subscriptions v3.1.0 */ public function rollback() { } /** * Closes out an active transaction depending on the type of shutdown. * * Shutdowns caused by a fatal will be rolledback or committed @see $this->on_fatal. * Shutdowns caused by a natural PHP termination (no error) will be rolledback or committed. @see $this->on_shutdown. * * @since 1.0.0 - Migrated from WooCommerce Subscriptions v3.1.0 */ public function handle_shutdown() { } } /** * WooCommerce Subscriptions staging mode handler. * * @package WooCommerce Subscriptions * @author Prospress * @since 1.0.0 - Migrated from WooCommerce Subscriptions v2.3.0 */ class WCS_Staging { /** * Attach callbacks. */ public static function init() { } /** * Add an order note to a renewal order to record when it was created under staging site conditions. * * @param int $renewal_order_id The renewal order ID. * @since 1.0.0 - Migrated from WooCommerce Subscriptions v2.3.0 */ public static function maybe_record_staging_site_renewal($renewal_order_id) { } /** * Add a badge to the Subscriptions submenu when a site is operating under a staging site lock. * * @param array $subscription_order_type_data The WC_Subscription register order type data. * @since 1.0.0 - Migrated from WooCommerce Subscriptions v2.3.0 */ public static function maybe_add_menu_badge($subscription_order_type_data) { } /** * Handles admin requests to redisplay the staging site admin notice. * * @since 1.0.0 - Migrated from WooCommerce Subscriptions v2.5.5 */ public static function maybe_reset_admin_notice() { } /** * Displays a note under the edit subscription payment method field to explain why the subscription is set to Manual Renewal. * * @param WC_Subscription $subscription * @since 1.0.0 - Migrated from WooCommerce Subscriptions v2.6.0 */ public static function maybe_add_payment_method_note($subscription) { } /** * Returns the content for a tooltip explaining a subscription's payment method while in staging mode. * * @param WC_Subscription $subscription * @return string HTML content for a tooltip. * @since 1.0.0 - Migrated from WooCommerce Subscriptions v2.6.0 */ public static function get_payment_method_tooltip($subscription) { } /** * Displays a notice when Subscriptions is being run on a different site, like a staging or testing site. * * @since 1.0.0 - Migrated from WooCommerce Subscriptions v4.0.0 */ public static function handle_site_change_notice() { } /** * Generates a unique key based on the sites URL used to determine duplicate/staging sites. * * The key can not simply be the site URL, e.g. http://example.com, because some hosts (WP Engine) replaces all * instances of the site URL in the database when creating a staging site. As a result, we obfuscate * the URL by inserting '_[wc_subscriptions_siteurl]_' into the middle of it. * * We don't use a hash because keeping the URL in the value allows for viewing and editing the URL * directly in the database. * * @since 1.0.0 - Migrated from WooCommerce Subscriptions v4.0.0 * @return string The duplicate lock key. */ public static function get_duplicate_site_lock_key() { } /** * Sets the duplicate site lock key to record the site's "live" url. * * This key is checked to determine if this database has moved to a different URL. * * @see self::get_duplicate_site_lock_key() which generates the key. * * @since 1.0.0 - Migrated from WooCommerce Subscriptions v4.0.0 */ public static function set_duplicate_site_url_lock() { } /** * Determines if this is a duplicate/staging site. * * Checks if the WordPress site URL is the same as the URL subscriptions considers * the live URL (@see self::set_duplicate_site_url_lock()). * * @since 1.0.0 - Migrated from WooCommerce Subscriptions v4.0.0 * @return bool Whether the site is a duplicate URL or not. */ public static function is_duplicate_site() { } /** * Gets the URL Subscriptions considers as the live site URL. * * This URL is set by @see WCS_Staging::set_duplicate_site_url_lock(). This function removes the obfuscation to get a raw URL. * * @since 1.0.0 - Migrated from WooCommerce Subscriptions v4.0.0 * * @param int|null $blog_id The blog to get the URL for. Optional. Default is null. Used for multisites only. * @param string $path The URL path to append. Optional. Default is ''. * @param string|null $scheme The URL scheme passed to @see set_url_scheme(). Optional. Default is null which automatically returns the URL as https or http depending on @see is_ssl(). */ public static function get_live_site_url($blog_id = \null, $path = '', $scheme = \null) { } /** * Gets the sites WordPress or Subscriptions URL. * * WordPress - This is typically the URL the current site is accessible via. * Subscriptions is the URL Subscriptions considers to be the URL to process live payments on. It may differ to the WP URL if the site has moved. * * @since 1.0.0 - Migrated from WooCommerce Subscriptions v4.0.0 * * @param string $source The URL source to get. Optional. Takes values 'current_wp_site' or 'subscriptions_install'. Default is 'current_wp_site' - the URL WP considers to be the site's. * @return string The URL. */ public static function get_site_url_from_source($source = 'current_wp_site') { } } /** * WC Subscriptions Template Loader * * @version 1.0.0 - Migrated from WooCommerce Subscriptions v2.0 * @author Prospress */ class WCS_Template_Loader { /** * Relocated templates from WooCommerce Subscriptions. * * @var array[] Array of file names and their directory found in templates/ */ private static $relocated_templates = ['order-shipping-html.php' => 'admin/deprecated/', 'order-tax-html.php' => 'admin/deprecated/', 'html-admin-notice.php' => 'admin/', 'html-failed-scheduled-action-notice.php' => 'admin/', 'html-variation-price.php' => 'admin/', 'html-variation-synchronisation.php' => 'admin/', 'status.php' => 'admin/', 'cart-recurring-shipping.php' => 'cart/', 'form-change-payment-method.php' => 'checkout/', 'recurring-coupon-totals.php' => 'checkout/', 'recurring-fee-totals.php' => 'checkout/', 'recurring-itemized-tax-totals.php' => 'checkout/', 'recurring-subscription-totals.php' => 'checkout/', 'recurring-subtotals.php' => 'checkout/', 'recurring-tax-totals.php' => 'checkout/', 'recurring-totals.php' => 'checkout/', 'subscription-receipt.php' => 'checkout/', 'admin-new-renewal-order.php' => 'emails/', 'admin-new-switch-order.php' => 'emails/', 'admin-payment-retry.php' => 'emails/', 'cancelled-subscription.php' => 'emails/', 'customer-completed-renewal-order.php' => 'emails/', 'customer-completed-switch-order.php' => 'emails/', 'customer-on-hold-renewal-order.php' => 'emails/', 'customer-payment-retry.php' => 'emails/', 'customer-processing-renewal-order.php' => 'emails/', 'customer-renewal-invoice.php' => 'emails/', 'email-order-details.php' => 'emails/', 'expired-subscription.php' => 'emails/', 'on-hold-subscription.php' => 'emails/', 'admin-new-renewal-order.php' => 'emails/plain/', 'admin-new-switch-order.php' => 'emails/plain/', 'admin-payment-retry.php' => 'emails/plain/', 'cancelled-subscription.php' => 'emails/plain/', 'customer-completed-renewal-order.php' => 'emails/plain/', 'customer-completed-switch-order.php' => 'emails/plain/', 'customer-on-hold-renewal-order.php' => 'emails/plain/', 'customer-payment-retry.php' => 'emails/plain/', 'customer-processing-renewal-order.php' => 'emails/plain/', 'customer-renewal-invoice.php' => 'emails/plain/', 'email-order-details.php' => 'emails/plain/', 'expired-subscription.php' => 'emails/plain/', 'on-hold-subscription.php' => 'emails/plain/', 'subscription-info.php' => 'emails/plain/', 'subscription-info.php' => 'emails/', 'html-modal.php' => '', 'my-subscriptions.php' => 'myaccount/', 'related-orders.php' => 'myaccount/', 'related-subscriptions.php' => 'myaccount/', 'subscription-details.php' => 'myaccount/', 'subscription-totals-table.php' => 'myaccount/', 'subscription-totals.php' => 'myaccount/', 'subscriptions.php' => 'myaccount/', 'view-subscription.php' => 'myaccount/', 'subscription.php' => 'single-product/add-to-cart/', 'variable-subscription.php' => 'single-product/add-to-cart/']; public static function init() { } /** * Get the view subscription template. * * @param int $subscription_id Subscription ID. * @since 1.0.0 - Migrated from WooCommerce Subscriptions v2.0.17 */ public static function get_view_subscription_template($subscription_id) { } /** * Get the subscription details template, which is part of the view subscription page. * * @param WC_Subscription $subscription Subscription object * @since 1.0.0 - Migrated from WooCommerce Subscriptions v2.2.19 */ public static function get_subscription_details_template($subscription) { } /** * Get the subscription totals template, which is part of the view subscription page. * * @param WC_Subscription $subscription Subscription object * @since 1.0.0 - Migrated from WooCommerce Subscriptions v2.2.19 */ public static function get_subscription_totals_template($subscription) { } /** * Get the order downloads template, which is part of the view subscription page. * * @param WC_Subscription $subscription Subscription object * @since 1.0.0 - Migrated from WooCommerce Subscriptions v2.5.0 */ public static function get_order_downloads_template($subscription) { } /** * Gets the subscription totals table. * * @since 1.0.0 - Migrated from WooCommerce Subscriptions v2.6.0 * * @param WC_Subscription $subscription The subscription to print the totals table for. * @param bool $include_item_removal_links Whether the remove line item links should be included. * @param array $totals The subscription totals rows to be displayed. * @param bool $include_switch_links Whether the line item switch links should be included. */ public static function get_subscription_totals_table_template($subscription, $include_item_removal_links, $totals, $include_switch_links = \true) { } /** * Gets the subscription receipt template content. * * @since 1.0.0 - Migrated from WooCommerce Subscriptions v3.0.0 * * @param WC_Subscription $subscription The subscription to display the receipt for. */ public static function get_subscription_receipt_template($subscription) { } /** * Gets the recurring totals subtotal rows content. * * @since 1.0.0 - Migrated from WooCommerce Subscriptions v3.1.0 * * @param array $recurring_carts The recurring carts. */ public static function get_recurring_cart_subtotals($recurring_carts) { } /** * Gets the recurring totals coupon rows content. * * @since 1.0.0 - Migrated from WooCommerce Subscriptions v3.1.0 * * @param array $recurring_carts The recurring carts. */ public static function get_recurring_cart_coupons($recurring_carts) { } /** * Gets the recurring totals shipping rows content. * * @since 1.0.0 - Migrated from WooCommerce Subscriptions v3.1.0 */ public static function get_recurring_cart_shipping() { } /** * Gets the recurring totals fee rows content. * * @since 1.0.0 - Migrated from WooCommerce Subscriptions v3.1.0 * * @param array $recurring_carts The recurring carts. */ public static function get_recurring_cart_fees($recurring_carts) { } /** * Gets the recurring totals tax rows content. * * @since 1.0.0 - Migrated from WooCommerce Subscriptions v3.1.0 * * @param array $recurring_carts The recurring carts. */ public static function get_recurring_cart_taxes($recurring_carts) { } /** * Gets the recurring subscription total rows content. * * @since 1.0.0 - Migrated from WooCommerce Subscriptions v3.1.0 * * @param array $recurring_carts The recurring carts. */ public static function get_recurring_subscription_totals($recurring_carts) { } /** * Loads the my-subscriptions.php template on the My Account page. * * @since 1.0.0 - Migrated from WooCommerce Subscriptions v4.0.0 * @param int $current_page The My Account Subscriptions page. */ public static function get_my_subscriptions($current_page = 1) { } /** * Gets the subscription add_to_cart template. * * Use the same cart template for subscription as that which is used for simple products. Reduce code duplication * and is made possible by the friendly actions & filters found through WC. * * @since 1.0.0 - Migrated from WooCommerce Subscriptions v4.0.0 */ public static function get_subscription_add_to_cart() { } /** * Gets the variable subscription add_to_cart template. * * Use a very similar cart template as that of a variable product with added functionality. * * @since 1.0.0 - Migrated from WooCommerce Subscriptions v4.0.0 */ public static function get_variable_subscription_add_to_cart() { } /** * Gets OPC's simple add to cart template for simple subscription products (to ensure data attributes required by OPC are added). * * Variable subscription products will be handled automatically because they identify as "variable" in response to is_type() method calls, * which OPC uses. * * @since 1.0.0 - Migrated from WooCommerce Subscriptions v4.0.0 */ public static function get_opc_subscription_add_to_cart() { } /** * Handles relocated subscription templates. * * Hooked onto 'wc_get_template'. * * @since 1.4.0 * * @param string $template * @param string $template_name * @param array $args * @param string $template_path * @param */ public static function handle_relocated_templates($template, $template_name, $args, $template_path, $default_path) { } /** * Determine if the given template file and default path is sourcing the template * from a outdated location. * * @since 1.4.0 * * @param string $template_file Template file name. * @param string $default_path Default path passed to `wc_get_template()`. * * @return bool */ public static function is_deprecated_default_path($template_file, $default_path) { } } class WCS_User_Change_Status_Handler { public static function init() { } /** * Checks if the current request is by a user to change the status of their subscription, and if it is, * validate the request and proceed to change to the subscription. * * @since 1.0.0 - Migrated from WooCommerce Subscriptions v2.0 */ public static function maybe_change_users_subscription() { } /** * Change the status of a subscription and show a notice to the user if there was an issue. * * @since 1.0.0 - Migrated from WooCommerce Subscriptions v2.0 */ public static function change_users_subscription($subscription, $new_status) { } /** * Validates a user change status change request. * * @since 1.0.0 - Migrated from WooCommerce Subscriptions v2.0.0 * * @param int $user_id The ID of the user performing the request. * @param WC_Subscription $subscription The Subscription to update. * @param string $new_status The new subscription status to validate. * @param string|null $wpnonce Optional. The nonce to validate the request or null if there's no nonce to validate. * * @return bool Whether the status change request is valid. */ public static function validate_request($user_id, $subscription, $new_status, $wpnonce = \null) { } } // Exit if accessed directly /** * WCS_Cache_Updater Interface * * Define a set of methods that can be used to update a cache */ interface WCS_Cache_Updater { /** * Get the items to be updated, if any. * * @return array An array of items to update, or empty array if there are no items to update. */ public function get_items_to_update(); /** * Update for a single item, of the form returned by get_items_to_update(). * * @param mixed $item The item to update. */ public function update_items_cache($item); /** * Clear all caches for all items. */ public function delete_all_caches(); } /** * Customer data store for subscriptions. * * This class is responsible for getting subscriptions for users. * * @version 1.0.0 - Migrated from WooCommerce Subscriptions v2.3.0 */ class WCS_Customer_Store_CPT extends \WCS_Customer_Store { /** * The post meta key used to link a customer with a subscription. * * @var string */ private $meta_key = '_customer_user'; /** * The object data key (property) used to link a customer with a subscription. * * @var string */ private $data_key = 'customer_id'; /** * Gets the post meta key used to link a customer with a subscription. * * @return string The customer user post meta key. */ protected function get_meta_key() { } /** * Gets the data key used to link the customer with a subscription. * * This can be the post meta key on stores using the WP Post architecture and the property name on HPOS architecture. * * @return string The customer user post meta key or the customer ID property key. */ protected function get_data_key() { } /** * Get the IDs for a given user's subscriptions. * * @param int $user_id The id of the user whose subscriptions you want. * @return array */ public function get_users_subscription_ids($user_id) { } } /** * Customer data store for subscriptions stored in Custom Post Types, with caching. * * Adds a persistent caching layer on top of WCS_Customer_Store_CPT for more * performant queries to find a user's subscriptions. * * Cache is based on the current blog in case of a multisite environment. * * @version 1.0.0 - Migrated from WooCommerce Subscriptions v2.3.0 * @category Class */ class WCS_Customer_Store_Cached_CPT extends \WCS_Customer_Store_CPT implements \WCS_Cache_Updater { /** * Keep the cache up-to-date with changes to our meta data via WordPress post meta APIs * or WC CRUD APIs by using a data cache manager. * * @var WCS_Post_Meta_Cache_Manager_Many_To_One|WCS_Object_Data_Cache_Manager_Many_To_One Depending on the HPOS environment. */ protected $object_data_cache_manager; /** * Meta key used to store all of a customer's subscription IDs in their user meta. * * @var string */ const _CACHE_META_KEY = '_wcs_subscription_ids_cache'; /** * Gets the legacy protected variables for backwards compatibility. * * Throws a deprecated warning if accessing the now deprecated variables. * * @param string $name The variable name. * @return WCS_Post_Meta_Cache_Manager_Many_To_One|WCS_Object_Data_Cache_Manager_Many_To_One Depending on the HPOS environment. */ public function __get($name) { } /** * Constructor */ public function __construct() { } /** * Attach callbacks to keep user subscription caches up-to-date and provide debug tools for managing the cache. */ protected function init() { } /* Public methods required by WCS_Customer_Store */ /** * Get the IDs for a given user's subscriptions. * * Wrapper to support getting a user's subscription regardless of whether they are cached or not yet, * either in the old transient cache, or new persistent cache. * * @param int $user_id The id of the user whose subscriptions you want. * @return array */ public function get_users_subscription_ids($user_id) { } /* Internal methods for managing the cache */ /** * Find subscriptions for a given user from the cache. * * Applies the 'wcs_get_cached_users_subscription_ids' filter for backward compatibility with * the now deprecated wcs_get_cached_user_subscription_ids() method. * * @param int $user_id The id of the user whose subscriptions you want. * @return string|array An array of subscriptions in the cache, or an empty string when no matching row is found for the given key, meaning it's cache is not set yet or has been deleted */ protected function get_users_subscription_ids_from_cache($user_id) { } /** * Add a subscription ID to the cached subscriptions for a given user. * * @param int $user_id The user the subscription belongs to. * @param int $subscription_id A subscription to link the user in the cache. */ protected function add_subscription_id_to_cache($user_id, $subscription_id) { } /** * Delete a subscription ID from the cached IDs for a given user. * * @param int $user_id The user the subscription belongs to. * @param int $subscription_id A subscription to link the user in the cache. */ protected function delete_subscription_id_from_cache($user_id, $subscription_id) { } /** * Helper function for setting subscription cache. * * @param int $user_id The id of the user who the subscriptions belongs to. * @param array $subscription_ids Set of subscriptions to link with the given user. * @return bool|int Returns meta ID if the key didn't exist; true on successful update; false on failure or if $subscription_ids is the same as the existing meta value in the database. */ protected function update_subscription_id_cache($user_id, array $subscription_ids) { } /* Public methods used to bulk edit cache */ /** * Clear all caches for all subscriptions against all users. */ public function delete_caches_for_all_users() { } /** * Clears the cache for a given user. * * @param int $user_id The id of the user */ public function delete_cache_for_user($user_id) { } /* Public methods used as callbacks on hooks for managing cache */ /** * Set empty subscription cache on a user. * * Newly registered users can't have subscriptions yet, so we set that cache to empty whenever a new user is added * by attaching this to the 'user_register' hook. * * @param int $user_id The id of the user just created */ public function set_empty_cache($user_id) { } /* Public methods attached to WCS_Post_Meta_Cache_Manager_Many_To_One hooks for managing the cache */ /** * If there is a change to a subscription's post meta key, update the user meta cache. * * @param string $update_type The type of update to check. Can be 'add', 'update' or 'delete'. * @param int $subscription_id The subscription's ID where the customer is being changed. * @param string $updated_data_key The object's data key being changed. Can be a post meta key or a property name. * @param mixed $user_id The new value stored in the database for the subscription's customer. This could be any type of value but is a user ID when the customer is being changed. * @param mixed $old_user_id The previous value stored in the database for the subscription's customer ID. Optional. */ public function maybe_update_for_post_meta_change($update_type, $subscription_id, $updated_data_key, $user_id, $old_user_id = '') { } /** * Remove all caches for a given meta key if all entries for that meta key are being deleted. * * This is very unlikely to ever happen, because it would be equivalent to deleting the linked * customer on all orders and subscriptions. But it is handled here anyway in case of things * like removing WooCommerce entirely. * * @param string $meta_key The post meta key being changed. */ public function maybe_delete_all_for_post_meta_change($meta_key) { } /** * Get the IDs of users without a cache set. * * @param int $number The number of users to return. Use -1 to return all users. * @return array */ protected function get_user_ids_without_cache($number = 10) { } /** Methods to implement WCS_Cache_Updater - wrap more accurately named methods for the sake of clarity */ /** * Get the items to be updated, if any. * * @return array An array of items to update, or empty array if there are no items to update. */ public function get_items_to_update() { } /** * Run the update for a single item. * * @param mixed $item The item to update. */ public function update_items_cache($user_id) { } /** * Clear all caches. */ public function delete_all_caches() { } /** * Gets the cache meta key. * * On multi-site installations, the current site ID is appended. * * @since 1.0.0 - Migrated from WooCommerce Subscriptions v3.1.0 * @return string */ public function get_cache_meta_key() { } } /** * Subscriptions Order Tables Data Store Controller class * * The purpose of this class is to: * - control when our subscriptions datastore class is loaded and used * - handle any other code that relates to the HPOS/COT feature and our datastore */ class WCS_Orders_Table_Data_Store_Controller { /** * The data store object to use. * * @var WCS_Orders_Table_Subscription_Data_Store */ private $data_store; /** * Constructor */ public function __construct() { } /** * Initialise WCS_Orders_Table_Data_Store_Controller class hooks. * * @return void */ public function init_hooks() { } /** * Returns an instance of the Subscriptions Order Table data store object to use. * If an instance doesn't exist, create one. * * @return WCS_Orders_Table_Subscription_Data_Store */ private function get_data_store_instance() { } /** * When the custom_order_tables feature is enabled, return the subscription datastore class. * * @param string $default_data_store The data store class name. * * @return string */ public function get_orders_table_data_store($default_data_store) { } } /** * Subscription Data Store: Stored in Custom Order Tables. * * Extends OrdersTableDataStore to make sure subscription related meta data is read/updated. */ class WCS_Orders_Table_Subscription_Data_Store extends \Automattic\WooCommerce\Internal\DataStores\Orders\OrdersTableDataStore { /** * Define subscription specific data which augments the meta of an order. * * The meta keys here determine the prop data that needs to be manually set. We can't use * the $internal_meta_keys property from OrdersTableDataStore because we want its value * too, so instead we create our own and merge it into $internal_meta_keys in __construct. * * @var array */ protected $subscription_internal_meta_keys = array('_schedule_trial_end', '_schedule_next_payment', '_schedule_cancelled', '_schedule_end', '_schedule_payment_retry', '_subscription_switch_data', '_schedule_start'); /** * Array of subscription specific data which augments the meta of an order in the form meta_key => prop_key * * Used to read/update props on the subscription. * * @var array */ protected $subscription_meta_keys_to_props = array('_billing_period' => 'billing_period', '_billing_interval' => 'billing_interval', '_suspension_count' => 'suspension_count', '_cancelled_email_sent' => 'cancelled_email_sent', '_requires_manual_renewal' => 'requires_manual_renewal', '_trial_period' => 'trial_period', '_schedule_trial_end' => 'schedule_trial_end', '_schedule_next_payment' => 'schedule_next_payment', '_schedule_cancelled' => 'schedule_cancelled', '_schedule_end' => 'schedule_end', '_schedule_payment_retry' => 'schedule_payment_retry', '_schedule_start' => 'schedule_start', '_subscription_switch_data' => 'switch_data'); /** * Table column to WC_Subscription mapping for wc_orders table. * * All columns are inherited from orders except the `transaction_id` column isn't used for subscriptions. * * @var \string[][] */ protected $order_column_mapping = array('id' => array('type' => 'int', 'name' => 'id'), 'status' => array('type' => 'string', 'name' => 'status'), 'type' => array('type' => 'string', 'name' => 'type'), 'currency' => array('type' => 'string', 'name' => 'currency'), 'tax_amount' => array('type' => 'decimal', 'name' => 'cart_tax'), 'total_amount' => array('type' => 'decimal', 'name' => 'total'), 'customer_id' => array('type' => 'int', 'name' => 'customer_id'), 'billing_email' => array('type' => 'string', 'name' => 'billing_email'), 'date_created_gmt' => array('type' => 'date', 'name' => 'date_created'), 'date_updated_gmt' => array('type' => 'date', 'name' => 'date_modified'), 'parent_order_id' => array('type' => 'int', 'name' => 'parent_id'), 'payment_method' => array('type' => 'string', 'name' => 'payment_method'), 'payment_method_title' => array('type' => 'string', 'name' => 'payment_method_title'), 'ip_address' => array('type' => 'string', 'name' => 'customer_ip_address'), 'user_agent' => array('type' => 'string', 'name' => 'customer_user_agent'), 'customer_note' => array('type' => 'string', 'name' => 'customer_note')); /** * Table column to WC_Subscription mapping for wc_operational_data table. * * For subscriptions, all columns are inherited from orders except for the following columns: * * - cart_hash * - new_order_email_sent * - order_stock_reduced * - date_paid_gmt * - recorded_sales * - date_completed_gmt * * @var \string[][] */ protected $operational_data_column_mapping = array('id' => array('type' => 'int'), 'order_id' => array('type' => 'int'), 'created_via' => array('type' => 'string', 'name' => 'created_via'), 'woocommerce_version' => array('type' => 'string', 'name' => 'version'), 'prices_include_tax' => array('type' => 'bool', 'name' => 'prices_include_tax'), 'coupon_usages_are_counted' => array('type' => 'bool', 'name' => 'recorded_coupon_usage_counts'), 'download_permission_granted' => array('type' => 'bool', 'name' => 'download_permissions_granted'), 'order_key' => array('type' => 'string', 'name' => 'order_key'), 'shipping_tax_amount' => array('type' => 'decimal', 'name' => 'shipping_tax'), 'shipping_total_amount' => array('type' => 'decimal', 'name' => 'shipping_total'), 'discount_tax_amount' => array('type' => 'decimal', 'name' => 'discount_tax'), 'discount_total_amount' => array('type' => 'decimal', 'name' => 'discount_total')); /** * Constructor. */ public function __construct() { } /** * Returns data store object to use backfilling. * * @return \WCS_Subscription_Data_Store_CPT */ protected function get_post_data_store_for_backfill() { } /** * Gets amount refunded for all related orders. * * @param \WC_Subscription $subscription * * @return string */ public function get_total_refunded($subscription) { } /** * Gets the total tax refunded for all related orders. * * @param \WC_Subscription $subscription * * @return float */ public function get_total_tax_refunded($subscription) { } /** * Gets the total shipping refunded for all related orders. * * @param \WC_Subscription $subscription The subscription object. * * @return float */ public function get_total_shipping_refunded($subscription) { } /** * Returns count of subscriptions with a specific status. * * @param string $status Subscription status. The wcs_get_subscription_statuses() function returns a list of valid statuses. * * @return int The number of subscriptions with a specific status. */ public function get_order_count($status) { } /** * Get all subscriptions matching the passed in args. * * @param array $args * * @return array of orders */ public function get_orders($args = []) { } /** * Attempts to restore the specified subscription back to its original status (after having been trashed). * * @param \WC_Subscription $order The order to be untrashed. * * @return bool If the operation was successful. */ public function untrash_order(\WC_Order $subscription) : bool { } /** * Method to delete a subscription from the database. * * @param \WC_Subscription $subscription Subscription object. * @param array $args Array of args to pass to the delete method. * * @return void */ public function delete(&$subscription, $args = array()) { } /** * Creates a new subscription in the database. * * @param \WC_Subscription $subscription Subscription object. */ public function create(&$subscription) { } /** * Updates a subscription in the database. * * @param \WC_Subscription $subscription Subscription object */ public function update(&$subscription) { } /** * Saves a subscription to the database. * * When a subscription is saved to the database we need to ensure we also save core subscription properties. The * parent::persist_order_to_db() will create and save the WC_Order inherited data, this method will save the * subscription core properties. * * @param WC_Subscription $subscription The subscription to save. * @param bool $force_all_fields Optional. Whether to force all fields to be saved. Default false. */ protected function persist_order_to_db(&$subscription, bool $force_all_fields = \false) { } /** * Initializes the subscription based on data received from the database. * * @param WC_Abstract_Order $subscription The subscription object. * @param int $subscription_id The subscription's ID. * @param stdClass $subscription_data All the subscription's data, retrieved from the database. */ protected function init_order_record(\WC_Abstract_Order &$subscription, int $subscription_id, \stdClass $subscription_data) { } /** * Updates subscription dates in the database. * * @param \WC_Subscription $subscription Subscription object. * * @return DateTime[] The date properties which were saved to the database in array format: [ $prop_name => DateTime Object ] */ public function save_dates($subscription) { } /** * Writes subscription dates to the database. * * @param WC_Subscription $subscription The subscription to write date changes for. * @param array $dates_to_save The dates to write to the database. * * @return WC_DateTime[] The date properties saved to the database in the format: array( $prop_name => WC_DateTime Object ). */ public function write_dates_to_database($subscription, $dates_to_save) { } /** * Searches subscription data for a term and returns subscription IDs. * * @param string $term Term to search. * * @return array A list of subscriptions IDs that match the search term. */ public function search_subscriptions($term) { } /** * Gets the subscription search fields. * * This function is hooked onto the 'woocommerce_order_table_search_query_meta_keys' filter. * * @param array The default order search fields. * * @return array The subscription search fields. */ public function get_subscription_order_table_search_fields($search_fields = []) { } /** * Gets user IDs for customers who have a subscription. * * @return array An array of user IDs. */ public function get_subscription_customer_ids() { } /** * Deletes all rows in the postmeta table with the given meta key. * * @param string $meta_key The meta key to delete. */ public function delete_all_metadata_by_key($meta_key) { } /** * Count subscriptions by status. * * @return array */ public function get_subscriptions_count_by_status() { } /** * Fetches the subscription's start date. * This method is called by @see parent::backfill_post_record() when backfilling subscriptions details to WP_Post DB. * * @param \WC_Subscription $subscription Subscription object. * * @return string */ public function get_schedule_start($subscription) { } /** * Fetches the subscription's trial end date. * This method is called by @see parent::backfill_post_record() when backfilling subscriptions details to WP_Post DB. * * @param \WC_Subscription $subscription Subscription object. * * @return string */ public function get_schedule_trial_end($subscription) { } /** * Fetches the subscription's next payment date. * This method is called by @see parent::backfill_post_record() when backfilling subscriptions details to WP_Post DB. * * @param \WC_Subscription $subscription Subscription object. * * @return string */ public function get_schedule_next_payment($subscription) { } /** * Fetches the subscription's cancelled date. * This method is called by @see parent::backfill_post_record() when backfilling subscriptions details to WP_Post DB. * * @param \WC_Subscription $subscription Subscription object. * * @return string */ public function get_schedule_cancelled($subscription) { } /** * Fetches the subscription's end date. * This method is called by @see parent::backfill_post_record() when backfilling subscriptions details to WP_Post DB. * * @param \WC_Subscription $subscription Subscription object. * * @return string */ public function get_schedule_end($subscription) { } /** * Fetches the subscription's payment retry date. * This method is called by @see parent::backfill_post_record() when backfilling subscriptions details to WP_Post DB. * * @param \WC_Subscription $subscription Subscription object. * * @return string */ public function get_schedule_payment_retry($subscription) { } /** * Returns a list of subscriptions's renewal order IDs stored in cache meta. * This method is called by @see parent::backfill_post_record() when backfilling subscriptions details to WP_Post DB. * * @param \WC_Subscription $subscription Subscription object. * * @return array */ public function get_renewal_order_ids_cache($subscription) { } /** * Returns a list of subscriptions's resubscribe order IDs stored in cache meta. * This method is called by @see parent::backfill_post_record() when backfilling subscriptions details to WP_Post DB. * * @param \WC_Subscription $subscription Subscription object. * * @return array */ public function get_resubscribe_order_ids_cache($subscription) { } /** * Returns a list of subscriptions's switch order IDs stored in cache meta. * This method is called by @see parent::backfill_post_record() when backfilling subscriptions details to WP_Post DB. * * @param \WC_Subscription $subscription Subscription object. * * @return array */ public function get_switch_order_ids_cache($subscription) { } /** * Sets the subscription's start date prop. * Called by @see OrdersTableDataStore::set_order_prop() when syncing/migrating internal meta key data. * * @param \WC_Subscription $subscription Subscription object. * @param string $date The date to set. */ public function set_schedule_start($subscription, $date) { } /** * Sets the subscription's trial end date prop. * Called by @see OrdersTableDataStore::set_order_prop() when syncing/migrating internal meta key data. * * @param \WC_Subscription $subscription Subscription object. * @param string $date The date to set. */ public function set_schedule_trial_end($subscription, $date) { } /** * Sets the subscription's next payment date prop. * Called by @see OrdersTableDataStore::set_order_prop() when syncing/migrating internal meta key data. * * @param \WC_Subscription $subscription Subscription object. * @param string $date The date to set. */ public function set_schedule_next_payment($subscription, $date) { } /** * Sets the subscription's cancelled date prop. * Called by @see OrdersTableDataStore::set_order_prop() when syncing/migrating internal meta key data. * * @param \WC_Subscription $subscription Subscription object. * @param string $date The date to set. */ public function set_schedule_cancelled($subscription, $date) { } /** * Sets the subscription's end date prop. * Called by @see OrdersTableDataStore::set_order_prop() when syncing/migrating internal meta key data. * * @param \WC_Subscription $subscription Subscription object. * @param string $date The date to set. */ public function set_schedule_end($subscription, $date) { } /** * Sets the subscription's payment retry date prop. * Called by @see OrdersTableDataStore::set_order_prop() when syncing/migrating internal meta key data. * * @param \WC_Subscription $subscription Subscription object. * @param string $date The date to set. */ public function set_schedule_payment_retry($subscription, $date) { } } /** * WCS Variable Product Data Store: Stored in CPT. * * @version 1.0.0 - Migrated from WooCommerce Subscriptions v2.3.0 * @author Prospress */ class WCS_Product_Variable_Data_Store_CPT extends \WC_Product_Variable_Data_Store_CPT { /** * A cache of products having their min and max variation data read. * Used as a circuit breaker to prevent multiple object reads causing infinite loops. * * @var array */ protected static $reading_min_max_variation_data = array(); /** * Method to read a product from the database. * * @param WC_Product_Variable_Subscription $product Product object. * @throws Exception If invalid product. */ public function read(&$product) { } /** * Read min and max variation data from post meta. * * @param WC_Product_Variable_Subscription $product Product object. */ protected function read_min_max_variation_data(&$product) { } } /** * Related order data store for orders. * * Importantly, this class uses WC_Data API methods, like WC_Data::add_meta_data() and WC_Data::get_meta(), to manage the * relationships instead of add_post_meta() or get_post_meta(). This ensures that the relationship is stored, regardless * of the order data store being used. * * @version 1.0.0 - Migrated from WooCommerce Subscriptions v2.3.0 */ class WCS_Related_Order_Store_CPT extends \WCS_Related_Order_Store { /** * Meta keys used to link an order with a subscription for each type of relationship. * * @since 1.0.0 - Migrated from WooCommerce Subscriptions v2.3.0 * @var array $meta_keys Relationship => Meta key */ private $meta_keys; /** * Constructor: sets meta keys used for storing each order relation. */ public function __construct() { } /** * Find orders related to a given subscription in a given way. * * @param WC_Order $subscription The ID of the subscription for which calling code wants the related orders. * @param string $relation_type The relationship between the subscription and the orders. Must be 'renewal', 'switch' or 'resubscribe. * * @return array */ public function get_related_order_ids(\WC_Order $subscription, $relation_type) { } /** * Find subscriptions related to a given order in a given way, if any. * * @param WC_Order $order The ID of an order that may be linked with subscriptions. * @param string $relation_type The relationship between the subscription and the orders. Must be 'renewal', 'switch' or 'resubscribe. * * @return array */ public function get_related_subscription_ids(\WC_Order $order, $relation_type) { } /** * Helper function for linking an order to a subscription via a given relationship. * * Existing order relationships of the same type will not be overwritten. This only adds a relationship. To overwrite, * you must also remove any existing relationship with @see $this->delete_relation(). * * @param WC_Order $order The order to link with the subscription. * @param WC_Order $subscription The order or subscription to link the order to. * @param string $relation_type The relationship between the subscription and the order. Must be 'renewal', 'switch' or 'resubscribe' unless custom relationships are implemented. */ public function add_relation(\WC_Order $order, \WC_Order $subscription, $relation_type) { } /** * Remove the relationship between a given order and subscription. * * This data store links the relationship for a renewal order and a subscription in meta data against the order. * * @param WC_Order $order An order that may be linked with subscriptions. * @param WC_Order $subscription A subscription or order to unlink the order with, if a relation exists. * @param string $relation_type The relationship between the subscription and the order. Must be 'renewal', 'switch' or 'resubscribe' unless custom relationships are implemented. */ public function delete_relation(\WC_Order $order, \WC_Order $subscription, $relation_type) { } /** * Remove all related orders/subscriptions of a given type from an order. * * @param WC_Order $order An order that may be linked with subscriptions. * @param string $relation_type The relationship between the subscription and the order. Must be 'renewal', 'switch' or 'resubscribe' unless custom relationships are implemented. */ public function delete_relations(\WC_Order $order, $relation_type) { } /** * Get the meta keys used to link orders with subscriptions. * * @return array */ protected function get_meta_keys() { } /** * Get the meta key used to link an order with a subscription based on the type of relationship. * * @param string $relation_type The order's relationship with the subscription. Must be 'renewal', 'switch' or 'resubscribe'. * @param string $prefix_meta_key Whether to add the underscore prefix to the meta key or not. 'prefix' to prefix the key. 'do_not_prefix' to not prefix the key. * * @return string */ protected function get_meta_key($relation_type, $prefix_meta_key = 'prefix') { } } /** * Related order data store for orders and subscriptions with caching. * * Subscription related orders (renewals, switch and resubscribe orders) record their relationship in order meta. * Historically finding subscription-related orders was costly as it required querying the database for all orders with specific meta key and meta value. * This required a performance heavy postmeta query and wp_post join. To fix this, in WC Subscriptions 2.3.0 we introduced a persistent caching layer. In * subscription metadata we now store a single key to keep track of the subscription's related orders. * * This class adds a persistent caching layer on top of WCS_Related_Order_Store_CPT for more * performant queries on related orders. This class contains the methods to fetch, update and delete the meta caches. * * @version 1.0.0 - Migrated from WooCommerce Subscriptions v2.3.0 */ class WCS_Related_Order_Store_Cached_CPT extends \WCS_Related_Order_Store_CPT implements \WCS_Cache_Updater { /** * Keep cache up-to-date with changes to our meta data using a meta cache manager. * * @var WCS_Post_Meta_Cache_Manager|WCS_Object_Data_Cache_Manager */ protected $object_data_cache_manager; /** * Store order relations using meta keys as the array key for more performant searches * in @see $this->get_relation_type_for_meta_key() than using array_search(). * * @var array $relation_keys meta key => Order Relationship */ private $relation_keys; /** * A flag to indicate whether the related order cache keys should be ignored. * * By default the related order cache keys are ignored via $this->add_related_order_cache_props(). In order to fetch the subscription's * meta with this cache's keys present, we need a way to bypass that function. * * Important: We use a static variable here because it is possible to have multiple instances of this class in memory, and we want to make sure we bypass * the function in all instances. This is especially true in unit tests. We can't make add_related_order_cache_props static because it uses $this in scope. * * @var bool $override_ignored_props True if the related order cache keys should be ignored otherwise false. */ private static $override_ignored_props = \false; /** * Constructor */ public function __construct() { } /** * Gets the legacy protected variables for backwards compatibility. * * Throws a deprecated warning if accessing the now deprecated variables. * * @param string $name The variable name. * @return WCS_Post_Meta_Cache_Manager_Many_To_One|WCS_Object_Data_Cache_Manager_Many_To_One Depending on the HPOS environment. */ public function __get($name) { } /** * Attaches callbacks to keep related order caches up-to-date. */ protected function init() { } /* Public methods required by WCS_Related_Order_Store */ /** * Finds orders related to a given subscription. * * This function is a wrapper to support getting related orders regardless of whether they are cached or not yet, * either in the old transient cache, or new persistent cache. * * @param WC_Order $subscription The ID of the subscription for which calling code wants the related orders. * @param string $relation_type The relationship between the subscription and the orders. Must be 'renewal', 'switch' or 'resubscribe. * * @return array An array of related order IDs. */ public function get_related_order_ids(\WC_Order $subscription, $relation_type) { } /** * Links an order to a subscription via a given relationship. * * @param WC_Order $order The order to link with the subscription. * @param WC_Order $subscription The order or subscription to link the order to. * @param string $relation_type The relationship between the subscription and the order. Must be 'renewal', 'switch' or 'resubscribe' unless custom relationships are implemented. */ public function add_relation(\WC_Order $order, \WC_Order $subscription, $relation_type) { } /** * Removes the relationship between a given order and subscription. * * @param WC_Order $order An order that may be linked with subscriptions. * @param WC_Order $subscription A subscription or order to unlink the order with, if a relation exists. * @param string $relation_type The relationship between the subscription and the order. Must be 'renewal', 'switch' or 'resubscribe' unless custom relationships are implemented. */ public function delete_relation(\WC_Order $order, \WC_Order $subscription, $relation_type) { } /** * Removes all related orders/subscriptions of a given type from an order. * * @param WC_Order $order An order that may be linked with subscriptions. * @param string $relation_type The relationship between the subscription and the order. Must be 'renewal', 'switch' or 'resubscribe' unless custom relationships are implemented. */ public function delete_relations(\WC_Order $order, $relation_type) { } /* Internal methods for managing the cache */ /** * Finds orders related to a given subscription in a given way from the cache. * * @param WC_Subscription|int $subscription_id The Subscription ID or subscription object to fetch related orders. * @param string $relation_type The relationship between the subscription and the orders. Must be 'renewal', 'switch' or 'resubscribe. * * @return string|array An array of related orders in the cache, or an empty string when no matching row is found for the given key, meaning it's cache is not set yet or has been deleted */ public function get_related_order_ids_from_cache($subscription, $relation_type) { } /** * Adds an order ID to a subscription's related order cache for a given relationship. * * @param int $order_id An order to link with the subscription. * @param WC_Subscription|int $subscription A subscription to link the order to. Accepts a subscription object or ID. * @param string $relation_type The relationship between the subscription and the order. Must be 'renewal', 'switch' or 'resubscribe. */ protected function add_related_order_id_to_cache($order_id, $subscription, $relation_type) { } /** * Deletes a related order ID from a subscription's related orders cache for a given order relationship. * * @param int $order_id The order that may be linked with subscriptions. * @param WC_Subscription|int $subscription A subscription to remove a linked order from. Accepts a subscription object or ID. * @param string $relation_type The relationship between the subscription and the orders. Must be 'renewal', 'switch' or 'resubscribe.e. */ protected function delete_related_order_id_from_cache($order_id, $subscription, $relation_type) { } /** * Sets a subscription's related order cache for a given relationship. * * @param WC_Subscription|int $subscription A subscription to update the linked order IDs for. * @param array $related_order_ids Set of orders related to the given subscription. * @param string $relation_type The relationship between the subscription and the order. Must be 'renewal', 'switch' or 'resubscribe' unless custom relationships are implemented. * * @return bool|int Returns the related order cache's meta ID if it didn't exist, otherwise returns true on success and false on failure. NOTE: If the $related_order_ids passed to this function are the same as those already in the database, this function returns false. */ protected function update_related_order_id_cache($subscription, array $related_order_ids, $relation_type) { } /** * Backfills the related order cache for a subscription when the "Keep the posts table and the orders tables synchronized" * setting is enabled. * * In this class we update the related orders cache metadata directly to ensure the * proper value is written to the database. To do this we use the data store's update_meta() and * add_meta() functions. * * Using these functions bypasses the DataSynchronizer resulting in order and post data becoming out of sync. * To fix this, this function manually updates the post meta table with the new values. * * @param WC_Subscription $subscription The subscription object to backfill. * @param string $relation_type The related order relationship type. Can be 'renewal', 'switch' or 'resubscribe'. * @param array $metadata The metadata to set update/add in the CPT data store. Should be an array with 'key' and 'value' keys. */ protected function maybe_backfill_related_order_cache($subscription, $relation_type, $metadata) { } /** * Gets the meta key used to store the cache of linked order with a subscription, based on the type of relationship. * * @param string $relation_type The order's relationship with the subscription. Must be 'renewal', 'switch' or 'resubscribe'. * @param string $prefix_meta_key Whether to add the underscore prefix to the meta key or not. 'prefix' to prefix the key. 'do_not_prefix' to not prefix the key. * * @return string The related order cache meta key. */ protected function get_cache_meta_key($relation_type, $prefix_meta_key = 'prefix') { } /* Public methods used to bulk edit cache */ /** * Clears all related order caches for a given subscription. * * @param WC_Subscription|int $subscription_id The ID of a subscription that may have linked orders. * @param string $relation_type The relationship between the subscription and the order. Must be 'renewal', 'switch' or 'resubscribe' unless custom relationships are implemented. Use 'any' to delete all cached. */ public function delete_caches_for_subscription($subscription, $relation_type = 'any') { } /** * Removes an order from all related order caches. * * @param int $order_id The order ID that must be removed. * @param string $relation_type Optional. The relationship between the subscription and the order. Can be 'renewal', 'switch' or 'resubscribe' unless custom relationships are implemented. Default is 'any' which deletes the ID from all cache types. */ public function delete_related_order_id_from_caches($order_id, $relation_type = 'any') { } /** * Clears all related order caches for all subscriptions. * * @param array $relation_types Optional. The order relations to clear. Default is an empty array which clears all relations. */ public function delete_caches_for_all_subscriptions($relation_types = array()) { } /* Public methods used as callbacks on hooks for managing cache */ /** * Adds related order cache meta keys to a set of props for a subscription data store. * * Related order cache APIs need to be handled by querying a central data source directly, instead of using * data set on an instance of the subscription, as it can be changed by other events outside of that instance's * knowledge or access. For now, this is done via the database. That may be changed in future to use an object * cache, but regardless, the prop should never be a source of that data. This method is attached to the filter * 'wcs_subscription_data_store_props_to_ignore' so that cache keys are ignored. * * @param array $props_to_ignore A mapping of meta keys => prop names. * @param WCS_Subscription_Data_Store_CPT $data_store Subscriptions Data Store * * @return array A mapping of meta keys => prop names, filtered by ones that should be updated. */ public function add_related_order_cache_props($props_to_ignore, $data_store) { } /** * Sets an empty renewal order cache on a subscription. * * Newly created subscriptions cannot have renewal orders yet, so we set that cache to empty whenever a new * subscription is created. Subscriptions can have switch or resubscribe orders, which may have been created before the subscription on * checkout, so we don't touch those caches. * * @param WC_Subscription $subscription A subscription to set an empty renewal cache against. * * @return WC_Subscription The instance of the subscription. Required as this method is attached to the 'wcs_created_subscription' filter */ public function set_empty_renewal_order_cache(\WC_Subscription $subscription) { } /* Public methods attached to WCS_Post_Meta_Cache_Manager hooks for managing the cache */ /** * Updates the cache when there is a change to a related order meta key. * * @param string $update_type The type of update to check. Can be 'add', 'update' or 'delete'. * @param int $order_id The order ID the meta is being changed on. * @param string $post_meta_key The meta key being changed. * @param mixed $subscription_id The related subscription's ID, as stored in meta value (only when the meta key is a related order meta key). * @param mixed $old_subscription_id Optional. The previous value stored in the database for the related subscription. */ public function maybe_update_for_post_meta_change($update_type, $order_id, $post_meta_key, $subscription_id, $old_subscription_id = '') { } /** * Removes all caches for a given meta key. * * Used by caching clearing tools if all entries for that meta key are being deleted. * * @param string $meta_key The meta key to delete. */ public function maybe_delete_all_for_post_meta_change($meta_key) { } /** * Gets a list of IDs for subscriptions without a related order cache set for a give relation type or types. * * If more than one relation is specified, a batch of subscription IDs will be returned that are missing * either of those relations, not both. * * @param array $relation_types Optional. The relations to check. Default is an empty array which checks for any relation type. * @param int $batch_size Optional. The number of subscriptions to return. Use -1 to return all subscriptions. Default is 10. * * @return array An array of subscription IDs missing the given relation type(s) */ protected function get_subscription_ids_without_cache($relation_types = array(), $batch_size = 10) { } /** * Gets the order relation for a given meta key. * * @param string $meta_key The meta key to get the subscription-relation for. * * @return bool|string The order relation if it exists, or false if no such meta key exists. */ private function get_relation_type_for_meta_key($meta_key) { } /** * Removes related order cache meta data from order meta copied from subscriptions to renewal orders. * * @param array $meta An order's meta data. * * @return array Filtered order meta data to be copied. */ public function remove_related_order_cache_keys($meta) { } /** Methods to implement WCS_Cache_Updater - wrap more accurately named methods for the sake of clarity */ /** * Gets the subscriptions without caches that need to be updated, if any. * * This function is used in the background updater to determine which subscriptions have missing caches that need generating. * * @return array An array of subscriptions without any related order caches. */ public function get_items_to_update() { } /** * Generates a related order cache for a given subscription. * * This function is used in the background updater to generate caches for subscriptions that are missing them. * * @param int $subscription_id The subscription to generate the cache for. */ public function update_items_cache($subscription_id) { } /** * Clears all caches for all subscriptions. */ public function delete_all_caches() { } /** * Gets the subscription's related order cached stored in meta. * * @param WC_Subscription $subscription The subscription to get the cache meta for. * @param string $relation_type The relation type to get the cache meta for. * @param mixed $data_store The data store to use to get the meta. Defaults to the current subscription's data store. * * @return stdClass|bool The meta data object if it exists, or false if it doesn't. */ protected function get_related_order_metadata(\WC_Subscription $subscription, $relation_type, $data_store = \null) { } } /** * Subscription Data Store: Stored in CPT (posts table). * * Extends WC_Order_Data_Store_CPT to make sure subscription related meta data is read/updated. * * @version 1.0.0 - Migrated from WooCommerce Subscriptions v2.2.0 * @category Class * @author Prospress */ class WCS_Subscription_Data_Store_CPT extends \WC_Order_Data_Store_CPT implements \WC_Object_Data_Store_Interface, \WC_Order_Data_Store_Interface { /** * Define subscription specific data which augments the meta of an order. * * The meta keys here determine the prop data that needs to be manually set. We can't use * the $internal_meta_keys property from WC_Order_Data_Store_CPT because we want its value * too, so instead we create our own and merge it into $internal_meta_keys in __construct. * * @since 1.0.0 - Migrated from WooCommerce Subscriptions v2.2.0 * @var array */ protected $subscription_internal_meta_keys = array('_schedule_trial_end', '_schedule_next_payment', '_schedule_cancelled', '_schedule_end', '_schedule_payment_retry', '_subscription_switch_data', '_schedule_start'); /** * Array of subscription specific data which augments the meta of an order in the form meta_key => prop_key * * Used to read/update props on the subscription. * * @since 1.0.0 - Migrated from WooCommerce Subscriptions v2.2.0 * @var array */ protected $subscription_meta_keys_to_props = array('_billing_period' => 'billing_period', '_billing_interval' => 'billing_interval', '_suspension_count' => 'suspension_count', '_cancelled_email_sent' => 'cancelled_email_sent', '_requires_manual_renewal' => 'requires_manual_renewal', '_trial_period' => 'trial_period', '_schedule_trial_end' => 'schedule_trial_end', '_schedule_next_payment' => 'schedule_next_payment', '_schedule_cancelled' => 'schedule_cancelled', '_schedule_end' => 'schedule_end', '_schedule_payment_retry' => 'schedule_payment_retry', '_schedule_start' => 'schedule_start', '_subscription_switch_data' => 'switch_data'); /** * Custom setters for subscription internal props in the form meta_key => set_|get_{value}. * * @var string[] */ protected $internal_data_store_key_getters = array('_schedule_start' => 'schedule_start', '_schedule_trial_end' => 'schedule_trial_end', '_schedule_next_payment' => 'schedule_next_payment', '_schedule_cancelled' => 'schedule_cancelled', '_schedule_end' => 'schedule_end', '_schedule_payment_retry' => 'schedule_payment_retry', '_subscription_renewal_order_ids_cache' => 'renewal_order_ids_cache', '_subscription_resubscribe_order_ids_cache' => 'resubscribe_order_ids_cache', '_subscription_switch_order_ids_cache' => 'switch_order_ids_cache'); /** * Constructor. */ public function __construct() { } /** * Create a new subscription in the database. * * @param WC_Subscription $subscription * @since 1.0.0 - Migrated from WooCommerce Subscriptions v2.2.0 */ public function create(&$subscription) { } /** * Returns an array of meta for an object. * * Ignore meta data that we don't want accessible on the object via meta APIs. * * @since 1.0.0 - Migrated from WooCommerce Subscriptions v2.3.0 * @param WC_Data $object * @return array */ public function read_meta(&$object) { } /** * Read subscription data. * * @param WC_Subscription $subscription * @param object $post_object * @since 1.0.0 - Migrated from WooCommerce Subscriptions v2.2.0 */ protected function read_order_data(&$subscription, $post_object) { } /** * Update subscription in the database. * * @param WC_Subscription $subscription * @since 1.0.0 - Migrated from WooCommerce Subscriptions v2.2.0 */ public function update(&$subscription) { } /** * Update post meta for a subscription based on it's settings in the WC_Subscription class. * * @param WC_Subscription $subscription * @since 1.0.0 - Migrated from WooCommerce Subscriptions v2.2.0 */ protected function update_post_meta(&$subscription) { } /** * Get the subscription's post title */ protected function get_post_title() { } /** * Excerpt for post. * * @param \WC_Subscription $order Subscription object. * @return string */ protected function get_post_excerpt($order) { } /** * Get amount refunded for all related orders. * * @param WC_Subscription $subscription * @return string * @since 1.0.0 - Migrated from WooCommerce Subscriptions v2.2.0 */ public function get_total_refunded($subscription) { } /** * Get the total tax refunded for all related orders. * * @param WC_Subscription $subscription * @return float * @since 1.0.0 - Migrated from WooCommerce Subscriptions v2.2.0 */ public function get_total_tax_refunded($subscription) { } /** * Get the total shipping refunded for all related orders. * * @param WC_Subscription $subscription * @return float * @since 1.0.0 - Migrated from WooCommerce Subscriptions v2.2.0 */ public function get_total_shipping_refunded($subscription) { } /** * Return count of subscriptions with type. * * @param string $type * @return int * @since 1.0.0 - Migrated from WooCommerce Subscriptions v2.2.0 */ public function get_order_count($status) { } /** * Get all subscriptions matching the passed in args. * * @see wc_get_orders() * @param array $args * @return array of orders * @since 1.0.0 - Migrated from WooCommerce Subscriptions v2.2.0 */ public function get_orders($args = array()) { } /** * Update subscription dates in the database. * * @param WC_Subscription $subscription * @return array The date properties saved to the database in the format: array( $prop_name => DateTime Object ) * @since 1.0.0 - Migrated from WooCommerce Subscriptions v2.2.6 */ public function save_dates($subscription) { } /** * Writes subscription dates to the database. * * @param WC_Subscription $subscription The subscription to write date changes for. * @param array $dates_to_save The dates to write to the database. * * @return WC_DateTime[] The date properties saved to the database in the format: array( $prop_name => WC_DateTime Object ) */ public function write_dates_to_database($subscription, $dates_to_save) { } /** * Get the props to update, and remove order meta data that isn't used on a subscription. * * Important for performance, because it avoids calling getters/setters on props that don't need * to be get/set, which in the case for get_date_paid(), or get_date_completed(), can be quite * resource intensive as it requires doing a related orders query. Also just avoids filling up the * post meta table more than is needed. * * @param WC_Data $object The WP_Data object (WC_Coupon for coupons, etc). * @param array $meta_key_to_props A mapping of meta keys => prop names. * @param string $meta_type The internal WP meta type (post, user, etc). * @return array A mapping of meta keys => prop names, filtered by ones that should be updated. */ protected function get_props_to_update($object, $meta_key_to_props, $meta_type = 'post') { } /** * Get the props set on a subscription which we don't want used on a subscription, which may be * inherited order meta data, or other values using the post meta data store but not as props. * * @return array A mapping of meta keys => prop names */ protected function get_props_to_ignore() { } /** * Search subscription data for a term and returns subscription ids * * @param string $term Term to search * @return array of subscription ids * @since 1.0.0 - Migrated from WooCommerce Subscriptions v2.3.0 */ public function search_subscriptions($term) { } /** * Get the user IDs for customers who have a subscription. * * @since 1.0.0 - Migrated from WooCommerce Subscriptions v3.4.3 * @return array The user IDs. */ public function get_subscription_customer_ids() { } /** * Deletes all rows in the postmeta table with the given meta key. * * @param string $meta_key The meta key to delete. */ public function delete_all_metadata_by_key($meta_key) { } /** * Count subscriptions by status. * * @return array */ public function get_subscriptions_count_by_status() { } /** * Sets the subscription's start date. * * This method is not intended for public use and is called by @see OrdersTableDataStore::backfill_post_record() * when backfilling subscription data to the WP_Post database. * * @param WC_Subscription $subscription * @param string $date */ public function set_schedule_start($subscription, $date) { } /** * Sets the subscription's trial end date. * * This method is not intended for public use and is called by @see OrdersTableDataStore::backfill_post_record() * when backfilling subscription data to the WP_Post database. * * @param WC_Subscription $subscription * @param string $date */ public function set_schedule_trial_end($subscription, $date) { } /** * Sets the subscription's next payment date. * * This method is not intended for public use and is called by @see OrdersTableDataStore::backfill_post_record() * when backfilling subscription data to the WP_Post database. * * @param WC_Subscription $subscription * @param string $date */ public function set_schedule_next_payment($subscription, $date) { } /** * Sets the subscription's cancelled date. * * This method is not intended for public use and is called by @see OrdersTableDataStore::backfill_post_record() * when backfilling subscription data to the WP_Post database. * * @param WC_Subscription $subscription * @param string $date */ public function set_schedule_cancelled($subscription, $date) { } /** * Sets the subscription's end date. * * This method is not intended for public use and is called by @see OrdersTableDataStore::backfill_post_record() * when backfilling subscription data to the WP_Post database. * * @param WC_Subscription $subscription * @param string $date */ public function set_schedule_end($subscription, $date) { } /** * Sets the subscription's payment retry date. * * This method is not intended for public use and is called by @see OrdersTableDataStore::backfill_post_record() * when backfilling subscription data to the WP_Post database. * * @param WC_Subscription $subscription * @param string $date */ public function set_schedule_payment_retry($subscription, $date) { } /** * Manually sets the list of subscription's renewal order IDs stored in cache. * * This method is not intended for public use and is called by @see OrdersTableDataStore::backfill_post_record() * when backfilling subscription data to the WP_Post database. * * @param WC_Subscription $subscription * @param array $renewal_order_ids */ public function set_renewal_order_ids_cache($subscription, $renewal_order_ids) { } /** * Manually sets the list of subscription's resubscribe order IDs stored in cache. * * This method is not intended for public use and is called by @see OrdersTableDataStore::backfill_post_record() * when backfilling subscription data to the WP_Post database. * * @param WC_Subscription $subscription * @param array $resubscribe_order_ids */ public function set_resubscribe_order_ids_cache($subscription, $resubscribe_order_ids) { } /** * Manually sets the list of subscription's switch order IDs stored in cache. * * This method is not intended for public use and is called by @see OrdersTableDataStore::backfill_post_record() * when backfilling subscription data to the WP_Post database. * * @param WC_Subscription $subscription * @param array $switch_order_ids */ public function set_switch_order_ids_cache($subscription, $switch_order_ids) { } /** * Deletes a subscription's related order cache - including any duplicates. * * WC core between v8.1 and v8.4 would duplicate related order cache meta when backfilling the post record. This method deletes all * instances of a order type cache (duplicates included). It is intended to be called before setting the cache manually. * * Note: this function assumes that the fix to WC (listed below) will be included in 8.4. If it's pushed back, this function will need to be updated, * if it's brought forward to 8.3, it can be updated but is not strictly required. * * @see https://github.com/woocommerce/woocommerce/pull/41281 * @see https://github.com/Automattic/woocommerce-subscriptions-core/pull/538 * * @param WC_Subscription $subscription The Subscription. * @param string $relationship_type The type of subscription related order relationship to delete. One of: 'renewal', 'resubscribe', 'switch'. */ private function cleanup_backfill_related_order_cache_duplicates($subscription, $relationship_type) { } } /** * Handle deprecated actions. * * When triggering an action which has a deprecated equivalient from Subscriptions v1.n, check if the old * action had any callbacks attached to it, and if so, log a notice and trigger the old action with a set * of parameters in the deprecated format. * * @package WooCommerce Subscriptions * @subpackage WCS_Hook_Deprecator * @category Class * @author Prospress * @since 1.0.0 - Migrated from WooCommerce Subscriptions v2.0 */ class WCS_Action_Deprecator extends \WCS_Hook_Deprecator { // phpcs:disable WordPress.Arrays.MultipleStatementAlignment.DoubleArrowNotAligned,WordPress.Arrays.MultipleStatementAlignment.LongIndexSpaceBeforeDoubleArrow /* The actions that have been deprecated, 'new_hook' => 'old_hook' */ protected $deprecated_hooks = array('woocommerce_scheduled_subscription_payment' => 'scheduled_subscription_payment', 'woocommerce_subscription_payment_complete' => 'processed_subscription_payment', 'woocommerce_subscription_renewal_payment_complete' => 'processed_subscription_renewal_payment', 'woocommerce_subscriptions_paid_for_failed_renewal_order' => 'woocommerce_subscriptions_processed_failed_renewal_order_payment', 'woocommerce_subscriptions_pre_update_payment_method' => 'woocommerce_subscriptions_pre_update_recurring_payment_method', 'woocommerce_subscription_payment_method_updated' => 'woocommerce_subscriptions_updated_recurring_payment_method', 'woocommerce_subscription_failing_payment_method_updated' => 'woocommerce_subscriptions_changed_failing_payment_method', 'woocommerce_subscription_payment_failed' => 'processed_subscription_payment_failure', 'woocommerce_subscription_change_payment_method_via_pay_shortcode' => 'woocommerce_subscriptions_change_payment_method_via_pay_shortcode', 'subscriptions_put_on_hold_for_order' => 'subscriptions_suspended_for_order', 'woocommerce_subscription_status_active' => 'activated_subscription', 'woocommerce_subscription_status_on-hold' => array('suspended_subscription', 'subscription_put_on-hold'), 'woocommerce_subscription_status_cancelled' => 'cancelled_subscription', 'woocommerce_subscription_status_on-hold_to_active' => 'reactivated_subscription', 'woocommerce_subscription_status_expired' => 'subscription_expired', 'woocommerce_scheduled_subscription_trial_end' => 'subscription_trial_end', 'woocommerce_scheduled_subscription_end_of_prepaid_term' => 'subscription_end_of_prepaid_term'); // phpcs:enable /** * Bootstraps the class and hooks required actions & filters. * * @since 1.0.0 - Migrated from WooCommerce Subscriptions v2.0 */ public function __construct() { } /** * Trigger the old action with the original callback parameters * * @since 1.0.0 - Migrated from WooCommerce Subscriptions v2.0 */ protected function trigger_hook($old_hook, $new_callback_args) { } } /** * Handles deprecation notices and triggering of legacy filter hooks when WC 3.0+ subscription filters are triggered. * * @since 1.0.0 - Migrated from WooCommerce Subscriptions v2.2.0 */ class WCS_Deprecated_Filter_Hooks extends \WC_Deprecated_Filter_Hooks { /** * Array of deprecated hooks we need to handle in the format array( new_hook => old_hook ) * * @var array */ protected $deprecated_hooks = array('woocommerce_subscription_get_currency' => 'woocommerce_get_currency', 'woocommerce_subscription_get_discount_total' => 'woocommerce_order_amount_discount_total', 'woocommerce_subscription_get_discount_tax' => 'woocommerce_order_amount_discount_tax', 'woocommerce_subscription_get_shipping_total' => 'woocommerce_order_amount_shipping_total', 'woocommerce_subscription_get_shipping_tax' => 'woocommerce_order_amount_shipping_tax', 'woocommerce_subscription_get_cart_tax' => 'woocommerce_order_amount_cart_tax', 'woocommerce_subscription_get_total' => 'woocommerce_order_amount_total', 'woocommerce_subscription_get_total_tax' => 'woocommerce_order_amount_total_tax', 'woocommerce_subscription_get_total_discount' => 'woocommerce_order_amount_total_discount', 'woocommerce_subscription_get_subtotal' => 'woocommerce_order_amount_subtotal', 'woocommerce_subscription_get_tax_totals' => 'woocommerce_order_tax_totals'); /** * Display a deprecated notice for old hooks. * * @param string $old_hook * @param string $new_hook * @since 1.0.0 - Migrated from WooCommerce Subscriptions v2.2.0 */ protected function display_notice($old_hook, $new_hook) { } } /** * Deprecate actions that use a dynamic hook by appending a variable, like a payment gateway's name. * * @package WooCommerce Subscriptions * @subpackage WCS_Hook_Deprecator * @category Class * @author Prospress * @since 1.0.0 - Migrated from WooCommerce Subscriptions v2.0 */ class WCS_Dynamic_Action_Deprecator extends \WCS_Dynamic_Hook_Deprecator { // phpcs:disable WordPress.Arrays.MultipleStatementAlignment.DoubleArrowNotAligned,WordPress.Arrays.MultipleStatementAlignment.LongIndexSpaceBeforeDoubleArrow /* The prefixes of hooks that have been deprecated, 'new_hook' => 'old_hook_prefix' */ protected $deprecated_hook_prefixes = array( 'woocommerce_admin_changed_subscription_to_' => 'admin_changed_subscription_to_', 'woocommerce_scheduled_subscription_payment_' => 'scheduled_subscription_payment_', 'woocommerce_customer_changed_subscription_to_' => 'customer_changed_subscription_to_', 'woocommerce_subscription_payment_method_updated_to_' => 'woocommerce_subscriptions_updated_recurring_payment_method_to_', 'woocommerce_subscription_payment_method_updated_from_' => 'woocommerce_subscriptions_updated_recurring_payment_method_from_', 'woocommerce_subscription_failing_payment_method_updated_' => 'woocommerce_subscriptions_changed_failing_payment_method_', // Gateway status change hooks 'woocommerce_subscription_activated_' => array('activated_subscription_', 'reactivated_subscription_'), 'woocommerce_subscription_on-hold_' => 'subscription_put_on-hold_', 'woocommerce_subscription_cancelled_' => 'cancelled_subscription_', 'woocommerce_subscription_expired_' => 'subscription_expired_', ); // phpcs:enable /** * Bootstraps the class and hooks required actions & filters. * * We need to use the special 'all' hook here because we don't actually know the full hook names * in advance, just their prefix. * * @since 1.0.0 - Migrated from WooCommerce Subscriptions v2.0 */ public function __construct() { } /** * Display a notice if functions are hooked to the old filter and apply the old filters args * * @since 1.0.0 - Migrated from WooCommerce Subscriptions v2.0 */ protected function trigger_hook($old_hook, $new_callback_args) { } } /** * Deprecate filters that use a dynamic hook by appending a variable, like a payment gateway's name. * * @package WooCommerce Subscriptions * @subpackage WCS_Hook_Deprecator * @category Class * @author Prospress * @since 1.0.0 - Migrated from WooCommerce Subscriptions v2.0 */ class WCS_Dynamic_Filter_Deprecator extends \WCS_Dynamic_Hook_Deprecator { /* The prefixes of hooks that have been deprecated, 'new_hook' => 'old_hook_prefix' */ protected $deprecated_hook_prefixes = array('woocommerce_can_subscription_be_updated_to_' => 'woocommerce_subscription_can_be_changed_to_'); /** * Bootstraps the class and hooks required actions & filters. * * We need to use the special 'all' hook here because we don't actually know the full hook names * in advance, just their prefix. * * @since 1.0.0 - Migrated from WooCommerce Subscriptions v2.0 */ public function __construct() { } /** * Display a notice if functions are hooked to the old filter and apply the old filters args * * @since 1.0.0 - Migrated from WooCommerce Subscriptions v2.0 */ protected function trigger_hook($old_hook, $new_callback_args) { } } /** * Handle deprecated filters. * * When triggering a filter which has a deprecated equivalient from Subscriptions v1.n, check if the old * filter had any callbacks attached to it, and if so, log a notice and trigger the old filter with a set * of parameters in the deprecated format so that the current return value also has the old filters applied * (wherever possible that is). * * @package WooCommerce Subscriptions * @subpackage WCS_Hook_Deprecator * @category Class * @author Prospress * @since 1.0.0 - Migrated from WooCommerce Subscriptions v2.0 */ class WCS_Filter_Deprecator extends \WCS_Hook_Deprecator { // phpcs:disable WordPress.Arrays.MultipleStatementAlignment.DoubleArrowNotAligned,WordPress.Arrays.MultipleStatementAlignment.LongIndexSpaceBeforeDoubleArrow /* The filters that have been deprecated, 'new_hook' => 'old_hook' */ protected $deprecated_hooks = array( // Subscription Meta Filters 'woocommerce_subscription_payment_failed_count' => 'woocommerce_subscription_failed_payment_count', 'woocommerce_subscription_payment_completed_count' => 'woocommerce_subscription_completed_payment_count', 'woocommerce_subscription_get_end_date' => 'woocommerce_subscription_expiration_date', 'woocommerce_subscription_get_trial_end_date' => 'woocommerce_subscription_trial_expiration_date', 'woocommerce_subscriptions_product_expiration_date' => 'woocommerce_subscription_calculated_expiration_date', 'woocommerce_subscription_get_last_payment_date' => 'woocommerce_subscription_last_payment_date', 'woocommerce_subscription_calculated_next_payment_date' => 'woocommerce_subscriptions_calculated_next_payment_date', 'woocommerce_subscription_date_updated' => 'woocommerce_subscriptions_set_trial_expiration_date', 'wcs_subscription_statuses' => array( 'woocommerce_subscriptions_custom_status_string', //no replacement as Subscriptions now uses wcs_get_subscription_statuses() for everything (the deprecator could use 'wc_subscription_statuses' and loop over all statuses to set it in the returned value) 'woocommerce_subscriptions_status_string', ), // Renewal Filters 'wcs_renewal_order_items' => 'woocommerce_subscriptions_renewal_order_items', 'wcs_renewal_order_meta_query' => 'woocommerce_subscriptions_renewal_order_meta_query', 'wcs_renewal_order_meta' => 'woocommerce_subscriptions_renewal_order_meta', 'wcs_renewal_order_item_name' => 'woocommerce_subscriptions_renewal_order_item_name', 'wcs_users_resubscribe_link' => 'woocommerce_subscriptions_users_renewal_link', 'wcs_can_user_resubscribe_to_subscription' => 'woocommerce_can_subscription_be_renewed', 'wcs_renewal_order_created' => array( 'woocommerce_subscriptions_renewal_order_created', // Even though 'woocommerce_subscriptions_renewal_order_created' is an action, as it is attached to a filter, we need to handle it in here 'woocommerce_subscriptions_renewal_order_id', ), // List Table Filters 'woocommerce_subscription_list_table_actions' => 'woocommerce_subscriptions_list_table_actions', 'woocommerce_subscription_list_table_column_status_content' => 'woocommerce_subscriptions_list_table_column_status_content', 'woocommerce_subscription_list_table_column_content' => 'woocommerce_subscriptions_list_table_column_content', // User Filters 'wcs_can_user_put_subscription_on_hold' => 'woocommerce_subscriptions_can_current_user_suspend', 'wcs_view_subscription_actions' => 'woocommerce_my_account_my_subscriptions_actions', 'wcs_get_users_subscriptions' => 'woocommerce_users_subscriptions', 'wcs_users_change_status_link' => 'woocommerce_subscriptions_users_action_link', 'wcs_user_has_subscription' => 'woocommerce_user_has_subscription', // Misc Filters 'woocommerce_subscription_max_failed_payments_exceeded' => 'woocommerce_subscriptions_max_failed_payments_exceeded', 'woocommerce_my_subscriptions_payment_method' => 'woocommerce_my_subscriptions_recurring_payment_method', 'woocommerce_subscriptions_update_payment_via_pay_shortcode' => 'woocommerce_subscriptions_update_recurring_payment_via_pay_shortcode', 'woocommerce_can_subscription_be_updated_to' => 'woocommerce_can_subscription_be_changed_to', ); // phpcs:enable /** * Bootstraps the class and hooks required actions & filters. * * @since 1.0.0 - Migrated from WooCommerce Subscriptions v2.0 */ public function __construct() { } /** * Trigger the old filter with the original callback parameters and make sure the return value is passed on (when possible). * * @since 1.0.0 - Migrated from WooCommerce Subscriptions v2.0 */ protected function trigger_hook($old_hook, $new_callback_args) { } } class WC_Subscriptions_Deprecation_Handler extends \WCS_Deprecated_Functions_Handler { /** * This class handles WC_Subscriptions. * * @var string */ protected $class = 'WC_Subscriptions'; /** * Deprecated WC_Subscriptions functions. * * @var array[] */ protected $deprecated_functions = array('add_months' => array('replacement' => 'wcs_add_months', 'version' => '2.0.0'), 'is_large_site' => array('replacement' => array(__CLASS__, '_is_large_site'), 'version' => '2.0.0'), 'get_subscription_status_counts' => array('replacement' => array(__CLASS__, '_get_subscription_status_counts'), 'version' => '2.0.0'), 'get_subscriptions' => array('replacement' => array(__CLASS__, '_get_subscriptions'), 'version' => '2.0.0'), 'format_total' => array('replacement' => 'wc_format_decimal', 'version' => '2.0.0'), 'woocommerce_dependancy_notice' => array('replacement' => array('WC_Subscriptions', 'woocommerce_inactive_notice'), 'version' => '2.1.0'), 'add_notice' => array('replacement' => 'wc_add_notice', 'version' => '2.2.16'), 'print_notices' => array('replacement' => 'wc_print_notices', 'version' => '2.2.16'), 'get_product' => array('replacement' => 'wc_get_product', 'version' => '2.4.0'), 'maybe_empty_cart' => array('replacement' => array('WC_Subscriptions_Cart_Validator', 'maybe_empty_cart'), 'version' => '2.6.0'), 'remove_subscriptions_from_cart' => array('replacement' => array('WC_Subscriptions_Cart', 'remove_subscriptions_from_cart'), 'version' => '2.6.0'), 'enqueue_styles' => array('replacement' => array('WC_Subscriptions_Frontend_Scripts', 'enqueue_styles'), 'version' => '3.1.3'), 'enqueue_frontend_scripts' => array('replacement' => array('WC_Subscriptions_Frontend_Scripts', 'enqueue_scripts'), 'version' => '3.1.3'), 'get_customer_orders' => array('replacement' => array('WCS_Meta_Box_Subscription_Data', 'get_customer_orders'), 'version' => '4.0.0'), 'get_my_subscriptions_template' => array('replacement' => array('WCS_Template_Loader', 'get_my_subscriptions'), 'version' => '4.0.0'), 'redirect_to_cart' => array('replacement' => array(__CLASS__, '_redirect_to_cart'), 'version' => '4.0.0'), 'get_longest_period' => array('replacement' => 'wcs_get_longest_period', 'version' => '4.0.0'), 'get_shortest_period' => array('replacement' => 'wcs_get_shortest_period', 'version' => '4.0.0'), 'append_numeral_suffix' => array('replacement' => 'wcs_append_numeral_suffix', 'version' => '4.0.0'), 'subscription_add_to_cart' => array('replacement' => array('WCS_Template_Loader', 'get_subscription_add_to_cart'), 'version' => '4.0.0'), 'variable_subscription_add_to_cart' => array('replacement' => array('WCS_Template_Loader', 'get_variable_subscription_add_to_cart'), 'version' => '4.0.0'), 'wcopc_subscription_add_to_cart' => array('replacement' => array('WCS_Template_Loader', 'get_opc_subscription_add_to_cart'), 'version' => '4.0.0'), 'add_to_cart_redirect' => array('replacement' => array('WC_Subscriptions_Cart', 'add_to_cart_redirect'), 'version' => '4.0.0'), 'is_woocommerce_pre' => array('replacement' => 'wcs_is_woocommerce_pre', 'version' => '4.0.0'), 'woocommerce_site_change_notice' => array('replacement' => array('WCS_Staging', 'handle_site_change_notice'), 'version' => '4.0.0'), 'get_current_sites_duplicate_lock' => array('replacement' => array('WCS_Staging', 'get_duplicate_site_lock_key'), 'version' => '4.0.0'), 'set_duplicate_site_url_lock' => array('replacement' => array('WCS_Staging', 'set_duplicate_site_url_lock'), 'version' => '4.0.0'), 'is_duplicate_site' => array('replacement' => array('WCS_Staging', 'is_duplicate_site'), 'version' => '4.0.0'), 'show_downgrade_notice' => array('replacement' => array(__CLASS__, '_show_downgrade_notice'), 'version' => '4.0.0'), 'get_site_url' => array('replacement' => array('WCS_Staging', 'get_live_site_url'), 'version' => '4.0.0'), 'get_site_url_from_source' => array('replacement' => array('WCS_Staging', 'get_site_url_from_source'), 'version' => '4.0.0'), 'redirect_ajax_add_to_cart' => array('replacement' => array('WC_Subscriptions_Cart_Validator', 'add_to_cart_ajax_redirect'), 'version' => '4.0.0'), 'order_button_text' => array('replacement' => array('WC_Subscriptions_Checkout', 'order_button_text'), 'version' => '4.0.0'), 'load_dependant_classes' => array('replacement' => array(array('WC_Subscriptions_Core_Plugin', 'instance'), 'init_version_dependant_classes'), 'version' => '4.0.0'), 'attach_dependant_hooks' => array('version' => '4.0.0'), 'register_order_types' => array('replacement' => array(array('WC_Subscriptions_Core_Plugin', 'instance'), 'register_order_types'), 'version' => '4.0.0'), 'add_data_stores' => array('replacement' => array(array('WC_Subscriptions_Core_Plugin', 'instance'), 'add_data_stores'), 'version' => '4.0.0'), 'register_post_status' => array('replacement' => array(array('WC_Subscriptions_Core_Plugin', 'instance'), 'register_post_statuses'), 'version' => '4.0.0'), 'deactivate_woocommerce_subscriptions' => array('replacement' => array(array('WC_Subscriptions_Core_Plugin', 'instance'), 'deactivate_plugin'), 'version' => '4.0.0'), 'load_plugin_textdomain' => array('replacement' => array(array('WC_Subscriptions_Core_Plugin', 'instance'), 'load_plugin_textdomain'), 'version' => '4.0.0'), 'action_links' => array('replacement' => array(array('WC_Subscriptions_Core_Plugin', 'instance'), 'add_plugin_action_links'), 'version' => '4.0.0'), 'update_notice' => array('replacement' => array(array('WC_Subscriptions_Core_Plugin', 'instance'), 'update_notice'), 'version' => '4.0.0'), 'setup_blocks_integration' => array('replacement' => array(array('WC_Subscriptions_Core_Plugin', 'instance'), 'setup_blocks_integration'), 'version' => '4.0.0'), 'maybe_activate_woocommerce_subscriptions' => array('replacement' => array(array('WC_Subscriptions_Core_Plugin', 'instance'), 'activate_plugin'), 'version' => '4.0.0'), 'action_scheduler_multisite_batch_size' => array('replacement' => array(array('WC_Subscriptions_Core_Plugin', 'instance'), 'reduce_multisite_action_scheduler_batch_size'), 'version' => '4.0.0')); /** * Deprecated Function Replacements */ /** * Deprecation handling of the original WC_Subscriptions::is_large_site() function. * * Not to be called directly. * * @deprecated */ protected function _is_large_site() { } /** * Deprecation handling of the original WC_Subscriptions::get_subscription_status_counts() function. * * Not to be called directly. * * @deprecated */ protected function _get_subscription_status_counts() { } /** * Deprecation handling of the original WC_Subscriptions::redirect_to_cart() function. * * Not to be called directly. * * @deprecated */ protected function _redirect_to_cart($permalink, $product_id) { } /** * Deprecation handling of the original WC_Subscriptions::show_downgrade_notice() function. * * Not to be called directly. * * @deprecated */ public static function _show_downgrade_notice() { } /** * Deprecation handling of the original WC_Subscriptions::show_downgrade_notice() function. * * Not to be called directly. * * @deprecated */ protected function _get_subscriptions($args = array()) { } } /** * Cancelled Subscription Email * * An email sent to the admin when a subscription is cancelled (either by a store manager, or the customer). * * @class WCS_Email_Cancelled_Subscription * @version 1.0.0 - Migrated from WooCommerce Subscriptions v2.1 * @package WooCommerce_Subscriptions/Classes/Emails * @author Prospress * @extends WC_Email */ class WCS_Email_Cancelled_Subscription extends \WC_Email { /** * Create an instance of the class. * * @access public */ function __construct() { } /** * Get the default e-mail subject. * * @since 1.0.0 - Migrated from WooCommerce Subscriptions v2.5.3 * @return string */ public function get_default_subject() { } /** * Get the default e-mail heading. * * @since 1.0.0 - Migrated from WooCommerce Subscriptions v2.5.3 * @return string */ public function get_default_heading() { } /** * trigger function. * * @access public * @return void */ function trigger($subscription) { } /** * get_content_html function. * * @access public * @return string */ function get_content_html() { } /** * get_content_plain function. * * @access public * @return string */ function get_content_plain() { } /** * Initialise Settings Form Fields * * @access public * @return void */ function init_form_fields() { } } /** * Customer Completed Order Email * * Order complete emails are sent to the customer when the order is marked complete and usual indicates that the order has been shipped. * * @class WC_Email_Customer_Completed_Order * @version 1.0.0 - Migrated from WooCommerce Subscriptions v2.0.0 * @package WooCommerce/Classes/Emails * @author Prospress * @extends WC_Email */ class WCS_Email_Completed_Renewal_Order extends \WC_Email_Customer_Completed_Order { /** * Constructor */ function __construct() { } /** * Get the default e-mail subject. * * @since 1.0.0 - Migrated from WooCommerce Subscriptions v2.5.3 * @return string */ public function get_default_subject() { } /** * Get the default e-mail heading. * * @since 1.0.0 - Migrated from WooCommerce Subscriptions v2.5.3 * @return string */ public function get_default_heading() { } /** * trigger function. * * We need to override WC_Email_Customer_Completed_Order's trigger method because it expects to be run only once * per request (but multiple subscription renewal orders can be generated per request). * * @access public * @return void */ function trigger($order_id, $order = \null) { } /** * get_subject function. * * @access public * @return string */ function get_subject() { } /** * get_heading function. * * @access public * @return string */ function get_heading() { } /** * get_content_html function. * * @access public * @return string */ function get_content_html() { } /** * get_content_plain function. * * @access public * @return string */ function get_content_plain() { } /** * Gets the deprecated public variables for backwards compatibility. * * @param string $key Key. * * @return string|null */ public function __get($key) { } } /** * Customer Completed Switch Order Email * * Order switch email sent to customer when a subscription is switched successfully. * * @class WCS_Email_Completed_Switch_Order * @version 1.0.0 - Migrated from WooCommerce Subscriptions v2.0.0 * @package WooCommerce/Classes/Emails * @author Prospress * @extends WC_Email */ class WCS_Email_Completed_Switch_Order extends \WC_Email_Customer_Completed_Order { /** * @var array Subscriptions linked to the switch order. */ public $subscriptions; /** * Constructor */ function __construct() { } /** * Get the default e-mail subject. * * @since 1.0.0 - Migrated from WooCommerce Subscriptions v2.5.3 * @return string */ public function get_default_subject() { } /** * Get the default e-mail heading. * * @since 1.0.0 - Migrated from WooCommerce Subscriptions v2.5.3 * @return string */ public function get_default_heading() { } /** * trigger function. * * We need to override WC_Email_Customer_Completed_Order's trigger method because it expects to be run only once * per request (but multiple subscription switch orders can be generated per request). * * @access public * @return void */ function trigger($order_id, $order = \null) { } /** * get_subject function. * * @access public * @return string */ function get_subject() { } /** * get_heading function. * * @access public * @return string */ function get_heading() { } /** * get_content_html function. * * @access public * @return string */ function get_content_html() { } /** * get_content_plain function. * * @access public * @return string */ function get_content_plain() { } /** * Gets the deprecated public variables for backwards compatibility. * * @param string $key Key. * * @return string|null */ public function __get($key) { } } // Exit if accessed directly. /** * Customer On Hold Renewal Order Email. * * Order On Hold emails are sent to the customer when the renewal order is marked on-hold and usually indicates that the order is awaiting payment confirmation. * * @class WCS_Email_On-hold_Renewal_Order * @version 1.0.0 - Migrated from WooCommerce Subscriptions v3.0.0 * @package WooCommerce_Subscriptions/Includes/Emails * @author WooCommerce. * @extends WC_Email_Customer_On_Hold_Order */ class WCS_Email_Customer_On_Hold_Renewal_Order extends \WC_Email_Customer_On_Hold_Order { /** * Constructor. */ public function __construct() { } /** * Get the default e-mail subject. * * @since 1.0.0 - Migrated from WooCommerce Subscriptions v3.0.0 * @return string */ public function get_default_subject() { } /** * Get the default e-mail heading. * * @since 1.0.0 - Migrated from WooCommerce Subscriptions v3.0.0 * @return string */ public function get_default_heading() { } /** * Get content html. * * @return string */ public function get_content_html() { } /** * Get content plain. * * @return string */ public function get_content_plain() { } } /** * Expired Subscription Email * * An email sent to the admin when a subscription is expired. * * @class WCS_Email_Expired_Subscription * @version 1.0.0 - Migrated from WooCommerce Subscriptions v2.1 * @package WooCommerce_Subscriptions/Classes/Emails * @author Prospress * @extends WC_Email */ class WCS_Email_Expired_Subscription extends \WC_Email { /** * Create an instance of the class. * * @access public */ function __construct() { } /** * Get the default e-mail subject. * * @since 1.0.0 - Migrated from WooCommerce Subscriptions v2.5.3 * @return string */ public function get_default_subject() { } /** * Get the default e-mail heading. * * @since 1.0.0 - Migrated from WooCommerce Subscriptions v2.5.3 * @return string */ public function get_default_heading() { } /** * trigger function. * * @access public * @return void */ function trigger($subscription) { } /** * get_content_html function. * * @access public * @return string */ function get_content_html() { } /** * get_content_plain function. * * @access public * @return string */ function get_content_plain() { } /** * Initialise Settings Form Fields * * @access public * @return void */ function init_form_fields() { } } /** * New Order Email * * An email sent to the admin when a new order is received/paid for. * * @class WCS_Email_New_Renewal_Order * @version 1.0.0 - Migrated from WooCommerce Subscriptions v1.4 * @extends WC_Email_New_Order */ class WCS_Email_New_Renewal_Order extends \WC_Email_New_Order { /** * Constructor */ function __construct() { } /** * Get the default e-mail subject. * * @since 1.0.0 - Migrated from WooCommerce Subscriptions v2.5.3 * @return string */ public function get_default_subject() { } /** * Get the default e-mail heading. * * @since 1.0.0 - Migrated from WooCommerce Subscriptions v2.5.3 * @return string */ public function get_default_heading() { } /** * trigger function. * * We need to override WC_Email_New_Order's trigger method because it expects to be run only once * per request (but multiple subscription renewal orders can be generated per request). * * @access public * @return void */ function trigger($order_id, $order = \null) { } /** * get_content_html function. * * @access public * @return string */ function get_content_html() { } /** * get_content_plain function. * * @access public * @return string */ function get_content_plain() { } } /** * Subscription Switched Email * * An email sent to the admin when a customer switches their subscription. * * @class WCS_Email_New_Switch_Order * @version 1.0.0 - Migrated from WooCommerce Subscriptions v1.5 * @extends WC_Email_New_Order */ class WCS_Email_New_Switch_Order extends \WC_Email_New_Order { /** * @var array Subscriptions linked to the switch order. */ public $subscriptions; /** * Constructor */ function __construct() { } /** * Get the default e-mail subject. * * @since 1.0.0 - Migrated from WooCommerce Subscriptions v2.5.3 * @return string */ public function get_default_subject() { } /** * Get the default e-mail heading. * * @since 1.0.0 - Migrated from WooCommerce Subscriptions v2.5.3 * @return string */ public function get_default_heading() { } /** * trigger function. * * We need to override WC_Email_New_Order's trigger method because it expects to be run only once * per request. * * @access public * @return void */ function trigger($order_id, $order = \null) { } /** * get_content_html function. * * @access public * @return string */ function get_content_html() { } /** * get_content_plain function. * * @access public * @return string */ function get_content_plain() { } } /** * Suspended Subscription Email * * An email sent to the admin when a subscription is expired. * * @class WCS_Email_On_Hold_Subscription * @version 1.0.0 - Migrated from WooCommerce Subscriptions v2.1 * @package WooCommerce_Subscriptions/Classes/Emails * @author Prospress * @extends WC_Email */ class WCS_Email_On_Hold_Subscription extends \WC_Email { /** * Create an instance of the class. * * @access public */ function __construct() { } /** * Get the default e-mail subject. * * @since 1.0.0 - Migrated from WooCommerce Subscriptions v2.5.3 * @return string */ public function get_default_subject() { } /** * Get the default e-mail heading. * * @since 1.0.0 - Migrated from WooCommerce Subscriptions v2.5.3 * @return string */ public function get_default_heading() { } /** * trigger function. * * @access public * @return void */ function trigger($subscription) { } /** * get_content_html function. * * @access public * @return string */ function get_content_html() { } /** * get_content_plain function. * * @access public * @return string */ function get_content_plain() { } /** * Initialise Settings Form Fields * * @access public * @return void */ function init_form_fields() { } } /** * Customer Completed Order Email * * Order complete emails are sent to the customer when the order is marked complete and usual indicates that the order has been shipped. * * @class WC_Email_Customer_Completed_Order * @version 1.0.0 - Migrated from WooCommerce Subscriptions v2.0.0 * @package WooCommerce/Classes/Emails * @author Prospress * @extends WC_Email */ class WCS_Email_Processing_Renewal_Order extends \WC_Email_Customer_Processing_Order { /** * Constructor */ function __construct() { } /** * Get the default e-mail subject. * * @since 1.0.0 - Migrated from WooCommerce Subscriptions v2.5.3 * @return string */ public function get_default_subject() { } /** * Get the default e-mail heading. * * @since 1.0.0 - Migrated from WooCommerce Subscriptions v2.5.3 * @return string */ public function get_default_heading() { } /** * trigger function. * * We need to override WC_Email_Customer_Processing_Order's trigger method because it expects to be run only once * per request (but multiple subscription renewal orders can be generated per request). * * @access public * @return void */ function trigger($order_id, $order = \null) { } /** * get_subject function. * * @access public * @return string */ function get_subject() { } /** * get_heading function. * * @access public * @return string */ function get_heading() { } /** * get_content_html function. * * @access public * @return string */ function get_content_html() { } /** * get_content_plain function. * * @access public * @return string */ function get_content_plain() { } } /** * WC_Subscriptions_Gateway_Restrictions_Manager class */ class WC_Subscriptions_Gateway_Restrictions_Manager { /** * Initialize the class. */ public static function init() { } /** * Registers and enqueues payment gateway specific scripts. */ public static function enqueue_scripts() { } } class WCS_PayPal { /** @var WCS_PayPal_Express_API for communicating with PayPal */ protected static $api; /** @var WCS_PayPal single instance of this class */ protected static $instance; /** @var Array cache of PayPal IPN Handler */ protected static $ipn_handlers; /** @var Array cache of PayPal Standard settings in WooCommerce */ protected static $paypal_settings; /** * An internal cache of subscription IDs with a specific PayPal Standard Profile ID or Reference Transaction Billing Agreement. * * @var int[][] */ protected static $subscriptions_by_paypal_id = array(); /** * Main PayPal Instance, ensures only one instance is/can be loaded * * @see wc_paypal_express() * @return WCS_PayPal * @since 1.0.0 - Migrated from WooCommerce Subscriptions v2.0 */ public static function instance() { } /** * Bootstraps the class and hooks required actions & filters. * * @since 1.0.0 - Migrated from WooCommerce Subscriptions v2.0 */ public static function init() { } /** * Get a WooCommerce setting value for the PayPal Standard Gateway * * @since 1.0.0 - Migrated from WooCommerce Subscriptions v2.0 */ public static function get_option($setting_key) { } /** * Checks if the PayPal API credentials are set. * * @since 1.0.0 - Migrated from WooCommerce Subscriptions v2.0 */ public static function are_credentials_set() { } /** * Checks if the PayPal account has reference transactions setup * * Subscriptions keeps a record of all accounts where reference transactions were found to be enabled just in case the * store manager switches to and from accounts. This record is stored as a JSON encoded array in the options table. * * @since 1.0.0 - Migrated from WooCommerce Subscriptions v2.0 */ public static function are_reference_transactions_enabled($bypass_cache = '') { } /** * Handle WC API requests where we need to run a reference transaction API operation * * @since 1.0.0 - Migrated from WooCommerce Subscriptions v2.0 */ public static function handle_wc_api() { } /** * Override the default PayPal standard args in WooCommerce for subscription purchases when * automatic payments are enabled and when the recurring order totals is over $0.00 (because * PayPal doesn't support subscriptions with a $0 recurring total, we need to circumvent it and * manage it entirely ourselves.) * * @since 1.0.0 - Migrated from WooCommerce Subscriptions v2.0 */ public static function get_paypal_args($paypal_args, $order) { } /** * When a PayPal IPN messaged is received for a subscription transaction, * check the transaction details and * * @link https://developer.paypal.com/docs/classic/ipn/integration-guide/IPNandPDTVariables/ * * @since 1.0.0 - Migrated from WooCommerce Subscriptions v2.0 */ public static function process_ipn_request($transaction_details) { } /** * Check whether a given subscription is using reference transactions and if so process the payment. * * @since 1.0.0 - Migrated from WooCommerce Subscriptions v2.0 */ public static function process_subscription_payment($amount, $order) { } /** * Process a payment based on a response * * @since 1.0.0 - Migrated from WooCommerce Subscriptions v2.0.9 */ public static function process_subscription_payment_response($order, $response) { } /** * Don't transfer PayPal meta to resubscribe orders. * * @param object $resubscribe_order The order created for resubscribing the subscription * @param object $subscription The subscription to which the resubscribe order relates * @return object * @since 1.0.0 - Migrated from WooCommerce Subscriptions v2.0 */ public static function remove_resubscribe_order_meta($resubscribe_order, $subscription) { } /** * Adds script parameters necessary to display a JS dialog when changing a PayPal subscription's payment method. * * @since 1.0.0 - Migrated from WooCommerce Subscriptions v2.0 * * @param array $script_parameters The script parameters used in subscription meta boxes. * @return array $script_parameters */ public static function maybe_add_change_payment_method_warning($script_parameters) { } /** * This validates against payment lock for PP and returns false if we meet the criteria: * - is a parent order. * - payment method is paypal. * - PayPal Reference Transactions is disabled. * - order has lock. * - lock hasn't timeout. * * @param bool $needs_payment Does this order needs to process payment? * @param WC_Order $order The actual order. * * @return bool * @since 1.0.0 - Migrated from WooCommerce Subscriptions v2.5.3 */ public static function maybe_override_needs_payment($needs_payment, $order) { } /** * Adds payment lock meta when order is received and... * - order is valid. * - payment method is paypal. * - order needs payment. * - PayPal Reference Transactions is disabled. * - order is parent order of a subscription. * * @since 1.0.0 - Migrated from WooCommerce Subscriptions v2.5.3 */ public static function maybe_add_payment_lock() { } /** * Removes payment lock when order is parent and has paypal method. * * @param int $order_id Order cancelled/paid. * * @since 1.0.0 - Migrated from WooCommerce Subscriptions v2.5.3 */ public static function maybe_remove_payment_lock($order_id) { } /** * Allow PayPal domains for redirect. * * @since 1.0.0 * * @param array $hosts Add PayPal domains for `wp_safe_redirect`. * * @return array */ public static function allow_paypal_redirect($hosts) { } /** Getters ******************************************************/ /** * Get the API object * * @see SV_WC_Payment_Gateway::get_api() * @return WC_PayPal_Express_API API instance * @since 1.0.0 - Migrated from WooCommerce Subscriptions v2.0 */ protected static function get_ipn_handler($ipn_type = 'standard') { } /** * Get the API object * * @return WCS_PayPal_Express_API API instance * @since 1.0.0 - Migrated from WooCommerce Subscriptions v2.0 */ public static function get_api() { } /** * Return the default WC PayPal gateway's settings. * * @since 1.0.0 - Migrated from WooCommerce Subscriptions v2.0 */ public static function reload_options() { } /** * Return the default WC PayPal gateway's settings. * * @since 1.0.0 - Migrated from WooCommerce Subscriptions v2.0 */ protected static function get_options() { } /** Logging **/ /** * Log API request/response data * * @since 1.0.0 - Migrated from WooCommerce Subscriptions v2.0 */ public static function log_api_requests($request_data, $response_data) { } /** Method required by WCS_SV_API_Base, which normally requires an instance of SV_WC_Plugin **/ public function get_plugin_name() { } public function get_version() { } public function get_id() { } /** * Set the default value for whether PayPal Standard is enabled or disabled for subscriptions purchases. * * PayPal Standard will be enabled for subscriptions when: * - PayPal is enabled. * - The store has existing subscriptions. * * In any other case, it will be disabled by default. * This function is called when 2.5.0 is active for the first time. @see WC_Subscriptions_Upgrader::upgrade() * * @since 1.0.0 - Migrated from WooCommerce Subscriptions v2.5.0 */ public static function set_enabled_for_subscriptions_default() { } /** * Remove PayPal Standard as an available payment method if it is disabled for subscriptions. * * @param array $available_gateways A list of available payment methods displayed on the checkout. * @return array * @since 1.0.0 - Migrated from WooCommerce Subscriptions v2.5.0 */ public static function maybe_remove_paypal_standard($available_gateways) { } /** * Gets subscriptions with a given paypal subscription id. * * @since 1.0.0 - Migrated from WooCommerce Subscriptions v2.5.4 * @param string $paypal_id The PayPal Standard Profile ID or PayPal Reference Transactions Billing Agreement. * @param string $return Optional. The type to return. Can be 'ids' to return subscription IDs or 'objects' to return WC_Subscription objects. Default 'ids'. * @return WC_Subscription[]|int[] Subscriptions (objects or IDs) with the PayPal Profile ID or Billing Agreement stored in meta. */ public static function get_subscriptions_by_paypal_id($paypal_id, $return = 'ids') { } } /** * # WooCommerce Plugin Framework API Base Class * * This class provides a standardized framework for constructing an API wrapper * to external services. It is designed to be extremely flexible. * * @version 1.0.0 - Migrated from WooCommerce Subscriptions v2.2.0 */ abstract class WCS_SV_API_Base { /** @var string request method, defaults to POST */ protected $request_method = 'POST'; /** @var string URI used for the request */ protected $request_uri; /** @var array request headers */ protected $request_headers = array(); /** @var string request user-agent */ protected $request_user_agent; /** @var string request HTTP version, defaults to 1.0 */ protected $request_http_version = '1.0'; /** @var string request duration */ protected $request_duration; /** @var object request */ protected $request; /** @var string response code */ protected $response_code; /** @var string response message */ protected $response_message; /** @var array response headers */ protected $response_headers; /** @var string raw response body */ protected $raw_response_body; /** @var string response handler class name */ protected $response_handler; /** @var object response */ protected $response; /** * Perform the request and return the parsed response * * @since 1.0.0 - Migrated from WooCommerce Subscriptions v2.2.0 * @param object $request class instance which implements \SV_WC_API_Request * @throws Exception * @return object class instance which implements \SV_WC_API_Response */ protected function perform_request($request) { } /** * Simple wrapper for wp_remote_request() so child classes can override this * and provide their own transport mechanism if needed, e.g. a custom * cURL implementation * * @since 1.0.0 - Migrated from WooCommerce Subscriptions v2.2.0 * @param string $request_uri * @param string $request_args * @return array|WP_Error */ protected function do_remote_request($request_uri, $request_args) { } /** * Handle and parse the response * * @since 1.0.0 - Migrated from WooCommerce Subscriptions v2.2.0 * @param array|WP_Error $response response data * @throws Exception network issues, timeouts, API errors, etc * @return object request class instance that implements SV_WC_API_Request */ protected function handle_response($response) { } /** * Allow child classes to validate a response prior to instantiating the * response object. Useful for checking response codes or messages, e.g. * throw an exception if the response code is not 200. * * A child class implementing this method should simply return true if the response * processing should continue, or throw a \SV_WC_API_Exception with a * relevant error message & code to stop processing. * * Note: Child classes *must* sanitize the raw response body before throwing * an exception, as it will be included in the broadcast_request() method * which is typically used to log requests. * * @since 1.0.0 - Migrated from WooCommerce Subscriptions v2.2.0 */ protected function do_pre_parse_response_validation() { } /** * Allow child classes to validate a response after it has been parsed * and instantiated. This is useful for check error codes or messages that * exist in the parsed response. * * A child class implementing this method should simply return true if the response * processing should continue, or throw an Exception with a * relevant error message & code to stop processing. * * Note: Response body sanitization is handled automatically * * @since 1.0.0 - Migrated from WooCommerce Subscriptions v2.2.0 */ protected function do_post_parse_response_validation() { } /** * Return the parsed response object for the request * * @since 1.0.0 - Migrated from WooCommerce Subscriptions v2.2.0 * @param string $raw_response_body * @return object response class instance which implements SV_WC_API_Request */ protected function get_parsed_response($raw_response_body) { } /** * Alert other actors that a request has been performed. This is primarily used * for request logging. * * @since 1.0.0 - Migrated from WooCommerce Subscriptions v2.2.0 */ protected function broadcast_request() { } /** * Reset the API response members to their * * @since 1.0.0 - Migrated from WooCommerce Subscriptions v1.0.0 */ protected function reset_response() { } /** Request Getters *******************************************************/ /** * Get the request URI * * @since 1.0.0 - Migrated from WooCommerce Subscriptions v2.2.0 * @return string */ protected function get_request_uri() { } /** * Get the request arguments in the format required by wp_remote_request() * * @since 1.0.0 - Migrated from WooCommerce Subscriptions v2.2.0 * @return mixed|void */ protected function get_request_args() { } /** * Get the request method, POST by default * * @since 1.0.0 - Migrated from WooCommerce Subscriptions v2.2.0 * @return string */ protected function get_request_method() { } /** * Get the request HTTP version, 1.1 by default * * @since 1.0.0 - Migrated from WooCommerce Subscriptions v2.2.0 * @return string */ protected function get_request_http_version() { } /** * Get the request headers * * @since 1.0.0 - Migrated from WooCommerce Subscriptions v2.2.0 * @return array */ protected function get_request_headers() { } /** * Get sanitized request headers suitable for logging, stripped of any * confidential information * * The `Authorization` header is sanitized automatically. * * Child classes that implement any custom authorization headers should * override this method to perform sanitization. * * @since 1.0.0 - Migrated from WooCommerce Subscriptions v2.2.0 * @return array */ protected function get_sanitized_request_headers() { } /** * Get the request user agent, defaults to: * * Dasherized-Plugin-Name/Plugin-Version (WooCommerce/WC-Version; WordPress/WP-Version) * * @since 1.0.0 - Migrated from WooCommerce Subscriptions v2.2.0 * @return string */ protected function get_request_user_agent() { } /** * Get the request duration in seconds, rounded to the 5th decimal place * * @since 1.0.0 - Migrated from WooCommerce Subscriptions v2.2.0 * @return string */ protected function get_request_duration() { } /** Response Getters ******************************************************/ /** * Get the response handler class name * * @since 1.0.0 - Migrated from WooCommerce Subscriptions v2.2.0 * @return string */ protected function get_response_handler() { } /** * Get the response code * * @since 1.0.0 - Migrated from WooCommerce Subscriptions v2.2.0 * @return string */ protected function get_response_code() { } /** * Get the response message * * @since 1.0.0 - Migrated from WooCommerce Subscriptions v2.2.0 * @return string */ protected function get_response_message() { } /** * Get the response headers * * @since 1.0.0 - Migrated from WooCommerce Subscriptions v2.2.0 * @return array */ protected function get_response_headers() { } /** * Get the raw response body, prior to any parsing or sanitization * * @since 1.0.0 - Migrated from WooCommerce Subscriptions v2.2.0 * @return string */ protected function get_raw_response_body() { } /** * Get the sanitized response body, provided by the response class * to_string_safe() method * * @since 1.0.0 - Migrated from WooCommerce Subscriptions v2.2.0 * @return string|null */ protected function get_sanitized_response_body() { } /** Misc Getters ******************************************************/ /** * Returns the most recent request object * * @since 1.0.0 - Migrated from WooCommerce Subscriptions v2.2.0 * @see \SV_WC_API_Request * @return object the most recent request object */ public function get_request() { } /** * Returns the most recent response object * * @since 1.0.0 - Migrated from WooCommerce Subscriptions v2.2.0 * @see \SV_WC_API_Response * @return object the most recent response object */ public function get_response() { } /** * Get the ID for the API, used primarily to namespace the action name * for broadcasting requests * * @since 1.0.0 - Migrated from WooCommerce Subscriptions v2.2.0 * @return string */ protected function get_api_id() { } /** * Return a new request object * * Child classes must implement this to return an object that implements * \SV_WC_API_Request which should be used in the child class API methods * to build the request. The returned SV_WC_API_Request should be passed * to self::perform_request() by your concrete API methods * * @since 1.0.0 - Migrated from WooCommerce Subscriptions v2.2.0 * @param array $args optional request arguments * @return SV_WC_API_Request */ protected abstract function get_new_request($args = array()); /** * Return the plugin class instance associated with this API * * Child classes must implement this to return their plugin class instance * * This is used for defining the plugin ID used in filter names, as well * as the plugin name used for the default user agent. * * @since 1.0.0 - Migrated from WooCommerce Subscriptions v2.2.0 * @return SV_WC_Plugin */ protected abstract function get_plugin(); /** Setters ***************************************************************/ /** * Set a header request * * @since 1.0.0 - Migrated from WooCommerce Subscriptions v2.2.0 * @param string $name header name * @param string $value header value * @return string */ protected function set_request_header($name, $value) { } /** * Set HTTP basic auth for the request * * Since 2.2.0 * @param string $username * @param string $password */ protected function set_http_basic_auth($username, $password) { } /** * Set the Content-Type request header * * @since 1.0.0 - Migrated from WooCommerce Subscriptions v2.2.0 * @param string $content_type */ protected function set_request_content_type_header($content_type) { } /** * Set the Accept request header * * @since 1.0.0 - Migrated from WooCommerce Subscriptions v2.2.0 * @param string $type the request accept type */ protected function set_request_accept_header($type) { } /** * Set the response handler class name. This class will be instantiated * to parse the response for the request. * * Note the class should implement SV_WC_API * * @since 1.0.0 - Migrated from WooCommerce Subscriptions v2.2.0 * @param string $handler handle class name * @return array */ protected function set_response_handler($handler) { } } class WCS_PayPal_Admin { /** * Bootstraps the class and hooks required actions & filters. * * @since 1.0.0 - Migrated from WooCommerce Subscriptions v2.0 */ public static function init() { } /** * Adds extra PayPal credential fields required to manage subscriptions. * * @since 1.0.0 - Migrated from WooCommerce Subscriptions v2.0 */ public static function add_form_fields() { } /** * Handle requests to check whether a PayPal account has Reference Transactions enabled * * @since 1.0.0 - Migrated from WooCommerce Subscriptions v2.0 */ public static function maybe_check_account() { } /** * Display an assortment of notices to administrators to encourage them to get PayPal setup right. * * @since 1.0.0 - Migrated from WooCommerce Subscriptions v2.0 */ public static function maybe_show_admin_notices() { } /** * Disable the invalid profile notice when requested. * * @since 1.0.0 - Migrated from WooCommerce Subscriptions v2.0 */ protected static function maybe_disable_invalid_profile_notice() { } /** * Remove the invalid credentials error flag whenever a new set of API credentials are saved. * * @since 1.0.0 - Migrated from WooCommerce Subscriptions v2.0 */ public static function maybe_update_credentials_error_flag() { } /** * Prints link to the PayPal's profile related to the provided subscription * * @param WC_Subscription $subscription */ public static function profile_link($subscription) { } /** * Add the enabled or subscriptions setting. * * @param array $settings The WooCommerce PayPal Settings array. * @return array * @since 1.0.0 - Migrated from WooCommerce Subscriptions v2.5.0 */ public static function add_enable_for_subscriptions_setting($settings) { } } class WCS_PayPal_Change_Payment_Method_Admin { /** * Bootstraps the class and hooks required actions & filters. * * @since 1.0.0 - Migrated from WooCommerce Subscriptions v2.0 */ public static function init() { } /** * Include the PayPal payment meta data required to process automatic recurring payments so that store managers can * manually set up automatic recurring payments for a customer via the Edit Subscription screen. * * @param array $payment_meta associative array of meta data required for automatic payments * @param WC_Subscription $subscription An instance of a subscription object * @return array * @since 1.0.0 - Migrated from WooCommerce Subscriptions v2.0 */ public static function add_payment_meta_details($payment_meta, $subscription) { } /** * Validate the payment meta data required to process automatic recurring payments so that store managers can * manually set up automatic recurring payments for a customer via the Edit Subscription screen. * * @param string $payment_method_id The ID of the payment method to validate * @param array $payment_meta associative array of meta data required for automatic payments * @return array * @since 1.0.0 - Migrated from WooCommerce Subscriptions v2.0 */ public static function validate_payment_meta($payment_meta, $subscription) { } } class WCS_PayPal_Reference_Transaction_API_Request { /** auth/capture transaction type */ const AUTH_CAPTURE = 'Sale'; /** @var array the request parameters */ private $parameters = array(); /** * Construct an PayPal Express request object * * @param string $api_username the API username * @param string $api_password the API password * @param string $api_signature the API signature * @param string $api_version the API version * @since 1.0.0 - Migrated from WooCommerce Subscriptions v2.0 */ public function __construct($api_username, $api_password, $api_signature, $api_version) { } /** * Sets up the express checkout transaction * * @link https://developer.paypal.com/docs/classic/express-checkout/integration-guide/ECGettingStarted/#id084RN060BPF * @link https://developer.paypal.com/webapps/developer/docs/classic/api/merchant/SetExpressCheckout_API_Operation_NVP/ * * @param array $args { * @type string 'currency' (Optional) A 3-character currency code (default is store's currency). * @type string 'billing_type' (Optional) Type of billing agreement for reference transactions. You must have permission from PayPal to use this field. This field must be set to one of the following values: MerchantInitiatedBilling - PayPal creates a billing agreement for each transaction associated with buyer. You must specify version 54.0 or higher to use this option; MerchantInitiatedBillingSingleAgreement - PayPal creates a single billing agreement for all transactions associated with buyer. Use this value unless you need per-transaction billing agreements. You must specify version 58.0 or higher to use this option. * @type string 'billing_description' (Optional) Description of goods or services associated with the billing agreement. This field is required for each recurring payment billing agreement if using MerchantInitiatedBilling as the billing type, that means you can use a different agreement for each subscription/order. PayPal recommends that the description contain a brief summary of the billing agreement terms and conditions (but this only makes sense when the billing type is MerchantInitiatedBilling, otherwise the terms will be incorrectly displayed for all agreements). For example, buyer is billed at "9.99 per month for 2 years". * @type string 'maximum_amount' (Optional) The expected maximum total amount of the complete order and future payments, including shipping cost and tax charges. If you pass the expected average transaction amount (default 25.00). PayPal uses this value to validate the buyer's funding source. * @type string 'no_shipping' (Optional) Determines where or not PayPal displays shipping address fields on the PayPal pages. For digital goods, this field is required, and you must set it to 1. It is one of the following values: 0 – PayPal displays the shipping address on the PayPal pages; 1 – PayPal does not display shipping address fields whatsoever (default); 2 – If you do not pass the shipping address, PayPal obtains it from the buyer's account profile. * @type string 'page_style' (Optional) Name of the Custom Payment Page Style for payment pages associated with this button or link. It corresponds to the HTML variable page_style for customizing payment pages. It is the same name as the Page Style Name you chose to add or edit the page style in your PayPal Account profile. * @type string 'brand_name' (Optional) A label that overrides the business name in the PayPal account on the PayPal hosted checkout pages. Default: store name. * @type string 'landing_page' (Optional) Type of PayPal page to display. It is one of the following values: 'login' – PayPal account login (default); 'Billing' – Non-PayPal account. * @type string 'payment_action' (Optional) How you want to obtain payment. If the transaction does not include a one-time purchase, this field is ignored. Default 'Sale' – This is a final sale for which you are requesting payment (default). Alternative: 'Authorization' – This payment is a basic authorization subject to settlement with PayPal Authorization and Capture. You cannot set this field to Sale in SetExpressCheckout request and then change the value to Authorization or Order in the DoExpressCheckoutPayment request. If you set the field to Authorization or Order in SetExpressCheckout, you may set the field to Sale. * @type string 'return_url' (Required) URL to which the buyer's browser is returned after choosing to pay with PayPal. * @type string 'cancel_url' (Required) URL to which the buyer is returned if the buyer does not approve the use of PayPal to pay you. * @type string 'custom' (Optional) A free-form field for up to 256 single-byte alphanumeric characters * } * @since 1.0.0 - Migrated from WooCommerce Subscriptions v2.0 */ public function set_express_checkout($args) { } /** * Set up the DoExpressCheckoutPayment request * * @link https://developer.paypal.com/docs/classic/express-checkout/integration-guide/ECGettingStarted/#id084RN060BPF * @link https://developer.paypal.com/webapps/developer/docs/classic/api/merchant/DoExpressCheckoutPayment_API_Operation_NVP/ * * @since 1.0.0 - Migrated from WooCommerce Subscriptions v2.0.9 * @param string $token PayPal Express Checkout token returned by SetExpressCheckout operation * @param WC_Order $order order object * @param string $type */ public function do_express_checkout($token, \WC_Order $order, $args) { } /** * Get info about the buyer & transaction from PayPal * * @link https://developer.paypal.com/docs/classic/express-checkout/integration-guide/ECGettingStarted/#id084RN060BPF * @link https://developer.paypal.com/webapps/developer/docs/classic/api/merchant/GetExpressCheckoutDetails_API_Operation_NVP/ * * @param string $token token from SetExpressCheckout response * @since 1.0.0 - Migrated from WooCommerce Subscriptions v2.0 */ public function get_express_checkout_details($token) { } /** * Create a billing agreement, required when a subscription sign-up has no initial payment * * @link https://developer.paypal.com/docs/classic/express-checkout/integration-guide/ECReferenceTxns/#id094TB0Y0J5Z__id094TB4003HS * @link https://developer.paypal.com/docs/classic/api/merchant/CreateBillingAgreement_API_Operation_NVP/ * * @param string $token token from SetExpressCheckout response * @since 1.0.0 - Migrated from WooCommerce Subscriptions v2.0 */ public function create_billing_agreement($token) { } /** * Charge a payment against a reference token * * @link https://developer.paypal.com/docs/classic/express-checkout/integration-guide/ECReferenceTxns/#id094UM0DA0HS * @link https://developer.paypal.com/docs/classic/api/merchant/DoReferenceTransaction_API_Operation_NVP/ * * @param string $reference_id the ID of a reference object, e.g. billing agreement ID. * @param WC_Order $order order object * @param array $args { * @type string 'payment_type' (Optional) Specifies type of PayPal payment you require for the billing agreement. It is one of the following values. 'Any' or 'InstantOnly'. Echeck is not supported for DoReferenceTransaction requests. * @type string 'payment_action' How you want to obtain payment. It is one of the following values: 'Authorization' - this payment is a basic authorization subject to settlement with PayPal Authorization and Capture; or 'Sale' - This is a final sale for which you are requesting payment. * @type string 'return_fraud_filters' (Optional) Flag to indicate whether you want the results returned by Fraud Management Filters. By default, you do not receive this information. * } * @since 1.0.0 - Migrated from WooCommerce Subscriptions v2.0 */ public function do_reference_transaction($reference_id, $order, $args = array()) { } /** * Set up the payment details for a DoExpressCheckoutPayment or DoReferenceTransaction request * * @since 1.0.0 - Migrated from WooCommerce Subscriptions v2.0.9 * @param WC_Order $order order object * @param string $type the type of transaction for the payment * @param bool $use_deprecated_params whether to use deprecated PayPal NVP parameters (required for DoReferenceTransaction API calls) */ protected function add_payment_details_parameters(\WC_Order $order, $type, $use_deprecated_params = \false) { } /** * Performs an Express Checkout NVP API operation as passed in $api_method. * * Although the PayPal Standard API provides no facility for cancelling a subscription, the PayPal * Express Checkout NVP API can be used. * * @since 1.0.0 - Migrated from WooCommerce Subscriptions v2.0 */ public function manage_recurring_payments_profile_status($profile_id, $new_status, $order = \null) { } /** Helper Methods ******************************************************/ /** * Add a parameter * * @param string $key * @param string|int $value * @since 1.0.0 - Migrated from WooCommerce Subscriptions v2.0 */ private function add_parameter($key, $value) { } /** * Add multiple parameters * * @param array $params * @since 1.0.0 - Migrated from WooCommerce Subscriptions v2.0 */ private function add_parameters(array $params) { } /** * Set the method for the request, currently using: * * + `SetExpressCheckout` - setup transaction * + `GetExpressCheckout` - gets buyers info from PayPal * + `DoExpressCheckoutPayment` - completes the transaction * + `DoCapture` - captures a previously authorized transaction * * @param string $method * @since 1.0.0 - Migrated from WooCommerce Subscriptions v2.0 */ private function set_method($method) { } /** * Add payment parameters, auto-prefixes the parameter key with `PAYMENTREQUEST_0_` * for convenience and readability * * @param array $params * @since 1.0.0 - Migrated from WooCommerce Subscriptions v2.0 */ private function add_payment_parameters(array $params) { } /** * Adds a line item parameters to the request, auto-prefixes the parameter key * with `L_PAYMENTREQUEST_0_` for convenience and readability * * @param array $params * @param int $item_count current item count * @since 1.0.0 - Migrated from WooCommerce Subscriptions v2.0 */ private function add_line_item_parameters(array $params, $item_count, $use_deprecated_params = \false) { } /** * Helper method to return the item description, which is composed of item * meta flattened into a comma-separated string, if available. Otherwise the * product SKU is included. * * The description is automatically truncated to the 127 char limit. * * @param array $item cart or order item * @param \WC_Product $product product data * @return string * @since 1.0.0 - Migrated from WooCommerce Subscriptions v2.0 */ private function get_item_description($item, $product) { } /** * Returns the string representation of this request * * @see SV_WC_Payment_Gateway_API_Request::to_string() * @return string the request query string * @since 1.0.0 - Migrated from WooCommerce Subscriptions v2.0 */ public function to_string() { } /** * Returns the string representation of this request with any and all * sensitive elements masked or removed * * @see SV_WC_Payment_Gateway_API_Request::to_string_safe() * @return string the pretty-printed request array string representation, safe for logging * @since 1.0.0 - Migrated from WooCommerce Subscriptions v2.0 */ public function to_string_safe() { } /** * Returns the request parameters after validation & filtering * * @throws \Exception invalid amount * @return array request parameters * @since 1.0.0 - Migrated from WooCommerce Subscriptions v2.0 */ public function get_parameters() { } /** * Returns the method for this request. PPE uses the API default request * method (POST) * * @return null * @since 1.0.0 - Migrated from WooCommerce Subscriptions v2.0 */ public function get_method() { } /** * Returns the request path for this request. PPE request paths do not * vary per request * * @return string * @since 1.0.0 - Migrated from WooCommerce Subscriptions v2.0 */ public function get_path() { } /** * PayPal cannot properly calculate order totals when prices include tax (due * to rounding issues), so line items are skipped and the order is sent as * a single item * * @since 1.0.0 - Migrated from WooCommerce Subscriptions v2.0.9 * @param WC_Order $order Optional. The WC_Order object. Default null. * @return bool true if line items should be skipped, false otherwise */ private function skip_line_items($order = \null, $order_items = \null) { } /** * Round a float * * @since 1.0.0 - Migrated from WooCommerce Subscriptions v2.0.9 * @param float $number * @param int $precision Optional. The number of decimal digits to round to. */ private function round($number, $precision = 2) { } /** * Format prices. * * @since 1.0.0 - Migrated from WooCommerce Subscriptions v2.2.12 * @param float|int|null $price * @param int $decimals Optional. The number of decimal points. * @return string */ private function price_format($price, $decimals = 2) { } } class WCS_PayPal_Reference_Transaction_API_Response extends \WC_Gateway_Paypal_Response { /** @var array URL-decoded and parsed parameters */ protected $parameters = array(); /** * Parse the response parameters from the raw URL-encoded response string * * @link https://developer.paypal.com/docs/classic/api/NVPAPIOverview/#id084FBM0M0HS * * @param string $response the raw URL-encoded response string * @since 1.0.0 - Migrated from WooCommerce Subscriptions v2.0 */ public function __construct($response) { } /** * Checks if response contains an API error code * * @link https://developer.paypal.com/docs/classic/api/errorcodes/ * * @return bool true if has API error, false otherwise * @since 1.0.0 - Migrated from WooCommerce Subscriptions v2.0 */ public function has_api_error() { } /** * Checks if response contains an API error code or message relating to invalid credentials * * @link https://developer.paypal.com/docs/classic/api/errorcodes/ * * @return bool true if has API error relating to incorrect credentials, false otherwise * @since 1.0.0 - Migrated from WooCommerce Subscriptions v2.1 */ public function has_api_error_for_credentials() { } /** * Gets the API error code * * Note that PayPal can return multiple error codes, which are merged here * for convenience * * @link https://developer.paypal.com/docs/classic/api/errorcodes/ * * @return string * @since 1.0.0 - Migrated from WooCommerce Subscriptions v2.0 */ public function get_api_error_code() { } /** * Gets the API error message * * Note that PayPal can return multiple error messages, which are merged here * for convenience * * @link https://developer.paypal.com/docs/classic/api/errorcodes/ * * @return string * @since 1.0.0 - Migrated from WooCommerce Subscriptions v2.0 */ public function get_api_error_message() { } /** * Returns true if the parameter is not empty * * @param string $name parameter name * @return bool * @since 1.0.0 - Migrated from WooCommerce Subscriptions v2.0 */ protected function has_parameter($name) { } /** * Gets the parameter value, or null if parameter is not set or empty * * @param string $name parameter name * @return string|null * @since 1.0.0 - Migrated from WooCommerce Subscriptions v2.0 */ protected function get_parameter($name) { } /** * Returns a message appropriate for a frontend user. This should be used * to provide enough information to a user to allow them to resolve an * issue on their own, but not enough to help nefarious folks fishing for * info. * * @link https://developer.paypal.com/docs/classic/api/errorcodes/ * * @return string user message, if there is one * @since 1.0.0 - Migrated from WooCommerce Subscriptions v2.0 */ public function get_user_message() { } /** * Returns the string representation of this response * * @return string response * @since 1.0.0 - Migrated from WooCommerce Subscriptions v2.0 */ public function to_string() { } /** * Returns the string representation of this response with any and all * sensitive elements masked or removed * * @return string response safe for logging/displaying * @since 1.0.0 - Migrated from WooCommerce Subscriptions v2.0 */ public function to_string_safe() { } /** * Get the order for a request based on the 'custom' response field * * @see WC_Gateway_Paypal_Response::get_paypal_order() * @param string $response the raw URL-encoded response string * @since 1.0.0 - Migrated from WooCommerce Subscriptions v2.0 */ public function get_order() { } } class WCS_PayPal_Reference_Transaction_API_Response_Billing_Agreement extends \WCS_PayPal_Reference_Transaction_API_Response { /** * Get the billing agreement ID which is returned after a successful CreateBillingAgreement API call * * @return string|null * @since 1.0.0 - Migrated from WooCommerce Subscriptions v2.0.0 */ public function get_billing_agreement_id() { } } class WCS_PayPal_Reference_Transaction_API_Response_Checkout extends \WCS_PayPal_Reference_Transaction_API_Response { /** * Get the token which is returned after a successful SetExpressCheckout * API call * * @return string|null * @since 1.0.0 - Migrated from WooCommerce Subscriptions v2.0 */ public function get_token() { } /** * Get the billing agreement status for a successful SetExpressCheckout * * @since 1.0.0 - Migrated from WooCommerce Subscriptions v3.0.0 * @return string|null * @since 1.0.0 - Migrated from WooCommerce Subscriptions v2.0 */ public function get_billing_agreement_status() { } /** * Get the shipping details from GetExpressCheckoutDetails response mapped to the WC shipping address format * * @since 1.0.0 - Migrated from WooCommerce Subscriptions v3.0.0 * @return array * @since 1.0.0 - Migrated from WooCommerce Subscriptions v2.0 */ public function get_shipping_details() { } /** * Get the note text from checkout details * * @return string * @since 1.0.0 - Migrated from WooCommerce Subscriptions v2.0 */ public function get_note_text() { } /** * Gets the payer ID from checkout details, a payer ID is a Unique PayPal Customer Account identification number * * @return string * @since 1.0.0 - Migrated from WooCommerce Subscriptions v2.0 */ public function get_payer_id() { } /** * Get state code given a full state name and country code * * @param string $country_code country code sent by PayPal * @param string $state state name or code sent by PayPal * @return string state code * @since 1.0.0 - Migrated from WooCommerce Subscriptions v2.0 */ private function get_state_code($country_code, $state) { } } class WCS_PayPal_Reference_Transaction_API_Response_Payment extends \WCS_PayPal_Reference_Transaction_API_Response_Billing_Agreement { /** approved transaction response payment status */ const TRANSACTION_COMPLETED = 'Completed'; /** in progress transaction response payment status */ const TRANSACTION_INPROGRESS = 'In-Progress'; /** in progress transaction response payment status */ const TRANSACTION_PROCESSED = 'Processed'; /** pending transaction response payment status */ const TRANSACTION_PENDING = 'Pending'; /** @var array URL-decoded and parsed parameters */ protected $successful_statuses = array(); /** * Parse the payment response * * @see WC_PayPal_Express_API_Response::__construct() * @param string $response the raw URL-encoded response string * @since 1.0.0 - Migrated from WooCommerce Subscriptions v2.0 */ public function __construct($response) { } /** * Checks if the transaction was successful * * @return bool true if approved, false otherwise * @since 1.0.0 - Migrated from WooCommerce Subscriptions v2.0 */ public function transaction_approved() { } /** * Returns true if the payment is pending, for instance if the payment was authorized, but not captured. There are many other * possible reasons * * @link https://developer.paypal.com/docs/classic/api/merchant/DoExpressCheckoutPayment_API_Operation_NVP/#id105CAM003Y4__id116RI0UF0YK * * @return bool true if the transaction was held, false otherwise * @since 1.0.0 - Migrated from WooCommerce Subscriptions v2.0 */ public function transaction_held() { } /** * Gets the response status code, or null if there is no status code associated with this transaction. * * @link https://developer.paypal.com/docs/classic/api/merchant/DoExpressCheckoutPayment_API_Operation_NVP/#id105CAM003Y4__id116RI0UF0YK * * @return string status code * @since 1.0.0 - Migrated from WooCommerce Subscriptions v2.0 */ public function get_status_code() { } /** * Gets the response status message, or null if there is no status message associated with this transaction. * * PayPal provides additional info only for Pending or Completed-Funds-Held transactions. * * @return string status message * @since 1.0.0 - Migrated from WooCommerce Subscriptions v2.0 */ public function get_status_message() { } /** * Gets the response transaction id, or null if there is no transaction id associated with this transaction. * * @return string transaction id * @since 1.0.0 - Migrated from WooCommerce Subscriptions v2.0 */ public function get_transaction_id() { } /** * Return true if the response has a payment type other than `none` * * @return bool * @since 1.0.0 - Migrated from WooCommerce Subscriptions v2.0 */ public function has_payment_type() { } /** * Get the PayPal payment type, either `none`, `echeck`, or `instant` * * @since 1.0.0 - Migrated from WooCommerce Subscriptions v2.0.9 * @return string */ public function get_payment_type() { } /** * Gets payment status * * @return string * @since 1.0.0 - Migrated from WooCommerce Subscriptions v2.0 */ private function get_payment_status() { } /** * Gets the pending reason * * @return string * @since 1.0.0 - Migrated from WooCommerce Subscriptions v2.0 */ private function get_pending_reason() { } /** AVS/CSC Methods *******************************************************/ /** * PayPal Express does not return an authorization code * * @return string credit card authorization code * @since 1.0.0 - Migrated from WooCommerce Subscriptions v2.0 */ public function get_authorization_code() { } /** * Returns the result of the AVS check * * @return string result of the AVS check, if any * @since 1.0.0 - Migrated from WooCommerce Subscriptions v2.0 */ public function get_avs_result() { } /** * Returns the result of the CSC check * * @return string result of CSC check * @since 1.0.0 - Migrated from WooCommerce Subscriptions v2.0 */ public function get_csc_result() { } /** * Returns true if the CSC check was successful * * @return boolean true if the CSC check was successful * @since 1.0.0 - Migrated from WooCommerce Subscriptions v2.0 */ public function csc_match() { } /** * Return any fraud management data available. This data is explicitly * enabled in the request, but PayPal recommends checking certain error * conditions prior to accessing this data. * * This data provides additional context for why a transaction was held for * review or declined. * * @link https://developer.paypal.com/webapps/developer/docs/classic/fmf/integration-guide/FMFProgramming/#id091UNG0065Z * @link https://developer.paypal.com/webapps/developer/docs/classic/api/merchant/DoReferenceTransaction_API_Operation_NVP/#id09BUI01L0K3__id0861GA0N07U (L_FMFfilterIDn Type Fields) * * @return array $filters { * @type string $id filter ID, integer from 1-17 * @type string name filter name, short description for filter * } * @since 1.0.0 - Migrated from WooCommerce Subscriptions v2.0 */ private function get_fraud_filters() { } /** * Check if the response has a specific payment parameter. * * A wrapper around @see WCS_PayPal_Reference_Transaction_API_Response::has_parameter() * that prepends the @see self::get_payment_parameter_prefix(). * * @since 1.0.0 - Migrated from WooCommerce Subscriptions v2.0.9 * @param string $name parameter name * @return bool */ protected function has_payment_parameter($name) { } /** * Gets a given payment parameter's value, or null if parameter is not set or empty. * * A wrapper around @see WCS_PayPal_Reference_Transaction_API_Response::get_parameter() * that prepends the @see self::get_payment_parameter_prefix(). * * @since 1.0.0 - Migrated from WooCommerce Subscriptions v2.0.9 * @param string $name parameter name * @return string|null */ protected function get_payment_parameter($name) { } /** * DoExpressCheckoutPayment API responses have a prefix for the payment * parameters. Parallels payments are not used, so the numeric portion of * the prefix is always '0' * * @since 1.0.0 - Migrated from WooCommerce Subscriptions v2.0.9 * @return string */ protected function get_payment_parameter_prefix() { } } class WCS_PayPal_Reference_Transaction_API_Response_Recurring_Payment extends \WCS_PayPal_Reference_Transaction_API_Response_Payment { /** * Parse the payment response * * @see WC_PayPal_Express_API_Response::__construct() * @param string $response the raw URL-encoded response string * @since 1.0.0 - Migrated from WooCommerce Subscriptions v2.0 */ public function __construct($response) { } /** * DoExpressCheckoutPayment API responses have a prefix for the payment * parameters. Parallels payments are not used, so the numeric portion of * the prefix is always '0' * * @since 1.0.0 - Migrated from WooCommerce Subscriptions v2.0.9 * @return string */ protected function get_payment_parameter_prefix() { } } class WCS_PayPal_Reference_Transaction_API extends \WCS_SV_API_Base { /** the production endpoint */ const PRODUCTION_ENDPOINT = 'https://api-3t.paypal.com/nvp'; /** the sandbox endpoint */ const SANDBOX_ENDPOINT = 'https://api-3t.sandbox.paypal.com/nvp'; /** NVP API version */ const VERSION = '124'; /** @var array the request parameters */ private $parameters = array(); /** @var string */ public $gateway_id; /** @var string */ public $api_username; /** @var string */ public $api_password; /** @var string */ public $api_signature; /** * Constructor - setup request object and set endpoint * * @param string $gateway_id gateway ID for this request * @param string $api_environment the API environment * @param string $api_username the API username * @param string $api_password the API password * @param string $api_signature the API signature * @since 1.0.0 - Migrated from WooCommerce Subscriptions v2.0 */ public function __construct($gateway_id, $api_environment, $api_username, $api_password, $api_signature) { } /** * Get PayPal URL parameters for the checkout URL * * @param array $paypal_args * @param WC_Order $order * @return array * @since 1.0.0 - Migrated from WooCommerce Subscriptions v2.0 */ public function get_paypal_args($paypal_args, $order) { } /** * Check account for reference transaction support * * For reference transactions to be enabled, we need to be able to setup a dummy SetExpressCheckout request without receiving any APIs errors. * This ensures there are no API credentials errors (e.g. error code 10008: "Security header is not valid") as well as testing the account for * reference transaction support. If the account does not have reference transaction support enabled, PayPal will return the error code * error code 11452: "Merchant not enabled for reference transactions". * * @link https://developer.paypal.com/docs/classic/api/errorcodes/#id09C3G0PJ0N9__id5e8c50e9-4f1b-462a-8586-399b63b07f1a * * @return bool * @since 1.0.0 - Migrated from WooCommerce Subscriptions v2.0 */ public function are_reference_transactions_enabled() { } /** * Set Express Checkout * * @param array $args @see WCS_PayPal_Reference_Transaction_API_Request::set_express_checkout() for details * @throws Exception network timeouts, etc * @return WCS_PayPal_Reference_Transaction_API_Response_Checkout response object * @since 1.0.0 - Migrated from WooCommerce Subscriptions v2.0 */ public function set_express_checkout($args) { } /** * Create a billing agreement, required when a subscription sign-up has no initial payment * * @link https://developer.paypal.com/docs/classic/express-checkout/integration-guide/ECReferenceTxns/#id094TB0Y0J5Z__id094TB4003HS * @link https://developer.paypal.com/docs/classic/api/merchant/CreateBillingAgreement_API_Operation_NVP/ * * @param string $token token from SetExpressCheckout response * @return WCS_PayPal_Reference_Transaction_API_Response_Billing_Agreement response object * @since 1.0.0 - Migrated from WooCommerce Subscriptions v2.0 */ public function create_billing_agreement($token) { } /** * Get Express Checkout Details * * @param string $token Token from set_express_checkout response * @return WC_PayPal_Reference_Transaction_API_Checkout_Response response object * @throws Exception network timeouts, etc * @since 1.0.0 - Migrated from WooCommerce Subscriptions v2.0 */ public function get_express_checkout_details($token) { } /** * Process an express checkout payment and billing agreement creation * * @param string $token PayPal Express Checkout token returned by SetExpressCheckout operation * @param WC_Order $order order object * @param array $args * @return WCS_PayPal_Reference_Transaction_API_Response_Payment refund response * @since 1.0.0 - Migrated from WooCommerce Subscriptions v2.0.9 */ public function do_express_checkout($token, $order, $args) { } /** * Perform a reference transaction for the given order * * @see SV_WC_Payment_Gateway_API::refund() * @param WC_Order $order order object * @return SV_WC_Payment_Gateway_API_Response refund response * @throws SV_WC_Payment_Gateway_Exception network timeouts, etc * @since 1.0.0 - Migrated from WooCommerce Subscriptions v2.0 */ public function do_reference_transaction($reference_id, $order, $args) { } /** * Change the status of a subscription for a given order/profile ID * * @since 1.0.0 - Migrated from WooCommerce Subscriptions v2.0.0 * @see SV_WC_Payment_Gateway_API::refund() * @param WC_Order $order order object * @return SV_WC_Payment_Gateway_API_Response refund response * @throws SV_WC_Payment_Gateway_Exception network timeouts, etc */ public function manage_recurring_payments_profile_status($profile_id, $new_status, $order) { } /** Helper methods ******************************************************/ /** * Get the wc-api URL to redirect to. * * @param string $action checkout action, either `set_express_checkout or `get_express_checkout_details`. * * @return string URL The URL. Note: this URL is escaped. * @since 1.0.0 - Migrated from WooCommerce Subscriptions v2.0 */ public function get_callback_url($action) { } /** * Builds and returns a new API request object * * @see \WCS_SV_API_Base::get_new_request() * @param array $args * @return WC_PayPal_Reference_Transaction_API_Request API request object * @since 1.0.0 - Migrated from WooCommerce Subscriptions v2.0 */ protected function get_new_request($args = array()) { } /** * Supposed to return the main gatewya plugin class, but we don't have one of those * * @see \WCS_SV_API_Base::get_plugin() * @return object * @since 1.0.0 - Migrated from WooCommerce Subscriptions v2.0 */ protected function get_plugin() { } } class WCS_PayPal_Standard_IPN_Handler extends \WC_Gateway_Paypal_IPN_Handler { /** @var Array transaction types this class can handle */ protected $transaction_types = array( 'subscr_signup', // Subscription started 'subscr_payment', // Subscription payment received 'subscr_cancel', // Subscription canceled 'subscr_eot', // Subscription expired 'subscr_failed', // Subscription payment failed 'subscr_modify', // Subscription modified // The PayPal docs say these are for Express Checkout recurring payments but they are also sent for PayPal Standard subscriptions 'recurring_payment_skipped', // Recurring payment skipped; it will be retried up to 3 times, 5 days apart 'recurring_payment_suspended', // Recurring payment suspended. This transaction type is sent if PayPal tried to collect a recurring payment, but the related recurring payments profile has been suspended. 'recurring_payment_suspended_due_to_max_failed_payment', ); /** * Constructor from WC_Gateway_Paypal_IPN_Handler */ public function __construct($sandbox = \false, $receiver_email = '') { } /** * There was a valid response * * Based on the IPN Variables documented here: https://developer.paypal.com/docs/classic/ipn/integration-guide/IPNandPDTVariables/#id091EB0901HT * * @param array $transaction_details Post data after wp_unslash * @since 1.0.0 - Migrated from WooCommerce Subscriptions v2.0 */ public function valid_response($transaction_details) { } /** * Process a PayPal Standard Subscription IPN request * * @param array $transaction_details Post data after wp_unslash * @since 1.0.0 - Migrated from WooCommerce Subscriptions v2.0 */ protected function process_ipn_request($transaction_details) { } /** * Return valid transaction types * * @since 1.0.0 - Migrated from WooCommerce Subscriptions v2.0 */ public function get_transaction_types() { } /** * Checks if a string may include a WooCommerce order key. * * This function expects a generic payload, in any serialization format. It looks for an 'order key' code. This * function uses regular expressions and looks for 'order key'. WooCommerce allows plugins to modify the order * keys through filtering, unfortunately we only check for the original * * @param string $payload PayPal payload data * * @return bool */ protected function is_woocommerce_payload($payload) { } /** * Checks a set of args and derives an Order ID with backward compatibility for WC < 1.7 where 'custom' was the Order ID. * * @since 1.0.0 - Migrated from WooCommerce Subscriptions v2.0 */ public static function get_order_id_and_key($args, $order_type = 'shop_order', $meta_key = '_paypal_subscription_id') { } /** * This function will try to get the parent order, and if not available, will get the last order related to the Subscription. * * @param WC_Subscription $subscription The Subscription. * * @return WC_Order Parent order or the last related order (renewal) */ protected static function get_parent_order_with_fallback($subscription) { } /** * Cancel a specific PayPal Standard Subscription Profile with PayPal. * * Used when switching payment methods with PayPal Standard to make sure that * the old subscription's profile ID is cancelled, not the new one. * * @param WC_Subscription A subscription object * @param string A PayPal Subscription Profile ID * @since 1.0.0 - Migrated from WooCommerce Subscriptions v2.0 */ protected static function cancel_subscription($subscription, $old_paypal_subscriber_id) { } /** * Check for a valid transaction type * * @param string $txn_type * @since 1.0.0 - Migrated from WooCommerce Subscriptions v2.0 */ protected function validate_transaction_type($txn_type) { } /** * Add an note for the given order or subscription * * @param string $note The text note * @param WC_Order $order An order object * @param array $transaction_details The transaction details, as provided by PayPal * @since 1.0.0 - Migrated from WooCommerce Subscriptions v2.0.20 */ protected function add_order_note($note, $order, $transaction_details) { } /** * Get an order associated with a subscription that has a specified transaction id. * * @param WC_Subscription object $subscription * @param int $transaction_id Id from transaction details as provided by PayPal * @param array|string Order type we want. Defaults to any. * * @return WC_Order|null If order with that transaction id, WC_Order object, otherwise null * @since 1.0.0 - Migrated from WooCommerce Subscriptions v2.4.3 */ protected function get_order_by_transaction_id($subscription, $transaction_id, $order_types = 'any') { } /** * Get a renewal order associated with a subscription that has a specified transaction id. * * @param WC_Subscription object $subscription * @param int $transaction_id Id from transaction details as provided by PayPal * @return WC_Order|null If order with that transaction id, WC_Order object, otherwise null * @since 1.0.0 - Migrated from WooCommerce Subscriptions v2.1 */ protected function get_renewal_order_by_transaction_id($subscription, $transaction_id) { } /** * Get a parent order associated with a subscription that has a specified transaction id. * * @param WC_Subscription object $subscription * @param int $transaction_id Id from transaction details as provided by PayPal * * @return WC_Order|null If order with that transaction id, WC_Order object, otherwise null * @since 1.0.0 - Migrated from WooCommerce Subscriptions v2.4.3 */ protected function get_parent_order_by_transaction_id($subscription, $transaction_id) { } } class WCS_PayPal_Reference_Transaction_IPN_Handler extends \WCS_PayPal_Standard_IPN_Handler { /** @var Array transaction types this class can handle */ protected $transaction_types = array( 'mp_signup', // Created a billing agreement 'mp_cancel', // Billing agreement cancelled 'merch_pmt', ); /** * Constructor */ public function __construct($sandbox = \false, $receiver_email = '') { } /** * There was a valid response * * Based on the IPN Variables documented here: https://developer.paypal.com/docs/classic/ipn/integration-guide/IPNandPDTVariables/#id091EB0901HT * * @param array $posted Post data after wp_unslash */ public function valid_response($transaction_details) { } /** * Find all subscription with a given billing agreement ID and cancel them because that billing agreement has been * cancelled at PayPal, and therefore, no future payments can be charged. * * @since 1.0.0 - Migrated from WooCommerce Subscriptions v2.0 */ protected function cancel_subscriptions($billing_agreement_id) { } /** * Removes a billing agreement from all subscriptions. * * @since 1.0.0 - Migrated from WooCommerce Subscriptions v2.5.4 * @param string $billing_agreement_id The billing agreement to remove. */ protected function remove_billing_agreement_from_subscriptions($billing_agreement_id) { } } class WCS_PayPal_Standard_Change_Payment_Method { /** * Bootstraps the class and hooks required actions & filters. * * @since 1.0.0 - Migrated from WooCommerce Subscriptions v2.0 */ public static function init() { } /** * If changing a subscriptions payment method from and to PayPal, wait until an appropriate IPN message * has come in before deciding to cancel the old subscription. * * @since 1.0.0 - Migrated from WooCommerce Subscriptions v2.0 */ public static function maybe_remove_subscription_cancelled_callback($subscription, $new_payment_method, $old_payment_method) { } /** * If changing a subscriptions payment method from and to PayPal, the cancelled subscription hook was removed in * @see self::maybe_remove_cancelled_subscription_hook() so we want to add it again for other subscriptions. * * @since 1.0.0 - Migrated from WooCommerce Subscriptions v2.0 */ public static function maybe_reattach_subscription_cancelled_callback($subscription, $new_payment_method, $old_payment_method) { } /** * Don't update the payment method on checkout when switching to PayPal - wait until we have the IPN message. * * @param string $item_name * @return string * @since 1.0.0 - Migrated from WooCommerce Subscriptions v1.5.14 */ public static function maybe_dont_update_payment_method($update, $new_payment_method, $subscription) { } /** * Change the "Change Payment Method" button for PayPal * * @param string $change_button_text * @param WC_Payment_Gateway $gateway * @since 1.0.0 - Migrated from WooCommerce Subscriptions v2.0.8 */ public static function change_payment_button_text($change_button_text, $gateway) { } } class WCS_PayPal_Standard_IPN_Failure_Handler { private static $transaction_details = \null; /** * @var WC_Logger_Interface|null */ public static $log = \null; /** * Attaches all IPN failure handler related hooks and filters and also sets logging to enabled. * * @since 1.0.0 - Migrated from WooCommerce Subscriptions v2.0.6 * @param array $transaction_details */ public static function attach($transaction_details) { } /** * Close up loose ends * * @since 1.0.0 - Migrated from WooCommerce Subscriptions v2.0.6 * @param $transaction_details */ public static function detach($transaction_details) { } /** * On PHP shutdown log any unexpected failures from PayPal IPN processing * * @since 1.0.0 - Migrated from WooCommerce Subscriptions v2.0.6 */ public static function catch_unexpected_shutdown() { } /** * Log any fatal errors occurred while Subscriptions is trying to process IPN messages * * @since 1.0.0 - Migrated from WooCommerce Subscriptions v2.0.6 * @param array $transaction_details the current IPN message being processed when the fatal error occurred * @param array $error */ public static function log_ipn_errors($transaction_details, $error = '') { } /** * Log any unexpected fatal errors to wcs-ipn-failures log file * * @since 1.0.0 - Migrated from WooCommerce Subscriptions v2.0.6 * @param string $message */ public static function log_to_failure($message) { } /** * Builds an error array from exception and call @see self::log_ipn_errors() to log unhandled * exceptions in a separate paypal log. * * @since 1.0.0 - Migrated from WooCommerce Subscriptions v2.0.6 * @param Exception $exception */ public static function log_unexpected_exception($exception) { } } class WCS_PayPal_Standard_Request { /** * Get PayPal Args for passing to PP * * Based on the HTML Variables documented here: https://developer.paypal.com/webapps/developer/docs/classic/paypal-payments-standard/integration-guide/Appx_websitestandard_htmlvariables/#id08A6HI00JQU * * @param WC_Order $order * @return array */ public static function get_paypal_args($paypal_args, $order) { } } class WCS_PayPal_Standard_Switcher { /** * Bootstraps the class and hooks required actions & filters. * * @since 1.0.0 - Migrated from WooCommerce Subscriptions v2.0 */ public static function init() { } /** * Allow items on PayPal Standard Subscriptions to be switch when the PayPal account supports Reference Transactions * * Because PayPal Standard does not support recurring amount or date changes, items can not be switched when the subscription is using a * profile ID for PayPal Standard. However, PayPal Reference Transactions do allow these to be updated and because switching uses the checkout * process, we can migrate a subscription from PayPal Standard to Reference Transactions when the customer switches, so we will allow that. * * @since 1.0.0 - Migrated from WooCommerce Subscriptions v2.0 */ public static function can_item_be_switched($item_can_be_switch, $item, $subscription) { } /** * Check whether the cart needs payment even if the order total is $0 because it's a subscription switch request for a subscription using * PayPal Standard as the subscription. * * @param bool $needs_payment The existing flag for whether the cart needs payment or not. * @param WC_Cart $cart The WooCommerce cart object. * @return bool */ public static function cart_needs_payment($needs_payment, $cart) { } /** * If switching a subscription using PayPal Standard as the payment method and the customer has entered * in a payment method other than PayPal (which would be using Reference Transactions), make sure to update * the payment method on the subscription (this is hooked to 'woocommerce_payment_successful_result' to make * sure it happens after the payment succeeds). * * @param array $payment_processing_result The result of the process payment gateway extension request. * @param int $order_id The ID of an order potentially recording a switch. * @return array */ public static function maybe_set_payment_method($payment_processing_result, $order_id) { } /** * Stores the old paypal standard subscription id on the switch order so that it can be used later to cancel the recurring payment. * * Strictly hooked on after WC_Subscriptions_Switcher::add_order_meta() * * @param int $order_id * @param array $posted * @since 1.0.0 - Migrated from WooCommerce Subscriptions v2.0.15 */ public static function save_old_paypal_meta($order_id, $posted) { } /** * Cancel subscriptions with PayPal Standard after the order has been successfully switched. * * @param WC_Order $order * @since 1.0.0 - Migrated from WooCommerce Subscriptions v2.1 */ public static function cancel_paypal_standard_after_switch($order) { } /** * Do not allow subscriptions to be switched using PayPal Standard as the payment method * * @since 1.0.0 - Migrated from WooCommerce Subscriptions v2.0.16 */ public static function get_available_payment_gateways($available_gateways) { } /** Deprecated Methods **/ /** * Cancel subscriptions with PayPal Standard after the order has been successfully switched. * * @param int $order_id * @param string $old_status * @param string $new_status * @since 1.0.0 - Migrated from WooCommerce Subscriptions v2.0.15 */ public static function maybe_cancel_paypal_after_switch($order_id, $old_status, $new_status) { } /** * Filters the note added to a subscription when the payment method is changed from PayPal Standard to PayPal Reference Transactions after a switch. * * Hooked onto 'wc_subscriptions_paypal_standard_suspension_note'. @see WCS_PayPal_Standard_Switcher::cancel_paypal_standard_after_switch() * * @since 1.0.0 - Migrated from WooCommerce Subscriptions v3.1.0 * @return string The note added to a subscription when the payment method changes from PayPal Standard to PayPal RT. */ public static function filter_suspended_switch_note() { } } class WCS_PayPal_Status_Manager extends \WCS_PayPal { /** * Bootstraps the class and hooks required actions & filters. * * @since 1.0.0 - Migrated from WooCommerce Subscriptions v2.0 */ public static function init() { } /** * When a store manager or user cancels a subscription in the store, also cancel the subscription with PayPal. * * @since 1.0.0 - Migrated from WooCommerce Subscriptions v2.0 */ public static function cancel_subscription($subscription) { } /** * When a store manager or user suspends a subscription in the store, also suspend the subscription with PayPal. * * @since 1.0.0 - Migrated from WooCommerce Subscriptions v2.0 */ public static function suspend_subscription($subscription) { } /** * When a store manager or user reactivates a subscription in the store, also reactivate the subscription with PayPal. * * How PayPal Handles suspension is discussed here: https://www.x.com/developers/paypal/forums/nvp/reactivate-recurring-profile * * @since 1.0.0 - Migrated from WooCommerce Subscriptions v2.0 */ public static function reactivate_subscription($subscription) { } /** * Performs an Express Checkout NVP API operation as passed in $api_method. * * Although the PayPal Standard API provides no facility for cancelling a subscription, the PayPal * Express Checkout NVP API can be used. * * @since 1.0.0 - Migrated from WooCommerce Subscriptions v2.0 */ public static function update_subscription_status($subscription, $new_status) { } /** * When changing the payment method on edit subscription screen from PayPal, only suspend the subscription rather * than cancelling it. * * @param string $status The subscription status sent to the current payment gateway before changing subscription payment method. * @return object $subscription * @since 1.0.0 - Migrated from WooCommerce Subscriptions v2.0 */ public static function suspend_subscription_on_payment_changed($status, $subscription) { } } class WCS_PayPal_Supports { protected static $standard_supported_features = array('subscriptions', 'gateway_scheduled_payments', 'subscription_payment_method_change_customer', 'subscription_cancellation', 'subscription_suspension', 'subscription_reactivation'); protected static $reference_transaction_supported_features = array('subscription_payment_method_change_customer', 'subscription_payment_method_change_admin', 'subscription_amount_changes', 'subscription_date_changes', 'multiple_subscriptions', 'subscription_payment_method_delayed_change'); /** * Bootstraps the class and hooks required actions & filters. * * @since 1.0.0 - Migrated from WooCommerce Subscriptions v2.0 */ public static function init() { } /** * Add subscription support to the PayPal Standard gateway only when credentials are set * * @since 1.0.0 - Migrated from WooCommerce Subscriptions v2.0 */ public static function add_feature_support_for_gateway($is_supported, $feature, $gateway) { } /** * Add additional feature support at the subscription level instead of just the gateway level because some subscriptions may have been * setup with PayPal Standard while others may have been setup with Billing Agreements to use with Reference Transactions. * * @since 1.0.0 - Migrated from WooCommerce Subscriptions v2.0 */ public static function add_feature_support_for_subscription($is_supported, $feature, $subscription) { } /** * Adds the payment gateway features supported by the type of billing the PayPal account supports (Reference Transactions or Standard). * * @since 1.0.0 - Migrated from WooCommerce Subscriptions v2.6.0 * * @param array $features The list of features the payment gateway supports. * @param WC_Payment_Gateway $gateway The payment gateway object. * @return array $features */ public static function add_paypal_billing_type_supported_features($features, $gateway) { } /** * Adds the payment gateway features supported by the type of billing the PayPal account supports (Reference Transactions or Standard). * * @param array $features The list of features the payment gateway supports. * @param string $gateway_name name of the gateway. * @return array $features. */ public static function add_paypal_billing_type_supported_features_blocks_store_api($features, $gateway_name) { } } /** * The old PayPal Standard Subscription Class. * * Filtered necessary functions in the WC_Paypal class to allow for subscriptions. * * Replaced by WCS_PayPal. * * @package WooCommerce Subscriptions * @subpackage WC_PayPal_Standard_Subscriptions * @category Class * @author Brent Shepherd * @since 1.0.0 - Migrated from WooCommerce Subscriptions v1.0 */ class WC_PayPal_Standard_Subscriptions { public static $api_username; public static $api_password; public static $api_signature; public static $api_endpoint; private static $request_handler; /** * Set the public properties to make sure we don't trigger any fatal errors even though the class is deprecated. * * @since 1.0.0 - Migrated from WooCommerce Subscriptions v1.0 */ public static function init() { } /** * Checks if the PayPal API credentials are set. * * @since 1.0.0 - Migrated from WooCommerce Subscriptions v1.0 */ public static function are_credentials_set() { } /** * Add subscription support to the PayPal Standard gateway only when credentials are set * * @since 1.0.0 - Migrated from WooCommerce Subscriptions v1.0 */ public static function add_paypal_standard_subscription_support($is_supported, $feature, $gateway) { } /** * When a PayPal IPN messaged is received for a subscription transaction, * check the transaction details and * * @since 1.0.0 - Migrated from WooCommerce Subscriptions v1.0 */ public static function process_paypal_ipn_request($transaction_details) { } /** * Override the default PayPal standard args in WooCommerce for subscription purchases when * automatic payments are enabled and when the recurring order totals is over $0.00 (because * PayPal doesn't support subscriptions with a $0 recurring total, we need to circumvent it and * manage it entirely ourselves.) * * @since 1.0.0 - Migrated from WooCommerce Subscriptions v1.0 */ public static function paypal_standard_subscription_args($paypal_args, $order = '') { } /** * Adds extra PayPal credential fields required to manage subscriptions. * * @since 1.0.0 - Migrated from WooCommerce Subscriptions v1.0 */ public static function add_subscription_form_fields() { } /** * Returns a PayPal Subscription ID/Recurring Payment Profile ID based on a user ID and subscription key * * @param WC_Order|WC_Subscription A WC_Order object or child object (i.e. WC_Subscription) * @since 1.0.0 - Migrated from WooCommerce Subscriptions v1.1 */ public static function get_subscriptions_paypal_id($order_id, $product_id = '') { } /** * Performs an Express Checkout NVP API operation as passed in $api_method. * * Although the PayPal Standard API provides no facility for cancelling a subscription, the PayPal * Express Checkout NVP API can be used. * * @since 1.0.0 - Migrated from WooCommerce Subscriptions v1.1 */ public static function change_subscription_status($profile_id, $new_status, $order = \null) { } /** * Checks a set of args and derives an Order ID with backward compatibility for WC < 1.7 where 'custom' was the Order ID. * * @since 1.0.0 - Migrated from WooCommerce Subscriptions v1.2 */ public static function get_order_id_and_key($args) { } /** * If changing a subscriptions payment method from and to PayPal, wait until an appropriate IPN message * has come in before deciding to cancel the old subscription. * * @since 1.0.0 - Migrated from WooCommerce Subscriptions v2.0 */ public static function maybe_remove_subscription_cancelled_callback($subscription, $new_payment_method, $old_payment_method) { } /** * If changing a subscriptions payment method from and to PayPal, the cancelled subscription hook was removed in * @see self::maybe_remove_cancelled_subscription_hook() so we want to add it again for other subscriptions. * * @since 1.0.0 - Migrated from WooCommerce Subscriptions v2.0 */ public static function maybe_reattach_subscription_cancelled_callback($subscription, $new_payment_method, $old_payment_method) { } /** * Don't update the payment method on checkout when switching to PayPal - wait until we have the IPN message. * * @param string $item_name * @return string * @since 1.0.0 - Migrated from WooCommerce Subscriptions v1.5.14 */ public static function maybe_dont_update_payment_method($update, $new_payment_method) { } /** * In typical PayPal style, there are a couple of important limitations we need to work around: * * @since 1.0.0 - Migrated from WooCommerce Subscriptions v1.4.3 */ public static function scheduled_subscription_payment() { } /** * Prompt the store manager to enter their PayPal API credentials if they are using * PayPal and have yet not entered their API credentials. * * @return void */ public static function maybe_show_admin_notice() { } /** * When a store manager or user cancels a subscription in the store, also cancel the subscription with PayPal. * * @since 1.0.0 - Migrated from WooCommerce Subscriptions v1.1 */ public static function cancel_subscription_with_paypal($order, $product_id = '', $profile_id = '') { } /** * When a store manager or user suspends a subscription in the store, also suspend the subscription with PayPal. * * @since 1.0.0 - Migrated from WooCommerce Subscriptions v1.1 */ public static function suspend_subscription_with_paypal($order, $product_id) { } /** * When a store manager or user reactivates a subscription in the store, also reactivate the subscription with PayPal. * * How PayPal Handles suspension is discussed here: https://www.x.com/developers/paypal/forums/nvp/reactivate-recurring-profile * * @since 1.0.0 - Migrated from WooCommerce Subscriptions v1.1 */ public static function reactivate_subscription_with_paypal($order, $product_id) { } /** * Don't transfer PayPal customer/token meta when creating a parent renewal order. * * @access public * @param array $order_meta_query MySQL query for pulling the metadata * @param int $original_order_id Post ID of the order being used to purchased the subscription being renewed * @param int $renewal_order_id Post ID of the order created for renewing the subscription * @param string $new_order_role The role the renewal order is taking, one of 'parent' or 'child' * @return void */ public static function remove_renewal_order_meta($order_meta_query, $original_order_id, $renewal_order_id, $new_order_role) { } /** * If changing a subscriptions payment method from and to PayPal, wait until an appropriate IPN message * has come in before deciding to cancel the old subscription. * * @since 1.0.0 - Migrated from WooCommerce Subscriptions v1.4.6 */ public static function maybe_remove_cancelled_subscription_hook($order, $subscription_key, $new_payment_method, $old_payment_method) { } /** * If changing a subscriptions payment method from and to PayPal, the cancelled subscription hook was removed in * @see self::maybe_remove_cancelled_subscription_hook() so we want to add it again for other subscriptions. * * @since 1.0.0 - Migrated from WooCommerce Subscriptions v1.4.6 */ public static function maybe_readd_cancelled_subscription_hook($order, $subscription_key, $new_payment_method, $old_payment_method) { } /** * Takes a timestamp for a date in the future and calculates the number of days between now and then * * @since 1.0.0 - Migrated from WooCommerce Subscriptions v1.4 */ public static function calculate_trial_periods_until($future_timestamp) { } } class WC_Product_Subscription_Legacy extends \WC_Product_Subscription { var $subscription_price; var $subscription_period; var $subscription_period_interval; var $subscription_length; var $subscription_trial_length; var $subscription_trial_period; var $subscription_sign_up_fee; /** * Create a simple subscription product object. * * @access public * @param mixed $product */ public function __construct($product) { } } class WC_Product_Subscription_Variation_Legacy extends \WC_Product_Subscription_Variation { /** * Set default array value for WC 3.0's data property. * @var array */ protected $data = array(); /** * Create a simple subscription product object. * * @access public * @param mixed $product */ public function __construct($product, $args = array()) { } /* Copied from WC 2.6 WC_Product_Variation */ /** * __isset function. * * @param mixed $key * @return bool */ public function __isset($key) { } /** * Get method returns variation meta data if set, otherwise in most cases the data from the parent. * * We need to use the WC_Product_Variation's __get() method, not the one in WC_Product_Subscription_Variation, * which handles deprecation notices. * * @param string $key * @return mixed */ public function __get($key) { } /** * Provide a WC 3.0 method for variations. * * WC < 3.0 products have a get_parent() method, but this is not equivalent to the get_parent_id() method * introduced in WC 3.0, because it derives the parent from $this->post->post_parent, but for variations, * $this->post refers to the parent variable object's post, so $this->post->post_parent will be 0 under * normal circumstances. Because of that, we can rely on wcs_get_objects_property( $this, 'parent_id' ) * and define this get_parent_id() method for variations even when WC 3.0 is not active. * * @param string $key * @return mixed */ public function get_parent_id() { } } class WC_Product_Variable_Subscription_Legacy extends \WC_Product_Variable_Subscription { var $subscription_price; var $subscription_period; var $max_variation_period; var $subscription_period_interval; var $max_variation_period_interval; var $product_type; protected $prices_array; /** * Create a simple subscription product object. * * @access public * @param mixed $product */ public function __construct($product) { } /** * Get the min or max variation (active) price. * * This is a copy of WooCommerce < 2.4's get_variation_price() method, because 2.4.0 introduced a new * transient caching system which assumes asort() on prices yields correct results for min/max prices * (which it does for prices alone, but that's not the full story for subscription prices). Unfortunately, * the new caching system is also hard to hook into so we'll just use the old system instead as the * @see self::variable_product_sync() uses the old method also. * * @param string $min_or_max - min or max * @param boolean $display Whether the value is going to be displayed * @return string */ public function get_variation_price($min_or_max = 'min', $display = \false) { } /** * Get an array of all sale and regular prices from all variations re-ordered after WC has done a standard sort, to reflect subscription terms. * The first and last element for each price type is the least and most expensive, respectively. * * @see WC_Product_Variable::get_variation_prices() * @param bool $include_taxes Should taxes be included in the prices. * @return array() Array of RAW prices, regular prices, and sale prices with keys set to variation ID. * @since 1.0.0 - Migrated from WooCommerce Subscriptions v2.2.0 */ public function get_variation_prices($display = \false) { } /** * Create unique cache key based on the tax location (affects displayed/cached prices), product version and active price filters. * DEVELOPERS should filter this hash if offering conditional pricing to keep it unique. * * @since 1.0.0 - Migrated from WooCommerce Subscriptions v2.2.0 * @param WC_Product * @param bool $display Are prices for display? If so, taxes will be calculated. * @return string */ protected function get_price_hash($display = \false) { } /** * Sync variable product prices with the children lowest/highest prices. * * @access public * @return void */ public function variable_product_sync($product_id = '') { } /** * Returns the price in html format. * * @access public * @param string $price (default: '') * @return string */ public function get_price_html($price = '') { } /** * Provide the WC_Data::get_meta() function when WC < 3.0 is active. * * @param string $meta_key * @param bool $single * @param string $context * @return object WC_Product_Subscription or WC_Product_Subscription_Variation */ function get_meta($meta_key = '', $single = \true, $context = 'view') { } /** * get_child function. * * @access public * @param mixed $child_id * @return object WC_Product_Subscription or WC_Product_Subscription_Variation */ public function get_child($child_id) { } /** * Get default attributes. * * @since 1.0.0 - Migrated from WooCommerce Subscriptions v2.2.0 * @param string $context * @return array */ public function get_default_attributes($context = 'view') { } /** * Set the product's min and max variation data. * * @param array $min_and_max_data The min and max variation data returned by @see wcs_get_min_max_variation_data(). Optional. * @param array $variation_ids The visible child variation IDs. Optional. By default this value be generated by @see WC_Product_Variable->get_children( true ). * @since 1.0.0 - Migrated from WooCommerce Subscriptions v2.3.0 */ public function set_min_and_max_variation_data($min_and_max_data = array(), $variation_ids = array()) { } /** * Get the min and max variation data. * * This is a wrapper for @see wcs_get_min_max_variation_data() but to avoid calling * that resource intensive function multiple times per request, check the value * stored in meta or cached in memory before calling that function. * * @param array $variation_ids An array of variation IDs. * @return array The variable product's min and max variation data. * @since 1.0.0 - Migrated from WooCommerce Subscriptions v2.3.0 */ public function get_min_and_max_variation_data($variation_ids) { } } /** * Subscription Legacy Object * * Extends WC_Subscription to provide WC 3.0 methods when running WooCommerce < 3.0. * * @class WC_Subscription_Legacy * @version 1.0.0 - Migrated from WooCommerce Subscriptions v2.1 * @package WooCommerce Subscriptions/Classes * @category Class * @author Brent Shepherd */ class WC_Subscription_Legacy extends \WC_Subscription { protected $schedule; protected $status_transition = \false; /** * Whether the object has been read. Pre WC 3.0 subscription objects are always read by default. * Provides an accessible variable equivalent to WC_Data::$object_read pre WC 3.0. * * @protected boolean */ protected $object_read = \true; /** * Initialize the subscription object. * * @param int|WC_Subscription $subscription */ public function __construct($subscription) { } /** * Populates a subscription from the loaded post data. * * @param mixed $result */ public function populate($result) { } /** * Returns the unique ID for this object. * * @return int */ public function get_id() { } /** * Get parent order ID. * * @since 1.0.0 - Migrated from WooCommerce Subscriptions v2.2.0 * @return int */ public function get_parent_id() { } /** * Gets order currency. * * @return string */ public function get_currency() { } /** * Get customer_note. * * @param string $context * @return string */ public function get_customer_note($context = 'view') { } /** * Get prices_include_tax. * * @param string $context * @return bool */ public function get_prices_include_tax($context = 'view') { } /** * Get the payment method. * * @param string $context * @return string */ public function get_payment_method($context = 'view') { } /** * Get the payment method's title. * * @param string $context * @return string */ public function get_payment_method_title($context = 'view') { } /** Address Getters **/ /** * Get billing_first_name. * * @param string $context * @return string */ public function get_billing_first_name($context = 'view') { } /** * Get billing_last_name. * * @param string $context * @return string */ public function get_billing_last_name($context = 'view') { } /** * Get billing_company. * * @param string $context * @return string */ public function get_billing_company($context = 'view') { } /** * Get billing_address_1. * * @param string $context * @return string */ public function get_billing_address_1($context = 'view') { } /** * Get billing_address_2. * * @param string $context * @return string $value */ public function get_billing_address_2($context = 'view') { } /** * Get billing_city. * * @param string $context * @return string $value */ public function get_billing_city($context = 'view') { } /** * Get billing_state. * * @param string $context * @return string */ public function get_billing_state($context = 'view') { } /** * Get billing_postcode. * * @param string $context * @return string */ public function get_billing_postcode($context = 'view') { } /** * Get billing_country. * * @param string $context * @return string */ public function get_billing_country($context = 'view') { } /** * Get billing_email. * * @param string $context * @return string */ public function get_billing_email($context = 'view') { } /** * Get billing_phone. * * @param string $context * @return string */ public function get_billing_phone($context = 'view') { } /** * Get shipping_first_name. * * @param string $context * @return string */ public function get_shipping_first_name($context = 'view') { } /** * Get shipping_last_name. * * @param string $context * @return string */ public function get_shipping_last_name($context = 'view') { } /** * Get shipping_company. * * @param string $context * @return string */ public function get_shipping_company($context = 'view') { } /** * Get shipping_address_1. * * @param string $context * @return string */ public function get_shipping_address_1($context = 'view') { } /** * Get shipping_address_2. * * @param string $context * @return string */ public function get_shipping_address_2($context = 'view') { } /** * Get shipping_city. * * @param string $context * @return string */ public function get_shipping_city($context = 'view') { } /** * Get shipping_state. * * @param string $context * @return string */ public function get_shipping_state($context = 'view') { } /** * Get shipping_postcode. * * @param string $context * @return string */ public function get_shipping_postcode($context = 'view') { } /** * Get shipping_country. * * @param string $context * @return string */ public function get_shipping_country($context = 'view') { } /** * Get order key. * * @since 1.0.0 - Migrated from WooCommerce Subscriptions v2.2.0 * @param string $context * @return string */ public function get_order_key($context = 'view') { } /** * Get date_created. * * Used by parent::get_date() * * @throws WC_Data_Exception * @return DateTime|NULL object if the date is set or null if there is no date. */ public function get_date_created($context = 'view') { } /** * Get date_modified. * * Used by parent::get_date() * * @throws WC_Data_Exception * @return DateTime|NULL object if the date is set or null if there is no date. */ public function get_date_modified($context = 'view') { } /** * Check if a given line item on the subscription had a sign-up fee, and if so, return the value of the sign-up fee. * * The single quantity sign-up fee will be returned instead of the total sign-up fee paid. For example, if 3 x a product * with a 10 BTC sign-up fee was purchased, a total 30 BTC was paid as the sign-up fee but this function will return 10 BTC. * * @param array|int Either an order item (in the array format returned by self::get_items()) or the ID of an order item. * @param string $tax_inclusive_or_exclusive Whether or not to adjust sign up fee if prices inc tax - ensures that the sign up fee paid amount includes the paid tax if inc * @return bool * @since 1.0.0 - Migrated from WooCommerce Subscriptions v2.0 */ public function get_items_sign_up_fee($line_item, $tax_inclusive_or_exclusive = 'exclusive_of_tax') { } /** * Helper function to make sure when WC_Subscription calls get_prop() from * it's new getters that the property is both retrieved from the legacy class * property and done so from post meta. * * For inherited dates props, like date_created, date_modified, date_paid, * date_completed, we want to use our own get_date() function rather simply * getting the stored value. Otherwise, we either get the prop set in memory * or post meta if it's not set yet, because __get() in WC < 3.0 would fallback * to post meta. * * @param string * @param string * @return mixed */ protected function get_prop($prop, $context = 'view') { } /** * Get the stored date for a specific schedule. * * @param string $date_type 'date_created', 'trial_end', 'next_payment', 'last_order_date_created' or 'end' */ protected function get_date_prop($date_type) { } /*** Setters *****************************************************/ /** * Set the unique ID for this object. * * @param int */ public function set_id($id) { } /** * Set parent order ID. We don't use WC_Abstract_Order::set_parent_id() because we want to allow false * parent IDs, like 0. * * @since 1.0.0 - Migrated from WooCommerce Subscriptions v2.2.0 * @param int $value */ public function set_parent_id($value) { } /** * Set subscription status. * * @param string $new_status Status to change the order to. No internal wc- prefix is required. * @return array details of change */ public function set_status($new_status, $note = '', $manual_update = \false) { } /** * Helper function to make sure when WC_Subscription calls set_prop() that property is * both set in the legacy class property and saved in post meta immediately. * * @param string $prop * @param mixed $value */ protected function set_prop($prop, $value) { } /** * Set the stored date for a specific schedule. * * @param string $date_type 'trial_end', 'next_payment', 'cancelled', 'payment_retry' or 'end' * @param int $value UTC timestamp */ protected function set_date_prop($date_type, $value) { } /** * Set a certain date type for the last order on the subscription. * * @since 1.0.0 - Migrated from WooCommerce Subscriptions v2.2.0 * @param string $date_type * @param string|integer|object * @return WC_DateTime|NULL object if the date is set or null if there is no date. */ protected function set_last_order_date($date_type, $date = \null) { } /** * Set date_created. * * Used by parent::update_dates() * * @param string|integer|null $date UTC timestamp, or ISO 8601 DateTime. If the DateTime string has no timezone or offset, WordPress site timezone will be assumed. Null if their is no date. * @throws WC_Data_Exception */ public function set_date_created($date = \null) { } /** * Set discount_total. * * @param string $value * @throws WC_Data_Exception */ public function set_discount_total($value) { } /** * Set discount_tax. * * @param string $value * @throws WC_Data_Exception */ public function set_discount_tax($value) { } /** * Set shipping_total. * * @param string $value * @throws WC_Data_Exception */ public function set_shipping_total($value) { } /** * Set shipping_tax. * * @param string $value * @throws WC_Data_Exception */ public function set_shipping_tax($value) { } /** * Set cart tax. * * @param string $value * @throws WC_Data_Exception */ public function set_cart_tax($value) { } /** * Save data to the database. Nothing to do here as it's all done separately when calling @see this->set_prop(). * * @return int order ID */ public function save() { } /** * Update meta data by key or ID, if provided. * * @since 1.0.0 - Migrated from WooCommerce Subscriptions v2.2.0 * @param string $key * @param string $value * @param int $meta_id */ public function update_meta_data($key, $value, $meta_id = '') { } /** * Save subscription date changes to the database. * Nothing to do here as all date properties are saved when calling @see $this->set_prop(). * * @since 1.0.0 - Migrated from WooCommerce Subscriptions v2.2.6 */ public function save_dates() { } } class WCS_Array_Property_Post_Meta_Black_Magic implements \ArrayAccess { /** * Store the ID this class is being used against so that we use it for post meta calls. */ protected $product_id; /** * Constructor * * @access public * @param mixed $product */ public function __construct($product_id) { } /** * offsetGet * @param string $key * @return mixed */ #[\ReturnTypeWillChange] public function offsetGet($key) { } /** * offsetSet * @param string $key * @param mixed $value */ #[\ReturnTypeWillChange] public function offsetSet($key, $value) { } /** * offsetExists * @param string $key * @return bool */ #[\ReturnTypeWillChange] public function offsetExists($key) { } /** * Nothing to do here as we access post meta directly. */ #[\ReturnTypeWillChange] public function offsetUnset($key) { } /** * We only work with post meta data that has meta keys prefixed with an underscore, so * add a prefix if it is not already set. */ protected function maybe_prefix_meta_key($key) { } } /** * Legacy Subscription Product Handler * * Ensures subscription products work with versions of WooCommerce prior to 3.0 by loading * legacy classes to provide CRUD methods only added with WC 3.0. * * @package WooCommerce Subscriptions * @subpackage WCS_Product_Legacy * @category Class * @since 1.0.0 - Migrated from WooCommerce Subscriptions v2.2.0 */ class WCS_Product_Legacy { /** * Set up the class, including it's hooks & filters, when the file is loaded. * * @since 1.0.0 - Migrated from WooCommerce Subscriptions v2.2.0 **/ public static function init() { } /** * Use legacy classes for WC < 3.0 * * @return string $classname The name of the WC_Product_* class which should be instantiated to create an instance of this product. * @since 1.0.0 - Migrated from WooCommerce Subscriptions v2.2.0 */ public static function set_product_class($classname, $product_type, $post_type, $product_id) { } } class WCS_Privacy_Background_Updater { /** * @var string The hook used to schedule subscription anonymization. */ protected $ended_subscription_anonymization_hook = 'woocommerce_subscriptions_privacy_anonymize_ended_subscriptions'; /** * @var string The hook used to schedule subscription related order anonymization. */ protected $subscription_orders_anonymization_hook = 'woocommerce_subscriptions_privacy_anonymize_subscription_orders'; /** * @var string The hook used to schedule individual order anonymization. */ protected $order_anonymization_hook = 'woocommerce_subscriptions_privacy_anonymize_subscription_order'; /** * Attach callbacks. */ public function init() { } /** * Schedule ended subscription anonymization, if it's not already scheduled. * * @since 1.0.0 - Migrated from WooCommerce Subscriptions v2.2.20 */ public function schedule_ended_subscription_anonymization() { } /** * Unschedule the ended subscription anonymization hook. * * @since 1.0.0 - Migrated from WooCommerce Subscriptions v2.2.20 */ protected function unschedule_ended_subscription_anonymization() { } /** * Schedule subscription related order anonymization, if it's not already scheduled. * * @since 1.0.0 - Migrated from WooCommerce Subscriptions v2.2.20 * @param int The subscription ID. */ protected function schedule_subscription_orders_anonymization($subscription_id) { } /** * Unschedule a specific subscription's related order anonymization hook. * * @since 1.0.0 - Migrated from WooCommerce Subscriptions v2.2.20 * @param int The subscription ID. */ protected function unschedule_subscription_orders_anonymization($subscription_id) { } /** * Schedule a specific order's anonymization action. * * @since 1.0.0 - Migrated from WooCommerce Subscriptions v2.2.20 * @param int The order ID. */ protected function schedule_order_anonymization($order_id) { } /** * Check if an order has a scheduled anonymization action. * * @since 1.0.0 - Migrated from WooCommerce Subscriptions v2.2.20 * @param int The order ID. * @return bool Whether the order has a scheduled anonymization action. */ protected function order_anonymization_is_scheduled($order_id) { } /** * Anonymize old ended subscriptions. * * @since 1.0.0 - Migrated from WooCommerce Subscriptions v2.2.20 */ public function anonymize_ended_subscriptions() { } /** * Schedule related order anonymization events for a specific subscription. * * @since 1.0.0 - Migrated from WooCommerce Subscriptions v2.2.20 */ public function schedule_subscription_orders_anonymization_events($subscription_id) { } /** * Anonymize an order. * * @param int The ID of the order to be anonymized. * @since 1.0.0 - Migrated from WooCommerce Subscriptions v2.2.20 */ public function anonymize_order($order_id) { } } class WCS_Privacy_Erasers { /** * Finds and erases data which could be used to identify a person from subscription data associated with an email address. * * Subscriptions are erased in blocks of 10 to avoid timeouts. * Based on @see WC_Privacy_Erasers::order_data_eraser(). * * @since 1.0.0 - Migrated from WooCommerce Subscriptions v2.2.20 * @param string $email_address The user email address. * @param int $page Page. * @return array An array of response data to return to the WP eraser. */ public static function subscription_data_eraser($email_address, $page) { } /** * Erase personal data from an array of subscriptions and generate an eraser response. * * @since 1.0.0 - Migrated from WooCommerce Subscriptions v2.2.20 * @param array $subscriptions An array of WC_Subscription objects. * @param int $limit The number of subscriptions erased in each batch. Optional. Default is 10. * @return array An array of response data to return to the WP eraser. */ public static function erase_subscription_data_and_generate_response($subscriptions, $limit = 10) { } /** * Remove personal data from a subscription object. * * Note; this will hinder the subscription's ability function correctly for obvious reasons! * * @since 1.0.0 - Migrated from WooCommerce Subscriptions v2.2.20 * @param WC_Subscription $subscription $subscription object. */ public static function remove_subscription_personal_data($subscription) { } } class WCS_Privacy_Exporters { /** * Finds and exports subscription data which could be used to identify a person from an email address. * * Subscriptions are exported in blocks of 10 to avoid timeouts. * Based on @see WC_Privacy_Exporters::order_data_exporter(). * * @param string $email_address The user email address. * @param int $page Page. * @return array An array of personal data in name value pairs * @since 1.0.0 - Migrated from WooCommerce Subscriptions v2.2.20 */ public static function subscription_data_exporter($email_address, $page) { } /** * Get personal data (key/value pairs) for an subscription object. * * @since 1.0.0 - Migrated from WooCommerce Subscriptions v2.2.20 * @param WC_Subscription $subscription Subscription object. * @return array */ protected static function get_subscription_personal_data($subscription) { } } class WCS_Privacy extends \WC_Abstract_Privacy { /** * Background updater to process personal data removal from subscriptions and related orders. * * @var WCS_Privacy_Background_Updater */ protected static $background_process; /** * A flag which is set when WC is doing a user inactivity cleanup. * Used to exclude subscription customers from the inactive user query. * * @var bool */ protected static $doing_user_inactivity_query = \false; /** * WCS_Privacy constructor. */ public function __construct() { } /** * Attach callbacks. */ public function init() { } /** * Spawn events for subscription cleanup. * * @since 1.0.0 - Migrated from WooCommerce Subscriptions v2.2.20 */ public function queue_cleanup_personal_data() { } /** * Add privacy policy content for the privacy policy page. * * @since 1.0.0 - Migrated from WooCommerce Subscriptions v2.2.20 */ public function get_privacy_message() { } /** * Adds the option to remove personal data from subscription via a bulk action. * * @since 5.2.0 * * @param array $bulk_actions Subscription bulk actions. * * @return array */ public static function add_privacy_bulk_action($bulk_actions) { } /** * Handles the Remove Personal Data bulk action requests for Subscriptions. * * @param string $redirect_url The default URL to redirect to after handling the bulk action request. * @param string $action The action to take against the list of subscriptions. * @param array $subscription_ids The list of subscription to run the action against. */ public static function handle_privacy_bulk_actions($redirect_url, $action, $subscription_ids) { } /** * Process the request to delete personal data from subscriptions via admin bulk action. * * @since 1.0.0 - Migrated from WooCommerce Subscriptions v2.2.20 */ public static function process_bulk_action() { } /** * Add admin notice after processing personal data removal bulk action. * * @since 1.0.0 - Migrated from WooCommerce Subscriptions v2.2.20 */ public static function bulk_admin_notices() { } /** * Add a note to WC Personal Data Retention settings explaining that subscription orders aren't affected. * * @since 1.0.0 - Migrated from WooCommerce Subscriptions v2.2.20 * @param array $settings WooCommerce Account and Privacy settings. * @return array Account and Privacy settings. */ public static function add_caveat_to_order_data_retention_settings($settings) { } /** * Add admin setting to turn subscription data removal when processing erasure requests on or off. * * @since 1.0.0 - Migrated from WooCommerce Subscriptions v2.2.20 * @param array $settings WooCommerce Account and Privacy settings. * @return array Account and Privacy settings. */ public static function add_subscription_data_retention_settings($settings) { } /** * Remove subscription related order types from the order anonymization query. * * @since 1.0.0 - Migrated from WooCommerce Subscriptions v2.2.20 * @param array $query_args @see wc_get_orders() args. * @return array The args used to get orders to anonymize. */ public static function remove_subscription_orders_from_anonymization_query($query_args) { } /** * Add a note to the inactive user data retention setting noting that users with a subscription are excluded. * * @since 1.0.0 - Migrated from WooCommerce Subscriptions v2.3.4 * @param array $settings WooCommerce Account and Privacy settings. * @return array Account and Privacy settings. */ public static function add_inactive_user_retention_note($settings) { } /** * Set a flag to record inactive user account deletion. * * @since 1.0.0 - Migrated from WooCommerce Subscriptions v2.3.4 * @param array $user_roles The user roles included in the inactive user query. * @return array */ public static function flag_subscription_user_exclusion_from_query($user_roles) { } /** * Exclude customers who have subscriptions from the inactive user cleanup query. * * @since 1.0.0 - Migrated from WooCommerce Subscriptions v2.3.4 * @param WP_User_Query $user_query */ public static function maybe_exclude_subscription_customers($user_query) { } /* Deprecated Functions */ /** * Add the option to remove personal data from subscription via a bulk action. * * @since 1.0.0 - Migrated from WooCommerce Subscriptions v2.2.20 * @param array $bulk_actions Subscription bulk actions. */ public static function add_remove_personal_data_bulk_action($bulk_actions) { } } /** * A timeout resistant, single-serve upgrader for WC Subscriptions. * * This class is used to make all reasonable attempts to neatly upgrade data between versions of Subscriptions. * * For example, the way subscription data is stored changed significantly between v1.n and v2.0. It was imperative * the data be upgraded to the new schema without hassle. A hassle could easily occur if 100,000 orders were being * modified - memory exhaustion, script time out etc. * * @author Prospress * @category Admin * @package WooCommerce Subscriptions/Admin/Upgrades * @version 1.0.0 - Migrated from WooCommerce Subscriptions v2.0.0 * @since 1.0.0 - Migrated from WooCommerce Subscriptions v1.2 */ class WC_Subscriptions_Upgrader { private static $active_version; private static $upgrade_limit_hooks; private static $upgrade_limit_subscriptions; private static $about_page_url; private static $old_subscription_count = \null; public static $is_wc_version_2 = \false; public static $updated_to_wc_2_0; /** * @var array An array of WCS_Background_Updater objects used to run upgrade scripts in the background. */ protected static $background_updaters = array(); /** * Hooks upgrade function to init. * * @since 1.0.0 - Migrated from WooCommerce Subscriptions v1.2 */ public static function init() { } /** * Set limits on the number of items to upgrade at any one time based on the size of the site. * * The size of subscription at the time the upgrade is started is used to determine the batch size. * * @since 1.0.0 - Migrated from WooCommerce Subscriptions v2.0 */ protected static function set_upgrade_limits() { } /** * Try to block WP-Cron until upgrading finishes. spawn_cron() will only let us steal the lock for 10 minutes into the future, so * we can actually only block it for 9 minutes confidently. But as long as the upgrade process continues, the lock will remain. * * @since 1.0.0 - Migrated from WooCommerce Subscriptions v2.0 */ protected static function set_cron_lock() { } /** * Checks which upgrades need to run and calls the necessary functions for that upgrade. * * @since 1.0.0 - Migrated from WooCommerce Subscriptions v1.2 */ public static function upgrade() { } /** * When an upgrade is complete, set the active version, delete the transient locking upgrade and fire a hook. * * @since 1.0.0 - Migrated from WooCommerce Subscriptions v1.2 */ public static function upgrade_complete() { } /** * Redirect to the Subscriptions major version Welcome/About page for major version updates * * @since 1.0.0 - Migrated from WooCommerce Subscriptions v2.1 */ public static function maybe_redirect_after_upgrade_complete($current_version, $previously_active_version) { } /** * Add support for quantities for subscriptions. * Update all current subscription wp_cron tasks to the new action-scheduler system. * * @since 1.0.0 - Migrated from WooCommerce Subscriptions v2.0 */ private static function ajax_upgrade_handler() { } /** * Move scheduled subscription hooks out of wp-cron and into the new Action Scheduler. * * Also set all existing subscriptions to "sold individually" to maintain previous behavior * for existing subscription products before the subscription quantities feature was enabled.. * * @since 1.0.0 - Migrated from WooCommerce Subscriptions v1.5 */ public static function ajax_upgrade() { } /** * Handle upgrades for really old versions. * * @since 1.0.0 - Migrated from WooCommerce Subscriptions v2.0 */ private static function upgrade_really_old_versions() { } /** * Version 1.2 introduced child renewal orders to keep a record of each completed subscription * payment. Before 1.2, these orders did not exist, so this function creates them. * * @since 1.0.0 - Migrated from WooCommerce Subscriptions v1.2 */ private static function generate_renewal_orders() { } /** * Let the site administrator know we are upgrading the database and provide a confirmation is complete. * * This is important to avoid the possibility of a database not upgrading correctly, but the site continuing * to function without any remedy. * * @since 1.0.0 - Migrated from WooCommerce Subscriptions v1.2 */ public static function display_database_upgrade_helper() { } /** * Let the site administrator know we are upgrading the database already to prevent duplicate processes running the * upgrade. Also provides some useful diagnostic information, like how long before the site admin can restart the * upgrade process, and how many subscriptions per request can typically be updated given the amount of memory * allocated to PHP. * * @since 1.0.0 - Migrated from WooCommerce Subscriptions v1.4 */ public static function upgrade_in_progress_notice() { } /** * Display the Subscriptions welcome/about page after successfully upgrading to the latest version. * * @since 1.0.0 - Migrated from WooCommerce Subscriptions v1.4 */ public static function updated_welcome_page() { } /** * admin_css function. * * @access public * @return void */ public static function admin_css() { } /** * Add styles just for this page, and remove dashboard page links. * * @access public * @return void */ public static function admin_head() { } /** * Output the about screen. */ public static function about_screen() { } /** * In v2.0 and newer, it's possible to simply use wp_count_posts( 'shop_subscription' ) to count subscriptions, * but not in v1.5, because a subscription data is still stored in order item meta. This function queries the * v1.5 database structure. * * @since 1.0.0 - Migrated from WooCommerce Subscriptions v2.0 */ private static function get_total_subscription_count($initial = \false) { } /** * Returns the number of subscriptions left in the 1.5 structure * @return integer number of 1.5 subscriptions left */ private static function get_total_subscription_count_query() { } /** * Single source of truth for the query * @param integer $limit the number of subscriptions to get * @return string SQL query of what we need */ public static function get_subscription_query($batch_size = \null) { } /** * Check if the database has some data that was migrated from 1.5 to 2.0 * * @return bool True if it detects some v1.5 migrated data, otherwise false */ protected static function migrated_subscription_count() { } /** * While the upgrade is in progress, we need to block IPN messages to avoid renewals failing to process correctly. * * PayPal will retry the IPNs for up to a day or two until it has a successful request, so the store will continue to receive * IPN messages during the upgrade process, then once it is completed, the IPN will be successfully processed. * * The method returns a 409 Conflict HTTP response code to indicate that the IPN is conflicting with the upgrader. * * @since 1.0.0 - Migrated from WooCommerce Subscriptions v2.0 */ public static function maybe_block_paypal_ipn() { } /** * Run the end of prepaid term repair script. * * @since 1.0.0 - Migrated from WooCommerce Subscriptions v2.2.7 */ public static function repair_end_of_prepaid_term_actions() { } /** * Repair subscriptions with missing contains_synced_subscription post meta. * * @since 1.0.0 - Migrated from WooCommerce Subscriptions v2.2.9 */ public static function repair_subscription_contains_sync_meta() { } /** * When updating WC to a version after 3.0 from a version prior to 3.0, schedule the repair script to add address indexes. * * @since 1.0.0 - Migrated from WooCommerce Subscriptions v2.3.0 */ public static function maybe_add_subscription_address_indexes() { } /** * Load and initialise the background updaters. * * @since 1.0.0 - Migrated from WooCommerce Subscriptions v2.4.0 */ public static function initialise_background_updaters() { } /** * Display an admin notice if the site had customer subscription and/or subscription renewal order cached data stored in the options table * and was using an external object cache at the time of updating to 2.3.3. * * Under these circumstances, there is a chance that the persistent caches introduced in 2.3 could contain invalid data. * * @see https://github.com/Prospress/woocommerce-subscriptions/issues/2822 for more details. * @since 1.0.0 - Migrated from WooCommerce Subscriptions v2.3.3 */ public static function maybe_display_external_object_cache_warning() { } /** * Repair a single item's subtracted base tax meta. * * @since 3.1.0 * @param int $item_id The ID of the item which needs repairing. */ public static function repair_subtracted_base_taxes($item_id) { } /* Deprecated Functions */ /** * Handles the WC 3.5.0 upgrade routine that moves customer IDs from post metadata to the 'post_author' column. * * @since 1.0.0 - Migrated from WooCommerce Subscriptions v2.4.0 * @deprecated 1.0.0 - Migrated from WooCommerce Subscriptions v2.5.0 */ public static function maybe_update_subscription_post_author() { } /** * Used to check if a user ID is greater than the last user upgraded to version 1.4. * * Needs to be a separate function so that it can use a static variable (and therefore avoid calling get_option() thousands * of times when iterating over thousands of users). * * @since 1.0.0 - Migrated from WooCommerce Subscriptions v1.4 */ public static function is_user_upgraded_to_1_4($user_id) { } /** * Display an admin notice if the database version is greater than the active version of the plugin by at least one minor release (eg 1.1 and 1.0). * * @since 2.3.0 * @deprecated 1.2.0 */ public static function maybe_add_downgrade_notice() { } } class WCS_Repair_2_0_2 { /** * Get a batch of subscriptions subscriptions that haven't already been checked for repair. * * @return array IDs of subscription that have not been checked or repaired */ public static function get_subscriptions_to_repair($batch_size) { } /** * Update any subscription that need to be repaired. * * @return array The counts of repaired and unrepaired subscriptions */ public static function maybe_repair_subscriptions($subscription_ids_to_repair) { } /** * Check if a subscription was created prior to 2.0.0 and has some dates that need to be updated * because the meta was borked during the 2.0.0 upgrade process. If it does, then update the dates * to the new values. * * @return bool true if the subscription was repaired, otherwise false */ protected static function maybe_repair_subscription($subscription) { } /** * If we have a trial end date and that value is not the same as the old end date prior to upgrade, it was most likely * corrupted, so we will reset it to the value in meta. * * @param WC_Subscription $subscription the subscription to check * @param array $former_order_item_meta the order item meta data for the line item on the original order that formerly represented the subscription * @return string|bool false if the date does not need to be repaired or the new date if it should be repaired */ protected static function check_trial_end_date($subscription, $former_order_item_meta) { } /** * Because the upgrader may have attempted to set an invalid end date on the subscription, it could * lead to the entire date update process failing, which would mean that a next payment date would * not be set even when one existed. * * This method checks if a given subscription has no next payment date, and if it doesn't, it checks * if one was previously scheduled for the old subscription. If one was, and that date is in the future, * it will pass that date back for being set on the subscription. If a date was scheduled but that is now * in the past, it will recalculate it. * * @param WC_Subscription $subscription the subscription to check * @return string|bool false if the date does not need to be repaired or the new date if it should be repaired */ protected static function check_next_payment_date($subscription) { } /** * Check if the old subscription meta had an end date recorded and make sure that end date is now being used for the new subscription. * * In Subscriptions prior to 2.0 a subscription could have both an end date and an expiration date. The end date represented a date in the past * on which the subscription expired or was cancelled. The expiration date represented a date on which the subscription was set to expire (this * could be in the past or future and could be the same as the end date or different). Because the end date is a definitive even, in this function * we first check if it exists before falling back to the expiration date to check against. * * @param WC_Subscription $subscription the subscription to check * @param array $former_order_item_meta the order item meta data for the line item on the original order that formerly represented the subscription * @return string|bool false if the date does not need to be repaired or the new date if it should be repaired */ protected static function check_end_date($subscription, $former_order_item_meta) { } /** * If the subscription has expired since upgrading and the end date is not the original expiration date, * we need to unexpire it, which in the case of a previously active subscription means activate it, and * in any other case, leave it as on-hold (a cancelled subscription wouldn't have been expired, so the * status must be on-hold or active). * * @param WC_Subscription $subscription data about the subscription * @return bool true if the trial date was repaired, otherwise false */ protected static function maybe_repair_status($subscription, $former_order_item_meta, $dates_to_update) { } /** * There was a bug in the WCS_Upgrade_2_0::add_line_tax_data() method in Subscriptions 2.0.0 and 2.0.1 which * prevented recurring line tax data from being copied correctly to newly created subscriptions. This bug was * fixed in 2.0.2, so we can now use that method to make sure line tax data is set correctly. But to do that, * we first need to massage some of the deprecated line item meta to use the original meta keys. * * @param int $subscription_line_item_id ID of the new subscription line item * @param int $old_order_item_id ID of the old order line item * @param array $old_order_item The old line item * @return bool|int the meta ID of the newly added '_line_tax_data' meta data row, or false if no line tax data was added. */ protected static function maybe_repair_line_tax_data($subscription_line_item_id, $old_order_item_id, $old_order_item) { } } class WCS_Repair_2_0 { /** * Takes care of undefine notices in the upgrade process * * @param array $order_item item meta * @return array repaired item meta */ public static function maybe_repair_order_item($order_item) { } /** * Does sanity check on every subscription, and repairs them as needed * * @param array $subscription subscription data to be upgraded * @param integer $item_id id of order item meta * @return array a repaired subscription array */ public static function maybe_repair_subscription($subscription, $item_id) { } /** * Checks for missing data on a subscription * * @param array $subscription data about the subscription * @return array a list of repair functions to run on the subscription */ public static function integrity_check($subscription) { } /** * 'order_id': a subscription can exist without an original order in v2.0, so technically the order ID is no longer required. * However, if some or all order item meta data that constitutes a subscription exists without a corresponding parent order, * we can deem the issue to be that the subscription meta data was not deleted, not that the subscription should exist. Meta * data could be orphaned in v1.n if the order row in the wp_posts table was deleted directly in the database, or the * subscription/order were for a customer that was deleted in WordPress administration interface prior to Subscriptions v1.3.8. * In both cases, the subscription, including meta data, should have been permanently deleted. However, deleting data is not a * good idea during an upgrade. So I propose instead that we create a subscription without a parent order, but move it to the trash. * * Additional idea was to check whether the given order_id exists, but since that's another database read, it would slow down a lot of things. * * A subscription will not make it to this point if it doesn't have an order id, so this function will practically never be run * * @param array $subscription data about the subscription * @return array repaired data about the subscription */ public static function repair_order_id($subscription) { } /** * Combined functionality for the following functions: * - repair_product_id * - repair_variation_id * - repair_recurring_line_total * - repair_recurring_line_tax * - repair_recurring_line_subtotal * - repair_recurring_line_subtotal_tax * * @param array $subscription data about the subscription * @param numeric $item_id the id of the product we're missing the id for * @param array $item_meta meta data about the product * @param string $item_meta_key the meta key for the data on the item meta * @param string $subscription_meta_key the meta key for the data on the subscription * @return array repaired data about the subscription */ public static function repair_from_item_meta(array $subscription, $item_id, $item_meta, $subscription_meta_key = \null, $item_meta_key = \null, $default_value = '') { } /** * '_product_id': the only way to derive a order item's product ID would be to match the order item's name to a product name/title. * This is quite hacky, so we may be better copying the empty product ID to the new subscription. A subscription to a deleted * produced should be able to exist. * * @param array $subscription data about the subscription * @param numeric $item_id the id of the product we're missing the id for * @param array $item_meta meta data about the product * @return array repaired data about the subscription */ public static function repair_product_id($subscription, $item_id, $item_meta) { } /** * '_variation_id': the only way to derive a order item's product ID would be to match the order item's name to a product name/title. * This is quite hacky, so we may be better copying the empty product ID to the new subscription. A subscription to a deleted produced * should be able to exist. * * @param array $subscription data about the subscription * @param numeric $item_id the id of the product we're missing variation id for * @param array $item_meta meta data about the product * @return array repaired data about the subscription */ public static function repair_variation_id($subscription, $item_id, $item_meta) { } /** * If the subscription does not have a subscription key for whatever reason (probably because the product_id was missing), then this one * fills in the blank. * * @param array $subscription data about the subscription * @param numeric $item_id the id of the product we're missing variation id for * @param array $item_meta meta data about the product * @return array repaired data about the subscription */ public static function repair_subscription_key($subscription, $item_id, $item_meta) { } /** * '_subscription_status': we could default to cancelled (and then potentially trash) if no status exists because the cancelled status * is irreversible. But we can also take this a step further. If the subscription has a '_subscription_expiry_date' value and a * '_subscription_end_date' value, and they are within a few minutes of each other, we can assume the subscription's status should be * expired. If there is a '_subscription_end_date' value that is different to the '_subscription_expiry_date' value (either because the * expiration value is 0 or some other date), then we can assume the status should be cancelled). If there is no end date value, we're * a bit lost as technically the subscription hasn't ended, but we should make sure it is not active, so cancelled is still the best * default. * * @param array $subscription data about the subscription * @param numeric $item_id the id of the product we're missing variation id for * @param array $item_meta meta data about the product * @return array repaired data about the subscription */ public static function repair_status($subscription, $item_id, $item_meta) { } /** * '_subscription_period': we can attempt to derive this from the time between renewal orders. For example, if there are two renewal * orders found 3 months apart, the billing period would be month. If there are not two or more renewal orders (we can't use a single * renewal order because that would account for the free trial) and a _product_id value , if the product still exists, we can use the * current value set on that product. It won't always be correct, but it's the closest we can get to an accurate estimate. * * @param array $subscription data about the subscription * @param numeric $item_id the id of the product we're missing variation id for * @param array $item_meta meta data about the product * @return array repaired data about the subscription */ public static function repair_period($subscription, $item_id, $item_meta) { } /** * '_subscription_interval': we can attempt to derive this from the time between renewal orders. For example, if there are two renewal * orders found 3 months apart, the billing period would be month. If there are not two or more renewal orders (we can't use a single * renewal order because that would account for the free trial) and a _product_id value , if the product still exists, we can use the * current value set on that product. It won't always be correct, but it's the closest we can get to an accurate estimate. * * @param array $subscription data about the subscription * @param numeric $item_id the id of the product we're missing variation id for * @param array $item_meta meta data about the product * @return array repaired data about the subscription */ public static function repair_interval($subscription, $item_id, $item_meta) { } /** * '_subscription_length': if there are '_subscription_expiry_date' and '_subscription_start_date' values, we can use those to * determine how many billing periods fall between them, and therefore, the length of the subscription. This data is low value however as * it is no longer stored in v2.0 and mainly used to determine the expiration date. * * @param array $subscription data about the subscription * @param numeric $item_id the id of the product we're missing variation id for * @param array $item_meta meta data about the product * @return array repaired data about the subscription */ public static function repair_length($subscription, $item_id, $item_meta) { } /** * '_subscription_start_date': the original order's '_paid_date' value (stored in post meta) can be used as the subscription's start date. * If no '_paid_date' exists, because the order used a payment method that doesn't call $order->payment_complete(), like BACs or Cheque, * then we can use the post_date_gmt column in the wp_posts table of the original order. * * @param array $subscription data about the subscription * @param numeric $item_id the id of the product we're missing variation id for * @param array $item_meta meta data about the product * @return array repaired data about the subscription */ public static function repair_start_date($subscription, $item_id, $item_meta) { } /** * '_subscription_trial_expiry_date': if the subscription has at least one renewal order, we can set the trial expiration date to the date * of the first renewal order. However, this is generally safe to default to 0 if it is not set. Especially if the subscription is * inactive and/or has 1 or more renewals (because its no longer used and is simply for record keeping). * * @param array $subscription data about the subscription * @param numeric $item_id the id of the product we're missing variation id for * @param array $item_meta meta data about the product * @return array repaired data about the subscription */ public static function repair_trial_expiry_date($subscription, $item_id, $item_meta) { } /** * '_subscription_expiry_date': if the subscription has a '_subscription_length' value, that can be used to calculate the expiration date * (from the '_subscription_start_date' or '_subscription_trial_expiry_date' if one is set). If no length is set, but the subscription has * an expired status, the '_subscription_end_date' can be used. In most other cases, this is generally safe to default to 0 if the * subscription is cancelled because its no longer used and is simply for record keeping. * * @param array $subscription data about the subscription * @param numeric $item_id the id of the product we're missing variation id for * @param array $item_meta meta data about the product * @return array repaired data about the subscription */ public static function repair_expiry_date($subscription, $item_id, $item_meta) { } /** * '_subscription_end_date': if the subscription has a '_subscription_length' value and status of expired, the length can be used to * calculate the end date as it will be the same as the expiration date. If no length is set, or the subscription has a cancelled status, * some time within 24 hours after the last renewal order's date can be used to provide a rough estimate. * * @param array $subscription data about the subscription * @param numeric $item_id the id of the product we're missing variation id for * @param array $item_meta meta data about the product * @return array repaired data about the subscription */ public static function repair_end_date($subscription, $item_id, $item_meta) { } /** * _recurring_line_total': if the subscription has at least one renewal order, this value can be derived from the '_line_total' value of * that order. If no renewal orders exist, it can be derived roughly by deducting the '_subscription_sign_up_fee' value from the original * order's total if there is no trial expiration date. * * @param array $subscription data about the subscription * @param numeric $item_id the id of the product we're missing variation id for * @param array $item_meta meta data about the product * @return array repaired data about the subscription */ public static function repair_recurring_line_total($subscription, $item_id, $item_meta) { } /** * _recurring_line_total': if the subscription has at least one renewal order, this value can be derived from the '_line_total' value * of that order. If no renewal orders exist, it can be derived roughly by deducting the '_subscription_sign_up_fee' value from the * original order's total if there is no trial expiration date. * * @param array $subscription data about the subscription * @param numeric $item_id the id of the product we're missing variation id for * @param array $item_meta meta data about the product * @return array repaired data about the subscription */ public static function repair_recurring_line_tax($subscription, $item_id, $item_meta) { } /** * _recurring_line_total': if the subscription has at least one renewal order, this value can be derived from the '_line_total' value of * that order. If no renewal orders exist, it can be derived roughly by deducting the '_subscription_sign_up_fee' value from the original * order's total if there is no trial expiration date * * @param array $subscription data about the subscription * @param numeric $item_id the id of the product we're missing variation id for * @param array $item_meta meta data about the product * @return array repaired data about the subscription */ public static function repair_recurring_line_subtotal($subscription, $item_id, $item_meta) { } /** * _recurring_line_total': if the subscription has at least one renewal order, this value can be derived from the '_line_total' value of * that order. If no renewal orders exist, it can be derived roughly by deducting the '_subscription_sign_up_fee' value from the original * order's total if there is no trial expiration date. * * @param array $subscription data about the subscription * @param numeric $item_id the id of the product we're missing variation id for * @param array $item_meta meta data about the product * @return array repaired data about the subscription */ public static function repair_recurring_line_subtotal_tax($subscription, $item_id, $item_meta) { } /** * Utility function to calculate the seconds between two timestamps. Order is not important, it's just the difference. * * @param string $to mysql timestamp * @param string $from mysql timestamp * @return integer number of seconds between the two */ private static function time_diff($to, $from) { } /** * Utility function to get all renewal orders in the old structure. * * @param array $subscription the sub we're looking for the renewal orders * @return array of WC_Orders */ private static function get_renewal_orders($subscription) { } /** * Utility method to check the action scheduler for dates * * @param string $type the type of scheduled action * @param string $subscription_key key of subscription in the format of order_id_item_id * @return string either 0 or mysql date */ private static function maybe_get_date_from_action_scheduler($type, $subscription) { } /** * Utility function to return the effective start date for interval calculations (end of trial period -> start date -> null ) * * @param array $subscription subscription data * @return mixed mysql formatted date, or null if none found */ public static function get_effective_start_date($subscription) { } /** * Logs an entry for the store owner to review an issue. * * @param array $subscription subscription data */ protected static function log_store_owner_review($subscription) { } } class WCS_Repair_Line_Item_Has_Trial_Meta extends \WCS_Background_Repairer { /** * Constructor * * @param WC_Logger_Interface $logger The WC_Logger instance. * * @since 1.0.0 - Migrated from WooCommerce Subscriptions v2.6.0 */ public function __construct(\WC_Logger_Interface $logger) { } /** * Get a batch of subscriptions which have or had free trials at the time of purchase. * * @param int $page The page number to get results from. * @return array A list of subscription ids. * * @since 1.0.0 - Migrated from WooCommerce Subscriptions v2.6.0 */ protected function get_items_to_repair($page) { } /** * Repair the line item meta for a given subscription ID. * * @param int $subscription_id * * @since 1.0.0 - Migrated from WooCommerce Subscriptions v2.6.0 */ public function repair_item($subscription_id) { } } class WCS_Repair_Start_Date_Metadata extends \WCS_Background_Upgrader { /** * Constructor * * @param WC_Logger_Interface $logger The WC_Logger instance. * * @since 1.0.0 - Migrated from WooCommerce Subscriptions v2.4.0 */ public function __construct(\WC_Logger_Interface $logger) { } /** * Update a subscription, saving its start date as metadata. * * @since 1.0.0 - Migrated from WooCommerce Subscriptions v2.4.0 */ protected function update_item($subscription_id) { } /** * Get a batch of subscriptions to repair. * * @since 1.0.0 - Migrated from WooCommerce Subscriptions v2.4.0 * @return array A list of subscription ids which may need to be repaired. */ protected function get_items_to_update() { } } class WCS_Repair_Subscription_Address_Indexes extends \WCS_Background_Upgrader { /** * Constructor * * @param WC_Logger_Interface $logger The WC_Logger instance. * * @since 1.0.0 - Migrated from WooCommerce Subscriptions v2.3.0 */ public function __construct(\WC_Logger_Interface $logger) { } /** * Update a subscription, setting its address indexes. * * @since 1.0.0 - Migrated from WooCommerce Subscriptions v2.3.0 */ protected function update_item($subscription_id) { } /** * Get a batch of subscriptions which need address indexes. * * @since 1.0.0 - Migrated from WooCommerce Subscriptions v2.3.0 * @return array A list of subscription ids which need address indexes. */ protected function get_items_to_update() { } } class WCS_Repair_Subtracted_Base_Tax_Line_Item_Meta extends \WCS_Background_Repairer { /** * Constructor * * @param WC_Logger_Interface $logger The WC_Logger instance. * * @since 1.0.0 - Migrated from WooCommerce Subscriptions v3.1.0 */ public function __construct(\WC_Logger_Interface $logger) { } /** * Get a batch of line items with _subtracted_base_location_tax meta to repair. * * @param int $page The page number to get results from. Base 1 - the first page is 1. * @return array A list of line item ids. * * @since 1.0.0 - Migrated from WooCommerce Subscriptions v3.1.0 */ protected function get_items_to_repair($page) { } /** * Repair the line item meta for a given line item. * * @param int $line_item_id The ID for the line item to repair. * * @since 1.0.0 - Migrated from WooCommerce Subscriptions v3.1.0 */ public function repair_item($line_item_id) { } } class WCS_Repair_Suspended_PayPal_Subscriptions extends \WCS_Background_Upgrader { /** * Constructor. * * @param WC_Logger_Interface $logger The WC Logger instance. * * @since 1.0.0 - Migrated from WooCommerce Subscriptions v2.3.0 */ public function __construct(\WC_Logger_Interface $logger) { } /** * Repair a subscription that was suspended in PayPal, but not suspended in WooCommerce. * * @param int $subscription_id The ID of a shop_subscription/WC_Subscription object. */ protected function update_item($subscription_id) { } /** * Get a list of subscriptions to repair. * * @since 1.0.0 - Migrated from WooCommerce Subscriptions v2.3.0 * @return array A list of subscription ids which may need to be repaired. */ protected function get_items_to_update() { } } class WCS_Upgrade_1_2 { public static function init() { } } class WCS_Upgrade_1_3 { public static function init() { } } class WCS_Upgrade_1_4 { private static $last_upgraded_user_id = \false; public static function init() { } /** * Used to check if a user ID is greater than the last user upgraded to version 1.4. * * Needs to be a separate function so that it can use a static variable (and therefore avoid calling get_option() thousands * of times when iterating over thousands of users). * * @since 1.0.0 - Migrated from WooCommerce Subscriptions v1.4 */ public static function is_user_upgraded($user_id) { } } class WCS_Upgrade_1_5 { /** * Set status to 'sold individually' for all existing subscription products that haven't already been updated. * * Subscriptions 1.5 made it possible for a product to be sold individually or in multiple quantities, whereas * previously it was possible only to buy a subscription product in a single quantity. * * @since 1.0.0 - Migrated from WooCommerce Subscriptions v2.0 */ public static function upgrade_products() { } /** * Update subscription WP-Cron tasks to Action Scheduler. * * @since 1.0.0 - Migrated from WooCommerce Subscriptions v2.0 */ public static function upgrade_hooks($number_hooks_to_upgrade) { } } class WCS_Upgrade_2_0 { /* Cache of order item meta keys that were used to store subscription data in v1.5 */ private static $subscription_item_meta_keys = array('_recurring_line_total', '_recurring_line_tax', '_recurring_line_subtotal', '_recurring_line_subtotal_tax', '_recurring_line_tax_data', '_subscription_suspension_count', '_subscription_period', '_subscription_interval', '_subscription_trial_length', '_subscription_trial_period', '_subscription_length', '_subscription_sign_up_fee', '_subscription_failed_payments', '_subscription_recurring_amount', '_subscription_start_date', '_subscription_trial_expiry_date', '_subscription_expiry_date', '_subscription_end_date', '_subscription_status', '_subscription_completed_payments'); /** * Migrate subscriptions out of order item meta and into post/post meta tables for their own post type. * * @since 1.0.0 - Migrated from WooCommerce Subscriptions v2.0 */ public static function upgrade_subscriptions($batch_size) { } /** * Gets an array of subscriptions from the v1.5 database structure and returns them in the in the v1.5 structure of * 'order_item_id' => subscription details array(). * * The subscription will be orders from oldest to newest, which is important because self::migrate_resubscribe_orders() * method expects a subscription to exist in order to migrate the resubscribe meta data correctly. * * @param int $batch_size The number of subscriptions to return. * @return array Subscription details in the v1.5 structure of 'order_item_id' => array() * @since 1.0.0 - Migrated from WooCommerce Subscriptions v2.0 */ private static function get_subscriptions($batch_size) { } /** * Add the details of an order item to a subscription as a product line item. * * When adding a product to a subscription, we can't use WC_Abstract_Order::add_product() because it requires a product object * and the details of the product may have changed since it was purchased so we can't simply instantiate an instance of the * product based on ID. * * @param WC_Subscription $new_subscription A subscription object * @param int $order_item_id ID of the subscription item on the original order * @param array $order_item An array of order item data in the form returned by WC_Abstract_Order::get_items() * @return int Subscription $item_id The order item id of the new line item added to the subscription. * @since 1.0.0 - Migrated from WooCommerce Subscriptions v2.0 */ private static function add_product($new_subscription, $order_item_id, $order_item) { } /** * Copy or recreate line tax data to the new subscription. * * @param int $new_order_item_id ID of the line item on the new subscription post type * @param int $old_order_item_id ID of the line item on the original order that in v1.5 represented the subscription * @param array $order_item The line item on the original order that in v1.5 represented the subscription * @since 1.0.0 - Migrated from WooCommerce Subscriptions v2.0 */ public static function add_line_tax_data($new_order_item_id, $old_order_item_id, $order_item) { } /** * Deprecate order item meta data stored on the original order that used to make up the subscription by prefixing it with with '_wcs_migrated' * * @param int $order_item_id ID of the subscription item on the original order * @since 1.0.0 - Migrated from WooCommerce Subscriptions v2.0 */ private static function deprecate_item_meta($order_item_id) { } /** * Move download permissions from original order to the new subscription created for the order. * * @param WC_Subscription $subscription A subscription object * @param int $subscription_item_id ID of the product line item on the subscription * @param WC_Order $original_order The original order that was created to purchase the subscription * @since 1.0.0 - Migrated from WooCommerce Subscriptions v2.0 */ private static function migrate_download_permissions($subscription, $subscription_item_id, $order) { } /** * Migrate the trial expiration, next payment and expiration/end dates to a new subscription. * * @since 1.0.0 - Migrated from WooCommerce Subscriptions v2.0 */ private static function migrate_dates($new_subscription, $old_subscription) { } /** * Copy an assortment of meta data from the original order's post meta table to the new subscription's post meta table. * * @param int $subscription_id The ID of a 'shop_subscription' post type * @param WC_Order $order The original order used to purchase a subscription * @return null * @since 1.0.0 - Migrated from WooCommerce Subscriptions v2.0 */ private static function migrate_post_meta($subscription_id, $order) { } /** * Deprecate post meta data stored on the original order that used to make up the subscription by prefixing it with with '_wcs_migrated' * * @param int $subscription_id The ID of a 'shop_subscription' post type * @param WC_Order $order The original order used to purchase a subscription * @return null * @since 1.0.0 - Migrated from WooCommerce Subscriptions v2.0 */ private static function deprecate_post_meta($order_id) { } /** * Migrate order notes relating to subscription events to the new subscription as these are now logged on the subscription * not the order. * * @param int $subscription_id The ID of a 'shop_subscription' post type * @param WC_Order $order The original order used to purchase a subscription * @return null * @since 1.0.0 - Migrated from WooCommerce Subscriptions v2.0 */ private static function migrate_order_notes($subscription_id, $order_id) { } /** * Migrate recurring_tax, recurring_shipping and recurring_coupon line items to be plain tax, shipping and coupon line * items on a subscription. * * @param int $subscription_id The ID of a 'shop_subscription' post type * @param WC_Order $order The original order used to purchase a subscription * @return null * @since 1.0.0 - Migrated from WooCommerce Subscriptions v2.0 */ private static function migrate_order_items($subscription_id, $order_id) { } /** * The 'post_parent' column is no longer used to relate a renewal order with a subscription/order, instead, we use a * '_subscription_renewal' post meta value, so the 'post_parent' of all renewal orders needs to be changed from the original * order's ID, to 0, and then the new subscription's ID should be set as the '_subscription_renewal' post meta value on * the renewal order. * * @param WC_Subscription $subscription An instance of a 'shop_subscription' post type * @param int $order_id The ID of a 'shop_order' which created this susbcription * @return null * @since 1.0.0 - Migrated from WooCommerce Subscriptions v2.0 */ private static function migrate_renewal_orders($subscription, $order_id) { } /** * The '_original_order' post meta value is no longer used to relate a resubscribe order with a subscription/order, instead, we use * a '_subscription_resubscribe' post meta value, so the '_original_order' of all resubscribe orders needs to be changed from the * original order's ID, to 0, and then the new subscription's ID should be set as the '_subscription_resubscribe' post meta value * on the resubscribe order. * * @param WC_Subscription $new_subscription An instance of a 'shop_subscription' post type * @param WC_Order $resubscribe_order An instance of a 'shop_order' post type which created this subscription * @return null * @since 1.0.0 - Migrated from WooCommerce Subscriptions v2.0 */ private static function migrate_resubscribe_orders($new_subscription, $resubscribe_order) { } /** * The '_switched_subscription_key' and '_switched_subscription_new_order' post meta values are no longer used to relate orders * and switched subscriptions, instead, we need to set a '_subscription_switch' value on the switch order and deprecated the old * meta keys by prefixing them with '_wcs_migrated'. * * Subscriptions also sets a '_switched_subscription_item_id' value on the new line item of for the switched item and a item meta * value of '_switched_subscription_new_item_id' on the old line item on the subscription, but the old switching process didn't * change order items, it just created a new order with the new item, so we won't bother setting this as it is purely for record * keeping. * * @param WC_Subscription $new_subscription A subscription object * @param WC_Order $switch_order The original order used to purchase the subscription * @param int $subscription_item_id The order item ID of the item added to the subscription by self::add_product() * @return null * @since 1.0.0 - Migrated from WooCommerce Subscriptions v2.0 */ private static function migrate_switch_meta($new_subscription, $switch_order, $subscription_item_id) { } } class WCS_Upgrade_2_1 { /** * Set the _schedule_cancelled post meta value to store a subscription's cancellation * date for those subscriptions still in the pending cancellation state, and therefore * where it is possible to determine the cancellation date. * * @since 1.0.0 - Migrated from WooCommerce Subscriptions v2.1 */ public static function set_cancelled_dates() { } } class WCS_Upgrade_2_2_7 { private static $cron_hook = 'wcs_repair_end_of_prepaid_term_actions'; private static $batch_size = 30; /** * Schedule an WP-Cron event to run in 5 minutes to repair pending cancelled subscriptions. * * @since 1.0.0 - Migrated from WooCommerce Subscriptions v2.2.7 */ public static function schedule_end_of_prepaid_term_repair() { } /** * Repair a batch of pending cancelled subscriptions. * * Subscriptions 2.2.0 included a race condition which causes cancelled subscriptions to not schedule * end of prepaid term actions. This results in pending cancelled subscriptions not transitioning to * cancelled automatically. * * @since 1.0.0 - Migrated from WooCommerce Subscriptions v2.2.7 */ public static function repair_pending_cancelled_subscriptions() { } /** * Get a batch of pending cancelled subscriptions to repair. * * @since 1.0.0 - Migrated from WooCommerce Subscriptions v2.2.7 * @return array An list of subscription ids which may need to be repaired. */ public static function get_subscriptions_to_repair() { } /** * Add a message to the wcs-upgrade-end-of-prepaid-term-repair log * * @param string The message to be logged * @since 1.0.0 - Migrated from WooCommerce Subscriptions v2.2.7 */ protected static function log($message) { } } class WCS_Upgrade_2_2_9 { private static $cron_hook = 'wcs_repair_subscriptions_containing_synced_variations'; private static $repaired_subscriptions_option = 'wcs_2_2_9_repaired_subscriptions'; private static $batch_size = 30; /** * Schedule an WP-Cron event to run in 3 minutes to repair subscription synced post meta. * * @since 1.0.0 - Migrated from WooCommerce Subscriptions v2.2.9 */ public static function schedule_repair() { } /** * Repair a batch of subscriptions. * * Subscriptions 2.2.0 included a bug which caused subscriptions which contain a synced variation product created while * WC 3.0 was active, to have missing _contains_synced_subscription post meta. This was fixed to prevent new subscriptions * falling victim to that bug in WCS 2.2.8 however existing subscriptions need to be repaired. * * @since 1.0.0 - Migrated from WooCommerce Subscriptions v2.2.9 */ public static function repair_subscriptions_containing_synced_variations() { } /** * Get a batch of subscriptions to repair. * * @since 1.0.0 - Migrated from WooCommerce Subscriptions v2.2.9 * @param array $repaired_subscriptions A list of subscription post IDs to ignore. * @return array A list of subscription ids which may need to be repaired. */ public static function get_subscriptions_to_repair($repaired_subscriptions) { } /** * Add a message to the wcs-upgrade-subscriptions-containing-synced-variations log * * @param string The message to be logged * @since 1.0.0 - Migrated from WooCommerce Subscriptions v2.2.9 */ protected static function log($message) { } } class WCS_Upgrade_3_1_0 { /** * Update Subscription webhooks with API Version set to 3, to now deliver API Version 1 payloads. * This is to maintain backwards compatibility with the delivery payloads now that we have added a * wc/v3/subscriptions endpoint with 3.1 * * @since 1.0.0 - Migrated from WooCommerce Subscriptions v3.1.0 */ public static function migrate_subscription_webhooks_using_api_version_3() { } } class WCS_Upgrade_Logger { /** @var WC_Logger_Interface instance */ protected static $log = \false; /** @var string File handle */ public static $handle = 'wcs-upgrade'; /** @var string File handle */ public static $weeks_until_cleanup = 8; public static function init() { } /** * Add an entry to the log * * @param string $message */ public static function add($message, $handle = '') { } /** * Clear entries from the upgrade log. */ public static function clear() { } /** * Log more information during upgrade: Information about environment and active plugins * * @since 1.0.0 - Migrated from WooCommerce Subscriptions v2.5.0 */ public static function add_more_info() { } /** * Schedule a hook to automatically clear the log after 8 weeks */ public static function schedule_cleanup($current_version, $old_version) { } } class WCS_Upgrade_Subscription_Post_Author extends \WCS_Background_Upgrader { /** * Constructor * * @param WC_Logger $logger The WC_Logger instance. * @since 1.0.0 - Migrated from WooCommerce Subscriptions v2.4.0 */ public function __construct(\WC_Logger $logger) { } /** * Update a subscription, setting its post_author to its customer ID. * * @since 1.0.0 - Migrated from WooCommerce Subscriptions v2.4.0 */ protected function update_item($subscription_id) { } /** * Get a batch of subscriptions which need to be updated. * * @since 1.0.0 - Migrated from WooCommerce Subscriptions v2.4.0 * @return array A list of subscription ids which need to be updated. */ protected function get_items_to_update() { } /** * Schedule the instance's hook to run in $this->time_limit seconds, if it's not already scheduled. */ protected function schedule_background_update() { } /** * Unschedule the instance's hook in Action Scheduler */ protected function unschedule_background_updates() { } /** * Returns the list of admin subscription IDs to ignore during this upgrade routine. * * @return array */ private function get_subscriptions_to_ignore() { } /** * Adds a subscription ID to the ignore list for this upgrade routine. * * @param int $subscription_id */ private function add_subscription_to_ignore_list($subscription_id) { } /** * Hooks into WC's 3.5 update routine to add the subscription post type to the list of post types affected by this update. * * @since 1.0.0 - Migrated from WooCommerce Subscriptions v2.4.0 */ public static function hook_into_wc_350_update() { } /** * Callback for the `woocommerce_update_350_order_customer_id_post_types` hook. Makes sure `shop_subscription` is * included in the post types array. * * @param array $post_types * @return array * @since 1.0.0 - Migrated from WooCommerce Subscriptions v2.4.0 */ public static function add_post_type_to_wc_350_update($post_types = array()) { } } /** * The main subscriptions class. * * @since 1.0 */ class WC_Subscriptions { /** @var string */ public static $name = 'subscription'; /** @var string */ public static $activation_transient = 'woocommerce_subscriptions_activated'; /** @var string */ public static $plugin_file = __FILE__; /** @var string */ public static $version = '6.3.1'; // WRCS: DEFINED_VERSION. /** @var string */ public static $wc_minimum_supported_version = '7.7'; /** @var WCS_Cache_Manager */ public static $cache; /** @var WCS_Autoloader */ protected static $autoloader; /** * Set up the class, including it's hooks & filters, when the file is loaded. * * @since 1.0 * * @param WCS_Autoloader $autoloader Autoloader instance. */ public static function init($autoloader = \null) { } /* * Plugin House Keeping */ /** * Called when WooCommerce is inactive or running and out-of-date version to display an inactive notice. * * @deprecated 5.0.0 * * @since 1.2 */ public static function woocommerce_inactive_notice() { } /* Deprecated Functions */ /** * Handle deprecation function calls. * * @since 4.0.0 * * @param string $function The name of the method being called. * @param array $arguments An array containing the parameters passed to the method. * * @return mixed The value returned from a deprecated function replacement or null. */ public static function __callStatic($method, $arguments) { } } /** * Checks the cart to see if it contains an early subscription renewal. * * @return bool|array The cart item containing the early renewal, else false. * @since 2.3.0 */ function wcs_cart_contains_early_renewal() { } /** * Checks if a user can renew an active subscription early. * * @param int|WC_Subscription $subscription Post ID of a 'shop_subscription' post, or instance of a WC_Subscription object. * @param int $user_id The ID of a user. * @since 2.3.0 * @return bool Whether the user can renew a subscription early. */ function wcs_can_user_renew_early($subscription, $user_id = 0) { } /** * Returns a URL for early renewal of a subscription. * * @param int|WC_Subscription $subscription WC_Subscription ID, or instance of a WC_Subscription object. * @return string The early renewal URL. * @since 2.3.0 */ function wcs_get_early_renewal_url($subscription) { } /** * Update the subscription dates after processing an early renewal. * * @since 2.6.0 * * @param WC_Subscription $subscription The subscription to update. * @param WC_Order $early_renewal The early renewal. */ function wcs_update_dates_after_early_renewal($subscription, $early_renewal) { } /** * Store a message to display via @see wcs_display_admin_notices(). * * @param string The message to display * @since 1.0.0 - Migrated from WooCommerce Subscriptions v2.0 */ function wcs_add_admin_notice($message, $notice_type = 'success') { } /** * Display any notices added with @see wcs_add_admin_notice() * * This method is also hooked to 'admin_notices' to display notices there. * * @since 1.0.0 - Migrated from WooCommerce Subscriptions v2.0 */ function wcs_display_admin_notices($clear = \true) { } /** * Delete any admin notices we stored for display later. * * @since 1.0.0 - Migrated from WooCommerce Subscriptions v2.0 */ function wcs_clear_admin_notices() { } /** * Needs to be called after init so that $woocommerce global is setup **/ function create_paypal_standard_subscriptions() { } /** * Returns a PayPal Subscription ID or Billing Agreement ID use to process payment for a given subscription or order. * * @param int The ID of a WC_Order or WC_Subscription object * @since 1.0.0 - Migrated from WooCommerce Subscriptions v2.0 */ function wcs_get_paypal_id($order) { } /** * Stores a PayPal Standard Subscription ID or Billing Agreement ID in the post meta of a given order and the user meta of the order's user. * * @param int|object A WC_Order or WC_Subscription object or the ID of a WC_Order or WC_Subscription object * @param string A PayPal Standard Subscription ID or Express Checkout Billing Agreement ID * @since 1.0.0 - Migrated from WooCommerce Subscriptions v2.0 */ function wcs_set_paypal_id($order, $paypal_subscription_id) { } /** * Checks if a given profile ID is of a certain type. * * PayPal offers many different profile IDs that can be used for recurring payments, including: * - Express Checkout Billing Agreement IDs for Reference Transactios * - Express Checkout Recurring Payment profile IDs * - PayPal Standard Subscription IDs * - outdated PayPal Standard Subscription IDs (for accounts prior to 2009 that have not been upgraded). * * @param string $profile_id A PayPal Standard Subscription ID or Express Checkout Billing Agreement ID * @param string $profile_type A type of profile ID, can be 'billing_agreement' or 'old_id'. * @since 1.0.0 - Migrated from WooCommerce Subscriptions v2.0 */ function wcs_is_paypal_profile_a($profile_id, $profile_type) { } /** * Limit the length of item names to be within the allowed 127 character range. * * @param string $item_name * @return string * @since 1.0.0 - Migrated from WooCommerce Subscriptions v2.0 */ function wcs_get_paypal_item_name($item_name) { } /** * Takes a timestamp for a date in the future and calculates the number of days between now and then * * @since 1.0.0 - Migrated from WooCommerce Subscriptions v2.0 */ function wcs_calculate_paypal_trial_periods_until($future_timestamp) { } /** * Check if the $_SERVER global has PayPal WC-API endpoint URL slug in its 'REQUEST_URI' value * * In some cases, we need tdo be able to check if we're on the PayPal API page before $wp's query vars are setup, * like from WC_Subscriptions_Product::is_purchasable() and WC_Product_Subscription_Variation::is_purchasable(), * both of which are called within WC_Cart::get_cart_from_session(), which is run before query vars are setup. * * @return 2.0.13 * @return bool **/ function wcs_is_paypal_api_page() { } /** * Display a recurring cart's subtotal * * @access public * @param WC_Cart $cart The cart do print the subtotal html for. * @return string */ function wcs_cart_totals_subtotal_html($cart) { } /** * Get recurring shipping methods. * * @access public */ function wcs_cart_totals_shipping_html() { } /** * Display a recurring shipping method's input element, either as a hidden element if there is only one shipping method, * or a radio select box when there is more than one available method. * * @param string $shipping_method_index * @param object $shipping_method * @param string $chosen_method * @param string $input_type * @return null */ function wcs_cart_print_shipping_input($shipping_method_index, $shipping_method, $chosen_method = '', $input_type = 'hidden') { } /** * Prints a hidden element which indicates that the shipping method for a given recurring cart is inherited from the initial cart. * * In frontend scripts, this hidden element's data properties are used to link initial cart shipping method changes to the * corresponding hidden recurring cart shipping method input element. * * @param string $shipping_method_index The shipping method index for the recurring cart. eg 2023_08_11_monthly_0. */ function wcs_cart_print_inherit_shipping_flag($shipping_method_index) { } /** * Display a recurring shipping methods price & name as a label * * @param WC_Shipping_Rate $method The shipping method rate object. * @return string The recurring shipping method price html. */ function wcs_cart_totals_shipping_method($method, $cart) { } /** * Display a recurring shipping methods price * * @param object $method * @return string */ function wcs_cart_totals_shipping_method_price_label($method, $cart) { } /** * Display recurring taxes total * * @access public * @return void */ function wcs_cart_totals_taxes_total_html($cart) { } /** * Display the remove link for a coupon. * * @access public * * @param WC_Coupon $coupon */ function wcs_cart_coupon_remove_link_html($coupon) { } /** * Display a recurring coupon's value. * * @see wc_cart_totals_coupon_html() * * @access public * * @param string|WC_Coupon $coupon * @param WC_Cart $cart */ function wcs_cart_totals_coupon_html($coupon, $cart) { } /** * Gets recurring total html including inc tax if needed. * * @param WC_Cart The cart to display the total for. */ function wcs_cart_totals_order_total_html($cart) { } /** * Return a formatted price string for a given cart object * * @access public * @return string */ function wcs_cart_price_string($recurring_amount, $cart) { } /** * Return a given piece of meta data from the cart * * The data can exist on the cart object, a cart item, or product data on a cart item. * The first piece of data with a matching key (in that order) will be returned if it * is found, otherwise, the value specified with $default, will be returned. * * @access public * @return string */ function wcs_cart_pluck($cart, $field, $default = 0) { } /** * Append the first renewal payment date to a string (which is the order total HTML string by default) * * @access public * @return string */ function wcs_add_cart_first_renewal_payment_date($order_total_html, $cart) { } /** * Return the cart item name for specific cart item * * @access public * @return string */ function wcs_get_cart_item_name($cart_item, $include = array()) { } /** * Allows protected products to be renewed. * * @since 1.0.0 - Migrated from WooCommerce Subscriptions v2.4.0 */ function wcs_allow_protected_products_to_renew() { } /** * Restores protected products from being added to the cart. * @see wcs_allow_protected_products_to_renew * @since 1.0.0 - Migrated from WooCommerce Subscriptions v2.4.0 */ function wcs_disallow_protected_product_add_to_cart_validation() { } /** * Gets all the cart items linked to a given subscription order type. * * @since 1.0.0 - Migrated from WooCommerce Subscriptions v3.1.0 * * @param string $order_type The order type to get cart items for. Can be 'parent', 'renewal', 'resubscribe', 'switch'. * @return array[] An array of cart items which are linked to an order or subscription by the order type relationship. */ function wcs_get_order_type_cart_items($order_type) { } /** * Display a tooltip in the WordPress administration area. * * @since 1.0.0 - Migrated from WooCommerce Subscriptions v2.1.0 * * @param string $tip The content to display in the tooltip. * @param bool $allow_html Allow sanitized HTML if true or escape. Optional. False by default. * @param string $class The help tip's class attribute. Optional. Default is 'woocommerce-help-tip'. * * @return string The helptip HTML. */ function wcs_help_tip($tip, $allow_html = \false, $class = 'woocommerce-help-tip') { } /** * Access an object's property in a way that is compatible with CRUD and non-CRUD APIs for different versions of WooCommerce. * * We don't want to force the use of a custom legacy class for orders, similar to WC_Subscription_Legacy, because 3rd party * code may expect the object type to be WC_Order with strict type checks. * * A note on dates: in WC 3.0+, dates are returned a timestamps in the site's timezone :upside_down_face:. In WC < 3.0, they were * returned as MySQL strings in the site's timezone. We return them from here as MySQL strings in UTC timezone because that's how * dates are used in Subscriptions in almost all cases, for sanity's sake. * * @param WC_Order|WC_Product|WC_Subscription $object The object whose property we want to access. * @param string $property The property name. * @param string $single Whether to return just the first piece of meta data with the given property key, or all meta data. * @param mixed $default (optional) The value to return if no value is found - defaults to single -> null, multiple -> array(). * * @since 1.0.0 - Migrated from WooCommerce Subscriptions v2.2.0 * @deprecated 2.4.0 Use of this compatibility function is no longer required, getters should be used on the objects instead. Please note there may be differences in dates between this function and the getter. * @return mixed */ function wcs_get_objects_property($object, $property, $single = 'single', $default = \null) { } /** * Set an object's property in a way that is compatible with CRUD and non-CRUD APIs for different versions of WooCommerce. * * @param WC_Order|WC_Product|WC_Subscription $object The object whose property we want to access. * @param string $key The meta key name without '_' prefix * @param mixed $value The data to set as the value of the meta * @param string $save Whether to write the data to the database or not. Use 'save' to write to the database, anything else to only update it in memory. * @param int $meta_id The meta ID of existing meta data if you wish to overwrite an existing piece of meta. * @param string $prefix_meta_key Whether the key should be prefixed with an '_' when stored in meta. Defaulted to 'prefix_meta_key', pass any other value to bypass automatic prefixing (optional) * @deprecated 2.4.0 Use of this compatibility function is no longer required, setters should be used on the objects instead. * @since 1.0.0 - Migrated from WooCommerce Subscriptions v2.2.0 * @return mixed */ function wcs_set_objects_property(&$object, $key, $value, $save = 'save', $meta_id = '', $prefix_meta_key = 'prefix_meta_key') { } /** * Delete an object's property in a way that is compatible with CRUD and non-CRUD APIs for different versions of WooCommerce. * * @param WC_Order|WC_Product|WC_Subscription $object The object whose property we want to access. * @param string $key The meta key name without '_' prefix * @param mixed $value The data to set as the value of the meta * @param string $save Whether to save the data or not, 'save' to save the data, otherwise it won't be saved. * @since 1.0.0 - Migrated from WooCommerce Subscriptions v2.2.0 * @deprecated 2.4.0 Use of this compatibility function is no longer required, setters should be used on the objects instead. * @return mixed */ function wcs_delete_objects_property(&$object, $key, $save = 'save', $meta_id = '') { } /** * Check whether an order is a standard order (i.e. not a refund or subscription) in version compatible way. * * WC 3.0 has the $order->get_type() API which returns 'shop_order', while WC < 3.0 provided the $order->order_type * property which returned 'simple', so we need to check for both. * * @param WC_Order $order * @since 1.0.0 - Migrated from WooCommerce Subscriptions v2.2.0 * @return bool */ function wcs_is_order($order) { } /** * Find and return the value for a deprecated property property. * * Product properties should not be accessed directly with WooCommerce 3.0+, because of that, a lot of properties * have been deprecated/removed in the subscription product type classes. This function centralises the handling * of deriving deprecated properties. This saves duplicating the __get() method in WC_Product_Subscription, * WC_Product_Variable_Subscription and WC_Product_Subscription_Variation. * * @param string $property * @param WC_Product $product * @since 1.0.0 - Migrated from WooCommerce Subscriptions v2.2.0 * @return mixed */ function wcs_product_deprecated_property_handler($property, $product) { } /** * Access a coupon's property in a way that is compatible with CRUD and non-CRUD APIs for different versions of WooCommerce. * * Similar to @see wcs_get_objects_property * * @param WC_Coupon $coupon The coupon whose property we want to access. * @param string $property The property name. * @since 1.0.0 - Migrated from WooCommerce Subscriptions v2.2 * @return mixed */ function wcs_get_coupon_property($coupon, $property) { } /** * Set a coupon's property in a way that is compatible with CRUD and non-CRUD APIs for different versions of WooCommerce. * * Similar to @see wcs_set_objects_property * * @param WC_Coupon $coupon The coupon whose property we want to set. * @param string $property The property name. * @param mixed $value The data to set as the value * @since 1.0.0 - Migrated from WooCommerce Subscriptions v2.2 */ function wcs_set_coupon_property(&$coupon, $property, $value) { } /** * Generate an order/subscription key. * * This is a compatibility wrapper for @see wc_generate_order_key() which was introduced in WC 3.5.4. * * @return string $order_key. * @since 1.0.0 - Migrated from WooCommerce Subscriptions v2.5.0 */ function wcs_generate_order_key() { } /** * Update a single option for a WC_Settings_API object. * * This is a compatibility wrapper for @see WC_Settings_API::update_option() which was introduced in WC 3.4.0. * * @param WC_Settings_API $settings_api The object to update the option for. * @param string $key Option key. * @param mixed $value Value to set. * @since 1.0.0 - Migrated from WooCommerce Subscriptions v2.5.1 */ function wcs_update_settings_option($settings_api, $key, $value) { } /** * Determines if the request is a non-legacy REST API request. * * This function is a compatibility wrapper for WC()->is_rest_api_request() which was introduced in WC 3.6. * * @since 1.0.0 - Migrated from WooCommerce Subscriptions v2.5.7 * * @return bool True if it's a REST API request, false otherwise. */ function wcs_is_rest_api_request() { } /** * Determines if the current request is to any or a specific Checkout blocks REST API endpoint. * * @see Automattic\WooCommerce\Blocks\StoreApi\RoutesController::initialize() for a list of routes. * * @since 1.7.0 * @param string $endpoint The checkout/checkout blocks endpoint. Optional. Can be empty (any checkout blocks API) or a specific endpoint ('checkout', 'cart', 'products' etc) * @return bool Whether the current request is for a cart/checkout blocks REST API endpoint. */ function wcs_is_checkout_blocks_api_request($endpoint = '') { } /** * Determines whether the current request is a WordPress cron request. * * This function is a compatibility wrapper for wp_doing_cron() which was introduced in WP 4.8. * * @since 1.0.0 - Migrated from WooCommerce Subscriptions v2.5.7 * * @return bool True if it's a WordPress cron request, false otherwise. */ function wcs_doing_cron() { } /** * Determines whether the current request is a WordPress Ajax request. * * @since 1.0.0 - Migrated from WooCommerce Subscriptions v2.5.7 * * @return bool True if it's a WordPress Ajax request, false otherwise. */ function wcs_doing_ajax() { } /** * A wrapper function for getting an order's used coupon codes. * * WC 3.7 deprecated @see WC_Abstract_Order::get_used_coupons() in favour of WC_Abstract_Order::get_coupon_codes(). * * @since 1.0.0 - Migrated from WooCommerce Subscriptions v2.6.0 * * @param WC_Abstract_Order $order An order or subscription object to get the coupon codes for. * @return array The coupon codes applied to the $order. */ function wcs_get_used_coupon_codes($order) { } /** * Attach a function callback for a certain WooCommerce versions. * * Enables attaching a callback if WooCommerce is before, after, equal or not equal to a given version. * This function is a wrapper for @see WCS_Dependent_Hook_Manager::add_woocommerce_dependent_action(). * * @since 1.0.0 - Migrated from WooCommerce Subscriptions v2.6.0 * * @param string $tag The action or filter tag to attach the callback too. * @param string|array $function The callable function to attach to the hook. * @param string $woocommerce_version The WooCommerce version to do a compare on. For example '3.0.0'. * @param string $operator The version compare operator to use. @see https://www.php.net/manual/en/function.version-compare.php * @param integer $priority The priority to attach this callback to. * @param integer $number_of_args The number of arguments to pass to the callback function */ function wcs_add_woocommerce_dependent_action($tag, $function, $woocommerce_version, $operator, $priority = 10, $number_of_args = 1) { } /** * Checks if the installed version of WooCommerce is older than a specified version. * * @since 1.0.0 - Migrated from WooCommerce Subscriptions v4.0.0 * * @param string The version string to check in a version_compare() compatible format. * @return bool Whether the installed version of WC is prior to the given version string. */ function wcs_is_woocommerce_pre($version) { } /** * Checks if the WooCommerce feature is enabled using WC's new FeaturesUtil class. * * @param string $feature_name The name of the WC feature to check if enabled. * * @return bool */ function wcs_is_wc_feature_enabled($feature_name) { } /** * Determines whether custom order tables usage is enabled. * * Custom order table feature can be enabled but the store is still using WP posts as the authoriative source of order data, * therefore this function will only return true if: * - the HPOS feature is enabled * - the HPOS tables have been generated * - HPOS is the authoriative source of order data * * @return bool */ function wcs_is_custom_order_tables_usage_enabled() { } /** * Determines whether the order tables are synchronized with WP posts. * * @return bool True if the order tables are synchronized with WP posts, false otherwise. */ function wcs_is_custom_order_tables_data_sync_enabled() { } /** * Sets the address on an order or subscription using WC 7.1 functions if they exist. * * For stores pre WC 7.1, use the individual address type and key setter i.e. `set_billing_address_1()` method. * * @since 5.2.0 * * @param WC_Order|WC_Subscription $order The order or subscription object to set the address on. * @param string $address_type The address type to set. Either 'billing' or 'shipping'. * @param array $address The address to set. */ function wcs_set_order_address($order, $address, $address_type = 'billing') { } /** * Gets an object's admin page screen ID in a WC version compatible way. * * This function is a version compatible wrapper for wc_get_page_screen_id(). * * @param string $object_type The object type. eg 'shop_subscription', 'shop_order'. * @return string The page screen ID. On CPT stores, the screen ID is equal to the post type. On HPOS, the screen ID is generated by WC and fetched via wc_get_page_screen_id(). */ function wcs_get_page_screen_id($object_type) { } /** * Outputs a select input box. * * This function is a compatibility wrapper for woocommerce_wp_select() which introduced the second parameter necessary for working with HPOS in WC 6.9.0. * * @since 5.2.0 * * @param array $field_args Field data. * @param WC_Data $object The WC object to get the field value from. Only used in WC 6.9.0+. On older versions of WC, the value is fetched from the global $post object. */ function wcs_woocommerce_wp_select($field_args, $object) { } /** * Check if the $_SERVER global has order received URL slug in its 'REQUEST_URI' value * * Similar to WooCommerce's is_order_received_page(), but can be used before the $wp's query vars are setup, which is essential * in some cases, like WC_Subscriptions_Product::is_purchasable() and WC_Product_Subscription_Variation::is_purchasable(), both * called within WC_Cart::get_cart_from_session(), which is run before query vars are setup. * * @return 2.0.13 * @return bool **/ function wcs_is_order_received_page() { } /** * Wrapper for wc_doing_it_wrong. * * @since 1.0.0 - Migrated from WooCommerce Subscriptions v2.2.0 * @param string $function * @param string $version * @param string $replacement */ function wcs_doing_it_wrong($function, $message, $version) { } /** * Wrapper for wcs_deprecated_function to improve handling of ajax requests, even when * WooCommerce 3.0's wcs_deprecated_function method is not available. * * @since 1.0.0 - Migrated from WooCommerce Subscriptions v2.2.0 * @param string $function * @param string $version * @param string $replacement */ function wcs_deprecated_function($function, $version, $replacement = \null) { } /** * Reimplement similar logic to wc_deprecated_argument() without the first parameter confusion. * * @since 1.0.0 - Migrated from WooCommerce Subscriptions v2.2.0 * @param string $argument * @param string $version * @param string $message */ function wcs_deprecated_argument($function, $version, $message = \null) { } /** * Get the string key for a subscription used in Subscriptions prior to 2.0. * * Previously, a subscription key was made up of the ID of the order used to purchase the subscription, and * the product to which the subscription relates; however, in Subscriptions 2.0, subscriptions can actually * relate to multiple products (because they can contain multiple line items) and they also no longer need * to have an original order associated with them, to make manually adding subscriptions more accurate. * * Therefore, although the return value of this method is a string matching the key form used inSubscriptions * prior to 2.0, the actual value represented is not a perfect analogue. Specifically, * - if the subscription contains more than one product, only the ID of the first line item will be used in the ID * - if the subscription does not contain any products, the key still be missing that component of the * - if the subscription does not have an initial order, then the order ID used will be the WC_Subscription object's ID * * @param WC_Subscription $subscription An instance of WC_Subscription * @return string $subscription_key A subscription key in the deprecated form previously created by @see self::get_subscription_key() * @since 1.0.0 - Migrated from WooCommerce Subscriptions v2.0 */ function wcs_get_old_subscription_key(\WC_Subscription $subscription) { } /** * Return the post ID of a WC_Subscription object for the given subscription key (if one exists). * * @param string $subscription_key A subscription key in the deprecated form created by @see WC_Subscriptions_Manager::get_subscription_key() * @return int|null The post ID for the subscription if it can be found (i.e. an order exists) or null if no order exists for the subscription. * @since 1.0.0 - Migrated from WooCommerce Subscriptions v2.0 */ function wcs_get_subscription_id_from_key($subscription_key) { } /** * Return an instance of a WC_Subscription object for the given subscription key (if one exists). * * @param string $subscription_key A subscription key in the deprecated form created by @see self::get_subscription_key() * @return WC_Subscription|null The subscription object if it can be found (i.e. an order exists) or null if no order exists for the subscription (i.e. it was manually created). * @since 1.0.0 - Migrated from WooCommerce Subscriptions v2.0 */ function wcs_get_subscription_from_key($subscription_key) { } /** * Return an associative array of a given subscriptions details (if it exists) in the pre v2.0 data structure. * * @param WC_Subscription $subscription An instance of WC_Subscription * @return array Subscription details * @since 1.0.0 - Migrated from WooCommerce Subscriptions v2.0 */ function wcs_get_subscription_in_deprecated_structure(\WC_Subscription $subscription) { } /** * Wrapper for wc_deprecated_hook to improve handling of ajax requests, even when * WooCommerce 3.3.0's wc_deprecated_hook method is not available. * * @since 1.0.0 - Migrated from WooCommerce Subscriptions v2.6.0 * @param string $hook The hook that was used. * @param string $version The version that deprecated the hook. * @param string $replacement The hook that should have been used. * @param string $message A message regarding the change. */ function wcs_deprecated_hook($hook, $version, $replacement = \null, $message = \null) { } /** * Creates a subscription price string from an array of subscription details. For example, "$5 / month for 12 months". * * @param array $subscription_details A set of name => value pairs for the subscription details to include in the string. Available keys: * 'initial_amount': The upfront payment for the subscription, including sign up fees, as a string from the @see wc_price(). Default empty string (no initial payment) * 'initial_description': The word after the initial payment amount to describe the amount. Examples include "now" or "initial payment". Defaults to "up front". * 'recurring_amount': The amount charged per period. Default 0 (no recurring payment). * 'subscription_interval': How regularly the subscription payments are charged. Default 1, meaning each period e.g. per month. * 'subscription_period': The temporal period of the subscription. Should be one of {day|week|month|year} as used by @see wcs_get_subscription_period_strings() * 'subscription_length': The total number of periods the subscription should continue for. Default 0, meaning continue indefinitely. * 'trial_length': The total number of periods the subscription trial period should continue for. Default 0, meaning no trial period. * 'trial_period': The temporal period for the subscription's trial period. Should be one of {day|week|month|year} as used by @see wcs_get_subscription_period_strings() * 'use_per_slash': Allow calling code to determine if they want the shorter price string using a slash for singular billing intervals, e.g. $5 / month, or the longer form, e.g. $5 every month, which is normally reserved for intervals > 1 * @since 1.0.0 - Migrated from WooCommerce Subscriptions v2.0 * @return string The price string with translated and billing periods included */ function wcs_price_string($subscription_details) { } /** * Display a human friendly time diff for a given timestamp, e.g. "in 12 hours" or "12 hours ago". * * @param int $timestamp_gmt * @return string A human friendly string to display for the timestamp's date * @since 1.0.0 - Migrated from WooCommerce Subscriptions v2.1 */ function wcs_get_human_time_diff($timestamp_gmt) { } /** * Works around the wp_kses() limitation of not accepting attribute names with underscores. * * @param string $content Content to filter through kses. * @param array $allowed_html List of allowed HTML elements. * @return string Filtered string of HTML. * @since 1.0.0 - Migrated from WooCommerce Subscriptions v2.2.17 */ function wp_kses_allow_underscores($content, $allowed_html) { } /** * Appends the ordinal suffix to a given number. * * eg. Given 2, the function returns 2nd. * * @since 1.0.0 - Migrated from WooCommerce Subscriptions v4.0.0 * * @param string The number to append the ordinal suffix to. * @return string */ function wcs_append_numeral_suffix($number) { } /** * Display date/time input fields * * @param int (optional) A timestamp for a certain date in the site's timezome. If left empty, or 0, it will be set to today's date. * @param array $args A set of name => value pairs to customise the input fields * 'id_attr': (string) the date to display in the selector in MySQL format ('Y-m-d H:i:s'). Required. * 'date': (string) the date to display in the selector in MySQL format ('Y-m-d H:i:s'). Required. * 'tab_index': (int) the tab index for the element. Optional. Default 0. * 'include_time': (bool) whether to include a specific time for the selector. Default true. * 'include_year': (bool) whether to include a the year field. Default true. * 'include_buttons': (bool) whether to include submit buttons on the selector. Default true. * @since 1.0.0 - Migrated from WooCommerce Subscriptions v2.0 */ function wcs_date_input($timestamp = 0, $args = array()) { } /** * Get the edit post link without checking if the user can edit that post or not. * * @param int $post_id * @since 1.0.0 - Migrated from WooCommerce Subscriptions v2.0 */ function wcs_get_edit_post_link($post_id) { } /** * Returns a string with all non-ASCII characters removed. This is useful for any string functions that expect only * ASCII chars and can't safely handle UTF-8 * * Based on the SV_WC_Helper::str_to_ascii() method developed by the masterful SkyVerge team * * Note: We must do a strict false check on the iconv() output due to a bug in PHP/glibc {@link https://bugs.php.net/bug.php?id=63450} * * @param string $string string to make ASCII * @return string|null ASCII string or null if error occurred * @since 1.0.0 - Migrated from WooCommerce Subscriptions v2.0 */ function wcs_str_to_ascii($string) { } /** * wp_json_encode exists since WP 4.1, but because we can't be sure that stores will actually use at least 4.1, we need * to have this wrapper. * * @param array $data Data to be encoded * * @return string */ function wcs_json_encode($data) { } /** * Inserts a new key/value after the key in the array. * * @param $needle The array key to insert the element after * @param $haystack An array to insert the element into * @param $new_key The key to insert * @param $new_value An value to insert * @return The new array if the $needle key exists, otherwise an unmodified $haystack */ function wcs_array_insert_after($needle, $haystack, $new_key, $new_value) { } /** * Helper function to get around WooCommerce version 2.6.3 which removed the constant WC_ROUNDING_PRECISION and * introduced the function wc_get_rounding_precision. Every version 2.6.2 and earlier has the constant. Every version * 2.6.4 and later (hopefully) will also have the constant AND the wc_get_rounding_precision function. 2.6.3 only has * the function however. * * @see https://github.com/Prospress/woocommerce-subscriptions/issues/1545 * * @return int rounding precision */ function wcs_get_rounding_precision() { } /** * Add a prefix to a string if it doesn't already have it * * @param string * @param string * @since 1.0.0 - Migrated from WooCommerce Subscriptions v2.2.0 * @return string */ function wcs_maybe_prefix_key($key, $prefix = '_') { } /** * Remove a prefix from a string if has it * * @param string $key * @param string $prefix * @since 1.0.0 - Migrated from WooCommerce Subscriptions v2.2.0 * @return string */ function wcs_maybe_unprefix_key($key, $prefix = '_') { } /** * Find the name of the function which called the function which called this function. * * @since 1.0.0 - Migrated from WooCommerce Subscriptions v2.2.0 * @return string */ function wcs_get_calling_function_name() { } /** * Get the value of a transient, even if it has expired. * * Handy when data cached in a transient will be valid even if the transient has expired. * * @param string $transient_key The key used to set/get the transient via get_transient()/set_transient() * @return mixed If data exists in a transient, the value of the transient, else boolean false. */ function wcs_get_transient_even_if_expired($transient_key) { } /** * Get a minor version string from a full version string. * * @param string $version Version string (eg 1.0.1). * @return string The minor release version string (eg 1.0). * @since 1.0.0 - Migrated from WooCommerce Subscriptions v2.3.0 */ function wcs_get_minor_version_string($version) { } /** * Determines if the current request is for the frontend. * * The logic in this function is based off WooCommerce::is_request( 'frontend' ). * * @since 1.0.0 - Migrated from WooCommerce Subscriptions v2.5.7 * * @return bool True if it's a frontend request, false otherwise. */ function wcs_is_frontend_request() { } /** * Sorts an array of objects by a given property in a given order. * * @since 1.0.0 - Migrated from WooCommerce Subscriptions v2.6.0 * * @param array $objects An array of objects to sort. * @param string $property The property to sort by. * @param string $sort_order Optional. The order to sort by. Must be 'ascending' or 'descending'. Default is 'ascending'. * * @throws InvalidArgumentException Thrown if an invalid sort order is given. * @return array The array of objects sorted. */ function wcs_sort_objects(&$objects, $property, $sort_order = 'ascending') { } /** * Has the trial for the Subscription passed? If the Subscription is invalid, will return a WP_Error * * @param int|WC_Subscription $subscription * * @return bool|WP_Error * @since 1.0.0 - Migrated from WooCommerce Subscriptions v3.0.6 */ function wcs_trial_has_passed($subscription) { } /** * Filters an array using a WP filter. * * This function behaves similar to PHP's array_filter(), except instead of a callback it uses a filter. * This allows third-parties via WP filter callbacks to filter the array. * * @since 1.0.0 - Migrated from WooCommerce Subscriptions v3.1.0 * * @param string $filter The WP filter to apply to each element. * @param array $array The array of items to check. * @param array $property The name of object's property to check. Optional. Default is '' - the array element value as a boolean will be used, the same as array_filter(). */ function wcs_apply_array_filter($filter, $array, $property = '') { } /** * Compares an order's billing address and shipping address and returns true if they are the same. * * @since 5.3.0 * * @see woocommerce_ship_to_different_address_checked * * @param WC_Order $order * @return bool True if the order's billing address and shipping address are the same, false otherwise. */ function wcs_compare_order_billing_shipping_address($order) { } /** * Get the subscription's limit type. * * @param int|WC_Product $product A WC_Product object or the ID of a product * @return string containing the limit type */ function wcs_get_product_limitation($product) { } /** * Returns true if product is limited to one active subscription and user currently has this product on-hold. * * @param int|WC_Product $product A WC_Product object or the ID of a product * @return boolean */ function wcs_is_product_limited_for_user($product, $user_id = 0) { } /** * Get the subscription related to an order, if any. * * @param WC_Order|int $order An instance of a WC_Order object or the ID of an order * @param array $args A set of name value pairs to filter the returned value. * 'subscriptions_per_page' The number of subscriptions to return. Default set to -1 to return all. * 'offset' An optional number of subscription to displace or pass over. Default 0. * 'orderby' The field which the subscriptions should be ordered by. Can be 'start_date', 'trial_end_date', 'end_date', 'status' or 'order_id'. Defaults to 'start_date'. * 'order' The order of the values returned. Can be 'ASC' or 'DESC'. Defaults to 'DESC' * 'customer_id' The user ID of a customer on the site. * 'product_id' The post ID of a WC_Product_Subscription, WC_Product_Variable_Subscription or WC_Product_Subscription_Variation object * 'order_id' The post ID of a shop_order post/WC_Order object which was used to create the subscription * 'subscription_status' Any valid subscription status. Can be 'any', 'active', 'cancelled', 'on-hold', 'expired', 'pending' or 'trash'. Defaults to 'any'. * 'order_type' Get subscriptions for the any order type in this array. Can include 'any', 'parent', 'renewal' or 'switch', defaults to parent. * @return WC_Subscription[] Subscription details in post_id => WC_Subscription form. * @since 1.0.0 - Migrated from WooCommerce Subscriptions v2.0 */ function wcs_get_subscriptions_for_order($order, $args = array()) { } /** * Copy the billing, shipping or all addresses from one order or subscription to another. * * @since 2.0.0 * * @param WC_Order $to_order The WC_Order object to copy the address to. * @param WC_Order $from_order The WC_Order object to copy the address from. * @param string $address_type The address type to copy, can be 'shipping', 'billing' or 'all'. Optional. Default is "all". * * @return WC_Order The WC_Order object with the new address set. */ function wcs_copy_order_address($from_order, $to_order, $address_type = 'all') { } /** * Copies order meta between two order objects (orders or subscriptions). * * Intended to copy meta between first order and subscription object, then between subscription and renewal orders. * * @param WC_Order $from_order Order|Subscription to copy meta from. * @param WC_Order $to_order Order|Subscription to copy meta to. * @param string $type The type of copy. Can be 'subscription' or 'renewal'. Optional. Default is 'subscription'. */ function wcs_copy_order_meta($from_order, $to_order, $type = 'subscription') { } /** * Function to create an order from a subscription. It can be used for a renewal or for a resubscribe * order creation. It is the common in both of those instances. * * @param WC_Subscription|int $subscription Subscription we're basing the order off of * @param string $type Type of new order. Default values are 'renewal_order'|'resubscribe_order' * @return WC_Order|WP_Error New order or error object. */ function wcs_create_order_from_subscription($subscription, $type) { } /** * Function to create a post title based on the type and the current date and time for new orders. By * default it's either renewal or resubscribe orders. * * @param string $type type of new order. By default 'renewal_order'|'resubscribe_order' * @return string new title for a post */ function wcs_get_new_order_title($type) { } /** * Utility function to check type. Filterable. Rejects if not in allowed new order types, rejects * if not actually string. * * @param string $type type of new order * @return string|WP_Error the same type thing if no problems are found, or WP_Error. */ function wcs_validate_new_order_type($type) { } /** * Wrapper function to get the address from an order / subscription in array format * @param WC_Order $order The order / subscription we want to get the order from * @param string $address_type shipping|billing. Default is shipping * @return array */ function wcs_get_order_address($order, $address_type = 'shipping') { } /** * Checks an order to see if it contains a subscription. * * @param mixed $order A WC_Order object or the ID of the order which the subscription was purchased in. * @param array|string $order_type Can include 'parent', 'renewal', 'resubscribe' and/or 'switch'. Defaults to 'parent', 'resubscribe' and 'switch' orders. * @return bool True if the order contains a subscription that belongs to any of the given order types, otherwise false. * @since 1.0.0 - Migrated from WooCommerce Subscriptions v2.0 */ function wcs_order_contains_subscription($order, $order_type = array('parent', 'resubscribe', 'switch')) { } /** * Fetches Orders and Subscriptions using wc_get_orders() with a built-in handler for the meta_query arg. * * This function is a replacement for the get_posts() function to help aid with transitioning over to using wc_get_orders. * Args and usage: https://github.com/woocommerce/woocommerce/wiki/wc_get_orders-and-WC_Order_Query * * @since 5.0.0 * * @param array $args Accepts the same arguments as wc_get_orders(). * @return array An array of WC_Order or WC_Subscription objects or IDs based on the args. */ function wcs_get_orders_with_meta_query($args) { } /** * Get all the orders that relate to a subscription in some form (rather than only the orders associated with * a specific subscription). * * @param string $return_fields The columns to return, either 'all' or 'ids' * @param array|string $order_type Can include 'any', 'parent', 'renewal', 'resubscribe' and/or 'switch'. Defaults to 'parent'. * @return array The orders that relate to a subscription, if any. Will contain either as just IDs or WC_Order objects depending on $return_fields value. * @since 1.0.0 - Migrated from WooCommerce Subscriptions v2.1 */ function wcs_get_subscription_orders($return_fields = 'ids', $order_type = 'parent') { } /** * A wrapper for getting a specific item from an order or subscription. * * WooCommerce has a wc_add_order_item() function, wc_update_order_item() function and wc_delete_order_item() function, * but no `wc_get_order_item()` function, so we need to add our own (for now). * * @param int $item_id The ID of an order item * @param WC_Order|WC_Subscription $order The order or order object the item belongs to. * * @return WC_Order_Item|array The order item object or an empty array if the item doesn't exist. * * @since 1.0.0 - Migrated from WooCommerce Subscriptions v2.0 */ function wcs_get_order_item($item_id, $order) { } /** * A wrapper for wc_update_order_item() which consistently deletes the cached item after update, unlike WC. * * @param int $item_id The ID of an order item * @param string $new_type The new type to set as the 'order_item_type' value on the order item. * @param int $order_or_subscription_id The order or subscription ID the line item belongs to - optional. Deletes the order item cache if provided. * @since 1.0.0 - Migrated from WooCommerce Subscriptions v2.2.12 */ function wcs_update_order_item_type($item_id, $new_type, $order_or_subscription_id = 0) { } /** * Get an instance of WC_Order_Item_Meta for an order item * * @param array * @return WC_Order_Item_Meta * @since 1.0.0 - Migrated from WooCommerce Subscriptions v2.0 */ function wcs_get_order_item_meta($item, $product = \null) { } /** * Create a string representing an order item's name and optionally include attributes. * * @param array $order_item An order item. * @since 1.0.0 - Migrated from WooCommerce Subscriptions v2.0 */ function wcs_get_order_item_name($order_item, $include = array()) { } /** * Get the full name for a order/subscription line item, including the items non hidden meta * (i.e. attributes), as a flat string. * * @param array * @return string */ function wcs_get_line_item_name($line_item) { } /** * Display item meta data in a version compatible way. * * @since 1.0.0 - Migrated from WooCommerce Subscriptions v2.2.0 * @param WC_Item $item * @param WC_Order $order * @return void */ function wcs_display_item_meta($item, $order) { } /** * Display item download links in a version compatible way. * * @since 1.0.0 - Migrated from WooCommerce Subscriptions v2.2.0 * @param WC_Item $item * @param WC_Order $order * @return void */ function wcs_display_item_downloads($item, $order) { } /** * Copy the order item data and meta data from one item to another. * * @since 1.0.0 - Migrated from WooCommerce Subscriptions v2.2.0 * @param WC_Order_Item $from_item The order item to copy data from * @param WC_Order_Item $to_item The order item to copy data to */ function wcs_copy_order_item($from_item, &$to_item) { } /** * Checks an order to see if it contains a manual subscription. * * @since 1.0.0 - Migrated from WooCommerce Subscriptions v2.4.3 * @param WC_Order|int $order The WC_Order object or ID to get related subscriptions from. * @param string|array $order_type The order relationship type(s). Can be single string or an array of order types. Optional. Default is 'any'. * @return bool */ function wcs_order_contains_manual_subscription($order, $order_type = 'any') { } /** * Copy payment method from a subscription to an order. * * @since 1.0.0 - Migrated from WooCommerce Subscriptions v2.4.3 * @param WC_Subscription $subscription * @param WC_Order $order */ function wcs_copy_payment_method_to_order($subscription, $order) { } /** * Returns how many minutes ago the order was created. * * @param WC_Order $order * * @return int * @since 1.0.0 - Migrated from WooCommerce Subscriptions v2.5.3 */ function wcs_minutes_since_order_created($order) { } /** * Returns how many seconds ago the order was created. * * @param WC_Order $order * * @return int * @since 1.0.0 - Migrated from WooCommerce Subscriptions v2.5.3 */ function wcs_seconds_since_order_created($order) { } /** * Finds a corresponding subscription line item on an order. * * @since 1.0.0 - Migrated from WooCommerce Subscriptions v2.6.0 * * @param WC_Abstract_Order $order The order object to look for the item in. * @param WC_Order_Item $subscription_item The line item on the the subscription to find on the order. * @param string $match_type Optional. The type of comparison to make. Can be 'match_product_ids' to compare product|variation IDs or 'match_attributes' to also compare by item attributes on top of matching product IDs. Default 'match_product_ids'. * * @return WC_Order_Item|bool The order item which matches the subscription item or false if one cannot be found. */ function wcs_find_matching_line_item($order, $subscription_item, $match_type = 'match_product_ids') { } /** * Checks if an order contains a product. * * @since 1.0.0 - Migrated from WooCommerce Subscriptions v2.6.0 * * @param WC_Order $order An order object * @param WC_Product $product A product object * * @return bool $order_has_product Whether the order contains a line item matching that product */ function wcs_order_contains_product($order, $product) { } /** * Check if a given order is a subscription renewal order. * * @param WC_Order|int $order The WC_Order object or ID of a WC_Order order. * @since 1.0.0 - Migrated from WooCommerce Subscriptions v2.3.0 * @return bool True if the order contains an early renewal, otherwise false. */ function wcs_order_contains_early_renewal($order) { } /** * Generates a key for grouping subscription products with the same billing schedule. * * Used by the orders//subscriptions REST API endpoint to group order items into subscriptions. * * @see https://woocommerce.com/document/subscriptions/develop/multiple-subscriptions/#section-3 * * @param WC_Order_Item_Product $item The order item to generate the key for. * @param int $renewal_time The timestamp of the first renewal payment. * * @return string The item's subscription grouping key. */ function wcs_get_subscription_item_grouping_key($item, $renewal_time = '') { } /** * WooCommerce Subscriptions Product Functions * * Functions for managing renewal of a subscription. * * @author Prospress * @category Core * @package WooCommerce Subscriptions/Functions * @version 1.0.0 - Migrated from WooCommerce Subscriptions v2.2.0 */ /** * For a given product, and optionally price/qty, work out the sign-up with tax included, based on store settings. * * @since 1.0.0 - Migrated from WooCommerce Subscriptions v2.2.0 * @param WC_Product $product * @param array $args * @return float */ function wcs_get_price_including_tax($product, $args = array()) { } /** * For a given product, and optionally price/qty, work out the sign-up fee with tax excluded, based on store settings. * * @since 1.0.0 - Migrated from WooCommerce Subscriptions v2.2.0 * @param WC_Product $product * @param array $args * @return float */ function wcs_get_price_excluding_tax($product, $args = array()) { } /** * Returns a 'from' prefix if you want to show where prices start at. * * @since 1.0.0 - Migrated from WooCommerce Subscriptions v2.2.0 * @return string */ function wcs_get_price_html_from_text($product = '') { } /** * Get an array of the prices, used to help determine min/max values. * * @since 1.0.0 - Migrated from WooCommerce Subscriptions v2.2.0 */ function wcs_get_variation_prices($variation, $variable_product) { } /** * Get an array of the minimum and maximum priced variations based on subscription billing terms. * * @param array $child_variation_ids the IDs of product variation children ids * @return array Array containing the min and max variation prices and billing data * @since 1.0.0 - Migrated from WooCommerce Subscriptions v2.2.0 */ function wcs_get_min_max_variation_data($variable_product, $child_variation_ids = array()) { } /** * Determine the minimum and maximum values for a set of structured subscription * price data in a form created by @see wcs_get_min_max_variation_data() * * @param array $child_variation_ids the IDs of product variation children ids * @return array * @since 1.0.0 - Migrated from WooCommerce Subscriptions v2.2.0 */ function wcs_calculate_min_max_variations($variations_data) { } /** * Generates a key for grouping subscription products with the same billing schedule. * * Used in a frontend cart and checkout context to group items by a recurring cart key for use in generating recurring carts. * Used by the orders//subscriptions REST API endpoint to group order items into subscriptions. * * @see https://woocommerce.com/document/subscriptions/develop/multiple-subscriptions/#section-3 * * @param WC_Product $product The product to generate the key for. * @param int $renewal_time The timestamp of the first renewal payment. * * @return string The subscription product grouping key. */ function wcs_get_subscription_grouping_key($product, $renewal_time = 0) { } /** * Create a renewal order to record a scheduled subscription payment. * * This method simply creates an order with the same post meta, order items and order item meta as the subscription * passed to it. * * @param int | WC_Subscription $subscription Post ID of a 'shop_subscription' post, or instance of a WC_Subscription object * @return WC_Order | WP_Error * @since 1.0.0 - Migrated from WooCommerce Subscriptions v2.0 */ function wcs_create_renewal_order($subscription) { } /** * Check if a given order is a subscription renewal order. * * @param WC_Order|int $order The WC_Order object or ID of a WC_Order order. * @since 1.0.0 - Migrated from WooCommerce Subscriptions v2.0 */ function wcs_order_contains_renewal($order) { } /** * Checks the cart to see if it contains a subscription product renewal. * * @param bool | Array The cart item containing the renewal, else false. * @return string * @since 1.0.0 - Migrated from WooCommerce Subscriptions v2.0 */ function wcs_cart_contains_renewal() { } /** * Checks the cart to see if it contains a subscription product renewal for a failed renewal payment. * * @return bool|array The cart item containing the renewal, else false. * @since 1.0.0 - Migrated from WooCommerce Subscriptions v2.0 */ function wcs_cart_contains_failed_renewal_order_payment() { } /** * Get the subscription/s to which a resubscribe order relates. * * @param WC_Order|int $order The WC_Order object or ID of a WC_Order order. * @since 1.0.0 - Migrated from WooCommerce Subscriptions v2.0 */ function wcs_get_subscriptions_for_renewal_order($order) { } /** * Get the last renewal order which isn't an early renewal order. * * @since 1.0.0 - Migrated from WooCommerce Subscriptions v2.6.0 * * @param WC_Subscription $subscription The subscription object. * @return WC_Order|bool The last non-early renewal order, otherwise false. */ function wcs_get_last_non_early_renewal_order($subscription) { } /** * Checks if manual renewals are required - automatic renewals are disabled. * * @since 1.0.0 - Migrated from WooCommerce Subscriptions v4.0.0 * @return bool Weather manual renewal are required. */ function wcs_is_manual_renewal_required() { } /** * Checks if manual renewals are enabled. * * @since 1.0.0 - Migrated from WooCommerce Subscriptions v4.0.0 * @return bool Weather manual renewal are enabled. */ function wcs_is_manual_renewal_enabled() { } /** * Check if a given order was created to resubscribe to a cancelled or expired subscription. * * @param WC_Order|int $order The WC_Order object or ID of a WC_Order order. * @since 1.0.0 - Migrated from WooCommerce Subscriptions v2.0 */ function wcs_order_contains_resubscribe($order) { } /** * Create a resubscribe order to record a customer resubscribing to an expired or cancelled subscription. * * This method is a wrapper for @see wcs_create_order() which creates an order with the same post meta, order * items and order item meta as the subscription passed to it. No trial periods or sign up fees are applied * to resubscribe orders. * * @param int | WC_Subscription $subscription Post ID of a 'shop_subscription' post, or instance of a WC_Subscription object * @return WC_Subscription * @since 1.0.0 - Migrated from WooCommerce Subscriptions v2.0 */ function wcs_create_resubscribe_order($subscription) { } /** * Returns a URL including required parameters for an authenticated user to renew a subscription * * @param int | WC_Subscription $subscription Post ID of a 'shop_subscription' post, or instance of a WC_Subscription object * @return string * @since 1.0.0 - Migrated from WooCommerce Subscriptions v2.0 */ function wcs_get_users_resubscribe_link($subscription) { } /** * Returns a URL including required parameters for an authenticated user to renew a subscription by product ID. * * @param int $product_id The ID of a product post type. * @since 1.0.0 - Migrated from WooCommerce Subscriptions v1.2 */ function wcs_get_users_resubscribe_link_for_product($product_id) { } /** * Checks the cart to see if it contains a subscription product renewal. * * @param bool | Array The cart item containing the renewal, else false. * @return string * @since 1.0.0 - Migrated from WooCommerce Subscriptions v2.0 */ function wcs_cart_contains_resubscribe($cart = '') { } /** * Get the subscription to which a renewal order relates. * * @param WC_Order|int $order The WC_Order object or ID of a WC_Order order. * @since 1.0.0 - Migrated from WooCommerce Subscriptions v2.0 */ function wcs_get_subscriptions_for_resubscribe_order($order) { } /** * Check if a user can resubscribe to an expired or cancelled subscription by creating a * new subscription with the same terms. * * For it to be possible to resubscribe to a subscription, the user specified with $user_id must * and the subscription must: * 1. be be inactive (expired or cancelled) * 2. had at least one payment, to avoid circumventing sign-up fees * 3. its parent order must not have already been superseded by a new order (to prevent * displaying "Resubscribe" links on subscriptions that have already been renewed) * 4. the products to which the subscription relates must not have been deleted * 5. have a recurring amount greater than $0, to avoid allowing resubscribes to subscriptions * where the entire cost is charged in a sign-up fee * * @param int | WC_Subscription $subscription Post ID of a 'shop_subscription' post, or instance of a WC_Subscription object * @param int The ID of a user * @return bool * @since 1.0.0 - Migrated from WooCommerce Subscriptions v2.0 */ function wcs_can_user_resubscribe_to($subscription, $user_id = '') { } /** * Check if a given order was to switch a subscription * * @param WC_Order|int $order The WC_Order object or ID of a WC_Order order. * @since 1.0.0 - Migrated from WooCommerce Subscriptions v2.0 */ function wcs_order_contains_switch($order) { } /** * Get the subscriptions that had an item switch for a given order (if any). * * @param int|WC_Order $order_id The post_id of a shop_order post or an instance of a WC_Order object * @return array Subscription details in post_id => WC_Subscription form. * @since 1.0.0 - Migrated from WooCommerce Subscriptions v2.0 */ function wcs_get_subscriptions_for_switch_order($order) { } /** * Get all the orders which have recorded a switch for a given subscription. * * @param int|WC_Subscription $subscription_id The post_id of a shop_subscription post or an instance of a WC_Subscription object * @return array Order details in post_id => WC_Order form. * @since 1.0.0 - Migrated from WooCommerce Subscriptions v2.0 */ function wcs_get_switch_orders_for_subscription($subscription_id) { } /** * Checks if a given product is of a switchable type * * @param int|WC_Product $product A WC_Product object or the ID of a product to check * @return bool * @since 1.0.0 - Migrated from WooCommerce Subscriptions v2.0 */ function wcs_is_product_switchable_type($product) { } /** * Check if the cart includes any items which are to switch an existing subscription's contents. * * @since 1.0.0 - Migrated from WooCommerce Subscriptions v4.0.0 * @param string $item_action Types of items to include ("any", "switch", or "add"). * @return bool|array Returns cart items that modify subscription contents, or false if no such items exist. */ function wcs_cart_contains_switches($item_action = 'any') { } /** * Gets the switch direction of a cart item. * * @since 1.0.0 - Migrated from WooCommerce Subscriptions v4.0.0 * @param array $cart_item Cart item object. * @return string|null Cart item subscription switch direction or null. */ function wcs_get_cart_item_switch_type($cart_item) { } /** * Return an i18n'ified associative array of all possible subscription periods. * * @param int (optional) An interval in the range 1-6 * @param string (optional) One of day, week, month or year. If empty, all subscription ranges are returned. * @since 1.0.0 - Migrated from WooCommerce Subscriptions v2.0 */ function wcs_get_subscription_period_strings($number = 1, $period = '') { } /** * Return an i18n'ified associative array of all possible subscription trial periods. * * @param int (optional) An interval in the range 1-6 * @param string (optional) One of day, week, month or year. If empty, all subscription ranges are returned. * @since 1.0.0 - Migrated from WooCommerce Subscriptions v2.0 */ function wcs_get_subscription_trial_period_strings($number = 1, $period = '') { } /** * Returns an array of subscription lengths. * * PayPal Standard Allowable Ranges * D – for days; allowable range is 1 to 90 * W – for weeks; allowable range is 1 to 52 * M – for months; allowable range is 1 to 24 * Y – for years; allowable range is 1 to 5 * * @since 1.0.0 - Migrated from WooCommerce Subscriptions v2.1.2 */ function wcs_get_non_cached_subscription_ranges() { } /** * Retaining the API, it makes use of the transient functionality. * * @param string $period * @return bool|mixed */ function wcs_get_subscription_ranges($subscription_period = '') { } /** * Return an i18n'ified associative array of all possible subscription periods. * * @param int (optional) An interval in the range 1-6 * @since 1.0.0 - Migrated from WooCommerce Subscriptions v2.0 */ function wcs_get_subscription_period_interval_strings($interval = '') { } /** * Return an i18n'ified associative array of all time periods allowed for subscriptions. * * @param string (Optional) Either 'singular' for singular trial periods or 'plural'. * @since 1.0.0 - Migrated from WooCommerce Subscriptions v2.0 */ function wcs_get_available_time_periods($form = 'singular') { } /** * Returns an array of allowed trial period lengths. * * @param string (optional) One of day, week, month or year. If empty, all subscription trial period lengths are returned. * @since 1.0.0 - Migrated from WooCommerce Subscriptions v2.0 */ function wcs_get_subscription_trial_lengths($subscription_period = '') { } /** * Convenience wrapper for adding "{n} {periods}" to a timestamp (e.g. 2 months or 5 days). * * @param int $number_of_periods The number of periods to add to the timestamp * @param string $period One of day, week, month or year. * @param int $from_timestamp A Unix timestamp to add the time too. * @param string $timezone_behaviour Optional. If the $from_timestamp parameter should be offset to the site time or not, either 'offset_site_time' or 'no_offset'. Default 'no_offset'. * @since 1.0.0 - Migrated from WooCommerce Subscriptions v2.0 */ function wcs_add_time($number_of_periods, $period, $from_timestamp, $timezone_behaviour = 'no_offset') { } /** * Workaround the last day of month quirk in PHP's strtotime function. * * Adding +1 month to the last day of the month can yield unexpected results with strtotime(). * For example: * - 30 Jan 2013 + 1 month = 3rd March 2013 * - 28 Feb 2013 + 1 month = 28th March 2013 * * What humans usually want is for the date to continue on the last day of the month. * * @param int $from_timestamp A Unix timestamp to add the months too. * @param int $months_to_add The number of months to add to the timestamp. * @param string $timezone_behaviour Optional. If the $from_timestamp parameter should be offset to the site time or not, either 'offset_site_time' or 'no_offset'. Default 'no_offset'. * @since 1.0.0 - Migrated from WooCommerce Subscriptions v2.0 */ function wcs_add_months($from_timestamp, $months_to_add, $timezone_behaviour = 'no_offset') { } /** * Estimate how many days, weeks, months or years there are between now and a given * date in the future. Estimates the minimum total of periods. * * @param int $start_timestamp A Unix timestamp * @param int $end_timestamp A Unix timestamp at some time in the future * @param string $unit_of_time A unit of time, either day, week month or year. * @param string $rounding_method A rounding method, either ceil (default) or floor for anything else * @since 1.0.0 - Migrated from WooCommerce Subscriptions v2.0 */ function wcs_estimate_periods_between($start_timestamp, $end_timestamp, $unit_of_time = 'month', $rounding_method = 'ceil') { } /** * Utility function to find out how many leap days are there between two given dates. The reason we need this is because * the constant YEAR_IN_SECONDS assumes a 365 year, which means some of the calculations are going to be off by a day. * This has caused problems where if there's a leap year, wcs_estimate_periods_between would return 2 years instead of * 1, making certain payments wildly inaccurate. * * @param int $start_timestamp A unix timestamp * @param int $end_timestamp A unix timestamp * * @return int number of leap days between the start and end timstamps */ function wcs_number_of_leap_days($start_timestamp, $end_timestamp) { } /** * Filter function used in wcs_number_of_leap_days * * @param $year int A four digit year, eg 2017 * * @return bool|string */ function wcs_is_leap_year($year) { } /** * Method to try to determine the period of subscriptions if data is missing. It tries the following, in order: * * - defaults to month * - comes up with an array of possible values given the standard time spans (day / week / month / year) * - ranks them * - discards 0 interval values * - discards high deviation values * - tries to match with passed in interval * - if all else fails, sorts by interval and returns the one having the lowest interval, or the first, if equal (that should * not happen though) * * @param string $last_date mysql date string * @param string $second_date mysql date string * @param integer $interval potential interval * @return string period string */ function wcs_estimate_period_between($last_date, $second_date, $interval = 1) { } /** * Finds full months between two dates and the remaining seconds after the end of the last full month. Takes into account * leap years and variable number of days in months. Uses wcs_add_months * * @param numeric $start_timestamp unix timestamp of a start date * @param numeric $end_timestamp unix timestamp of an end date * @return array with keys 'months' (integer) and 'remainder' (seconds, integer) */ function wcs_find_full_months_between($start_timestamp, $end_timestamp, $interval = 1) { } /** * Used in an array_filter, removes elements where intervals are less than 0 * * @param array $array elements of an array * @return bool true if at least 1 interval */ function wcs_discard_zero_intervals($array) { } /** * Used in an array_filter, discards high deviation elements. * - 10 days for a year (10/365th) * - 4 days for a month (4/(days_in_month)) * - 1 day for week (i.e. 1/7th) * - 1 hour for days (i.e. 1/24th) * * @param array $array elements of the filtered array * @return bool true if value is within deviation limit */ function wcs_discard_high_deviations($array) { } /** * Used in an array_filter, tries to match intervals against passed in interval * @param array $array elements of filtered array * @return bool true if intervals match */ function wcs_match_intervals($array) { } /** * Used in a usort, responsible for making sure the array is sorted in ascending order by intervals * * @param array $a one element of the sorted array * @param array $b different element of the sorted array * @return int 0 if equal, -1 if $b is larger, 1 if $a is larger */ function wcs_sort_by_intervals($a, $b) { } /** * Used in a usort, responsible for making sure the array is sorted in descending order by fraction. * * @param array $a one element of the sorted array * @param array $b different element of the sorted array * @return int 0 if equal, -1 if $b is larger, 1 if $a is larger */ function wcs_sort_by_fractions($a, $b) { } /** * Validate whether a given datetime matches the mysql pattern of YYYY-MM-DD HH:MM:SS * This function will return false when the date or time is invalid (e.g. 2015-02-29 00:00:00) * * @param string $time the mysql time string * @return boolean if the string is valid */ function wcs_is_datetime_mysql_format($time) { } /** * Convert a date string into a timestamp without ever adding or deducting time. * * strtotime() would be handy for this purpose, but alas, if other code running on the server * is calling date_default_timezone_set() to change the timezone, strtotime() will assume the * date is in that timezone unless the timezone is specific on the string (which it isn't for * any MySQL formatted date) and attempt to convert it to UTC time by adding or deducting the * GMT/UTC offset for that timezone, so for example, when 3rd party code has set the servers * timezone using date_default_timezone_set( 'America/Los_Angeles' ) doing something like * gmdate( "Y-m-d H:i:s", strtotime( gmdate( "Y-m-d H:i:s" ) ) ) will actually add 7 hours to * the date even though it is a date in UTC timezone because the timezone wasn't specified. * * This makes sure the date is never converted. * * @param string $date_string A date string formatted in MySQl or similar format that will map correctly when instantiating an instance of DateTime() * @return int Unix timestamp representation of the timestamp passed in without any changes for timezones */ function wcs_date_to_time($date_string) { } /** * A wrapper for strtotime() designed to stand up against those who want to watch the WordPress burn. * * One day WordPress will require Harvey Dent (aka PHP 5.3) then we can use DateTime::add() instead, * but for now, this ensures when using strtotime() to add time to a timestamp, there are no additional * changes for server specific timezone additions or deductions. * * @param string $time_string A string representation of a date in any format that can be parsed by strtotime() * @return int Unix timestamp representation of the timestamp passed in without any changes for timezones */ function wcs_strtotime_dark_knight($time_string, $from_timestamp = \null) { } /** * Find the average number of days for a given billing period and interval. * * @param string $period a billing period: day, week, month or year. * @param int $interval a billing interval * @return int the number of days in that billing cycle */ function wcs_get_days_in_cycle($period, $interval) { } /** * Set a DateTime's timezone to the WordPress site's timezone, or a UTC offset * if no timezone string is available. * * @since 1.0.0 - Migrated from WooCommerce Subscriptions v2.4.2 * @param WC_DateTime $date * @return WC_DateTime */ function wcs_set_local_timezone(\WC_DateTime $date) { } /* Deprecated Functions */ /** * Get an instance of the site's timezone. * * @return DateTimeZone Timezone object for the timezone the site is using. * @deprecated 1.0.0 - Migrated from WooCommerce Subscriptions v2.4.2 */ function wcs_get_sites_timezone() { } /** * Returns an array of subscription lengths. * * PayPal Standard Allowable Ranges * D – for days; allowable range is 1 to 90 * W – for weeks; allowable range is 1 to 52 * M – for months; allowable range is 1 to 24 * Y – for years; allowable range is 1 to 5 * * @param string (optional) One of day, week, month or year. If empty, all subscription ranges are returned. * @since 1.0.0 - Migrated from WooCommerce Subscriptions v2.0 */ function wcs_get_subscription_ranges_tlc() { } /** * Take a date in the form of a timestamp, MySQL date/time string or DateTime object (or perhaps * a WC_Datetime object when WC > 3.0 is active) and create a WC_DateTime object. * * @since 1.0.0 - Migrated from WooCommerce Subscriptions v2.2.0 * @param string|integer|null $date UTC timestamp, or ISO 8601 DateTime. If the DateTime string has no timezone or offset, WordPress site timezone will be assumed. Null if their is no date. * @return null|WC_DateTime in site's timezone */ function wcs_get_datetime_from($variable_date_type) { } /** * Get a MySQL date/time string in UTC timezone from a WC_Datetime object. * * @since 1.0.0 - Migrated from WooCommerce Subscriptions v2.2.0 * @param WC_DateTime * @return string MySQL date/time string representation of the DateTime object in UTC timezone */ function wcs_get_datetime_utc_string($datetime) { } /** * Format a date for output, a wrapper for wcs_format_datetime() introduced with WC 3.0. * * @since 1.0.0 - Migrated from WooCommerce Subscriptions v2.2.0 * @param WC_DateTime $date * @param string $format Defaults to the wc_date_format function if not set. * @return string */ function wcs_format_datetime($date, $format = '') { } /** * Compares two periods and returns the longest period. * * @since 1.0.0 - Migrated from WooCommerce Subscriptions v4.0.0 * * @param string $current_period Period string. Can be 'day', 'week', 'month', 'year'. * @param string $new_period Period string. Can be 'day', 'week', 'month', 'year'. * * @return string The longest period between the two provided. */ function wcs_get_longest_period($current_period, $new_period) { } /** * Compares two periods and returns the shortest period. * * @since 1.0.0 - Migrated from WooCommerce Subscriptions v4.0.0 * * @param string $current_period A period string. Can be 'day', 'week', 'month', 'year'. * @param string $new_period A period string. Can be 'day', 'week', 'month', 'year'. * * @return string The shortest period between the two provided. */ function wcs_get_shortest_period($current_period, $new_period) { } /** * Give a user the Subscription's default subscriber role * * @since 1.0.0 - Migrated from WooCommerce Subscriptions v2.0 */ function wcs_make_user_active($user_id) { } /** * Give a user the Subscription's default subscriber's inactive role * * @since 1.0.0 - Migrated from WooCommerce Subscriptions v2.0 */ function wcs_make_user_inactive($user_id) { } /** * Give a user the Subscription's default subscriber's inactive role if they do not have an active subscription * * @since 1.0.0 - Migrated from WooCommerce Subscriptions v2.0 */ function wcs_maybe_make_user_inactive($user_id) { } /** * Wrapper for wcs_maybe_make_user_inactive() that accepts a subscription instead of a user ID. * Handy for hooks that pass a subscription object. * * @since 1.0.0 - Migrated from WooCommerce Subscriptions v2.2.9 * @param WC_Subscription|WC_Order */ function wcs_maybe_make_user_inactive_for($subscription) { } /** * Update a user's role to a special subscription's role * * @param int $user_id The ID of a user * @param string $role_new The special name assigned to the role by Subscriptions, one of 'default_subscriber_role', 'default_inactive_role' or 'default_cancelled_role' * @return WP_User The user with the new role. * @since 1.0.0 - Migrated from WooCommerce Subscriptions v2.0 */ function wcs_update_users_role($user_id, $role_new) { } /** * Gets default new and old role names if the new role is 'default_subscriber_role'. Otherwise returns role_new and an * empty string. * * @param $role_new string the new role of the user * @return array with keys 'old' and 'new'. */ function wcs_get_new_user_role_names($role_new) { } /** * Check if a user has a subscription, optionally to a specific product and/or with a certain status. * * @param int $user_id (optional) The ID of a user in the store. If left empty, the current user's ID will be used. * @param int $product_id (optional) The ID of a product in the store. If left empty, the function will see if the user has any subscription. * @param mixed $status (optional) A valid subscription status string or array. If left empty, the function will see if the user has a subscription of any status. * @since 1.0.0 - Migrated from WooCommerce Subscriptions v2.0 * * @return bool */ function wcs_user_has_subscription($user_id = 0, $product_id = '', $status = 'any') { } /** * Gets all the active and inactive subscriptions for a user, as specified by $user_id * * @param int $user_id (optional) The id of the user whose subscriptions you want. Defaults to the currently logged in user. * @since 1.0.0 - Migrated from WooCommerce Subscriptions v2.0 * * @return WC_Subscription[] */ function wcs_get_users_subscriptions($user_id = 0) { } /** * Get subscription IDs for the given user. * * @author Jeremy Pry * * @param int $user_id The ID of the user whose subscriptions you want. * * @return array Array of Subscription IDs. */ function wcs_get_users_subscription_ids($user_id) { } /** * Get subscription IDs for a user using caching. * * @author Jeremy Pry * * @param int $user_id The ID of the user whose subscriptions you want. * * @return array Array of subscription IDs. */ function wcs_get_cached_user_subscription_ids($user_id = 0) { } /** * Return a link for subscribers to change the status of their subscription, as specified with $status parameter * * @param int $subscription_id A subscription's post ID * @param string $status A subscription's post ID * @param string $current_status A subscription's current status * @since 1.0.0 - Migrated from WooCommerce Subscriptions v1.0 */ function wcs_get_users_change_status_link($subscription_id, $status, $current_status = '') { } /** * Check if a given user (or the currently logged in user) has permission to put a subscription on hold. * * By default, a store manager can put all subscriptions on hold, while other users can only suspend their own subscriptions. * * @param int|WC_Subscription $subscription An instance of a WC_Snbscription object or ID representing a 'shop_subscription' post * @since 1.0.0 - Migrated from WooCommerce Subscriptions v2.0 */ function wcs_can_user_put_subscription_on_hold($subscription, $user = '') { } /** * Retrieve available actions that a user can perform on the subscription * * @since 1.0.0 - Migrated from WooCommerce Subscriptions v2.0 * * @param WC_Subscription $subscription The subscription. * @param int $user_id The user. * * @return array */ function wcs_get_all_user_actions_for_subscription($subscription, $user_id) { } /** * Checks if a user has a certain capability * * @access public * @param array $allcaps * @param array $caps * @param array $args * @return array */ function wcs_user_has_capability($allcaps, $caps, $args) { } /** * Grants shop managers the capability to edit subscribers. * * @since 1.0.0 - Migrated from WooCommerce Subscriptions v3.0.4 * @param array $roles The user roles shop managers can edit. * @return array The list of roles editable by shop managers. */ function wcs_grant_shop_manager_editable_roles($roles) { } /** * Gets the subscriber role. * * @since 1.0.0 - Migrated from WooCommerce Subscriptions v4.0.0 * * @return string The role to apply to subscribers. */ function wcs_get_subscriber_role() { } /** * Gets the inactive subscriber role. * * @since 1.0.0 - Migrated from WooCommerce Subscriptions v4.0.0 * * @return string The role to apply to inactive subscribers. */ function wcs_get_inactive_subscriber_role() { } /** * Check if a given object is a WC_Subscription (or child class of WC_Subscription), or if a given ID * belongs to a post or order with type ('shop_subscription'). * * @since 1.0.0 - Migrated from WooCommerce Subscriptions v2.0 * * @param mixed $subscription A WC_Subscription object or an ID. * @return boolean true if anything is found */ function wcs_is_subscription($subscription) { } /** * Determines if there are any subscriptions in the database (active or inactive). * * @since 1.0.0 - Migrated from WooCommerce Subscriptions v2.0 * @return bool True if the store has any subscriptions, otherwise false. */ function wcs_do_subscriptions_exist() { } /** * Main function for returning subscriptions. Wrapper for the wc_get_order() method. * * @since 1.0.0 - Migrated from WooCommerce Subscriptions v2.0 * @param mixed $the_subscription Post object or post ID of the order. * @return WC_Subscription|false The subscription object, or false if it cannot be found. */ function wcs_get_subscription($the_subscription) { } /** * Create a new subscription * * Returns a new WC_Subscription object on success which can then be used to add additional data. * * @return WC_Subscription | WP_Error A WC_Subscription on success or WP_Error object on failure * @since 1.0.0 - Migrated from WooCommerce Subscriptions v2.0 */ function wcs_create_subscription($args = array()) { } /** * Return an array of subscription status types, similar to @see wc_get_order_statuses() * * @since 1.0.0 - Migrated from WooCommerce Subscriptions v2.0 * @return array */ function wcs_get_subscription_statuses() { } /** * Get the nice name for a subscription's status * * @since 1.0.0 - Migrated from WooCommerce Subscriptions v2.0 * @param string $status * @return string */ function wcs_get_subscription_status_name($status) { } /** * Helper function to return a localised display name for an address type * * @param string $address_type the type of address (shipping / billing) * * @return string */ function wcs_get_address_type_to_display($address_type) { } /** * Returns an array of subscription dates * * @since 1.0.0 - Migrated from WooCommerce Subscriptions v2.0 * @return array */ function wcs_get_subscription_date_types() { } /** * Find whether to display a specific date type in the admin area * * @param string A subscription date type key. One of the array key values returned by @see wcs_get_subscription_date_types(). * @param WC_Subscription * @since 1.0.0 - Migrated from WooCommerce Subscriptions v2.1 * @return bool */ function wcs_display_date_type($date_type, $subscription) { } /** * Get the meta key value for storing a date in the subscription's post meta table. * * @param string $date_type Internally, 'trial_end', 'next_payment' or 'end', but can be any string * @since 1.0.0 - Migrated from WooCommerce Subscriptions v2.0 */ function wcs_get_date_meta_key($date_type) { } /** * Accept a variety of date type keys and normalise them to current canonical key. * * This method saves code calling the WC_Subscription date functions, e.g. self::get_date(), needing * to make sure they pass the correct date type key, which can involve transforming a prop key or * deprecated date type key. * * @since 1.0.0 - Migrated from WooCommerce Subscriptions v2.2.0 * @param string $date_type_key String referring to a valid date type, can be: 'date_created', 'trial_end', 'next_payment', 'last_order_date_created' or 'end', or any other value returned by @see this->get_valid_date_types() * @return string */ function wcs_normalise_date_type_key($date_type_key, $display_deprecated_notice = \false) { } /** * Utility function to standardise status keys: * - turns 'pending' into 'wc-pending'. * - turns 'wc-pending' into 'wc-pending' * * @param string $status_key The status key going in * @return string Status key guaranteed to have 'wc-' at the beginning */ function wcs_sanitize_subscription_status_key($status_key) { } /** * Gets a list of subscriptions that match a certain set of query arguments. * * @since 1.0.0 - Migrated from WooCommerce Subscriptions v2.0. * * @param array $args { * A set of name value pairs to query for subscriptions - similar to args supported by wc_get_orders(). * * @type string $subscriptions_per_page The number of subscriptions to return. Set to -1 for unlimited. Default 10. * @type int $paged The page of subscriptions to return. Default 1. * @type int $offset An optional number of subscription to displace or pass over. Default 0. * @type string $orderby The field which the subscriptions should be ordered by. Can be 'start_date', 'trial_end_date', 'end_date', 'status' or 'order_id'. Defaults to 'start_date'. * @type string $order The direction to order subscriptions by. Can be 'ASC' or 'DESC'. Defaults to 'DESC'. * @type int $customer_id The ID of the customer whose subscriptions should be returned. Default 0 - No customer restriction. * @type int $product_id To restrict subscriptions to those which contain a certain product ID. Default 0 - No product restriction. * @type int $variation_id To restrict subscriptions to those which contain a certain product variation ID. Default 0 - No variation restriction. * @type int $order_id To restrict subscriptions to those which have a certain parent order ID. Default 0 - No parent order restriction. * @type string $subscription_status The status of the subscriptions to return. Can be 'any', 'active', 'on-hold', 'pending', 'cancelled', 'expired', 'trash', 'pending-cancel'. Default 'any'. * } * * @return WC_Subscription[] An array of WC_Subscription objects keyed by their ID matching the query args. */ function wcs_get_subscriptions($args) { } /** * Get subscriptions that contain a certain product, specified by ID. * * @param int|array $product_ids Either the post ID of a product or variation or an array of product or variation IDs * @param string $fields The fields to return, either "ids" to receive only post ID's for the match subscriptions, or "subscription" to receive WC_Subscription objects * @param array $args A set of name value pairs to determine the returned subscriptions. * 'subscription_statuses' Any valid subscription status. Can be 'any', 'active', 'cancelled', 'on-hold', 'expired', 'pending' or 'trash' or an array of statuses. Defaults to 'any'. * 'limit' The number of subscriptions to return. Default is all (-1). * 'offset' An optional number of subscriptions to displace or pass over. Default 0. A limit arg is required for the offset to be applied. * @return array * @since 1.0.0 - Migrated from WooCommerce Subscriptions v2.0 */ function wcs_get_subscriptions_for_product($product_ids, $fields = 'ids', $args = []) { } /** * Get all subscription items which have a trial. * * @param mixed WC_Subscription|post_id * @return array * @since 1.0.0 - Migrated from WooCommerce Subscriptions v2.0 */ function wcs_get_line_items_with_a_trial($subscription_id) { } /** * Checks if the user can be granted the permission to remove a line item from the subscription. * * @param WC_Subscription $subscription An instance of a WC_Subscription object * @since 1.0.0 - Migrated from WooCommerce Subscriptions v2.0 */ function wcs_can_items_be_removed($subscription) { } /** * Checks if the user can be granted the permission to remove a particular line item from the subscription. * * @param WC_Order_item $item An instance of a WC_Order_item object * @param WC_Subscription $subscription An instance of a WC_Subscription object * @since 1.0.0 - Migrated from WooCommerce Subscriptions v2.2.15 */ function wcs_can_item_be_removed($item, $subscription) { } /** * Get the Product ID for an order's line item (only the product ID, not the variation ID, even if the order item * is for a variation). * * @param int An order item ID * @since 1.0.0 - Migrated from WooCommerce Subscriptions v2.0 */ function wcs_get_order_items_product_id($item_id) { } /** * Get the variation ID for variation items or the product ID for non-variation items. * * When acting on cart items or order items, Subscriptions often needs to use an item's canonical product ID. For * items representing a variation, that means the 'variation_id' value, if the item is not a variation, that means * the 'product_id value. This function helps save keystrokes on the idiom to check if an item is to a variation or not. * * @param array or object $item Either a cart item, order/subscription line item, or a product. */ function wcs_get_canonical_product_id($item_or_product) { } /** * Return an array statuses used to describe when a subscriptions has been marked as ending or has ended. * * @return array * @since 1.0.0 - Migrated from WooCommerce Subscriptions v2.0 */ function wcs_get_subscription_ended_statuses() { } /** * Returns true when on the My Account > View Subscription front end page. * * @return bool * @since 1.0.0 - Migrated from WooCommerce Subscriptions v2.0 */ function wcs_is_view_subscription_page() { } /** * Get a WooCommerce Subscription's image asset url. * * @param string $file_name The image file name. * @return string The image asset url. * @since 1.0.0 - Migrated from WooCommerce Subscriptions v2.2.20 */ function wcs_get_image_asset_url($file_name) { } /** * Search subscriptions * * @param string $term Term to search * @return array of subscription ids * @since 1.0.0 - Migrated from WooCommerce Subscriptions v2.3.0 */ function wcs_subscription_search($term) { } /** * Set payment method meta data for a subscription or order. * * @since 1.0.0 - Migrated from WooCommerce Subscriptions v2.4.3 * @param WC_Subscription|WC_Order $subscription The subscription or order to set the post payment meta on. * @param array $payment_meta Associated array of the form: $database_table => array( 'meta_key' => array( 'value' => '' ) ) * @throws InvalidArgumentException */ function wcs_set_payment_meta($subscription, $payment_meta) { } /** * Get total quantity of a product on a subscription or order, even across multiple line items. So we can determine if product has stock available. * * @since 1.0.0 - Migrated from WooCommerce Subscriptions v2.6.0 * * @param WC_Order|WC_Subscription $subscription Order or subscription object. * @param WC_Product $product The product to get the total quantity of. * @param string $product_match_method The way to find matching products. Optional. Default is 'stock_managed' Can be: * 'stock_managed' - Products with matching stock managed IDs are grouped. Helpful for getting the total quantity of variation parents if they are managed on the product level, not on the variation level - @see WC_Product::get_stock_managed_by_id(). * 'parent' - Products with the same parent ID are grouped. Standard products are matched together by ID. Variations are matched with variations with the same parent product ID. * 'strict_product' - Products with the exact same product ID are grouped. Variations are only grouped with other variations that share the variation ID. * * @return int $quantity The total quantity of a product on an order or subscription. */ function wcs_get_total_line_item_product_quantity($order, $product, $product_match_method = 'stock_managed') { } /** * Determines if a site can be considered large for the purposes of performance. * * Sites are considered large if they have more than 3000 subscriptions or more than 25000 orders. * * @since 1.0.0 - Migrated from WooCommerce Subscriptions v3.0.7 * @return bool True for large sites, otherwise false. */ function wcs_is_large_site() { } function add_woocommerce_inbox_variant() { } /** * Load and set up the Autoloader * * If the `woocommerce-subscriptions-core` plugin is active, setup the autoloader using this plugin directory * as the base file path for loading subscription core classes. * * @since 4.0.0 * @return WCS_Autoloader */ function wcs_init_autoloader() { }