Pass idempotency key from SubscriptionsController#create to CustomersDot
What does this MR do and why?
As part of the effort in https://gitlab.com/groups/gitlab-org/-/epics/10972+, we're allowing the subscription and add-on purchase flows to send an idempotency key to the CustomersDot backend. However, the Gitlab.com backend does not currently permit that parameter through its purchase creation endpoint (POST /-/subscriptions
).
The frontend subscription and add-on purchase pages already send an :idempotency_key
parameter to SubscriptionsController#create
, so this MR passes it along through the GitLabSubscriptions::CreateService
so it can be added to the CustomersDot REST calls.
Screenshots or screen recordings
No visual changes.
How to set up and validate locally
- Start GDK and CustomersDot.
- For the subscription purchase page and the add-on purchase page:
- Go through the purchase flow and purchase a subcription or add-on.
- In the CustomersDot logs, you should see output showing a non-nil
idempotency_key
param value:
web | Processing by SubscriptionsController#create as JSON
web | Parameters: {"products"=>{"main"=>{"quantity"=>1}}, "promo_code"=>nil, "plan_id"=>"[plan_id]", "payment_method_id"=>"[payment_method_id]", "gl_namespace_id"=>236, "gl_namespace_name"=>"test-423448-group", "preview"=>"false", "source"=>nil, "idempotency_key"=>"[FILTERED]", "subscription"=>{"products"=>{"main"=>{"quantity"=>1}}, "promo_code"=>nil, "plan_id"=>"[plan_id]", "payment_method_id"=>"[payment_method_id]", "gl_namespace_id"=>236, "gl_namespace_name"=>"test-423448-group", "preview"=>"false", "source"=>nil, "idempotency_key"=>"[FILTERED]"}}
MR acceptance checklist
This checklist encourages us to confirm any changes have been analyzed to reduce risks in quality, performance, reliability, security, and maintainability.
-
I have evaluated the MR acceptance checklist for this MR.