Skip to content

pacelyapp/vatsearch

Repository files navigation

@pacely/vatsearch

npm version npm downloads License

Search for company records in all Nordic countries ⚡️

Features

  • 👌  Search for all companies in Norway, Denmark, Sweden and Finland
  • ⚡  Get opinionated Risk Analysis on all companies

Quick Setup

Add @pacely/vatsearch dependency to your project

# Using npm
npm install @pacely/vatsearch

# Using yarn
yarn add @pacely/vatsearch

Usage

import VatSearch, { VatRegister, Company } from "@pacely/vatsearch";

// Initialize the parser
const vatsearch = new VatSearch({ register: VatRegister.NO }).parser()

// Get all companies (Only available for NO)
vatsearch.all().then((response: Company[]) => {
    console.log(response)
})

// Search for a company by name
vatsearch.find('Hirvi AS').then((response: Company[]) => {
    console.log(response)
})

// Get a single company by VATID/Organization identifier
vatsearch.get(10150817).then((response: Company) => {
    console.log(response)
})

Response

The response object contains the following and is the same for all registers

interface Company {
    vatid: string | number;
    name: string;
    dateStarted: string;
    employees: number | string;
    companyType: string;
    address: CompanyAddress;
    website: string;
    bankrupt: boolean | string | 'not_available';
    contact: CompanyContact | string | 'not_available';
    risk: RiskAnalyses;
    [x: string]: any;
}

interface CompanyAddress {
    address: string;
    zip: number;
    place: string;
    municipal?: string;
    country: string;
}

interface CompanyContact {
    phone?: string | number;
    email?: string;
    fax?: string | number;
}

interface RiskAnalyses {
    score: number
    risks: {
        [x: string]: any;
    }[]
    info: string
}

Configuration

This package takes a single configuration while initializing. The register flag tells it what API to use for your request.

const vatsearch = new VatSearch({
    register: 'NO' // NO, DK, SV, FI
})

You can change the configuration afterwards by doing vatsearch.setOptions(options).

License

MIT License

Copyright (c) HIRVI AS