| @@ -45,8 +45,9 @@ | ||
| 45 | 45 | */ |
| 46 | 46 | public function add_pro_preview_fields( $settings_fields ) { |
| 47 | 47 | $pro_fields = array_merge( |
| 48 | 48 | $this->pro_core_fields(), |
| 49 | + $this->license_fields(), | |
| 49 | 50 | $this->grace_period_fields(), |
| 50 | 51 | $this->payment_failure_fields(), |
| 51 | 52 | $this->api_fields(), |
| 52 | 53 | $this->health_queue_fields(), |
| @@ -78,9 +79,9 @@ | ||
| 78 | 79 | private function pro_core_fields() { |
| 79 | 80 | return [ |
| 80 | 81 | [ |
| 81 | 82 | 'type' => 'select', |
| 82 | - 'group' => 'main', | |
| 83 | + 'group' => 'renewals', | |
| 83 | 84 | 'priority' => 7, |
| 84 | 85 | 'field_data' => [ |
| 85 | 86 | 'id' => 'subscrpt_renewal_price', |
| 86 | 87 | 'title' => __( 'Renewal Price', 'subscription' ), |
| @@ -93,9 +94,9 @@ | ||
| 93 | 94 | ], |
| 94 | 95 | ], |
| 95 | 96 | [ |
| 96 | 97 | 'type' => 'toggle', |
| 97 | - 'group' => 'main', | |
| 98 | + 'group' => 'renewals', | |
| 98 | 99 | 'priority' => 8, |
| 99 | 100 | 'field_data' => [ |
| 100 | 101 | 'id' => 'subscrpt_early_renew', |
| 101 | 102 | 'title' => __( 'Early Renewal', 'subscription' ), |
| @@ -104,41 +105,50 @@ | ||
| 104 | 105 | 'value' => '1', |
| 105 | 106 | 'checked' => '1' === get_option( 'subscrpt_early_renew', '1' ), |
| 106 | 107 | ], |
| 107 | 108 | ], |
| 109 | + ]; | |
| 110 | + } | |
| 111 | + | |
| 112 | + /** | |
| 113 | + * Module: License integrations (Integrations/LicenseManagerWoo.php). | |
| 114 | + * | |
| 115 | + * @return array | |
| 116 | + */ | |
| 117 | + private function license_fields() { | |
| 118 | + return [ | |
| 108 | 119 | [ |
| 109 | - 'type' => 'select', | |
| 110 | - 'group' => 'main', | |
| 111 | - 'priority' => 9, | |
| 120 | + 'type' => 'heading', | |
| 121 | + 'group' => 'license_settings', | |
| 122 | + 'priority' => 4, | |
| 112 | 123 | 'field_data' => [ |
| 113 | - 'id' => 'subscrpt_cancellation_delay', | |
| 114 | - 'title' => __( 'Cancellation Timing', 'subscription' ), | |
| 115 | - 'description' => __( 'When a subscription is cancelled, choose when it actually ends.', 'subscription' ), | |
| 116 | - 'options' => [ | |
| 117 | - '24h' => __( 'After 24 hours', 'subscription' ), | |
| 118 | - 'instant' => __( 'Immediately', 'subscription' ), | |
| 119 | - 'period' => __( 'At end of billing period (before next renewal)', 'subscription' ), | |
| 120 | - ], | |
| 121 | - 'selected' => esc_attr( \SpringDevs\Subscription\Illuminate\Cancellation::get_settings( 'subscrpt_cancellation_delay' ) ), | |
| 124 | + 'title' => __( 'License Settings', 'subscription' ), | |
| 122 | 125 | ], |
| 123 | 126 | ], |
| 124 | 127 | [ |
| 125 | - 'type' => 'editlist', | |
| 126 | - 'group' => 'main', | |
| 127 | - 'priority' => 9.6, | |
| 128 | + 'type' => 'toggle', | |
| 129 | + 'group' => 'license_settings', | |
| 130 | + 'priority' => 1, | |
| 128 | 131 | 'field_data' => [ |
| 129 | - 'id' => 'subscrpt_cancellation_reasons', | |
| 130 | - 'title' => __( 'Cancellation Reasons', 'subscription' ), | |
| 131 | - 'description' => __( 'Reasons offered in the cancellation survey form. Shown when Cancellation Survey is enabled.', 'subscription' ), | |
| 132 | - 'value' => \SpringDevs\Subscription\Illuminate\Cancellation::get_reasons(), | |
| 133 | - 'modal' => true, | |
| 134 | - 'button_label' => __( 'Manage reasons', 'subscription' ), | |
| 135 | - 'modal_title' => __( 'Cancellation Reasons', 'subscription' ), | |
| 136 | - 'add_placeholder' => __( 'Add a reason…', 'subscription' ), | |
| 137 | - 'add_label' => __( 'Add reason', 'subscription' ), | |
| 138 | - 'empty_text' => __( 'No reasons yet. Add one below.', 'subscription' ), | |
| 132 | + 'id' => 'subscrpt_regenerate_license_on_renewal', | |
| 133 | + 'title' => __( 'Regenerate License on Renewal', 'subscription' ), | |
| 134 | + 'description' => __( 'Enable this option if you want to invalidate the old key and issue a fresh license key whenever a subscription renews.', 'subscription' ), | |
| 135 | + 'value' => '1', | |
| 136 | + 'checked' => '1' === get_option( 'subscrpt_regenerate_license_on_renewal', '0' ), | |
| 139 | 137 | ], |
| 140 | 138 | ], |
| 139 | + [ | |
| 140 | + 'type' => 'toggle', | |
| 141 | + 'group' => 'license_settings', | |
| 142 | + 'priority' => 2, | |
| 143 | + 'field_data' => [ | |
| 144 | + 'id' => 'subscrpt_deactivate_old_license_on_renewal', | |
| 145 | + 'title' => __( 'Deactivate Previous License', 'subscription' ), | |
| 146 | + 'description' => __( 'When a fresh license key is issued on renewal, deactivate the previous key. Turn off to let the previous key keep working until it expires.', 'subscription' ), | |
| 147 | + 'value' => '1', | |
| 148 | + 'checked' => '1' === get_option( 'subscrpt_deactivate_old_license_on_renewal', '1' ), | |
| 149 | + ], | |
| 150 | + ], | |
| 141 | 151 | ]; |
| 142 | 152 | } |
| 143 | 153 | |
| 144 | 154 | /** |
| @@ -150,9 +160,9 @@ | ||
| 150 | 160 | return [ |
| 151 | 161 | [ |
| 152 | 162 | 'type' => 'heading', |
| 153 | 163 | 'group' => 'grace_period', |
| 154 | - 'priority' => 3, | |
| 164 | + 'priority' => 5, | |
| 155 | 165 | 'field_data' => [ |
| 156 | 166 | 'title' => __( 'Grace Period Settings', 'subscription' ), |
| 157 | 167 | ], |
| 158 | 168 | ], |
| @@ -213,9 +223,9 @@ | ||
| 213 | 223 | return [ |
| 214 | 224 | [ |
| 215 | 225 | 'type' => 'heading', |
| 216 | 226 | 'group' => 'payment_failure', |
| 217 | - 'priority' => 4, | |
| 227 | + 'priority' => 6, | |
| 218 | 228 | 'field_data' => [ |
| 219 | 229 | 'title' => __( 'Payment Failure Handling', 'subscription' ), |
| 220 | 230 | ], |
| 221 | 231 | ], |
| @@ -349,9 +359,9 @@ | ||
| 349 | 359 | return [ |
| 350 | 360 | [ |
| 351 | 361 | 'type' => 'heading', |
| 352 | 362 | 'group' => 'health_queue', |
| 353 | - 'priority' => 8, | |
| 363 | + 'priority' => 9, | |
| 354 | 364 | 'field_data' => [ |
| 355 | 365 | 'title' => __( 'Subscription Health', 'subscription' ), |
| 356 | 366 | ], |
| 357 | 367 | ], |
| @@ -393,8 +403,21 @@ | ||
| 393 | 403 | 'value' => '1', |
| 394 | 404 | 'checked' => '1' === get_option( 'wp_subscription_auto_complete_order', '1' ), |
| 395 | 405 | ], |
| 396 | 406 | ], |
| 407 | + [ | |
| 408 | + 'type' => 'toggle', | |
| 409 | + 'group' => 'payment_gateways', | |
| 410 | + 'priority' => 2, | |
| 411 | + 'field_data' => [ | |
| 412 | + 'id' => 'subscrpt_require_payment_on_trial', | |
| 413 | + 'title' => __( 'Require Payment for Free Trials', 'subscription' ), | |
| 414 | + 'label' => __( 'Collect payment details at checkout for trial subscriptions', 'subscription' ), | |
| 415 | + 'description' => __( 'Collect payment details up front on free trials so renewals charge automatically.', 'subscription' ), | |
| 416 | + 'value' => '1', | |
| 417 | + 'checked' => '1' === get_option( 'subscrpt_require_payment_on_trial', '1' ), | |
| 418 | + ], | |
| 419 | + ], | |
| 397 | 420 | ]; |
| 398 | 421 | } |
| 399 | 422 | |
| 400 | 423 | /** |
| @@ -404,10 +427,18 @@ | ||
| 404 | 427 | */ |
| 405 | 428 | private function switch_fields() { |
| 406 | 429 | return [ |
| 407 | 430 | [ |
| 431 | + 'type' => 'heading', | |
| 432 | + 'group' => 'switching', | |
| 433 | + 'priority' => 3, | |
| 434 | + 'field_data' => [ | |
| 435 | + 'title' => __( 'Switching & Upgrades', 'subscription' ), | |
| 436 | + ], | |
| 437 | + ], | |
| 438 | + [ | |
| 408 | 439 | 'type' => 'toggle', |
| 409 | - 'group' => 'general', | |
| 440 | + 'group' => 'switching', | |
| 410 | 441 | 'priority' => 9, |
| 411 | 442 | 'field_data' => [ |
| 412 | 443 | 'id' => 'subscrpt_switch_enabled', |
| 413 | 444 | 'title' => __( 'Switch Subscription', 'subscription' ), |
| @@ -418,9 +449,9 @@ | ||
| 418 | 449 | ], |
| 419 | 450 | ], |
| 420 | 451 | [ |
| 421 | 452 | 'type' => 'toggle', |
| 422 | - 'group' => 'general', | |
| 453 | + 'group' => 'switching', | |
| 423 | 454 | 'priority' => 10, |
| 424 | 455 | 'field_data' => [ |
| 425 | 456 | 'id' => 'subscrpt_downgrade_allowed', |
| 426 | 457 | 'title' => __( 'Downgrade Subscription', 'subscription' ), |
| @@ -431,9 +462,9 @@ | ||
| 431 | 462 | ], |
| 432 | 463 | ], |
| 433 | 464 | [ |
| 434 | 465 | 'type' => 'join', |
| 435 | - 'group' => 'general', | |
| 466 | + 'group' => 'switching', | |
| 436 | 467 | 'priority' => 11, |
| 437 | 468 | 'field_data' => [ |
| 438 | 469 | 'title' => __( 'Switch Fee', 'subscription' ), |
| 439 | 470 | 'description' => __( 'Optional fee charged when a customer switches plans. Use a flat amount or a percentage of the new plan price. (0 = no fee)', 'subscription' ), |
| @@ -471,9 +502,9 @@ | ||
| 471 | 502 | ], |
| 472 | 503 | ], |
| 473 | 504 | [ |
| 474 | 505 | 'type' => 'select', |
| 475 | - 'group' => 'general', | |
| 506 | + 'group' => 'switching', | |
| 476 | 507 | 'priority' => 12, |
| 477 | 508 | 'field_data' => [ |
| 478 | 509 | 'id' => 'subscrpt_switch_fee_apply_to', |
| 479 | 510 | 'title' => __( 'Apply Fee To', 'subscription' ), |
| @@ -498,9 +529,9 @@ | ||
| 498 | 529 | return [ |
| 499 | 530 | [ |
| 500 | 531 | 'type' => 'heading', |
| 501 | 532 | 'group' => 'role_based_settings', |
| 502 | - 'priority' => 6, | |
| 533 | + 'priority' => 7, | |
| 503 | 534 | 'field_data' => [ |
| 504 | 535 | 'title' => __( 'Role-Based Settings', 'subscription' ), |
| 505 | 536 | ], |
| 506 | 537 | ], |
| @@ -528,9 +559,9 @@ | ||
| 528 | 559 | return [ |
| 529 | 560 | [ |
| 530 | 561 | 'type' => 'heading', |
| 531 | 562 | 'group' => 'live_qr_settings', |
| 532 | - 'priority' => 5, | |
| 563 | + 'priority' => 8, | |
| 533 | 564 | 'field_data' => [ |
| 534 | 565 | 'title' => __( 'Quick Details QR Settings', 'subscription' ), |
| 535 | 566 | ], |
| 536 | 567 | ], |
| @@ -601,9 +632,9 @@ | ||
| 601 | 632 | return [ |
| 602 | 633 | [ |
| 603 | 634 | 'type' => 'heading', |
| 604 | 635 | 'group' => 'payment_gateways', |
| 605 | - 'priority' => 0.1, | |
| 636 | + 'priority' => 1, | |
| 606 | 637 | 'field_data' => [ |
| 607 | 638 | 'title' => __( 'Payment Gateway Settings', 'subscription' ), |
| 608 | 639 | ], |
| 609 | 640 | ], |