Fix LOB-BANK-DIAGNOSTIC: Owner-only endpoint to fetch Lob's view of a bank account#202
Open
bmoss2015 wants to merge 1 commit into
Open
Fix LOB-BANK-DIAGNOSTIC: Owner-only endpoint to fetch Lob's view of a bank account#202bmoss2015 wants to merge 1 commit into
bmoss2015 wants to merge 1 commit into
Conversation
… bank account
After two rounds of the $0.01-and-immediate-reversal pattern with no
second micro-deposit landing, we need to see what Lob actually thinks
about bank_5b6b93b4d5730ab. Our DB only shows what we wrote, not what
Lob has recorded (verification_status, attempts, reversal codes,
signatory mismatch, etc).
Adds:
- lobGetBankAccount helper in lib/mail/lob.ts that calls GET /v1/
bank_accounts/{id} and returns the raw Lob response untouched
- /api/admin/lob-bank-debug owner-only endpoint that joins the portal
row with the live Lob lookup. Returns bare JSON, no UI.
Usage:
GET /api/admin/lob-bank-debug?id=<mail_bank_accounts.id>
GET /api/admin/lob-bank-debug?lob_id=bank_xxxxxxxxxxxxxxx
One-shot diagnostic. Kept around for future bank-verification debugging.
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
|
This pull request has been ignored for the connected project Preview Branches by Supabase. |
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.
Why
The bank Bree added Friday 6/19 has gone through two rounds of $0.01 deposit + immediate reversal with no second micro-deposit, and the same pattern happened in May. Our DB only shows what we wrote into it (status=unverified, 0 attempts). It does not tell us what Lob has recorded about the verification attempts, ACH return codes, or whether Lob thinks the account is failed vs pending.
This adds a one-shot diagnostic so we can see Lob's authoritative view.
What
lobGetBankAccount(bnkId)helper inlib/mail/lob.ts— callsGET /v1/bank_accounts/{id}and returns the raw Lob response object/api/admin/lob-bank-debug— owner-only Next.js route handler that joins the portal row with the live Lob lookupUsage
Sign in to app.nextsurplus.com as owner, then visit either:
https://app.nextsurplus.com/api/admin/lob-bank-debug?id=edfbe660-8ee8-4b85-b3d6-53682f2ee134(the unverified Mercury account)https://app.nextsurplus.com/api/admin/lob-bank-debug?lob_id=bank_5b6b93b4d5730ab(direct Lob ID)Returns bare JSON:
{ ok, portal_row, lob_bank_id, lob_response: { ok, raw: { ... } } }.Test plan
npx tsc --noEmitpasses🤖 Generated with Claude Code