squarefi-bff-api-module 1.36.6 → 1.36.8

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.
@@ -1,15 +1,16 @@
1
1
  import { API } from './types/types';
2
2
  export declare const counterparties: {
3
3
  getAll: ({ wallet_id, ...params }: API.Counterparties.List.Request) => Promise<API.Counterparties.List.Response>;
4
- getById: ({ wallet_id, counterparty_account_id, }: API.Counterparties.GetById.Request) => Promise<API.Counterparties.GetById.Response>;
4
+ getById: ({ counterparty_account_id, }: API.Counterparties.GetById.Request) => Promise<API.Counterparties.GetById.Response>;
5
5
  create: ({ wallet_id, ...data }: API.Counterparties.Create.Request) => Promise<API.Counterparties.Create.Response>;
6
- update: ({ wallet_id, counterparty_account_id, ...data }: API.Counterparties.Update.Request) => Promise<API.Counterparties.Update.Response>;
7
- delete: ({ wallet_id, counterparty_account_id, }: API.Counterparties.Delete.Request) => Promise<API.Counterparties.Delete.Response>;
6
+ update: ({ counterparty_account_id, wallet_id: _wallet_id, ...data }: API.Counterparties.Update.Request) => Promise<API.Counterparties.Update.Response>;
7
+ delete: ({ counterparty_account_id, }: API.Counterparties.Delete.Request) => Promise<API.Counterparties.Delete.Response>;
8
8
  destinations: {
9
- getAll: ({ wallet_id, counterparty_account_id, ...params }: API.Counterparties.Destination.List.Request) => Promise<API.Counterparties.Destination.List.Response>;
10
- getById: ({ wallet_id, counterparty_account_id, counterparty_destination_id, }: API.Counterparties.Destination.Detail.Request) => Promise<API.Counterparties.Destination.Detail.Response>;
11
- create: ({ wallet_id, counterparty_account_id, ...data }: API.Counterparties.Destination.Create.Request) => Promise<API.Counterparties.Destination.Create.Response>;
12
- update: ({ wallet_id, counterparty_account_id, counterparty_destination_id, ...data }: API.Counterparties.Destination.Update.Request) => Promise<API.Counterparties.Destination.Update.Response>;
13
- delete: ({ wallet_id, counterparty_account_id, counterparty_destination_id, }: API.Counterparties.Destination.Delete.Request) => Promise<void>;
9
+ getAll: ({ wallet_id, ...params }: API.Counterparties.Destination.List.Request) => Promise<API.Counterparties.Destination.List.Response>;
10
+ getById: ({ counterparty_destination_id, }: API.Counterparties.Destination.Detail.Request) => Promise<API.Counterparties.Destination.Detail.Response>;
11
+ create: ({ wallet_id: _wallet_id, external_banking_data, external_crypto_data, internal_data, ...rest }: API.Counterparties.Destination.Create.Request) => Promise<API.Counterparties.Destination.Create.Response>;
12
+ update: ({ counterparty_destination_id, wallet_id: _wallet_id, counterparty_account_id: _counterparty_account_id, ...data }: API.Counterparties.Destination.Update.Request) => Promise<API.Counterparties.Destination.Update.Response>;
13
+ delete: ({ counterparty_destination_id, request_id, }: API.Counterparties.Destination.Delete.Request) => Promise<void>;
14
+ internalTransfer: ({ counterparty_destination_id, }: API.Counterparties.Destination.InternalTransfer.Request) => Promise<API.Counterparties.Destination.InternalTransfer.Response>;
14
15
  };
15
16
  };
