From 3f790d49a9b13f4035cdea81c31075efd7531e7e Mon Sep 17 00:00:00 2001 From: Shivam Mishra Date: Thu, 9 Jul 2026 18:18:24 +0530 Subject: [PATCH] feat: grant api_and_webhooks through startup plan features --- .../enterprise/billing/reconcile_plan_features_service.rb | 7 +------ .../billing/reconcile_plan_features_service_spec.rb | 5 ++--- 2 files changed, 3 insertions(+), 9 deletions(-) diff --git a/enterprise/app/services/enterprise/billing/reconcile_plan_features_service.rb b/enterprise/app/services/enterprise/billing/reconcile_plan_features_service.rb index 2522682a4..435b1f3d1 100644 --- a/enterprise/app/services/enterprise/billing/reconcile_plan_features_service.rb +++ b/enterprise/app/services/enterprise/billing/reconcile_plan_features_service.rb @@ -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? diff --git a/spec/enterprise/services/enterprise/billing/reconcile_plan_features_service_spec.rb b/spec/enterprise/services/enterprise/billing/reconcile_plan_features_service_spec.rb index 471ec2a4d..64be87ff4 100644 --- a/spec/enterprise/services/enterprise/billing/reconcile_plan_features_service_spec.rb +++ b/spec/enterprise/services/enterprise/billing/reconcile_plan_features_service_spec.rb @@ -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