Charge legacy us_bank_account instruments through PaymentIntents - #257
Charge legacy us_bank_account instruments through PaymentIntents #257asterdrak wants to merge 6 commits into
Conversation
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: e9e076f030
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
| elsif listed.size == 1 | ||
| listed.first |
There was a problem hiding this comment.
Reject a mismatched instrument before singleton fallback
When unstore receives an explicit compound identifier such as cus_X|pm_old, but Stripe now lists one different instrument—for example, because pm_old was already detached or replaced—this fallback silently selects and detaches that remaining instrument. This can remove another payment profile's live bank account even though the caller named a different one; the singleton fallback should apply only when instrument_id is absent, while a supplied but unlisted ID should produce a no-op or error.
Useful? React with 👍 / 👎.
There was a problem hiding this comment.
Hardened in 8cbff29: a named instrument that is no longer attached now returns a success no-op ("Payment method already detached") instead of falling through to the singleton/default guesses, with a test. Note the scenario is unreachable through the only production caller today — conduit passes the bare cus_ token, never a compound id — so this closes the API surface, not a live path.
|
Test evidence, since this repo has no CI:
|
|
Small refactoring here: #258 |
Related work:
https://github.com/maxio-com/chargify/pull/30281