Skip to content

Fetch eligibility for new purchase from customers app

Josianne Hyson requested to merge jh-fetch_eligible_namespaces into master

What does this MR do?

Addresses: customers-gitlab-com#2344 (closed)

Prior to this change, the eligibility logic for whether or not a group was eligible for a new subscription was defined on both customers and the GitLab application.

This resulted in changes being made in the customers flow that were not reflected in the GitLab flow.

This MR:

  1. Removes the GitLab app logic to determine if a namespace is eligible for a new purchase
  2. Start calling the purchase eligibility endpoint on the customers app to determine if the namespace is eligible

This is a follow up from https://gitlab.com/gitlab-org/customers-gitlab-com/-/merge_requests/2603 which introduced the new endpoint on the customers app.

💡 Steps to reproduce

  1. The repurchase_expired_subscriptions: true feature flag must be set on customers-dot
  2. Create a customer with an expired subscription in the grace period
    1. Create a new user on gitlab and link to a customers-dot account
    2. Create a personal subscription for the customers namespace (to link the customer account in Zuora)
    3. Create a new subscription in Zuora for this customer account, backdated so that it expired in the last week
  3. Link the expired subscription to a group
    1. Create a new group on gitlab
    2. Comment out SubscriptionController expired guard clause
    3. Comment out NamspaceTransactionValidator expired guard clause
    4. Navigate to Manage Purchaces in customers, and copy the subscription ID (eg A-S00073959) of the expired subscription
    5. Click Change linked namespace on the non-expired subscription (for the personal namespace)
    6. Replace the subscription ID in the URL with the copied ID of the expired one
    7. Select the group in the dropdown and save
  4. View the state of the dropdown on customers dot
    1. Navigate to Buy new subscription > Add new subscription > Buy now > Buy ... plan
    2. The group with the expired plan should appear in the namespace list
  5. Enable the move_gitlab_purchases_to_gitlab: true feature flag
  6. View the status of the dropdown on gitlab
    1. Make sure you're running gitlab EE (ie have a license uploaded)
    2. Create a new group on gitlab without a paid plan (this ensures the dropdown will actually show up)
    3. Navigate to Buy new subscription > Add new subscription > Buy now > Buy ... plan
    4. Only the free group should appear in the namespace dropdown
Customers Dot Gitlab.com [BEFORE] Gitlab.com [AFTER]

Does this MR meet the acceptance criteria?

Conformity

Availability and Testing

Security

If this MR contains changes to processing or storing of credentials or tokens, authorization and authentication methods and other items described in the security review guidelines:

  • ~~Label as security and @ mention @gitlab-com/gl-security/appsec~~
  • The MR includes necessary changes to maintain consistency between UI, API, email, or other methods
  • Security reports checked/validated by a reviewer from the AppSec team
Edited by Alex Kalderimis

Merge request reports