Resolve "Add subscription table to GitLab.com billing areas"
What does this MR do?
Instead of showing the promotion table on the group namespaces we will display a subscription table showing information about the user's current usage and billing state.
CE-port: https://gitlab.com/gitlab-org/gitlab-ce/merge_requests/23264
Screenshots:
before | after |
---|---|
![]() |
![]() |
Backend changes
-
Adds a new model: GitlabSubscription
- This model will be used to store all the info related to a GitLab.com subscription or a GitLab EE subscription.
-
Adds the following API endpoints -
POST https://gitlab.example.com/api/v4/namespaces/:id/gitlab_subscription
- This endpoint creates a new GitLab subscription for the current namespace (can be a Group or User).
- This endpoint can be used only with an admin token. For now this is only going to be used by the subscription portal every time a new subscription is purchased. The subscription portal will sync all the info related to the subscription: the number of purchased seats, the purchased plan, start and end date of the subscription and whether the subscription is trial or not.
-
GET https://gitlab.example.com/api/v4/namespaces/:id/gitlab_subscription
- Returns the serialized GitLab Subscription resource that belongs to the current namespace. This endpoint can only be accessible by the owner of the namespace or the admin user.
-
PUT https://gitlab.example.com/api/v4/namespaces/:id/gitlab_subscription
- This endpoint allows the client to update any attribute of the GitLab subscription resource.
-
-
Adds a new background job that will be executed daily through a cronjob. - The purpose of this worker is to update the
max_seats_used
attribute of the GitLab subscription with the current number of active users.max_seats_user
is only going to be updated if the current number of active users is greater than the current value ofmax_seats_used
- The value of
max_seats_used
will be used to show the customer how many extra seats they have added on top of the seats allowed by the subscription. Our plan is to do an automatic charge of those extra seats on a monthly basis.
- The purpose of this worker is to update the
Local GDK setup
In order to activate the Billing
menu item on the following pages
one needs to make sure to return true
from the following methods on the local GDK:
-
self.dev_env_or_com?
(ingitlab.rb
) -
should_check_namespace_plan?
(inapplication_setting.rb
)
One can update a particular group to a different plan via the rails console:
plan = Plan.find_by_name('bronze')
group = Group.find_by_path('gitlab-org')
group.create_gitlab_subscription!(hosted_plan: plan, seats: 100, start_date: Date.today, end_date: 1.year.from_now.to_date)
What are the relevant issue numbers?
https://gitlab.com/gitlab-org/gitlab-ee/issues/7772
Does this MR meet the acceptance criteria?
-
Changelog entry added, if necessary -
Documentation created/updated -
Tests added for this feature/bug -
Conforms to the code review guidelines -
Conforms to the merge request performance guidelines -
Conforms to the style guides -
Conforms to the database guides -
EE specific content should be in the top level /ee
folder -
For a paid feature, have we considered GitLab.com plans, how it works for groups, and is there a design for promoting it to users who aren't on the correct plan?
Closes #7772 (closed)
Edited by Mark Chao