0.0.5 • Published 5 years ago

vies v0.0.5

Weekly downloads
21
License
ISC
Repository
github
Last release
5 years ago

VIES

The VIES repository is overtaken from Jethro, with all respects going to the original author. The VIES Node module checks VAT numbers against the European VIES validator. It is a thin and transparant wrapper around the SOAP service that is exposed through ec.europa.eu/taxation_customs.

INSTALL

npm i --save vies

USAGE

Calling vies.validate(vatNumber, countryCode) returns a promise:

const vies = require('vies');

vies.validate('123456789', 'NL')
    .then((response) => {
        /* do stuff ... */
    })
    .catch((error) => {
        /* do stuff ... */
    });

EXAMPLE RESPONSES

1. Success
~~~~~~~~~~

    {
        error: null,
        is_valid: true,
        data: {
            countryCode: 'NL',
            vatNumber: '0123456789',
            requestDate: Invalid Date,
            valid: true,
            name: 'BV SOMECOMPANY',
            address: 'THE REGISTERED ADDRESS\nZIP CITY'
        }
    }


2. Invalid VAT-number
~~~~~~~~~~~~~~~~~~~~~

    {
        error: null,
        is_valid: false,
        data: {
            countryCode: 'NL',
            vatNumber: '0123456789',
            requestDate: Invalid Date,
            valid: false,
            name: '---',
            address: '---'
        }
    }


3. Invalid input
~~~~~~~~~~~~~~~~

    {
        error: 'INVALID_INPUT',
        is_valid: false,
        data: null
    }


4. Other VIES error codes
~~~~~~~~~~~~~~~~~~~~~~~~~

    cf. example reponse 3, with the following error strings:

    - INVALID_INPUT
    - INVALID_REQUESTER_INFO
    - SERVICE_UNAVAILABLE
    - MS_UNAVAILABLE
    - TIMEOUT
    - VAT_BLOCKED
    - IP_BLOCKED
    - GLOBAL_MAX_CONCURRENT_REQ
    - GLOBAL_MAX_CONCURRENT_REQ_TIME
    - MS_MAX_CONCURRENT_REQ
    - MS_MAX_CONCURRENT_REQ_TIME
0.0.5

5 years ago

0.0.4

5 years ago

0.0.3

5 years ago

0.0.2

5 years ago

0.0.1

5 years ago