110 lines
4.2 KiB
PHP
110 lines
4.2 KiB
PHP
<?php
|
|
/**
|
|
* Subscription Module Settings
|
|
*
|
|
* @package WooNooW\Modules
|
|
*/
|
|
|
|
namespace WooNooW\Modules;
|
|
|
|
if (!defined('ABSPATH')) exit;
|
|
|
|
class SubscriptionSettings {
|
|
|
|
/**
|
|
* Initialize the settings
|
|
*/
|
|
public static function init() {
|
|
add_filter('woonoow/module_settings_schema', [__CLASS__, 'register_schema']);
|
|
}
|
|
|
|
/**
|
|
* Register subscription settings schema
|
|
*/
|
|
public static function register_schema($schemas) {
|
|
$schemas['subscription'] = [
|
|
'default_status' => [
|
|
'type' => 'select',
|
|
'label' => __('Default Subscription Status', 'woonoow'),
|
|
'description' => __('Status for new subscriptions after successful payment', 'woonoow'),
|
|
'options' => [
|
|
'active' => __('Active', 'woonoow'),
|
|
'pending' => __('Pending', 'woonoow'),
|
|
],
|
|
'default' => 'active',
|
|
],
|
|
'button_text_subscribe' => [
|
|
'type' => 'text',
|
|
'label' => __('Subscribe Button Text', 'woonoow'),
|
|
'description' => __('Text for the subscribe button on subscription products', 'woonoow'),
|
|
'placeholder' => 'Subscribe Now',
|
|
'default' => 'Subscribe Now',
|
|
],
|
|
'button_text_renew' => [
|
|
'type' => 'text',
|
|
'label' => __('Renew Button Text', 'woonoow'),
|
|
'description' => __('Text for the renewal button', 'woonoow'),
|
|
'placeholder' => 'Renew Subscription',
|
|
'default' => 'Renew Subscription',
|
|
],
|
|
'allow_customer_cancel' => [
|
|
'type' => 'toggle',
|
|
'label' => __('Allow Customer Cancellation', 'woonoow'),
|
|
'description' => __('Allow customers to cancel their own subscriptions', 'woonoow'),
|
|
'default' => true,
|
|
],
|
|
'allow_customer_pause' => [
|
|
'type' => 'toggle',
|
|
'label' => __('Allow Customer Pause', 'woonoow'),
|
|
'description' => __('Allow customers to pause and resume their subscriptions', 'woonoow'),
|
|
'default' => true,
|
|
],
|
|
'max_pause_count' => [
|
|
'type' => 'number',
|
|
'label' => __('Maximum Pause Count', 'woonoow'),
|
|
'description' => __('Maximum number of times a subscription can be paused (0 = unlimited)', 'woonoow'),
|
|
'default' => 3,
|
|
'min' => 0,
|
|
'max' => 10,
|
|
],
|
|
'renewal_retry_enabled' => [
|
|
'type' => 'toggle',
|
|
'label' => __('Retry Failed Renewals', 'woonoow'),
|
|
'description' => __('Automatically retry failed renewal payments', 'woonoow'),
|
|
'default' => true,
|
|
],
|
|
'renewal_retry_days' => [
|
|
'type' => 'text',
|
|
'label' => __('Retry Days', 'woonoow'),
|
|
'description' => __('Days after failure to retry payment (comma-separated, e.g., 1,3,5)', 'woonoow'),
|
|
'placeholder' => '1,3,5',
|
|
'default' => '1,3,5',
|
|
],
|
|
'expire_after_failed_attempts' => [
|
|
'type' => 'number',
|
|
'label' => __('Max Failed Attempts', 'woonoow'),
|
|
'description' => __('Number of failed payment attempts before subscription expires', 'woonoow'),
|
|
'default' => 3,
|
|
'min' => 1,
|
|
'max' => 10,
|
|
],
|
|
'send_renewal_reminder' => [
|
|
'type' => 'toggle',
|
|
'label' => __('Send Renewal Reminders', 'woonoow'),
|
|
'description' => __('Send email reminder before subscription renewal', 'woonoow'),
|
|
'default' => true,
|
|
],
|
|
'reminder_days_before' => [
|
|
'type' => 'number',
|
|
'label' => __('Reminder Days Before', 'woonoow'),
|
|
'description' => __('Days before renewal to send reminder email', 'woonoow'),
|
|
'default' => 3,
|
|
'min' => 1,
|
|
'max' => 14,
|
|
],
|
|
];
|
|
|
|
return $schemas;
|
|
}
|
|
}
|