Format applicant details response (#3)
Part of [Sumsub KYC integration in onboarding app](https://www.notion.so/Sumsub-KYC-integration-in-onboarding-app-607b598c9c1d4d12adc71725e2ab5e7e) Co-authored-by: IshaVenikar <ishavenikar7@gmail.com> Reviewed-on: #3
This commit is contained in:
parent
b06e07b0f8
commit
a1a0f8e3ba
@ -22,6 +22,7 @@
|
||||
},
|
||||
"scripts": {
|
||||
"build": "tsc",
|
||||
"start": "node dist/index.js"
|
||||
"start": "node dist/index.js",
|
||||
"cli": "node dist/cli/index.js"
|
||||
}
|
||||
}
|
||||
|
@ -5,13 +5,13 @@ import { sumsubAxios } from '../../../utils';
|
||||
|
||||
dotenv.config();
|
||||
|
||||
export const command = 'applicant-details';
|
||||
|
||||
export const desc = 'Get applicant details.';
|
||||
|
||||
const SUMSUB_BASE_URL = 'https://api.sumsub.com';
|
||||
const SUMSUB_APP_TOKEN = process.env.SUMSUB_APP_TOKEN || '';
|
||||
|
||||
export const command = 'applicant-details [applicantId]';
|
||||
|
||||
export const desc = 'Get applicant details.';
|
||||
|
||||
export const builder = (yargs: any) => {
|
||||
return yargs.positional('applicantId', {
|
||||
describe: 'The applicant ID to query',
|
||||
@ -39,7 +39,7 @@ function getApplicantDetails (applicantId: string | number) {
|
||||
}
|
||||
|
||||
export const handler = async (argv: Arguments) => {
|
||||
const applicantId = argv._[2];
|
||||
const applicantId = argv.applicantId as string;
|
||||
|
||||
if (!applicantId) {
|
||||
console.error('Applicant ID is required');
|
||||
@ -47,7 +47,11 @@ export const handler = async (argv: Arguments) => {
|
||||
|
||||
try {
|
||||
const response = await sumsubAxios(getApplicantDetails(applicantId));
|
||||
console.log('Applicant Data:', response.data);
|
||||
|
||||
// Exclude this key because the includedCountries and docSets data is not required
|
||||
delete response.data.requiredIdDocs;
|
||||
|
||||
console.log('Applicant Data:', JSON.stringify(response.data, null, 2));
|
||||
} catch (error: any) {
|
||||
console.error('Failed to fetch applicant data:', error.response ? error.response.data : error.message);
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user