fix(captain): default paid accounts to V2 (#15262)
Paid Chatwoot Cloud accounts now receive Captain V2 during plan reconciliation unless they are explicitly held on Captain V1. Older accounts could otherwise start on V1 when they became paid after the V2 rollout because only newly created accounts carried the rollout eligibility value. ## Closes No linked issue. ## How to reproduce 1. Start with a cloud account created before the Captain V2 rollout. 2. Upgrade the account from the default plan to a paid plan. 3. Reconcile the Stripe subscription. 4. Confirm that Captain is enabled but Captain V2 remains disabled. ## What changed 1. Treat a missing rollout eligibility value as eligible for Captain V2 on paid plans. 2. Keep Captain V2 disabled when the rollout eligibility value is explicitly set to false. 3. Keep the default plan behavior unchanged. 4. Update the billing reconciliation specs to cover existing paid accounts, new accounts, and explicit V1 exceptions.
This commit is contained in:
@@ -1,7 +1,7 @@
|
||||
module Enterprise::Account
|
||||
# Transitional marker for the Captain V1 to V2 rollout. New cloud accounts get
|
||||
# this marker so plan reconciliation can enable V2 for them without upgrading
|
||||
# existing paid accounts. Remove once every account is migrated to V2.
|
||||
# Transitional marker for the Captain V1 to V2 rollout. Set this to false only
|
||||
# for accounts that must remain on V1 during paid plan reconciliation.
|
||||
# Remove once every account is migrated to V2.
|
||||
CAPTAIN_V2_DEFAULT_ELIGIBLE = 'captain_v2_default_eligible'.freeze
|
||||
|
||||
class << self
|
||||
|
||||
@@ -37,7 +37,7 @@ class Enterprise::Billing::ReconcilePlanFeaturesService
|
||||
|
||||
def perform
|
||||
account.disable_features(*PREMIUM_PLAN_FEATURES)
|
||||
account.disable_features('captain_integration_v2') if default_plan?
|
||||
account.disable_features('captain_integration_v2')
|
||||
account.enable_features(*current_plan_features)
|
||||
account.enable_features('captain_integration_v2') if captain_v2_default_eligible?
|
||||
account.enable_features(*manually_managed_features)
|
||||
@@ -74,6 +74,6 @@ class Enterprise::Billing::ReconcilePlanFeaturesService
|
||||
end
|
||||
|
||||
def captain_v2_default_eligible?
|
||||
!default_plan? && account.internal_attributes[Enterprise::Account::CAPTAIN_V2_DEFAULT_ELIGIBLE] == true
|
||||
!default_plan? && account.internal_attributes[Enterprise::Account::CAPTAIN_V2_DEFAULT_ELIGIBLE] != false
|
||||
end
|
||||
end
|
||||
|
||||
Reference in New Issue
Block a user