fix: restore customer_id on blockchain/offramp wallet and limit-increase responses - #62
Merged
Merged
Conversation
…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
Contributor
✅ Snyk checks have passed. No issues have been found so far.
💻 Catch issues earlier using the plugins for VS Code, JetBrains IDEs, Visual Studio, and Eclipse. |
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.
Summary
The wave 1 PR (#61) merged two commits: the intended wave-1 webhook/filter additions, and a second commit that reverted
BlockchainWalletOut,OfframpWalletandGetLimitIncreaseRequestsResponseback toreceiver_id. That second commit reasoned only from the declared zod schema inopenapi.json, which is not what actually leaves the socket.addCustomerIdMiddleware(apps/api/src/shared/helpers/customer-migration.tsin blindpay-v2, mounted on every customer route) rewrites responses: whenever an object carriesreceiver_id, it addscustomer_idwith the same value, at the top level and inside adataarray. It does not recurse into nested object/array properties such asowners[].So today, in production:
customer_idvia the middleware alias.Ownerelement inside a business customer'sowners[]does not getcustomer_idtoday, because the middleware never recurses into it.The post-#1799 spec (once the server-side rename ships) declares
customer_idas required on all four of these shapes, including the nested owner.receiver_idgoes away there.Changes
src/resources/wallets/blockchain.tsListBlockchainWalletsResponseelementcustomer_idsrc/resources/wallets/blockchain.tsGetBlockchainWalletResponsecustomer_idsrc/resources/wallets/blockchain.tsCreateBlockchainWalletResponsecustomer_idsrc/resources/wallets/offramp.tsOfframpWallet(used by list/get)customer_idsrc/resources/customers/index.tsGetLimitIncreaseRequestsResponseelementcustomer_idsrc/resources/customers/index.tsOwner(nestedowners[]element)receiver_id(kept) +customer_id(added)receiver_idis what production sends there today (middleware doesn't recurse into it);customer_idis what post-#1799 will sendNothing else changed:
receiver_amount,receivers_amount,currency_type, thereceiver.*webhook enum members and storedre_ids are all untouched.Test fixtures for blockchain, offramp and limit-increase were updated from
receiver_idback tocustomer_id. Because these three response shapes keepcustomer_idas a required field (not optional), the typed fixture literals give TypeScript excess-property + missing-property checks in both directions: reverting toreceiver_idagain, or droppingcustomer_id, both failbun 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-lockfilebun run check-types— cleanbun run lint:check— cleanbun run test— 97/97 passingbun run build— succeedshttps://claude.ai/code/session_01F1stiNzuNtJXoXtiW9ZCbs