squarefi-bff-api-module 1.36.40 → 1.36.41

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -13,12 +13,15 @@ export declare const frontend: {
13
13
  list: ({ status, ...params }?: API.Frontend.Issuing.Cards.List.Request) => Promise<API.Frontend.Issuing.Cards.List.Response>;
14
14
  deposit: ({ card_id, ...data }: API.Frontend.Issuing.Cards.Deposit.Request) => Promise<API.Frontend.Issuing.Cards.Deposit.Response>;
15
15
  withdraw: ({ card_id, ...data }: API.Frontend.Issuing.Cards.Withdraw.Request) => Promise<API.Frontend.Issuing.Cards.Withdraw.Response>;
16
+ create: (data: API.Frontend.Issuing.Cards.Create.Request) => Promise<API.Frontend.Issuing.Cards.Create.Response>;
16
17
  };
17
18
  cardholders: {
18
19
  list: (params?: API.Frontend.Issuing.Cardholders.List.Request) => Promise<API.Frontend.Issuing.Cardholders.List.Response>;
19
20
  create: (data: API.Frontend.Issuing.Cardholders.Create.Request) => Promise<API.Frontend.Issuing.Cardholders.Create.Response>;
20
21
  getById: ({ cardholder_id, ...params }: API.Frontend.Issuing.Cardholders.Get.Request) => Promise<API.Frontend.Issuing.Cardholders.Get.Response>;
21
22
  delete: ({ cardholder_id, ...params }: API.Frontend.Issuing.Cardholders.Delete.Request) => Promise<API.Frontend.Issuing.Cardholders.Delete.Response>;
23
+ update: ({ cardholder_id, wallet_id, ...data }: API.Frontend.Issuing.Cardholders.Update.Request) => Promise<API.Frontend.Issuing.Cardholders.Update.Response>;
24
+ eligibility: (data: API.Frontend.Issuing.Cardholders.Eligibility.Request) => Promise<API.Frontend.Issuing.Cardholders.Eligibility.Response>;
22
25
  submit: ({ cardholder_id, ...params }: API.Frontend.Issuing.Cardholders.Submit.Request) => Promise<API.Frontend.Issuing.Cardholders.Submit.Response>;
23
26
  documents: {
24
27
  upload: ({ wallet_id, ...files }: API.Frontend.Issuing.Cardholders.Documents.Upload.Request) => Promise<API.Frontend.Issuing.Cardholders.Documents.Upload.Response>;
@@ -22,6 +22,16 @@ export const frontend = {
22
22
  }),
23
23
  deposit: ({ card_id, ...data }) => apiClientV1Frontend.postRequest(`/frontend/issuing/cards/${card_id}/deposit`, { data }),
24
24
  withdraw: ({ card_id, ...data }) => apiClientV1Frontend.postRequest(`/frontend/issuing/cards/${card_id}/withdraw`, { data }),
25
+ // Unified create — the backend routes to the balance or prepaid flow by the program's
26
+ // `sub_account_type`, so there is one method for both. Replaces the legacy
27
+ // `issuing.cards.create.*` methods. The cardholder is either an explicit `cardholder_id`
28
+ // or resolved from `assigned_user_data_uuid` via the user's linked cardholder (provision it
29
+ // first through `cardholders.*` — an unlinked user gets `400 CARDHOLDER_NOT_LINKED`).
30
+ // Issuing fee / initial top-up follow the group tariff; pass `currency_id` (and optionally
31
+ // `initial_topup`) whenever the tariff carries money.
32
+ create: (data) => apiClientV1Frontend.postRequest('/frontend/issuing/cards', {
33
+ data,
34
+ }),
25
35
  },
26
36
  // Cardholder create flow (see the OpenAPI spec for details):
27
37
  // 1. `cardholders.create` — creates a DRAFT; no vendor is contacted. In `user_data_id` mode
