feat: grant api_and_webhooks through startup plan features
This commit is contained in:
@@ -18,6 +18,7 @@ class Enterprise::Billing::ReconcilePlanFeaturesService
|
||||
advanced_search
|
||||
linear_integration
|
||||
channel_voice
|
||||
api_and_webhooks
|
||||
].freeze
|
||||
|
||||
BUSINESS_PLAN_FEATURES = %w[
|
||||
@@ -37,10 +38,8 @@ class Enterprise::Billing::ReconcilePlanFeaturesService
|
||||
def perform
|
||||
account.disable_features(*PREMIUM_PLAN_FEATURES)
|
||||
account.disable_features('captain_integration_v2') if default_plan?
|
||||
account.disable_features('api_and_webhooks')
|
||||
account.enable_features(*current_plan_features)
|
||||
account.enable_features('captain_integration_v2') if captain_v2_default_eligible?
|
||||
account.enable_features('api_and_webhooks') if api_and_webhooks_eligible?
|
||||
account.enable_features(*manually_managed_features)
|
||||
account.save!
|
||||
end
|
||||
@@ -58,10 +57,6 @@ class Enterprise::Billing::ReconcilePlanFeaturesService
|
||||
end
|
||||
end
|
||||
|
||||
def api_and_webhooks_eligible?
|
||||
!default_plan? && account.custom_attributes['subscription_status'] == 'active'
|
||||
end
|
||||
|
||||
def default_plan?
|
||||
default_plan_name = cloud_plans.first&.dig('name')
|
||||
return false if default_plan_name.blank?
|
||||
|
||||
@@ -23,13 +23,12 @@ describe Enterprise::Billing::ReconcilePlanFeaturesService do
|
||||
expect(account.reload).to be_feature_enabled('api_and_webhooks')
|
||||
end
|
||||
|
||||
it 'disables the feature for a paid plan on trial' do
|
||||
account.enable_features!('api_and_webhooks')
|
||||
it 'enables the feature for a paid plan on trial' do
|
||||
account.update!(custom_attributes: { 'plan_name' => 'Startups', 'subscription_status' => 'trialing' })
|
||||
|
||||
described_class.new(account: account).perform
|
||||
|
||||
expect(account.reload).not_to be_feature_enabled('api_and_webhooks')
|
||||
expect(account.reload).to be_feature_enabled('api_and_webhooks')
|
||||
end
|
||||
|
||||
it 'disables the feature on the default plan' do
|
||||
|
||||
Reference in New Issue
Block a user