WIP: Add support to process info about GitLab.com subscriptions
What does this MR do?
-
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
What are the relevant issue numbers?
Closes #7438 (closed)
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 -
Link to e2e tests MR added if this MR has Requires e2e tests label. See the Test Planning Process. -
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?
Edited by Rubén Dávila