@@ -1,17 +1,76 @@
1
- import { apiClientV2 } from '../utils/apiClientFactory';
1
+ import { apiClientV1Frontend } from '../utils/apiClientFactory';
2
+ // Бэкенд отдаёт реквизиты под ключами banking_data / crypto_data / internal_data; ровно одно
3
+ // заполнено и определяется полем type (а не наличием payload — см. описание схемы). Downstream
4
+ // исторически читает external_banking_data / external_crypto_data — сохраняем эти имена, INTERNAL
5
+ // проносим как есть (нового слота "external" для него нет). Дискриминируем строго по type.
6
+ const mapDestination = (destination) => {
7
+ const common = {
8
+ id: destination.id,
9
+ nickname: destination.nickname ?? null,
10
+ type: destination.type,
11
+ created_at: destination.created_at,
12
+ };
13
+ if (destination.type === 'CRYPTO_EXTERNAL' || destination.type === 'CRYPTO_INTERNAL') {
14
+ return { ...common, external_crypto_data: destination.crypto_data };
15
+ }
16
+ if (destination.type === 'INTERNAL') {
17
+ return { ...common, internal_data: destination.internal_data };
18
+ }
19
+ return { ...common, external_banking_data: destination.banking_data };
20
+ };
2
21
  export const counterparties = {
3
- getAll: ({ wallet_id, ...params }) => apiClientV2.getRequest(`/counterparties/${wallet_id}`, {
4
- params,
5
- }),
6
- getById: ({ wallet_id, counterparty_account_id, }) => apiClientV2.getRequest(`/counterparties/${wallet_id}/${counterparty_account_id}`),
7
- create: ({ wallet_id, ...data }) => apiClientV2.postRequest(`/counterparties/${wallet_id}`, { data }),
8
- update: ({ wallet_id, counterparty_account_id, ...data }) => apiClientV2.patchRequest(`/counterparties/${wallet_id}/${counterparty_account_id}`, { data }),
9
- delete: ({ wallet_id, counterparty_account_id, }) => apiClientV2.deleteRequest(`/counterparties/${wallet_id}/${counterparty_account_id}`),
22
+ getAll: async ({ wallet_id, ...params }) => {
23
+ const res = await apiClientV1Frontend.getRequest(`/frontend/counterparty/accounts/wallet/${wallet_id}`, { params });
24
+ return { total: res.pagination?.total ?? res.data.length, data: res.data };
25
+ },
26
+ getById: async ({ counterparty_account_id, }) => {
27
+ const res = await apiClientV1Frontend.getRequest(`/frontend/counterparty/accounts/${counterparty_account_id}`);
28
+ const { destinations, ...account } = res.data.account;
29
+ return { ...account, destinations: destinations.map(mapDestination) };
30
+ },
31
+ create: async ({ wallet_id, ...data }) => {
32
+ const res = await apiClientV1Frontend.postRequest(`/frontend/counterparty/accounts/wallet/${wallet_id}`, { data });
33
+ return res.data.account;
34
+ },
35
+ update: async ({ counterparty_account_id, wallet_id: _wallet_id, ...data }) => {
36
+ const res = await apiClientV1Frontend.patchRequest(`/frontend/counterparty/accounts/${counterparty_account_id}`, { data });
37
+ return res.data.account;
38
+ },
39
+ delete: async ({ counterparty_account_id, }) => {
40
+ const res = (await apiClientV1Frontend.deleteRequest(`/frontend/counterparty/accounts/${counterparty_account_id}`));
41
+ return res.data;
42
+ },
10
43
  destinations: {
11
- getAll: ({ wallet_id, counterparty_account_id, ...params }) => apiClientV2.getRequest(`/counterparties/${wallet_id}/${counterparty_account_id}/destinations`, { params }),
12
- getById: ({ wallet_id, counterparty_account_id, counterparty_destination_id, }) => apiClientV2.getRequest(`/counterparties/${wallet_id}/${counterparty_account_id}/destinations/${counterparty_destination_id}`),
13
- create: ({ wallet_id, counterparty_account_id, ...data }) => apiClientV2.postRequest(`/counterparties/${wallet_id}/${counterparty_account_id}/destinations`, { data }),
14
- update: ({ wallet_id, counterparty_account_id, counterparty_destination_id, ...data }) => apiClientV2.patchRequest(`/counterparties/${wallet_id}/${counterparty_account_id}/destinations/${counterparty_destination_id}`, { data }),
15
- delete: ({ wallet_id, counterparty_account_id, counterparty_destination_id, }) => apiClientV2.deleteRequest(`/counterparties/${wallet_id}/${counterparty_account_id}/destinations/${counterparty_destination_id}`),
44
+ getAll: async ({ wallet_id, ...params }) => {
45
+ const res = await apiClientV1Frontend.getRequest(`/frontend/counterparty/destinations/wallet/${wallet_id}`, { params });
46
+ return { total: res.pagination?.total ?? res.data.length, data: res.data.map(mapDestination) };
47
+ },
48
+ getById: async ({ counterparty_destination_id, }) => {
49
+ const res = await apiClientV1Frontend.getRequest(`/frontend/counterparty/destinations/${counterparty_destination_id}`);
50
+ return mapDestination(res.data.destination);
51
+ },
52
+ create: async ({ wallet_id: _wallet_id, external_banking_data, external_crypto_data, internal_data, ...rest }) => {
53
+ const data = {
54
+ ...rest,
55
+ ...(external_banking_data ? { banking_data: external_banking_data } : {}),
56
+ ...(external_crypto_data ? { crypto_data: external_crypto_data } : {}),
57
+ ...(internal_data ? { internal_data } : {}),
58
+ };
59
+ const res = await apiClientV1Frontend.postRequest(`/frontend/counterparty/destinations`, { data });
60
+ return mapDestination(res.data.destination);
61
+ },
62
+ update: async ({ counterparty_destination_id, wallet_id: _wallet_id, counterparty_account_id: _counterparty_account_id, ...data }) => {
63
+ const res = await apiClientV1Frontend.patchRequest(`/frontend/counterparty/destinations/${counterparty_destination_id}`, { data });
64
+ return mapDestination(res.data.destination);
65
+ },
66
+ delete: async ({ counterparty_destination_id, request_id, }) => {
67
+ await apiClientV1Frontend.deleteRequest(`/frontend/counterparty/destinations/${counterparty_destination_id}`, {
68
+ params: { request_id },
69
+ });
70
+ },
71
+ internalTransfer: async ({ counterparty_destination_id, }) => {
72
+ const res = await apiClientV1Frontend.getRequest(`/frontend/counterparty/destinations/${counterparty_destination_id}/internal-transfer`);
73
+ return res.data;
74
+ },
16
75
  },
17
76
  };
