@taxora/sdk 1.7.1 → 1.9.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 +84 -0
- package/README.md +205 -4
- package/dist/index.cjs +985 -184
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +564 -16
- package/dist/index.d.ts +564 -16
- package/dist/index.js +978 -184
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
package/dist/index.d.cts
CHANGED
|
@@ -110,6 +110,98 @@ declare class AuthEndpoint {
|
|
|
110
110
|
private parseResponse;
|
|
111
111
|
}
|
|
112
112
|
|
|
113
|
+
/** One billable usage event of a summary (only included by billing.getUsageSummaries(period)). */
|
|
114
|
+
interface UsageEvent {
|
|
115
|
+
id: number;
|
|
116
|
+
usageSummaryId: number | null;
|
|
117
|
+
feature: string;
|
|
118
|
+
country: string | null;
|
|
119
|
+
regime: string | null;
|
|
120
|
+
billingPeriod: string;
|
|
121
|
+
/** What was billed, e.g. a compliance transaction. */
|
|
122
|
+
resourceType: string | null;
|
|
123
|
+
resourceId: number | null;
|
|
124
|
+
stripeUsageRecordId: string | null;
|
|
125
|
+
stripeReportedAt: string | null;
|
|
126
|
+
createdAt: string | null;
|
|
127
|
+
}
|
|
128
|
+
/**
|
|
129
|
+
* Billed usage of one feature (e.g. `ereporting_transaction`) in one billing
|
|
130
|
+
* period (YYYY-MM) — GET /billing/usage-summaries.
|
|
131
|
+
*/
|
|
132
|
+
declare class UsageSummary {
|
|
133
|
+
readonly id: number;
|
|
134
|
+
readonly companyId: number;
|
|
135
|
+
readonly feature: string;
|
|
136
|
+
readonly country: string | null;
|
|
137
|
+
readonly regime: string | null;
|
|
138
|
+
/** Billing period, YYYY-MM. */
|
|
139
|
+
readonly billingPeriod: string;
|
|
140
|
+
readonly eventCount: number;
|
|
141
|
+
/** Precision-safe decimal string as returned by the API (e.g. "49.00"); null until priced. */
|
|
142
|
+
readonly billableAmount: string | null;
|
|
143
|
+
/** e.g. "open"; free-form so new states don't break parsing. */
|
|
144
|
+
readonly state: string | null;
|
|
145
|
+
readonly stateLabel: string | null;
|
|
146
|
+
readonly periodClosedAt: string | null;
|
|
147
|
+
readonly billingTriggeredAt: string | null;
|
|
148
|
+
readonly billedAt: string | null;
|
|
149
|
+
readonly stripeInvoiceId: string | null;
|
|
150
|
+
readonly stripeSubscriptionItemId: string | null;
|
|
151
|
+
readonly billingNotes: string | null;
|
|
152
|
+
/** The period's usage events — only filled by getUsageSummaries(period); empty in the list. */
|
|
153
|
+
readonly events: UsageEvent[];
|
|
154
|
+
readonly createdAt: string | null;
|
|
155
|
+
readonly updatedAt: string | null;
|
|
156
|
+
constructor(id: number, companyId: number, feature: string, country: string | null, regime: string | null,
|
|
157
|
+
/** Billing period, YYYY-MM. */
|
|
158
|
+
billingPeriod: string, eventCount: number,
|
|
159
|
+
/** Precision-safe decimal string as returned by the API (e.g. "49.00"); null until priced. */
|
|
160
|
+
billableAmount: string | null,
|
|
161
|
+
/** e.g. "open"; free-form so new states don't break parsing. */
|
|
162
|
+
state: string | null, stateLabel: string | null, periodClosedAt: string | null, billingTriggeredAt: string | null, billedAt: string | null, stripeInvoiceId: string | null, stripeSubscriptionItemId: string | null, billingNotes: string | null,
|
|
163
|
+
/** The period's usage events — only filled by getUsageSummaries(period); empty in the list. */
|
|
164
|
+
events: UsageEvent[], createdAt: string | null, updatedAt: string | null);
|
|
165
|
+
static fromArray(data: Record<string, unknown>): UsageSummary;
|
|
166
|
+
}
|
|
167
|
+
/** A paginated page of usage summaries (newest billing period first). */
|
|
168
|
+
declare class UsageSummaryPage implements Iterable<UsageSummary> {
|
|
169
|
+
readonly rows: UsageSummary[];
|
|
170
|
+
readonly currentPage: number;
|
|
171
|
+
readonly perPage: number;
|
|
172
|
+
readonly total: number;
|
|
173
|
+
readonly lastPage: number;
|
|
174
|
+
constructor(rows: UsageSummary[], currentPage: number, perPage: number, total: number, lastPage: number);
|
|
175
|
+
static fromResponse(payload: unknown): UsageSummaryPage;
|
|
176
|
+
[Symbol.iterator](): Iterator<UsageSummary>;
|
|
177
|
+
get length(): number;
|
|
178
|
+
}
|
|
179
|
+
|
|
180
|
+
/**
|
|
181
|
+
* Billing transparency: read-only usage summaries of the company's billable
|
|
182
|
+
* modules (E-Reporting / E-Invoicing, Smart Enrichment). Requires one of those
|
|
183
|
+
* modules on the account (403 otherwise). Every call is a GET, so transient
|
|
184
|
+
* gateway failures are retried (see RetryPolicy).
|
|
185
|
+
*/
|
|
186
|
+
declare class BillingEndpoint {
|
|
187
|
+
private readonly baseUrl;
|
|
188
|
+
private readonly apiKey;
|
|
189
|
+
private readonly tokenStorage;
|
|
190
|
+
private readonly httpClient;
|
|
191
|
+
private readonly retryPolicy;
|
|
192
|
+
constructor(baseUrl: string, apiKey: string, tokenStorage: TokenStorageInterface, httpClient: HttpClientInterface, retryPolicy?: RetryPolicy);
|
|
193
|
+
/** Paginated usage summaries, newest billing period first. `perPage` is clamped to 1-100 server-side. */
|
|
194
|
+
listUsageSummaries(page?: number, perPage?: number): Promise<UsageSummaryPage>;
|
|
195
|
+
/**
|
|
196
|
+
* The usage summaries of one billing period (YYYY-MM), one per feature,
|
|
197
|
+
* each with its usage events. A period without usage yields a 404 (HttpException).
|
|
198
|
+
*/
|
|
199
|
+
getUsageSummaries(period: string): Promise<UsageSummary[]>;
|
|
200
|
+
private buildHeaders;
|
|
201
|
+
/** GET + envelope unwrap (`{success, data}` → data, which may be an object or an array). */
|
|
202
|
+
private getJson;
|
|
203
|
+
}
|
|
204
|
+
|
|
113
205
|
interface CompanyResource {
|
|
114
206
|
id?: number;
|
|
115
207
|
uuid?: string;
|
|
@@ -209,6 +301,81 @@ declare class ComplianceEnrollment {
|
|
|
209
301
|
static fromArray(data: Record<string, unknown>): ComplianceEnrollment;
|
|
210
302
|
}
|
|
211
303
|
|
|
304
|
+
/** One bookable plan of a country offering. Fees are net EUR amounts. */
|
|
305
|
+
interface ComplianceOfferingPlan {
|
|
306
|
+
key: string;
|
|
307
|
+
monthlyFee: number | null;
|
|
308
|
+
setupFee: number | null;
|
|
309
|
+
/** Usage tiers as configured server-side (raw objects). */
|
|
310
|
+
usageTiers: unknown[];
|
|
311
|
+
volumeLimit: unknown;
|
|
312
|
+
/** Contact-only plans cannot be booked via createCheckout(). */
|
|
313
|
+
contactOnly: boolean;
|
|
314
|
+
/** True when createCheckout() can be started for this plan right now. */
|
|
315
|
+
checkoutAvailable: boolean;
|
|
316
|
+
/** Prerequisite of the plan (e.g. `{ country: 'FR', service: 'e_reporting' }`); null when there is none. */
|
|
317
|
+
requires: {
|
|
318
|
+
country: string;
|
|
319
|
+
service: string;
|
|
320
|
+
} | null;
|
|
321
|
+
/** Whether the company meets `requires`. */
|
|
322
|
+
eligible: boolean;
|
|
323
|
+
}
|
|
324
|
+
/** A country offering with the company's current state for it. */
|
|
325
|
+
interface ComplianceOffering {
|
|
326
|
+
/** Upper-case ISO 3166-1 alpha-2 code. */
|
|
327
|
+
country: string;
|
|
328
|
+
/** "e_reporting" or "e_invoicing". */
|
|
329
|
+
service: string;
|
|
330
|
+
currency: string;
|
|
331
|
+
active: boolean;
|
|
332
|
+
/** The plan was bought via Stripe self-service (vs. granted manually). */
|
|
333
|
+
viaStripe: boolean;
|
|
334
|
+
plan: string | null;
|
|
335
|
+
status: string | null;
|
|
336
|
+
enrolled: boolean;
|
|
337
|
+
plans: ComplianceOfferingPlan[];
|
|
338
|
+
}
|
|
339
|
+
/** A country Taxora reaches — bookable self-service or set up on request. */
|
|
340
|
+
interface ComplianceCoverageCountry {
|
|
341
|
+
country: string;
|
|
342
|
+
/** "bookable" or "on_request". */
|
|
343
|
+
availability: string;
|
|
344
|
+
services: string[];
|
|
345
|
+
network: string | null;
|
|
346
|
+
format: string | null;
|
|
347
|
+
mandate: string | null;
|
|
348
|
+
/**
|
|
349
|
+
* "yes", "cross_border_only" (only invoices across the border are reached) or
|
|
350
|
+
* "coming_soon" (not live yet, can be requested). Older API versions send none: "yes".
|
|
351
|
+
*/
|
|
352
|
+
support?: string;
|
|
353
|
+
}
|
|
354
|
+
/**
|
|
355
|
+
* GET /compliance/offerings — bookable compliance plans per country, every
|
|
356
|
+
* reachable country, and which services the company has unlocked.
|
|
357
|
+
*/
|
|
358
|
+
declare class ComplianceOfferings {
|
|
359
|
+
readonly offerings: ComplianceOffering[];
|
|
360
|
+
readonly coverage: ComplianceCoverageCountry[];
|
|
361
|
+
/** Company-wide: is the service unlocked anywhere. */
|
|
362
|
+
readonly access: {
|
|
363
|
+
eReporting: boolean;
|
|
364
|
+
eInvoicing: boolean;
|
|
365
|
+
};
|
|
366
|
+
/** Per country (upper-case code) and service (`e_reporting` / `e_invoicing`). */
|
|
367
|
+
readonly accessByCountry: Record<string, Record<string, boolean>>;
|
|
368
|
+
constructor(offerings: ComplianceOffering[], coverage: ComplianceCoverageCountry[],
|
|
369
|
+
/** Company-wide: is the service unlocked anywhere. */
|
|
370
|
+
access: {
|
|
371
|
+
eReporting: boolean;
|
|
372
|
+
eInvoicing: boolean;
|
|
373
|
+
},
|
|
374
|
+
/** Per country (upper-case code) and service (`e_reporting` / `e_invoicing`). */
|
|
375
|
+
accessByCountry: Record<string, Record<string, boolean>>);
|
|
376
|
+
static fromArray(data: Record<string, unknown>): ComplianceOfferings;
|
|
377
|
+
}
|
|
378
|
+
|
|
212
379
|
/**
|
|
213
380
|
* A paginated page of compliance enrollments (GET /compliance/enrollments).
|
|
214
381
|
*/
|
|
@@ -300,6 +467,8 @@ declare const ComplianceTransactionState: {
|
|
|
300
467
|
readonly SENDING: "sending";
|
|
301
468
|
readonly SUBMITTED: "submitted";
|
|
302
469
|
readonly ERROR: "error";
|
|
470
|
+
/** E-invoicing only: the buyer cannot receive e-invoices — nothing was sent or billed; send your regular invoice. */
|
|
471
|
+
readonly NOT_REQUIRED: "not_required";
|
|
303
472
|
readonly UNKNOWN: "unknown";
|
|
304
473
|
};
|
|
305
474
|
type ComplianceTransactionState = (typeof ComplianceTransactionState)[keyof typeof ComplianceTransactionState];
|
|
@@ -338,6 +507,38 @@ interface ComplianceTransactionInvoiceLine {
|
|
|
338
507
|
unit: number | null;
|
|
339
508
|
taxes: ComplianceTransactionInvoiceLineTax[];
|
|
340
509
|
}
|
|
510
|
+
/** The seller's own invoice PDF attached to an e-invoice (`invoice_pdf`). */
|
|
511
|
+
interface ComplianceTransactionInvoicePdf {
|
|
512
|
+
filename: string | null;
|
|
513
|
+
/** Size in bytes. */
|
|
514
|
+
size: number | null;
|
|
515
|
+
/** True once the PDF was uploaded to the provider together with the e-invoice. */
|
|
516
|
+
attached: boolean;
|
|
517
|
+
}
|
|
518
|
+
/**
|
|
519
|
+
* Non-EUR invoices: the amounts in EUR at the ECB reference rate of the invoice
|
|
520
|
+
* date (or the last published rate before it) — `eur_equivalent`. A reference
|
|
521
|
+
* value for bookkeeping; the invoice itself stays in its own currency. Amounts
|
|
522
|
+
* are decimal strings with two decimals, as returned by the API.
|
|
523
|
+
*/
|
|
524
|
+
interface ComplianceTransactionEurEquivalent {
|
|
525
|
+
subtotal: string;
|
|
526
|
+
taxAmount: string;
|
|
527
|
+
total: string;
|
|
528
|
+
/** Units of the invoice currency per 1 EUR (ECB reference rate), as a decimal string. */
|
|
529
|
+
rate: string;
|
|
530
|
+
/** Date (YYYY-MM-DD) the ECB published the rate used. */
|
|
531
|
+
rateDate: string | null;
|
|
532
|
+
/** Where the rate comes from — currently always "ECB". */
|
|
533
|
+
source: string;
|
|
534
|
+
}
|
|
535
|
+
/**
|
|
536
|
+
* E-invoicing: the Peppol directory answer about the buyer when it held the
|
|
537
|
+
* invoice back (`delivery_check`) — e.g. status `not_reachable` (state
|
|
538
|
+
* `not_required`) or `pending` (retried automatically). Kept as the raw object;
|
|
539
|
+
* its keys may grow.
|
|
540
|
+
*/
|
|
541
|
+
type ComplianceTransactionDeliveryCheck = Record<string, unknown>;
|
|
341
542
|
/**
|
|
342
543
|
* A recorded compliance transaction (GET/POST /compliance/transactions) — an
|
|
343
544
|
* e-reported transaction (France) or an e-invoice / credit note (Norway).
|
|
@@ -396,6 +597,35 @@ declare class ComplianceTransaction {
|
|
|
396
597
|
readonly providerState: string | null;
|
|
397
598
|
/** The stored invoice lines (empty when the server does not include them). */
|
|
398
599
|
readonly invoiceLines: ComplianceTransactionInvoiceLine[];
|
|
600
|
+
/**
|
|
601
|
+
* E-invoicing: URL of the legal e-invoice document once it was sent; null
|
|
602
|
+
* until then. Download it with `eReporting.getTransactionDocument(id)`.
|
|
603
|
+
*/
|
|
604
|
+
readonly documentUrl: string | null;
|
|
605
|
+
/** E-invoicing: Peppol directory answer when the buyer check held the invoice back; null otherwise. */
|
|
606
|
+
readonly deliveryCheck: ComplianceTransactionDeliveryCheck | null;
|
|
607
|
+
/** E-invoicing: the attached seller PDF, or null when none is attached. */
|
|
608
|
+
readonly invoicePdf: ComplianceTransactionInvoicePdf | null;
|
|
609
|
+
/**
|
|
610
|
+
* The customer's own reference (order number, ERP id) for searching; never
|
|
611
|
+
* sent to the buyer or the tax authority. Null when not set.
|
|
612
|
+
*/
|
|
613
|
+
readonly internalReference: string | null;
|
|
614
|
+
/**
|
|
615
|
+
* URL of the invoice as a readable PDF (the attached seller PDF or the
|
|
616
|
+
* provider's rendering of the e-invoice); null when no PDF is available.
|
|
617
|
+
* Download it with `eReporting.getTransactionPdf(id)`.
|
|
618
|
+
*/
|
|
619
|
+
readonly pdfUrl: string | null;
|
|
620
|
+
/** E-invoicing: the buyer refused the invoice (provider state `refused`) — correct it with a credit note. */
|
|
621
|
+
readonly buyerRejected: boolean;
|
|
622
|
+
/** E-invoicing: the buyer's reason for the rejection, when given. */
|
|
623
|
+
readonly rejectionReason: string | null;
|
|
624
|
+
/**
|
|
625
|
+
* Non-EUR invoices: the amounts in EUR at the ECB reference rate of the
|
|
626
|
+
* invoice date. Null for EUR invoices or when no rate is known.
|
|
627
|
+
*/
|
|
628
|
+
readonly eurEquivalent: ComplianceTransactionEurEquivalent | null;
|
|
399
629
|
constructor(id: number, companyId: number, complianceEnrollmentId: number, country: string, regime: string, transactionType: ComplianceTransactionType, transactionTypeLabel: string, state: ComplianceTransactionState, stateLabel: string, invoiceNumber: string,
|
|
400
630
|
/** Invoice date (YYYY-MM-DD). */
|
|
401
631
|
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,
|
|
@@ -416,7 +646,36 @@ declare class ComplianceTransaction {
|
|
|
416
646
|
*/
|
|
417
647
|
providerState?: string | null,
|
|
418
648
|
/** The stored invoice lines (empty when the server does not include them). */
|
|
419
|
-
invoiceLines?: ComplianceTransactionInvoiceLine[]
|
|
649
|
+
invoiceLines?: ComplianceTransactionInvoiceLine[],
|
|
650
|
+
/**
|
|
651
|
+
* E-invoicing: URL of the legal e-invoice document once it was sent; null
|
|
652
|
+
* until then. Download it with `eReporting.getTransactionDocument(id)`.
|
|
653
|
+
*/
|
|
654
|
+
documentUrl?: string | null,
|
|
655
|
+
/** E-invoicing: Peppol directory answer when the buyer check held the invoice back; null otherwise. */
|
|
656
|
+
deliveryCheck?: ComplianceTransactionDeliveryCheck | null,
|
|
657
|
+
/** E-invoicing: the attached seller PDF, or null when none is attached. */
|
|
658
|
+
invoicePdf?: ComplianceTransactionInvoicePdf | null,
|
|
659
|
+
/**
|
|
660
|
+
* The customer's own reference (order number, ERP id) for searching; never
|
|
661
|
+
* sent to the buyer or the tax authority. Null when not set.
|
|
662
|
+
*/
|
|
663
|
+
internalReference?: string | null,
|
|
664
|
+
/**
|
|
665
|
+
* URL of the invoice as a readable PDF (the attached seller PDF or the
|
|
666
|
+
* provider's rendering of the e-invoice); null when no PDF is available.
|
|
667
|
+
* Download it with `eReporting.getTransactionPdf(id)`.
|
|
668
|
+
*/
|
|
669
|
+
pdfUrl?: string | null,
|
|
670
|
+
/** E-invoicing: the buyer refused the invoice (provider state `refused`) — correct it with a credit note. */
|
|
671
|
+
buyerRejected?: boolean,
|
|
672
|
+
/** E-invoicing: the buyer's reason for the rejection, when given. */
|
|
673
|
+
rejectionReason?: string | null,
|
|
674
|
+
/**
|
|
675
|
+
* Non-EUR invoices: the amounts in EUR at the ECB reference rate of the
|
|
676
|
+
* invoice date. Null for EUR invoices or when no rate is known.
|
|
677
|
+
*/
|
|
678
|
+
eurEquivalent?: ComplianceTransactionEurEquivalent | null);
|
|
420
679
|
get isCreditNote(): boolean;
|
|
421
680
|
static fromArray(data: Record<string, unknown>): ComplianceTransaction;
|
|
422
681
|
}
|
|
@@ -653,6 +912,12 @@ declare class VatRates {
|
|
|
653
912
|
static fromArray(data: Record<string, unknown>): VatRates;
|
|
654
913
|
}
|
|
655
914
|
|
|
915
|
+
declare const Language: {
|
|
916
|
+
readonly ENGLISH: "en";
|
|
917
|
+
readonly GERMAN: "de";
|
|
918
|
+
};
|
|
919
|
+
type Language = (typeof Language)[keyof typeof Language];
|
|
920
|
+
|
|
656
921
|
/** Time-series bucket size accepted by the revenue statistics endpoint. */
|
|
657
922
|
type EReportingInterval = 'day' | 'week' | 'month';
|
|
658
923
|
/** Enterprise size categories accepted by the DGFiP enrollment. */
|
|
@@ -674,6 +939,70 @@ interface RevenueStatisticsFilters {
|
|
|
674
939
|
interval?: EReportingInterval;
|
|
675
940
|
transactionType?: ComplianceTransactionRequestType;
|
|
676
941
|
state?: ComplianceTransactionRequestState;
|
|
942
|
+
/** Only this enrollment's transactions — one country's figures (e.g. France or Norway). */
|
|
943
|
+
complianceEnrollmentId?: number;
|
|
944
|
+
}
|
|
945
|
+
/** Filters for exportRevenueTaxRatesCsv() — the revenue statistics filters without `interval`. */
|
|
946
|
+
type RevenueTaxRatesCsvFilters = Omit<RevenueStatisticsFilters, 'interval'>;
|
|
947
|
+
/** A transaction download: the legal e-invoice document (getTransactionDocument()) or the invoice PDF (getTransactionPdf()). */
|
|
948
|
+
interface ComplianceTransactionDocument {
|
|
949
|
+
/** Raw bytes as delivered by the network (e.g. the EHF/UBL XML). */
|
|
950
|
+
content: Uint8Array;
|
|
951
|
+
/** Content-Type header of the download, e.g. "application/xml". */
|
|
952
|
+
contentType: string;
|
|
953
|
+
/** Filename from Content-Disposition; null when the header is missing. */
|
|
954
|
+
filename: string | null;
|
|
955
|
+
}
|
|
956
|
+
/** createCheckout() result: open `url` in the browser to pay via Stripe Checkout. */
|
|
957
|
+
interface ComplianceCheckoutSession {
|
|
958
|
+
id: string;
|
|
959
|
+
url: string;
|
|
960
|
+
}
|
|
961
|
+
/** Digest email schedule: daily at 08:00 for the day before, weekly on Mondays for the last 7 days. */
|
|
962
|
+
type ComplianceNotificationDigest = 'off' | 'daily' | 'weekly';
|
|
963
|
+
/** getNotificationSettings() / updateNotificationSettings() result: the company's opt-in compliance emails. */
|
|
964
|
+
interface ComplianceNotificationSettings {
|
|
965
|
+
/** Up to 5 email addresses (lower-cased by the server). */
|
|
966
|
+
recipients: string[];
|
|
967
|
+
/** Language of the emails. */
|
|
968
|
+
language: Language;
|
|
969
|
+
/** Email (at most hourly) listing new invoices held back because the buyer is not on Peppol. */
|
|
970
|
+
notOnPeppol: boolean;
|
|
971
|
+
digest: ComplianceNotificationDigest;
|
|
972
|
+
/** ISO 8601 timestamp of the last digest sent; null when none was sent yet. */
|
|
973
|
+
digestSentAt: string | null;
|
|
974
|
+
}
|
|
975
|
+
/** updateNotificationSettings() input: only the provided fields change (at least one is required). */
|
|
976
|
+
interface UpdateComplianceNotificationSettingsInput {
|
|
977
|
+
/** Replaces the whole list (max 5 addresses); `[]` clears it. */
|
|
978
|
+
recipients?: string[];
|
|
979
|
+
language?: Language;
|
|
980
|
+
notOnPeppol?: boolean;
|
|
981
|
+
digest?: ComplianceNotificationDigest;
|
|
982
|
+
}
|
|
983
|
+
/** confirmCheckout() result: the plan state after the checkout. */
|
|
984
|
+
interface ComplianceCheckoutConfirmation {
|
|
985
|
+
active: boolean;
|
|
986
|
+
country: string | null;
|
|
987
|
+
service: string | null;
|
|
988
|
+
plan: string | null;
|
|
989
|
+
status: string | null;
|
|
990
|
+
}
|
|
991
|
+
/**
|
|
992
|
+
* The seller's own invoice PDF: raw bytes (Uint8Array — a Node Buffer works —
|
|
993
|
+
* or ArrayBuffer), base64-encoded by the SDK; or a string that is already
|
|
994
|
+
* base64 (a `data:application/pdf;base64,` prefix is accepted).
|
|
995
|
+
*/
|
|
996
|
+
type ComplianceInvoicePdfInput = Uint8Array | ArrayBuffer | string;
|
|
997
|
+
/**
|
|
998
|
+
* E-invoicing only: attach your own invoice PDF as the e-invoice's visual
|
|
999
|
+
* representation (max 10 MB). The structured e-invoice stays the legal
|
|
1000
|
+
* document. Rejected with 422 when the country is not booked as e-invoicing.
|
|
1001
|
+
*/
|
|
1002
|
+
interface ComplianceInvoicePdfFields {
|
|
1003
|
+
invoicePdf?: ComplianceInvoicePdfInput;
|
|
1004
|
+
/** Filename for the PDF (max 120 chars); defaults server-side to the invoice number. */
|
|
1005
|
+
invoicePdfFilename?: string;
|
|
677
1006
|
}
|
|
678
1007
|
/**
|
|
679
1008
|
* France (DGFiP e-reporting) enrollment — the original createEnrollment() input.
|
|
@@ -792,7 +1121,7 @@ interface ComplianceTransactionBuyerInput {
|
|
|
792
1121
|
/** Free-text note printed on the invoice (max 1000 chars). */
|
|
793
1122
|
extraInfo?: string;
|
|
794
1123
|
}
|
|
795
|
-
interface CreateComplianceTransactionInput extends ComplianceTransactionBuyerInput {
|
|
1124
|
+
interface CreateComplianceTransactionInput extends ComplianceTransactionBuyerInput, ComplianceInvoicePdfFields {
|
|
796
1125
|
complianceEnrollmentId: number;
|
|
797
1126
|
transactionType: ComplianceTransactionRequestType;
|
|
798
1127
|
invoiceNumber: string;
|
|
@@ -816,10 +1145,15 @@ interface CreateComplianceTransactionInput extends ComplianceTransactionBuyerInp
|
|
|
816
1145
|
remittanceInformation?: string;
|
|
817
1146
|
paymentMethodText?: string;
|
|
818
1147
|
paymentTerms?: string;
|
|
1148
|
+
/**
|
|
1149
|
+
* Your own reference (order number, ERP id), max 100 chars. Stored for your search
|
|
1150
|
+
* only — never sent to the buyer or the tax authority.
|
|
1151
|
+
*/
|
|
1152
|
+
internalReference?: string;
|
|
819
1153
|
/** When false, the transaction is only recorded — submission is deferred. Defaults to true server-side. */
|
|
820
1154
|
submitNow?: boolean;
|
|
821
1155
|
}
|
|
822
|
-
interface UpdateComplianceTransactionInput extends ComplianceTransactionBuyerInput {
|
|
1156
|
+
interface UpdateComplianceTransactionInput extends ComplianceTransactionBuyerInput, ComplianceInvoicePdfFields {
|
|
823
1157
|
transactionType?: ComplianceTransactionRequestType;
|
|
824
1158
|
invoiceNumber?: string;
|
|
825
1159
|
invoiceDate?: Date | string;
|
|
@@ -840,6 +1174,11 @@ interface UpdateComplianceTransactionInput extends ComplianceTransactionBuyerInp
|
|
|
840
1174
|
remittanceInformation?: string;
|
|
841
1175
|
paymentMethodText?: string;
|
|
842
1176
|
paymentTerms?: string;
|
|
1177
|
+
/**
|
|
1178
|
+
* Your own reference (order number, ERP id), max 100 chars. Stored for your search
|
|
1179
|
+
* only — never sent to the buyer or the tax authority. An empty string clears it.
|
|
1180
|
+
*/
|
|
1181
|
+
internalReference?: string;
|
|
843
1182
|
}
|
|
844
1183
|
interface ComplianceTransactionFilters {
|
|
845
1184
|
/** Inclusive lower bound on the invoice date (Date or strict YYYY-MM-DD). */
|
|
@@ -852,10 +1191,18 @@ interface ComplianceTransactionFilters {
|
|
|
852
1191
|
complianceEnrollmentId?: number;
|
|
853
1192
|
/** Only transactions of this country (2-char ISO 3166-1 alpha-2). */
|
|
854
1193
|
country?: string;
|
|
1194
|
+
/** Contains-match over invoice number, internal reference and buyer name (max 100 chars). */
|
|
1195
|
+
search?: string;
|
|
1196
|
+
/** Exact match on the internal reference (max 100 chars). */
|
|
1197
|
+
internalReference?: string;
|
|
1198
|
+
/** Provider delivery state (lowercase letters/underscore, max 30), e.g. `refused` = rejected by the buyer. */
|
|
1199
|
+
providerState?: string;
|
|
855
1200
|
page?: number;
|
|
856
1201
|
/** Page size (1-100, default 25 server-side). */
|
|
857
1202
|
perPage?: number;
|
|
858
1203
|
}
|
|
1204
|
+
/** Filters for exportTransactionsCsv() — the transaction list filters without pagination. */
|
|
1205
|
+
type ComplianceTransactionExportFilters = Omit<ComplianceTransactionFilters, 'page' | 'perPage'>;
|
|
859
1206
|
interface EReportingAccessRequestInput {
|
|
860
1207
|
name?: string;
|
|
861
1208
|
email?: string;
|
|
@@ -883,6 +1230,8 @@ interface EReportingAccessRequestInput {
|
|
|
883
1230
|
*
|
|
884
1231
|
* Each country/service is unlocked (and billed) separately; enrolling for a
|
|
885
1232
|
* service the company does not have yields a 403 with code `service_not_active`.
|
|
1233
|
+
* Write requests (create/update/delete/submit/import) by a user whose only role
|
|
1234
|
+
* is read-only yield a 403 (HttpException) with body code `read_only_role`.
|
|
886
1235
|
* All routes except requestEReportingAccess() require compliance access on the
|
|
887
1236
|
* account.
|
|
888
1237
|
*/
|
|
@@ -967,8 +1316,21 @@ declare class EReportingEndpoint {
|
|
|
967
1316
|
* On provider failure the API responds 502 (mapped to an HttpException).
|
|
968
1317
|
*/
|
|
969
1318
|
createTransaction(input: CreateComplianceTransactionInput): Promise<ComplianceTransaction>;
|
|
970
|
-
/** Paginated list of the company's transactions (newest invoice date first), filterable by date / state / type / enrollment / country. */
|
|
1319
|
+
/** Paginated list of the company's transactions (newest invoice date first), filterable by date / state / type / enrollment / country / search / internal reference / provider state. */
|
|
971
1320
|
listTransactions(filters?: ComplianceTransactionFilters): Promise<ComplianceTransactionPage>;
|
|
1321
|
+
/**
|
|
1322
|
+
* All transactions matching the filters as raw CSV for bookkeeping
|
|
1323
|
+
* (semicolon-separated) — the same filters as listTransactions() without
|
|
1324
|
+
* pagination. Columns: invoice_number, internal_reference, invoice_date,
|
|
1325
|
+
* due_date, country, transaction_type, document_type, state, delivery_state,
|
|
1326
|
+
* buyer_rejected, rejection_reason, counterparty_name, counterparty_country,
|
|
1327
|
+
* counterparty_vat_number, currency, subtotal, tax_amount, total, eur_rate,
|
|
1328
|
+
* eur_rate_date, eur_subtotal, eur_tax_amount, eur_total, provider_invoice_id,
|
|
1329
|
+
* created_at. The eur_* columns hold the ECB reference conversion for non-EUR
|
|
1330
|
+
* invoices (empty for EUR). Max 50,000 rows server-side. The body is returned
|
|
1331
|
+
* verbatim, a UTF-8 BOM included when the API sends one.
|
|
1332
|
+
*/
|
|
1333
|
+
exportTransactionsCsv(filters?: ComplianceTransactionExportFilters): Promise<string>;
|
|
972
1334
|
/** Get a single transaction by id (includes its tax report when one exists). */
|
|
973
1335
|
getTransaction(id: number): Promise<ComplianceTransaction>;
|
|
974
1336
|
/** Update a still-pending transaction. Only the provided fields are sent; already-submitted transactions are rejected with 422. */
|
|
@@ -986,6 +1348,25 @@ declare class EReportingEndpoint {
|
|
|
986
1348
|
* already-submitted transactions are rejected with 422.
|
|
987
1349
|
*/
|
|
988
1350
|
submitTransaction(id: number): Promise<ComplianceTransaction>;
|
|
1351
|
+
/**
|
|
1352
|
+
* Download the legal e-invoice document of a sent transaction (e-invoicing,
|
|
1353
|
+
* e.g. the EHF/UBL XML for Norway). Available once `documentUrl` on the
|
|
1354
|
+
* transaction is set.
|
|
1355
|
+
*
|
|
1356
|
+
* Errors: 404 (HttpException) for an unknown transaction; 409 (HttpException)
|
|
1357
|
+
* when no document exists (yet) — e.g. e-reporting, not sent, or the network
|
|
1358
|
+
* has not produced it yet (try again in a few minutes); 502 on provider failure.
|
|
1359
|
+
*/
|
|
1360
|
+
getTransactionDocument(id: number): Promise<ComplianceTransactionDocument>;
|
|
1361
|
+
/**
|
|
1362
|
+
* Download the invoice as a readable PDF — the seller's attached PDF, or the
|
|
1363
|
+
* provider's rendering of the e-invoice. Available once `pdfUrl` on the
|
|
1364
|
+
* transaction is set.
|
|
1365
|
+
*
|
|
1366
|
+
* Errors: 404 (HttpException) for an unknown transaction; 409 (HttpException)
|
|
1367
|
+
* when no PDF exists (yet); 502 on provider failure.
|
|
1368
|
+
*/
|
|
1369
|
+
getTransactionPdf(id: number): Promise<ComplianceTransactionDocument>;
|
|
989
1370
|
/**
|
|
990
1371
|
* Bulk-import transactions from a semicolon-separated CSV (one row per invoice
|
|
991
1372
|
* line; rows sharing an invoice_number are grouped into one transaction).
|
|
@@ -1003,14 +1384,25 @@ declare class EReportingEndpoint {
|
|
|
1003
1384
|
* months and a monthly interval.
|
|
1004
1385
|
*/
|
|
1005
1386
|
getRevenueStatistics(filters?: RevenueStatisticsFilters): Promise<RevenueStatistics>;
|
|
1387
|
+
/**
|
|
1388
|
+
* Net and VAT per month, currency and tax rate as raw CSV (semicolon-separated,
|
|
1389
|
+
* computed from the invoice lines) — for reconciling the reported figures with
|
|
1390
|
+
* your VAT return. Same filters as getRevenueStatistics() (without
|
|
1391
|
+
* `interval`); defaults to the last 12 months. The body is returned verbatim,
|
|
1392
|
+
* a UTF-8 BOM included when the API sends one.
|
|
1393
|
+
*/
|
|
1394
|
+
exportRevenueTaxRatesCsv(filters?: RevenueTaxRatesCsvFilters): Promise<string>;
|
|
1006
1395
|
/**
|
|
1007
1396
|
* The canonical VAT rates & DGFiP tax categories for a reporting country
|
|
1008
1397
|
* (the seller's reporting-country rates, not the counterparty's). Falls back
|
|
1009
1398
|
* to the configured default country (FR) when none/unknown is given.
|
|
1010
1399
|
*/
|
|
1011
1400
|
getVatRates(country?: string): Promise<VatRates>;
|
|
1012
|
-
/**
|
|
1013
|
-
|
|
1401
|
+
/**
|
|
1402
|
+
* Paginated list of the company's tax reports (newest first), optionally
|
|
1403
|
+
* filtered by state and by country (2-letter ISO code, case-insensitive).
|
|
1404
|
+
*/
|
|
1405
|
+
listTaxReports(page?: number, perPage?: number, state?: ComplianceTaxReportRequestState, country?: string): Promise<ComplianceTaxReportPage>;
|
|
1014
1406
|
/** Get a single tax report by id. */
|
|
1015
1407
|
getTaxReport(id: number): Promise<ComplianceTaxReport>;
|
|
1016
1408
|
/**
|
|
@@ -1023,6 +1415,48 @@ declare class EReportingEndpoint {
|
|
|
1023
1415
|
* returned as HTTP 400 (surfaced as HttpException), not 422.
|
|
1024
1416
|
*/
|
|
1025
1417
|
requestEReportingAccess(input?: EReportingAccessRequestInput): Promise<void>;
|
|
1418
|
+
/**
|
|
1419
|
+
* Bookable compliance plans per country (net EUR prices), every country
|
|
1420
|
+
* Taxora reaches, and which services the company has unlocked. Works for
|
|
1421
|
+
* companies without compliance access.
|
|
1422
|
+
*/
|
|
1423
|
+
getOfferings(): Promise<ComplianceOfferings>;
|
|
1424
|
+
/**
|
|
1425
|
+
* Start a Stripe Checkout for a plan (see getOfferings() — `checkoutAvailable`).
|
|
1426
|
+
* Open the returned `url` in the browser. After payment Stripe redirects to
|
|
1427
|
+
* the Taxora portal, which activates the plan; call confirmCheckout() with the
|
|
1428
|
+
* session id to activate it from your side (idempotent).
|
|
1429
|
+
*
|
|
1430
|
+
* Errors: 422 (ValidationException) for an unknown or contact-only plan or a
|
|
1431
|
+
* plan that is already active; 502 (HttpException) on a Stripe error.
|
|
1432
|
+
*/
|
|
1433
|
+
createCheckout(country: string, plan: string): Promise<ComplianceCheckoutSession>;
|
|
1434
|
+
/** Confirm a finished Stripe Checkout and activate its plan. Idempotent. */
|
|
1435
|
+
confirmCheckout(sessionId: string): Promise<ComplianceCheckoutConfirmation>;
|
|
1436
|
+
/**
|
|
1437
|
+
* URL of the Stripe billing portal for the company's compliance plans
|
|
1438
|
+
* (invoices, payment method, cancellation). The portal returns to the Taxora
|
|
1439
|
+
* portal. 404 (HttpException) when no plan was bought via Stripe.
|
|
1440
|
+
*/
|
|
1441
|
+
createBillingPortalSession(): Promise<string>;
|
|
1442
|
+
/**
|
|
1443
|
+
* The company's opt-in e-reporting / e-invoicing emails: recipients, language,
|
|
1444
|
+
* the "buyer not on Peppol" email and the digest. Readable by every member.
|
|
1445
|
+
*/
|
|
1446
|
+
getNotificationSettings(): Promise<ComplianceNotificationSettings>;
|
|
1447
|
+
/**
|
|
1448
|
+
* Change the company's e-reporting / e-invoicing emails; only the provided
|
|
1449
|
+
* fields change. `notOnPeppol` only reports invoices held back after it was
|
|
1450
|
+
* switched on.
|
|
1451
|
+
*
|
|
1452
|
+
* Errors: 422 (ValidationException) when an email is switched on without any
|
|
1453
|
+
* recipient; 403 (HttpException, body code `admin_only` or `read_only_role`)
|
|
1454
|
+
* for users who are not company admins.
|
|
1455
|
+
*/
|
|
1456
|
+
updateNotificationSettings(input: UpdateComplianceNotificationSettingsInput): Promise<ComplianceNotificationSettings>;
|
|
1457
|
+
private toNotificationSettings;
|
|
1458
|
+
/** Validated transaction-list filters as query params (shared by listTransactions and exportTransactionsCsv). */
|
|
1459
|
+
private buildTransactionFilterParams;
|
|
1026
1460
|
private validateEnrollmentInput;
|
|
1027
1461
|
private isNorwayEnrollmentInput;
|
|
1028
1462
|
/** Validates the Norway input and builds its wire body (org number normalized to 9 digits). */
|
|
@@ -1036,6 +1470,8 @@ declare class EReportingEndpoint {
|
|
|
1036
1470
|
private validateTransactionType;
|
|
1037
1471
|
private validateInvoiceNumber;
|
|
1038
1472
|
private validateInvoiceLines;
|
|
1473
|
+
private validateInvoicePdfFilename;
|
|
1474
|
+
private validateInternalReference;
|
|
1039
1475
|
private validateOptionalCodes;
|
|
1040
1476
|
/**
|
|
1041
1477
|
* Format checks for the buyer/document fields. Country rules (e.g. the Norway
|
|
@@ -1046,8 +1482,14 @@ declare class EReportingEndpoint {
|
|
|
1046
1482
|
private buildInvoiceLines;
|
|
1047
1483
|
/** Applies the optional scalar fields shared by create and update. */
|
|
1048
1484
|
private applyOptionalTransactionFields;
|
|
1485
|
+
/** Bytes → base64 (validated as a PDF of at most 10 MB); strings are taken as already base64. */
|
|
1486
|
+
private encodeInvoicePdf;
|
|
1049
1487
|
private buildHeaders;
|
|
1050
1488
|
private sendRequest;
|
|
1489
|
+
/** GET for a non-JSON download (CSV / document): no JSON Content-Type, retried like other GETs. */
|
|
1490
|
+
private sendDownloadRequest;
|
|
1491
|
+
/** `attachment; filename="x.xml"` (or RFC 5987 `filename*=UTF-8''x.xml`) → "x.xml". */
|
|
1492
|
+
private filenameFromDisposition;
|
|
1051
1493
|
/** Multipart upload: Content-Type is left to fetch so the boundary is set correctly. */
|
|
1052
1494
|
private sendMultipartRequest;
|
|
1053
1495
|
/** Accepts any 2xx response (e.g. 201 on create, 200 on idempotent replay). */
|
|
@@ -1092,6 +1534,63 @@ type SmartEnrichmentMode = (typeof SmartEnrichmentMode)[keyof typeof SmartEnrich
|
|
|
1092
1534
|
declare function toSmartEnrichmentMode(value: unknown): SmartEnrichmentMode | undefined;
|
|
1093
1535
|
declare function describeSmartEnrichmentMode(mode: SmartEnrichmentMode): string;
|
|
1094
1536
|
|
|
1537
|
+
/** Why a row was left out of a recheck. */
|
|
1538
|
+
type SmartEnrichmentRecheckSkipReason = 'resolved' | 'no_vat_exists' | 'limit_reached' | 'cooldown' | 'running' | 'pending';
|
|
1539
|
+
type SmartEnrichmentRecheckRunState = 'queued' | 'running' | 'finished' | 'failed';
|
|
1540
|
+
interface SmartEnrichmentRecheckRun {
|
|
1541
|
+
state: SmartEnrichmentRecheckRunState;
|
|
1542
|
+
/** Set once a finished recheck found a usable number (`true`) or did not (`false`). */
|
|
1543
|
+
resolved?: boolean;
|
|
1544
|
+
}
|
|
1545
|
+
interface SmartEnrichmentRecheckOptions {
|
|
1546
|
+
/** 0-based row indexes of the lookup; omit to recheck every row that qualifies. */
|
|
1547
|
+
rows?: number[];
|
|
1548
|
+
/** Only report which rows would run and what they cost — nothing is started. */
|
|
1549
|
+
dryRun?: boolean;
|
|
1550
|
+
}
|
|
1551
|
+
/**
|
|
1552
|
+
* What a recheck started (or, for a dry run, would start) and what it costs. Every recheck counts
|
|
1553
|
+
* as a check like a new lookup (Deep Verify ×2), whether a VAT number is found or not.
|
|
1554
|
+
*/
|
|
1555
|
+
declare class SmartEnrichmentRecheck {
|
|
1556
|
+
readonly jobId: string;
|
|
1557
|
+
/** Row indexes that are (or would be) rechecked. */
|
|
1558
|
+
readonly rows: number[];
|
|
1559
|
+
/** Checks these rechecks use. */
|
|
1560
|
+
readonly checks: number;
|
|
1561
|
+
/** Rows left out, by reason. */
|
|
1562
|
+
readonly skipped: Partial<Record<SmartEnrichmentRecheckSkipReason, number>>;
|
|
1563
|
+
readonly dryRun: boolean;
|
|
1564
|
+
constructor(jobId: string,
|
|
1565
|
+
/** Row indexes that are (or would be) rechecked. */
|
|
1566
|
+
rows: number[],
|
|
1567
|
+
/** Checks these rechecks use. */
|
|
1568
|
+
checks: number,
|
|
1569
|
+
/** Rows left out, by reason. */
|
|
1570
|
+
skipped: Partial<Record<SmartEnrichmentRecheckSkipReason, number>>, dryRun: boolean);
|
|
1571
|
+
static fromArray(data: Record<string, unknown>): SmartEnrichmentRecheck;
|
|
1572
|
+
}
|
|
1573
|
+
/**
|
|
1574
|
+
* "Check again" state of a lookup, as `smartEnrichment.get()` reports it: the rows that can be
|
|
1575
|
+
* rechecked right now, the rechecks of the last week, and the limits behind both.
|
|
1576
|
+
*/
|
|
1577
|
+
declare class SmartEnrichmentRecheckState {
|
|
1578
|
+
/** Row indexes that can be rechecked now. */
|
|
1579
|
+
readonly eligible: number[];
|
|
1580
|
+
/** Rechecks of the last week, by row index. */
|
|
1581
|
+
readonly runs: Record<number, SmartEnrichmentRecheckRun>;
|
|
1582
|
+
readonly maxPerRow: number;
|
|
1583
|
+
readonly cooldownDays: number;
|
|
1584
|
+
constructor(
|
|
1585
|
+
/** Row indexes that can be rechecked now. */
|
|
1586
|
+
eligible: number[],
|
|
1587
|
+
/** Rechecks of the last week, by row index. */
|
|
1588
|
+
runs: Record<number, SmartEnrichmentRecheckRun>, maxPerRow: number, cooldownDays: number);
|
|
1589
|
+
static fromArray(data: Record<string, unknown>): SmartEnrichmentRecheckState;
|
|
1590
|
+
/** True while any recheck of this lookup is queued or running. */
|
|
1591
|
+
isActive(): boolean;
|
|
1592
|
+
}
|
|
1593
|
+
|
|
1095
1594
|
/**
|
|
1096
1595
|
* Why a VAT number the research DID find was not returned as the result.
|
|
1097
1596
|
*
|
|
@@ -1251,6 +1750,10 @@ declare class SmartEnrichmentResource {
|
|
|
1251
1750
|
* or 'company_website' (published by the company itself, not officially confirmable).
|
|
1252
1751
|
*/
|
|
1253
1752
|
readonly taxNumberSource: SmartEnrichmentTaxNumberSource | undefined;
|
|
1753
|
+
/** How often this row was checked again (`smartEnrichment.recheck()`); undefined when never. */
|
|
1754
|
+
readonly recheckCount: number | undefined;
|
|
1755
|
+
/** When it was last checked again (ISO 8601). */
|
|
1756
|
+
readonly lastRecheckedAt: string | undefined;
|
|
1254
1757
|
constructor(status: SmartEnrichmentStatus, vatNumber: string | undefined, vatType: string | undefined, confidence: number | undefined, matchedCompanyName: string | undefined,
|
|
1255
1758
|
/** Official/registered address of the matched company, when available. */
|
|
1256
1759
|
matchedAddress: string | undefined, country: string | undefined, source: string | undefined,
|
|
@@ -1314,7 +1817,11 @@ declare class SmartEnrichmentResource {
|
|
|
1314
1817
|
* Where `taxNumber` comes from: 'vat_id' (read off the VAT ID the tax authority confirmed — exact)
|
|
1315
1818
|
* or 'company_website' (published by the company itself, not officially confirmable).
|
|
1316
1819
|
*/
|
|
1317
|
-
taxNumberSource?: SmartEnrichmentTaxNumberSource | undefined
|
|
1820
|
+
taxNumberSource?: SmartEnrichmentTaxNumberSource | undefined,
|
|
1821
|
+
/** How often this row was checked again (`smartEnrichment.recheck()`); undefined when never. */
|
|
1822
|
+
recheckCount?: number | undefined,
|
|
1823
|
+
/** When it was last checked again (ISO 8601). */
|
|
1824
|
+
lastRecheckedAt?: string | undefined);
|
|
1318
1825
|
/** True when the register knows the number under a different name than the one requested. */
|
|
1319
1826
|
nameMismatch(): boolean;
|
|
1320
1827
|
/** True when a VAT number was found but rejected by the official check. */
|
|
@@ -1335,7 +1842,11 @@ declare class SmartEnrichmentJob {
|
|
|
1335
1842
|
readonly completedCount: number | undefined;
|
|
1336
1843
|
readonly foundCount: number | undefined;
|
|
1337
1844
|
readonly results: SmartEnrichmentResource[];
|
|
1338
|
-
|
|
1845
|
+
/** Which rows can be checked again and which are being rechecked (undefined on older API versions). */
|
|
1846
|
+
readonly recheck: SmartEnrichmentRecheckState | undefined;
|
|
1847
|
+
constructor(jobId: string, status: SmartEnrichmentStatus, itemCount: number | undefined, completedCount: number | undefined, foundCount: number | undefined, results: SmartEnrichmentResource[],
|
|
1848
|
+
/** Which rows can be checked again and which are being rechecked (undefined on older API versions). */
|
|
1849
|
+
recheck?: SmartEnrichmentRecheckState | undefined);
|
|
1339
1850
|
static fromArray(data: Record<string, unknown>): SmartEnrichmentJob;
|
|
1340
1851
|
isProcessing(): boolean;
|
|
1341
1852
|
/** Convenience for single lookups: the first (or only) result, if any. */
|
|
@@ -1544,6 +2055,21 @@ declare class SmartEnrichmentEndpoint {
|
|
|
1544
2055
|
bulkLookup(items: SmartEnrichmentInput[], mode?: SmartEnrichmentMode): Promise<SmartEnrichmentJob>;
|
|
1545
2056
|
/** Poll a job (single or bulk) by its id. */
|
|
1546
2057
|
get(jobId: string): Promise<SmartEnrichmentJob>;
|
|
2058
|
+
/**
|
|
2059
|
+
* Search again for rows of a finished lookup that have no usable answer (`not_found`, or a
|
|
2060
|
+
* number registered to another company). Without `rows` every row that qualifies is rechecked.
|
|
2061
|
+
*
|
|
2062
|
+
* Every recheck counts as a check like a new lookup (Deep Verify ×2), whether a VAT number is
|
|
2063
|
+
* found or not. A row can be rechecked up to 3 times, with 7 days between two rechecks;
|
|
2064
|
+
* `no_vat_exists` and found rows are never rechecked. Pass `dryRun` to see which rows would run
|
|
2065
|
+
* and what they cost without starting anything. Improved rows arrive via the
|
|
2066
|
+
* `enrichment.updated` webhook; `get(jobId).recheck` shows the progress.
|
|
2067
|
+
*
|
|
2068
|
+
* Throws a ValidationException when nothing can be rechecked, the lookup is still running, or
|
|
2069
|
+
* rechecks are not available (sandbox, flat-fee import), and an HttpException (429) when the
|
|
2070
|
+
* start credit or monthly hard cap does not cover it.
|
|
2071
|
+
*/
|
|
2072
|
+
recheck(jobId: string, options?: SmartEnrichmentRecheckOptions): Promise<SmartEnrichmentRecheck>;
|
|
1547
2073
|
/**
|
|
1548
2074
|
* Poll get(jobId) until the job is no longer processing (completed, failed or resolved).
|
|
1549
2075
|
* Throws a TaxoraException when the job does not finish within `timeoutMs`.
|
|
@@ -1812,12 +2338,6 @@ interface LocalTaxNumberReportOptions {
|
|
|
1812
2338
|
*/
|
|
1813
2339
|
declare function parseLocalTaxNumbersCsv(csv: string): LocalTaxNumberRow[];
|
|
1814
2340
|
|
|
1815
|
-
declare const Language: {
|
|
1816
|
-
readonly ENGLISH: "en";
|
|
1817
|
-
readonly GERMAN: "de";
|
|
1818
|
-
};
|
|
1819
|
-
type Language = (typeof Language)[keyof typeof Language];
|
|
1820
|
-
|
|
1821
2341
|
declare class VatEndpoint {
|
|
1822
2342
|
private readonly baseUrl;
|
|
1823
2343
|
private readonly apiKey;
|
|
@@ -1877,6 +2397,7 @@ declare class TaxoraClient {
|
|
|
1877
2397
|
readonly company: CompanyEndpoint;
|
|
1878
2398
|
readonly smartEnrichment: SmartEnrichmentEndpoint;
|
|
1879
2399
|
readonly eReporting: EReportingEndpoint;
|
|
2400
|
+
readonly billing: BillingEndpoint;
|
|
1880
2401
|
readonly baseUrl: string;
|
|
1881
2402
|
constructor(options: TaxoraClientOptions);
|
|
1882
2403
|
}
|
|
@@ -1957,13 +2478,40 @@ interface ComplianceLedgerWebhookObject {
|
|
|
1957
2478
|
ledger_type: string | null;
|
|
1958
2479
|
ledger_date: string | null;
|
|
1959
2480
|
}
|
|
2481
|
+
/**
|
|
2482
|
+
* `compliance.transaction.state_changed` payload. Sent for every real change of a
|
|
2483
|
+
* transaction — Taxora's own state (submitted, error, not_required) and the
|
|
2484
|
+
* provider's delivery state (accepted, refused, paid, …); never twice for the
|
|
2485
|
+
* same state and never for the transient `sending`.
|
|
2486
|
+
*
|
|
2487
|
+
* The optional fields were added later and are missing on older deliveries.
|
|
2488
|
+
*/
|
|
1960
2489
|
interface ComplianceTransactionWebhookObject {
|
|
1961
2490
|
id: number;
|
|
2491
|
+
/** A ComplianceTransactionState value, e.g. `submitted`, `error`, `not_required`. */
|
|
1962
2492
|
state: string;
|
|
2493
|
+
/** Provider-side delivery state, e.g. `sent`, `accepted`, `refused`, `paid`. */
|
|
1963
2494
|
provider_state: string | null;
|
|
2495
|
+
/** Lowercase ISO 3166-1 alpha-2 code, e.g. `no`. */
|
|
1964
2496
|
country: string | null;
|
|
1965
2497
|
invoice_number: string | null;
|
|
1966
|
-
|
|
2498
|
+
/** Your own reference of the transaction. */
|
|
2499
|
+
internal_reference?: string | null;
|
|
2500
|
+
/** Taxora state before this change. */
|
|
2501
|
+
previous_state?: string | null;
|
|
2502
|
+
/** Provider state before this change. */
|
|
2503
|
+
previous_provider_state?: string | null;
|
|
2504
|
+
/** The buyer refused the e-invoice — issue a credit note. */
|
|
2505
|
+
buyer_rejected?: boolean;
|
|
2506
|
+
/** The buyer's reason for the rejection, when given. */
|
|
2507
|
+
rejection_reason?: string | null;
|
|
2508
|
+
/** Why sending failed (state `error`). */
|
|
2509
|
+
submission_error?: string | null;
|
|
2510
|
+
/** Peppol directory result, e.g. `not_reachable` when the state is `not_required`. */
|
|
2511
|
+
delivery_check?: string | null;
|
|
2512
|
+
}
|
|
2513
|
+
/** True when the buyer refused the e-invoice (false for older deliveries without the field). */
|
|
2514
|
+
declare function isTransactionBuyerRejected(object: ComplianceTransactionWebhookObject): boolean;
|
|
1967
2515
|
/** Raw Smart Enrichment rows — wrap them with `SmartEnrichmentResource.fromArray()` for a typed DTO. */
|
|
1968
2516
|
interface EnrichmentCompletedWebhookObject {
|
|
1969
2517
|
jobId: string;
|
|
@@ -2126,4 +2674,4 @@ declare class AuthRetryHttpClient implements HttpClientInterface {
|
|
|
2126
2674
|
private injectAuthHeader;
|
|
2127
2675
|
}
|
|
2128
2676
|
|
|
2129
|
-
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, type LocalTaxNumberReportOptions, LocalTaxNumberRow, type LocalTaxNumberSummary, 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 SmartEnrichmentOfficialAddress, type SmartEnrichmentOutcomeBreakdown, type SmartEnrichmentProviderVerdict, type SmartEnrichmentRejectedCandidate, SmartEnrichmentRejectionReason, SmartEnrichmentResource, type SmartEnrichmentSourceBreakdown, SmartEnrichmentStatistics, type SmartEnrichmentStatisticsInterval, type SmartEnrichmentStatisticsOptions, type SmartEnrichmentStatisticsRange, type SmartEnrichmentStatisticsTotals, SmartEnrichmentStatus, type SmartEnrichmentTaxNumberSource, 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, describeSmartEnrichmentRejectionReason, describeSmartEnrichmentStatus, describeVatState, generateWebhookSignatureHeader, getBaseUrl, getFailedVatStates, parseLocalTaxNumbersCsv, parseWebhookSignatureHeader, toComplianceDocumentType, toComplianceEnrollmentStatus, toComplianceService, toComplianceTaxReportState, toComplianceTransactionState, toComplianceTransactionType, toPeppolLookupStatus, toSmartEnrichmentMode, toSmartEnrichmentRejectionReason, toSmartEnrichmentStatus, verifyWebhookSignature };
|
|
2677
|
+
export { ApiVersion, AuthEndpoint, AuthRetryHttpClient, AuthenticationException, BillingEndpoint, CompanyAddress, CompanyEndpoint, type CompanyResource, type ComplianceCheckoutConfirmation, type ComplianceCheckoutSession, type ComplianceCoverageCountry, ComplianceDocumentType, ComplianceEnrollment, ComplianceEnrollmentPage, ComplianceEnrollmentStatus, type ComplianceEnterpriseSize, type ComplianceInvoiceLineInput, type ComplianceInvoicePdfFields, type ComplianceInvoicePdfInput, type ComplianceInvoiceTaxInput, type ComplianceLedgerStateChangedEvent, type ComplianceLedgerWebhookObject, type ComplianceNotificationDigest, type ComplianceNotificationSettings, type ComplianceOffering, type ComplianceOfferingPlan, ComplianceOfferings, type ComplianceRequestService, ComplianceService, ComplianceTaxReport, ComplianceTaxReportPage, type ComplianceTaxReportRequestState, ComplianceTaxReportState, ComplianceTransaction, type ComplianceTransactionBuyerInput, type ComplianceTransactionDeliveryCheck, type ComplianceTransactionDocument, type ComplianceTransactionEurEquivalent, type ComplianceTransactionExportFilters, type ComplianceTransactionFilters, type ComplianceTransactionInvoiceLine, type ComplianceTransactionInvoiceLineTax, type ComplianceTransactionInvoicePdf, 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, type LocalTaxNumberReportOptions, LocalTaxNumberRow, type LocalTaxNumberSummary, LoginIdentifier, type NorwayEnrollmentInput, NorwegianOrgNumber, type ParsedWebhookSignatureHeader, PeppolLookupResult, PeppolLookupStatus, ProviderDocument, ProviderDocumentLine, RegistryCompany, RetryPolicy, type RetryPolicyOptions, type RevenueCountryBreakdown, type RevenueCurrencyBreakdown, type RevenueStateBreakdown, RevenueStatistics, type RevenueStatisticsFilters, type RevenueTaxRatesCsvFilters, 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 SmartEnrichmentOfficialAddress, type SmartEnrichmentOutcomeBreakdown, type SmartEnrichmentProviderVerdict, SmartEnrichmentRecheck, type SmartEnrichmentRecheckOptions, type SmartEnrichmentRecheckRun, type SmartEnrichmentRecheckRunState, type SmartEnrichmentRecheckSkipReason, SmartEnrichmentRecheckState, type SmartEnrichmentRejectedCandidate, SmartEnrichmentRejectionReason, SmartEnrichmentResource, type SmartEnrichmentSourceBreakdown, SmartEnrichmentStatistics, type SmartEnrichmentStatisticsInterval, type SmartEnrichmentStatisticsOptions, type SmartEnrichmentStatisticsRange, type SmartEnrichmentStatisticsTotals, SmartEnrichmentStatus, type SmartEnrichmentTaxNumberSource, type SmartEnrichmentTimeBucket, type SmartEnrichmentUsage, type SmartEnrichmentUsageHistoryEntry, type SmartEnrichmentWaitOptions, TaxoraClient, TaxoraClientFactory, type TaxoraClientOptions, TaxoraException, type TaxoraWebhookEvent, type TestWebhookObject, Token, type TokenStorageInterface, type UpdateComplianceNotificationSettingsInput, type UpdateComplianceTransactionInput, type UsageEvent, UsageSummary, UsageSummaryPage, 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, describeSmartEnrichmentRejectionReason, describeSmartEnrichmentStatus, describeVatState, generateWebhookSignatureHeader, getBaseUrl, getFailedVatStates, isTransactionBuyerRejected, parseLocalTaxNumbersCsv, parseWebhookSignatureHeader, toComplianceDocumentType, toComplianceEnrollmentStatus, toComplianceService, toComplianceTaxReportState, toComplianceTransactionState, toComplianceTransactionType, toPeppolLookupStatus, toSmartEnrichmentMode, toSmartEnrichmentRejectionReason, toSmartEnrichmentStatus, verifyWebhookSignature };
|