@taxora/sdk 1.6.0 → 1.7.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 +20 -0
- package/README.md +42 -3
- package/dist/index.cjs +200 -4
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +113 -6
- package/dist/index.d.ts +113 -6
- package/dist/index.js +198 -4
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
package/dist/index.d.cts
CHANGED
|
@@ -1166,6 +1166,8 @@ interface SmartEnrichmentRejectedCandidate {
|
|
|
1166
1166
|
vatNumber: string;
|
|
1167
1167
|
reason: SmartEnrichmentRejectionReason;
|
|
1168
1168
|
}
|
|
1169
|
+
/** Where a Smart Enrichment `taxNumber` comes from. */
|
|
1170
|
+
type SmartEnrichmentTaxNumberSource = 'vat_id' | 'company_website';
|
|
1169
1171
|
/** The registered address the official VAT check returned, field by field. */
|
|
1170
1172
|
interface SmartEnrichmentOfficialAddress {
|
|
1171
1173
|
street?: string;
|
|
@@ -1219,8 +1221,12 @@ declare class SmartEnrichmentResource {
|
|
|
1219
1221
|
*/
|
|
1220
1222
|
readonly sourceUrls: string[];
|
|
1221
1223
|
/**
|
|
1222
|
-
*
|
|
1223
|
-
*
|
|
1224
|
+
* The company's LOCAL tax / business number, national notation without spaces — what domestic
|
|
1225
|
+
* e-invoicing asks for. On `found` it is read off the confirmed VAT ID where that country's VAT ID
|
|
1226
|
+
* contains it (`taxNumberSource` 'vat_id': FR SIREN, IT Partita IVA, ES NIF, PL NIP, BE enterprise
|
|
1227
|
+
* number, DK CVR, PT, RO, CZ IČO, SK DIČ, SE/NO orgnr, FI Y-tunnus, SI, HR OIB, BG EIK, GR AFM).
|
|
1228
|
+
* Otherwise a domestic number the company itself published ('company_website', e.g. a DE/AT
|
|
1229
|
+
* Steuernummer) — that one is not a VAT ID.
|
|
1224
1230
|
*/
|
|
1225
1231
|
readonly taxNumber: string | undefined;
|
|
1226
1232
|
/** Only on `found`: the tax authority's verdict on the number; undefined when no official check ran. */
|
|
@@ -1236,6 +1242,15 @@ declare class SmartEnrichmentResource {
|
|
|
1236
1242
|
readonly officialName: string | undefined;
|
|
1237
1243
|
/** Only on `found`: the registered address, field by field. */
|
|
1238
1244
|
readonly officialAddress: SmartEnrichmentOfficialAddress | undefined;
|
|
1245
|
+
/** What `taxNumber` is, e.g. 'pl_nip', 'fr_siren', 'de_steuernummer'. Undefined when there is none. */
|
|
1246
|
+
readonly taxNumberType: string | undefined;
|
|
1247
|
+
/** The number's name in its country (SIREN, NIP, Steuernummer …), for display. */
|
|
1248
|
+
readonly taxNumberLabel: string | undefined;
|
|
1249
|
+
/**
|
|
1250
|
+
* Where `taxNumber` comes from: 'vat_id' (read off the VAT ID the tax authority confirmed — exact)
|
|
1251
|
+
* or 'company_website' (published by the company itself, not officially confirmable).
|
|
1252
|
+
*/
|
|
1253
|
+
readonly taxNumberSource: SmartEnrichmentTaxNumberSource | undefined;
|
|
1239
1254
|
constructor(status: SmartEnrichmentStatus, vatNumber: string | undefined, vatType: string | undefined, confidence: number | undefined, matchedCompanyName: string | undefined,
|
|
1240
1255
|
/** Official/registered address of the matched company, when available. */
|
|
1241
1256
|
matchedAddress: string | undefined, country: string | undefined, source: string | undefined,
|
|
@@ -1270,8 +1285,12 @@ declare class SmartEnrichmentResource {
|
|
|
1270
1285
|
*/
|
|
1271
1286
|
sourceUrls?: string[],
|
|
1272
1287
|
/**
|
|
1273
|
-
*
|
|
1274
|
-
*
|
|
1288
|
+
* The company's LOCAL tax / business number, national notation without spaces — what domestic
|
|
1289
|
+
* e-invoicing asks for. On `found` it is read off the confirmed VAT ID where that country's VAT ID
|
|
1290
|
+
* contains it (`taxNumberSource` 'vat_id': FR SIREN, IT Partita IVA, ES NIF, PL NIP, BE enterprise
|
|
1291
|
+
* number, DK CVR, PT, RO, CZ IČO, SK DIČ, SE/NO orgnr, FI Y-tunnus, SI, HR OIB, BG EIK, GR AFM).
|
|
1292
|
+
* Otherwise a domestic number the company itself published ('company_website', e.g. a DE/AT
|
|
1293
|
+
* Steuernummer) — that one is not a VAT ID.
|
|
1275
1294
|
*/
|
|
1276
1295
|
taxNumber?: string | undefined,
|
|
1277
1296
|
/** Only on `found`: the tax authority's verdict on the number; undefined when no official check ran. */
|
|
@@ -1286,7 +1305,16 @@ declare class SmartEnrichmentResource {
|
|
|
1286
1305
|
/** Only on `found`: the name the register has the number under. */
|
|
1287
1306
|
officialName?: string | undefined,
|
|
1288
1307
|
/** Only on `found`: the registered address, field by field. */
|
|
1289
|
-
officialAddress?: SmartEnrichmentOfficialAddress | undefined
|
|
1308
|
+
officialAddress?: SmartEnrichmentOfficialAddress | undefined,
|
|
1309
|
+
/** What `taxNumber` is, e.g. 'pl_nip', 'fr_siren', 'de_steuernummer'. Undefined when there is none. */
|
|
1310
|
+
taxNumberType?: string | undefined,
|
|
1311
|
+
/** The number's name in its country (SIREN, NIP, Steuernummer …), for display. */
|
|
1312
|
+
taxNumberLabel?: string | undefined,
|
|
1313
|
+
/**
|
|
1314
|
+
* Where `taxNumber` comes from: 'vat_id' (read off the VAT ID the tax authority confirmed — exact)
|
|
1315
|
+
* or 'company_website' (published by the company itself, not officially confirmable).
|
|
1316
|
+
*/
|
|
1317
|
+
taxNumberSource?: SmartEnrichmentTaxNumberSource | undefined);
|
|
1290
1318
|
/** True when the register knows the number under a different name than the one requested. */
|
|
1291
1319
|
nameMismatch(): boolean;
|
|
1292
1320
|
/** True when a VAT number was found but rejected by the official check. */
|
|
@@ -1718,6 +1746,72 @@ declare class VatValidationAddressInput {
|
|
|
1718
1746
|
toArray(): Record<string, string>;
|
|
1719
1747
|
}
|
|
1720
1748
|
|
|
1749
|
+
/** Columns of the local tax numbers report. */
|
|
1750
|
+
type Column = 'companyName' | 'requestedName' | 'country' | 'vatNumber' | 'vatStatus' | 'taxNumber' | 'taxNumberName' | 'taxNumberSource' | 'source' | 'checkedAt' | 'checkId';
|
|
1751
|
+
/**
|
|
1752
|
+
* One company of the local tax numbers report: every company checked (VAT checks and Smart
|
|
1753
|
+
* Enrichment) once, with its local tax number. Empty cells come back as null.
|
|
1754
|
+
*/
|
|
1755
|
+
declare class LocalTaxNumberRow {
|
|
1756
|
+
readonly companyName: string | null;
|
|
1757
|
+
/** The name you submitted, when it differs from the registered one. */
|
|
1758
|
+
readonly requestedName: string | null;
|
|
1759
|
+
readonly country: string | null;
|
|
1760
|
+
readonly vatNumber: string | null;
|
|
1761
|
+
/** 'valid' | 'invalid' | 'unconfirmed' | 'wrong_company' | 'no_vat_id' | 'not_found' */
|
|
1762
|
+
readonly vatStatus: string | null;
|
|
1763
|
+
/** The company's local tax / business number (NIP, SIREN, Partita IVA, Steuernummer …). */
|
|
1764
|
+
readonly taxNumber: string | null;
|
|
1765
|
+
/** The number's national name, e.g. 'NIP', 'SIREN', 'Steuernummer'. */
|
|
1766
|
+
readonly taxNumberName: string | null;
|
|
1767
|
+
/** 'vat_id' (read off the confirmed VAT ID) | 'company_website' (published by the company). */
|
|
1768
|
+
readonly taxNumberSource: string | null;
|
|
1769
|
+
/** 'vat_check' | 'smart_enrichment' */
|
|
1770
|
+
readonly source: string | null;
|
|
1771
|
+
readonly checkedAt: string | null;
|
|
1772
|
+
/** The VAT check uuid or the Smart Enrichment job id. */
|
|
1773
|
+
readonly checkId: string | null;
|
|
1774
|
+
constructor(companyName: string | null,
|
|
1775
|
+
/** The name you submitted, when it differs from the registered one. */
|
|
1776
|
+
requestedName: string | null, country: string | null, vatNumber: string | null,
|
|
1777
|
+
/** 'valid' | 'invalid' | 'unconfirmed' | 'wrong_company' | 'no_vat_id' | 'not_found' */
|
|
1778
|
+
vatStatus: string | null,
|
|
1779
|
+
/** The company's local tax / business number (NIP, SIREN, Partita IVA, Steuernummer …). */
|
|
1780
|
+
taxNumber: string | null,
|
|
1781
|
+
/** The number's national name, e.g. 'NIP', 'SIREN', 'Steuernummer'. */
|
|
1782
|
+
taxNumberName: string | null,
|
|
1783
|
+
/** 'vat_id' (read off the confirmed VAT ID) | 'company_website' (published by the company). */
|
|
1784
|
+
taxNumberSource: string | null,
|
|
1785
|
+
/** 'vat_check' | 'smart_enrichment' */
|
|
1786
|
+
source: string | null, checkedAt: string | null,
|
|
1787
|
+
/** The VAT check uuid or the Smart Enrichment job id. */
|
|
1788
|
+
checkId: string | null);
|
|
1789
|
+
/** One CSV row keyed by column name. */
|
|
1790
|
+
static fromArray(data: Record<string, unknown>): LocalTaxNumberRow;
|
|
1791
|
+
toArray(): Record<Column, string | null>;
|
|
1792
|
+
}
|
|
1793
|
+
/** How many companies the local tax numbers report would list, and how many have a tax number. */
|
|
1794
|
+
interface LocalTaxNumberSummary {
|
|
1795
|
+
companies: number;
|
|
1796
|
+
withTaxNumber: number;
|
|
1797
|
+
}
|
|
1798
|
+
/** Filters of the local tax numbers report. All optional. */
|
|
1799
|
+
interface LocalTaxNumberReportOptions {
|
|
1800
|
+
/** Y-m-d string or Date. */
|
|
1801
|
+
dateFrom?: Date | string;
|
|
1802
|
+
/** Y-m-d string or Date. */
|
|
1803
|
+
dateTo?: Date | string;
|
|
1804
|
+
/** ISO 3166-1 alpha-2 codes. */
|
|
1805
|
+
countries?: string[];
|
|
1806
|
+
/** Skip companies without a local tax number (report only; the summary counts both). */
|
|
1807
|
+
onlyWithTaxNumber?: boolean;
|
|
1808
|
+
}
|
|
1809
|
+
/**
|
|
1810
|
+
* Parses a local tax numbers CSV (as returned by `localTaxNumbersCsv()`) into rows: BOM dropped,
|
|
1811
|
+
* cells trimmed (incl. the Excel TAB guard), empty cells null.
|
|
1812
|
+
*/
|
|
1813
|
+
declare function parseLocalTaxNumbersCsv(csv: string): LocalTaxNumberRow[];
|
|
1814
|
+
|
|
1721
1815
|
declare const Language: {
|
|
1722
1816
|
readonly ENGLISH: "en";
|
|
1723
1817
|
readonly GERMAN: "de";
|
|
@@ -1742,6 +1836,19 @@ declare class VatEndpoint {
|
|
|
1742
1836
|
certificatesListExport(fromDate: Date | string, toDate: Date | string, countries?: string[], lang?: Language): Promise<VatCertificateExport>;
|
|
1743
1837
|
private exportRequest;
|
|
1744
1838
|
downloadBulkExport(exportId: string): Promise<Uint8Array>;
|
|
1839
|
+
/**
|
|
1840
|
+
* Local tax numbers report as raw CSV (UTF-8 with BOM, comma-separated): every company checked —
|
|
1841
|
+
* single and bulk VAT checks and Smart Enrichment lookups — once, with its local tax number
|
|
1842
|
+
* (taxNumber, taxNumberName, taxNumberSource). Digit-only taxNumber cells carry a leading TAB so
|
|
1843
|
+
* Excel keeps them as text; `localTaxNumbers()` strips it for you.
|
|
1844
|
+
*/
|
|
1845
|
+
localTaxNumbersCsv(options?: LocalTaxNumberReportOptions): Promise<string>;
|
|
1846
|
+
/** The local tax numbers report, parsed: one row per company (same filters as `localTaxNumbersCsv()`). */
|
|
1847
|
+
localTaxNumbers(options?: LocalTaxNumberReportOptions): Promise<LocalTaxNumberRow[]>;
|
|
1848
|
+
/** How many companies the report would list for the filters, and how many have a tax number. */
|
|
1849
|
+
localTaxNumbersSummary(options?: Omit<LocalTaxNumberReportOptions, 'onlyWithTaxNumber'>): Promise<LocalTaxNumberSummary>;
|
|
1850
|
+
private localTaxNumbersParams;
|
|
1851
|
+
private withQuery;
|
|
1745
1852
|
private buildHeaders;
|
|
1746
1853
|
private sendRequest;
|
|
1747
1854
|
private sendBinaryRequest;
|
|
@@ -2019,4 +2126,4 @@ declare class AuthRetryHttpClient implements HttpClientInterface {
|
|
|
2019
2126
|
private injectAuthHeader;
|
|
2020
2127
|
}
|
|
2021
2128
|
|
|
2022
|
-
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 SmartEnrichmentOfficialAddress, type SmartEnrichmentOutcomeBreakdown, type SmartEnrichmentProviderVerdict, type SmartEnrichmentRejectedCandidate, SmartEnrichmentRejectionReason, 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, describeSmartEnrichmentRejectionReason, describeSmartEnrichmentStatus, describeVatState, generateWebhookSignatureHeader, getBaseUrl, getFailedVatStates, parseWebhookSignatureHeader, toComplianceDocumentType, toComplianceEnrollmentStatus, toComplianceService, toComplianceTaxReportState, toComplianceTransactionState, toComplianceTransactionType, toPeppolLookupStatus, toSmartEnrichmentMode, toSmartEnrichmentRejectionReason, toSmartEnrichmentStatus, verifyWebhookSignature };
|
|
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 };
|
package/dist/index.d.ts
CHANGED
|
@@ -1166,6 +1166,8 @@ interface SmartEnrichmentRejectedCandidate {
|
|
|
1166
1166
|
vatNumber: string;
|
|
1167
1167
|
reason: SmartEnrichmentRejectionReason;
|
|
1168
1168
|
}
|
|
1169
|
+
/** Where a Smart Enrichment `taxNumber` comes from. */
|
|
1170
|
+
type SmartEnrichmentTaxNumberSource = 'vat_id' | 'company_website';
|
|
1169
1171
|
/** The registered address the official VAT check returned, field by field. */
|
|
1170
1172
|
interface SmartEnrichmentOfficialAddress {
|
|
1171
1173
|
street?: string;
|
|
@@ -1219,8 +1221,12 @@ declare class SmartEnrichmentResource {
|
|
|
1219
1221
|
*/
|
|
1220
1222
|
readonly sourceUrls: string[];
|
|
1221
1223
|
/**
|
|
1222
|
-
*
|
|
1223
|
-
*
|
|
1224
|
+
* The company's LOCAL tax / business number, national notation without spaces — what domestic
|
|
1225
|
+
* e-invoicing asks for. On `found` it is read off the confirmed VAT ID where that country's VAT ID
|
|
1226
|
+
* contains it (`taxNumberSource` 'vat_id': FR SIREN, IT Partita IVA, ES NIF, PL NIP, BE enterprise
|
|
1227
|
+
* number, DK CVR, PT, RO, CZ IČO, SK DIČ, SE/NO orgnr, FI Y-tunnus, SI, HR OIB, BG EIK, GR AFM).
|
|
1228
|
+
* Otherwise a domestic number the company itself published ('company_website', e.g. a DE/AT
|
|
1229
|
+
* Steuernummer) — that one is not a VAT ID.
|
|
1224
1230
|
*/
|
|
1225
1231
|
readonly taxNumber: string | undefined;
|
|
1226
1232
|
/** Only on `found`: the tax authority's verdict on the number; undefined when no official check ran. */
|
|
@@ -1236,6 +1242,15 @@ declare class SmartEnrichmentResource {
|
|
|
1236
1242
|
readonly officialName: string | undefined;
|
|
1237
1243
|
/** Only on `found`: the registered address, field by field. */
|
|
1238
1244
|
readonly officialAddress: SmartEnrichmentOfficialAddress | undefined;
|
|
1245
|
+
/** What `taxNumber` is, e.g. 'pl_nip', 'fr_siren', 'de_steuernummer'. Undefined when there is none. */
|
|
1246
|
+
readonly taxNumberType: string | undefined;
|
|
1247
|
+
/** The number's name in its country (SIREN, NIP, Steuernummer …), for display. */
|
|
1248
|
+
readonly taxNumberLabel: string | undefined;
|
|
1249
|
+
/**
|
|
1250
|
+
* Where `taxNumber` comes from: 'vat_id' (read off the VAT ID the tax authority confirmed — exact)
|
|
1251
|
+
* or 'company_website' (published by the company itself, not officially confirmable).
|
|
1252
|
+
*/
|
|
1253
|
+
readonly taxNumberSource: SmartEnrichmentTaxNumberSource | undefined;
|
|
1239
1254
|
constructor(status: SmartEnrichmentStatus, vatNumber: string | undefined, vatType: string | undefined, confidence: number | undefined, matchedCompanyName: string | undefined,
|
|
1240
1255
|
/** Official/registered address of the matched company, when available. */
|
|
1241
1256
|
matchedAddress: string | undefined, country: string | undefined, source: string | undefined,
|
|
@@ -1270,8 +1285,12 @@ declare class SmartEnrichmentResource {
|
|
|
1270
1285
|
*/
|
|
1271
1286
|
sourceUrls?: string[],
|
|
1272
1287
|
/**
|
|
1273
|
-
*
|
|
1274
|
-
*
|
|
1288
|
+
* The company's LOCAL tax / business number, national notation without spaces — what domestic
|
|
1289
|
+
* e-invoicing asks for. On `found` it is read off the confirmed VAT ID where that country's VAT ID
|
|
1290
|
+
* contains it (`taxNumberSource` 'vat_id': FR SIREN, IT Partita IVA, ES NIF, PL NIP, BE enterprise
|
|
1291
|
+
* number, DK CVR, PT, RO, CZ IČO, SK DIČ, SE/NO orgnr, FI Y-tunnus, SI, HR OIB, BG EIK, GR AFM).
|
|
1292
|
+
* Otherwise a domestic number the company itself published ('company_website', e.g. a DE/AT
|
|
1293
|
+
* Steuernummer) — that one is not a VAT ID.
|
|
1275
1294
|
*/
|
|
1276
1295
|
taxNumber?: string | undefined,
|
|
1277
1296
|
/** Only on `found`: the tax authority's verdict on the number; undefined when no official check ran. */
|
|
@@ -1286,7 +1305,16 @@ declare class SmartEnrichmentResource {
|
|
|
1286
1305
|
/** Only on `found`: the name the register has the number under. */
|
|
1287
1306
|
officialName?: string | undefined,
|
|
1288
1307
|
/** Only on `found`: the registered address, field by field. */
|
|
1289
|
-
officialAddress?: SmartEnrichmentOfficialAddress | undefined
|
|
1308
|
+
officialAddress?: SmartEnrichmentOfficialAddress | undefined,
|
|
1309
|
+
/** What `taxNumber` is, e.g. 'pl_nip', 'fr_siren', 'de_steuernummer'. Undefined when there is none. */
|
|
1310
|
+
taxNumberType?: string | undefined,
|
|
1311
|
+
/** The number's name in its country (SIREN, NIP, Steuernummer …), for display. */
|
|
1312
|
+
taxNumberLabel?: string | undefined,
|
|
1313
|
+
/**
|
|
1314
|
+
* Where `taxNumber` comes from: 'vat_id' (read off the VAT ID the tax authority confirmed — exact)
|
|
1315
|
+
* or 'company_website' (published by the company itself, not officially confirmable).
|
|
1316
|
+
*/
|
|
1317
|
+
taxNumberSource?: SmartEnrichmentTaxNumberSource | undefined);
|
|
1290
1318
|
/** True when the register knows the number under a different name than the one requested. */
|
|
1291
1319
|
nameMismatch(): boolean;
|
|
1292
1320
|
/** True when a VAT number was found but rejected by the official check. */
|
|
@@ -1718,6 +1746,72 @@ declare class VatValidationAddressInput {
|
|
|
1718
1746
|
toArray(): Record<string, string>;
|
|
1719
1747
|
}
|
|
1720
1748
|
|
|
1749
|
+
/** Columns of the local tax numbers report. */
|
|
1750
|
+
type Column = 'companyName' | 'requestedName' | 'country' | 'vatNumber' | 'vatStatus' | 'taxNumber' | 'taxNumberName' | 'taxNumberSource' | 'source' | 'checkedAt' | 'checkId';
|
|
1751
|
+
/**
|
|
1752
|
+
* One company of the local tax numbers report: every company checked (VAT checks and Smart
|
|
1753
|
+
* Enrichment) once, with its local tax number. Empty cells come back as null.
|
|
1754
|
+
*/
|
|
1755
|
+
declare class LocalTaxNumberRow {
|
|
1756
|
+
readonly companyName: string | null;
|
|
1757
|
+
/** The name you submitted, when it differs from the registered one. */
|
|
1758
|
+
readonly requestedName: string | null;
|
|
1759
|
+
readonly country: string | null;
|
|
1760
|
+
readonly vatNumber: string | null;
|
|
1761
|
+
/** 'valid' | 'invalid' | 'unconfirmed' | 'wrong_company' | 'no_vat_id' | 'not_found' */
|
|
1762
|
+
readonly vatStatus: string | null;
|
|
1763
|
+
/** The company's local tax / business number (NIP, SIREN, Partita IVA, Steuernummer …). */
|
|
1764
|
+
readonly taxNumber: string | null;
|
|
1765
|
+
/** The number's national name, e.g. 'NIP', 'SIREN', 'Steuernummer'. */
|
|
1766
|
+
readonly taxNumberName: string | null;
|
|
1767
|
+
/** 'vat_id' (read off the confirmed VAT ID) | 'company_website' (published by the company). */
|
|
1768
|
+
readonly taxNumberSource: string | null;
|
|
1769
|
+
/** 'vat_check' | 'smart_enrichment' */
|
|
1770
|
+
readonly source: string | null;
|
|
1771
|
+
readonly checkedAt: string | null;
|
|
1772
|
+
/** The VAT check uuid or the Smart Enrichment job id. */
|
|
1773
|
+
readonly checkId: string | null;
|
|
1774
|
+
constructor(companyName: string | null,
|
|
1775
|
+
/** The name you submitted, when it differs from the registered one. */
|
|
1776
|
+
requestedName: string | null, country: string | null, vatNumber: string | null,
|
|
1777
|
+
/** 'valid' | 'invalid' | 'unconfirmed' | 'wrong_company' | 'no_vat_id' | 'not_found' */
|
|
1778
|
+
vatStatus: string | null,
|
|
1779
|
+
/** The company's local tax / business number (NIP, SIREN, Partita IVA, Steuernummer …). */
|
|
1780
|
+
taxNumber: string | null,
|
|
1781
|
+
/** The number's national name, e.g. 'NIP', 'SIREN', 'Steuernummer'. */
|
|
1782
|
+
taxNumberName: string | null,
|
|
1783
|
+
/** 'vat_id' (read off the confirmed VAT ID) | 'company_website' (published by the company). */
|
|
1784
|
+
taxNumberSource: string | null,
|
|
1785
|
+
/** 'vat_check' | 'smart_enrichment' */
|
|
1786
|
+
source: string | null, checkedAt: string | null,
|
|
1787
|
+
/** The VAT check uuid or the Smart Enrichment job id. */
|
|
1788
|
+
checkId: string | null);
|
|
1789
|
+
/** One CSV row keyed by column name. */
|
|
1790
|
+
static fromArray(data: Record<string, unknown>): LocalTaxNumberRow;
|
|
1791
|
+
toArray(): Record<Column, string | null>;
|
|
1792
|
+
}
|
|
1793
|
+
/** How many companies the local tax numbers report would list, and how many have a tax number. */
|
|
1794
|
+
interface LocalTaxNumberSummary {
|
|
1795
|
+
companies: number;
|
|
1796
|
+
withTaxNumber: number;
|
|
1797
|
+
}
|
|
1798
|
+
/** Filters of the local tax numbers report. All optional. */
|
|
1799
|
+
interface LocalTaxNumberReportOptions {
|
|
1800
|
+
/** Y-m-d string or Date. */
|
|
1801
|
+
dateFrom?: Date | string;
|
|
1802
|
+
/** Y-m-d string or Date. */
|
|
1803
|
+
dateTo?: Date | string;
|
|
1804
|
+
/** ISO 3166-1 alpha-2 codes. */
|
|
1805
|
+
countries?: string[];
|
|
1806
|
+
/** Skip companies without a local tax number (report only; the summary counts both). */
|
|
1807
|
+
onlyWithTaxNumber?: boolean;
|
|
1808
|
+
}
|
|
1809
|
+
/**
|
|
1810
|
+
* Parses a local tax numbers CSV (as returned by `localTaxNumbersCsv()`) into rows: BOM dropped,
|
|
1811
|
+
* cells trimmed (incl. the Excel TAB guard), empty cells null.
|
|
1812
|
+
*/
|
|
1813
|
+
declare function parseLocalTaxNumbersCsv(csv: string): LocalTaxNumberRow[];
|
|
1814
|
+
|
|
1721
1815
|
declare const Language: {
|
|
1722
1816
|
readonly ENGLISH: "en";
|
|
1723
1817
|
readonly GERMAN: "de";
|
|
@@ -1742,6 +1836,19 @@ declare class VatEndpoint {
|
|
|
1742
1836
|
certificatesListExport(fromDate: Date | string, toDate: Date | string, countries?: string[], lang?: Language): Promise<VatCertificateExport>;
|
|
1743
1837
|
private exportRequest;
|
|
1744
1838
|
downloadBulkExport(exportId: string): Promise<Uint8Array>;
|
|
1839
|
+
/**
|
|
1840
|
+
* Local tax numbers report as raw CSV (UTF-8 with BOM, comma-separated): every company checked —
|
|
1841
|
+
* single and bulk VAT checks and Smart Enrichment lookups — once, with its local tax number
|
|
1842
|
+
* (taxNumber, taxNumberName, taxNumberSource). Digit-only taxNumber cells carry a leading TAB so
|
|
1843
|
+
* Excel keeps them as text; `localTaxNumbers()` strips it for you.
|
|
1844
|
+
*/
|
|
1845
|
+
localTaxNumbersCsv(options?: LocalTaxNumberReportOptions): Promise<string>;
|
|
1846
|
+
/** The local tax numbers report, parsed: one row per company (same filters as `localTaxNumbersCsv()`). */
|
|
1847
|
+
localTaxNumbers(options?: LocalTaxNumberReportOptions): Promise<LocalTaxNumberRow[]>;
|
|
1848
|
+
/** How many companies the report would list for the filters, and how many have a tax number. */
|
|
1849
|
+
localTaxNumbersSummary(options?: Omit<LocalTaxNumberReportOptions, 'onlyWithTaxNumber'>): Promise<LocalTaxNumberSummary>;
|
|
1850
|
+
private localTaxNumbersParams;
|
|
1851
|
+
private withQuery;
|
|
1745
1852
|
private buildHeaders;
|
|
1746
1853
|
private sendRequest;
|
|
1747
1854
|
private sendBinaryRequest;
|
|
@@ -2019,4 +2126,4 @@ declare class AuthRetryHttpClient implements HttpClientInterface {
|
|
|
2019
2126
|
private injectAuthHeader;
|
|
2020
2127
|
}
|
|
2021
2128
|
|
|
2022
|
-
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 SmartEnrichmentOfficialAddress, type SmartEnrichmentOutcomeBreakdown, type SmartEnrichmentProviderVerdict, type SmartEnrichmentRejectedCandidate, SmartEnrichmentRejectionReason, 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, describeSmartEnrichmentRejectionReason, describeSmartEnrichmentStatus, describeVatState, generateWebhookSignatureHeader, getBaseUrl, getFailedVatStates, parseWebhookSignatureHeader, toComplianceDocumentType, toComplianceEnrollmentStatus, toComplianceService, toComplianceTaxReportState, toComplianceTransactionState, toComplianceTransactionType, toPeppolLookupStatus, toSmartEnrichmentMode, toSmartEnrichmentRejectionReason, toSmartEnrichmentStatus, verifyWebhookSignature };
|
|
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 };
|
package/dist/index.js
CHANGED
|
@@ -2330,7 +2330,7 @@ function toOfficialAddress(value) {
|
|
|
2330
2330
|
return Object.keys(address).length > 0 ? address : void 0;
|
|
2331
2331
|
}
|
|
2332
2332
|
var SmartEnrichmentResource = class _SmartEnrichmentResource {
|
|
2333
|
-
constructor(status, vatNumber, vatType, confidence, matchedCompanyName, matchedAddress, country, source, mode = void 0, providerVerdicts = [], addressQuality = void 0, rejectedCandidates = [], sourceUrl = void 0, registeredOwner = void 0, sourceUrls = [], taxNumber = void 0, vatValid = void 0, aiScore = void 0, nameMatch = void 0, officialName = void 0, officialAddress = void 0) {
|
|
2333
|
+
constructor(status, vatNumber, vatType, confidence, matchedCompanyName, matchedAddress, country, source, mode = void 0, providerVerdicts = [], addressQuality = void 0, rejectedCandidates = [], sourceUrl = void 0, registeredOwner = void 0, sourceUrls = [], taxNumber = void 0, vatValid = void 0, aiScore = void 0, nameMatch = void 0, officialName = void 0, officialAddress = void 0, taxNumberType = void 0, taxNumberLabel = void 0, taxNumberSource = void 0) {
|
|
2334
2334
|
this.status = status;
|
|
2335
2335
|
this.vatNumber = vatNumber;
|
|
2336
2336
|
this.vatType = vatType;
|
|
@@ -2352,6 +2352,9 @@ var SmartEnrichmentResource = class _SmartEnrichmentResource {
|
|
|
2352
2352
|
this.nameMatch = nameMatch;
|
|
2353
2353
|
this.officialName = officialName;
|
|
2354
2354
|
this.officialAddress = officialAddress;
|
|
2355
|
+
this.taxNumberType = taxNumberType;
|
|
2356
|
+
this.taxNumberLabel = taxNumberLabel;
|
|
2357
|
+
this.taxNumberSource = taxNumberSource;
|
|
2355
2358
|
}
|
|
2356
2359
|
status;
|
|
2357
2360
|
vatNumber;
|
|
@@ -2374,6 +2377,9 @@ var SmartEnrichmentResource = class _SmartEnrichmentResource {
|
|
|
2374
2377
|
nameMatch;
|
|
2375
2378
|
officialName;
|
|
2376
2379
|
officialAddress;
|
|
2380
|
+
taxNumberType;
|
|
2381
|
+
taxNumberLabel;
|
|
2382
|
+
taxNumberSource;
|
|
2377
2383
|
/** True when the register knows the number under a different name than the one requested. */
|
|
2378
2384
|
nameMismatch() {
|
|
2379
2385
|
return this.nameMatch === "mismatch";
|
|
@@ -2421,7 +2427,10 @@ var SmartEnrichmentResource = class _SmartEnrichmentResource {
|
|
|
2421
2427
|
num("aiScore"),
|
|
2422
2428
|
data["nameMatch"] === "ok" || data["nameMatch"] === "mismatch" ? data["nameMatch"] : void 0,
|
|
2423
2429
|
text("officialName"),
|
|
2424
|
-
toOfficialAddress(data["officialAddress"])
|
|
2430
|
+
toOfficialAddress(data["officialAddress"]),
|
|
2431
|
+
text("taxNumberType"),
|
|
2432
|
+
text("taxNumberLabel"),
|
|
2433
|
+
data["taxNumberSource"] === "vat_id" || data["taxNumberSource"] === "company_website" ? data["taxNumberSource"] : void 0
|
|
2425
2434
|
);
|
|
2426
2435
|
}
|
|
2427
2436
|
toArray() {
|
|
@@ -2446,7 +2455,10 @@ var SmartEnrichmentResource = class _SmartEnrichmentResource {
|
|
|
2446
2455
|
aiScore: this.aiScore ?? null,
|
|
2447
2456
|
nameMatch: this.nameMatch ?? null,
|
|
2448
2457
|
officialName: this.officialName ?? null,
|
|
2449
|
-
officialAddress: this.officialAddress ?? null
|
|
2458
|
+
officialAddress: this.officialAddress ?? null,
|
|
2459
|
+
taxNumberType: this.taxNumberType ?? null,
|
|
2460
|
+
taxNumberLabel: this.taxNumberLabel ?? null,
|
|
2461
|
+
taxNumberSource: this.taxNumberSource ?? null
|
|
2450
2462
|
};
|
|
2451
2463
|
}
|
|
2452
2464
|
};
|
|
@@ -3454,6 +3466,123 @@ var VatValidationAddressInput = class _VatValidationAddressInput {
|
|
|
3454
3466
|
}
|
|
3455
3467
|
};
|
|
3456
3468
|
|
|
3469
|
+
// src/dto/LocalTaxNumberReport.ts
|
|
3470
|
+
var LocalTaxNumberRow = class _LocalTaxNumberRow {
|
|
3471
|
+
constructor(companyName, requestedName, country, vatNumber, vatStatus, taxNumber, taxNumberName, taxNumberSource, source, checkedAt, checkId) {
|
|
3472
|
+
this.companyName = companyName;
|
|
3473
|
+
this.requestedName = requestedName;
|
|
3474
|
+
this.country = country;
|
|
3475
|
+
this.vatNumber = vatNumber;
|
|
3476
|
+
this.vatStatus = vatStatus;
|
|
3477
|
+
this.taxNumber = taxNumber;
|
|
3478
|
+
this.taxNumberName = taxNumberName;
|
|
3479
|
+
this.taxNumberSource = taxNumberSource;
|
|
3480
|
+
this.source = source;
|
|
3481
|
+
this.checkedAt = checkedAt;
|
|
3482
|
+
this.checkId = checkId;
|
|
3483
|
+
}
|
|
3484
|
+
companyName;
|
|
3485
|
+
requestedName;
|
|
3486
|
+
country;
|
|
3487
|
+
vatNumber;
|
|
3488
|
+
vatStatus;
|
|
3489
|
+
taxNumber;
|
|
3490
|
+
taxNumberName;
|
|
3491
|
+
taxNumberSource;
|
|
3492
|
+
source;
|
|
3493
|
+
checkedAt;
|
|
3494
|
+
checkId;
|
|
3495
|
+
/** One CSV row keyed by column name. */
|
|
3496
|
+
static fromArray(data) {
|
|
3497
|
+
const cell = (key) => {
|
|
3498
|
+
const value = data[key];
|
|
3499
|
+
const trimmed = typeof value === "string" ? value.trim() : "";
|
|
3500
|
+
return trimmed === "" ? null : trimmed;
|
|
3501
|
+
};
|
|
3502
|
+
return new _LocalTaxNumberRow(
|
|
3503
|
+
cell("companyName"),
|
|
3504
|
+
cell("requestedName"),
|
|
3505
|
+
cell("country"),
|
|
3506
|
+
cell("vatNumber"),
|
|
3507
|
+
cell("vatStatus"),
|
|
3508
|
+
cell("taxNumber"),
|
|
3509
|
+
cell("taxNumberName"),
|
|
3510
|
+
cell("taxNumberSource"),
|
|
3511
|
+
cell("source"),
|
|
3512
|
+
cell("checkedAt"),
|
|
3513
|
+
cell("checkId")
|
|
3514
|
+
);
|
|
3515
|
+
}
|
|
3516
|
+
toArray() {
|
|
3517
|
+
return {
|
|
3518
|
+
companyName: this.companyName,
|
|
3519
|
+
requestedName: this.requestedName,
|
|
3520
|
+
country: this.country,
|
|
3521
|
+
vatNumber: this.vatNumber,
|
|
3522
|
+
vatStatus: this.vatStatus,
|
|
3523
|
+
taxNumber: this.taxNumber,
|
|
3524
|
+
taxNumberName: this.taxNumberName,
|
|
3525
|
+
taxNumberSource: this.taxNumberSource,
|
|
3526
|
+
source: this.source,
|
|
3527
|
+
checkedAt: this.checkedAt,
|
|
3528
|
+
checkId: this.checkId
|
|
3529
|
+
};
|
|
3530
|
+
}
|
|
3531
|
+
};
|
|
3532
|
+
function parseCsvRecords(csv) {
|
|
3533
|
+
const records = [];
|
|
3534
|
+
let record = [];
|
|
3535
|
+
let cell = "";
|
|
3536
|
+
let quoted = false;
|
|
3537
|
+
for (let i = 0; i < csv.length; i++) {
|
|
3538
|
+
const ch = csv[i];
|
|
3539
|
+
if (quoted) {
|
|
3540
|
+
if (ch === '"') {
|
|
3541
|
+
if (csv[i + 1] === '"') {
|
|
3542
|
+
cell += '"';
|
|
3543
|
+
i++;
|
|
3544
|
+
} else {
|
|
3545
|
+
quoted = false;
|
|
3546
|
+
}
|
|
3547
|
+
} else {
|
|
3548
|
+
cell += ch;
|
|
3549
|
+
}
|
|
3550
|
+
} else if (ch === '"') {
|
|
3551
|
+
quoted = true;
|
|
3552
|
+
} else if (ch === ",") {
|
|
3553
|
+
record.push(cell);
|
|
3554
|
+
cell = "";
|
|
3555
|
+
} else if (ch === "\n" || ch === "\r") {
|
|
3556
|
+
if (ch === "\r" && csv[i + 1] === "\n") i++;
|
|
3557
|
+
record.push(cell);
|
|
3558
|
+
records.push(record);
|
|
3559
|
+
record = [];
|
|
3560
|
+
cell = "";
|
|
3561
|
+
} else {
|
|
3562
|
+
cell += ch;
|
|
3563
|
+
}
|
|
3564
|
+
}
|
|
3565
|
+
if (cell !== "" || record.length > 0) {
|
|
3566
|
+
record.push(cell);
|
|
3567
|
+
records.push(record);
|
|
3568
|
+
}
|
|
3569
|
+
return records.filter((r) => !(r.length === 1 && r[0] === ""));
|
|
3570
|
+
}
|
|
3571
|
+
function parseLocalTaxNumbersCsv(csv) {
|
|
3572
|
+
const [header, ...records] = parseCsvRecords(csv.replace(/^\uFEFF/, ""));
|
|
3573
|
+
if (!header) {
|
|
3574
|
+
return [];
|
|
3575
|
+
}
|
|
3576
|
+
const names = header.map((name) => name.trim());
|
|
3577
|
+
return records.map((cells) => {
|
|
3578
|
+
const row = {};
|
|
3579
|
+
names.forEach((name, i) => {
|
|
3580
|
+
row[name] = cells[i];
|
|
3581
|
+
});
|
|
3582
|
+
return LocalTaxNumberRow.fromArray(row);
|
|
3583
|
+
});
|
|
3584
|
+
}
|
|
3585
|
+
|
|
3457
3586
|
// src/endpoints/VatEndpoint.ts
|
|
3458
3587
|
var DATE_REGEX2 = /^\d{4}-\d{2}-\d{2}$/;
|
|
3459
3588
|
var VatEndpoint = class {
|
|
@@ -3564,6 +3693,69 @@ var VatEndpoint = class {
|
|
|
3564
3693
|
return new Uint8Array(buffer);
|
|
3565
3694
|
});
|
|
3566
3695
|
}
|
|
3696
|
+
/**
|
|
3697
|
+
* Local tax numbers report as raw CSV (UTF-8 with BOM, comma-separated): every company checked —
|
|
3698
|
+
* single and bulk VAT checks and Smart Enrichment lookups — once, with its local tax number
|
|
3699
|
+
* (taxNumber, taxNumberName, taxNumberSource). Digit-only taxNumber cells carry a leading TAB so
|
|
3700
|
+
* Excel keeps them as text; `localTaxNumbers()` strips it for you.
|
|
3701
|
+
*/
|
|
3702
|
+
async localTaxNumbersCsv(options = {}) {
|
|
3703
|
+
const params = this.localTaxNumbersParams(options);
|
|
3704
|
+
if (options.onlyWithTaxNumber !== void 0) {
|
|
3705
|
+
params.set("only_with_tax_number", options.onlyWithTaxNumber ? "1" : "0");
|
|
3706
|
+
}
|
|
3707
|
+
const url = this.withQuery(`${this.baseUrl}/reports/local-tax-numbers`, params);
|
|
3708
|
+
return withRetries(this.retryPolicy, "Local tax numbers report", async () => {
|
|
3709
|
+
const headers = this.buildHeaders();
|
|
3710
|
+
delete headers["Content-Type"];
|
|
3711
|
+
headers["Accept"] = "text/csv, application/json";
|
|
3712
|
+
const response = await this.httpClient.request("GET", url, { headers });
|
|
3713
|
+
if (response.status === 422) {
|
|
3714
|
+
await this.parseJsonResponse(response);
|
|
3715
|
+
}
|
|
3716
|
+
const text = new TextDecoder("utf-8", { ignoreBOM: true }).decode(await response.arrayBuffer());
|
|
3717
|
+
if (!response.ok) {
|
|
3718
|
+
throw new HttpException(
|
|
3719
|
+
describeApiError(text, response.status),
|
|
3720
|
+
response.status,
|
|
3721
|
+
text,
|
|
3722
|
+
{},
|
|
3723
|
+
response.headers.get("retry-after")
|
|
3724
|
+
);
|
|
3725
|
+
}
|
|
3726
|
+
return text;
|
|
3727
|
+
});
|
|
3728
|
+
}
|
|
3729
|
+
/** The local tax numbers report, parsed: one row per company (same filters as `localTaxNumbersCsv()`). */
|
|
3730
|
+
async localTaxNumbers(options = {}) {
|
|
3731
|
+
return parseLocalTaxNumbersCsv(await this.localTaxNumbersCsv(options));
|
|
3732
|
+
}
|
|
3733
|
+
/** How many companies the report would list for the filters, and how many have a tax number. */
|
|
3734
|
+
async localTaxNumbersSummary(options = {}) {
|
|
3735
|
+
const url = this.withQuery(
|
|
3736
|
+
`${this.baseUrl}/reports/local-tax-numbers/summary`,
|
|
3737
|
+
this.localTaxNumbersParams(options)
|
|
3738
|
+
);
|
|
3739
|
+
return withRetries(this.retryPolicy, "Local tax numbers summary", async () => {
|
|
3740
|
+
const response = await this.sendRequest("GET", url);
|
|
3741
|
+
const data = await this.parseJsonResponse(response);
|
|
3742
|
+
const count = (key) => typeof data[key] === "number" ? data[key] : 0;
|
|
3743
|
+
return { companies: count("companies"), withTaxNumber: count("withTaxNumber") };
|
|
3744
|
+
});
|
|
3745
|
+
}
|
|
3746
|
+
localTaxNumbersParams(options) {
|
|
3747
|
+
const params = new URLSearchParams();
|
|
3748
|
+
if (options.dateFrom !== void 0) params.set("date_from", this.formatDate(options.dateFrom));
|
|
3749
|
+
if (options.dateTo !== void 0) params.set("date_to", this.formatDate(options.dateTo));
|
|
3750
|
+
for (const country of options.countries ?? []) {
|
|
3751
|
+
params.append("countries[]", country.trim().toUpperCase());
|
|
3752
|
+
}
|
|
3753
|
+
return params;
|
|
3754
|
+
}
|
|
3755
|
+
withQuery(url, params) {
|
|
3756
|
+
const queryString = params.toString();
|
|
3757
|
+
return queryString ? `${url}?${queryString}` : url;
|
|
3758
|
+
}
|
|
3567
3759
|
buildHeaders() {
|
|
3568
3760
|
const headers = {
|
|
3569
3761
|
"Content-Type": "application/json",
|
|
@@ -3724,7 +3916,7 @@ var AuthRetryHttpClient = class {
|
|
|
3724
3916
|
};
|
|
3725
3917
|
|
|
3726
3918
|
// src/version.ts
|
|
3727
|
-
var SDK_VERSION = "1.
|
|
3919
|
+
var SDK_VERSION = "1.7.0";
|
|
3728
3920
|
|
|
3729
3921
|
// src/http/SdkVersionHttpClient.ts
|
|
3730
3922
|
var SDK_VERSION_HEADER = "X-Taxora-SDK-Version";
|
|
@@ -3937,6 +4129,7 @@ export {
|
|
|
3937
4129
|
ImportResult,
|
|
3938
4130
|
InMemoryTokenStorage,
|
|
3939
4131
|
Language,
|
|
4132
|
+
LocalTaxNumberRow,
|
|
3940
4133
|
LoginIdentifier,
|
|
3941
4134
|
NorwegianOrgNumber,
|
|
3942
4135
|
PeppolLookupResult,
|
|
@@ -3989,6 +4182,7 @@ export {
|
|
|
3989
4182
|
generateWebhookSignatureHeader,
|
|
3990
4183
|
getBaseUrl,
|
|
3991
4184
|
getFailedVatStates,
|
|
4185
|
+
parseLocalTaxNumbersCsv,
|
|
3992
4186
|
parseWebhookSignatureHeader,
|
|
3993
4187
|
toComplianceDocumentType,
|
|
3994
4188
|
toComplianceEnrollmentStatus,
|