squarefi-bff-api-module 1.36.39 → 1.36.40
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/frontend.d.ts +12 -0
- package/dist/api/frontend.js +37 -0
- package/dist/api/types/types.d.ts +63 -0
- package/package.json +1 -1
package/dist/api/frontend.d.ts
CHANGED
|
@@ -14,6 +14,18 @@ export declare const frontend: {
|
|
|
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
16
|
};
|
|
17
|
+
cardholders: {
|
|
18
|
+
list: (params?: API.Frontend.Issuing.Cardholders.List.Request) => Promise<API.Frontend.Issuing.Cardholders.List.Response>;
|
|
19
|
+
create: (data: API.Frontend.Issuing.Cardholders.Create.Request) => Promise<API.Frontend.Issuing.Cardholders.Create.Response>;
|
|
20
|
+
getById: ({ cardholder_id, ...params }: API.Frontend.Issuing.Cardholders.Get.Request) => Promise<API.Frontend.Issuing.Cardholders.Get.Response>;
|
|
21
|
+
delete: ({ cardholder_id, ...params }: API.Frontend.Issuing.Cardholders.Delete.Request) => Promise<API.Frontend.Issuing.Cardholders.Delete.Response>;
|
|
22
|
+
submit: ({ cardholder_id, ...params }: API.Frontend.Issuing.Cardholders.Submit.Request) => Promise<API.Frontend.Issuing.Cardholders.Submit.Response>;
|
|
23
|
+
documents: {
|
|
24
|
+
upload: ({ wallet_id, ...files }: API.Frontend.Issuing.Cardholders.Documents.Upload.Request) => Promise<API.Frontend.Issuing.Cardholders.Documents.Upload.Response>;
|
|
25
|
+
discard: ({ document_id, ...params }: API.Frontend.Issuing.Cardholders.Documents.Discard.Request) => Promise<void>;
|
|
26
|
+
attach: ({ cardholder_id, wallet_id, ...data }: API.Frontend.Issuing.Cardholders.Documents.Attach.Request) => Promise<API.Frontend.Issuing.Cardholders.Documents.Attach.Response>;
|
|
27
|
+
};
|
|
28
|
+
};
|
|
17
29
|
subAccounts: {
|
|
18
30
|
deposit: ({ sub_account_id, ...data }: API.Frontend.Issuing.SubAccounts.Deposit.Request) => Promise<API.Frontend.Issuing.SubAccounts.Deposit.Response>;
|
|
19
31
|
withdraw: ({ sub_account_id, ...data }: API.Frontend.Issuing.SubAccounts.Withdraw.Request) => Promise<API.Frontend.Issuing.SubAccounts.Withdraw.Response>;
|
package/dist/api/frontend.js
CHANGED
|
@@ -23,6 +23,43 @@ export const frontend = {
|
|
|
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
25
|
},
|
|
26
|
+
// Cardholder create flow (see the OpenAPI spec for details):
|
|
27
|
+
// 1. `cardholders.create` — creates a DRAFT; no vendor is contacted. In `user_data_id` mode
|
|
28
|
+
// the KYC documents are seeded from the verified user, so step 2 is usually unnecessary.
|
|
29
|
+
// 2. `cardholders.documents.upload` (one file per request, before or after the draft exists)
|
|
30
|
+
// + `cardholders.documents.attach` — attach the returned upload ids to the draft.
|
|
31
|
+
// 3. `cardholders.submit` — registers at the vendor and flips the cardholder to ACTIVE.
|
|
32
|
+
// All write endpoints require the ADMIN role on the wallet; `wallet_id` travels as a query
|
|
33
|
+
// parameter for access validation.
|
|
34
|
+
cardholders: {
|
|
35
|
+
list: (params = {}) => apiClientV1Frontend.getRequest('/frontend/issuing/cardholders', { params }),
|
|
36
|
+
create: (data) => apiClientV1Frontend.postRequest('/frontend/issuing/cardholders', { data }),
|
|
37
|
+
getById: ({ cardholder_id, ...params }) => apiClientV1Frontend.getRequest(`/frontend/issuing/cardholders/${cardholder_id}`, { params }),
|
|
38
|
+
delete: ({ cardholder_id, ...params }) => apiClientV1Frontend.deleteRequest(`/frontend/issuing/cardholders/${cardholder_id}`, { params }),
|
|
39
|
+
// Retryable: a failed submit leaves the draft untouched, so it can be called again once the
|
|
40
|
+
// dossier is complete (a `400 CARDHOLDER_SUBMISSION_INCOMPLETE` lists what is missing in
|
|
41
|
+
// `error.details.missing`). While a review is running — or once the cardholder is live —
|
|
42
|
+
// another submit returns `409 CARDHOLDER_NOT_DRAFT`.
|
|
43
|
+
submit: ({ cardholder_id, ...params }) => apiClientV1Frontend.postRequest(`/frontend/issuing/cardholders/${cardholder_id}/submit`, { params }),
|
|
44
|
+
documents: {
|
|
45
|
+
// Send the file the camera produced, unchanged (no crop/resize/re-encode — the vendor's
|
|
46
|
+
// tampering check can flag a re-encoded photo as forgery), one file per request so the UI
|
|
47
|
+
// can show per-file progress and retry. Content-Type is set by the browser via FormData.
|
|
48
|
+
upload: ({ wallet_id, ...files }) => {
|
|
49
|
+
const formData = new FormData();
|
|
50
|
+
Object.entries(files).forEach(([type, file]) => {
|
|
51
|
+
if (file)
|
|
52
|
+
formData.append(type, file);
|
|
53
|
+
});
|
|
54
|
+
return apiClientV1Frontend.postRequest('/frontend/issuing/cardholder-documents', { data: formData, params: { wallet_id } });
|
|
55
|
+
},
|
|
56
|
+
// Only uploads not yet attached to a cardholder can be discarded (attached ones answer 409);
|
|
57
|
+
// an upload that is never attached is deleted by a cleanup sweep anyway.
|
|
58
|
+
discard: ({ document_id, ...params }) => apiClientV1Frontend.deleteRequest(`/frontend/issuing/cardholder-documents/${document_id}`, { params }),
|
|
59
|
+
// Attaching a document of a type the cardholder already has replaces the previous one.
|
|
60
|
+
attach: ({ cardholder_id, wallet_id, ...data }) => apiClientV1Frontend.postRequest(`/frontend/issuing/cardholders/${cardholder_id}/documents`, { data, params: { wallet_id } }),
|
|
61
|
+
},
|
|
62
|
+
},
|
|
26
63
|
subAccounts: {
|
|
27
64
|
deposit: ({ sub_account_id, ...data }) => apiClientV1Frontend.postRequest(`/frontend/issuing/sub-accounts/${sub_account_id}/deposit`, { data }),
|
|
28
65
|
// Concurrent withdrawals on the same sub-account are rejected with `409`. The currency is
|
|
@@ -676,6 +676,11 @@ export declare namespace API {
|
|
|
676
676
|
type CardWithdrawRoot = pathsV1Frontend['/frontend/issuing/cards/{card_id}/withdraw'];
|
|
677
677
|
type SubAccountDepositRoot = pathsV1Frontend['/frontend/issuing/sub-accounts/{sub_account_id}/deposit'];
|
|
678
678
|
type SubAccountWithdrawRoot = pathsV1Frontend['/frontend/issuing/sub-accounts/{sub_account_id}/withdraw'];
|
|
679
|
+
type CardholdersRoot = pathsV1Frontend['/frontend/issuing/cardholders'];
|
|
680
|
+
type CardholderRoot = pathsV1Frontend['/frontend/issuing/cardholders/{cardholder_id}'];
|
|
681
|
+
type CardholderSubmitRoot = pathsV1Frontend['/frontend/issuing/cardholders/{cardholder_id}/submit'];
|
|
682
|
+
type CardholderDocumentsUploadRoot = pathsV1Frontend['/frontend/issuing/cardholder-documents'];
|
|
683
|
+
type CardholderAttachDocumentsRoot = pathsV1Frontend['/frontend/issuing/cardholders/{cardholder_id}/documents'];
|
|
679
684
|
type WithOrderStatus<T extends {
|
|
680
685
|
data?: {
|
|
681
686
|
status?: string;
|
|
@@ -718,6 +723,64 @@ export declare namespace API {
|
|
|
718
723
|
type Response = SubAccounts.Withdraw.Response;
|
|
719
724
|
}
|
|
720
725
|
}
|
|
726
|
+
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'];
|
|
731
|
+
}
|
|
732
|
+
namespace Create {
|
|
733
|
+
type Request = CardholdersRoot['post']['requestBody']['content']['application/json'];
|
|
734
|
+
type Response = CardholdersRoot['post']['responses']['201']['content']['application/json'];
|
|
735
|
+
}
|
|
736
|
+
namespace Get {
|
|
737
|
+
type Request = {
|
|
738
|
+
cardholder_id: string;
|
|
739
|
+
} & NonNullable<CardholderRoot['get']['parameters']['query']>;
|
|
740
|
+
type Response = CardholderRoot['get']['responses']['200']['content']['application/json'];
|
|
741
|
+
}
|
|
742
|
+
namespace Delete {
|
|
743
|
+
type Request = {
|
|
744
|
+
cardholder_id: string;
|
|
745
|
+
} & NonNullable<CardholderRoot['delete']['parameters']['query']>;
|
|
746
|
+
type Response = CardholderRoot['delete']['responses']['200']['content']['application/json'];
|
|
747
|
+
}
|
|
748
|
+
namespace Submit {
|
|
749
|
+
type Request = {
|
|
750
|
+
cardholder_id: string;
|
|
751
|
+
} & CardholderSubmitRoot['post']['parameters']['query'];
|
|
752
|
+
type Response = CardholderSubmitRoot['post']['responses']['200']['content']['application/json'];
|
|
753
|
+
}
|
|
754
|
+
namespace Documents {
|
|
755
|
+
type DocumentType = keyof CardholderDocumentsUploadRoot['post']['requestBody']['content']['multipart/form-data'];
|
|
756
|
+
namespace Upload {
|
|
757
|
+
type Request = {
|
|
758
|
+
wallet_id: string;
|
|
759
|
+
} & {
|
|
760
|
+
[K in DocumentType]?: File | Blob;
|
|
761
|
+
};
|
|
762
|
+
type Response = CardholderDocumentsUploadRoot['post']['responses']['201']['content']['application/json'];
|
|
763
|
+
type Document = NonNullable<NonNullable<Response['data']>['documents']>[number];
|
|
764
|
+
}
|
|
765
|
+
namespace Discard {
|
|
766
|
+
type Request = {
|
|
767
|
+
document_id: string;
|
|
768
|
+
wallet_id: string;
|
|
769
|
+
};
|
|
770
|
+
}
|
|
771
|
+
namespace Attach {
|
|
772
|
+
export type Request = {
|
|
773
|
+
cardholder_id: string;
|
|
774
|
+
wallet_id: string;
|
|
775
|
+
} & CardholderAttachDocumentsRoot['post']['requestBody']['content']['application/json'];
|
|
776
|
+
type RawResponse = CardholderAttachDocumentsRoot['post']['responses']['200']['content']['application/json'];
|
|
777
|
+
export type Response = Omit<RawResponse, 'data'> & {
|
|
778
|
+
data?: Cardholder;
|
|
779
|
+
};
|
|
780
|
+
export {};
|
|
781
|
+
}
|
|
782
|
+
}
|
|
783
|
+
}
|
|
721
784
|
export {};
|
|
722
785
|
}
|
|
723
786
|
}
|