facturas 0.9.0 → 0.11.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 +95 -786
- package/bin/facturas.mjs +4 -0
- package/dist/{chunk-RCM4NAAG.mjs → chunk-5KCTRQJX.mjs} +83 -284
- package/dist/chunk-5KCTRQJX.mjs.map +1 -0
- package/dist/{chunk-XNBD5NVL.mjs → chunk-ALH5IPSY.mjs} +2 -57
- package/dist/chunk-ALH5IPSY.mjs.map +1 -0
- package/dist/{chunk-76WU5BVI.mjs → chunk-GX5ERXT6.mjs} +1 -1
- package/dist/chunk-GX5ERXT6.mjs.map +1 -0
- package/dist/chunk-LOWV7IF6.mjs +3758 -0
- package/dist/chunk-LOWV7IF6.mjs.map +1 -0
- package/dist/chunk-LR4M2AMG.mjs +169 -0
- package/dist/chunk-LR4M2AMG.mjs.map +1 -0
- package/dist/{chunk-4QVFXT35.mjs → chunk-UDX6HLAU.mjs} +1 -17
- package/dist/{chunk-4QVFXT35.mjs.map → chunk-UDX6HLAU.mjs.map} +1 -1
- package/dist/cli.d.ts +49 -0
- package/dist/cli.mjs +2316 -0
- package/dist/cli.mjs.map +1 -0
- package/dist/client-BZxeScuK.d.ts +521 -0
- package/dist/constants.d.ts +1 -1
- package/dist/constants.mjs +1 -1
- package/dist/{wsfe-DF0jAE2k.d.ts → decimal-B0HtrMFY.d.ts} +9 -66
- package/dist/errors.d.ts +2 -2
- package/dist/{fiscal-evidence-DBzakqBE.d.ts → fiscal-evidence-B1Qe6XMg.d.ts} +2 -2
- package/dist/{index-CVGQyyYM.d.ts → index-D8LGFvxV.d.ts} +1 -1
- package/dist/index.d.ts +11 -235
- package/dist/index.mjs +21 -2315
- package/dist/index.mjs.map +1 -1
- package/dist/padron.d.ts +2 -2
- package/dist/{types-BiznC1-X.d.ts → types-r2nf55gh.d.ts} +1 -1
- package/dist/types.d.ts +1 -1
- package/dist/wsfe.d.ts +45 -4
- package/dist/wsfe.mjs +6 -4
- package/dist/wsmtxca.d.ts +4 -20
- package/dist/wsmtxca.mjs +2 -2
- package/package.json +5 -1
- package/dist/chunk-76WU5BVI.mjs.map +0 -1
- package/dist/chunk-RCM4NAAG.mjs.map +0 -1
- package/dist/chunk-XNBD5NVL.mjs.map +0 -1
|
@@ -0,0 +1,521 @@
|
|
|
1
|
+
import { h as ArcaEnvironment, A as ArcaClientOptions } from './types-r2nf55gh.js';
|
|
2
|
+
import { PadronService } from './padron.js';
|
|
3
|
+
import { s as WsfeVoucherInput, S as SupportedVatRate, r as WsfeVoucherInfo, i as WsfeDateInput, o as WsfeService } from './decimal-B0HtrMFY.js';
|
|
4
|
+
import { VoucherClass, ReceiverCondition, IssuerCondition } from './constants.js';
|
|
5
|
+
import { A as ArcaAuthorizationOutcome, i as ArcaFiscalIssue, q as ArcaSafeErrorMetadata } from './fiscal-evidence-B1Qe6XMg.js';
|
|
6
|
+
import { WsmtxcaService } from './wsmtxca.js';
|
|
7
|
+
|
|
8
|
+
/** Detailed item evidence. Amounts are cents; unitPrice is a decimal major-unit string. */
|
|
9
|
+
type VoucherItemDetail = {
|
|
10
|
+
description: string;
|
|
11
|
+
quantity: number;
|
|
12
|
+
unit: number;
|
|
13
|
+
unitPrice: string;
|
|
14
|
+
discount?: number;
|
|
15
|
+
vatCondition: number;
|
|
16
|
+
vatAmount?: number;
|
|
17
|
+
amount: number;
|
|
18
|
+
code?: string;
|
|
19
|
+
matrixCode?: string;
|
|
20
|
+
matrixUnits?: number;
|
|
21
|
+
};
|
|
22
|
+
type WsmtxcaIssueRequest = ReturnType<typeof wsmtxcaRequest>;
|
|
23
|
+
type FiscalHeader = WsfeVoucherInput & {
|
|
24
|
+
details?: readonly VoucherItemDetail[];
|
|
25
|
+
};
|
|
26
|
+
declare function wsmtxcaRequest(data: FiscalHeader, number?: number): {
|
|
27
|
+
comprobanteCAERequest: {
|
|
28
|
+
arrayComprobantesAsociados: {
|
|
29
|
+
comprobanteAsociado: {
|
|
30
|
+
codigoTipoComprobante: number;
|
|
31
|
+
numeroPuntoVenta: number;
|
|
32
|
+
numeroComprobante: number;
|
|
33
|
+
cuit: string | undefined;
|
|
34
|
+
fechaEmision: string | undefined;
|
|
35
|
+
}[];
|
|
36
|
+
} | undefined;
|
|
37
|
+
periodoComprobantesAsociados: {
|
|
38
|
+
fechaDesde: string | undefined;
|
|
39
|
+
fechaHasta: string | undefined;
|
|
40
|
+
} | undefined;
|
|
41
|
+
arrayCompradores: {
|
|
42
|
+
comprador: {
|
|
43
|
+
codigoTipoDocumento: number;
|
|
44
|
+
numeroDocumento: number;
|
|
45
|
+
porcentaje: number;
|
|
46
|
+
}[];
|
|
47
|
+
} | undefined;
|
|
48
|
+
arrayOtrosTributos: {
|
|
49
|
+
otroTributo: {
|
|
50
|
+
codigo: number;
|
|
51
|
+
descripcion: string | undefined;
|
|
52
|
+
baseImponible: number;
|
|
53
|
+
importe: number;
|
|
54
|
+
}[];
|
|
55
|
+
} | undefined;
|
|
56
|
+
arrayItems: {
|
|
57
|
+
item: {
|
|
58
|
+
importeItem: number;
|
|
59
|
+
importeIVA?: number | undefined;
|
|
60
|
+
unidadesMtx: number | undefined;
|
|
61
|
+
codigoMtx: string | undefined;
|
|
62
|
+
codigo: string | undefined;
|
|
63
|
+
descripcion: string;
|
|
64
|
+
cantidad: number;
|
|
65
|
+
codigoUnidadMedida: number;
|
|
66
|
+
precioUnitario: string;
|
|
67
|
+
importeBonificacion: number;
|
|
68
|
+
codigoCondicionIVA: number;
|
|
69
|
+
}[];
|
|
70
|
+
};
|
|
71
|
+
arraySubtotalesIVA: {
|
|
72
|
+
subtotalIVA: {
|
|
73
|
+
codigo: number;
|
|
74
|
+
importe: number;
|
|
75
|
+
}[];
|
|
76
|
+
} | undefined;
|
|
77
|
+
arrayDatosAdicionales: {
|
|
78
|
+
datoAdicional: ({
|
|
79
|
+
t: number;
|
|
80
|
+
c1: string;
|
|
81
|
+
} | {
|
|
82
|
+
t: number;
|
|
83
|
+
c1: string | undefined;
|
|
84
|
+
c2: string | undefined;
|
|
85
|
+
})[];
|
|
86
|
+
} | undefined;
|
|
87
|
+
arrayActividades: {
|
|
88
|
+
actividad: {
|
|
89
|
+
codigo: number;
|
|
90
|
+
}[];
|
|
91
|
+
} | undefined;
|
|
92
|
+
cancelaEnMismaMonedaExtranjera?: "S" | "N" | undefined;
|
|
93
|
+
fechaEmision: string | undefined;
|
|
94
|
+
codigoTipoDocumento: number;
|
|
95
|
+
numeroDocumento: number;
|
|
96
|
+
condicionIVAReceptor: number;
|
|
97
|
+
importeGravado: number;
|
|
98
|
+
importeNoGravado: number;
|
|
99
|
+
importeExento: number;
|
|
100
|
+
importeSubtotal: number;
|
|
101
|
+
importeOtrosTributos: number;
|
|
102
|
+
importeTotal: number;
|
|
103
|
+
codigoMoneda: string;
|
|
104
|
+
cotizacionMoneda: string | number | undefined;
|
|
105
|
+
codigoConcepto: number;
|
|
106
|
+
fechaServicioDesde: string | undefined;
|
|
107
|
+
fechaServicioHasta: string | undefined;
|
|
108
|
+
fechaVencimientoPago: string | undefined;
|
|
109
|
+
numeroComprobante?: number | undefined;
|
|
110
|
+
codigoTipoComprobante: number;
|
|
111
|
+
numeroPuntoVenta: number;
|
|
112
|
+
};
|
|
113
|
+
};
|
|
114
|
+
|
|
115
|
+
type VatRate = SupportedVatRate | "exempt" | "untaxed";
|
|
116
|
+
type VatItem = {
|
|
117
|
+
net: number;
|
|
118
|
+
gross?: never;
|
|
119
|
+
amount?: never;
|
|
120
|
+
vat: VatRate;
|
|
121
|
+
} | {
|
|
122
|
+
gross: number;
|
|
123
|
+
net?: never;
|
|
124
|
+
amount?: never;
|
|
125
|
+
vat: VatRate;
|
|
126
|
+
};
|
|
127
|
+
type AmountItem = {
|
|
128
|
+
amount: number;
|
|
129
|
+
vat?: never;
|
|
130
|
+
net?: never;
|
|
131
|
+
gross?: never;
|
|
132
|
+
};
|
|
133
|
+
type IssueAmounts = {
|
|
134
|
+
computedTotal: number;
|
|
135
|
+
sentTotal: number;
|
|
136
|
+
vatAdjustment: number;
|
|
137
|
+
};
|
|
138
|
+
|
|
139
|
+
type VoucherCoordinates = {
|
|
140
|
+
salesPoint: number;
|
|
141
|
+
voucherType: number;
|
|
142
|
+
number: number;
|
|
143
|
+
};
|
|
144
|
+
/** Raw-free consultation evidence. Missing provider fields remain absent. */
|
|
145
|
+
type VoucherSummary = {
|
|
146
|
+
number: number;
|
|
147
|
+
salesPoint?: number;
|
|
148
|
+
voucherType?: number;
|
|
149
|
+
date?: string;
|
|
150
|
+
concept?: number;
|
|
151
|
+
documentType?: number;
|
|
152
|
+
documentNumber?: string;
|
|
153
|
+
receiverVatConditionId?: number;
|
|
154
|
+
currencyId?: string;
|
|
155
|
+
exchangeRate?: number;
|
|
156
|
+
totalAmount?: number;
|
|
157
|
+
netAmount?: number;
|
|
158
|
+
vatAmount?: number;
|
|
159
|
+
exemptAmount?: number;
|
|
160
|
+
nonTaxableAmount?: number;
|
|
161
|
+
taxAmount?: number;
|
|
162
|
+
vatRates?: {
|
|
163
|
+
id: number;
|
|
164
|
+
baseAmount: number;
|
|
165
|
+
amount: number;
|
|
166
|
+
}[];
|
|
167
|
+
serviceStartDate?: string;
|
|
168
|
+
serviceEndDate?: string;
|
|
169
|
+
paymentDueDate?: string;
|
|
170
|
+
result?: string;
|
|
171
|
+
cae?: string;
|
|
172
|
+
caeExpiry?: string;
|
|
173
|
+
};
|
|
174
|
+
type WsfeIdentityMatch = {
|
|
175
|
+
matches: true;
|
|
176
|
+
} | {
|
|
177
|
+
matches: false;
|
|
178
|
+
evidence: "conflict" | "incomplete";
|
|
179
|
+
reason: string;
|
|
180
|
+
};
|
|
181
|
+
/**
|
|
182
|
+
* Compares the invoice subset supported by issue(): header identity, amounts,
|
|
183
|
+
* VAT, tributes, associations, optional fields, buyers, activities and the
|
|
184
|
+
* foreign-currency payment flag. This proves consistency, not authorship.
|
|
185
|
+
* Configure a store and pass idempotencyKey for retries. Exact-API extensions
|
|
186
|
+
* outside that subset stay incomplete; a missing field is never proof.
|
|
187
|
+
*/
|
|
188
|
+
declare function matchWsfeVoucherIdentity(sent: WsfeVoucherInput, number: number, found: WsfeVoucherInfo): WsfeIdentityMatch;
|
|
189
|
+
|
|
190
|
+
type IssueOptions = {
|
|
191
|
+
service?: "wsfe" | "wsmtxca";
|
|
192
|
+
/** An externally reserved number. Never reads the next number when supplied. */
|
|
193
|
+
number?: number;
|
|
194
|
+
idempotencyKey?: string;
|
|
195
|
+
representedTaxId?: number | string;
|
|
196
|
+
forceRefresh?: boolean;
|
|
197
|
+
include?: {
|
|
198
|
+
raw?: boolean;
|
|
199
|
+
exactInput?: boolean;
|
|
200
|
+
};
|
|
201
|
+
};
|
|
202
|
+
type IssuedVoucher = VoucherCoordinates & {
|
|
203
|
+
voucherClass: VoucherClass;
|
|
204
|
+
date: string;
|
|
205
|
+
cae: string;
|
|
206
|
+
caeExpiry: string;
|
|
207
|
+
amounts: IssueAmounts;
|
|
208
|
+
};
|
|
209
|
+
/** The provider a call targets. It is chosen explicitly, never switched. */
|
|
210
|
+
type IssuanceService = "wsfe" | "wsmtxca";
|
|
211
|
+
type ServiceFor<O extends IssueOptions> = "service" extends keyof O ? "wsmtxca" extends O["service"] ? O extends {
|
|
212
|
+
service: "wsmtxca";
|
|
213
|
+
} ? "wsmtxca" : IssuanceService : "wsfe" : "wsfe";
|
|
214
|
+
type ExactIssueInput<S extends IssuanceService = "wsfe"> = S extends "wsmtxca" ? WsmtxcaIssueRequest : WsfeVoucherInput;
|
|
215
|
+
/**
|
|
216
|
+
* What issue() would send, derived with zero I/O. The voucher number is absent
|
|
217
|
+
* because it is only known when the number is reserved at issuance.
|
|
218
|
+
*/
|
|
219
|
+
type IssuePreview<S extends IssuanceService = "wsfe"> = {
|
|
220
|
+
voucherClass: VoucherClass;
|
|
221
|
+
voucherType: number;
|
|
222
|
+
amounts: IssueAmounts;
|
|
223
|
+
request: ExactIssueInput<S>;
|
|
224
|
+
service?: S;
|
|
225
|
+
};
|
|
226
|
+
type WithRaw<T, O extends IssueOptions> = T & (true extends NonNullable<O["include"]>["raw"] ? {
|
|
227
|
+
raw?: Record<string, unknown>;
|
|
228
|
+
} : unknown);
|
|
229
|
+
type WithSent<O extends IssueOptions> = O extends {
|
|
230
|
+
include: {
|
|
231
|
+
exactInput: true;
|
|
232
|
+
};
|
|
233
|
+
} ? {
|
|
234
|
+
sent: ExactIssueInput<ServiceFor<O>>;
|
|
235
|
+
} : true extends NonNullable<O["include"]>["exactInput"] ? {
|
|
236
|
+
sent?: ExactIssueInput<ServiceFor<O>>;
|
|
237
|
+
} : unknown;
|
|
238
|
+
type Evidence<K extends ArcaAuthorizationOutcome["kind"], O extends IssueOptions> = WithRaw<Omit<Extract<ArcaAuthorizationOutcome<ServiceFor<O>>, {
|
|
239
|
+
kind: K;
|
|
240
|
+
}>, "raw">, O>;
|
|
241
|
+
/** Fiscal outcomes are returned. Keyed replays authorize only after not_found. */
|
|
242
|
+
type IssueOutcome<O extends IssueOptions = {
|
|
243
|
+
include?: never;
|
|
244
|
+
}> = ({
|
|
245
|
+
kind: "authorized";
|
|
246
|
+
recoveredByMatch: false;
|
|
247
|
+
voucher: IssuedVoucher;
|
|
248
|
+
authorization: Evidence<"authorized", O>;
|
|
249
|
+
} & WithSent<O>) | ({
|
|
250
|
+
kind: "authorized";
|
|
251
|
+
recoveredByMatch: true;
|
|
252
|
+
voucher: IssuedVoucher;
|
|
253
|
+
attempt: Evidence<"indeterminate", O>;
|
|
254
|
+
lookup: WithRaw<VoucherSummary, O>;
|
|
255
|
+
} & WithSent<O>) | {
|
|
256
|
+
kind: "rejected";
|
|
257
|
+
attempted: VoucherCoordinates;
|
|
258
|
+
issues: ArcaFiscalIssue[];
|
|
259
|
+
authorization: Evidence<"rejected", O>;
|
|
260
|
+
} | {
|
|
261
|
+
kind: "indeterminate";
|
|
262
|
+
attempted: VoucherCoordinates;
|
|
263
|
+
attempt: Evidence<"indeterminate", O>;
|
|
264
|
+
lookup: WithRaw<{
|
|
265
|
+
kind: "not_found";
|
|
266
|
+
}, O> | WithRaw<{
|
|
267
|
+
kind: "incomplete";
|
|
268
|
+
reason: string;
|
|
269
|
+
}, O> | {
|
|
270
|
+
kind: "failed";
|
|
271
|
+
error: ArcaSafeErrorMetadata;
|
|
272
|
+
};
|
|
273
|
+
} | {
|
|
274
|
+
kind: "conflict";
|
|
275
|
+
attempted: VoucherCoordinates;
|
|
276
|
+
attempt: Evidence<"indeterminate", O>;
|
|
277
|
+
found: WithRaw<VoucherSummary, O>;
|
|
278
|
+
reason: string;
|
|
279
|
+
};
|
|
280
|
+
|
|
281
|
+
/** Monetary values in the high-level API are integer minor units. */
|
|
282
|
+
type Tribute = {
|
|
283
|
+
id: number;
|
|
284
|
+
description?: string;
|
|
285
|
+
base: number;
|
|
286
|
+
rate: number;
|
|
287
|
+
amount: number;
|
|
288
|
+
};
|
|
289
|
+
/** An already-reviewed fiscal breakdown; no recalculation of historical VAT. */
|
|
290
|
+
type VoucherAmounts = {
|
|
291
|
+
net: number;
|
|
292
|
+
vat: number;
|
|
293
|
+
exempt?: number;
|
|
294
|
+
untaxed?: number;
|
|
295
|
+
vatRates?: readonly {
|
|
296
|
+
id: number;
|
|
297
|
+
base: number;
|
|
298
|
+
amount: number;
|
|
299
|
+
}[];
|
|
300
|
+
};
|
|
301
|
+
type InvoiceFamily = "ordinary" | "retention_legend" | "fce";
|
|
302
|
+
type IssuanceFields = {
|
|
303
|
+
fce?: FceOptions;
|
|
304
|
+
taxes?: readonly Tribute[];
|
|
305
|
+
amounts?: VoucherAmounts;
|
|
306
|
+
concept?: "products" | "services" | "products_and_services";
|
|
307
|
+
dueDate?: WsfeDateInput;
|
|
308
|
+
paidInForeignCurrency?: boolean;
|
|
309
|
+
optionalFields?: WsfeVoucherInput["optionalFields"];
|
|
310
|
+
buyers?: WsfeVoucherInput["buyers"];
|
|
311
|
+
activities?: WsfeVoucherInput["activities"];
|
|
312
|
+
};
|
|
313
|
+
/** FCE business fields; the SDK encodes each provider's different option layout. */
|
|
314
|
+
type FceOptions = {
|
|
315
|
+
cbu?: string;
|
|
316
|
+
alias?: string;
|
|
317
|
+
transfer?: "ADC" | "SCA";
|
|
318
|
+
annulment?: boolean;
|
|
319
|
+
reference?: string;
|
|
320
|
+
};
|
|
321
|
+
|
|
322
|
+
type Receiver = {
|
|
323
|
+
condition: number;
|
|
324
|
+
cuit?: string | number;
|
|
325
|
+
dni?: string | number;
|
|
326
|
+
document?: {
|
|
327
|
+
type: number;
|
|
328
|
+
number: string | number;
|
|
329
|
+
};
|
|
330
|
+
} | {
|
|
331
|
+
condition: "consumidor_final";
|
|
332
|
+
cuit?: number | string;
|
|
333
|
+
dni?: number | string;
|
|
334
|
+
} | {
|
|
335
|
+
condition: Exclude<ReceiverCondition, "consumidor_final">;
|
|
336
|
+
cuit: number | string;
|
|
337
|
+
dni?: never;
|
|
338
|
+
};
|
|
339
|
+
type IssueCommon = IssuanceFields & {
|
|
340
|
+
family?: InvoiceFamily;
|
|
341
|
+
details?: readonly VoucherItemDetail[];
|
|
342
|
+
salesPoint: number;
|
|
343
|
+
to: Receiver;
|
|
344
|
+
total?: number;
|
|
345
|
+
date?: WsfeDateInput;
|
|
346
|
+
currency?: "ARS" | "USD" | {
|
|
347
|
+
id: string;
|
|
348
|
+
};
|
|
349
|
+
exchangeRate?: string;
|
|
350
|
+
service?: {
|
|
351
|
+
from: WsfeDateInput;
|
|
352
|
+
to: WsfeDateInput;
|
|
353
|
+
dueDate: WsfeDateInput;
|
|
354
|
+
};
|
|
355
|
+
};
|
|
356
|
+
type IssueInput = IssueCommon & ({
|
|
357
|
+
issuer: "responsable_inscripto";
|
|
358
|
+
items: readonly VatItem[];
|
|
359
|
+
amounts?: never;
|
|
360
|
+
} | {
|
|
361
|
+
issuer: "monotributo" | "exento" | "no_alcanzado";
|
|
362
|
+
items: readonly AmountItem[];
|
|
363
|
+
amounts?: never;
|
|
364
|
+
} | {
|
|
365
|
+
issuer: IssuerCondition;
|
|
366
|
+
amounts: VoucherAmounts;
|
|
367
|
+
items?: never;
|
|
368
|
+
});
|
|
369
|
+
|
|
370
|
+
/**
|
|
371
|
+
* The credited lines and, at most, the note's own sales point and date.
|
|
372
|
+
* Class, receiver, currency, concept and service dates come from the original.
|
|
373
|
+
*
|
|
374
|
+
* The mode is explicit: `items` or a reviewed `amounts` breakdown credits the
|
|
375
|
+
* chosen lines, `all: true` credits the whole original. A forgotten field never
|
|
376
|
+
* credits the whole invoice. A full note mirrors the original's tributes; a
|
|
377
|
+
* partial note carries the `taxes` the caller chose, never a prorated share.
|
|
378
|
+
*/
|
|
379
|
+
type CreditNoteInput = Pick<IssuanceFields, "taxes" | "optionalFields" | "fce"> & {
|
|
380
|
+
details?: readonly VoucherItemDetail[];
|
|
381
|
+
/** The authorized invoice or debit note the note corrects. */
|
|
382
|
+
for: VoucherCoordinates;
|
|
383
|
+
salesPoint?: number;
|
|
384
|
+
date?: WsfeDateInput;
|
|
385
|
+
} & ({
|
|
386
|
+
items: NonNullable<IssueInput["items"]>;
|
|
387
|
+
total?: number;
|
|
388
|
+
all?: never;
|
|
389
|
+
amounts?: never;
|
|
390
|
+
} | {
|
|
391
|
+
amounts: VoucherAmounts;
|
|
392
|
+
items?: never;
|
|
393
|
+
total?: number;
|
|
394
|
+
all?: never;
|
|
395
|
+
} | {
|
|
396
|
+
all: true;
|
|
397
|
+
items?: never;
|
|
398
|
+
total?: never;
|
|
399
|
+
amounts?: never;
|
|
400
|
+
});
|
|
401
|
+
|
|
402
|
+
type PeriodNoteInput = IssueInput & {
|
|
403
|
+
associatedPeriod: {
|
|
404
|
+
from: WsfeDateInput;
|
|
405
|
+
to: WsfeDateInput;
|
|
406
|
+
};
|
|
407
|
+
for?: never;
|
|
408
|
+
};
|
|
409
|
+
type DebitNoteInput = (CreditNoteInput & {
|
|
410
|
+
all?: never;
|
|
411
|
+
}) | PeriodNoteInput;
|
|
412
|
+
type RecoveryOptions = Pick<IssueOptions, "representedTaxId" | "forceRefresh" | "include">;
|
|
413
|
+
type VouchersService = {
|
|
414
|
+
/** Consults a durable reservation. Never allocates or authorizes a voucher. */
|
|
415
|
+
recover<O extends RecoveryOptions = {
|
|
416
|
+
include?: never;
|
|
417
|
+
}>(idempotencyKey: string, options?: O): Promise<IssueOutcome<O & {
|
|
418
|
+
service?: IssuanceService;
|
|
419
|
+
}>>;
|
|
420
|
+
/**
|
|
421
|
+
* Issues a debit note against the same originals `issueCreditNote()` accepts,
|
|
422
|
+
* or against a period with `associatedPeriod`. It has no `all: true` mode:
|
|
423
|
+
* a debit note adds to the account, so its lines are always explicit.
|
|
424
|
+
*/
|
|
425
|
+
issueDebitNote<O extends IssueOptions = {
|
|
426
|
+
include?: never;
|
|
427
|
+
}>(input: DebitNoteInput, options?: O): Promise<IssueOutcome<O>>;
|
|
428
|
+
/**
|
|
429
|
+
* Derives what issueCreditNote() would send. Unlike the zero-I/O preview(),
|
|
430
|
+
* it consults the original once: one read, no write and no number reserved.
|
|
431
|
+
* A period note carries its own business input and needs no lookup.
|
|
432
|
+
*/
|
|
433
|
+
previewCreditNote<O extends PreviewOptions = {
|
|
434
|
+
service?: never;
|
|
435
|
+
}>(input: CreditNoteInput | PeriodNoteInput, options?: O): Promise<IssuePreview<ServiceFor<O>>>;
|
|
436
|
+
/** Same contract as previewCreditNote(), for issueDebitNote() input. */
|
|
437
|
+
previewDebitNote<O extends PreviewOptions = {
|
|
438
|
+
service?: never;
|
|
439
|
+
}>(input: DebitNoteInput, options?: O): Promise<IssuePreview<ServiceFor<O>>>;
|
|
440
|
+
/**
|
|
441
|
+
* Issues a credit note against an authorized invoice or debit note of the
|
|
442
|
+
* ordinary, retention-legend or FCE families, or against a period with
|
|
443
|
+
* `associatedPeriod`. The note credits the chosen `items` or reviewed
|
|
444
|
+
* `amounts`, or the whole original with `all: true`.
|
|
445
|
+
*
|
|
446
|
+
* For a linked note everything except the credited lines, the note's sales
|
|
447
|
+
* point and its date comes from the original: class, receiver, currency,
|
|
448
|
+
* concept and service dates. ARCA has no cancellation; every mode writes a
|
|
449
|
+
* real fiscal document.
|
|
450
|
+
*/
|
|
451
|
+
issueCreditNote<O extends IssueOptions = {
|
|
452
|
+
include?: never;
|
|
453
|
+
}>(input: CreditNoteInput | PeriodNoteInput, options?: O): Promise<IssueOutcome<O>>;
|
|
454
|
+
/**
|
|
455
|
+
* Configure a store and pass idempotencyKey to recover retries after a crash.
|
|
456
|
+
*
|
|
457
|
+
* Without a key: one next-number read, one authorization and at most one lookup.
|
|
458
|
+
* Keyed replay consults the reserved number; only not_found permits a write.
|
|
459
|
+
* Local validation and next-number read failures throw before authorization.
|
|
460
|
+
*/
|
|
461
|
+
issue<O extends IssueOptions = {
|
|
462
|
+
include?: never;
|
|
463
|
+
}>(input: IssueInput, options?: O): Promise<IssueOutcome<O>>;
|
|
464
|
+
/**
|
|
465
|
+
* Derives what issue() would send for the same input, with no I/O at all:
|
|
466
|
+
* no store, no WSAA, no SOAP and no next-number read.
|
|
467
|
+
*
|
|
468
|
+
* It throws every input error issue() throws before its first call, so a
|
|
469
|
+
* caller that previews and then issues sees no new local error.
|
|
470
|
+
*/
|
|
471
|
+
preview<O extends Pick<PreviewOptions, "representedTaxId" | "service"> = {
|
|
472
|
+
service?: never;
|
|
473
|
+
}>(input: IssueInput, options?: O): IssuePreview<ServiceFor<O>>;
|
|
474
|
+
};
|
|
475
|
+
type PreviewOptions = {
|
|
476
|
+
representedTaxId?: number | string;
|
|
477
|
+
service?: "wsfe" | "wsmtxca";
|
|
478
|
+
forceRefresh?: boolean;
|
|
479
|
+
};
|
|
480
|
+
|
|
481
|
+
/** Immutable, credential-free operational view of an ARCA client configuration. */
|
|
482
|
+
type ArcaClientConfigView = Readonly<{
|
|
483
|
+
taxId: string;
|
|
484
|
+
environment: ArcaEnvironment;
|
|
485
|
+
timeout?: number;
|
|
486
|
+
retries?: number;
|
|
487
|
+
retryDelay?: number;
|
|
488
|
+
}>;
|
|
489
|
+
/** Fully wired ARCA client with access to all service modules. */
|
|
490
|
+
type ArcaClient = {
|
|
491
|
+
readonly config: ArcaClientConfigView;
|
|
492
|
+
/** Issues an invoice from business input. Idempotent with a store and key. */
|
|
493
|
+
issue: VouchersService["issue"];
|
|
494
|
+
/** Derives what issue() would send for the same input, with no I/O. */
|
|
495
|
+
preview: VouchersService["preview"];
|
|
496
|
+
/** Issues a credit note against an authorized original or a period. */
|
|
497
|
+
issueCreditNote: VouchersService["issueCreditNote"];
|
|
498
|
+
/** Consults a durable reservation. Never allocates or authorizes a voucher. */
|
|
499
|
+
recover: VouchersService["recover"];
|
|
500
|
+
/** Issues a debit note against an authorized original or a period. */
|
|
501
|
+
issueDebitNote: VouchersService["issueDebitNote"];
|
|
502
|
+
/** Derives a credit note; reads the original but reserves no number. */
|
|
503
|
+
previewCreditNote: VouchersService["previewCreditNote"];
|
|
504
|
+
/** Derives a debit note; reads the original but reserves no number. */
|
|
505
|
+
previewDebitNote: VouchersService["previewDebitNote"];
|
|
506
|
+
wsfe: WsfeService;
|
|
507
|
+
wsmtxca: WsmtxcaService;
|
|
508
|
+
padron: PadronService;
|
|
509
|
+
};
|
|
510
|
+
/**
|
|
511
|
+
* Creates an ARCA client from the given configuration.
|
|
512
|
+
* Validates the config, wires WSAA authentication and SOAP transport,
|
|
513
|
+
* and returns an object with `issue()`, `preview()`, `issueCreditNote()`,
|
|
514
|
+
* `issueDebitNote()`, `previewCreditNote()`, `previewDebitNote()`, `recover()`
|
|
515
|
+
* and the `.wsfe`, `.wsmtxca`, and `.padron` service modules.
|
|
516
|
+
*
|
|
517
|
+
* @throws {ArcaConfigurationError} When the config is missing or invalid.
|
|
518
|
+
*/
|
|
519
|
+
declare function createArcaClient(config?: ArcaClientOptions): ArcaClient;
|
|
520
|
+
|
|
521
|
+
export { type ArcaClient as A, type CreditNoteInput as C, type DebitNoteInput as D, type ExactIssueInput as E, type FceOptions as F, type InvoiceFamily as I, 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 IssuedVoucher as k, type PreviewOptions as l, type RecoveryOptions as m, type VatRate as n, type VoucherAmounts as o, type VoucherCoordinates as p, type VoucherItemDetail as q, type VoucherSummary as r, type VouchersService as s, type WsmtxcaIssueRequest as t, createArcaClient as u, matchWsfeVoucherIdentity as v };
|
package/dist/constants.d.ts
CHANGED
|
@@ -60,7 +60,7 @@ declare const ARCA_CURRENCIES: {
|
|
|
60
60
|
readonly PES: "PES";
|
|
61
61
|
readonly DOL: "DOL";
|
|
62
62
|
};
|
|
63
|
-
/** Legal assertions supported by the invoice
|
|
63
|
+
/** Legal assertions supported by the invoice high-level API; never inferred from Padrón. */
|
|
64
64
|
type IssuerCondition = "responsable_inscripto" | "monotributo" | "exento" | "no_alcanzado";
|
|
65
65
|
type ReceiverCondition = IssuerCondition | "consumidor_final";
|
|
66
66
|
type VoucherClass = "A" | "B" | "C";
|
package/dist/constants.mjs
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import { W as WsaaAuthModule, S as SoapTransport } from './index-
|
|
3
|
-
import { A as ArcaAuthorizationOutcome,
|
|
1
|
+
import { a as ArcaClientConfig } from './types-r2nf55gh.js';
|
|
2
|
+
import { W as WsaaAuthModule, S as SoapTransport } from './index-D8LGFvxV.js';
|
|
3
|
+
import { A as ArcaAuthorizationOutcome, a as ArcaVoucherLookupResult } from './fiscal-evidence-B1Qe6XMg.js';
|
|
4
4
|
|
|
5
5
|
/** Accepted public date inputs for WSFE request fields. */
|
|
6
6
|
type WsfeDateInput = `${number}${number}${number}${number}-${number}${number}-${number}${number}` | `${number}${number}${number}${number}${number}${number}${number}${number}`;
|
|
@@ -82,13 +82,6 @@ type WsfeAuthorizeVoucherInput = {
|
|
|
82
82
|
voucherNumber: number;
|
|
83
83
|
forceRefresh?: boolean;
|
|
84
84
|
};
|
|
85
|
-
/** Result of a successful WSFE voucher authorization. */
|
|
86
|
-
type WsfeAuthorizationResult = {
|
|
87
|
-
cae: string;
|
|
88
|
-
caeExpiry: string;
|
|
89
|
-
voucherNumber: number;
|
|
90
|
-
raw: Record<string, unknown>;
|
|
91
|
-
};
|
|
92
85
|
/** Structured evidence from one exact WSFE authorization attempt. */
|
|
93
86
|
type WsfeAuthorizationOutcome = ArcaAuthorizationOutcome<"wsfe">;
|
|
94
87
|
/** A point-of-sale entry returned by {@link WsfeService.getSalesPoints}. */
|
|
@@ -125,6 +118,11 @@ type WsfeVoucherInfo = {
|
|
|
125
118
|
paymentDueDate?: string;
|
|
126
119
|
taxes?: WsfeTax[];
|
|
127
120
|
associatedVouchers?: WsfeAssociatedVoucher[];
|
|
121
|
+
associatedPeriod?: WsfeAssociatedPeriod;
|
|
122
|
+
optionalFields?: WsfeOptionalField[];
|
|
123
|
+
buyers?: WsfeBuyer[];
|
|
124
|
+
activities?: WsfeActivity[];
|
|
125
|
+
sameCurrencyForeignCancellation?: "S" | "N";
|
|
128
126
|
raw: Record<string, unknown>;
|
|
129
127
|
};
|
|
130
128
|
/** Typed exact-voucher consultation result for WSFE. */
|
|
@@ -163,23 +161,6 @@ type WsfeService = {
|
|
|
163
161
|
* (`authorized`, `rejected` or `indeterminate`) instead of throwing.
|
|
164
162
|
*/
|
|
165
163
|
issue(input: WsfeAuthorizeVoucherInput): Promise<WsfeAuthorizationOutcome>;
|
|
166
|
-
/** @deprecated Renamed to `issue()`. Removed in the next minor release. */
|
|
167
|
-
authorizeVoucherOutcome(input: WsfeAuthorizeVoucherInput): Promise<WsfeAuthorizationOutcome>;
|
|
168
|
-
/**
|
|
169
|
-
* @deprecated Throws instead of returning evidence, which loses the
|
|
170
|
-
* rejected/indeterminate distinction. Use `issue()`. Removed in the next
|
|
171
|
-
* minor release.
|
|
172
|
-
*/
|
|
173
|
-
authorizeVoucher(input: WsfeAuthorizeVoucherInput): Promise<WsfeAuthorizationResult>;
|
|
174
|
-
/**
|
|
175
|
-
* @deprecated Reads the next number and authorizes in one non-idempotent
|
|
176
|
-
* call. Use `client.issue()` or reserve a number and call `wsfe.issue()`.
|
|
177
|
-
*/
|
|
178
|
-
createNextVoucher(input: {
|
|
179
|
-
representedTaxId?: number | string;
|
|
180
|
-
data: WsfeVoucherInput;
|
|
181
|
-
forceRefresh?: boolean;
|
|
182
|
-
}): Promise<WsfeAuthorizationResult>;
|
|
183
164
|
/** Returns the next available voucher number for the given sales point and type. */
|
|
184
165
|
getNextVoucherNumber(input: {
|
|
185
166
|
representedTaxId?: number | string;
|
|
@@ -284,42 +265,4 @@ declare function createWsfeService(options: CreateWsfeServiceOptions): WsfeServi
|
|
|
284
265
|
declare const SUPPORTED_VAT_RATES: readonly [0, 2.5, 5, 10.5, 21, 27];
|
|
285
266
|
type SupportedVatRate = (typeof SUPPORTED_VAT_RATES)[number];
|
|
286
267
|
|
|
287
|
-
type
|
|
288
|
-
currency?: "ARS";
|
|
289
|
-
exchangeRate?: never;
|
|
290
|
-
sameCurrencyForeignCancellation?: never;
|
|
291
|
-
} | {
|
|
292
|
-
currency: "USD";
|
|
293
|
-
exchangeRate: string;
|
|
294
|
-
sameCurrencyForeignCancellation?: false;
|
|
295
|
-
} | {
|
|
296
|
-
currency: "USD";
|
|
297
|
-
exchangeRate?: never;
|
|
298
|
-
sameCurrencyForeignCancellation: true;
|
|
299
|
-
};
|
|
300
|
-
type WsfeBuilderVatRate = SupportedVatRate;
|
|
301
|
-
type WsfeInvoiceBuilderBaseInput = {
|
|
302
|
-
salesPoint: number;
|
|
303
|
-
concept: number;
|
|
304
|
-
documentType: number;
|
|
305
|
-
documentNumber: number;
|
|
306
|
-
receiverVatConditionId: number;
|
|
307
|
-
voucherDate: WsfeDateInput;
|
|
308
|
-
serviceStartDate?: WsfeDateInput;
|
|
309
|
-
serviceEndDate?: WsfeDateInput;
|
|
310
|
-
paymentDueDate?: WsfeDateInput;
|
|
311
|
-
};
|
|
312
|
-
type BuildFacturaBInput = WsfeInvoiceBuilderBaseInput & WsfeBuilderCurrencyInput & {
|
|
313
|
-
/** Positive integer currency minor units forming the taxable base. */
|
|
314
|
-
taxableAmount: number;
|
|
315
|
-
vatRate: WsfeBuilderVatRate;
|
|
316
|
-
};
|
|
317
|
-
type BuildFacturaCInput = WsfeInvoiceBuilderBaseInput & WsfeBuilderCurrencyInput & {
|
|
318
|
-
amount: number;
|
|
319
|
-
};
|
|
320
|
-
/** Builds a narrow Factura B exact WSFE input from integer currency minor units. */
|
|
321
|
-
declare function buildFacturaB(input: BuildFacturaBInput): WsfeVoucherInput;
|
|
322
|
-
/** Builds a narrow Factura C exact WSFE input from integer currency minor units. */
|
|
323
|
-
declare function buildFacturaC(input: BuildFacturaCInput): WsfeVoucherInput;
|
|
324
|
-
|
|
325
|
-
export { createWsfeService as A, type BuildFacturaBInput as B, type CreateWsfeServiceOptions as C, type SupportedVatRate as S, type WsfeVoucherInput as W, type WsfeVoucherInfo as a, type WsfeDateInput as b, type WsfeService as c, type BuildFacturaCInput as d, type WsfeActivity as e, type WsfeActivityType as f, type WsfeAssociatedPeriod as g, type WsfeAssociatedVoucher as h, type WsfeAuthorizationOutcome as i, type WsfeAuthorizationResult as j, type WsfeAuthorizeVoucherInput as k, type WsfeBuilderCurrencyInput as l, type WsfeBuilderVatRate as m, type WsfeBuyer as n, type WsfeCatalogEntry as o, type WsfeCurrencyType as p, type WsfeOptionalField as q, type WsfeQuotation as r, type WsfeReceiverVatCondition as s, type WsfeSalesPoint as t, type WsfeServerStatus as u, type WsfeTax as v, type WsfeVatRate as w, type WsfeVoucherLookupResult as x, buildFacturaB as y, buildFacturaC as z };
|
|
268
|
+
export { type CreateWsfeServiceOptions as C, type SupportedVatRate as S, type WsfeActivity as W, type WsfeActivityType as a, type WsfeAssociatedPeriod as b, type WsfeAssociatedVoucher as c, type WsfeAuthorizationOutcome as d, type WsfeAuthorizeVoucherInput as e, type WsfeBuyer as f, type WsfeCatalogEntry as g, type WsfeCurrencyType as h, type WsfeDateInput as i, type WsfeOptionalField as j, type WsfeQuotation as k, type WsfeReceiverVatCondition as l, type WsfeSalesPoint as m, type WsfeServerStatus as n, type WsfeService as o, type WsfeTax as p, type WsfeVatRate as q, type WsfeVoucherInfo as r, type WsfeVoucherInput as s, type WsfeVoucherLookupResult as t, createWsfeService as u };
|
package/dist/errors.d.ts
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import './types-
|
|
2
|
-
export {
|
|
1
|
+
import './types-r2nf55gh.js';
|
|
2
|
+
export { b as ArcaAuthenticationError, c as ArcaAuthenticationErrorOptions, e as ArcaAuthenticationReason, g as ArcaConfigurationError, h as ArcaError, m as ArcaInputError, n as ArcaInputErrorCode, o as ArcaInputErrorOptions, p as ArcaInvalidSoapResponseError, q as ArcaSafeErrorMetadata, r as ArcaServiceError, s as ArcaSoapFaultError, t as ArcaTransportError, u as isArcaAuthenticationError, v as toArcaSafeErrorMetadata } from './fiscal-evidence-B1Qe6XMg.js';
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { b as ArcaServiceName } from './types-r2nf55gh.js';
|
|
2
2
|
|
|
3
3
|
/** Base error class for all ARCA-related errors. */
|
|
4
4
|
declare class ArcaError extends Error {
|
|
@@ -194,4 +194,4 @@ type ArcaVoucherLookupResult<TVoucher, TService extends ArcaFiscalService = Arca
|
|
|
194
194
|
raw: Record<string, unknown>;
|
|
195
195
|
};
|
|
196
196
|
|
|
197
|
-
export { type ArcaAuthorizationOutcome as A, type
|
|
197
|
+
export { type ArcaAuthorizationOutcome as A, type ArcaVoucherLookupResult as a, ArcaAuthenticationError as b, type ArcaAuthenticationErrorOptions as c, type ArcaAuthenticationEvidence as d, type ArcaAuthenticationReason as e, type ArcaAuthorizationIndeterminateReason as f, ArcaConfigurationError as g, ArcaError as h, type ArcaFiscalIssue as i, type ArcaFiscalResultLevel as j, type ArcaFiscalResults as k, type ArcaFiscalService as l, ArcaInputError as m, type ArcaInputErrorCode as n, type ArcaInputErrorOptions as o, ArcaInvalidSoapResponseError as p, type ArcaSafeErrorMetadata as q, ArcaServiceError as r, ArcaSoapFaultError as s, ArcaTransportError as t, isArcaAuthenticationError as u, toArcaSafeErrorMetadata as v };
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { c as ArcaSoapExecutionOptions, d as ArcaSoapResponse, e as ArcaWsaaServiceId, f as ArcaAuthOptions, g as ArcaAuthCredentials } from './types-r2nf55gh.js';
|
|
2
2
|
|
|
3
3
|
type SoapTransport = {
|
|
4
4
|
execute<TBody, TResult>(request: ArcaSoapExecutionOptions<TBody>): Promise<ArcaSoapResponse<TResult>>;
|