fix(cloud): persist Connect payouts_enabled from webhook — unblock every fiat payout (#11172) - #11187
NubsCarson wants to merge 1 commit into
Conversation
…ook (#11172) The account.updated webhook derived status from the capability booleans but dropped them, persisting only status. The payout transfer gate checks account.payouts_enabled directly, which defaults false (migration 0150) and had no production writer — so every Stripe Connect fiat payout was rejected even for a fully onboarded account. Persist charges_enabled/payouts_enabled alongside status (the repository setter already accepts them) so the gate reflects real Stripe state. Keeps the explicit gate check intact. Closes #11172.
|
Important Review skippedAuto reviews are disabled on this repository. Please check the settings in the CodeRabbit UI or the ⚙️ Run configurationConfiguration used: Organization UI Review profile: CHILL Plan: Pro Run ID: You can disable this status message by setting the Use the checkbox below for a quick retry:
✨ Finishing Touches🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
There was a problem hiding this comment.
Your trial has ended. Reactivate Greptile to resume code reviews.
|
Closing as duplicate of #11190, which ships the same webhook persistence fix with tests (including updating the existing route test this branch would have broken) and camelCase outcome fields consistent with ConnectWebhookOutcome. |
|
Claude encountered an error —— View job I'll analyze this and get back to you. |
What
Persists
charges_enabled/payouts_enabledfrom the Stripe Connectaccount.updatedwebhook, closing the launch-blocker #11172 (every fiat payout permanently rejected).Why
mapConnectWebhookEventderivedstatusfrom the capability booleans but dropped them; the webhook handler persisted onlystatus. The payout transfer gate (transfer/route.ts:73) checksaccount.payouts_enableddirectly, and that column defaultsfalse(migration 0150) with no production writer — so a fully-onboarded creator (status='active') still fails!account.payouts_enabledand can never withdraw via the fiat rail.Change (2 files, minimal)
stripe-connect-payout.ts:ConnectWebhookOutcomecarriescharges_enabled?/payouts_enabled?; theaccount.updatedcase returns them (computed once, still feedsconnectStatusFromCapabilities).webhook/route.ts: persist those flags viaupdateByAccountId(the repository setter already accepts them).Chosen the "keep the column truthful" fix (option a from #11172) over dropping the gate's column check (option b) — it doesn't alter the gate's security posture, just makes
payouts_enabledreflect real Stripe state. No new migration; no behavior change for the status enum.Verification
status === 'active' && payouts_enablednow passes for an onboarded account, becauseaccount.updated(both caps true) writesstatus='active'andpayouts_enabled=true.payouts_enabled=false) now writes bothstatus(→ non-active viaconnectStatusFromCapabilities) and the column, so the gate closes correctly.stripe-connect-webhook-route.test.ts/stripe-connect-transfer-route.test.tscover the surface; recommend a case asserting the column is written onaccount.updated.Money-path — not self-merged. @lalalune, this is the top launch-blocker if fiat payout is in scope.
[cloud-audit]Closes #11172.