Skip to content

Submit forms for duo pro trial

Roy Liu requested to merge 435875-submit-forms-for-duo-pro-trial into master

What does this MR do and why?

Create duo pro trial services to allow form submissions to call CustomersDot's create_addon_trial endpoint for creating lead and applying duo pro trial.

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.

Screenshots or screen recordings

No changes to UI, for UI references, see !141597 (merged)

How to set up and validate locally

  • Setup GDK to simulate SaaS.
  • Setup and Start CustomersDot application
  • Login in as a user. Visit /-/trials/duo_pro/new.
  • Make sure it returns 404.
  • Enable the feature flag by:
Feature.enable(:duo_pro_trials)
  • Visit /-/trials/duo_pro/new. Submit the lead form.

  • You should see the select namespace form, choose any namespace available or create a new group

  • Submitting the form redirect back to group overview page

  • You should see the lead created in CustomersDot console

    Lead example
     [2] pry(main)> Lead.last
     Lead Load (1.2ms)  SELECT "leads".* FROM "leads" ORDER BY "leads"."id" DESC LIMIT $1  [["LIMIT", 1]]
     => #<Lead:0x0000000124ed3710
     id: 32,
     created_at: Tue, 05 Mar 2024 19:13:08.916792000 UTC +00:00,
     updated_at: Tue, 05 Mar 2024 19:13:08.916792000 UTC +00:00,
     trial_start_date: 2024-03-05,
     namespace_id: nil,
     user_id: 50,
     opt_in: true,
     currently_in_trial: true,
     is_for_business_use: nil,
     first_name: "Alfonzo",
     last_name: "Mayer",
     email: "janis.blick@goodwin.co.uk",
     phone: "1234",
     company_name: "Fake company",
     employees_bucket: "1-99",
     country: "Afghanistan",
     state: nil,
     product_interaction: "duo_pro_trial",
     provider: "gitlab",
     comment_capture: nil,
     glm_content: nil,
     glm_source: nil,
     sent_at: nil,
     website_url: nil,
     role: nil,
     jtbd: nil,
     preferred_language: "en">
  • You should see the there is a GitlabSubscriptions::AddOnPurchase created for your group

    Example
      [1] pry(main)> GitlabSubscriptions::AddOnPurchase.last
      => #<GitlabSubscriptions::AddOnPurchase:0x000000011cbe87d8
      id: 5,
      created_at: Tue, 05 Mar 2024 19:15:54.412252000 UTC +00:00,
      updated_at: Tue, 05 Mar 2024 19:15:54.412252000 UTC +00:00,
      subscription_add_on_id: 1,
      namespace_id: 205,
      quantity: 100,
      expires_on: Thu, 04 Apr 2024,
      purchase_xid: "trial-order-12",
      last_assigned_users_refreshed_at: nil>

Related to #435875

Edited by Roy Liu

Merge request reports