@taxora/sdk 1.1.0 → 1.3.0
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/CHANGELOG.md +22 -0
- package/README.md +282 -1
- package/dist/index.cjs +1243 -190
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +684 -29
- package/dist/index.d.ts +684 -29
- package/dist/index.js +1216 -189
- package/dist/index.js.map +1 -1
- package/package.json +2 -1
package/dist/index.d.cts
CHANGED
|
@@ -22,6 +22,75 @@ interface HttpClientInterface {
|
|
|
22
22
|
request(method: string, url: string, options?: RequestInit): Promise<Response>;
|
|
23
23
|
}
|
|
24
24
|
|
|
25
|
+
/**
|
|
26
|
+
* How the SDK retries transient failures.
|
|
27
|
+
*
|
|
28
|
+
* Only gateway-level failures are retried by default (502/503/504): those come
|
|
29
|
+
* from the infrastructure in front of the API, not from the API itself, and a
|
|
30
|
+
* second attempt a moment later usually succeeds. Everything else — 4xx, and any
|
|
31
|
+
* answer the API produced itself — is surfaced immediately.
|
|
32
|
+
*
|
|
33
|
+
* On top of that, a 429 is retried when the API answers with a `Retry-After`
|
|
34
|
+
* telling us how long to wait, and connection-level failures (reset connection,
|
|
35
|
+
* client-side timeout, DNS hiccup) are retried as well — those never reached the
|
|
36
|
+
* API's answer either.
|
|
37
|
+
*
|
|
38
|
+
* Retries are opt-in per operation and are only applied to read-only calls
|
|
39
|
+
* (lookups, downloads, polling). Calls that change state or cost quota — booking
|
|
40
|
+
* a transaction, starting an enrichment job, triggering a certificate export —
|
|
41
|
+
* are never retried automatically, because a gateway timeout does not tell us
|
|
42
|
+
* whether the API already processed the request.
|
|
43
|
+
*/
|
|
44
|
+
interface RetryPolicyOptions {
|
|
45
|
+
/** Total attempts including the first one (1 disables retrying). */
|
|
46
|
+
maxAttempts?: number;
|
|
47
|
+
initialDelayMs?: number;
|
|
48
|
+
backoffMultiplier?: number;
|
|
49
|
+
maxDelayMs?: number;
|
|
50
|
+
retryableStatusCodes?: number[];
|
|
51
|
+
/** Honour a `Retry-After` header instead of the backoff, and retry a 429 that carries one. */
|
|
52
|
+
respectRetryAfter?: boolean;
|
|
53
|
+
/** Longest wait accepted from `Retry-After`; a longer one means we give up instead of blocking. */
|
|
54
|
+
maxRetryAfterMs?: number;
|
|
55
|
+
/** Retry connection-level failures (reset connection, client-side timeout, DNS hiccup). */
|
|
56
|
+
retryOnNetworkErrors?: boolean;
|
|
57
|
+
/** Receives the delay in milliseconds; defaults to setTimeout. */
|
|
58
|
+
sleeper?: (delayMs: number) => Promise<void> | void;
|
|
59
|
+
}
|
|
60
|
+
declare class RetryPolicy {
|
|
61
|
+
readonly maxAttempts: number;
|
|
62
|
+
readonly initialDelayMs: number;
|
|
63
|
+
readonly backoffMultiplier: number;
|
|
64
|
+
readonly maxDelayMs: number;
|
|
65
|
+
readonly retryableStatusCodes: number[];
|
|
66
|
+
readonly respectRetryAfter: boolean;
|
|
67
|
+
readonly maxRetryAfterMs: number;
|
|
68
|
+
readonly retryOnNetworkErrors: boolean;
|
|
69
|
+
private readonly sleeper;
|
|
70
|
+
constructor(options?: RetryPolicyOptions);
|
|
71
|
+
/** No retrying at all — every failure is surfaced on the first attempt. */
|
|
72
|
+
static disabled(): RetryPolicy;
|
|
73
|
+
/** Retry immediately, without waiting (mainly useful in tests). */
|
|
74
|
+
static withoutDelay(maxAttempts?: number): RetryPolicy;
|
|
75
|
+
isRetryable(statusCode: number, retryAfterHeader?: string | null): boolean;
|
|
76
|
+
/** @param attempt Number of attempts made so far (1 = the first one just failed). */
|
|
77
|
+
shouldRetry(statusCode: number, attempt: number, retryAfterHeader?: string | null): boolean;
|
|
78
|
+
/**
|
|
79
|
+
* A connection-level failure: the request never got an answer, so repeating it
|
|
80
|
+
* is as safe as repeating a gateway timeout.
|
|
81
|
+
*/
|
|
82
|
+
isRetryableError(error: unknown): boolean;
|
|
83
|
+
shouldRetryError(error: unknown, attempt: number): boolean;
|
|
84
|
+
/**
|
|
85
|
+
* The wait the API asked for, in milliseconds — seconds or HTTP-date form — or
|
|
86
|
+
* null when there is none, it cannot be parsed, or the header is ignored.
|
|
87
|
+
*/
|
|
88
|
+
retryAfterMs(header: string | null | undefined, now?: Date): number | null;
|
|
89
|
+
/** The wait before the next attempt: what the API asked for, else exponential backoff. */
|
|
90
|
+
delayMsForAttempt(attempt: number, retryAfterHeader?: string | null): number;
|
|
91
|
+
sleepBeforeRetry(attempt: number, retryAfterHeader?: string | null): Promise<void>;
|
|
92
|
+
}
|
|
93
|
+
|
|
25
94
|
interface TokenStorageInterface {
|
|
26
95
|
get(): Token | null;
|
|
27
96
|
set(token: Token): void;
|
|
@@ -33,7 +102,8 @@ declare class AuthEndpoint {
|
|
|
33
102
|
private readonly apiKey;
|
|
34
103
|
private readonly tokenStorage;
|
|
35
104
|
private readonly httpClient;
|
|
36
|
-
|
|
105
|
+
private readonly retryPolicy;
|
|
106
|
+
constructor(baseUrl: string, apiKey: string, tokenStorage: TokenStorageInterface, httpClient: HttpClientInterface, retryPolicy?: RetryPolicy);
|
|
37
107
|
login(identifier: string, password: string, device?: string, loginIdentifier?: LoginIdentifier): Promise<Token>;
|
|
38
108
|
loginWithClientId(clientId: string, password: string, device?: string): Promise<Token>;
|
|
39
109
|
refresh(): Promise<Token>;
|
|
@@ -69,7 +139,8 @@ declare class CompanyEndpoint {
|
|
|
69
139
|
private readonly apiKey;
|
|
70
140
|
private readonly tokenStorage;
|
|
71
141
|
private readonly httpClient;
|
|
72
|
-
|
|
142
|
+
private readonly retryPolicy;
|
|
143
|
+
constructor(baseUrl: string, apiKey: string, tokenStorage: TokenStorageInterface, httpClient: HttpClientInterface, retryPolicy?: RetryPolicy);
|
|
73
144
|
get(): Promise<CompanyResource>;
|
|
74
145
|
}
|
|
75
146
|
|
|
@@ -89,8 +160,24 @@ declare function toComplianceEnrollmentStatus(value: unknown): ComplianceEnrollm
|
|
|
89
160
|
declare function describeComplianceEnrollmentStatus(status: ComplianceEnrollmentStatus): string;
|
|
90
161
|
|
|
91
162
|
/**
|
|
92
|
-
*
|
|
93
|
-
*
|
|
163
|
+
* The compliance service an enrollment books for its country: French DGFiP
|
|
164
|
+
* e-reporting, or e-invoicing (e.g. Norway EHF / Peppol BIS 3.0). Each country
|
|
165
|
+
* and service is unlocked and billed separately.
|
|
166
|
+
*/
|
|
167
|
+
declare const ComplianceService: {
|
|
168
|
+
readonly E_REPORTING: "e_reporting";
|
|
169
|
+
readonly E_INVOICING: "e_invoicing";
|
|
170
|
+
readonly UNKNOWN: "unknown";
|
|
171
|
+
};
|
|
172
|
+
type ComplianceService = (typeof ComplianceService)[keyof typeof ComplianceService];
|
|
173
|
+
/** Tolerant coercion: unrecognized values become `unknown` instead of throwing. */
|
|
174
|
+
declare function toComplianceService(value: unknown): ComplianceService;
|
|
175
|
+
declare function describeComplianceService(service: ComplianceService): string;
|
|
176
|
+
|
|
177
|
+
/**
|
|
178
|
+
* A compliance enrollment — the merchant's provisioned account for one country
|
|
179
|
+
* and service (GET/POST /compliance/enrollments), e.g. France e-reporting
|
|
180
|
+
* (regime "dgfip_flux10") or Norway e-invoicing (regime "peppol_bis3").
|
|
94
181
|
*/
|
|
95
182
|
declare class ComplianceEnrollment {
|
|
96
183
|
readonly id: number;
|
|
@@ -112,9 +199,13 @@ declare class ComplianceEnrollment {
|
|
|
112
199
|
readonly autoSend: boolean;
|
|
113
200
|
readonly createdAt: string | null;
|
|
114
201
|
readonly updatedAt: string | null;
|
|
202
|
+
/** Booked service ("e_reporting" / "e_invoicing"); `unknown` when an older server omits it. */
|
|
203
|
+
readonly service: ComplianceService;
|
|
115
204
|
constructor(id: number, companyId: number, country: string, regime: string, provider: string, status: ComplianceEnrollmentStatus, statusLabel: string, statusError: string | null, providerAccountId: string | null, taxId: string | null, companyRegisterId: string | null, companyRegisterScheme: string | null, regimeConfig: Record<string, unknown> | null,
|
|
116
205
|
/** First date transactions are reported for (YYYY-MM-DD). */
|
|
117
|
-
reportingStartDate: string | null, notificationEmail: string | null, autoSend: boolean, createdAt: string | null, updatedAt: string | null
|
|
206
|
+
reportingStartDate: string | null, notificationEmail: string | null, autoSend: boolean, createdAt: string | null, updatedAt: string | null,
|
|
207
|
+
/** Booked service ("e_reporting" / "e_invoicing"); `unknown` when an older server omits it. */
|
|
208
|
+
service?: ComplianceService);
|
|
118
209
|
static fromArray(data: Record<string, unknown>): ComplianceEnrollment;
|
|
119
210
|
}
|
|
120
211
|
|
|
@@ -193,6 +284,17 @@ declare class ComplianceTaxReportPage implements Iterable<ComplianceTaxReport> {
|
|
|
193
284
|
get length(): number;
|
|
194
285
|
}
|
|
195
286
|
|
|
287
|
+
/** Kind of document a compliance transaction represents. */
|
|
288
|
+
declare const ComplianceDocumentType: {
|
|
289
|
+
readonly INVOICE: "invoice";
|
|
290
|
+
readonly CREDIT_NOTE: "credit_note";
|
|
291
|
+
readonly UNKNOWN: "unknown";
|
|
292
|
+
};
|
|
293
|
+
type ComplianceDocumentType = (typeof ComplianceDocumentType)[keyof typeof ComplianceDocumentType];
|
|
294
|
+
/** Tolerant coercion: unrecognized values become `unknown` instead of throwing. */
|
|
295
|
+
declare function toComplianceDocumentType(value: unknown): ComplianceDocumentType;
|
|
296
|
+
declare function describeComplianceDocumentType(type: ComplianceDocumentType): string;
|
|
297
|
+
|
|
196
298
|
declare const ComplianceTransactionState: {
|
|
197
299
|
readonly PENDING: "pending";
|
|
198
300
|
readonly SENDING: "sending";
|
|
@@ -218,8 +320,30 @@ type ComplianceTransactionType = (typeof ComplianceTransactionType)[keyof typeof
|
|
|
218
320
|
declare function toComplianceTransactionType(value: unknown): ComplianceTransactionType;
|
|
219
321
|
declare function describeComplianceTransactionType(type: ComplianceTransactionType): string;
|
|
220
322
|
|
|
323
|
+
/** One tax of a stored invoice line (provider shape, as recorded at creation/update). */
|
|
324
|
+
interface ComplianceTransactionInvoiceLineTax {
|
|
325
|
+
name: string;
|
|
326
|
+
percent: number | null;
|
|
327
|
+
category: string | null;
|
|
328
|
+
/** VATEX exemption code for category "E". */
|
|
329
|
+
comment: string | null;
|
|
330
|
+
}
|
|
331
|
+
/** One stored invoice line (`provider_payload.invoice.invoice_lines_attributes`). */
|
|
332
|
+
interface ComplianceTransactionInvoiceLine {
|
|
333
|
+
description: string;
|
|
334
|
+
quantity: number | null;
|
|
335
|
+
/** Unit price as a precision-safe decimal string. */
|
|
336
|
+
price: string;
|
|
337
|
+
/** UN/ECE unit code, e.g. 9 (each). */
|
|
338
|
+
unit: number | null;
|
|
339
|
+
taxes: ComplianceTransactionInvoiceLineTax[];
|
|
340
|
+
}
|
|
221
341
|
/**
|
|
222
|
-
* A recorded
|
|
342
|
+
* A recorded compliance transaction (GET/POST /compliance/transactions) — an
|
|
343
|
+
* e-reported transaction (France) or an e-invoice / credit note (Norway).
|
|
344
|
+
*
|
|
345
|
+
* The e-invoicing fields at the end of the constructor are optional so DTOs
|
|
346
|
+
* built from older servers (or by hand) stay valid.
|
|
223
347
|
*/
|
|
224
348
|
declare class ComplianceTransaction {
|
|
225
349
|
readonly id: number;
|
|
@@ -251,11 +375,49 @@ declare class ComplianceTransaction {
|
|
|
251
375
|
readonly taxReport: ComplianceTaxReport | undefined;
|
|
252
376
|
readonly createdAt: string | null;
|
|
253
377
|
readonly updatedAt: string | null;
|
|
378
|
+
/** Buyer's company register id (Norway: 9-digit organisation number). */
|
|
379
|
+
readonly counterpartyRegisterId: string | null;
|
|
380
|
+
readonly counterpartyAddress: string | null;
|
|
381
|
+
readonly counterpartyCity: string | null;
|
|
382
|
+
readonly counterpartyPostalcode: string | null;
|
|
383
|
+
readonly counterpartyEmail: string | null;
|
|
384
|
+
readonly buyerReference: string | null;
|
|
385
|
+
/** "invoice" or "credit_note" (older servers without the field → "invoice"). */
|
|
386
|
+
readonly documentType: ComplianceDocumentType;
|
|
387
|
+
/** Number of the invoice a credit note corrects. */
|
|
388
|
+
readonly amendedNumber: string | null;
|
|
389
|
+
/** Date of the invoice a credit note corrects (YYYY-MM-DD). */
|
|
390
|
+
readonly amendedDate: string | null;
|
|
391
|
+
/**
|
|
392
|
+
* Latest provider-side delivery state (e.g. "sent", "accepted", "refused",
|
|
393
|
+
* "paid") — richer than `state` for e-invoicing, where delivery continues
|
|
394
|
+
* after submission. Free-form string; null until the provider reports one.
|
|
395
|
+
*/
|
|
396
|
+
readonly providerState: string | null;
|
|
397
|
+
/** The stored invoice lines (empty when the server does not include them). */
|
|
398
|
+
readonly invoiceLines: ComplianceTransactionInvoiceLine[];
|
|
254
399
|
constructor(id: number, companyId: number, complianceEnrollmentId: number, country: string, regime: string, transactionType: ComplianceTransactionType, transactionTypeLabel: string, state: ComplianceTransactionState, stateLabel: string, invoiceNumber: string,
|
|
255
400
|
/** Invoice date (YYYY-MM-DD). */
|
|
256
401
|
invoiceDate: string | null, dueDate: string | null, currency: string, subtotal: string, taxAmount: string, total: string, counterpartyName: string | null, counterpartyCountry: string | null, counterpartyVatNumber: string | null, isPaid: boolean, paidAt: string | null, providerInvoiceId: string | null, submissionError: string | null, reportedAt: string | null,
|
|
257
402
|
/** Associated DGFiP tax report; undefined when the API did not include it. */
|
|
258
|
-
taxReport: ComplianceTaxReport | undefined, createdAt: string | null, updatedAt: string | null
|
|
403
|
+
taxReport: ComplianceTaxReport | undefined, createdAt: string | null, updatedAt: string | null,
|
|
404
|
+
/** Buyer's company register id (Norway: 9-digit organisation number). */
|
|
405
|
+
counterpartyRegisterId?: string | null, counterpartyAddress?: string | null, counterpartyCity?: string | null, counterpartyPostalcode?: string | null, counterpartyEmail?: string | null, buyerReference?: string | null,
|
|
406
|
+
/** "invoice" or "credit_note" (older servers without the field → "invoice"). */
|
|
407
|
+
documentType?: ComplianceDocumentType,
|
|
408
|
+
/** Number of the invoice a credit note corrects. */
|
|
409
|
+
amendedNumber?: string | null,
|
|
410
|
+
/** Date of the invoice a credit note corrects (YYYY-MM-DD). */
|
|
411
|
+
amendedDate?: string | null,
|
|
412
|
+
/**
|
|
413
|
+
* Latest provider-side delivery state (e.g. "sent", "accepted", "refused",
|
|
414
|
+
* "paid") — richer than `state` for e-invoicing, where delivery continues
|
|
415
|
+
* after submission. Free-form string; null until the provider reports one.
|
|
416
|
+
*/
|
|
417
|
+
providerState?: string | null,
|
|
418
|
+
/** The stored invoice lines (empty when the server does not include them). */
|
|
419
|
+
invoiceLines?: ComplianceTransactionInvoiceLine[]);
|
|
420
|
+
get isCreditNote(): boolean;
|
|
259
421
|
static fromArray(data: Record<string, unknown>): ComplianceTransaction;
|
|
260
422
|
}
|
|
261
423
|
|
|
@@ -294,6 +456,93 @@ declare class ImportResult {
|
|
|
294
456
|
static fromArray(data: Record<string, unknown>): ImportResult;
|
|
295
457
|
}
|
|
296
458
|
|
|
459
|
+
/**
|
|
460
|
+
* Outcome of a Peppol directory lookup (GET /compliance/peppol-lookup). The
|
|
461
|
+
* directory resolves asynchronously — `pending` means ask again in a few seconds.
|
|
462
|
+
*/
|
|
463
|
+
declare const PeppolLookupStatus: {
|
|
464
|
+
readonly REACHABLE: "reachable";
|
|
465
|
+
readonly NOT_REACHABLE: "not_reachable";
|
|
466
|
+
readonly PENDING: "pending";
|
|
467
|
+
readonly UNKNOWN: "unknown";
|
|
468
|
+
};
|
|
469
|
+
type PeppolLookupStatus = (typeof PeppolLookupStatus)[keyof typeof PeppolLookupStatus];
|
|
470
|
+
/** Tolerant coercion: unrecognized values become `unknown` instead of throwing. */
|
|
471
|
+
declare function toPeppolLookupStatus(value: unknown): PeppolLookupStatus;
|
|
472
|
+
declare function describePeppolLookupStatus(status: PeppolLookupStatus): string;
|
|
473
|
+
|
|
474
|
+
/**
|
|
475
|
+
* Whether a participant can receive e-invoices over Peppol
|
|
476
|
+
* (GET /compliance/peppol-lookup). For Norway, `reachable === true` means the
|
|
477
|
+
* buyer is registered in ELMA and must receive an EHF e-invoice.
|
|
478
|
+
*/
|
|
479
|
+
declare class PeppolLookupResult {
|
|
480
|
+
readonly status: PeppolLookupStatus;
|
|
481
|
+
/** null while the lookup is still `pending`. */
|
|
482
|
+
readonly reachable: boolean | null;
|
|
483
|
+
readonly country: string;
|
|
484
|
+
/** Peppol identifier scheme, e.g. "0192" for Norwegian organisation numbers. */
|
|
485
|
+
readonly scheme: string;
|
|
486
|
+
/** Participant identifier, e.g. the organisation number. */
|
|
487
|
+
readonly id: string;
|
|
488
|
+
/** Peppol document types the participant accepts, e.g. "xml.ubl.invoice.bis3". */
|
|
489
|
+
readonly documentTypes: string[];
|
|
490
|
+
readonly transportTypeCode: string | null;
|
|
491
|
+
readonly checkedAt: string | null;
|
|
492
|
+
constructor(status: PeppolLookupStatus,
|
|
493
|
+
/** null while the lookup is still `pending`. */
|
|
494
|
+
reachable: boolean | null, country: string,
|
|
495
|
+
/** Peppol identifier scheme, e.g. "0192" for Norwegian organisation numbers. */
|
|
496
|
+
scheme: string,
|
|
497
|
+
/** Participant identifier, e.g. the organisation number. */
|
|
498
|
+
id: string,
|
|
499
|
+
/** Peppol document types the participant accepts, e.g. "xml.ubl.invoice.bis3". */
|
|
500
|
+
documentTypes: string[], transportTypeCode: string | null, checkedAt: string | null);
|
|
501
|
+
/** True while the directory is still resolving — ask again in a few seconds. */
|
|
502
|
+
get isPending(): boolean;
|
|
503
|
+
static fromArray(data: Record<string, unknown>): PeppolLookupResult;
|
|
504
|
+
}
|
|
505
|
+
|
|
506
|
+
/**
|
|
507
|
+
* A company from a national company register (GET /compliance/registry-lookup) —
|
|
508
|
+
* for Norway the Brønnøysund Enhetsregisteret. Maps onto the Norway enrollment
|
|
509
|
+
* input and the buyer fields of a Norwegian e-invoice.
|
|
510
|
+
*/
|
|
511
|
+
declare class RegistryCompany {
|
|
512
|
+
/** 9-digit Norwegian organisation number. */
|
|
513
|
+
readonly orgNumber: string;
|
|
514
|
+
readonly companyName: string;
|
|
515
|
+
/** Legal form, e.g. "AS" or "ASA". */
|
|
516
|
+
readonly organisationForm: string | null;
|
|
517
|
+
/** Registered for VAT (Merverdiavgiftsregisteret). */
|
|
518
|
+
readonly vatRegistered: boolean;
|
|
519
|
+
/** "NO…MVA" VAT number; null when not VAT-registered. */
|
|
520
|
+
readonly vatNumber: string | null;
|
|
521
|
+
/** Registered in Foretaksregisteret (adds "Foretaksregisteret" to invoices). */
|
|
522
|
+
readonly enterpriseRegister: boolean;
|
|
523
|
+
readonly bankrupt: boolean;
|
|
524
|
+
readonly underLiquidation: boolean;
|
|
525
|
+
readonly address: string | null;
|
|
526
|
+
readonly postalcode: string | null;
|
|
527
|
+
readonly city: string | null;
|
|
528
|
+
/** 2-char ISO 3166-1 alpha-2 code, e.g. "NO". */
|
|
529
|
+
readonly country: string;
|
|
530
|
+
constructor(
|
|
531
|
+
/** 9-digit Norwegian organisation number. */
|
|
532
|
+
orgNumber: string, companyName: string,
|
|
533
|
+
/** Legal form, e.g. "AS" or "ASA". */
|
|
534
|
+
organisationForm: string | null,
|
|
535
|
+
/** Registered for VAT (Merverdiavgiftsregisteret). */
|
|
536
|
+
vatRegistered: boolean,
|
|
537
|
+
/** "NO…MVA" VAT number; null when not VAT-registered. */
|
|
538
|
+
vatNumber: string | null,
|
|
539
|
+
/** Registered in Foretaksregisteret (adds "Foretaksregisteret" to invoices). */
|
|
540
|
+
enterpriseRegister: boolean, bankrupt: boolean, underLiquidation: boolean, address: string | null, postalcode: string | null, city: string | null,
|
|
541
|
+
/** 2-char ISO 3166-1 alpha-2 code, e.g. "NO". */
|
|
542
|
+
country: string);
|
|
543
|
+
static fromArray(data: Record<string, unknown>): RegistryCompany;
|
|
544
|
+
}
|
|
545
|
+
|
|
297
546
|
/**
|
|
298
547
|
* DTOs for the e-reporting revenue statistics endpoint
|
|
299
548
|
* (GET /compliance/revenue-statistics).
|
|
@@ -410,6 +659,8 @@ type EReportingInterval = 'day' | 'week' | 'month';
|
|
|
410
659
|
type ComplianceEnterpriseSize = 'micro' | 'pme' | 'eti' | 'ge';
|
|
411
660
|
/** Type of operations the enrolled company performs. */
|
|
412
661
|
type ComplianceTypeOperation = 'services' | 'goods' | 'mixed';
|
|
662
|
+
/** Services accepted on the request side (the tolerant `unknown` is response-only). */
|
|
663
|
+
type ComplianceRequestService = Exclude<ComplianceService, 'unknown'>;
|
|
413
664
|
/** Transaction types accepted on the request side (the tolerant `unknown` is response-only). */
|
|
414
665
|
type ComplianceTransactionRequestType = Exclude<ComplianceTransactionType, 'unknown'>;
|
|
415
666
|
/** Transaction states accepted as filters (the tolerant `unknown` is response-only). */
|
|
@@ -424,9 +675,15 @@ interface RevenueStatisticsFilters {
|
|
|
424
675
|
transactionType?: ComplianceTransactionRequestType;
|
|
425
676
|
state?: ComplianceTransactionRequestState;
|
|
426
677
|
}
|
|
678
|
+
/**
|
|
679
|
+
* France (DGFiP e-reporting) enrollment — the original createEnrollment() input.
|
|
680
|
+
* For Norway use {@link CreateNorwayEnrollmentInput} (or createNorwayEnrollment()).
|
|
681
|
+
*/
|
|
427
682
|
interface CreateComplianceEnrollmentInput {
|
|
428
|
-
/** Reporting country (2-char ISO 3166-1 alpha-2). Defaults server-side (FR). */
|
|
683
|
+
/** Reporting country (2-char ISO 3166-1 alpha-2). Defaults server-side (FR). "NO" selects the Norway input. */
|
|
429
684
|
country?: string;
|
|
685
|
+
/** Service to book. Defaults server-side to the country's default service (FR: "e_reporting"). */
|
|
686
|
+
service?: ComplianceRequestService;
|
|
430
687
|
/** Compliance regime, e.g. "dgfip_flux10". Defaults server-side. */
|
|
431
688
|
regime?: string;
|
|
432
689
|
/** 14-digit SIRET. Required unless `siren` is set. */
|
|
@@ -450,6 +707,45 @@ interface CreateComplianceEnrollmentInput {
|
|
|
450
707
|
/** When false, only the provider account is created — the DGFiP regime is NOT activated. Defaults to true server-side. */
|
|
451
708
|
autoActivate?: boolean;
|
|
452
709
|
}
|
|
710
|
+
/**
|
|
711
|
+
* Norway e-invoicing (EHF / Peppol BIS 3.0) enrollment: registers the company
|
|
712
|
+
* as a Peppol participant so it can send (and optionally receive) e-invoices.
|
|
713
|
+
* Prefill it from registryLookup('NO', …).
|
|
714
|
+
*/
|
|
715
|
+
interface CreateNorwayEnrollmentInput {
|
|
716
|
+
country: 'NO';
|
|
717
|
+
/** Service to book. Defaults server-side to "e_invoicing" (the only service for NO). */
|
|
718
|
+
service?: ComplianceRequestService;
|
|
719
|
+
/** Compliance regime. Defaults server-side ("peppol_bis3"). */
|
|
720
|
+
regime?: string;
|
|
721
|
+
/**
|
|
722
|
+
* 9-digit Norwegian organisation number (mod-11 check digit). Spaces, a "NO"
|
|
723
|
+
* prefix and an "MVA" suffix are accepted and stripped before sending.
|
|
724
|
+
*/
|
|
725
|
+
orgNumber: string;
|
|
726
|
+
companyName: string;
|
|
727
|
+
address: string;
|
|
728
|
+
city: string;
|
|
729
|
+
postalcode: string;
|
|
730
|
+
/** Notification email for the provider account. */
|
|
731
|
+
email: string;
|
|
732
|
+
vatNumber?: string;
|
|
733
|
+
province?: string;
|
|
734
|
+
/** Registered in Merverdiavgiftsregisteret (adds "MVA" to invoices). Defaults to true server-side. */
|
|
735
|
+
vatRegistered?: boolean;
|
|
736
|
+
/** Registered in Foretaksregisteret (adds "Foretaksregisteret" to invoices). Defaults to false server-side. */
|
|
737
|
+
enterpriseRegister?: boolean;
|
|
738
|
+
/** Also register to RECEIVE e-invoices over Peppol. Defaults to false server-side. */
|
|
739
|
+
reception?: boolean;
|
|
740
|
+
/** Country of the legal entity when it differs from NO (2-char ISO 3166-1 alpha-2). */
|
|
741
|
+
legalCountry?: string;
|
|
742
|
+
/** Optional first date transactions are recorded for (Date or strict YYYY-MM-DD). */
|
|
743
|
+
reportingStartDate?: Date | string;
|
|
744
|
+
/** When false, only the provider account is created — the Peppol registration is NOT activated. Defaults to true server-side. */
|
|
745
|
+
autoActivate?: boolean;
|
|
746
|
+
}
|
|
747
|
+
/** createNorwayEnrollment() input — the Norway input without the fixed `country`. */
|
|
748
|
+
type NorwayEnrollmentInput = Omit<CreateNorwayEnrollmentInput, 'country'>;
|
|
453
749
|
interface ComplianceInvoiceTaxInput {
|
|
454
750
|
/** Tax designation, e.g. "TVA". */
|
|
455
751
|
name: string;
|
|
@@ -469,7 +765,34 @@ interface ComplianceInvoiceLineInput {
|
|
|
469
765
|
/** At least one tax per line. */
|
|
470
766
|
taxes: ComplianceInvoiceTaxInput[];
|
|
471
767
|
}
|
|
472
|
-
|
|
768
|
+
/**
|
|
769
|
+
* Buyer and document fields interpreted per country. For Norway (EHF / Peppol)
|
|
770
|
+
* `counterpartyRegisterId` (the buyer's organisation number) and
|
|
771
|
+
* `counterpartyName` are required unless `providerContactId` is set, the
|
|
772
|
+
* transaction type must be "b2b_domestic_outbound", and a credit note needs
|
|
773
|
+
* `amendedNumber`. The SDK does not know the enrollment's country — those rules
|
|
774
|
+
* are enforced server-side (422).
|
|
775
|
+
*/
|
|
776
|
+
interface ComplianceTransactionBuyerInput {
|
|
777
|
+
/** Buyer's company register id (Norway: 9-digit organisation number; "NO…MVA" is accepted). Max 30 chars. */
|
|
778
|
+
counterpartyRegisterId?: string;
|
|
779
|
+
counterpartyAddress?: string;
|
|
780
|
+
counterpartyCity?: string;
|
|
781
|
+
counterpartyPostalcode?: string;
|
|
782
|
+
/** Buyer's email address. */
|
|
783
|
+
counterpartyEmail?: string;
|
|
784
|
+
/** Buyer reference (Peppol BuyerReference); max 100 chars. Norway defaults it to the buyer's org number. */
|
|
785
|
+
buyerReference?: string;
|
|
786
|
+
/** Issue the document as a credit note. */
|
|
787
|
+
isCreditNote?: boolean;
|
|
788
|
+
/** Number of the invoice a credit note corrects (max 50 chars). */
|
|
789
|
+
amendedNumber?: string;
|
|
790
|
+
/** Date of the invoice a credit note corrects (Date or strict YYYY-MM-DD). */
|
|
791
|
+
amendedDate?: Date | string;
|
|
792
|
+
/** Free-text note printed on the invoice (max 1000 chars). */
|
|
793
|
+
extraInfo?: string;
|
|
794
|
+
}
|
|
795
|
+
interface CreateComplianceTransactionInput extends ComplianceTransactionBuyerInput {
|
|
473
796
|
complianceEnrollmentId: number;
|
|
474
797
|
transactionType: ComplianceTransactionRequestType;
|
|
475
798
|
invoiceNumber: string;
|
|
@@ -496,7 +819,7 @@ interface CreateComplianceTransactionInput {
|
|
|
496
819
|
/** When false, the transaction is only recorded — submission is deferred. Defaults to true server-side. */
|
|
497
820
|
submitNow?: boolean;
|
|
498
821
|
}
|
|
499
|
-
interface UpdateComplianceTransactionInput {
|
|
822
|
+
interface UpdateComplianceTransactionInput extends ComplianceTransactionBuyerInput {
|
|
500
823
|
transactionType?: ComplianceTransactionRequestType;
|
|
501
824
|
invoiceNumber?: string;
|
|
502
825
|
invoiceDate?: Date | string;
|
|
@@ -525,6 +848,10 @@ interface ComplianceTransactionFilters {
|
|
|
525
848
|
dateTo?: Date | string;
|
|
526
849
|
state?: ComplianceTransactionRequestState;
|
|
527
850
|
transactionType?: ComplianceTransactionRequestType;
|
|
851
|
+
/** Only transactions of this enrollment. */
|
|
852
|
+
complianceEnrollmentId?: number;
|
|
853
|
+
/** Only transactions of this country (2-char ISO 3166-1 alpha-2). */
|
|
854
|
+
country?: string;
|
|
528
855
|
page?: number;
|
|
529
856
|
/** Page size (1-100, default 25 server-side). */
|
|
530
857
|
perPage?: number;
|
|
@@ -537,33 +864,57 @@ interface EReportingAccessRequestInput {
|
|
|
537
864
|
message?: string;
|
|
538
865
|
/** Locale for the confirmation mail, e.g. "de" or "en". */
|
|
539
866
|
language?: string;
|
|
867
|
+
/** The service being requested. Defaults server-side to "e_reporting". */
|
|
868
|
+
service?: ComplianceRequestService;
|
|
869
|
+
/** The countries the service is requested for (2-char ISO codes), e.g. ["NO"]. */
|
|
870
|
+
countries?: string[];
|
|
540
871
|
}
|
|
541
872
|
/**
|
|
542
|
-
* E-Reporting / Compliance (
|
|
873
|
+
* E-Reporting / Compliance endpoints (per-country services).
|
|
543
874
|
*
|
|
544
|
-
*
|
|
545
|
-
* provision the provider account, then
|
|
546
|
-
*
|
|
875
|
+
* - France — e-reporting (DGFiP Flux 10): sireneLookup() to prefill company
|
|
876
|
+
* data, createEnrollment() to provision the provider account, then
|
|
877
|
+
* createTransaction() / importTransactions() to record invoices and
|
|
878
|
+
* listTaxReports() to track their DGFiP lifecycle.
|
|
879
|
+
* - Norway — e-invoicing (EHF / Peppol BIS 3.0): registryLookup('NO', …) to
|
|
880
|
+
* prefill company/buyer data, createNorwayEnrollment() to register as a Peppol
|
|
881
|
+
* participant, peppolLookup('NO', …) to check a buyer is reachable, then
|
|
882
|
+
* createTransaction() to send invoices and credit notes.
|
|
547
883
|
*
|
|
548
|
-
*
|
|
549
|
-
*
|
|
884
|
+
* Each country/service is unlocked (and billed) separately; enrolling for a
|
|
885
|
+
* service the company does not have yields a 403 with code `service_not_active`.
|
|
886
|
+
* All routes except requestEReportingAccess() require compliance access on the
|
|
887
|
+
* account.
|
|
550
888
|
*/
|
|
551
889
|
declare class EReportingEndpoint {
|
|
552
890
|
private readonly baseUrl;
|
|
553
891
|
private readonly apiKey;
|
|
554
892
|
private readonly tokenStorage;
|
|
555
893
|
private readonly httpClient;
|
|
556
|
-
|
|
894
|
+
private readonly retryPolicy;
|
|
895
|
+
constructor(baseUrl: string, apiKey: string, tokenStorage: TokenStorageInterface, httpClient: HttpClientInterface, retryPolicy?: RetryPolicy);
|
|
557
896
|
/**
|
|
558
897
|
* Create a compliance enrollment and provision the provider account. By
|
|
559
|
-
* default the
|
|
898
|
+
* default the country regime is activated right away (France: DGFiP tax
|
|
899
|
+
* report setting; Norway: Peppol registration); pass `autoActivate: false`
|
|
560
900
|
* to only create the account.
|
|
561
901
|
*
|
|
562
|
-
*
|
|
563
|
-
* the
|
|
902
|
+
* The input shape depends on `country`: omitted/"FR" takes the France input
|
|
903
|
+
* (unchanged, backwards compatible), "NO" the Norway input — see also the
|
|
904
|
+
* createNorwayEnrollment() shortcut.
|
|
905
|
+
*
|
|
906
|
+
* Errors: 403 (HttpException, body code `service_not_active`) when the company
|
|
907
|
+
* lacks the requested service; on provider failure 502 (HttpException) — the
|
|
908
|
+
* enrollment is then persisted in `error_account`/`error_activation` state so
|
|
564
909
|
* provisioning can be retried.
|
|
565
910
|
*/
|
|
566
|
-
createEnrollment(input: CreateComplianceEnrollmentInput): Promise<ComplianceEnrollment>;
|
|
911
|
+
createEnrollment(input: CreateComplianceEnrollmentInput | CreateNorwayEnrollmentInput): Promise<ComplianceEnrollment>;
|
|
912
|
+
/**
|
|
913
|
+
* Enroll the company for Norway e-invoicing (EHF / Peppol BIS 3.0) — shortcut
|
|
914
|
+
* for createEnrollment({ country: 'NO', ... }). The organisation number is
|
|
915
|
+
* checked (mod-11) and normalized to 9 digits before sending.
|
|
916
|
+
*/
|
|
917
|
+
createNorwayEnrollment(input: NorwayEnrollmentInput): Promise<ComplianceEnrollment>;
|
|
567
918
|
/** Paginated list of the company's enrollments (newest first). `perPage` is capped at 100 server-side. */
|
|
568
919
|
listEnrollments(page?: number, perPage?: number): Promise<ComplianceEnrollmentPage>;
|
|
569
920
|
/** Get a single enrollment by id. */
|
|
@@ -576,6 +927,31 @@ declare class EReportingEndpoint {
|
|
|
576
927
|
* government API); exceeding it yields a 429 (mapped to an HttpException).
|
|
577
928
|
*/
|
|
578
929
|
sireneLookup(q: string): Promise<SireneLookupResult>;
|
|
930
|
+
/**
|
|
931
|
+
* Look up companies in a national company register — currently Norway
|
|
932
|
+
* (Brønnøysund Enhetsregisteret). `q` is an organisation number, a "NO…MVA"
|
|
933
|
+
* VAT number or a company name; an exact number match yields one result.
|
|
934
|
+
* Ideal for prefilling createNorwayEnrollment() and the buyer fields of an
|
|
935
|
+
* e-invoice. For France use sireneLookup().
|
|
936
|
+
*
|
|
937
|
+
* Errors: 404 (HttpException) when nothing is found, 422 (ValidationException)
|
|
938
|
+
* on invalid input / unsupported country, 429 (HttpException) when the
|
|
939
|
+
* per-user rate limit (30/min) is exceeded.
|
|
940
|
+
*/
|
|
941
|
+
registryLookup(country: string, q: string): Promise<RegistryCompany[]>;
|
|
942
|
+
/**
|
|
943
|
+
* Check whether a participant (typically the buyer) can receive e-invoices
|
|
944
|
+
* over Peppol. For Norway pass the organisation number (scheme defaults to
|
|
945
|
+
* "0192"): `reachable === true` means the buyer is registered in ELMA and must
|
|
946
|
+
* receive an EHF e-invoice. The directory resolves asynchronously —
|
|
947
|
+
* `status === 'pending'` (`reachable === null`) means ask again in a few
|
|
948
|
+
* seconds. Free of charge; definite answers are cached for 24h server-side.
|
|
949
|
+
*
|
|
950
|
+
* A Norwegian organisation number is checked (mod-11) and normalized before
|
|
951
|
+
* sending. Errors: 422 (ValidationException) on invalid input, 502
|
|
952
|
+
* (HttpException) on provider failure.
|
|
953
|
+
*/
|
|
954
|
+
peppolLookup(country: string, id: string, scheme?: string): Promise<PeppolLookupResult>;
|
|
579
955
|
/**
|
|
580
956
|
* Record and (by default) submit a Flux 10 transaction. Pass `submitNow: false`
|
|
581
957
|
* to only record it — submission can be triggered later via submitTransaction().
|
|
@@ -591,7 +967,7 @@ declare class EReportingEndpoint {
|
|
|
591
967
|
* On provider failure the API responds 502 (mapped to an HttpException).
|
|
592
968
|
*/
|
|
593
969
|
createTransaction(input: CreateComplianceTransactionInput): Promise<ComplianceTransaction>;
|
|
594
|
-
/** Paginated list of the company's transactions (newest invoice date first), filterable by date / state / type. */
|
|
970
|
+
/** Paginated list of the company's transactions (newest invoice date first), filterable by date / state / type / enrollment / country. */
|
|
595
971
|
listTransactions(filters?: ComplianceTransactionFilters): Promise<ComplianceTransactionPage>;
|
|
596
972
|
/** Get a single transaction by id (includes its tax report when one exists). */
|
|
597
973
|
getTransaction(id: number): Promise<ComplianceTransaction>;
|
|
@@ -648,11 +1024,25 @@ declare class EReportingEndpoint {
|
|
|
648
1024
|
*/
|
|
649
1025
|
requestEReportingAccess(input?: EReportingAccessRequestInput): Promise<void>;
|
|
650
1026
|
private validateEnrollmentInput;
|
|
1027
|
+
private isNorwayEnrollmentInput;
|
|
1028
|
+
/** Validates the Norway input and builds its wire body (org number normalized to 9 digits). */
|
|
1029
|
+
private buildNorwayEnrollmentBody;
|
|
1030
|
+
private createEnrollmentFromBody;
|
|
1031
|
+
private validateService;
|
|
1032
|
+
private validateEmail;
|
|
1033
|
+
/** Lookup routes take a 2-letter country; the API expects it upper-case. */
|
|
1034
|
+
private normalizeLookupCountry;
|
|
651
1035
|
private validateId;
|
|
652
1036
|
private validateTransactionType;
|
|
653
1037
|
private validateInvoiceNumber;
|
|
654
1038
|
private validateInvoiceLines;
|
|
655
1039
|
private validateOptionalCodes;
|
|
1040
|
+
/**
|
|
1041
|
+
* Format checks for the buyer/document fields. Country rules (e.g. the Norway
|
|
1042
|
+
* org number being required) depend on the enrollment and stay server-side;
|
|
1043
|
+
* a register id is only check-digit validated when the buyer is Norwegian.
|
|
1044
|
+
*/
|
|
1045
|
+
private validateBuyerFields;
|
|
656
1046
|
private buildInvoiceLines;
|
|
657
1047
|
/** Applies the optional scalar fields shared by create and update. */
|
|
658
1048
|
private applyOptionalTransactionFields;
|
|
@@ -678,6 +1068,30 @@ declare class EReportingEndpoint {
|
|
|
678
1068
|
private formatDate;
|
|
679
1069
|
}
|
|
680
1070
|
|
|
1071
|
+
/**
|
|
1072
|
+
* How hard a Smart Enrichment lookup is allowed to search.
|
|
1073
|
+
*
|
|
1074
|
+
* `default` searches with one AI provider and consults a second one only when the first finds
|
|
1075
|
+
* nothing — one paid search per lookup in the common case.
|
|
1076
|
+
*
|
|
1077
|
+
* `complex` has two independent AI providers search from the start, and every VAT number either of
|
|
1078
|
+
* them proposes is put through the tax authority's checks until one confirms. Noticeably better on
|
|
1079
|
+
* hard lookups — companies whose VAT only appears in a website Impressum — and it costs more per
|
|
1080
|
+
* lookup, so it is opt-in per request rather than the default.
|
|
1081
|
+
*/
|
|
1082
|
+
declare const SmartEnrichmentMode: {
|
|
1083
|
+
readonly DEFAULT: "default";
|
|
1084
|
+
readonly COMPLEX: "complex";
|
|
1085
|
+
};
|
|
1086
|
+
type SmartEnrichmentMode = (typeof SmartEnrichmentMode)[keyof typeof SmartEnrichmentMode];
|
|
1087
|
+
/**
|
|
1088
|
+
* Coercion for values coming back from the API. Returns undefined for anything unrecognized —
|
|
1089
|
+
* unlike the status enum there is no `unknown` member to fall back to, and inventing a mode would
|
|
1090
|
+
* misreport how a lookup actually ran.
|
|
1091
|
+
*/
|
|
1092
|
+
declare function toSmartEnrichmentMode(value: unknown): SmartEnrichmentMode | undefined;
|
|
1093
|
+
declare function describeSmartEnrichmentMode(mode: SmartEnrichmentMode): string;
|
|
1094
|
+
|
|
681
1095
|
declare const SmartEnrichmentStatus: {
|
|
682
1096
|
readonly FOUND: "found";
|
|
683
1097
|
readonly NO_VAT_EXISTS: "no_vat_exists";
|
|
@@ -693,6 +1107,34 @@ type SmartEnrichmentStatus = (typeof SmartEnrichmentStatus)[keyof typeof SmartEn
|
|
|
693
1107
|
declare function toSmartEnrichmentStatus(value: unknown): SmartEnrichmentStatus;
|
|
694
1108
|
declare function describeSmartEnrichmentStatus(status: SmartEnrichmentStatus): string;
|
|
695
1109
|
|
|
1110
|
+
/** What one AI provider independently concluded, when more than one searched. */
|
|
1111
|
+
interface SmartEnrichmentProviderVerdict {
|
|
1112
|
+
provider: string;
|
|
1113
|
+
model: string | null;
|
|
1114
|
+
status: string;
|
|
1115
|
+
vatNumber: string | null;
|
|
1116
|
+
confidence: number | null;
|
|
1117
|
+
/** False when the model answered from memory instead of an actual web search. */
|
|
1118
|
+
grounded: boolean;
|
|
1119
|
+
sourceUrl: string | null;
|
|
1120
|
+
}
|
|
1121
|
+
/**
|
|
1122
|
+
* What the API made of the address you submitted. The actionable part is `warnings`:
|
|
1123
|
+
* `postal_code_city_mismatch` / `postal_code_unassigned` / `postal_code_format_invalid` mean the
|
|
1124
|
+
* postal code in your source record is wrong, and `derivedPlace` is where it actually points —
|
|
1125
|
+
* worth writing back into your own data.
|
|
1126
|
+
*/
|
|
1127
|
+
interface SmartEnrichmentAddressQuality {
|
|
1128
|
+
providedPostalCode: string | null;
|
|
1129
|
+
providedCity: string | null;
|
|
1130
|
+
postalCodeFormatValid: boolean | null;
|
|
1131
|
+
postalCodeAssigned: boolean | null;
|
|
1132
|
+
/** False when the postal code was excluded from the search because it could not be trusted. */
|
|
1133
|
+
postalCodeTrusted: boolean;
|
|
1134
|
+
derivedPlace: string | null;
|
|
1135
|
+
cityMatchesPostalCode: boolean | null;
|
|
1136
|
+
warnings: string[];
|
|
1137
|
+
}
|
|
696
1138
|
/**
|
|
697
1139
|
* Result of resolving one reverse-VAT lookup (company name + address → VAT + confidence).
|
|
698
1140
|
* Mirrors the API response item shape (camelCase keys).
|
|
@@ -707,9 +1149,26 @@ declare class SmartEnrichmentResource {
|
|
|
707
1149
|
readonly matchedAddress: string | undefined;
|
|
708
1150
|
readonly country: string | undefined;
|
|
709
1151
|
readonly source: string | undefined;
|
|
1152
|
+
/** The search mode this lookup actually ran in. */
|
|
1153
|
+
readonly mode: SmartEnrichmentMode | undefined;
|
|
1154
|
+
/**
|
|
1155
|
+
* What each AI provider independently concluded. Populated when more than one searched
|
|
1156
|
+
* (complex mode, or a fallback). Two entries reporting the same vatNumber is the strongest
|
|
1157
|
+
* confirmation this layer produces.
|
|
1158
|
+
*/
|
|
1159
|
+
readonly providerVerdicts: SmartEnrichmentProviderVerdict[];
|
|
1160
|
+
readonly addressQuality: SmartEnrichmentAddressQuality | undefined;
|
|
710
1161
|
constructor(status: SmartEnrichmentStatus, vatNumber: string | undefined, vatType: string | undefined, confidence: number | undefined, matchedCompanyName: string | undefined,
|
|
711
1162
|
/** Official/registered address of the matched company, when available. */
|
|
712
|
-
matchedAddress: string | undefined, country: string | undefined, source: string | undefined
|
|
1163
|
+
matchedAddress: string | undefined, country: string | undefined, source: string | undefined,
|
|
1164
|
+
/** The search mode this lookup actually ran in. */
|
|
1165
|
+
mode?: SmartEnrichmentMode | undefined,
|
|
1166
|
+
/**
|
|
1167
|
+
* What each AI provider independently concluded. Populated when more than one searched
|
|
1168
|
+
* (complex mode, or a fallback). Two entries reporting the same vatNumber is the strongest
|
|
1169
|
+
* confirmation this layer produces.
|
|
1170
|
+
*/
|
|
1171
|
+
providerVerdicts?: SmartEnrichmentProviderVerdict[], addressQuality?: SmartEnrichmentAddressQuality | undefined);
|
|
713
1172
|
static fromArray(data: Record<string, unknown>): SmartEnrichmentResource;
|
|
714
1173
|
toArray(): Record<string, unknown>;
|
|
715
1174
|
}
|
|
@@ -850,6 +1309,11 @@ interface SmartEnrichmentInput {
|
|
|
850
1309
|
street?: string;
|
|
851
1310
|
postalCode?: string;
|
|
852
1311
|
city?: string;
|
|
1312
|
+
/**
|
|
1313
|
+
* Search depth. Omit to use the server default (`default`). `complex` searches with two
|
|
1314
|
+
* independent providers and cross-checks them — better hit rate, higher cost per lookup.
|
|
1315
|
+
*/
|
|
1316
|
+
mode?: SmartEnrichmentMode;
|
|
853
1317
|
}
|
|
854
1318
|
/** One recent monthly billing entry, exposed on the usage response for transparency. */
|
|
855
1319
|
interface SmartEnrichmentUsageHistoryEntry {
|
|
@@ -912,7 +1376,8 @@ declare class SmartEnrichmentEndpoint {
|
|
|
912
1376
|
private readonly apiKey;
|
|
913
1377
|
private readonly tokenStorage;
|
|
914
1378
|
private readonly httpClient;
|
|
915
|
-
|
|
1379
|
+
private readonly retryPolicy;
|
|
1380
|
+
constructor(baseUrl: string, apiKey: string, tokenStorage: TokenStorageInterface, httpClient: HttpClientInterface, retryPolicy?: RetryPolicy);
|
|
916
1381
|
/**
|
|
917
1382
|
* Single reverse lookup. Returns a confident result synchronously, or a `processing`
|
|
918
1383
|
* job (poll with get(job.jobId) or waitForCompletion(job.jobId)) when deeper resolution
|
|
@@ -922,8 +1387,11 @@ declare class SmartEnrichmentEndpoint {
|
|
|
922
1387
|
/**
|
|
923
1388
|
* Bulk batch — always async. Returns a `processing` job; results arrive via the
|
|
924
1389
|
* `enrichment.completed` webhook and are retrievable via get(job.jobId).
|
|
1390
|
+
*
|
|
1391
|
+
* @param mode Search depth for every row in the batch. A row carrying its own `mode` overrides
|
|
1392
|
+
* it, so a caller can pay for `complex` on just the rows that need it.
|
|
925
1393
|
*/
|
|
926
|
-
bulkLookup(items: SmartEnrichmentInput[]): Promise<SmartEnrichmentJob>;
|
|
1394
|
+
bulkLookup(items: SmartEnrichmentInput[], mode?: SmartEnrichmentMode): Promise<SmartEnrichmentJob>;
|
|
927
1395
|
/** Poll a job (single or bulk) by its id. */
|
|
928
1396
|
get(jobId: string): Promise<SmartEnrichmentJob>;
|
|
929
1397
|
/**
|
|
@@ -1139,9 +1607,9 @@ declare class VatEndpoint {
|
|
|
1139
1607
|
private readonly apiKey;
|
|
1140
1608
|
private readonly tokenStorage;
|
|
1141
1609
|
private readonly httpClient;
|
|
1142
|
-
|
|
1610
|
+
private readonly retryPolicy;
|
|
1611
|
+
constructor(baseUrl: string, apiKey: string, tokenStorage: TokenStorageInterface, httpClient: HttpClientInterface, retryPolicy?: RetryPolicy);
|
|
1143
1612
|
validate(vatUid: string, companyName?: string, provider?: string, addressInput?: VatValidationAddressInput | Record<string, string>): Promise<VatResource>;
|
|
1144
|
-
private validateWithGatewayRetry;
|
|
1145
1613
|
validateMultiple(vatUids: string[], companyNames?: string[], provider?: string): Promise<VatCollection>;
|
|
1146
1614
|
validateSchema(vatUid: string): Promise<Record<string, unknown>>;
|
|
1147
1615
|
state(vatUid: string): Promise<VatResource>;
|
|
@@ -1171,6 +1639,8 @@ interface TaxoraClientOptions {
|
|
|
1171
1639
|
environment?: Environment;
|
|
1172
1640
|
tokenStorage?: TokenStorageInterface;
|
|
1173
1641
|
httpClient?: HttpClientInterface;
|
|
1642
|
+
/** Retry behaviour for transient gateway failures; defaults to 3 attempts with backoff. */
|
|
1643
|
+
retryPolicy?: RetryPolicy;
|
|
1174
1644
|
}
|
|
1175
1645
|
declare class TaxoraClient {
|
|
1176
1646
|
readonly auth: AuthEndpoint;
|
|
@@ -1191,11 +1661,170 @@ declare const ApiVersion: {
|
|
|
1191
1661
|
};
|
|
1192
1662
|
type ApiVersion = (typeof ApiVersion)[keyof typeof ApiVersion];
|
|
1193
1663
|
|
|
1664
|
+
/**
|
|
1665
|
+
* Norwegian organisation number (organisasjonsnummer): 9 digits, the last one a
|
|
1666
|
+
* modulus-11 check digit (weights 3,2,7,6,5,4,3,2). It is also the Peppol
|
|
1667
|
+
* participant identifier under scheme 0192 and — with the "NO" prefix and "MVA"
|
|
1668
|
+
* suffix — the Norwegian VAT number.
|
|
1669
|
+
*
|
|
1670
|
+
* Mirrors the backend's validation, so invalid numbers are rejected before a
|
|
1671
|
+
* request is sent.
|
|
1672
|
+
*/
|
|
1673
|
+
declare const NorwegianOrgNumber: {
|
|
1674
|
+
/** Peppol identifier scheme for Norwegian organisation numbers. */
|
|
1675
|
+
readonly PEPPOL_SCHEME: "0192";
|
|
1676
|
+
/**
|
|
1677
|
+
* Strips whitespace, dots, dashes, a "0192:" Peppol scheme prefix, the "NO"
|
|
1678
|
+
* prefix and the "MVA" suffix: "NO 923 609 016 MVA", "923609016MVA" and
|
|
1679
|
+
* "923 609 016" all become "923609016". Does not validate.
|
|
1680
|
+
*/
|
|
1681
|
+
readonly normalize: (value: string | null | undefined) => string;
|
|
1682
|
+
/** True when the (normalized) value is 9 digits with a valid mod-11 check digit. */
|
|
1683
|
+
readonly isValid: (value: string | null | undefined) => boolean;
|
|
1684
|
+
/** "NO923609016MVA" — the Norwegian VAT number of an MVA-registered entity. Does not validate. */
|
|
1685
|
+
readonly toVatNumber: (value: string) => string;
|
|
1686
|
+
};
|
|
1687
|
+
|
|
1194
1688
|
declare class TaxoraException extends Error {
|
|
1195
1689
|
readonly context: Record<string, unknown>;
|
|
1196
1690
|
constructor(message: string, context?: Record<string, unknown>);
|
|
1197
1691
|
}
|
|
1198
1692
|
|
|
1693
|
+
/**
|
|
1694
|
+
* Typed shapes of the JSON bodies Taxora POSTs to your webhook endpoint.
|
|
1695
|
+
*
|
|
1696
|
+
* Every event shares the same envelope ({@link WebhookEventEnvelope}); `event` narrows `data.object`:
|
|
1697
|
+
*
|
|
1698
|
+
* ```ts
|
|
1699
|
+
* const event = constructWebhookEvent(rawBody, header, secret);
|
|
1700
|
+
* if (event.event === 'vat.validated') {
|
|
1701
|
+
* event.data.object.vat_uid; // string
|
|
1702
|
+
* }
|
|
1703
|
+
* ```
|
|
1704
|
+
*/
|
|
1705
|
+
type WebhookEventType = 'vat.validated' | 'vat.state_changed' | 'compliance.ledger.state_changed' | 'compliance.transaction.state_changed' | 'enrichment.completed' | 'enrichment.updated' | 'webhook.test';
|
|
1706
|
+
interface WebhookEventEnvelope<TEvent extends string, TObject> {
|
|
1707
|
+
/** Delivery UUID — identical to the `Taxora-Webhook-Id` header and stable across retries. Use it to dedupe. */
|
|
1708
|
+
id: string;
|
|
1709
|
+
event: TEvent;
|
|
1710
|
+
/** Unix seconds when the event was created (not the delivery attempt — that is `t` in the signature). */
|
|
1711
|
+
timestamp: number;
|
|
1712
|
+
data: {
|
|
1713
|
+
object: TObject;
|
|
1714
|
+
};
|
|
1715
|
+
}
|
|
1716
|
+
interface VatWebhookObject {
|
|
1717
|
+
id: number;
|
|
1718
|
+
vat_uid: string;
|
|
1719
|
+
/** A VatState value, e.g. `valid`, `invalid`. */
|
|
1720
|
+
state: string;
|
|
1721
|
+
company_name: string | null;
|
|
1722
|
+
country_code: string | null;
|
|
1723
|
+
checked_at: string | null;
|
|
1724
|
+
}
|
|
1725
|
+
interface ComplianceLedgerWebhookObject {
|
|
1726
|
+
id: number;
|
|
1727
|
+
state: string;
|
|
1728
|
+
ledger_type: string | null;
|
|
1729
|
+
ledger_date: string | null;
|
|
1730
|
+
}
|
|
1731
|
+
interface ComplianceTransactionWebhookObject {
|
|
1732
|
+
id: number;
|
|
1733
|
+
state: string;
|
|
1734
|
+
provider_state: string | null;
|
|
1735
|
+
country: string | null;
|
|
1736
|
+
invoice_number: string | null;
|
|
1737
|
+
}
|
|
1738
|
+
/** Raw Smart Enrichment rows — wrap them with `SmartEnrichmentResource.fromArray()` for a typed DTO. */
|
|
1739
|
+
interface EnrichmentCompletedWebhookObject {
|
|
1740
|
+
jobId: string;
|
|
1741
|
+
status: string;
|
|
1742
|
+
itemCount: number;
|
|
1743
|
+
foundCount: number;
|
|
1744
|
+
results: Record<string, unknown>[];
|
|
1745
|
+
}
|
|
1746
|
+
interface EnrichmentUpdatedWebhookObject {
|
|
1747
|
+
jobId: string;
|
|
1748
|
+
status: string;
|
|
1749
|
+
itemCount: number;
|
|
1750
|
+
foundCount: number;
|
|
1751
|
+
/** Zero-based index of the row that changed, matching `results[rowIndex]` of enrichment.completed. */
|
|
1752
|
+
rowIndex: number;
|
|
1753
|
+
result: Record<string, unknown> | null;
|
|
1754
|
+
}
|
|
1755
|
+
interface TestWebhookObject {
|
|
1756
|
+
message: string;
|
|
1757
|
+
}
|
|
1758
|
+
type VatValidatedEvent = WebhookEventEnvelope<'vat.validated', VatWebhookObject>;
|
|
1759
|
+
type VatStateChangedEvent = WebhookEventEnvelope<'vat.state_changed', VatWebhookObject>;
|
|
1760
|
+
type ComplianceLedgerStateChangedEvent = WebhookEventEnvelope<'compliance.ledger.state_changed', ComplianceLedgerWebhookObject>;
|
|
1761
|
+
type ComplianceTransactionStateChangedEvent = WebhookEventEnvelope<'compliance.transaction.state_changed', ComplianceTransactionWebhookObject>;
|
|
1762
|
+
type EnrichmentCompletedEvent = WebhookEventEnvelope<'enrichment.completed', EnrichmentCompletedWebhookObject>;
|
|
1763
|
+
type EnrichmentUpdatedEvent = WebhookEventEnvelope<'enrichment.updated', EnrichmentUpdatedWebhookObject>;
|
|
1764
|
+
type WebhookTestEvent = WebhookEventEnvelope<'webhook.test', TestWebhookObject>;
|
|
1765
|
+
/** Discriminated union of every event Taxora sends. Switch on `event` to narrow `data.object`. */
|
|
1766
|
+
type TaxoraWebhookEvent = VatValidatedEvent | VatStateChangedEvent | ComplianceLedgerStateChangedEvent | ComplianceTransactionStateChangedEvent | EnrichmentCompletedEvent | EnrichmentUpdatedEvent | WebhookTestEvent;
|
|
1767
|
+
|
|
1768
|
+
/** Name of the HTTP header that carries the signature. Node lower-cases it: `req.headers['taxora-signature']`. */
|
|
1769
|
+
declare const WEBHOOK_SIGNATURE_HEADER = "Taxora-Signature";
|
|
1770
|
+
/** Name of the HTTP header that carries the delivery UUID (stable across retries). */
|
|
1771
|
+
declare const WEBHOOK_ID_HEADER = "Taxora-Webhook-Id";
|
|
1772
|
+
/** Default maximum age (seconds) of a signed request before it is rejected as a possible replay. */
|
|
1773
|
+
declare const DEFAULT_WEBHOOK_TOLERANCE_SECONDS = 300;
|
|
1774
|
+
/** The exact bytes Taxora sent. Never pass a parsed-and-re-serialised object. */
|
|
1775
|
+
type WebhookRawBody = string | Uint8Array | ArrayBuffer;
|
|
1776
|
+
/** Header value as frameworks hand it over (Express/Node may give an array for repeated headers). */
|
|
1777
|
+
type WebhookSignatureHeaderInput = string | readonly string[] | null | undefined;
|
|
1778
|
+
interface WebhookVerifyOptions {
|
|
1779
|
+
/**
|
|
1780
|
+
* Maximum allowed difference between now and the signature timestamp, in seconds. Default 300.
|
|
1781
|
+
* `0` disables the check — not recommended, it re-opens replay attacks.
|
|
1782
|
+
*/
|
|
1783
|
+
tolerance?: number;
|
|
1784
|
+
/** Current time in Unix seconds. Only meant for tests. */
|
|
1785
|
+
now?: number;
|
|
1786
|
+
}
|
|
1787
|
+
type WebhookSignatureErrorReason = 'missing_secret' | 'missing_header' | 'malformed_header' | 'invalid_body' | 'timestamp_outside_tolerance' | 'no_matching_signature' | 'invalid_payload';
|
|
1788
|
+
declare class WebhookSignatureVerificationError extends TaxoraException {
|
|
1789
|
+
readonly reason: WebhookSignatureErrorReason;
|
|
1790
|
+
constructor(message: string, reason: WebhookSignatureErrorReason, context?: Record<string, unknown>);
|
|
1791
|
+
}
|
|
1792
|
+
interface ParsedWebhookSignatureHeader {
|
|
1793
|
+
timestamp: number;
|
|
1794
|
+
/** All `v1` signatures — two during a secret rotation on Taxora's side. */
|
|
1795
|
+
signatures: string[];
|
|
1796
|
+
}
|
|
1797
|
+
/** Parses `t=<unix>,v1=<hex>[,v1=<hex>…]`. Unknown schemes are ignored for forward compatibility. */
|
|
1798
|
+
declare function parseWebhookSignatureHeader(header: WebhookSignatureHeaderInput): ParsedWebhookSignatureHeader;
|
|
1799
|
+
/** hex(HMAC-SHA256(secret, `${timestamp}.${rawBody}`)) — the value Taxora puts into `v1=`. */
|
|
1800
|
+
declare function computeWebhookSignature(rawBody: WebhookRawBody, timestamp: number, secret: string): string;
|
|
1801
|
+
/**
|
|
1802
|
+
* Builds a valid `Taxora-Signature` header value for a payload — handy for unit-testing your webhook handler
|
|
1803
|
+
* without calling Taxora.
|
|
1804
|
+
*/
|
|
1805
|
+
declare function generateWebhookSignatureHeader(rawBody: WebhookRawBody, secret: string | readonly string[], timestamp?: number): string;
|
|
1806
|
+
/**
|
|
1807
|
+
* Verifies a Taxora webhook request. Returns `true` or throws {@link WebhookSignatureVerificationError}.
|
|
1808
|
+
*
|
|
1809
|
+
* - `rawBody` must be the unmodified request body (e.g. `express.raw()`, `await request.text()`).
|
|
1810
|
+
* - `secret` may be a list — useful while you rotate the secret on your side.
|
|
1811
|
+
* - The comparison is constant-time; the timestamp must be within `tolerance` seconds (default 300).
|
|
1812
|
+
*/
|
|
1813
|
+
declare function verifyWebhookSignature(rawBody: WebhookRawBody, header: WebhookSignatureHeaderInput, secret: string | readonly string[], options?: WebhookVerifyOptions): true;
|
|
1814
|
+
/**
|
|
1815
|
+
* Verifies the signature and returns the parsed, typed event. Throws {@link WebhookSignatureVerificationError}
|
|
1816
|
+
* on any problem — respond with HTTP 400 in that case.
|
|
1817
|
+
*
|
|
1818
|
+
* ```ts
|
|
1819
|
+
* app.post('/taxora-webhook', express.raw({ type: 'application/json' }), (req, res) => {
|
|
1820
|
+
* const event = constructWebhookEvent(req.body, req.header('Taxora-Signature'), process.env.TAXORA_WEBHOOK_SECRET!);
|
|
1821
|
+
* if (event.event === 'vat.validated') { ... }
|
|
1822
|
+
* res.sendStatus(200);
|
|
1823
|
+
* });
|
|
1824
|
+
* ```
|
|
1825
|
+
*/
|
|
1826
|
+
declare function constructWebhookEvent<T extends TaxoraWebhookEvent = TaxoraWebhookEvent>(rawBody: WebhookRawBody, header: WebhookSignatureHeaderInput, secret: string | readonly string[], options?: WebhookVerifyOptions): T;
|
|
1827
|
+
|
|
1199
1828
|
declare class AuthenticationException extends TaxoraException {
|
|
1200
1829
|
readonly statusCode = 401;
|
|
1201
1830
|
constructor(message: string, context?: Record<string, unknown>);
|
|
@@ -1204,9 +1833,17 @@ declare class AuthenticationException extends TaxoraException {
|
|
|
1204
1833
|
declare class HttpException extends TaxoraException {
|
|
1205
1834
|
readonly statusCode: number;
|
|
1206
1835
|
readonly responseBody: string;
|
|
1207
|
-
|
|
1836
|
+
/** Raw `Retry-After` header of the failed response, when it carried one. */
|
|
1837
|
+
readonly retryAfter: string | null;
|
|
1838
|
+
constructor(message: string, statusCode: number, responseBody: string, context?: Record<string, unknown>, retryAfter?: string | null);
|
|
1839
|
+
/**
|
|
1840
|
+
* The final failure after the SDK retried a transient gateway error, e.g.
|
|
1841
|
+
* "Taxora VAT validation failed after 3 attempts (HTTP 504 Gateway Timeout)."
|
|
1842
|
+
*/
|
|
1843
|
+
static afterAttempts(operation: string, attempts: number, last: HttpException): HttpException;
|
|
1208
1844
|
getStatusCode(): number;
|
|
1209
1845
|
getResponseBody(): string;
|
|
1846
|
+
getRetryAfter(): string | null;
|
|
1210
1847
|
}
|
|
1211
1848
|
|
|
1212
1849
|
declare class ValidationException extends TaxoraException {
|
|
@@ -1216,6 +1853,24 @@ declare class ValidationException extends TaxoraException {
|
|
|
1216
1853
|
getErrors(): Record<string, string[]>;
|
|
1217
1854
|
}
|
|
1218
1855
|
|
|
1856
|
+
/**
|
|
1857
|
+
* Derives a short, human readable exception message from an API response body.
|
|
1858
|
+
*
|
|
1859
|
+
* A response body is never used verbatim as an exception message: the gateways
|
|
1860
|
+
* in front of the API (DigitalOcean App Platform, load balancers, proxies)
|
|
1861
|
+
* answer 5xx with a full HTML error page, and that page would otherwise end up
|
|
1862
|
+
* in every log line and stack trace of the integrating application.
|
|
1863
|
+
*
|
|
1864
|
+
* Only the human readable message of a JSON error body is used; everything else
|
|
1865
|
+
* (HTML, empty bodies, binary payloads) falls back to the HTTP status line. The
|
|
1866
|
+
* untouched body always stays available via `HttpException.getResponseBody()`.
|
|
1867
|
+
*/
|
|
1868
|
+
/**
|
|
1869
|
+
* The message for a failed request: the API message when the body carries one,
|
|
1870
|
+
* otherwise a description of the HTTP status.
|
|
1871
|
+
*/
|
|
1872
|
+
declare function describeApiError(body: string | null | undefined, statusCode: number): string;
|
|
1873
|
+
|
|
1219
1874
|
declare class InMemoryTokenStorage implements TokenStorageInterface {
|
|
1220
1875
|
private token;
|
|
1221
1876
|
get(): Token | null;
|
|
@@ -1242,4 +1897,4 @@ declare class AuthRetryHttpClient implements HttpClientInterface {
|
|
|
1242
1897
|
private injectAuthHeader;
|
|
1243
1898
|
}
|
|
1244
1899
|
|
|
1245
|
-
export { ApiVersion, AuthEndpoint, AuthRetryHttpClient, AuthenticationException, CompanyAddress, CompanyEndpoint, type CompanyResource, ComplianceEnrollment, ComplianceEnrollmentPage, ComplianceEnrollmentStatus, type ComplianceEnterpriseSize, type ComplianceInvoiceLineInput, type ComplianceInvoiceTaxInput, ComplianceTaxReport, ComplianceTaxReportPage, type ComplianceTaxReportRequestState, ComplianceTaxReportState, ComplianceTransaction, type ComplianceTransactionFilters, ComplianceTransactionPage, type ComplianceTransactionRequestState, type ComplianceTransactionRequestType, ComplianceTransactionState, ComplianceTransactionType, type ComplianceTypeOperation, type CreateComplianceEnrollmentInput, type CreateComplianceTransactionInput, type EReportingAccessRequestInput, EReportingEndpoint, type EReportingInterval, Environment, Environment as EnvironmentType, FetchHttpClient, type HttpClientInterface, HttpException, ImportResult, InMemoryTokenStorage, Language, LoginIdentifier, ProviderDocument, ProviderDocumentLine, type RevenueCountryBreakdown, type RevenueCurrencyBreakdown, type RevenueStateBreakdown, RevenueStatistics, type RevenueStatisticsFilters, type RevenueTimeBucket, type RevenueTotals, type RevenueTypeBreakdown, ScoreBreakdown, SireneLookupResult, type SmartEnrichmentConfidenceBucket, SmartEnrichmentEndpoint, type SmartEnrichmentExportOptions, type SmartEnrichmentHistoryInput, SmartEnrichmentHistoryPage, SmartEnrichmentHistoryRow, type SmartEnrichmentHistoryStats, type SmartEnrichmentInput, SmartEnrichmentJob, type SmartEnrichmentOutcomeBreakdown, SmartEnrichmentResource, type SmartEnrichmentSourceBreakdown, SmartEnrichmentStatistics, type SmartEnrichmentStatisticsInterval, type SmartEnrichmentStatisticsOptions, type SmartEnrichmentStatisticsRange, type SmartEnrichmentStatisticsTotals, SmartEnrichmentStatus, type SmartEnrichmentTimeBucket, type SmartEnrichmentUsage, type SmartEnrichmentUsageHistoryEntry, type SmartEnrichmentWaitOptions, TaxoraClient, TaxoraClientFactory, type TaxoraClientOptions, TaxoraException, Token, type TokenStorageInterface, type UpdateComplianceTransactionInput, ValidationException, VatCertificateExport, VatCollection, VatEndpoint, type VatRate, VatRates, VatResource, VatState, VatValidationAddressInput, describeComplianceEnrollmentStatus, describeComplianceTaxReportState, describeComplianceTransactionState, describeComplianceTransactionType, describeSmartEnrichmentStatus, describeVatState, getBaseUrl, getFailedVatStates, toComplianceEnrollmentStatus, toComplianceTaxReportState, toComplianceTransactionState, toComplianceTransactionType, toSmartEnrichmentStatus };
|
|
1900
|
+
export { ApiVersion, AuthEndpoint, AuthRetryHttpClient, AuthenticationException, CompanyAddress, CompanyEndpoint, type CompanyResource, ComplianceDocumentType, ComplianceEnrollment, ComplianceEnrollmentPage, ComplianceEnrollmentStatus, type ComplianceEnterpriseSize, type ComplianceInvoiceLineInput, type ComplianceInvoiceTaxInput, type ComplianceLedgerStateChangedEvent, type ComplianceLedgerWebhookObject, type ComplianceRequestService, ComplianceService, ComplianceTaxReport, ComplianceTaxReportPage, type ComplianceTaxReportRequestState, ComplianceTaxReportState, ComplianceTransaction, type ComplianceTransactionBuyerInput, type ComplianceTransactionFilters, type ComplianceTransactionInvoiceLine, type ComplianceTransactionInvoiceLineTax, ComplianceTransactionPage, type ComplianceTransactionRequestState, type ComplianceTransactionRequestType, ComplianceTransactionState, type ComplianceTransactionStateChangedEvent, ComplianceTransactionType, type ComplianceTransactionWebhookObject, type ComplianceTypeOperation, type CreateComplianceEnrollmentInput, type CreateComplianceTransactionInput, type CreateNorwayEnrollmentInput, DEFAULT_WEBHOOK_TOLERANCE_SECONDS, type EReportingAccessRequestInput, EReportingEndpoint, type EReportingInterval, type EnrichmentCompletedEvent, type EnrichmentCompletedWebhookObject, type EnrichmentUpdatedEvent, type EnrichmentUpdatedWebhookObject, Environment, Environment as EnvironmentType, FetchHttpClient, type HttpClientInterface, HttpException, ImportResult, InMemoryTokenStorage, Language, LoginIdentifier, type NorwayEnrollmentInput, NorwegianOrgNumber, type ParsedWebhookSignatureHeader, PeppolLookupResult, PeppolLookupStatus, ProviderDocument, ProviderDocumentLine, RegistryCompany, RetryPolicy, type RetryPolicyOptions, type RevenueCountryBreakdown, type RevenueCurrencyBreakdown, type RevenueStateBreakdown, RevenueStatistics, type RevenueStatisticsFilters, type RevenueTimeBucket, type RevenueTotals, type RevenueTypeBreakdown, ScoreBreakdown, SireneLookupResult, type SmartEnrichmentAddressQuality, type SmartEnrichmentConfidenceBucket, SmartEnrichmentEndpoint, type SmartEnrichmentExportOptions, type SmartEnrichmentHistoryInput, SmartEnrichmentHistoryPage, SmartEnrichmentHistoryRow, type SmartEnrichmentHistoryStats, type SmartEnrichmentInput, SmartEnrichmentJob, SmartEnrichmentMode, type SmartEnrichmentOutcomeBreakdown, type SmartEnrichmentProviderVerdict, SmartEnrichmentResource, type SmartEnrichmentSourceBreakdown, SmartEnrichmentStatistics, type SmartEnrichmentStatisticsInterval, type SmartEnrichmentStatisticsOptions, type SmartEnrichmentStatisticsRange, type SmartEnrichmentStatisticsTotals, SmartEnrichmentStatus, type SmartEnrichmentTimeBucket, type SmartEnrichmentUsage, type SmartEnrichmentUsageHistoryEntry, type SmartEnrichmentWaitOptions, TaxoraClient, TaxoraClientFactory, type TaxoraClientOptions, TaxoraException, type TaxoraWebhookEvent, type TestWebhookObject, Token, type TokenStorageInterface, type UpdateComplianceTransactionInput, ValidationException, VatCertificateExport, VatCollection, VatEndpoint, type VatRate, VatRates, VatResource, VatState, type VatStateChangedEvent, type VatValidatedEvent, VatValidationAddressInput, type VatWebhookObject, WEBHOOK_ID_HEADER, WEBHOOK_SIGNATURE_HEADER, type WebhookEventEnvelope, type WebhookEventType, type WebhookRawBody, type WebhookSignatureErrorReason, type WebhookSignatureHeaderInput, WebhookSignatureVerificationError, type WebhookTestEvent, type WebhookVerifyOptions, computeWebhookSignature, constructWebhookEvent, describeApiError, describeComplianceDocumentType, describeComplianceEnrollmentStatus, describeComplianceService, describeComplianceTaxReportState, describeComplianceTransactionState, describeComplianceTransactionType, describePeppolLookupStatus, describeSmartEnrichmentMode, describeSmartEnrichmentStatus, describeVatState, generateWebhookSignatureHeader, getBaseUrl, getFailedVatStates, parseWebhookSignatureHeader, toComplianceDocumentType, toComplianceEnrollmentStatus, toComplianceService, toComplianceTaxReportState, toComplianceTransactionState, toComplianceTransactionType, toPeppolLookupStatus, toSmartEnrichmentMode, toSmartEnrichmentStatus, verifyWebhookSignature };
|