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 7.8.0 - Compatible with HPOS, originally introduced in 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 void */ 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 */ 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 { /** * Tracks whether the cache should be updated after generating report data. * * @var bool */ private static $should_update_cache = \false; /** * Cached report results for performance optimization. * * * @var array */ private static $cached_report_results = array(); /** * Hook in additional reporting to WooCommerce dashboard widget */ public function __construct() { } /** * Get all data needed for this report and store in the class * * @see WCS_Report_Cache_Manager::update_cache() - This method is called by the cache manager to update the cache. * * @param array $args The arguments for the report. * @return object The report data. */ 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. * * @see WCS_Report_Cache_Manager::update_cache() - This method is called by the cache manager before updating the cache. * * @since 3.0.10 */ public static function clear_cache() { } /** * Fetch the signup count for the dashboard. * * @param string $start_date The start date. * @param string $end_date The end date. * @param bool $force_cache_update Whether to force update the cache. * @return int The signup count. */ private static function fetch_signup_count($start_date, $end_date, $force_cache_update = \false) { } /** * Fetch the signup revenue for the dashboard. * * @param string $start_date The start date. * @param string $end_date The end date. * @param bool $force_cache_update Whether to force update the cache. * @return float The signup revenue. */ private static function fetch_signup_revenue($start_date, $end_date, $force_cache_update = \false) { } /** * Fetch the renewal count for the dashboard. * * @param string $start_date The start date. * @param string $end_date The end date. * @param bool $force_cache_update Whether to force update the cache. * @return int The renewal count. */ private static function fetch_renewal_count($start_date, $end_date, $force_cache_update = \false) { } /** * Fetch the renewal revenue for the dashboard. * * @param string $start_date The start date. * @param string $end_date The end date. * @param bool $force_cache_update Whether to force update the cache. * @return float The renewal revenue. */ private static function fetch_renewal_revenue($start_date, $end_date, $force_cache_update = \false) { } /** * Fetch the cancellation count for the dashboard. * * @param string $start_date The start date. * @param string $end_date The end date. * @param bool $force_cache_update Whether to force update the cache. * @return int The cancellation count. */ private static function fetch_cancel_count($start_date, $end_date, $force_cache_update = \false) { } /** * Initialize cache for report results. * * @return void */ private static function init_cache() { } /** * Cache report results for performance optimization. * * @param string $query_hash The hash of the query for caching. * @param array $report_data The report data to cache. * @return void */ private static function cache_report_results($query_hash, $report_data) { } } /** * 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 stdClass */ 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 void */ private function query_report_data() { } /** * Get the age of the longest living subscription in days. * * @return int */ private function get_max_subscription_age_in_days() { } /** * Fetch the number of periods each subscription has between creating and ending. * * @param int $days_in_interval_period * @param int $oldest_subscription_age * @return array */ private function fetch_subscriptions_ages($days_in_interval_period, $oldest_subscription_age) { } /** * 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 */ public function output_report() { } /** * Output the HTML and JavaScript to plot the chart * * @since 2.1 */ 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 { /** * Cached report results. * * @var array */ private static $cached_report_results = array(); private $totals; /** * Constructor. */ public function __construct() { } /** * Get the totals. * * @return object */ public function get_totals() { } /** * No subscription products found text. */ public function no_items() { } /** * Output the report. */ public function output_report() { } /** * Get column value. * * @param stdClass $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. * * @see WCS_Report_Cache_Manager::update_cache() - This method is called by the cache manager to update the cache. * * @param array $args The arguments for the report. * @return object The totals for customers. */ public static function get_data($args = array()) { } /** * Clears the cached report data. * * @see WCS_Report_Cache_Manager::update_cache() - This method is called by the cache manager before updating the cache. * * @since 3.0.10 */ public static function clear_cache() { } /** * Fetch totals by customer for subscriptions. * * @param array $args The arguments for the report. * @return object The totals by customer for subscriptions. * * @since 2.1.0 */ public static function fetch_customer_subscription_totals($args = array()) { } /** * Fetch totals by customer for related renewal and switch orders. * * @param array $args The arguments for the report. * @return object The totals by customer for related renewal and switch orders. * * @since 2.1.0 */ public static function fetch_customer_subscription_related_orders_totals($args = array()) { } /** * Fetch subscriptions by customer. * * Records for deleted customers will be grouped under customer_id 0 (zero). * * @param array $query_options The query options. * @return array The subscriptions by customer. * * @since 2.1.0 */ private static function fetch_subscriptions_by_customer($query_options = array()) { } /** * Fetch totals by customer for related renewal and switch orders. * * @param array $query_options The query options. * @return array The totals by customer for related renewal and switch orders. * * @since 2.1.0 */ private static function fetch_subscriptions_related_orders_totals_by_customer($query_options = array()) { } /** * Initialize cache for report results. */ private static function init_cache() { } /** * Cache report results. * * @param string $query_hash The query hash. * @param array $report_data The report data. */ private static function cache_report_results($query_hash, $report_data) { } } /** * 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 { /** * Cached report results. * * @var array */ private static $cached_report_results = array(); /** * 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. * * @see WCS_Report_Cache_Manager::update_cache() - This method is called by the cache manager to update the cache. * * @param array $args The arguments for the report. * @return array The subscription product data. */ public static function get_data($args = array()) { } /** * Output product breakdown chart. */ public function product_breakdown_chart() { } /** * Clears the cached report data. * * @see WCS_Report_Cache_Manager::update_cache() - This method is called by the cache manager before updating the cache. * * @since 3.0.10 */ public static function clear_cache() { } private static function fetch_subscription_products_data($args = array()) { } /** * Organize subscription products data for futher reporting. * * Group subscription product variations under variable subscription products. * * @param array $report_data The report data. * @return array The organized report data. */ private static function organize_subscription_products_data($report_data) { } private static function fetch_product_totals_data($args = array()) { } /** * Initialize cache for report results. */ private static function init_cache() { } /** * Cache report results. * * @param string $query_hash The query hash. * @param array $report_data The report data. */ private static function cache_report_results($query_hash, $report_data) { } } /** * 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 { /** * Chart colors for different data series. * * @var array */ public $chart_colours = array(); /** * Report data object containing all calculated metrics. * * @var stdClass */ private $report_data; /** * Current report type being generated (new_subscriptions, renewals, resubscribes, switches). * * Used for query hash generation. * * @var string */ private $generating_report; /** * Tracks whether the cache should be updated after generating report data. * * @var bool */ private $should_update_cache; /** * Cached report results for performance optimization. * * Works slightly differently to the WC_Admin_Report::cached_results, so intentionally separate. * * @var array */ private $cached_report_results; /** * 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 stdClass */ public function get_report_data() { } /** * Get all data needed for this report and store in the class * * @see WCS_Report_Cache_Manager::update_cache() - This method is called by the cache manager to update the cache. * * @param array $args Optional arguments to customize the report data. * @return void */ public function get_data($args = array()) { } /** * Get the legend for the main chart sidebar. * * @return array */ public function get_chart_legend() { } /** * Output the report. * * @return void */ public function output_report() { } /** * Output an export link. * * @return void */ public function get_export_button() { } /** * Get the main chart. * * @return void */ public function get_main_chart() { } /** * Round chart totals correctly for display. * * @param string $amount The amount to round. * @return string The rounded amount. */ 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 The interval for grouping. * @param string $start_date The start date. * @param string $group_by How to group the data. * @return array */ private function prepare_chart_data_daily_average($data, $date_key, $data_key, $interval, $start_date, $group_by) { } /** * Clears the cached report data. * * @see WCS_Report_Cache_Manager::update_cache() - This method is called by the cache manager before updating the cache. * * @since 3.0.10 */ public function clear_cache() { } /** * Fetch and cache new subscriptions data for the report. * * @param array $args Report arguments. * @return void */ public function fetch_new_subscriptions_data($args) { } /** * Fetch and cache renewal orders data for the report. * * @param array $args Report arguments. * @return void */ public function fetch_renewals_data($args) { } /** * Fetch and cache resubscribe orders data for the report. * * @param array $args Report arguments. * @return void */ public function fetch_resubscribes_data($args) { } /** * Fetch and cache subscription switch orders data for the report. * * @param array $args Report arguments. * @return void */ public function fetch_switches_data($args) { } /** * Fetch and cache subscription signup data for the report. * * @param array $args Report arguments. * @param array $query_options Query options including timezone and date settings. * @return void */ public function fetch_signups_data($args, $query_options) { } /** * Fetch and cache subscriber count data for the report. * * @param array $args Report arguments. * @param array $query_options Query options including timezone and date settings. * @return void */ public function fetch_subscribers_data($args, $query_options) { } /** * Fetch and cache subscription cancellation data for the report. * * @param array $args Report arguments. * @param array $query_options Query options including timezone and date settings. * @return void */ public function fetch_cancellations_data($args, $query_options) { } /** * Fetch and cache subscription ended data for the report. * * @param array $args Report arguments. * @param array $query_options Query options including timezone and date settings. * @return void */ public function fetch_subscriptions_ended_data($args, $query_options) { } /** * Update report totals by calculating sums from collected data. * * @return void */ public function update_report_totals() { } /** * Uses the provided arguments to build a query. * * The parent method is extended in order to support HPOS queries for that report only. * No universal support for all possible queries when HPOS enabled is provided. * * @see WC_Admin_Report::get_order_report_data() * * @param array $args Arguments for the report. * @return mixed */ public function get_order_report_data($args = array()) { } /** * Order report data implementation for HPOS. * * @param array $args Arguments for the report. * @return mixed */ private function get_hpos_report_data(array $args = array()) { } /** * Initialize cache for report results. * * @return void */ private function init_cache() { } /** * Cache report results for performance optimization. * * @param string $query_hash The hash of the query for caching. * @param array $report_data The report data to cache. * @return void */ private function cache_report_results($query_hash, $report_data) { } /** * Modifies the report query arguments so that they work smoothly with HPOS. * * @param array $args Report arguments. * @return array */ private function remap_args_for_hpos_compatibility(array $args): array { } } /** * 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 stdClass */ 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 void */ public function get_main_chart() { } /** * Round our totals correctly. * @param string $amount * @return string */ private function round_chart_totals($amount) { } /** * Get the sum of order totals for completed retries (i.e. retries which eventually succeeded in processing the failed payment) * * @param array $query_options Query options. */ private function fetch_renewal_data($query_options) { } /** * Get the counts for all retries, grouped by day or month and status * * @param array $query_options Query options. */ private function fetch_retry_data($query_options) { } } /** * 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. * * @see WCS_Report_Cache_Manager::update_cache() - This method is called by the cache manager to update the cache. * * @param array $args The arguments for the report. * @return stdClass[] - Upcoming renewal data grouped by scheduled date. */ 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 void */ 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. * * @see WCS_Report_Cache_Manager::update_cache() - This method is called by the cache manager before updating the cache. * * @since 3.0.10 */ public function clear_cache() { } } /** * Admin includes and hooks. * * @class WCS_ATT_Admin_Ajax * @version 3.2.1 */ class WCS_ATT_Admin_Ajax { /** * Initialize. */ public static function init() { } /** * Add hooks. */ private static function add_hooks() { } /* |-------------------------------------------------------------------------- | Notices. |-------------------------------------------------------------------------- */ /** * Dismisses notices. * * @since APFS 2.2.0 * * @return void */ public static function dismiss_notice() { } } /** * Admin notices handling. * * @class WCS_ATT_Admin_Notices * @version 9.0.0 */ class WCS_ATT_Admin_Notices { /** * Notices presisting on the next request. * * @var array */ public static $meta_box_notices = array(); /** * Notices displayed on the current request. * * @var array */ public static $admin_notices = array(); /** * Dismissible notices displayed on the current request. * * @var array */ public static $dismissed_notices = array(); /** * Constructor. */ public static function init() { } /** * Add a notice/error. * * @param string $text * @param mixed $args * @param boolean $save_notice */ public static function add_notice($text, $args, $save_notice = \false) { } /** * Checks if a dismissible notice has been dismissed in the past. * * @param string $notice_name * @return boolean */ public static function is_dismissible_notice_dismissed($notice_name) { } /** * Save errors to an option. */ public static function save_notices() { } /** * Show any stored error messages. */ public static function output_notices() { } /** * Add a dimissible notice/error. * * @param string $text * @param mixed $args */ public static function add_dismissible_notice($text, $args) { } /** * Remove a dismissible notice. * * @param string $notice_name */ public static function remove_dismissible_notice($notice_name) { } /** * Dismisses a notice. * * @param string $notice */ public static function dismiss_notice($notice) { } } /** * WCS_ATT_Admin_Welcome_Announcement class. */ class WCS_ATT_Admin_Welcome_Announcement { /** * Dismiss-notice key persisted in the `wcsatt_dismissed_notices` user meta array. * * @var string */ const NOTICE_NAME = 'welcome_subscription_plans'; /** * Register hooks. */ public static function init() { } /** * Localize data for the JS entrypoint. * * Only runs on WC Admin home or the Subscriptions listing; on any other * screen the localization is skipped so the announcement does not mount. */ public static function enqueue_scripts() { } /** * Echo the root div that the React entrypoint mounts into. */ public static function output_root() { } /** * Whether the current user has already dismissed the announcement. * * Reads directly from user meta on each call. This is intentional: * * - It does not depend on `WCS_ATT_Admin_Notices::init()` having already * run, which is required because this method is called from early hook * positions (e.g. plugin-file load time, `admin_init:5`) before that * class's `$dismissed_notices` static is populated. * - It avoids a cross-user stale-state bug where the shared * `WCS_ATT_Admin_Notices::$dismissed_notices` static could leak one * user's dismissal list to another user if the current user is * switched mid-request (possible in some REST/cron contexts). * * `get_user_meta()` is served from the WordPress object cache within a * request after the first read, so repeated calls do not hit the database. * * When the APFS notices class is unavailable entirely, treat the * announcement as dismissed (safe fallback: do nothing) rather than * initializing a broken state. * * @return bool */ public static function is_welcome_announcement_dismissed() { } /** * Whether the current admin screen is the WC Admin home or Subscriptions listing. * * @return bool */ private static function is_woocommerce_admin_or_subscriptions_listing() { } } /** * Admin includes and hooks. * * @class WCS_ATT_Admin * @version 6.1.0 */ class WCS_ATT_Admin { /** * Initialize. */ public static function init() { } /** * Add hooks. */ private static function add_hooks() { } /** * Admin init. */ public static function admin_init() { } /** * Include classes. */ public static function includes() { } /** * Add extra 'Allow Switching > 'Between Subscription Plans' option. * In the past there was no option to turn off this feature. * * @param array $data * @return array */ public static function allow_switching_options($data) { } /** * Subscriptions schemes admin metaboxes. * * Renders the React root element for the storewide plans React app. * * @param array $values Settings field values. * @return void */ public static function subscription_schemes_content($values) { } /** * Append "Subscribe to Cart/Order" section in the Subscriptions settings tab. * * @since APFS 2.1.0 * * @param array $settings * @return array */ public static function add_settings($settings) { } /** * Add "Add to Subscription" settings section. * * @param array $settings * @return array */ public static function add_subscription_management_settings($settings) { } /** * Load scripts and styles. * * APFS functionality is included in the main admin.js bundle loaded by WCS_Admin_Assets. * This method only handles APFS-specific styles and localization parameters. * * @return void */ public static function admin_scripts() { } /** * Support scanning for template overrides in extension. * * @since APFS 3.1.8 * * @param array $paths * @return array */ public static function template_scan_path($paths) { } /** * Convert a PHP associative options map (value => label) to the * [{value, label}] format expected by the React SelectControl component. * * @param array $options_map Associative array of value => label pairs. * @return array Array of { value, label } objects sorted by numeric value. */ /** * Get year sync options with "each year" labels per Figma design. * * Wraps WC_Subscriptions_Synchroniser::get_year_sync_options() and appends * "each year" to each month name (e.g., "January" → "January each year"). * * @since 9.0.0 * * @return array Associative array of value => label. */ private static function get_year_sync_options_with_labels() { } private static function format_sync_options($options_map) { } /** * Add APFS debug data in the system status. * * @since APFS 3.1.8 */ public static function render_system_status_items() { } /** * Determine which of our files have been overridden by the theme. * * @since APFS 3.1.8 * * @return array */ private static function get_template_overrides() { } } /** * Exception for expected plan operation failures. * * Carries a machine-readable error code, an HTTP status, and optional * field-level details — so the REST controller can convert it into a * properly-shaped WP_Error response. */ class WCS_ATT_Plan_Exception extends \RuntimeException { /** * Machine-readable error code (e.g. 'plan_not_found', 'validation_error'). * * @var string */ private $error_code; /** * HTTP status code to use in the REST response. * * @var int */ private $status; /** * Optional field-level details (e.g. validation error messages keyed by field name). * * @var array */ private $details; /** * Constructor. * * @since 9.0.0 * * @param string $error_code Machine-readable error code. * @param string $message Human-readable message. * @param int $status HTTP status code. Default 400. * @param array $details Optional field-level details. */ public function __construct($error_code, $message, $status = 400, $details = array()) { } /** * Return the machine-readable error code. * * @since 9.0.0 * * @return string */ public function get_error_code() { } /** * Return the HTTP status code. * * @since 9.0.0 * * @return int */ public function get_status() { } /** * Return the field-level details array. * * @since 9.0.0 * * @return array */ public function get_details() { } } /** * Manages subscription plan CRUD: storage read/write, validation, ID generation, and filter hooks. * * For storewide plans, plans are stored in wp_options ('wcsatt_subscribe_to_cart_schemes'). * For product plans, plans are stored in post meta ('_wcsatt_schemes'). Pass the product ID * as the $product_id argument to each CRUD method — this allows a single manager instance to * operate across multiple products without the overhead of creating one instance per product. */ class WCS_ATT_Plans_Manager { /** * Plan type: 'storewide' or 'product'. * * Controls which storage backend is used and which third-party filter hook * is applied when persisting plan data. * * @var string */ private $plan_type; /** * Constructor. * * @since 9.0.0 * * @param string $plan_type 'storewide' or 'product'. */ public function __construct($plan_type) { } // ------------------------------------------------------------------------- // CRUD operations // ------------------------------------------------------------------------- /** * Read and return the current plans from storage. * * @since 9.0.0 * * @param int|null $product_id Product ID for 'product' plans; null for 'storewide' plans. * @return array */ public function read($product_id = \null) { } /** * Add a new plan to storage. * * Generates an ID, validates the data, and applies third-party filter hooks. * * @since 9.0.0 * * @param array $plan_data Plan data. An 'id' key is generated automatically if absent. * @param int|null $product_id Product ID for 'product' plans; null for 'storewide' plans. * @return array Created plan data. * @throws WCS_ATT_Plan_Exception On validation failure. */ public function create($plan_data, $product_id = \null) { } /** * Update an existing plan in storage. * * Validates the data and applies third-party filter hooks. * * @since 9.0.0 * * @param string $plan_id Plan ID. * @param array $plan_data New plan data. The 'id' key will be set to $plan_id. * @param int|null $product_id Product ID for 'product' plans; null for 'storewide' plans. * @return array Updated plan data. * @throws WCS_ATT_Plan_Exception If not found or invalid. */ public function update($plan_id, $plan_data, $product_id = \null) { } /** * Remove a plan from storage. * * @since 9.0.0 * * @param string $plan_id Plan ID. * @param int|null $product_id Product ID for 'product' plans; null for 'storewide' plans. * @return true * @throws WCS_ATT_Plan_Exception If the plan was not found. */ public function delete($plan_id, $product_id = \null) { } /** * Reorder the plans in storage according to the provided ID sequence. * * @since 9.0.0 * * @param array $plan_ids Ordered list of all plan IDs. * @param int|null $product_id Product ID for 'product' plans; null for 'storewide' plans. * @return true * @throws WCS_ATT_Plan_Exception If IDs are invalid or incomplete. */ public function reorder($plan_ids, $product_id = \null) { } // ------------------------------------------------------------------------- // Private helpers // ------------------------------------------------------------------------- /** * Persist the plans array to the appropriate storage backend. * * For product plans, also clears storewide / one-time-purchase mode markers so * the product is put into custom plans mode (MODE_OVERRIDE) whenever plans are non-empty. * * @since 9.0.0 * * @param array $plans Plans array to persist. * @param int|null $product_id Product ID for 'product' plans; null for 'storewide' plans. */ private function save($plans, $product_id = \null) { } /** * Apply the appropriate third-party filter hooks for the current plan type. * * WCS_ATT_Sync and other extensions hook here to add payment sync date fields * and other custom data before plans are persisted. * * @since 9.0.0 * * @param array $plan_data Plan data. * @param int|null $product_id Product ID for 'product' plans; null for 'storewide' plans. * @return array Filtered plan data. */ private function apply_plan_filters($plan_data, $product_id = \null) { } /** * Find the index of a plan in an array by its ID or scheme key. * * Tries to match by 'id' first. Falls back to matching by scheme key * ('{interval}_{period}', e.g. '1_month') for legacy plans created by the * standalone APFS plugin that do not have an 'id' field. * * @since 9.0.0 * * @param array $plans Plans array. * @param string $plan_id Plan ID or scheme key. * @return int|null Plan index or null if not found. */ private function find_plan_index($plans, $plan_id) { } } /** * Abstract base REST API controller for subscription plans. * * Contains the shared HTTP orchestration: CRUD endpoint handlers, the consistent * success/error response envelope, and the try/catch structure. Business logic * (validation, ID generation, storage, filter hooks) is delegated to WCS_ATT_Plans_Manager. * * Child classes are responsible for: * - Registering routes and permission checks. * - Providing the plan type string used to construct the manager and select filter hooks. * - Providing the storage context (e.g. product ID) required by the manager, if any. * - Extracting the plan data fields relevant to their plan type from the request. * - Formatting the plan data for the REST response. * - Defining the item schema (using self::get_base_schema_properties() as a starting * point and extending with plan-type-specific fields). */ abstract class WCS_ATT_REST_Plans_Base_Controller extends \WP_REST_Controller { /** * Endpoint namespace. * * @var string */ protected $namespace = 'wc/v3'; /** * Get the base schema properties shared by all plan types. * * @since 9.0.0 * * @return array Base schema properties. */ protected function get_base_schema_properties() { } /** * Sanitize a subscription_payment_sync_date object value from the REST request. * * Translates the public always-object API shape back to the internal mixed format * expected by WCS_ATT_Scheme: 0 for no sync, integer for week/month sync, or * array {day, month} for yearly sync. * * @since 9.0.0 * * @param array|object $value Raw value from the request. * @return int|array 0, integer day, or array {day, month}. */ public static function sanitize_sync_date_for_request($value) { } /** * Normalize a sync_date value from internal mixed format to the always-object API shape. * * @since 9.0.0 * * @param int|array $sync_date Internal sync date: 0, integer, or array {day, month}. * @return array Always-object: {day} or {day, month}. */ protected function normalize_sync_date_for_response($sync_date) { } /** * Convert a sanitized subscription_payment_sync_date object to the internal mixed format. * * Translates the always-object API shape to the format expected by WCS_ATT_Scheme: * 0 for no sync, integer for week/month sync, or array {day, month} for yearly sync. * * @since 9.0.0 * * @param array $value Sanitized object value from the request. * @return int|array 0, integer day, or array {day, month}. */ protected function convert_sync_date_for_storage($value) { } /** * Get the base response data shared by all plan types. * * @since 9.0.0 * * @param WCS_ATT_Scheme $scheme Scheme object. * @param array $plan_data Raw plan data. * @return array Base response data. */ protected function get_base_response_data($scheme, $plan_data) { } /** * Create a new subscription plan. * * @since 9.0.0 * * @param WP_REST_Request $request Full details about the request. * @return WP_REST_Response|WP_Error Response object on success, or WP_Error object on failure. */ public function create_plan($request) { } /** * Update an existing subscription plan. * * @since 9.0.0 * * @param WP_REST_Request $request Full details about the request. * @return WP_REST_Response|WP_Error Response object on success, or WP_Error object on failure. */ public function update_plan($request) { } /** * Delete a subscription plan. * * @since 9.0.0 * * @param WP_REST_Request $request Full details about the request. * @return WP_REST_Response|WP_Error Response object on success, or WP_Error object on failure. */ public function delete_plan($request) { } /** * Reorder subscription plans. * * @since 9.0.0 * * @param WP_REST_Request $request Full details about the request. * @return WP_REST_Response|WP_Error Response object on success, or WP_Error object on failure. */ public function reorder_plans($request) { } /** * Convert a WCS_ATT_Plan_Exception into a WP_Error with the correct HTTP status. * * @since 9.0.0 * * @param WCS_ATT_Plan_Exception $e The plan exception. * @param string $error_code REST-level error code for the response. * @return WP_Error */ private function plan_exception_to_wp_error($e, $error_code) { } /** * Log a caught exception with full request context to aid debugging. * * Includes the plan type, request route, storage context (e.g. product ID), * the derived plan ID and operation, the exception message, and a full stack * trace — so that log entries are actionable even when third-party filter hooks * throw generic exceptions deep inside the manager. * * @since 9.0.0 * * @param Exception $e The caught exception. * @param WP_REST_Request $request The current REST request. */ private function log_request_exception($e, $request) { } /** * Instantiate a WCS_ATT_Plans_Manager for the current plan type. * * @since 9.0.0 * * @return WCS_ATT_Plans_Manager */ protected function make_manager() { } /** * Return the storage context needed by the manager for the current request. * * Storewide plans need no context (returns null). Override in child classes * that require a context, e.g. the product plans controller returns the product ID. * * @since 9.0.0 * * @param WP_REST_Request $request Current request. * @return int|null */ protected function get_plan_context($request) { } /** * Return the plan type string used to construct the manager and select filter hooks. * * @since 9.0.0 * * @return string 'storewide' or 'product'. */ abstract protected function get_plan_type(); /** * Get the URL parameter name that identifies a single plan in route patterns. * * @since 9.0.0 * * @return string e.g. 'id' or 'plan_id'. */ abstract protected function get_plan_id_param(); /** * Extract and return the plan field values from the request. * * By the time this is called the WP REST API has already applied the * sanitize_callbacks defined in the item schema, so implementations only * need to call $request->get_param() — no additional sanitization required. * * @since 9.0.0 * * @param WP_REST_Request $request Current request. * @return array Plan data array ready to pass to the manager. */ abstract protected function get_plan_data_from_request($request); /** * Prepare plan data for the REST response. * * @since 9.0.0 * * @param WCS_ATT_Scheme $scheme Scheme object built from the persisted plan data. * @param array $plan_data Persisted plan data. * @return array Response data array. */ abstract protected function prepare_plan_for_response($scheme, $plan_data); } /** * REST API controller for storewide subscription plans. * * Registers routes, enforces permissions, extracts request values, and formats * responses. All business logic is handled by WCS_ATT_Plans_Manager. */ class WCS_ATT_REST_Plans_Controller extends \WCS_ATT_REST_Plans_Base_Controller { /** * Route base. * * @var string */ protected $rest_base = 'subscriptions/storewide-plans'; /** * Register the routes for the storewide plans endpoint. * * @since 9.0.0 */ public function register_routes() { } /** * Check if a given request has access to manage storewide plans. * * @since 9.0.0 * * @param WP_REST_Request $request Full details about the request. * @return true|WP_Error True if the request has manage access, WP_Error object otherwise. */ public function manage_plans_permissions_check($request) { } /** * Retrieves the query params for the plans collection. * * @since 9.0.0 * * @return array Collection parameters. */ public function get_collection_params() { } /** * Return the plan type string used to construct the manager. * * @since 9.0.0 * * @return string */ protected function get_plan_type() { } /** * Get the URL parameter name for a single plan. * * @since 9.0.0 * * @return string */ protected function get_plan_id_param() { } /** * Extract storewide plan field values from the request. * * Schema sanitize_callbacks have already run by this point, so no additional * sanitization is needed here. * * @since 9.0.0 * * @param WP_REST_Request $request Current request. * @return array Plan data array. */ protected function get_plan_data_from_request($request) { } /** * Prepare storewide plan data for the REST response. * * @since 9.0.0 * * @param WCS_ATT_Scheme $scheme Scheme object. * @param array $plan_data Persisted plan data. * @return array Response data array. */ protected function prepare_plan_for_response($scheme, $plan_data) { } /** * Retrieves the plan's schema, conforming to JSON Schema. * * @since 9.0.0 * * @return array Item schema data. */ public function get_item_schema() { } } /** * REST API controller for product-level subscription plans. * * Registers routes, enforces permissions, extracts request values, and formats * responses. All business logic is handled by WCS_ATT_Plans_Manager. * Only available in edit context (product must already exist and have an ID). */ class WCS_ATT_REST_Product_Plans_Controller extends \WCS_ATT_REST_Plans_Base_Controller { /** * Route base. * * @var string */ protected $rest_base = 'products/(?P[\d]+)/subscription-plans'; /** * Register the routes for the product plans endpoint. * * @since 9.0.0 */ public function register_routes() { } /** * Check if a given request has access to manage product plans. * * @since 9.0.0 * * @param WP_REST_Request $request Full details about the request. * @return true|WP_Error True if the request has manage access, WP_Error object otherwise. */ public function manage_plans_permissions_check($request) { } /** * Return the plan type string used to construct the manager. * * @since 9.0.0 * * @return string */ protected function get_plan_type() { } /** * Return the product ID as the storage context for the manager. * * @since 9.0.0 * * @param WP_REST_Request $request Current request. * @return int */ protected function get_plan_context($request) { } /** * Get the URL parameter name for a single plan. * * @since 9.0.0 * * @return string */ protected function get_plan_id_param() { } /** * Extract product plan field values from the request. * * Schema sanitize_callbacks have already run by this point, so no additional * sanitization is needed here. Pricing fields are included conditionally * based on the chosen pricing method, matching how they are stored and validated. * * @since 9.0.0 * * @param WP_REST_Request $request Current request. * @return array Plan data array. */ protected function get_plan_data_from_request($request) { } /** * Prepare product plan data for the REST response. * * @since 9.0.0 * * @param WCS_ATT_Scheme $scheme Scheme object. * @param array $plan_data Persisted plan data. * @return array Response data array. */ protected function prepare_plan_for_response($scheme, $plan_data) { } /** * Retrieves the plan's schema, conforming to JSON Schema. * * @since 9.0.0 * * @return array Item schema data. */ public function get_item_schema() { } } class WCS_ATT_Validation { /** * Maximum allowed trial lengths for each period. * * @var array */ const MAX_TRIAL_LENGTHS = array('day' => 90, 'week' => 52, 'month' => 24, 'year' => 5); /** * Valid trial period values. * * @var array */ const VALID_PERIODS = array('day', 'week', 'month', 'year'); /** * Validate trial length based on period. * * @param int $length Trial length value. * @param string $period Trial period (day/week/month/year). * * @return true|WP_Error True if valid, WP_Error on failure. */ public static function validate_trial_length($length, $period) { } /** * Validate signup fee. * * @param float|string $fee Signup fee value. * * @return true|WP_Error True if valid, WP_Error on failure. */ public static function validate_signup_fee($fee) { } /** * Get the maximum trial length for a given period. * * @param string $period Trial period (day/week/month/year). * * @return int|null Maximum length or null if invalid period. */ public static function get_max_trial_length($period) { } /** * Check if a value is valid (returns true if validation passes). * * Helper method to simplify validation checks. * * @param mixed $result The result of a validation method. * * @return bool True if valid, false otherwise. */ public static function is_valid($result) { } /** * Get error message from validation result. * * @param mixed $result The result of a validation method. * * @return string Error message or empty string if valid. */ public static function get_error_message($result) { } /** * Validate subscription period. * * @param string $period Subscription period value. * * @return true|WP_Error True if valid, WP_Error on failure. */ public static function validate_period($period) { } /** * Validate subscription period interval. * * @param int $interval Subscription period interval value. * * @return true|WP_Error True if valid, WP_Error on failure. */ public static function validate_interval($interval) { } /** * Validate subscription trial period. * * @param string $period Trial period value. * * @return true|WP_Error True if valid, WP_Error on failure. */ public static function validate_trial_period($period) { } /** * Maximum subscription duration in periods for 10 years. * * @var array */ const MAX_LENGTH_BY_PERIOD = array('day' => 3650, 'week' => 520, 'month' => 120, 'year' => 10); /** * Validate subscription length. * * @param int $length Subscription length value (number of intervals). * @param string $period Optional. Billing period to validate max duration against. * * @return true|WP_Error True if valid, WP_Error on failure. */ public static function validate_length($length, $period = '') { } /** * Validate subscription payment sync date based on billing period. * * Accepts: * - 0 (integer) — "do not align", valid for any period. * - integer 1-7 — week period (1 = Monday, 7 = Sunday). * - integer 1-28 — month period (capped at 28 so the day exists in every month). * - array {day, month} — year period; validated with checkdate() against a non-leap year * so that Feb 29 is never accepted. * * @param mixed $sync_date Sync date: 0, int, or array {day, month}. * @param string $period Subscription billing period (day/week/month/year). * * @return true|WP_Error True if valid, WP_Error on failure. */ public static function validate_sync_date($sync_date, $period) { } /** * Validate subscription discount percentage. * * @param float|string $discount Discount percentage value. * * @return true|WP_Error True if valid, WP_Error on failure. */ public static function validate_percentage_discount($discount) { } /** * Validate a fixed monetary discount amount. * * Unlike percentage discounts, fixed amounts have no upper bound. * * @param float|string $discount Fixed discount monetary value. * * @return true|WP_Error True if valid, WP_Error on failure. */ public static function validate_fixed_discount($discount) { } /** * Validate override pricing (regular and sale prices). * * @param string|float $regular_price Regular price value. * @param string|float $sale_price Sale price value. * * @return array Array of validation errors (empty if valid). */ public static function validate_override_pricing($regular_price, $sale_price) { } /** * Validate plan data before saving. * * @param array $plan_data Plan data to validate. * * @return array Array of validation errors (empty if valid). */ public static function validate_plan_data($plan_data) { } } /** * WooCommerce core Product Exporter support. * * @class WCS_ATT_Product_Export * @version 4.0.0 */ class WCS_ATT_Product_Export { /** * Hook in. */ public static function init() { } /** * Export Subscription schemes. * * @param mixed $meta_value * @param WC_Meta_Data $meta * @param WC_Product $product * @param array $row * @return string $meta_value */ public static function export_subscription_schemes($meta_value, $meta, $product, $row) { } } /** * WooCommerce core Product Importer support. * * @class WCS_ATT_Product_Import * @version 4.0.0 */ class WCS_ATT_Product_Import { /** * Hook in. */ public static function init() { } /** * Parse Subscription schemes. * * @param array $parsed_data * @param WC_Product_CSV_Importer $importer * @return array $parsed_data */ public static function import_subscription_schemes($parsed_data, $importer) { } } /** * Product meta-box data for SATT-enabled product types. * * @class WCS_ATT_Meta_Box_Product_Data * @version 6.0.5 */ class WCS_ATT_Meta_Box_Product_Data { /** * Initialize. */ public static function init() { } /** * Add hooks. */ private static function add_hooks() { } /** * Add Subscriptions tab. * * @param array $tabs * @return void */ public static function satt_product_data_tab($tabs) { } /** * Product writepanel for Subscriptions. * * @return void */ public static function product_data_panel() { } /** * Save subscription options. * * @param WC_Product $product * @return void */ public static function save_subscription_data($product) { } } /** * Extends the store public API with bundle related data for each bundle parent and child item. * * @version 3.3.2 */ class WCS_ATT_Store_API { /** * Bootstraps the class and hooks required data. */ public static function init() { } /* |-------------------------------------------------------------------------- | Callbacks. |-------------------------------------------------------------------------- */ /** * Validate cart item in Store API context. * * @throws RouteException * * @param WC_Product $product * @param array $cart_item * @return void */ public static function validate_cart_item($product, $cart_item) { } /** * Prevents access to the checkout block if a cart item is misconfigured. * * @throws RouteException * * @param WC_Order $order * @return void */ public static function validate_draft_order($order) { } } /** * Cart support. * * @class WCS_ATT_Cart * @version 6.0.0 */ class WCS_ATT_Cart { /** * Initialize. */ public static function init() { } /** * Hook-in. */ private static function add_hooks() { } /* |-------------------------------------------------------------------------- | Cart item methods |-------------------------------------------------------------------------- */ /** * Returns all subscription schemes associated with a cart item - @see 'WCS_ATT_Product_Schemes::get_subscription_schemes'. * * @since APFS 2.0.0 * * @param array $cart_item * @param string $context * @return array */ public static function get_subscription_schemes($cart_item, $context = 'any') { } /** * Returns the subscription scheme key (to apply) of a cart item, or false if the cart item is a one-time purchase. * * @since APFS 2.0.0 * * @return string|null|false */ public static function get_subscription_scheme($cart_item) { } /** * Get the posted cart-item subscription scheme. * * @since APFS 2.1.0 * * @param string $cart_item_key * @return string */ public static function get_posted_subscription_scheme($cart_item_key) { } /** * Equivalent of 'WC_Cart::get_product_price' that utilizes 'WCS_ATT_Product_Prices::get_price' instead of 'WC_Product::get_price'. * * @since APFS 2.0.0 * * @param WC_Product $product * @param string $scheme_key * @return string */ public static function get_product_price($cart_item, $scheme_key = '') { } /** * Applies a saved subscription key to a cart item. * * @see 'WCS_ATT_Product_Schemes::set_subscription_scheme'. * * @since APFS 2.0.0 * * @param array $cart_item * @return array */ public static function apply_subscription_scheme($cart_item) { } /* |-------------------------------------------------------------------------- | Hooks |-------------------------------------------------------------------------- */ /** * Add scheme data to cart items that can be purchased on a recurring basis. * * @param array $cart_item * @param int $product_id * @param int $variation_id * @return array */ public static function add_cart_item_data($cart_item, $product_id, $variation_id) { } /** * Load saved session data of cart items that can be pruchased on a recurring basis. * * @param array $cart_item * @param array $item_session_values * @return array */ public static function load_cart_item_data_from_session($cart_item, $item_session_values) { } /** * Inspect product-level/cart-level session data and apply subscription schemes to cart items as needed. * * @param WC_Cart $cart * @return void */ public static function apply_subscription_schemes($cart) { } /** * Gets the subscription scheme to apply against a cart item product object on session load. * * @see 'WCS_ATT_Cart::apply_subscription_scheme'. * * @param array $cart_item * @return string|false */ private static function get_subscription_scheme_to_apply($cart_item) { } /** * Inspect product-level/cart-level session data and apply subscription schemes on cart items as needed. * Then, recalculate totals. * * @return void */ public static function apply_subscription_schemes_on_add_to_cart($item_key, $product_id, $quantity, $variation_id, $variation, $item_data) { } /** * Update the subscription scheme saved on a cart item when chosing a new option. * * @param boolean $updated * @return boolean */ public static function update_cart_item_data($updated) { } /** * True if the product corresponding to a cart item is one of the types supported by the plugin. * * @param mixed $arg * @return boolean */ public static function is_supported($arg) { } /** * Validates the subscription schemes applied on a cart item. * * @since APFS 3.3.2 * * @return array */ public static function validate_applied_subscription_scheme($cart_item) { } /** * Validates the subscription schemes applied on cart items. */ public static function check_applied_subscription_schemes() { } /** * Restore selected plan when clicking cart item titles. * * @since APFS 3.1.14 * * @param string $html * @param array $cart_item * @return string */ public static function cart_item_permalink($html, $cart_item) { } } /** * WC Core compatibility functions. * * @class WCS_ATT_Core_Compatibility * @version 6.0.0 */ class WCS_ATT_Core_Compatibility { /** * Cache 'gte' comparison results. * * @var array */ private static $is_wc_version_gte = array(); /** * Current REST request stack. * An array containing WP_REST_Request instances. * * @since APFS 5.0.3 * * @var array */ private static $requests = array(); /** * Constructor. */ public static function init() { } /* |-------------------------------------------------------------------------- | Callbacks. |-------------------------------------------------------------------------- */ /** * Pops the current request from the execution stack. * * @since APFS 5.0.3 * * @param WP_REST_Response $response * @param WP_REST_Server|array $handler * @param WP_REST_Request $request * @return mixed */ public static function pop_rest_request($response) { } /** * Saves the current hydration request. * * @since APFS 5.0.3 * * @param mixed $result * @param WP_REST_Request $request * @return mixed */ public static function save_hydration_request($result, $request) { } /** * Saves the current rest request. * * @since APFS 3.3.2 * * @param mixed $result * @param WP_REST_Server $server * @param WP_REST_Request $request * @return mixed */ public static function save_rest_request($result, $server, $request) { } /* |-------------------------------------------------------------------------- | WC version getters. |-------------------------------------------------------------------------- */ /** * Helper method to get the version of the currently installed WooCommerce * * @since APFS 1.0.0 * @return string woocommerce version number or null */ private static function get_wc_version() { } /** * Returns true if the installed version of WooCommerce is greater than or equal to $version. * * @since APFS 2.0.0 * * @param string $version * @return boolean */ public static function is_wc_version_gte($version) { } /* |-------------------------------------------------------------------------- | Utilities. |-------------------------------------------------------------------------- */ /** * Wrapper for 'get_parent_id' with fallback to 'get_id'. * * @since APFS 2.0.0 * * @param WC_Product $product * @return mixed */ public static function get_product_id($product) { } /** * Wrapper for 'WC_Product_Factory::get_product_type'. * * @since APFS 2.0.0 * * @param mixed $product_id * @return mixed */ public static function get_product_type($product_id) { } /** * Get formatted screen id. * * @since APFS 3.1.20 * * @param string $key * @return string */ public static function get_formatted_screen_id($screen_id) { } /** * Returns the current Store/REST API request or false. * * @since APFS 3.3.2 * * @return WP_REST_Request|false */ public static function get_api_request() { } /** * Whether this is a Store API request. * * @since APFS 3.3.2 * * @param string $route * @return boolean */ public static function is_store_api_request($route = '') { } } /** * Front-end support and single-product template modifications. * * @class WCS_ATT_Display * @version 6.0.0 */ class WCS_ATT_Display { /** * Initialization. */ public static function init() { } /** * Hook-in. */ private static function add_hooks() { } /* |-------------------------------------------------------------------------- | Filters |-------------------------------------------------------------------------- */ /** * Front end styles and scripts. * * Loads webpack-generated APFS frontend styles and consolidated JavaScript bundle. * RTL styles are automatically generated by webpack. * JavaScript bundle includes both single-add-to-cart.js and cart.js functionality. * * @return void */ public static function frontend_scripts() { } } /** * Product Bundle Helper Functions. * * @class WCS_ATT_Helpers * @version 2.3.0 */ class WCS_ATT_Helpers { /** * Runtime cache for simple storage. * * @var array */ public static $cache = array(); /** * Simple runtime cache getter. * * @param string $key * @param string $group_key * @return mixed */ public static function cache_get($key, $group_key = '') { } /** * Simple runtime cache setter. * * @param string $key * @param mixed $value * @param string $group_key * @return void */ public static function cache_set($key, $value, $group_key = '') { } } /** * Compatibility with other extensions. * * @class WCS_ATT_Integrations * @version 6.0.0 */ class WCS_ATT_Integrations { /** * Min required plugin versions to check. * * @var array */ private static $required = array(); /** * Cache block based cart detection result. * * @since APFS 3.3.0 * @var array */ private static $is_block_based_cart = \null; /** * Initialize. */ public static function init() { } /** * Declare HPOS (Custom Order tables) compatibility. * * @since APFS 4.0.3 * @deprecated 9.1.0 No longer used. Subscriptions declares HPOS compatibility for the main plugin file; this is now a no-op kept for backwards compatibility. */ public static function declare_hpos_compatibility() { } /** * Declare cart/checkout Blocks compatibility. * * @since APFS 4.1.4 * @deprecated 9.1.0 No longer used. Cart & Checkout Blocks are compatible by default in WooCommerce; this is now a no-op kept for backwards compatibility. */ public static function declare_blocks_compatibility() { } /** * Checks versions of compatible/integrated/deprecated extensions. * * @since APFS 2.4.0 * * @return void */ public static function display_notices() { } /** * Whether the cart page contains the cart block. * * @since APFS 3.3.0 * * @param string $route * @return boolean */ public static function is_block_based_cart() { } } /** * Order hooks for saving/restoring the subscription state of a product to/from order item data. * * @class WCS_ATT_Order * @version 6.0.3 */ class WCS_ATT_Order { /** * Initialization. */ public static function init() { } /** * Hook-in. */ private static function add_hooks() { } /* |-------------------------------------------------------------------------- | API |-------------------------------------------------------------------------- */ /** * Returns the key of the subscription scheme applied on the product when it was purchased. * * @param array $order_item * @param array $args * @return string|false|null */ public static function get_subscription_scheme($order_item, $args = array()) { } /** * Returns a summary of the products included in an order/subscription. * * @since APFS 3.4.0 * * @param WC_Order|int $order * @param array $args * @return string|array */ public static function get_contents_summary($order, $args = array()) { } /* |-------------------------------------------------------------------------- | Hooks |-------------------------------------------------------------------------- */ /** * Attempts to restore subscription data when creating a cart item using an order item as reference. * * @param array $cart_item * @param array $order_item * @param WC_Order $order * @return array */ public static function restore_cart_item_from_order_item($cart_item, $order_item, $order) { } /** * Attempts to restore the subscription state of a product instantiated using an order item as reference. * * @param WC_Product $product * @param array $order_item * @return WC_Product */ public static function restore_product_from_order_item($product, $order_item) { } /** * Stores the scheme key on the order item when checking out. * Used for reconstructing the scheme when reordering, resubscribing, etc - @see 'WCS_ATT_Cart::add_cart_item_data'. * * @param WC_Order_Item $order_item * @param string $cart_item_key * @param array $cart_item * @return void */ public static function save_subscription_scheme_meta($order_item, $cart_item_key, $cart_item) { } /** * Sets _has_trial on APFS subscription line items that have a trial period. * * WC_Subscriptions_Checkout::maybe_add_free_trial_item_meta() (priority 10) misses APFS trials * because $item->get_product() creates a fresh product object without APFS runtime meta. * We run at priority 11 and read trial_length from $cart_item['data'] which carries the * runtime meta set by WCS_ATT_Product_Schemes::set_subscription_scheme(). * * _has_trial is required by WC_Subscription::get_items_sign_up_fee() to correctly return the * full initial amount paid rather than (order_line_total - subscription_line_total). * * @since 9.0.0 * * @param WC_Order_Item_Product $item The line item being created. * @param string $_cart_item_key The cart item key. * @param array $cart_item The cart item data. * @param WC_Order|WC_Subscription $order The order or subscription being created. */ public static function maybe_add_apfs_free_trial_item_meta($item, $_cart_item_key, $cart_item, $order) { } /** * Hides subscription scheme metadata. * * @since APFS 2.1.0 * * @param array $hidden * @return array */ public static function hidden_order_item_meta($hidden) { } /** * Modify scheme meta key for switching context. * * @since APFS 2.5.0 * * @param string $label * @return string */ public static function modify_scheme_attribute_label($label) { } /** * When adding a new product to a subscription, apply scheme discounts * if a scheme with the same billing schedule as the subscription is found. * * @param int $item_id * @param WC_Order_Item $item * @param int $order_id */ public static function apply_matching_scheme_discount_to_order_item($item_id, $item, $order_id) { } } /** * Product data parallel structure for storing product properties. * * @class WCS_ATT_Product_Data * @version 5.0.1 */ class WCS_ATT_Product_Data { /** * @var WCS_ATT_Product_Data - the single instance of the class. */ protected static $_instance = \null; /** * @var array - the instance's data. */ protected $data = array(); /** * Main WCS_ATT_Product_Data Instance. * * Ensures only one instance of WCS_ATT_Product_Data is loaded or can be loaded. * * @static * @return WCS_ATT_Product_Data - Main instance */ public static function instance() { } /** * Overriding the constructor with a private one prevents calling it directly. */ private function __construct() { } /** * Cloning is forbidden. */ public function __clone() { } /** * Unserializing instances of this class is forbidden. * * @since APFS 1.0.0 */ public function __wakeup() { } /** * Gets product data. * * @param WC_Product $product * @param string $key * @param null|string $default * * @return string */ public function get($product, $key, $default = \null) { } /** * Sets product data. * * @param WC_Product $product * @param string $key * @param string $value */ public function set($product, $key, $value) { } /** * Deletes product data. * * @param WC_Product $product * @param string $key * * @return boolean */ public function delete($product, $key) { } } /** * API for working with subscription-enabled product objects. * * @class WCS_ATT_Product * @version 6.0.7 */ class WCS_ATT_Product { /** * Local runtime meta store for performance. * * @var array */ private static $runtime_meta = array(); /** * Own implementation of 'spl_object_hash'; * * @var integer */ private static $object_instance_count = 0; /** * DB meta expected by WCS that needs to be added by SATT at runtime. * * @var array */ private static $subscription_product_type_meta_keys = array('subscription_price', 'subscription_period', 'subscription_period_interval', 'subscription_length', 'subscription_trial_period', 'subscription_trial_length', 'subscription_sign_up_fee', 'subscription_payment_sync_date', 'wcs_switch_totals_calc_base_length'); /** * Include Product API price and scheme components and add hooks. */ public static function init() { } /** * Hook-in. */ private static function add_hooks() { } /* |-------------------------------------------------------------------------- | Conditionals |-------------------------------------------------------------------------- */ /** * Determines if a subscription scheme is set on the product object. * * @param WC_Product $product Product object to check. * @return boolean Result of check. */ public static function is_subscription($product) { } /** * Checks a product object to determine if it is a WCS subscription-type product. * * @param WC_Product $product Product object to check. * @return boolean Result of check. */ public static function is_subscription_product_type($product) { } /** * Checks if a product has any existing subscription configuration. * * A product has subscription configuration if any of these meta keys exist: * - _wcsatt_schemes_status (the authoritative mode key, set on first save) * - _wcsatt_disabled (legacy: product set to "Sell one-time only") * - _wcsatt_schemes (product has custom subscription plans) * - _wcsatt_storewide_selection_mode (product uses storewide plans) * * For variations, this method can optionally check the parent product if the * variation itself has no subscription configuration. * * @param WC_Product $product Product object to check. * @param bool $check_parent Whether to check parent product for variations (default: true). * @return bool True if product has subscription configuration, false otherwise. */ public static function has_subscription_config($product, $check_parent = \true) { } /** * Checks if a single product object has subscription meta keys. * * This is a helper method for has_subscription_config() to avoid code duplication. * * @param WC_Product $product Product object to check. * @return bool True if product has subscription meta keys, false otherwise. */ private static function check_product_subscription_meta($product) { } /** * Query for support of SATT features. * * @param WC_Product $product Product object to check. * @param string $feature Feature. * @param array $args Additional arguments. * @return boolean Result. */ public static function supports_feature($product, $feature, $args = array()) { } /* |-------------------------------------------------------------------------- | Filters |-------------------------------------------------------------------------- */ /** * Hooks onto 'woocommerce_is_subscription' to trick WCS into thinking it is dealing with a subscription-type product. * * @param boolean $is * @param int $product_id * @param WC_Product $product * @return boolean */ public static function filter_is_subscription($is, $product_id, $product) { } /** * Make sure One-Time Shipping state is transferred from variations to parent products in the cart. * * @since APFS 2.2.0 * * @param boolean $needs_one_time_shipping * @param mixed $product * @param mixed $product * @return boolean */ public static function filter_needs_one_time_shipping($needs_one_time_shipping, $product, $variation = \false) { } /** * Delete object meta in use by the application layer. * Note that the subscription state of a product object: * * 1. Cannot be persisted in the DB. * 2. Is lost when the object is saved. * * This is intended behavior. * * @param WC_Product $product */ public static function delete_runtime_meta($product) { } /** * Prevent runtime meta from being saved on the product object * when 'save_meta_data' is called without a subsequent 'save' call. * * @param null|bool $check Whether to allow updating metadata for the given type. * @param int $object_id ID of the object metadata is for. * @param string $meta_key Metadata key. */ public static function ignore_satt_runtime_meta($check, $object_id, $meta_key) { } /* |-------------------------------------------------------------------------- | Helpers |-------------------------------------------------------------------------- */ /** * Property getter (compatibility wrapper). * * @param WC_Product $product Product object. * @param string $key Runtime meta key name. * @return mixed */ public static function get_runtime_meta($product, $key) { } /** * Property setter (compatibility wrapper). * * @param WC_Product $product Product object. * @param string $key Runtime meta key name. * @param string $value Property value. * @return mixed */ public static function set_runtime_meta($product, $key, $value) { } /** * Get unique identifier for product instances. * * @since APFS 2.4.0 * * @param WC_Product $product * @return string */ public static function get_instance_id($product) { } /** * Get the subscription scheme mode for a product. * * Reads the persisted `_wcsatt_schemes_status` meta key. For legacy products that * don't have this key, infers the mode from which meta keys exist. * * Does not check parent products — only reads from the given product object. * * @since 9.0.0 * * @param WC_Product $product The product to check. * @return string The mode. One of the WCS_ATT_Scheme::MODE_* constants. */ public static function get_subscription_scheme_mode($product) { } /** * Set the subscription scheme mode for a product. * * Persists `_wcsatt_schemes_status` as the authoritative mode key and sets * `_wcsatt_disabled` for backward compatibility. All other data (custom schemes, * storewide settings) is preserved in place — the mode key determines which is active. * * Does NOT call `$product->save()` - the caller is responsible for saving. * * @since 9.0.0 * * @param WC_Product $product The product to update. * @param string $mode The mode to set. One of the WCS_ATT_Scheme::MODE_* constants. */ public static function set_subscription_scheme_mode($product, $mode) { } /** * Get the default subscription scheme mode for products without existing subscription settings. * * This determines how new products (or products without subscriptions configuration) should * handle subscription offerings by default. * * @since 9.0.0 * * @return string The default mode. */ public static function get_default_subscription_scheme_mode() { } } /** * Subscription scheme object. May extend the WC_Data class or handle CRUD in the future, if schemes are moved out of meta. * * @class WCS_ATT_Scheme * @version 4.0.2 */ class WCS_ATT_Scheme implements \ArrayAccess { /** * Scheme data. * * @var array */ private $data = array(); /** * Scheme key - a string representation of the scheme details. * * @var array */ private $key = ''; /** * Maps meta array key names to object data keys for back-compat. * * @var array */ private $offset_map = array('subscription_period' => 'period', 'subscription_period_interval' => 'interval', 'subscription_length' => 'length', 'subscription_payment_sync_date' => 'sync_date', 'subscription_trial_period' => 'trial_period', 'subscription_trial_length' => 'trial_length', 'subscription_pricing_method' => 'pricing_mode', 'subscription_discount' => 'discount', 'subscription_regular_price' => 'regular_price', 'subscription_sale_price' => 'sale_price', 'subscription_price' => 'price', 'subscription_signup_fee' => 'signup_fee'); // Product mode constants. /** * Sell one-time only. */ const MODE_DISABLE = 'disable'; /** * Add custom subscription plans. */ const MODE_OVERRIDE = 'override'; /** * Use storewide subscription plans. */ const MODE_INHERIT = 'inherit'; /** * Apply a fixed monetary discount to the product price. */ const MODE_FIXED_DISCOUNT = 'fixed_discount'; /** * Check if a given string is a valid product subscription scheme mode. * * @since 8.6.0 * * @param string $mode The mode to validate. * @return bool */ public static function is_valid_mode($mode) { } /** * Constructor. Currently only initializes the object from raw data. * Later, it could initialize using other source data, such as a DB ID. * * @param array $args */ public function __construct($args) { } /** * Updates the 'is_synced' prop. * * @return void */ protected function update_sync_status() { } /** * Returns a string representation of the scheme details. * * @return string A string representation of the entire scheme. */ public function get_key() { } /** * Returns the raw scheme data array. * * @return array */ public function get_data() { } /** * Returns a md5 hash of the scheme's data array. * * @since APFS 2.1.1 * * @return array */ public function get_hash() { } /** * Gets the scheme context. * * This property serves a dual purpose: * - Application context: where the scheme is applied ('product', 'cart', 'any'). * - Scheme origin: where the scheme data comes from ('local', 'global'). * * @return string */ public function get_context() { } /** * Returns the period of the subscription scheme. * * @return string A string representation of the period, either Day, Week, Month or Year. */ public function get_period() { } /** * Returns the interval of the subscription scheme. * * @return int Interval of subscription scheme, or an empty string if the product has not been associated with a subscription scheme. */ public function get_interval() { } /** * Returns the length of the subscription scheme. * * @return int An integer representing the length of the subscription scheme. */ public function get_length() { } /** * Returns the trial period of the subscription scheme. * * @return string A string representation of the trial period, either Day, Week, Month or Year. */ public function get_trial_period() { } /** * Returns the trial length of the subscription scheme. * * @return int An integer representing the trial length of the subscription scheme. */ public function get_trial_length() { } /** * Returns the signup fee of the subscription scheme. * * @since 9.0.0 * * @return float The signup fee amount, or 0 if not set. */ public function get_signup_fee(): float { } /** * Returns the sync day (integer) or sync month/day (array) of this scheme. * * @since APFS 2.1.0 * * @return mixed */ public function get_sync_date() { } /** * Whether the first payment is processed at the time of sign-up but prorated to the sync day. * * @since APFS 2.1.0 */ public function is_prorated() { } /** * Whether the first payment needs to be processed on a specific day (instead of at the time of sign-up). * * @since APFS 2.1.0 */ public function is_synced() { } /** * Returns the pricing mode of the scheme - 'inherit', 'override', or 'fixed_discount'. * Indicates how the subscription scheme modifies the price of a product when active. * * @return string String with values 'inherit', 'override', or 'fixed_discount'. */ public function get_pricing_mode() { } /** * Returns the price discount applied by the scheme when its pricing mode is 'inherit' or 'fixed_discount'. * * @return mixed */ public function get_discount() { } /** * Returns the overridden regular price applied by the scheme when its pricing mode is 'override'. * * @return mixed */ public function get_regular_price() { } /** * Returns the overridden sale price applied by the scheme when its pricing mode is 'override'. * * @return mixed */ public function get_sale_price() { } /** * Returns modified prices based on subscription scheme settings. * * @param array $raw_prices * @return string */ public function get_prices($raw_prices) { } /** * Get price after discount. * * @param array $raw_prices * @param string $discount * @return mixed */ protected function get_discounted_price($raw_prices) { } /* |-------------------------------------------------------------------------- | Conditionals. |-------------------------------------------------------------------------- */ /** * Indicates whether the scheme uses a discount-based pricing mode ('inherit' or 'fixed_discount'). * * @since 9.0.0 * * @return boolean */ public function is_discount_mode() { } /** * Indicates whether the scheme modifies the price of the product it's attached onto when active. * * @return boolean */ public function has_price_filter() { } /** * Indicates whether the billing details of a subscription match the billing details of this scheme. * * @since APFS 2.1.0 * * @param WC_Subscription $subscription * @param array $args * @return boolean */ public function matches_subscription($subscription, $args = array()) { } /** * Indicates whether the scheme has a trial period configured. * * @since 9.0.0 * * @return bool True if the scheme has a trial period, false otherwise. */ public function has_trial(): bool { } /** * Indicates whether the scheme has a signup fee configured. * * @since 9.0.0 * * @return bool True if the scheme has a signup fee, false otherwise. */ public function has_signup_fee(): bool { } /** * Whether the scheme requires an upfront charge adjustment (prorated first payment or signup fee) * which makes it incompatible with the "add to existing subscription" flow. * * @since 9.0.0 * * @param WC_Product $product The product being checked. * @param string $scheme_key The scheme key (defaults to this scheme's key). * @return bool */ public function requires_upfront_charge($product, $scheme_key = '') { } /* |-------------------------------------------------------------------------- | Setters. |-------------------------------------------------------------------------- */ /** * Sets the scheme context. * * This property serves a dual purpose: * - Application context: where the scheme is applied ('product', 'cart', 'any'). * - Scheme origin: where the scheme data comes from ('local', 'global'). * * @param string $value */ public function set_context($value) { } /** * Sets the period of the subscription scheme. Does not validate input. * * @param string $value */ public function set_period($value) { } /** * Sets the interval of the subscription scheme. * * @param int $value */ public function set_interval($value) { } /** * Sets the length of the subscription scheme. * * @param int $value */ public function set_length($value) { } /** * Sets the trial period of the subscription scheme. * * @param string $value */ public function set_trial_period($value) { } /** * Sets the trial length of the subscription scheme. * * Validates the value using WCS_ATT_Validation before setting. * If validation fails, an InvalidArgumentException is thrown. * * @since 9.0.0 * * @param int $value The trial length value. * @throws InvalidArgumentException When validation fails. */ public function set_trial_length($value) { } /** * Sets the signup fee of the subscription scheme. * * Validates the value using WCS_ATT_Validation before setting. * If validation fails, an InvalidArgumentException is thrown. * * @since 9.0.0 * * @param float|string $value The signup fee amount. * @throws InvalidArgumentException When validation fails. */ public function set_signup_fee($value): void { } /** * Sets the pricing mode of the scheme - 'inherit', 'override', or 'fixed_discount'. * Indicates how the subscription scheme modifies the price of a product when active. * * @param string $value */ public function set_pricing_mode($value) { } /** * Sets the price discount applied by the scheme when its pricing mode is 'inherit' or 'fixed_discount'. * * @param mixed $value */ public function set_discount($value) { } /** * Sets the overridden regular price applied by the scheme when its pricing mode is 'override'. * * @param mixed $value */ public function set_regular_price($value) { } /** * Sets the overridden sale price applied by the scheme when its pricing mode is 'override'. * * @param mixed $value */ public function set_sale_price($value) { } /** * Sets the sync date. * * @param mixed $value */ public function set_sync_date($value) { } /* |-------------------------------------------------------------------------- | Array access methods. |-------------------------------------------------------------------------- */ #[\ReturnTypeWillChange] public function offsetGet($offset) { } #[\ReturnTypeWillChange] public function offsetExists($offset) { } #[\ReturnTypeWillChange] public function offsetSet($offset, $value) { } #[\ReturnTypeWillChange] public function offsetUnset($offset) { } } /** * Handles synchronization. * * @class WCS_ATT_Sync * @version 4.1.0 */ class WCS_ATT_Sync { /** * Initialization. */ public static function init() { } /** * Hook-in. */ private static function add_hooks() { } /** * Determines if the first payment of a product is prorated, assuming a scheme is set on it. * * @since APFS 2.1.0 * * @param WC_Product $product Product object to check. * @param string|WCS_ATT_Scheme $scheme Optional scheme key when checking against one of the schemes already tied to the object, or an arbitrary 'WCS_ATT_Scheme' object to check against. * @return boolean Result. */ public static function is_first_payment_prorated($product, $scheme = '') { } /* |-------------------------------------------------------------------------- | Hooks |-------------------------------------------------------------------------- */ /** * Renders subscription scheme synchronization options. * * @param int $index * @param array $scheme_data * @param int $post_id * @return void */ /** * Keep it short. Rename "Do not synchronise" to "Disabled". Pointless but blame OCD. * * @param array $range_data * @return array */ private static function rename_subscription_billing_period_range_data($range_data) { } /** * Save subscription sync options. * * @param array $scheme * @return void */ public static function process_scheme_sync_data($scheme_data) { } /** * Add translated syncing options for our client side script. * * @param array $script_parameters */ public static function admin_script_parameters($script_parameters) { } /** * Set subscription payment sync data on product objects. * * @param string $scheme_key * @param string $active_scheme_key * @param WC_Product $product */ public static function set_product_subscription_scheme_sync_date($scheme_key, $active_scheme_key, $product) { } } /** * Cart template modifications. * * @class WCS_ATT_Display_Cart * @version 6.0.0 */ class WCS_ATT_Display_Cart { /** * Runtime cache. * * @var bool */ private static $display_prices_incl_tax; /** * Initialize. */ public static function init() { } /** * Hook-in. */ private static function add_hooks() { } /* |-------------------------------------------------------------------------- | Functions |-------------------------------------------------------------------------- */ /** * Back-compat wrapper for 'WC_Cart::display_price_including_tax'. * * @since APFS 3.1.15 * * @return string */ public static function display_prices_including_tax() { } /* |-------------------------------------------------------------------------- | Filters |-------------------------------------------------------------------------- */ /** * Previously rendered an in-cart plan switcher in the cart item Price column. * * As of WOOSUBS-1738 the classic cart & checkout match the block presentation, which deliberately does not allow * changing a line item's subscription plan in the cart — they simply reflect the plan chosen on the product page. * The switcher is therefore no longer rendered and the price is returned unchanged. * * This callback stays registered on 'woocommerce_cart_item_price' (prio 1000) so integrations that detect it — e.g. * WCS_ATT_Integration_PB_CP's container price formatting, which calls has_filter() for this method — keep working. * * @param string $price * @param array $cart_item * @param string $cart_item_key * @return string */ public static function show_cart_item_subscription_options($price, $cart_item, $cart_item_key) { } } /** * Single-product template modifications. * * @class WCS_ATT_Display_Product * @version 4.1.0 */ class WCS_ATT_Display_Product { /** * Initialization. */ public static function init() { } /** * Single-product display hooks. */ private static function add_hooks() { } /** * Options for purchasing a product once or creating a subscription from it. * * @param WC_Product $product * @param WC_Product|null $parent_product * @return void */ public static function get_subscription_options_content($product, $parent_product = \null) { } /** * Returns the signup fee adjusted for the store's tax display setting. * * @since 9.0.0 * * @param float $signup_fee Raw signup fee. * @param WC_Product $product Product (needed for tax class context). * @return float */ private static function get_display_signup_fee($signup_fee, $product) { } /** * Returns the human-readable trial length label for the "Free trial:" detail line, e.g. "1 week" or "7 days". * * wcs_get_subscription_period_strings() returns only the singular period name (e.g. "week") for a length of 1, * so the count is prepended in that case to avoid a label that reads "Free trial: week". * * @since 9.0.0 * * @param int $trial_length Trial length. * @param string $trial_period Trial period (day, week, month, year). * @return string Empty string when there is no trial. */ public static function get_trial_length_label($trial_length, $trial_period) { } /** * Formats a dropdown description by cleaning up an html price string and replacing the price in a placeholder. * * @since APFS 3.0.0 * * @param string $dropdown_details_html * @param WC_Product $product * @param WCS_ATT_Scheme $subscription_scheme * @param array $args * @return string */ public static function format_subscription_options_dropdown_description($dropdown_details_html, $product, $subscription_scheme, $args = array()) { } /** * Controls where variation subscription scheme options will be rendered: In the variation data array's 'price_html' key, or before the add to cart button. * * @since APFS 2.3.1 * * @param WC_Product_Variable $variable_product * @return bool */ protected static function modify_variation_data_price_html($variable_product) { } /** * Label for subscription plans dropdown. * * @since APFS 3.0.0 * * @param WC_Product $product * @return string */ protected static function get_subscription_options_dropdown_label($product) { } /** * Returns the subscription options text prompt. * * @since APFS 3.0.0 * * @param WC_Product $product * @return string */ public static function get_subscription_options_prompt_text($product) { } /** * Returns the subscription options layout. * * @since APFS 3.0.0 * * @param WC_Product $product * @return string */ public static function get_subscription_options_layout($product) { } /** * Return add-to-cart button replacement text when choosing a subscription plan. * Returns null if the text should not be modified. * * @since APFS 3.0.0 * * @param WC_Product $product * @return string|null */ public static function get_subscription_options_button_text($product) { } /* |-------------------------------------------------------------------------- | Filters |-------------------------------------------------------------------------- */ /** * Replace plain variation price html with subscription options template. * Subscription options are updated by the core variations script when a variation is selected. * * @param array $variation_data * @param WC_Product_Variable $variable_product * @param WC_Product_Variation $variation_product * @return array */ public static function add_subscription_options_to_variation_data($variation_data, $variable_product, $variation_product) { } /** * Displays single-product options for purchasing a product once or creating a subscription from it. * * @return void */ public static function show_subscription_options() { } /** * Renders the trial and sign-up fee detail lines below the price for products with a single forced plan. * * With a single forced plan there is nothing to choose, so the options selector (and its detail lines) is hidden. * This outputs the detail lines just below the price instead — the same placement legacy subscription products use * (@see WC_Subscriptions_Product::output_subscription_price_details()) — so both look identical. * * @since 9.0.0 * * @return void */ public static function show_single_plan_price_details() { } /** * Overrides the single-product add-to-cart button text with "Sign up". * * @since APFS 1.1.1 * * @param string $button_text * @param WC_Product $product * @return string */ public static function single_add_to_cart_text($button_text, $product) { } /** * Whether to prompt users to choose a plan in the catalog. * * @since APFS 4.0.0 * * @param WC_Product $product */ public static function prompt_plan_selection_in_catalog($product) { } /** * Changes the shop add-to-cart button text when a product has subscription options. * * @since APFS 2.0.0 * * @param string $button_text * @param WC_Product $product * @return string */ public static function add_to_cart_text($button_text, $product) { } /** * Changes the shop add-to-cart button action when a product has subscription options. * * @since APFS 2.0.0 * * @param string $url * @param WC_Product $product * @return string */ public static function add_to_cart_url($url, $product) { } /** * Changes the shop add-to-cart button URL when a product has subscription options. * * @since APFS 2.0.0 * * @param array $supports * @param string $feature * @param WC_Product $product * @return string */ public static function supports_ajax_add_to_cart($supports, $feature, $product) { } /** * Add product page class if a product has subscription plans. * * @since APFS 3.0.0 * * @param array $classes * @param WC_Product $product */ public static function add_product_class($classes, $class, $product_id) { } } /** * Compatibility with AfterPay. * * @class WCS_ATT_Integration_AfterPay * @version 3.3.2 */ class WCS_ATT_Integration_AfterPay { /** * Hook used in the single product page to display AfterPay buttons -- default = woocommerce_single_product_summary. * * @var string */ private static $single_product_page_hook = ''; /** * Priority of the hook stored in $single_product_page_hook -- default = 15. * * @var int */ private static $single_product_page_hook_priority = 15; /** * Hook used in the category page to display AfterPay buttons -- default = 'woocommerce_after_shop_loop_item_title'. * * @var string */ private static $category_page_hook = ''; /** * Priority of the hook stored in $category_page_hook -- default = 99. * * @var int */ private static $category_page_hook_priority = 99; /** * Instance of the AfterPay Gateway class. * * @var WC_Gateway_Afterpay */ private static $gateway = ''; /** * Initialize. */ public static function init() { } /** * Hooks for AfterPay support. */ private static function add_hooks() { } /** * Hide AfterPay buttons in the single product page for products with Subscription plans. */ public static function single_product_page_handler() { } /** * Hide AfterPay buttons in category pages for products with Subscription plans. */ public static function category_page_handler() { } /** * Hide AfterPay buttons in the cart for products with Subscription plans. */ public static function cart_page_handler() { } } /** * WooCommerce Blocks Compatibility. * * @version 3.3.2 */ class WCS_ATT_Integration_Blocks { /** * Initialize. */ public static function init() { } } /** * Flatsome integration. * * @version 4.1.5 */ class WCS_ATT_Integration_FS { public static function init() { } /** * Add hooks if the active parent theme is Flatsome. */ public static function maybe_add_hooks() { } /** * Initializes subscriptions in quick view modals. * * @return array */ public static function add_quickview_integration() { } } /** * Compatibility with Name Your Price. * * @class WCS_ATT_Integration_NYP * @version 2.3.1 */ class WCS_ATT_Integration_NYP { /** * Initialize. */ public static function init() { } /** * Hooks for NYP support. */ private static function add_hooks() { } /** * Helper function to prevent subscription plan option prices from appearing as empty strings. * Prevents NYP from emptying price strings + makes empty price string go through WCS price filters. */ public static function before_subscription_option_get_price_html() { } /** * See 'before_subscription_option_get_price_html'. */ public static function after_subscription_option_get_price_html() { } /* |-------------------------------------------------------------------------- | Hooks. |-------------------------------------------------------------------------- */ /** * Makes empty price string go through WCS price filters. * * @param string $price_html * @param WC_Product $product * @return string */ public static function before_subscription_option_empty_price_html($price_html, $product) { } /** * Clear discount data if NYP is enabled. * * @param array $schemes * @param WC_Product $product * @return array */ public static function reset_discount_data($schemes, $product) { } /** * Use alternative method to render variation options. * * @param bool $modify * @param WC_Product_Variable $variable_product * @return bool */ public static function modify_variation_data_price_html($modify, $variable_product) { } } /** * Compatibility with Product Add-Ons. * * @class WCS_ATT_Integration_PAO * @version 6.0.6 */ class WCS_ATT_Integration_PAO { /** * Initialize. */ public static function init() { } /** * Hooks for PAO support. */ private static function add_hooks() { } /* |-------------------------------------------------------------------------- | Helpers |-------------------------------------------------------------------------- */ /** * Whether to apply price discounts after addons have been added to the product price. * Important: Does not work with "Override Price" plans. * * @since APFS 2.4.0 * * @param WC_Product $product * @return boolean */ public static function discount_addons($product) { } /** * Used to tell if a product has (required) addons. * * @since APFS 2.3.0 * * @param mixed $product * @param boolean $required * @return boolean */ public static function has_addons($product, $required = \false) { } /* |-------------------------------------------------------------------------- | Hooks - Application |-------------------------------------------------------------------------- */ /** * Add price data to one-time option. * * @param array $data * @param WC_Product $product * @return array */ public static function maybe_add_one_time_option_price_data($data, $product, $parent_product) { } /** * Add price data to subscription options. * * @param array $data * @param WC_Product $product * @return array */ public static function maybe_add_subscription_option_price_data($data, $scheme, $product, $parent_product) { } /** * Add price data to SATT options. * * @param array $data * @param WC_Product $product * @return array */ public static function maybe_add_option_price_data($data, $scheme_key, $product, $parent_product) { } /** * Triggers the re-calculation of the 'price_offset' runtime meta when * the cart item quantity changes. * * @since APFS 6.0.6 * * @param string $cart_item_key Cart item key. */ public static function sync_price_offset($cart_item_key) { } /** * Aggregate add-ons costs and calculate them after APFS has applied discounts. * * @since APFS 2.4.0 * * @param array $cart_item * @return array */ public static function backup_addons_price($cart_item) { } /** * Replace scheme option price html with discount. * * @since APFS 2.4.0 * * @param array $args * @param WCS_ATT_Scheme $scheme * @param WC_Product $product * @param WC_Product|null $parent_product * @return array */ public static function show_option_discount($args, $scheme, $product, $parent_product) { } /** * Add data to determine if addons will be discounted. * * @since APFS 2.4.0 * * @return array */ public static function add_discount_addons_data() { } /** * Filter add-on prices when dealing with single-plan forced subscription products. * * @since APFS 2.4.0 * * @param string $price * @return array */ public static function filter_addons_price($price) { } /** * Use alternative method to render variation options. * * @since APFS 2.4.1 * * @param bool $modify * @param WC_Product_Variable $variable_product * @return bool */ public static function modify_variation_data_price_html($modify, $variable_product) { } } /** * PayPal Compatibility. * * @version 5.0.5 */ class WCS_ATT_PayPal_Compatibility { // Hide smart buttons in product pages when products have Subscription plans. public static function init() { } /** * Hide smart buttons in product pages when the product has any Subscription plans. * * @param bool $is_supported * @param WC_Product $product * * @return bool */ public static function handle_smart_buttons($is_supported, $product) { } } /** * Compatibility with Product Bundles and Composite Products. * * @class WCS_ATT_Integration_PB_CP * @version 9.0.0 */ class WCS_ATT_Integration_PB_CP { /** * Complex product types integrated with SATT. * * @var array */ private static $bundle_types = array(); /** * Complex type container cart item getter function names. * * @var array */ private static $container_cart_item_getters = array(); /** * Complex type container order item getter function names. * * @var array */ private static $container_order_item_getters = array(); /** * Complex type container cart item getter function names. * * @var array */ private static $child_cart_item_getters = array(); /** * Complex type container order item getter function names. * * @var array */ private static $child_order_item_getters = array(); /** * Complex type container cart item conditional function names. * * @var array */ private static $container_cart_item_conditionals = array(); /** * Complex type container order item conditional function names. * * @var array */ private static $container_order_item_conditionals = array(); /** * Complex type container cart item conditional function names. * * @var array */ private static $child_cart_item_conditionals = array(); /** * Complex type container order item conditional function names. * * @var array */ private static $child_order_item_conditionals = array(); /** * Runtime cache. * * @since APFS 2.4.0 * @var array */ private static $cache = array(); /** * Initialize. */ public static function init() { } /** * Hooks for PB/CP support. */ private static function add_hooks() { } /* |-------------------------------------------------------------------------- | Helpers |-------------------------------------------------------------------------- */ /** * Checks if the passed product is of a supported bundle type. Returns the type if yes, or false if not. * * @param WC_Product $product * @return boolean */ public static function is_bundle_type_product($product) { } /** * Given a bundle-type child cart item, find and return its container cart item or its cart id when the $return_id arg is true. * * @param array $cart_item * @param array $cart_contents * @param boolean $return_id * @return mixed */ public static function get_bundle_type_cart_item_container($cart_item, $cart_contents = \false, $return_id = \false) { } /** * Given a bundle-type container cart item, find and return its child cart items - or their cart ids when the $return_ids arg is true. * * @param array $cart_item * @param array $cart_contents * @param boolean $return_ids * @return mixed */ public static function get_bundle_type_cart_items($cart_item, $cart_contents = \false, $return_ids = \false) { } /** * True if a cart item appears to be a bundle-type container item. * * @param array $cart_item * @return boolean */ public static function is_bundle_type_container_cart_item($cart_item) { } /** * True if a cart item is part of a bundle-type product. * * @param array $cart_item * @param array $cart_contents * @return boolean */ public static function is_bundle_type_cart_item($cart_item, $cart_contents = \false) { } /** * Given a bundle-type child order item, find and return its container order item or its order item id when the $return_id arg is true. * * @param array $order_item * @param WC_Order $order * @param boolean $return_id * @return mixed */ public static function get_bundle_type_order_item_container($order_item, $order = \false, $return_id = \false) { } /** * Given a bundle-type container order item, find and return its child order items - or their order item ids when the $return_ids arg is true. * * @param array $order_item * @param WC_Order $order * @param boolean $return_ids * @param boolean $deep * @return mixed */ public static function get_bundle_type_order_items($order_item, $order = \false, $return_ids = \false, $deep = \false) { } /** * True if an order item appears to be a bundle-type container item. * * @param array $order_item * @param WC_Order $order * @return boolean */ public static function is_bundle_type_container_order_item($order_item, $order = \false) { } /** * True if an order item is part of a bundle-type product. * * @param array $cart_item * @param WC_Order $order * @return boolean */ public static function is_bundle_type_order_item($order_item, $order = \false) { } /** * True if there are sub schemes inherited from a container. * * @param array $cart_item * @return boolean */ private static function has_scheme_data($cart_item) { } /** * WC_Product_Bundle 'contains_sub' back-compat wrapper. * * @param WC_Product_Bundle $bundle * @return boolean */ private static function bundle_contains_subscription($bundle) { } /** * Set the active bundle scheme on a bundled item. * * @param WC_Bundled_Item $bundled_item * @param WC_Product_Bundle $bundle */ public static function set_bundled_item_scheme($bundled_item, $bundle) { } /** * Calculates bundle container item subtotals. * * @param array $cart_item * @param string $scheme_key * @param string $tax * @return double */ private static function calculate_container_item_subtotal($cart_item, $scheme_key, $tax = '') { } /** * Add bundles to subscriptions using 'WC_PB_Order::add_bundle_to_order'. * * @param WC_Subscription $subscription * @param array $cart_item * @param WC_Cart $recurring_cart */ public static function add_bundle_to_order($subscription, $cart_item, $recurring_cart) { } /** * Add composites to subscriptions using 'WC_CP_Order::add_composite_to_order'. * * @param WC_Subscription $subscription * @param array $cart_item * @param WC_Cart $recurring_cart */ public static function add_composite_to_order($subscription, $cart_item, $recurring_cart) { } /* |-------------------------------------------------------------------------- | Hooks - Application |-------------------------------------------------------------------------- */ /** * Sub schemes attached on a Product Bundle should not work if the bundle contains a non-convertible product, such as a "legacy" subscription. * * @param array $schemes * @param WC_Product $product * @return array */ public static function get_product_bundle_schemes($schemes, $product) { } /** * Hide bundled cart item subscription options. * * @deprecated 9.1.0 In-cart plan switching was removed to match the block cart & checkout, so child item options * are no longer rendered. Retained for backward compatibility with any code calling it directly. * * @param boolean $show * @param array $cart_item * @param string $cart_item_key * @return boolean */ public static function hide_child_item_options($show, $cart_item, $cart_item_key) { } /** * Bundled items inherit the active subscription scheme id of their parent. * * @param string $scheme_key * @param array $cart_item * @param array $cart_level_schemes * @return string */ public static function set_child_item_subscription_scheme($scheme_key, $cart_item, $cart_level_schemes) { } /** * Bundled cart items inherit the subscription schemes of their parent, with some modifications. * * @param WC_Cart $cart * @return void */ public static function apply_child_item_subscription_schemes($cart) { } /** * Copies product schemes to a child product. * * @param WC_Product $bundled_product * @param WC_Product $container_product */ private static function set_bundled_product_subscription_schemes($bundled_product, $container_product) { } /** * Bundled cart items inherit the subscription schemes of their parent, with some modifications (first add). * * @param array $cart_item * @param string $cart_item_key * @return array */ public static function set_child_item_schemes($cart_item, $cart_item_key) { } /** * Pass one-time option price placeholder to JS script. * * @since APFS 3.0.0 * * @param array $data * @param WC_Product $product * @return array */ public static function bundle_one_time_option_data($data, $product) { } /** * Pass subscription details placeholder to JS script. * * @since APFS 3.0.0 * * @param array $data * @param WCS_ATT_Scheme $subscription_scheme * @param WC_Product $product * @return array */ public static function bundle_subscription_option_data($data, $subscription_scheme, $product) { } /** * Reorders cart item data so bundle/composite component details come after subscription details, * and marks the last subscription detail with a CSS class for separator hiding. * * Bundle/Composite plugins add component details (e.g. "Includes: Polo × 1") without setting * the 'hidden' property. The block cart's ProductDetails component includes them when determining * " / " separator placement, but they are visually hidden via CSS in the cart. If they appear * after subscription details like "Free trial" or "Sign up fee", a trailing " / " separator * is rendered on the last subscription detail. * * We can't set 'hidden: true' on these entries because the Store API serves the same response * to both the block cart and block checkout — hiding them would also remove component details * from the checkout order summary where they are useful context for the customer. * * Instead, this method: * 1. Moves entries without 'hidden' (component details) to the end of the array. * 2. Adds a 'wcs-last-subscription-detail' CSS class to the last subscription detail. * 3. A CSS rule scoped to .wc-block-cart hides the separator on that class (see index.scss). * * @param array $item_data Cart item data. * @param array $cart_item Cart item. * @return array */ public static function hide_container_component_details_in_blocks($item_data, $cart_item) { } /* |-------------------------------------------------------------------------- | Hooks - Cart Templates |-------------------------------------------------------------------------- */ /** * Aggregate first-period price of a bundle/composite container cart item for its active subscription scheme — * the container's own price plus its child items' prices. This mirrors the aggregate WooCommerce displays for * the container line, so the classic cart/checkout "due today" and recurring-price presentation reflect the * whole bundle rather than just the container's base price. * * @since 9.1.0 * * @param array $cart_item The container cart item. * @param string $tax '', 'incl' or 'excl'. Empty uses the cart's display setting. * @return float */ public static function get_container_aggregate_price($cart_item, $tax = '') { } /** * Calculates bundle container item prices for a given scheme, aggregating the container's own price with its * child items' prices (per single container). * * @param array $cart_item * @param string $scheme_key * @param string $tax * @return float */ private static function calculate_container_item_price($cart_item, $scheme_key, $tax = '') { } /** * Add subscription details next to price of per-item-priced bundle-type container cart items. * * @param string $price * @param array $cart_item * @param string $cart_item_key * @return string */ public static function filter_container_item_price($price, $cart_item, $cart_item_key) { } /** * Add subscription details next to subtotal of per-item-priced bundle-type container cart items. * * @param string $subtotal * @param array $cart_item * @param string $cart_item_key * @return string */ public static function filter_container_item_subtotal($subtotal, $cart_item, $cart_item_key) { } /** * Builds the per-item "$X due today" subtotal for a bundle/composite container, matching the classic cart/checkout * presentation for regular subscription items (see WC_Subscriptions_Cart::get_formatted_product_subtotal). The * amount is the first payment for the whole bundle: the aggregate first period plus the container sign-up fee when * there is no trial, or just the sign-up fee when a trial defers the first period. Containers with no sign-up fee * keep the standard aggregate subtotal with no label, matching the block gate. * * @since 9.1.0 * * @param string $subtotal The aggregate subtotal markup WooCommerce built for the container line. * @param array $cart_item The container cart item. * @return string */ private static function container_due_today_subtotal($subtotal, $cart_item) { } /** * Appends the recurring price and the trial / sign-up fee detail lines below a bundle/composite container item on * the classic checkout. The core WC_Subscriptions_Cart::checkout_cart_item_details() leaves bundle-type items to * this integration, which prices the container as the aggregate of the container and its child items so the * classic checkout reflects the whole bundle (matching the block checkout) rather than the container's base price. * * @since 9.1.0 * * @param string $quantity_html The "× qty" markup rendered before this filter. * @param array $cart_item The cart item. * @param string $cart_item_key The cart item key. * @return string */ public static function checkout_container_item_details($quantity_html, $cart_item, $cart_item_key) { } /** * Modify bundle container cart item subscription options to include child item prices. * * @deprecated 9.1.0 In-cart plan switching was removed to match the block cart & checkout, so container options are * no longer rendered. Retained for backward compatibility with any code calling it directly, and * still applies the 'wcsatt_cart_item_options' filter so callbacks on it keep firing (deprecated). * * @param array $options * @param array $subscription_schemes * @param array $cart_item * @param string $cart_item_key * @return array */ public static function container_item_options($options, $subscription_schemes, $cart_item, $cart_item_key) { } /* |-------------------------------------------------------------------------- | Hooks - Subscriptions View |-------------------------------------------------------------------------- */ /** * Don't count bundle-type child items and hidden bundle-type container/child items. * * @param boolean $can * @param WC_Subscription $subscription * @return boolean */ public static function can_remove_subscription_items($can, $subscription) { } /** * Prevent direct removal of child subscription items from 'My Account > Subscriptions'. * Does ~nothing~ to prevent removal at an application level, e.g. via a REST API call. * * @param boolean $can * @param WC_Order_Item $item * @param WC_Subscription $subscription * @return boolean */ public static function can_remove_child_subscription_item($can, $item, $subscription) { } /** * Handle parent subscription line item removals under 'My Account > Subscriptions'. * * @param WC_Order_Item $item * @param WC_Order $subscription * @return void */ public static function user_removed_parent_subscription_item($item, $subscription) { } /** * Handle parent subscription line item re-additions under 'My Account > Subscriptions'. * * @param WC_Order_Item $item * @param WC_Order $subscription * @return void */ public static function user_readded_parent_subscription_item($item, $subscription) { } /** * Add extra 'Allow Switching' options for content switching of Bundles/Composites. See 'WCS_ATT_Admin::allow_switching_options'. * * @since APFS 3.0.0 * * @param array $data * @return array */ public static function add_bundle_switching_options($data) { } /** * Prevent direct switching of child subscription items from 'My Account > Subscriptions'. * Allow content switching for parent items only, which means that a matching scheme must exist. * * @since APFS 2.4.0 * * @param boolean $can * @param WC_Order_Item $item * @param WC_Subscription $subscription * @return boolean */ public static function can_switch_bundle_type_item($can, $item, $subscription) { } /** * Add content switching support to Bundles and Composites. * * @param bool $is_feature_supported * @param WC_Product $product * @param string $feature * @param array $args * @return bool */ public static function bundle_supports_switching($is_feature_supported, $product, $feature, $args) { } /** * Make WCS see bundles with a switched content as non-identical ones. * * @since APFS 2.4.0 * * @param boolean $is_identical * @param int $product_id * @param int $quantity * @param int $variation_id * @param WC_Order $subscription * @param WC_Order_Item $item * @return boolean */ public static function bundle_is_identical($is_identical, $product_id, $quantity, $variation_id, $subscription, $item) { } /** * Match a subscription line item to its corresponding order item by bundle/composite slot identifier. * * When the same product appears in multiple bundle/composite slots at different prices, * product ID matching alone is insufficient. This method matches by `_bundled_item_id` * or `_composite_item` meta to find the correct order item. * * @param WC_Order_Item|null $matched_item The currently matched item (null if none). * @param WC_Order_Item_Product $line_item The subscription line item. * @param WC_Order $parent_order The parent order. * @param WC_Subscription $subscription The subscription. Unused but part of the filter signature. * @return WC_Order_Item|null The matched order item, or null if no match found. */ public static function match_order_item_for_sign_up_fee($matched_item, $line_item, $parent_order, $subscription) { } /** * Retrieve subscription switch-related parameters of child items from the parent cart item data array. * * @since APFS 2.4.0 * * @param array $bundled_item_cart_data * @param array $cart_item_data * @return array */ public static function bundled_item_switch_cart_data($bundled_item_cart_data, $cart_item_data) { } /** * Retrieve subscription switch-related parameters of child items from the parent cart item data array. * * @since APFS 2.4.0 * * @param array $composited_item_cart_data * @param array $cart_item_data * @return array */ public static function composited_item_switch_cart_data($composited_item_cart_data, $cart_item_data) { } /** * Restore bundle configuration when switching. * * @since APFS 2.4.0 * * @param string $url * @param int $item_id * @param WC_Order_Item $item * @param WC_Subscription $subscription * @return string */ public static function bundle_type_switch_configuration_url($url, $item_id, $item, $subscription) { } /** * Changes the order item status of old child items when the new parent is added. * * @since APFS 2.4.0 * * @param WC_Order $order * @param WC_Subscription $subscription * @param int $adding_item_id * @param int $removing_item_id * @return void */ public static function remove_switched_subscription_child_items($order, $subscription, $adding_item_id, $removing_item_id) { } /** * Disallow plan switching for bundle types. Only content switching permitted! * * @since APFS 2.4.0 * * @param boolean $is_forced * @param WC_Product $product * @return boolean */ public static function force_switched_bundle_type_subscription($is_forced, $product) { } /** * Bundle schemes should be limited to the one matching the subscription while the product is being switched. * This is the meaning of 'content switching': It's not permitted to apply plan changes, only content changes are allowed. * * @since APFS 2.4.0 * * @param array $schemes * @param WC_Product $product * @return array */ public static function limit_switched_bundle_type_schemes($schemes, $product) { } /* |-------------------------------------------------------------------------- | Hooks - Add to Subscription |-------------------------------------------------------------------------- */ /** * Modify the validation context when adding a bundle-type product to an order. * * @param int $product_id */ public static function set_bundle_type_validation_context($product_id) { } /** * Modify the validation context when adding a bundle-type product to an order. * * @param int $product_id */ public static function reset_bundle_type_validation_context($product_id) { } /** * Sets the validation context to 'add-to-order'. * * @param WC_Product_Bundle $bundle */ public static function set_add_to_order_validation_context($product) { } /** * Validates bundle-type stock in 'add-to-order' context. * * @param boolean $is_valid */ public static function validate_bundle_type_stock($is_valid, $bundle_id, $stock_manager, $configuration) { } /** * Don't attempt to increment the quantity of bundle-type subscription items when adding to an existing subscription. * Also omit child items -- they'll be added by their parent. * * @param false|WC_Order_Item_Product $found_order_item * @param array $matching_cart_item * @param WC_Cart $recurring_cart * @param WC_Subscription $subscription * @param WC_Order_Item $order_item * @return false|WC_Order_Item_Product */ public static function found_bundle_in_subscription($found_order_item, $matching_cart_item, $recurring_cart, $subscription, $order_item) { } /** * Return 'add_bundle_to_order' as a callback for adding bundles to subscriptions. * Do not add child items as they'll be added by their parent. * * @param array $callback * @param array $cart_item * @param WC_Cart $recurring_cart */ public static function add_bundle_to_subscription_callback($callback, $cart_item, $recurring_cart) { } /* |-------------------------------------------------------------------------- | Hooks - Bundles |-------------------------------------------------------------------------- */ /** * Build a fingerprint of the bundle's effective scheme state. * * @param WC_Product_Bundle $bundle Bundle. * @param array $bundled_items Bundle Items. * @return string */ private static function build_bundle_fingerprint($bundle, $bundled_items) { } /** * When loading bundled items, always set the active bundle scheme on the bundled objects. * * @param array $bundled_items * @param WC_Product_Bundle $bundle */ public static function set_bundled_items_scheme($bundled_items, $bundle) { } /** * Clear all subscription schemes from a bundled item's product. * * @param WC_Bundled_Item $bundled_item Bundled Item. * @return void */ private static function reset_bundled_item_scheme($bundled_item) { } /** * Compare current fingerprint to last stored one. * * @param WC_Product_Bundle $bundle Bundle. * @param array $bundled_items Bundled Items. * @param string $out_fp (by reference) current fingerprint. * @return bool true if changed (i.e., we should update children) */ private static function bundle_changed($bundle, $bundled_items, &$out_fp = \null) { } /** * Add scheme data to runtime price cache hashes. * * @param array $hash * @param WC_Product_Bundle $bundle * @return array */ public static function bundle_prices_hash($hash, $bundle) { } /** * Remove APFS price filters before retrieving the bundled item Regular Price. */ public static function remove_price_filters() { } /** * Re-add APFS price filters after retrieving the bundled item Regular Price. */ public static function add_price_filters() { } /* |-------------------------------------------------------------------------- | Hooks - Composites |-------------------------------------------------------------------------- */ /** * Set the default scheme when one-time purchases are disabled, no scheme is set on the object, and only a single sub scheme exists. * * @param WC_Product_Composite $composite */ public static function set_single_composite_subscription_scheme($composite) { } /** * Ensure composites in cached component objects have up-to-date scheme data. * * @param string $scheme_key * @param string $previous_scheme_key * @param WC_Product $product */ public static function set_composite_product_scheme($scheme_key, $previous_scheme_key, $product) { } /** * Composited products inherit the subscription schemes of their container object. * * @param WC_CP_Product $component_option * @param string $component_id * @param WC_Product_Composite $composite */ public static function set_component_option_scheme($component_option, $component_id, $composite) { } /** * Adds scheme data to runtime component cache hashes. * * @param array $hash * @param WC_Product_Composite $composite * @return array */ public static function component_hash($hash, $composite) { } /** * Add scheme data to runtime price cache hashes. * * @param array $hash * @param WC_Product_Composite $composite * @return array */ public static function composite_prices_hash($hash, $composite) { } /** * Make sure child order items inherit the subscription plans of their parent. * * @since APFS 3.1.8 * * @param WC_Product $product * @param WC_Order_Item $order_item * @return WC_Product */ public static function restore_bundle_type_product_from_order_item($product, $order_item) { } /** * Calculate correct switch type for bundle containers and force crossgrade to disable proration calculations. Remember to cache the initial value. * * @since APFS 2.4.0 * * @param string $switch_type * @param WC_Subscription $subscription * @param array $cart_item * @return string */ public static function force_bundle_switch_type($switch_type, $subscription, $cart_item) { } /** * Restore initial switch type if applicable. * * @since APFS 2.4.0 * * @param WC_Cart $cart * @return void */ public static function restore_bundle_switch_type($cart) { } } /** * Square integration. * * @version 3.1.27 */ class WCS_ATT_Integration_Square { public static function init() { } /** * Hide Square Digital Wallet buttons from product, cart and checkout for products with Subscription plans. * * @param array $available_pages * @param WooCommerce\Square\Gateway\Digital_Wallet $wallet * @return array */ public static function hide_square_digital_wallet_buttons($available_pages, $wallet) { } } /** * Stripe Compatibility. * * @version 5.0.5 */ class WCS_ATT_Stripe_Compatibility { public static function init() { } /** * Hide Stripe Quick-pay buttons for products with Subscription plans. * * @since APFS 3.1.30 */ public static function hide_stripe_quickpay($hide_button, $post) { } } /** * WooPayments Integration. * * @version 5.0.5 */ class WCS_ATT_Intgeration_WC_Payments { // Hide quick-pay buttons in product pages with Subscription plans. public static function init() { } /** * Hide quick-pay buttons in product pages with Subscription plans. * * @param bool $is_supported * @param WC_Product $product * @return bool */ public static function handle_quick_pay_buttons($is_supported, $product) { } } /** * Abstract class used as the foundation for SATT modules. * Modules are groupings of functionality that SATT uses to attach hooks associated with specific application components. * This is just a way to organize SATT code better. * See 'WCS_ATT::includes', 'WCS_ATT::register_modules' and 'WCS_ATT::register_component_hooks'. * * @version 3.2.0 */ abstract class WCS_ATT_Abstract_Module { /** * Sub-modules to instantiate. * * @var array */ protected $modules = array(); /** * Handles module initialization. * * @return void */ public function __construct() { } /** * Include submodules. * * @return void */ protected function register_modules() { } /** * Initialize submodules. * * @return void */ public function initialize_modules() { } /** * Adds sub-module hooks by component type. * * @param string $component * @return void */ protected function register_module_hooks($component) { } /** * Adds module hooks by component type. * * @param string $component * @param boolean $register_module_hooks * @return void */ public function register_hooks($component, $register_module_hooks = \true) { } /** * Checks if a specific module is registered. * * @return boolean */ public function is_module_registered($module) { } } /** * Handles subscription object management functions, e.g. add, edit/switch, delete. * * @class WCS_ATT_Management * @version 3.2.0 */ class WCS_ATT_Management extends \WCS_ATT_Abstract_Module { /** * Register modules. */ protected function register_modules() { } } /** * Add stuff to existing subscriptions. * * @class WCS_ATT_Manage_Add_Cart * @version 6.0.0 */ class WCS_ATT_Manage_Add_Cart extends \WCS_ATT_Abstract_Module { /** * Register display hooks. * * @return void */ protected function register_display_hooks() { } /** * Register form hooks. */ protected function register_form_hooks() { } /** * Register template hooks. */ private static function register_template_hooks() { } /** * Register ajax hooks. */ private static function register_ajax_hooks() { } /** * Is adding carts to existing subscriptions supported? * * @since APFS 3.1.19 * @return boolean */ public static function is_feature_supported($context = 'cart') { } /* |-------------------------------------------------------------------------- | Templates |-------------------------------------------------------------------------- */ /** * 'Add cart to subscription' view -- template wrapper element. */ public static function options_template() { } /** * Displays list of subscriptions matching a cart. */ public static function display_matching_subscriptions() { } /** * 'Add to subscription' view -- matching list of subscriptions. * * @param array $subscriptions * @param array|null $schemes * @return void */ public static function matching_subscriptions_template($subscriptions, $schemes) { } /* |-------------------------------------------------------------------------- | Ajax Handlers |-------------------------------------------------------------------------- */ /** * Load all user subscriptions matching a cart + scheme key (known billing period and interval). * * @return void */ public static function load_matching_subscriptions() { } /** * Adds a cart to a subscription via the checkout page. * * @return void */ public static function add_cart_to_subscription_from_checkout() { } /* |-------------------------------------------------------------------------- | Form Handlers |-------------------------------------------------------------------------- */ /** * Adds carts to subscriptions. */ public static function form_handler() { } } /** * Add stuff to existing subscriptions. * * @class WCS_ATT_Manage_Add_Product * @version 6.0.0 */ class WCS_ATT_Manage_Add_Product extends \WCS_ATT_Abstract_Module { /** * Using this to pass data from 'WC_Form_Handler::add_to_cart_action' into our own logic. * * @var array */ private static $add_to_subscription_args = array(); /** * Register display hooks. * * @return void */ protected function register_display_hooks() { } /** * Register form hooks. */ protected function register_form_hooks() { } /** * Register template hooks. */ private static function register_template_hooks() { } /** * Register ajax hooks. */ private static function register_ajax_hooks() { } /* |-------------------------------------------------------------------------- | Templates |-------------------------------------------------------------------------- */ /** * 'Add to subscription' view -- wrapper element. */ public static function options_template() { } /** * 'Add to subscription' view -- matching list of subscriptions. * * @param array $subscriptions * @param WC_Product $product * @param WCS_ATT_Scheme|null $scheme * @return void */ public static function matching_subscriptions_template($subscriptions, $product, $scheme) { } /* |-------------------------------------------------------------------------- | Ajax Handlers |-------------------------------------------------------------------------- */ /** * Load all user subscriptions matching a product + scheme key (known billing period and interval). * * @return void */ public static function load_matching_subscriptions() { } /* |-------------------------------------------------------------------------- | Form Handlers |-------------------------------------------------------------------------- */ /** * Adds products to subscriptions after validating. */ public static function form_handler() { } /* |-------------------------------------------------------------------------- | Form Handling Hooks |-------------------------------------------------------------------------- */ /** * Signals 'form_handler' that validation failed. * Data is exchanged via the 'add_product_to_subscription' static prop. * Always returns false to ensure nothing gets added to the cart. * * @param boolean $result * @param int $product_id * @param mixed $quantity * @param int $variation_id * @param array $variation_data * @return bool */ public static function add_to_subscription_validation($result, $product_id, $quantity, $variation_id = 0, $variation_data = array()) { } } /** * Add stuff to existing subscriptions. * * @class WCS_ATT_Manage_Add * @version 4.0.5 */ class WCS_ATT_Manage_Add extends \WCS_ATT_Abstract_Module { /** * Include sub-modules. */ protected function register_modules() { } /** * Register hooks. * * @return void */ protected function register_core_hooks() { } /** * Get posted data. * * @param string $context * @return array */ public static function get_posted_data($context) { } /** * Get matching cart scheme, if all cart items share the same scheme. Returns false otherwise. * * @since APFS 3.4.0 * * @return array|null An array of WCS_ATT_Scheme objects that are common on the cart contents, null for all subscriptions. */ public static function get_schemes_matching_cart() { } /** * Gets all active subscriptions of the current user matching a set of schemes. * * @param array|null $schemes * @return array */ public static function get_matching_subscriptions($schemes) { } /** * Adds a product to a subscription. * * @param WC_Subscription $subscription * @param WC_Product $product * @param array $args * @return boolean */ public static function add_product_to_subscription($subscription, $product, $args) { } /** * Adds the contents of a (recurring) cart to a subscription. * * @param WC_Subscription $subscription * @param boolean $args */ public static function add_cart_to_subscription($subscription, $args = array()) { } } /** * Handles scheme switching for SATT items. * * @class WCS_ATT_Manage_Switch * @version 5.0.5 */ class WCS_ATT_Manage_Switch extends \WCS_ATT_Abstract_Module { /** * Runtime switched product cache. * * @var WC_Product */ private static $switched_product; /** * Runtime cache. * * @var bool */ private static $is_switched_product_identical; /** * Register hooks. * * @return void */ public function register_core_hooks() { } /** * True if switching is in progress. * * @return boolean */ public static function is_switch_request() { } /** * True if a subscribed product scheme/configuration is being switched. * * @param WC_Product $product_switched * @return boolean */ public static function is_switch_request_for_product($product_switched) { } /* |-------------------------------------------------------------------------- | Hooks |-------------------------------------------------------------------------- */ /** * Allow scheme switching for SATT products with more than 1 subscription scheme or products with switchable content (variations and bundle/composite configurations). * * @param boolean $is_switchable * @param WC_Product $product * @return boolean */ public static function is_product_switchable($is_switchable, $product) { } /** * Prevent content switching when plan switching is disabled and a matching scheme can't be found. * * @since APFS 3.1.17 * * @param boolean $can * @param WC_Order_Item $item * @param WC_Subscription $subscription * @return boolean */ public static function can_switch_item($can, $item, $subscription) { } /** * Disable one-time purchases when switching. * * @param boolean $is_forced * @param WC_Product $product * @return boolean */ public static function force_subscription($is_forced, $product) { } /** * When switching 'Between Subscription Plans' is disabled and 'Between Subscription Variations' is enabled, plan switching should not be possible. * This is the meaning of 'content switching': It's not permitted to apply plan changes, only content changes are allowed. * * @since APFS 3.0.0 * * @param array $schemes * @param WC_Product $product * @return array */ public static function variable_product_subscription_schemes($schemes, $product) { } /** * Allow WCS to recognize any supported product as a subscription when validating a switch: Add filter. * * @param boolean $is_valid * @return boolean */ public static function add_is_subscription_filter($is_valid) { } /** * Allow WCS to recognize any supported product as a subscription when validating a switch: Remove filter. * * @param boolean $is_valid * @return boolean */ public static function remove_is_subscription_filter($is_valid) { } /** * Hooks onto 'woocommerce_is_subscription' to trick WCS into thinking it is dealing with a subscription-type product when switching. * * @param boolean $is * @param int $product_id * @param WC_Product $product * @return boolean */ public static function filter_is_subscription($is, $product_id, $product) { } /** * Make WCS see products with a switched scheme as non-identical ones. * * @param boolean $is_identical * @param int $product_id * @param int $quantity * @param int $variation_id * @param WC_Order $subscription * @param WC_Order_Item $item * @return boolean */ public static function is_identical_product($is_identical, $product_id, $quantity, $variation_id, $subscription, $item) { } /** * Checks if the posted subscription plan during a switch is identical with the plan of the item being switched. * * @since APFS 3.0.0 * * @param int $product_id * @param WC_Order_Item $item * @return boolean */ private static function is_posted_subscription_scheme_identical($product_id, $item) { } /** * Prevent variation switching when 'Between Subscription Variations' is disabled. * * @since APFS 3.0.0 * * @param bool $is_valid * @param int $product_id * @param int $quantity * @param int $variation_id * @param WC_Subscription $subscription * @param WC_Order_Item $item * @return boolean */ public static function is_variation_switch_valid($is_valid, $product_id, $quantity, $variation_id, $subscription, $item) { } /** * Modify cart item being switched. * * @param array $cart_item * @param string $cart_item_key * @return void */ public static function edit_switched_cart_item($cart_item, $cart_item_key) { } /** * Change the "select options" link to include the switch query args, similar to what WooCommerce Subscriptions does. * Applies to variable products belonging to group products. * * @since APFS 5.0.5 * * @param string $permalink The permalink of the product belonging to the group * @param WP_Post $the_post The WP_Post object * * @return string modified string with the query arg present * @see WC_Subscriptions_Switcher::add_switch_query_arg_post_link */ public static function add_switch_query_arg_post_link($permalink, $the_post) { } /** * Filters the add to cart text for products during a switch request. * No need to call self::is_switch_request() here, as the filter is only added when there is a switch request. * * @since APFS 5.0.5 * * @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 filter_add_to_cart_text($add_to_cart_text) { } } /** * Handles modifications to the prices of subscription-enabled product objects. * * @class WCS_ATT_Product_Price_Filters * @version 3.2.0 */ class WCS_ATT_Product_Price_Filters { /** * Runtime cache. * * @var array */ private static $filter_instance_plan_prices = array(); /** * Whether we are currently rendering WooCommerce's grouped product list. * * Toggled by the 'woocommerce_grouped_product_list_before' and * 'woocommerce_grouped_product_list_after' action handlers below. APFS is * not supported on grouped products (see WOOSUBS-1267), so price-html * mutations are suppressed while this flag is set. * * @var bool */ private static $in_grouped_product_list = \false; /* |-------------------------------------------------------------------------- | Public Price Filters API |-------------------------------------------------------------------------- */ /** * Determine filtering context - 'inherit' or 'override'. * * @since APFS 3.1.0 * * @return string */ public static function get_price_filter_type() { } /** * Whether the current WP price filter context is the 'override' pipeline. * MODE_INHERIT and MODE_FIXED_DISCOUNT both run in the non-override pipeline. * * @return bool */ private static function is_processing_override_filter() { } /** * Whether the pricing mode inherits or adjusts the product's base price (inherit or fixed_discount). * * @param string $pricing_mode WCS_ATT_Scheme pricing mode constant. * @return bool */ private static function is_price_inheriting_mode($pricing_mode) { } /** * Whether the scheme's pricing mode matches the currently-running WP filter pipeline. * * Price filters are hooked at two priorities: 0 (override pipeline) and 99 (inherit/fixed_discount pipeline). * WP runs all priority-0 hooks before priority-99 hooks, so both fire for every filtered value. * This guard ensures each scheme type is only processed by its own pipeline and skipped by the other. * * @param string $pricing_mode WCS_ATT_Scheme pricing mode constant. * @return bool True when the scheme should be processed; false when it should be skipped. */ private static function scheme_matches_current_pipeline($pricing_mode) { } /** * Allow plan prices to be filtered for this product? * * @since APFS 3.1.0 * * @param WC_Product $product * @return bool */ public static function filter_plan_prices($product) { } /** * Add price filters. Filtering early allows us to override "raw" prices as safely as possible. * This allows 3p code to apply discounts or other transformations on overridden prices. * The catch: Any price filters added by 3p code with a priority earlier than 0 will be rendered ineffective. * * @param string $context Filtering context. Values: 'price', 'price_html', ''. * @return void */ public static function add($context = '') { } /** * Remove price filters. * * @param string $context Filtering context. Values: 'price', 'price_html', ''. * @return void */ public static function remove($context = '') { } /* |-------------------------------------------------------------------------- | Filters |-------------------------------------------------------------------------- */ /** * Filter html price based on the subscription scheme that is activated on the object. * * @param string $price_html * @param WC_Product $product * @return string */ public static function filter_price_html($price_html, $product) { } /** * Mark the start of WooCommerce's grouped product list rendering so that * 'filter_price_html' can bail and leave native output untouched. * * @return void */ public static function before_grouped_product_list() { } /** * Mark the end of WooCommerce's grouped product list rendering. * * @return void */ public static function after_grouped_product_list() { } /** * Filter variation data based on the subscription scheme that is activated on the parent. * * @param array $variation_data * @param WC_Product_Variable $product * @param WC_Product_Variation $variation * @return array */ public static function filter_variation_data($variation_data, $product, $variation) { } /** * Filter variation prices hash to load different prices depending on the scheme that's active on the object. * * @param array $hash * @param WC_Product_Variable $product * @return array */ public static function filter_variation_prices_hash($hash, $product) { } /** * Filter get_variation_prices() calls to take price filters into account. * We could as well have used 'woocommerce_variation_prices_{regular_/sale_}price' filters. * This is a bit slower but makes code simpler when there are no variation-level schemes. * * @param array $raw_prices * @param WC_Product_Variable $product * @return array */ public static function filter_variation_prices($raw_prices, $product) { } /** * Filter get_price() calls to take scheme price overrides into account. * * @param double $price * @param WC_Product $product * @return double */ public static function filter_price($price, $product) { } /** * Filter get_regular_price() calls to take scheme price overrides into account. * * @param double $price * @param WC_Product $product * @return double */ public static function filter_regular_price($regular_price, $product) { } /** * Filter get_sale_price() calls to take scheme price overrides into account. * * @param double $sale_price * @param WC_Product $product * @return double */ public static function filter_sale_price($sale_price, $product) { } /** * Filter WC_Subscriptions_Product::get_price() calls. * * @since APFS 3.1.0 * * @param double $price * @param WC_Product $product * @return double */ public static function filter_subscription_price($price, $product) { } /** * Filter WC_Product::is_on_sale() calls. * * @since APFS 3.1.29 * * @param bool $is_on_sale * @param WC_Product $product * @return bool */ public static function filter_is_on_sale($is_on_sale, $product) { } } /** * API for working with the prices of subscription-enabled product objects. * * @class WCS_ATT_Product_Prices * @version 6.0.7 */ class WCS_ATT_Product_Prices { /** * Initialize. */ public static function init() { } /** * Add price filters. * * @return void */ private static function add_hooks() { } /* |-------------------------------------------------------------------------- | Getters |-------------------------------------------------------------------------- */ /** * Returns a string representing the details of the active subscription scheme. * * @param WC_Product $product Product object. * @param array $include An associative array of flags to indicate how to calculate the price and what to include - @see 'WC_Subscriptions_Product::get_price_string'. * @param array $args Optional args to pass into 'WC_Subscriptions_Product::get_price_string'. Use 'scheme_key' to optionally define a scheme key to use. * @return string */ public static function get_price_string($product, $args = array()) { } /** * Returns the price html associated with the active subscription scheme. * You may optionally pass a scheme key to get the price html string associated with it. * * @param WC_Product $product Product object. * @param integer $scheme_key Scheme key or the currently active one, if undefined. Optional. * @param array $args Optional args to pass into 'WC_Subscriptions_Product::get_price_string'. * @return string */ public static function get_price_html($product, $scheme_key = '', $args = array()) { } /** * Base subscription scheme price html args. * * @since APFS 3.0.0 * * @param array $args * @param WC_Product $product * @return array */ protected static function get_base_subscription_scheme_price_html_args($args, $product, $scheme = \null) { } /** * Returns the product's current effective price as HTML, without subscription plan suffix. * * Used as the 'price' argument passed to WC_Subscriptions_Product::get_price_string() when building * the subscription suffix string (e.g. "available on subscription from ¥16 / year"). * * @param WC_Product $product Product object. * @return string */ public static function get_price_html_unfiltered($product) { } /** * Generate price HTML for a product under a specific scheme without switching. * * When a scheme applies a price filter (discount or override), generates * strikethrough HTML (e.g., $10$9). Otherwise returns * the product's unfiltered price HTML. * * @param WC_Product $product The product. * @param WCS_ATT_Scheme $scheme The scheme. * @return string Formatted price HTML. */ private static function get_scheme_price_html_for_product($product, $scheme) { } /** * Returns the recurring vanilla/regular/sale price. * * @param WC_Product $product Product object. * @param string $scheme_key Optional key to get the price of a specific scheme. * @param string $context Function call context. * @param string $price_type Price to get. Values: '', 'regular', or 'sale'. * @return mixed The price charged charged per subscription period. */ protected static function get_product_price($product, $scheme_key = '', $context = 'view', $price_type = '') { } /** * Returns the recurring price. * * @param WC_Product $product Product object. * @param string $scheme_key Optional key to get the price of a specific scheme. * @param string $context Function call context. * @return mixed The price charged per subscription period. */ public static function get_price($product, $scheme_key = '', $context = 'view') { } /** * Returns the recurring regular price. * * @param WC_Product $product Product object. * @param string $scheme_key Optional key to get the regular price of a specific scheme. * @param string $context Function call context. * @return mixed The regular price charged per subscription period. */ public static function get_regular_price($product, $scheme_key = '', $context = 'view') { } /** * Returns the recurring sale price. * * @param WC_Product $product Product object. * @param string $scheme_key Optional key to get the price of a specific scheme. * @param string $context Function call context. * @return mixed The sale price charged per subscription period. */ public static function get_sale_price($product, $scheme_key = '', $context = 'view') { } /** * Generated formatted discount string. Used in dropdowns. * * @since APFS 3.0.0 * * @return string|false */ public static function get_formatted_discount($product, $scheme) { } /** * Precision for discounts displayed in price strings. * * @since APFS 3.0.0 * * @return int */ public static function get_formatted_discount_precision() { } /** * Format prices without html content. Used in dropdowns. * * @since APFS 3.0.0 * * @param mixed $price * @param array $args * @return string */ public static function get_formatted_price($price) { } } /** * API for working with the subscription schemes of subscription-enabled product objects. * * @class WCS_ATT_Product_Schemes * @version 5.0.2 */ class WCS_ATT_Product_Schemes { /* |-------------------------------------------------------------------------- | Conditionals |-------------------------------------------------------------------------- */ /** * Determines if the product can be purchased on a recurring basis. * * @param WC_Product $product Product object to check. * @param string $context Context/origin of schemes. * @return boolean Result of check. */ public static function has_subscription_schemes($product, $context = 'any') { } /** * Determines if the product is purchasable on a recurring basis only. * * @param WC_Product $product Product object to check. * @return boolean Result of check. */ public static function has_forced_subscription_scheme($product) { } /** * Determines if the product is purchasable on a recurring basis only, and a single plan is available. * * @since APFS 2.4.0 * * @param WC_Product $product Product object to check. * @return boolean Result of check. */ public static function has_single_forced_subscription_scheme($product) { } /** * Determines if the product is currently set to be purchased on a recurring basis. * * @param WC_Product $product Product object to check. * @return boolean Result of check. */ public static function has_active_subscription_scheme($product) { } /* |-------------------------------------------------------------------------- | Getters |-------------------------------------------------------------------------- */ /** * Returns all subscription schemes associated with a product. * * @param WC_Product $product Product object. * @param string $context Context of schemes, based on origin. Values: 'local', 'global'. * @return array */ public static function get_subscription_schemes($product, $context = 'any') { } /** * Get the active subscription scheme. Note that: * When requesting the active scheme 'key', the function returns: * * - string if a valid subscription scheme is activated on the object (subscription state defined); * - false if the product is set to be sold in a non-recurring manner (subscription state defined); or * - null if no scheme is set on the object (subscription state undefined). * * When requesting the active scheme, the function returns: * * - A WCS_ATT_Scheme instance if a valid subscription scheme is activated on the object; * - false if the product is set to be sold in a non-recurring manner; or * - null otherwise. * * Optionally pass a specific key to get the associated scheme, if valid. * * Note that the return value is always validated against 'get_subscription_schemes' and 'has_forced_subscription'. * * @param WC_Product $product Product object. * @param string $return What to return - 'object' or 'key'. Optional. * @param string $scheme_key Optional key to get a specific scheme. * @return string|null|false|WCS_ATT_Scheme Subscription scheme activated on object. */ public static function get_subscription_scheme($product, $return = 'key', $scheme_key = '') { } /** * Get the default subscription scheme (key). * * @param WC_Product $product Product object. * @param string $return What to return - 'object' or 'key'. Optional. * @return string|null|false|WCS_ATT_Scheme Default subscription scheme. */ public static function get_default_subscription_scheme($product, $return = 'key') { } /** * Returns the "base" subscription scheme by finding the one with the lowest recurring price. * If prices are equal, no interval-based comparison is carried out: * Reason: In some applications "$5 every week for 2 weeks" (=$10) might be seen as "cheaper" than "$5 every month for 3 months" (=$15), and in some the opposite. * Instead of making guesswork and complex calculations, we can let scheme order be used to define the "base" scheme manually. * * @param WC_Product $product * @return WCS_ATT_Scheme */ public static function get_base_subscription_scheme($product) { } /** * Get the posted product subscription scheme from the single-product page. * * @since APFS 2.1.0 * * @param mixed $product_id * @return string */ public static function get_posted_subscription_scheme($product_id = '') { } /* |-------------------------------------------------------------------------- | Setters |-------------------------------------------------------------------------- */ /** * Associates subscription schemes with a product. * Normally, you wouldn't need to use this since 'WCS_ATT_Product::get_subscription_schemes' will automagically fetch all product-level schemes. * Can be used to append or otherwise modify schemes -- e.g. it is used by 'WCS_ATT_Cart::apply_subscription_schemes' to conditionally attach cart-level schemes on session load. * * @param WC_Product $product Product object. * @param array $schemes Schemes. * @return void */ public static function set_subscription_schemes($product, $schemes) { } /** * Set the active subscription scheme. Key value should be: * * - string to activate a subscription scheme (valid key required); * - false to indicate that the product is sold in a non-recurring manner; or * - null to indicate that the subscription state of the product is undefined. * * Note that the scheme set on the object may become invalid if 'set_subscription_schemes' or 'set_forced_subscription_scheme' are modified. * * @param WC_Product $product Product object. * @param string $key Identifier of subscription scheme to activate on object. * @return boolean Action result. */ public static function set_subscription_scheme($product, $key) { } /** * Set the product as purchasable on a recurring basis only. * * @param WC_Product $product Product object to set. * @param boolean $is_forced_subscription Value. */ public static function set_forced_subscription_scheme($product, $is_forced_subscription) { } /* |-------------------------------------------------------------------------- | Helpers |-------------------------------------------------------------------------- */ /** * Indicates whether the product price is modified by one or more subscription schemes. * * @param array $subscription_schemes * @param string $pricing_mode * @return boolean */ public static function price_filter_exists($subscription_schemes, $pricing_mode = 'any') { } /** * Parses a string-formatted subscription scheme key. * * @since APFS 3.1.2 * * @param string $key * @return false|string */ public static function parse_subscription_scheme_key($key) { } /** * Stringifies a subscription scheme key. * * @since APFS 3.1.2 * * @param string|false $key * @return string */ public static function stringify_subscription_scheme_key($key) { } /** * Filter schemes by context. * * @param array $schemes * @param string $context * @return array */ private static function filter_by_context($schemes, $context) { } } /** * Main plugin class. * * @class WCS_ATT * @version 9.0.0 */ class WCS_ATT extends \WCS_ATT_Abstract_Module { /* Plugin version. */ const VERSION = '6.0.7'; /* Required WC version. */ const REQ_WC_VERSION = '8.2.0'; /* Required WC version. */ const REQ_WCS_VERSION = '6.1.0'; /* Required WC Payments version. */ const REQ_WCPAY_VERSION = '3.2.0'; /** * @var WCS_ATT - the single instance of the class. * * @since APFS 1.0.0 */ protected static $_instance = \null; /** * Product data object. * * @var WCS_ATT_Product_Data * * @since APFS 5.0.0 */ public $product_data; /** * Main WCS_ATT Instance. * * Ensures only one instance of WCS_ATT is loaded or can be loaded. * * @static * @see WCS_ATT() * @return WCS_ATT - Main instance * @since APFS 1.0.0 */ public static function instance() { } /** * Cloning is forbidden. * * @since APFS 1.0.0 */ public function __clone() { } /** * Unserializing instances of this class is forbidden. * * @since APFS 1.0.0 */ public function __wakeup() { } /** * Do some work. */ public function __construct() { } /** * The plugin URL. * * @return string */ public function plugin_url() { } /** * The plugin path. * * @return string */ public function plugin_path() { } /** * Plugin version getter. * * @since APFS 2.4.0 * * @param boolean $base * @param string $version * @return string */ public function plugin_version($base = \false, $version = '') { } /** * Define constants if not present. * * @since APFS 3.1.7 * * @return boolean */ protected function maybe_define_constant($name, $value) { } /** * Plugin base path name getter. * * @return string */ public function plugin_basename() { } /** * Bootstrap. */ public function plugins_loaded() { } /** * Define constants. * * @return void */ protected function define_constants() { } /** * Include plugin files. * * @return void */ public function includes() { } /** * Include submodules. * * @since APFS 2.1.0 * * @return void */ public function register_modules() { } /** * Register all module hooks associated with a named SATT component. * * @since APFS 2.1.0 * * @param string $component */ protected function register_component_hooks($component) { } /** * Loads the Admin & AJAX filters / hooks. * * @return void */ public function admin_includes() { } /** * Initialize plugin. * * @since APFS 3.4.0 * * @return void */ public function init_plugin() { } /** * Store plugin version. * * @return void */ public function activate() { } /** * Clean-up on de-activation. * * @since APFS 3.1.5 * * @return void */ /** * Product types supported by the plugin. * * @return array */ public function get_supported_product_types() { } /** * Log important stuff. * * @param string $message * @param string $level * @return void */ public function log($message, $level) { } /** * Returns URL to a doc or support resource. * * @since APFS 4.0.0 * * @param string $handle * @return string */ public function get_resource_url($handle) { } } 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 * GET /orders//subscriptions * POST /orders//subscriptions * * @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_Subscription $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) { } /** * Gets the /orders/[id]/subscriptions response. * * @since 7.9.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_order_subscriptions($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) { } } /** * REST controller for settings options. */ class WC_REST_Subscriptions_Settings_Option_Controller extends \WP_REST_Controller { /** * Endpoint namespace. * * @var string */ protected $namespace = 'wc/v3'; /** * List of allowed option names that can be updated via the REST API. * * @var array */ private const ALLOWED_OPTIONS = ['woocommerce_subscriptions_gifting_is_welcome_announcement_dismissed', 'woocommerce_subscriptions_downloads_is_welcome_announcement_dismissed']; /** * Endpoint path. * * @var string */ protected $rest_base = 'subscriptions/settings'; /** * Configure REST API routes. */ public function register_routes() { } /** * Validate the option name. * * @param string $option_name The option name to validate. * @return bool */ public function validate_option_name(string $option_name): bool { } /** * Validate the value parameter. * * @param mixed $value The value to validate. * @return bool|WP_Error True if valid, WP_Error if invalid. */ public function validate_value($value) { } /** * Update the option value. * * @param WP_REST_Request $request The request object. * @return WP_Error|WP_REST_Response */ public function update_option(\WP_REST_Request $request) { } /** * Verify access. * * Override this method if custom permissions required. */ public function check_permission() { } } /** * 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 */ 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 */ 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 */ 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() { } } /** * REST API Subscription Notes controller class. * * @package WooCommerce_Subscriptions/API */ class WC_REST_Subscription_Notes_V2_Controller extends \WC_REST_Order_Notes_V2_Controller { /** * Route base. * * @var string */ protected $rest_base = 'subscriptions/(?P[\d]+)/notes'; /** * Post type. * * @var string */ protected $post_type = 'shop_subscription'; } class WC_REST_Subscriptions_V2_Controller extends \WC_REST_Orders_V2_Controller { /** * @var string Route base. */ protected $rest_base = 'subscriptions'; /** * @var string The post type. */ protected $post_type = 'shop_subscription'; /** * Register the routes for the subscriptions endpoint. * * GET|POST /subscriptions * GET|PUT|DELETE /subscriptions/ * GET /subscriptions/status * GET /subscriptions//orders * POST /orders//subscriptions * * @since 6.4.0 */ public function register_routes() { } /** * Gets the request object. Return false if the ID is not a subscription. * * @since 6.4.0 * * @param int $id Object ID. * * @return WC_Subscription|bool */ protected function get_object($id) { } /** * Prepare a single subscription output for response. * * @since 6.4.0 * * @param WC_Subscription $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 6.4.0 * * @return WP_REST_Response The response object. */ public function get_statuses() { } /** * Gets the /subscriptions/[id]/orders response. * * @since 6.4.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_V2_Controller::get_order_statuses() so that subscription statuses are * validated correctly. * * @since 6.4.0 * * @return array An array of valid subscription statuses. */ protected function get_order_statuses() { } /** * Prepares a single subscription for creation or update. * * @since 6.4.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 6.4.0 * * @return array */ public function get_item_schema() { } /** * Get the query params for collections. * * @since 6.4.0 * * @return array */ public function get_collection_params() { } /** * Gets an object's links to include in the response. * * Because this class also handles retrieving order data, we need * to edit the links generated so the correct REST API href is included * when its generated for an order. * * @since 6.4.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 6.4.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. * * @return void */ public function update_payment_method($subscription, $payment_method, $payment_meta) { } /** * Creates subscriptions from an order. * * @since 6.4.0 * * @param WP_REST_Request $request * * @return array Subscriptions created from the order. */ public function create_subscriptions_from_order($request) { } /** * Subscriptions statuses schema, conforming to JSON Schema. * * @return array */ public function get_statuses_schema() { } /** * Subscriptions orders schema, conforming to JSON Schema. * * @return array */ public function get_subscription_orders_schema() { } /** * Subscriptions schema, conforming to JSON Schema. * * @return array */ public function create_subscriptions_from_order_schema() { } } class WC_Subscriptions_CLI { /** * Loads WooCommerce Subscriptions CLI related hooks. */ public function __construct() { } /** * Return an error when the `wc shop_order subscriptions create` WP CLI command is used. * * WooCommerce core adds WP CLI commands for each WC REST API endpoints beginning with /wc/v2. This means all of our subscription * REST API endpoints are added. While the `wc shop_order subscriptions create` CLI command technically works, WooCommerce doesn't have support for * batch creation via CLI and results in the success message not being displayed correctly. * * @param string $command The command name. */ public function abort_create_subscriptions_from_order($command) { } } 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; /** * @var boolean Whether to skip the class_exists and WC_VERSION constant checks. */ private $skip_class_exists_and_wc_version_constant_checks = \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 = '8.3.0'; // WRCS: DEFINED_VERSION. /** * The subscription scheduler instance. * * @var WCS_Action_Scheduler */ protected $scheduler = \null; /** * Notification scheduler instance. * * @var WCS_Action_Scheduler_Customer_Notifications */ public $notifications_scheduler = \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. * * @since 8.8.0 The $autoloader parameter is no longer used; classes are loaded via Composer. * * @param mixed $autoloader Unused. Retained for backwards compatibility. */ // @phpstan-ignore constructor.unusedParameter 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() { } /** * Returns an instance of the (now deprecated) bespoke autoloader. * * Class loading is handled by Composer; this method is retained only for * third-party integrations that still call it. The returned instance is a * no-op shell and does not register any autoload callbacks. * * @deprecated 8.8.0 Composer handles class autoloading; no replacement is required. * * @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) { } /** * Initialize batch processing for subscription notifications. * * @return void */ public function init_notification_batch_processor() { } } /** * @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() { } /** * Attempts to initialize APFS (All Products for Subscriptions) functionality. * * By the time `plugins_loaded` fires, WordPress has already included every active plugin file. * If the standalone APFS plugin is active, its top-level `function WCS_ATT()` declaration will * have executed during file inclusion - so `function_exists( 'WCS_ATT' )` is a reliable check. * * The `is_plugin_being_activated` fallback covers the single request where a merchant activates * the standalone plugin: WordPress calls `activate_plugin()` after `plugins_loaded`, so the * standalone file has not been included yet and `function_exists` would be false. Without this * check the standalone's unconditional `function WCS_ATT()` declaration would redeclare-fatal. */ public function init_apfs() { } /** * Attempts to initialize gifting functionality. * * Before doing this, the method tries to determine if the standalone WooCommerce Gifting plugin is active and has * already loaded (if the standalone plugin is active, we do not proceed). To accomplish this, this method expects * to run during plugins_loaded at priority 20 (whereas the equivalent code from the standalone plugin will run at * priority 11). */ public function init_gifting() { } /** * Attempts to initialize additional downloads functionality. * * This functionality makes it possible to link downloadable products with a subscription * product. Purchasers of the subscription product then automatically get access to the files associated with downloadable product. * * Previously, this functionality existed as a standalone plugin (WooCommerce Subscription Downnloads) and so, * before initializing, we try to determine if the standalone plugin is active and has already loaded (if it is * active, we do not proceed). */ public function init_downloads() { } /** * Tries to determine if the specified plugin is being activated. * * The provided plugin slug can be either the complete relative plugin path (ie, 'plugin-slug/plugin-slug.php') or * just a part of the path (ie, 'plugin-slug'). So long as the plugin which is actually being activated contains * that string, then we consider ourselves to have a match and will return true. * * Therefore, consider with care how precise you need to be: something highly specific like our first example will * fail if the plugin directory has been renamed. A shorter fragment, on the other hand, will potentially match the * wrong plugin. * * This method is only useful as a means of detecting when a plugin is activated through 'conventional' means (via * the plugin admin screen, or via WP CLI), but it will not provide protection if, for example, third party code * makes its own arbitrary calls to activate_plugin(). * * @param string $plugin_slug Plugin slug. * * @return bool */ private function is_plugin_being_activated(string $plugin_slug): bool { } } 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_Product $item Order item object. * @param array $item_request_data Data posted to the API about the order item. */ public static function add_sign_up_fee_to_order_item($item, $item_request_data = array()) { } /** * 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() { } /** * Fetches WooCommerce API endpoint data in a WooCommerce version compatible way. * * This method is a wrapper for the WooCommerce API get_endpoint_data method. In WooCommerce 9.0.0 and later, the * WC()->api was deprecated in favor of the new Automattic\WooCommerce\Utilities\RestApiUtil class. * * @since 6.4.1 * * @param string $endpoint The endpoint to get data for. * @return array|\WP_Error The endpoint data or WP_Error if the request fails. */ public static function get_wc_api_endpoint_data($endpoint) { } } 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) { } } 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. * * @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|WC_Coupon $coupon The coupon or 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($coupon) { } /** * 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 * * @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 array */ 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) { } } // 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. */ abstract protected function get_items_to_update(); /** * Run the update for a single item. * * @param mixed $item The item to update. */ abstract protected 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) { } } 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. */ abstract protected 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. */ abstract protected 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 { final public static function get_instance() { } /** * Initialises some form of logger */ abstract public function load_logger(); /** * This method should implement adding to the log file * @return mixed */ abstract public function log($message); /** * Caches and returns data. Implementation can vary by classes. * * @return mixed */ abstract public function cache_and_get($key, $callback, $params = array(), $expires = \WEEK_IN_SECONDS); /** * Deletes a cached version of data. * * @return mixed */ abstract public 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 */ abstract public function get_users_subscription_ids($user_id); /** * Get the active customer data store. * * @return WCS_Customer_Store */ final public static 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 */ abstract protected 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) { } } 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 */ abstract public 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 */ abstract public 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 */ abstract public 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 */ abstract public 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 */ abstract protected 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) { } } /** * 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 */ final public static 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 */ abstract 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 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 */ abstract public 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. */ abstract public 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. */ abstract 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. */ abstract public 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) { } /** * Get related order IDs grouped by relation type. * * @param WC_Order $subscription The subscription to find related orders. * @param array $relation_types An array of relation types to fetch. Must be an array containing 'renewal', 'switch' or 'resubscribe' unless custom relationships are implemented. * * @return array An associative array where keys are relation types and values are arrays of related order IDs. */ public function get_related_order_ids_by_types(\WC_Order $subscription, $relation_types) { } } /** * 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. */ abstract public 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 */ abstract 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 $new_status A valid subscription status * @param string $old_status A valid subscription status */ abstract public function update_status($subscription, $new_status, $old_status); } // 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() { } /** * Deletes the schema option and recreates the tables. * * This forces the table schema to be regenerated by removing the stored * schema version and triggering the table registration process. */ public function recreate_tables() { } /** * @param string $table The name of the table * * @return string The CREATE TABLE statement, suitable for passing to dbDelta */ abstract protected 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) { } } /** * 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 */ public static function clear_subscriptions_transients() { } /** * Add the 'subscriptions' product type to the WooCommerce product type select box. * * @param array $product_types 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 the "Subscription product creation" settings section. * * @param array $settings Existing subscription settings. * @return array */ public static function add_subscription_product_creation_settings($settings) { } /** * Get the product type of the product currently being edited, if any. * * @return string|false The product type slug, or false if not on a product edit screen. */ private static function get_current_product_type() { } /** * 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 int $post_id The ID of the post being saved. * @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 int $post_id The ID of the post being saved. * @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. * @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 * @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 $index * @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 savedf * * @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 */ public static function set_variation_meta_defaults_on_bulk_add($variation_id) { } /** * Adds all necessary admin styles. * * @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. * * @deprecated 2.2.2 Use WC_Subscriptions_Admin::render_system_status_items() instead. * * @param array $debug_data * @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 * @deprecated 7.5.0 */ 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 int $post_id The ID of the post being saved. * @param array $product_types 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 * * @deprecated 2.3 Use WCS_Admin_System_Status::render_system_status_items() instead. */ public static function render_system_status_items() { } /** * Outputs the contents of the "Renewal Orders" meta box. * * @deprecated 2.0 Use WCS_Meta_Box_Related_Orders::output() instead. * * @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. * * @deprecated 2.0 * * @param WP_User_Query $user_query */ public static function add_subscribers_to_customers($user_query) { } /** * Set a translation safe screen ID for Subscriptions * * @deprecated 2.0 * @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. * * @deprecated 2.0 * @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. * * @deprecated 2.0 * * @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 * * @deprecated 2.0 */ 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) { } /** * Check if the current page is the Edit Subscription page * * @return bool True if the current page is the Edit Subscription page * * @since 7.5.0 */ private static function is_edit_subscription_page() { } } /** * 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 WC_Subscription $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 WC_Subscription $subscription */ public static function create_pending_renewal_action_request($subscription) { } /** * Handles the action request to create a pending parent order. * * @param WC_Subscription $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 $email_actions * @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_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() { } /** * Notifies the user of an operational success or failure, and records a matching order note. * * In essence, it can be convenient to generate both an admin notice (to give the user some clear and * obvious feedback) and record the same as an order note (the admin notice could be missed, and is * auto-dismissed after the first view). * * @param WC_Subscription $subscription The subscription we are working with. * @param string $type Message type: 'success' or 'error. * @param string $message Message text, which will be used both for an admin notice and for the order note. * * @return void */ private static function notify(\WC_Subscription $subscription, $type, $message) { } } 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. */ 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_Order_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 $subscription_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 $subscription_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 $subscription_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_Order_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 = \null, $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_Order_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 string $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) { } /** * Get the last payment date for a subscription. * * @param WC_Subscription $subscription The subscription object. * @return int The last payment date timestamp. */ private static function get_last_payment_date($subscription) { } /** * 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 to handle subscription product types. * * Auto-enables legacy subscription product type settings when the CSV importer encounters * subscription or variable-subscription types that are currently disabled, so the import * succeeds instead of failing with "Invalid product type". * * Also converts subscription_variation types to variation, since subscription variations * are identical to standard variations except for their parent product type. * * @param array $data The product's import data. * @return array $data */ public static function import_subscription_variations($data) { } /** * Sets the subscription price meta when importing a subscription product. * * During CSV imports, WooCommerce sets the regular price (`_price`) from the "Regular price" column, * but subscription products also need _subscription_price to be set for proper and consistent pricing. * * @param WC_Product $product The product object being imported. * * @return WC_Product */ public static function set_subscription_price_on_import($product) { } } /** * 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; /** * Contains pre-determined SSR report data. * * @var array */ private static $report_data = []; /** * Used to cache the result of the comparatively expensive queries executed by * the get_subscriptions_by_gateway() method. * * This cache is short-lived by design, as we don't necessarily want to cache this * across requests (in some troubleshooting/debug scenarios, that could be confusing * for the troubleshooter), which is why a transient or WP caching functions are not * used. * * @var null|array */ private static $statuses_by_gateway = \null; /** * Used to cache the subscriptions-by-status counts. * * As with with self::$statuses_by_gateway, the cache is deliberately short-lived. * * @var null|array */ private static $subscription_status_counts = \null; /** * 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 * @since 7.2.0 Uses supplied report data if available. * * @param mixed $report Pre-determined SSR report data. */ public static function render_system_status_items($report = \null) { } /** * 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. * @since 7.2.0 Information is cached per request. * * @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() { } /** * Returns a cached array of subscription statuses along with the corresponding number * of subscriptions for each (the values). * * Example: * * [ * 'wc-active' => 100, * 'wc-cancelled' => 200, * '...' => 300, * ] * * @param bool $fresh If cached results should be discarded. * * @return array */ public static function get_subscription_status_counts(bool $fresh = \false): array { } } class WCS_WC_Admin_Manager { /** * Initialise the class and attach hook callbacks. * * WooCommerce 9.3 removed the new Navigation feature making this class obsolete. * This class will only be inited on stores running WooCommerce 9.2 or older. */ 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 $tool_name 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_Batch_Processor Interface * * Interface for batch data processors. See the WCS_Batch_Processing_Controller class for usage details. * * @package WooCommerce Subscriptions * @version 7.7.0 * @since 7.7.0 */ interface WCS_Batch_Processor { /** * Get a user-friendly name for this processor. * * @return string Name of the processor. */ public function get_name(): string; /** * Get a user-friendly description for this processor. * * @return string Description of what this processor does. */ public function get_description(): string; /** * Get the total number of pending items that require processing. * Once an item is successfully processed by 'process_batch' it shouldn't be included in this count. * * Note that the once the processor is enqueued the batch processor controller will keep * invoking `get_next_batch_to_process` and `process_batch` repeatedly until this method returns zero. * * @return int Number of items pending processing. */ public function get_total_pending_count(): int; /** * Returns the next batch of items that need to be processed. * * A batch item can be anything needed to identify the actual processing to be done, * but whenever possible items should be numbers (e.g. database record ids) * or at least strings, to ease troubleshooting and logging in case of problems. * * The size of the batch returned can be less than $size if there aren't that * many items pending processing (and it can be zero if there isn't anything to process), * but the size should always be consistent with what 'get_total_pending_count' returns * (i.e. the size of the returned batch shouldn't be larger than the pending items count). * * @param int $size Maximum size of the batch to be returned. * * @return array Batch of items to process, containing $size or less items. */ public function get_next_batch_to_process(int $size): array; /** * Process data for the supplied batch. * * This method should be prepared to receive items that don't actually need processing * (because they have been processed before) and ignore them, but if at least * one of the batch items that actually need processing can't be processed, an exception should be thrown. * * Once an item has been processed it shouldn't be counted in 'get_total_pending_count' * nor included in 'get_next_batch_to_process' anymore (unless something happens that causes it * to actually require further processing). * * @throw \Exception Something went wrong while processing the batch. * * @param array $batch Batch to process, as returned by 'get_next_batch_to_process'. */ public function process_batch(array $batch): void; /** * Default (preferred) batch size to pass to 'get_next_batch_to_process'. * The controller will pass this size unless it's externally configured * to use a different size. * * @return int Default batch size. */ public function get_default_batch_size(): int; } /** * WooCommerce Subscriptions Notifications Debug Tool Processor. * * @package WooCommerce Subscriptions * @category Class * @since 7.7.0 */ class WCS_Notifications_Debug_Tool_Processor implements \WCS_Batch_Processor { /** * Option name for the tool state. * This is used to pass the state of the tool between requests. */ const TOOL_STATE_OPTION_NAME = 'wcs_notifications_debug_tool_state'; /** * Constructor. */ public function __construct() { } /** * Get the state of the tool. * * @return array { * @last_offset Last offset processed. * } */ private function get_tool_state(): array { } /** * Update the state of the tool. * * @param array $state New state of the tool. */ private function update_tool_state($state) { } /** * Delete the state of the tool. */ private function delete_tool_state() { } /** * Get a user-friendly name for this processor. * * @return string Name of the processor. */ public function get_name(): string { } /** * Get a user-friendly description for this processor. * * @return string Description of what this processor does. */ public function get_description(): string { } /** * Get the allowed subscription statuses to process. */ protected function get_subscription_statuses(): array { } /** * Get the total number of pending items that require processing. * Once an item is successfully processed by 'process_batch' it shouldn't be included in this count. * * Note that the once the processor is enqueued the batch processor controller will keep * invoking `get_next_batch_to_process` and `process_batch` repeatedly until this method returns zero. * * In this case, this means total number of subscriptions in allowed statuses - number of processed subscriptions. * * @return int Number of items pending processing. */ public function get_total_pending_count(): int { } /** * Returns the next batch of items that need to be processed. * * A batch item can be anything needed to identify the actual processing to be done, * but whenever possible items should be numbers (e.g. database record ids) * or at least strings, to ease troubleshooting and logging in case of problems. * * The size of the batch returned can be less than $size if there aren't that * many items pending processing (and it can be zero if there isn't anything to process), * but the size should always be consistent with what 'get_total_pending_count' returns * (i.e. the size of the returned batch shouldn't be larger than the pending items count). * * @param int $size Maximum size of the batch to be returned. * * @return array Batch of items to process, containing $size or less items. */ public function get_next_batch_to_process(int $size): array { } /** * Process data for the supplied batch. * * This method should be prepared to receive items that don't actually need processing * (because they have been processed before) and ignore them, but if at least * one of the batch items that actually need processing can't be processed, an exception should be thrown. * * Once an item has been processed it shouldn't be counted in 'get_total_pending_count' * nor included in 'get_next_batch_to_process' anymore (unless something happens that causes it * to actually require further processing). * * @throw \Exception Something went wrong while processing the batch. * * @param array $batch Batch to process, as returned by 'get_next_batch_to_process'. */ public function process_batch(array $batch): void { } /** * Default (preferred) batch size to pass to 'get_next_batch_to_process'. * The controller will pass this size unless it's externally configured * to use a different size. * * @return int Default batch size. */ public function get_default_batch_size(): int { } /** * Start the background process for batch processing subscription notifications updates. * * @return string Informative string to show after the tool is triggered in UI. */ public function enqueue(): string { } /** * Stop the background process for batch processing subscription notifications updates. * * @return string Informative string to show after the tool is triggered in UI. */ public function dequeue(): string { } /** * Add the tool to start or stop the background process that manages notification batch processing. * * @param array $tools Old tools array. * @return array Updated tools array. */ public function handle_woocommerce_debug_tools(array $tools): array { } } /** * 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 $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 { /** * 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 * * @return string */ public function add_to_cart_text() { } /** * Get the add to cart button text for the single page * * @return string */ public function single_add_to_cart_text() { } /** * Checks if the variable product this variation belongs to is purchasable. * * @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. * * @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 * * @deprecated 2.2.0 Use WC_Subscriptions_Product::get_sign_up_fee() instead. * * @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 ) * @deprecated 2.2.0 Use wcs_get_price_including_tax() instead. * * @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 ) * * @deprecated 2.2.0 Use wcs_get_price_excluding_tax() instead. * * @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() { } /** * Provides the descriptive text for add-to-cart buttons. * * @return mixed */ public function add_to_cart_description() { } /** * 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 * * @deprecated 2.2.0 Use WC_Subscriptions_Product::get_sign_up_fee(). * * @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 ) * @deprecated 2.3.0 * * @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 ) * @deprecated 2.2.0 * * @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) { } /** * 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 function add_to_cart_handler($handler, $product) { } /** * Sync variable product prices with the children lowest/highest prices. * * @param int $product_id The ID of the product to sync. * * @return void */ public function variable_product_sync($product_id = 0) { } /** * 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() { } } /** * WC_Subscription_Query_Controller class. */ class WC_Subscription_Query_Controller { /** * The wcs_get_subscriptions() query variables. * * @var array */ private $query_vars = []; /** * Constructor. * * @param array $query_vars The wcs_get_subscriptions() query variables. */ public function __construct($query_vars) { } /** * Determines if the query is for a specific product or variation. * * @return bool True if the query is for a specific product or variation, otherwise false. */ public function has_product_query() { } /** * Determines if the wcs_get_subscription() query should filter the results by product ID or variation ID after the query has been run. * * If the wcs_get_subscriptions() query is substantially limited (eg to a customer or order) we know that the results will be small. In these cases, we can * filter the results by product ID or variation ID after the query has been run for better performance. * * @return bool True if the subscriptions should be queried by product ID, otherwise false. */ public function should_filter_query_results() { } /** * Filters the subscription query results by product ID or variation ID. * * @param WC_Subscription[] $subscriptions * @return WC_Subscription[] The filtered subscriptions. */ public function filter_subscriptions($subscriptions) { } /** * Applies pagination to the subscriptions array. * * @param WC_Subscriptions[] $subscriptions * @return WC_Subscriptions[] The subscriptions array with pagination applied. */ public function paginate_results($subscriptions) { } } /** * 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; /** * Stores if the subscription is in the payment completed flow. * Allowing subscriptions to be renewed even if they have limited products. * * @var bool */ private $is_payment_completed_flow = \false; /** * 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' => '', 'last_order_date_created' => \null, // 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) { } /** * Checks if the subscription contains an unavailable product. * * A product is considered unavailable if it is: * - Deleted (not found) * - Not published (draft, trash, private, etc.) * * Note: This method intentionally does NOT use is_purchasable() to avoid incorrectly * flagging limited products as unavailable. Limited products return is_purchasable() = false * for users with existing subscriptions, but they should still be available for resubscribe. * Functions like wcs_can_user_resubscribe_to() have specific logic to handle limited products * by checking if the user has an active subscription. * * @return bool */ public function contains_unavailable_product() { } /** * 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 * @return bool */ 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_update 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') { } /** * The subscription last order created date. * * @return string */ public function get_last_order_date_created($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) { } /** * Set the subscription last order created date. */ public function set_last_order_date_created($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'. * @param array $exclude_statuses An array of subscription statuses to exclude from the date calculation. */ public function get_date($date_type, $timezone = 'gmt', $exclude_statuses = array()) { } /** * 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 $value 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. * @param array $exclude_statuses An array of subscription statuses to exclude from the date calculation. * @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', $exclude_statuses = array()) { } /** * 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') { } /** * Formats a subscription date timestamp for display. * * @param int $timestamp_gmt The subscription date in a timestamp format. * @param string $date_type The subscription date type to display. @see WC_Subscription::get_valid_date_types() * * @return string The formatted date to display. */ public function format_date_to_display($timestamp_gmt, $date_type) { } /** * 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'. * @param array $exclude_statuses An array of subscription statuses to exclude from the date calculation. */ public function get_time($date_type, $timezone = 'gmt', $exclude_statuses = array()) { } /** * Set the dates on the subscription. * * This method is more strict than update_valid_dates() in that it will throw an exception if any of the dates are not in the correct format or are not compatible with the current subscription dates. * * @see update_valid_dates() for a more permissive alternative that allows ignoring invalid dates. * * @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 bool True if the dates were updated, false otherwise. * @throws InvalidArgumentException if the dates are not in the correct format or are not compatible with the current subscription dates. */ public function update_dates($dates, $timezone = 'gmt'): bool { } /** * Set the dates on the subscription. * * This method is more permissive than update_dates() in that it will ignore invalid date values and save only valid values. * It still throws an exception if the date values are in the wrong order. * * @see update_dates() for a more strict alternative that will throw an exception if any of the dates are not in the correct format or are not compatible with the current subscription dates. * * @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 bool True if the dates were updated, false otherwise. * @throws InvalidArgumentException if the dates are not in the correct format or are not compatible with the current subscription dates. * * @since 7.7.0 More permissive alternative to update_dates(). */ public function update_valid_dates($dates, $timezone = 'gmt'): bool { } /** * 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, and 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 array $validation_options array containing the following validation options: * - timezone: The timezone of the $datetime param. Default 'gmt'. * - ignore_invalid_dates: Whether to ignore invalid dates. Default false. When invalid date is ignored, the current value stored on subscription (if any) is used instead. * @return bool True if the dates were updated, false otherwise. * @throws InvalidArgumentException if the dates are not in the correct format or are not compatible with the current subscription dates. * * @since 7.7.0 Shared logic for update_dates() and update_valid_dates(). */ private function flexible_update_dates($dates, $validation_options = array()): bool { } /** * 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. * * This function is primarily used when the date needs to be recalculated (e.g., after a renewal or if the date has already passed). * If you need to retrieve the currently scheduled date, use get_date() or get_time() instead. * * @see WC_Subscription::calculate_next_payment_date() for more details about how the next payment date is calculated. * * @param string $date_type 'trial_end', 'next_payment', 'end_of_prepaid_term' or 'end'. * * @return string|int The calculated date in MySQL format (`YYYY-MM-DD HH:MM:SS`), or `0` if undefined. */ public function calculate_date($date_type) { } /** * Calculates the next payment date for a subscription. * * This function calculates the next valid renewal date. This could be the currently scheduled next payment date if it's still valid or * it could be a newly calculated date based on specific conditions. It is primarily used when the next payment date needs to be * recalculated (e.g., after a renewal or if the next payment date has already passed). * * How it calculates the next payment date: * - If the subscription has a trial period, and the trial is still active, the next * payment returned is the scheduled trial end date. * - Otherwise, the function selects a base date and adds {interval} {period} to it. The base date is chosen in this order: * 1. Current next payment date – Used if the subscription has a trial period and there's no first renewal payment yet or it is synced * to a fixed billing day. * 2. Last payment date – This is the most common case. The last order payment date is used to ensure the customer is given a full * billing term after they successfully paid the last order. This is important in cases where the last order payment failed and * was paid sometime later. * - This can be bypassed using the 'wcs_calculate_next_payment_from_last_payment' filter. * - @see https://github.com/woocommerce/woocommerce-subscriptions-preserve-billing-schedule * 3. Next payment date – Used when the filter above is used and the subscription has a valid next payment date. This preserves the * subscriptions current billing date. eg if the subscription's payment date occurs on the 10th of every month, it will continue * even if the last payment was received late. * 4. Subscription start date – Used as a last resort if no valid payment dates exist. * * Important notes: * - If the resulting calculated next payment date is less than 2 hours in the future, it will add an additional billing period * until it finds a date a least 2 hours in the future. This was originally necessary to combat daylight savings issues. ie if * we added 1 billing period to the previous date but there has been a subsequent daylight savings change, the next payment date * could be on the same day as the previous payment. * - If the subscription has an end date, and the calculated next payment occurs after it, the function returns 0. ie there are no * more payments to be made. * - Although an inactive subscription does not have a public facing next payment date, this function will still calculate the date * so it can be used when determining what the next date would be if the subscription were to be reactivated. * * Filters: * - wcs_calculate_next_payment_from_last_payment (bool) – Controls whether the function * should use the last payment date as the base for calculation. Default is true. * * @return int|string Zero if the subscription has no next payment date, or a MySQL formatted date (YYYY-MM-DD HH:MM:SS) 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 * @return bool */ 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 $last_order */ public function payment_complete_for_order($last_order) { } /** * When related order fails, update the status of the related order and the subscription. * Related order can fail because of payment failure or because of other reasons. * * @param string $new_status The new status to set for the subscription. * @param WC_Order|bool $related_order The related order that failed payment. False if no related order is found. * @since 7.9.0 Replaces payment_failed() method. */ public function payment_failed_for_related_order($new_status = 'on-hold', $related_order = \false) { } /** * 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 * @deprecated 7.9.0 - The method incorrectly assumes that the last order failed, and sometimes causes side effects.Use payment_failed_for_related_order instead. */ 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')) { } /** * Offers a means of fetching paginated sets of related orders. * * @since 7.5.0 * * @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' ). * @param int $page Optional. Can be used to specify which page of results is desired. * @param int $limit Optional. Can be used to specify how many results are desired per page. Defaults to -1, which is treated as meaning 'unlimited'. * * @return object { * array: orders, * int: total, * int: max_num_pages * } */ public function get_paginated_related_orders(string $return_fields = 'ids', $order_types = array('parent', 'renewal', 'switch'), int $page = 1, int $limit = 10): object { } /** * Get the related order IDs for a subscription based on an order type. * * @since 1.0.0 - Migrated from WooCommerce Subscriptions v2.3.0 * @since 7.2.1 - The $order_type parameter can now be an array of order types and the $return_type parameter was added. * * @param string|array $order_type Can include 'any', 'parent', 'renewal', 'resubscribe' and/or 'switch'. Defaults to 'any'. * @param string $return_type The format to return the related order IDs in. Can be 'flat' or 'grouped'. Defaults to 'flat'. * * @return array List of related order IDs. */ protected function get_related_order_ids($order_type = 'any', $return_type = 'flat') { } /** * 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'. * @param array $exclude_statuses An array of statuses to exclude from the search. Defaults to an empty array. * @since 1.0.0 - Migrated from WooCommerce Subscriptions v2.0 */ public function get_last_order($return_fields = 'ids', $order_types = array('parent', 'renewal'), $exclude_statuses = []) { } /** * 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 $product_id 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 WC_Order_Item_Product|int $line_item 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. * * @see prepare_dates_for_update() as a preferrable and more flexible alternative. * * @param array $dates array containing dates with keys: 'date_created', 'trial_end', 'next_payment', 'last_order_date_created' or 'end'. Values are timestamps or 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. * @throws InvalidArgumentException if the dates are not in the correct format or are not compatible with the current subscription dates. * * @deprecated 7.7.0 - Use prepare_dates_for_update() instead. This method remains in place for backwards compatibility. */ public function validate_date_updates(array $dates, string $timezone = 'gmt'): array { } /** * Prepares the dates for setting/deleting by validating values and adjusting to the gmt timezone. * * Validates subscription date updates ensuring the proposed date changes are in the correct format and are compatible with * the current subscription dates. Also allows excluding invalid dates from the results. * * @param array $dates array containing dates with keys: 'date_created', 'trial_end', 'next_payment', 'last_order_date_created' or 'end'. Values are timestamps or MySQL formatted date/time strings in UTC timezone. * @param array $options array containing the following validation options: * - timezone: The timezone of the $datetime param. Default 'gmt'. * - ignore_invalid_dates: Whether to ignore invalid dates. Default false. When invalid date is ignored, the current value stored on subscription (if any) is used instead. * @return array $dates array of dates in gmt timezone. * @throws InvalidArgumentException if the dates are not in the correct format or are not compatible with the current subscription dates. * * @since 7.7.0 Alternative to validate_date_updates() for more flexible validation options. */ public function prepare_dates_for_update($dates, $options = array()): array { } /** * 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 $qty 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() { } /** * Outputs the necessary markup on the "My Account" > "Edit Account" page for editing contact info (Name, Email) * to check if the customer wants to update the contact info in Billing addresses for all of their active subscriptions. * * @since 7.5.0 */ public static function maybe_add_edit_addresses_checkbox() { } /** * When user's contact info is successfully updated, check if the subscriber * has also requested to update the contact info in 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 7.5.0 */ public static function maybe_update_subscription_addresses_contact($user_id) { } /** * 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 * * @since 1.0.0 - Migrated from WooCommerce Subscriptions v1.3 * @deprecated 2.2.0 Use WC_Order::set_address() or WC_Subscription::set_address() * * @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 */ 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. * * @param bool $valid Whether the product can be added to the cart. * @param int $product_id The product ID. * @param int $quantity The quantity of the product being added. * @param int $variation_id The variation ID. * @param array $variations The variations of the product being added. * @param array $item_data The additional item data set by all plugins. * * @return bool Whether the product can be added to the cart. * @since 1.0.0 - Migrated from WooCommerce Subscriptions v2.6.0 */ public static function maybe_empty_cart($valid, $product_id, $quantity, $variation_id = 0, $variations = array(), $item_data = 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) { } /** * Validates an incoming add-to-cart attempt against four cart-item-shape rules: * * 1. Renewal-block: if the cart already contains a subscription renewal, reject any * non-renewal add (plain or resubscribe-tagged). Renewal carts must remain isolated to * the single renewing subscription. * 2. Active-subscription-flow-block: if the cart already contains a resubscribe or switch * item for the same product, reject a plain add for that product. Each control-item * type fires its own branch with a flow-specific notice ("subscription resubscribe", * "subscription switch") so the customer can identify which existing flow to complete * or cancel. `subscription_initial_payment` items are deliberately excluded - those * only appear via the pay-for-order URL, where the cart is captive to the pending * order at the system level (update_cart_hash) and Layer 1 protection is unnecessary. * 3. Plain-vs-control-block: if the incoming item is renewal- or resubscribe-tagged and the * cart already contains a plain item for the same product, reject the add (symmetric * counterpart of rule 2). * 4. Limited-product duplicate-block: if the incoming item is a plain add for a limited * subscription product and the cart already contains another plain item for the same * product, reject the add. WC normally merges matching cart-ids, but variations with * differing attributes or extension-injected item data can bypass that merge. * * @since 7.7.0 * @since 8.8.0 Extended to handle three additional enforcement paths (rules 2, 3, and 4). * Rule 2 expanded to cover subscription_switch and subscription_initial_payment * cart items in addition to subscription_resubscribe. * * @param bool $can_add Whether the product can be added to the cart. * @param int $product_id The product ID. * @param int $quantity The quantity of the product being added. * @param int $variation_id The variation ID. * @param array $variations The variations of the product being added. * @param array $item_data The item data. * * @return bool Whether the product can be added to the cart. */ public static function can_add_product_to_cart($can_add, $product_id, $quantity, $variation_id = 0, $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) { } /** * Validates the cart against per-product subscription limits. * * Hooked to `woocommerce_check_cart_items` (cart page load, checkout page load, and Place Order * submission). When a limited subscription product appears more than once across cart items, * or appears as a plain item while the customer already has an active/on-hold subscription * to it, an error notice is queued. WooCommerce blocks cart and checkout progression while * any error notice is registered against this hook. * * Acts as the last-mile defence for code paths that bypass `can_add_product_to_cart` (Store API, * programmatic `WC()->cart->add_to_cart()` from extensions, restored session carts). * * Skips the order-received page and the PayPal API handler so post-payment confirmation * and PayPal IPN callback hydration do not surface error notices. This mirrors two of the * three context bypasses in `WCS_Limiter::is_product_limited`; the third bypass there * (`order_awaiting_payment_for_product()`) is not duplicated because Layer 3 already exempts * "control item + zero plain" carts, which is the shape produced by pay-for-order flows. * * @since 8.8.0 */ public static function validate_subscription_limits() { } /** * Reconciles the cart when it contains both a control item (resubscribe or renewal) and a * plain item for the same limited subscription product. The plain duplicate is removed and * the control item is preserved. Mirrors the notice/redirect pattern used by * `validate_cart_contents_for_mixed_checkout()` for its mixed-checkout-off branch. * * Switch and initial-payment items are intentionally NOT treated as Layer 2 reconciliation * triggers - those flows are actively in progress and the customer has chosen them * deliberately, so silently mutating their cart would surprise them. Layer 3 * (`validate_subscription_limits()`) gives them the same exemption when no plain duplicate * is present. * * @since 8.8.0 * * @param WC_Cart $cart The cart loaded from session. */ private static function reconcile_same_product_duplicates($cart) { } /** * Groups the cart items by canonical product (variation IDs collapse to their parent). * * Returns one entry per logical product in the cart. Each entry carries the cart-item keys * for every classification of cart item we care about: * * - `plain` - regular add-to-cart items. * - `resubscribe` - items tagged with `subscription_resubscribe` (created via * `WCS_Cart_Resubscribe`). * - `renewal` - items tagged with `subscription_renewal` (created via * `WCS_Cart_Renewal`). * - `switch` - items tagged with `subscription_switch` (created via * `WCS_Cart_Switch`). * - `initial_payment` - items tagged with `subscription_initial_payment` (created via * `WCS_Cart_Initial_Payment`). * * The four control-flow buckets (resubscribe, renewal, switch, initial_payment) are kept * separate because Layer 2 (silent reconciliation) and Layer 3 (limit validation) apply * different rules to each: * * - Layer 3 treats all four as control items - a solo control item never conflicts, but a * control + plain combination always does. * - Layer 2 treats only `resubscribe` and `renewal` as triggers. Switch and initial-payment * flows are user-initiated, in-progress checkouts; silently removing line items mid-flow * would surprise the customer. * * `control_count` is the sum of the four control buckets, exposed as a precomputed field to * avoid every caller summing it manually. * * @since 8.8.0 * * @param WC_Cart $cart The cart whose `cart_contents` should be grouped. * * @return array, * resubscribe: array, * renewal: array, * switch: array, * initial_payment: array, * control_count: int * }> */ private static function group_cart_items_by_product($cart) { } /** * Resolves the product to use for user-facing display. Variations are not subscriptions in * their own right (`WC_Subscriptions_Product::is_subscription` returns false for them); the * parent variable subscription product carries the limit setting and the customer-facing * name. Fall back to the parent so notices and assertions reference the merchant-defined * product. * * @since 8.8.0 * * @param WC_Product|null $product Product taken from a cart item. * * @return WC_Product|null Original product when it is not a variation; the parent product * when it is and the parent can be loaded; the original product * (variation or null) otherwise. */ private static function get_display_product($product) { } /** * Returns the cart item keys matching a given product, grouped by item type. * * Variations are matched against their parent product so a plain variation cart item * conflicts with a resubscribe/renewal/switch/initial-payment cart item that uses the * parent ID and vice versa. * * Buckets mirror `group_cart_items_by_product()` so the two helpers classify cart items * consistently. Layer 1's rules (`can_add_product_to_cart()`) read individual control * buckets to surface accurate notice messages; Layer 3's matrix iterates the same * buckets via `control_count`. Keeping the shapes aligned avoids a class of bug where a * switch or initial-payment cart item (placed via Store API, session restoration, or an * extension that bypasses `setup_cart()`) is misclassified as plain and triggers a Layer * 1 rule with a misleading notice ("non-subscription item" when the cart actually holds * a subscription switch). * * @since 8.8.0 * * @param int $product_id The product ID being added. * @param int $variation_id The variation ID being added (0 if not a variation). * * @return array{plain:array,resubscribe:array,renewal:array,switch:array,initial_payment:array} */ private static function get_cart_items_for_product($product_id, $variation_id = 0) { } /** * Determines whether a product is a limited subscription product. * * For variations, falls back to the parent product when needed - `wcs_get_product_limitation()` * already resolves the limitation off the parent. * * @since 8.8.0 * * @param int|WC_Product $product Product ID or product object. * * @return bool True when the product is a subscription with `_subscription_limit !== 'no'`. */ private static function is_limited_subscription_product($product) { } /** * 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 * @deprecated 3.0.0 */ public static function can_add_subscription_product_to_cart($can_add, $product_id, $quantity, $variation_id = '', $variations = array(), $item_data = array()) { } } /** * 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; /** * A stack of recurring cart keys being calculated. * * Before calculating a cart's totals, we set the recurring cart key and calculation type to match that cart's key and type. @see self::set_recurring_cart_key_before_calculate_totals() * After a cart's totals have been calculated, we restore the recurring cart key and calculation type. @see self::update_recurring_cart_key_after_calculate_totals() * * @var array */ private static $recurring_totals_calculation_stack = []; /** * 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) { } /** * Sets the recurring cart key and calculation type before calculating a carts totals. * * @param WC_Cart $cart The cart object being calculated. */ public static function set_recurring_cart_key_before_calculate_totals($cart) { } /** * Updates the recurring cart key and calculation type after calculating a carts totals. * * @param WC_Cart $cart The cart object that finished calculating it's totals. */ public static function update_recurring_cart_key_after_calculate_totals($cart) { } /** * 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. * @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) { } /** * Builds the per-item "$X due today" subtotal for a subscription line item, matching the block cart/checkout * presentation. The amount is the first payment: the first period plus the sign-up fee when there is no trial, or * just the sign-up fee when a trial defers the first period. The `$fallback` is returned unchanged when no * "due today" amount should be shown — on a renewal cart, or for items with no sign-up fee (matching the block * gate; even trial-only items keep the standard subtotal with no label). * * Shared by the classic cart/checkout subtotal for regular subscription products * (see get_formatted_product_subtotal) and for bundle/composite containers * (see WCS_ATT_Integration_PB_CP::container_due_today_subtotal), which differ only in how the first-period amount * is sourced. * * @since 9.1.0 * * @param WC_Product $product The subscription product (or bundle/composite container product). * @param int $quantity The line quantity. * @param callable $get_recurring_amount Given a boolean $incl_tax, returns the tax-adjusted first-period amount * for the whole line. Only called when there is no trial. * @param string $fallback The markup to return unchanged when no "due today" amount applies. * @return string */ public static function get_due_today_subtotal($product, $quantity, callable $get_recurring_amount, $fallback) { } /** * Returns the cart's tax price display mode ('incl' or 'excl'), with a fallback for WooCommerce versions before * 4.4 where WC_Cart::get_tax_price_display_mode() did not yet exist. Centralised so the classic cart/checkout * presentation resolves the mode the same way everywhere. * * @since 9.1.0 * @return string */ public static function get_tax_display_mode() { } /* * 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) { } /** * Make sure cart product prices correctly include/exclude taxes. * * On the classic cart page the trial and sign-up fee are surfaced as dedicated detail lines below the price * (matching the block cart, @see should_surface_detail_lines()) instead of the inline price-string suffix. Every * other context that runs this filter (the mini-cart, page builders, ...) keeps the long-standing inline suffix. * * @since 1.0.0 - Migrated from WooCommerce Subscriptions v1.5.8 */ public static function cart_product_price($price, $product) { } /** * Whether the classic cart/checkout should surface the trial & sign-up fee as dedicated detail lines, * matching the block cart/checkout presentation, rather than the inline price-string suffix. * * The mini-cart keeps the long-standing inline suffix, so it is excluded even when rendered on the cart page. * * @since 9.1.0 * @return bool */ protected static function should_surface_detail_lines() { } /** * Appends the recurring price and the trial / sign-up fee detail lines below a cart item on the classic checkout. * * The classic checkout consolidates everything into a single Product column (no separate Price column), so the * recurring amount and the "Free trial:" / "Sign-up fee:" lines are appended after the "name × qty" markup — the * same information the cart page shows in its Price column, matching the block checkout presentation. * * @since 9.1.0 * * @param string $quantity_html The "× qty" markup rendered before this filter. * @param array $cart_item The cart item. * @param string $cart_item_key The cart item key. * @return string */ public static function checkout_cart_item_details($quantity_html, $cart_item, $cart_item_key) { } /** * Builds the classic-checkout Product-column markup for a subscription line item: the recurring price followed by * the trial / sign-up fee detail lines, appended after the "name × qty" markup. Shared by the regular subscription * path (see checkout_cart_item_details) and the bundle/composite container path in the PB/CP integration, which * differ only in how the recurring amount is sourced. * * @since 9.1.0 * * @param string $quantity_html The "× qty" markup rendered before this filter. * @param WC_Product $product The subscription product (or bundle/composite container product). * @param float $recurring_amount The tax-adjusted recurring amount for the line. * @param string $tax_display_mode The cart tax display mode ('incl' or 'excl'). * @return string */ public static function build_checkout_item_details($quantity_html, $product, $recurring_amount, $tax_display_mode) { } /** * 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 if the recurring package rates match the initial package rates. * * @param array $standard_packages The standard packages. * @param array $recurring_cart_package The recurring cart package. * @param string $recurring_cart_key The recurring cart key. * @param object $recurring_cart The recurring cart. * @return bool Whether the recurring package rates match the initial package rates. */ public static function package_rates_match_initial_rates($standard_packages, $recurring_cart_package, $recurring_cart_key, $recurring_cart) { } /** * Checks the cart to see if it contains a specific product. * * @param int $product_id 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 $product_id 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) { } /** * 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 $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 string */ 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. * * @param string $role The role of the cart item to check for. * @return array|false The cart item containing the 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 $cart_totals_fee_html String of the coupon's discount amount * @param string $fee 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. * * @deprecated 7.3.0 - no longer in use internally */ public static function maybe_restore_chosen_shipping_method() { } /** * Return a localized free trial period string. * * @param int $number An interval in the range 1-6 * @param string $period 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 void * @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() { } /** * Remove the item names from the shipping rate * to check if the rates match. * * @param WC_Shipping_Rate $rate The rate. * @return WC_Shipping_Rate The rate. */ private static function remove_item_names_from_rate($rate) { } } /** * 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 = \null) { } /** * Add a "Change Payment Method" button to the "My Subscriptions" table. * * @param array $actions The $subscription_key => $actions array with all actions that will be displayed for a subscription on the "My Subscriptions" table * @param WC_Subscription $subscription The subscription. * @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. * * @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 = []) { } /** * 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_Subscription $subscription The subscription. * @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 * @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. * * @since 1.0.0 - Migrated from WooCommerce Subscriptions v1.4 * @deprecated 1.0.0 - Migrated from WooCommerce Subscriptions v2.0 * * @param string $subscription_key The subscription key. * @param WC_Order $order The order. * @param string $new_payment_method The new payment method. */ 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. * * @deprecated 2.0 Use WC_Subscriptions_Change_Payment_Gateway::can_subscription_be_updated_to_new_payment_method() instead. * * @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_Subscription $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 $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_Order_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) { } /** * Check if the current page is the coupon edit page. * * @since 1.0.0 - Migrated from WooCommerce Subscriptions v4.0.0 * * @return bool Whether the current page is the coupon edit page. */ public static function is_coupon_edit_page() { } /* 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. * * @param WC_Cart $cart The cart object. * * @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', '_last_order_date_created', '_trial_period', '_created_via', '_order_stock_reduced', 'id']; /** * 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 Notifications Class * * * @package WooCommerce Subscriptions * @subpackage WC_Subscriptions_Email * @category Class */ class WC_Subscriptions_Email_Notifications { /** * @var string Offset setting option identifier. */ public static $offset_setting_string = '_customer_notifications_offset'; /** * @var string Enabled/disabled setting option identifier. */ public static $switch_setting_string = '_customer_notifications_enabled'; /** * List of subscription notification email classes. * * @var array */ public static $email_classes = ['WCS_Email_Customer_Notification_Manual_Trial_Expiration' => \true, 'WCS_Email_Customer_Notification_Auto_Trial_Expiration' => \true, 'WCS_Email_Customer_Notification_Manual_Renewal' => \true, 'WCS_Email_Customer_Notification_Auto_Renewal' => \true, 'WCS_Email_Customer_Notification_Subscription_Expiration' => \true]; /** * Init. */ public static function init() { } /** * Map and forward Edit order screen action to the correct reminder. * * @param $order * * @return void */ public static function forward_action($order) { } /** * Sets the update time when any of the settings that affect notifications change and triggers update of subscriptions. * * When time offset or global on/off switch change values, this method gets triggered and it: * 1. Updates the wcs_notification_settings_update_time option so that the code knows which subscriptions to update * 2. Triggers rescheduling/unscheduling of existing notifications. * 3. Adds a notice with info about the actions that got triggered to the store manager. * * Side note: offset gets updated in WCS_Action_Scheduler_Customer_Notifications::set_time_offset_from_option. * * @return void */ public static function set_notification_settings_update_time() { } /** * Add Subscriptions notifications' email classes. */ public static function add_emails($email_classes) { } /** * Hook the notification emails with our custom trigger. */ public static function hook_notification_emails() { } /** * Send the notification emails. * * @param int $subscription_id Subscription ID. */ public static function send_notification($subscription_id) { } /** * Is the notifications feature enabled? * * @return bool */ public static function notifications_globally_enabled() { } /** * Should the emails be sent out? * * @return bool */ public static function should_send_notification() { } /** * Adds actions to the admin edit subscriptions page. * * @param array $actions An array of available actions * @return array An array of updated actions */ public static function add_notification_actions($actions) { } /** * Adds the subscription notification setting. * * @param array $settings Subscriptions settings. * @return array Subscriptions settings. */ public static function add_settings($settings) { } } /** * 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 { /** * Used to capture the ID of a subscription that is potentially being reactivated. */ private static int $subscription_being_reactivated_id = -1; /** * List of all core subscription email classes. * * @var array */ public static $email_classes = ['WCS_Email_New_Renewal_Order' => \true, 'WCS_Email_New_Switch_Order' => \true, 'WCS_Email_Processing_Renewal_Order' => \true, 'WCS_Email_Completed_Renewal_Order' => \true, 'WCS_Email_Customer_On_Hold_Renewal_Order' => \true, 'WCS_Email_Completed_Switch_Order' => \true, 'WCS_Email_Customer_Renewal_Invoice' => \true, 'WCS_Email_Cancelled_Subscription' => \true, 'WCS_Email_Expired_Subscription' => \true, 'WCS_Email_On_Hold_Subscription' => \true, 'WCS_Email_Reactivated_Subscription' => \true]; /** * 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 WC_Subscription $subscription The subscription being examined. * @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) { } /** * Listen for subscriptions being reactivated by the customer (not the admin). * * This method expects to run when a customer reactivates a subscription, which specifically means the customer has * taken action to move a subscription from 'pending-cancel' to 'active'. * * @internal This method may be moved or renamed without notice. * @since 8.4.0 * * @param WC_Subscription|mixed $subscription The subscription being examined. */ public static function watch_for_reactivations($subscription) { } /** * Trigger the email reactivation email. * * This method expects to run when a customer reactivates a subscription, which specifically means the customer has * taken action to move a subscription from 'pending-cancel' to 'active'. * * @internal This method may be moved or renamed without notice. * @since 8.4.0 * * @param WC_Subscription|mixed $subscription The subscription being examined. */ public static function maybe_send_reactivation_email($subscription) { } /** * 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 string $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 = '') { } /** * Show the subscription details table. * * @param WC_Subscription[] $subscriptions List of subscriptions. Also accepts a single subscription. * @param WC_Order|null $order The order related to the subscription - defaults to parent 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 bool $skip_my_account_link Whether to skip displaying the My Account link - defaults to false. */ public static function subscription_details($subscriptions, $order = \null, $sent_to_admin = \false, $plain_text = \false, $skip_my_account_link = \false) { } /** * Detach WC transactional emails from a specific hook. * * @param string $hook Optional. The action hook or filter to detach WC core's transactional emails from. Defaults to the current filter. * @param int $priority 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 $hook Optional. The action hook or filter to attach WC core's transactional emails to. Defaults to the current filter. * @param int $priority Optional. The priority the function should run on. Default 10. * @param int $accepted_args 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 string $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 = '') { } /** * If the subscription was cancelled before, reset the cancelled email sent flag so the customer can be notified of a future cancellation. * * @param $subscription WC_Subscription The subscription object. * @return void */ public static function maybe_clear_cancelled_email_flag($subscription) { } /** * 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() { } /** * Select the initial shipment shipping rate. * * @param string $package_id Package ID. * @param string $rate_id Rate ID. */ public static function initial_shipment_select_shipping_rate($package_id, $rate_id) { } /** * 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 coupon data for a recurring cart. * * Excludes internal pseudo-renewal coupon types (`renewal_cart`, `renewal_fee`, * `renewal_percent`) which are applied programmatically to renewal/resubscribe * carts and should never surface in customer-facing UI. * * @param \WC_Cart $cart Recurring cart instance. * @return array Array of coupon data with code and total_discount. */ protected static function get_recurring_cart_coupons($cart) { } /** * Get coupon codes that should be hidden from the initial cart display in block checkout. * * Mirrors the logic in WC_Subscriptions_Coupon::mark_recurring_coupon_in_initial_cart_for_hiding() * for the classic cart/checkout. * * @return array List of coupon codes to hide. */ protected static function get_hidden_coupon_codes() { } /** * Provide cart-level subscription metadata to the Store API. * * @return array Cart-level subscription data. */ public static function extend_cart_meta_data() { } /** * Schema for cart-level subscription metadata. * * @return array Registered schema. */ public static function extend_cart_meta_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. * @param int $product_id The ID of the product. * @since 1.0.0 - Migrated from WooCommerce Subscriptions v1.0 */ public static function process_subscription_payments_on_order($order, $product_id = 0) { } /** * 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. * @param int $product_id The ID of the product. * @since 1.0.0 - Migrated from WooCommerce Subscriptions v1.0 */ public static function process_subscription_payment_failure_on_order($order, $product_id = 0) { } /** * 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. * * This method only performs actions when a parent order changed to failed status. * Overlaps with WC_Subscriptions_Order::maybe_record_subscription_payment. * * @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 = 0) { } /* * 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 mixed $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 string $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 string $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 int $order_id The ID of the order in which the subscription was purchased. * @param int $product_id 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 = 0) { } /** * 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 = 0) { } /** * 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() * @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 = 0, $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 string|int $expiration_date (optional)The date and time the subscription will expire, 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 = 0, $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 = 0, $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 = 0, $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 string|int $next_payment (optional) 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 = 0, $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 = 0, $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 = 0) { } /** * 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 = 0, $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 = 0, $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 string|int $trial_expiration_date (optional) The date and time the trial will expire, 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 = 0, $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 = 0, $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 = 0) { } /** * 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 int $product_id (optional) The ID of a subscription product. * @param string $status (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 = 0, $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 = 0) { } /** * 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 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 = 0, $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 WC_Order|int $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 = 0) { } /** * 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 = 0) { } /** * Gets an item by a subscription key of the form created by @see WC_Subscriptions_Manager::get_subscription_key(). * * @param string $subscription_key The subscription key. * @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 string $subscription_key The subscription key. * @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 int $order_item_id The product/post ID of a subscription. Option - if no product id is provided, the first item's meta will be returned * @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 = 0, $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 = 0) { } /** * 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 $order_id The ID of the order. * @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) { } /** * Cancel related orders when a subscription is cancelled. * * @param WC_Subscription $subscription The subscription that was cancelled. */ public static function cancel_pending_related_orders($subscription) { } /* 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 $order_item 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, $skip_my_account_link = \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. * * @param WC_Subscription $subscription The subscription whose related orders we are interested in. */ public static function get_related_orders_template($subscription) { } /** * Introduced to support pagination of the related orders list (within the My Account > View Subscription * screen). * * @since 7.5.0 Updated to support pagination of the related orders list. * * @param WC_Subscription $subscription The subscription whose related orders we are interested in. * @param int[]|null $subscription_orders IDs of the related orders. * @param int|null $page The current page number. * @param int|null $max_num_pages The maximum number of pages in the set. * * @return void */ public static function get_related_orders_pagination_template(\WC_Subscription $subscription, ?array $subscription_orders = \null, ?int $page = \null, ?int $max_num_pages = \null) { } /** * 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 * @deprecated 2.0 Use WC_Subscription::is_editable() instead. */ 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 = 0) { } /** * 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 = 0) { } /** * 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 WC_Order $order The order object. * * @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 is fully paid ($0 owed) and all the * subscriptions in an order are synced, or the order contains a resubscribe or switch. * * @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) { } /** * Translate the friendly subscription-relation query args (`subscription_renewal`, * `subscription_switch`, `subscription_resubscribe`) into a `meta_query` clause so * the HPOS order data store honors them. * * Under CPT, the legacy handler `add_subscription_order_query_args()` below already * translates these args inside the CPT-specific filter. Injecting a `meta_query` arg * upstream of the CPT store would also trigger a `wc_doing_it_wrong` notice from * WC core (`meta_query` is not a supported `wc_get_orders()` arg under CPT). So * this handler is a no-op when HPOS is not the active order data store. * * @param array $args @see wc_get_orders() arguments. * @return array The args, with subscription-relation conditions expressed as a meta_query under HPOS. */ public static function add_subscription_relation_meta_query($args) { } /** * 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 array 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. * * @version 1.0.0 Migrated from WooCommerce Subscriptions v1.2 * @since 1.0.0 Migrated from WooCommerce Subscriptions v1.0 * @deprecated 2.0 Use wcs_order_contains_subscription() instead. * * @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. */ 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 * @deprecated 2.0 */ 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. * * @since 1.0.0 - Migrated from WooCommerce Subscriptions v1.3 * @deprecated 2.0 * * @return bool False if the order contains a subscription that has expired or is cancelled/on-hold, otherwise, the original value of $download_permitted */ 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. * * @since 1.0.0 - Migrated from WooCommerce Subscriptions v1.2.5 * @version 1.0.0 - Migrated from WooCommerce Subscriptions v1.4 * @deprecated 2.0 * * @param WC_Order_Item $item * @param int $item_id An order_item_id as returned by the insert statement of @see woocommerce_add_order_item() * * @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 * @deprecated 2.0 * * @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. * * @deprecated 2.0 * * @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. * * @deprecated 2.0 * * @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. * * @deprecated 2.0 * * @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. * * @deprecated 2.0 * * @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. * * @deprecated 2.0 * * @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. * * @deprecated 2.0 Use WC_Subscription::is_manual() instead. * * @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. * * @deprecated 2.0 Use WC_Order::get_total() instead. * * @param mixed $order A WC_Order object or the ID of the order which the subscription was purchased in. * @param int $product_id The ID of the product. * @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 = 0) { } /** * Returns the recurring amount for an item * * @since 1.0.0 - Migrated from WooCommerce Subscriptions v1.2 * @deprecated 2.0 Use the value for the item on the subscription object instead. * * @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. */ 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 * * @since 1.0.0 - Migrated from WooCommerce Subscriptions v1.2 * @deprecated 2.0 Use the value for the subscription object instead. * * @param WC_Order|int $order A WC_Order object or ID of a WC_Order order. * @param int $product_id The ID of the product. */ public static function get_recurring_discount_cart($order, $product_id = 0) { } /** * Returns the proportion of cart discount tax that is recurring for the product specified with $product_id * * @since 1.0.0 - Migrated from WooCommerce Subscriptions v1.2 * @deprecated 2.0 Use the value for the subscription object instead. * * @param WC_Order|int $order A WC_Order object or ID of a WC_Order order. * @param int $product_id The ID of the product. * */ public static function get_recurring_discount_cart_tax($order, $product_id = 0) { } /** * Returns the proportion of total discount that is recurring for the product specified with $product_id * * @since 1.0.0 - Migrated from WooCommerce Subscriptions v1.2 * @deprecated 2.0 Use the value for the subscription object instead. * * @param WC_Order|int $order A WC_Order object or ID of a WC_Order order. * @param int $product_id The ID of the product. */ public static function get_recurring_discount_total($order, $product_id = 0) { } /** * 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() * * @since 1.0.0 - Migrated from WooCommerce Subscriptions v1.2 * @deprecated 2.0 Use the value for the subscription object instead. * * @param WC_Order|int $order A WC_Order object or ID of a WC_Order order. * @param int $product_id The ID of the product. */ public static function get_recurring_shipping_tax_total($order, $product_id = 0) { } /** * 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() * * @since 1.0.0 - Migrated from WooCommerce Subscriptions v1.2 * @deprecated 2.0 Use the value for the subscription object instead. * * @param WC_Order|int $order A WC_Order object or ID of a WC_Order order. * @param int $product_id The ID of the product. */ public static function get_recurring_shipping_total($order, $product_id = 0) { } /** * Return an array of shipping costs within this order. * * @deprecated 2.0 Use the shipping for each individual subscription object instead. * * @return array */ public static function get_recurring_shipping_methods($order) { } /** * Returns an array of taxes on an order with their recurring totals. * * @deprecated 2.0 Use the taxes for the subscription object instead. * * @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 * @since 1.0.0 - Migrated from WooCommerce Subscriptions v1.2 * @deprecated 2.0 Use the value for the subscription object instead. * * @param WC_Order|int $order A WC_Order object or ID of a WC_Order order. * @param int $product_id The ID of the product. */ public static function get_recurring_total_tax($order, $product_id = 0) { } /** * Returns the proportion of total before tax on an order that is recurring for the product specified with $product_id * * @since 1.0.0 - Migrated from WooCommerce Subscriptions v1.2 * @deprecated 2.0 Use the value for the subscription object instead. * * @param WC_Order|int $order A WC_Order object or ID of a WC_Order order. * @param int $product_id The ID of the product. */ public static function get_recurring_total_ex_tax($order, $product_id = 0) { } /** * 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 The ID of the product. * @since 1.0.0 - Migrated from WooCommerce Subscriptions v1.2 */ public static function get_recurring_total($order, $product_id = 0) { } /** * Creates a string representation of the subscription period/term for each item in the cart * * @since 1.0.0 - Migrated from WooCommerce Subscriptions v1.0 * @deprecated 2.0 Use WC_Subscription::get_formatted_order_total() instead. * * @param WC_Order $order A WC_Order object. * @param mixed $deprecated_price Never used. * @param mixed $deprecated_sign_up_fee Never used. * */ 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. * * @since 1.0.0 - Migrated from WooCommerce Subscriptions v1.2 * @deprecated 2.0 Use the items on each individual subscription object instead. * * @param WC_Order|int $order A WC_Order object or ID of a WC_Order order. */ public static function get_recurring_items($order) { } /** * Returns the period (e.g. month) for a each subscription product in an order. * * @since 1.0.0 - Migrated from WooCommerce Subscriptions v1.0 * @deprecated 2.0 Use the billing period for each individual subscription object instead. * * @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. */ public static function get_subscription_period($order, $product_id = 0) { } /** * 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 = 0) { } /** * 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 = 0) { } /** * 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 = 0) { } /** * 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 = 0) { } /** * 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. f * * @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 * @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 int $product_id 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 int $product_id 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 $order_id The id of the order. * @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 = 0) { } /** * 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) { } /** * Update subscription cached last_order_date_created metadata when deleting a child order. * * @param int $id The deleted order ID. * @param WC_Order $order The deleted order object. */ public static function delete_order_update_order_related_subscriptions_last_order_date_created($id, $order) { } /** * Update subscription cached last_order_date_created metadata when adding a child order. * * @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 static function add_relation_update_order_related_subscriptions_last_order_date_created($order, $subscription, $relation_type) { } /** * Update subscription cached last_order_date_created metadata when deleting a child order relation. * * @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 static function delete_relation_update_order_related_subscriptions_last_order_date_created($order, $subscription, $relation_type) { } /** * Update all subscription cached last_order_date_created metadata related to the order. * * @param WC_Order $order The order object. * @param array $exclude_statuses The order statuses to exclude. */ private static function update_order_related_subscriptions_last_order_date_created($order, $exclude_statuses = []) { } /** * Update subscription cached last_order_date_created metadata when manually updating parent id. * * @param string $type The type of update to check. Only 'add' or 'delete' should be used. * @param int $object_id The object the meta is being changed on. * @param string $key The object meta key being changed. * @param mixed $new_value The meta value. * @param mixed $previous_value The previous value stored in the database. Optional. */ public static function update_subscription_last_order_date_parent_id_changes($type, $object_id, $key, $new_value, $previous_value) { } /** * Update subscription cached last_order_date_created metadata. * * @param WC_Subscription $subscription The subscription object. * @param array $exclude_statuses The order statuses to exclude. */ private static function update_subscription_last_order_date_created($subscription, $exclude_statuses = []) { } /** * 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 WC_Order $order The order in the current row. */ private static function render_contains_subscription_column_content($order) { } } /** * 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(); /* Nesting depth of price-rendering blocks currently being rendered (block themes / block-based templates). */ protected static $price_block_render_depth = 0; /* Whether a WooCommerce Store API request is currently being served (block hydration or a genuine REST call). */ protected static $is_serving_store_api_request = \false; 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', '_subscription_gifting'); /** * 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) { } /** * Checks a given product to determine if it is a variable subscription. * * @param int|WC_Product $product Either a product object or product's post ID. * @since 7.8.0 * @see WC_Subscriptions_Product::is_subscription() */ public static function is_variable_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 $include 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()) { } /** * Whether the inline trial / sign-up fee suffix should be omitted from the displayed price string. * * They are suppressed only where they are either replaced by dedicated detail lines or deliberately hidden: * - the single product page (@see output_subscription_price_details()), and * - catalog / shop loops (archives, category/tag pages, related & up-sell products, [products] grids). * * Every other context that renders a product's price HTML — the REST API `price_html` field, product widgets, * the mini-cart, page builders and third-party code — keeps the suffix, preserving the long-standing behaviour. * * Detection is by render context (the WooCommerce price-template hooks, or the woocommerce/product-price block in * block themes) rather than page conditionals, so the decision is correct even when a catalog loop is rendered * inside another page (e.g. related products on the single product page) or via AJAX. * * @since 9.0.0 * @return bool */ public static function should_omit_inline_trial_and_fee() { } /** * Whether a block renders a product's price (directly or via its variation data) and so should omit the suffix. * * @since 9.0.0 * * @param array $parsed_block The block being rendered. * @return bool */ protected static function is_price_rendering_block($parsed_block) { } /** * Flags that a WooCommerce Store API request is being served. * * Hooked on 'rest_request_before_callbacks'. The Store API's price_html is a display field — used by block themes * (via hydration) and block-based product/cart templates — so the inline trial / sign-up fee suffix is omitted * while it is served. Fires for both block hydration and genuine REST requests. * * @since 9.0.0 * * @param mixed $response The response. Passed through unchanged. * @param array $handler The matched route handler. * @param WP_REST_Request $request The request. * @return mixed */ public static function flag_store_api_request($response, $handler, $request) { } /** * Flags a Store API request served via block hydration (which bypasses the REST dispatch). * * Hooked on 'woocommerce_hydration_dispatch_request'. * * @since 9.0.0 * * @param mixed $pre_dispatch Short-circuit value. Passed through unchanged. * @param WP_REST_Request $request The hydration request. * @return mixed */ public static function flag_store_api_hydration($pre_dispatch, $request) { } /** * Clears the Store API request flag once the request has been served. * * Hooked on 'rest_request_after_callbacks'. * * @since 9.0.0 * * @param mixed $response The response. Passed through unchanged. * @param array $handler The matched route handler. * @param WP_REST_Request $request The request. * @return mixed */ public static function unflag_store_api_request($response, $handler, $request) { } /** * Flags that a price-rendering block has started rendering. * * Hooked on 'pre_render_block'. Used so the inline trial / sign-up fee suffix is omitted from prices rendered by * these blocks (block themes, the Single Product and Product Collection blocks, related products, the add to cart * form's variation data, etc.). * * Only increments when $pre_render is null. A non-null value means another plugin has short-circuited the block, * so WordPress skips the 'render_block' filter where unflag_price_block_rendering() would decrement — incrementing * in that case would leave the depth permanently raised for the rest of the request. * * @since 9.0.0 * * @param string|null $pre_render The pre-rendered content. Passed through unchanged. * @param array $parsed_block The block being rendered. * @return string|null */ public static function flag_price_block_rendering($pre_render, $parsed_block) { } /** * Clears the woocommerce/product-price block rendering flag once the block has finished rendering. * * Hooked on 'render_block'. * * @since 9.0.0 * * @param string $block_content The rendered block content. Passed through unchanged. * @param array $parsed_block The block that was rendered. * @return string */ public static function unflag_price_block_rendering($block_content, $parsed_block) { } /** * Outputs the trial and sign-up fee detail lines below the price on the single product page. * * The trial and sign-up fee are intentionally excluded from the inline price string (@see get_price_html()) and * surfaced here instead, mirroring how products with subscription plans display them next to the plan selector. * * Variable subscriptions are handled separately (@see output_variable_subscription_price_details()) because their * values are variation-specific and should only appear once a variation is selected. * * @since 9.0.0 */ public static function output_subscription_price_details() { } /** * Outputs the detail-line container for variable subscriptions, just before the add to cart button. * * The container starts empty and hidden; the variation script (@see assets/js/frontend/single-product.js) fills it * with the selected variation's trial and sign-up fee details once a variation is chosen (i.e. once the add to cart * button is enabled) and hides it again when the selection is reset. * * @since 9.0.0 */ public static function output_variable_subscription_price_details() { } /** * Returns the "Free trial:" / "Sign-up fee:" detail line HTML for a subscription product. * * @param WC_Product|int $product A WC_Product object or ID of a WC_Product. * @param string $tax_display_mode Optional. 'incl' or 'excl' to resolve the sign-up fee's tax treatment. * Defaults to '', which follows the shop price display setting — correct on * the product page. Cart/checkout callers pass the cart display mode so the * fee matches the surrounding prices when the shop and cart settings differ. * @return string Detail line HTML, or an empty string when there is no trial or sign-up fee. * @since 9.0.0 */ public static function get_subscription_price_details_html($product, $tax_display_mode = '') { } /** * 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) { } /** * Returns the gifting setting for a subscription, if it is a subscription. * * @param mixed $product A WC_Product object or product ID * @return string The value of the gifting setting, or '' if the product it is using the global setting. * @since 7.8.0 */ public static function get_gifting($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 $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 $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 $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 $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 = '') { } /** * Check if the current session has an order awaiting payment for a subscription to a specific product line item. * * @deprecated 2.1 Use WCS_Limiter::order_awaiting_payment_for_product() * * @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 ) * @deprecated 2.2.0 * * @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 ) * @deprecated 2.2.0 * * @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 $renewal_order_id 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. * * This hook will be skipped for early renewal orders transitioning to statuses other than cancelled or refunded. * @see WCS_Cart_Early_Renewal::maybe_record_subscription_payment(). * * @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 $renewal_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 $renewal_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 $product_id The ID of the product to renew. * @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 = 0) { } /** * 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 $original_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. * * @since 1.2 * @deprecated 2.0 Use wcs_order_contains_resubscribe() and wcs_order_contains_renewal() instead. * * @param WC_Order|int $order The WC_Order object or ID of a WC_Order order. * @param array $args { * An optional array of name => value flags. * * @type string $order_role A specific role to check the order against. Either 'parent' or 'child'. Optional. * @type bool $via_checkout Indicates whether to check if the renewal order was via the cart/checkout process. * } */ 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. * * @param string $pay_url The URL to the payment page. * @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.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. * * @since 1.0.0 - Migrated from WooCommerce Subscriptions v1.2 * @deprecated 2.0 * * @param int $order_id The ID of a WC_Order object. */ public static function process_failed_renewal_order_payment($order_id) { } /** * Records manual payment of a renewal order against a subscription. * * @since 1.0.0 - Migrated from WooCommerce Subscriptions v1.2 * @deprecated 2.0 * * @param int $order_id The ID of a WC_Order object. */ 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_id 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 $order_id The ID of a WC_Order object. * @param string $payment_status The status of the payment. * * @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 * @deprecated 2.0 Use WC_Subscriptions_Renewal_Order::maybe_record_subscription_payment() instead. */ 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 { /** * @deprecated 8.6.0 The "Align Subscription Renewal Day" checkbox has been removed; syncing is always enabled. * The option value is preserved in the database but no longer read. Use {@see is_syncing_enabled()} which now always returns true. */ public static $setting_id; /** * @deprecated 8.6.0 Replaced by {@see $setting_id_first_billing_behavior}, {@see $setting_id_prorate_virtual}, and {@see $setting_id_prorate_physical}. * The option value has been migrated to the new keys on plugin load. Use {@see get_first_billing_behavior()} to read the current behavior. */ 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; // Option key properties — initialized in init() from WC_Subscriptions_Admin::$option_prefix. public static $setting_id_first_billing_behavior; public static $setting_id_prorate_virtual; public static $setting_id_prorate_physical; public static $setting_id_section_title; // First billing behavior option values. const FIRST_BILLING_BEHAVIOR_FULL = 'full'; const FIRST_BILLING_BEHAVIOR_NEXT_BILLING_DATE = 'next_billing_date'; const FIRST_BILLING_BEHAVIOR_PRORATE = 'prorate'; /** * Whether proration checkbox validation failed during the current settings save request. * * Used to prevent save_proration_checkboxes() from writing invalid values when * validate_proration_checkboxes() has already rejected the submission. * * @var bool */ private static $proration_validation_failed = \false; // 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 * @deprecated Syncing is always enabled. This method always returns true and will be removed in a future version. */ 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() { } /** * Get the stored first billing behavior option value. * * @since 8.6.0 * @return string One of the FIRST_BILLING_BEHAVIOR_* constants. */ public static function get_first_billing_behavior() { } /** * Resolve the first billing behavior constant for a given product proration state. * * Combines the global first billing behavior setting with the product-specific proration * eligibility to return the fully resolved constant. Use this when populating Price_Context * so that consumers of the context do not need to re-check the global option. * * @since 8.6.0 * * @param bool $is_prorated Whether this specific product is eligible for proration. * @return string One of the FIRST_BILLING_BEHAVIOR_* constants. */ public static function resolve_billing_behavior(bool $is_prorated) { } /** * Whether proration applies to virtual subscription products. * * @since 8.6.0 * @return bool */ public static function should_prorate_virtual_products() { } /** * Whether proration applies to physical subscription products. * * @since 8.6.0 * @return bool */ public static function should_prorate_physical_products() { } /** * Render the woocommerce_subscriptions_proration_options setting field. * * @since 8.6.0 */ public static function proration_options_field_html() { } /** * Save proration checkbox options from the settings page. * * Handles saving of the woocommerce_subscriptions_proration_options custom field type, which WooCommerce's * standard settings API does not process automatically. * * @since 9.0.0 */ public static function save_proration_checkboxes() { } /** * Validate that at least one "Apply proration to" checkbox is checked when prorate behavior is selected. * * Fires on woocommerce_update_options_subscriptions. Reverts both checkboxes to their prior values * and adds an admin notice if both are unchecked while 'prorate' is the selected behavior. * * @since 8.6.0 */ public static function validate_proration_checkboxes() { } /** * Render the proration validation error admin notice. * * @since 8.6.0 */ public static function proration_validation_error_notice() { } /** * 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 should have its first payment processed 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|\Automattic\WooCommerce_Subscriptions\Internal\Pricing\Price_Context $product_or_context Product or Price_Context to check. * * @return bool */ public static function is_product_prorated($product_or_context) { } /** * 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|\Automattic\WooCommerce_Subscriptions\Internal\Pricing\Price_Context $product_or_context Product or Price_Context 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_or_context, $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. * * Accepts either a WC_Product (reads subscription data from product meta) * or a Price_Context (uses pre-extracted subscription data directly). * * @param WC_Product|\Automattic\WooCommerce_Subscriptions\Internal\Pricing\Price_Context $product_or_context A subscription product or Price_Context. * @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_or_context, $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 a synchronized subscription product. * * For synchronized subscription products, this method calculates and formats a human-readable string * indicating when the first payment will be processed. The string will indicate if the payment is: * - Due today * - Prorated with the next payment date * - Just the first payment date * * @since 1.0.0 - Migrated from WooCommerce Subscriptions v1.5 * * @param WC_Product|WC_Product_Subscription|WC_Product_Variable_Subscription $product The subscription product to get the first payment date for. * @return string A formatted string explaining the first payment date. Empty string if product is not synchronized. */ 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 $sign_up_fee The initial sign-up fee charged when the subscription product in the order was first purchased, if any. * @param WC_Subscription $subscription The subscription object. * @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. * @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 $order_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 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 $item_id The order item ID of an item that was just added to the order * @param array $item 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 $subscription_id The post ID of a WC_Order or child object * @param int $item_id The order item ID of an item that was just added to the order * @param object $product 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 $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 $item_id The new line item id * @param WC_Order_Item $item * @param int $subscription_id 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 first billing behavior is not set to 'full' -- 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 * @deprecated 2.1.3 Use WC_Subscriptions_Order::maybe_autocomplete_order(). */ 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 $sign_up_fee 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 { /** * Handles the collection of additional pieces of data. */ private static \Automattic\WooCommerce_Subscriptions\Internal\Telemetry\Collector $telemetry_collector; /** * 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 order count and total for subscription-related orders. * * @return array Array with counts and totals for switch, renewal, and resubscribe orders. */ private static function get_order_count_and_total_by_meta_key() { } /** * Gets count and total for initial orders (orders without subscription relation meta keys). * * @return array Array with 'count' and 'total' keys. */ private static function get_initial_order_count_and_total() { } /** * 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 notifications that uses the Action Scheduler * * @class WCS_Action_Scheduler_Customer_Notifications * @version 7.7.0 * @package WooCommerce Subscriptions/Classes * @category Class */ class WCS_Action_Scheduler_Customer_Notifications extends \WCS_Scheduler { /** * @var int Time offset (in whole seconds) between the notification and the action it's notifying about. */ protected $time_offset; /** * @var array|string[] Notifications scheduled by this class. * * Just for reference. */ protected static $notification_actions = ['woocommerce_scheduled_subscription_customer_notification_trial_expiration', 'woocommerce_scheduled_subscription_customer_notification_expiration', 'woocommerce_scheduled_subscription_customer_notification_renewal']; /** * Name of Action Scheduler group used for customer notification actions. * * @var string */ protected static $notifications_as_group = 'wcs_customer_notifications'; /** * Constructor. */ public function __construct() { } /** * Check if the subscription period is too short to send a renewal notification. * * @param $subscription * * @return bool */ public static function is_subscription_period_too_short($subscription) { } /** * Return time offset for notifications for given subscription. * * Generally, there is one offset for all subscriptions, but there's a filter. * * @param WC_Subscription $subscription * @param string $notification_type * * @return mixed|null */ public function get_time_offset($subscription, $notification_type) { } /** * General time offset setter. * * @param int $time_offset In seconds * * @return void */ public function set_time_offset($time_offset) { } /** * Set the offset based on new value set in the option. * * @param $_ Unused parameter. * @param $new_option_value * * @return void */ public function set_time_offset_from_option($_, $new_option_value) { } /** * Calculate time offset in seconds from the settings array. * * @param array $offset Format: [ 'number' => 3, 'unit' => 'days' ] * * @return int */ protected static function convert_offset_to_seconds($offset) { } /** * Maybe schedule a notification action for given subscription and timestamp. * * Will *not* schedule notification if: * - the notifications are globally disabled, * - the subscription isn't active/pending-cancel, * - the subscription's billing cycle is less than 3 days, * - there is already the same action scheduled for the same subscription and time. * * If only the time differs, the previous scheduled action will be unscheduled and a new one will replace it. * * @param WC_Subscription $subscription Subscription to schedule the action for. * @param string $action Action ID to schedule. * @param int $timestamp Time to schedule the notification for. * * @return void */ protected function maybe_schedule_notification($subscription, $action, $timestamp) { } /** * Subtract time offset from given datetime based on the settings and subscription properties and return resulting timestamp. * * @param string $datetime * @param WC_Subscription $subscription * @param string $notification_type Can be 'trial_end', 'next_payment' or 'end'. * * @return int */ protected function subtract_time_offset($datetime, $subscription, $notification_type) { } /** * Get the notification action name based on the date type. * * @param string $date_type * * @return string */ public static function get_action_from_date_type($date_type) { } /** * Update notifications when subscription gets updated. * * To make batch processing easier, we need to handle the following use case: * 1. Subscription S1 gets updated. * 2. Notification config gets updated, a batch to fix all subscriptions is started and processes all subscriptions * with update time before the config got updated. * 3. Subscription S1 gets updated before it gets processed by the batch process. * * Thus, we update notifications for all subscriptions that are being updated after notification config change time * and which have their update time before that. * * As this gets called on Subscription save, the modification timestamp should be updated, too, and thus * the currently updated subscription no longer needs to be processed by the batch process. * * @param WC_Subscription $subscription * @param $subscription_data_store * * @return void */ public function update_notifications($subscription, $subscription_data_store) { } /** * Schedule a notification with given type for given subscription. * * Date/time is determined automatically based on notification type, dates stored on the subscription, * and offset WCS_Action_Scheduler_Customer_Notifications::$time_offset. * * @param WC_Subscription $subscription * @param string $notification_type * * @return void */ protected function schedule_notification($subscription, $notification_type) { } /** * Schedule all notifications for a subscription based on the dates defined on the subscription. * * Which notifications are needed for the subscription is determined by \WCS_Action_Scheduler_Customer_Notifications::get_valid_notifications. * * @param WC_Subscription $subscription * * @return void */ protected function schedule_all_notifications($subscription) { } /** * Set which date types are affecting the notifications. * * Currently, only trial_end, end and next_payment are being used. * * @return void */ public function set_date_types_to_schedule() { } /** * Schedule notifications if the date has changed. * * @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) { } /** * Schedule notifications if the date has been deleted. * * @param WC_Subscription $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) { } /** * Unschedule all notifications for a subscription. * * @param object $subscription An instance of a WC_Subscription object * @param array $exceptions Array of notification actions to not unschedule * * @return void */ public function unschedule_all_notifications($subscription = \null, $exceptions = []) { } /** * 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 New subscription status * @param string $old_status Previous subscription status */ public function update_status($subscription, $new_status, $old_status) { } /** * Get the args to set on the scheduled action. * * @param WC_Subscription|null $subscription An instance of WC_Subscription to get the hook for * * @return array Array of name => value pairs stored against the scheduled action. */ public static function get_action_args($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 = []) { } /** * Returns true if given date for subscription is now or in the future. * * @param WC_Subscription $subscription Subscription whose date is examined. * @param string $date_type Date type to evaluate. * * @return bool */ protected static function is_date_in_the_future_or_now($subscription, $date_type) { } /** * Return an array of notifications valid for given subscription based on the dates set on the subscription. * * This method doesn't take status into account. That's done in \WCS_Action_Scheduler_Customer_Notifications::update_status. * * Possible values in the array: 'end', 'trial_end', 'next_payment'. * * @param WC_Subscription $subscription * * @return array * @throws Exception */ public static function get_valid_notifications($subscription) { } /** * Returns a list of currently scheduled notifications for a subscription. * * Notifications are identified by the date type of the subscription. * I.e. possible values are: 'end', 'trial_end' and 'next_payment'. * * @param $subscription * * @return array */ public function get_notifications($subscription) { } } /** * 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 { /** * The action scheduler group to use for scheduled subscription events. */ const ACTION_GROUP = 'wc_subscription_scheduled_event'; /** * The priority of the subscription-related scheduled action. */ const ACTION_PRIORITY = 1; /** * 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 WC_Subscription $subscription An instance of a WC_Subscription object * @param string $new_status Can be 'trial_end', 'next_payment', 'end', 'end_of_prepaid_term' or a custom date type * @param string $old_status */ 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) { } /** * Gets the priority of the subscription-related scheduled action. * * @return int The priority of the subscription-related scheduled action. */ public function get_action_priority($action_hook) { } /** * Schedule an subscription-related action with the Action Scheduler. * * Subscription events are scheduled with a priority of 1 (see self::ACTION_PRIORITY) and the * group 'wc_subscription_scheduled_event' (see self::ACTION_GROUP). * * @param int $timestamp Unix timestamp of when the action should run. * @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. * * @return int The action ID. */ protected function schedule_action($timestamp, $action_hook, $action_args) { } } /** * This class is a helper intended to handle data processings that need to happen in batches in a deferred way. * It abstracts away the nuances of (re)scheduling actions and dealing with errors. * * Usage: * * 1. Create a class that implements WCS_Batch_Processor. * * 2. Whenever there's data to be processed invoke the 'enqueue_processor' method in this class, * passing the class name of the processor. * * That's it, processing will be performed in batches inside scheduled actions; enqueued processors will only * be dequeued once they notify that no more items are left to process (or when `force_clear_all_processes` is invoked). * Failed batches will be retried after a while. * * This is heavily inspired by core's version at Automattic\WooCommerce\Internal\BatchProcessing\BatchProcessingController. * * @package WooCommerce Subscriptions * @category Class * @since 7.7.0 */ class WCS_Batch_Processing_Controller { /* * Identifier of a "watchdog" action that will schedule a processing action * for any processor that is enqueued but not yet scheduled * (because it's been just enqueued or because it threw an error while processing a batch), * that's one single action that reschedules itself continuously. */ const WATCHDOG_ACTION_NAME = 'wcs_schedule_pending_batch_processes'; /* * Identifier of the action that will do the actual batch processing. * There's one action per enqueued processor that will keep rescheduling itself * as long as there are still pending items to process * (except if there's an error that caused no items to be processed at all). */ const PROCESS_SINGLE_BATCH_ACTION_NAME = 'wcs_run_batch_process'; const ENQUEUED_PROCESSORS_OPTION_NAME = 'wcs_pending_batch_processes'; const ACTION_GROUP = 'wcs_batch_processes'; const LOGS_CONTEXT = 'wcs-batch-processing'; /** * Maximum number of failures per processor before it gets dequeued. */ const FAILING_PROCESS_MAX_ATTEMPTS_DEFAULT = 5; /** * Instance of WC_Logger class. * * @var \WC_Logger_Interface */ private $logger; /** * Singleton instance. * * @var WCS_Batch_Processing_Controller */ private static $instance; /** * Constructor. * * Schedules the necessary actions to process batches. */ private function __construct() { } /** * Get the singleton instance of this class. * * @return WCS_Batch_Processing_Controller */ final public static function instance(): \WCS_Batch_Processing_Controller { } /** * Enqueue a processor so that it will get batch processing requests from within scheduled actions. * * @param string $processor_class_name Fully qualified class name of the processor, must implement `WCS_Batch_Processor`. */ public function enqueue_processor(string $processor_class_name): void { } /** * Schedule the watchdog action. * * @param bool $with_delay Whether to delay the action execution. Should be true when rescheduling, false when enqueueing. * @param bool $unique Whether to make the action unique. */ private function schedule_watchdog_action(bool $with_delay = \false, bool $unique = \false): void { } /** * Schedule a processing action for all the processors that are enqueued but not scheduled * (because they have just been enqueued, or because the processing for a batch failed). */ private function handle_watchdog_action(): void { } /** * Process a batch for a single processor, and handle any required rescheduling or state cleanup. * * @param string $processor_class_name Fully qualified class name of the processor. * * @throws \Exception If error occurred during batch processing. */ private function process_next_batch_for_single_processor(string $processor_class_name): void { } /** * Process a batch for a single processor, updating state and logging any error. * * @param WCS_Batch_Processor $batch_processor Batch processor instance. * * @return null|\Exception Exception if error occurred, null otherwise. */ private function process_next_batch_for_single_processor_core(\WCS_Batch_Processor $batch_processor): ?\Exception { } /** * Get the current state for a given enqueued processor. * * @param WCS_Batch_Processor $batch_processor Batch processor instance. * * @return array Current state for the processor, or a "blank" state if none exists yet. */ private function get_process_details(\WCS_Batch_Processor $batch_processor): array { } /** * Get the name of the option where we will be saving state for a given processor. * * @param WCS_Batch_Processor|string $batch_processor Batch processor instance or class name. * * @return string Option name. */ private function get_processor_state_option_name($batch_processor): string { } /** * Update the state for a processor after a batch has completed processing. * * @param WCS_Batch_Processor $batch_processor Batch processor instance. * @param float $time_taken Time take by the batch to complete processing. * @param \Exception|null $last_error Exception object in processing the batch, if there was one. */ private function update_processor_state(\WCS_Batch_Processor $batch_processor, float $time_taken, ?\Exception $last_error = \null): void { } /** * Removes the option where we store state for a given processor. * * @param string $processor_class_name Fully qualified class name of the processor. */ private function clear_processor_state(string $processor_class_name): void { } /** * Schedule a processing action for a single processor. * * @param string $processor_class_name Fully qualified class name of the processor. * @param bool $with_delay Whether to schedule the action for immediate execution or for later. */ private function schedule_batch_processing(string $processor_class_name, bool $with_delay = \false): void { } /** * Check if a batch processing action is already scheduled for a given processor. * Differs from `as_has_scheduled_action` in that this excludes actions in progress. * * @param string $processor_class_name Fully qualified class name of the batch processor. * * @return bool True if a batch processing action is already scheduled for the processor. */ public function is_scheduled(string $processor_class_name): bool { } /** * Get an instance of a processor given its class name. * * @param string $processor_class_name Full class name of the batch processor. * * @return WCS_Batch_Processor Instance of batch processor for the given class. * @throws \Exception If it's not possible to get an instance of the class. */ private function get_processor_instance(string $processor_class_name): \WCS_Batch_Processor { } /** * Helper method to get list of all the enqueued processors. * * @return array List (of string) of the class names of the enqueued processors. */ public function get_enqueued_processors(): array { } /** * Dequeue a processor once it has no more items pending processing. * * @param string $processor_class_name Full processor class name. */ private function dequeue_processor(string $processor_class_name): void { } /** * Helper method to set the enqueued processor class names. * * @param array $processors List of full processor class names. */ private function set_enqueued_processors(array $processors): void { } /** * Check if a particular processor is enqueued. * * @param string $processor_class_name Fully qualified class name of the processor. * * @return bool True if the processor is enqueued. */ public function is_enqueued(string $processor_class_name): bool { } /** * Dequeue and de-schedule a processor instance so that it won't be processed anymore. * * @param string $processor_class_name Fully qualified class name of the processor. * @return bool True if the processor has been dequeued, false if the processor wasn't enqueued (so nothing has been done). */ public function remove_processor(string $processor_class_name): bool { } /** * Dequeues and de-schedules all the processors. */ public function force_clear_all_processes(): void { } /** * Log an error that happened while processing a batch. * * @param \Exception $error Exception object to log. * @param WCS_Batch_Processor $batch_processor Batch processor instance. * @param array $batch Batch that was being processed. */ protected function log_error(\Exception $error, \WCS_Batch_Processor $batch_processor, array $batch): void { } /** * Determines whether a given processor is consistently failing based on how many recent consecutive failures it has had. * * @param WCS_Batch_Processor $batch_processor The processor that we want to check. * @return boolean TRUE if processor is consistently failing. FALSE otherwise. */ private function is_consistently_failing(\WCS_Batch_Processor $batch_processor): bool { } /** * Creates log entry with details about a batch processor that is consistently failing. * * @param WCS_Batch_Processor $batch_processor The batch processor instance. * @param array $process_details Failing process details. */ private function log_consistent_failure(\WCS_Batch_Processor $batch_processor, array $process_details): void { } /** * Hooked onto 'shutdown'. This cleanup routine checks enqueued processors and whether they are scheduled or not to * either re-eschedule them or remove them from the queue. * This prevents stale states where Action Scheduler won't schedule any more attempts but we still report the * processor as enqueued. * */ private function remove_or_retry_failed_processors(): void { } } /** * 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. */ public static 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 * * @deprecated 2.3.0 * * @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. * * @deprecated 6.0.0 */ 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 * @deprecated 6.0.0 */ 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) { } } /** * 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|WC_Order $order_id The order 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_Subscription $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) { } /** * 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 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 $order_id order 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 $cart_item 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 = array()) { } /** * 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 $order 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 $redirect The redirect URL after successful login. * @param WP_User $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 $adjust_price Whether to apply the dynamic discount * @param string $cart_item_key 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 */ public 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 $posted_checkout_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 $item * @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) { } /** * Restores the order awaiting payment session args if the cart contains a subscription-related order. * * It's possible the that order_awaiting_payment and store_api_draft_order session args are not set if those session args are lost due * to session destruction. * * This function checks the cart that is being loaded from the session and if the cart contains a subscription-related order and if the * current user has permission to pay for it. If so, it restores the order awaiting payment session args. * * @param WC_Cart $cart The cart object. */ public function restore_order_awaiting_payment($cart) { } /* 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 $order 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 $order_status 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) { } } /** * 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 $cart_item 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 = array()) { } /** * 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) { } /** * 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 = \null) { } /** * Get the subscription object used to construct the resubscribe cart. * * @param array $cart_item 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 = \null) { } /** * 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 int|WC_Subscription $subscription The subscription object * @return array */ 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 IDs of subscriptions awaiting payment for a given product in the current session */ 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() { } /** * Checks if the session contains a renewal for a given product. * Used for the pay for order flow. * * @param WC_Product $product The product to check. * @return bool */ private static function session_contains_renewal($product) { } /** * Checks if the session contains a resubscribe for a given product. * Used for the pay for order flow with limited subscriptions products. * * @param WC_Product $product The product to check. * @return bool */ private static function session_contains_resubscribe($product) { } /** * 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 * @deprecated 8.0.0 Use WCS_Limiter::is_product_limited(). * * @return bool */ public static function is_purchasable_product($is_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_product_limited($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 * @deprecated 1.0.0 Use WCS_Limiter::is_product_limited(). * * @return bool */ public static function is_purchasable_renewal($is_purchasable, $product) { } /** * Get the IDs of subscriptions awaiting payment for a specific product in the current session. * * Covers the "pay for order" flow, where a customer pays for their own pending or failed order * from the My Account area or the cart. The subscriptions tied to such an order should be set * aside when determining whether the product's limit has been reached, so the customer can pay * that order without being blocked by the very subscription they're paying for. * * @since 8.9.0 * @param int $product_id The product to look for subscriptions awaiting payment. * @return int[] The IDs of subscriptions awaiting payment for the product. **/ protected static function get_subscriptions_awaiting_payment_for_product($product_id) { } /** * 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) { } /** * Check if we're currently paying for a failed renewal order containing the product. * * @since 8.3.0 - Migrated from WooCommerce Subscriptions v2.1.0 * @param WC_Product $product The product to check. * @return bool */ protected static function is_paying_for_failed_renewal_order($product) { } /** * 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 8.3.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(); /** * A unique ID for the modal to use in HTML ID attribute. * * @var string */ private $id = ''; /** * 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() { } /** * Sets the modal's unique ID. * * This is used for the actual HTML ID attribute, and so should follow the normal CSS identifier rules. * * @since 8.2.0 * * @param string $id The modal's unique ID. */ public function set_id($id) { } /** * Returns the modal's unique ID. * * @since 8.2.0 * * @return string The modal's unique ID. */ public function get_id() { } /** * 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 $payment_token_data 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 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 $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) { } } /** * WooCommerce Subscriptions Notifications Batch Processor. * * This batch processor is used to process subscriptions whenever global settings get updated * (global on/off for notifications or time offset). * * It will only process subscriptions whose update time is before the time when the settings got updated. * To ensure all subscription end up having correct notifications, the hook * WCS_Action_Scheduler_Customer_Notifications::update_notifications will update any notifications * whose update time is before the settings got updated. The rest of subscriptions should be updated by this * batch processor. * * In addition to this batch processor which runs ad-hoc, there's also a debug tool to regenerate notifications for * all subscriptions: WCS_Notifications_Debug_Tool_Processor. * * @package WooCommerce Subscriptions * @category Class * @since 7.7.0 */ class WCS_Notifications_Batch_Processor implements \WCS_Batch_Processor { /** * Get a user-friendly name for this processor. * * @return string Name of the processor. */ public function get_name(): string { } /** * Get a user-friendly description for this processor. * * @return string Description of what this processor does. */ public function get_description(): string { } /** * Get the subscription statuses that should be processed. * * @return array Subscription statuses that should be processed. */ protected function get_subscription_statuses() { } /** * Get the timestamp of the last time the notification settings were updated. * * @return string Datetime of the last time the notification settings were updated. */ public function get_notification_settings_update_time() { } /** * Get the total number of pending items that require processing. * Once an item is successfully processed by 'process_batch' it shouldn't be included in this count. * * Note that once the processor is enqueued the batch processor controller will keep * invoking `get_next_batch_to_process` and `process_batch` repeatedly until this method returns zero. * * Since this batch processor updates only subscriptions older than the settings update, * it only selects subscriptions updated before the settings update time. * * @return int Number of items pending processing. */ public function get_total_pending_count(): int { } /** * Returns the next batch of items that need to be processed. * * A batch item can be anything needed to identify the actual processing to be done, * but whenever possible items should be numbers (e.g. database record ids) * or at least strings, to ease troubleshooting and logging in case of problems. * * The size of the batch returned can be less than $size if there aren't that * many items pending processing (and it can be zero if there isn't anything to process), * but the size should always be consistent with what 'get_total_pending_count' returns * (i.e. the size of the returned batch shouldn't be larger than the pending items count). * * @param int $size Maximum size of the batch to be returned. * * @return array Batch of items to process, containing $size or less items. */ public function get_next_batch_to_process(int $size): array { } /** * Process data for the supplied batch: update all notifications for given batch of subscriptions. * * This method should be prepared to receive items that don't actually need processing * (because they have been processed before) and ignore them, but if at least * one of the batch items that actually need processing can't be processed, an exception should be thrown. * * Once an item has been processed it shouldn't be counted in 'get_total_pending_count' * nor included in 'get_next_batch_to_process' anymore (unless something happens that causes it * to actually require further processing). * * @throw \Exception Something went wrong while processing the batch. * * @param array $batch Batch to process, as returned by 'get_next_batch_to_process'. */ public function process_batch(array $batch): void { } /** * Default (preferred) batch size to pass to 'get_next_batch_to_process'. * The controller will pass this size unless it's externally configured * to use a different size. * * @return int Default batch size. */ public function get_default_batch_size(): int { } /** * Start the background process for updating notifications. * * @return string Informative string to show after the tool is triggered in UI. */ public static function enqueue(): string { } /** * Stop the background process for updating notifications. * * @return string Informative string to show after the tool is triggered in UI. */ public static function dequeue(): string { } } /** * 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 $post_type The post type this cache manage acts on. * @param array $meta_keys 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 $object_type The post type this cache manage acts on. * @param array $data_keys 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_Subscription $subscription 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($subscription, $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 $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 $customer_id (optional) The customer id - defaults to the current user. * @param string $gateway_id (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 = 0, $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 $menu_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 $settings * @return mixed $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 string $default_path */ 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() { } /** * Register debug tools for managing the cache. */ public function register_debug_tools() { } /* 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 $user_id The user ID 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', '_last_order_date_created' => 'last_order_date_created', '_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. The `transaction_id` column isn't used for subscriptions * but is included in the mapping to ensure cached data objects have all the properties the parent * order data store expects, preventing PHP warnings when HPOS Data Caching is enabled. * * @see https://github.com/woocommerce/woocommerce/issues/63272 * * @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'), 'transaction_id' => array('type' => 'string', 'name' => 'transaction_id'), '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. * * All columns are inherited from orders. Some columns (cart_hash, new_order_email_sent, * order_stock_reduced, date_paid_gmt, recorded_sales, date_completed_gmt) aren't used for * subscriptions but are included in the mapping to ensure cached data objects have all the * properties the parent order data store expects, preventing PHP warnings when HPOS Data * Caching is enabled. * * @see https://github.com/woocommerce/woocommerce/issues/63272 * * @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'), 'cart_hash' => array('type' => 'string', 'name' => 'cart_hash'), 'new_order_email_sent' => array('type' => 'bool', 'name' => 'new_order_email_sent'), 'order_key' => array('type' => 'string', 'name' => 'order_key'), 'order_stock_reduced' => array('type' => 'bool', 'name' => 'order_stock_reduced'), 'date_paid_gmt' => array('type' => 'date', 'name' => 'date_paid'), 'date_completed_gmt' => array('type' => 'date', 'name' => 'date_completed'), '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'), 'recorded_sales' => array('type' => 'bool', 'name' => 'recorded_sales')); /** * 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 $subscription The subscription 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_Subscription $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 $search_fields 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() { } /** * Get a subscription's raw stored status directly from the orders table. * * Unlike WC_Subscription::get_status(), this bypasses the in-memory conversion of the * 'draft' and 'auto-draft' statuses to 'pending' that WC_Subscription::set_status() applies * when a subscription object is read. * * @since 9.0.0 * * @param int $subscription_id The subscription ID. * @return string The raw stored status (e.g. 'auto-draft', 'draft', 'wc-active'), or an empty string if it could not be determined. */ public function get_subscription_raw_status($subscription_id) { } /** * 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; /** * A list of subscription IDs that are requesting multiple related order caches to be read. * * This is used by @see get_related_order_ids_by_types() to enable fetching multiple related order caches without reading the subscriptions meta query multiple times. * * @var array $batch_processing_subscriptions An array of subscription IDs. */ private static $batch_processing_related_orders = []; /** * A cache of subscription meta data. Used when fetching multiple related order caches for a subscription to avoid multiple database queries. * * @var array $subscription_meta_cache An array of subscription meta data. */ private static $subscription_meta_cache = []; /** * 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() { } /** * Register debug tools for managing the cache. */ public function register_debug_tools() { } /* 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 The subscription 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. * * @deprecated 7.3.0 - Backfilling is already handled by the Order/Subscriptions Data Store. */ 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 The 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) { } /** * Updates the subscription's modified date if the related order cache has changed. * * @param WC_Subscription $subscription The subscription to update the modified date for. * @param array $related_order_ids The related order IDs to compare with the current related order IDs. * @param object $current_metadata The current related order cache metadata. */ protected function update_modified_date_for_related_order_cache($subscription, $related_order_ids, $current_metadata) { } /** * Gets the subscription's meta data. * * @param WC_Subscription $subscription The subscription to get the meta for. * @param mixed $data_store The data store to use to get the meta. Defaults to the current subscription's data store. * * @return array The subscription's meta data. */ private function get_subscription_meta(\WC_Subscription $subscription, $data_store) { } /** * Gets the related order IDs for a subscription by multiple relation types. * * This function is a more efficient way to get related order IDs for multiple relation types at once. * It will only query the database once for all cache data, and then return the related order IDs for each relation type. * * The alternative of calling the get_related_order_ids() function for each relation type will result in a full subscription meta read for each relation type. * * @param WC_Order $subscription The subscription to get related order IDs for. * @param array $related_order_types The related order types to get IDs for. Must be an array of supported relation types. * * @return array An array of related order IDs for each relation type. */ public function get_related_order_ids_by_types(\WC_Order $subscription, $related_order_types) { } /** * Starts batch processing mode for a subscription. * * @param WC_Subscription $subscription The subscription to start batch processing mode for. * @return string The cache key for the subscription. */ private function start_batch_processing_mode($subscription) { } /** * Stops batch processing mode for a subscription. * * Destroys the cache and removes the cache key. * * @param string $subscription The subscriptions being cached. */ private function stop_batch_processing_mode($subscription) { } /** * Busts the batch processing mode memory cache for a subscription without stopping the batch processing mode. * * @param WC_Subscription $subscription the subscription being cached. */ private function bust_batch_processing_mode_memory_cache($subscription) { } /** * Checks if batch processing mode is active for a subscription. * * @param string $cache_key The batch processing cache key. * @return bool True if batch processing mode is active, false otherwise. */ private function is_batch_processing($cache_key) { } /** * Gets the batch processing cache key for a subscription. * * The cache key is a unique combination of the subscription ID and the data store class name. * * @param WC_Subscription $subscription The subscription to get the cache key for. * @param bool|object $data_store The data store which will be used to read the subscription meta. Defaults to the current subscription's data store. * * @return string The cache key for the subscription. */ private function get_batch_processing_cache_key($subscription, $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', '_last_order_date_created' => 'last_order_date_created', '_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'); /** * The data store instance for the custom order tables. * * @var WCS_Orders_Table_Subscription_Data_Store */ protected $orders_table_data_store; /** * 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 $status * @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() { } /** * Get a subscription's raw stored status directly from the posts table. * * Unlike WC_Subscription::get_status(), this bypasses the in-memory conversion of the * 'draft' and 'auto-draft' statuses to 'pending' that WC_Subscription::set_status() applies * when a subscription object is read. * * @since 9.0.0 * * @param int $subscription_id The subscription ID. * @return string The raw stored status (e.g. 'auto-draft', 'draft', 'wc-active'), or an empty string if it could not be determined. */ public function get_subscription_raw_status($subscription_id) { } /** * 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) { } /** * Get the data store instance for Order Tables data store. * * @return WCS_Orders_Table_Subscription_Data_Store */ public function get_cot_data_store_instance() { } } /** * 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()) { } } /** * Subscriptions Email Preview Class */ class WC_Subscriptions_Email_Preview { /** * The email being previewed * * @var string */ private $email_type; /** * Constructor. */ public function __construct() { } /** * Prepare subscription email dummy data for preview. * * @param WC_Email $email The email object. * * @return WC_Email */ public function prepare_email_for_preview($email) { } /** * Get a dummy subscription for use in preview emails. * * @return WC_Subscription */ private function get_dummy_subscription() { } /** * Get a dummy product for use when previewing subscription emails. * * @return WC_Product */ private function get_dummy_product() { } /** * Get a dummy address used when previewing subscription emails. * * @return array */ private function get_dummy_address() { } /** * Creates a dummy retry for use when previewing failed subscription payment retry emails. * * @param WC_Order $order The order object to create a dummy retry for. * @return WCS_Retry The dummy retry object. */ private function get_dummy_retry($order) { } /** * Check if the email being previewed is a subscription email. * * Subscription emails include: * - WC_Subscriptions_Email::$email_classes - core subscription emails. * - WC_Subscriptions_Email_Notifications::$email_classes - subscription notification emails (pre-renewal emails). * - WCS_Email_Customer_Payment_Retry - customer payment retry emails. * - WCS_Email_Payment_Retry - admin payment retry emails. * * @return bool Whether the email being previewed is a subscription email. */ private function is_subscription_email() { } /** * Set up filters for previewing emails. */ private function set_up_filters() { } /** * Clean up filters at the end of previewing emails. * * @param string $preview_content The email content. * * @return string */ public function clean_up_filters($preview_content) { } /** * Mock the last order date created for a subscription to the current date. * * @param string $date The date. * * @return string */ public function mock_last_order_date_created($date, $subscription) { } /** * Allow early renewals for previewing emails. * * @param bool $can_renew_early Whether the subscription can be renewed early. * @param WC_Subscription $subscription The subscription. * @param int $user_id The user ID. * * @return bool */ public function allow_early_renewals_during_preview($can_renew_early, $subscription, $user_id) { } /** * Adds custom placeholders for subscription emails. * * @param WC_Email $email The email object. */ private function add_placeholders($email) { } } /** * 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 */ class WCS_Email_Cancelled_Subscription extends \WC_Email { /** * Create an instance of the class. * * @access public */ function __construct() { } /** * For the cancellation email, we add an extra setting to let the merchant decide if * they should *always* received cancellation emails (the default being to send them * only once, when they are first set to Pending Cancellation or Cancelled). * * @return void */ private function add_always_send_field() { } /** * 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 */ 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() { } } /** * 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 */ 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() { } } /** * Customer notification email * * Customer notification email sent to customer when a there's an upcoming payment/expity/free trial expiry. * * @class WCS_Email_Customer_Notification * @version 7.7.0 * @package WooCommerce/Classes/Emails */ class WCS_Email_Customer_Notification extends \WC_Email { public function __construct() { } /** * Initialise Settings Form Fields - these are generic email options most will use. */ public function init_form_fields() { } /** * Trigger function. * * @return void */ public function trigger($subscription_id) { } /** * Get content for the HTML-version of the email. * * @return string */ public function get_content_html() { } /** * Get content for the plain (text, non-HTML) version of the email. * * @return string */ public function get_content_plain() { } /** * Returns number of days until date_type for subscription. * * This method is needed when sending out the emails as the email queue might be delayed, in which case the email * should state the correct number of days until the date_type. * * @param WC_Subscription $subscription Subscription to check. * @param string $date_type Date type to count days to. * * @return false|int|string Number of days from now until the date type event's time. Empty string if subscription doesn't have the date_type defined. False if DateTime can't process the data. */ public function get_time_until_date($subscription, $date_type) { } /** * Return subscription's date of date type in localized format. * * @param WC_Subscription $subscription * @param string $date_type * * @return string */ public function get_formatted_date($subscription, $date_type) { } /** * Default content to show below main email content. * * @return string */ public function get_default_additional_content() { } /** * Determines whether the customer reminder email should be sent. * * Reminder emails are not sent if: * - The Customer Notification feature is disabled. * - The store is a staging or development site. * - The recipient email address is missing. * - The subscription's billing cycle is too short. * * @param WC_Subscription $subscription * * @return bool */ public function should_send_reminder_email($subscription) { } /** * If WCS_DEBUG or WP_DEBUG is enabled, attach a note to the subscription to detail why a reminder email was not sent. * * @param WC_Subscription $subscription * @param array|string $reasons * * @return false */ private function log_reminder_email_not_sent($subscription, $reasons) { } } /** * Customer Notification: Automated Subscription Renewal. * * An email sent to the customer when a subscription will be renewed automatically. * * @class WCS_Email_Customer_Notification_Auto_Renewal * @version 1.0.0 * @package WooCommerce_Subscriptions/Classes/Emails */ class WCS_Email_Customer_Notification_Auto_Renewal extends \WCS_Email_Customer_Notification { /** * Create an instance of the class. */ public function __construct() { } public function get_relevant_date_type() { } /** * Default content to show below main email content. * * @return string */ public function get_default_additional_content() { } } /** * Customer Notification: Free Trial Expiring Subscription Email * * An email sent to the customer when a free trial is about to end. * * @class WCS_Email_Customer_Notification_Free_Trial_Expiry * @version 1.0.0 * @package WooCommerce_Subscriptions/Classes/Emails */ class WCS_Email_Customer_Notification_Auto_Trial_Expiration extends \WCS_Email_Customer_Notification { /** * Create an instance of the class. */ public function __construct() { } public function get_relevant_date_type() { } } /** * Customer Notification: Manual Subscription Renewal. * * An email sent to the customer when a subscription needs to be renewed manually. * * @class WCS_Email_Customer_Notification_Manual_Renewal * @version 1.0.0 * @package WooCommerce_Subscriptions/Classes/Emails */ class WCS_Email_Customer_Notification_Manual_Renewal extends \WCS_Email_Customer_Notification { /** * Create an instance of the class. */ public function __construct() { } public function get_relevant_date_type() { } /** * Default content to show below main email content. * * @return string */ public function get_default_additional_content() { } } /** * Customer Notification: Free Trial Expiring Subscription Email * * An email sent to the customer when a free trial is about to end. * * @class WCS_Email_Customer_Notification_Free_Trial_Expiry * @version 1.0.0 * @package WooCommerce_Subscriptions/Classes/Emails */ class WCS_Email_Customer_Notification_Manual_Trial_Expiration extends \WCS_Email_Customer_Notification { /** * Create an instance of the class. */ public function __construct() { } public function get_relevant_date_type() { } } /** * Customer Notification: Subscription Expiring email * * An email sent to the customer when a subscription is about to expire. * * @class WCS_Email_Customer_Notification_Subscription_Expiring * @version 1.0.0 * @package WooCommerce_Subscriptions/Classes/Emails */ class WCS_Email_Customer_Notification_Subscription_Expiration extends \WCS_Email_Customer_Notification { /** * Create an instance of the class. */ public function __construct() { } public function get_relevant_date_type() { } /** * Default content to show below main email content. * * @return string */ public function get_default_additional_content() { } } // 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. */ 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() { } } /** * 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 */ 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() { } } /** * 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 */ 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 */ 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 */ 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 */ 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 */ 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() { } } /** * Reactivated Subscription Email * * An email sent to the admin when a subscription is reactivated (in the sense that a customer reactivates a * subscription which was pending cancellation). * * @since 8.4.0 */ class WCS_Email_Reactivated_Subscription extends \WC_Email { /** * Sets up the email object. */ public function __construct() { } /** * Get the default e-mail subject. * * @return string */ public function get_default_subject() { } /** * Get the default e-mail heading. * * @return string */ public function get_default_heading() { } /** * Runs when the email is triggered. * * @return void */ public function trigger($subscription) { } /** * Get the HTML version of the content. * * @return string */ public function get_content_html() { } /** * Get the plain-text version of the content. * * @return string */ public function get_content_plain() { } /** * Initialise fields used to configure the email. * * @return void */ public function init_form_fields() { } } /** * 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. * * @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 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 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) { } } /** * 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 */ abstract protected 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 */ abstract protected 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 $subscription A subscription object * @param string $old_paypal_subscriber_id 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 $subscription * @param int $transaction_id Id from transaction details as provided by PayPal * @param array|string $order_types 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 $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 $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 $order_id A WC_Order object or child object (i.e. WC_Subscription) * @param int $product_id The product ID. * @since 1.0.0 - Migrated from WooCommerce Subscriptions v1.1 */ public static function get_subscriptions_paypal_id($order_id, $product_id = 0) { } /** * 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. * * @param WC_Order $order A WC_Order object. * @param int $product_id The ID of the product. * @param string $profile_id The ID of the profile. * @since 1.0.0 - Migrated from WooCommerce Subscriptions v1.1 */ public static function cancel_subscription_with_paypal($order, $product_id = 0, $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 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 $subscription_id 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 $subscription_id 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 $order_id 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 $order_id 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 $order_id 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; /** * Health Check privacy eraser. * * @var \Automattic\WooCommerce_Subscriptions\Internal\HealthCheck\PrivacyEraser */ protected $health_check_privacy_eraser; /** * WCS_Privacy constructor. */ public function __construct() { } /** * Register erasers and exporters. */ public function register_erasers_exporters() { } /** * 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. * * ⚠️ Since 7.7.0, when triggering migrations and upgrade routines we should reference self::$active_plugin_version * (which corresponds with the actual plugin version) and not self::$active_core_library_version (which is the * Subscriptions Core library version, and therefore a historic side-effect of a time when development was split * across two repositories). * * @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 * @since 7.7.0 Added support for upgrades based on the plugin version number, as opposed to the core library version number. */ class WC_Subscriptions_Upgrader { /** * @var string The database-persisted version number of the Subscriptions Core framework. Retained to support historic migrations. * @since 7.7.0 */ private static string $stored_core_library_version; /** * @var string The database-persisted version number of WooCommerce Subscriptions. * @since 7.7.0 */ private static string $stored_plugin_version; /** * Indicates if plugin upgrade routines should potentially be triggered. * * @var bool * @since 7.7.0 */ private static bool $plugin_upgrades_may_be_needed = \false; /** * @var string The minimum supported version that this class can upgrade from. */ private static $minimum_supported_version = '3.0'; /** * Indicates if core library upgrade routines should potentially be triggered. * * @var bool * @since 7.7.0 */ private static bool $core_library_upgrades_may_be_needed = \false; /** * @var array An array of WCS_Background_Updater objects used to run upgrade scripts in the background. */ protected static $background_updaters = array(); /** * Deprecated variables. * * @deprecated subscriptions-core 7.7.0 */ public static $is_wc_version_2 = \false; public static $updated_to_wc_2_0; private static $upgrade_limit_subscriptions; private static $about_page_url; private static $old_subscription_count = \null; private static $upgrade_limit_hooks; /** * Hooks upgrade function to init. * * @since 1.0.0 - Migrated from WooCommerce Subscriptions v1.2 */ public static function init() { } /** * 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() { } /** * This method contains migrations for changes introduced before WooCommerce Subscriptions 7.7.0. * * The version numbers tested here are core library version numbers. For any new migrations or upgrade routines, * we should use the actual plugin version number. This boils down to one simple rule: * * ⚠️ New migrations/upgrade routines should not be added to this method. * * @return void */ private static function legacy_core_library_upgrades(): void { } /** * Plugin upgrades should be triggered from this method. * * Here is an example of doing some work when the user updates to 8.0.0: * * if ( version_compare( self::$stored_plugin_version, '8.0.0', '<' ) ) { * self::do_something_when_updating_to_8_0_0(); * } * * @return void */ private static function plugin_upgrades(): void { } /** * When an upgrade is complete, set the active version and fire a hook. * * @since 1.0.0 - Migrated from WooCommerce Subscriptions v1.2 */ public static function upgrade_complete() { } /** * Load and initialise the background updaters. * * @since 1.0.0 - Migrated from WooCommerce Subscriptions v2.4.0 */ public static function initialise_background_updaters() { } /** * 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) { } /** * Show an admin notice if the store is upgrading from a Subscriptions version that's no longer supported. * * @since 7.7.0 */ private static function show_unsupported_upgrade_path_notice() { } /* 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() { } /** * Deprecated functions. */ /** * 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. * * @deprecated subscriptions-core 7.7.0 - Upgrade limits were used when the upgrade process used AJAX. * * @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. * * @deprecated subscriptions-core 7.7.0 Cron lock was required for more intensive upgrades prior to v3.0 * * @since 1.0.0 - Migrated from WooCommerce Subscriptions v2.0 */ protected static function set_cron_lock() { } /** * Redirect to the Subscriptions major version Welcome/About page for major version updates. * * @deprecated subscriptions-core 7.7.0 * * @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. * * @deprecated subscriptions-core 7.7.0 * * @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.. * * @deprecated subscriptions-core 7.7.0 - This function is only used when upgrading from versions less than v3.0. * * @since 1.0.0 - Migrated from WooCommerce Subscriptions v1.5 */ public static function ajax_upgrade() { } /** * Handle upgrades for really old versions. * * @deprecated subscriptions-core 7.7.0 * @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. * * @deprecated subscriptions-core 7.7.0 * * @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. * * @deprecated subscriptions-core 7.7.0 - We know longer use a notice or pages to display upgrade progress. * * @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. * * @return void */ public static function admin_css() { } /** * Add styles just for this page, and remove dashboard page links. * * @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. * * @deprecated subscriptions-core 7.7.0 - We no lock down the store during subscription upgrades so we don't need to block IPNs. * * @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. * @deprecated subscriptions-core 7.7.0 * @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. * @deprecated subscriptions-core 7.7.0 * @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. * * @deprecated subscriptions-core 7.7.0 - Upgrading from before WC 3.0 is not supported. * * @since 1.0.0 - Migrated from WooCommerce Subscriptions v2.3.0 */ public static function maybe_add_subscription_address_indexes() { } /** * 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 * @deprecated subscriptions-core 7.7.0 */ public static function maybe_display_external_object_cache_warning() { } } class WCS_Plugin_Upgrade_7_8_0 { /** * Check if the Gifting plugin is enabled and update the settings. * * @since 7.8.0 */ public static function check_gifting_plugin_is_enabled() { } } class WCS_Plugin_Upgrade_8_3_0 { /** * Check if the Gifting plugin is enabled and update the settings. * * @since 8.1.0 */ public static function check_downloads_plugin_is_enabled() { } } /** * WCS_Plugin_Upgrade_8_5_0 class. */ class WCS_Plugin_Upgrade_8_5_0 { /** * Enable the "show shared downloadable products" setting for stores * that already have downloadable file sharing enabled. * * This preserves backward compatibility: existing stores continue to see * downloadable products as line items on subscriptions. New activations * of the downloads feature will default to the better-performing behavior * (no line items). * * @since 8.5.0 */ public static function maybe_enable_downloads_line_items() { } } /** * WCS_Plugin_Upgrade_8_8_0 class. */ class WCS_Plugin_Upgrade_8_8_0 { /** * Consider auto-enabling the "Dedicated processing" feature on this site. * * Delegates the decision to {@see Auto_Enable}, which inspects the live environment for any signs of * existing Action Scheduler tuning. Only flips the option on stores that pass every probe — when any * signal suggests the site has been hand-tuned, we skip and leave the merchant in control. Logs the * decision (and the disqualifying signal, when applicable) to the upgrade log for later diagnosis. * * @since 8.8.0 */ public static function maybe_auto_enable_reserved_processing_capacity(): void { } } /** * @deprecated */ 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) { } } /** * @deprecated */ 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) { } } /** * @deprecated */ 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) { } } /** * @deprecated */ 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() { } } /** * @deprecated */ 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) { } } /** * @deprecated */ 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() { } } /** * @deprecated subscriptions-core 7.7.0 */ class WCS_Upgrade_1_2 { public static function init() { } } /** * @deprecated subscription-core 7.7.0 */ class WCS_Upgrade_1_3 { public static function init() { } } /** * @deprecated subscriptions-core 7.7.0 */ 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 * @deprecated subscriptions-core 7.7.0 */ 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. * * @deprecated * @since 1.0.0 - Migrated from WooCommerce Subscriptions v2.0 */ public static function upgrade_products() { } /** * Update subscription WP-Cron tasks to Action Scheduler. * * @deprecated * @since 1.0.0 - Migrated from WooCommerce Subscriptions v2.0 */ public static function upgrade_hooks($number_hooks_to_upgrade) { } } /** * @deprecated */ 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() * @since 1.0.0 - Migrated from WooCommerce Subscriptions v2.0 */ private static function migrate_switch_meta($new_subscription, $switch_order, $subscription_item_id) { } } /** * @deprecated */ 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() { } } /** * @deprecated */ 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 $message The message to be logged * @since 1.0.0 - Migrated from WooCommerce Subscriptions v2.2.7 */ protected static function log($message) { } } /** * @deprecated */ 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 $message 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_8_3_0 { /** * Update Subscription email templates Subject and Heading replacing blogname with site_title. * * @since 8.3.0 */ public static function migrate_subscription_email_templates() { } } class WCS_Upgrade_9_0_0 { /** * The cron hook used to schedule batch migrations of APFS products. * * @var string */ private static $cron_hook = 'woocommerce_subscriptions_migrate_apfs_products'; /** * The number of products to process per batch. * * @var int */ private static $batch_size = 50; /** * The option name used to track the last migrated product ID. * * @var string */ private static $tracking_option = 'woocommerce_subscriptions_9_0_0_last_migrated_product_id'; /** * The option name used to store the total number of products to migrate. * * Captured once when the migration starts and used as the denominator for the * admin progress notice. * * @var string */ private static $total_option = 'woocommerce_subscriptions_9_0_0_migration_total'; /** * The option name used to track how many products have been processed so far. * * Used as the numerator for the admin progress notice. * * @var string */ private static $migrated_count_option = 'woocommerce_subscriptions_9_0_0_migrated_count'; /** * The option name used to flag that the migration has finished. * * Set when the final batch completes and drives the dismissible completion notice. * Deleted when the merchant dismisses that notice. * * @var string */ private static $complete_option = 'woocommerce_subscriptions_9_0_0_migration_complete'; /** * The standalone APFS plugin basename. * * @var string */ private static $apfs_plugin_basename = 'woocommerce-all-products-for-subscriptions/woocommerce-all-products-for-subscriptions.php'; /** * Initialize hooks for the upgrade class. * * Registers the cron callback and the standalone APFS plugin deactivation hook. * * @since 9.0.0 */ public static function init() { } /** * While the APFS migration is in progress, resolve a product's scheme mode with the standalone * plugin's rules instead of the core meta-based resolution. * * Core reads the mode from the `_wcsatt_schemes_status` / `_wcsatt_storewide_selection_mode` * meta keys, which the standalone plugin never wrote and does not honor — so a product carrying * stale/core-only meta could display differently than it did under the standalone. To keep the * catalog stable during the migration window, we emulate the standalone read * (`WCS_ATT_Product_Schemes::get_subscription_schemes()`) until each product's batch writes its * permanent mode. Once the migration completes (the total option is deleted) this filter becomes * inert and normal core resolution resumes. * * @since 9.0.1 * * @param string|null $mode The pre-resolved mode (null unless another callback set it). * @param WC_Product|null $product The product being resolved. * @return string|null A WCS_ATT_Scheme::MODE_* constant to force, or the incoming value otherwise. */ public static function maybe_emulate_standalone_scheme_mode($mode, $product = \null) { } /** * Resolve a product's scheme mode using the standalone APFS plugin's rules. * * Mirrors the standalone `WCS_ATT_Product_Schemes::get_subscription_schemes()` resolution: * a product is one-time when explicitly disabled; uses its own custom plans when it has any; * otherwise inherits storewide plans when they exist and the product is category-eligible, * falling back to one-time. Deliberately ignores the core-only `_wcsatt_schemes_status` and * `_wcsatt_storewide_selection_mode` keys so the result matches the standalone exactly. * * @since 9.0.1 * * @param WC_Product $product The product to resolve. * @return string A WCS_ATT_Scheme::MODE_* constant. */ private static function standalone_scheme_mode($product) { } /** * Whether the APFS product migration is currently in progress. * * True from the moment the migration is scheduled (the total option is set) until the * final batch completes and deletes it. * * @since 9.0.1 * * @return bool */ private static function is_migration_in_progress() { } /** * Migrate the legacy proration option to the new first billing behavior option. * * Runs once on upgrade. Guarded by checking whether the new option is already set. * * @since 9.0.0 */ public static function maybe_migrate_proration_option() { } /** * Entry point for the APFS product migration. * * Checks whether the standalone APFS plugin was previously active and is now disabled. * If so, triggers the batch migration immediately. If the plugin is still active, * migration is deferred to the `on_apfs_plugin_deactivated()` hook — this ensures the * category restrictions are read at the moment the merchant disables APFS, not at * upgrade time (when they may still modify categories). * * @since 9.0.0 */ public static function log_apfs_products_migration_status() { } /** * Schedule the next batch of APFS product migrations via Action Scheduler. * * @since 9.0.0 * */ private static function schedule_apfs_migration() { } /** * Process a batch of products for APFS migration. * * Reads the category restriction list once, then queries for products that have no * APFS configuration and assigns the appropriate subscription scheme mode based on * category membership. * * @since 9.0.0 */ public static function migrate_apfs_products_batch() { } /** * Enable subscription product type creation settings if matching products exist. * * Checks if the store has any simple subscription or variable subscription products * and enables the corresponding creation settings. Only runs for stores that had * standalone APFS installed. * * @since 9.0.0 */ public static function maybe_enable_subscription_product_types() { } /** * Handle standalone APFS plugin deactivation. * * Hooked to `deactivated_plugin`. Checks if the deactivated plugin is the * standalone APFS plugin, then triggers the batch migration. Category restrictions * are read at this point to reflect the merchant's final configuration. * * @since 9.0.0 * * @param string $plugin The plugin basename that was deactivated. */ public static function on_apfs_plugin_deactivated($plugin = '') { } /** * Block the standalone APFS plugin from being activated. * * Hooked to `admin_init` to intercept the activation request before WordPress * sandbox-scrapes the plugin file. This prevents fatal errors. * * @since 9.0.0 */ public static function block_apfs_plugin_activation() { } /** * Get the next batch of product IDs to migrate. * * Queries for products with ID greater than the last migrated product ID that do * not have `_wcsatt_schemes_status` meta set. Additionally excludes products with * any legacy APFS meta keys. * * Only top-level products (`post_type = 'product'`) are queried — variations inherit * their subscription scheme mode from the parent at runtime, so they must not be * migrated independently. * * @since 9.0.0 * * @param int $last_product_id The last product ID that was migrated. * @return array Array of product IDs. */ private static function get_products_to_migrate($last_product_id) { } /** * Count the total number of products that will be migrated. * * Mirrors the criteria used by `get_products_to_migrate()` (minus the ID cursor and * batch limit) so the progress notice's denominator matches exactly what the batches * iterate over. Captured once at the start of the run because the eligible set shrinks * as products gain the `_wcsatt_schemes_status` meta. * * @since 9.0.1 * * @return int The number of products to migrate. */ private static function count_products_to_migrate() { } /** * Display an admin notice reporting the product migration status. * * While the migration is running (the total option is set) it shows a progress notice. * Once the final batch completes it shows a dismissible "finished" notice, which is * cleared when the merchant dismisses it. * * @since 9.0.1 */ public static function display_migration_progress_notice() { } /** * Determine whether a product should inherit storewide subscription plans. * * If the category restriction list is empty, all products qualify. If the list has * entries, only products belonging to at least one listed category qualify. * Products that don't qualify are left at the default `disable` mode (no write needed). * * @since 9.0.0 * * @param WC_Product $product The product to check. * @param array $categories Array of category IDs from the APFS category restriction setting. * @return bool True if the product should be set to `inherit` mode. */ private static function should_inherit_storewide_plans($product, $categories) { } /** * Check if the standalone APFS plugin is currently active. * * @since 9.0.0 * * @return bool True if the standalone APFS plugin is active. */ private static function is_apfs_plugin_active() { } } 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 * * @since 7.7.0 Updated to reference the plugin version, rather than the legacy core library version. * * @param string $current_library_version Disused. * @param string $old_library_version Disused. * @param string $current_version Current version of WooCommerce Subscriptions. * @param string $old_version Old version of WooCommerce Subscriptions. */ public static function schedule_cleanup(string $current_library_version, string $old_library_version, string $current_version, string $old_version): void { } } /** * @deprecated */ 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()) { } } /** * @deprecated 8.8.0 Composer handles class autoloading; this class is no longer used. */ class WCS_Core_Autoloader { /** * Accepts and discards any constructor arguments the legacy signature took. * * @param mixed $base_path Unused. Retained so existing call sites do not error. */ // @phpstan-ignore constructor.unusedParameter public function __construct($base_path = '') { } /** * Catch-all for instance method calls on the deprecated class. * * @param string $name The method name. * @param array $arguments The arguments passed to the method. */ public function __call($name, $arguments) { } /** * Catch-all for static method calls on the deprecated class. * * @param string $name The method name. * @param array $arguments The arguments passed to the method. */ public static function __callStatic($name, $arguments) { } /** * Catch-all for property reads on the deprecated class. * * @param string $name The property name. */ public function __get($name) { } /** * Catch-all for property writes on the deprecated class. * * @param string $name The property name. * @param mixed $value The value being assigned. */ public function __set($name, $value) { } } /** * @deprecated 8.8.0 Composer handles class autoloading; this class is no longer used. */ class WCS_Autoloader extends \WCS_Core_Autoloader { } class WC_Subscription_Downloads_Admin_Welcome_Announcement { /** * Initialize the tour handler */ public static function init() { } /** * Enqueue required scripts and styles */ public static function enqueue_scripts() { } /** * Output the tour HTML in the admin footer */ public static function output_tour() { } /** * Checks if the welcome tour has been dismissed. * * @return bool */ public static function is_welcome_announcement_dismissed() { } /** * Checks if the current screen is WooCommerce Admin or subscriptions listing. * * @return bool */ private static function is_woocommerce_admin_or_subscriptions_listing() { } } /** * WooCommerce Subscription Downloads Ajax. * * @package WC_Subscription_Downloads_Ajax * @category Ajax * @author WooThemes */ class WC_Subscription_Downloads_Ajax { /** * Ajax actions. */ public function __construct() { } /** * Search subscription products. */ public function search_subscriptions() { } /** * Searches for downloadable products that are simple or variants. * * @return void */ public function search_downloadable_products(): void { } } /** * WooCommerce Subscription Downloads Install. * * @package WC_Subscription_Downloads_Install * @category Install * @author WooThemes */ class WC_Subscription_Downloads_Install { /** * Run the install. */ public function __construct() { } /** * Install the plugin table. * * @return void */ protected function create_table() { } } /** * WooCommerce Subscription Downloads Order. * * @package WC_Subscription_Downloads_Order * @category Order * @author WooThemes */ class WC_Subscription_Downloads_Order { /** * Order actions. */ public function __construct() { } /** * Save the download permissions in the subscription depending on the status. * * @param int $subscription_id Subscription ID. * @param string $old_status Old status. * @param string $new_status New status. * @param WC_Subscription $subscription Subscription object. * * @return void */ public function download_permissions($subscription_id, $old_status, $new_status, $subscription) { } /** * Remove downloads duplicates on subscriptions. * * @since 1.1.29 * * @param array $downloads List of downloads. * @param WC_Order $order The order. * * @return array Array of downloads. */ public static function remove_subscription_download_duplicates($downloads, $order) { } /** * Remove customer download duplicates that were added to the same order. * * @since 1.1.30 * * @param array $downloads List of downloads. * @param int $customer_id The customer id. * * @return array Array of downloads. */ public static function remove_customer_download_duplicates($downloads, $customer_id) { } /** * List the downloads in order emails. * * @param WC_Order $order Order data * @param bool $sent_to_admin Sent or not to admin. * @param bool $plain_text Plain or HTML email. */ public function email_list_downloads($order, $sent_to_admin = \false, $plain_text = \false) { } /** * Revoke download permissions granted on the old switch item. * * @param WC_Subscription $subscription * @param array $new_item * @param array $old_item */ public function handle_download_switch($subscription, $new_item, $old_item) { } } /** * WooCommerce Subscription Downloads Products. * * @package WC_Subscription_Downloads_Products */ class WC_Subscription_Downloads_Products { public const EDITOR_UPDATE = 'wcsubs_subscription_download_relationships'; public const RELATIONSHIP_DOWNLOAD_TO_SUB = 'download-to-sub'; public const RELATIONSHIP_VAR_DOWNLOAD_TO_SUB = 'var-download-to-sub'; public const RELATIONSHIP_SUB_TO_DOWNLOAD = 'sub-to-download'; public const RELATIONSHIP_VAR_SUB_TO_DOWNLOAD = 'var-sub-to-download'; /** * Products actions. */ public function __construct() { } public function init() { } /** * Handle product save - generic handler for all product updates. * * @param int $post_id Post ID. * * @return void */ public function handle_product_save($post_id) { } /** * Handle product variation save - generic handler for all variation updates. * * @param int $post_id Post ID. * * @return void */ public function handle_product_variation_save($post_id) { } /** * Handle save for downloadable products (simple or variation). * These products link TO subscription products. * * @param int $product_id Product or variation ID. * * @return void */ private function handle_downloadable_product_save($product_id) { } /** * Handle save for subscription products (simple subscription or variation). * These products link TO downloadable products. * * @param int $product_id Subscription product or variation ID. * * @return void */ private function handle_subscription_product_save($product_id) { } /** * Assess downloadable product status and adjust permissions accordingly. * Called when no form data is available (e.g., status change, REST API update, file changes). * * @param int $product_id Product ID. * * @return void */ private function assess_downloadable_product_status($product_id) { } /** * Simple product write panel options. */ public function simple_write_panel_options() { } /** * Variable product write panel options. */ public function variable_write_panel_options($loop, $variation_data, $variation) { } /** * Adds a field with which to link the subscription product (the product being edited) with zero-or-many * downloadable products. * * @return void */ public function subscription_product_editor_ui(): void { } /** * @param int $loop * @param array $variation_data * @param WP_Post $variation * * @return void */ public function variable_subscription_product_editor_ui($loop, $variation_data, $variation): void { } /** * Search orders from subscription product ID. * * @param int $subscription_product_id * * @return array */ protected function get_orders($subscription_product_id) { } /** * Revoke access to download. * * @param bool $download_id * @param bool $product_id * @param bool $order_id * * @return void */ protected function revoke_access_to_download($download_id, $product_id, $order_id) { } /** * Update subscription downloads table and orders according in respect to the described relationship between a * regular product and zero-to-many regular subscription products. * * @param int $product_id The downloadable product ID. * @param array $subscriptions Subscription product IDs. * * @return void */ protected function update_subscription_downloads($product_id, $subscriptions) { } /** * Update subscription downloads table and orders according in respect to the described relationship between a * subscription product and zero-to-many regular products. * * @param int $subscription_product_id Subscription product ID. * @param int[] $new_ids IDs for downloadable products that should be associated with the subscription product. * * @return void */ private function update_subscription_products(int $subscription_product_id, array $new_ids): void { } /** * Deletes relationships that exist between any of the supplied subscription IDs and any of the supplied product * IDs. * * The most common use case will be to supply a single subscription ID and one-or-more product IDs, or else the * inverse. * * @param int[] $subscription_ids * @param int[] $product_ids * * @return void */ private function delete_relationships(array $subscription_ids, array $product_ids): void { } /** * Revoke download permissions for a product across all related subscriptions. * * @param int $product_id Product ID. * * @return void */ private function revoke_permissions_for_product($product_id) { } /** * Grant download permissions for a product across all related subscriptions. * * @param int $product_id Product ID. * * @return void */ private function grant_permissions_for_product($product_id) { } /** * Adds relationships between the specified subscription and product IDs. * * The most common use case will be to supply a single subscription ID and one-or-more product IDs, or else the * inverse. * * @param int[] $subscription_ids * @param int[] $product_ids * * @return void */ private function create_relationships(array $subscription_ids, array $product_ids): void { } /** * Save simple product data. * * @param int $product_id * * @return void */ public function save_simple_product_data($product_id) { } /** * Save subscriptions information when duplicating a product. * * @param int|WC_Product $id_or_product Duplicated product ID * @param WP_Post|WC_Product $post Product being duplicated */ public function save_subscriptions_when_duplicating_product($id_or_product, $post) { } /** * Get string representation of variation attributes from a given product variation. * * @param mixed $product_variation Product variation * * @return string Variation attributes */ protected function get_str_variation_attributes($product_variation) { } /** * Deprecated, do not use. Previously took care of saving product data for variations. * * @deprecated 8.3.0 * * @param int $variation_id * @param int $index * * @return void */ // phpcs:disable Generic.CodeAnalysis.UnusedFunctionParameter.FoundAfterLastUsed public function save_variation_product_data($variation_id, $index) { } /** * Deprecated, do not use. Previously took care of saving product data. * * @deprecated 8.3.0 * * @param int $subscription_product_id * @param int|null $index * * @return void */ // phpcs:disable Generic.CodeAnalysis.UnusedFunctionParameter.FoundAfterLastUsed public function save_subscription_product_data(int $subscription_product_id, ?int $index = \null) { } /** * Deprecated, do not use. Previously set up assets for the Subscription Downloads extension. * * @deprecated 8.3.0 * * @return void */ public function scripts() { } } /** * Registers and manages settings related to linked downloadable files functionality. * * @internal This class is used internally by WooCommerce Subscriptions. It is not intended for third party use, and may change at any time. */ class WC_Subscription_Downloads_Settings { public function __construct() { } /** * Check if WooCommerce Subscription Downloads plugin is enabled and add a warning about the bundled feature if it is. * * @since 8.0.0 */ public static function add_notice_about_bundled_feature() { } /** * Adds our settings to the main subscription settings page. * * @param array $settings The full subscription settings array. * * @return array */ public function add_settings(array $settings): array { } /** * Check if Subscriptions Downloads is enabled. * @since 8.1.0 * @return bool */ public static function is_enabled() { } /** * Check if downloadable products should be added as line items on subscriptions. * * @since 8.5.0 * * @return bool */ public static function add_line_items_enabled() { } } /** * Point of entry for our 'linked downloadable files' functionality. * * Along with other classes in this directory, this used to exist as a standalone plugin (important to note because, for * backwards compatibility reasons, that may place limits on future refactoring). * * The overall goal is to let merchants associate individual downloadable products with subscription products. * Customers who purchase the subscription product then automatically are granted acccess to the relevant downloadable * files. * * This class sets up the functionality, and also provides a high-level interface through methods such as * get_order_downloads( $order ) and get_subscriptions( $product_id ). * * @since 8.1.0 */ class WC_Subscription_Downloads { /** * Initialize the various subsystems that drive 'linked downloadable files' functionality. */ public static function setup(): void { } /** * Install the plugin. * * @return void */ public static function install() { } /** * Given the ID of a downloadable product, returns an array of linked subscription product IDs. * * @param int $product_id * * @return array */ public static function get_subscriptions($product_id) { } /** * Get downloadable products from a subscription. * * @param int $subscription_id * * @return array */ public static function get_downloadable_products($subscription_id, $subscription_variable_id = '') { } /** * Get order download files. * * @param WC_Order $order Order data. * * @return array Download data (name, file and download_url). */ public static function get_order_downloads($order) { } /** * Get linked downloadable items for a subscription in the format expected by WC's order-downloads.php template. * * This queries the subscription downloads mapping table to find linked downloadable products, * rather than relying on the subscription's line items. This is necessary when downloadable * products are not added as line items on the subscription (for performance reasons). * * When $limit is set, only that many product IDs are loaded and processed, avoiding the * performance cost of loading all linked products. The total count of linked products is * always returned to allow callers to show "View all N downloads" links. * * @param WC_Subscription $subscription The subscription object. * @param int $limit Maximum number of products to load. 0 for unlimited. * * @since 8.5.0 * * @return array { * @type array[] $downloads Downloads in the get_downloadable_items() format. * @type int $total_products Total number of linked downloadable product IDs (before limit). * } */ public static function get_subscription_linked_downloads($subscription, $limit = 0) { } /** * Collect all unique linked downloadable product IDs for a subscription. * * This only runs the lightweight mapping table queries, without loading any product objects. * * @param WC_Subscription $subscription The subscription object. * * @since 8.5.0 * * @return int[] Unique product IDs. */ private static function get_all_linked_product_ids($subscription) { } /** * Batch-load product objects by ID in a single query. * * @param int[] $product_ids Product IDs to load. * * @since 8.5.0 * * @return WC_Product[] Map of product_id => WC_Product. */ private static function batch_load_products($product_ids) { } } 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 $cart_item 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. * * @since 2.3.0 * @deprecated 5.2.0 * * @param int $order_id The WC Order ID which contains an early renewal. */ public function maybe_reactivate_subscription($order_id) { } /** * Records an early renewal against order created on checkout (only for WooCommerce < 3.0). * * @since 2.3.0 * @deprecated 5.2.0 Use WCS_Cart_Early_Renewal::add_early_renewal_metadata_to_order() instead. * * @param int $order_id The post_id of a shop_order post/WC_Order object. * @param array $posted_data The data posted on checkout. */ 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. * * @since 2.3.0 * @deprecated 5.6.0 Use WCS_Cart_Early_Renewal::filter_early_renewal_order_actions() instead. * * @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 */ 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 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 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|false $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_Payment_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) { } } /** * Class for edit order page. */ class WCSG_Admin_Order { public static function init() { } /** * Hides the gifting meta from the order edit page. * @param array $item_meta_names The item meta names to hide. */ public static function hide_gifting_meta($item_meta_names) { } } /** * Sets up and manages subscription gifting functionality. */ class WCS_Gifting { /** * Plugin's current version. * * @var string */ public static $version = '2.9.0'; // WRCS: DEFINED_VERSION. /** * Minimum WooCommerce version required. * * @var string */ public static $wc_minimum_supported_version = '3.0'; /** * Minimum WooCommerce Subscription version required. * * @var string */ public static $wcs_minimum_supported_version = '2.2'; /** * Minimum WooCommerce Memberships version required for integration. * * @var string */ public static $wcm_minimum_supported_version = '1.4'; /** * Setup hooks & filters, when the class is initialised. */ public static function init() { } /** * Don't carry the _recipient_user meta data to renewal orders. * * @param array $order_meta Renewal order meta. * * @return array */ public static function remove_renewal_order_meta($order_meta) { } /** * Don't carry recipient meta data to renewal orders. * * @param string $order_meta_query Renewal order meta-query. */ public static function remove_renewal_order_meta_query($order_meta_query) { } /** * Loads classes after plugins for classes dependant on other plugin files. */ public static function load_dependant_classes() { } /** * Register/queue frontend scripts. */ public static function gifting_scripts() { } /** * Determines if an email address belongs to the current user. * * @param string $email Email address. * @return bool Returns whether the email address belongs to the current user. */ public static function email_belongs_to_current_user($email) { } /** * Validates an array of recipient emails scheduling error notices if an error is found. * * @param array $recipients An array of recipient email addresses. * @return bool Returns whether any errors have occurred. */ public static function validate_recipient_emails($recipients) { } /** * Attaches recipient information to a subscription cart item. * * @param object $item The item in the cart to be updated. * @param string $key Cart item key. * @param array $new_recipient_data The new recipient information for the item. */ public static function update_cart_item_recipient($item, $key, $new_recipient_data) { } /** * Populates the cart item data that will be used by WooCommerce to generate a unique ID for the cart item. That is to * avoid merging different products when they aren't the same. Previously the resubscribe status was ignored. * * @param array $item A cart item with all its data. * @param string $key A cart item key. * @param array $new_recipient_data Email address of the new recipient. * @return array New cart item data. */ private static function add_cart_item_data($item, $key, $new_recipient_data) { } /** * Checks on each admin page load if Gifting plugin is activated. * * Apparently the official WP API is "lame" and it's far better to use an upgrade routine fired on admin_init: https://core.trac.wordpress.org/ticket/14170#comment:68 * * @deprecated This is a hangover from the time when Subscriptions Gifting was a separate plugin. * @since 7.8.0 - Originally implemented in WooCommerce Subscriptions Gifting 1.1. */ public static function maybe_activate() { } /** * Called when the plugin is deactivated. Deletes the is active flag and fires an action. * * @deprecated This is a hangover from the time when Subscriptions Gifting was a separate plugin. * @since 7.8.0 - Originally implemented in WooCommerce Subscriptions Gifting 2.0.0. */ public static function deactivate() { } /** * Renders the add recipient fields (including the checkbox and e-mail input). * * @param string $email E-mail address. * @param string $id ID, for uniqueness on page. * @param string $print_or_return Wether to print or return the HTML content. Optional. Default behaviour is to print the string. Pass 'return' to return the HTML content instead. * @param bool $hidden Whether the container should be initially hidden (display:none). Used for products with subscription plans where the gifting UI is shown/hidden by JS based on plan selection. * @return string Returns the HTML string if $print_or_return is set to 'return', otherwise prints the HTML and nothing is returned. * @since 7.8.0 - Originally implemented in WooCommerce Subscriptions Gifting 2.1. */ public static function render_add_recipient_fields($email = '', $id = '', $print_or_return = 'print', $hidden = \false) { } /** * Build the set of arguments to be passed to the "Add Recipient" template. * * @param string $email E-mail address. * @param string $id ID, for CSS uniqueness on page. * @since 7.8.0 - Originally implemented in WooCommerce Subscriptions Gifting 2.1. */ public static function get_add_recipient_template_args($email = '', $id = '') { } /** * Adds row to subscription details table that displays subscription period for recipients. * * @param WC_Subscription $subscription Subscription object. * @since 7.8.0 - Originally implemented in WooCommerce Subscriptions Gifting 2.0.0. */ public static function add_billing_period_table_row($subscription) { } /** * Reformats the price of the subscription to hide it if the user is the recipient. * * @param string $formatted_order_total The order total formatted. * @param WC_Subscription $subscription Subscription object. * @since 7.8.0 - Originally implemented in WooCommerce Subscriptions Gifting 2.0.0. */ public static function get_formatted_recipient_total($formatted_order_total, $subscription) { } /** * Returns a combination of the customer's first name, last name and email depending on what the customer has set. * * @param int $user_id The ID of the customer user. * @param bool $strip_tags Whether to strip HTML tags in user name (defaulted to false). */ public static function get_user_display_name($user_id, $strip_tags = \false) { } /** * Displays plugin dependency notices if required plugins are inactive or the installed version is less than a * supported version. */ public static function plugin_dependency_notices() { } /** * Prints a plugin dependency admin notice. If a required version is supplied an invalid version notice is printed, * otherwise an inactive plugin notice is printed. * * @param string $plugin_name The plugin name. * @param string|bool $required_version The minimum supported version of the plugin. */ public static function output_plugin_dependency_notice($plugin_name, $required_version = \false) { } /** * Checks whether a subscription is a gifted subscription. * * @param int|WC_Subscription $subscription either a subscription object or subscription's ID. * @return bool */ public static function is_gifted_subscription($subscription) { } /** * Returns a list of all order item ids and their containing order ids that have been purchased for a recipient. * * @param int $recipient_user_id User ID. * @return array */ public static function get_recipient_order_items($recipient_user_id) { } /** * Returns the user's shipping address. * * @param int $user_id User ID. * @return array */ public static function get_users_shipping_address($user_id) { } /** * Determines if an order contains a gifted subscription. * * @param mixed $order the order id or order object to check. * @return bool */ public static function order_contains_gifted_subscription($order) { } /** * Retrieves the user id of the recipient stored in order item meta. * * @param mixed $order_item the order item to check. * @return mixed bool|int The recipient user id or false if the order item is not gifted. */ public static function get_order_item_recipient_user_id($order_item) { } /** * Create a recipient user account. * * @param string $recipient_email Recipient's e-mail address. * @return int ID for newly created user. */ public static function create_recipient_user($recipient_email) { } /** * Retrieve the recipient user ID from a subscription. * * @param WC_Subscription $subscription Subscription object. * * @return string The recipient's user ID. Returns an empty string if there is no recipient set. */ public static function get_recipient_user($subscription) { } /** * Set the recipient user ID on a subscription. * * @param WC_Subscription $subscription Subscription object. * @param int $user_id The user ID of the user to set as the recipient on the subscription. * @param string $save Whether to save the data or not, 'save' to save the data, otherwise it won't be saved. * @param int $meta_id The meta ID of existing meta data if you wish to overwrite an existing recipient meta value. * @param WC_Order $order Order object. */ public static function set_recipient_user(&$subscription, $user_id, $save = 'save', $meta_id = 0, ?\WC_Order $order = \null) { } /** * Delete the recipient user ID on a subscription * * @param WC_Subscription $subscription Subscription object. * @param string $save Whether to save the data or not, 'save' to save the data, otherwise it won't be saved. * @param int $meta_id The meta ID of existing recipient meta data if you wish to only delete a field specified by ID. */ public static function delete_recipient_user(&$subscription, $save = 'save', $meta_id = 0) { } /** * Retrieves a set of gifted subscriptions based on certain parameters. * * @see wc_get_orders() * * @param array $args Custom args for query, excluding 'type' and custom var 'is_gifted_subscription'. * Passing `'paginate' => true` switches the return shape to the standard * `wc_get_orders()` paginated stdClass envelope ({orders, total, max_num_pages}); * callers that need a count and a page in one shot should use that form. * * @return WC_Order[]|\stdClass `WC_Order[]` by default, or the paginated envelope * when `$args['paginate']` is true. * * @since 7.8.0 - Originally implemented in WooCommerce Subscriptions Gifting 2.0.3. */ public static function get_gifted_subscriptions($args = array()) { } /** * Handle custom WCS Gifting query vars to get subscriptions with 'WCS Gifting' meta. * * @param array $query Args for WP_Query. * @param array $query_vars Query vars from WC_Order_Query. * * @return array modified $query * @since 7.8.0 - Originally implemented in WooCommerce Subscriptions Gifting 2.0.3. */ public static function handle_is_gifted_subscription_query_var($query, $query_vars) { } /** * Does the site requires shipping address data for non-virtual products. Default: true * * @return bool */ public static function require_shipping_address_for_virtual_products() { } /** * Counts the number of Gifted Subscriptions. * * @return int * @since 7.8.0 - Originally implemented in WooCommerce Subscriptions Gifting 2.1.0. */ public static function get_gifted_subscriptions_count() { } /** * Register/queue admin scripts. * * @deprecated 2.0.0 Use WCSG_Admin::enqueue_scripts() instead. */ public static function admin_scripts() { } /** * Install wcsg * * @deprecated 2.0.0 Use WCS_Gifting::maybe_activate() instead. */ public static function wcsg_install() { } /** * Flush rewrite rules if they haven't been flushed since plugin activation * * @deprecated 2.0.0 Use flush_rewrite_rules() instead. */ public static function maybe_flush_rewrite_rules() { } /** * Overrides the default recent order template for gifted subscriptions * * @deprecated 2.0.0 Use WCSG_Template_Loader::get_recent_orders_template() instead. * * @param string $located Path to template. * @param string $template_name Template name. * @param array $args Arguments. */ public static function get_recent_orders_template($located, $template_name, $args) { } /** * Generates an array of arguments used to create the recipient email html fields. * * @param string $email E-mail address. * @return array email_field_args A set of html attributes * @deprecated 2.1 */ public static function get_recipient_email_field_args($email) { } /** * Generates an array of arguments used to create the recipient checkbox html fields * * @param string $email The email of the gift recipient. * @return array checkbox_field_args A set of html attributes * @since 7.8.0 - Originally implemented in WooCommerce Subscriptions Gifting 2.0.2. * @deprecated 2.1 */ public static function get_recipient_checkbox_field_args($email) { } public static function setup_blocks_integration() { } } /** * System Status Class */ class WCSG_Admin_System_Status { /** * Array of Gifting information for display on the System Status page. * * @var array */ private static $gifting_data = array(); /** * Hooks. */ public static function init() { } /** * Renders Gifting system status report. * * @since 7.8.0 - Originally implemented in WooCommerce Subscriptions Gifting 2.1.0. */ public static function render_system_status_items() { } /** * Sets the theme overrides area for Subscriptions Gifting. * * @since 7.8.0 - Originally implemented in WooCommerce Subscriptions Gifting 2.1.0. */ private static function set_theme_overrides() { } /** * Determine which of our files have been overridden by the theme and if the theme files are outdated. * * @since 7.8.0 - Originally implemented in WooCommerce Subscriptions Gifting 2.1.0. * @return array */ private static function get_theme_overrides() { } /** * Gets the number of Gifted Subscriptions and adds it to the system status. * * @since 7.8.0 - Originally implemented in WooCommerce Subscriptions Gifting 2.1.0. */ private static function set_gifting_information() { } } class WCSG_Admin_Welcome_Announcement { /** * Initialize the tour handler */ public static function init() { } /** * Enqueue required scripts and styles */ public static function enqueue_scripts() { } /** * Output the tour HTML in the admin footer */ public static function output_tour() { } /** * Checks if the welcome tour has been dismissed. * * @return bool */ public static function is_welcome_announcement_dismissed() { } /** * Checks if the current screen is WooCommerce Admin or subscriptions listing. * * @return bool */ private static function is_woocommerce_admin_or_subscriptions_listing() { } } /** * Class for admin-side integration. */ class WCSG_Admin { /** * Prefix used in all Gifting settings names. * * @var string */ public static $option_prefix = 'woocommerce_subscriptions_gifting'; /** * Setup hooks & filters, when the class is initialised. */ public static function init() { } /** * Hides the wcsg_recipient meta from the order item meta in the edit order page. * * @param array $hidden_order_itemmeta The hidden order item meta. * @return array The hidden order item meta. */ public static function hide_wcsg_recipient_meta($hidden_order_itemmeta) { } /** * Register/queue admin scripts. */ public static function enqueue_scripts() { } /** * Formats the subscription title in the admin subscriptions table to include the recipient's name. * * @param string $column_content The column content HTML elements. * @param WC_Subscription $subscription Subscription object. * @param string $column The column name being rendered. */ public static function display_recipient_name_in_subscription_title($column_content, $subscription, $column) { } /** * Removes the recipient order item meta from the admin subscriptions table. * * @param array $formatted_meta formatted order item meta key, label and value. */ public static function remove_recipient_order_item_meta($formatted_meta) { } /** * Add Gifting specific settings to standard Subscriptions settings * * @param array $settings Current set of settings. * @return array $settings New set of settings. */ public static function add_settings($settings) { } /** * Adds meta query to also include subscriptions the user is the recipient of when filtering subscriptions by customer. * Compatibility method for Subscriptions < 2.3.5. * * @param array $vars Request vars. * @return array */ public static function request_query($vars) { } /** * Adds subscriptions the user is the recipient of when filtering subscriptions by customer on the backend. * * @param array $subscription_ids Current set of subscription IDs. * @param int $customer_user_id User ID. * @return array New set of subscription IDs. * @since 7.8.0 - Originally implemented in WooCommerce Subscriptions Gifting 2.0.2. */ public static function request_query_customer_filter($subscription_ids, $customer_user_id) { } /** * Output a recipient user select field in the edit subscription data metabox. * * @param WP_Post $subscription Subscription's post object. * @since 7.8.0 - Originally implemented in WooCommerce Subscriptions Gifting 1.0.1. */ public static function display_edit_subscription_recipient_field($subscription) { } /** * Save subscription recipient user meta by updating or deleting _recipient_user post meta. * Also updates the recipient id stored in subscription line item meta. * * @param int $post_id Post ID. * @param WP_Post $post Post object. * @since 7.8.0 - Originally implemented in WooCommerce Subscriptions Gifting 1.0.1. */ public static function save_subscription_recipient_meta($post_id, $post) { } /** * Outputs a welcome message. Called when the Subscriptions extension is activated. * * @since 7.8.0 - Originally implemented in WooCommerce Subscriptions Gifting 2.0.0. */ public static function admin_installed_notice() { } /** * A WooCommerce version aware function for getting the Subscriptions/Gifting admin settings tab URL. * * @since 7.8.0 - Originally implemented in WooCommerce Subscriptions Gifting 2.0.0. * @return string */ public static function settings_tab_url() { } /** * Adds a dropdown to the Subscriptions admin screen to allow filtering by gifted subscriptions. * * @param string $post_type Current post type. * @since 7.8.0 - Originally implemented in WooCommerce Subscriptions Gifting 2.0.3. */ public static function add_gifted_subscriptions_filter($post_type = '') { } /** * Filters the main admin query to include only gifted or non-gifted subscriptions. * * @param WP_Query $query The WP_Query instance (passed by reference). * @since 7.8.0 - Originally implemented in WooCommerce Subscriptions Gifting 2.0.3. */ public static function maybe_filter_by_gifted_subscriptions($query) { } /** * Filter the Subscriptions Admin Table to filter only gifted or non-gifted subscriptions. * * @param array $request_query The query args sent to wc_get_orders(). */ public static function filter_subscription_list_table_by_gifted_subscriptions($request_query) { } /** * Adds actions to the admin edit subscriptions page, if the subscription is a gifted one. * * @param array $actions Current admin actions. * @return array $actions The subscription actions with the "Renew Now" action added if it's permitted. * * @since 7.8.0 - Originally implemented in WooCommerce Subscriptions Gifting 2.1.0. */ public static function add_resend_new_recipient_account_email_action($actions) { } /** * Resends the "new recipient" e-mail. * * @param WC_Order $subscription Subscription object. * * @since 7.8.0 - Originally implemented in WooCommerce Subscriptions Gifting 2.1.0. */ public static function resend_new_recipient_account_email($subscription) { } /** * Get enable gifting setting. * * @return bool */ public static function is_gifting_enabled() { } /** * Get if gifting is enabled by default for all products. * * @return bool */ public static function is_gifting_enabled_for_all_products() { } /** * Get the text for the gifting option. * * @return string */ public static function get_gifting_option_text() { } /** * Get the text for the gifting option. */ public static function get_gifting_global_override_text() { } } /** * Class for blocks integration. */ class WCSG_Blocks_Integration implements \Automattic\WooCommerce\Blocks\Integrations\IntegrationInterface { public function get_name() { } 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() { } } /** * Class for cart integration. */ class WCSG_Cart { /** * Setup hooks & filters, when the class is initialised. */ public static function init() { } /** * Adds the wcsg_cart_key meta to the order line item * So it's possible to track which subscription came from which parent order line item. * * @param WC_Order_Item_Product $item The order line item. * @param string $cart_item_key The cart item key. * @param array $values The cart item values. * @param WC_Order $order The order. */ public static function add_recipient_to_order_line_item($item, $cart_item_key, $values, $order) { } /** * Registers the blocks cart update callback. */ public static function register_blocks_update_callback() { } /** * Handles the blocks cart update callback. * * @param array $data The data from the blocks update callback. */ public static function handle_blocks_update_cart_item_recipient($data) { } /** * Adds gifting ui elements to subscription cart items. * * @param string $title The product title displayed in the cart table. * @param array $cart_item Details of an item in WC_Cart. * @param string $cart_item_key The key of the cart item being displayed in the cart table. */ public static function add_gifting_option_cart($title, $cart_item, $cart_item_key) { } /** * Adds gifting ui elements to subscription items in the mini cart. * * @param int $quantity The quantity of the cart item. * @param array $cart_item Details of an item in WC_Cart. * @param string $cart_item_key Key of the cart item being displayed in the mini cart. */ public static function add_gifting_option_minicart($quantity, $cart_item, $cart_item_key) { } /** * Updates the cart items for changes made to recipient infomation on the cart page. * * @param bool $cart_updated whether the cart has been updated. */ public static function cart_update($cart_updated) { } /** * Prevent products being added to the cart if the cart contains a gifted subscription renewal. * * Line items that are themselves part of a subscription renewal are exempt: Subscriptions * loads each line item of the renewal order into the cart individually, and this guard must * not block the renewal's own subsequent items (WOOSUBS-1680). * * @param bool $passed Whether adding to cart is valid. * @param int $product_id The product being added to the cart. Optional. * @param int $quantity The quantity being added. Optional. * @param int $variation_id The variation being added. Optional. * @param array $variations The variation attributes. Optional. * @param array $cart_item_data Additional cart item data for the product being added. Optional. */ public static function prevent_products_in_gifted_renewal_orders($passed, $product_id = 0, $quantity = 1, $variation_id = 0, $variations = array(), $cart_item_data = array()) { } /** * Determines if a cart item is able to be gifted. * Only subscriptions that are not a renewal, switch, or bundle/composite child are giftable. * * @param array $cart_item Cart item. * @return bool Whether the cart item is giftable. */ public static function is_giftable_item($cart_item) { } /** * Propagates a recipient email from a bundle/composite container cart item to all its child items. * * When a recipient is set on a parent container, the same email must be applied to all children * so they stay in the same recurring cart group and inherit the gifting state. * * @param string $cart_item_key The cart item key of the container. * @param string $recipient The recipient email to propagate. */ public static function propagate_recipient_to_children($cart_item_key, $recipient) { } /** * Returns the relevant html (static/flat, interactive or none at all) depending on * whether the cart item is a giftable cart item or is a gifted renewal item. * * @param array $cart_item The cart item. * @param string $cart_item_key The cart item key. * @param string $print_or_return Wether to print or return the HTML content. Optional. Default behaviour is to return the string. Pass 'print' to print the HTML content directly. * @return string Returns the HTML string if $print_or_return is set to 'return', otherwise prints the HTML and nothing is returned. */ public static function maybe_display_gifting_information($cart_item, $cart_item_key, $print_or_return = 'return') { } /** * When setting up the cart for resubscribes or initial subscription payment carts, ensure the existing subscription recipient email is added to the cart item. * * @param array $cart_item_data Cart item data. * @param array $line_item Line item. * @param object $subscription Subscription object. * @return array Updated cart item data. */ public static function add_recipient_to_resubscribe_initial_payment_item($cart_item_data, $line_item, $subscription) { } /** * Checks the cart to see if it contains a gifted subscription renewal. * * @return bool * @since 7.8.0 - Originally implemented in WooCommerce Subscriptions Gifting 1.0. */ public static function contains_gifted_renewal() { } /** * Checks the cart to see if a gift recipient email is set. * * @return bool * @since 7.8.0 - Originally implemented in WooCommerce Subscriptions Gifting 1.0. */ public static function contains_gift_recipient_email() { } /** * Retrieve a recipient user's ID from a cart item. * * @param array $cart_item Cart item. * @return string the recipient id. If the cart item doesn't belong to a recipient an empty string is returned * @since 7.8.0 - Originally implemented in WooCommerce Subscriptions Gifting 1.0.1. */ public static function get_recipient_from_cart_item($cart_item) { } /** * Remove recipient line item meta from order again cart item meta. This meta is re-added to the line item after * checkout and so doesn't need to copied through the cart in this way. * * @param array $cart_item_data Cart item data. * @return array Updated cart item data. * @since 7.8.0 - Originally implemented in WooCommerce Subscriptions Gifting 1.0.1. */ public static function remove_recipient_from_order_again_cart_item_meta($cart_item_data) { } /** * Maybe print gifting HTML elements. * * @param array $cart_item The cart item array data. * @param string $cart_item_key The cart item key. * @since 7.8.0 - Originally implemented in WooCommerce Subscriptions Gifting 2.0.1. */ public static function print_gifting_option_cart($cart_item, $cart_item_key) { } /** Deprecated **/ /** * Returns gifting ui html elements displaying the email of the recipient. * * @param string $cart_item_key The key of the cart item being displayed in the mini cart. * @param string $email The email of the gift recipient. * @deprecated 2.0.1 */ public static function generate_static_gifting_html($cart_item_key, $email) { } } /** * Class for checkout integration. */ class WCSG_Checkout { /** * Setup hooks & filters, when the class is initialised. */ public static function init() { } /** * Adds gifting ui elements to the checkout page. Also updates recipient information * stored on the cart item from session data if it exists. * * @param int $quantity Quantity. * @param object $cart_item The Cart_Item for which we are adding ui elements. * @param string $cart_item_key Cart item key. * @return int The quantity of the cart item with ui elements appended on. */ public static function add_gifting_option_checkout($quantity, $cart_item, $cart_item_key) { } /** * Attaches the recipient email address to a subscription when it is purchased via checkout. * * @param WC_Subscription $subscription The subscription that has just been created. * @param WC_Order $order Order object. * @param WC_Cart $recurring_cart An array of subscription products that make up the subscription. */ public static function subscription_created($subscription, $order, $recurring_cart) { } /** * Attaches the recipient email to a recurring cart key to differentiate subscription products * gifted to different recipients. * * @param string $cart_key Cart key. * @param object $cart_item Cart item. * @return string The cart_key with a recipient's email appended */ public static function add_recipient_email_recurring_cart_key($cart_key, $cart_item) { } /** * Updates the cart items for changes made to recipient infomation on the checkout page. * This needs to occur right before WooCommerce processes the cart. * If an error occurs schedule a checkout reload so the user can see the emails causing the errors. */ public static function update_cart_before_checkout() { } /** * If the cart contains a gifted subscription renewal or a gift recipient, tell the checkout to ship to a different address. * * @param bool $ship_to_different_address Whether the order will ship to a different address. * @return bool */ public static function maybe_ship_to_recipient($ship_to_different_address) { } /** * Returns recipient's shipping address if the checkout is requesting * the shipping fields for a gifted subscription renewal. * * @param string $value Default checkout field value. * @param string $key The checkout form field name/key. */ public static function maybe_get_recipient_shipping($value, $key) { } /** * Stores recipient email data in the session to prevent losing changes made to recipient emails * during the checkout updating the order review fields. * * @param string $checkout_data Checkout _POST data in a query string format. */ public static function store_recipients_in_session($checkout_data) { } /** * Output a notice to guide the shopper on how to fill the shipping address. The visibility of this notice is controlled by CSS depending on * the status of the gifting checkbox. * * @since 7.8.0 - Originally implemented in WooCommerce Subscriptions Gifting 1.0. */ public static function maybe_display_recipient_shipping_notice() { } /** * Adds meta data so it can be displayed in the Cart. */ public static function woocommerce_get_item_data($other_data, $cart_item) { } } /** * Properly handles permissions and access for downloadable files associated to gifted subscriptions. */ class WCSG_Download_Handler { /** * Cache of subscription download permissions. * * @var array */ private static $subscription_download_permissions = array(); /** * Temporary cache of recipient download permissions stored before a subscription is saved. * * @var array */ private static $recipient_download_permissions = array(); /** * Setup hooks & filters, when the class is initialised. */ public static function init() { } /** * Gets the correct user's download links for a downloadable order item. * If the request is from within an email, the links belonging to the email recipient are returned otherwise * if the request is from the view subscription page use the current user id, * otherwise the links for order's customer user are returned. * * @param array $files Downloadable files for the order item. * @param array $item Order line item. * @param object $order Order object. * @return array $files Files. */ public static function get_item_download_links($files, $item, $order) { } /** * Grants download permissions to the recipient rather than the purchaser by default. However if the * purchaser can download setting is selected, permissions are granted to both recipient and purchaser. * * @param array $data download permission data inserted into the wp_woocommerce_downloadable_product_permissions table. * @return array $data */ public static function grant_recipient_download_permissions($data) { } /** * Insert Gifting download specific settings into Subscriptions settings * * @param array $settings Subscription's current set of settings. * @return array $settings new settings with appended wcsg specific settings. */ public static function register_download_settings($settings) { } /** * Before displaying the meta box, save an unmodified set of the download permissions so they can be used later * when displaying user information and outputting download permission hidden fields (which needs to be done just * once per permission). * * @param WC_Subscription $subscription Subscription object. */ public static function get_download_permissions_before_meta_box($subscription) { } /** * Formats the download permission title to also include information about the user the permission belongs to. * This is to make it clear to store managers which user's permissions are being edited. * * We also sneak in hidden fields for the user and permission ID to make sure that we can revoke or modify * permissions for a specific user, because WC doesn't use permission IDs and instead uses download IDs, which * are a hash that do not take into account user ID and duplicate permissions for the same product on the same * order for different users. * * @param string $download_title The download permission title displayed in order download permission meta boxes. * @param int $product_id Product ID. * @param int $order_id Order ID. */ public static function add_user_to_download_permission_title($download_title, $product_id, $order_id) { } /** * Save download permission meta box data. * * We need to unhook WC_Meta_Box_Order_Downloads::save() to prevent the WC save function from being called because * it does not differentiate between duplicate permissions for the same product on the same order even when the * permissions are for different users (and with different permission IDs). This means it would modify all * permissions on that order for that product and set them all to be for the same user, instead of keeping * them for the different users. * * @param int $subscription_id Subscription ID. */ public static function download_permissions_meta_box_save($subscription_id) { } /** * Get all download permissions for a subscription * * @param int $subscription_id Subscription ID. * @param string $order_by Column to use inside the ORDER BY clause. */ private static function get_subscription_download_permissions($subscription_id, $order_by = 'product_id') { } /** * Grants download permissions from the edit subscription meta box grant access button. * Outputs meta box table rows for each permission granted. */ public static function ajax_grant_download_permission() { } /** * WooCommerce revokes download permissions based only on the product an order ID, that means when * revoking downloads on a gift subscription with permissions for both the purchaser and recipient, * it will revoke both sets of permissions instead of only the permission against which the store * manager clicked the "Revoke Access" button. * * To workaround this, we add the permission ID as a hidden fields against each download permission * with @see self::add_user_to_download_permission_title(). We then trigger a custom Ajax request * that passes the permission ID to the server to make sure we only revoke only that permission. * * We also need to remove WC's handler, which is the WC_Ajax:;revoke_access_to_download() method attached * to the 'woocommerce_revoke_access_to_download' Ajax action. To do this, we have out wcsg-admin.js file * enqueued after WooCommerce's 'wc-admin-order-meta-boxes' script and then in our JavaScript call * $( '.order_download_permissions' ).off() to remove WooCommerce's Ajax method. * * @since 7.8.0 - Originally implemented in WooCommerce Subscriptions Gifting 1.0. */ public static function ajax_revoke_download_permission() { } /** * Retrieves a user's download permissions for an order. * * @param WC_Order $order Order object. * @param int $user_id User ID. * @param array $item Order item. * * @return array */ public static function get_user_downloads_for_order_item($order, $user_id, $item) { } /** * Retrieves all the user's download permissions for an order by checking * for downloads stored on the subscriptions in the order. * * @param WC_Order $order Order object. * @param int $user_id User ID. * * @return array */ public static function get_user_downloads_for_order($order, $user_id) { } /** * Makes sure download permissions on newly created subscriptions (admin-side) are granted after the recipient has * been set. * * @param WC_Subscription $subscription Subscription object. * @since 7.8.0 - Originally implemented in WooCommerce Subscriptions Gifting 2.0.2. */ public static function grant_permissions_on_admin_created_subscription($subscription) { } /** * Stores recipient download permissions before a subscription is saved, just in case they are needed later. * * @param WC_Subscription $subscription Subscription object. * * @since 7.8.0 - Originally implemented in WooCommerce Subscriptions Gifting 2.0.2. */ public static function maybe_store_recipient_permissions_before_save($subscription) { } /** * Restores recipient download permissions from cached values. * * @param WC_Subscription $subscription Subscription object. * * @since 7.8.0 - Originally implemented in WooCommerce Subscriptions Gifting 2.0.2. */ private static function restore_recipient_permissions($subscription) { } /** * Restores previous recipient permissions when the subscription's customer changes. * This is required because WC resets all download permissions to the new customer (effectively disabling recipient access) when such a change is made. * * @param WC_Order $order Order object. * @param array $updated_props Properties that changed. * * @since 7.8.0 - Originally implemented in WooCommerce Subscriptions Gifting 2.0.2. */ public static function maybe_restore_recipient_permissions_after_save($order, $updated_props) { } /** * Grants new recipients the downloads permissions the previous recipient had. * * @param WC_Subscription $subscription Subscription object. * @param int $new_recipient_id New recipient user ID. * @param int $old_recipient_id Old recipient user ID. * * @since 7.8.0 - Originally implemented in WooCommerce Subscriptions Gifting 2.0.2. */ public static function maybe_grant_permissions_to_new_recipient($subscription, $new_recipient_id, $old_recipient_id) { } } /** * Handles e-mailing inside Gifting. */ class WCSG_Email { /** * Header/subject and triggers associated to e-mails with downloadable headings/subjects. * * @var array */ public static $downloadable_email_data = array('customer_completed_order' => array('trigger_action' => 'woocommerce_order_status_completed_notification', 'heading_filter' => 'woocommerce_email_heading_customer_completed_order', 'subject_hook' => 'woocommerce_email_subject_customer_completed_order'), 'customer_completed_renewal_order' => array( 'trigger_action' => 'woocommerce_order_status_completed_renewal_notification', 'heading_filter' => '', // shares woocommerce_email_heading_customer_completed_order. 'subject_hook' => 'woocommerce_subscriptions_email_subject_customer_completed_renewal_order', ), 'customer_completed_switch_order' => array('trigger_action' => 'woocommerce_order_status_completed_switch_notification', 'heading_filter' => 'woocommerce_email_heading_customer_switch_order', 'subject_hook' => 'woocommerce_subscriptions_email_subject_customer_completed_switch_order'), 'recipient_completed_renewal_order' => array( 'trigger_action' => 'woocommerce_order_status_completed_renewal_notification_recipient', 'heading_filter' => '', // shares woocommerce_email_heading_customer_completed_order. 'subject_hook' => '', )); /** * Flag used to indicate that an e-mail with downloadable headings/subjects is being sent. * * @var mixed */ public static $sending_downloadable_email; /** * Setup hooks & filters, when the class is initialised. */ public static function init() { } /** * Add WCS Gifting email classes. * * @param WC_Email[] $email_classes E-mail classes. */ public static function add_new_recipient_customer_email($email_classes) { } /** * Hooks up all of WCS Gifting emails after the WooCommerce object is constructed. */ public static function hook_email() { } /** * If an order contains subscriptions with recipient data send an email to the recipient * notifying them on their new subscription(s) * * @param WC_Order|int $order Order ID or instance. */ public static function maybe_send_recipient_order_emails($order) { } /** * Generates purchaser new recipient user email. * * @param int $purchaser_user_id Subscription purchaser user id. * @param int $recipient_user_id Subscription recipient user id. * * @since 7.8.0 - Originally implemented in WooCommerce Subscriptions Gifting 2.1.0. */ public static function generate_new_recipient_user_email($purchaser_user_id, $recipient_user_id) { } /** * This will get the necessary data to resend the new recipient new email. * * @param WC_Order $subscription The subscription we're using to get the purchaser and recipient data. * * @since 7.8.0 - Originally implemented in WooCommerce Subscriptions Gifting 2.1.0. */ public static function resend_new_recipient_user_email($subscription) { } /** * If the order contains a subscription that is being gifted, init the mailer and call the notification for recipient renewal notices. * * @param int $order_id The ID of the renewal order with a new status of processing/completed. */ public static function maybe_send_recipient_renewal_notification($order_id) { } /** * Formats an email's heading and subject so that the correct one is displayed. * If for instance the email recipient doesn't have downloads for this order fallback * to the normal heading and subject, * * @param string $heading The email heading or subject. * @param object $order Order object. * @return string */ public static function maybe_change_download_email_heading($heading, $order) { } /** * Set a flag to indicate that an email with downloadable headings and subjects is being sent. * hooked just before the email's trigger function. */ public static function set_sending_downloadable_email_flag() { } /** * Removes the downloadable email being sent flag. Hooked just after the email's trigger function. */ public static function remove_sending_downloadable_email_flag() { } /** * Overrides the email order items template in recipient emails * * @param WC_Order $order Order object. * @param array $args Email arguments. * @since 7.8.0 - Originally implemented in WooCommerce Subscriptions Gifting 2.0.0. */ public static function recipient_email_order_items_table($order, $args) { } /** * Show the order details table * * @param WC_Order $order Order object. * @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 E-mail instance. * @since 7.8.0 - Originally implemented in WooCommerce Subscriptions Gifting 2.0.0. */ public static function order_details($order, $sent_to_admin = \false, $plain_text = \false, $email = \null) { } /** * Get the related subscription details table for emails sent to recipients. * * @param WC_Order $order The order object the email be sent relates to. * @param bool $sent_to_admin Whether the email is sent to admin users. * @param bool $plain_text Whether the email template is plain text or HTML. * @since 7.8.0 - Originally implemented in WooCommerce Subscriptions Gifting 2.0.0. */ public static function get_related_subscriptions_table($order, $sent_to_admin, $plain_text) { } /** * Get the order's address details table for emails sent to recipients. * * @param WC_Order $order The order object the email be sent relates to. * @param bool $sent_to_admin Whether the email is sent to admin users. * @param bool $plain_text Whether the email template is plain text. * @since 7.8.0 - Originally implemented in WooCommerce Subscriptions Gifting 2.0.0. */ public static function get_address_table($order, $sent_to_admin, $plain_text) { } /** * Hooks into the WooCommerce created customer action to prevent sending the core WooCommerce new customer email and send the Gifting new recipient user email instead. */ public static function use_gifting_new_account_email() { } /** * Prevent sending the core WooCommerce new customer email. */ public static function remove_wc_new_customer_email() { } /** * Sends the Gifting new recipient user email. Overriding the core WooCommerce new customer email. * * @param int $customer_id The ID of the new customer being created. */ public static function send_new_recipient_user_email($customer_id) { } /** * Reattaches the core WooCommerce new customer email after sending the gifting new account email. */ public static function reattach_wc_new_customer_email() { } } /** * Implements integration with WooCommerce Memberships. */ class WCSG_Memberships_Integration { /** * Flag set when processing an order. * * @var mixed */ public static $processing_memberships_for_order; /** * Set up hooks and filters. */ public static function init() { } /** * Grants memberships to recipients and returns false so the purchaser is not granted the membership * unless it is found that the purchaser also purchased the product for themselves. * * @param bool $grant_access Whether the membership will be granted with the following membership data. * @param array $membership_data Array of data including: $user_id, $product_id, $order_id. */ public static function grant_membership_access($grant_access, $membership_data) { } /** * Sets a order id flag when processing an order so it can be later used inside * self::get_user_unique_membership_access_granting_product_ids(). * * @param int $order_id Order ID. */ public static function set_processing_memberships_for_order_flag($order_id) { } /** * Removes the order id flag after memberships has processed the order. * * @param int $order_id Order ID. */ public static function remove_processing_memberships_for_order_flag($order_id) { } /** * By default memberships will determine what the best product in this order is to grant the membership * (subscriptions with the longest end date take priority). However, because multiple subscriptions with * multiple recipients (purchaser or gift recipient) is possible we need to get the best product per user. * * @param array $product_ids The product id(s) which will grant membership in this order. * @param array $all_access_granting_product_ids Array of product IDs that can grant access to this plan. * @param WC_Memberships_Membership_Plan $plan Membership plan access will be granted to. */ public static function get_user_unique_membership_access_granting_product_ids($product_ids, $all_access_granting_product_ids, $plan) { } /** * Because an order can contain multiple subscriptions with the same product in the one order we need * to update the subscription linked to the membership. * Gets the subscription the membership user has access to via recipient link. * * @param WC_Memberships_Membership_Plan $membership_plan The plan that user was granted access to. * @param array $args Other arguments. */ public static function update_subscription_id($membership_plan, $args) { } } /** * Class for integrating with product pages. */ class WCSG_Product { /** * Setup hooks & filters, when the class is initialised. */ public static function init() { } /** * Attaches recipient information to cart item data when a subscription is added to cart via product page. * If the recipient email is invalid (incorrect email format or belongs to the current user) an exception is thrown * and caught by WooCommerce add to cart function - preventing the product being entered into the cart. * * @param array $cart_item_data Cart item data. * @return array New cart item data. * @throws Exception In case of error. */ public static function add_recipient_data($cart_item_data) { } /** * Adds the recipient information to the session cart item data. * * @param object $item The Session Data stored for an item in the cart. * @param array $values The data stored on a cart item. * @return object The session data with added cart item recipient information. */ public static function get_cart_items_from_session($item, $values) { } /** * Adds gifting ui elements to the subscription product page. */ public static function add_gifting_option_product() { } /** * Checks if a given product is a giftable product * * @param int|WC_Product $product A WC_Product object or the ID of a product to check. * @return bool */ public static function is_giftable($product) { } /** * Adds gifting data to the variation data. * The variation data is used on the front-end as a value for the "found_variation" DOM event. * * @param array $variation_data The variation data. * @param WC_Product $product The product object. * @param WC_Product_Variation $variation The variation object. * @return array The variation data with added gifting data. */ public static function add_gifting_to_variation_data($variation_data, $product, $variation) { } /** * Checks if a product has subscription plans and is not set to one-time only. * * @param WC_Product $product Product object to check. * @return bool */ public static function product_has_subscription_plans($product) { } } /** * WCSG_Query. */ class WCSG_Query extends \WCS_Query { /** * Setup hooks & filters, when the class is constructed. */ public function __construct() { } /** * Init query vars by loading options. */ public function init_query_vars() { } /** * Enqueue frontend scripts */ public function enqueue_scripts() { } /** * Changes the recipient account details endpoint title. * * Hooked onto the dynamic hook 'woocommerce_endpoint_new-recipient-account_title'. * * @since 7.8.0 - Originally implemented in WooCommerce Subscriptions Gifting 2.1.2. * * @param string $title Endpoint title. * @param string $endpoint Endpoint. * * @return string The gift recipient account details page title. */ public function change_my_account_endpoint_title($title, $endpoint) { } /* Function Overrides */ /** * This function is attached to the 'woocommerce_account_menu_items' filter by the @see parent::__construct(). * In this context there is no menu items to add so this function is simply overriding the parent instance to avoid it from being called twice. * * @param array $menu_items The My Account menu items. * @deprecated 2.0.0 Because parent::__construct() is no longer called, this function is no longer attached to any filters, no longer called and so no longer needs to be overridden. */ public function add_menu_items($menu_items) { } /** * This function is attached to the 'woocommerce_account_subscriptions_endpoint' action hook by the @see parent::__construct(). * In this context there is no subscriptions endpoint content so this function is simply overriding the parent instance to avoid it from being called twice. * * @param int $current_page Current page. * @deprecated 2.0.0 Because parent::__construct() is no longer called, this function is no longer attached to any hooks, no longer called and so no longer needs to be overridden. */ public function endpoint_content($current_page = 1) { } } /** * Allow for updating subscription addresses taking into consideration purchaser/recipient subscriptions. */ class WCSG_Recipient_Addresses { /** * Setup hooks & filters, when the class is initialised. */ public static function init() { } /** * Returns the subset of user subscriptions which should be included when updating all subscription addresses. * When setting shipping addresses only include those which the user has purchased for themselves or have been gifted to them. * When setting billing addresses only include subscriptions that belong to the user and those they have gifted to another user. * * @param array $subscriptions Array of subscriptions. * @param int $user_id User ID. * @return array */ public static function get_users_subscriptions($subscriptions, $user_id) { } /** * Appends a notice to the 'update all subscriptions addresses' checkbox notifing the customer that updating all * subscription addresses will not update gifted subscriptions, depending on which address is being updated. * * @param string $field The generated html element field string. * @param string $field_id The id attribute of the html element being generated. */ public static function display_update_all_addresses_notice($field, $field_id) { } } /** * Handles the new recipient account endpoint. */ class WCSG_Recipient_Details { /** * Setup hooks & filters, when the class is initialised. */ public static function init() { } /** * Determines if the current page is the recipient details page. * * @return boolean Whether the current page is the recipient details page or not. * @since 7.8.0 - Originally implemented in WooCommerce Subscriptions Gifting 2.0.0. */ private static function is_recipient_details_page() { } /** * Override the core My Account base template and display a full-width template if we're displaying the Recipient Details page. * * @param string $located Path to template. * @param string $template_name The template's name. * @param array $args An array of arguments used in the template. * @param string $template_path Path for including template. * @return string Path to template. * @since 7.8.0 - Originally implemented in WooCommerce Subscriptions Gifting 2.0.0. */ public static function get_new_recipient_account_container($located, $template_name, $args, $template_path) { } /** * Get the new-recipient-account template * * @since 7.8.0 - Originally implemented in WooCommerce Subscriptions Gifting 2.0.0. */ public static function get_new_customer_template() { } /** * Locates the new recipient details page template if the user is flagged for requiring further details. * * @param string $located Path to template. * @param string $template_name The template's name. * @param array $args An array of arguments used in the template. * @param string $template_path Path for including template. * @param string $default_path Default path. * @return string Path to template. */ public static function add_new_customer_template($located, $template_name, $args, $template_path, $default_path) { } /** * Redirects the user to the relevant page if they are trying to access my account or recipient account details page. */ public static function my_account_template_redirect() { } /** * Validates the new recipient account details page updating user data and removing the 'required account update' user flag * if there are no errors in validation. */ public static function update_recipient_details() { } /** * Creates an array of form fields for the new recipient user details form * * @param string $country For which country we need to fetch fields. * @param int $user_id For which user we need to fetch the fields. Default get_current_user_id(). * * @return array Form elements for recipient details page */ public static function get_new_recipient_account_form_fields($country, $user_id = \null) { } /** * Determines whether shipping address information is required for the given recipient. * * @param int $user_id User ID. * @return bool TRUE if shipping address information is required for the given user. * * @since 7.8.0 - Originally implemented in WooCommerce Subscriptions Gifting 2.1.1. */ private static function need_shipping_address_details_for_recipient($user_id = \null) { } } /** * Recipient management class. */ class WCSG_Recipient_Management { /** * Setup hooks & filters, when the class is initialised. */ public static function init() { } /** * Grant capabilities for subscriptions and related orders to recipients * * @param array $allcaps An array of user capabilities. * @param array $caps The capability being questioned. * @param array $args Additional arguments related to the capability. * @return array */ public static function grant_recipient_capabilities($allcaps, $caps, $args) { } /** * Adds available user actions to the subscription recipient * * @param array $actions An array of actions the user can peform. * @param object $subscription Subscription object. * @return array An updated array of actions the user can perform on a gifted subscription. */ public static function add_recipient_actions($actions, $subscription) { } /** * Disables the early renewal modal for recipients. This is to prevent recipients from renewing using the purchaser's * payment information. * This is only required when running on WCS < 3.0.5, where being able to renew early implies access to the early renewal modal. * * @since 7.8.0 - Originally implemented in WooCommerce Subscriptions Gifting 2.1.1. */ public static function maybe_disable_early_renewal_modal_for_recipient() { } /** * Generates a link for the user to change the status of a subscription * * @param int $subscription_id Subscription ID. * @param string $status The status the recipient has requested to change the subscription to. * @param int $recipient_id Recipient ID. * @param string $current_status Current status. */ private static function get_recipient_change_status_link($subscription_id, $status, $recipient_id, $current_status) { } /** * Checks if a status change request is by the recipient, and if it is, * validate the request and proceed to change to the subscription. */ public static function change_user_recipient_subscription() { } /** * Allows the recipient to suspend a subscription, provided the suspension count hasnt been reached * * @param bool $user_can_suspend Whether the user can suspend a subscription. * @param WC_Subscription $subscription Subscription object. */ public static function recipient_can_suspend($user_can_suspend, $subscription) { } /** * Adds all the subscriptions that have been gifted to a user to their subscriptions * * @param array $subscriptions An array of subscriptions assigned to the user. * @param int $user_id Recipient's user ID. * @return array An updated array of subscriptions with any subscriptions gifted to the user added. */ public static function get_users_subscriptions($subscriptions, $user_id) { } /** * Adds recipient/purchaser information to the view subscription page. * * @param WC_Subscription $subscription Subscription object. */ public static function gifting_information_after_customer_details($subscription) { } /** * Gets an array of subscription ids which have been gifted to a user * * @param int $user_id The user id of the recipient. * @param int $order_id The Order ID which contains the subscription. * @param array $args Array of arguments. * * @return int[] An array of subscription IDs gifted to the user */ public static function get_recipient_subscriptions($user_id, $order_id = 0, $args = array()) { } /** * Filter the WC_Subscription::get_related_orders() method removing parent orders for recipients. * * @param array $related_orders An array of order ids related to the $subscription. * @param WC_Subscription $subscription Subscription object. * @return array an array of order ids related to the $subscription. */ public static function maybe_remove_parent_order($related_orders, $subscription) { } /** * Maybe add recipient information to order item meta for displaying in order item tables. * * @param int $item_id The item ID. * @param array $cart_item The cart's item. */ public static function maybe_add_recipient_order_item_meta($item_id, $cart_item) { } /** * Format the order item meta label to be displayed. * * @param string $label The item meta label displayed. * @param string $name The name of the order item meta (key). */ public static function format_recipient_meta_label($label, $name) { } /** * Format recipient order item meta value by extracting the recipient user id. * * @param mixed $value Order item meta value. */ public static function format_recipient_meta_value($value) { } /** * Prevents default display of recipient meta in admin panel. * * @param array $ignored_meta_keys An array of order item meta keys which are skipped when displaying meta. */ public static function hide_recipient_order_item_meta($ignored_meta_keys) { } /** * Displays recipient order item meta for admin panel. * * @param int $item_id The id of the order item. */ public static function display_recipient_meta_admin($item_id) { } /** * Removes recipient subscription meta from gifted subscriptions if the recipient is deleted. * * @param int $user_id The id of the user being deleted. */ public static function maybe_remove_recipient($user_id) { } /** * Displays a warning message if a recipient is in the process of being deleted. */ public static function maybe_display_delete_recipient_warning() { } /** * On password reset, if the user needs to update account, sets a (temporary) flag * * @param WP_User $user User object. * * @since 7.8.0 - Originally implemented in WooCommerce Subscriptions Gifting 2.1.0. */ public static function maybe_add_recipient_reset_password_flag($user) { } /** * Does the user require a new password after password reset? * * @param Int $user_id User ID we want to validate. * * @return bool * @since 7.8.0 - Originally implemented in WooCommerce Subscriptions Gifting 2.1.0. */ public static function user_requires_new_password($user_id) { } /** * On subscription status changes, maybe update the role of the subscription recipient (if set) depending on the new subscription status. * Sets the recipient user to the inactive subscriber role on on-hold, cancelled, expired statuses and an active subscriber role on active statuses. * * @param WC_Subscription $subscription Subscription object. * @param string $new_status The subscription's new status. */ public static function maybe_update_recipient_role($subscription, $new_status) { } /** * When orders are processed/completed, create new recipients and attach shipping information to gifted subscriptions. * * @param int $order_id Order ID. * @param WC_Order $order Order object. */ public static function maybe_create_recipient($order_id, ?\WC_Order $order = \null) { } /** * Maybe create a recipient user and attach shipping information to a subscription. * * @param WC_Subscription $subscription The subscription object. * @param WC_Order $order Order object. */ public static function maybe_create_recipient_and_attach_shipping_information($subscription, ?\WC_Order $order = \null) { } } /** * Locates Gifting templates for use through `wc_get_template()`. */ class WCSG_Template_Loader { /** * Setup hooks & filters, when the class is initialised. */ public static function init() { } /** * Overrides the default recent order template for gifted subscriptions * * @param string $located Path to template. * @param string $template_name Template name. * @param array $args Arguments. * @return string Path for including template. * @since 7.8.0 - Originally implemented in WooCommerce Subscriptions Gifting 2.0.0. */ public static function get_recent_orders_template($located, $template_name, $args) { } /** * Overrides subscription totals template. * * @param string $located Path to template. * @param string $template_name Template name. * @param array $args Arguments. * @return string Path for including template. * @since 7.8.0 - Originally implemented in WooCommerce Subscriptions Gifting 2.0.0. */ public static function get_subscription_totals_template($located, $template_name, $args) { } /** * Overrides the order details customer template on view subscription page for recipient. * * @param string $located Path to template. * @param string $template_name Template name. * @param array $args Arguments. * @return string Path for including template. * @since 7.8.0 - Originally implemented in WooCommerce Subscriptions Gifting 2.0.0. */ public static function get_customer_details_template($located, $template_name, $args) { } } /** * Handles e-mailing of the "Completed Renewal Order" e-mail to recipients. */ class WCSG_Email_Completed_Renewal_Order extends \WCS_Email_Completed_Renewal_Order { /** * Recipient's user ID. * * @var int */ public $wcsg_sending_recipient_email; /** * Create an instance of the class. */ public 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. * * @param int $order_id Order ID. * @param object $order Order object. */ public function trigger($order_id, $order = \null) { } } /** * Handles e-mailing to purchaser of new account notification. */ class WCSG_Email_Customer_New_Account extends \WC_Email { /** * Subscription purchaser's name. * * @var string */ public $subscription_owner; /** * Recipient's user name. * * @var string */ public $user_login; /** * Recipient's e-mail address. * * @var string */ public $user_email; /** * Recipient's user ID. * * @var int */ public $user_id; /** * Recipient's account reset key. * * @var string */ public $reset_key; /** * Create an instance of the class. */ public 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. * * @param int $user_id User ID. * @param string $reset_key Reset key. * @param string $subscription_purchaser Purchaser's name. */ public function trigger($user_id, $reset_key, $subscription_purchaser) { } /** * Returns content for the HTML version of the e-mail. */ public function get_content_html() { } /** * Returns content for the plain text version of the e-mail. */ public function get_content_plain() { } /** * Set WooCommerce email preview data. */ public function set_preview_data() { } } /** * Handles e-mailing of the "Processing Renewal Order" e-mail to recipients. */ class WCSG_Email_Processing_Renewal_Order extends \WCS_Email_Processing_Renewal_Order { /** * Recipient user ID. * * @var int */ public $wcsg_sending_recipient_email; /** * Create an instance of the class. */ public 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. * * @param int $order_id Order ID. * @param WC_Order|null $order Order object. */ public function trigger($order_id, $order = \null) { } } /** * Handles e-mailing of the "New Initial Order" e-mail to recipients. */ class WCSG_Email_Recipient_New_Initial_Order extends \WC_Email { /** * Subscription owner name. * * @var string */ public $subscription_owner; /** * Array of subscription post objects. * * @var WP_Post[] */ public $subscriptions; /** * Recipient user ID. * * @var int */ public $wcsg_sending_recipient_email; /** * Recipient user. * * @var WP_User */ public $recipient_user; /** * Create an instance of the class. */ public 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. * * @param int $recipient_user User ID. * @param WP_Post[] $recipient_subscriptions Array of subscription post objects. */ public function trigger($recipient_user, $recipient_subscriptions) { } /** * Returns the content for the HTML version of the e-mail. */ public function get_content_html() { } /** * Returns the content for the plain text version of the e-mail. */ public function get_content_plain() { } /** * Set WooCommerce email preview data. */ public function set_preview_data() { } } /** * Handles erasing of Gifting information from WooCommerce. */ class WCSG_Privacy_Erasers { /** * Find and erase personal data from subscriptions linked to a user via recipient meta. * * Subscriptions are erased in blocks of 10 to avoid timeouts. * * @since 7.8.0 - Originally implemented in WooCommerce Subscriptions Gifting 2.0.1. * @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) { } /** * Find and erase personal data from subscription orders linked to a user via recipient meta. * * Orders are erased in blocks of 10 to avoid timeouts. * * @since 7.8.0 - Originally implemented in WooCommerce Subscriptions Gifting 2.0.1. * @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 order_data_eraser($email_address, $page) { } /** * Remove personal recipient line item meta from an order or subscription. * * @since 7.8.0 - Originally implemented in WooCommerce Subscriptions Gifting 2.0.1. * @param WC_Order|WC_Subscription $order The order or subscription object to remove recipient line item meta from. * @param int $recipient_id Optional. Default behaviour is to remove all recipient line item meta. Pass a user ID to only remove line item meta specific to that user. */ public static function remove_personal_recipient_line_item_data($order, $recipient_id = 0) { } /** * Remove a recipient from a subscription. * * @since 7.8.0 - Originally implemented in WooCommerce Subscriptions Gifting 2.0.1. * @param WC_Subscription $subscription The subscription object. */ public static function remove_recipient_meta($subscription) { } } /** * Gifting information exporter. */ class WCSG_Privacy_Exporters extends \WCS_Privacy_Exporters { /** * Finds and exports subscription data linked to a user via recipient meta. * * Subscriptions are exported in blocks of 10 to avoid timeouts. * * @since 7.8.0 - Originally implemented in WooCommerce Subscriptions Gifting 2.0.1. * @param string $email_address The user email address. * @param int $page Page. * @return array An array of personal data in name value pairs. */ public static function subscription_data_exporter($email_address, $page) { } /** * Remove the personal data properties which belong to the purchaser. * * @since 7.8.0 - Originally implemented in WooCommerce Subscriptions Gifting 2.0.1. * @param array $exported_data_properties The subscription properties to export. * @return array The recipient personal data properties to export. */ public static function remove_purchaser_properties($exported_data_properties) { } /** * Finds and exports order data linked to a user via recipient line item meta. * * Orders are exported in blocks of 10 to avoid timeouts. * * @since 7.8.0 - Originally implemented in WooCommerce Subscriptions Gifting 2.0.1. * @param string $email_address The user email address. * @param int $page Page. * @return array An array of personal data in name value pairs. */ public static function order_data_exporter($email_address, $page) { } /** * Get the recipient's personal data (key/value pairs) for an order object. * * @since 7.8.0 - Originally implemented in WooCommerce Subscriptions Gifting 2.0.1. * @param WC_Order $order The order object. * @param array $items The order line item objects which belong to the recipient in the order. * @param bool $export_shipping Whether to export shipping address data. * @return array The recipient's personal data. */ protected static function get_recipient_order_personal_data($order, $items, $export_shipping) { } } /** * Hooks into WooCommerce's privacy-related functionality. */ class WCSG_Privacy extends \WC_Abstract_Privacy { /** * WCSG_Privacy constructor. */ public function __construct() { } /** * Attach callbacks. */ protected function init() { } } class WCS_Health_Check_Table_Maker extends \WCS_Table_Maker { /** * @inheritDoc * * v2: reworked the candidates table indexes to better match the access * patterns of CandidateStore — see `maybe_upgrade_candidates_indexes()` * below for the migration detail. * * v3: added `created_at DATETIME NOT NULL DEFAULT CURRENT_TIMESTAMP` to * the candidates table so the Status tab's "Detected on" column has a * per-row timestamp to render. * * v4: dropped `wcs_health_check_ignored` — the Ignore action was cut * during the v1 scope pivot so the table never had a write path. The * Detector's always-empty ignore-list filter was pure per-scan waste. * Upgrade path drops the table; fresh installs never create it. See * `maybe_drop_ignored_table()`. * * v5: added `signal_type VARCHAR(32) NOT NULL DEFAULT 'supports_auto_renewal'` * to the candidates table and widened the existing `run_subscription` * UNIQUE KEY to include it. The Missing renewals tab introduced a second * signal that can legitimately co-exist with Supports-auto-renewal on the * same subscription in the same run — without the widened key the second * write would replace the first. dbDelta never drops indexes, so the key * swap runs explicitly in `maybe_upgrade_candidates_signal_type()` before * the parent hand-off. */ protected $schema_version = 5; /** * WCS_Health_Check_Table_Maker constructor. */ public function __construct() { } /** * Register the tables, first applying any explicit migrations that * dbDelta can't handle on its own. * * dbDelta is effective at adding new columns and indexes, but it will * never drop an index OR a table that used to exist. Two explicit * migrations run before the parent hand-off: * * - v1 → v2 candidates indexes: drop the legacy single-column `run_id` * / `status` indexes and replace with the composite `run_id_status` * + the `(run_id, subscription_id)` unique key. * - v3 → v4 ignored table: drop the retired `wcs_health_check_ignored` * table entirely. * - v4 → v5 signal_type column + widened unique key: add the column * then drop the narrow `run_subscription` unique key so dbDelta can * recreate it with the new `(run_id, subscription_id, signal_type)` * shape. */ public function register_tables() { } /** * Whether the stored schema version is behind this class's * declared `$schema_version`. Parallels the parent's private * `schema_update_required()` so the child can short-circuit * steady-state verification without changing the parent API. * * @return bool */ private function schema_is_out_of_date(): bool { } /** * Verifies that every table expected to be created exists. * * Logs via WC's logger for any missing tables. Does not attempt repair. * * @return bool True if all tables exist. */ private function verify_tables_created(): bool { } /** * Drop legacy single-column indexes on the candidates table when * upgrading from schema v1. No-op if the table hasn't been created yet * (first-time install) or has already been upgraded. */ private function maybe_upgrade_candidates_indexes() { } /** * Add the `signal_type` column and drop the narrow `run_subscription` * UNIQUE KEY when upgrading from any pre-v5 schema, so dbDelta can * recreate the key with the widened `(run_id, subscription_id, * signal_type)` shape. No-op on fresh installs — the table is created * with the v5 layout directly. * * Same shape as `maybe_upgrade_candidates_indexes()`: dbDelta can add * columns and indexes, but never drops an existing index, so the swap * has to be explicit before the parent hand-off. * * Returns false when any step actually attempted (ADD COLUMN, DROP * INDEX) reports a SQL failure — the caller skips the parent's * dbDelta + schema-version bump on a false return so the next * request retries. Returns true on the no-op paths (already on v5, * fresh install where the table doesn't yet exist). * * @return bool True when the migration completed (or was a no-op). */ private function maybe_upgrade_candidates_signal_type(): bool { } /** * Confirm the post-dbDelta `run_subscription` unique key includes * `signal_type`. If the column is missing from the key — typically * because dbDelta couldn't add the wider key while the narrower * one still existed — log loudly and reset the schema option so * `schema_is_out_of_date()` flags the next request for retry. * * Resetting the option is a stronger response than logging alone: * the alternative is shipping CandidateStore writes against a key * that silently REPLACE-clobbers rows across signals. The retry * loop will eventually clear the wedged state once the underlying * cause (locks, permissions, transient errors) clears. * * @return bool True when the unique key includes `signal_type`. */ private function verify_signal_type_key_shape(): bool { } /** * Drop the retired `wcs_health_check_ignored` table when upgrading * from any pre-v4 schema. Fresh installs never had it, so the SHOW * TABLES probe short-circuits for them. * * Same shape as `maybe_upgrade_candidates_indexes()` — dbDelta can * add tables but never removes them, so we issue the DROP TABLE * explicitly before handing control to the parent. */ private function maybe_drop_ignored_table() { } /** * Gets the CREATE TABLE statement for a given Health Check table. * * @param string $table Table identifier (one of the values from $this->tables). * * @return string */ protected function get_table_definition($table) { } } /** * 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) { } /** * Display the number of retries on a renewal order in the Orders list table, * for HPOS-enabled stores. * * @param string $column The column name * @param WC_Order $order The order object * * @return void */ public static function add_column_content_list_table(string $column, \WC_Order $order) { } /** * Add a setting to enable/disable the retry system * * @param array $settings * * @return array */ 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) { } } /** * 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 $order_id 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() { } /** * Check if the payment retry table exists. * * @return bool True if the table exists, false otherwise. */ public static function retry_table_exists(): bool { } /** * Show an admin notice if the retry table is missing. * * @return void */ public static function maybe_show_missing_table_notice() { } /** * Add retry manager debug tools to the WooCommerce > Status > Tools administration screen. * * @param array $tools The array of tools. * @return array The array of tools. */ public static function add_retry_manager_debug_tools($tools) { } /** * Recreate the payment retry table. * * @return string Informative string to show after the tool is triggered in UI. */ public static function recreate_payment_retry_table(): string { } } 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 $retry_number The retry queue position to check for a rule * @param int $order_id 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 $retry_number The retry queue position to check for a rule * @param int $order_id 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 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 { private static $store = \null; /** * Save the details of a retry to the database * * @param WCS_Retry $retry * * @return int the retry's ID */ abstract public function save(\WCS_Retry $retry); /** * Get the details of a retry from the database * * @param int $retry_id * * @return WCS_Retry */ abstract public 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 */ abstract 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 * * @return array * @since 2.4 */ public function get_retry_ids_for_order($order_id) { } /** * Setup the class, if required */ abstract public 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 void */ public function init() { } /** * Registers the custom payment_retry post type. * * @return void */ public function register_payment_retry_post() { } /** * 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 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 */ class WCS_Email_Customer_Payment_Retry extends \WCS_Email_Customer_Renewal_Invoice { /** * The retry object. * * @var WCS_Retry */ public $retry; /** * 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 */ class WCS_Email_Payment_Retry extends \WC_Email_Failed_Order { /** * The retry object associated with the order. * * @var WCS_Retry */ public $retry; /** * 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 $retry_rule The retry rule applied. * @param WC_Order $last_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) { } /** * Add hidden form inputs for subscription switch parameters. * * When a customer is switching subscriptions, the switch parameters are passed via URL query arguments. * This method outputs them as hidden form inputs so they're included when AJAX add-to-cart plugins * serialize and submit the form via POST. * * @since 8.3.0 */ public static function add_switch_hidden_inputs() { } /** * 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. * * @since 2.0 * @deprecated 2.2.0 Use WC_Subscriptions_Switcher::add_line_item_meta() instead. * * @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 */ 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. * * @since 2.0 * @deprecated 2.2.0 Use WC_Subscriptions_Switcher::add_line_item_meta() instead. * * @param int $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 */ 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()) { } /** * 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 $product 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 $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) { } /** * 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) { } /** * 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) { } /** * Reconcile a manual subscription's renewal preference after a product switch is paid. * * Applies the unified rule in {@see wcs_should_require_manual_renewal()} so the subscriber's existing * preference is preserved when the merchant's "Display the auto renewal toggle" setting is on, and * otherwise flips the subscription to automatic when the gateway can handle it. * * @param WC_Order $order The switch order. * @since 2.1 * @since 8.6.1 Defers the manual/automatic decision to wcs_should_require_manual_renewal() so the switcher * and change-payment-method flows apply the same rule. */ 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 $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 array The orders/subscriptions to display in the meta box. */ public static function display_switches_in_related_order_metabox($orders_to_display, $subscriptions, $order) { } /** * 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) { } /** * Removes subscription items from recurring carts which have been handled. * * It's possible that after we've processed the subscription switches and removed any recurring carts that shouldn't lead to new subscriptions, * that someone could call WC()->cart->calculate_totals() and that would lead us to recreate all the recurring carts after we've already processed them. * * This method runs after subscription recurring carts have been created and removes any recurring carts which have been handled. * * @param float $total The total amount of the cart. * @return float $total. The total amount of the cart. This is a pass-through method and doesn't modify the total. */ public static function remove_handled_switch_recurring_carts($total) { } } /** * 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; /** * The last switch order for this subscription. * @var WC_Order|null */ private $switch_order = \null; /** * Constructor. * * @since 2.6.0 * * @param array $cart_item The cart item. * @param WC_Subscription $subscription The subscription being switched. * @param WC_Order_Item $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 frequency 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://woocommerce.com/document/subscriptions/switching-guide/switching-process-and-costs/#upgrades * @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() { } /** * Calculates whether the last order was a switch and it fully reduced the prepaid term. * * @since 7.6.0 * @return bool */ public function calculate_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() { } } } namespace Automattic\WooCommerce_Subscriptions\Internal\Abilities { /** * Registers WooCommerce Subscriptions abilities with the WordPress Abilities API. * * Hosts the WCS read-only abilities (subscription reads + the gifted-list * read) under the shared `woocommerce` category, and the `can_read_subscriptions()` * capability helper that mirrors the load-bearing read gate resolved by * the REST controllers (`read_private_shop_orders`, the primitive cap that * map_meta_cap routes * `wc_rest_check_post_permissions('shop_subscription', 'read')` to). * * Plugin ownership is carried by the ability namespace * (`woocommerce-subscriptions/*`); the `woocommerce` category itself is * owned and registered by WooCommerce Core 10.9+, so this class does not * re-register it (the Abilities API fires `_doing_it_wrong` on duplicate * slug registration). * * Registration is gated by the `woocommerce_subscriptions_abilities_enabled` * filter (default false). Concrete write abilities will land in a follow-up * pass once per-state-transition design is settled. * * Registration pattern: WCS abilities are registered exclusively via Woo * Core's `woocommerce_ability_definition_classes` loader filter (introduced * in WooCommerce 10.9). On stores running WC < 10.9 the feature silently * no-ops — see `woo_abilities_loader_available()`. * * @internal This class may be modified, moved or removed in future releases. */ class Abilities_Registrar { /** * Category slug used for every WooCommerce Subscriptions ability. * * The `woocommerce` category is owned and registered by WooCommerce * Core (10.9+); plugin ownership lives in the ability namespace, not * the category. Mirrored on `Abstract_WCS_Ability::CATEGORY_SLUG` so * Domain classes can reference `self::CATEGORY_SLUG` without a * cross-namespace static call. * * @var string */ const CATEGORY_SLUG = 'woocommerce'; /** * Ability definition classes registered through the WC 10.9 loader. * * Registered exclusively via Woo Core's `woocommerce_ability_definition_classes` * filter (introduced in WooCommerce 10.9). * * @var array */ private const ABILITY_CLASSES = [\Automattic\WooCommerce_Subscriptions\Internal\Abilities\Domain\Get_Subscription_Statuses::class, \Automattic\WooCommerce_Subscriptions\Internal\Abilities\Domain\Get_Subscriptions::class, \Automattic\WooCommerce_Subscriptions\Internal\Abilities\Domain\Get_Subscription::class, \Automattic\WooCommerce_Subscriptions\Internal\Abilities\Domain\Get_Subscription_Related_Orders::class, \Automattic\WooCommerce_Subscriptions\Internal\Abilities\Domain\Get_Order_Subscriptions::class, \Automattic\WooCommerce_Subscriptions\Internal\Abilities\Domain\Get_Subscription_Notes::class, \Automattic\WooCommerce_Subscriptions\Internal\Abilities\Domain\Get_Gifted_Subscriptions::class]; /** * Whether init() has already wired its action callbacks. * * Without this guard, repeated calls to init() while the feature filter * is true would each append a fresh `add_action()` for the registrar * callbacks, and WP_Abilities_Registry::register() would emit * `_doing_it_wrong` notices for every already-registered slug when the * action fires. * * @var bool */ private static $initialized = false; /** * Initialize the abilities registration. * * Gated behind the `woocommerce_subscriptions_abilities_enabled` filter * (default false during rollout). Flip via `add_filter()` on a per-site * basis to enable; the default flips to true once the surface is stable. * * If the relevant Abilities API action has already fired we call the * registrar directly; otherwise we hook it for when the API boots. * * Idempotent: only the first invocation that passes the feature gate * wires the hooks; subsequent calls short-circuit. * * @return void */ public static function init(): void { } /** * Reset the idempotency guard set by init(). * * Tests need to reset the static between cases because PHPUnit runs * methods in the same PHP process; without a reset, a passing first * test would force subsequent init() calls to short-circuit and break * the isolated arrange/act/assert each case relies on. * * @internal Test-isolation helper. Not part of the public API. * * @return void */ public static function reset_initialized_for_testing(): void { } /** * Whether WooCommerce 10.9's AbilitiesLoader is available. * * Used as a hard gate: on WC < 10.9 the abilities feature silently * no-ops. WC 10.9 also depends on WP 6.9, so wp_register_ability() * is implicitly available wherever the loader exists. * * @return bool */ private static function woo_abilities_loader_available(): bool { } /** * Append WCS ability definition classes to Woo Core's loader. * * Filter callback for `woocommerce_ability_definition_classes`. * * @param array $classes Class names accumulated by the loader. * @return array */ public static function append_classes(array $classes): array { } /** * Permission callback for read abilities. * * Mirrors the REST controllers' resolved read gate: `shop_subscription` * post-type capability machinery (`capability_type='shop_order'`, * `map_meta_cap=true`) routes `wc_rest_check_post_permissions('shop_subscription', 'read')` * to the primitive `read_private_shop_orders` capability. Shop managers * and administrators have it; subscribers do not. * * @return bool */ public static function can_read_subscriptions(): bool { } } } namespace Automattic\WooCommerce_Subscriptions\Internal\Abilities\Domain { /** * Shared helpers for WCS ability definitions. * * Mirrors the shape of Woo Core's `Internal\Abilities\Domain\AbstractDomainAbility` * (introduced in WooCommerce 10.9 via #64606) without coupling WCS to that * class — Woo Core's lives under `Internal\`, which we treat as off-limits for * cross-plugin reuse. Update this base in sync if Woo Core's helper shape * meaningfully diverges. * * @internal Subscription-internal base; intended for use by classes in this * Domain namespace, not third-party code. */ abstract class Abstract_WCS_Ability { /** * Ability category slug shared across every WCS Domain ability. * * The `woocommerce` category is owned and registered by WooCommerce * Core (10.9+). Plugin ownership is carried by the ability namespace * (`woocommerce-subscriptions/*`), not the category. Mirrors * `Abilities_Registrar::CATEGORY_SLUG`; Domain classes reference this * constant via `self::CATEGORY_SLUG` to avoid the cross-namespace * static call. * * @var string */ public const CATEGORY_SLUG = 'woocommerce'; /** * Build a paginated collection-output schema. * * @param string $collection_key Property key naming the array of items * (e.g. `subscriptions`, `orders`, `notes`). * @param array $item_schema JSON schema describing a single item in * the collection. * @return array */ protected static function get_collection_output_schema(string $collection_key, array $item_schema): array { } /** * Build the standard pagination input properties for inclusion in an * ability's `input_schema['properties']` array. * * @param int $default_per_page Default page size when caller omits `per_page`. * @param int $max_per_page Hard cap on page size. * @return array */ protected static function get_pagination_input_properties(int $default_per_page = 10, int $max_per_page = 100): array { } /** * Compute total_pages from a total count + per_page. * * @param int $total Total result count. * @param int $per_page Page size in effect. * @return int */ protected static function compute_total_pages(int $total, int $per_page): int { } /** * Extract the X-WP-Total header from a REST response, with a row-count fallback. * * WP_REST_Server adds X-WP-Total / X-WP-TotalPages to paginated * collection responses when the controller's `get_items()` sets them * (most do by inheriting from WP_REST_Controller's pagination plumbing). * When the header is absent — either because the controller didn't set * it or because the response was filtered — we fall back to the count of * the returned rows. The fallback under-reports for sliced responses * (it only sees the current page's rows), but it never lies about the * current page existing. * * @param \WP_REST_Response $response Response object returned by * delegate_to_rest_controller( ..., true ). * @param array $rows Already-extracted data array used as the fallback total. * @return int Total result count. */ protected static function extract_total_from_response(\WP_REST_Response $response, array $rows): int { } /** * Execute a backing REST controller route and return its unwrapped response. * * Used by abilities whose backing is a WC REST controller. Builds a * WP_REST_Request, calls rest_do_request(), then unwraps WP_REST_Response * (success → data; error → WP_Error) and raw-array return shapes. The * controller_class argument is informational — used to surface a clear * error if the class has not loaded — because rest_do_request() routes * by registered route, not class. * * Outside a live REST request, rest_do_request() lazy-instantiates * WP_REST_Server and fires rest_api_init once per PHP process — the * first delegating call pays that cost. Acceptable for the read surface * registered here (low-stakes, no telemetry on the backing callbacks); * future writes should consider a shared-service shape instead. * * Visibility is `protected` so Domain subclasses inherit this helper via * `self::delegate_to_rest_controller(...)` and spy test subclasses can * reach it to assert the helper's contract independently of any one * ability. This is not a public extension point. * * @param string $controller_class Fully-qualified backing controller class (informational; surfaces a clear error when not loaded). * @param string $method HTTP method (GET, POST, PUT, DELETE). * @param string $route Resolved route path with concrete IDs substituted (e.g. /wc/v3/subscriptions/123/orders). * @param array $params Request parameters (query or body), passed to set_param(). * @param bool $return_response When true, return the WP_REST_Response object on success instead of * unwrapping to its data array. Callers that need response headers * (e.g. X-WP-Total for pagination) must pass true. WP_Error is always * returned as-is regardless of this flag. * @return array|\WP_REST_Response|\WP_Error Unwrapped response data (default), WP_REST_Response * (when $return_response is true), or WP_Error on failure. */ protected static function delegate_to_rest_controller(string $controller_class, string $method, string $route, array $params = [], bool $return_response = false) { } } /** * Registers the woocommerce-subscriptions/get-gifted-subscriptions ability. * * List gifted subscriptions on this store with optional status / per_page / * orderby / order filters and real server-side pagination. Distinct from the * existing woocommerce-subscriptions/get-subscriptions ability, which does NOT * expose a gifted filter at the REST layer. * * Returns a paginated envelope with total_pages, page, and per_page so callers * can iterate large gifted-subscription datasets without loading everything at * once. Each item carries a small summary projection: id, status, * parent_order_id, recipient_user_id, recipient_email. * * WIRE-FORMAT NOTE: The legacy `limit` parameter accepted by the pre-migration * execute callback has been removed. Callers must switch to `per_page`. The * `additionalProperties: false` constraint on the input_schema enforces this * at the schema-validation layer. * * @internal Only loaded when WooCommerce 10.9+ is active. The * Abilities_Registrar short-circuits before referencing this * class on earlier WC versions. */ class Get_Gifted_Subscriptions extends \Automattic\WooCommerce_Subscriptions\Internal\Abilities\Domain\Abstract_WCS_Ability implements \Automattic\WooCommerce\Abilities\AbilityDefinition { public static function get_name(): string { } public static function get_registration_args(): array { } /** * Execute callback for woocommerce-subscriptions/get-gifted-subscriptions. * * @param mixed $input Optional input array with keys status, orderby, order, page, per_page. * @return array|\WP_Error Paginated envelope { subscriptions, total_pages, page, per_page } on success, * or WP_Error when gifting is not initialized. */ public static function execute($input = null) { } /** * Project a subscription object to the gifted-subscription summary shape. * * Inlined from Abilities_Registrar::project_gifted_subscription_summary() * which was used only by the pre-migration execute callback and has been * removed from the registrar as part of this migration. * * WCS_Gifting::get_gifted_subscriptions() returns WC_Subscription / WC_Order * instances; both extend WC_Abstract_Order and always expose the methods used * below. Guard only against a non-object slipping through (defensive boundary * for direct callers passing arbitrary input). Return null so the caller can * skip the row rather than emit an empty object that breaks the documented shape. * * Treats `_recipient_user` as the source of truth for "this row is a gift": * after a GDPR erasure the user-ID meta is gone but the email meta survives, * and the gifted-list `meta_query` (EXISTS on `_recipient_user`) already * shields the listing — but a defensive null-out below means a stale or * cached row that slips past the filter cannot re-leak the erased email. * * @param \WC_Order|null $subscription Subscription row from WCS_Gifting::get_gifted_subscriptions(). * @return array|null Projection on success, null on non-WC_Order input (caller should skip). */ private static function project_summary($subscription): ?array { } } /** * Registers the woocommerce-subscriptions/get-order-subscriptions ability. * * Inverse lookup — list the subscriptions associated with a given order. * Backs "which subscriptions did this purchase create?" and "is order * #N tied to a subscription?". Returns a paginated envelope with * total_pages, page, and per_page so callers can iterate large result * sets without loading everything at once. * * The backing controller (WC_REST_Subscriptions_Controller) handles * `/wc/v3/orders/{id}/subscriptions` and accepts get_collection_params() * on its route (including page + per_page), always setting X-WP-Total / * X-WP-TotalPages response headers. * * @internal Only loaded when WooCommerce 10.9+ is active. The * Abilities_Registrar short-circuits before referencing this * class on earlier WC versions. */ class Get_Order_Subscriptions extends \Automattic\WooCommerce_Subscriptions\Internal\Abilities\Domain\Abstract_WCS_Ability implements \Automattic\WooCommerce\Abilities\AbilityDefinition { public static function get_name(): string { } public static function get_registration_args(): array { } /** * Execute callback for woocommerce-subscriptions/get-order-subscriptions. * * @param mixed $input Required input with `id` (ORDER ID); optional `page` and `per_page`. * @return array|\WP_Error Paginated envelope { subscriptions, total_pages, page, per_page }, or WP_Error. */ public static function execute($input = null) { } } /** * Registers the woocommerce-subscriptions/get-subscription ability. * * Fetch a single subscription by ID with full details (status, dates, * billing schedule, customer, line items, payment method) — backs the * common question "what's the state of subscription #N?". * * The response is enriched with the gifting projection `is_gifted`, * `recipient_user_id`, `recipient_email`. The WC REST controller does not * carry these fields; reading the recipient meta here avoids a follow-up * call when an agent needs to know whether a subscription is a gift. * * @internal Only loaded when WooCommerce 10.9+ is active. The * Abilities_Registrar short-circuits before referencing this * class on earlier WC versions. */ class Get_Subscription extends \Automattic\WooCommerce_Subscriptions\Internal\Abilities\Domain\Abstract_WCS_Ability implements \Automattic\WooCommerce\Abilities\AbilityDefinition { public static function get_name(): string { } public static function get_registration_args(): array { } /** * Execute callback for woocommerce-subscriptions/get-subscription. * * @param mixed $input Required input with at least `id`; optional `context`. * @return array|\WP_Error Subscription record enriched with the gifting projection, * or WP_Error on failure / not-found / permission. */ public static function execute($input = null) { } /** * Add the gifting projection (is_gifted, recipient_user_id, recipient_email) * to the REST response. * * The WC REST `shop_subscription` controller does not include the * `_recipient_user` or `_recipient_user_email_address` meta in its * default payload, so an agent that calls get-subscription would * otherwise need a separate call (or a meta scan) to learn whether the * subscription is a gift. Reading the two meta keys here keeps that * answer in the same round trip. * * Treats `_recipient_user` as the source of truth for "this subscription * is a gift" — not `WCS_Gifting::is_gifted_subscription()`, which also * returns true when only the email meta survives. After a GDPR erasure * the privacy eraser deletes `_recipient_user` but leaves * `_recipient_user_email_address` in place, and surfacing the stale * email through this ability would be a re-leak. So if the user-ID meta * is gone, the gifting projection collapses to nulls regardless of what * the email meta contains. * * @param array $response REST response payload. * @param int $subscription_id Subscription ID for the meta lookup. * @return array Response merged with is_gifted, recipient_user_id, recipient_email. */ private static function enrich_with_recipient(array $response, int $subscription_id): array { } } /** * Registers the woocommerce-subscriptions/get-subscription-notes ability. * * List a subscription's notes (customer and/or internal) — backs * "what's the history on subscription #N?" and surfaces recent operator * activity. Returns a paginated envelope with total_pages, page, and * per_page for API surface consistency. * * The backing controller (WC_REST_Subscription_notes_Controller, which * extends WC_REST_Order_Notes_V2_Controller) handles * `/wc/v3/subscriptions/{id}/notes`. The parent controller's get_items() * returns all notes in one flat array without server-side pagination or * X-WP-Total headers; extract_total_from_response() falls back to * count($rows) in that case, making total_pages always 1 for typical * subscription note sets. * * The input uses `subscription_id` for clarity; the backing REST route's * path variable is the vestigial `order_id` inherited from the order * notes controller, but it accepts a subscription ID. * * @internal Only loaded when WooCommerce 10.9+ is active. The * Abilities_Registrar short-circuits before referencing this * class on earlier WC versions. */ class Get_Subscription_Notes extends \Automattic\WooCommerce_Subscriptions\Internal\Abilities\Domain\Abstract_WCS_Ability implements \Automattic\WooCommerce\Abilities\AbilityDefinition { public static function get_name(): string { } public static function get_registration_args(): array { } /** * Execute callback for woocommerce-subscriptions/get-subscription-notes. * * The ability input uses `subscription_id` for clarity; the backing REST * route's path variable is the vestigial `order_id` inherited from the * order notes controller, but accepts a subscription ID. * * The backing controller (WC_REST_Subscription_notes_Controller) returns * all notes in one flat array without server-side pagination or X-WP-Total * headers. extract_total_from_response() falls back to count($rows) so * total_pages is always 1 for typical subscription note sets. * * @param mixed $input Required input with `subscription_id`; optional `type`, `page`, `per_page`. * @return array|\WP_Error Paginated envelope { notes, total_pages, page, per_page }, or WP_Error. */ public static function execute($input = null) { } } /** * Registers the woocommerce-subscriptions/get-subscription-related-orders ability. * * List the parent, renewal, and switch orders related to a subscription — * backs "show me the payment history for subscription #N?". Returns a * paginated envelope with total_pages, page, and per_page so callers can * iterate large order histories without loading everything at once. * * The backing controller (WC_REST_Subscriptions_Controller::get_subscription_orders) * accepts get_collection_params() on its route (including page + per_page) and * always sets X-WP-Total / X-WP-TotalPages response headers. * * @internal Only loaded when WooCommerce 10.9+ is active. The * Abilities_Registrar short-circuits before referencing this * class on earlier WC versions. */ class Get_Subscription_Related_Orders extends \Automattic\WooCommerce_Subscriptions\Internal\Abilities\Domain\Abstract_WCS_Ability implements \Automattic\WooCommerce\Abilities\AbilityDefinition { public static function get_name(): string { } public static function get_registration_args(): array { } /** * Execute callback for woocommerce-subscriptions/get-subscription-related-orders. * * @param mixed $input Required input with `id` (subscription ID); optional `page` and `per_page`. * @return array|\WP_Error Paginated envelope { orders, total_pages, page, per_page }, or WP_Error. */ public static function execute($input = null) { } } /** * Registers the woocommerce-subscriptions/get-subscription-statuses ability. * * Zero-arg read that returns the vocabulary of subscription statuses * (`wc-active`, `wc-on-hold`, `wc-cancelled`, etc.) keyed to their human * labels. Reference ability — establishes the registration shape (helper * + execute callback + permission callback) the remaining reads copy. * * @internal Only loaded when WooCommerce 10.9+ is active. The * Abilities_Registrar short-circuits before referencing this * class on earlier WC versions. */ class Get_Subscription_Statuses extends \Automattic\WooCommerce_Subscriptions\Internal\Abilities\Domain\Abstract_WCS_Ability implements \Automattic\WooCommerce\Abilities\AbilityDefinition { public static function get_name(): string { } public static function get_registration_args(): array { } /** * Execute callback for woocommerce-subscriptions/get-subscription-statuses. * * Returns the same status map the REST controller exposes at * GET /wc/v3/subscriptions/statuses. Calls wcs_get_subscription_statuses() * directly rather than round-tripping through rest_do_request() — the * source function is a thin canonical helper with no side effects, so the * REST bootstrap cost would only buy us extra overhead. * * @param mixed $input Optional; ability input. Unused for this ability (empty input_schema) but accepted to match the Abilities API execute_callback signature. * @return array|\WP_Error Status map (status_slug => human label) or WP_Error when WCS is not initialized. */ public static function execute($input = null) { } } /** * Registers the woocommerce-subscriptions/get-subscriptions ability. * * List subscriptions with filters (status, customer, product, parent order, * date range, search, paginate). Backs the merchant question "which * subscriptions are for customer ?" or "show subscriptions * renewing this week" in a single call. * * The backing controller (WC_REST_Subscriptions_Controller) handles * `/wc/v3/subscriptions` and accepts get_collection_params() on its route * (including page + per_page), always setting X-WP-Total / X-WP-TotalPages * response headers. * * WIRE-FORMAT NOTE: The legacy ability exposed a `limit` parameter. This * migration replaces it with `page` + `per_page` (via * Abstract_WCS_Ability::get_pagination_input_properties()). The input_schema's * `additionalProperties: false` REJECTS any caller that passes `limit`. * Acceptable because the abilities feature is flag-gated default-off and * there are no production consumers yet. The new shape aligns with WC 10.9's * OrdersQuery convention. * * @internal Only loaded when WooCommerce 10.9+ is active. The * Abilities_Registrar short-circuits before referencing this * class on earlier WC versions. */ class Get_Subscriptions extends \Automattic\WooCommerce_Subscriptions\Internal\Abilities\Domain\Abstract_WCS_Ability implements \Automattic\WooCommerce\Abilities\AbilityDefinition { public static function get_name(): string { } public static function get_registration_args(): array { } /** * Execute callback for woocommerce-subscriptions/get-subscriptions. * * All input fields are optional. Passes any provided filter parameters * (status, customer, product, parent, after, before, search, order, * orderby) and pagination parameters (page, per_page) through to the * backing REST controller. * * The backing controller (WC_REST_Subscriptions_Controller) sets * X-WP-Total / X-WP-TotalPages response headers, which * extract_total_from_response() uses to compute total_pages accurately. * * @param mixed $input Optional; ability input matching the input_schema. * @return array|\WP_Error Paginated envelope { subscriptions, total_pages, page, per_page }, or WP_Error on failure. */ public static function execute($input = null) { } } } namespace Automattic\WooCommerce_Subscriptions\Internal\CLI\Test_Data { /** * Failure reason vocabulary for the test subscription generator. * * Closed set of slugs that the generator stamps onto a failed renewal order's note. The slugs * carry no behavioural meaning beyond what individual cases require — `expired_card` is * special because the RemediationAdvisor uses the gateway error code to decide between * TC-F2 and TC-D3. Everything else is flavour text. * * @since 9.0.0 * @internal This class may be modified, moved or removed in future releases. */ class Failure_Reasons { /** * The closed vocabulary: slug => human-readable note. Intentionally small — * one declined-by-issuer case, one balance case, and the card-expired token * the D3 detector keys on. * * @var array */ private static $vocabulary = array('card_declined' => 'Payment declined by issuer.', 'insufficient_funds' => 'Payment declined: insufficient funds.', 'expired_card' => 'Payment declined: card expired.'); /** * Default reason picked when a case asks for a failed renewal but the * caller didn't override `--failure-reason`. Realistic, retryable, and * doesn't accidentally trigger the TC-D3 card-expired upgrade path. */ private const DEFAULT_REASON = 'card_declined'; /** * Return every known failure-reason slug. * * @return string[] */ public static function slugs() { } /** * Whether the given slug is part of the vocabulary. * * @param string $slug * @return bool */ public static function is_valid($slug) { } /** * Human-readable note template for the given slug. Empty string if the slug is unknown. * * @param string $slug * @return string */ public static function get_note($slug) { } /** * The default failure reason — used when a case calls for a failed renewal * and no explicit reason was supplied. * * @return string */ public static function default_slug() { } } /** * WP-CLI command for generating health-check test-case subscriptions. * * Local / development use only. See docs/dev-tools/generate-subscriptions.md for the user- * facing reference and docs/health-check/test-cases.md for the canonical specification of * each case. * * Generates one subscription per `--case` invocation, in the exact shape the corresponding * RemediationAdvisor case expects. * * Safety properties enforced by this command: * - Refuses to run unless WP_ENVIRONMENT_TYPE is 'local' or 'development'. * - Short-circuits pre_wp_mail so no outbound mail leaves the process during the command. * * @since 9.0.0 * @internal This class may be modified, moved or removed in future releases. */ class Generate_Command { const VALID_FORMATS = array('table', 'ids', 'csv', 'json'); /** * Generate test subscriptions matching a Health Check advisor case. * * ## OPTIONS * * --case= * : Health Check case to generate. Each slug maps 1:1 to a `RemediationAdvisor` case * constant; see `docs/health-check/test-cases.md` for the full spec. Pass `all` to * generate `--count` of every supported case. * --- * options: * - s1a * - s1b * - s2a * - s2b * - all * --- * * --count= * : Number of subscriptions to generate. * * [--customer=] * : Existing WP user ID or email to assign all generated subscriptions to. * * [--product=] * : Existing subscription product ID. A test product is created when omitted. * * --payment-method= * : Registered payment gateway ID (e.g. `stripe`, `bacs`). * * [--dry-run] * : Print the resolved configuration without writing anything. * * [--format=] * : Output format for the summary. * --- * default: table * options: * - table * - ids * - csv * - json * --- * * ## EXAMPLES * * # One stuck-on-manual sub for the Eligible-for-automatic-renewal tab. * wp wc-subs generate --case=s1a --count=1 --payment-method=stripe * * # Stuck-on-manual with a failed renewal order. * wp wc-subs generate --case=s1b --count=1 --payment-method=stripe * * # Active sub with no next-payment date and no end date. * wp wc-subs generate --case=s2a --count=3 --payment-method=stripe * * # Past-due sub with no matching renewal order. * wp wc-subs generate --case=s2b --count=1 --payment-method=stripe --customer=qa@example.test * * # One subscription of every supported case. * wp wc-subs generate --case=all --count=1 --payment-method=stripe * * @when after_wp_load * * @param array $args Positional arguments (unused). * @param array $assoc_args Associative arguments. */ public function __invoke($args, $assoc_args) { } /** * Instantiate the generator and drive it count times, then render the summary. * * @param array $config Normalised config from parse_args(). */ private function run_generation(array $config) { } /** * Format the list of generated records for output. * * @param array $results List of per-subscription result rows. * @param string $format One of table, ids, csv, json. */ private function render_results(array $results, $format) { } /** * Abort unless the current WP environment is suitable for running the command. */ private function assert_safe_environment() { } /** * Neutralise outbound mail for the duration of this CLI invocation. * * Short-circuits pre_wp_mail with PHP_INT_MAX priority so nothing can override it from a later filter. * No restoration is needed: WP-CLI commands run in a short-lived PHP process. */ private function suppress_mail() { } /** * Parse, validate, and normalise the CLI flags into a config array. * * @param array $assoc_args Associative CLI arguments. * @return array Normalised config. */ private function parse_args(array $assoc_args) { } /** * Print the resolved configuration without generating any data. * * @param array $config Normalised config from parse_args(). */ private function print_dry_run(array $config) { } } /** * Test subscription data generator — health-check-case driven. * * Creates one subscription (and its supporting customer, product, and parent order) per call, * in the exact shape that the corresponding RemediationAdvisor case expects. Local / * development use only — driven exclusively by Generate_Command, which enforces the * environment guard and mail suppression before ever instantiating this class. * * Each `--case=` value maps 1:1 to a case in `docs/health-check/test-cases.md`. The * canonical specification of what each case looks like (statuses, schedule meta, related * orders, retries, AS rows) lives in that doc; this class is the executable transcription. * * @since 9.0.0 * @internal This class may be modified, moved or removed in future releases. */ class Generator { /** * Meta key stamped on every record this class creates, so purge-test can find them. */ const TEST_META_KEY = '_wcs_test_data'; /** * Health-check case slugs the generator can produce. Each entry maps 1:1 to a case * in docs/health-check/test-cases.md and to a CASE_* constant on RemediationAdvisor. */ const SUPPORTED_CASES = array('s1a', 's1b', 's2a', 's2b'); /** * Cases that need a payment gateway declaring `supports( 'subscriptions' )` to be a * realistic match for the detector. The generator validates the gateway during * config resolution to avoid producing rows the detector would reject. */ const SUPPORTS_SUBS_GATEWAY_CASES = array('s1a', 's1b'); /** * Cases where Stripe must return a real PaymentMethod token. A fake token is * not reliable for these shapes because the Stripe gateway can filter invalid * tokens before the Health Check detector sees them. */ const REQUIRES_REAL_STRIPE_TOKEN_CASES = array('s1a', 's1b'); /** * AS hook constant for the renewal-payment action. Used by S2b to force-schedule * an AS row so the sub doesn't get flagged for a missing hook instead. */ const HOOK_RENEWAL_PAYMENT = 'woocommerce_scheduled_subscription_payment'; /** * Normalised config from Generate_Command::parse_args(). * * @var array */ private $config; /** * Resolved shared customer ID when --customer was supplied, null otherwise. * * @var int|null */ private $shared_customer_id = null; /** * Resolved shared product ID. Always set on first use — either from --product or by * creating a reusable test product for the whole invocation. * * @var int|null */ private $shared_product_id = null; /** * Cached result of resolve_payment_method() — gateway picks are stable per invocation. * * @var string|null */ private $resolved_payment_method = null; /** * @param array $config Normalised CLI config. */ public function __construct(array $config) { } /** * Abort unless the current WP environment is suitable for generating test data. * * Mirrors Generate_Command::assert_safe_environment() as a defence-in-depth measure * so that direct callers of this class (outside the CLI command) cannot bypass the * environment guard. */ private function assert_safe_environment() { } /** * Abort if Action Scheduler is not available and the configured case requires it. * * S2b depends on a scheduled AS renewal-payment row for the Health Check detector * to classify it correctly. Without AS, the generated subscription would be silently * invisible to the health check — defeating the tool's purpose. */ private function assert_action_scheduler_available() { } /** * Create one subscription matching the configured case and return a row describing it. * * @return array */ public function generate_one() { } // // ───── Case builders ────────────────────────────────────────────────── // // Each builder produces the exact shape its TC-X case expects. // `docs/health-check/test-cases.md` is the source of truth for the // shape; these methods are the executable transcription. Anything // the detector classifier reads (status, meta, AS rows, related // orders) is set explicitly here. // /** * TC-S1a — manual flag stuck, customer has saved token, gateway supports subs. */ private function build_s1a($customer_id, $product_id, $gateway_id) { } /** * TC-S1b — TC-S1a plus a `failed` renewal as the latest related order. */ private function build_s1b($customer_id, $product_id, $gateway_id) { } /** * TC-S2a — active sub with no scheduled next-payment AND no future end date. */ private function build_s2a($customer_id, $product_id, $gateway_id) { } /** * TC-S2b — active sub with a stale next-payment date (past tolerance) and no * matching renewal order. * * The detector's tolerance is filterable but defaults to 24h, so seven days * past comfortably qualifies. Start date is back-dated 30 days so * `set_next_payment_date()` accepts the past timestamp. * * Force-schedules an AS row so M1's "no AS hook" classifier doesn't preempt * S2b — keeping the case test-faithful to the doc's resolution-precedence. */ private function build_s2b($customer_id, $product_id, $gateway_id) { } // // ───── Building blocks ──────────────────────────────────────────────── // /** * Create a subscription + parent order in the requested status and apply * the supplied date overrides. Returns the live WC_Subscription object. * Most cases call this once and then layer their case-specific state on * top. * * @param int $customer_id WP user id. * @param int $product_id Subscription product id. * @param string $gateway_id Payment gateway id. * @param string $status Final subscription status. * @param array $date_overrides Date keys to apply via `update_dates()` * after status transition. May include * `start_date` (consumed at create time * instead of via update_dates). * * @return WC_Subscription */ private function create_base_subscription($customer_id, $product_id, $gateway_id, $status, array $date_overrides) { } /** * Build the parent order. Always `completed` — the cases the generator * produces all assume the initial sign-up succeeded. * * @param int $customer_id * @param int $product_id * @param string $gateway_id * @param string $date_created MySQL UTC datetime. * * @return WC_Order */ private function create_parent_order($customer_id, $product_id, $gateway_id, $date_created) { } /** * Create a renewal order in the given status, optionally stamping a gateway * error code on it (used by D3 to drive the advisor's card-expired upgrade * path). * * @param WC_Subscription $sub * @param string $status Final renewal-order status. * @param string $gateway_id Payment method id. * @param string $failure_reason Failure-reason slug (note text). * @param string|null $stripe_decline_code Optional gateway error code * stamped via the Stripe * decline-code meta key the * advisor samples. * * @return WC_Order */ private function create_renewal_order(\WC_Subscription $sub, $status, $gateway_id, $failure_reason, $stripe_decline_code) { } /** * Resolve the customer for this subscription. When --customer was supplied, the same user is * reused across the whole invocation; otherwise each call creates a fresh test user. * * @return int */ private function resolve_customer() { } /** * Look up a customer by numeric ID or email; abort if not found. * * @param string|int $id_or_email * @return int */ private function find_or_fail_customer($id_or_email) { } /** * Create a fresh test user with a collision-resistant login and email. * * @return int */ private function create_test_customer() { } /** * Resolve the subscription product. One product is shared across the whole invocation — * either the user-supplied one or a freshly minted test product — to avoid littering the * catalog when --count is large. * * @return int */ private function resolve_product() { } /** * Verify an existing product ID and confirm it's a subscription product. * * @param int $product_id * @return int */ private function find_or_fail_product($product_id) { } /** * Create a minimal monthly subscription product priced at 10.00. * * @return int */ private function create_test_product() { } /** * Resolve and validate the payment method for this run. * * The caller (Generate_Command) enforces --payment-method as required, so * config['payment_method'] is always set. This method validates the gateway * and caches the result. * * @return string Registered payment-gateway id. */ private function resolve_payment_method() { } /** * Verify that the given gateway exists and declares subscriptions support. Called only * when the active case requires it; a gateway without that support would never survive * the detector's filter. * * @param string $gateway_id */ private function assert_gateway_supports_subscriptions($gateway_id) { } /** * Fill a plausible billing address for the test customer. * * @param int $customer_id * @return array */ private function get_test_address($customer_id) { } /** * Create a saved card token for the given customer under the given gateway. * Used by S1a/S1b — those cases only need the existence of a token, so the * card details are decorative. * * When the gateway is Stripe and test-mode API keys are configured, a real * Stripe test customer + PaymentMethod is created via the Stripe API so that * remediation actions (e.g. "switch to automatic and retry") can process an * actual charge against the Stripe test environment. Falls back to a fake * token when the API call fails or keys are not configured. * * @param int $customer_id * @param string $gateway_id * @return string The payment method token string (PM id or fake token). */ private function create_test_payment_token($customer_id, $gateway_id) { } /** * Create a real Stripe test customer + PaymentMethod via the Stripe API * and store the customer ID in user meta so the gateway can find it. * * @param int $customer_id WP user id. * @return string|null The `pm_...` PaymentMethod ID, or null on failure. */ private function create_stripe_test_token($customer_id) { } /** * Get or create a Stripe test customer for the given WP user. Caches the * Stripe customer ID in user meta (same key the Stripe gateway plugin uses) * so subsequent calls reuse the same customer. * * @param int $customer_id WP user id. * @param string $secret_key Stripe test secret key. * @return string|null Stripe customer ID or null on failure. */ private function get_or_create_stripe_customer($customer_id, $secret_key) { } /** * Minimal Stripe API POST helper. Returns the decoded JSON response. * * @param string $secret_key Stripe secret key. * @param string $endpoint API endpoint path (e.g. 'customers'). * @param array $params POST parameters. * @return array Decoded response body. */ private function stripe_api_post($secret_key, $endpoint, $params) { } /** * Provision gateway payment credentials (token + subscription meta) so * that remediation actions involving payment processing (retry, process * missed renewal, etc.) can complete a real charge in the test * environment. Called by every builder whose remediation path triggers * a payment — deliberately omitted from D1 (which tests the "no token" * scenario) and S1a/S1b (which provision tokens via their own path * for the manual-flag-stuck signal). * * @param WC_Subscription $sub Subscription to provision. * @param int $customer_id WP user id. * @param string $gateway_id Payment gateway id. */ private function provision_gateway_credentials($sub, $customer_id, $gateway_id) { } /** * Set `_stripe_customer_id` and `_stripe_source_id` on the subscription * when the token is a real Stripe PaymentMethod (`pm_...`). Without these * the Stripe gateway can't resolve which customer/method to charge during * renewal processing. * * @param WC_Subscription $sub Subscription to update. * @param int $customer_id WP user id. * @param string $pm_token The token string from create_test_payment_token(). */ private function maybe_set_stripe_meta($sub, $customer_id, $pm_token) { } /** * Whether the current case must have a real Stripe PaymentMethod to * produce a detector-visible row. * * @param string $gateway_id Resolved payment gateway id. * @return bool */ private function requires_real_stripe_token($gateway_id) { } /** * Abort early when a Stripe-dependent case cannot produce a reliable * detector-visible token. */ private function assert_stripe_test_secret_key_is_configured() { } /** * Read the Stripe test secret key from the WooCommerce Stripe settings. * * @return string */ private function get_stripe_test_secret_key() { } /** * Print actionable setup guidance for Stripe token-dependent cases. * * @param string $reason Specific failure reason. */ private function stripe_setup_error($reason) { } /** * Force-schedule a renewal-payment AS row for the sub. Used by S2b so the * M1 classifier's "no AS hook" check doesn't preempt the past-due path. * * @param int $sub_id Subscription id. */ private function force_schedule_renewal_hook($sub_id) { } /** * UTC mysql datetime string offset by N days from now. Negative = past, positive = future. * * @param int $offset_days * @return string */ private function date_string($offset_days) { } } /** * WP-CLI command for purging test subscriptions created by `wp wc-subs generate`. * * Local / development use only. Finds every record tagged with `_wcs_test_data` and removes * it. Records that were *supplied* to `generate` via --customer or --product are never tagged * and therefore never touched — only records the generator itself created. * * See docs/dev-tools/generate-subscriptions.md. * * Safety properties enforced by this command: * - Refuses to run unless WP_ENVIRONMENT_TYPE is 'local' or 'development' (overridable only with an explicit flag). * - Defaults to preview mode; actual deletion requires --yes. * * @since 9.0.0 * @internal This class may be modified, moved or removed in future releases. */ class Purge_Command { /** * Purge test data created by the generator. * * ## OPTIONS * * [--yes] * : Actually delete the records. Without this flag, the command prints a summary of * what would be removed and exits. * * [--i-know-what-im-doing] * : Override the environment-type safety guard. Not recommended. * * ## EXAMPLES * * # Preview what would be deleted. * wp wc-subs purge-test * * # Actually delete everything tagged as test data. * wp wc-subs purge-test --yes * * @when after_wp_load * * @param array $args Positional arguments (unused). * @param array $assoc_args Associative arguments. */ public function __invoke($args, $assoc_args) { } /** * Abort unless the current WP environment is suitable. * * @param array $assoc_args */ private function assert_safe_environment(array $assoc_args) { } /** * Find orders of the given WC order type that carry the test-data tag. * Works with both legacy post and HPOS datastores via wc_get_orders(). * * @param string $type * @return int[] */ private function find_orders_of_type($type) { } /** * @return int[] */ private function find_products() { } /** * @return int[] */ private function find_users() { } /** * @param int[] $order_ids * @return int[] */ private function find_retries_for_orders(array $order_ids) { } /** * @param int[] $retry_ids */ private function purge_retries(array $retry_ids) { } /** * Force-delete each order. Subscriptions are WC orders under the hood, so the same loop * handles both — call with subscriptions first, then regular orders. * * @param int[] $ids */ private function purge_orders(array $ids) { } /** * @param int[] $ids */ private function purge_products(array $ids) { } /** * @param int[] $ids */ private function purge_users(array $ids) { } /** * Find payment tokens tagged as test data. Queries the token meta table * directly because the WC Payment Tokens API does not support meta-based * lookups, and tokens may belong to non-test users supplied via --customer * (who are not themselves tagged with _wcs_test_data). * * @return int[] */ private function find_payment_tokens() { } /** * @param int[] $ids */ private function purge_tokens(array $ids) { } /** * Find Action Scheduler renewal hooks for all test-tagged subscriptions. * Queries all statuses to match what purge_scheduled_actions() removes via * as_unschedule_all_actions(). Currently only S2b schedules this hook, but * all test subscriptions are checked so future cases are covered. * * @param int[] $subscription_ids All test-tagged subscription ids. * @return int[] */ private function find_scheduled_actions_for_subscriptions(array $subscription_ids) { } /** * Unschedule all Action Scheduler renewal hooks for test-tagged * subscriptions before the subscriptions themselves are deleted. * * @param int[] $subscription_ids All test-tagged subscription ids. */ private function purge_scheduled_actions(array $subscription_ids) { } /** * Render the counts as a small table with the given verb ('would remove' | 'removed'). * * @param array $counts * @param string $verb */ private function print_summary(array $counts, $verb) { } } } namespace Automattic\WooCommerce_Subscriptions\Internal\HealthCheck\Admin { /** * AJAX endpoints for the Health Check admin surface. * * Handles suggest-remediation (GET) and tool-call (POST) requests from the * resolve-dialog modal, delegating to RemediationAdvisor and ToolRunner * for the actual work. * * @internal This class may be modified, moved or removed in future releases. */ class AjaxController { /** @var RemediationLock */ private \Automattic\WooCommerce_Subscriptions\Internal\HealthCheck\RemediationLock $lock; /** @var CandidateStore */ private \Automattic\WooCommerce_Subscriptions\Internal\HealthCheck\CandidateStore $candidate_store; /** @var RunStore */ private \Automattic\WooCommerce_Subscriptions\Internal\HealthCheck\RunStore $run_store; /** @var RemediationAdvisor */ private \Automattic\WooCommerce_Subscriptions\Internal\HealthCheck\RemediationAdvisor $advisor; /** @var ToolRunner */ private \Automattic\WooCommerce_Subscriptions\Internal\HealthCheck\ToolRunner $runner; /** * List-table renderer used by ajax_tool_call() to produce the * transformed-row HTML when a successful action moves the * subscription into a different signal. Optional so existing * tests don't have to construct a list table. * * @var CandidatesListTable|null */ private ?\Automattic\WooCommerce_Subscriptions\Internal\HealthCheck\Admin\CandidatesListTable $candidates_table; /** * Single source of truth for the in-flight scan-progress reading, * shared with StatusTab so the background poll and the server render * report the same count + copy. Defaulted so existing callers * (Bootstrap, tests) need no construction change. * * @var ScanProgress */ private \Automattic\WooCommerce_Subscriptions\Internal\HealthCheck\ScanProgress $scan_progress; /** * @param RemediationLock $lock Lock for serialising concurrent remediation requests. * @param CandidateStore $candidate_store Candidate persistence layer. * @param RunStore $run_store Scan-run persistence layer. * @param RemediationAdvisor $advisor Classification advisor. * @param ToolRunner $runner Remediation tool executor. * @param CandidatesListTable|null $candidates_table List-table renderer for transformed-row HTML (optional). * @param ScanProgress|null $scan_progress In-flight scan-progress reader for the status poll (optional). */ public function __construct(\Automattic\WooCommerce_Subscriptions\Internal\HealthCheck\RemediationLock $lock, \Automattic\WooCommerce_Subscriptions\Internal\HealthCheck\CandidateStore $candidate_store, \Automattic\WooCommerce_Subscriptions\Internal\HealthCheck\RunStore $run_store, \Automattic\WooCommerce_Subscriptions\Internal\HealthCheck\RemediationAdvisor $advisor, \Automattic\WooCommerce_Subscriptions\Internal\HealthCheck\ToolRunner $runner, ?\Automattic\WooCommerce_Subscriptions\Internal\HealthCheck\Admin\CandidatesListTable $candidates_table = null, ?\Automattic\WooCommerce_Subscriptions\Internal\HealthCheck\ScanProgress $scan_progress = null) { } /** * Register AJAX hooks. */ public function register(): void { } /** * Script data for the dialog JS — AJAX URL and nonces. * * Called by Bootstrap during asset enqueueing to provide the * values `wp_localize_script()` passes to the client. * * @return array */ public function get_script_data(): array { } /** * AJAX handler: suggest remediation for a subscription and return the advisory JSON. * * @since 8.7.0 * * @return void */ public function ajax_suggest_remediation(): void { } /** * AJAX handler: execute a remediation tool on a subscription. * * After the tool runs, re-classifies the subscription. If the issue * is resolved, marks the candidate as fixed in the database. * * @since 8.7.0 * * @return void */ public function ajax_tool_call(): void { } /** * AJAX handler: report the current scan-progress reading for the background poll. * * Read-only — it mutates no scan state. health-check-admin.js polls this while a scan * is in flight to update the inline "N of M subscriptions scanned" count in place * (instead of the legacy 8 s full-page reload) and reloads the page once when the * response reports `in_flight === false` (terminal state). * * @since 8.8.0 * * @return void */ public function ajax_scan_status(): void { } /** * Shape the uniform AJAX response envelope. Same shape for every * terminal outcome; transformed adds `row_html`. The JS routes on * `envelope.outcome`; no legacy field passthrough — the feature is * unreleased so there is no back-compat surface to preserve. * * @param string $outcome One of 'ready'|'resolved'|'transformed'|'failed'|'stale'. * 'ready' is the modal-open success * outcome — callers should attach a * `classification` payload separately. * @param int $subscription_id Subscription id. * @param int $run_id Current scan run id (for badge counts). * @param string $view Current candidates-table view slug. * * @return array */ public function build_response_envelope(string $outcome, int $subscription_id, int $run_id, string $view): array { } /** * Per-signal + total candidate counts for the given scan run. * * @param int $run_id Current scan run id. * * @return array{all: int, missing_renewal: int, supports_auto_renewal: int} */ private function build_badge_counts(int $run_id): array { } /** * Render the post-action `` for a transformed subscription via * the list-table helper. Returns an empty string when the helper * isn't available (constructor was called without a list table) or * when the subscription can't be loaded. * * @param int $subscription_id Subscription id. * @param string $view Current view slug. * * @return string */ private function render_transformed_row(int $subscription_id, string $view): string { } /** * Lazy-construct (or return the injected) CandidatesListTable. * * Eager construction in Bootstrap fatals because WP_List_Table's * parent constructor calls `convert_to_screen()`, which is only * defined after `wp-admin/includes/screen.php` loads — too late * for the `init` hook where Bootstrap runs. Building the table * here defers that work to AJAX-handler timing, by which time * the wp-admin context is fully resolved. * * The injected-table branch keeps unit tests deterministic. * * @return CandidatesListTable|null */ private function resolve_candidates_table(): ?\Automattic\WooCommerce_Subscriptions\Internal\HealthCheck\Admin\CandidatesListTable { } /** * Build the notice payload that the client-side helper injects as * a WP admin notice after a Resolve action terminates. Outcome * drives both the notice class and the copy: * * - 'resolved' / 'transformed' -> notice-success * "Subscription #N was successfully updated." * - 'failed' -> notice-error * "Subscription #N could not be updated. Please try again." * - 'stale' -> notice-info * "Subscription #N has been updated since the last scan * and is no longer flagged. The row has been removed * from the list." * * `#N` is rendered as a link to the subscription edit screen so * the merchant can jump straight to the subscription from the * notice. Returns an empty array for unknown outcomes so the * caller can omit the notice key from the envelope. * * @param string $outcome One of 'resolved', 'transformed', 'failed', 'stale'. * 'ready' (modal-open success) maps to an * empty payload — no notice is rendered * because the modal itself is the * merchant-facing surface in that case. * @param int $subscription_id Subscription id rendered into the link. * * @return array{type: string, html: string}|array{} */ public function build_notice_payload(string $outcome, int $subscription_id): array { } } /** * Read-only WP_List_Table for the Health Check candidate list. * * Rendered inside WooCommerce > Status > Subscriptions. Seven * columns, column order fixed by the MVP-update spec: * * 1. Subscription — "#" + subscribed product title, HPOS- * aware deep link. * 2. Customer — name linked to user-edit.php (plain * text for guest subscriptions). * 3. Status — live WC status pill; sortable PHP-side. * 4. Billing mode — Manual ⚠ / Automatic badge; sortable PHP- * side. * 5. Payment method — "{Gateway} ···· {last4}" over "✓/⚠ token * on file". * 6. Renewal order status — pill for the most recent renewal order's * status (Pending / Failed / etc.); sortable * PHP-side on the stored detail field. * 7. Last successful payment — date over wc_price() total from the prior * auto-renewal order. * * Every flagged sub is treated uniformly — no confidence tier is * computed or displayed; the Renewal preference column carries the * per-row context merchants need to decide what to do. * * Sort rules: * - Status, Billing mode — derived from live subscription lookups * (not stored on candidate rows), so sort the current page in PHP. * - Renewal order status — stored in details_json (latest_renewal_status), * so sort the current page in PHP without a live order load. * * Search: PHP-side match on subscription id and customer email. * * @internal This class may be modified, moved or removed in future releases. */ class CandidatesListTable extends \WP_List_Table { /** * Page size for the list. Matches WooCommerce's default Subscriptions * list density and gives the WP-standard pagination something to do * when a store accumulates more than ~20 candidates. */ private const PER_PAGE = 20; /** * @var RunStore */ private $run_store; /** * @var CandidateStore */ private $candidate_store; /** * Per-request cache of `count_all_subscriptions()` results, keyed * on status filter. Populated lazily by * `cached_count_all_subscriptions()`. * * @var array */ private $count_cache = array(); /** * Per-request cache of loaded WC_Subscription objects, keyed by ID. * Populated lazily by `load_subscription()` to avoid redundant * `wcs_get_subscription()` calls across column renderers. * * @var array */ private $subscription_cache = array(); /** * Detector used by render_row_for() to live-classify a subscription * for the transformed-row update path. Lazily instantiated. * * @var Detector|null */ private $detector; public function __construct(?\Automattic\WooCommerce_Subscriptions\Internal\HealthCheck\RunStore $run_store = null, ?\Automattic\WooCommerce_Subscriptions\Internal\HealthCheck\CandidateStore $candidate_store = null, ?\Automattic\WooCommerce_Subscriptions\Internal\HealthCheck\Detector $detector = null) { } /** * Render a single candidate row as an HTML `` string, suitable * for swapping into the candidates table from the Resolve modal's * AJAX response after a transformed-case action (the subscription * is still flagged, just under a different signal — see T7 / T10 * in the WOOSUBS-1674 spec). * * Self-contained — live-classifies the subscription via Detector so * the rendered row reflects the post-action state, even when the * candidate_store doesn't yet have a row for the new signal. No * state mutation. * * Threads `$view` through the table's view-dependent rendering by * temporarily overriding `$_REQUEST['view']` for the duration of * the `single_row()` call; restores the prior value in a `finally` * so the override doesn't leak. * * @param WC_Subscription $subscription Subscription to render. * @param string $view One of 'all', 'supports_auto_renewal', * 'missing_renewals'. * Determines which signal's data * drives the row and which row * actions appear (see T8 gating). * * @return string Full `...` HTML for the subscription, or an * empty string when the subscription doesn't classify * under any signal at the moment of the call. */ public function render_row_for(\WC_Subscription $subscription, string $view): string { } /** * View slug -> CandidateStore signal type mapping shared between * the table view, the row-render helper, and AjaxController's * per-view re-classify wiring. Empty string for the All view, * which has no signal-specific column data. * * @param string $view 'all', 'supports_auto_renewal' or 'missing_renewals'. * * @return string SIGNAL_TYPE_* constant or empty string. */ public static function signal_type_for_view(string $view): string { } /** * Column definitions, in display order. * * Universal across every view — swapping columns as merchants * change tabs is disorienting, so the same column set renders * everywhere and per-user hiding goes through the Screen Options * drawer. * * @return array */ public function get_columns(): array { } /** * Sortable columns + default-descending flag. * * Cycle is deliberately omitted — "Every 2 months" has no natural * ordering vs "Every 3 weeks" (the period + interval combination * isn't a linear quantity), so any sort key would encode a * product decision the merchant didn't ask us to make. * * @return array */ protected function get_sortable_columns(): array { } /** * Filter tabs rendered above the table: * - All — every subscription in the store. * - Supports auto-renewal — Supports-auto-renewal signal. * - Missing renewals — missing / stale next-payment * schedule. * * "Supports auto-renewal" is the default view, so its tab * carries the bare tab URL; the All and Missing tabs get explicit * `?view=` params. * * View slugs (`all`, `supports_auto_renewal`, `missing_renewals`) * map directly to the signal types so URLs shared in support * tickets stay self-describing. * * @return array */ protected function get_views(): array { } /** * Total subscription count across the whole store. Direct SQL * count rather than `wcs_get_subscriptions(['subscriptions_per_page' => -1])` * because the latter would hydrate every WC_Subscription object * just to count them — unbounded memory on big stores. * * Matches the status filter `wcs_get_subscriptions( [ 'subscription_status' * => [ 'any' ] ] )` actually applies — `trash` and `auto-draft` are excluded * by the paginated fetch, so including them here would make the `All (N)` * tab count drift higher than the rows a merchant can browse to. * * HPOS-aware: queries `wc_orders` when HPOS is enabled, falls * back to `posts` otherwise. * * @return int */ public static function count_all_subscriptions(string $status_filter = ''): int { } /** * Instance-cached wrapper for `count_all_subscriptions()` used by * the two internal callers (`get_views()` for the All-tab badge and * `prepare_items_all_view()` for pagination totals) that both run * within the same request on the same list-table instance. Collapses * those two otherwise-identical COUNT(*) queries per All-view render * into one. * * The public static `count_all_subscriptions()` stays uncached for * callers from outside the class (StatusTab scope card) that call * it once per render. * * @param string $status_filter Optional status filter; defaults to * "all statuses" (trash/auto-draft * excluded). * * @return int */ private function cached_count_all_subscriptions(string $status_filter = ''): int { } /** * Currently-selected filter tab. Defaults to 'supports_auto_renewal' — * the design treats "things that need attention" as the merchant's * primary entry point. Unknown values fall back to the default * view rather than surfacing as an empty page. */ private function current_view(): string { } /** * Candidate-store signal_type corresponding to the currently-selected * view. Only meaningful for candidate-backed views ('supports_auto_renewal' * and 'missing_renewals'); the All view reads from `wcs_get_subscriptions()` * and ignores signal type. * * @return string Empty string for the All view; a SIGNAL_TYPE_* * constant otherwise. */ private function signal_type_for_current_view(): string { } /** * Populate `$this->items` from the latest completed scan's * candidates, with search + sort applied. * * @return void */ public function prepare_items(): void { } /** * Hidden-column list for the current view. Reads the user's saved * preferences from the WP Screen Options drawer (backed by user * meta) and falls back to the empty array so every column renders * by default — matches the Figma literal. * * Wrapped in a helper rather than inlined in `prepare_items()` so * the fallback is testable and the dependency on the live screen * is isolated to one place. * * @return array */ private function get_hidden_columns_for_current_view(): array { } /** * Hard cap on the number of candidate rows fetched into PHP when * search / filter / PHP-sortable column fallback kicks in on a * candidate-backed view (Supports auto-renewal / Missing renewals). Candidate * counts are bounded in practice (~100s), but a pathologically * broken store could produce thousands — without this cap, * `usort` + per-row `load_subscription()` would run O(N log N) * hydrations and tip over the page. * * When the cap is hit the merchant sees a "showing first N" notice * (see `prepare_items_signal_view()`) that invites them to narrow * the search. * * @var int */ public const SIGNAL_PHP_FALLBACK_CAP = 500; /** * @deprecated Use `SIGNAL_PHP_FALLBACK_CAP`. Alias retained for * callers outside this class that may have inlined the * older constant. Removes on next major. */ public const ELIGIBLE_PHP_FALLBACK_CAP = self::SIGNAL_PHP_FALLBACK_CAP; /** * True when the most recent `prepare_items_signal_view()` call * fetched exactly the cap and at least one more candidate existed * beyond it. Read by `extra_tablenav()` to render the truncation * notice. Reset to false on every `prepare_items()` call so a * later page load (search cleared, cap no longer hit) doesn't * carry the notice forward. * * @var bool */ private $signal_view_truncated = false; /** * Signal-backed view: PHP-sliced page over the latest scan's * candidate set, filtered to the given signal type. Loads every * candidate row of that signal for the run, applies search + sort, * then slices for the visible page. Acceptable here because * per-signal candidate counts are bounded (~100s, not 100k+) — * and for pathological stores, capped at * `SIGNAL_PHP_FALLBACK_CAP` with an in-table notice pointing the * merchant at search/filter to narrow the set. * * @param string $signal_type One of the `CandidateStore::SIGNAL_TYPE_*` * constants. */ private function prepare_items_signal_view(string $signal_type): void { } /** * All view: SQL-paginated query against every subscription in * the store via `wcs_get_subscriptions`. Sort + pagination push * down to SQL so memory stays bounded regardless of store size. * * Per-row data not stored on the candidate row (latest renewal * status, prior auto-renewal id used for Last successful payment) * is computed live in the renderers — see * `render_renewal_order_status` and `render_last_payment` for the * fallback path. * * Search support is intentionally narrow on this view: a numeric * search term is treated as a subscription id lookup (cheap + * correct); free-text email search is not supported here because * `wcs_get_subscriptions` has no native text index. Merchants who * need email search should use the Supports auto-renewal view (which already * supports it via PHP filtering over a small dataset) or the * standard WC subscriptions list page. */ private function prepare_items_all_view(): void { } /** * Map the user-selected orderby column to a value * `wcs_get_subscriptions` understands. Columns the upstream * function can't sort on directly fall back to `start_date` — * the same default the function uses when no orderby is provided. * * Next-payment sort on the All view: `wcs_get_subscriptions` * doesn't expose a dedicated orderby for `_schedule_next_payment`, * and wiring a `meta_value` sort would mean bypassing the function * and hand-building the HPOS-vs-CPT query. Out of scope for v1; * falls back to ID order on the All view. The Supports auto-renewal * + Missing renewals views keep real next-payment sort via `php_sort_items()` because * their row count is bounded. * * @return string */ private function all_view_orderby(): string { } /** * Render a single cell. Public so tests can exercise the column * formatters directly. * * @param array $item Candidate row. * @param string $column_name Column slug. * * @return string */ public function render_column(array $item, string $column_name): string { } /** * Created-date cell — subscription creation date formatted in the * store's date format. Live-looked up on every render; no Detector * stash, since `WC_Subscription::get_date_created()` is cheap after * `load_subscription()` caches the object. * * @param int $subscription_id * * @return string */ private function render_created(int $subscription_id): string { } /** * WP_List_Table's default cell dispatch. * * @param array $item * @param string $column_name * * @return string */ protected function column_default($item, $column_name) { } /** * Empty-state copy. Two states — see F1-polish commit for the * rationale behind two-state messaging (unscanned vs zero). * * @return void */ public function no_items(): void { } // // ───── Column renderers ────────────────────────────────────────────── // private function render_subscription_link(int $subscription_id): string { } /** * Render the Customer cell. Shows the billing name (with fallbacks * via resolve_customer_name()) linked to the customer's WP user * edit screen — the same pattern the WCS Subscriptions list uses in * class-wcs-admin-post-types.php. For guest subscriptions * (no customer user id) the name renders as plain text with no * link. Email was retired from the visible column in a copy * review; the search filter still matches on billing email via * row_matches_search(). * * @param int $subscription_id Subscription row id. * * @return string */ private function render_customer(int $subscription_id): string { } /** * Resolve a display-friendly customer name. Prefers the * subscription's billing first/last fields (entered at checkout); * when those are empty — common on fixtures, imported subs, or * subscriptions created via the API — falls back to the WP user * profile's first/last, then the user's display_name. Returns an * empty string when no source has a name. * * @param WC_Subscription $subscription * * @return string */ private function resolve_customer_name(\WC_Subscription $subscription): string { } private function render_status(int $subscription_id): string { } /** * Renewal preference pill — Default / Opted out. * * Reads from the `renewal_preference` value the Detector stashes in * `details_json` during a scan (`'opted_out'` / `'re_enabled'` / * null). The pill surfaces: * * - `'opted_out'` → **Opted out** (amber warning chrome) * - anything else (`'re_enabled'`, null, or missing) → **Default** * (neutral chrome). A re-enable note means the subscriber chose * auto at some point and the sub has since reverted to manual * via some other path — reads as Default from the merchant's * perspective (no explicit opt-out on record here). * * The filter scope already guarantees every row is manual with an * eligible payment method, so there's no meaningful "Automatic" * value on this column — every row IS manual by the filter * definition. The only question the pill answers is "was manual * the default, or did someone explicitly opt out?" * * @param array $details Pre-stashed details payload. * * @return string */ private function render_renewal_preference(array $details): string { } /** * Render the Billing mode cell. * * Manual rows in the Supports auto-renewal view (rows whose `signals` * include `has_token`) are prefixed with a warning-triangle tooltip: * the merchant has confirmed evidence the customer has a payment * method on file, so leaving the subscription in manual renewal is * very likely a misconfiguration. Manual rows surfaced via other * signals (e.g. Missing renewals) skip the warning because we don't * have token-on-file evidence for those. * * @param int $subscription_id Subscription id. * @param string[] $signals Per-row signal flags from the Detector * (e.g. `['has_token']` on the * Supports-auto-renewal pipeline). * * @return string */ private function render_billing_mode(int $subscription_id, array $signals = array()): string { } /** * Render the Cycle cell — billing period + interval combined into * a single human-readable label. * * Interval = 1 collapses to the period-specific adjective * ("Daily" / "Weekly" / "Monthly" / "Yearly"); interval > 1 takes * the "Every N {period-plural}" form. Matches the Figma mockup * — the default WCS "every 2nd month" strings from * `wcs_get_subscription_period_interval_strings()` read more * awkwardly in this dense table context. * * Not sortable: "Every 2 months" has no natural ordering vs * "Every 3 weeks", so any sort key would encode a product * decision the merchant didn't ask us to make. * * @param array $details Pre-stashed details payload. * @param int $subscription_id Live-lookup fallback target. * * @return string */ private function render_cycle(array $details, int $subscription_id): string { } /** * Format a billing period + interval pair into the UI label. * * Broken out of `render_cycle()` so tests can assert the mapping * without needing to construct a real subscription, and so the * Missing-renewal classifier could reuse the same formatter for * stash-time display strings later. * * @param string $period 'day' | 'week' | 'month' | 'year'. * @param int $interval Billing interval (≥ 1). * * @return string Empty string for unrecognised periods. */ public static function format_cycle_label(string $period, int $interval): string { } private function render_payment_method(int $subscription_id): string { } /** * Render the Next payment date cell. * * Sources the timestamp from the candidate row's details payload * when available (Missing-renewal classifier stashes * `next_payment_timestamp`); falls back to a live * `WC_Subscription::get_time('next_payment')` lookup for All-view * rows and Supports-auto-renewal rows (whose classifier doesn't * stash the timestamp — it's not part of that signal's decision). * * Rendering: * - Missing: em dash — the Missing-renewal signal means "no next * payment date exists"; the tab context already communicates why. * - Past-due: formatted date on line 1, "N ago" on line 2 in * the same amber pill chrome. * - Upcoming: formatted date on line 1, "in N" on line 2 in * the neutral `.woocommerce-subscriptions-health-check-next-payment-future` * wrapper. * * @param array $details Pre-stashed details payload. * @param int $subscription_id Live-lookup fallback target. * * @return string */ private function render_next_payment(array $details, int $subscription_id): string { } /** * Renewal-order-status pill. Supports-auto-renewal-view rows carry the status * pre-stashed in `details.latest_renewal_status` by the Detector; * All-view rows have no details payload, so we fall back to a * live `WC_Subscription::get_related_orders('renewal')` lookup. * * Uses the same `mark.order-status.status-{slug}` pill chrome as * the subscription Status column so the visual language is shared. * * @param array $details Pre-stashed details payload. * Empty array on All-view rows. * @param int $subscription_id Live-lookup fallback target. * * @return string */ private function render_renewal_order_status(array $details, int $subscription_id): string { } /** * Last successful payment cell — live-looked up from the subscription * on every render, mirroring the Detector's pre-broadening "most * recent completed/processing renewal with a non-empty payment method" * logic, falling back to a qualifying parent order if the sub has no * renewal history. * * `$details` is kept on the signature for future use (a cached value * could be surfaced via `details_json` in a later iteration), but is * currently unused. * * @param array $details Unused (kept for signature symmetry with other column renderers). * @param int $subscription_id Subscription to resolve the payment from. * * @return string */ private function render_last_payment(array $details, int $subscription_id): string { } /** * Live lookup for the latest renewal order's status — All-view * fallback when details_json doesn't carry the pre-stashed value. * `WC_Subscription::get_related_orders('all','renewal')` returns * the renewal orders most-recent-first (it `arsort()`s the * id-keyed map internally), so the first WC_Order entry is the * latest. The Detector encodes the same selection during scans * via the prefetch path's `(date_gmt DESC, id DESC)` comparison; * this method is the live equivalent for unscanned rows. * * @param int $subscription_id * * @return string Empty string when no renewal exists. */ private function lookup_latest_renewal_status(int $subscription_id): string { } /** * Live lookup for the most recent successful auto-renewal id — * All-view fallback for the Last successful payment column. * Filter shape: status in {completed, processing} AND non-empty * payment method. The "non-empty payment method" guard * distinguishes a genuinely-charged renewal from a manual-mode * placeholder that WCS sometimes leaves with no method id. * * @param int $subscription_id * * @return int 0 when no qualifying renewal exists. */ private function lookup_prior_auto_renewal_id(int $subscription_id): int { } /** * Live lookup for the parent-order payment id — All-view fallback for * the Last successful payment column when no renewal evidence exists * (silent-from-birth victims). Filter shape: parent in * {completed, processing} AND non-empty payment method. The gateway- * supports-subscriptions check is intentionally omitted here — the * UI is visualising an historical charge, not re-running the * detection pipeline, so listing a completed parent payment that * happened on a now-non-auto gateway is still informative. * * @param int $subscription_id * * @return int 0 when no qualifying parent exists. */ private function lookup_prior_parent_payment_id(int $subscription_id): int { } // // ───── Sort + search ───────────────────────────────────────────────── // private function current_orderby(): string { } private function current_order(): string { } private function current_search_term(): string { } private function row_matches_search(array $row, string $search): bool { } /** * Currently-active top-bar filters, sanitized and allowlisted. * * Any missing or out-of-allowlist query arg comes back as an empty * string so downstream callers can use a simple `'' === $value` * check. * * @return array{status:string, billing_mode:string, renewal_order_status:string, renewal_preference:string} */ private function current_filters(): array { } /** * Read a filter query-arg and gate it against the provided allowlist. * * @param string $key Query-arg key. * @param array $allowed Allowlisted values. * * @return string Empty string when missing or not in the allowlist. */ private function read_filter(string $key, array $allowed): string { } /** * @param array{status:string, billing_mode:string, renewal_order_status:string, renewal_preference:string} $filters */ private function has_active_filters(array $filters): bool { } /** * Does this candidate row match every active filter? Missing keys * (e.g. a row with no stashed `renewal_preference`) fail the match * when the user has asked for a specific value — nothing surfaces * without positive evidence. * * Status + billing mode are read from the live subscription, not * the stashed row — a merchant may have changed either after the * last scan. * * @param array $row * @param array{status:string, billing_mode:string, renewal_order_status:string, renewal_preference:string} $filters */ private function row_matches_filters(array $row, array $filters): bool { } /** * Subscription statuses merchants can filter on. Matches the set * WooCommerce Subscriptions considers active/live (not trash or * auto-draft). Includes historical statuses (cancelled / expired) * so a merchant can page through past subs as well. * * @return array */ private function allowed_status_values(): array { } /** * Billing-mode dropdown values. Two options — automatic (token- * billed) and manual. Candidate rows expose the live mode via * `WC_Subscription::is_manual()` so the filter works uniformly on * every view. * * @return array */ private function allowed_billing_mode_values(): array { } /** * WC order statuses the renewal_order_status filter can match. * Mirrors the options WooCommerce renders on the Orders list. * * @return array */ private function allowed_renewal_order_status_values(): array { } /** * Renewal preference values currently rendered by the Renewal * preference pill. 'default' is not a stored value — "no stored * opt-out note" reads as default — so the dropdown exposes both * `opted_out` and `default` as filterable cases. * * @return array */ private function allowed_renewal_preference_values(): array { } /** * Render the top-of-table filter bar. Standard WP_List_Table hook — * `$which` is `'top'` or `'bottom'`. We render controls only above * the table, mirroring the WC Products / Orders list convention. * * Filter scope caveat: `renewal_order_status` and `renewal_preference` * dropdowns read from per-row details stashed on the candidate row. * On the All view those details are not populated (rows come from * `wcs_get_subscriptions`, not the candidate store), so only the * Status filter has an effect there. * * @param string $which 'top' or 'bottom'. */ protected function extra_tablenav($which): void { } /** * Two responsibilities, both keyed off the tablenav position: * * - Render the truncation notice between the top tablenav and the * table itself. `extra_tablenav()` would have placed it inside * `.tablenav.top` next to the float-left filter controls, where * a non-floated block doesn't clear and overlaps the headers * below. Emitting after the parent's top tablenav lands the * notice as a clean sibling of the tablenav. * * - Bracket the `` with `.wcs-health-check-candidates-scroll`, * a horizontally-scrollable wrapper. WP core's `display()` calls * this method around the table, so opening the wrapper after the * top tablenav and closing it before the bottom tablenav keeps * the views / search / pagination chrome at full content width * while only the data area scrolls. * * @param string $which 'top' or 'bottom'. */ protected function display_tablenav($which) { } /** * Render a "showing first N" notice when a candidate-backed view * (Supports auto-renewal / Missing renewals) capped the fallback PHP fetch. * Kept in the table header so merchants see the cap before they * scroll an incomplete list wondering where the rest of their * candidates went. */ private function maybe_render_truncation_notice(): void { } /** * Render a single filter `