Count awaiting users on checkout for free groups
What does this MR do and why?
This changes how we calculate the billable members for free plans when
free_user_cap
is enabled when a subscription gets purchased.
Example:
- free group where
free_user_cap
is enabled has 7 users. - 2 users get their memberships set to
awaiting
whenfree_user_cap
applies. - When they want to purchase a plan it's likely that they want to purchase seats for these 2 users. We therefore need to count them in the checkout process as
billable
members.
We also have to change the way how we calculate seats_in_use
as it was
using billable_members_count
. It's now using directly
billed_user_ids
and we therefore distinguish between billable
(potentially billable) and billed users (actually billed users).
Issue: https://gitlab.com/gitlab-org/gitlab/-/issues/357257
Screenshots or screen recordings
On Usage Quota Page (5 seats used) | On Checkout (7 billable) |
---|---|
![]() |
![]() |
How to set up and validate locally
- Start gdk in SaaS mode
export GITLAB_SIMULATE_SAAS=1 gdk start
- Enable the feature flags:
bin/rails c
Feature.enable(:seats_in_use_for_free_or_trial) Feature.enable(:free_user_cap)
- Enable
check_namespace_plan
ApplicationSetting.first.update(check_namespace_plan: true)
- Visit a free group's usage quota page, e.g.
http://localhost:3000/groups/my-testing-group/-/usage_quotas#seats-quota-tab
- Go to "Explore all Plans" on the Usage Quota Page, or go to "Billing" in the group settings. Then click "Upgrade" on a Plan to go to the checkout page.
- To view the checkout page, you need to have customerDot running
MR acceptance checklist
This checklist encourages us to confirm any changes have been analyzed to reduce risks in quality, performance, reliability, security, and maintainability.
-
I have evaluated the MR acceptance checklist for this MR.
Edited by Nicolas Dular