Skip to content

Conversation

julienbourdeau
Copy link
Contributor

@julienbourdeau julienbourdeau commented Jun 5, 2025

This PR adds fixtures for 2025-04-30.basil. I removed the forced version for some call if the client version is set.

The fixtures were reorganize a little to make it easier for next upgrades:

  1. All webhook payload are under webhooks/.
  2. The webhook event file name is the name of the webhook event (no suffix or extra description)
  3. The content is always the full event (with evt_* id included)
  4. HTTP call response fixutres are suffixed with _response but can have extra description in the name.

Payloads are copy pasted AS-IS from stripe and never edited.
If you need to update the payload for the purpose of your tests, for example setting the metadata.lago_payable_id (very typical), use the helper to modify the payload. Don't edit the files.

Next time we upgrade, we only have to copy the payload to a file.

let(:event_json) do
  get_stripe_fixtures("webhooks/setup_intent_succeeded.json") do |h|
    h[:data][:object][:customer] = "cus_666" if h[:data][:object][:customer].nil?
    h[:data][:object][:metadata] = metadata
  end
end
let(:stripe_customer) do
  create(:stripe_customer, payment_provider: stripe_provider, customer:, provider_customer_id: "cus_123")
end

@julienbourdeau julienbourdeau self-assigned this Jun 5, 2025
@julienbourdeau julienbourdeau force-pushed the feat/stripe-fixtures-2025-04-30.basil branch 3 times, most recently from f53a58b to a7aeb26 Compare June 5, 2025 12:27
@julienbourdeau julienbourdeau force-pushed the feat/stripe-fixtures-2025-04-30.basil branch from a7aeb26 to 36b56e5 Compare June 9, 2025 08:01
Copy link
Contributor

@annvelents annvelents left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

👏 Looks good 😁

@julienbourdeau julienbourdeau force-pushed the feat/stripe-fixtures-2025-04-30.basil branch from 84dc067 to 36b56e5 Compare June 9, 2025 08:49
@julienbourdeau julienbourdeau merged commit 6c7c739 into main Jun 9, 2025
24 checks passed
@julienbourdeau julienbourdeau deleted the feat/stripe-fixtures-2025-04-30.basil branch June 9, 2025 08:59
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants