Use stringify to show nested objects
This commit is contained in:
parent
b06e07b0f8
commit
a17f060f4d
@ -22,6 +22,7 @@
|
|||||||
},
|
},
|
||||||
"scripts": {
|
"scripts": {
|
||||||
"build": "tsc",
|
"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();
|
dotenv.config();
|
||||||
|
|
||||||
export const command = 'applicant-details';
|
|
||||||
|
|
||||||
export const desc = 'Get applicant details.';
|
|
||||||
|
|
||||||
const SUMSUB_BASE_URL = 'https://api.sumsub.com';
|
const SUMSUB_BASE_URL = 'https://api.sumsub.com';
|
||||||
const SUMSUB_APP_TOKEN = process.env.SUMSUB_APP_TOKEN || '';
|
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) => {
|
export const builder = (yargs: any) => {
|
||||||
return yargs.positional('applicantId', {
|
return yargs.positional('applicantId', {
|
||||||
describe: 'The applicant ID to query',
|
describe: 'The applicant ID to query',
|
||||||
@ -39,7 +39,7 @@ function getApplicantDetails (applicantId: string | number) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
export const handler = async (argv: Arguments) => {
|
export const handler = async (argv: Arguments) => {
|
||||||
const applicantId = argv._[2];
|
const applicantId = argv.applicantId as string;
|
||||||
|
|
||||||
if (!applicantId) {
|
if (!applicantId) {
|
||||||
console.error('Applicant ID is required');
|
console.error('Applicant ID is required');
|
||||||
@ -47,7 +47,7 @@ export const handler = async (argv: Arguments) => {
|
|||||||
|
|
||||||
try {
|
try {
|
||||||
const response = await sumsubAxios(getApplicantDetails(applicantId));
|
const response = await sumsubAxios(getApplicantDetails(applicantId));
|
||||||
console.log('Applicant Data:', response.data);
|
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);
|
console.error('Failed to fetch applicant data:', error.response ? error.response.data : error.message);
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user