Skip to content

Charge legacy us_bank_account instruments through PaymentIntents - #257

Open
asterdrak wants to merge 6 commits into
masterfrom
PAY-3931-imp
Open

Charge legacy us_bank_account instruments through PaymentIntents #257
asterdrak wants to merge 6 commits into
masterfrom
PAY-3931-imp

Conversation

@asterdrak

@asterdrak asterdrak commented Aug 21, 2026

Copy link
Copy Markdown

@asterdrak asterdrak self-assigned this Aug 21, 2026
@asterdrak asterdrak changed the title Fix ACH unstore payment method selection Charge legacy us_bank_account instruments through PaymentIntents Aug 21, 2026
@asterdrak
asterdrak marked this pull request as ready for review August 24, 2026 09:18

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

💡 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".

Comment on lines +97 to +98
elsif listed.size == 1
listed.first

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

P1 Badge 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 👍 / 👎.

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

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

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.

@asterdrak

Copy link
Copy Markdown
Author

Test evidence, since this repo has no CI:

  • Gateway under change: test/unit/gateways/stripe_ach_setup_intents_test.rb22 tests, 71 assertions, 0 failures at head 8cbff291.
  • Full unit suite, head vs merge-base (a466b20e): 3,616 tests both; identical failure sets (62) — the diff between the two runs is a single object memory address. Every failure, including all 12 in StripeTest, pre-exists on master (Ruby 3.4 bit-rot: Psych 4 strictness, extract_options!, test-unit skip) and is untouched by this PR.
  • Integration: maxio-com/chargify#30281 CI runs the full app suite with Gemfile pinned to this branch's head, which exercises this gateway through conduit.
  • Real-API coverage: the staging end-to-end on PAY-3931 (store → mandate → PaymentIntent charge on a live legacy ba_); the one deliberately unexecuted call is PaymentMethod.detach against a legacy ba_ on a real account, which is why profile destroy stays on the legacy vault for the migrated book.

@asterdrak
asterdrak requested review from Marcin-Kozdras, mizinsky and mykhi and removed request for Marcin-Kozdras, mizinsky and mykhi August 25, 2026 12:19
@dbackowski

Copy link
Copy Markdown

Small refactoring here: #258

@dbackowski dbackowski left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

🚀

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