@@ -36,6 +46,15 @@ export const frontend = {
36
46
  create: (data) => apiClientV1Frontend.postRequest('/frontend/issuing/cardholders', { data }),
37
47
  getById: ({ cardholder_id, ...params }) => apiClientV1Frontend.getRequest(`/frontend/issuing/cardholders/${cardholder_id}`, { params }),
38
48
  delete: ({ cardholder_id, ...params }) => apiClientV1Frontend.deleteRequest(`/frontend/issuing/cardholders/${cardholder_id}`, { params }),
49
+ // Complete a DRAFT's dossier (address / phone / email / tax id / gov_id fields) before
50
+ // submitting it — typically driven by the cardholder's `missing_kyc_fields`. `wallet_id`
51
+ // travels as a query parameter for access validation; everything else is the PATCH body.
52
+ update: ({ cardholder_id, wallet_id, ...data }) => apiClientV1Frontend.patchRequest(`/frontend/issuing/cardholders/${cardholder_id}`, { data, params: { wallet_id } }),
53
+ // Batch verdicts for a member picker: for each user_data uuid — can a card be issued right
54
+ // away (`READY`), is a draft waiting (`DRAFT`), can one be created (`CAN_CREATE`), or does
55
+ // the member have to verify first. `will_require` previews the fields to collect by hand;
56
+ // the created draft's `missing_kyc_fields` is the authoritative version.
57
+ eligibility: (data) => apiClientV1Frontend.postRequest('/frontend/issuing/cardholders/eligibility', { data }),
39
58
  // Retryable: a failed submit leaves the draft untouched, so it can be called again once the
40
59
  // dossier is complete (a `400 CARDHOLDER_SUBMISSION_INCOMPLETE` lists what is missing in
41
60
  // `error.details.missing`). While a review is running — or once the cardholder is live —
@@ -1,11 +1,19 @@
1
1
  import { API } from './types/types';
2
2
  export declare const issuing: {
3
3
  cards: {
4
+ /**
5
+ * @deprecated The legacy `/issuing/cards/*` create routes are deprecated (SFI-2129).
6
+ * Use `frontend.issuing.cards.create` — the unified `POST /frontend/issuing/cards` routes
7
+ * by the program's `sub_account_type` and carries the same fee/top-up handling.
8
+ */
4
9
  create: {
5
10
  standAloneCard: {
11
+ /** @deprecated Use `frontend.issuing.cards.create` (SFI-2129). */
6
12
  prepaid: (data: API.Cards.Create.StandAloneRequest) => Promise<API.Cards.Create.StandAloneResponse>;
13
+ /** @deprecated Use `frontend.issuing.cards.create` (SFI-2129). */
7
14
  balance: (data: API.Cards.Create.StandAloneRequest) => Promise<API.Cards.Create.ExtendedSubAccountResponse>;
8
15
  };
16
+ /** @deprecated Use `frontend.issuing.cards.create` with `sub_account_id` (SFI-2129). */
9
17
  subAccountCard: (data: API.Cards.Create.SubAccountRequest) => Promise<API.Cards.Create.ExtendedSubAccountResponse>;
10
18
  };
11
19
  byWalletUuid: {
@@ -3,9 +3,16 @@ import { defaultPaginationParams } from '../constants';
3
3
  import { makeSecureRequest } from '../utils/encrypt';
4
4
  export const issuing = {
5
5
  cards: {
6
+ /**
7
+ * @deprecated The legacy `/issuing/cards/*` create routes are deprecated (SFI-2129).
8
+ * Use `frontend.issuing.cards.create` — the unified `POST /frontend/issuing/cards` routes
9
+ * by the program's `sub_account_type` and carries the same fee/top-up handling.
10
+ */
6
11
  create: {
7
12
  standAloneCard: {
13
+ /** @deprecated Use `frontend.issuing.cards.create` (SFI-2129). */
8
14
  prepaid: (data) => apiClientV1.postRequest('/issuing/cards/create', { data }),
15
+ /** @deprecated Use `frontend.issuing.cards.create` (SFI-2129). */
9
16
  balance: async (data) => {
10
17
  const { id: sub_account_id } = await issuing.sub_accounts.create(data.wallet_id, data.program_id);
11
18
  const response = await apiClientV1.postRequest('/issuing/cards/balance', {
@@ -20,6 +27,7 @@ export const issuing = {
20
27
  };
21
28
  },
22
29
  },
30
+ /** @deprecated Use `frontend.issuing.cards.create` with `sub_account_id` (SFI-2129). */
23
31
  subAccountCard: async (data) => {
24
32
  const response = await apiClientV1.postRequest('/issuing/cards/balance', {
25
33
  data,
@@ -1734,6 +1734,12 @@ export interface paths {
1734
1734
  wallet_id?: string;
1735
1735
  /** @description Filter cardholders by issuing program ID */
1736
1736
  issuing_program_id?: string;
1737
+ /** @description Only cardholders LINKED to this CORE user (`user_data.uuid`, via the link
1738
+ * written by `user_data_id`-mode provisioning). Manually created cardholders
1739
+ * have no link and never match this filter. Each returned cardholder also
1740
+ * carries its link as `user_data_uuid` (null when unlinked).
1741
+ * */
1742
+ user_data_id?: string;
1737
1743
  /** @description Number of items to skip */
1738
1744
  offset?: number;
1739
1745
  /** @description Number of items to return */
@@ -1984,7 +1990,8 @@ export interface paths {
1984
1990
  "application/json": components["schemas"]["ApiErrorResponse"];
1985
1991
  };
1986
1992
  };
1987
- /** @description Cardholder with this email already exists in this wallet + issuing_program */
1993
+ /** @description Cardholder with this email already exists in this wallet + issuing_program. `error.details.cardholder_id` names the conflicting cardholder (when it could be resolved) so the client can adopt it instead of dead-ending.
1994
+ * */
1988
1995
  409: {
1989
1996
  headers: {
1990
1997
  [name: string]: unknown;
@@ -2207,11 +2207,46 @@ export interface paths {
2207
2207
  *
2208
2208
  */
2209
2209
  vendor_user_id?: string;
2210
+ /**
2211
+ * @description TOTAL wallet debit asked for at issuance: the issuing fee is subtracted and
2212
+ * the remainder lands on the card's sub-account. Accepted only on group tariffs
2213
+ * that already mandate an initial top-up (`initial_topup_usd > 0`); otherwise the
2214
+ * group amount stands. Requires `currency_id`.
2215
+ *
2216
+ * @example 100
2217
+ */
2218
+ initial_topup?: number;
2219
+ /**
2220
+ * Format: uuid
2221
+ * @description Wallet currency to debit for the issuing fee / initial top-up.
2222
+ * **Required whenever the group tariff carries a fee or a top-up** — the request
2223
+ * is refused with 400 otherwise.
2224
+ *
2225
+ */
2226
+ currency_id?: string;
2227
+ /**
2228
+ * Format: uuid
2229
+ * @description Client-generated idempotency key. A replay with the same value returns the
2230
+ * already-created card (same wallet) instead of issuing/charging again; a value
2231
+ * already used by another request is refused with 409. Globally unique.
2232
+ *
2233
+ */
2234
+ request_id?: string;
2210
2235
  };
2211
2236
  };
2212
2237
  };
2213
2238
  responses: {
2214
- /** @description Card created successfully */
2239
+ /** @description Card created successfully. `data` is the same fully-decorated card shape as
2240
+ * `GET /frontend/issuing/cards/{card_id}` — including `data.id` and
2241
+ * `data.sub_account_id` (the sub-account the card spends from; for prepaid cards it
2242
+ * is provisioned by this call).
2243
+ *
2244
+ * When the group tariff carried an issuing fee / initial top-up, `data` additionally
2245
+ * reports the money outcome: `initial_topup_status` is `completed` when the top-up
2246
+ * landed (or there was none to land), `topup_skipped` when no sub-account could
2247
+ * receive it (nothing debited), and `topup_failed` when the top-up transfer failed —
2248
+ * the card exists either way; `initial_topup_error` carries the failure reason.
2249
+ * */
2215
2250
  201: {
2216
2251
  headers: {
2217
2252
  [name: string]: unknown;
@@ -2220,7 +2255,15 @@ export interface paths {
2220
2255
  "application/json": {
2221
2256
  /** @example true */
2222
2257
  success?: boolean;
2223
- data?: components["schemas"]["IssuingCard"];
2258
+ data?: components["schemas"]["IssuingCard"] & {
2259
+ /**
2260
+ * @description Outcome of the issuance-time initial top-up. Present only when the tariff charged at issuance.
2261
+ * @enum {string}
2262
+ */
2263
+ initial_topup_status?: "completed" | "topup_failed" | "topup_skipped";
2264
+ /** @description Reason the initial top-up was skipped or failed. Present only when initial_topup_status is not `completed`. */
2265
+ initial_topup_error?: string;
2266
+ };
2224
2267
  /** @example Card created successfully */
2225
2268
  message?: string;
2226
2269
  };
@@ -4043,6 +4086,12 @@ export interface paths {
4043
4086
  wallet_id?: string;
4044
4087
  /** @description Filter cardholders by issuing program ID */
4045
4088
  issuing_program_id?: string;
4089
+ /** @description Only cardholders LINKED to this CORE user (`user_data.uuid`, via the link
4090
+ * written by `user_data_id`-mode provisioning). Manually created cardholders
4091
+ * have no link and never match this filter. Each returned cardholder also
4092
+ * carries its link as `user_data_uuid` (null when unlinked).
4093
+ * */
4094
+ user_data_id?: string;
4046
4095
  /** @description Number of items to skip */
4047
4096
  offset?: number;
4048
4097
  /** @description Number of items to return */
@@ -4282,12 +4331,31 @@ export interface paths {
4282
4331
  };
4283
4332
  content?: never;
4284
4333
  };
4285
- /** @description Cardholder with this email already exists in this wallet + issuing_program */
4334
+ /** @description Cardholder with this email already exists in this wallet + issuing_program. `error.details.cardholder_id` names the conflicting cardholder (when it could be resolved) so the client can adopt it instead of dead-ending.
4335
+ * */
4286
4336
  409: {
4287
4337
  headers: {
4288
4338
  [name: string]: unknown;
4289
4339
  };
4290
- content?: never;
4340
+ content: {
4341
+ "application/json": {
4342
+ /** @example false */
4343
+ success?: boolean;
4344
+ error?: {
4345
+ /** @example DUPLICATE_CARDHOLDER */
4346
+ code?: string;
4347
+ /** @example A cardholder with this email already exists for this wallet and issuing program */
4348
+ message?: string;
4349
+ details?: {
4350
+ /**
4351
+ * Format: uuid
4352
+ * @description Id of the already-existing (conflicting) cardholder
4353
+ */
4354
+ cardholder_id?: string;
4355
+ } | null;
4356
+ };
4357
+ };
4358
+ };
4291
4359
  };
4292
4360
  /** @description Internal Server Error */
4293
4361
  500: {
@@ -4432,6 +4500,131 @@ export interface paths {
4432
4500
  patch?: never;
4433
4501
  trace?: never;
4434
4502
  };
4503
+ "/frontend/issuing/cardholders/eligibility": {
4504
+ parameters: {
4505
+ query?: never;
4506
+ header?: never;
4507
+ path?: never;
4508
+ cookie?: never;
4509
+ };
4510
+ get?: never;
4511
+ put?: never;
4512
+ /**
4513
+ * Batch cardholder eligibility for wallet members
4514
+ * @description For each `user_data_id`, answers whether a card can be issued to that wallet member
4515
+ * right away — and if not, what stands in the way. Built for member pickers: one call
4516
+ * per page of members, verdicts computed from LOCAL data only (memberships, verification
4517
+ * statuses, KYC applicant references, cardholder links) — the KYC provider is never called.
4518
+ *
4519
+ * **Verdicts**:
4520
+ * - `READY` — an ACTIVE cardholder is linked (`cardholder_id`); create the card directly.
4521
+ * - `DRAFT` — a draft is linked (`cardholder_id`); complete `will_require` and submit it.
4522
+ * - `CAN_CREATE` — no cardholder yet, but the member clears the `user_data_id`-mode
4523
+ * creation gates (approved identity/face verification + KYC applicant).
4524
+ * - `PENDING` — a verification review is in flight; wait.
4525
+ * - `NEEDS_VERIFICATION` — no approved verification or no KYC applicant; the member has
4526
+ * to (re)run identity verification.
4527
+ * - `REJECTED` — a verification came back with a FINAL rejection; re-running it from the
4528
+ * app is not possible (support resets it), so never render a "verify now" action.
4529
+ * - `NOT_MEMBER` — the uuid is not an active member of this wallet.
4530
+ *
4531
+ * **`will_require`**: fields the client should expect to collect BY HAND (same vocabulary
4532
+ * as the submit 400 `missing` list, e.g. `address.line1`, `tax_identification_number`,
4533
+ * `email or phone`). For `DRAFT` it is the draft's actual leftovers; for `CAN_CREATE` it
4534
+ * is a projection that assumes the KYC dossier covers what it usually covers — the created
4535
+ * draft's `missing_kyc_fields` is the authoritative version.
4536
+ *
4537
+ * **Authentication**: Bearer token with x-tenant-id header; wallet ADMIN role required.
4538
+ *
4539
+ */
4540
+ post: {
4541
+ parameters: {
4542
+ query?: never;
4543
+ header?: never;
4544
+ path?: never;
4545
+ cookie?: never;
4546
+ };
4547
+ requestBody: {
4548
+ content: {
4549
+ "application/json": {
4550
+ /**
4551
+ * Format: uuid
4552
+ * @description Wallet whose members are being evaluated
4553
+ */
4554
+ wallet_id: string;
4555
+ /**
4556
+ * Format: uuid
4557
+ * @description Program the card would be issued under (drives the KYC bar)
4558
+ */
4559
+ issuing_program_id: string;
4560
+ /** @description user_data uuids of the members to evaluate */
4561
+ user_data_ids: string[];
4562
+ };
4563
+ };
4564
+ };
4565
+ responses: {
4566
+ /** @description One verdict per requested user_data_id (duplicates collapsed) */
4567
+ 200: {
4568
+ headers: {
4569
+ [name: string]: unknown;
4570
+ };
4571
+ content: {
4572
+ "application/json": {
4573
+ /** @example true */
4574
+ success?: boolean;
4575
+ data?: {
4576
+ /** Format: uuid */
4577
+ user_data_id: string;
4578
+ /** @enum {string} */
4579
+ verdict: "READY" | "DRAFT" | "CAN_CREATE" | "PENDING" | "NEEDS_VERIFICATION" | "REJECTED" | "NOT_MEMBER";
4580
+ /**
4581
+ * Format: uuid
4582
+ * @description The linked cardholder for READY/DRAFT verdicts
4583
+ */
4584
+ cardholder_id: string | null;
4585
+ /** @description Fields to collect by hand (submit `missing` vocabulary) */
4586
+ will_require: string[];
4587
+ }[];
4588
+ };
4589
+ };
4590
+ };
4591
+ /** @description Invalid input (missing program, empty/oversized/malformed id list), or the program is not available for the caller's user group — the same "This program is not available for your user group" failure cardholder creation gives.
4592
+ * */
4593
+ 400: {
4594
+ headers: {
4595
+ [name: string]: unknown;
4596
+ };
4597
+ content?: never;
4598
+ };
4599
+ /** @description Access denied to this wallet */
4600
+ 403: {
4601
+ headers: {
4602
+ [name: string]: unknown;
4603
+ };
4604
+ content?: never;
4605
+ };
4606
+ /** @description Issuing program not found */
4607
+ 404: {
4608
+ headers: {
4609
+ [name: string]: unknown;
4610
+ };
4611
+ content?: never;
4612
+ };
4613
+ /** @description Server error */
4614
+ 500: {
4615
+ headers: {
4616
+ [name: string]: unknown;
4617
+ };
4618
+ content?: never;
4619
+ };
4620
+ };
4621
+ };
4622
+ delete?: never;
4623
+ options?: never;
4624
+ head?: never;
4625
+ patch?: never;
4626
+ trace?: never;
4627
+ };
4435
4628
  "/frontend/issuing/cardholders/{cardholder_id}/submit": {
4436
4629
  parameters: {
4437
4630
  query?: never;
@@ -12266,22 +12459,78 @@ export interface components {
12266
12459
  /** Format: date-time */
12267
12460
  cleared_at?: string | null;
12268
12461
  };
12269
- /** @description Cardholder — the consumed subset (mirrors the frontend CardCardholder). The live vendor-proxied endpoint may return additional fields; only the supported subset is documented here. */
12462
+ /** @description Cardholder wire shape: the flattened cardholder record plus flat vendor fields (`vendor_*`, `review_status`, `reject_reason`), as returned by the cardholder list/get/create/update endpoints. */
12270
12463
  IssuingCardholder: {
12271
12464
  /** Format: uuid */
12272
12465
  id: string;
12466
+ /** Format: date-time */
12467
+ created_at?: string;
12273
12468
  first_name: string;
12274
12469
  last_name: string;
12275
12470
  /** Format: email */
12276
12471
  email?: string | null;
12277
12472
  phone?: string | null;
12278
- /** @description Date of birth */
12473
+ /** @description Date of birth (YYYY-MM-DD) */
12279
12474
  birth_date?: string | null;
12280
12475
  /**
12281
12476
  * @description ISO 3166 alpha-3
12282
12477
  * @example ESP
12283
12478
  */
12284
12479
  nationality?: string | null;
12480
+ /** Format: uuid */
12481
+ wallet_id?: string | null;
12482
+ /** Format: uuid */
12483
+ issuing_program_id?: string | null;
12484
+ /**
12485
+ * @description DRAFT until the cardholder is submitted and registered at the vendor.
12486
+ * @enum {string}
12487
+ */
12488
+ status: "DRAFT" | "ACTIVE";
12489
+ /** @description 'M' | 'F' where the vendor requires one */
12490
+ gender?: string | null;
12491
+ /** @enum {string|null} */
12492
+ cardholder_relationship?: "EMPLOYEE" | "CONTRACTOR" | null;
12493
+ address?: {
12494
+ line1?: string;
12495
+ line2?: string | null;
12496
+ city?: string;
12497
+ state?: string | null;
12498
+ postal_code?: string;
12499
+ /** @description ISO country code */
12500
+ country?: string;
12501
+ } | null;
12502
+ gov_id_type?: string | null;
12503
+ gov_id_number?: string | null;
12504
+ gov_id_country?: string | null;
12505
+ gov_id_issuance_date?: string | null;
12506
+ gov_id_expiration_date?: string | null;
12507
+ /** @description Personal tax id (US: SSN) */
12508
+ tax_identification_number?: string | null;
12509
+ /** @description Stored KYC file descriptors attached to the cardholder. */
12510
+ kyc_documents?: {
12511
+ /** @enum {string} */
12512
+ type?: "selfie" | "gov_id_front" | "gov_id_back";
12513
+ filename?: string | null;
12514
+ content_type?: string;
12515
+ size?: number;
12516
+ /** Format: date-time */
12517
+ uploaded_at?: string;
12518
+ }[];
12519
+ /** @description Fields the issuing program's KYC bar still wants from this cardholder (same vocabulary as the submit 400 `missing` list, e.g. `address.line1`, `documents: selfie`). Absent when the bar cannot be read. */
12520
+ missing_kyc_fields?: string[];
12521
+ /**
12522
+ * Format: uuid
12523
+ * @description CORE user this cardholder is linked to (user_data provisioning mode); null for manually-created cardholders.
12524
+ */
12525
+ user_data_uuid?: string | null;
12526
+ vendor_id?: string | null;
12527
+ vendor_name?: string | null;
12528
+ vendor_type?: string | null;
12529
+ /** @description Vendor-side cardholder id; null while a review is pending. */
12530
+ vendor_user_id?: string | null;
12531
+ vendor_status?: string | null;
12532
+ review_status?: string | null;
12533
+ reject_reason?: string | null;
12285
12534
  };
12286
12535
  /** @description Crypto wallet with nested addresses */
12287
12536
  CryptoWallet: {
@@ -1611,7 +1611,11 @@ export interface paths {
1611
1611
  put?: never;
1612
1612
  /**
1613
1613
  * Create a new prepaid card
1614
- * @description Creates a new prepaid card for the user. Initial topup amount is determined by user group settings.
1614
+ * @deprecated
1615
+ * @description **Deprecated.** Use `POST /frontend/issuing/cards` (unified, routes by the program's
1616
+ * `sub_account_type`) instead — it carries the same fee/top-up handling.
1617
+ *
1618
+ * Creates a new prepaid card for the user. Initial topup amount is determined by user group settings.
1615
1619
  *
1616
1620
  * **Cardholder is required**: Every card must be associated with a cardholder.
1617
1621
  * Create a cardholder first, then pass the `cardholder_id` here.
@@ -1716,7 +1720,11 @@ export interface paths {
1716
1720
  put?: never;
1717
1721
  /**
1718
1722
  * Create a new balance card
1719
- * @description Creates a new card linked to an existing balance account for the user. Card fees and initial topup are determined by user group settings.
1723
+ * @deprecated
1724
+ * @description **Deprecated.** Use `POST /frontend/issuing/cards` (unified, routes by the program's
1725
+ * `sub_account_type`) instead — it carries the same fee/top-up handling.
1726
+ *
1727
+ * Creates a new card linked to an existing balance account for the user. Card fees and initial topup are determined by user group settings.
1720
1728
  *
1721
1729
  * **Cardholder is required**: Every card must be associated with a cardholder.
1722
1730
  * Create a cardholder first, then pass the `cardholder_id` here.
@@ -6163,7 +6163,8 @@ export interface paths {
6163
6163
  };
6164
6164
  content?: never;
6165
6165
  };
6166
- /** @description Cardholder with this email already exists in this wallet + issuing_program */
6166
+ /** @description Cardholder with this email already exists in this wallet + issuing_program. `error.details.cardholder_id` names the conflicting cardholder when it could be resolved.
6167
+ * */
6167
6168
  409: {
6168
6169
  headers: {
6169
6170
  [name: string]: unknown;
@@ -710,6 +710,32 @@ export declare namespace API {
710
710
  type Response = CardsRoot['get']['responses']['200']['content']['application/json'];
711
711
  type Card = NonNullable<Response['data']>[number];
712
712
  }
713
+ namespace Create {
714
+ type Request = Omit<CardsRoot['post']['requestBody']['content']['application/json'], 'cardholder_id'> & {
715
+ cardholder_id?: string;
716
+ /** Card assignee (`user_data.uuid`); their linked cardholder is used. */
717
+ assigned_user_data_uuid?: string;
718
+ /**
719
+ * TOTAL wallet debit at issuance (fee + card top-up). Accepted only on group
720
+ * tariffs that already mandate an initial top-up. Requires `currency_id`.
721
+ */
722
+ initial_topup?: number;
723
+ /** Wallet currency to debit; required whenever the tariff has a fee or a top-up. */
724
+ currency_id?: string;
725
+ /** Client-generated id stored with the card (idempotency/tracing reference). */
726
+ request_id?: string;
727
+ };
728
+ type Response = CardsRoot['post']['responses']['201']['content']['application/json'] & {
729
+ /**
730
+ * Outcome of the tariff-mandated initial top-up when the tariff moved money:
731
+ * `topup_skipped` when no top-up applied, `topup_failed` when the card was created
732
+ * but the top-up could not be executed — a 201 alone is NOT proof the card is funded.
733
+ */
734
+ initial_topup_status?: 'completed' | 'topup_failed' | 'topup_skipped';
735
+ /** Why the top-up failed; populated when `initial_topup_status` is `topup_failed`. */
736
+ initial_topup_error?: string;
737
+ };
738
+ }
713
739
  namespace Deposit {
714
740
  type Request = {
715
741
  card_id: string;
@@ -724,34 +750,145 @@ export declare namespace API {
724
750
  }
725
751
  }
726
752
  export namespace Cardholders {
727
- type Cardholder = componentsV1Frontend['schemas']['IssuingCardholder'];
728
- namespace List {
729
- type Request = NonNullable<CardholdersRoot['get']['parameters']['query']>;
730
- type Response = CardholdersRoot['get']['responses']['200']['content']['application/json'];
753
+ export type Cardholder = componentsV1Frontend['schemas']['IssuingCardholder'] & {
754
+ created_at?: string;
755
+ wallet_id?: string | null;
756
+ issuing_program_id?: string | null;
757
+ /** DRAFT until the cardholder is submitted and registered at the vendor. */
758
+ status?: 'DRAFT' | 'ACTIVE';
759
+ gender?: string | null;
760
+ cardholder_relationship?: 'EMPLOYEE' | 'CONTRACTOR' | null;
761
+ address?: {
762
+ line1?: string;
763
+ line2?: string | null;
764
+ city?: string;
765
+ state?: string | null;
766
+ postal_code?: string;
767
+ country?: string;
768
+ } | null;
769
+ gov_id_type?: string | null;
770
+ gov_id_number?: string | null;
771
+ gov_id_country?: string | null;
772
+ gov_id_issuance_date?: string | null;
773
+ gov_id_expiration_date?: string | null;
774
+ /** Personal tax id (US: SSN) — independent of the gov_id document. */
775
+ tax_identification_number?: string | null;
776
+ kyc_documents?: {
777
+ type?: 'selfie' | 'gov_id_front' | 'gov_id_back';
778
+ filename?: string | null;
779
+ content_type?: string;
780
+ size?: number;
781
+ uploaded_at?: string;
782
+ }[];
783
+ /**
784
+ * Fields the program's KYC bar still wants (submit 400 `missing` vocabulary, e.g.
785
+ * `address.line1`, `documents: selfie`) — what the completion form should collect.
786
+ */
787
+ missing_kyc_fields?: string[];
788
+ /** CORE user this cardholder is linked to; null for manually-created cardholders. */
789
+ user_data_uuid?: string | null;
790
+ vendor_id?: string | null;
791
+ vendor_name?: string | null;
792
+ vendor_type?: string | null;
793
+ /** Vendor-side cardholder id; null while a review is pending. */
794
+ vendor_user_id?: string | null;
795
+ vendor_status?: string | null;
796
+ review_status?: string | null;
797
+ reject_reason?: string | null;
798
+ };
799
+ type WithCardholder<T extends {
800
+ data?: unknown;
801
+ }> = Omit<T, 'data'> & {
802
+ data?: Cardholder;
803
+ };
804
+ type WithCardholderList<T extends {
805
+ data?: unknown;
806
+ }> = Omit<T, 'data'> & {
807
+ data?: Cardholder[];
808
+ };
809
+ export namespace List {
810
+ type Request = NonNullable<CardholdersRoot['get']['parameters']['query']> & {
811
+ /**
812
+ * Only cardholders LINKED to this CORE user (`user_data.uuid`). Manually created
813
+ * cardholders have no link and never match. Added in SFI-2129.
814
+ */
815
+ user_data_id?: string;
816
+ };
817
+ type Response = WithCardholderList<CardholdersRoot['get']['responses']['200']['content']['application/json']>;
731
818
  }
732
- namespace Create {
819
+ export namespace Create {
733
820
  type Request = CardholdersRoot['post']['requestBody']['content']['application/json'];
734
- type Response = CardholdersRoot['post']['responses']['201']['content']['application/json'];
821
+ type Response = WithCardholder<CardholdersRoot['post']['responses']['201']['content']['application/json']>;
735
822
  }
736
- namespace Get {
823
+ export namespace Get {
737
824
  type Request = {
738
825
  cardholder_id: string;
739
826
  } & NonNullable<CardholderRoot['get']['parameters']['query']>;
740
- type Response = CardholderRoot['get']['responses']['200']['content']['application/json'];
827
+ type Response = WithCardholder<CardholderRoot['get']['responses']['200']['content']['application/json']>;
741
828
  }
742
- namespace Delete {
829
+ export namespace Update {
830
+ type Request = {
831
+ cardholder_id: string;
832
+ /** Query param — the wallet the cardholder belongs to (ADMIN role required). */
833
+ wallet_id: string;
834
+ } & Partial<Pick<Create.Request, 'first_name' | 'last_name' | 'email' | 'phone' | 'birth_date' | 'nationality' | 'gender' | 'cardholder_relationship' | 'address' | 'gov_id_type' | 'gov_id_number' | 'gov_id_country' | 'gov_id_issuance_date' | 'gov_id_expiration_date' | 'tax_identification_number'>>;
835
+ type Response = {
836
+ success?: boolean;
837
+ data?: Cardholder;
838
+ message?: string;
839
+ };
840
+ }
841
+ export namespace Eligibility {
842
+ type Verdict =
843
+ /** An ACTIVE cardholder is linked — create the card right away. */
844
+ 'READY'
845
+ /** A draft is linked — complete `will_require`, submit, then create the card. */
846
+ | 'DRAFT'
847
+ /** No cardholder yet, but the member clears the creation gates. */
848
+ | 'CAN_CREATE'
849
+ /** A verification review is in flight; wait. */
850
+ | 'PENDING'
851
+ /** No approved verification or no KYC applicant — the member must verify. */
852
+ | 'NEEDS_VERIFICATION'
853
+ /**
854
+ * A verification came back with a FINAL rejection — only support can
855
+ * reset it. Never render an actionable "verify now" for this state.
856
+ */
857
+ | 'REJECTED'
858
+ /** Not an active member of this wallet. */
859
+ | 'NOT_MEMBER';
860
+ type Request = {
861
+ wallet_id: string;
862
+ issuing_program_id: string;
863
+ /** user_data uuids of the members to evaluate, max 100 per request. */
864
+ user_data_ids: string[];
865
+ };
866
+ type Item = {
867
+ user_data_id: string;
868
+ verdict: Verdict;
869
+ /** The linked cardholder for READY/DRAFT verdicts, null otherwise. */
870
+ cardholder_id: string | null;
871
+ /** Fields to collect by hand (submit `missing` vocabulary). */
872
+ will_require: string[];
873
+ };
874
+ type Response = {
875
+ success?: boolean;
876
+ data?: Item[];
877
+ };
878
+ }
879
+ export namespace Delete {
743
880
  type Request = {
744
881
  cardholder_id: string;
745
882
  } & NonNullable<CardholderRoot['delete']['parameters']['query']>;
746
883
  type Response = CardholderRoot['delete']['responses']['200']['content']['application/json'];
747
884
  }
748
- namespace Submit {
885
+ export namespace Submit {
749
886
  type Request = {
750
887
  cardholder_id: string;
751
888
  } & CardholderSubmitRoot['post']['parameters']['query'];
752
- type Response = CardholderSubmitRoot['post']['responses']['200']['content']['application/json'];
889
+ type Response = WithCardholder<CardholderSubmitRoot['post']['responses']['200']['content']['application/json']>;
753
890
  }
754
- namespace Documents {
891
+ export namespace Documents {
755
892
  type DocumentType = keyof CardholderDocumentsUploadRoot['post']['requestBody']['content']['multipart/form-data'];
756
893
  namespace Upload {
757
894
  type Request = {
@@ -780,6 +917,7 @@ export declare namespace API {
780
917
  export {};
781
918
  }
782
919
  }
920
+ export {};
783
921
  }
784
922
  export {};
785
923
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "squarefi-bff-api-module",
3
- "version": "1.36.40",
3
+ "version": "1.36.41",
4
4
  "description": "Squarefi BFF API client module",
5
5
  "type": "module",
6
6
  "main": "./dist/index.js",