fix(testkit): create a fresh Stripe customer per test run#29
Merged
Conversation
The Stripe provider's createOrUpdateCustomer reuses an existing customer matched by email (Customer.list(email).headOption). With the fixed test email demo@softnetwork.fr, every run reattached pm_card_visa to the SAME persisted customer until Stripe rejected with customer_max_payment_methods, failing StripeLicenseIntegrationSpec.registerCard (and any card flow) — the in-memory journal means the account is recreated each run, so the email lookup is the actual reuse vector. Make `email` unique per JVM run (demo+<uuid8>@softnetwork.fr), evaluated once as a val so it stays a single source of truth within a run (every user/assertion referencing `email` still sees the same value) while differing across runs → Customer.list misses → a brand-new customer each run. This ships in the published payment-testkit artifact, so republish payment-testkit for downstream consumers (e.g. softclient4es-license-server) to pick it up. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #29 +/- ##
========================================
Coverage 40.94% 40.94%
========================================
Files 155 155
Lines 10859 10859
Branches 1604 1810 +206
========================================
Hits 4446 4446
Misses 6413 6413
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
The Stripe provider's createOrUpdateCustomer reuses an existing customer matched by email (Customer.list(email).headOption). With the fixed test email demo@softnetwork.fr, every run reattached pm_card_visa to the SAME persisted customer until Stripe rejected with customer_max_payment_methods, failing StripeLicenseIntegrationSpec.registerCard (and any card flow) — the in-memory journal means the account is recreated each run, so the email lookup is the actual reuse vector.
Make
emailunique per JVM run (demo+@softnetwork.fr), evaluated once as a val so it stays a single source of truth within a run (every user/assertion referencingemailstill sees the same value) while differing across runs → Customer.list misses → a brand-new customer each run.This ships in the published payment-testkit artifact, so republish payment-testkit for downstream consumers (e.g. softclient4es-license-server) to pick it up.