Skip to content

Fetch BillingAccount info on GitLab backend

Aman Luthra requested to merge 464153-al_billing_account_gql_api into master

What does this MR do and why?

This MR introduces a GraphQL API which can be consumed by the current logged in user to retrieve the zuora_account_name from its corresponding billing account via CustomersDot.

MR acceptance checklist

Please evaluate this MR against the MR acceptance checklist. It helps you analyze changes to reduce risks in quality, performance, reliability, security, and maintainability.

How to set up and validate locally

  • Since we will depend on interaction between CustomersDot and GitLab, we would need the following requisites enabled:
  1. Ensure GDK and CustomersDot are both running on your system.
  2. Ensure the GitLab GraphQL proxy setup is completed for communication between the two.
  3. Purchase any new subscription and ensure it is activated on a GitLab group.
  • Now we can test the flow out by:
  1. Run the GitLab rails console to get the corresponding user using which the subscription was purchased:
user = User.last
  1. Passing the user reference to the API, get the BillingAccountDetails:
client = Gitlab::SubscriptionPortal::Client

client.get_billing_account_details(user)
=> {:success=>true, :response=>{"data"=>{"billingAccount"=>{"zuoraAccountName"=>"testAccount"}}}}

Note: The user passed here references the current_user which will be passed via the controller where this API will be called.

Related to #464153

Edited by Aman Luthra

Merge request reports