@taxora/sdk 1.3.0 → 1.5.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/dist/index.d.cts CHANGED
@@ -1092,6 +1092,32 @@ type SmartEnrichmentMode = (typeof SmartEnrichmentMode)[keyof typeof SmartEnrich
1092
1092
  declare function toSmartEnrichmentMode(value: unknown): SmartEnrichmentMode | undefined;
1093
1093
  declare function describeSmartEnrichmentMode(mode: SmartEnrichmentMode): string;
1094
1094
 
1095
+ /**
1096
+ * Why a VAT number the research DID find was not returned as the result.
1097
+ *
1098
+ * Only appears on `not_found` results (see `SmartEnrichmentResource.rejectedCandidates`), so
1099
+ * "a number was found, but the tax authority calls it invalid" can be told apart from "nothing
1100
+ * was found at all".
1101
+ */
1102
+ declare const SmartEnrichmentRejectionReason: {
1103
+ /** The tax authority reports the number as not (or no longer) valid. */
1104
+ readonly VAT_INVALID: "vat_invalid";
1105
+ /** The number is valid, but registered to a different company. */
1106
+ readonly NAME_MISMATCH: "name_mismatch";
1107
+ /** The number could not be tied to the requested company. */
1108
+ readonly UNBOUND: "unbound";
1109
+ /** The number could not be checked against the tax authority. */
1110
+ readonly UNVERIFIED: "unverified";
1111
+ /** Rejected for another reason. */
1112
+ readonly REJECTED: "rejected";
1113
+ /** A reason this SDK version does not know yet. */
1114
+ readonly UNKNOWN: "unknown";
1115
+ };
1116
+ type SmartEnrichmentRejectionReason = (typeof SmartEnrichmentRejectionReason)[keyof typeof SmartEnrichmentRejectionReason];
1117
+ /** Tolerant coercion: unrecognized values become `unknown` instead of throwing. */
1118
+ declare function toSmartEnrichmentRejectionReason(value: unknown): SmartEnrichmentRejectionReason;
1119
+ declare function describeSmartEnrichmentRejectionReason(reason: SmartEnrichmentRejectionReason): string;
1120
+
1095
1121
  declare const SmartEnrichmentStatus: {
1096
1122
  readonly FOUND: "found";
1097
1123
  readonly NO_VAT_EXISTS: "no_vat_exists";
@@ -1135,6 +1161,11 @@ interface SmartEnrichmentAddressQuality {
1135
1161
  cityMatchesPostalCode: boolean | null;
1136
1162
  warnings: string[];
1137
1163
  }
1164
+ /** A VAT number the research named, but the official check threw out. */
1165
+ interface SmartEnrichmentRejectedCandidate {
1166
+ vatNumber: string;
1167
+ reason: SmartEnrichmentRejectionReason;
1168
+ }
1138
1169
  /**
1139
1170
  * Result of resolving one reverse-VAT lookup (company name + address → VAT + confidence).
1140
1171
  * Mirrors the API response item shape (camelCase keys).
@@ -1158,6 +1189,28 @@ declare class SmartEnrichmentResource {
1158
1189
  */
1159
1190
  readonly providerVerdicts: SmartEnrichmentProviderVerdict[];
1160
1191
  readonly addressQuality: SmartEnrichmentAddressQuality | undefined;
1192
+ /**
1193
+ * Only on `not_found`: VAT numbers the research DID find but the official check threw out —
1194
+ * e.g. one the tax authority reports as invalid. Lets you tell "found one, it is invalid"
1195
+ * apart from "found nothing". Empty for every other status.
1196
+ */
1197
+ readonly rejectedCandidates: SmartEnrichmentRejectedCandidate[];
1198
+ /**
1199
+ * Only on `found`: the web page the VAT number was read from — usually the company's own
1200
+ * Impressum / legal notice. Undefined when it came from Taxora's own data or a register.
1201
+ */
1202
+ readonly sourceUrl: string | undefined;
1203
+ /**
1204
+ * Only on `found`: the PERSON the tax authority has the VAT ID under, when that is not the
1205
+ * trading name — typical for a German sole proprietorship (e.K.). `matchedCompanyName` stays
1206
+ * the trading name.
1207
+ */
1208
+ readonly registeredOwner: string | undefined;
1209
+ /**
1210
+ * Only on `found`: every page the VAT number was read from, `sourceUrl` first — each research
1211
+ * pass that found the same number contributes its page. At most 5.
1212
+ */
1213
+ readonly sourceUrls: string[];
1161
1214
  constructor(status: SmartEnrichmentStatus, vatNumber: string | undefined, vatType: string | undefined, confidence: number | undefined, matchedCompanyName: string | undefined,
1162
1215
  /** Official/registered address of the matched company, when available. */
1163
1216
  matchedAddress: string | undefined, country: string | undefined, source: string | undefined,
@@ -1168,7 +1221,31 @@ declare class SmartEnrichmentResource {
1168
1221
  * (complex mode, or a fallback). Two entries reporting the same vatNumber is the strongest
1169
1222
  * confirmation this layer produces.
1170
1223
  */
1171
- providerVerdicts?: SmartEnrichmentProviderVerdict[], addressQuality?: SmartEnrichmentAddressQuality | undefined);
1224
+ providerVerdicts?: SmartEnrichmentProviderVerdict[], addressQuality?: SmartEnrichmentAddressQuality | undefined,
1225
+ /**
1226
+ * Only on `not_found`: VAT numbers the research DID find but the official check threw out —
1227
+ * e.g. one the tax authority reports as invalid. Lets you tell "found one, it is invalid"
1228
+ * apart from "found nothing". Empty for every other status.
1229
+ */
1230
+ rejectedCandidates?: SmartEnrichmentRejectedCandidate[],
1231
+ /**
1232
+ * Only on `found`: the web page the VAT number was read from — usually the company's own
1233
+ * Impressum / legal notice. Undefined when it came from Taxora's own data or a register.
1234
+ */
1235
+ sourceUrl?: string | undefined,
1236
+ /**
1237
+ * Only on `found`: the PERSON the tax authority has the VAT ID under, when that is not the
1238
+ * trading name — typical for a German sole proprietorship (e.K.). `matchedCompanyName` stays
1239
+ * the trading name.
1240
+ */
1241
+ registeredOwner?: string | undefined,
1242
+ /**
1243
+ * Only on `found`: every page the VAT number was read from, `sourceUrl` first — each research
1244
+ * pass that found the same number contributes its page. At most 5.
1245
+ */
1246
+ sourceUrls?: string[]);
1247
+ /** True when a VAT number was found but rejected by the official check. */
1248
+ hasRejectedCandidates(): boolean;
1172
1249
  static fromArray(data: Record<string, unknown>): SmartEnrichmentResource;
1173
1250
  toArray(): Record<string, unknown>;
1174
1251
  }
@@ -1897,4 +1974,4 @@ declare class AuthRetryHttpClient implements HttpClientInterface {
1897
1974
  private injectAuthHeader;
1898
1975
  }
1899
1976
 
1900
- export { ApiVersion, AuthEndpoint, AuthRetryHttpClient, AuthenticationException, CompanyAddress, CompanyEndpoint, type CompanyResource, ComplianceDocumentType, ComplianceEnrollment, ComplianceEnrollmentPage, ComplianceEnrollmentStatus, type ComplianceEnterpriseSize, type ComplianceInvoiceLineInput, type ComplianceInvoiceTaxInput, type ComplianceLedgerStateChangedEvent, type ComplianceLedgerWebhookObject, type ComplianceRequestService, ComplianceService, ComplianceTaxReport, ComplianceTaxReportPage, type ComplianceTaxReportRequestState, ComplianceTaxReportState, ComplianceTransaction, type ComplianceTransactionBuyerInput, type ComplianceTransactionFilters, type ComplianceTransactionInvoiceLine, type ComplianceTransactionInvoiceLineTax, ComplianceTransactionPage, type ComplianceTransactionRequestState, type ComplianceTransactionRequestType, ComplianceTransactionState, type ComplianceTransactionStateChangedEvent, ComplianceTransactionType, type ComplianceTransactionWebhookObject, type ComplianceTypeOperation, type CreateComplianceEnrollmentInput, type CreateComplianceTransactionInput, type CreateNorwayEnrollmentInput, DEFAULT_WEBHOOK_TOLERANCE_SECONDS, type EReportingAccessRequestInput, EReportingEndpoint, type EReportingInterval, type EnrichmentCompletedEvent, type EnrichmentCompletedWebhookObject, type EnrichmentUpdatedEvent, type EnrichmentUpdatedWebhookObject, Environment, Environment as EnvironmentType, FetchHttpClient, type HttpClientInterface, HttpException, ImportResult, InMemoryTokenStorage, Language, LoginIdentifier, type NorwayEnrollmentInput, NorwegianOrgNumber, type ParsedWebhookSignatureHeader, PeppolLookupResult, PeppolLookupStatus, ProviderDocument, ProviderDocumentLine, RegistryCompany, RetryPolicy, type RetryPolicyOptions, type RevenueCountryBreakdown, type RevenueCurrencyBreakdown, type RevenueStateBreakdown, RevenueStatistics, type RevenueStatisticsFilters, type RevenueTimeBucket, type RevenueTotals, type RevenueTypeBreakdown, ScoreBreakdown, SireneLookupResult, type SmartEnrichmentAddressQuality, type SmartEnrichmentConfidenceBucket, SmartEnrichmentEndpoint, type SmartEnrichmentExportOptions, type SmartEnrichmentHistoryInput, SmartEnrichmentHistoryPage, SmartEnrichmentHistoryRow, type SmartEnrichmentHistoryStats, type SmartEnrichmentInput, SmartEnrichmentJob, SmartEnrichmentMode, type SmartEnrichmentOutcomeBreakdown, type SmartEnrichmentProviderVerdict, SmartEnrichmentResource, type SmartEnrichmentSourceBreakdown, SmartEnrichmentStatistics, type SmartEnrichmentStatisticsInterval, type SmartEnrichmentStatisticsOptions, type SmartEnrichmentStatisticsRange, type SmartEnrichmentStatisticsTotals, SmartEnrichmentStatus, type SmartEnrichmentTimeBucket, type SmartEnrichmentUsage, type SmartEnrichmentUsageHistoryEntry, type SmartEnrichmentWaitOptions, TaxoraClient, TaxoraClientFactory, type TaxoraClientOptions, TaxoraException, type TaxoraWebhookEvent, type TestWebhookObject, Token, type TokenStorageInterface, type UpdateComplianceTransactionInput, ValidationException, VatCertificateExport, VatCollection, VatEndpoint, type VatRate, VatRates, VatResource, VatState, type VatStateChangedEvent, type VatValidatedEvent, VatValidationAddressInput, type VatWebhookObject, WEBHOOK_ID_HEADER, WEBHOOK_SIGNATURE_HEADER, type WebhookEventEnvelope, type WebhookEventType, type WebhookRawBody, type WebhookSignatureErrorReason, type WebhookSignatureHeaderInput, WebhookSignatureVerificationError, type WebhookTestEvent, type WebhookVerifyOptions, computeWebhookSignature, constructWebhookEvent, describeApiError, describeComplianceDocumentType, describeComplianceEnrollmentStatus, describeComplianceService, describeComplianceTaxReportState, describeComplianceTransactionState, describeComplianceTransactionType, describePeppolLookupStatus, describeSmartEnrichmentMode, describeSmartEnrichmentStatus, describeVatState, generateWebhookSignatureHeader, getBaseUrl, getFailedVatStates, parseWebhookSignatureHeader, toComplianceDocumentType, toComplianceEnrollmentStatus, toComplianceService, toComplianceTaxReportState, toComplianceTransactionState, toComplianceTransactionType, toPeppolLookupStatus, toSmartEnrichmentMode, toSmartEnrichmentStatus, verifyWebhookSignature };
1977
+ export { ApiVersion, AuthEndpoint, AuthRetryHttpClient, AuthenticationException, CompanyAddress, CompanyEndpoint, type CompanyResource, ComplianceDocumentType, ComplianceEnrollment, ComplianceEnrollmentPage, ComplianceEnrollmentStatus, type ComplianceEnterpriseSize, type ComplianceInvoiceLineInput, type ComplianceInvoiceTaxInput, type ComplianceLedgerStateChangedEvent, type ComplianceLedgerWebhookObject, type ComplianceRequestService, ComplianceService, ComplianceTaxReport, ComplianceTaxReportPage, type ComplianceTaxReportRequestState, ComplianceTaxReportState, ComplianceTransaction, type ComplianceTransactionBuyerInput, type ComplianceTransactionFilters, type ComplianceTransactionInvoiceLine, type ComplianceTransactionInvoiceLineTax, ComplianceTransactionPage, type ComplianceTransactionRequestState, type ComplianceTransactionRequestType, ComplianceTransactionState, type ComplianceTransactionStateChangedEvent, ComplianceTransactionType, type ComplianceTransactionWebhookObject, type ComplianceTypeOperation, type CreateComplianceEnrollmentInput, type CreateComplianceTransactionInput, type CreateNorwayEnrollmentInput, DEFAULT_WEBHOOK_TOLERANCE_SECONDS, type EReportingAccessRequestInput, EReportingEndpoint, type EReportingInterval, type EnrichmentCompletedEvent, type EnrichmentCompletedWebhookObject, type EnrichmentUpdatedEvent, type EnrichmentUpdatedWebhookObject, Environment, Environment as EnvironmentType, FetchHttpClient, type HttpClientInterface, HttpException, ImportResult, InMemoryTokenStorage, Language, LoginIdentifier, type NorwayEnrollmentInput, NorwegianOrgNumber, type ParsedWebhookSignatureHeader, PeppolLookupResult, PeppolLookupStatus, ProviderDocument, ProviderDocumentLine, RegistryCompany, RetryPolicy, type RetryPolicyOptions, type RevenueCountryBreakdown, type RevenueCurrencyBreakdown, type RevenueStateBreakdown, RevenueStatistics, type RevenueStatisticsFilters, type RevenueTimeBucket, type RevenueTotals, type RevenueTypeBreakdown, ScoreBreakdown, SireneLookupResult, type SmartEnrichmentAddressQuality, type SmartEnrichmentConfidenceBucket, SmartEnrichmentEndpoint, type SmartEnrichmentExportOptions, type SmartEnrichmentHistoryInput, SmartEnrichmentHistoryPage, SmartEnrichmentHistoryRow, type SmartEnrichmentHistoryStats, type SmartEnrichmentInput, SmartEnrichmentJob, SmartEnrichmentMode, type SmartEnrichmentOutcomeBreakdown, type SmartEnrichmentProviderVerdict, 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 };
package/dist/index.d.ts CHANGED
@@ -1092,6 +1092,32 @@ type SmartEnrichmentMode = (typeof SmartEnrichmentMode)[keyof typeof SmartEnrich
1092
1092
  declare function toSmartEnrichmentMode(value: unknown): SmartEnrichmentMode | undefined;
1093
1093
  declare function describeSmartEnrichmentMode(mode: SmartEnrichmentMode): string;
1094
1094
 
1095
+ /**
1096
+ * Why a VAT number the research DID find was not returned as the result.
1097
+ *
1098
+ * Only appears on `not_found` results (see `SmartEnrichmentResource.rejectedCandidates`), so
1099
+ * "a number was found, but the tax authority calls it invalid" can be told apart from "nothing
1100
+ * was found at all".
1101
+ */
1102
+ declare const SmartEnrichmentRejectionReason: {
1103
+ /** The tax authority reports the number as not (or no longer) valid. */
1104
+ readonly VAT_INVALID: "vat_invalid";
1105
+ /** The number is valid, but registered to a different company. */
1106
+ readonly NAME_MISMATCH: "name_mismatch";
1107
+ /** The number could not be tied to the requested company. */
1108
+ readonly UNBOUND: "unbound";
1109
+ /** The number could not be checked against the tax authority. */
1110
+ readonly UNVERIFIED: "unverified";
1111
+ /** Rejected for another reason. */
1112
+ readonly REJECTED: "rejected";
1113
+ /** A reason this SDK version does not know yet. */
1114
+ readonly UNKNOWN: "unknown";
1115
+ };
1116
+ type SmartEnrichmentRejectionReason = (typeof SmartEnrichmentRejectionReason)[keyof typeof SmartEnrichmentRejectionReason];
1117
+ /** Tolerant coercion: unrecognized values become `unknown` instead of throwing. */
1118
+ declare function toSmartEnrichmentRejectionReason(value: unknown): SmartEnrichmentRejectionReason;
1119
+ declare function describeSmartEnrichmentRejectionReason(reason: SmartEnrichmentRejectionReason): string;
1120
+
1095
1121
  declare const SmartEnrichmentStatus: {
1096
1122
  readonly FOUND: "found";
1097
1123
  readonly NO_VAT_EXISTS: "no_vat_exists";
@@ -1135,6 +1161,11 @@ interface SmartEnrichmentAddressQuality {
1135
1161
  cityMatchesPostalCode: boolean | null;
1136
1162
  warnings: string[];
1137
1163
  }
1164
+ /** A VAT number the research named, but the official check threw out. */
1165
+ interface SmartEnrichmentRejectedCandidate {
1166
+ vatNumber: string;
1167
+ reason: SmartEnrichmentRejectionReason;
1168
+ }
1138
1169
  /**
1139
1170
  * Result of resolving one reverse-VAT lookup (company name + address → VAT + confidence).
1140
1171
  * Mirrors the API response item shape (camelCase keys).
@@ -1158,6 +1189,28 @@ declare class SmartEnrichmentResource {
1158
1189
  */
1159
1190
  readonly providerVerdicts: SmartEnrichmentProviderVerdict[];
1160
1191
  readonly addressQuality: SmartEnrichmentAddressQuality | undefined;
1192
+ /**
1193
+ * Only on `not_found`: VAT numbers the research DID find but the official check threw out —
1194
+ * e.g. one the tax authority reports as invalid. Lets you tell "found one, it is invalid"
1195
+ * apart from "found nothing". Empty for every other status.
1196
+ */
1197
+ readonly rejectedCandidates: SmartEnrichmentRejectedCandidate[];
1198
+ /**
1199
+ * Only on `found`: the web page the VAT number was read from — usually the company's own
1200
+ * Impressum / legal notice. Undefined when it came from Taxora's own data or a register.
1201
+ */
1202
+ readonly sourceUrl: string | undefined;
1203
+ /**
1204
+ * Only on `found`: the PERSON the tax authority has the VAT ID under, when that is not the
1205
+ * trading name — typical for a German sole proprietorship (e.K.). `matchedCompanyName` stays
1206
+ * the trading name.
1207
+ */
1208
+ readonly registeredOwner: string | undefined;
1209
+ /**
1210
+ * Only on `found`: every page the VAT number was read from, `sourceUrl` first — each research
1211
+ * pass that found the same number contributes its page. At most 5.
1212
+ */
1213
+ readonly sourceUrls: string[];
1161
1214
  constructor(status: SmartEnrichmentStatus, vatNumber: string | undefined, vatType: string | undefined, confidence: number | undefined, matchedCompanyName: string | undefined,
1162
1215
  /** Official/registered address of the matched company, when available. */
1163
1216
  matchedAddress: string | undefined, country: string | undefined, source: string | undefined,
@@ -1168,7 +1221,31 @@ declare class SmartEnrichmentResource {
1168
1221
  * (complex mode, or a fallback). Two entries reporting the same vatNumber is the strongest
1169
1222
  * confirmation this layer produces.
1170
1223
  */
1171
- providerVerdicts?: SmartEnrichmentProviderVerdict[], addressQuality?: SmartEnrichmentAddressQuality | undefined);
1224
+ providerVerdicts?: SmartEnrichmentProviderVerdict[], addressQuality?: SmartEnrichmentAddressQuality | undefined,
1225
+ /**
1226
+ * Only on `not_found`: VAT numbers the research DID find but the official check threw out —
1227
+ * e.g. one the tax authority reports as invalid. Lets you tell "found one, it is invalid"
1228
+ * apart from "found nothing". Empty for every other status.
1229
+ */
1230
+ rejectedCandidates?: SmartEnrichmentRejectedCandidate[],
1231
+ /**
1232
+ * Only on `found`: the web page the VAT number was read from — usually the company's own
1233
+ * Impressum / legal notice. Undefined when it came from Taxora's own data or a register.
1234
+ */
1235
+ sourceUrl?: string | undefined,
1236
+ /**
1237
+ * Only on `found`: the PERSON the tax authority has the VAT ID under, when that is not the
1238
+ * trading name — typical for a German sole proprietorship (e.K.). `matchedCompanyName` stays
1239
+ * the trading name.
1240
+ */
1241
+ registeredOwner?: string | undefined,
1242
+ /**
1243
+ * Only on `found`: every page the VAT number was read from, `sourceUrl` first — each research
1244
+ * pass that found the same number contributes its page. At most 5.
1245
+ */
1246
+ sourceUrls?: string[]);
1247
+ /** True when a VAT number was found but rejected by the official check. */
1248
+ hasRejectedCandidates(): boolean;
1172
1249
  static fromArray(data: Record<string, unknown>): SmartEnrichmentResource;
1173
1250
  toArray(): Record<string, unknown>;
1174
1251
  }
@@ -1897,4 +1974,4 @@ declare class AuthRetryHttpClient implements HttpClientInterface {
1897
1974
  private injectAuthHeader;
1898
1975
  }
1899
1976
 
1900
- export { ApiVersion, AuthEndpoint, AuthRetryHttpClient, AuthenticationException, CompanyAddress, CompanyEndpoint, type CompanyResource, ComplianceDocumentType, ComplianceEnrollment, ComplianceEnrollmentPage, ComplianceEnrollmentStatus, type ComplianceEnterpriseSize, type ComplianceInvoiceLineInput, type ComplianceInvoiceTaxInput, type ComplianceLedgerStateChangedEvent, type ComplianceLedgerWebhookObject, type ComplianceRequestService, ComplianceService, ComplianceTaxReport, ComplianceTaxReportPage, type ComplianceTaxReportRequestState, ComplianceTaxReportState, ComplianceTransaction, type ComplianceTransactionBuyerInput, type ComplianceTransactionFilters, type ComplianceTransactionInvoiceLine, type ComplianceTransactionInvoiceLineTax, ComplianceTransactionPage, type ComplianceTransactionRequestState, type ComplianceTransactionRequestType, ComplianceTransactionState, type ComplianceTransactionStateChangedEvent, ComplianceTransactionType, type ComplianceTransactionWebhookObject, type ComplianceTypeOperation, type CreateComplianceEnrollmentInput, type CreateComplianceTransactionInput, type CreateNorwayEnrollmentInput, DEFAULT_WEBHOOK_TOLERANCE_SECONDS, type EReportingAccessRequestInput, EReportingEndpoint, type EReportingInterval, type EnrichmentCompletedEvent, type EnrichmentCompletedWebhookObject, type EnrichmentUpdatedEvent, type EnrichmentUpdatedWebhookObject, Environment, Environment as EnvironmentType, FetchHttpClient, type HttpClientInterface, HttpException, ImportResult, InMemoryTokenStorage, Language, LoginIdentifier, type NorwayEnrollmentInput, NorwegianOrgNumber, type ParsedWebhookSignatureHeader, PeppolLookupResult, PeppolLookupStatus, ProviderDocument, ProviderDocumentLine, RegistryCompany, RetryPolicy, type RetryPolicyOptions, type RevenueCountryBreakdown, type RevenueCurrencyBreakdown, type RevenueStateBreakdown, RevenueStatistics, type RevenueStatisticsFilters, type RevenueTimeBucket, type RevenueTotals, type RevenueTypeBreakdown, ScoreBreakdown, SireneLookupResult, type SmartEnrichmentAddressQuality, type SmartEnrichmentConfidenceBucket, SmartEnrichmentEndpoint, type SmartEnrichmentExportOptions, type SmartEnrichmentHistoryInput, SmartEnrichmentHistoryPage, SmartEnrichmentHistoryRow, type SmartEnrichmentHistoryStats, type SmartEnrichmentInput, SmartEnrichmentJob, SmartEnrichmentMode, type SmartEnrichmentOutcomeBreakdown, type SmartEnrichmentProviderVerdict, SmartEnrichmentResource, type SmartEnrichmentSourceBreakdown, SmartEnrichmentStatistics, type SmartEnrichmentStatisticsInterval, type SmartEnrichmentStatisticsOptions, type SmartEnrichmentStatisticsRange, type SmartEnrichmentStatisticsTotals, SmartEnrichmentStatus, type SmartEnrichmentTimeBucket, type SmartEnrichmentUsage, type SmartEnrichmentUsageHistoryEntry, type SmartEnrichmentWaitOptions, TaxoraClient, TaxoraClientFactory, type TaxoraClientOptions, TaxoraException, type TaxoraWebhookEvent, type TestWebhookObject, Token, type TokenStorageInterface, type UpdateComplianceTransactionInput, ValidationException, VatCertificateExport, VatCollection, VatEndpoint, type VatRate, VatRates, VatResource, VatState, type VatStateChangedEvent, type VatValidatedEvent, VatValidationAddressInput, type VatWebhookObject, WEBHOOK_ID_HEADER, WEBHOOK_SIGNATURE_HEADER, type WebhookEventEnvelope, type WebhookEventType, type WebhookRawBody, type WebhookSignatureErrorReason, type WebhookSignatureHeaderInput, WebhookSignatureVerificationError, type WebhookTestEvent, type WebhookVerifyOptions, computeWebhookSignature, constructWebhookEvent, describeApiError, describeComplianceDocumentType, describeComplianceEnrollmentStatus, describeComplianceService, describeComplianceTaxReportState, describeComplianceTransactionState, describeComplianceTransactionType, describePeppolLookupStatus, describeSmartEnrichmentMode, describeSmartEnrichmentStatus, describeVatState, generateWebhookSignatureHeader, getBaseUrl, getFailedVatStates, parseWebhookSignatureHeader, toComplianceDocumentType, toComplianceEnrollmentStatus, toComplianceService, toComplianceTaxReportState, toComplianceTransactionState, toComplianceTransactionType, toPeppolLookupStatus, toSmartEnrichmentMode, toSmartEnrichmentStatus, verifyWebhookSignature };
1977
+ export { ApiVersion, AuthEndpoint, AuthRetryHttpClient, AuthenticationException, CompanyAddress, CompanyEndpoint, type CompanyResource, ComplianceDocumentType, ComplianceEnrollment, ComplianceEnrollmentPage, ComplianceEnrollmentStatus, type ComplianceEnterpriseSize, type ComplianceInvoiceLineInput, type ComplianceInvoiceTaxInput, type ComplianceLedgerStateChangedEvent, type ComplianceLedgerWebhookObject, type ComplianceRequestService, ComplianceService, ComplianceTaxReport, ComplianceTaxReportPage, type ComplianceTaxReportRequestState, ComplianceTaxReportState, ComplianceTransaction, type ComplianceTransactionBuyerInput, type ComplianceTransactionFilters, type ComplianceTransactionInvoiceLine, type ComplianceTransactionInvoiceLineTax, ComplianceTransactionPage, type ComplianceTransactionRequestState, type ComplianceTransactionRequestType, ComplianceTransactionState, type ComplianceTransactionStateChangedEvent, ComplianceTransactionType, type ComplianceTransactionWebhookObject, type ComplianceTypeOperation, type CreateComplianceEnrollmentInput, type CreateComplianceTransactionInput, type CreateNorwayEnrollmentInput, DEFAULT_WEBHOOK_TOLERANCE_SECONDS, type EReportingAccessRequestInput, EReportingEndpoint, type EReportingInterval, type EnrichmentCompletedEvent, type EnrichmentCompletedWebhookObject, type EnrichmentUpdatedEvent, type EnrichmentUpdatedWebhookObject, Environment, Environment as EnvironmentType, FetchHttpClient, type HttpClientInterface, HttpException, ImportResult, InMemoryTokenStorage, Language, LoginIdentifier, type NorwayEnrollmentInput, NorwegianOrgNumber, type ParsedWebhookSignatureHeader, PeppolLookupResult, PeppolLookupStatus, ProviderDocument, ProviderDocumentLine, RegistryCompany, RetryPolicy, type RetryPolicyOptions, type RevenueCountryBreakdown, type RevenueCurrencyBreakdown, type RevenueStateBreakdown, RevenueStatistics, type RevenueStatisticsFilters, type RevenueTimeBucket, type RevenueTotals, type RevenueTypeBreakdown, ScoreBreakdown, SireneLookupResult, type SmartEnrichmentAddressQuality, type SmartEnrichmentConfidenceBucket, SmartEnrichmentEndpoint, type SmartEnrichmentExportOptions, type SmartEnrichmentHistoryInput, SmartEnrichmentHistoryPage, SmartEnrichmentHistoryRow, type SmartEnrichmentHistoryStats, type SmartEnrichmentInput, SmartEnrichmentJob, SmartEnrichmentMode, type SmartEnrichmentOutcomeBreakdown, type SmartEnrichmentProviderVerdict, 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 };
package/dist/index.js CHANGED
@@ -2224,6 +2224,43 @@ function describeSmartEnrichmentMode(mode) {
2224
2224
  return DESCRIPTIONS8[mode];
2225
2225
  }
2226
2226
 
2227
+ // src/enums/SmartEnrichmentRejectionReason.ts
2228
+ var SmartEnrichmentRejectionReason = {
2229
+ /** The tax authority reports the number as not (or no longer) valid. */
2230
+ VAT_INVALID: "vat_invalid",
2231
+ /** The number is valid, but registered to a different company. */
2232
+ NAME_MISMATCH: "name_mismatch",
2233
+ /** The number could not be tied to the requested company. */
2234
+ UNBOUND: "unbound",
2235
+ /** The number could not be checked against the tax authority. */
2236
+ UNVERIFIED: "unverified",
2237
+ /** Rejected for another reason. */
2238
+ REJECTED: "rejected",
2239
+ /** A reason this SDK version does not know yet. */
2240
+ UNKNOWN: "unknown"
2241
+ };
2242
+ var VALUES9 = Object.values(SmartEnrichmentRejectionReason);
2243
+ function toSmartEnrichmentRejectionReason(value) {
2244
+ if (typeof value === "string") {
2245
+ const normalized = value.trim().toLowerCase();
2246
+ if (VALUES9.includes(normalized)) {
2247
+ return normalized;
2248
+ }
2249
+ }
2250
+ return SmartEnrichmentRejectionReason.UNKNOWN;
2251
+ }
2252
+ var DESCRIPTIONS9 = {
2253
+ [SmartEnrichmentRejectionReason.VAT_INVALID]: "The tax authority reports the VAT number as invalid.",
2254
+ [SmartEnrichmentRejectionReason.NAME_MISMATCH]: "The VAT number is registered to a different company.",
2255
+ [SmartEnrichmentRejectionReason.UNBOUND]: "The VAT number could not be tied to the requested company.",
2256
+ [SmartEnrichmentRejectionReason.UNVERIFIED]: "The VAT number could not be verified with the tax authority.",
2257
+ [SmartEnrichmentRejectionReason.REJECTED]: "The VAT number was not confirmed.",
2258
+ [SmartEnrichmentRejectionReason.UNKNOWN]: "Unknown rejection reason."
2259
+ };
2260
+ function describeSmartEnrichmentRejectionReason(reason) {
2261
+ return DESCRIPTIONS9[reason];
2262
+ }
2263
+
2227
2264
  // src/enums/SmartEnrichmentStatus.ts
2228
2265
  var SmartEnrichmentStatus = {
2229
2266
  FOUND: "found",
@@ -2235,17 +2272,17 @@ var SmartEnrichmentStatus = {
2235
2272
  FAILED: "failed",
2236
2273
  UNKNOWN: "unknown"
2237
2274
  };
2238
- var VALUES9 = Object.values(SmartEnrichmentStatus);
2275
+ var VALUES10 = Object.values(SmartEnrichmentStatus);
2239
2276
  function toSmartEnrichmentStatus(value) {
2240
2277
  if (typeof value === "string") {
2241
2278
  const normalized = value.trim().toLowerCase();
2242
- if (VALUES9.includes(normalized)) {
2279
+ if (VALUES10.includes(normalized)) {
2243
2280
  return normalized;
2244
2281
  }
2245
2282
  }
2246
2283
  return SmartEnrichmentStatus.UNKNOWN;
2247
2284
  }
2248
- var DESCRIPTIONS9 = {
2285
+ var DESCRIPTIONS10 = {
2249
2286
  [SmartEnrichmentStatus.FOUND]: "A VAT number was resolved and confirmed.",
2250
2287
  [SmartEnrichmentStatus.NO_VAT_EXISTS]: "The company was identified but has no VAT number.",
2251
2288
  [SmartEnrichmentStatus.NOT_FOUND]: "No sufficiently-confident match could be resolved.",
@@ -2256,12 +2293,30 @@ var DESCRIPTIONS9 = {
2256
2293
  [SmartEnrichmentStatus.UNKNOWN]: "Unknown status."
2257
2294
  };
2258
2295
  function describeSmartEnrichmentStatus(status) {
2259
- return DESCRIPTIONS9[status];
2296
+ return DESCRIPTIONS10[status];
2260
2297
  }
2261
2298
 
2262
2299
  // src/dto/SmartEnrichmentResource.ts
2300
+ function toRejectedCandidates(value) {
2301
+ if (!Array.isArray(value)) {
2302
+ return [];
2303
+ }
2304
+ const candidates = [];
2305
+ for (const entry of value) {
2306
+ if (typeof entry !== "object" || entry === null) {
2307
+ continue;
2308
+ }
2309
+ const record = entry;
2310
+ const vatNumber = typeof record["vatNumber"] === "string" ? record["vatNumber"].trim() : "";
2311
+ if (vatNumber === "") {
2312
+ continue;
2313
+ }
2314
+ candidates.push({ vatNumber, reason: toSmartEnrichmentRejectionReason(record["reason"]) });
2315
+ }
2316
+ return candidates;
2317
+ }
2263
2318
  var SmartEnrichmentResource = class _SmartEnrichmentResource {
2264
- constructor(status, vatNumber, vatType, confidence, matchedCompanyName, matchedAddress, country, source, mode = void 0, providerVerdicts = [], addressQuality = void 0) {
2319
+ constructor(status, vatNumber, vatType, confidence, matchedCompanyName, matchedAddress, country, source, mode = void 0, providerVerdicts = [], addressQuality = void 0, rejectedCandidates = [], sourceUrl = void 0, registeredOwner = void 0, sourceUrls = []) {
2265
2320
  this.status = status;
2266
2321
  this.vatNumber = vatNumber;
2267
2322
  this.vatType = vatType;
@@ -2273,6 +2328,10 @@ var SmartEnrichmentResource = class _SmartEnrichmentResource {
2273
2328
  this.mode = mode;
2274
2329
  this.providerVerdicts = providerVerdicts;
2275
2330
  this.addressQuality = addressQuality;
2331
+ this.rejectedCandidates = rejectedCandidates;
2332
+ this.sourceUrl = sourceUrl;
2333
+ this.registeredOwner = registeredOwner;
2334
+ this.sourceUrls = sourceUrls;
2276
2335
  }
2277
2336
  status;
2278
2337
  vatNumber;
@@ -2285,11 +2344,26 @@ var SmartEnrichmentResource = class _SmartEnrichmentResource {
2285
2344
  mode;
2286
2345
  providerVerdicts;
2287
2346
  addressQuality;
2347
+ rejectedCandidates;
2348
+ sourceUrl;
2349
+ registeredOwner;
2350
+ sourceUrls;
2351
+ /** True when a VAT number was found but rejected by the official check. */
2352
+ hasRejectedCandidates() {
2353
+ return this.rejectedCandidates.length > 0;
2354
+ }
2288
2355
  static fromArray(data) {
2289
2356
  const str = (key) => {
2290
2357
  const v = data[key];
2291
2358
  return typeof v === "string" ? v : void 0;
2292
2359
  };
2360
+ const text = (key) => {
2361
+ const v = str(key)?.trim();
2362
+ return v ? v : void 0;
2363
+ };
2364
+ const isWebUrl = (value) => typeof value === "string" && /^https?:\/\/\S+$/i.test(value.trim());
2365
+ const url = text("sourceUrl");
2366
+ const urls = data["sourceUrls"];
2293
2367
  const num = (key) => {
2294
2368
  const v = data[key];
2295
2369
  return typeof v === "number" ? v : void 0;
@@ -2307,7 +2381,11 @@ var SmartEnrichmentResource = class _SmartEnrichmentResource {
2307
2381
  str("source"),
2308
2382
  toSmartEnrichmentMode(data["mode"]),
2309
2383
  Array.isArray(verdicts) ? verdicts.filter((v) => typeof v === "object" && v !== null) : [],
2310
- typeof quality === "object" && quality !== null ? quality : void 0
2384
+ typeof quality === "object" && quality !== null ? quality : void 0,
2385
+ toRejectedCandidates(data["rejectedCandidates"]),
2386
+ url && isWebUrl(url) ? url : void 0,
2387
+ text("registeredOwner"),
2388
+ Array.isArray(urls) ? [...new Set(urls.filter(isWebUrl).map((u) => u.trim()))] : []
2311
2389
  );
2312
2390
  }
2313
2391
  toArray() {
@@ -2322,7 +2400,11 @@ var SmartEnrichmentResource = class _SmartEnrichmentResource {
2322
2400
  source: this.source ?? null,
2323
2401
  mode: this.mode ?? null,
2324
2402
  providerVerdicts: this.providerVerdicts,
2325
- addressQuality: this.addressQuality ?? null
2403
+ addressQuality: this.addressQuality ?? null,
2404
+ rejectedCandidates: this.rejectedCandidates.map((c) => ({ vatNumber: c.vatNumber, reason: c.reason })),
2405
+ sourceUrl: this.sourceUrl ?? null,
2406
+ registeredOwner: this.registeredOwner ?? null,
2407
+ sourceUrls: this.sourceUrls
2326
2408
  };
2327
2409
  }
2328
2410
  };
@@ -2861,14 +2943,14 @@ var VatState = {
2861
2943
  function getFailedVatStates() {
2862
2944
  return [VatState.INVALID, VatState.FRAUD];
2863
2945
  }
2864
- var DESCRIPTIONS10 = {
2946
+ var DESCRIPTIONS11 = {
2865
2947
  [VatState.VALID]: "The VAT number is valid and active.",
2866
2948
  [VatState.INVALID]: "The VAT number is invalid or not registered.",
2867
2949
  [VatState.FRAUD]: "The VAT number has been flagged as potentially fraudulent.",
2868
2950
  [VatState.UNKNOWN]: "The VAT number state could not be determined."
2869
2951
  };
2870
2952
  function describeVatState(state) {
2871
- return DESCRIPTIONS10[state];
2953
+ return DESCRIPTIONS11[state];
2872
2954
  }
2873
2955
 
2874
2956
  // src/dto/CompanyAddress.ts
@@ -3600,7 +3682,7 @@ var AuthRetryHttpClient = class {
3600
3682
  };
3601
3683
 
3602
3684
  // src/version.ts
3603
- var SDK_VERSION = "1.3.0";
3685
+ var SDK_VERSION = "1.5.0";
3604
3686
 
3605
3687
  // src/http/SdkVersionHttpClient.ts
3606
3688
  var SDK_VERSION_HEADER = "X-Taxora-SDK-Version";
@@ -3829,6 +3911,7 @@ export {
3829
3911
  SmartEnrichmentHistoryRow,
3830
3912
  SmartEnrichmentJob,
3831
3913
  SmartEnrichmentMode,
3914
+ SmartEnrichmentRejectionReason,
3832
3915
  SmartEnrichmentResource,
3833
3916
  SmartEnrichmentStatistics,
3834
3917
  SmartEnrichmentStatus,
@@ -3858,6 +3941,7 @@ export {
3858
3941
  describeComplianceTransactionType,
3859
3942
  describePeppolLookupStatus,
3860
3943
  describeSmartEnrichmentMode,
3944
+ describeSmartEnrichmentRejectionReason,
3861
3945
  describeSmartEnrichmentStatus,
3862
3946
  describeVatState,
3863
3947
  generateWebhookSignatureHeader,
@@ -3872,6 +3956,7 @@ export {
3872
3956
  toComplianceTransactionType,
3873
3957
  toPeppolLookupStatus,
3874
3958
  toSmartEnrichmentMode,
3959
+ toSmartEnrichmentRejectionReason,
3875
3960
  toSmartEnrichmentStatus,
3876
3961
  verifyWebhookSignature
3877
3962
  };