facturas 0.12.3 → 0.13.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/README.md +41 -35
- package/dist/{chunk-QHYJ424J.mjs → chunk-BPBTQDCO.mjs} +18 -175
- package/dist/chunk-BPBTQDCO.mjs.map +1 -0
- package/dist/{chunk-ZOSNASXB.mjs → chunk-BYEP3ABS.mjs} +1 -1
- package/dist/chunk-BYEP3ABS.mjs.map +1 -0
- package/dist/{chunk-G7BWMDFT.mjs → chunk-KPWAQMR5.mjs} +881 -216
- package/dist/chunk-KPWAQMR5.mjs.map +1 -0
- package/dist/{chunk-GX5ERXT6.mjs → chunk-LQMNKQ2V.mjs} +1 -1
- package/dist/chunk-LQMNKQ2V.mjs.map +1 -0
- package/dist/{chunk-UDX6HLAU.mjs → chunk-PHXH34L6.mjs} +2 -2
- package/dist/{chunk-ZPVXXSUC.mjs → chunk-WN62NMUJ.mjs} +15 -15
- package/dist/chunk-WN62NMUJ.mjs.map +1 -0
- package/dist/{chunk-7LEKQ4P7.mjs → chunk-WVKVJTFG.mjs} +2 -2
- package/dist/cli.d.ts +5 -5
- package/dist/cli.mjs +7 -7
- package/dist/{client-BT_F1N8o.d.ts → client-bblLZeUb.d.ts} +87 -45
- package/dist/constants.d.ts +1 -1
- package/dist/constants.mjs +1 -1
- package/dist/errors.d.ts +2 -2
- package/dist/errors.mjs +1 -1
- package/dist/{fiscal-evidence-Dpj-Iao8.d.ts → fiscal-evidence-DaCyGd5o.d.ts} +3 -3
- package/dist/{index-CT1ffEAL.d.ts → index-DAC3edtw.d.ts} +1 -1
- package/dist/index.d.ts +6 -7
- package/dist/index.mjs +11 -17
- package/dist/index.mjs.map +1 -1
- package/dist/padron.d.ts +2 -2
- package/dist/padron.mjs +2 -2
- package/dist/{types-SdBQAflw.d.ts → types-Su7QwloQ.d.ts} +1 -1
- package/dist/types.d.ts +1 -1
- package/dist/wsfe.d.ts +255 -31
- package/dist/wsfe.mjs +3 -10
- package/dist/wsmtxca.d.ts +6 -6
- package/dist/wsmtxca.mjs +3 -3
- package/package.json +1 -1
- package/dist/chunk-G7BWMDFT.mjs.map +0 -1
- package/dist/chunk-GX5ERXT6.mjs.map +0 -1
- package/dist/chunk-QHYJ424J.mjs.map +0 -1
- package/dist/chunk-VGNLXU4T.mjs +0 -169
- package/dist/chunk-VGNLXU4T.mjs.map +0 -1
- package/dist/chunk-ZOSNASXB.mjs.map +0 -1
- package/dist/chunk-ZPVXXSUC.mjs.map +0 -1
- package/dist/decimal-xie0oMOQ.d.ts +0 -272
- /package/dist/{chunk-UDX6HLAU.mjs.map → chunk-PHXH34L6.mjs.map} +0 -0
- /package/dist/{chunk-7LEKQ4P7.mjs.map → chunk-WVKVJTFG.mjs.map} +0 -0
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../src/constants.ts"],"sourcesContent":["/** Common ARCA reference data for readable userland code and examples. */\nexport const ARCA_VOUCHER_TYPES = {\n FACTURA_A: 1,\n NOTA_DEBITO_A: 2,\n NOTA_CREDITO_A: 3,\n FACTURA_B: 6,\n NOTA_DEBITO_B: 7,\n NOTA_CREDITO_B: 8,\n FACTURA_C: 11,\n NOTA_DEBITO_C: 12,\n NOTA_CREDITO_C: 13,\n} as const;\n\n/** Common document types accepted by ARCA services. */\nexport const ARCA_DOCUMENT_TYPES = {\n CUIT: 80,\n DNI: 96,\n CONSUMIDOR_FINAL: 99,\n} as const;\n\n/**\n * Common receiver IVA condition identifiers used by WSFE.\n * Allowed values depend on the voucher class and ARCA's live catalog.\n */\nexport const ARCA_RECEIVER_VAT_CONDITIONS = {\n RESPONSABLE_INSCRIPTO: 1,\n EXENTO: 4,\n CONSUMIDOR_FINAL: 5,\n MONOTRIBUTISTA: 6,\n IVA_NO_ALCANZADO: 15,\n} as const;\n\n/** Supported invoice concept types for WSFE requests. */\nexport const ARCA_CONCEPT_TYPES = {\n PRODUCTOS: 1,\n SERVICIOS: 2,\n PRODUCTOS_Y_SERVICIOS: 3,\n} as const;\n\n/** Common IVA rate identifiers used by WSFE. */\nexport const ARCA_VAT_RATES = {\n IVA_0: 3,\n IVA_10_5: 4,\n IVA_21: 5,\n IVA_27: 6,\n IVA_5: 8,\n IVA_2_5: 9,\n} as const;\n\n/** ISO currency codes accepted by the high-level WSFE builders. */\nexport const ISO_CURRENCIES = {\n ARS: \"ARS\",\n USD: \"USD\",\n} as const;\n\n/** ARCA currency identifiers keyed by their corresponding ISO currency. */\nexport const ARCA_CURRENCY_IDS = {\n ARS: \"PES\",\n USD: \"DOL\",\n} as const;\n\n/**\n * Common ARCA currency identifiers.\n * @deprecated Use ISO_CURRENCIES, or ARCA_CURRENCY_IDS at the provider boundary.\n */\nexport const ARCA_CURRENCIES = {\n PES: \"PES\",\n DOL: \"DOL\",\n} as const;\n\n/** Legal assertions supported by the invoice high-level API; never inferred from Padrón. */\nexport type IssuerCondition =\n | \"responsable_inscripto\"\n | \"monotributo\"\n | \"exento\"\n | \"no_alcanzado\";\nexport type ReceiverCondition = IssuerCondition | \"consumidor_final\";\nexport type VoucherClass = \"A\" | \"B\" | \"C\";\n\nexport const ARCA_RECEIVER_CONDITION_IDS = {\n responsable_inscripto: ARCA_RECEIVER_VAT_CONDITIONS.RESPONSABLE_INSCRIPTO,\n monotributo: ARCA_RECEIVER_VAT_CONDITIONS.MONOTRIBUTISTA,\n exento: ARCA_RECEIVER_VAT_CONDITIONS.EXENTO,\n consumidor_final: ARCA_RECEIVER_VAT_CONDITIONS.CONSUMIDOR_FINAL,\n no_alcanzado: ARCA_RECEIVER_VAT_CONDITIONS.IVA_NO_ALCANZADO,\n} as const satisfies Record<ReceiverCondition, number>;\n\nexport const ARCA_ISSUER_CONDITION_IDS = {\n responsable_inscripto: 1,\n monotributo: 6,\n exento: 4,\n no_alcanzado: 15,\n} as const satisfies Record<IssuerCondition, number>;\n\n// RG 5866/2026, art. 1(f), effective 2026-07-01 (art. 4).\n// https://www.argentina.gob.ar/normativa/nacional/norma-427092/texto\nexport const ARCA_FINAL_CONSUMER_IDENTIFICATION_THRESHOLD_MINOR_UNITS =\n 1_000_000_000n;\n\n// WSFE v4.7, physical PDF p. 203, validations 10243/10246; issuer asserted first.\n// ARCA checks actual issuer eligibility independently at authorization.\nexport const ARCA_INVOICE_CLASS_BY_ISSUER = {\n responsable_inscripto: {\n responsable_inscripto: \"A\",\n monotributo: \"A\",\n exento: \"B\",\n consumidor_final: \"B\",\n no_alcanzado: \"B\",\n },\n monotributo: {\n responsable_inscripto: \"C\",\n monotributo: \"C\",\n exento: \"C\",\n consumidor_final: \"C\",\n no_alcanzado: \"C\",\n },\n exento: {\n responsable_inscripto: \"C\",\n monotributo: \"C\",\n exento: \"C\",\n consumidor_final: \"C\",\n no_alcanzado: \"C\",\n },\n no_alcanzado: {\n responsable_inscripto: \"C\",\n monotributo: \"C\",\n exento: \"C\",\n consumidor_final: \"C\",\n no_alcanzado: \"C\",\n },\n} as const satisfies Record<\n IssuerCondition,\n Record<ReceiverCondition, VoucherClass>\n>;\n"],"mappings":";AACO,IAAM,qBAAqB;AAAA,EAChC,WAAW;AAAA,EACX,eAAe;AAAA,EACf,gBAAgB;AAAA,EAChB,WAAW;AAAA,EACX,eAAe;AAAA,EACf,gBAAgB;AAAA,EAChB,WAAW;AAAA,EACX,eAAe;AAAA,EACf,gBAAgB;AAClB;AAGO,IAAM,sBAAsB;AAAA,EACjC,MAAM;AAAA,EACN,KAAK;AAAA,EACL,kBAAkB;AACpB;AAMO,IAAM,+BAA+B;AAAA,EAC1C,uBAAuB;AAAA,EACvB,QAAQ;AAAA,EACR,kBAAkB;AAAA,EAClB,gBAAgB;AAAA,EAChB,kBAAkB;AACpB;AAGO,IAAM,qBAAqB;AAAA,EAChC,WAAW;AAAA,EACX,WAAW;AAAA,EACX,uBAAuB;AACzB;AAGO,IAAM,iBAAiB;AAAA,EAC5B,OAAO;AAAA,EACP,UAAU;AAAA,EACV,QAAQ;AAAA,EACR,QAAQ;AAAA,EACR,OAAO;AAAA,EACP,SAAS;AACX;AAGO,IAAM,iBAAiB;AAAA,EAC5B,KAAK;AAAA,EACL,KAAK;AACP;AAGO,IAAM,oBAAoB;AAAA,EAC/B,KAAK;AAAA,EACL,KAAK;AACP;AAMO,IAAM,kBAAkB;AAAA,EAC7B,KAAK;AAAA,EACL,KAAK;AACP;AAWO,IAAM,8BAA8B;AAAA,EACzC,uBAAuB,6BAA6B;AAAA,EACpD,aAAa,6BAA6B;AAAA,EAC1C,QAAQ,6BAA6B;AAAA,EACrC,kBAAkB,6BAA6B;AAAA,EAC/C,cAAc,6BAA6B;AAC7C;AAEO,IAAM,4BAA4B;AAAA,EACvC,uBAAuB;AAAA,EACvB,aAAa;AAAA,EACb,QAAQ;AAAA,EACR,cAAc;AAChB;AAIO,IAAM,2DACX;AAIK,IAAM,+BAA+B;AAAA,EAC1C,uBAAuB;AAAA,IACrB,uBAAuB;AAAA,IACvB,aAAa;AAAA,IACb,QAAQ;AAAA,IACR,kBAAkB;AAAA,IAClB,cAAc;AAAA,EAChB;AAAA,EACA,aAAa;AAAA,IACX,uBAAuB;AAAA,IACvB,aAAa;AAAA,IACb,QAAQ;AAAA,IACR,kBAAkB;AAAA,IAClB,cAAc;AAAA,EAChB;AAAA,EACA,QAAQ;AAAA,IACN,uBAAuB;AAAA,IACvB,aAAa;AAAA,IACb,QAAQ;AAAA,IACR,kBAAkB;AAAA,IAClB,cAAc;AAAA,EAChB;AAAA,EACA,cAAc;AAAA,IACZ,uBAAuB;AAAA,IACvB,aAAa;AAAA,IACb,QAAQ;AAAA,IACR,kBAAkB;AAAA,IAClB,cAAc;AAAA,EAChB;AACF;","names":[]}
|
|
@@ -3,7 +3,7 @@ import {
|
|
|
3
3
|
ArcaServiceError,
|
|
4
4
|
ArcaSoapFaultError,
|
|
5
5
|
isArcaAuthenticationError
|
|
6
|
-
} from "./chunk-
|
|
6
|
+
} from "./chunk-BYEP3ABS.mjs";
|
|
7
7
|
|
|
8
8
|
// src/internal/authentication.ts
|
|
9
9
|
var WSFE_AUTHENTICATION_CODES = {
|
|
@@ -176,4 +176,4 @@ export {
|
|
|
176
176
|
createArcaAuthenticationEvidence,
|
|
177
177
|
executeWithAuthenticationRecovery
|
|
178
178
|
};
|
|
179
|
-
//# sourceMappingURL=chunk-
|
|
179
|
+
//# sourceMappingURL=chunk-PHXH34L6.mjs.map
|
|
@@ -3,14 +3,14 @@ import {
|
|
|
3
3
|
classifyArcaAuthenticationIssues,
|
|
4
4
|
createArcaAuthenticationEvidence,
|
|
5
5
|
executeWithAuthenticationRecovery
|
|
6
|
-
} from "./chunk-
|
|
6
|
+
} from "./chunk-PHXH34L6.mjs";
|
|
7
7
|
import {
|
|
8
8
|
ArcaInputError,
|
|
9
9
|
ArcaInvalidSoapResponseError,
|
|
10
10
|
ArcaServiceError,
|
|
11
11
|
ArcaSoapFaultError,
|
|
12
12
|
ArcaTransportError
|
|
13
|
-
} from "./chunk-
|
|
13
|
+
} from "./chunk-BYEP3ABS.mjs";
|
|
14
14
|
|
|
15
15
|
// src/services/wsmtxca.ts
|
|
16
16
|
function createWsmtxcaService(options) {
|
|
@@ -18,13 +18,13 @@ function createWsmtxcaService(options) {
|
|
|
18
18
|
const auth = await options.auth.login("wsmtxca", {
|
|
19
19
|
representedTaxId: input.representedTaxId,
|
|
20
20
|
forceRefresh: input.forceRefresh,
|
|
21
|
-
|
|
21
|
+
abortSignal: input.abortSignal
|
|
22
22
|
});
|
|
23
23
|
const response = await options.soap.execute({
|
|
24
24
|
service: "wsmtxca",
|
|
25
25
|
operation,
|
|
26
26
|
...retries === void 0 ? {} : { retries },
|
|
27
|
-
signal: input.
|
|
27
|
+
signal: input.abortSignal,
|
|
28
28
|
bodyElementName: `${operation}Request`,
|
|
29
29
|
bodyElementNamespaceMode: "prefix",
|
|
30
30
|
body: {
|
|
@@ -43,7 +43,7 @@ function createWsmtxcaService(options) {
|
|
|
43
43
|
representedTaxId,
|
|
44
44
|
data,
|
|
45
45
|
forceRefresh,
|
|
46
|
-
|
|
46
|
+
abortSignal
|
|
47
47
|
}) {
|
|
48
48
|
if (Object.hasOwn(data, "authRequest")) {
|
|
49
49
|
throw new ArcaInputError(
|
|
@@ -58,7 +58,7 @@ function createWsmtxcaService(options) {
|
|
|
58
58
|
try {
|
|
59
59
|
const raw = await executeWsmtxcaAuthenticatedOperation(
|
|
60
60
|
"autorizarComprobante",
|
|
61
|
-
{ representedTaxId, forceRefresh,
|
|
61
|
+
{ representedTaxId, forceRefresh, abortSignal },
|
|
62
62
|
data,
|
|
63
63
|
0
|
|
64
64
|
);
|
|
@@ -78,7 +78,7 @@ function createWsmtxcaService(options) {
|
|
|
78
78
|
voucherType,
|
|
79
79
|
salesPoint,
|
|
80
80
|
forceRefresh,
|
|
81
|
-
|
|
81
|
+
abortSignal
|
|
82
82
|
}) {
|
|
83
83
|
return executeWithAuthenticationRecovery({
|
|
84
84
|
service: "wsmtxca",
|
|
@@ -89,7 +89,7 @@ function createWsmtxcaService(options) {
|
|
|
89
89
|
voucherType,
|
|
90
90
|
salesPoint,
|
|
91
91
|
forceRefresh: attemptForceRefresh,
|
|
92
|
-
|
|
92
|
+
abortSignal
|
|
93
93
|
})
|
|
94
94
|
});
|
|
95
95
|
}
|
|
@@ -98,12 +98,12 @@ function createWsmtxcaService(options) {
|
|
|
98
98
|
voucherType,
|
|
99
99
|
salesPoint,
|
|
100
100
|
forceRefresh,
|
|
101
|
-
|
|
101
|
+
abortSignal
|
|
102
102
|
}) {
|
|
103
103
|
const operation = "consultarUltimoComprobanteAutorizado";
|
|
104
104
|
const raw = await executeWsmtxcaAuthenticatedOperation(
|
|
105
105
|
operation,
|
|
106
|
-
{ representedTaxId, forceRefresh,
|
|
106
|
+
{ representedTaxId, forceRefresh, abortSignal },
|
|
107
107
|
{
|
|
108
108
|
consultaUltimoComprobanteAutorizadoRequest: {
|
|
109
109
|
codigoTipoComprobante: voucherType,
|
|
@@ -176,7 +176,7 @@ function createWsmtxcaService(options) {
|
|
|
176
176
|
salesPoint,
|
|
177
177
|
voucherNumber,
|
|
178
178
|
forceRefresh,
|
|
179
|
-
|
|
179
|
+
abortSignal
|
|
180
180
|
}) {
|
|
181
181
|
return executeWithAuthenticationRecovery({
|
|
182
182
|
service: "wsmtxca",
|
|
@@ -188,7 +188,7 @@ function createWsmtxcaService(options) {
|
|
|
188
188
|
salesPoint,
|
|
189
189
|
voucherNumber,
|
|
190
190
|
forceRefresh: attemptForceRefresh,
|
|
191
|
-
|
|
191
|
+
abortSignal
|
|
192
192
|
})
|
|
193
193
|
});
|
|
194
194
|
}
|
|
@@ -198,12 +198,12 @@ function createWsmtxcaService(options) {
|
|
|
198
198
|
salesPoint,
|
|
199
199
|
voucherNumber,
|
|
200
200
|
forceRefresh,
|
|
201
|
-
|
|
201
|
+
abortSignal
|
|
202
202
|
}) {
|
|
203
203
|
const operation = "consultarComprobante";
|
|
204
204
|
const raw = await executeWsmtxcaAuthenticatedOperation(
|
|
205
205
|
operation,
|
|
206
|
-
{ representedTaxId, forceRefresh,
|
|
206
|
+
{ representedTaxId, forceRefresh, abortSignal },
|
|
207
207
|
{
|
|
208
208
|
consultaComprobanteRequest: {
|
|
209
209
|
codigoTipoComprobante: voucherType,
|
|
@@ -655,4 +655,4 @@ function formatCompactDateToIso(dateValue) {
|
|
|
655
655
|
export {
|
|
656
656
|
createWsmtxcaService
|
|
657
657
|
};
|
|
658
|
-
//# sourceMappingURL=chunk-
|
|
658
|
+
//# sourceMappingURL=chunk-WN62NMUJ.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../src/services/wsmtxca.ts"],"sourcesContent":["import {\n ArcaInputError,\n ArcaInvalidSoapResponseError,\n ArcaServiceError,\n ArcaSoapFaultError,\n ArcaTransportError,\n} from \"../errors\";\nimport {\n classifyArcaAuthenticationError,\n classifyArcaAuthenticationIssues,\n createArcaAuthenticationEvidence,\n executeWithAuthenticationRecovery,\n} from \"../internal/authentication\";\nimport type { ArcaClientConfig, ArcaRepresentedTaxId } from \"../internal/types\";\nimport type { SoapTransport } from \"../soap\";\nimport type { WsaaAuthModule } from \"../wsaa\";\nimport type {\n ArcaAuthorizationIndeterminateReason,\n ArcaAuthorizationOutcome,\n ArcaFiscalIssue,\n ArcaVoucherLookupResult,\n} from \"./fiscal-evidence\";\n\n/** Input data for one WSMTXCA voucher authorization. */\nexport type WsmtxcaAuthorizeVoucherInput = {\n representedTaxId?: ArcaRepresentedTaxId;\n data: Record<string, unknown>;\n forceRefresh?: boolean;\n /** Aborts login, submission and consultation with the caller's deadline. */\n abortSignal?: AbortSignal;\n};\n\n/** Structured evidence from one exact WSMTXCA authorization attempt. */\nexport type WsmtxcaAuthorizationOutcome = ArcaAuthorizationOutcome<\"wsmtxca\">;\n\n/** Result of querying the last authorized voucher number. */\nexport type WsmtxcaLastAuthorizedVoucherResult = {\n voucherNumber: number;\n raw: Record<string, unknown>;\n};\n\n/** A point of sale enabled for WSMTXCA. */\nexport type WsmtxcaSalesPoint = {\n number: number;\n blocked: boolean;\n deletedAt?: string;\n};\n\n/** Result of querying WSMTXCA points of sale. */\nexport type WsmtxcaSalesPointsResult = {\n salesPoints: WsmtxcaSalesPoint[];\n raw: Record<string, unknown>;\n};\n\n/** Typed provider fields used to match one exact WSMTXCA voucher. */\nexport type WsmtxcaVoucherInfo = {\n voucherNumber?: number;\n invoiceDate?: string;\n salesPoint?: number;\n voucherType?: number;\n concept?: number;\n documentType?: number;\n documentNumber?: string;\n receiverVatConditionId?: number;\n totalAmount?: number;\n subtotalAmount?: number;\n taxableAmount?: number;\n nonTaxableAmount?: number;\n exemptAmount?: number;\n taxAmount?: number;\n vatAmount?: number;\n currencyId?: string;\n exchangeRate?: number;\n cae?: string;\n caeExpiry?: string;\n raw: Record<string, unknown>;\n};\n\n/** Typed exact-voucher consultation result for WSMTXCA. */\nexport type WsmtxcaVoucherLookupOutcome = ArcaVoucherLookupResult<\n WsmtxcaVoucherInfo,\n \"wsmtxca\"\n>;\n\n/** Result of looking up a specific WSMTXCA voucher. */\nexport type WsmtxcaVoucherLookupResult = {\n invoiceDate: string;\n voucher: Record<string, unknown>;\n messages: string[];\n raw: Record<string, unknown>;\n};\n\n/** WSMTXCA electronic invoicing service (Factura de Crédito Electrónica). */\nexport type WsmtxcaService = {\n /**\n * Issues one exact voucher: a single autorizarComprobante without transport\n * retries, returning structured evidence instead of throwing.\n */\n issue(\n input: WsmtxcaAuthorizeVoucherInput\n ): Promise<WsmtxcaAuthorizationOutcome>;\n /** Returns the last authorized voucher number for the given sales point and type. */\n getLastAuthorizedVoucher(input: {\n representedTaxId?: ArcaRepresentedTaxId;\n voucherType: number;\n salesPoint: number;\n forceRefresh?: boolean;\n abortSignal?: AbortSignal;\n }): Promise<WsmtxcaLastAuthorizedVoucherResult>;\n /** Returns the points of sale enabled for WSMTXCA. */\n getSalesPoints(input: {\n representedTaxId?: ArcaRepresentedTaxId;\n forceRefresh?: boolean;\n }): Promise<WsmtxcaSalesPointsResult>;\n /** Consults one exact voucher and normalizes WSMTXCA error 1503 to `not_found`. */\n lookupVoucher(input: {\n representedTaxId?: ArcaRepresentedTaxId;\n voucherType: number;\n salesPoint: number;\n voucherNumber: number;\n forceRefresh?: boolean;\n abortSignal?: AbortSignal;\n }): Promise<WsmtxcaVoucherLookupOutcome>;\n /** Retrieves details for a specific voucher. */\n getVoucher(input: {\n representedTaxId?: ArcaRepresentedTaxId;\n voucherType: number;\n salesPoint: number;\n voucherNumber: number;\n forceRefresh?: boolean;\n }): Promise<WsmtxcaVoucherLookupResult>;\n};\n\nexport type CreateWsmtxcaServiceOptions = {\n config: ArcaClientConfig;\n auth: WsaaAuthModule;\n soap: SoapTransport;\n};\n\n/** Creates a WSMTXCA service instance wired with authentication and SOAP transport. */\nexport function createWsmtxcaService(\n options: CreateWsmtxcaServiceOptions\n): WsmtxcaService {\n async function executeWsmtxcaAuthenticatedOperation(\n operation: WsmtxcaOperation,\n input: {\n representedTaxId?: ArcaRepresentedTaxId;\n forceRefresh?: boolean;\n abortSignal?: AbortSignal;\n },\n body: Record<string, unknown> = {},\n retries?: number\n ) {\n const auth = await options.auth.login(\"wsmtxca\", {\n representedTaxId: input.representedTaxId,\n forceRefresh: input.forceRefresh,\n abortSignal: input.abortSignal,\n });\n const response = await options.soap.execute<\n Record<string, unknown>,\n Record<string, unknown>\n >({\n service: \"wsmtxca\",\n operation,\n ...(retries === undefined ? {} : { retries }),\n signal: input.abortSignal,\n bodyElementName: `${operation}Request`,\n bodyElementNamespaceMode: \"prefix\",\n body: {\n // WSMTXCA request types use an XML sequence with authentication first.\n authRequest: createWsmtxcaAuth(\n input.representedTaxId ?? options.config.taxId,\n auth.token,\n auth.sign\n ),\n ...body,\n },\n });\n\n return unwrapWsmtxcaOperationResponse(response.result, operation);\n }\n\n async function executeWsmtxcaAuthorization({\n representedTaxId,\n data,\n forceRefresh,\n abortSignal,\n }: WsmtxcaAuthorizeVoucherInput): Promise<{\n outcome: WsmtxcaAuthorizationOutcome;\n error?: unknown;\n }> {\n if (Object.hasOwn(data, \"authRequest\")) {\n throw new ArcaInputError(\n 'WSMTXCA authorization data cannot include the reserved top-level field \"authRequest\".',\n {\n code: \"ARCA_INPUT_RESERVED_FIELD\",\n field: \"data.authRequest\",\n expected: \"omitted because facturas manages authentication fields\",\n }\n );\n }\n\n try {\n const raw = await executeWsmtxcaAuthenticatedOperation(\n \"autorizarComprobante\",\n { representedTaxId, forceRefresh, abortSignal },\n data,\n 0\n );\n return { outcome: classifyWsmtxcaAuthorization(raw) };\n } catch (error) {\n return {\n outcome: createWsmtxcaIndeterminateOutcome(error),\n error,\n };\n }\n }\n\n async function issue(\n input: WsmtxcaAuthorizeVoucherInput\n ): Promise<WsmtxcaAuthorizationOutcome> {\n return (await executeWsmtxcaAuthorization(input)).outcome;\n }\n\n function getLastAuthorizedVoucher({\n representedTaxId,\n voucherType,\n salesPoint,\n forceRefresh,\n abortSignal,\n }: {\n representedTaxId?: ArcaRepresentedTaxId;\n voucherType: number;\n salesPoint: number;\n forceRefresh?: boolean;\n abortSignal?: AbortSignal;\n }): Promise<WsmtxcaLastAuthorizedVoucherResult> {\n return executeWithAuthenticationRecovery({\n service: \"wsmtxca\",\n operation: \"consultarUltimoComprobanteAutorizado\",\n forceRefresh,\n execute: (attemptForceRefresh) =>\n getLastAuthorizedVoucherOnce({\n representedTaxId,\n voucherType,\n salesPoint,\n forceRefresh: attemptForceRefresh,\n abortSignal,\n }),\n });\n }\n\n async function getLastAuthorizedVoucherOnce({\n representedTaxId,\n voucherType,\n salesPoint,\n forceRefresh,\n abortSignal,\n }: {\n representedTaxId?: ArcaRepresentedTaxId;\n voucherType: number;\n salesPoint: number;\n forceRefresh?: boolean;\n abortSignal?: AbortSignal;\n }): Promise<WsmtxcaLastAuthorizedVoucherResult> {\n const operation = \"consultarUltimoComprobanteAutorizado\";\n const raw = await executeWsmtxcaAuthenticatedOperation(\n operation,\n { representedTaxId, forceRefresh, abortSignal },\n {\n consultaUltimoComprobanteAutorizadoRequest: {\n codigoTipoComprobante: voucherType,\n numeroPuntoVenta: salesPoint,\n },\n }\n );\n const errors = extractWsmtxcaIssues(raw, operation, \"error\");\n\n if (errors.length > 0 && errors.every((issue) => issue.code === \"1502\")) {\n return { voucherNumber: 0, raw };\n }\n if (errors.length > 0) {\n throw createWsmtxcaServiceError(operation, errors);\n }\n\n return {\n voucherNumber: parseWsmtxcaVoucherNumber(\n raw.numeroComprobante ?? raw.cbteNro ?? raw.nroComprobante,\n \"WSMTXCA did not return the last authorized voucher number\",\n true\n ),\n raw,\n };\n }\n\n function getSalesPoints({\n representedTaxId,\n forceRefresh,\n }: {\n representedTaxId?: ArcaRepresentedTaxId;\n forceRefresh?: boolean;\n }): Promise<WsmtxcaSalesPointsResult> {\n return executeWithAuthenticationRecovery({\n service: \"wsmtxca\",\n operation: \"consultarPuntosVenta\",\n forceRefresh,\n execute: (attemptForceRefresh) =>\n getSalesPointsOnce({\n representedTaxId,\n forceRefresh: attemptForceRefresh,\n }),\n });\n }\n\n async function getSalesPointsOnce({\n representedTaxId,\n forceRefresh,\n }: {\n representedTaxId?: ArcaRepresentedTaxId;\n forceRefresh?: boolean;\n }): Promise<WsmtxcaSalesPointsResult> {\n const operation = \"consultarPuntosVenta\";\n const raw = await executeWsmtxcaAuthenticatedOperation(operation, {\n representedTaxId,\n forceRefresh,\n });\n throwForWsmtxcaOperationErrors(operation, raw);\n const rawSalesPoints = toRecord(raw.arrayPuntosVenta)?.puntoVenta;\n const entries = Array.isArray(rawSalesPoints)\n ? rawSalesPoints\n : rawSalesPoints\n ? [rawSalesPoints]\n : [];\n const salesPoints = entries.flatMap((entry) => {\n const record = toRecord(entry);\n const number = parseOptionalPositiveInteger(record?.numeroPuntoVenta);\n if (number === undefined) {\n return [];\n }\n const deletedAt = normalizeWsmtxcaResponseDate(record?.fechaBaja);\n return [\n {\n number,\n blocked: String(record?.bloqueado ?? \"N\").toUpperCase() === \"S\",\n ...(deletedAt === undefined ? {} : { deletedAt }),\n },\n ];\n });\n\n return { salesPoints, raw };\n }\n\n function lookupVoucher({\n representedTaxId,\n voucherType,\n salesPoint,\n voucherNumber,\n forceRefresh,\n abortSignal,\n }: {\n representedTaxId?: ArcaRepresentedTaxId;\n voucherType: number;\n salesPoint: number;\n voucherNumber: number;\n forceRefresh?: boolean;\n abortSignal?: AbortSignal;\n }): Promise<WsmtxcaVoucherLookupOutcome> {\n return executeWithAuthenticationRecovery({\n service: \"wsmtxca\",\n operation: \"consultarComprobante\",\n forceRefresh,\n execute: (attemptForceRefresh) =>\n lookupVoucherOnce({\n representedTaxId,\n voucherType,\n salesPoint,\n voucherNumber,\n forceRefresh: attemptForceRefresh,\n abortSignal,\n }),\n });\n }\n\n async function lookupVoucherOnce({\n representedTaxId,\n voucherType,\n salesPoint,\n voucherNumber,\n forceRefresh,\n abortSignal,\n }: {\n representedTaxId?: ArcaRepresentedTaxId;\n voucherType: number;\n salesPoint: number;\n voucherNumber: number;\n forceRefresh?: boolean;\n abortSignal?: AbortSignal;\n }): Promise<WsmtxcaVoucherLookupOutcome> {\n const operation = \"consultarComprobante\";\n const raw = await executeWsmtxcaAuthenticatedOperation(\n operation,\n { representedTaxId, forceRefresh, abortSignal },\n {\n consultaComprobanteRequest: {\n codigoTipoComprobante: voucherType,\n numeroPuntoVenta: salesPoint,\n numeroComprobante: voucherNumber,\n },\n }\n );\n const errors = extractWsmtxcaIssues(raw, operation, \"error\");\n const observations = extractWsmtxcaIssues(raw, operation, \"observation\");\n\n if (errors.length > 0 && errors.every((issue) => issue.code === \"1503\")) {\n return {\n kind: \"not_found\",\n service: \"wsmtxca\",\n operation,\n errors,\n observations,\n raw,\n };\n }\n if (errors.length > 0) {\n throw createWsmtxcaServiceError(operation, errors);\n }\n\n const voucher = extractWsmtxcaVoucherPayload(raw);\n if (voucher === raw && !toRecord(raw.comprobante)) {\n throw new ArcaServiceError(\n \"WSMTXCA did not return the voucher issue date\",\n {\n service: \"wsmtxca\",\n operation,\n issues: observations,\n }\n );\n }\n\n return {\n kind: \"found\",\n service: \"wsmtxca\",\n operation,\n voucher: mapWsmtxcaVoucherInfo(voucher),\n observations,\n raw,\n };\n }\n\n async function getVoucher(input: {\n representedTaxId?: ArcaRepresentedTaxId;\n voucherType: number;\n salesPoint: number;\n voucherNumber: number;\n forceRefresh?: boolean;\n }): Promise<WsmtxcaVoucherLookupResult> {\n const lookup = await lookupVoucher(input);\n if (lookup.kind === \"not_found\") {\n throw createWsmtxcaServiceError(lookup.operation, lookup.errors);\n }\n\n const invoiceDate = lookup.voucher.invoiceDate;\n if (!invoiceDate) {\n throw new ArcaServiceError(\n formatWsmtxcaIssues(lookup.observations)[0] ??\n \"WSMTXCA did not return the voucher issue date\",\n {\n service: \"wsmtxca\",\n operation: lookup.operation,\n issues: lookup.observations,\n }\n );\n }\n\n return {\n invoiceDate,\n voucher: lookup.voucher.raw,\n messages: formatWsmtxcaIssues(lookup.observations),\n raw: lookup.raw,\n };\n }\n\n return {\n issue,\n getLastAuthorizedVoucher,\n getSalesPoints,\n lookupVoucher,\n getVoucher,\n };\n}\n\nfunction createWsmtxcaAuth(\n representedTaxId: number | string,\n token: string,\n sign: string\n) {\n return {\n token,\n sign,\n cuitRepresentada: Number.parseInt(String(representedTaxId), 10),\n };\n}\n\nfunction toRecord(value: unknown): Record<string, unknown> | undefined {\n return value && typeof value === \"object\" && !Array.isArray(value)\n ? (value as Record<string, unknown>)\n : undefined;\n}\n\ntype WsmtxcaOperation =\n | \"autorizarComprobante\"\n | \"consultarUltimoComprobanteAutorizado\"\n | \"consultarPuntosVenta\"\n | \"consultarComprobante\";\n\nfunction unwrapWsmtxcaOperationResponse(\n response: unknown,\n operation: WsmtxcaOperation\n) {\n const responseRecord = toRecord(response) ?? {};\n\n if (operation === \"autorizarComprobante\") {\n return (\n toRecord(responseRecord.autorizarComprobanteResponse) ??\n toRecord(responseRecord.autorizarComprobanteResult) ??\n toRecord(responseRecord.comprobanteCAEResponse) ??\n toRecord(responseRecord.comprobanteCAEReponse) ??\n responseRecord\n );\n }\n\n if (operation === \"consultarComprobante\") {\n return (\n toRecord(responseRecord.consultarComprobanteResponse) ??\n toRecord(responseRecord.consultaComprobanteResponse) ??\n toRecord(responseRecord.consultarComprobanteResult) ??\n responseRecord\n );\n }\n\n if (operation === \"consultarPuntosVenta\") {\n return (\n toRecord(responseRecord.consultarPuntosVentaResponse) ??\n toRecord(responseRecord.consultarPuntosVentaResult) ??\n responseRecord\n );\n }\n\n return (\n toRecord(responseRecord.consultarUltimoComprobanteAutorizadoResponse) ??\n toRecord(responseRecord.consultaUltimoComprobanteAutorizadoResponse) ??\n toRecord(responseRecord.consultarUltimoComprobanteAutorizadoResult) ??\n responseRecord\n );\n}\n\nfunction extractWsmtxcaAuthorizationPayload(raw: Record<string, unknown>) {\n return (\n toRecord(raw.comprobanteResponse) ??\n toRecord(raw.comprobanteCAEResponse) ??\n toRecord(raw.comprobanteCAEReponse) ??\n raw\n );\n}\n\nfunction extractWsmtxcaVoucherPayload(raw: Record<string, unknown>) {\n return (\n toRecord(raw.comprobanteResponse) ??\n toRecord(raw.comprobante) ??\n toRecord(raw.cmp) ??\n raw\n );\n}\n\nfunction classifyWsmtxcaAuthorization(\n raw: Record<string, unknown>\n): WsmtxcaAuthorizationOutcome {\n const operation = \"autorizarComprobante\";\n const payload = extractWsmtxcaAuthorizationPayload(raw);\n const result = normalizeWsmtxcaResult(raw.resultado ?? payload.resultado);\n const cae = normalizeWsmtxcaString(\n payload.CAE ?? payload.codigoAutorizacion ?? raw.codigoAutorizacion\n );\n const caeExpiry = normalizeWsmtxcaResponseDate(\n payload.fechaVencimientoCAE ??\n payload.fechaVencimiento ??\n raw.fechaVencimiento\n );\n const voucherNumber = parseOptionalPositiveInteger(\n payload.numeroComprobante ?? raw.numeroComprobante\n );\n const errors = extractWsmtxcaIssues(raw, operation, \"error\");\n const observations = extractWsmtxcaIssues(raw, operation, \"observation\");\n const base = {\n service: \"wsmtxca\" as const,\n operation,\n results: createWsmtxcaResults(result),\n errors,\n observations,\n raw,\n };\n\n const authenticationOutcome = createWsmtxcaAuthenticationOutcome({\n base,\n result,\n cae,\n voucherNumber,\n });\n if (authenticationOutcome) {\n return authenticationOutcome;\n }\n\n if (\n (result === \"A\" || result === \"O\") &&\n cae &&\n voucherNumber !== undefined &&\n errors.length === 0\n ) {\n return {\n ...base,\n kind: \"authorized\",\n result,\n resultLevel: \"operation\",\n cae,\n ...(caeExpiry === undefined ? {} : { caeExpiry }),\n voucherNumber,\n };\n }\n\n if (result === \"R\" && !cae && errors.length > 0) {\n return {\n ...base,\n kind: \"rejected\",\n result: \"R\",\n resultLevel: \"operation\",\n };\n }\n\n const outcome: WsmtxcaAuthorizationOutcome = {\n ...base,\n kind: \"indeterminate\",\n reason:\n (result === \"R\" && Boolean(cae)) ||\n ((result === \"A\" || result === \"O\") && Boolean(errors.length))\n ? \"contradictory_response\"\n : \"incomplete_response\",\n ...(result === undefined ? {} : { result }),\n ...(result === undefined ? {} : { resultLevel: \"operation\" }),\n };\n assignWsmtxcaValue(outcome, \"cae\", cae);\n assignWsmtxcaValue(outcome, \"caeExpiry\", caeExpiry);\n assignWsmtxcaValue(outcome, \"voucherNumber\", voucherNumber);\n return outcome;\n}\n\nfunction createWsmtxcaAuthenticationOutcome({\n base,\n result,\n cae,\n voucherNumber,\n}: {\n base: {\n service: \"wsmtxca\";\n operation: string;\n results: ReturnType<typeof createWsmtxcaResults>;\n errors: ArcaFiscalIssue[];\n observations: ArcaFiscalIssue[];\n raw: Record<string, unknown>;\n };\n result?: string;\n cae?: string;\n voucherNumber?: number;\n}): WsmtxcaAuthorizationOutcome | undefined {\n const authenticationError = classifyArcaAuthenticationIssues(base.errors, {\n service: base.service,\n operation: base.operation,\n });\n if (\n !authenticationError ||\n result === \"A\" ||\n result === \"O\" ||\n cae ||\n voucherNumber !== undefined\n ) {\n return undefined;\n }\n\n return {\n ...base,\n kind: \"indeterminate\",\n reason: \"authentication_rejected\",\n authentication: createArcaAuthenticationEvidence(authenticationError),\n ...(result === undefined ? {} : { result }),\n ...(result === undefined ? {} : { resultLevel: \"operation\" }),\n };\n}\n\nfunction createWsmtxcaIndeterminateOutcome(\n error: unknown\n): WsmtxcaAuthorizationOutcome {\n const authenticationError = classifyArcaAuthenticationError(error, {\n service: \"wsmtxca\",\n operation: \"autorizarComprobante\",\n });\n return {\n kind: \"indeterminate\",\n service: \"wsmtxca\",\n operation: \"autorizarComprobante\",\n results: {},\n reason: authenticationError\n ? \"authentication_rejected\"\n : getWsmtxcaIndeterminateReason(error),\n ...(authenticationError\n ? {\n authentication: createArcaAuthenticationEvidence(authenticationError),\n }\n : {}),\n errors: [],\n observations: [],\n };\n}\n\nfunction getWsmtxcaIndeterminateReason(\n error: unknown\n): ArcaAuthorizationIndeterminateReason {\n if (error instanceof ArcaTransportError) {\n return \"transport_error\";\n }\n if (error instanceof ArcaSoapFaultError) {\n return \"soap_fault\";\n }\n if (error instanceof ArcaInvalidSoapResponseError) {\n return \"invalid_response\";\n }\n return \"unexpected_error\";\n}\n\nfunction createWsmtxcaResults(operationResult?: string) {\n const results: { operation?: string } = {};\n assignWsmtxcaValue(results, \"operation\", operationResult);\n return results;\n}\n\nfunction createWsmtxcaServiceError(\n operation: string,\n issues: ArcaFiscalIssue[]\n) {\n const authenticationError = classifyArcaAuthenticationIssues(issues, {\n service: \"wsmtxca\",\n operation,\n });\n if (authenticationError) {\n return authenticationError;\n }\n\n const firstIssue = issues[0];\n return new ArcaServiceError(\n formatWsmtxcaIssues(issues).join(\" | \") ||\n \"WSMTXCA returned a service error\",\n {\n service: \"wsmtxca\",\n operation,\n ...(firstIssue?.code === undefined\n ? {}\n : { serviceCode: firstIssue.code }),\n issues,\n }\n );\n}\n\nfunction throwForWsmtxcaOperationErrors(\n operation: string,\n raw: Record<string, unknown>\n): void {\n const errors = extractWsmtxcaIssues(raw, operation, \"error\");\n if (errors.length > 0) {\n throw createWsmtxcaServiceError(operation, errors);\n }\n}\n\nfunction extractWsmtxcaIssues(\n raw: Record<string, unknown>,\n operation: string,\n source: \"error\" | \"observation\"\n): ArcaFiscalIssue[] {\n const container = toRecord(\n source === \"error\" ? raw.arrayErrores : raw.arrayObservaciones\n );\n return normalizeWsmtxcaIssueEntries(container?.codigoDescripcion).map(\n (entry) => ({\n service: \"wsmtxca\",\n operation,\n source,\n category:\n source === \"observation\"\n ? \"observation\"\n : operation === \"autorizarComprobante\"\n ? \"business\"\n : \"unknown\",\n ...(entry.code === undefined ? {} : { code: entry.code }),\n message: entry.message,\n ...(operation === \"autorizarComprobante\"\n ? { resultLevel: \"operation\" as const }\n : {}),\n })\n );\n}\n\nfunction normalizeWsmtxcaIssueEntries(value: unknown) {\n const entries = Array.isArray(value) ? value : value ? [value] : [];\n return entries.map((entry) => {\n const record = toRecord(entry) ?? {};\n const code = record.codigo;\n const description = record.descripcion;\n return {\n ...(code === undefined || code === null ? {} : { code: String(code) }),\n message:\n description === undefined || description === null\n ? \"Unknown WSMTXCA issue\"\n : String(description),\n };\n });\n}\n\nfunction formatWsmtxcaIssues(issues: ArcaFiscalIssue[]): string[] {\n return issues.map((issue) => {\n const prefix = issue.source === \"error\" ? \"Error\" : \"Obs\";\n return `${prefix}${issue.code ? ` ${issue.code}` : \"\"}: ${issue.message}`;\n });\n}\n\nfunction mapWsmtxcaVoucherInfo(\n raw: Record<string, unknown>\n): WsmtxcaVoucherInfo {\n const voucher: WsmtxcaVoucherInfo = { raw };\n const invoiceDate = normalizeWsmtxcaResponseDate(\n raw.fechaEmision ?? raw.fecha ?? raw.CbteFch\n );\n const cae = normalizeWsmtxcaString(raw.codigoAutorizacion ?? raw.CAE);\n const caeExpiry = normalizeWsmtxcaResponseDate(\n raw.fechaVencimiento ?? raw.fechaVencimientoCAE\n );\n const vatAmount = sumWsmtxcaVatAmounts(raw.arraySubtotalesIVA);\n\n assignWsmtxcaValue(\n voucher,\n \"voucherNumber\",\n parseOptionalPositiveInteger(raw.numeroComprobante)\n );\n assignWsmtxcaValue(voucher, \"invoiceDate\", invoiceDate);\n assignWsmtxcaValue(\n voucher,\n \"salesPoint\",\n parseOptionalPositiveInteger(raw.numeroPuntoVenta)\n );\n assignWsmtxcaValue(\n voucher,\n \"voucherType\",\n parseOptionalPositiveInteger(raw.codigoTipoComprobante)\n );\n assignWsmtxcaValue(\n voucher,\n \"concept\",\n parseOptionalNumber(raw.codigoConcepto)\n );\n assignWsmtxcaValue(\n voucher,\n \"documentType\",\n parseOptionalNumber(raw.codigoTipoDocumento)\n );\n assignWsmtxcaValue(\n voucher,\n \"documentNumber\",\n normalizeWsmtxcaString(raw.numeroDocumento)\n );\n assignWsmtxcaValue(\n voucher,\n \"receiverVatConditionId\",\n parseOptionalNumber(raw.condicionIVAReceptor)\n );\n assignWsmtxcaValue(\n voucher,\n \"totalAmount\",\n parseOptionalNumber(raw.importeTotal)\n );\n assignWsmtxcaValue(\n voucher,\n \"subtotalAmount\",\n parseOptionalNumber(raw.importeSubtotal)\n );\n assignWsmtxcaValue(\n voucher,\n \"taxableAmount\",\n parseOptionalNumber(raw.importeGravado)\n );\n assignWsmtxcaValue(\n voucher,\n \"nonTaxableAmount\",\n parseOptionalNumber(raw.importeNoGravado)\n );\n assignWsmtxcaValue(\n voucher,\n \"exemptAmount\",\n parseOptionalNumber(raw.importeExento)\n );\n // A voucher issued without tributes carries neither the amount nor the\n // detail, and its tribute amount is zero.\n assignWsmtxcaValue(\n voucher,\n \"taxAmount\",\n parseOptionalNumber(raw.importeOtrosTributos) ??\n (raw.arrayOtrosTributos === undefined ? 0 : undefined)\n );\n assignWsmtxcaValue(voucher, \"vatAmount\", vatAmount);\n assignWsmtxcaValue(\n voucher,\n \"currencyId\",\n normalizeWsmtxcaString(raw.codigoMoneda)\n );\n assignWsmtxcaValue(\n voucher,\n \"exchangeRate\",\n parseOptionalNumber(raw.cotizacionMoneda)\n );\n assignWsmtxcaValue(voucher, \"cae\", cae);\n assignWsmtxcaValue(voucher, \"caeExpiry\", caeExpiry);\n\n return voucher;\n}\n\nfunction sumWsmtxcaVatAmounts(value: unknown): number | undefined {\n const subtotals = toRecord(value)?.subtotalIVA;\n const entries = Array.isArray(subtotals)\n ? subtotals\n : subtotals\n ? [subtotals]\n : [];\n const amounts = entries\n .map((entry) => parseOptionalNumber(toRecord(entry)?.importe))\n .filter((amount): amount is number => amount !== undefined);\n return amounts.length > 0\n ? amounts.reduce((total, amount) => total + amount, 0)\n : undefined;\n}\n\nfunction parseWsmtxcaVoucherNumber(\n value: unknown,\n message: string,\n allowZero = false\n) {\n const parsed = Number.parseInt(String(value ?? \"\"), 10);\n if (!Number.isFinite(parsed) || (allowZero ? parsed < 0 : parsed <= 0)) {\n throw new ArcaServiceError(message, {\n service: \"wsmtxca\",\n });\n }\n return parsed;\n}\n\nfunction parseOptionalPositiveInteger(value: unknown): number | undefined {\n const parsed = Number.parseInt(String(value ?? \"\"), 10);\n return Number.isFinite(parsed) && parsed > 0 ? parsed : undefined;\n}\n\nfunction parseOptionalNumber(value: unknown): number | undefined {\n if (value === undefined || value === null || value === \"\") {\n return undefined;\n }\n const parsed = Number(value);\n return Number.isFinite(parsed) ? parsed : undefined;\n}\n\nfunction normalizeWsmtxcaResult(value: unknown): string | undefined {\n if (typeof value !== \"string\") {\n return undefined;\n }\n const normalized = value.trim().toUpperCase();\n return normalized || undefined;\n}\n\nfunction normalizeWsmtxcaString(value: unknown): string | undefined {\n if (value === undefined || value === null) {\n return undefined;\n }\n const normalized = String(value).trim();\n return normalized || undefined;\n}\n\nfunction assignWsmtxcaValue<TTarget, TKey extends keyof TTarget>(\n target: TTarget,\n key: TKey,\n value: TTarget[TKey] | undefined\n) {\n if (value !== undefined) {\n target[key] = value;\n }\n}\n\nfunction normalizeWsmtxcaResponseDate(value: unknown): string | undefined {\n if (typeof value === \"number\" && Number.isInteger(value)) {\n return formatCompactDateToIso(value);\n }\n\n if (typeof value !== \"string\") {\n return undefined;\n }\n\n const trimmed = value.trim();\n if (!trimmed) {\n return undefined;\n }\n\n if (/^\\d{8}$/.test(trimmed)) {\n return formatCompactDateToIso(Number.parseInt(trimmed, 10));\n }\n\n if (/^\\d{4}-\\d{2}-\\d{2}/.test(trimmed)) {\n return trimmed.slice(0, 10);\n }\n\n return undefined;\n}\n\nfunction formatCompactDateToIso(dateValue?: number | null): string | undefined {\n if (!dateValue) {\n return undefined;\n }\n\n const raw = String(dateValue);\n if (raw.length !== 8) {\n return undefined;\n }\n\n return `${raw.slice(0, 4)}-${raw.slice(4, 6)}-${raw.slice(6, 8)}`;\n}\n"],"mappings":";;;;;;;;;;;;;;;AA4IO,SAAS,qBACd,SACgB;AAChB,iBAAe,qCACb,WACA,OAKA,OAAgC,CAAC,GACjC,SACA;AACA,UAAM,OAAO,MAAM,QAAQ,KAAK,MAAM,WAAW;AAAA,MAC/C,kBAAkB,MAAM;AAAA,MACxB,cAAc,MAAM;AAAA,MACpB,aAAa,MAAM;AAAA,IACrB,CAAC;AACD,UAAM,WAAW,MAAM,QAAQ,KAAK,QAGlC;AAAA,MACA,SAAS;AAAA,MACT;AAAA,MACA,GAAI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B;AAEA,SAAO;AACT;AAEA,SAAS,uBAAuB,WAA+C;AAC7E,MAAI,CAAC,WAAW;AACd,WAAO;AAAA,EACT;AAEA,QAAM,MAAM,OAAO,SAAS;AAC5B,MAAI,IAAI,WAAW,GAAG;AACpB,WAAO;AAAA,EACT;AAEA,SAAO,GAAG,IAAI,MAAM,GAAG,CAAC,CAAC,IAAI,IAAI,MAAM,GAAG,CAAC,CAAC,IAAI,IAAI,MAAM,GAAG,CAAC,CAAC;AACjE;","names":["issue"]}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import {
|
|
2
2
|
ArcaSoapFaultError
|
|
3
|
-
} from "./chunk-
|
|
3
|
+
} from "./chunk-BYEP3ABS.mjs";
|
|
4
4
|
|
|
5
5
|
// src/services/padron.ts
|
|
6
6
|
function createPadronService(options) {
|
|
@@ -103,4 +103,4 @@ async function executePadronOperation(options, service, operation, body) {
|
|
|
103
103
|
export {
|
|
104
104
|
createPadronService
|
|
105
105
|
};
|
|
106
|
-
//# sourceMappingURL=chunk-
|
|
106
|
+
//# sourceMappingURL=chunk-WVKVJTFG.mjs.map
|
package/dist/cli.d.ts
CHANGED
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
import { A as ArcaClient } from './client-
|
|
2
|
-
import { A as ArcaClientOptions, a as ArcaClientConfig } from './types-
|
|
3
|
-
import { W as WsaaAuthModule } from './index-
|
|
1
|
+
import { A as ArcaClient } from './client-bblLZeUb.js';
|
|
2
|
+
import { A as ArcaClientOptions, a as ArcaClientConfig } from './types-Su7QwloQ.js';
|
|
3
|
+
import { W as WsaaAuthModule } from './index-DAC3edtw.js';
|
|
4
4
|
import './padron.js';
|
|
5
|
-
import './
|
|
6
|
-
import './fiscal-evidence-
|
|
5
|
+
import './wsfe.js';
|
|
6
|
+
import './fiscal-evidence-DaCyGd5o.js';
|
|
7
7
|
import './constants.js';
|
|
8
8
|
import './wsmtxca.js';
|
|
9
9
|
|
package/dist/cli.mjs
CHANGED
|
@@ -7,12 +7,12 @@ import {
|
|
|
7
7
|
createWsaaAuthModule,
|
|
8
8
|
createWsaaStoreAdapter,
|
|
9
9
|
discoverArcaClientConfig
|
|
10
|
-
} from "./chunk-
|
|
11
|
-
import "./chunk-
|
|
12
|
-
import "./chunk-
|
|
13
|
-
import "./chunk-
|
|
14
|
-
import "./chunk-
|
|
15
|
-
import "./chunk-
|
|
10
|
+
} from "./chunk-KPWAQMR5.mjs";
|
|
11
|
+
import "./chunk-LQMNKQ2V.mjs";
|
|
12
|
+
import "./chunk-WVKVJTFG.mjs";
|
|
13
|
+
import "./chunk-BPBTQDCO.mjs";
|
|
14
|
+
import "./chunk-WN62NMUJ.mjs";
|
|
15
|
+
import "./chunk-PHXH34L6.mjs";
|
|
16
16
|
import {
|
|
17
17
|
ArcaConfigurationError,
|
|
18
18
|
ArcaServiceError,
|
|
@@ -20,7 +20,7 @@ import {
|
|
|
20
20
|
ArcaTransportError,
|
|
21
21
|
isArcaAuthenticationError,
|
|
22
22
|
toArcaSafeErrorMetadata
|
|
23
|
-
} from "./chunk-
|
|
23
|
+
} from "./chunk-BYEP3ABS.mjs";
|
|
24
24
|
|
|
25
25
|
// src/cli/main.ts
|
|
26
26
|
import { tmpdir } from "os";
|
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
import { h as ArcaEnvironment, A as ArcaClientOptions } from './types-
|
|
1
|
+
import { h as ArcaEnvironment, A as ArcaClientOptions } from './types-Su7QwloQ.js';
|
|
2
2
|
import { PadronService } from './padron.js';
|
|
3
|
-
import {
|
|
3
|
+
import { WsfeVoucherInput, WsfeVoucherInfo, WsfeDateInput, WsfeService } from './wsfe.js';
|
|
4
4
|
import { VoucherClass, ReceiverCondition, IssuerCondition } from './constants.js';
|
|
5
|
-
import {
|
|
5
|
+
import { e as ArcaAuthorizationOutcome, h as ArcaFiscalIssue, p as ArcaSafeErrorMetadata } from './fiscal-evidence-DaCyGd5o.js';
|
|
6
6
|
import { WsmtxcaService } from './wsmtxca.js';
|
|
7
7
|
|
|
8
8
|
type VoucherCoordinates = {
|
|
@@ -51,18 +51,22 @@ type WsfeIdentityMatch = {
|
|
|
51
51
|
* Compares the invoice subset supported by issue(): header identity, amounts,
|
|
52
52
|
* VAT, tributes, associations, optional fields, buyers, activities and the
|
|
53
53
|
* foreign-currency payment flag. This proves consistency, not authorship.
|
|
54
|
-
* Configure a store and pass idempotencyKey for retries.
|
|
54
|
+
* Configure a store and pass idempotencyKey for retries. Provider fields
|
|
55
55
|
* outside that subset stay incomplete; a missing field is never proof.
|
|
56
56
|
*/
|
|
57
57
|
declare function matchWsfeVoucherIdentity(sent: WsfeVoucherInput, number: number, found: WsfeVoucherInfo): WsfeIdentityMatch;
|
|
58
58
|
|
|
59
|
-
/**
|
|
60
|
-
|
|
59
|
+
/**
|
|
60
|
+
* One WSMTXCA provider line, derived from an `items` entry on the way out and
|
|
61
|
+
* read back from ARCA on the way in. Amounts are cents; `unitPrice` is a
|
|
62
|
+
* decimal major-unit string, the SDK's one monetary exception.
|
|
63
|
+
*/
|
|
64
|
+
type WsmtxcaLine = {
|
|
61
65
|
description: string;
|
|
62
66
|
quantity: number;
|
|
63
67
|
unit: number;
|
|
64
68
|
unitPrice: string;
|
|
65
|
-
discount
|
|
69
|
+
discount: number;
|
|
66
70
|
vatCondition: number;
|
|
67
71
|
vatAmount?: number;
|
|
68
72
|
amount: number;
|
|
@@ -70,9 +74,18 @@ type VoucherItemDetail = {
|
|
|
70
74
|
matrixCode?: string;
|
|
71
75
|
matrixUnits?: number;
|
|
72
76
|
};
|
|
77
|
+
/** @internal Shape written by facturas 0.10 through 0.12. */
|
|
78
|
+
type LegacyWsmtxcaLine = Omit<WsmtxcaLine, "discount"> & {
|
|
79
|
+
discount?: number;
|
|
80
|
+
};
|
|
73
81
|
type WsmtxcaIssueRequest = ReturnType<typeof wsmtxcaRequest>;
|
|
74
82
|
type FiscalHeader = WsfeVoucherInput & {
|
|
75
|
-
|
|
83
|
+
/** Derived provider lines. WSFE never reads them; WSMTXCA sends them. */
|
|
84
|
+
lines?: readonly WsmtxcaLine[];
|
|
85
|
+
/** @internal Lines mirrored from an authorized WSMTXCA consultation. */
|
|
86
|
+
authorizedLines?: readonly WsmtxcaLine[];
|
|
87
|
+
/** @internal Durable v2 reservation evidence written before `lines`. */
|
|
88
|
+
details?: readonly LegacyWsmtxcaLine[];
|
|
76
89
|
};
|
|
77
90
|
declare function wsmtxcaRequest(data: FiscalHeader, number?: number): {
|
|
78
91
|
comprobanteCAERequest: {
|
|
@@ -163,8 +176,28 @@ declare function wsmtxcaRequest(data: FiscalHeader, number?: number): {
|
|
|
163
176
|
};
|
|
164
177
|
};
|
|
165
178
|
|
|
179
|
+
declare const SUPPORTED_VAT_RATES: readonly [0, 2.5, 5, 10.5, 21, 27];
|
|
180
|
+
type SupportedVatRate = (typeof SUPPORTED_VAT_RATES)[number];
|
|
181
|
+
|
|
182
|
+
/**
|
|
183
|
+
* The line an item describes. WSFE ignores every field here and derives its
|
|
184
|
+
* header from the money alone; WSMTXCA requires `description`, `quantity`,
|
|
185
|
+
* `unit` and `unitPrice` and sends the line as it is. The line never carries
|
|
186
|
+
* its own VAT amount: that follows from the item's `vat` and its money.
|
|
187
|
+
*/
|
|
188
|
+
type ItemLine = {
|
|
189
|
+
description?: string;
|
|
190
|
+
quantity?: number;
|
|
191
|
+
unit?: number;
|
|
192
|
+
/** A major-unit decimal string with up to six decimals, unlike every other amount. */
|
|
193
|
+
unitPrice?: string;
|
|
194
|
+
discount?: number;
|
|
195
|
+
code?: string;
|
|
196
|
+
matrixCode?: string;
|
|
197
|
+
matrixUnits?: number;
|
|
198
|
+
};
|
|
166
199
|
type VatRate = SupportedVatRate | "exempt" | "untaxed";
|
|
167
|
-
type VatItem = {
|
|
200
|
+
type VatItem = ItemLine & ({
|
|
168
201
|
net: number;
|
|
169
202
|
gross?: never;
|
|
170
203
|
amount?: never;
|
|
@@ -174,8 +207,8 @@ type VatItem = {
|
|
|
174
207
|
net?: never;
|
|
175
208
|
amount?: never;
|
|
176
209
|
vat: VatRate;
|
|
177
|
-
};
|
|
178
|
-
type AmountItem = {
|
|
210
|
+
});
|
|
211
|
+
type AmountItem = ItemLine & {
|
|
179
212
|
amount: number;
|
|
180
213
|
vat?: never;
|
|
181
214
|
net?: never;
|
|
@@ -195,8 +228,8 @@ type IssueOptions = {
|
|
|
195
228
|
representedTaxId?: number | string;
|
|
196
229
|
forceRefresh?: boolean;
|
|
197
230
|
include?: {
|
|
198
|
-
|
|
199
|
-
|
|
231
|
+
request?: boolean;
|
|
232
|
+
rawResponse?: boolean;
|
|
200
233
|
};
|
|
201
234
|
/**
|
|
202
235
|
* The caller's deadline. It aborts the WSAA login, the submission and every
|
|
@@ -204,7 +237,7 @@ type IssueOptions = {
|
|
|
204
237
|
* `indeterminate` with `lookup.kind === "aborted"`: the reservation stays and
|
|
205
238
|
* `recover()` settles it.
|
|
206
239
|
*/
|
|
207
|
-
|
|
240
|
+
abortSignal?: AbortSignal;
|
|
208
241
|
};
|
|
209
242
|
type IssuedVoucher = VoucherCoordinates & {
|
|
210
243
|
voucherClass: VoucherClass;
|
|
@@ -218,7 +251,7 @@ type IssuanceService = "wsfe" | "wsmtxca";
|
|
|
218
251
|
type ServiceFor<O extends IssueOptions> = "service" extends keyof O ? "wsmtxca" extends O["service"] ? O extends {
|
|
219
252
|
service: "wsmtxca";
|
|
220
253
|
} ? "wsmtxca" : IssuanceService : "wsfe" : "wsfe";
|
|
221
|
-
type
|
|
254
|
+
type IssueRequest<S extends IssuanceService = "wsfe"> = S extends "wsmtxca" ? WsmtxcaIssueRequest : WsfeVoucherInput;
|
|
222
255
|
/**
|
|
223
256
|
* What issue() would send, derived with zero I/O. The voucher number is absent
|
|
224
257
|
* because it is only known when the number is reserved at issuance.
|
|
@@ -227,22 +260,22 @@ type IssuePreview<S extends IssuanceService = "wsfe"> = {
|
|
|
227
260
|
voucherClass: VoucherClass;
|
|
228
261
|
voucherType: number;
|
|
229
262
|
amounts: IssueAmounts;
|
|
230
|
-
request:
|
|
263
|
+
request: IssueRequest<S>;
|
|
231
264
|
service?: S;
|
|
232
265
|
};
|
|
233
|
-
type
|
|
234
|
-
|
|
266
|
+
type WithRawResponse<T, O extends IssueOptions> = T & (true extends NonNullable<O["include"]>["rawResponse"] ? {
|
|
267
|
+
rawResponse?: Record<string, unknown>;
|
|
235
268
|
} : unknown);
|
|
236
|
-
type
|
|
269
|
+
type WithRequest<O extends IssueOptions> = O extends {
|
|
237
270
|
include: {
|
|
238
|
-
|
|
271
|
+
request: true;
|
|
239
272
|
};
|
|
240
273
|
} ? {
|
|
241
|
-
|
|
242
|
-
} : true extends NonNullable<O["include"]>["
|
|
243
|
-
|
|
274
|
+
request: IssueRequest<ServiceFor<O>>;
|
|
275
|
+
} : true extends NonNullable<O["include"]>["request"] ? {
|
|
276
|
+
request?: IssueRequest<ServiceFor<O>>;
|
|
244
277
|
} : unknown;
|
|
245
|
-
type Evidence<K extends ArcaAuthorizationOutcome["kind"], O extends IssueOptions> =
|
|
278
|
+
type Evidence<K extends ArcaAuthorizationOutcome["kind"], O extends IssueOptions> = WithRawResponse<Omit<Extract<ArcaAuthorizationOutcome<ServiceFor<O>>, {
|
|
246
279
|
kind: K;
|
|
247
280
|
}>, "raw">, O>;
|
|
248
281
|
/** Fiscal outcomes are returned. Keyed replays authorize only after not_found. */
|
|
@@ -253,13 +286,13 @@ type IssueOutcome<O extends IssueOptions = {
|
|
|
253
286
|
recoveredByMatch: false;
|
|
254
287
|
voucher: IssuedVoucher;
|
|
255
288
|
authorization: Evidence<"authorized", O>;
|
|
256
|
-
}
|
|
289
|
+
} | {
|
|
257
290
|
kind: "authorized";
|
|
258
291
|
recoveredByMatch: true;
|
|
259
292
|
voucher: IssuedVoucher;
|
|
260
293
|
attempt: Evidence<"indeterminate", O>;
|
|
261
|
-
lookup:
|
|
262
|
-
}
|
|
294
|
+
lookup: WithRawResponse<VoucherSummary, O>;
|
|
295
|
+
} | {
|
|
263
296
|
kind: "rejected";
|
|
264
297
|
attempted: VoucherCoordinates;
|
|
265
298
|
issues: ArcaFiscalIssue[];
|
|
@@ -268,9 +301,9 @@ type IssueOutcome<O extends IssueOptions = {
|
|
|
268
301
|
kind: "indeterminate";
|
|
269
302
|
attempted: VoucherCoordinates;
|
|
270
303
|
attempt: Evidence<"indeterminate", O>;
|
|
271
|
-
lookup:
|
|
304
|
+
lookup: WithRawResponse<{
|
|
272
305
|
kind: "not_found";
|
|
273
|
-
}, O> |
|
|
306
|
+
}, O> | WithRawResponse<{
|
|
274
307
|
kind: "incomplete";
|
|
275
308
|
reason: string;
|
|
276
309
|
}, O> | {
|
|
@@ -295,9 +328,9 @@ type IssueOutcome<O extends IssueOptions = {
|
|
|
295
328
|
kind: "conflict";
|
|
296
329
|
attempted: VoucherCoordinates;
|
|
297
330
|
attempt: Evidence<"indeterminate", O>;
|
|
298
|
-
found:
|
|
331
|
+
found: WithRawResponse<VoucherSummary, O>;
|
|
299
332
|
reason: string;
|
|
300
|
-
}
|
|
333
|
+
}) & WithRequest<O>;
|
|
301
334
|
|
|
302
335
|
/** Monetary values in the high-level API are integer minor units. */
|
|
303
336
|
type Tribute = {
|
|
@@ -359,7 +392,6 @@ type Receiver = {
|
|
|
359
392
|
};
|
|
360
393
|
type IssueCommon = IssuanceFields & {
|
|
361
394
|
family?: InvoiceFamily;
|
|
362
|
-
details?: readonly VoucherItemDetail[];
|
|
363
395
|
salesPoint: number;
|
|
364
396
|
to: Receiver;
|
|
365
397
|
total?: number;
|
|
@@ -390,7 +422,7 @@ type IssueInput = IssueCommon & ({
|
|
|
390
422
|
|
|
391
423
|
/**
|
|
392
424
|
* The credited lines and, at most, the note's own sales point and date.
|
|
393
|
-
* Class, receiver, currency, concept and service dates come from the
|
|
425
|
+
* Class, receiver, currency, concept and service dates come from the originals.
|
|
394
426
|
*
|
|
395
427
|
* The mode is explicit: `items` or a reviewed `amounts` breakdown credits the
|
|
396
428
|
* chosen lines, `all: true` credits the whole original. A forgotten field never
|
|
@@ -398,9 +430,12 @@ type IssueInput = IssueCommon & ({
|
|
|
398
430
|
* partial note carries the `taxes` the caller chose, never a prorated share.
|
|
399
431
|
*/
|
|
400
432
|
type CreditNoteInput = Pick<IssuanceFields, "taxes" | "optionalFields" | "fce"> & {
|
|
401
|
-
|
|
402
|
-
|
|
403
|
-
|
|
433
|
+
/**
|
|
434
|
+
* The authorized invoice or debit note the note corrects, or a non-empty
|
|
435
|
+
* list of them. Every original is consulted and every one is associated to
|
|
436
|
+
* the note; they must agree on everything the note inherits.
|
|
437
|
+
*/
|
|
438
|
+
for: VoucherCoordinates | readonly VoucherCoordinates[];
|
|
404
439
|
salesPoint?: number;
|
|
405
440
|
date?: WsfeDateInput;
|
|
406
441
|
} & ({
|
|
@@ -430,7 +465,11 @@ type PeriodNoteInput = IssueInput & {
|
|
|
430
465
|
type DebitNoteInput = (CreditNoteInput & {
|
|
431
466
|
all?: never;
|
|
432
467
|
}) | PeriodNoteInput;
|
|
433
|
-
type
|
|
468
|
+
type NotePreview<S extends IssuanceService = "wsfe"> = IssuePreview<S> & {
|
|
469
|
+
/** The originals consulted, in input order; absent for a period note. */
|
|
470
|
+
originals?: readonly VoucherSummary[];
|
|
471
|
+
};
|
|
472
|
+
type RecoveryOptions = Pick<IssueOptions, "representedTaxId" | "forceRefresh" | "include" | "abortSignal">;
|
|
434
473
|
type VouchersService = {
|
|
435
474
|
/** Consults a durable reservation. Never allocates or authorizes a voucher. */
|
|
436
475
|
recover<O extends RecoveryOptions = {
|
|
@@ -448,16 +487,17 @@ type VouchersService = {
|
|
|
448
487
|
}>(input: DebitNoteInput, options?: O): Promise<IssueOutcome<O>>;
|
|
449
488
|
/**
|
|
450
489
|
* Derives what issueCreditNote() would send. Unlike the zero-I/O preview(),
|
|
451
|
-
* it consults
|
|
452
|
-
* A
|
|
490
|
+
* it consults each original once: reads only, no write and no number
|
|
491
|
+
* reserved. A linked note returns those raw-free originals in `originals`. A
|
|
492
|
+
* period note carries its own business input and needs no lookup at all.
|
|
453
493
|
*/
|
|
454
494
|
previewCreditNote<O extends PreviewOptions = {
|
|
455
495
|
service?: never;
|
|
456
|
-
}>(input: CreditNoteInput | PeriodNoteInput, options?: O): Promise<
|
|
496
|
+
}>(input: CreditNoteInput | PeriodNoteInput, options?: O): Promise<NotePreview<ServiceFor<O>>>;
|
|
457
497
|
/** Same contract as previewCreditNote(), for issueDebitNote() input. */
|
|
458
498
|
previewDebitNote<O extends PreviewOptions = {
|
|
459
499
|
service?: never;
|
|
460
|
-
}>(input: DebitNoteInput, options?: O): Promise<
|
|
500
|
+
}>(input: DebitNoteInput, options?: O): Promise<NotePreview<ServiceFor<O>>>;
|
|
461
501
|
/**
|
|
462
502
|
* Issues a credit note against an authorized invoice or debit note of the
|
|
463
503
|
* ordinary, retention-legend or FCE families, or against a period with
|
|
@@ -465,9 +505,10 @@ type VouchersService = {
|
|
|
465
505
|
* `amounts`, or the whole original with `all: true`.
|
|
466
506
|
*
|
|
467
507
|
* For a linked note everything except the credited lines, the note's sales
|
|
468
|
-
* point and its date comes from the
|
|
469
|
-
* concept and service dates.
|
|
470
|
-
*
|
|
508
|
+
* point and its date comes from the originals: class, receiver, currency,
|
|
509
|
+
* concept and service dates. `for` takes one original or a list of them,
|
|
510
|
+
* and every one is associated to the note. ARCA has no cancellation; every
|
|
511
|
+
* mode writes a real fiscal document.
|
|
471
512
|
*/
|
|
472
513
|
issueCreditNote<O extends IssueOptions = {
|
|
473
514
|
include?: never;
|
|
@@ -497,6 +538,7 @@ type PreviewOptions = {
|
|
|
497
538
|
representedTaxId?: number | string;
|
|
498
539
|
service?: "wsfe" | "wsmtxca";
|
|
499
540
|
forceRefresh?: boolean;
|
|
541
|
+
abortSignal?: AbortSignal;
|
|
500
542
|
};
|
|
501
543
|
|
|
502
544
|
/** Immutable, credential-free operational view of an ARCA client configuration. */
|
|
@@ -539,4 +581,4 @@ type ArcaClient = {
|
|
|
539
581
|
*/
|
|
540
582
|
declare function createArcaClient(config?: ArcaClientOptions): ArcaClient;
|
|
541
583
|
|
|
542
|
-
export { type ArcaClient as A, type CreditNoteInput as C, type DebitNoteInput as D, type
|
|
584
|
+
export { type ArcaClient as A, type CreditNoteInput as C, type DebitNoteInput as D, type FceOptions as F, type InvoiceFamily as I, type NotePreview as N, type PeriodNoteInput as P, type Receiver as R, type Tribute as T, type VatItem as V, type WsfeIdentityMatch as W, type AmountItem as a, type ArcaClientConfigView as b, type IssuanceFields as c, type IssuanceService as d, type IssueAmounts as e, type IssueCommon as f, type IssueInput as g, type IssueOptions as h, type IssueOutcome as i, type IssuePreview as j, type IssueRequest as k, type IssuedVoucher as l, type ItemLine as m, type PreviewOptions as n, type RecoveryOptions as o, type VatRate as p, type VoucherAmounts as q, type VoucherCoordinates as r, type VoucherSummary as s, type VouchersService as t, type WsmtxcaIssueRequest as u, type WsmtxcaLine as v, createArcaClient as w, matchWsfeVoucherIdentity as x };
|
package/dist/constants.d.ts
CHANGED
|
@@ -54,7 +54,7 @@ declare const ARCA_CURRENCY_IDS: {
|
|
|
54
54
|
};
|
|
55
55
|
/**
|
|
56
56
|
* Common ARCA currency identifiers.
|
|
57
|
-
* @deprecated Use ISO_CURRENCIES
|
|
57
|
+
* @deprecated Use ISO_CURRENCIES, or ARCA_CURRENCY_IDS at the provider boundary.
|
|
58
58
|
*/
|
|
59
59
|
declare const ARCA_CURRENCIES: {
|
|
60
60
|
readonly PES: "PES";
|
package/dist/constants.mjs
CHANGED
package/dist/errors.d.ts
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import './types-
|
|
2
|
-
export {
|
|
1
|
+
import './types-Su7QwloQ.js';
|
|
2
|
+
export { A as ArcaAuthenticationError, a as ArcaAuthenticationErrorOptions, c as ArcaAuthenticationReason, f as ArcaConfigurationError, g as ArcaError, l as ArcaInputError, m as ArcaInputErrorCode, n as ArcaInputErrorOptions, o as ArcaInvalidSoapResponseError, p as ArcaSafeErrorMetadata, q as ArcaServiceError, r as ArcaSoapFaultError, s as ArcaTransportError, u as isArcaAuthenticationError, v as toArcaSafeErrorMetadata } from './fiscal-evidence-DaCyGd5o.js';
|