@devly-cl/sii-client 0.7.9 → 0.7.11
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/README.md +68 -2
- package/dist/application/document-status.d.ts +5 -5
- package/dist/application/document-status.js +14 -9
- package/dist/application/dte-import-mapper.d.ts +8 -0
- package/dist/application/dte-import-mapper.js +25 -0
- package/dist/application/dte-import-model.d.ts +28 -0
- package/dist/application/dte-import-model.js +2 -0
- package/dist/application/dte-import.d.ts +37 -0
- package/dist/application/dte-import.js +352 -0
- package/dist/application/invoice-queries.d.ts +12 -6
- package/dist/application/invoice-queries.js +9 -5
- package/dist/application/issuance.d.ts +2 -2
- package/dist/application/issuance.js +26 -10
- package/dist/contracts.d.ts +32 -0
- package/dist/contracts.js +17 -0
- package/dist/domain/civil-date.d.ts +2 -0
- package/dist/domain/civil-date.js +10 -0
- package/dist/domain/document-status.d.ts +0 -4
- package/dist/domain/document-status.js +18 -11
- package/dist/domain/document.js +47 -9
- package/dist/domain/dte-arithmetic.d.ts +35 -0
- package/dist/domain/dte-arithmetic.js +78 -0
- package/dist/domain/dte-components.d.ts +9 -0
- package/dist/domain/dte-components.js +37 -0
- package/dist/domain/dte-detail.d.ts +111 -0
- package/dist/domain/dte-detail.js +2 -0
- package/dist/domain/dte-identity.d.ts +19 -0
- package/dist/domain/dte-identity.js +52 -0
- package/dist/domain/dte-money.d.ts +41 -0
- package/dist/domain/dte-money.js +81 -0
- package/dist/domain/dte-reconciliation-model.d.ts +87 -0
- package/dist/domain/dte-reconciliation-model.js +2 -0
- package/dist/domain/dte-reconciliation.d.ts +14 -4
- package/dist/domain/dte-reconciliation.js +211 -172
- package/dist/domain/dte-validation.d.ts +7 -0
- package/dist/domain/dte-validation.js +84 -0
- package/dist/domain/invoice-xml.d.ts +12 -151
- package/dist/domain/invoice-xml.js +0 -10
- package/dist/domain/invoicing.d.ts +30 -4
- package/dist/domain/invoicing.js +75 -21
- package/dist/domain/issued-invoice.d.ts +0 -6
- package/dist/domain/rcv-document.d.ts +0 -4
- package/dist/domain/received-invoice.d.ts +1 -4
- package/dist/index.d.ts +18 -10
- package/dist/index.js +18 -5
- package/dist/infrastructure/document-status-gateway.d.ts +6 -4
- package/dist/infrastructure/document-status-gateway.js +34 -13
- package/dist/infrastructure/document-status-parser.js +38 -12
- package/dist/infrastructure/dte-xml-mapper.d.ts +16 -0
- package/dist/infrastructure/dte-xml-mapper.js +381 -0
- package/dist/infrastructure/dte-xml.d.ts +40 -4
- package/dist/infrastructure/dte-xml.js +116 -238
- package/dist/infrastructure/facturador-gateway.d.ts +10 -7
- package/dist/infrastructure/facturador-gateway.js +256 -56
- package/dist/infrastructure/facturador.js +14 -7
- package/dist/infrastructure/invoice-pdf.js +10 -3
- package/dist/infrastructure/rcv-gateway.d.ts +7 -4
- package/dist/infrastructure/rcv-gateway.js +53 -12
- package/dist/infrastructure/rcv-normalization.d.ts +8 -1
- package/dist/infrastructure/rcv-normalization.js +54 -12
- package/dist/infrastructure/read-options.d.ts +3 -0
- package/dist/infrastructure/read-options.js +25 -0
- package/dist/infrastructure/sii-client.d.ts +98 -13
- package/dist/infrastructure/sii-client.js +182 -31
- package/dist/infrastructure/sii-http-session.d.ts +2 -2
- package/dist/infrastructure/sii-http-session.js +83 -19
- package/dist/sii-error.d.ts +4 -0
- package/dist/sii-error.js +38 -13
- package/package.json +2 -2
|
@@ -0,0 +1,84 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.validateComponentAmounts = validateComponentAmounts;
|
|
4
|
+
exports.validateDteSourceDecimals = validateDteSourceDecimals;
|
|
5
|
+
exports.validateDteImportSource = validateDteImportSource;
|
|
6
|
+
exports.validateFiscalReference = validateFiscalReference;
|
|
7
|
+
const dte_money_1 = require("./dte-money");
|
|
8
|
+
const dte_arithmetic_1 = require("./dte-arithmetic");
|
|
9
|
+
const dte_identity_1 = require("./dte-identity");
|
|
10
|
+
function validateComponentAmounts(detail) {
|
|
11
|
+
try {
|
|
12
|
+
for (const value of Object.values(detail.fiscalConditions ?? {}))
|
|
13
|
+
if (!Number.isSafeInteger(value) || value < 0)
|
|
14
|
+
(0, dte_arithmetic_1.fail)('INVALID_FISCAL_CONDITION', 'Condición fiscal XML inválida.');
|
|
15
|
+
for (const value of Object.values(detail.fiscalComponents ?? {}))
|
|
16
|
+
(0, dte_money_1.exactDteMoney)(value);
|
|
17
|
+
for (const line of detail.lines)
|
|
18
|
+
if (line.retention) {
|
|
19
|
+
for (const value of [line.retention.meatProcessingBase, line.retention.marginBase])
|
|
20
|
+
if (value !== null)
|
|
21
|
+
(0, dte_money_1.exactDteMoney)(value);
|
|
22
|
+
if (line.retention.consumerUnitPrice !== null)
|
|
23
|
+
(0, dte_arithmetic_1.decimal)(line.retention.consumerUnitPrice);
|
|
24
|
+
}
|
|
25
|
+
for (const commission of detail.commissions ?? []) {
|
|
26
|
+
(0, dte_money_1.exactDteMoney)(commission.netAmount);
|
|
27
|
+
(0, dte_money_1.exactDteMoney)(commission.exemptAmount);
|
|
28
|
+
if (commission.vatAmount !== null)
|
|
29
|
+
(0, dte_money_1.exactDteMoney)(commission.vatAmount);
|
|
30
|
+
if (commission.rate !== null)
|
|
31
|
+
(0, dte_arithmetic_1.decimal)(commission.rate);
|
|
32
|
+
}
|
|
33
|
+
}
|
|
34
|
+
catch (error) {
|
|
35
|
+
if (error instanceof dte_arithmetic_1.DteInterpretationError)
|
|
36
|
+
throw error;
|
|
37
|
+
(0, dte_arithmetic_1.fail)('INVALID_AMOUNT', 'Los componentes fiscales contienen importes fuera de su representación exacta.');
|
|
38
|
+
}
|
|
39
|
+
}
|
|
40
|
+
/** Decimal syntax is independent of the chosen monetary representation. */
|
|
41
|
+
function validateDteSourceDecimals(detail) {
|
|
42
|
+
if (detail.vatRate != null)
|
|
43
|
+
(0, dte_arithmetic_1.decimal)(detail.vatRate);
|
|
44
|
+
for (const adjustment of detail.adjustments)
|
|
45
|
+
(0, dte_arithmetic_1.decimal)(adjustment.value);
|
|
46
|
+
for (const line of detail.lines) {
|
|
47
|
+
for (const value of [line.quantity, line.unitPrice, line.discountPercent, line.surchargePercent]) {
|
|
48
|
+
if (value != null)
|
|
49
|
+
(0, dte_arithmetic_1.decimal)(value);
|
|
50
|
+
}
|
|
51
|
+
}
|
|
52
|
+
for (const tax of detail.taxes)
|
|
53
|
+
if (tax.rate != null)
|
|
54
|
+
(0, dte_arithmetic_1.decimal)(tax.rate);
|
|
55
|
+
}
|
|
56
|
+
/** Shared source invariants; arithmetic feasibility is evaluated separately by reconciliation. */
|
|
57
|
+
function validateDteImportSource(detail) {
|
|
58
|
+
if (!detail || ![33, 34, 61].includes(detail.documentType))
|
|
59
|
+
(0, dte_arithmetic_1.fail)('UNSUPPORTED_DOCUMENT', 'Tipo de documento fuera del alcance de importación.');
|
|
60
|
+
if (!Array.isArray(detail.lines) || !detail.lines.length || detail.lines.length > 1000 || !Array.isArray(detail.taxes) || !Array.isArray(detail.adjustments) || !Array.isArray(detail.references)) {
|
|
61
|
+
(0, dte_arithmetic_1.fail)('INVALID_LINES', 'Detalle XML incompleto o fuera de límites.');
|
|
62
|
+
}
|
|
63
|
+
validateFiscalReference(detail);
|
|
64
|
+
validateComponentAmounts(detail);
|
|
65
|
+
validateDteSourceDecimals(detail);
|
|
66
|
+
const numbers = new Set();
|
|
67
|
+
for (const line of detail.lines) {
|
|
68
|
+
if (!Number.isSafeInteger(line.lineNumber) || line.lineNumber < 1 || numbers.has(line.lineNumber)) {
|
|
69
|
+
(0, dte_arithmetic_1.fail)('INVALID_LINE_IDENTITY', 'La identidad de las líneas XML es inválida o está repetida.');
|
|
70
|
+
}
|
|
71
|
+
numbers.add(line.lineNumber);
|
|
72
|
+
}
|
|
73
|
+
for (const tax of detail.taxes) {
|
|
74
|
+
if (!Number.isSafeInteger(tax.type) || tax.type < 1 || tax.type > 999)
|
|
75
|
+
(0, dte_arithmetic_1.fail)('INVALID_TAX_CODE', 'Código XML de impuesto inválido.');
|
|
76
|
+
}
|
|
77
|
+
}
|
|
78
|
+
function validateFiscalReference(detail) {
|
|
79
|
+
if (detail.documentType !== 61)
|
|
80
|
+
return;
|
|
81
|
+
const references = detail.references.filter(r => r && /^\d{1,3}$/.test(r.documentType) && Number(r.documentType) < 200 && Number(r.documentType) > 0);
|
|
82
|
+
if (!references.length || references.some(r => !(0, dte_identity_1.validDteCreditReference)(r) || r.date > detail.issuedDate) || references.some(r => r.code === 1 || r.code === 2) && references.length !== 1)
|
|
83
|
+
(0, dte_arithmetic_1.fail)('INVALID_FISCAL_REFERENCE', 'La nota de crédito requiere referencias fiscales originales válidas.');
|
|
84
|
+
}
|
|
@@ -1,5 +1,9 @@
|
|
|
1
|
+
import type { DteDeclaredDetail } from './dte-detail';
|
|
2
|
+
import type { DteReconciliation } from './dte-reconciliation-model';
|
|
1
3
|
import type { InvoiceDocumentType } from './issued-invoice';
|
|
2
|
-
|
|
4
|
+
import type { ExactDte } from './dte-money';
|
|
5
|
+
export type { DteFiscalReference, DteReferenceIdentity, DteFiscalComponents, DteFiscalConditions, DteCommission, DteInvoiceLine, DteDeclaredDetail } from './dte-detail';
|
|
6
|
+
export type { DteProjectedTax, DteReconciliationDiagnostic, DteFiscalObservation, DteReconciledLine, DteTotalRounding, DteReconciledAmounts, DteReconciliation } from './dte-reconciliation-model';
|
|
3
7
|
export type IssuedDocumentType = InvoiceDocumentType | 61;
|
|
4
8
|
export interface IssuedDocumentXmlQuery {
|
|
5
9
|
documentType: IssuedDocumentType;
|
|
@@ -15,155 +19,11 @@ export interface IssuedInvoiceXmlQuery {
|
|
|
15
19
|
export interface ReceivedInvoiceXmlQuery extends IssuedInvoiceXmlQuery {
|
|
16
20
|
issuerRut: string;
|
|
17
21
|
}
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
name: string;
|
|
21
|
-
description: string | null;
|
|
22
|
-
codes: {
|
|
23
|
-
type: string;
|
|
24
|
-
value: string;
|
|
25
|
-
}[];
|
|
26
|
-
quantity: string | null;
|
|
27
|
-
unit: string | null;
|
|
28
|
-
unitPrice: string | null;
|
|
29
|
-
discountPercent: string | null;
|
|
30
|
-
discountAmount: number | null;
|
|
31
|
-
surchargePercent: string | null;
|
|
32
|
-
surchargeAmount: number | null;
|
|
33
|
-
exemptIndicator: number | null;
|
|
34
|
-
amount: number;
|
|
35
|
-
/** Original per-line tax codes, when present. They do not replace the declared header taxes. */
|
|
36
|
-
additionalTaxCodes?: number[];
|
|
37
|
-
}
|
|
38
|
-
export interface DteInvoiceDetail {
|
|
39
|
-
/** Present only for MntBruto=1: line amounts/prices include VAT. Original fiscal totals are unchanged. */
|
|
40
|
-
grossAmounts?: boolean;
|
|
41
|
-
issuerRut: string;
|
|
22
|
+
/** Compatible invoice read model: source facts plus optional arithmetic interpretation. */
|
|
23
|
+
export interface DteInvoiceDetail extends DteDeclaredDetail {
|
|
42
24
|
documentType: InvoiceDocumentType;
|
|
43
|
-
folio: string;
|
|
44
|
-
/** Original spelling when numeric normalization removes leading zeroes. XML bytes are unchanged. */
|
|
45
|
-
declaredFolio?: string;
|
|
46
|
-
issuedDate: string;
|
|
47
|
-
receiverRut: string;
|
|
48
|
-
netAmount: number | null;
|
|
49
|
-
exemptAmount: number | null;
|
|
50
|
-
vatRate: string | null;
|
|
51
|
-
vatAmount: number | null;
|
|
52
|
-
totalAmount: number;
|
|
53
|
-
/** Optional original totalizers; do not change the fiscal total or infer cash rounding. */
|
|
54
|
-
nonBillableAmount?: number;
|
|
55
|
-
periodAmount?: number;
|
|
56
|
-
previousBalance?: number;
|
|
57
|
-
payableAmount?: number;
|
|
58
|
-
lines: DteInvoiceLine[];
|
|
59
|
-
taxes: {
|
|
60
|
-
type: number;
|
|
61
|
-
rate: string | null;
|
|
62
|
-
amount: number;
|
|
63
|
-
}[];
|
|
64
|
-
adjustments: {
|
|
65
|
-
lineNumber: number;
|
|
66
|
-
movement: 'D' | 'R';
|
|
67
|
-
description: string | null;
|
|
68
|
-
valueType: '%' | '$';
|
|
69
|
-
value: string;
|
|
70
|
-
exemptIndicator: number | null;
|
|
71
|
-
}[];
|
|
72
|
-
references: {
|
|
73
|
-
lineNumber: number;
|
|
74
|
-
documentType: string;
|
|
75
|
-
folio: string;
|
|
76
|
-
declaredFolio?: string;
|
|
77
|
-
date: string;
|
|
78
|
-
code: number | null;
|
|
79
|
-
reason: string | null;
|
|
80
|
-
}[];
|
|
81
|
-
/** Read reconciliation only. Never authorizes issuing or modifying a fiscal document. */
|
|
82
25
|
reconciliation?: DteReconciliation;
|
|
83
26
|
}
|
|
84
|
-
export interface DteReconciliationDiagnostic {
|
|
85
|
-
code: string;
|
|
86
|
-
severity: 'INFO' | 'ERROR';
|
|
87
|
-
message: string;
|
|
88
|
-
lineNumber?: number;
|
|
89
|
-
declaredAmount?: number;
|
|
90
|
-
derivedAmount?: number;
|
|
91
|
-
}
|
|
92
|
-
/** Non-blocking documentary observations; declared fiscal amounts remain authoritative. */
|
|
93
|
-
export type DteFiscalObservation = Pick<DteReconciliationDiagnostic, 'code' | 'message' | 'declaredAmount' | 'derivedAmount'>;
|
|
94
|
-
export interface DteReconciledLine {
|
|
95
|
-
lineNumber: number;
|
|
96
|
-
quantity: string;
|
|
97
|
-
unitPrice: string;
|
|
98
|
-
discountPercent: string;
|
|
99
|
-
discountAmount: number;
|
|
100
|
-
surchargeAmount: number;
|
|
101
|
-
netAmount: number;
|
|
102
|
-
/** MontoItem exactly as declared, even when the derived line is converted from gross to net. */
|
|
103
|
-
declaredAmount: number;
|
|
104
|
-
category: 'TAXABLE' | 'EXEMPT' | 'NON_BILLABLE' | 'NON_BILLABLE_DEDUCTION';
|
|
105
|
-
}
|
|
106
|
-
/** Derived explanation only; the original header and line amounts are never changed. */
|
|
107
|
-
export interface DteTotalRounding {
|
|
108
|
-
difference: -1 | 1;
|
|
109
|
-
method: 'PER_LINE_VAT_AND_TAX';
|
|
110
|
-
basis: 'DECLARED_LINE_AMOUNTS' | 'EXACT_PRODUCTS';
|
|
111
|
-
componentTotal: number;
|
|
112
|
-
}
|
|
113
|
-
export interface DteReconciledAmounts {
|
|
114
|
-
netAmount: number;
|
|
115
|
-
exemptAmount: number;
|
|
116
|
-
vatAmount: number;
|
|
117
|
-
totalAmount: number;
|
|
118
|
-
payableAmount: number;
|
|
119
|
-
lines: DteReconciledLine[];
|
|
120
|
-
taxes: {
|
|
121
|
-
type: number;
|
|
122
|
-
rate: string | null;
|
|
123
|
-
amount: number;
|
|
124
|
-
kind: 'ADDITIONAL' | 'ANTICIPATED';
|
|
125
|
-
}[];
|
|
126
|
-
globalDiscount?: {
|
|
127
|
-
netAmount: number;
|
|
128
|
-
grossAmount?: number;
|
|
129
|
-
};
|
|
130
|
-
globalSurcharge?: {
|
|
131
|
-
netAmount: number;
|
|
132
|
-
grossAmount?: number;
|
|
133
|
-
};
|
|
134
|
-
nonBillable?: {
|
|
135
|
-
amount: number;
|
|
136
|
-
lines: {
|
|
137
|
-
lineNumber: number;
|
|
138
|
-
amount: number;
|
|
139
|
-
indicator: 2 | 6;
|
|
140
|
-
}[];
|
|
141
|
-
};
|
|
142
|
-
grossAmountsInferred?: true;
|
|
143
|
-
/** Difference explained by summing exact source products before rounding the subtotal. */
|
|
144
|
-
lineRounding?: number;
|
|
145
|
-
/** At most one peso per document, explained by an exact supported line calculation. */
|
|
146
|
-
totalRounding?: DteTotalRounding;
|
|
147
|
-
observations?: DteFiscalObservation[];
|
|
148
|
-
}
|
|
149
|
-
export interface DteReconciliation {
|
|
150
|
-
version: 1;
|
|
151
|
-
status: 'RECONCILED' | 'REVIEW_REQUIRED';
|
|
152
|
-
/** Header values are never overwritten by calculations. Null means absent in the XML. */
|
|
153
|
-
declared: {
|
|
154
|
-
netAmount: number | null;
|
|
155
|
-
exemptAmount: number | null;
|
|
156
|
-
vatAmount: number | null;
|
|
157
|
-
totalAmount: number;
|
|
158
|
-
nonBillableAmount: number | null;
|
|
159
|
-
periodAmount: number | null;
|
|
160
|
-
previousBalance: number | null;
|
|
161
|
-
payableAmount: number | null;
|
|
162
|
-
grossAmounts: boolean | null;
|
|
163
|
-
};
|
|
164
|
-
derived: DteReconciledAmounts | null;
|
|
165
|
-
diagnostics: DteReconciliationDiagnostic[];
|
|
166
|
-
}
|
|
167
27
|
/** Fiscal parser model, also usable for reconciling previously stored declared detail. */
|
|
168
28
|
export type DteFiscalDetail = Omit<DteInvoiceDetail, 'documentType'> & {
|
|
169
29
|
documentType: number;
|
|
@@ -237,6 +97,11 @@ export interface DteIssuanceOptions {
|
|
|
237
97
|
export interface IssuedDocumentXmlResult extends Omit<InvoiceXmlResult, 'detail'> {
|
|
238
98
|
detail: DteDocumentDetail;
|
|
239
99
|
}
|
|
100
|
+
export type ExactDteDocumentDetail = ExactDte<DteDocumentDetail>;
|
|
101
|
+
export type ExactDteFiscalDetail = ExactDte<DteFiscalDetail>;
|
|
102
|
+
export interface ExactDteDocumentXmlResult extends Omit<InvoiceXmlResult, 'detail'> {
|
|
103
|
+
detail: ExactDteDocumentDetail;
|
|
104
|
+
}
|
|
240
105
|
/** @deprecated Use IssuedDocumentType. */
|
|
241
106
|
export type TipoDocumentoEmitido = IssuedDocumentType;
|
|
242
107
|
/** @deprecated Use IssuedDocumentXmlQuery. */
|
|
@@ -249,7 +114,3 @@ export type ConsultaXmlFacturaRecibida = ReceivedInvoiceXmlQuery;
|
|
|
249
114
|
export type ResultadoXmlFacturaEmitida = InvoiceXmlResult;
|
|
250
115
|
/** @deprecated Use IssuedDocumentXmlResult. */
|
|
251
116
|
export type ResultadoXmlDocumentoEmitido = IssuedDocumentXmlResult;
|
|
252
|
-
export declare class DteXmlError extends Error {
|
|
253
|
-
readonly code: 'SII_XML_INVALID' | 'SII_XML_IDENTITY_MISMATCH';
|
|
254
|
-
constructor(code: 'SII_XML_INVALID' | 'SII_XML_IDENTITY_MISMATCH');
|
|
255
|
-
}
|
|
@@ -1,12 +1,2 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.DteXmlError = exports.MAX_DTE_XML_BYTES = void 0;
|
|
4
|
-
exports.MAX_DTE_XML_BYTES = 1_048_576;
|
|
5
|
-
class DteXmlError extends Error {
|
|
6
|
-
code;
|
|
7
|
-
constructor(code) {
|
|
8
|
-
super(code);
|
|
9
|
-
this.code = code;
|
|
10
|
-
}
|
|
11
|
-
}
|
|
12
|
-
exports.DteXmlError = DteXmlError;
|
|
@@ -12,6 +12,10 @@ export interface InvoiceLineInput {
|
|
|
12
12
|
discountPercent?: string;
|
|
13
13
|
}
|
|
14
14
|
export type InvoiceAdditionalTaxCode = 23 | 44 | 24 | 25 | 26 | 27 | 271;
|
|
15
|
+
/**
|
|
16
|
+
* Tasas admitidas por la emisión de facturas tipo 33 en el facturador gratuito.
|
|
17
|
+
* Los códigos desconocidos pueden leerse documentalmente; esta tabla limita la emisión soportada.
|
|
18
|
+
*/
|
|
15
19
|
export declare const INVOICE_ADDITIONAL_TAX_RATES: Readonly<{
|
|
16
20
|
23: "15";
|
|
17
21
|
44: "15";
|
|
@@ -28,7 +32,8 @@ export type InvoiceGlobalDiscount = {
|
|
|
28
32
|
amountClp: number;
|
|
29
33
|
percent?: never;
|
|
30
34
|
};
|
|
31
|
-
|
|
35
|
+
declare const referenceTypes: readonly ["30", "32", "33", "34", "35", "38", "39", "40", "41", "43", "45", "46", "48", "50", "52", "55", "56", "60", "61", "103", "801", "802", "803", "804", "805", "806", "813", "820", "821", "822", "823", "HES"];
|
|
36
|
+
export type InvoiceReferenceDocumentType = typeof referenceTypes[number];
|
|
32
37
|
export interface InvoiceReferenceInput {
|
|
33
38
|
documentType: InvoiceReferenceDocumentType;
|
|
34
39
|
folio: string;
|
|
@@ -111,11 +116,31 @@ export declare function invoiceBreakdown(lines: readonly InvoiceLineInput[], dis
|
|
|
111
116
|
amount: number;
|
|
112
117
|
}[];
|
|
113
118
|
};
|
|
114
|
-
/**
|
|
119
|
+
/**
|
|
120
|
+
* Valida y normaliza una orden de emisión de factura tipo 33 con IVA 19%.
|
|
121
|
+
* Aplica límites del facturador, normaliza RUT/decimales y congela la estructura devuelta.
|
|
122
|
+
* @param input Orden plana sin campos desconocidos; hasta diez ítems, con cantidades y precios de hasta dos decimales.
|
|
123
|
+
* @returns Una nueva orden normalizada e inmutable; no prepara ni envía documentos al SII.
|
|
124
|
+
* @throws TypeError por estructura, identidad, importes, fechas u opcionales fuera del alcance de emisión.
|
|
125
|
+
* @remarks Esta política de emisión no se usa para aceptar o rechazar documentos históricos de lectura.
|
|
126
|
+
*/
|
|
115
127
|
export declare function validateInvoice(input: unknown): InvoiceInput;
|
|
116
|
-
/**
|
|
128
|
+
/**
|
|
129
|
+
* Calcula totales de emisión tipo 33: líneas, descuento global, IVA 19% e impuestos adicionales soportados.
|
|
130
|
+
* Usa aritmética entera; no introduce decimales binarios en cantidades, precios ni porcentajes.
|
|
131
|
+
* @param input Array de InvoiceLineInput, con los mismos límites que validateInvoice.
|
|
132
|
+
* @param discount Descuento global opcional, porcentual o importe entero CLP.
|
|
133
|
+
* @returns netAmount, vatAmount y totalAmount como enteros CLP seguros; el total incluye impuestos adicionales.
|
|
134
|
+
* @throws TypeError por líneas, descuentos o totales fuera del alcance de emisión.
|
|
135
|
+
*/
|
|
117
136
|
export declare function calculateInvoiceTotals(input: unknown, discount?: InvoiceGlobalDiscount): InvoiceTotals;
|
|
118
|
-
/**
|
|
137
|
+
/**
|
|
138
|
+
* Calcula SHA-256 hexadecimal sobre una serialización determinista del contenido.
|
|
139
|
+
* Ordena claves de objetos y conserva el orden de arrays; rechaza ciclos, undefined y objetos no planos.
|
|
140
|
+
* @param value Contenido fiscal compatible con JSON. El llamador debe excluir claves, tokens y otros secretos.
|
|
141
|
+
* @returns Huella de 64 caracteres; no modifica ni persiste el contenido.
|
|
142
|
+
* @throws TypeError si el contenido no tiene una representación canónica soportada.
|
|
143
|
+
*/
|
|
119
144
|
export declare function hashContent(value: unknown): string;
|
|
120
145
|
/** @deprecated Use validateInvoice. */
|
|
121
146
|
export declare const validarFactura: typeof validateInvoice;
|
|
@@ -123,3 +148,4 @@ export declare const validarFactura: typeof validateInvoice;
|
|
|
123
148
|
export declare const calcularTotalesFactura: typeof calculateInvoiceTotals;
|
|
124
149
|
/** @deprecated Use hashContent. */
|
|
125
150
|
export declare const hashContenido: typeof hashContent;
|
|
151
|
+
export {};
|
package/dist/domain/invoicing.js
CHANGED
|
@@ -5,11 +5,28 @@ exports.invoiceBreakdown = invoiceBreakdown;
|
|
|
5
5
|
exports.validateInvoice = validateInvoice;
|
|
6
6
|
exports.calculateInvoiceTotals = calculateInvoiceTotals;
|
|
7
7
|
exports.hashContent = hashContent;
|
|
8
|
+
const civil_date_1 = require("./civil-date");
|
|
8
9
|
const node_crypto_1 = require("node:crypto");
|
|
9
10
|
const rut_1 = require("./rut");
|
|
10
|
-
|
|
11
|
+
/**
|
|
12
|
+
* Tasas admitidas por la emisión de facturas tipo 33 en el facturador gratuito.
|
|
13
|
+
* Los códigos desconocidos pueden leerse documentalmente; esta tabla limita la emisión soportada.
|
|
14
|
+
*/
|
|
15
|
+
exports.INVOICE_ADDITIONAL_TAX_RATES = Object.freeze({
|
|
16
|
+
23: '15',
|
|
17
|
+
44: '15',
|
|
18
|
+
24: '31.5',
|
|
19
|
+
25: '20.5',
|
|
20
|
+
26: '20.5',
|
|
21
|
+
27: '10',
|
|
22
|
+
271: '18'
|
|
23
|
+
});
|
|
24
|
+
const referenceTypes = ['30', '32', '33', '34', '35', '38', '39', '40', '41', '43', '45', '46', '48', '50', '52', '55', '56', '60', '61', '103', '801', '802', '803', '804', '805', '806', '813', '820', '821', '822', '823', 'HES'];
|
|
25
|
+
const referenceTypeSet = new Set(referenceTypes);
|
|
11
26
|
const controls = /[\u0000-\u001f\u007f-\u009f]/u;
|
|
12
|
-
function invalid(field) {
|
|
27
|
+
function invalid(field) {
|
|
28
|
+
throw new TypeError(`Factura inválida: ${field}`);
|
|
29
|
+
}
|
|
13
30
|
function isRecord(value) {
|
|
14
31
|
return typeof value === 'object' && value !== null && !Array.isArray(value)
|
|
15
32
|
&& (Object.getPrototypeOf(value) === Object.prototype || Object.getPrototypeOf(value) === null);
|
|
@@ -83,7 +100,12 @@ function items(value) {
|
|
|
83
100
|
quantity: decimal(source.quantity, 'quantity'),
|
|
84
101
|
unitNetPriceClp: decimal(source.unitNetPriceClp, 'unitNetPriceClp'),
|
|
85
102
|
...(unit === undefined ? {} : { unit }),
|
|
86
|
-
...(code === undefined ? {} : {
|
|
103
|
+
...(code === undefined ? {} : {
|
|
104
|
+
productCode: Object.freeze({
|
|
105
|
+
type: requiredText(code.type, 10, 'productCode.type'),
|
|
106
|
+
value: requiredText(code.value, 15, 'productCode.value')
|
|
107
|
+
})
|
|
108
|
+
}),
|
|
87
109
|
...(additionalTaxCode === undefined ? {} : { additionalTaxCode: additionalTaxCode }),
|
|
88
110
|
...(source.discountPercent === undefined ? {} : { discountPercent: percentage(source.discountPercent, 'discountPercent') }),
|
|
89
111
|
});
|
|
@@ -113,8 +135,10 @@ function invoiceBreakdown(lines, discount) {
|
|
|
113
135
|
const net = subtotal - discountAmount;
|
|
114
136
|
const vat = (net * 19n + 50n) / 100n;
|
|
115
137
|
const taxBases = new Map();
|
|
116
|
-
lines.forEach((line, index) => {
|
|
117
|
-
|
|
138
|
+
lines.forEach((line, index) => {
|
|
139
|
+
if (line.additionalTaxCode !== undefined)
|
|
140
|
+
taxBases.set(line.additionalTaxCode, (taxBases.get(line.additionalTaxCode) ?? 0n) + BigInt(lineAmounts[index].amount));
|
|
141
|
+
});
|
|
118
142
|
let taxNumerator = 0n;
|
|
119
143
|
const taxes = [...taxBases].map(([type, base]) => {
|
|
120
144
|
const rate = exports.INVOICE_ADDITIONAL_TAX_RATES[type];
|
|
@@ -130,17 +154,17 @@ function invoiceBreakdown(lines, discount) {
|
|
|
130
154
|
invalid('totalAmount');
|
|
131
155
|
return {
|
|
132
156
|
totals: Object.freeze({ netAmount: Number(net), vatAmount: Number(vat), totalAmount: Number(total) }),
|
|
133
|
-
subtotal: Number(subtotal),
|
|
134
|
-
|
|
157
|
+
subtotal: Number(subtotal),
|
|
158
|
+
discountAmount: Number(discountAmount),
|
|
159
|
+
discountPercent: fromHundredths(discountPercent),
|
|
160
|
+
discountAmountFromPercent: Number(round(subtotal * discountPercent, 10000n)),
|
|
161
|
+
additionalTaxAmount: Number(additionalTaxAmount),
|
|
162
|
+
lineAmounts,
|
|
163
|
+
taxes,
|
|
135
164
|
};
|
|
136
165
|
}
|
|
137
166
|
function civilDate(value, field, minimum, maximum = '9999-12-31') {
|
|
138
|
-
if (
|
|
139
|
-
invalid(field);
|
|
140
|
-
const year = Number(value.slice(0, 4)), month = Number(value.slice(5, 7)), day = Number(value.slice(8, 10));
|
|
141
|
-
const leap = year % 4 === 0 && (year % 100 !== 0 || year % 400 === 0);
|
|
142
|
-
const days = [31, leap ? 29 : 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31];
|
|
143
|
-
if (value < minimum || value > maximum || month < 1 || month > 12 || day < 1 || day > days[month - 1])
|
|
167
|
+
if (!(0, civil_date_1.isCivilDate)(value) || value < minimum || value > maximum)
|
|
144
168
|
invalid(field);
|
|
145
169
|
return value;
|
|
146
170
|
}
|
|
@@ -149,11 +173,10 @@ function smallArray(value, field) {
|
|
|
149
173
|
invalid(field);
|
|
150
174
|
return Array.from(value);
|
|
151
175
|
}
|
|
152
|
-
const referenceTypes = ['30', '32', '33', '34', '35', '38', '39', '40', '41', '43', '45', '46', '48', '50', '52', '55', '56', '60', '61', '103', '801', '802', '803', '804', '805', '806', '813', '820', '821', '822', '823', 'HES'];
|
|
153
176
|
function references(value) {
|
|
154
177
|
return Object.freeze(smallArray(value, 'references').map(entry => {
|
|
155
178
|
const source = record(entry, ['documentType', 'folio', 'date', 'reason', 'global'], 'reference');
|
|
156
|
-
if (typeof source.documentType !== 'string' || !
|
|
179
|
+
if (typeof source.documentType !== 'string' || !referenceTypeSet.has(source.documentType))
|
|
157
180
|
invalid('reference.documentType');
|
|
158
181
|
if (source.global !== undefined && typeof source.global !== 'boolean')
|
|
159
182
|
invalid('reference.global');
|
|
@@ -161,7 +184,11 @@ function references(value) {
|
|
|
161
184
|
if (source.global ? folio !== '0' : ['30', '32', '38', '40', '45', '50', '55', '60', '33', '34', '39', '46', '56', '61', '52', '103'].includes(source.documentType) && !/^[1-9]\d*$/.test(folio))
|
|
162
185
|
invalid('reference.folio');
|
|
163
186
|
const reason = text(source.reason, 90, 'reference.reason', true);
|
|
164
|
-
return Object.freeze({
|
|
187
|
+
return Object.freeze({
|
|
188
|
+
documentType: source.documentType,
|
|
189
|
+
folio,
|
|
190
|
+
date: civilDate(source.date, 'reference.date', '2002-08-01', '2050-12-31'), ...(reason === undefined ? {} : { reason }), ...(source.global ? { global: true } : {})
|
|
191
|
+
});
|
|
165
192
|
}));
|
|
166
193
|
}
|
|
167
194
|
function payments(value, issued, total) {
|
|
@@ -183,9 +210,21 @@ function payments(value, issued, total) {
|
|
|
183
210
|
}
|
|
184
211
|
function transport(value) {
|
|
185
212
|
const source = record(value, ['carrierRut', 'licensePlate', 'driverRut', 'driverName'], 'transport');
|
|
186
|
-
return Object.freeze({
|
|
213
|
+
return Object.freeze({
|
|
214
|
+
carrierRut: (0, rut_1.parseRut)(requiredText(source.carrierRut, 15, 'transport.carrierRut')).formatted,
|
|
215
|
+
licensePlate: requiredText(source.licensePlate, 8, 'transport.licensePlate'),
|
|
216
|
+
driverRut: (0, rut_1.parseRut)(requiredText(source.driverRut, 15, 'transport.driverRut')).formatted,
|
|
217
|
+
driverName: requiredText(source.driverName, 30, 'transport.driverName')
|
|
218
|
+
});
|
|
187
219
|
}
|
|
188
|
-
/**
|
|
220
|
+
/**
|
|
221
|
+
* Valida y normaliza una orden de emisión de factura tipo 33 con IVA 19%.
|
|
222
|
+
* Aplica límites del facturador, normaliza RUT/decimales y congela la estructura devuelta.
|
|
223
|
+
* @param input Orden plana sin campos desconocidos; hasta diez ítems, con cantidades y precios de hasta dos decimales.
|
|
224
|
+
* @returns Una nueva orden normalizada e inmutable; no prepara ni envía documentos al SII.
|
|
225
|
+
* @throws TypeError por estructura, identidad, importes, fechas u opcionales fuera del alcance de emisión.
|
|
226
|
+
* @remarks Esta política de emisión no se usa para aceptar o rechazar documentos históricos de lectura.
|
|
227
|
+
*/
|
|
189
228
|
function validateInvoice(input) {
|
|
190
229
|
const source = record(input, ['issuedDate', 'issuer', 'receiver', 'paymentForm', 'saleType', 'purchaseType', 'items', 'globalDiscount', 'references', 'payments', 'requesterRut', 'transport', 'smallBusiness'], 'input');
|
|
191
230
|
const issuer = record(source.issuer, ['address', 'commune', 'city', 'activityCode', 'email', 'phone'], 'issuer');
|
|
@@ -240,9 +279,24 @@ function validateInvoice(input) {
|
|
|
240
279
|
Object.freeze(result.items);
|
|
241
280
|
return Object.freeze(result);
|
|
242
281
|
}
|
|
243
|
-
/**
|
|
244
|
-
|
|
245
|
-
|
|
282
|
+
/**
|
|
283
|
+
* Calcula totales de emisión tipo 33: líneas, descuento global, IVA 19% e impuestos adicionales soportados.
|
|
284
|
+
* Usa aritmética entera; no introduce decimales binarios en cantidades, precios ni porcentajes.
|
|
285
|
+
* @param input Array de InvoiceLineInput, con los mismos límites que validateInvoice.
|
|
286
|
+
* @param discount Descuento global opcional, porcentual o importe entero CLP.
|
|
287
|
+
* @returns netAmount, vatAmount y totalAmount como enteros CLP seguros; el total incluye impuestos adicionales.
|
|
288
|
+
* @throws TypeError por líneas, descuentos o totales fuera del alcance de emisión.
|
|
289
|
+
*/
|
|
290
|
+
function calculateInvoiceTotals(input, discount) {
|
|
291
|
+
return invoiceBreakdown(items(input), globalDiscount(discount)).totals;
|
|
292
|
+
}
|
|
293
|
+
/**
|
|
294
|
+
* Calcula SHA-256 hexadecimal sobre una serialización determinista del contenido.
|
|
295
|
+
* Ordena claves de objetos y conserva el orden de arrays; rechaza ciclos, undefined y objetos no planos.
|
|
296
|
+
* @param value Contenido fiscal compatible con JSON. El llamador debe excluir claves, tokens y otros secretos.
|
|
297
|
+
* @returns Huella de 64 caracteres; no modifica ni persiste el contenido.
|
|
298
|
+
* @throws TypeError si el contenido no tiene una representación canónica soportada.
|
|
299
|
+
*/
|
|
246
300
|
function hashContent(value) {
|
|
247
301
|
const ancestors = new Set();
|
|
248
302
|
function canonical(input) {
|
|
@@ -1,8 +1,4 @@
|
|
|
1
1
|
export type InvoiceDocumentType = 33 | 34;
|
|
2
|
-
export interface IssuedInvoicesQuery {
|
|
3
|
-
periodo: string;
|
|
4
|
-
tokenRecaptcha?: string;
|
|
5
|
-
}
|
|
6
2
|
export interface IssuedInvoice {
|
|
7
3
|
issuerRut: string;
|
|
8
4
|
documentType: InvoiceDocumentType;
|
|
@@ -26,8 +22,6 @@ export interface IssuedInvoicesResult {
|
|
|
26
22
|
}
|
|
27
23
|
/** @deprecated Use InvoiceDocumentType. */
|
|
28
24
|
export type TipoFacturaEmitida = InvoiceDocumentType;
|
|
29
|
-
/** @deprecated Use IssuedInvoicesQuery. */
|
|
30
|
-
export type ConsultaFacturasEmitidas = IssuedInvoicesQuery;
|
|
31
25
|
/** @deprecated Use IssuedInvoice. */
|
|
32
26
|
export type FacturaEmitida = IssuedInvoice;
|
|
33
27
|
/** @deprecated Use IssuedInvoicesResult. */
|
|
@@ -1,9 +1,5 @@
|
|
|
1
1
|
import type { IssuedInvoice } from './issued-invoice';
|
|
2
2
|
export type RcvDocumentType = 33 | 34 | 61;
|
|
3
|
-
export interface RcvDocumentsQuery {
|
|
4
|
-
periodo: string;
|
|
5
|
-
tokenRecaptcha?: string;
|
|
6
|
-
}
|
|
7
3
|
export interface RcvDocument extends Omit<IssuedInvoice, 'documentType'> {
|
|
8
4
|
documentType: RcvDocumentType;
|
|
9
5
|
issuerName?: string | null;
|
|
@@ -1,13 +1,10 @@
|
|
|
1
|
-
import
|
|
2
|
-
export type ReceivedInvoicesQuery = IssuedInvoicesQuery;
|
|
1
|
+
import type { IssuedInvoice, IssuedInvoicesResult } from './issued-invoice';
|
|
3
2
|
export interface ReceivedInvoice extends IssuedInvoice {
|
|
4
3
|
issuerName: string | null;
|
|
5
4
|
}
|
|
6
5
|
export interface ReceivedInvoicesResult extends Omit<IssuedInvoicesResult, 'data'> {
|
|
7
6
|
data: ReceivedInvoice[];
|
|
8
7
|
}
|
|
9
|
-
/** @deprecated Use ReceivedInvoicesQuery. */
|
|
10
|
-
export type ConsultaFacturasRecibidas = ReceivedInvoicesQuery;
|
|
11
8
|
/** @deprecated Use ReceivedInvoice. */
|
|
12
9
|
export type FacturaRecibida = ReceivedInvoice;
|
|
13
10
|
/** @deprecated Use ReceivedInvoicesResult. */
|
package/dist/index.d.ts
CHANGED
|
@@ -2,23 +2,31 @@ export { SiiClient, SiiError } from './infrastructure/sii-client';
|
|
|
2
2
|
export { sanitizeSiiDiagnostics } from './sii-error';
|
|
3
3
|
export type { SiiDiagnostics } from './sii-error';
|
|
4
4
|
export type { CompanyInfo } from './domain/company-info';
|
|
5
|
-
export type { RcvDocumentType, RcvDocument,
|
|
6
|
-
export type {
|
|
7
|
-
export type { IssuedInvoicePdfQuery, ReceivedInvoicePdfQuery, PdfDownloadOptions, InvoicePdfResult } from './contracts';
|
|
5
|
+
export type { RcvDocumentType, RcvDocument, RcvDocumentsResult } from './domain/rcv-document';
|
|
6
|
+
export type { DocumentDirection, DocumentIdentity, DocumentStatusQuery, DocumentVerification, DocumentStatusResult, RecipientEventsQuery, RecipientEvent, RecipientEventsResult, } from './domain/document-status';
|
|
7
|
+
export type { IssuedInvoicePdfQuery, ReceivedInvoicePdfQuery, PdfDownloadOptions, InvoicePdfResult, DteXmlReadOptions, DocumentQueryOptions, IssuedInvoicesQuery, ReceivedInvoicesQuery, RcvDocumentsQuery, ConsultaFacturasEmitidas, ConsultaFacturasRecibidas } from './contracts';
|
|
8
|
+
export type { DteDeclaredDetail } from './domain/dte-detail';
|
|
8
9
|
export { parseRut } from './domain/rut';
|
|
9
10
|
export { validateInvoice, calculateInvoiceTotals, hashContent, INVOICE_ADDITIONAL_TAX_RATES, validarFactura, calcularTotalesFactura, hashContenido } from './domain/invoicing';
|
|
10
11
|
export type { InvoiceInput, InvoiceLineInput, InvoiceTotals, InvoiceAdditionalTaxCode, InvoiceGlobalDiscount, InvoiceReferenceDocumentType, InvoiceReferenceInput, InvoicePaymentInput, InvoiceTransportInput, EntradaFactura, LineaFactura, TotalesFactura } from './domain/invoicing';
|
|
11
12
|
export type { DocumentoPreparado, DocumentoFirmado, DocumentoEnviado, FirmaDocumento } from './infrastructure/sii-client';
|
|
12
|
-
export { parseDteXml, parseDteDocumentXml } from './infrastructure/dte-xml';
|
|
13
|
-
export {
|
|
13
|
+
export { parseDteXml, parseDteDocumentXml, parseDteDocumentXmlExact } from './infrastructure/dte-xml';
|
|
14
|
+
export { exactDteMoney, withExactDteAmounts, withNumberDteAmounts, DteMoneyRangeError } from './domain/dte-money';
|
|
15
|
+
export type { ExactDte } from './domain/dte-money';
|
|
16
|
+
export { buildDteImportProjection, buildDteImportProjectionExact, projectDteForImport, projectDteForImportExact } from './application/dte-import';
|
|
17
|
+
export type { DteImportAmounts, DteImportProjection, ExactDteImportProjection } from './application/dte-import-model';
|
|
18
|
+
export type { ExactDteDocumentDetail, ExactDteFiscalDetail, ExactDteDocumentXmlResult } from './domain/invoice-xml';
|
|
19
|
+
export { reconcileDteDetail } from './domain/dte-reconciliation';
|
|
20
|
+
export { normalizeDteFolio, resolveDteReferenceIdentity } from './domain/dte-identity';
|
|
21
|
+
export type { DteFiscalReference, DteReferenceIdentity, DteFiscalComponents, DteFiscalConditions, DteCommission, DteProjectedTax } from './domain/invoice-xml';
|
|
14
22
|
export type { DteFiscalDetail, DteReconciliation, DteReconciliationDiagnostic, DteReconciledAmounts, DteReconciledLine, DteTotalRounding, DteFiscalObservation } from './domain/invoice-xml';
|
|
15
|
-
export { DteXmlError, MAX_DTE_XML_BYTES } from './
|
|
23
|
+
export { DteXmlError, MAX_DTE_XML_BYTES } from './contracts';
|
|
16
24
|
export type { ConsultaXmlFacturaEmitida, ConsultaXmlFacturaRecibida, DteInvoiceLine, DteInvoiceDetail, ResultadoXmlFacturaEmitida } from './domain/invoice-xml';
|
|
17
25
|
export type { TipoDocumentoEmitido, ConsultaXmlDocumentoEmitido, DteDocumentDetail, DteIssuanceOptions, ResultadoXmlDocumentoEmitido } from './domain/invoice-xml';
|
|
18
|
-
export type {
|
|
19
|
-
export type {
|
|
26
|
+
export type { FacturaEmitida, ResultadoFacturasEmitidas, TipoFacturaEmitida } from './domain/issued-invoice';
|
|
27
|
+
export type { FacturaRecibida, ResultadoFacturasRecibidas } from './domain/received-invoice';
|
|
20
28
|
export type { ConsultaResumen, CredencialesSii, EmpresaAutorizada, EstadoCompra, Operacion, RegistroSii, RespuestaSii, SesionSii, SiiClientOptions, } from './infrastructure/sii-client';
|
|
21
29
|
export type { SummaryQuery, SiiCredentials, SiiSession, Operation, PurchaseStatus, SiiRecord, SiiResponse, AuthorizedCompany, PreparedDocument, SignedDocument, SentDocument, SignDocumentInput, } from './infrastructure/sii-client';
|
|
22
|
-
export type {
|
|
23
|
-
export type {
|
|
30
|
+
export type { IssuedInvoice, IssuedInvoicesResult, InvoiceDocumentType, } from './domain/issued-invoice';
|
|
31
|
+
export type { ReceivedInvoice, ReceivedInvoicesResult, } from './domain/received-invoice';
|
|
24
32
|
export type { IssuedInvoiceXmlQuery, ReceivedInvoiceXmlQuery, InvoiceXmlResult, IssuedDocumentType, IssuedDocumentXmlQuery, ReceivedDocumentXmlQuery, IssuedDocumentXmlResult, } from './domain/invoice-xml';
|
package/dist/index.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.MAX_DTE_XML_BYTES = exports.DteXmlError = exports.
|
|
3
|
+
exports.MAX_DTE_XML_BYTES = exports.DteXmlError = exports.resolveDteReferenceIdentity = exports.normalizeDteFolio = exports.reconcileDteDetail = exports.projectDteForImportExact = exports.projectDteForImport = exports.buildDteImportProjectionExact = exports.buildDteImportProjection = exports.DteMoneyRangeError = exports.withNumberDteAmounts = exports.withExactDteAmounts = exports.exactDteMoney = exports.parseDteDocumentXmlExact = exports.parseDteDocumentXml = exports.parseDteXml = exports.hashContenido = exports.calcularTotalesFactura = exports.validarFactura = exports.INVOICE_ADDITIONAL_TAX_RATES = exports.hashContent = exports.calculateInvoiceTotals = exports.validateInvoice = exports.parseRut = exports.sanitizeSiiDiagnostics = exports.SiiError = exports.SiiClient = void 0;
|
|
4
4
|
var sii_client_1 = require("./infrastructure/sii-client");
|
|
5
5
|
Object.defineProperty(exports, "SiiClient", { enumerable: true, get: function () { return sii_client_1.SiiClient; } });
|
|
6
6
|
Object.defineProperty(exports, "SiiError", { enumerable: true, get: function () { return sii_client_1.SiiError; } });
|
|
@@ -19,9 +19,22 @@ Object.defineProperty(exports, "hashContenido", { enumerable: true, get: functio
|
|
|
19
19
|
var dte_xml_1 = require("./infrastructure/dte-xml");
|
|
20
20
|
Object.defineProperty(exports, "parseDteXml", { enumerable: true, get: function () { return dte_xml_1.parseDteXml; } });
|
|
21
21
|
Object.defineProperty(exports, "parseDteDocumentXml", { enumerable: true, get: function () { return dte_xml_1.parseDteDocumentXml; } });
|
|
22
|
+
Object.defineProperty(exports, "parseDteDocumentXmlExact", { enumerable: true, get: function () { return dte_xml_1.parseDteDocumentXmlExact; } });
|
|
23
|
+
var dte_money_1 = require("./domain/dte-money");
|
|
24
|
+
Object.defineProperty(exports, "exactDteMoney", { enumerable: true, get: function () { return dte_money_1.exactDteMoney; } });
|
|
25
|
+
Object.defineProperty(exports, "withExactDteAmounts", { enumerable: true, get: function () { return dte_money_1.withExactDteAmounts; } });
|
|
26
|
+
Object.defineProperty(exports, "withNumberDteAmounts", { enumerable: true, get: function () { return dte_money_1.withNumberDteAmounts; } });
|
|
27
|
+
Object.defineProperty(exports, "DteMoneyRangeError", { enumerable: true, get: function () { return dte_money_1.DteMoneyRangeError; } });
|
|
28
|
+
var dte_import_1 = require("./application/dte-import");
|
|
29
|
+
Object.defineProperty(exports, "buildDteImportProjection", { enumerable: true, get: function () { return dte_import_1.buildDteImportProjection; } });
|
|
30
|
+
Object.defineProperty(exports, "buildDteImportProjectionExact", { enumerable: true, get: function () { return dte_import_1.buildDteImportProjectionExact; } });
|
|
31
|
+
Object.defineProperty(exports, "projectDteForImport", { enumerable: true, get: function () { return dte_import_1.projectDteForImport; } });
|
|
32
|
+
Object.defineProperty(exports, "projectDteForImportExact", { enumerable: true, get: function () { return dte_import_1.projectDteForImportExact; } });
|
|
22
33
|
var dte_reconciliation_1 = require("./domain/dte-reconciliation");
|
|
23
|
-
Object.defineProperty(exports, "normalizeDteFolio", { enumerable: true, get: function () { return dte_reconciliation_1.normalizeDteFolio; } });
|
|
24
34
|
Object.defineProperty(exports, "reconcileDteDetail", { enumerable: true, get: function () { return dte_reconciliation_1.reconcileDteDetail; } });
|
|
25
|
-
var
|
|
26
|
-
Object.defineProperty(exports, "
|
|
27
|
-
Object.defineProperty(exports, "
|
|
35
|
+
var dte_identity_1 = require("./domain/dte-identity");
|
|
36
|
+
Object.defineProperty(exports, "normalizeDteFolio", { enumerable: true, get: function () { return dte_identity_1.normalizeDteFolio; } });
|
|
37
|
+
Object.defineProperty(exports, "resolveDteReferenceIdentity", { enumerable: true, get: function () { return dte_identity_1.resolveDteReferenceIdentity; } });
|
|
38
|
+
var contracts_1 = require("./contracts");
|
|
39
|
+
Object.defineProperty(exports, "DteXmlError", { enumerable: true, get: function () { return contracts_1.DteXmlError; } });
|
|
40
|
+
Object.defineProperty(exports, "MAX_DTE_XML_BYTES", { enumerable: true, get: function () { return contracts_1.MAX_DTE_XML_BYTES; } });
|