squarefi-bff-api-module 1.36.27 → 1.36.29
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.
- package/dist/api/types/autogen/apiV1External.types.d.ts +30 -9
- package/dist/api/types/autogen/apiV1Frontend.types.d.ts +34 -16
- package/dist/api/types/autogen/apiV1Legacy.types.d.ts +103 -3
- package/dist/api/types/autogen/apiV1Tenant.types.d.ts +36 -10
- package/dist/utils/apiClientFactory.js +9 -2
- package/package.json +1 -1
|
@@ -830,7 +830,8 @@ export interface paths {
|
|
|
830
830
|
postcode?: string;
|
|
831
831
|
street1?: string;
|
|
832
832
|
street2?: string;
|
|
833
|
-
|
|
833
|
+
/** @description Required when the selected country has states; countries without states may omit it */
|
|
834
|
+
state_id?: number | null;
|
|
834
835
|
};
|
|
835
836
|
};
|
|
836
837
|
/** @description Required for crypto types (CRYPTO_EXTERNAL, CRYPTO_INTERNAL) */
|
|
@@ -3870,13 +3871,14 @@ export interface paths {
|
|
|
3870
3871
|
put?: never;
|
|
3871
3872
|
/**
|
|
3872
3873
|
* Exchange
|
|
3873
|
-
* @description
|
|
3874
|
+
* @description Crypto-to-crypto exchange within the wallet bound to the API key.
|
|
3874
3875
|
*
|
|
3875
|
-
*
|
|
3876
|
-
*
|
|
3877
|
-
*
|
|
3876
|
+
* Two-phase, like the banking withdrawals: the order is created in status
|
|
3877
|
+
* `NEW` with the source funds blocked. Call `POST /api/orders/{order_id}/approve`
|
|
3878
|
+
* to execute the swap (the order lands in `COMPLETE` synchronously), or
|
|
3879
|
+
* `POST /api/orders/{order_id}/cancel` to release the blocked funds.
|
|
3878
3880
|
*
|
|
3879
|
-
*
|
|
3881
|
+
* Fiat legs are not supported — only crypto-to-crypto pairs are accepted.
|
|
3880
3882
|
*
|
|
3881
3883
|
*/
|
|
3882
3884
|
post: {
|
|
@@ -3892,7 +3894,7 @@ export interface paths {
|
|
|
3892
3894
|
};
|
|
3893
3895
|
};
|
|
3894
3896
|
responses: {
|
|
3895
|
-
/** @description Exchange order created */
|
|
3897
|
+
/** @description Exchange order created (status NEW, funds blocked — approve to execute) */
|
|
3896
3898
|
200: {
|
|
3897
3899
|
headers: {
|
|
3898
3900
|
[name: string]: unknown;
|
|
@@ -4219,6 +4221,8 @@ export interface paths {
|
|
|
4219
4221
|
/**
|
|
4220
4222
|
* Approve order
|
|
4221
4223
|
* @description Transitions the order from NEW to PROCESSING and triggers the order execution pipeline.
|
|
4224
|
+
* Exchange orders (EXCHANGE_OMNI) and internal transfers (TRANSFER_INTERNAL /
|
|
4225
|
+
* OMNIBUS_INTERNAL_TRANSFER) settle synchronously and land in COMPLETE.
|
|
4222
4226
|
* Only orders with status NEW can be approved.
|
|
4223
4227
|
*
|
|
4224
4228
|
*/
|
|
@@ -4366,7 +4370,12 @@ export interface paths {
|
|
|
4366
4370
|
put?: never;
|
|
4367
4371
|
/**
|
|
4368
4372
|
* Internal
|
|
4369
|
-
* @description Transfers funds between wallets within the platform.
|
|
4373
|
+
* @description Transfers funds between wallets within the platform. Two-phase: the
|
|
4374
|
+
* order is created in `NEW` status with the sender's funds blocked;
|
|
4375
|
+
* call `POST /api/orders/{id}/approve` to execute the transfer — it
|
|
4376
|
+
* settles synchronously (receiver credited, order `COMPLETE`). A `NEW`
|
|
4377
|
+
* order can be canceled via `POST /api/orders/{id}/cancel` to refund
|
|
4378
|
+
* the blocked funds.
|
|
4370
4379
|
* Wallet ID is automatically resolved from the API key — do **not** pass `wallet_id`.
|
|
4371
4380
|
*
|
|
4372
4381
|
* `request_id` is used for idempotency: re-posting the same `request_id`
|
|
@@ -4406,7 +4415,7 @@ export interface paths {
|
|
|
4406
4415
|
};
|
|
4407
4416
|
};
|
|
4408
4417
|
responses: {
|
|
4409
|
-
/** @description Transfer created */
|
|
4418
|
+
/** @description Transfer created in NEW status (funds blocked, awaiting approve) */
|
|
4410
4419
|
200: {
|
|
4411
4420
|
headers: {
|
|
4412
4421
|
[name: string]: unknown;
|
|
@@ -4478,6 +4487,12 @@ export interface paths {
|
|
|
4478
4487
|
* address (or another internal wallet) via a previously-created counterparty
|
|
4479
4488
|
* destination.
|
|
4480
4489
|
*
|
|
4490
|
+
* Two-phase: the order is created in `NEW` status with funds blocked;
|
|
4491
|
+
* `POST /api/orders/{id}/approve` dispatches the on-chain send. If the
|
|
4492
|
+
* destination address belongs to a wallet in the same tenant, the order is
|
|
4493
|
+
* created as `OMNIBUS_INTERNAL_TRANSFER` (no on-chain transaction) — still
|
|
4494
|
+
* `NEW` at create, settled synchronously to `COMPLETE` at approve.
|
|
4495
|
+
*
|
|
4481
4496
|
* **Prerequisites:**
|
|
4482
4497
|
* - A counterparty destination of type `CRYPTO_EXTERNAL` or `CRYPTO_INTERNAL`
|
|
4483
4498
|
* created via `POST /api/counterparty/destinations`.
|
|
@@ -7430,6 +7445,12 @@ export interface components {
|
|
|
7430
7445
|
* @example 7c8d4a2b-1e3f-4d59-9b6a-2c0e5f7d8a90
|
|
7431
7446
|
*/
|
|
7432
7447
|
to_currency_id: string;
|
|
7448
|
+
/**
|
|
7449
|
+
* Format: uuid
|
|
7450
|
+
* @description Idempotency key (UUID v4 recommended).
|
|
7451
|
+
* @example 550e8400-e29b-41d4-a716-446655440000
|
|
7452
|
+
*/
|
|
7453
|
+
request_id: string;
|
|
7433
7454
|
};
|
|
7434
7455
|
/** @description Virtual bank account */
|
|
7435
7456
|
VirtualAccount: {
|
|
@@ -1425,11 +1425,11 @@ export interface paths {
|
|
|
1425
1425
|
* Check internal-transfer availability for a destination
|
|
1426
1426
|
* @description Read-only check (writes nothing). Resolves the destination's payment
|
|
1427
1427
|
* details to an on-platform wallet within the tenant and reports whether an
|
|
1428
|
-
*
|
|
1428
|
+
* internal (off-chain) transfer is available.
|
|
1429
1429
|
*
|
|
1430
1430
|
* A `true` answer means the caller can create an INTERNAL destination to
|
|
1431
1431
|
* `target_wallet_id` and transfer to it. Any recipient that cannot receive
|
|
1432
|
-
* an
|
|
1432
|
+
* an internal transfer is uniformly reported as `available:false`
|
|
1433
1433
|
* with `target_wallet_id:null` — the check does not disclose the reason.
|
|
1434
1434
|
*
|
|
1435
1435
|
* Detects crypto (address), INTERNAL (stored target wallet) and banking
|
|
@@ -4830,13 +4830,15 @@ export interface paths {
|
|
|
4830
4830
|
put?: never;
|
|
4831
4831
|
/**
|
|
4832
4832
|
* Exchange
|
|
4833
|
-
* @description
|
|
4833
|
+
* @description Crypto-to-crypto exchange within a wallet.
|
|
4834
4834
|
*
|
|
4835
|
-
*
|
|
4836
|
-
*
|
|
4837
|
-
*
|
|
4835
|
+
* Two-phase, like the banking withdrawals: the order is created in status
|
|
4836
|
+
* `NEW` with the source funds blocked. Call `POST /frontend/orders/{order_id}/approve`
|
|
4837
|
+
* (OTP-gated via `request_id`) to execute the swap — the order lands in
|
|
4838
|
+
* `COMPLETE` synchronously — or `POST /frontend/orders/{order_id}/cancel`
|
|
4839
|
+
* to release the blocked funds.
|
|
4838
4840
|
*
|
|
4839
|
-
*
|
|
4841
|
+
* Fiat legs are not supported — only crypto-to-crypto pairs are accepted.
|
|
4840
4842
|
* Caller must be `admin` of the wallet.
|
|
4841
4843
|
*
|
|
4842
4844
|
*/
|
|
@@ -4853,7 +4855,7 @@ export interface paths {
|
|
|
4853
4855
|
};
|
|
4854
4856
|
};
|
|
4855
4857
|
responses: {
|
|
4856
|
-
/** @description Exchange order created */
|
|
4858
|
+
/** @description Exchange order created (status NEW, funds blocked — approve to execute) */
|
|
4857
4859
|
200: {
|
|
4858
4860
|
headers: {
|
|
4859
4861
|
[name: string]: unknown;
|
|
@@ -4921,7 +4923,11 @@ export interface paths {
|
|
|
4921
4923
|
put?: never;
|
|
4922
4924
|
/**
|
|
4923
4925
|
* Internal
|
|
4924
|
-
* @description Transfers funds between two wallets within the platform.
|
|
4926
|
+
* @description Transfers funds between two wallets within the platform. Two-phase:
|
|
4927
|
+
* the order is created in `NEW` status with the sender's funds blocked;
|
|
4928
|
+
* `POST /frontend/orders/{id}/approve` (OTP-gated via the `request_id`)
|
|
4929
|
+
* executes the transfer synchronously — receiver credited, order
|
|
4930
|
+
* `COMPLETE`. A `NEW` order can be canceled to refund the blocked funds.
|
|
4925
4931
|
* Caller must be `admin` of the source wallet.
|
|
4926
4932
|
*
|
|
4927
4933
|
*/
|
|
@@ -4956,7 +4962,7 @@ export interface paths {
|
|
|
4956
4962
|
};
|
|
4957
4963
|
};
|
|
4958
4964
|
responses: {
|
|
4959
|
-
/** @description Transfer created */
|
|
4965
|
+
/** @description Transfer created in NEW status (funds blocked, awaiting approve) */
|
|
4960
4966
|
200: {
|
|
4961
4967
|
headers: {
|
|
4962
4968
|
[name: string]: unknown;
|
|
@@ -5024,10 +5030,13 @@ export interface paths {
|
|
|
5024
5030
|
put?: never;
|
|
5025
5031
|
/**
|
|
5026
5032
|
* Crypto
|
|
5027
|
-
* @description Sends crypto from an omnibus wallet to an external address.
|
|
5028
|
-
*
|
|
5029
|
-
*
|
|
5030
|
-
*
|
|
5033
|
+
* @description Sends crypto from an omnibus wallet to an external address. Two-phase:
|
|
5034
|
+
* the order is created in `NEW` status with funds blocked;
|
|
5035
|
+
* `POST /frontend/orders/{id}/approve` (OTP-gated via the `request_id`)
|
|
5036
|
+
* dispatches the on-chain send. If the destination address belongs to a
|
|
5037
|
+
* wallet in the same tenant, the order is created as
|
|
5038
|
+
* `OMNIBUS_INTERNAL_TRANSFER` (no on-chain transaction) — still `NEW` at
|
|
5039
|
+
* create, settled synchronously to `COMPLETE` at approve.
|
|
5031
5040
|
*
|
|
5032
5041
|
*/
|
|
5033
5042
|
post: {
|
|
@@ -5697,7 +5706,11 @@ export interface paths {
|
|
|
5697
5706
|
put?: never;
|
|
5698
5707
|
/**
|
|
5699
5708
|
* Approve an order
|
|
5700
|
-
* @description Moves a NEW order to PROCESSING, triggering its workflow.
|
|
5709
|
+
* @description Moves a NEW order to PROCESSING, triggering its workflow. Exchange orders
|
|
5710
|
+
* (EXCHANGE_OMNI) and internal transfers (TRANSFER_INTERNAL /
|
|
5711
|
+
* OMNIBUS_INTERNAL_TRANSFER) settle synchronously and land in COMPLETE.
|
|
5712
|
+
* Validates the order's request_id via OTP.
|
|
5713
|
+
*
|
|
5701
5714
|
*/
|
|
5702
5715
|
post: {
|
|
5703
5716
|
parameters: {
|
|
@@ -8869,7 +8882,7 @@ export interface paths {
|
|
|
8869
8882
|
*
|
|
8870
8883
|
* **Access Control**: User must own the wallet
|
|
8871
8884
|
*
|
|
8872
|
-
* **Note**:
|
|
8885
|
+
* **Note**: New addresses are always provisioned via Utila. The legacy Processing (Accepta) provider was decommissioned; existing `processing` addresses remain readable.
|
|
8873
8886
|
*
|
|
8874
8887
|
*/
|
|
8875
8888
|
post: {
|
|
@@ -10835,6 +10848,11 @@ export interface components {
|
|
|
10835
10848
|
* @description Destination currency UUID
|
|
10836
10849
|
*/
|
|
10837
10850
|
to_currency_id: string;
|
|
10851
|
+
/**
|
|
10852
|
+
* Format: uuid
|
|
10853
|
+
* @description Idempotency key (UUID); OTP-verified at approve
|
|
10854
|
+
*/
|
|
10855
|
+
request_id: string;
|
|
10838
10856
|
};
|
|
10839
10857
|
/** @description Wallet invitation record */
|
|
10840
10858
|
WalletInvite: {
|
|
@@ -364,7 +364,7 @@ export interface paths {
|
|
|
364
364
|
put?: never;
|
|
365
365
|
/**
|
|
366
366
|
* Create a new wallet address
|
|
367
|
-
* @description Create a new blockchain address for a wallet with Utila
|
|
367
|
+
* @description Create a new blockchain address for a wallet with Utila integration
|
|
368
368
|
*/
|
|
369
369
|
post: {
|
|
370
370
|
parameters: {
|
|
@@ -8977,6 +8977,108 @@ export interface components {
|
|
|
8977
8977
|
*/
|
|
8978
8978
|
has_more?: boolean;
|
|
8979
8979
|
};
|
|
8980
|
+
/** @description Profile information of the payment sender */
|
|
8981
|
+
L2FOriginatorProfile: {
|
|
8982
|
+
/**
|
|
8983
|
+
* @description Name of the sender
|
|
8984
|
+
* @example FS AI, A SERIES OF FINSIGHT SPECI
|
|
8985
|
+
*/
|
|
8986
|
+
name?: string;
|
|
8987
|
+
/** @description Sender's address information */
|
|
8988
|
+
address?: {
|
|
8989
|
+
address_line1?: string | null;
|
|
8990
|
+
city?: string | null;
|
|
8991
|
+
state?: string | null;
|
|
8992
|
+
postal_code?: string | null;
|
|
8993
|
+
country?: string | null;
|
|
8994
|
+
};
|
|
8995
|
+
};
|
|
8996
|
+
/** @description Bank account information of the sender */
|
|
8997
|
+
L2FOriginatorAccountInfo: {
|
|
8998
|
+
/**
|
|
8999
|
+
* @description Bank account number
|
|
9000
|
+
* @example 202504243736
|
|
9001
|
+
*/
|
|
9002
|
+
account_number?: string;
|
|
9003
|
+
/**
|
|
9004
|
+
* @description Routing number (for US payments)
|
|
9005
|
+
* @example 91311229
|
|
9006
|
+
*/
|
|
9007
|
+
routing_number?: string | null;
|
|
9008
|
+
/** @description SWIFT BIC code (for international transfers) */
|
|
9009
|
+
swift_bic?: string | null;
|
|
9010
|
+
/** @description Name of the bank/institution */
|
|
9011
|
+
institution_name?: string | null;
|
|
9012
|
+
};
|
|
9013
|
+
/**
|
|
9014
|
+
* @description Standardized originator (sender) information for L2F ONRAMP orders.
|
|
9015
|
+
* Available for order types: L2F_ACH_ONRAMP, L2F_WIRE_ONRAMP, L2F_SEPA_ONRAMP, L2F_SWIFT_ONRAMP.
|
|
9016
|
+
* This field appears in order.meta.originator
|
|
9017
|
+
*
|
|
9018
|
+
* @example {
|
|
9019
|
+
* "profile": {
|
|
9020
|
+
* "name": "FS AI, A SERIES OF FINSIGHT SPECI",
|
|
9021
|
+
* "address": {
|
|
9022
|
+
* "address_line1": "",
|
|
9023
|
+
* "city": "",
|
|
9024
|
+
* "state": "",
|
|
9025
|
+
* "postal_code": "",
|
|
9026
|
+
* "country": ""
|
|
9027
|
+
* }
|
|
9028
|
+
* },
|
|
9029
|
+
* "account_information": {
|
|
9030
|
+
* "account_number": "202504243736",
|
|
9031
|
+
* "routing_number": "91311229",
|
|
9032
|
+
* "swift_bic": "",
|
|
9033
|
+
* "institution_name": ""
|
|
9034
|
+
* },
|
|
9035
|
+
* "reference": "20251016MMQFMP2U004005",
|
|
9036
|
+
* "memo": "bfgkp5w"
|
|
9037
|
+
* }
|
|
9038
|
+
*/
|
|
9039
|
+
L2FOriginator: {
|
|
9040
|
+
profile?: components["schemas"]["L2FOriginatorProfile"];
|
|
9041
|
+
account_information?: components["schemas"]["L2FOriginatorAccountInfo"];
|
|
9042
|
+
/**
|
|
9043
|
+
* @description Payment reference number (rail_reference from Railio)
|
|
9044
|
+
* @example 20251016MMQFMP2U004005
|
|
9045
|
+
*/
|
|
9046
|
+
reference?: string | null;
|
|
9047
|
+
/**
|
|
9048
|
+
* @description Payment memo/note (rail_originator_memo from Railio)
|
|
9049
|
+
* @example bfgkp5w
|
|
9050
|
+
*/
|
|
9051
|
+
memo?: string | null;
|
|
9052
|
+
} | null;
|
|
9053
|
+
/**
|
|
9054
|
+
* @description Optional array of document objects to attach to the order.
|
|
9055
|
+
* Documents should be uploaded to a storage service beforehand and only URLs should be provided.
|
|
9056
|
+
* Maximum 50 documents per order.
|
|
9057
|
+
*
|
|
9058
|
+
* @example [
|
|
9059
|
+
* {
|
|
9060
|
+
* "url": "https://storage.example.com/documents/invoice-001.pdf",
|
|
9061
|
+
* "description": "Invoice for payment #001"
|
|
9062
|
+
* },
|
|
9063
|
+
* {
|
|
9064
|
+
* "url": "https://storage.example.com/documents/contract-signed.pdf",
|
|
9065
|
+
* "description": "Signed contract"
|
|
9066
|
+
* }
|
|
9067
|
+
* ]
|
|
9068
|
+
*/
|
|
9069
|
+
OrderDocuments: {
|
|
9070
|
+
/**
|
|
9071
|
+
* Format: uri
|
|
9072
|
+
* @description URL of the uploaded document
|
|
9073
|
+
* @example https://storage.example.com/documents/invoice-123.pdf
|
|
9074
|
+
*/
|
|
9075
|
+
url: string;
|
|
9076
|
+
/**
|
|
9077
|
+
* @description Optional description of the document
|
|
9078
|
+
* @example Invoice for payment #12345
|
|
9079
|
+
*/
|
|
9080
|
+
description?: string | null;
|
|
9081
|
+
}[];
|
|
8980
9082
|
VirtualAccount: {
|
|
8981
9083
|
/**
|
|
8982
9084
|
* Format: uuid
|
|
@@ -9261,8 +9363,6 @@ export interface components {
|
|
|
9261
9363
|
CardUpdateRequest: unknown;
|
|
9262
9364
|
IssuingProgram: unknown;
|
|
9263
9365
|
IssuingTransactionList: unknown;
|
|
9264
|
-
L2FOriginator: unknown;
|
|
9265
|
-
OrderDocuments: unknown;
|
|
9266
9366
|
};
|
|
9267
9367
|
responses: never;
|
|
9268
9368
|
parameters: never;
|
|
@@ -615,7 +615,8 @@ export interface paths {
|
|
|
615
615
|
postcode?: string;
|
|
616
616
|
street1?: string;
|
|
617
617
|
street2?: string;
|
|
618
|
-
|
|
618
|
+
/** @description Required when the selected country has states; countries without states may omit it */
|
|
619
|
+
state_id?: number | null;
|
|
619
620
|
};
|
|
620
621
|
};
|
|
621
622
|
crypto_data?: {
|
|
@@ -2517,13 +2518,14 @@ export interface paths {
|
|
|
2517
2518
|
put?: never;
|
|
2518
2519
|
/**
|
|
2519
2520
|
* Exchange
|
|
2520
|
-
* @description
|
|
2521
|
+
* @description Crypto-to-crypto exchange within a wallet.
|
|
2521
2522
|
*
|
|
2522
|
-
*
|
|
2523
|
-
*
|
|
2524
|
-
*
|
|
2523
|
+
* Two-phase, like the banking withdrawals: the order is created in status
|
|
2524
|
+
* `NEW` with the source funds blocked. Call `POST /admin/orders/{order_id}/approve`
|
|
2525
|
+
* to execute the swap (the order lands in `COMPLETE` synchronously), or
|
|
2526
|
+
* `POST /admin/orders/{order_id}/cancel` to release the blocked funds.
|
|
2525
2527
|
*
|
|
2526
|
-
*
|
|
2528
|
+
* Fiat legs are not supported — only crypto-to-crypto pairs are accepted.
|
|
2527
2529
|
*
|
|
2528
2530
|
*/
|
|
2529
2531
|
post: {
|
|
@@ -2542,7 +2544,7 @@ export interface paths {
|
|
|
2542
2544
|
};
|
|
2543
2545
|
};
|
|
2544
2546
|
responses: {
|
|
2545
|
-
/** @description Exchange order created */
|
|
2547
|
+
/** @description Exchange order created (status NEW, funds blocked — approve to execute) */
|
|
2546
2548
|
200: {
|
|
2547
2549
|
headers: {
|
|
2548
2550
|
[name: string]: unknown;
|
|
@@ -2608,7 +2610,15 @@ export interface paths {
|
|
|
2608
2610
|
};
|
|
2609
2611
|
get?: never;
|
|
2610
2612
|
put?: never;
|
|
2611
|
-
/**
|
|
2613
|
+
/**
|
|
2614
|
+
* Internal
|
|
2615
|
+
* @description Transfers funds between two wallets within the platform. Two-phase:
|
|
2616
|
+
* the order is created in `NEW` status with the sender's funds blocked;
|
|
2617
|
+
* `POST /admin/orders/{id}/approve` executes the transfer synchronously —
|
|
2618
|
+
* receiver credited, order `COMPLETE`. A `NEW` order can be canceled to
|
|
2619
|
+
* refund the blocked funds.
|
|
2620
|
+
*
|
|
2621
|
+
*/
|
|
2612
2622
|
post: {
|
|
2613
2623
|
parameters: {
|
|
2614
2624
|
query?: never;
|
|
@@ -2636,7 +2646,7 @@ export interface paths {
|
|
|
2636
2646
|
};
|
|
2637
2647
|
};
|
|
2638
2648
|
responses: {
|
|
2639
|
-
/** @description Transfer created */
|
|
2649
|
+
/** @description Transfer created in NEW status (funds blocked, awaiting approve) */
|
|
2640
2650
|
200: {
|
|
2641
2651
|
headers: {
|
|
2642
2652
|
[name: string]: unknown;
|
|
@@ -2693,7 +2703,16 @@ export interface paths {
|
|
|
2693
2703
|
};
|
|
2694
2704
|
get?: never;
|
|
2695
2705
|
put?: never;
|
|
2696
|
-
/**
|
|
2706
|
+
/**
|
|
2707
|
+
* Crypto
|
|
2708
|
+
* @description Sends crypto from the wallet's omnibus balance via a counterparty
|
|
2709
|
+
* destination. Two-phase: created `NEW` with funds blocked;
|
|
2710
|
+
* `POST /admin/orders/{id}/approve` dispatches the on-chain send. A
|
|
2711
|
+
* destination address internal to the tenant downgrades the order to
|
|
2712
|
+
* `OMNIBUS_INTERNAL_TRANSFER` — still `NEW` at create, settled
|
|
2713
|
+
* synchronously to `COMPLETE` at approve.
|
|
2714
|
+
*
|
|
2715
|
+
*/
|
|
2697
2716
|
post: {
|
|
2698
2717
|
parameters: {
|
|
2699
2718
|
query?: never;
|
|
@@ -3538,6 +3557,8 @@ export interface paths {
|
|
|
3538
3557
|
/**
|
|
3539
3558
|
* Approve order
|
|
3540
3559
|
* @description Transitions the order from NEW to PROCESSING and triggers the order execution pipeline.
|
|
3560
|
+
* Exchange orders (EXCHANGE_OMNI) and internal transfers (TRANSFER_INTERNAL /
|
|
3561
|
+
* OMNIBUS_INTERNAL_TRANSFER) settle synchronously and land in COMPLETE.
|
|
3541
3562
|
* Only orders with status NEW can be approved.
|
|
3542
3563
|
*
|
|
3543
3564
|
*/
|
|
@@ -8176,6 +8197,11 @@ export interface components {
|
|
|
8176
8197
|
* @description Destination currency UUID
|
|
8177
8198
|
*/
|
|
8178
8199
|
to_currency_id: string;
|
|
8200
|
+
/**
|
|
8201
|
+
* Format: uuid
|
|
8202
|
+
* @description Idempotency key (UUID v4 recommended)
|
|
8203
|
+
*/
|
|
8204
|
+
request_id: string;
|
|
8179
8205
|
};
|
|
8180
8206
|
TenantOrder: {
|
|
8181
8207
|
/** Format: uuid */
|
|
@@ -7,7 +7,14 @@ import { isExternalAuthMode, resolveAccessToken, triggerReverification, triggerU
|
|
|
7
7
|
import { deleteTokens, getTokens, refreshTokens } from './tokensFactory';
|
|
8
8
|
// eslint-disable-next-line no-constant-condition
|
|
9
9
|
// Backend signals that a sensitive request needs a fresh second-factor verification with this code.
|
|
10
|
-
|
|
10
|
+
// Backend error codes are UPPER_SNAKE_CASE, and the code can sit at either `data.code` or
|
|
11
|
+
// `data.error.code`. Normalize to upper case and check both locations so the match stays robust.
|
|
12
|
+
const TWO_FACTOR_REVERIFICATION_CODE = 'TWO_FACTOR_REVERIFICATION_REQUIRED';
|
|
13
|
+
const isReverificationRequired = (data) => {
|
|
14
|
+
const code = data?.code ??
|
|
15
|
+
data?.error?.code;
|
|
16
|
+
return typeof code === 'string' && code.toUpperCase() === TWO_FACTOR_REVERIFICATION_CODE;
|
|
17
|
+
};
|
|
11
18
|
const apiV1BaseURL = process.env.API_URL ?? 'ENV variable API_URL is not defined';
|
|
12
19
|
const apiV2BaseURL = process.env.API_V2_URL ?? 'ENV variable API_V2_URL is not defined';
|
|
13
20
|
const apiTOTPBaseURL = process.env.API_TOTP_URL ?? 'ENV variable API_TOTP_URL is not defined';
|
|
@@ -46,7 +53,7 @@ export const createApiClient = ({ baseURL, isBearerToken, tenantId }) => {
|
|
|
46
53
|
// Step-up 2FA: the backend rejects a sensitive request until the user re-verifies their
|
|
47
54
|
// second factor. Hand off to the consumer's reverification handler and retry once on success.
|
|
48
55
|
if (error?.response?.status === ResponseStatus.FORBIDDEN &&
|
|
49
|
-
error?.response?.data
|
|
56
|
+
isReverificationRequired(error?.response?.data) &&
|
|
50
57
|
!error?.response?.config.context?.isRetryRequest) {
|
|
51
58
|
const { response, config: failedRequestConfig } = error;
|
|
52
59
|
return triggerReverification(response.data).then((didReverify) => {
|