Skip to content
Snippets Groups Projects

BE: Allow customers to extend or reactivate their trial on gitlab.com [RUN ALL RSPEC] [RUN AS-IF-FOSS]

Merged Qingyu Zhao requested to merge 290278-allow-extend-or-reactivate-trial-on-gitlab-com into master
All threads resolved!
Compare and Show latest version
10 files
+ 215
29
Compare changes
  • Side-by-side
  • Inline
Files
10
@@ -17,24 +17,6 @@ def new
@@ -17,24 +17,6 @@ def new
record_experiment_user(:remove_known_trial_form_fields, remove_known_trial_form_fields_context)
record_experiment_user(:remove_known_trial_form_fields, remove_known_trial_form_fields_context)
end
end
def extend_reactivate
return render_403 unless %w[GitlabSubscription::TRIAL_EXTENDED GitlabSubscription::TRIAL_REACTIVATED].include?(params[:trial_extension_type])
return render_403 if params[:trial_extension_type].to_i == GitlabSubscription::TRIAL_EXTENDED && !@namespace.can_extend?
return render_403 if params[:trial_extension_type].to_i == GitlabSubscription::TRIAL_REACTIVATED && !@namespace.can_reactivate?
return render_403 if @namespace.invalid?
@result = GitlabSubscriptions::ExtendReactivateTrialService.new.execute(extend_reactivate_trial_params)
if @result&.dig(:success)
head 200
else
render_403
end
end
def select
def select
end
end
@@ -69,6 +51,26 @@ def apply
@@ -69,6 +51,26 @@ def apply
end
end
end
end
 
def extend_reactivate
 
trial_extension_type = params[:trial_extension_type].to_i
 
 
return render_403 unless [GitlabSubscription::TRIAL_EXTENDED, GitlabSubscription::TRIAL_REACTIVATED].include?(trial_extension_type)
 
 
return render_403 if trial_extension_type == GitlabSubscription::TRIAL_EXTENDED && !@namespace.can_extend?
 
 
return render_403 if trial_extension_type == GitlabSubscription::TRIAL_REACTIVATED && !@namespace.can_reactivate?
 
 
return render_403 if @namespace.invalid?
 
 
@result = GitlabSubscriptions::ExtendReactivateTrialService.new.execute(extend_reactivate_trial_params)
 
 
if @result&.dig(:success)
 
head 200
 
else
 
render_403
 
end
 
end
 
protected
protected
# override the ConfirmEmailWarning method in order to skip
# override the ConfirmEmailWarning method in order to skip
Loading