New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

eu-vat

Package Overview
Dependencies
Maintainers
1
Versions
2
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

eu-vat

A tiny utility to retrieve vat rates for the EU. Useful for Ecommerce platforms and projects.

  • 1.0.1
  • latest
  • Source
  • npm
  • Socket score

Version published
Maintainers
1
Created
Source

eu-vat

Build Status

Description

This eu-vat module is a tiny package the helps retrieve vat rates for EU countries. It makes use of the json-vat api to retrieve the most recent vat rates for EU countries. This library can be easily plugged into your ecommerce platforms if you need to calculate cost related to vat e.g. shiiping cost etc.

Developers Guide

Dependencies

  • NPM 6.x
  • Node 8.x

NPM

This package has been published on NPM and is freely available according to the MIT license. To install via npm simply run npm install eu-vat.

NPM Package Usage


const EuroVat = require('eu-vat');
const vat = new EuroVat();


vat.getRates('FI').then((rates) => {
  console.log(rates);
  // Do something with rates
});

/* Alternative style using async await */
const getRates = async () => {
  const rates = await vat.getRates('RO');
  console.log(rates);
  // Do something with rates
}

The utility returns a resolved or rejected promise.

Available function

This module exposes one primary functions getRates. The getRates function accepts just one argument countryCode. The get rate function returns a promise.

Accepted method argument

The countryCode {Optional} - This refers to the ISO2 country code of the European country whose tax rate is to be retrieved. This argument is optional i.e if no countryCode is passed, the function will return a list countaining objects of each countries tax rates. This argument compulsorily has to be a string if passed of course :). Kindly see the next section for a list of supported countries.

Returned Value

The returned value largely depends on if a countryCode is passed, however the returned value is always a Promise, although using the async/await syntax one could easily mimick real time data handling. For a getRates request with a countryCode passed, say Romanian countryCode RO, the following should be an expected response.

{ 
  name: 'Romania',
  countryCode: 'RO',
  periods:
  { effective_from: '2017-01-01',
    rates: { 
      reduced1: 5, reduced2: 9, standard: 19 
    }
  } 
}

Supported Countries

name: 'Spain', countryCode: 'ES'

name: 'Bulgaria', countryCode: 'BG'

name: 'Hungary', countryCode: 'HU'

name: 'Latvia', countryCode: 'LV'

name: 'Poland', countryCode: 'PL'

name: 'United Kingdom', countryCode: 'GB'

name: 'Czech Republic', countryCode: 'CZ'

name: 'Malta', countryCode: 'MT'

name: 'Italy', countryCode: 'IT'

name: 'Slovenia', countryCode: 'SI'

name: 'Ireland', countryCode: 'IE'

name: 'Sweden', countryCode: 'SE'

name: 'Denmark', countryCode: 'DK'

name: 'Finland', countryCode: 'FI'

name: 'Cyprus', countryCode: 'CY'

name: 'Luxembourg', countryCode: 'LU'

name: 'Romania', countryCode: 'RO'

name: 'Estonia', countryCode: 'EE'

name: 'Greece', countryCode: 'GR'

name: 'Lithuania', countryCode: 'LT'

name: 'France', countryCode: 'FR'

name: 'Croatia', countryCode: 'HR'

name: 'Belgium', countryCode: 'BE'

name: 'Netherlands', countryCode: 'NL'

name: 'Slovakia', countryCode: 'SK'

name: 'Germany', countryCode: 'DE'

name: 'Portugal', countryCode: 'PT'

name: 'Austria', countryCode: 'AT'

Keywords

FAQs

Package last updated on 27 Oct 2018

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc