Skip to content

fix: restore customer_id on blockchain/offramp wallet and limit-increase responses - #62

Merged
ericviana merged 1 commit into
mainfrom
eric/customer-id-forward-compatible
Jul 27, 2026
Merged

fix: restore customer_id on blockchain/offramp wallet and limit-increase responses#62
ericviana merged 1 commit into
mainfrom
eric/customer-id-forward-compatible

Conversation

@ericviana

Copy link
Copy Markdown
Member

Summary

The wave 1 PR (#61) merged two commits: the intended wave-1 webhook/filter additions, and a second commit that reverted BlockchainWalletOut, OfframpWallet and GetLimitIncreaseRequestsResponse back to receiver_id. That second commit reasoned only from the declared zod schema in openapi.json, which is not what actually leaves the socket.

addCustomerIdMiddleware (apps/api/src/shared/helpers/customer-migration.ts in blindpay-v2, mounted on every customer route) rewrites responses: whenever an object carries receiver_id, it adds customer_id with the same value, at the top level and inside a data array. It does not recurse into nested object/array properties such as owners[].

So today, in production:

  • Blockchain wallet responses (list/get/create), offramp wallet responses (list/get), and limit-increase responses already carry customer_id via the middleware alias.
  • The nested Owner element inside a business customer's owners[] does not get customer_id today, because the middleware never recurses into it.

The post-#1799 spec (once the server-side rename ships) declares customer_id as required on all four of these shapes, including the nested owner. receiver_id goes away there.

Changes

File Symbol Key now declared Required Justification
src/resources/wallets/blockchain.ts ListBlockchainWalletsResponse element customer_id yes middleware alias (today) + post-#1799 spec
src/resources/wallets/blockchain.ts GetBlockchainWalletResponse customer_id yes middleware alias (today) + post-#1799 spec
src/resources/wallets/blockchain.ts CreateBlockchainWalletResponse customer_id yes middleware alias (today) + post-#1799 spec
src/resources/wallets/offramp.ts OfframpWallet (used by list/get) customer_id yes middleware alias (today) + post-#1799 spec
src/resources/customers/index.ts GetLimitIncreaseRequestsResponse element customer_id yes middleware alias (today) + post-#1799 spec
src/resources/customers/index.ts Owner (nested owners[] element) receiver_id (kept) + customer_id (added) no, both optional transitional: receiver_id is what production sends there today (middleware doesn't recurse into it); customer_id is what post-#1799 will send

Nothing else changed: receiver_amount, receivers_amount, currency_type, the receiver.* webhook enum members and stored re_ ids are all untouched.

Test fixtures for blockchain, offramp and limit-increase were updated from receiver_id back to customer_id. Because these three response shapes keep customer_id as a required field (not optional), the typed fixture literals give TypeScript excess-property + missing-property checks in both directions: reverting to receiver_id again, or dropping customer_id, both fail bun run check-types.

Bump: 4.1.0 -> 4.1.1 (patch — corrects a type declaration, no new feature). Added a changeset accordingly.

Test plan

  • bun install --frozen-lockfile
  • bun run check-types — clean
  • bun run lint:check — clean
  • bun run test — 97/97 passing
  • bun run build — succeeds
  • CI green on the PR (polling after push)

https://claude.ai/code/session_01F1stiNzuNtJXoXtiW9ZCbs

…ase responses

The wave 1 PR (#61) also merged a second commit that reverted BlockchainWalletOut,
OfframpWallet and GetLimitIncreaseRequestsResponse to receiver_id, reasoning from the
declared zod schema in openapi.json alone. That schema is not what leaves the socket:
addCustomerIdMiddleware (apps/api/src/shared/helpers/customer-migration.ts) rewrites
every customer-route response, adding customer_id wherever receiver_id is present, at
both the top level and inside a response's data array. It does not recurse into nested
object/array properties such as owners[].

So customer_id is already on the wire today for these three response shapes, and it
is also the field name the post-#1799 spec declares once the server-side rename ships.
Restore customer_id as required for the three affected shapes.

The nested Owner.owners[] element is the one place the middleware does not reach today:
declare both receiver_id and customer_id there as optional, since receiver_id is what
production actually sends there now and customer_id is what it will send after #1799.

Bump to 4.1.1 (patch: corrects a type declaration, no feature).

Claude-Session: https://claude.ai/code/session_01F1stiNzuNtJXoXtiW9ZCbs
@BernardoSM

BernardoSM commented Jul 27, 2026

Copy link
Copy Markdown
Contributor

Snyk checks have passed. No issues have been found so far.

Status Scan Engine Critical High Medium Low Total (0)
Open Source Security 0 0 0 0 0 issues
Licenses 0 0 0 0 0 issues
Code Security 0 0 0 0 0 issues

💻 Catch issues earlier using the plugins for VS Code, JetBrains IDEs, Visual Studio, and Eclipse.

@ericviana
ericviana merged commit a3746a0 into main Jul 27, 2026
9 checks passed
@ericviana
ericviana deleted the eric/customer-id-forward-compatible branch July 27, 2026 16:28
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