-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathbusiness_verification.ts
50 lines (43 loc) · 1.6 KB
/
business_verification.ts
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
// Change to smile-identity-core if you're using this snippet in your project.
/* eslint-disable import/no-relative-packages */
import { IDApi } from '..';
// Initialize
// Login to the Smile Identity Portal to view your partner id.
const partner_id = '<Your partner ID>';
// Copy your API key from the Smile Identity portal.
const api_key = '<Your API key>';
// Use '0' for the sandbox server, use '1' for production server.
const sid_server = '<0 or 1>';
const connection = new IDApi(partner_id, api_key, sid_server);
// Create required tracking parameters
const partner_params = {
job_id: '<put your unique job ID here>',
user_id: '<put your unique ID for the user here>',
job_type: 7,
};
// Set fields required by the ID authority for a verification job.
const id_info = {
country: '<2-letter country code>',
id_type: '<id type>',
id_number: '<valid id number>',
entered: true,
business_type: '<valid business type>', // this is optional except when country is NG
postal_address: '<valid postal address>', // this is optional, except when country is KE
postal_code: '<valid postal address>', // this is optional, except when country is KE
};
// Submit the job. This method returns a promise.
(async () => {
try {
const result = await connection.submit_job(partner_params, id_info);
console.info(result);
// submit Asyncjob is an alternative to submit_job that returns a promise
const async_result = await connection.submitAsyncjob(
partner_params,
id_info,
'<your callback url>',
);
console.info(async_result);
} catch (error) {
console.error(error);
}
})();