@@ -890,7 +890,7 @@ export interface paths {
890
890
  * @description Payment rail type
891
891
  * @enum {string}
892
892
  */
893
- type: "ACH" | "SWIFT" | "SEPA" | "CRYPTO_EXTERNAL" | "CRYPTO_INTERNAL" | "CHAPS" | "FPS" | "FEDWIRE";
893
+ type: "ACH" | "SWIFT" | "SEPA" | "CRYPTO_EXTERNAL" | "CRYPTO_INTERNAL" | "CHAPS" | "FPS" | "FEDWIRE" | "INTERNAL";
894
894
  /** @description User-friendly alias for this destination */
895
895
  nickname?: string;
896
896
  /** @description Required for banking types (ACH, SWIFT, SEPA, CHAPS, FPS, FEDWIRE) */
@@ -931,6 +931,16 @@ export interface paths {
931
931
  /** @description Memo/tag (for XRP, XLM, etc.) */
932
932
  memo?: string;
933
933
  };
934
+ /** @description Required for type INTERNAL — points at the receiver wallet on the same platform. */
935
+ internal_data?: {
936
+ /**
937
+ * Format: uuid
938
+ * @description Target (receiver) wallet uuid on the same platform.
939
+ */
940
+ wallet_id: string;
941
+ /** @description Optional, reserved for future use. */
942
+ description?: string;
943
+ };
934
944
  };
935
945
  };
936
946
  };
