GithubHelp home page GithubHelp logo

ostdotcom / ost-kyc-sdk-js Goto Github PK

View Code? Open in Web Editor NEW
3.0 6.0 0.0 43 KB

OST KYC SDK for JS

Home Page: https://kyc.ost.com

License: MIT License

JavaScript 100.00%
ost-kyc-sdk users-kyc kyc kyc-service ost js openst

ost-kyc-sdk-js's Introduction

KYC Javascript SDK

The official OST KYC JavaScript SDK.

Requirements

To use this node module, developers will need to:

  1. Login on https://kyc.ost.com/admin/login.
  2. Obtain an API Key and API Secret from https://kyc.ost.com/admin/settings/developer-integrations.

Documentation

https://dev.ost.com/docs/kyc

Installation

Install OST KYC JavaScript SDK

> npm install @ostdotcom/ost-kyc-sdk-js

Example Usage

Require the SDK:

const KYCSDK = require('@ostdotcom/ost-kyc-sdk-js');

Initialize the SDK object:

// the latest valid API endpoint is "https://kyc.sandboxost.com", this may change in the future
// timeout can be passed in config object. This is http request timeout.(In seconds)
const kycObj = new KYCSDK({apiKey: <api_key>, apiSecret: <api_secret>, apiEndpoint: <api_endpoint>, 
config: {timeout: <timeout>}});

Users Module

const userService = kycObj.services.users;

Create a new user:

userService.create({email: '[email protected]'}).then(function(res) { console.log(JSON.stringify(res)); }).catch(function(err) { console.log(JSON.stringify(err)); });

Get an existing user:

userService.get({id: '123454333'}).then(function(res) { console.log(JSON.stringify(res)); }).catch(function(err) { console.log(JSON.stringify(err)); });

Get a list of users and other data:

userService.list({}).then(function(res) { console.log(JSON.stringify(res)); }).catch(function(err) { console.log(JSON.stringify(err)); });

Users KYC module

const usersKYCService = kycObj.services.usersKyc;

Submit KYC:

usersKYCService.submitKyc({user_id:11003, first_name:'RAJESH',  last_name:'KUMAR',  birthdate:'29/07/1992', country:'INDIA', nationality:'INDIAN', document_id_number:'ADDHBDHBSH', document_id_file_path:'10/i/4ae058629d4b384edcda8decdfbf0dd1', selfie_file_path:'10/i/4ae058629d4b384edcda8decdfbf0dd2', ethereum_address:'0x04d39e0b112c20917868ffd5c42372ecc5df577b',estimated_participation_amount:'1.2',residence_proof_file_path:'10/i/4ae058629d4b384edcda8decdfbf0dd3',investor_proof_files_path: ['10/i/4ae058629d4b384edcda8decdfbf0da1', '10/i/4ae058629d4b384edcda8decdfbf0da2'], city:'pune',street_address:'hadapsar',postal_code:'411028',state:'maharashtra'}).then(function(res) { console.log(JSON.stringify(res)); }).catch(function(err) { console.log(JSON.stringify(err)); });

List Users KYC:

usersKYCService.list().then(function(res) { console.log(JSON.stringify(res)); }).catch(function(err) { console.log(JSON.stringify(err)); });

Get Users KYC

usersKYCService.get({user_id:11003}).then(function(res) { console.log(JSON.stringify(res)); }).catch(function(err) { console.log(JSON.stringify(err)); });

Get PUT Presigned url

    usersKYCService.getPresignedUrlPut({
         files: {
           residence_proof: 'application/pdf',
           investor_proof_file1: 'application/pdf',
           investor_proof_file2: 'application/pdf',
           document_id: 'image/jpeg',
           selfie: 'image/jpeg'
         }
       }
       ).then(function(res) { console.log(JSON.stringify(res, null, "  ")); }).catch(function(err) { console.log(JSON.stringify(err)); });

Get POST Presigned url

usersKYCService.getPresignedUrlPost({
     files: {
       residence_proof: 'application/pdf',
       investor_proof_file1: 'application/pdf',
       investor_proof_file2: 'application/pdf',
       document_id: 'image/jpeg',
       selfie: 'image/jpeg'
     }
   }
 ).then(function(res) { console.log(JSON.stringify(res, null, "  ")); }).catch(function(err) { console.log(JSON.stringify(err)); });

Send KYC approve email

usersKYCService.emailApprove({user_id: 11003}).then(function(res) { console.log(JSON.stringify(res, null, "  ")); }).catch(function(err) { console.log(JSON.stringify(err)); });

Send KYC deny email

usersKYCService.emailDeny({user_id: 11003}).then(function(res) { console.log(JSON.stringify(res, null, "  ")); }).catch(function(err) { console.log(JSON.stringify(err)); });

Send KYC report issue email

usersKYCService.emailReportIssue({user_id: 11003}).then(function(res) { console.log(JSON.stringify(res, null, "  ")); }).catch(function(err) { console.log(JSON.stringify(err)); });

Users KYC details Module

const usersKYCDetailsService = kycObj.services.usersKycDetails;

Get user's kyc details

usersKYCDetailsService.get({user_id:11003}).then(function(res) { console.log(JSON.stringify(res)); }).catch(function(err) { console.log(JSON.stringify(err)); });

Validation Module

const validatorService = kycObj.services.validators;

Verify ethereum address

 validatorService.verifyEthereumAddress({ethereum_address: '0x32be343b94f860124dc4fee278fdcbd38c102d88'}).then(function(res) { console.log(JSON.stringify(res)); }).catch(function(err) { console.log(JSON.stringify(err)); });

ost-kyc-sdk-js's People

Contributors

aman-barbaria avatar mayurpatil888 avatar

Stargazers

 avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.