Skip to content

Send correct idempotency_key during add-on purchase

Angelo Gulina requested to merge ag/6977-idempotency-key-add-on into master

What does this MR do and why?

Relates to https://gitlab.com/gitlab-org/customers-gitlab-com/-/issues/6977 – with this MR, we are providing an idempotency_key param to the BE. The key helps avoiding duplicate orders cases. Read more here.

The key depends on, and will be refreshed when changes happen to, the following:

  1. payment method ID (generated by Zuora)
  2. selected plan ID
  3. selected quantity
  4. selected namespace

Additionally, to force refresh on all 4xx error code cases, an idempotencyKeyAttempts is also considered.

Screenshots or screen recordings

Screenshots are required for UI changes, and strongly recommended for all other merge requests.

Key params regeneration https://www.loom.com/share/e1c7f20200be4f68b2e230e34a443656?sid=dbed7c66-77fc-4f6b-8ecf-2b16fe2c462a
4xx https://www.loom.com/share/3f12529f6533447ea26ed0b8be45fc70?sid=f76538e8-8555-4a1b-b2b3-db6105ddf528
5xx https://www.loom.com/share/15377cfb79f54cc9b584669a7c08824a?sid=dd9f7e0c-1f79-4475-9aa7-43ead30e7941
Invalid card + success https://www.loom.com/share/f2509dabd49c4e9caffd8535fc875d2a?sid=b5acd21b-c090-47fc-9607-cdd0eb1c5f4d

How to set up and validate locally

  • Make sure to have the following env variables set up, before starting gdk
    • CUSTOMER_PORTAL_URL to https://customers.staging.gitlab.com
    • GITLAB_SIMULATE_SAAS to true
    • GITLAB_LICENSE_MODE to test
  • Create a Group
  • Buy a Subscription
  • Visit -/subscriptions/buy_minutes?selected_group=<your-group-id>
  • Cases:
    • 4xx and 5xx are done by manually returning them from the create action of gitlab/ee/app/controllers/subscriptions_controller.rb
    • Invalid CC numbers are available at Stripe

MR acceptance checklist

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

Edited by Angelo Gulina

Merge request reports