Plugin Directory

Changeset 3415062


Ignore:
Timestamp:
12/09/2025 08:29:31 AM (4 months ago)
Author:
aushamim
Message:

Update to version 1.8.10 from GitHub

Location:
subscription
Files:
2 deleted
14 edited
1 copied

Legend:

Unmodified
Added
Removed
  • subscription/tags/1.8.10/changelog.txt

    r3413403 r3415062  
    11*** WPSubscription Changelog ***
     2
     32025-12-09 - version 1.8.10
     4* new: Added beta badge in the integrations list.
     5* fix: Subscription switch action.
     6* fix: Core helper methods.
    27
    382025-12-07 - version 1.8.9
  • subscription/tags/1.8.10/includes/Admin/Integrations.php

    r3413403 r3415062  
    114114     *
    115115     * @param string $gateway_id Gateway ID.
     116     * @param bool   $partial_match Whether to allow partial match of gateway ID.
    116117     * @return bool
    117118     */
    118     protected function is_gateway_installed( $gateway_id ) {
     119    public static function is_gateway_installed( $gateway_id, $partial_match = false ) {
    119120        $installed_gateways = WC()->payment_gateways()->payment_gateways();
     121
     122        // Partial match check. For gateways with dynamic IDs.
     123        if ( $partial_match ) {
     124            foreach ( $installed_gateways as $key => $gateway ) {
     125                if ( strpos( $key, $gateway_id ) !== false ) {
     126                    return true;
     127                }
     128            }
     129            return false;
     130        }
     131
    120132        return isset( $installed_gateways[ $gateway_id ] );
    121133    }
     
    125137     *
    126138     * @param string $gateway_id Gateway ID.
     139     * @param bool   $partial_match Whether to allow partial match of gateway ID.
    127140     * @return bool
    128141     */
    129     protected function is_gateway_enabled( $gateway_id ) {
     142    public static function is_gateway_enabled( $gateway_id, $partial_match = false ) {
    130143        $installed_gateways = WC()->payment_gateways()->payment_gateways();
     144
     145        // Partial match check. For gateways with dynamic IDs.
     146        if ( $partial_match ) {
     147            foreach ( $installed_gateways as $key => $gateway ) {
     148                if ( strpos( $key, $gateway_id ) !== false ) {
     149                    return $gateway->is_available();
     150                }
     151            }
     152            return false;
     153        }
     154
    131155        if ( ! isset( $installed_gateways[ $gateway_id ] ) ) {
    132156            return false;
     
    183207                'icon_url'           => WP_SUBSCRIPTION_ASSETS . '/images/paypal.svg',
    184208                'is_installed'       => 'on' === get_option( 'wp_subs_paypal_integration_enabled', 'off' ),
    185                 'is_active'          => $this->is_gateway_enabled( 'wp_subscription_paypal' ),
     209                'is_active'          => self::is_gateway_enabled( 'wp_subscription_paypal' ),
    186210                'supports_recurring' => true,
    187211                'actions'            => [
     
    212236                'icon_url'           => 'https://ps.w.org/woocommerce-gateway-stripe/assets/icon-256x256.png',
    213237                'is_installed'       => class_exists( 'WC_Stripe' ),
    214                 'is_active'          => $this->is_gateway_enabled( 'stripe' ),
     238                'is_active'          => self::is_gateway_enabled( 'stripe' ),
    215239                'supports_recurring' => true,
    216240                'actions'            => [
     
    234258                'icon_url'           => WP_SUBSCRIPTION_ASSETS . '/images/paddle.svg',
    235259                'is_installed'       => class_exists( 'SmartPayWoo\Gateways\Paddle\SmartPay_Paddle' ),
    236                 'is_active'          => $this->is_gateway_enabled( 'smartpay_paddle' ),
     260                'is_active'          => self::is_gateway_enabled( 'smartpay_paddle' ),
    237261                'supports_recurring' => true,
    238262                'actions'            => [
  • subscription/tags/1.8.10/includes/Frontend/Checkout.php

    r3399395 r3415062  
    1919     */
    2020    public function __construct() {
     21        // Subscription upgrade/downgrade order created hook.
     22        add_action( 'woocommerce_checkout_order_processed', [ $this, 'trigger_subscription_switch_order_created' ] );
     23        add_action( 'woocommerce_store_api_checkout_order_processed', [ $this, 'trigger_subscription_switch_order_created_storeapi' ] );
     24
    2125        add_action( 'woocommerce_checkout_order_processed', [ $this, 'create_subscription_after_checkout' ] );
    2226        add_action( 'woocommerce_store_api_checkout_order_processed', [ $this, 'create_subscription_after_checkout_storeapi' ] );
     
    317321        }
    318322    }
     323
     324    /**
     325     * Trigger subscription switch order created store API.
     326     *
     327     * @param \WC_Order $order Order.
     328     */
     329    public function trigger_subscription_switch_order_created_storeapi( $order ) {
     330        $this->trigger_subscription_switch_order_created( $order->get_id() ?? 0 );
     331    }
     332
     333    /**
     334     * Trigger subscription switch order created.
     335     *
     336     * @param int $order_id Order ID.
     337     */
     338    public function trigger_subscription_switch_order_created( $order_id ) {
     339        if ( ! $order_id || ! subscrpt_pro_activated() ) {
     340            return;
     341        }
     342
     343        $order       = wc_get_order( $order_id );
     344        $order_items = $order->get_items();
     345
     346        foreach ( $order_items as $order_item ) {
     347            $is_switch      = in_array( $order_item->get_meta( '_wp_subs_switch' ), [ true, 1, '1' ], true );
     348            $switch_context = $order_item->get_meta( '_wp_subs_switch_context' );
     349
     350            if ( $is_switch ) {
     351                $switch_type = $switch_context['switch_type'] ?? 'upgrade';
     352
     353                unset( $switch_context['nonce'] );
     354                unset( $switch_context['redirect_back_url'] );
     355
     356                /**
     357                 * Action fired when subscription switch order is created.
     358                 *
     359                 * @param string    $switch_type    Switch type (upgrade/downgrade).
     360                 * @param \WC_Order $order          Order object.
     361                 * @param \WC_Order_Item_Product $order_item Order Item object.
     362                 * @param array     $switch_context Switch context data. [ 'switch_type', 'subscription_id', 'order_id', 'product_id', 'old_variation_id', 'new_variation_id' ]
     363                 */
     364                do_action( 'subscrpt_switch_order_created', $switch_type, $order, $order_item, $switch_context );
     365            }
     366        }
     367    }
    319368}
  • subscription/tags/1.8.10/includes/Illuminate/Helper.php

    r3413403 r3415062  
    564564        if ( subscrpt_is_max_payments_reached( $subscription_id ) ) {
    565565            // Mark subscription as expired due to limit reached
    566             wp_update_post(
    567                 array(
    568                     'ID'          => $subscription_id,
    569                     'post_status' => 'expired',
    570                 )
    571             );
     566            Action::status( 'expired', $subscription_id );
    572567
    573568            error_log( "WPS: Maximum payment limit reached for subscription #{$subscription_id}. No renewal order created." );
     
    634629
    635630        do_action( 'subscrpt_after_create_renew_order', $new_order, $old_order, $subscription_id, false );
     631
     632        return $new_order;
     633    }
     634
     635    /**
     636     * Get subscription total price.
     637     *
     638     * @param int $subscription_id Subscription ID.
     639     * @return float
     640     */
     641    public static function get_subscription_total( $subscription_id ) {
     642        return (float) get_post_meta( $subscription_id, '_subscrpt_price', true );
     643    }
     644
     645    /**
     646     * Get subscription status.
     647     *
     648     * @param int $subscription_id Subscription ID.
     649     * @return string
     650     */
     651    public static function get_subscription_status( $subscription_id ) {
     652        return get_post_status( $subscription_id );
     653    }
     654
     655    /**
     656     * Check if subscription has status.
     657     *
     658     * @param int    $subscription_id Subscription ID.
     659     * @param string $status Status to check.
     660     * @return bool
     661     */
     662    public static function subscription_has_status( $subscription_id, $status ) {
     663        return self::get_subscription_status( $subscription_id ) === $status;
     664    }
     665
     666    /**
     667     * Check if subscription needs payment.
     668     *
     669     * @param int $subscription_id Subscription ID.
     670     * @return bool
     671     */
     672    public static function subscription_needs_payment( $subscription_id ) {
     673        return true; // Always true for now
     674    }
     675
     676    /**
     677     * Get product period (timing option).
     678     *
     679     * @param int $product_id Product ID.
     680     * @return string
     681     */
     682    public static function get_product_period( $product_id ) {
     683        $product = wc_get_product( $product_id );
     684        return $product ? $product->get_meta( '_subscrpt_timing_option' ) : '';
     685    }
     686
     687    /**
     688     * Get product interval (timing per).
     689     *
     690     * @param int $product_id Product ID.
     691     * @return int
     692     */
     693    public static function get_product_interval( $product_id ) {
     694        $product = wc_get_product( $product_id );
     695        return $product ? (int) $product->get_meta( '_subscrpt_timing_per' ) : 1;
     696    }
     697
     698    /**
     699     * Get product length (max payments).
     700     *
     701     * @param int $product_id Product ID.
     702     * @return int
     703     */
     704    public static function get_product_length( $product_id ) {
     705        $product = wc_get_product( $product_id );
     706        return $product ? (int) $product->get_meta( '_subscrpt_max_no_payment' ) : 0;
     707    }
     708
     709    /**
     710     * Get product trial length.
     711     *
     712     * @param int $product_id Product ID.
     713     * @return int
     714     */
     715    public static function get_product_trial_length( $product_id ) {
     716        $product = wc_get_product( $product_id );
     717        return $product ? (int) $product->get_meta( '_subscrpt_trial_timing_per' ) : 0;
     718    }
     719
     720    /**
     721     * Get product signup fee.
     722     *
     723     * @param int $product_id Product ID.
     724     * @return float
     725     */
     726    public static function get_product_signup_fee( $product_id ) {
     727        $product = wc_get_product( $product_id );
     728        return $product ? (float) $product->get_meta( '_subscrpt_signup_fee' ) : 0.0;
     729    }
     730
     731    /**
     732     * Get first renewal payment time.
     733     *
     734     * @param int $product_id Product ID.
     735     * @return int Timestamp
     736     */
     737    public static function get_first_renewal_payment_time( $product_id ) {
     738        $product = wc_get_product( $product_id );
     739        if ( ! $product ) {
     740            return 0;
     741        }
     742
     743        $trial_period = $product->get_meta( '_subscrpt_trial_timing_per' );
     744        $trial_option = $product->get_meta( '_subscrpt_trial_timing_option' );
     745
     746        if ( ! empty( $trial_period ) && ! empty( $trial_option ) ) {
     747            return strtotime( "+{$trial_period} {$trial_option}" );
     748        }
     749
     750        return 0;
     751    }
     752
     753    /**
     754     * Update subscription next payment date.
     755     *
     756     * @param int    $subscription_id Subscription ID.
     757     * @param string $new_date New Date string.
     758     * @return void
     759     */
     760    public static function update_subscription_next_payment_date( $subscription_id, $new_date ) {
     761        update_post_meta( $subscription_id, '_subscrpt_next_date', strtotime( $new_date ) );
     762    }
     763
     764    /**
     765     * Cancel subscription.
     766     *
     767     * @param int $subscription_id Subscription ID.
     768     * @return void
     769     */
     770    public static function cancel_subscription( $subscription_id ) {
     771        Action::status( 'cancelled', $subscription_id );
     772    }
     773
     774    /**
     775     * Pause subscription.
     776     *
     777     * @param int $subscription_id Subscription ID.
     778     * @return void
     779     */
     780    public static function pause_subscription( $subscription_id ) {
     781        Action::status( 'on-hold', $subscription_id );
     782    }
     783
     784    /**
     785     * Resume subscription.
     786     *
     787     * @param int $subscription_id Subscription ID.
     788     * @return void
     789     */
     790    public static function resume_subscription( $subscription_id ) {
     791        Action::status( 'active', $subscription_id );
     792    }
     793
     794    /**
     795     * Mark subscription payment as complete.
     796     *
     797     * @param int    $subscription_id Subscription ID.
     798     * @param string $payment_id Payment/Transaction ID.
     799     * @return void
     800     */
     801    public static function subscription_payment_complete( $subscription_id, $payment_id ) {
     802        if ( 'active' !== get_post_status( $subscription_id ) ) {
     803            Action::status( 'active', $subscription_id );
     804        }
     805
     806        // Allow payment gateways to add their own comments/notes
     807        do_action( 'subscrpt_subscription_payment_completed', $subscription_id, $payment_id );
    636808    }
    637809
  • subscription/tags/1.8.10/languages/wp_subscription.pot

    r3413403 r3415062  
    1010"Content-Type: text/plain; charset=UTF-8\n"
    1111"Content-Transfer-Encoding: 8bit\n"
    12 "POT-Creation-Date: 2025-12-07T08:44:18+00:00\n"
     12"POT-Creation-Date: 2025-12-09T08:24:31+00:00\n"
    1313"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
    1414"X-Generator: WP-CLI 2.12.0\n"
     
    14881488msgstr ""
    14891489
    1490 #: includes/Illuminate/Helper.php:924
     1490#: includes/Illuminate/Helper.php:1096
    14911491msgid "Subscription renewal isn't possible due to previous order not completed or deletion."
    14921492msgstr ""
  • subscription/tags/1.8.10/subscription.php

    r3413403 r3415062  
    77 * Description: WPSubscription allow WooCommerce to enables recurring payments, subscriptions, and auto-renewals for digital and physical products. Supports Stripe, PayPal, Paddle, and more.
    88 *
    9  * Version: 1.8.9
     9 * Version: 1.8.10
    1010 *
    1111 * Author: ConversWP
     
    5151     * @var string
    5252     */
    53     const version = '1.8.9';
     53    const version = '1.8.10';
    5454
    5555    /**
  • subscription/tags/1.8.10/vendor/composer/installed.php

    r3413403 r3415062  
    22    'root' => array(
    33        'name' => 'converswp/subscription',
    4         'pretty_version' => '1.8.9',
    5         'version' => '1.8.9.0',
    6         'reference' => '6ef770f3fb9e19d8f07a1853a1c2b571093a3dc8',
     4        'pretty_version' => '1.8.10',
     5        'version' => '1.8.10.0',
     6        'reference' => '4fe49d4b2b7f0c2436a0e6fff49949240485f685',
    77        'type' => 'wordpress-plugin',
    88        'install_path' => __DIR__ . '/../../',
     
    1212    'versions' => array(
    1313        'converswp/subscription' => array(
    14             'pretty_version' => '1.8.9',
    15             'version' => '1.8.9.0',
    16             'reference' => '6ef770f3fb9e19d8f07a1853a1c2b571093a3dc8',
     14            'pretty_version' => '1.8.10',
     15            'version' => '1.8.10.0',
     16            'reference' => '4fe49d4b2b7f0c2436a0e6fff49949240485f685',
    1717            'type' => 'wordpress-plugin',
    1818            'install_path' => __DIR__ . '/../../',
  • subscription/trunk/changelog.txt

    r3413403 r3415062  
    11*** WPSubscription Changelog ***
     2
     32025-12-09 - version 1.8.10
     4* new: Added beta badge in the integrations list.
     5* fix: Subscription switch action.
     6* fix: Core helper methods.
    27
    382025-12-07 - version 1.8.9
  • subscription/trunk/includes/Admin/Integrations.php

    r3413403 r3415062  
    114114     *
    115115     * @param string $gateway_id Gateway ID.
     116     * @param bool   $partial_match Whether to allow partial match of gateway ID.
    116117     * @return bool
    117118     */
    118     protected function is_gateway_installed( $gateway_id ) {
     119    public static function is_gateway_installed( $gateway_id, $partial_match = false ) {
    119120        $installed_gateways = WC()->payment_gateways()->payment_gateways();
     121
     122        // Partial match check. For gateways with dynamic IDs.
     123        if ( $partial_match ) {
     124            foreach ( $installed_gateways as $key => $gateway ) {
     125                if ( strpos( $key, $gateway_id ) !== false ) {
     126                    return true;
     127                }
     128            }
     129            return false;
     130        }
     131
    120132        return isset( $installed_gateways[ $gateway_id ] );
    121133    }
     
    125137     *
    126138     * @param string $gateway_id Gateway ID.
     139     * @param bool   $partial_match Whether to allow partial match of gateway ID.
    127140     * @return bool
    128141     */
    129     protected function is_gateway_enabled( $gateway_id ) {
     142    public static function is_gateway_enabled( $gateway_id, $partial_match = false ) {
    130143        $installed_gateways = WC()->payment_gateways()->payment_gateways();
     144
     145        // Partial match check. For gateways with dynamic IDs.
     146        if ( $partial_match ) {
     147            foreach ( $installed_gateways as $key => $gateway ) {
     148                if ( strpos( $key, $gateway_id ) !== false ) {
     149                    return $gateway->is_available();
     150                }
     151            }
     152            return false;
     153        }
     154
    131155        if ( ! isset( $installed_gateways[ $gateway_id ] ) ) {
    132156            return false;
     
    183207                'icon_url'           => WP_SUBSCRIPTION_ASSETS . '/images/paypal.svg',
    184208                'is_installed'       => 'on' === get_option( 'wp_subs_paypal_integration_enabled', 'off' ),
    185                 'is_active'          => $this->is_gateway_enabled( 'wp_subscription_paypal' ),
     209                'is_active'          => self::is_gateway_enabled( 'wp_subscription_paypal' ),
    186210                'supports_recurring' => true,
    187211                'actions'            => [
     
    212236                'icon_url'           => 'https://ps.w.org/woocommerce-gateway-stripe/assets/icon-256x256.png',
    213237                'is_installed'       => class_exists( 'WC_Stripe' ),
    214                 'is_active'          => $this->is_gateway_enabled( 'stripe' ),
     238                'is_active'          => self::is_gateway_enabled( 'stripe' ),
    215239                'supports_recurring' => true,
    216240                'actions'            => [
     
    234258                'icon_url'           => WP_SUBSCRIPTION_ASSETS . '/images/paddle.svg',
    235259                'is_installed'       => class_exists( 'SmartPayWoo\Gateways\Paddle\SmartPay_Paddle' ),
    236                 'is_active'          => $this->is_gateway_enabled( 'smartpay_paddle' ),
     260                'is_active'          => self::is_gateway_enabled( 'smartpay_paddle' ),
    237261                'supports_recurring' => true,
    238262                'actions'            => [
  • subscription/trunk/includes/Frontend/Checkout.php

    r3399395 r3415062  
    1919     */
    2020    public function __construct() {
     21        // Subscription upgrade/downgrade order created hook.
     22        add_action( 'woocommerce_checkout_order_processed', [ $this, 'trigger_subscription_switch_order_created' ] );
     23        add_action( 'woocommerce_store_api_checkout_order_processed', [ $this, 'trigger_subscription_switch_order_created_storeapi' ] );
     24
    2125        add_action( 'woocommerce_checkout_order_processed', [ $this, 'create_subscription_after_checkout' ] );
    2226        add_action( 'woocommerce_store_api_checkout_order_processed', [ $this, 'create_subscription_after_checkout_storeapi' ] );
     
    317321        }
    318322    }
     323
     324    /**
     325     * Trigger subscription switch order created store API.
     326     *
     327     * @param \WC_Order $order Order.
     328     */
     329    public function trigger_subscription_switch_order_created_storeapi( $order ) {
     330        $this->trigger_subscription_switch_order_created( $order->get_id() ?? 0 );
     331    }
     332
     333    /**
     334     * Trigger subscription switch order created.
     335     *
     336     * @param int $order_id Order ID.
     337     */
     338    public function trigger_subscription_switch_order_created( $order_id ) {
     339        if ( ! $order_id || ! subscrpt_pro_activated() ) {
     340            return;
     341        }
     342
     343        $order       = wc_get_order( $order_id );
     344        $order_items = $order->get_items();
     345
     346        foreach ( $order_items as $order_item ) {
     347            $is_switch      = in_array( $order_item->get_meta( '_wp_subs_switch' ), [ true, 1, '1' ], true );
     348            $switch_context = $order_item->get_meta( '_wp_subs_switch_context' );
     349
     350            if ( $is_switch ) {
     351                $switch_type = $switch_context['switch_type'] ?? 'upgrade';
     352
     353                unset( $switch_context['nonce'] );
     354                unset( $switch_context['redirect_back_url'] );
     355
     356                /**
     357                 * Action fired when subscription switch order is created.
     358                 *
     359                 * @param string    $switch_type    Switch type (upgrade/downgrade).
     360                 * @param \WC_Order $order          Order object.
     361                 * @param \WC_Order_Item_Product $order_item Order Item object.
     362                 * @param array     $switch_context Switch context data. [ 'switch_type', 'subscription_id', 'order_id', 'product_id', 'old_variation_id', 'new_variation_id' ]
     363                 */
     364                do_action( 'subscrpt_switch_order_created', $switch_type, $order, $order_item, $switch_context );
     365            }
     366        }
     367    }
    319368}
  • subscription/trunk/includes/Illuminate/Helper.php

    r3413403 r3415062  
    564564        if ( subscrpt_is_max_payments_reached( $subscription_id ) ) {
    565565            // Mark subscription as expired due to limit reached
    566             wp_update_post(
    567                 array(
    568                     'ID'          => $subscription_id,
    569                     'post_status' => 'expired',
    570                 )
    571             );
     566            Action::status( 'expired', $subscription_id );
    572567
    573568            error_log( "WPS: Maximum payment limit reached for subscription #{$subscription_id}. No renewal order created." );
     
    634629
    635630        do_action( 'subscrpt_after_create_renew_order', $new_order, $old_order, $subscription_id, false );
     631
     632        return $new_order;
     633    }
     634
     635    /**
     636     * Get subscription total price.
     637     *
     638     * @param int $subscription_id Subscription ID.
     639     * @return float
     640     */
     641    public static function get_subscription_total( $subscription_id ) {
     642        return (float) get_post_meta( $subscription_id, '_subscrpt_price', true );
     643    }
     644
     645    /**
     646     * Get subscription status.
     647     *
     648     * @param int $subscription_id Subscription ID.
     649     * @return string
     650     */
     651    public static function get_subscription_status( $subscription_id ) {
     652        return get_post_status( $subscription_id );
     653    }
     654
     655    /**
     656     * Check if subscription has status.
     657     *
     658     * @param int    $subscription_id Subscription ID.
     659     * @param string $status Status to check.
     660     * @return bool
     661     */
     662    public static function subscription_has_status( $subscription_id, $status ) {
     663        return self::get_subscription_status( $subscription_id ) === $status;
     664    }
     665
     666    /**
     667     * Check if subscription needs payment.
     668     *
     669     * @param int $subscription_id Subscription ID.
     670     * @return bool
     671     */
     672    public static function subscription_needs_payment( $subscription_id ) {
     673        return true; // Always true for now
     674    }
     675
     676    /**
     677     * Get product period (timing option).
     678     *
     679     * @param int $product_id Product ID.
     680     * @return string
     681     */
     682    public static function get_product_period( $product_id ) {
     683        $product = wc_get_product( $product_id );
     684        return $product ? $product->get_meta( '_subscrpt_timing_option' ) : '';
     685    }
     686
     687    /**
     688     * Get product interval (timing per).
     689     *
     690     * @param int $product_id Product ID.
     691     * @return int
     692     */
     693    public static function get_product_interval( $product_id ) {
     694        $product = wc_get_product( $product_id );
     695        return $product ? (int) $product->get_meta( '_subscrpt_timing_per' ) : 1;
     696    }
     697
     698    /**
     699     * Get product length (max payments).
     700     *
     701     * @param int $product_id Product ID.
     702     * @return int
     703     */
     704    public static function get_product_length( $product_id ) {
     705        $product = wc_get_product( $product_id );
     706        return $product ? (int) $product->get_meta( '_subscrpt_max_no_payment' ) : 0;
     707    }
     708
     709    /**
     710     * Get product trial length.
     711     *
     712     * @param int $product_id Product ID.
     713     * @return int
     714     */
     715    public static function get_product_trial_length( $product_id ) {
     716        $product = wc_get_product( $product_id );
     717        return $product ? (int) $product->get_meta( '_subscrpt_trial_timing_per' ) : 0;
     718    }
     719
     720    /**
     721     * Get product signup fee.
     722     *
     723     * @param int $product_id Product ID.
     724     * @return float
     725     */
     726    public static function get_product_signup_fee( $product_id ) {
     727        $product = wc_get_product( $product_id );
     728        return $product ? (float) $product->get_meta( '_subscrpt_signup_fee' ) : 0.0;
     729    }
     730
     731    /**
     732     * Get first renewal payment time.
     733     *
     734     * @param int $product_id Product ID.
     735     * @return int Timestamp
     736     */
     737    public static function get_first_renewal_payment_time( $product_id ) {
     738        $product = wc_get_product( $product_id );
     739        if ( ! $product ) {
     740            return 0;
     741        }
     742
     743        $trial_period = $product->get_meta( '_subscrpt_trial_timing_per' );
     744        $trial_option = $product->get_meta( '_subscrpt_trial_timing_option' );
     745
     746        if ( ! empty( $trial_period ) && ! empty( $trial_option ) ) {
     747            return strtotime( "+{$trial_period} {$trial_option}" );
     748        }
     749
     750        return 0;
     751    }
     752
     753    /**
     754     * Update subscription next payment date.
     755     *
     756     * @param int    $subscription_id Subscription ID.
     757     * @param string $new_date New Date string.
     758     * @return void
     759     */
     760    public static function update_subscription_next_payment_date( $subscription_id, $new_date ) {
     761        update_post_meta( $subscription_id, '_subscrpt_next_date', strtotime( $new_date ) );
     762    }
     763
     764    /**
     765     * Cancel subscription.
     766     *
     767     * @param int $subscription_id Subscription ID.
     768     * @return void
     769     */
     770    public static function cancel_subscription( $subscription_id ) {
     771        Action::status( 'cancelled', $subscription_id );
     772    }
     773
     774    /**
     775     * Pause subscription.
     776     *
     777     * @param int $subscription_id Subscription ID.
     778     * @return void
     779     */
     780    public static function pause_subscription( $subscription_id ) {
     781        Action::status( 'on-hold', $subscription_id );
     782    }
     783
     784    /**
     785     * Resume subscription.
     786     *
     787     * @param int $subscription_id Subscription ID.
     788     * @return void
     789     */
     790    public static function resume_subscription( $subscription_id ) {
     791        Action::status( 'active', $subscription_id );
     792    }
     793
     794    /**
     795     * Mark subscription payment as complete.
     796     *
     797     * @param int    $subscription_id Subscription ID.
     798     * @param string $payment_id Payment/Transaction ID.
     799     * @return void
     800     */
     801    public static function subscription_payment_complete( $subscription_id, $payment_id ) {
     802        if ( 'active' !== get_post_status( $subscription_id ) ) {
     803            Action::status( 'active', $subscription_id );
     804        }
     805
     806        // Allow payment gateways to add their own comments/notes
     807        do_action( 'subscrpt_subscription_payment_completed', $subscription_id, $payment_id );
    636808    }
    637809
  • subscription/trunk/languages/wp_subscription.pot

    r3413403 r3415062  
    1010"Content-Type: text/plain; charset=UTF-8\n"
    1111"Content-Transfer-Encoding: 8bit\n"
    12 "POT-Creation-Date: 2025-12-07T08:44:18+00:00\n"
     12"POT-Creation-Date: 2025-12-09T08:24:31+00:00\n"
    1313"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
    1414"X-Generator: WP-CLI 2.12.0\n"
     
    14881488msgstr ""
    14891489
    1490 #: includes/Illuminate/Helper.php:924
     1490#: includes/Illuminate/Helper.php:1096
    14911491msgid "Subscription renewal isn't possible due to previous order not completed or deletion."
    14921492msgstr ""
  • subscription/trunk/subscription.php

    r3413403 r3415062  
    77 * Description: WPSubscription allow WooCommerce to enables recurring payments, subscriptions, and auto-renewals for digital and physical products. Supports Stripe, PayPal, Paddle, and more.
    88 *
    9  * Version: 1.8.9
     9 * Version: 1.8.10
    1010 *
    1111 * Author: ConversWP
     
    5151     * @var string
    5252     */
    53     const version = '1.8.9';
     53    const version = '1.8.10';
    5454
    5555    /**
  • subscription/trunk/vendor/composer/installed.php

    r3413403 r3415062  
    22    'root' => array(
    33        'name' => 'converswp/subscription',
    4         'pretty_version' => '1.8.9',
    5         'version' => '1.8.9.0',
    6         'reference' => '6ef770f3fb9e19d8f07a1853a1c2b571093a3dc8',
     4        'pretty_version' => '1.8.10',
     5        'version' => '1.8.10.0',
     6        'reference' => '4fe49d4b2b7f0c2436a0e6fff49949240485f685',
    77        'type' => 'wordpress-plugin',
    88        'install_path' => __DIR__ . '/../../',
     
    1212    'versions' => array(
    1313        'converswp/subscription' => array(
    14             'pretty_version' => '1.8.9',
    15             'version' => '1.8.9.0',
    16             'reference' => '6ef770f3fb9e19d8f07a1853a1c2b571093a3dc8',
     14            'pretty_version' => '1.8.10',
     15            'version' => '1.8.10.0',
     16            'reference' => '4fe49d4b2b7f0c2436a0e6fff49949240485f685',
    1717            'type' => 'wordpress-plugin',
    1818            'install_path' => __DIR__ . '/../../',
Note: See TracChangeset for help on using the changeset viewer.