Commit 191f7499 authored by James Lopez's avatar James Lopez

Merge branch '322043-behave-trial-as-paid-plan' into 'master'

Allow trial plans to behave paid plan

See merge request gitlab-org/gitlab!60496
parents d623afb4 15a176ee
......@@ -12,8 +12,8 @@ module EE
NAMESPACE_PLANS_TO_LICENSE_PLANS = {
::Plan::BRONZE => License::STARTER_PLAN,
[::Plan::SILVER, ::Plan::PREMIUM] => License::PREMIUM_PLAN,
[::Plan::GOLD, ::Plan::ULTIMATE] => License::ULTIMATE_PLAN
[::Plan::SILVER, ::Plan::PREMIUM, ::Plan::PREMIUM_TRIAL] => License::PREMIUM_PLAN,
[::Plan::GOLD, ::Plan::ULTIMATE, ::Plan::ULTIMATE_TRIAL] => License::ULTIMATE_PLAN
}.freeze
LICENSE_PLANS_TO_NAMESPACE_PLANS = NAMESPACE_PLANS_TO_LICENSE_PLANS.invert.freeze
......@@ -342,6 +342,10 @@ module EE
actual_plan_name == ::Plan::PREMIUM
end
def premium_trial_plan?
actual_plan_name == ::Plan::PREMIUM_TRIAL
end
def gold_plan?
actual_plan_name == ::Plan::GOLD
end
......@@ -350,6 +354,10 @@ module EE
actual_plan_name == ::Plan::ULTIMATE
end
def ultimate_trial_plan?
actual_plan_name == ::Plan::ULTIMATE_TRIAL
end
def plan_eligible_for_trial?
::Plan::PLANS_ELIGIBLE_FOR_TRIAL.include?(actual_plan_name)
end
......
......@@ -12,9 +12,11 @@ module EE
PREMIUM = 'premium'
GOLD = 'gold'
ULTIMATE = 'ultimate'
ULTIMATE_TRIAL = 'ultimate_trial'
PREMIUM_TRIAL = 'premium_trial'
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
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
trait :ultimate do
association :hosted_plan, factory: :ultimate_plan
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
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