update plan catalog display_name
This commit is contained in:
@@ -7,26 +7,7 @@ module Enterprise::Billing::Concerns::PlanProvisioningHelper
|
||||
plan_definition = Enterprise::Billing::V2::PlanCatalog.definition_for(new_pricing_plan_id)
|
||||
return unless plan_definition
|
||||
|
||||
plan_name = extract_plan_name(plan_definition)
|
||||
plan_name = plan_definition[:display_name]
|
||||
enable_plan_specific_features(plan_name) if plan_name.present?
|
||||
end
|
||||
|
||||
def extract_plan_name(plan_definition)
|
||||
plan_definition[:display_name].split.find { |word| %w[Startups Business Enterprise].include?(word) }
|
||||
end
|
||||
|
||||
def update_account_plan(new_pricing_plan_id, quantity, next_billing_date)
|
||||
attributes = {
|
||||
'stripe_pricing_plan_id' => new_pricing_plan_id,
|
||||
'pending_stripe_pricing_plan_id' => nil,
|
||||
'pending_subscription_quantity' => nil,
|
||||
'subscribed_quantity' => quantity,
|
||||
'next_billing_date' => next_billing_date
|
||||
}
|
||||
|
||||
plan_definition = Enterprise::Billing::V2::PlanCatalog.definition_for(new_pricing_plan_id)
|
||||
attributes['plan_name'] = plan_definition[:display_name] if plan_definition
|
||||
|
||||
update_custom_attributes(attributes)
|
||||
end
|
||||
end
|
||||
|
||||
@@ -5,7 +5,7 @@ module Enterprise::Billing::V2::PlanCatalog
|
||||
PLAN_DEFINITIONS = [
|
||||
{
|
||||
key: :free,
|
||||
display_name: 'Chatwoot Hacker',
|
||||
display_name: 'Hacker',
|
||||
base_fee: 0.0,
|
||||
monthly_credits: 0,
|
||||
config_key: 'STRIPE_HACKER_PLAN_ID',
|
||||
@@ -13,7 +13,7 @@ module Enterprise::Billing::V2::PlanCatalog
|
||||
},
|
||||
{
|
||||
key: :startup,
|
||||
display_name: 'Chatwoot Startups',
|
||||
display_name: 'Startups',
|
||||
base_fee: 19.0,
|
||||
monthly_credits: 300,
|
||||
config_key: 'STRIPE_STARTUP_PLAN_ID',
|
||||
@@ -21,7 +21,7 @@ module Enterprise::Billing::V2::PlanCatalog
|
||||
},
|
||||
{
|
||||
key: :business,
|
||||
display_name: 'Chatwoot Business',
|
||||
display_name: 'Business',
|
||||
base_fee: 39.0,
|
||||
monthly_credits: 500,
|
||||
config_key: 'STRIPE_BUSINESS_PLAN_ID',
|
||||
@@ -29,7 +29,7 @@ module Enterprise::Billing::V2::PlanCatalog
|
||||
},
|
||||
{
|
||||
key: :enterprise,
|
||||
display_name: 'Chatwoot Enterprise',
|
||||
display_name: 'Enterprise',
|
||||
base_fee: 99.0,
|
||||
monthly_credits: 800,
|
||||
config_key: 'STRIPE_ENTERPRISE_PLAN_ID',
|
||||
|
||||
Reference in New Issue
Block a user