Commit 15a176ee authored by Shreyas Agarwal's avatar Shreyas Agarwal Committed by James Lopez

Allow trial plans to behave paid plan

parent 90f218ad
...@@ -12,8 +12,8 @@ module EE ...@@ -12,8 +12,8 @@ module EE
NAMESPACE_PLANS_TO_LICENSE_PLANS = { NAMESPACE_PLANS_TO_LICENSE_PLANS = {
::Plan::BRONZE => License::STARTER_PLAN, ::Plan::BRONZE => License::STARTER_PLAN,
[::Plan::SILVER, ::Plan::PREMIUM] => License::PREMIUM_PLAN, [::Plan::SILVER, ::Plan::PREMIUM, ::Plan::PREMIUM_TRIAL] => License::PREMIUM_PLAN,
[::Plan::GOLD, ::Plan::ULTIMATE] => License::ULTIMATE_PLAN [::Plan::GOLD, ::Plan::ULTIMATE, ::Plan::ULTIMATE_TRIAL] => License::ULTIMATE_PLAN
}.freeze }.freeze
LICENSE_PLANS_TO_NAMESPACE_PLANS = NAMESPACE_PLANS_TO_LICENSE_PLANS.invert.freeze LICENSE_PLANS_TO_NAMESPACE_PLANS = NAMESPACE_PLANS_TO_LICENSE_PLANS.invert.freeze
...@@ -342,6 +342,10 @@ module EE ...@@ -342,6 +342,10 @@ module EE
actual_plan_name == ::Plan::PREMIUM actual_plan_name == ::Plan::PREMIUM
end end
def premium_trial_plan?
actual_plan_name == ::Plan::PREMIUM_TRIAL
end
def gold_plan? def gold_plan?
actual_plan_name == ::Plan::GOLD actual_plan_name == ::Plan::GOLD
end end
...@@ -350,6 +354,10 @@ module EE ...@@ -350,6 +354,10 @@ module EE
actual_plan_name == ::Plan::ULTIMATE actual_plan_name == ::Plan::ULTIMATE
end end
def ultimate_trial_plan?
actual_plan_name == ::Plan::ULTIMATE_TRIAL
end
def plan_eligible_for_trial? def plan_eligible_for_trial?
::Plan::PLANS_ELIGIBLE_FOR_TRIAL.include?(actual_plan_name) ::Plan::PLANS_ELIGIBLE_FOR_TRIAL.include?(actual_plan_name)
end end
......
...@@ -12,9 +12,11 @@ module EE ...@@ -12,9 +12,11 @@ module EE
PREMIUM = 'premium' PREMIUM = 'premium'
GOLD = 'gold' GOLD = 'gold'
ULTIMATE = 'ultimate' ULTIMATE = 'ultimate'
ULTIMATE_TRIAL = 'ultimate_trial'
PREMIUM_TRIAL = 'premium_trial'
EE_DEFAULT_PLANS = (const_get(:DEFAULT_PLANS, false) + [FREE]).freeze EE_DEFAULT_PLANS = (const_get(:DEFAULT_PLANS, false) + [FREE]).freeze
PAID_HOSTED_PLANS = [BRONZE, SILVER, PREMIUM, GOLD, ULTIMATE].freeze PAID_HOSTED_PLANS = [BRONZE, SILVER, PREMIUM, GOLD, ULTIMATE, ULTIMATE_TRIAL, PREMIUM_TRIAL].freeze
EE_ALL_PLANS = (EE_DEFAULT_PLANS + PAID_HOSTED_PLANS).freeze EE_ALL_PLANS = (EE_DEFAULT_PLANS + PAID_HOSTED_PLANS).freeze
PLANS_ELIGIBLE_FOR_TRIAL = EE_DEFAULT_PLANS PLANS_ELIGIBLE_FOR_TRIAL = EE_DEFAULT_PLANS
......
---
title: Allow trial plans to behave paid plan
merge_request: 60496
author:
type: added
...@@ -53,5 +53,13 @@ FactoryBot.define do ...@@ -53,5 +53,13 @@ FactoryBot.define do
trait :ultimate do trait :ultimate do
association :hosted_plan, factory: :ultimate_plan association :hosted_plan, factory: :ultimate_plan
end end
trait :premium_trial do
association :hosted_plan, factory: :premium_trial_plan
end
trait :ultimate_trial do
association :hosted_plan, factory: :ultimate_trial_plan
end
end end
end end
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment