squarefi-bff-api-module 1.36.5 → 1.36.7

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,15 @@
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
14
  };
15
15
  };
@@ -1,17 +1,72 @@
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
+ },
16
71
  },
17
72
  };
@@ -43,6 +43,11 @@ export declare const orders: {
43
43
  L2F_FPS_OFFRAMP: (data: API.Orders.V2.Create.ByOrderType.L2F_FPS_OFFRAMP.Request) => Promise<API.Orders.V2.Create.ByOrderType.L2F_FPS_OFFRAMP.Response>;
44
44
  BRL_WIRE_OFFRAMP: (data: API.Orders.V2.Create.ByOrderType.BRL_WIRE_OFFRAMP.Request) => Promise<API.Orders.V2.Create.ByOrderType.BRL_WIRE_OFFRAMP.Response>;
45
45
  BRL_ACH_OFFRAMP: (data: API.Orders.V2.Create.ByOrderType.BRL_ACH_OFFRAMP.Request) => Promise<API.Orders.V2.Create.ByOrderType.BRL_ACH_OFFRAMP.Response>;
46
+ BRL_RTP_OFFRAMP: (data: API.Orders.V2.Create.ByOrderType.BRL_RTP_OFFRAMP.Request) => Promise<API.Orders.V2.Create.ByOrderType.BRL_RTP_OFFRAMP.Response>;
47
+ DLS_WIRE_OFFRAMP: (data: API.Orders.V2.Create.ByOrderType.DLS_WIRE_OFFRAMP.Request) => Promise<API.Orders.V2.Create.ByOrderType.DLS_WIRE_OFFRAMP.Response>;
48
+ DLS_ACH_OFFRAMP: (data: API.Orders.V2.Create.ByOrderType.DLS_ACH_OFFRAMP.Request) => Promise<API.Orders.V2.Create.ByOrderType.DLS_ACH_OFFRAMP.Response>;
49
+ DLS_SEPA_OFFRAMP: (data: API.Orders.V2.Create.ByOrderType.DLS_SEPA_OFFRAMP.Request) => Promise<API.Orders.V2.Create.ByOrderType.DLS_SEPA_OFFRAMP.Response>;
50
+ DLS_SWIFT_OFFRAMP: (data: API.Orders.V2.Create.ByOrderType.DLS_SWIFT_OFFRAMP.Request) => Promise<API.Orders.V2.Create.ByOrderType.DLS_SWIFT_OFFRAMP.Response>;
46
51
  };
47
52
  };
48
53
  list: {
@@ -76,6 +76,11 @@ export const orders = {
76
76
  [OrderType.L2F_FPS_OFFRAMP]: (data) => apiClientV1.postRequest('/v2/orders/L2F_FPS_OFFRAMP', { data }),
77
77
  [OrderType.BRL_WIRE_OFFRAMP]: (data) => apiClientV1.postRequest('/v2/orders/BRL_WIRE_OFFRAMP', { data }),
78
78
  [OrderType.BRL_ACH_OFFRAMP]: (data) => apiClientV1.postRequest('/v2/orders/BRL_ACH_OFFRAMP', { data }),
79
+ [OrderType.BRL_RTP_OFFRAMP]: (data) => apiClientV1.postRequest('/v2/orders/BRL_RTP_OFFRAMP', { data }),
80
+ [OrderType.DLS_WIRE_OFFRAMP]: (data) => apiClientV1.postRequest('/v2/orders/DLS_WIRE_OFFRAMP', { data }),
81
+ [OrderType.DLS_ACH_OFFRAMP]: (data) => apiClientV1.postRequest('/v2/orders/DLS_ACH_OFFRAMP', { data }),
82
+ [OrderType.DLS_SEPA_OFFRAMP]: (data) => apiClientV1.postRequest('/v2/orders/DLS_SEPA_OFFRAMP', { data }),
83
+ [OrderType.DLS_SWIFT_OFFRAMP]: (data) => apiClientV1.postRequest('/v2/orders/DLS_SWIFT_OFFRAMP', { data }),
79
84
  },
80
85
  },
81
86
  list: {
@@ -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
  /**
@@ -6447,7 +6462,7 @@ export interface components {
6447
6462
  * @example EXCHANGE_OMNI
6448
6463
  * @enum {string}
6449
6464
  */
6450
- OrderTypeId: "EXCHANGE_OMNI" | "EXCHANGE_OMNI_ONRAMP" | "EXCHANGE_OMNI_OFFRAMP" | "EXCHANGE_OMNI_CRYPTO" | "EXCHANGE_CRYPTO_INTERNAL" | "L2F_ACH_ONRAMP" | "L2F_ACH_OFFRAMP" | "L2F_SEPA_ONRAMP" | "L2F_SEPA_OFFRAMP" | "L2F_SWIFT_ONRAMP" | "L2F_SWIFT_OFFRAMP" | "L2F_WIRE_ONRAMP" | "L2F_WIRE_OFFRAMP" | "L2F_CHAPS_ONRAMP" | "L2F_CHAPS_OFFRAMP" | "L2F_FPS_ONRAMP" | "L2F_FPS_OFFRAMP" | "BRL_WIRE_ONRAMP" | "BRL_WIRE_OFFRAMP" | "BRL_ACH_ONRAMP" | "BRL_ACH_OFFRAMP" | "OMNIBUS_CRYPTO_TRANSFER" | "OMNIBUS_CRYPTO_WITHDRAWAL" | "OMNIBUS_INTERNAL_TRANSFER" | "SEGREGATED_CRYPTO_TRANSFER" | "TRANSFER_INTERNAL" | "TRANSFER_CARD_PREPAID" | "TRANSFER_CARD_SUBACCOUNT" | "TRANSFER_CARD_WHOLESALE" | "WITHDRAW_CARD_PREPAID" | "WITHDRAW_CARD_SUBACCOUNT" | "REFUND_CARD_PREPAID" | "REFUND_CARD_SUBACCOUNT" | "RN_CARDS_OFFRAMP" | "CARD_ISSUING_FEE";
6465
+ OrderTypeId: "EXCHANGE_OMNI" | "EXCHANGE_OMNI_ONRAMP" | "EXCHANGE_OMNI_OFFRAMP" | "EXCHANGE_OMNI_CRYPTO" | "EXCHANGE_CRYPTO_INTERNAL" | "L2F_ACH_ONRAMP" | "L2F_ACH_OFFRAMP" | "L2F_SEPA_ONRAMP" | "L2F_SEPA_OFFRAMP" | "L2F_SWIFT_ONRAMP" | "L2F_SWIFT_OFFRAMP" | "L2F_WIRE_ONRAMP" | "L2F_WIRE_OFFRAMP" | "L2F_CHAPS_ONRAMP" | "L2F_CHAPS_OFFRAMP" | "L2F_FPS_ONRAMP" | "L2F_FPS_OFFRAMP" | "BRL_WIRE_ONRAMP" | "BRL_WIRE_OFFRAMP" | "BRL_ACH_ONRAMP" | "BRL_ACH_OFFRAMP" | "BRL_RTP_OFFRAMP" | "DLS_WIRE_ONRAMP" | "DLS_WIRE_OFFRAMP" | "DLS_ACH_ONRAMP" | "DLS_ACH_OFFRAMP" | "DLS_SEPA_ONRAMP" | "DLS_SEPA_OFFRAMP" | "DLS_SWIFT_ONRAMP" | "DLS_SWIFT_OFFRAMP" | "OMNIBUS_CRYPTO_TRANSFER" | "OMNIBUS_CRYPTO_WITHDRAWAL" | "OMNIBUS_INTERNAL_TRANSFER" | "SEGREGATED_CRYPTO_TRANSFER" | "TRANSFER_INTERNAL" | "TRANSFER_CARD_PREPAID" | "TRANSFER_CARD_SUBACCOUNT" | "TRANSFER_CARD_WHOLESALE" | "WITHDRAW_CARD_PREPAID" | "WITHDRAW_CARD_SUBACCOUNT" | "REFUND_CARD_PREPAID" | "REFUND_CARD_SUBACCOUNT" | "RN_CARDS_OFFRAMP" | "CARD_ISSUING_FEE";
6451
6466
  /** @description Card object with all properties */
6452
6467
  IssuingCard: {
6453
6468
  /**
@@ -6977,6 +6992,16 @@ export interface components {
6977
6992
  memo?: string | null;
6978
6993
  currency?: components["schemas"]["CurrencyRef"];
6979
6994
  } | null;
6995
+ /** @description Internal destination payload — the receiver wallet on the same platform. Populated when type is INTERNAL; null otherwise. */
6996
+ CounterpartyInternalData: {
6997
+ /**
6998
+ * Format: uuid
6999
+ * @description Target (receiver) wallet uuid
7000
+ */
7001
+ wallet_id?: string;
7002
+ /** @description Optional, reserved for future use */
7003
+ description?: string | null;
7004
+ } | null;
6980
7005
  /** @description Payment destination linked to a counterparty account */
6981
7006
  CounterpartyDestination: {
6982
7007
  /**
@@ -6993,7 +7018,7 @@ export interface components {
6993
7018
  * @description Destination/payment rail type
6994
7019
  * @enum {string}
6995
7020
  */
6996
- type?: "ACH" | "SWIFT" | "SEPA" | "CRYPTO_EXTERNAL" | "CRYPTO_INTERNAL" | "CHAPS" | "FPS" | "FEDWIRE";
7021
+ type?: "ACH" | "SWIFT" | "SEPA" | "CRYPTO_EXTERNAL" | "CRYPTO_INTERNAL" | "CHAPS" | "FPS" | "FEDWIRE" | "INTERNAL";
6997
7022
  /** @description User-friendly alias */
6998
7023
  nickname?: string | null;
6999
7024
  /** Format: date-time */
@@ -7002,6 +7027,7 @@ export interface components {
7002
7027
  updated_at?: string;
7003
7028
  banking_data?: components["schemas"]["BankingData"];
7004
7029
  crypto_data?: components["schemas"]["CryptoData"];
7030
+ internal_data?: components["schemas"]["CounterpartyInternalData"];
7005
7031
  };
7006
7032
  ApiSuccessResponse: {
7007
7033
  /** @example true */