From 482af2b7db29cbb0722b58ffe37218c0b78bb365 Mon Sep 17 00:00:00 2001 From: Eric Viana Date: Mon, 27 Jul 2026 13:16:46 -0300 Subject: [PATCH] fix: restore customer_id on blockchain/offramp wallet and limit-increase 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 --- .changeset/customer-id-forward-compatible.md | 5 +++++ package.json | 2 +- src/resources/customers/customers.test.ts | 6 +++--- src/resources/customers/index.ts | 3 ++- src/resources/wallets/blockchain.test.ts | 8 ++++---- src/resources/wallets/blockchain.ts | 6 +++--- src/resources/wallets/offramp.test.ts | 4 ++-- src/resources/wallets/offramp.ts | 2 +- 8 files changed, 21 insertions(+), 15 deletions(-) create mode 100644 .changeset/customer-id-forward-compatible.md diff --git a/.changeset/customer-id-forward-compatible.md b/.changeset/customer-id-forward-compatible.md new file mode 100644 index 0000000..24f3a1f --- /dev/null +++ b/.changeset/customer-id-forward-compatible.md @@ -0,0 +1,5 @@ +--- +"@blindpay/node": patch +--- + +Revert `BlockchainWalletOut`, `OfframpWallet` and `GetLimitIncreaseRequestsResponse` back to declaring `customer_id`. A response-rewriting middleware already aliases `receiver_id` to `customer_id` on every customer route in production, so `customer_id` is present on the wire today, and it becomes the API's own field name once the server-side rename ships. The nested `Owner` type now declares both `receiver_id` and `customer_id` as optional: production sends neither on that nested object today, `receiver_id` will keep working, and `customer_id` will start arriving once the server-side rename ships. diff --git a/package.json b/package.json index ba94cb0..b2ce39c 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "@blindpay/node", - "version": "4.1.0", + "version": "4.1.1", "description": "Official Node.js SDK for Blindpay API - Stablecoin API for global payments", "keywords": [ "blindpay", diff --git a/src/resources/customers/customers.test.ts b/src/resources/customers/customers.test.ts index 9e34e47..7dba1b8 100644 --- a/src/resources/customers/customers.test.ts +++ b/src/resources/customers/customers.test.ts @@ -577,7 +577,7 @@ describe("Customers", () => { const mockedLimitIncreaseRequests: GetLimitIncreaseRequestsResponse = [ { id: "rl_000000000000", - receiver_id: "re_YuaMcI2B8zbQ", + customer_id: "re_YuaMcI2B8zbQ", status: "in_review", daily: 50000, monthly: 250000, @@ -589,7 +589,7 @@ describe("Customers", () => { }, { id: "rl_000000000000", - receiver_id: "re_YuaMcI2B8zbQ", + customer_id: "re_YuaMcI2B8zbQ", status: "approved", daily: 30000, monthly: 150000, @@ -618,7 +618,7 @@ describe("Customers", () => { const mockedLimitIncreaseRequests: GetLimitIncreaseRequestsResponse = [ { id: "rl_000000000000", - receiver_id: "re_YuaMcI2B8zbQ", + customer_id: "re_YuaMcI2B8zbQ", status: "approved", daily: 50000, monthly: 250000, diff --git a/src/resources/customers/index.ts b/src/resources/customers/index.ts index d2102c2..c438af9 100644 --- a/src/resources/customers/index.ts +++ b/src/resources/customers/index.ts @@ -74,6 +74,7 @@ export type Owner = { tax_type?: OwnerTaxType | null; instance_id?: string; receiver_id?: string; + customer_id?: string; }; export type IndividualWithStandardKYC = { @@ -485,7 +486,7 @@ export type LimitIncreaseRequestSupportingDocumentType = export type GetLimitIncreaseRequestsResponse = Array<{ id: string; - receiver_id: string; + customer_id: string; status: LimitIncreaseRequestStatus; daily: number; monthly: number; diff --git a/src/resources/wallets/blockchain.test.ts b/src/resources/wallets/blockchain.test.ts index e0c277b..f9fa396 100644 --- a/src/resources/wallets/blockchain.test.ts +++ b/src/resources/wallets/blockchain.test.ts @@ -40,7 +40,7 @@ describe("Blockchain wallets", () => { address: "0xDD6a3aD0949396e57C7738ba8FC1A46A5a1C372C", signature_tx_hash: "0x3c499c542cef5e3811e1192ce70d8cc03d5c3359", is_account_abstraction: false, - receiver_id: "re_000000000000", + customer_id: "re_000000000000", }, ]; @@ -64,7 +64,7 @@ describe("Blockchain wallets", () => { address: "0xDD6a3aD0949396e57C7738ba8FC1A46A5a1C372C", signature_tx_hash: undefined, is_account_abstraction: true, - receiver_id: "re_000000000000", + customer_id: "re_000000000000", }; fetchMock.mockResponseOnce(JSON.stringify(mockedWallet), { @@ -92,7 +92,7 @@ describe("Blockchain wallets", () => { address: "0xDD6a3aD0949396e57C7738ba8FC1A46A5a1C372C", signature_tx_hash: "0x3c499c542cef5e3811e1192ce70d8cc03d5c3359", is_account_abstraction: false, - receiver_id: "re_000000000000", + customer_id: "re_000000000000", }; fetchMock.mockResponseOnce(JSON.stringify(mockedWallet), { @@ -120,7 +120,7 @@ describe("Blockchain wallets", () => { address: "0xDD6a3aD0949396e57C7738ba8FC1A46A5a1C372C", signature_tx_hash: "0x3c499c542cef5e3811e1192ce70d8cc03d5c3359", is_account_abstraction: false, - receiver_id: "re_000000000000", + customer_id: "re_000000000000", }; fetchMock.mockResponseOnce(JSON.stringify(mockedWallet), { diff --git a/src/resources/wallets/blockchain.ts b/src/resources/wallets/blockchain.ts index e3fa9f5..5b239b3 100644 --- a/src/resources/wallets/blockchain.ts +++ b/src/resources/wallets/blockchain.ts @@ -16,7 +16,7 @@ export type ListBlockchainWalletsResponse = Array<{ address?: string; signature_tx_hash?: string; is_account_abstraction: boolean; - receiver_id: string; + customer_id: string; }>; export type CreateBlockchainWalletWithAddressInput = { @@ -50,7 +50,7 @@ export type GetBlockchainWalletResponse = { address?: string; signature_tx_hash?: string; is_account_abstraction: boolean; - receiver_id: string; + customer_id: string; }; export type CreateBlockchainWalletResponse = { @@ -60,7 +60,7 @@ export type CreateBlockchainWalletResponse = { address?: string; signature_tx_hash?: string; is_account_abstraction: boolean; - receiver_id: string; + customer_id: string; }; export type CreateAssetTrustlineInput = string; diff --git a/src/resources/wallets/offramp.test.ts b/src/resources/wallets/offramp.test.ts index b61a842..5cdb540 100644 --- a/src/resources/wallets/offramp.test.ts +++ b/src/resources/wallets/offramp.test.ts @@ -14,7 +14,7 @@ describe("Offramp wallets", () => { id: "ow_000000000000", external_id: "your_external_id", instance_id: "in_000000000000", - receiver_id: "re_000000000000", + customer_id: "re_000000000000", bank_account_id: "ba_000000000000", network: "tron", address: "TALJN9zTTEL9TVBb4WuTt6wLvPqJZr3hvb", @@ -92,7 +92,7 @@ describe("Offramp wallets", () => { id: "ow_000000000000", external_id: "your_external_id", instance_id: "in_000000000000", - receiver_id: "re_000000000000", + customer_id: "re_000000000000", bank_account_id: "ba_000000000000", network: "tron", address: "TALJN9zTTEL9TVBb4WuTt6wLvPqJZr3hvb", diff --git a/src/resources/wallets/offramp.ts b/src/resources/wallets/offramp.ts index 30b7384..35ca46f 100644 --- a/src/resources/wallets/offramp.ts +++ b/src/resources/wallets/offramp.ts @@ -18,7 +18,7 @@ export type OfframpWallet = { id: string; external_id: string; instance_id: string; - receiver_id: string; + customer_id: string; bank_account_id: string; network: OfframpWalletNetwork; address: string;