Zum Hauptinhalt springen

VatValidatorBzStService

This class validates vat numbers by using the german Federal Central Tax Office service (https://evatr.bff-online.de/eVatR/).

context.enableModules();
const { VatValidatorBzStService } = require("ou.sp.validation.VatValidatorBzStService");

const isValid = VatValidatorBzStService.isValid("de-306219982");

try {
const response = VatValidatorBzStService.validate("de-306219982");
response.ErrorCode
} catch (error) {
util.log(error.message);
}

Constructors

Constructor

new VatValidatorBzStService(): VatValidatorBzStService

Returns

VatValidatorBzStService

Properties

errorCodes

static errorCodes: Record<BzStServiceErrorCodes, string>

Methods

isValid()

Call Signature

static isValid(ownerVat, companyVat): boolean

Validates a VAT by using the german Federal Central Tax Office service (https://evatr.bff-online.de/eVatR/).

Warning: This function will not throw an error. If an error occurs, this function will always return false

const isValid = VatValidatorBzStService.isValid("DE306219982","NL809075349B01");
// isValid = true

@param ownerVat
@param companyVat
@returns `true` if valid, otherwise `false`

##### Parameters

###### ownerVat

`string`

###### companyVat

`string`

##### Returns

`boolean`

#### Call Signature

> `static` **isValid**(`ownerVat`, `companyVat`, `companyName`, `companyCity`, `companyZipCode?`, `companyStreet?`): `boolean`

Validates a VAT by using the german Federal Central Tax Office service (`https://evatr.bff-online.de/eVatR/`).

Warning: This function will not throw an error. If an error occurs, this function will always return false

const isValid = VatValidatorBzStService.isValid("DE306219982","NL809075349B01","WILDLANDS Adventure Zoo Emmen B.V","Emmen","Raadhuisplein 99"); // isValid = true

@param ownerVat @param companyVat @param companyName @param companyCity @param companyZipCode @param companyStreet @returns true if valid, otherwise false

Parameters
ownerVat

string

companyVat

string

companyName

string

companyCity

string

companyZipCode?

string

companyStreet?

string

Returns

boolean


validate()

Call Signature

static validate(ownerVat, companyVat): BzStServiceResponse

Validates a VAT by using the german Federal Central Tax Office service (https://evatr.bff-online.de/eVatR/).

Warning: This function will throws error.

const result = VatValidatorBzStService.validate("DE306219982","NL809075349B01");
// {
// "UstId_1": "DE306219982",
// "UstId_2": "NL809075349B01",
// "ErrorCode": "200",
// "ErrorMessage": "Die angefragte USt-IdNr. ist gültig.",
// "Firmenname": "",
// "Druck": "nein",
// "Strasse": "",
// "Ort": "",
// "Datum": "01.12.2022",
// "PLZ": "",
// "Uhrzeit": "13:48:43",
// "Gueltig_ab": "",
// "Gueltig_bis": "",
// "Erg_Ort": "A",
// "Erg_PLZ": "C",
// "Erg_Name": "A",
// "Erg_Str": "A"
// }
Parameters
ownerVat

string

companyVat

string

Returns

BzStServiceResponse

the response as json object

Throws

an error in case of any error

Call Signature

static validate(ownerVat, companyVat, companyName, companyCity, companyZipCode?, companyStreet?): BzStServiceResponse

Validates a VAT by using the german Federal Central Tax Office service (https://evatr.bff-online.de/eVatR/).

Warning: This function will throws error.

const result = VatValidatorBzStService.validate("DE306219982","NL809075349B01","WILDLANDS Adventure Zoo Emmen B.V","Emmen");
// {
// "UstId_1": "DE306219982",
// "UstId_2": "NL809075349B01",
// "ErrorCode": "200",
// "ErrorMessage": "Die angefragte USt-IdNr. ist gültig.",
// "Firmenname": "WILDLANDS Adventure Zoo Emmen B.V",
// "Druck": "nein",
// "Strasse": "Raadhuisplein 99",
// "Ort": "Emmen",
// "Datum": "01.12.2022",
// "PLZ": "",
// "Uhrzeit": "13:48:43",
// "Gueltig_ab": "",
// "Gueltig_bis": "",
// "Erg_Ort": "A",
// "Erg_PLZ": "C",
// "Erg_Name": "A",
// "Erg_Str": "A"
// }
Parameters
ownerVat

string

companyVat

string

companyName

string

companyCity

string

companyZipCode?

string

companyStreet?

string

Returns

BzStServiceResponse

the response as json object

Throws

an error in case of any error