Update applicant-details CLI to use user ID #4
@ -19,7 +19,8 @@ export const builder = (yargs: any) => {
|
|||||||
});
|
});
|
||||||
};
|
};
|
||||||
|
|
||||||
function getApplicantDetails (userId: string) {
|
// https://docs.sumsub.com/reference/get-applicant-data-via-externaluserid
|
||||||
|
function getApplicantDetailsRequest (userId: string) {
|
||||||
const config: any = { baseURL: SUMSUB_BASE_URL};
|
const config: any = { baseURL: SUMSUB_BASE_URL};
|
||||||
|
|
||||||
var method = 'GET';
|
var method = 'GET';
|
||||||
@ -42,19 +43,17 @@ export const handler = async (argv: Arguments) => {
|
|||||||
const userId = argv.userId as string;
|
const userId = argv.userId as string;
|
||||||
|
|
||||||
if (!userId) {
|
if (!userId) {
|
||||||
console.error('User ID is required');
|
throw new Error('User ID is required')
|
||||||
process.exit(1);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
try {
|
try {
|
||||||
const response = await sumsubAxios(getApplicantDetails(userId));
|
const response = await sumsubAxios(getApplicantDetailsRequest(userId));
|
||||||
|
|
||||||
// Exclude this key because the includedCountries and docSets data is not required
|
// Exclude this key because the includedCountries and docSets data is not required
|
||||||
delete response.data.requiredIdDocs;
|
delete response.data.requiredIdDocs;
|
||||||
|
|
||||||
console.log('Applicant Data:', JSON.stringify(response.data, null, 2));
|
console.log('Applicant Data:', JSON.stringify(response.data, null, 2));
|
||||||
} catch (error: any) {
|
} catch (error: any) {
|
||||||
console.error('Failed to fetch applicant data:', error.response ? error.response.data : error.message);
|
throw new Error(`Failed to fetch applicant data: ${JSON.stringify(error.response ? error.response.data : error.message)}`)
|
||||||
process.exit(1);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user