evatr-api 0.1.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE.md +21 -0
- package/README.md +434 -0
- package/dist/api-updater.d.ts +67 -0
- package/dist/api-updater.d.ts.map +1 -0
- package/dist/api-updater.js +283 -0
- package/dist/api-updater.js.map +1 -0
- package/dist/client.d.ts +111 -0
- package/dist/client.d.ts.map +1 -0
- package/dist/client.js +278 -0
- package/dist/client.js.map +1 -0
- package/dist/constants.d.ts +39 -0
- package/dist/constants.d.ts.map +1 -0
- package/dist/constants.js +268 -0
- package/dist/constants.js.map +1 -0
- package/dist/index.d.ts +15 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +28 -0
- package/dist/index.js.map +1 -0
- package/dist/migration-helper.d.ts +92 -0
- package/dist/migration-helper.d.ts.map +1 -0
- package/dist/migration-helper.js +222 -0
- package/dist/migration-helper.js.map +1 -0
- package/dist/status-loader.d.ts +71 -0
- package/dist/status-loader.d.ts.map +1 -0
- package/dist/status-loader.js +191 -0
- package/dist/status-loader.js.map +1 -0
- package/dist/types.d.ts +152 -0
- package/dist/types.d.ts.map +1 -0
- package/dist/types.js +6 -0
- package/dist/types.js.map +1 -0
- package/dist/utils.d.ts +77 -0
- package/dist/utils.d.ts.map +1 -0
- package/dist/utils.js +135 -0
- package/dist/utils.js.map +1 -0
- package/package.json +73 -0
package/dist/client.js
ADDED
|
@@ -0,0 +1,278 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
/**
|
|
3
|
+
* Main client class for the eVatR API
|
|
4
|
+
*/
|
|
5
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
6
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
7
|
+
};
|
|
8
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
9
|
+
exports.EvatrClient = void 0;
|
|
10
|
+
const axios_1 = __importDefault(require("axios"));
|
|
11
|
+
const constants_1 = require("./constants");
|
|
12
|
+
const status_loader_1 = require("./status-loader");
|
|
13
|
+
/**
|
|
14
|
+
* EvatrClient - Main client for interacting with the eVatR API
|
|
15
|
+
*/
|
|
16
|
+
class EvatrClient {
|
|
17
|
+
constructor(config = {}) {
|
|
18
|
+
const { timeout = 30000, headers = {}, } = config;
|
|
19
|
+
this.httpClient = axios_1.default.create({
|
|
20
|
+
timeout,
|
|
21
|
+
headers: {
|
|
22
|
+
'Content-Type': 'application/json',
|
|
23
|
+
'Accept': 'application/json',
|
|
24
|
+
...headers,
|
|
25
|
+
},
|
|
26
|
+
});
|
|
27
|
+
// Add response interceptor for error handling
|
|
28
|
+
this.httpClient.interceptors.response.use((response) => response, (error) => {
|
|
29
|
+
const evatrError = new Error(error.response?.data?.message || error.message || 'Unknown error');
|
|
30
|
+
evatrError.name = 'EvatrApiError';
|
|
31
|
+
evatrError.http = error.response?.status;
|
|
32
|
+
evatrError.status = error.response?.data?.status;
|
|
33
|
+
evatrError.field = error.response?.data?.field;
|
|
34
|
+
throw evatrError;
|
|
35
|
+
});
|
|
36
|
+
}
|
|
37
|
+
async validateSimple(request, extended) {
|
|
38
|
+
const payload = {
|
|
39
|
+
vatIdOwn: request.vatIdOwn,
|
|
40
|
+
vatIdForeign: request.vatIdForeign,
|
|
41
|
+
includeRaw: request.includeRaw,
|
|
42
|
+
};
|
|
43
|
+
return this.performValidation(payload, extended);
|
|
44
|
+
}
|
|
45
|
+
async validateQualified(request, extended) {
|
|
46
|
+
const payload = {
|
|
47
|
+
vatIdOwn: request.vatIdOwn,
|
|
48
|
+
vatIdForeign: request.vatIdForeign,
|
|
49
|
+
company: request.company,
|
|
50
|
+
location: request.location,
|
|
51
|
+
street: request.street,
|
|
52
|
+
zip: request.zip,
|
|
53
|
+
includeRaw: request.includeRaw,
|
|
54
|
+
};
|
|
55
|
+
return this.performValidation(payload, extended);
|
|
56
|
+
}
|
|
57
|
+
async validate(request, extended) {
|
|
58
|
+
return this.performValidation(request, extended);
|
|
59
|
+
}
|
|
60
|
+
/**
|
|
61
|
+
* Get status messages from the API
|
|
62
|
+
* @returns Promise<StatusMessage[]>
|
|
63
|
+
*/
|
|
64
|
+
async getStatusMessages() {
|
|
65
|
+
try {
|
|
66
|
+
const response = await this.httpClient.get(constants_1.ENDPOINTS.STATUS_MESSAGES);
|
|
67
|
+
return response.data.map(apiMsg => ({
|
|
68
|
+
status: apiMsg.status,
|
|
69
|
+
category: apiMsg.kategorie === 'Ergebnis' ? 'Result' : apiMsg.kategorie === 'Fehler' ? 'Error' : apiMsg.kategorie === 'Hinweis' ? 'Hint' : undefined,
|
|
70
|
+
http: apiMsg.httpcode,
|
|
71
|
+
message: apiMsg.meldung,
|
|
72
|
+
field: apiMsg.feld,
|
|
73
|
+
}));
|
|
74
|
+
}
|
|
75
|
+
catch (error) {
|
|
76
|
+
throw this.handleError(error);
|
|
77
|
+
}
|
|
78
|
+
}
|
|
79
|
+
/**
|
|
80
|
+
* Get EU member states and their availability
|
|
81
|
+
* @returns Promise<ApiEUMemberState[]>
|
|
82
|
+
*/
|
|
83
|
+
async getEUMemberStates() {
|
|
84
|
+
try {
|
|
85
|
+
const response = await this.httpClient.get(constants_1.ENDPOINTS.EU_MEMBER_STATES);
|
|
86
|
+
return response.data.map(apiState => ({
|
|
87
|
+
code: apiState.alpha2,
|
|
88
|
+
available: apiState.verfuegbar,
|
|
89
|
+
}));
|
|
90
|
+
}
|
|
91
|
+
catch (error) {
|
|
92
|
+
throw this.handleError(error);
|
|
93
|
+
}
|
|
94
|
+
}
|
|
95
|
+
/**
|
|
96
|
+
* Get status message by status code
|
|
97
|
+
* @param statusCode Status code (e.g., "evatr-0000")
|
|
98
|
+
* @returns StatusMessage or undefined if not found
|
|
99
|
+
*/
|
|
100
|
+
getStatusMessage(statusCode) {
|
|
101
|
+
return status_loader_1.StatusMessages.getStatusMessage(statusCode);
|
|
102
|
+
}
|
|
103
|
+
/**
|
|
104
|
+
* Check if a status code indicates success
|
|
105
|
+
* @param statusCode Status code to check
|
|
106
|
+
* @returns boolean
|
|
107
|
+
*/
|
|
108
|
+
isSuccessStatus(statusCode) {
|
|
109
|
+
return status_loader_1.StatusMessages.isSuccessStatus(statusCode);
|
|
110
|
+
}
|
|
111
|
+
/**
|
|
112
|
+
* Check if a status code indicates an error
|
|
113
|
+
* @param statusCode Status code to check
|
|
114
|
+
* @returns boolean
|
|
115
|
+
*/
|
|
116
|
+
isErrorStatus(statusCode) {
|
|
117
|
+
return status_loader_1.StatusMessages.isErrorStatus(statusCode);
|
|
118
|
+
}
|
|
119
|
+
/**
|
|
120
|
+
* Check if a status code indicates a warning/hint
|
|
121
|
+
* @param statusCode Status code to check
|
|
122
|
+
* @returns boolean
|
|
123
|
+
*/
|
|
124
|
+
isWarningStatus(statusCode) {
|
|
125
|
+
return status_loader_1.StatusMessages.isWarningStatus(statusCode);
|
|
126
|
+
}
|
|
127
|
+
/**
|
|
128
|
+
* Validate VAT-ID format (basic syntax check)
|
|
129
|
+
* @param vatId VAT-ID to validate
|
|
130
|
+
* @returns boolean
|
|
131
|
+
*/
|
|
132
|
+
static checkVatIdSyntax(vatId) {
|
|
133
|
+
if (!vatId || typeof vatId !== 'string') {
|
|
134
|
+
return false;
|
|
135
|
+
}
|
|
136
|
+
const cleanVatId = this.normalizeVatId(vatId);
|
|
137
|
+
// Must start with exactly 2 letters (country code)
|
|
138
|
+
if (!/^[A-Z]{2}/.test(cleanVatId)) {
|
|
139
|
+
return false;
|
|
140
|
+
}
|
|
141
|
+
const countryCode = cleanVatId.substring(0, 2);
|
|
142
|
+
const pattern = constants_1.VATID_PATTERNS[countryCode];
|
|
143
|
+
if (!pattern) {
|
|
144
|
+
return false;
|
|
145
|
+
}
|
|
146
|
+
return pattern.test(cleanVatId);
|
|
147
|
+
}
|
|
148
|
+
/**
|
|
149
|
+
* Extract country code from VAT-ID
|
|
150
|
+
* @param vatId VAT-ID
|
|
151
|
+
* @returns string Country code
|
|
152
|
+
*/
|
|
153
|
+
static getCountryCode(vatId) {
|
|
154
|
+
return this.normalizeVatId(vatId).substring(0, 2);
|
|
155
|
+
}
|
|
156
|
+
/**
|
|
157
|
+
* Format VAT-ID by removing spaces and converting to uppercase
|
|
158
|
+
* @param vatId VAT-ID to format
|
|
159
|
+
* @returns string Formatted VAT-ID
|
|
160
|
+
*/
|
|
161
|
+
static normalizeVatId(vatId) {
|
|
162
|
+
return vatId.replace(/[^a-zA-Z0-9]/g, '').toUpperCase();
|
|
163
|
+
}
|
|
164
|
+
/**
|
|
165
|
+
* Maps parameters to API property names
|
|
166
|
+
*/
|
|
167
|
+
mapToApiParams(request) {
|
|
168
|
+
return {
|
|
169
|
+
anfragendeUstid: request.vatIdOwn,
|
|
170
|
+
angefragteUstid: request.vatIdForeign,
|
|
171
|
+
firmenname: request.company,
|
|
172
|
+
ort: request.location,
|
|
173
|
+
strasse: request.street,
|
|
174
|
+
plz: request.zip,
|
|
175
|
+
};
|
|
176
|
+
}
|
|
177
|
+
/**
|
|
178
|
+
* Maps API response to parameters
|
|
179
|
+
*/
|
|
180
|
+
mapFromApiResponse(response, vatIdOwn, vatIdForeign) {
|
|
181
|
+
return {
|
|
182
|
+
timestamp: response.anfrageZeitpunkt,
|
|
183
|
+
status: response.status,
|
|
184
|
+
vatIdOwn,
|
|
185
|
+
vatIdForeign,
|
|
186
|
+
validFrom: response.gueltigAb,
|
|
187
|
+
validTill: response.gueltigBis,
|
|
188
|
+
company: response.ergFirmenname,
|
|
189
|
+
street: response.ergStrasse,
|
|
190
|
+
zip: response.ergPlz,
|
|
191
|
+
location: response.ergOrt,
|
|
192
|
+
};
|
|
193
|
+
}
|
|
194
|
+
/**
|
|
195
|
+
* Maps basic Response to ExtendedResponse with date objects and additional info
|
|
196
|
+
*/
|
|
197
|
+
mapToExtendedResponse(response) {
|
|
198
|
+
const statusMessage = this.getStatusMessage(response.status);
|
|
199
|
+
return {
|
|
200
|
+
timestamp: new Date(response.timestamp),
|
|
201
|
+
valid: this.isSuccessStatus(response.status),
|
|
202
|
+
status: response.status,
|
|
203
|
+
message: statusMessage?.message || undefined,
|
|
204
|
+
vatIdOwn: response.vatIdOwn,
|
|
205
|
+
vatIdForeign: response.vatIdForeign,
|
|
206
|
+
validFrom: response.validFrom ? new Date(response.validFrom) : undefined,
|
|
207
|
+
validTill: response.validTill ? new Date(response.validTill) : undefined,
|
|
208
|
+
company: response.company,
|
|
209
|
+
street: response.street,
|
|
210
|
+
zip: response.zip,
|
|
211
|
+
location: response.location,
|
|
212
|
+
raw: response.raw,
|
|
213
|
+
};
|
|
214
|
+
}
|
|
215
|
+
/**
|
|
216
|
+
* Internal method to perform the actual validation request
|
|
217
|
+
*/
|
|
218
|
+
async performValidation(request, extended) {
|
|
219
|
+
try {
|
|
220
|
+
// Validate input
|
|
221
|
+
if (!request.vatIdOwn || !request.vatIdForeign) {
|
|
222
|
+
throw new Error('Both vatIdOwn and vatIdForeign are required');
|
|
223
|
+
}
|
|
224
|
+
// Format VAT-IDs
|
|
225
|
+
const formattedRequest = {
|
|
226
|
+
...request,
|
|
227
|
+
vatIdOwn: EvatrClient.normalizeVatId(request.vatIdOwn),
|
|
228
|
+
vatIdForeign: EvatrClient.normalizeVatId(request.vatIdForeign),
|
|
229
|
+
};
|
|
230
|
+
// Validate VAT-ID formats
|
|
231
|
+
if (!EvatrClient.checkVatIdSyntax(formattedRequest.vatIdOwn)) {
|
|
232
|
+
throw new Error(`Invalid format for vatIdOwn: ${formattedRequest.vatIdOwn}`);
|
|
233
|
+
}
|
|
234
|
+
if (!EvatrClient.checkVatIdSyntax(formattedRequest.vatIdForeign)) {
|
|
235
|
+
throw new Error(`Invalid format for vatIdForeign: ${formattedRequest.vatIdForeign}`);
|
|
236
|
+
}
|
|
237
|
+
// Map to API parameters for the actual request
|
|
238
|
+
const apiPayload = this.mapToApiParams(formattedRequest);
|
|
239
|
+
const response = await this.httpClient.post(constants_1.ENDPOINTS.VALIDATION, apiPayload);
|
|
240
|
+
// Map API response to English property names
|
|
241
|
+
const basicResponse = this.mapFromApiResponse(response.data, formattedRequest.vatIdOwn, formattedRequest.vatIdForeign);
|
|
242
|
+
// Include raw response data if requested
|
|
243
|
+
if (request.includeRaw === true) {
|
|
244
|
+
const rawData = {
|
|
245
|
+
headers: response.headers,
|
|
246
|
+
data: response.data
|
|
247
|
+
};
|
|
248
|
+
basicResponse.raw = JSON.stringify(rawData);
|
|
249
|
+
}
|
|
250
|
+
if (extended) {
|
|
251
|
+
return this.mapToExtendedResponse(basicResponse);
|
|
252
|
+
}
|
|
253
|
+
return basicResponse;
|
|
254
|
+
}
|
|
255
|
+
catch (error) {
|
|
256
|
+
throw this.handleError(error);
|
|
257
|
+
}
|
|
258
|
+
}
|
|
259
|
+
/**
|
|
260
|
+
* Handle and transform errors
|
|
261
|
+
*/
|
|
262
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
263
|
+
handleError(error) {
|
|
264
|
+
if (error.name === 'EvatrApiError') {
|
|
265
|
+
return error;
|
|
266
|
+
}
|
|
267
|
+
const evatrError = new Error(error.message || 'Unknown error occurred');
|
|
268
|
+
evatrError.name = 'EvatrApiError';
|
|
269
|
+
if (error.response) {
|
|
270
|
+
evatrError.http = error.response.status;
|
|
271
|
+
evatrError.status = error.response.data?.status;
|
|
272
|
+
evatrError.field = error.response.data?.field;
|
|
273
|
+
}
|
|
274
|
+
return evatrError;
|
|
275
|
+
}
|
|
276
|
+
}
|
|
277
|
+
exports.EvatrClient = EvatrClient;
|
|
278
|
+
//# sourceMappingURL=client.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"client.js","sourceRoot":"","sources":["../src/client.ts"],"names":[],"mappings":";AAAA;;GAEG;;;;;;AAEH,kDAA4D;AAgB5D,2CAAwD;AACxD,mDAAiD;AAEjD;;GAEG;AACH,MAAa,WAAW;IAGtB,YAAY,SAA4B,EAAE;QACxC,MAAM,EACJ,OAAO,GAAG,KAAK,EACf,OAAO,GAAG,EAAE,GACb,GAAG,MAAM,CAAC;QAEX,IA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AAO,KAAK,EAAE,CAAC;YACf,MAAM,IAAI,CAAC,WAAW,CAAC,KAAK,CAAC,CAAC;QAChC,CAAC;IACH,CAAC;IAED;;OAEG;IACH,8DAA8D;IACtD,WAAW,CAAC,KAAU;QAC5B,IAAI,KAAK,CAAC,IAAI,KAAK,eAAe,EAAE,CAAC;YACnC,OAAO,KAAK,CAAC;QACf,CAAC;QAED,MAAM,UAAU,GAAkB,IAAI,KAAK,CACzC,KAAK,CAAC,OAAO,IAAI,wBAAwB,CAC1C,CAAC;QACF,UAAU,CAAC,IAAI,GAAG,eAAe,CAAC;QAElC,IAAI,KAAK,CAAC,QAAQ,EAAE,CAAC;YACnB,UAAU,CAAC,IAAI,GAAG,KAAK,CAAC,QAAQ,CAAC,MAAM,CAAC;YACxC,UAAU,CAAC,MAAM,GAAG,KAAK,CAAC,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAC;YAChD,UAAU,CAAC,KAAK,GAAG,KAAK,CAAC,QAAQ,CAAC,IAAI,EAAE,KAAK,CAAC;QAChD,CAAC;QAED,OAAO,UAAU,CAAC;IACpB,CAAC;CACF;AAvVD,kCAuVC"}
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Constants and status messages for the eVatR API
|
|
3
|
+
*/
|
|
4
|
+
import { StatusMessage } from './types';
|
|
5
|
+
/**
|
|
6
|
+
* Default API base URL
|
|
7
|
+
*/
|
|
8
|
+
export declare const DEFAULT_HOST = "https://api.evatr.vies.bzst.de";
|
|
9
|
+
export declare const DEFAULT_BASE_URL: string;
|
|
10
|
+
/**
|
|
11
|
+
* API endpoints
|
|
12
|
+
*/
|
|
13
|
+
export declare const ENDPOINTS: {
|
|
14
|
+
readonly VALIDATION: string;
|
|
15
|
+
readonly STATUS_MESSAGES: string;
|
|
16
|
+
readonly EU_MEMBER_STATES: string;
|
|
17
|
+
};
|
|
18
|
+
/**
|
|
19
|
+
* VAT-ID syntax validation rules
|
|
20
|
+
*/
|
|
21
|
+
export declare const VATID_PATTERNS: Record<string, RegExp>;
|
|
22
|
+
/**
|
|
23
|
+
* Status messages from the eVatR API
|
|
24
|
+
*/
|
|
25
|
+
export declare const STATUS_MESSAGES: Record<string, StatusMessage>;
|
|
26
|
+
/**
|
|
27
|
+
* Qualified result codes explanations
|
|
28
|
+
*/
|
|
29
|
+
export declare const QUALIFIED_RESULT_CODES: {
|
|
30
|
+
readonly A: "Die Angaben stimmen mit den registrierten Daten überein.";
|
|
31
|
+
readonly B: "Die Angaben stimmen mit den registrierten Daten nicht überein.";
|
|
32
|
+
readonly C: "Die Angaben wurden nicht angefragt.";
|
|
33
|
+
readonly D: "Die Angaben wurden vom EU-Mitgliedsstaat nicht mitgeteilt.";
|
|
34
|
+
};
|
|
35
|
+
/**
|
|
36
|
+
* Country code to country name mapping for EU member states
|
|
37
|
+
*/
|
|
38
|
+
export declare const EU_MEMBER_STATES: Record<string, string>;
|
|
39
|
+
//# sourceMappingURL=constants.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"constants.d.ts","sourceRoot":"","sources":["../src/constants.ts"],"names":[],"mappings":"AAAA;;GAEG;AAEH,OAAO,EAAE,aAAa,EAAE,MAAM,SAAS,CAAC;AAExC;;GAEG;AACH,eAAO,MAAM,YAAY,mCAAmC,CAAC;AAC7D,eAAO,MAAM,gBAAgB,QAA2B,CAAC;AAEzD;;GAEG;AACH,eAAO,MAAM,SAAS;;;;CAIZ,CAAC;AAEX;;GAEG;AACH,eAAO,MAAM,cAAc,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CA6BjD,CAAC;AAEF;;GAEG;AACH,eAAO,MAAM,eAAe,EAAE,MAAM,CAAC,MAAM,EAAE,aAAa,CAyKzD,CAAC;AAEF;;GAEG;AACH,eAAO,MAAM,sBAAsB;;;;;CAKzB,CAAC;AAEX;;GAEG;AACH,eAAO,MAAM,gBAAgB,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CA6BnD,CAAC"}
|
|
@@ -0,0 +1,268 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
/**
|
|
3
|
+
* Constants and status messages for the eVatR API
|
|
4
|
+
*/
|
|
5
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
+
exports.EU_MEMBER_STATES = exports.QUALIFIED_RESULT_CODES = exports.STATUS_MESSAGES = exports.VATID_PATTERNS = exports.ENDPOINTS = exports.DEFAULT_BASE_URL = exports.DEFAULT_HOST = void 0;
|
|
7
|
+
/**
|
|
8
|
+
* Default API base URL
|
|
9
|
+
*/
|
|
10
|
+
exports.DEFAULT_HOST = 'https://api.evatr.vies.bzst.de';
|
|
11
|
+
exports.DEFAULT_BASE_URL = exports.DEFAULT_HOST + '/app/v1';
|
|
12
|
+
/**
|
|
13
|
+
* API endpoints
|
|
14
|
+
*/
|
|
15
|
+
exports.ENDPOINTS = {
|
|
16
|
+
VALIDATION: exports.DEFAULT_BASE_URL + '/abfrage',
|
|
17
|
+
STATUS_MESSAGES: exports.DEFAULT_BASE_URL + '/info/statusmeldungen',
|
|
18
|
+
EU_MEMBER_STATES: exports.DEFAULT_BASE_URL + '/info/eu_mitgliedstaaten',
|
|
19
|
+
};
|
|
20
|
+
/**
|
|
21
|
+
* VAT-ID syntax validation rules
|
|
22
|
+
*/
|
|
23
|
+
exports.VATID_PATTERNS = {
|
|
24
|
+
'AT': /^ATU\d{8}$/, // ATU + 8 digits
|
|
25
|
+
'BE': /^BE[01]\d{9}$/, // BE + 0 or 1 + 9 digits
|
|
26
|
+
'BG': /^BG\d{9,10}$/, // BG + 9-10 digits
|
|
27
|
+
'CY': /^CY\d{8}[A-Z]$/, // CY + 8 digits + letter
|
|
28
|
+
'CZ': /^CZ\d{8,10}$/, // CZ + 8-10 digits
|
|
29
|
+
'DE': /^DE\d{9}$/, // DE + 9 digits
|
|
30
|
+
'DK': /^DK\d{8}$/, // DK + 8 digits
|
|
31
|
+
'EE': /^EE\d{9}$/, // EE + 9 digits
|
|
32
|
+
'ES': /^ES[A-Z]\d{7}[A-Z0-9]$/, // ES + letter + 7 digits + letter or digit
|
|
33
|
+
'FI': /^FI\d{8}$/, // FI + 8 digits
|
|
34
|
+
'FR': /^FR[A-Z0-9]{2}\d{9}$/, // FR + 2 chars + 9 digits
|
|
35
|
+
'GR': /^GR\d{9}$/, // GR + 9 digits
|
|
36
|
+
'HR': /^HR\d{11}$/, // HR + 11 digits
|
|
37
|
+
'HU': /^HU\d{8}$/, // HU + 8 digits
|
|
38
|
+
'IE': /^IE\d[A-Z0-9]\d{5}[A-Z]$|^\d{7}[A-Z]{1,2}$/, // IE + various patterns
|
|
39
|
+
'IT': /^IT\d{11}$/, // IT + 11 digits
|
|
40
|
+
'LT': /^LT\d{9}$|^\d{12}$/, // LT + 9 or 12 digits
|
|
41
|
+
'LU': /^LU\d{8}$/, // LU + 8 digits
|
|
42
|
+
'LV': /^LV\d{11}$/, // LV + 11 digits
|
|
43
|
+
'MT': /^MT\d{8}$/, // MT + 8 digits
|
|
44
|
+
'NL': /^NL\d{9}B\d{2}$/, // NL + 9 digits + B + 2 digits
|
|
45
|
+
'PL': /^PL\d{10}$/, // PL + 10 digits
|
|
46
|
+
'PT': /^PT\d{9}$/, // PT + 9 digits
|
|
47
|
+
'RO': /^RO\d{2,10}$/, // RO + 2-10 digits
|
|
48
|
+
'SE': /^SE\d{10}01$/, // SE + 10 digits + 01
|
|
49
|
+
'SI': /^SI\d{8}$/, // SI + 8 digits
|
|
50
|
+
'SK': /^SK\d{10}$/, // SK + 10 digits
|
|
51
|
+
'XI': /^XI\d{9}$|^\d{12}$/, // XI + 9 or 12 digits
|
|
52
|
+
};
|
|
53
|
+
/**
|
|
54
|
+
* Status messages from the eVatR API
|
|
55
|
+
*/
|
|
56
|
+
exports.STATUS_MESSAGES = {
|
|
57
|
+
'evatr-0000': {
|
|
58
|
+
status: 'evatr-0000',
|
|
59
|
+
category: 'Result',
|
|
60
|
+
http: 200,
|
|
61
|
+
message: 'Die angefragte Ust-IdNr. ist zum Anfragezeitpunkt gültig.',
|
|
62
|
+
},
|
|
63
|
+
'evatr-0001': {
|
|
64
|
+
status: 'evatr-0001',
|
|
65
|
+
category: 'Hint',
|
|
66
|
+
http: 400,
|
|
67
|
+
field: 'datenschutz',
|
|
68
|
+
message: 'Bitte bestätigen Sie den Datenschutzhinweis.',
|
|
69
|
+
},
|
|
70
|
+
'evatr-0002': {
|
|
71
|
+
status: 'evatr-0002',
|
|
72
|
+
category: 'Hint',
|
|
73
|
+
http: 400,
|
|
74
|
+
field: 'angefragteUstid',
|
|
75
|
+
message: 'Mindestens eins der Pflichtfelder ist nicht besetzt.',
|
|
76
|
+
},
|
|
77
|
+
'evatr-0003': {
|
|
78
|
+
status: 'evatr-0003',
|
|
79
|
+
category: 'Hint',
|
|
80
|
+
http: 400,
|
|
81
|
+
field: 'firmenname,ort',
|
|
82
|
+
message: 'Die angefragte Ust-IdNr. ist zum Anfragezeitpunkt gültig. Mindestens eines der Pflichtfelder für eine qualifizierte Bestätigungsanfrage ist nicht besetzt.',
|
|
83
|
+
},
|
|
84
|
+
'evatr-0004': {
|
|
85
|
+
status: 'evatr-0004',
|
|
86
|
+
category: 'Error',
|
|
87
|
+
http: 400,
|
|
88
|
+
field: 'anfragendeUstid',
|
|
89
|
+
message: 'Die anfragende DE Ust-IdNr. ist syntaktisch falsch. Sie passt nicht in das deutsche Erzeugungsschema.',
|
|
90
|
+
},
|
|
91
|
+
'evatr-0005': {
|
|
92
|
+
status: 'evatr-0005',
|
|
93
|
+
category: 'Error',
|
|
94
|
+
http: 400,
|
|
95
|
+
field: 'angefragteUstid',
|
|
96
|
+
message: 'Die angegebene angefragte Ust-IdNr. ist syntaktisch falsch.',
|
|
97
|
+
},
|
|
98
|
+
'evatr-0006': {
|
|
99
|
+
status: 'evatr-0006',
|
|
100
|
+
category: 'Hint',
|
|
101
|
+
http: 403,
|
|
102
|
+
field: 'anfragendeUstid',
|
|
103
|
+
message: 'Die anfragende DE USt-IdNr. ist nicht berechtigt eine DE Ust-IdNr. anzufragen.',
|
|
104
|
+
},
|
|
105
|
+
'evatr-0007': {
|
|
106
|
+
status: 'evatr-0007',
|
|
107
|
+
category: 'Hint',
|
|
108
|
+
http: 403,
|
|
109
|
+
message: 'Fehlerhafter Aufruf.',
|
|
110
|
+
},
|
|
111
|
+
'evatr-0008': {
|
|
112
|
+
status: 'evatr-0008',
|
|
113
|
+
category: 'Hint',
|
|
114
|
+
http: 403,
|
|
115
|
+
message: 'Die maximale Anzahl von qualifizierten Bestätigungsabfragen für diese Session wurde erreicht. Bitte starten Sie erneut mit einer einfachen Bestätigungsabfrage.',
|
|
116
|
+
},
|
|
117
|
+
'evatr-0011': {
|
|
118
|
+
status: 'evatr-0011',
|
|
119
|
+
category: 'Error',
|
|
120
|
+
http: 503,
|
|
121
|
+
message: 'Eine Bearbeitung Ihrer Anfrage ist zurzeit nicht möglich. Bitte versuchen Sie es später noch einmal.',
|
|
122
|
+
},
|
|
123
|
+
'evatr-0012': {
|
|
124
|
+
status: 'evatr-0012',
|
|
125
|
+
category: 'Error',
|
|
126
|
+
http: 400,
|
|
127
|
+
field: 'angefragteUstid',
|
|
128
|
+
message: 'Die angefrage USt-IdNr. ist syntaktisch falsch. Sie passt nicht in das Erzeugungsschema.',
|
|
129
|
+
},
|
|
130
|
+
'evatr-0013': {
|
|
131
|
+
status: 'evatr-0013',
|
|
132
|
+
category: 'Error',
|
|
133
|
+
http: 503,
|
|
134
|
+
message: 'Eine Bearbeitung Ihrer Anfrage ist zurzeit nicht möglich. Bitte versuchen Sie es später noch einmal.',
|
|
135
|
+
},
|
|
136
|
+
'evatr-1001': {
|
|
137
|
+
status: 'evatr-1001',
|
|
138
|
+
category: 'Error',
|
|
139
|
+
http: 503,
|
|
140
|
+
message: 'Eine Bearbeitung Ihrer Anfrage ist zurzeit nicht möglich. Bitte versuchen Sie es später noch einmal.',
|
|
141
|
+
},
|
|
142
|
+
'evatr-1002': {
|
|
143
|
+
status: 'evatr-1002',
|
|
144
|
+
category: 'Error',
|
|
145
|
+
http: 500,
|
|
146
|
+
message: 'Eine Bearbeitung Ihrer Anfrage ist zurzeit nicht möglich. Bitte versuchen Sie es später noch einmal.',
|
|
147
|
+
},
|
|
148
|
+
'evatr-1003': {
|
|
149
|
+
status: 'evatr-1003',
|
|
150
|
+
category: 'Error',
|
|
151
|
+
http: 500,
|
|
152
|
+
message: 'Eine Bearbeitung Ihrer Anfrage ist zurzeit nicht möglich. Bitte versuchen Sie es später noch einmal.',
|
|
153
|
+
},
|
|
154
|
+
'evatr-1004': {
|
|
155
|
+
status: 'evatr-1004',
|
|
156
|
+
category: 'Error',
|
|
157
|
+
http: 500,
|
|
158
|
+
message: 'Eine Bearbeitung Ihrer Anfrage ist zurzeit nicht möglich. Bitte versuchen Sie es später noch einmal.',
|
|
159
|
+
},
|
|
160
|
+
'evatr-2001': {
|
|
161
|
+
status: 'evatr-2001',
|
|
162
|
+
category: 'Hint',
|
|
163
|
+
http: 404,
|
|
164
|
+
field: 'angefragteUstid',
|
|
165
|
+
message: 'Die angefragte USt-IdNr. ist zum Anfragezeitpunkt nicht vergeben.',
|
|
166
|
+
},
|
|
167
|
+
'evatr-2002': {
|
|
168
|
+
status: 'evatr-2002',
|
|
169
|
+
category: 'Hint',
|
|
170
|
+
http: 200,
|
|
171
|
+
field: 'angefragteUstid',
|
|
172
|
+
message: 'Die angefragte USt-IdNr. ist zum Anfragezeitpunkt nicht gültig. Sie ist erst gültig ab dem Datum im Feld gueltigAb.',
|
|
173
|
+
},
|
|
174
|
+
'evatr-2003': {
|
|
175
|
+
status: 'evatr-2003',
|
|
176
|
+
category: 'Error',
|
|
177
|
+
http: 400,
|
|
178
|
+
field: 'angefragteUstid',
|
|
179
|
+
message: 'Das angegebene Länderkennzeichen der angefragten USt-IdNr. ist nicht gültig.',
|
|
180
|
+
},
|
|
181
|
+
'evatr-2004': {
|
|
182
|
+
status: 'evatr-2004',
|
|
183
|
+
category: 'Error',
|
|
184
|
+
http: 500,
|
|
185
|
+
message: 'Eine Bearbeitung Ihrer Anfrage ist zurzeit nicht möglich. Bitte versuchen Sie es später noch einmal.',
|
|
186
|
+
},
|
|
187
|
+
'evatr-2005': {
|
|
188
|
+
status: 'evatr-2005',
|
|
189
|
+
category: 'Error',
|
|
190
|
+
http: 404,
|
|
191
|
+
field: 'anfragendeUstid',
|
|
192
|
+
message: 'Die angegebene eigene DE Ust-IdNr. ist zum Anfragezeitpunkt nicht gültig.',
|
|
193
|
+
},
|
|
194
|
+
'evatr-2006': {
|
|
195
|
+
status: 'evatr-2006',
|
|
196
|
+
category: 'Hint',
|
|
197
|
+
http: 200,
|
|
198
|
+
field: 'angefragteUstid',
|
|
199
|
+
message: 'Die angefragte Ust-IdNr. ist zum Anfragezeitpunkt nicht gültig. Sie war gültig im Zeitraum, der durch die Werte in den Feldern gueltigAb und gueltigBis beschrieben ist.',
|
|
200
|
+
},
|
|
201
|
+
'evatr-2007': {
|
|
202
|
+
status: 'evatr-2007',
|
|
203
|
+
category: 'Error',
|
|
204
|
+
http: 500,
|
|
205
|
+
message: 'Bei der Verarbeitung der Daten aus dem angefragten EU-Mitgliedstaat ist ein Fehler aufgetreten. Ihre Anfrage kann deshalb nicht bearbeitet werden.',
|
|
206
|
+
},
|
|
207
|
+
'evatr-2008': {
|
|
208
|
+
status: 'evatr-2008',
|
|
209
|
+
category: 'Hint',
|
|
210
|
+
http: 200,
|
|
211
|
+
message: 'Die angefragte Ust-IdNr. ist zum Anfragezeitpunkt gültig. Für die qualifizierte Bestätigungsanfrage liegt einer Besonderheit vor. Für Rückfragen wenden Sie sich an das BZSt.',
|
|
212
|
+
},
|
|
213
|
+
'evatr-2011': {
|
|
214
|
+
status: 'evatr-2011',
|
|
215
|
+
category: 'Error',
|
|
216
|
+
http: 500,
|
|
217
|
+
message: 'Eine Bearbeitung Ihrer Anfrage ist zurzeit nicht möglich. Bitte versuchen Sie es später noch einmal.',
|
|
218
|
+
},
|
|
219
|
+
'evatr-3011': {
|
|
220
|
+
status: 'evatr-3011',
|
|
221
|
+
category: 'Error',
|
|
222
|
+
http: 500,
|
|
223
|
+
message: 'Eine Bearbeitung Ihrer Anfrage ist zurzeit nicht möglich. Bitte versuchen Sie es später noch einmal.',
|
|
224
|
+
},
|
|
225
|
+
};
|
|
226
|
+
/**
|
|
227
|
+
* Qualified result codes explanations
|
|
228
|
+
*/
|
|
229
|
+
exports.QUALIFIED_RESULT_CODES = {
|
|
230
|
+
A: 'Die Angaben stimmen mit den registrierten Daten überein.',
|
|
231
|
+
B: 'Die Angaben stimmen mit den registrierten Daten nicht überein.',
|
|
232
|
+
C: 'Die Angaben wurden nicht angefragt.',
|
|
233
|
+
D: 'Die Angaben wurden vom EU-Mitgliedsstaat nicht mitgeteilt.',
|
|
234
|
+
};
|
|
235
|
+
/**
|
|
236
|
+
* Country code to country name mapping for EU member states
|
|
237
|
+
*/
|
|
238
|
+
exports.EU_MEMBER_STATES = {
|
|
239
|
+
'AT': 'Austria',
|
|
240
|
+
'BE': 'Belgium',
|
|
241
|
+
'BG': 'Bulgaria',
|
|
242
|
+
'CY': 'Cyprus',
|
|
243
|
+
'CZ': 'Czech Republic',
|
|
244
|
+
'DE': 'Germany',
|
|
245
|
+
'DK': 'Denmark',
|
|
246
|
+
'EE': 'Estonia',
|
|
247
|
+
'ES': 'Spain',
|
|
248
|
+
'FI': 'Finland',
|
|
249
|
+
'FR': 'France',
|
|
250
|
+
'GR': 'Greece',
|
|
251
|
+
'HR': 'Croatia',
|
|
252
|
+
'HU': 'Hungary',
|
|
253
|
+
'IE': 'Ireland',
|
|
254
|
+
'IT': 'Italy',
|
|
255
|
+
'LT': 'Lithuania',
|
|
256
|
+
'LU': 'Luxembourg',
|
|
257
|
+
'LV': 'Latvia',
|
|
258
|
+
'MT': 'Malta',
|
|
259
|
+
'NL': 'Netherlands',
|
|
260
|
+
'PL': 'Poland',
|
|
261
|
+
'PT': 'Portugal',
|
|
262
|
+
'RO': 'Romania',
|
|
263
|
+
'SE': 'Sweden',
|
|
264
|
+
'SI': 'Slovenia',
|
|
265
|
+
'SK': 'Slovakia',
|
|
266
|
+
'XI': 'Northern Ireland',
|
|
267
|
+
};
|
|
268
|
+
//# sourceMappingURL=constants.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"constants.js","sourceRoot":"","sources":["../src/constants.ts"],"names":[],"mappings":";AAAA;;GAEG;;;AAIH;;GAEG;AACU,QAAA,YAAY,GAAG,gCAAgC,CAAC;AAChD,QAAA,gBAAgB,GAAG,oBAAY,GAAG,SAAS,CAAC;AAEzD;;GAEG;AACU,QAAA,SAAS,GAAG;IACvB,UAAU,EAAE,wBAAgB,GAAG,UAAU;IACzC,eAAe,EAAE,wBAAgB,GAAG,uBAAuB;IAC3D,gBAAgB,EAAE,wBAAgB,GAAG,0BAA0B;CACvD,CAAC;AAEX;;GAEG;AACU,QAAA,cAAc,GAA2B;IACpD,IAAI,EAAE,YAAY,EAAE,iBAAiB;IACrC,IAAI,EAAE,eAAe,EAAE,yBAAyB;IAChD,IAAI,EAAE,cAAc,EAAE,mBAAmB;IACzC,IAAI,EAAE,gBAAgB,EAAE,yBAAyB;IACjD,IAAI,EAAE,cAAc,EAAE,mBAAmB;IACzC,IAAI,EAAE,WAAW,EAAE,gBAAgB;IACnC,IAAI,EAAE,WAAW,EAAE,gBAAgB;IACnC,IAAI,EAAE,WAAW,EAAE,gBAAgB;IACnC,IAAI,EAAE,wBAAwB,EAAE,2CAA2C;IAC3E,IAAI,EAAE,WAAW,EAAE,gBAAgB;IACnC,IAAI,EAAE,sBAAsB,EAAE,0BAA0B;IACxD,IAAI,EAAE,WAAW,EAAE,gBAAgB;IACnC,IAAI,EAAE,YAAY,EAAE,iBAAiB;IACrC,IAAI,EAAE,WAAW,EAAE,gBAAgB;IACnC,IAAI,EAAE,4CAA4C,EAAE,wBAAwB;IAC5E,IAAI,EAAE,YAAY,EAAE,iBAAiB;IACrC,IAAI,EAAE,oBAAoB,EAAE,sBAAsB;IAClD,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
|
3
|
+
*
|
|
4
|
+
* Checks a VAT-ID using the eVatR REST-API of the German Federal Central Tax Office (Bundeszentralamt für Steuern, BZSt)
|
|
5
|
+
*
|
|
6
|
+
* @author Krzysztof Tomasz Zembrowski <open-source@rechtlogisch.de>
|
|
7
|
+
*/
|
|
8
|
+
export { EvatrClient } from './client';
|
|
9
|
+
export type { EvatrApiError, EvatrClientConfig, EUMemberState, QualifiedRequest, SimpleRequest, StatusMessage, } from './types';
|
|
10
|
+
export { STATUS_MESSAGES, QUALIFIED_RESULT_CODES, } from './constants';
|
|
11
|
+
export { EvatrUtils } from './utils';
|
|
12
|
+
export { EvatrApiUpdater } from './api-updater';
|
|
13
|
+
export { StatusMessages } from './status-loader';
|
|
14
|
+
export { EvatrMigrationHelper, } from './migration-helper';
|
|
15
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAGH,OAAO,EAAE,WAAW,EAAE,MAAM,UAAU,CAAC;AAGvC,YAAY,EACV,aAAa,EACb,iBAAiB,EACjB,aAAa,EACb,gBAAgB,EAChB,aAAa,EACb,aAAa,GACd,MAAM,SAAS,CAAC;AAGjB,OAAO,EACL,eAAe,EACf,sBAAsB,GACvB,MAAM,aAAa,CAAC;AAGrB,OAAO,EAAE,UAAU,EAAE,MAAM,SAAS,CAAC;AACrC,OAAO,EAAE,eAAe,EAAE,MAAM,eAAe,CAAC;AAChD,OAAO,EAAE,cAAc,EAAE,MAAM,iBAAiB,CAAC;AAGjD,OAAO,EACL,oBAAoB,GACrB,MAAM,oBAAoB,CAAC"}
|
package/dist/index.js
ADDED
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
/**
|
|
3
|
+
* evatr-api
|
|
4
|
+
*
|
|
5
|
+
* Checks a VAT-ID using the eVatR REST-API of the German Federal Central Tax Office (Bundeszentralamt für Steuern, BZSt)
|
|
6
|
+
*
|
|
7
|
+
* @author Krzysztof Tomasz Zembrowski <open-source@rechtlogisch.de>
|
|
8
|
+
*/
|
|
9
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
10
|
+
exports.EvatrMigrationHelper = exports.StatusMessages = exports.EvatrApiUpdater = exports.EvatrUtils = exports.QUALIFIED_RESULT_CODES = exports.STATUS_MESSAGES = exports.EvatrClient = void 0;
|
|
11
|
+
// Export main client
|
|
12
|
+
var client_1 = require("./client");
|
|
13
|
+
Object.defineProperty(exports, "EvatrClient", { enumerable: true, get: function () { return client_1.EvatrClient; } });
|
|
14
|
+
// Export constants
|
|
15
|
+
var constants_1 = require("./constants");
|
|
16
|
+
Object.defineProperty(exports, "STATUS_MESSAGES", { enumerable: true, get: function () { return constants_1.STATUS_MESSAGES; } });
|
|
17
|
+
Object.defineProperty(exports, "QUALIFIED_RESULT_CODES", { enumerable: true, get: function () { return constants_1.QUALIFIED_RESULT_CODES; } });
|
|
18
|
+
// Export utilities
|
|
19
|
+
var utils_1 = require("./utils");
|
|
20
|
+
Object.defineProperty(exports, "EvatrUtils", { enumerable: true, get: function () { return utils_1.EvatrUtils; } });
|
|
21
|
+
var api_updater_1 = require("./api-updater");
|
|
22
|
+
Object.defineProperty(exports, "EvatrApiUpdater", { enumerable: true, get: function () { return api_updater_1.EvatrApiUpdater; } });
|
|
23
|
+
var status_loader_1 = require("./status-loader");
|
|
24
|
+
Object.defineProperty(exports, "StatusMessages", { enumerable: true, get: function () { return status_loader_1.StatusMessages; } });
|
|
25
|
+
// Export migration helper for backward compatibility
|
|
26
|
+
var migration_helper_1 = require("./migration-helper");
|
|
27
|
+
Object.defineProperty(exports, "EvatrMigrationHelper", { enumerable: true, get: function () { return migration_helper_1.EvatrMigrationHelper; } });
|
|
28
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";AAAA;;;;;;GAMG;;;AAEH,qBAAqB;AACrB,mCAAuC;AAA9B,qGAAA,WAAW,OAAA;AAYpB,mBAAmB;AACnB,yCAGqB;AAFnB,4GAAA,eAAe,OAAA;AACf,mHAAA,sBAAsB,OAAA;AAGxB,mBAAmB;AACnB,iCAAqC;AAA5B,mGAAA,UAAU,OAAA;AACnB,6CAAgD;AAAvC,8GAAA,eAAe,OAAA;AACxB,iDAAiD;AAAxC,+GAAA,cAAc,OAAA;AAEvB,qDAAqD;AACrD,uDAE4B;AAD1B,wHAAA,oBAAoB,OAAA"}
|