Giter Site home page Giter Site logo

unit-node-sdk's Introduction

unit-node-sdk

This library provides a typescript wrapper to Unit's API.

Documentation

See https://docs.unit.co/

Installation

npm install @unit-finance/unit-node-sdk

Usage

Create an individual application (es6)

import { Unit } from '@unit-finance/unit-node-sdk'

const unit = new Unit(UNIT_TOKEN, UNIT_API_URL)

let createApplicationRequest = {
    type: "individualApplication",
    attributes: {
        "ssn": "000000002",
        "fullName": unit.helpers.createFullName("Richard", "Hendricks"),
        "dateOfBirth": "2001-08-10",
        "address": unit.helpers.createAddress("20 Ingram St", null, "Forest Hills", "CA", "11375", "US"),
        "email": "[email protected]",
        "phone": unit.helpers.createPhone("1", "2025550158"),
        "ip": "127.0.0.1",
        "ein": "123456789",
        "dba": "Pied Piper Inc",
        "soleProprietorship": true
    }
}

let application = await unit.applications.create(createApplicationRequest).catch(err => {
    // handle errors
    return err
})

console.log(application)

Create an individual application (typescript)

import { CreateIndividualApplicationRequest, Unit, UnitError } from "@unit-finance/unit-node-sdk";

const unit = new Unit(UNIT_TOKEN, UNIT_API_URL)

(async () => {
    let createApplicationRequest: CreateIndividualApplicationRequest = {
        type: "individualApplication",
        attributes: {
    		"ssn": "000000002",
        	"fullName": unit.helpers.createFullName("Richard", "Hendricks"),
            "dateOfBirth": "2001-08-10",
            "address": unit.helpers.createAddress("20 Ingram St", null, "Forest Hills", "CA", "11375", "US"),
            "email": "[email protected]",
            "phone": unit.helpers.createPhone("1", "2025550158"),
            "ip": "127.0.0.1",
            "ein": "123456789",
            "dba": "Pied Piper Inc",
            "soleProprietorship": true
        }
    }

    let application = await unit.applications.create(createApplicationRequest).catch<UnitError>(err => {
        // handle errors
        return err
    })

    console.log(application)
})();

Fetching a customer

import { Unit, UnitError } from "@unit-finance/unit-node-sdk";

const unit = new Unit(UNIT_TOKEN, UNIT_API_URL)

(async () => {
    let customer = await unit.customers.get(customerId).catch<UnitError>(err => {
        // handle errors
        return err
    })

    console.log(customer)
})();

unit-node-sdk's People

Contributors

axshani avatar ilyamerman avatar elroie avatar obando777 avatar ali-sharif avatar jerizm avatar katt avatar unit-shahaf avatar lucianopierdona avatar n10000k avatar jorcar avatar somdoron avatar dev-dennis-guye avatar luoyang9 avatar bluedot-dev avatar evang859 avatar itaii avatar kevmo314 avatar yutongliuytl avatar dependabot[bot] avatar joshua-moves 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.