@@ -2009,8 +2019,10 @@ export interface paths {
2009
2019
  program_id?: string;
2010
2020
  /** @description Filter cards by program sub-account type (prepaid or balance) */
2011
2021
  sub_account_type?: "prepaid" | "balance";
2012
- /** @description Filter cards by status */
2013
- status?: "ACTIVE" | "INACTIVE" | "SUSPENDED" | "CANCELED";
2022
+ /** @description Filter cards by status.
2023
+ * Accepts a single value or a comma-separated list, e.g. `status=ACTIVE,CANCELED`.
2024
+ * */
2025
+ status?: ("ACTIVE" | "INACTIVE" | "SUSPENDED" | "CANCELED")[];
2014
2026
  /** @description Filter cards by last 4 digits of the card number (partial, case-insensitive match) */
2015
2027
  last4?: string;
2016
2028
  /** @description Number of items to skip */
@@ -2113,13 +2125,16 @@ export interface paths {
2113
2125
  /**
2114
2126
  * Format: uuid
2115
2127
  * @description ID of the cardholder to associate with this card.
2116
- * **Required.** Must be a valid cardholder ID retrieved from `GET /api/issuing/cardholders`
2117
- * or created via `POST /api/issuing/cardholders`.
2128
+ * **Optional.** When omitted, a cardholder is resolved
2129
+ * automatically for the card owner (the user the card is issued
2130
+ * for): an existing cardholder for that user is reused, otherwise
2131
+ * one is created. Provide a value (from `GET /api/issuing/cardholders`
2132
+ * or `POST /api/issuing/cardholders`) to bind a specific cardholder.
2118
2133
  * The cardholder will be automatically registered at the vendor if not already present.
2119
2134
  *
2120
2135
  * @example a1b2c3d4-e5f6-7890-abcd-ef1234567890
2121
2136
  */
2122
- cardholder_id: string;
2137
+ cardholder_id?: string;
2123
2138
  /**
2124
2139
  * @description Name for the card
2125
2140
  * @example My Card
@@ -4461,10 +4476,10 @@ export interface paths {
4461
4476
  from_currency_id: string;
4462
4477
  /**
4463
4478
  * Format: uuid
4464
- * @description Target wallet UUID on the same platform tenant.
4465
- * @example a1b2c3d4-e5f6-4789-9abc-def012345678
4479
+ * @description Counterparty destination of type INTERNAL (points at the receiver wallet on the same tenant).
4480
+ * @example b2f3d8c1-4a7e-4d22-9c5f-1e6a8d0b2a44
4466
4481
  */
4467
- to_wallet_id: string;
4482
+ counterparty_destination_id: string;
4468
4483
  /** @example 50 */
4469
4484
  amount: number;
4470
4485
  /**
@@ -6939,7 +6954,7 @@ export interface components {
6939
6954
  /** @description Routing/sort code */
6940
6955
  routing_number?: string | null;
6941
6956
  /** @description Bank name */
6942
- bank_name?: string | null;
6957
+ bank_name: string | null;
6943
6958
  /** @description SWIFT/BIC code */
6944
6959
  swift_bic?: string | null;
6945
6960
  /** @description IBAN */
@@ -6949,6 +6964,8 @@ export interface components {
6949
6964
  /** @description Additional notes/reference */
6950
6965
  note?: string | null;
6951
6966
  address?: components["schemas"]["BankingAddress"];
6967
+ /** Format: date-time */
6968
+ created_at: string;
6952
6969
  } | null;
6953
6970
  /** @description Currency reference (short) */
6954
6971
  CurrencyRef: {
@@ -6967,7 +6984,7 @@ export interface components {
6967
6984
  /** Format: uuid */
6968
6985
  id?: string;
6969
6986
  /** @description Blockchain address */
6970
- address?: string;
6987
+ address: string;
6971
6988
  /**
6972
6989
  * Format: uuid
6973
6990
  * @description Currency UUID
@@ -6975,7 +6992,21 @@ export interface components {
6975
6992
  currency_id?: string;
6976
6993
  /** @description Memo/tag (for XRP, XLM, etc.) */
6977
6994
  memo?: string | null;
6978
- currency?: components["schemas"]["CurrencyRef"];
6995
+ currency: components["schemas"]["CurrencyRef"];
6996
+ /** Format: date-time */
6997
+ created_at: string;
6998
+ } | null;
6999
+ /** @description Internal destination payload — the receiver wallet on the same platform. Populated when type is INTERNAL; null otherwise. */
7000
+ CounterpartyInternalData: {
7001
+ /**
7002
+ * Format: uuid
7003
+ * @description Target (receiver) wallet uuid
7004
+ */
7005
+ wallet_id: string;
7006
+ /** @description Optional, reserved for future use */
7007
+ description?: string | null;
7008
+ /** Format: date-time */
7009
+ created_at: string;
6979
7010
  } | null;
6980
7011
  /** @description Payment destination linked to a counterparty account */
6981
7012
  CounterpartyDestination: {
@@ -6993,7 +7024,7 @@ export interface components {
6993
7024
  * @description Destination/payment rail type
6994
7025
  * @enum {string}
6995
7026
  */
6996
- type?: "ACH" | "SWIFT" | "SEPA" | "CRYPTO_EXTERNAL" | "CRYPTO_INTERNAL" | "CHAPS" | "FPS" | "FEDWIRE";
7027
+ type?: "ACH" | "SWIFT" | "SEPA" | "CRYPTO_EXTERNAL" | "CRYPTO_INTERNAL" | "CHAPS" | "FPS" | "FEDWIRE" | "INTERNAL";
6997
7028
  /** @description User-friendly alias */
6998
7029
  nickname?: string | null;
6999
7030
  /** Format: date-time */
@@ -7002,6 +7033,7 @@ export interface components {
7002
7033
  updated_at?: string;
7003
7034
  banking_data?: components["schemas"]["BankingData"];
7004
7035
  crypto_data?: components["schemas"]["CryptoData"];
7036
+ internal_data?: components["schemas"]["CounterpartyInternalData"];
7005
7037
  };
7006
7038
  ApiSuccessResponse: {
7007
7039
  /** @example true */