Skip to content

Use invoice preview API to calculate plan pricing for SaaS purchase

What does this MR do and why?

Uses invoicePreview GraphQL endpoint to preview transaction during SaaS purchase flow

  • We use use_invoice_preview_api_in_saas_purchase feature flag to determine whether or not to use the new API
  • With the introduction of preview transaction API, this MR also introduces a loading state and error handling for the same

Note: We need this MR to be deployed to be able to turn this feature flag on but we can still go live with this MR if all is looking well with feature flag off.

Screenshots or screen recordings

Scenario Screenshot
Feature flag on Screen_Recording_2023-02-02_at_3.11.20_PM
Feature flag off Screen_Recording_2023-02-02_at_2.42.17_PM
Large breakpoint subscription purchase LBP_premium
Large breakpoint loading state LBP_loading
Large breakpoint error state LBP_error
Large breakpoint no users state (no change) LBP_no_users
Large breakpoint new group (no change) LBP_new_group
Small breakpoint subscription purchase SBP_premium
Small breakpoint loading state SBP_loading_state
Small breakpoint error state SBP_error
Small breakpoint no users state (no change) SBP_no_users
Small breakpoint new group (no change) SBP_new_group

How to set up and validate locally

  1. Start gdk in SaaS mode GITLAB_SIMULATE_SAAS=true gdk start
  2. Go to a free group's billing page: Settings -> Billing
  3. Click on Upgrade CTA on one of the plans

Turn feature flag ON

  1. Open rails console rails c
  2. Run Feature.enable(:use_invoice_preview_api_in_saas_purchase)

MR acceptance checklist

This checklist encourages us to confirm any changes have been analyzed to reduce risks in quality, performance, reliability, security, and maintainability.

Related to #388075

Edited by Vamsi Vempati

Merge request reports