Add generic CustomersDot product trial client methods

What does this MR do and why?

Adds generic CustomersDot trial methods to the subscription portal client. Orbit trials use them first.

  • product_trial, start_product_trial, and expire_product_trial_cache. Each method takes a trial_type:.
  • ProductTrialResponse and StartProductTrialResponse.
CDot response Result
200 or 201 Success
409 :trial_already_active (a trial exists, active or expired)
422 :ineligible, with the CDot reason in error_message
404 :not_found
5xx or network error Raises an error

The methods reuse the existing CustomersDot helpers. A later MR adds the first caller.

References

gitlab-org/orbit#19

Closes gitlab-org/orbit/knowledge-graph#1332

How to set up and validate locally

With a local CustomersDot, in the Rails console:

client = Gitlab::SubscriptionPortal::Client
client.start_product_trial(trial_type: :orbit, namespace_id: group.id)
client.product_trial(trial_type: :orbit, namespace_id: group.id)

Demo against a local CustomersDot: eligible group, start (201), start again (409), active, not on the allowlist (422), and ended.

MR acceptance checklist

See the MR acceptance checklist.

Edited by Jean-Gabriel Doyon

Merge request reports

Loading
Loading