@taxora/sdk 1.3.0 → 1.4.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 +15 -0
- package/README.md +7 -0
- package/dist/index.cjs +79 -10
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +47 -2
- package/dist/index.d.ts +47 -2
- package/dist/index.js +76 -10
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
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,12 @@ 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[];
|
|
1161
1198
|
constructor(status: SmartEnrichmentStatus, vatNumber: string | undefined, vatType: string | undefined, confidence: number | undefined, matchedCompanyName: string | undefined,
|
|
1162
1199
|
/** Official/registered address of the matched company, when available. */
|
|
1163
1200
|
matchedAddress: string | undefined, country: string | undefined, source: string | undefined,
|
|
@@ -1168,7 +1205,15 @@ declare class SmartEnrichmentResource {
|
|
|
1168
1205
|
* (complex mode, or a fallback). Two entries reporting the same vatNumber is the strongest
|
|
1169
1206
|
* confirmation this layer produces.
|
|
1170
1207
|
*/
|
|
1171
|
-
providerVerdicts?: SmartEnrichmentProviderVerdict[], addressQuality?: SmartEnrichmentAddressQuality | undefined
|
|
1208
|
+
providerVerdicts?: SmartEnrichmentProviderVerdict[], addressQuality?: SmartEnrichmentAddressQuality | undefined,
|
|
1209
|
+
/**
|
|
1210
|
+
* Only on `not_found`: VAT numbers the research DID find but the official check threw out —
|
|
1211
|
+
* e.g. one the tax authority reports as invalid. Lets you tell "found one, it is invalid"
|
|
1212
|
+
* apart from "found nothing". Empty for every other status.
|
|
1213
|
+
*/
|
|
1214
|
+
rejectedCandidates?: SmartEnrichmentRejectedCandidate[]);
|
|
1215
|
+
/** True when a VAT number was found but rejected by the official check. */
|
|
1216
|
+
hasRejectedCandidates(): boolean;
|
|
1172
1217
|
static fromArray(data: Record<string, unknown>): SmartEnrichmentResource;
|
|
1173
1218
|
toArray(): Record<string, unknown>;
|
|
1174
1219
|
}
|
|
@@ -1897,4 +1942,4 @@ declare class AuthRetryHttpClient implements HttpClientInterface {
|
|
|
1897
1942
|
private injectAuthHeader;
|
|
1898
1943
|
}
|
|
1899
1944
|
|
|
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 };
|
|
1945
|
+
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,12 @@ 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[];
|
|
1161
1198
|
constructor(status: SmartEnrichmentStatus, vatNumber: string | undefined, vatType: string | undefined, confidence: number | undefined, matchedCompanyName: string | undefined,
|
|
1162
1199
|
/** Official/registered address of the matched company, when available. */
|
|
1163
1200
|
matchedAddress: string | undefined, country: string | undefined, source: string | undefined,
|
|
@@ -1168,7 +1205,15 @@ declare class SmartEnrichmentResource {
|
|
|
1168
1205
|
* (complex mode, or a fallback). Two entries reporting the same vatNumber is the strongest
|
|
1169
1206
|
* confirmation this layer produces.
|
|
1170
1207
|
*/
|
|
1171
|
-
providerVerdicts?: SmartEnrichmentProviderVerdict[], addressQuality?: SmartEnrichmentAddressQuality | undefined
|
|
1208
|
+
providerVerdicts?: SmartEnrichmentProviderVerdict[], addressQuality?: SmartEnrichmentAddressQuality | undefined,
|
|
1209
|
+
/**
|
|
1210
|
+
* Only on `not_found`: VAT numbers the research DID find but the official check threw out —
|
|
1211
|
+
* e.g. one the tax authority reports as invalid. Lets you tell "found one, it is invalid"
|
|
1212
|
+
* apart from "found nothing". Empty for every other status.
|
|
1213
|
+
*/
|
|
1214
|
+
rejectedCandidates?: SmartEnrichmentRejectedCandidate[]);
|
|
1215
|
+
/** True when a VAT number was found but rejected by the official check. */
|
|
1216
|
+
hasRejectedCandidates(): boolean;
|
|
1172
1217
|
static fromArray(data: Record<string, unknown>): SmartEnrichmentResource;
|
|
1173
1218
|
toArray(): Record<string, unknown>;
|
|
1174
1219
|
}
|
|
@@ -1897,4 +1942,4 @@ declare class AuthRetryHttpClient implements HttpClientInterface {
|
|
|
1897
1942
|
private injectAuthHeader;
|
|
1898
1943
|
}
|
|
1899
1944
|
|
|
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 };
|
|
1945
|
+
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
|
|
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 (
|
|
2279
|
+
if (VALUES10.includes(normalized)) {
|
|
2243
2280
|
return normalized;
|
|
2244
2281
|
}
|
|
2245
2282
|
}
|
|
2246
2283
|
return SmartEnrichmentStatus.UNKNOWN;
|
|
2247
2284
|
}
|
|
2248
|
-
var
|
|
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
|
|
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 = []) {
|
|
2265
2320
|
this.status = status;
|
|
2266
2321
|
this.vatNumber = vatNumber;
|
|
2267
2322
|
this.vatType = vatType;
|
|
@@ -2273,6 +2328,7 @@ var SmartEnrichmentResource = class _SmartEnrichmentResource {
|
|
|
2273
2328
|
this.mode = mode;
|
|
2274
2329
|
this.providerVerdicts = providerVerdicts;
|
|
2275
2330
|
this.addressQuality = addressQuality;
|
|
2331
|
+
this.rejectedCandidates = rejectedCandidates;
|
|
2276
2332
|
}
|
|
2277
2333
|
status;
|
|
2278
2334
|
vatNumber;
|
|
@@ -2285,6 +2341,11 @@ var SmartEnrichmentResource = class _SmartEnrichmentResource {
|
|
|
2285
2341
|
mode;
|
|
2286
2342
|
providerVerdicts;
|
|
2287
2343
|
addressQuality;
|
|
2344
|
+
rejectedCandidates;
|
|
2345
|
+
/** True when a VAT number was found but rejected by the official check. */
|
|
2346
|
+
hasRejectedCandidates() {
|
|
2347
|
+
return this.rejectedCandidates.length > 0;
|
|
2348
|
+
}
|
|
2288
2349
|
static fromArray(data) {
|
|
2289
2350
|
const str = (key) => {
|
|
2290
2351
|
const v = data[key];
|
|
@@ -2307,7 +2368,8 @@ var SmartEnrichmentResource = class _SmartEnrichmentResource {
|
|
|
2307
2368
|
str("source"),
|
|
2308
2369
|
toSmartEnrichmentMode(data["mode"]),
|
|
2309
2370
|
Array.isArray(verdicts) ? verdicts.filter((v) => typeof v === "object" && v !== null) : [],
|
|
2310
|
-
typeof quality === "object" && quality !== null ? quality : void 0
|
|
2371
|
+
typeof quality === "object" && quality !== null ? quality : void 0,
|
|
2372
|
+
toRejectedCandidates(data["rejectedCandidates"])
|
|
2311
2373
|
);
|
|
2312
2374
|
}
|
|
2313
2375
|
toArray() {
|
|
@@ -2322,7 +2384,8 @@ var SmartEnrichmentResource = class _SmartEnrichmentResource {
|
|
|
2322
2384
|
source: this.source ?? null,
|
|
2323
2385
|
mode: this.mode ?? null,
|
|
2324
2386
|
providerVerdicts: this.providerVerdicts,
|
|
2325
|
-
addressQuality: this.addressQuality ?? null
|
|
2387
|
+
addressQuality: this.addressQuality ?? null,
|
|
2388
|
+
rejectedCandidates: this.rejectedCandidates.map((c) => ({ vatNumber: c.vatNumber, reason: c.reason }))
|
|
2326
2389
|
};
|
|
2327
2390
|
}
|
|
2328
2391
|
};
|
|
@@ -2861,14 +2924,14 @@ var VatState = {
|
|
|
2861
2924
|
function getFailedVatStates() {
|
|
2862
2925
|
return [VatState.INVALID, VatState.FRAUD];
|
|
2863
2926
|
}
|
|
2864
|
-
var
|
|
2927
|
+
var DESCRIPTIONS11 = {
|
|
2865
2928
|
[VatState.VALID]: "The VAT number is valid and active.",
|
|
2866
2929
|
[VatState.INVALID]: "The VAT number is invalid or not registered.",
|
|
2867
2930
|
[VatState.FRAUD]: "The VAT number has been flagged as potentially fraudulent.",
|
|
2868
2931
|
[VatState.UNKNOWN]: "The VAT number state could not be determined."
|
|
2869
2932
|
};
|
|
2870
2933
|
function describeVatState(state) {
|
|
2871
|
-
return
|
|
2934
|
+
return DESCRIPTIONS11[state];
|
|
2872
2935
|
}
|
|
2873
2936
|
|
|
2874
2937
|
// src/dto/CompanyAddress.ts
|
|
@@ -3600,7 +3663,7 @@ var AuthRetryHttpClient = class {
|
|
|
3600
3663
|
};
|
|
3601
3664
|
|
|
3602
3665
|
// src/version.ts
|
|
3603
|
-
var SDK_VERSION = "1.
|
|
3666
|
+
var SDK_VERSION = "1.4.0";
|
|
3604
3667
|
|
|
3605
3668
|
// src/http/SdkVersionHttpClient.ts
|
|
3606
3669
|
var SDK_VERSION_HEADER = "X-Taxora-SDK-Version";
|
|
@@ -3829,6 +3892,7 @@ export {
|
|
|
3829
3892
|
SmartEnrichmentHistoryRow,
|
|
3830
3893
|
SmartEnrichmentJob,
|
|
3831
3894
|
SmartEnrichmentMode,
|
|
3895
|
+
SmartEnrichmentRejectionReason,
|
|
3832
3896
|
SmartEnrichmentResource,
|
|
3833
3897
|
SmartEnrichmentStatistics,
|
|
3834
3898
|
SmartEnrichmentStatus,
|
|
@@ -3858,6 +3922,7 @@ export {
|
|
|
3858
3922
|
describeComplianceTransactionType,
|
|
3859
3923
|
describePeppolLookupStatus,
|
|
3860
3924
|
describeSmartEnrichmentMode,
|
|
3925
|
+
describeSmartEnrichmentRejectionReason,
|
|
3861
3926
|
describeSmartEnrichmentStatus,
|
|
3862
3927
|
describeVatState,
|
|
3863
3928
|
generateWebhookSignatureHeader,
|
|
@@ -3872,6 +3937,7 @@ export {
|
|
|
3872
3937
|
toComplianceTransactionType,
|
|
3873
3938
|
toPeppolLookupStatus,
|
|
3874
3939
|
toSmartEnrichmentMode,
|
|
3940
|
+
toSmartEnrichmentRejectionReason,
|
|
3875
3941
|
toSmartEnrichmentStatus,
|
|
3876
3942
|
verifyWebhookSignature
|
|
3877
3943
|
};
|