Handle code suggestions add-on purchase in licenses
What does this MR do and why?
Part of https://gitlab.com/gitlab-org/gitlab/-/issues/419944+
When a license for an Online Cloud subscription is used as the current license and it contains a code suggestions add-on purchase, the needed data for the code suggestions add-on purchase will now be created. This happens when an activation code is used for such a license or when a license seat link is triggered for one.
Additionally, when a license is created and the current is for an Online Cloud subscription a new seat link sync is scheduled to retrieve up to date data for the license. The sync will update the future subscriptions info and the code suggestions add-on purchases.
How to set up and validate locally
note: You'll need Zuora, CustomersDot and GitLab/GDK for this verification:
-
Zuora: Create a new self-managed subscription with
TurnOnCloudLicensing
set toYes
in Zuora. - CustomersDot: Wait for the callout to process.
-
CustomersDot: Copy the activation code (either from the email in letter opener or by querying for
CloudActivation.last.activation_code
) and activate your GitLab instance (you'll need this in a later step). -
Zuora: Start to create a new self-managed subscription with
TurnOnCloudLicensing
set toYes
in Zuora. - Zuora: Add code suggestions as an additional product to the same subscription and enter a much smaller quantity than the subscription's seats.
- Zuora: Activate the subscription.
- CustomersDot: Wait for the callout to process.
-
CustomersDot: Copy the activation code (either from the email in letter opener or by querying for
CloudActivation.last.activation_code
) and activate your GitLab instance. -
GitLab: Open a rails console and verify the last
GitlabSubscriptions::AddOnPurchase
record reflects the correct data of your subscription from steps 4-6:GitlabSubscriptions::AddOnPurchase.last
- Repeat steps 4-9.
-
GitLab: Remove the license in under
admin/subscription
. - Verify the last
GitlabSubscriptions::AddOnPurchase
was updated to reflect the data from the subscription created in steps 4-6. -
GitLab: Remove the next license too in under
admin/subscription
. - Verify the last
GitlabSubscriptions::AddOnPurchase
was updated to be expired as of yesterday.
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.