facturas 0.22.0 → 0.23.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/cli.d.ts CHANGED
@@ -1,4 +1,4 @@
1
- import { A as ArcaClient } from './client-ghHzZdu8.js';
1
+ import { A as ArcaClient } from './client-BK-aaWiG.js';
2
2
  import { A as ArcaClientOptions, a as ArcaClientConfig } from './types-CbvsjIhf.js';
3
3
  import { W as WsaaAuthModule } from './index-BSTxy3nN.js';
4
4
  import './padron.js';
package/dist/cli.mjs CHANGED
@@ -7,7 +7,7 @@ import {
7
7
  createWsaaAuthModule,
8
8
  createWsaaStoreAdapter,
9
9
  discoverArcaClientConfig
10
- } from "./chunk-R4MOVPYT.mjs";
10
+ } from "./chunk-HSC3KLPL.mjs";
11
11
  import "./chunk-5CGIRDZY.mjs";
12
12
  import "./chunk-FSJHE4VS.mjs";
13
13
  import "./chunk-67ISWKGE.mjs";
@@ -362,6 +362,34 @@ type FiscalHeader = {
362
362
  serviceEndDate?: string;
363
363
  paymentDueDate?: string;
364
364
  };
365
+ /**
366
+ * The money of the authorized voucher, as sent and authorized, in minor units
367
+ * of the voucher currency. `vatRates` is ARCA's AlicIva: one row per rate,
368
+ * which a class A voucher must print (RG 1415, Anexo II, A, IV, a) 1). It is
369
+ * empty for class C. `rate` is absent only for a rate id this SDK does not
370
+ * know. `taxes` is ARCA's Tributos, with `rate` as a percentage.
371
+ */
372
+ type VoucherTotals = {
373
+ total: number;
374
+ netTaxed: number;
375
+ untaxed: number;
376
+ exempt: number;
377
+ vat: number;
378
+ otherTaxes: number;
379
+ vatRates: {
380
+ id: number;
381
+ rate?: number;
382
+ base: number;
383
+ amount: number;
384
+ }[];
385
+ taxes: {
386
+ id: number;
387
+ description?: string;
388
+ base: number;
389
+ rate: number;
390
+ amount: number;
391
+ }[];
392
+ };
365
393
  type IssueOptions = {
366
394
  service?: "wsfe" | "wsmtxca";
367
395
  /** An externally reserved number. Never reads the next number when supplied. */
@@ -389,6 +417,7 @@ type IssuedVoucher = VoucherCoordinates & {
389
417
  cae: string;
390
418
  caeExpiry: string;
391
419
  amounts: IssueAmounts;
420
+ totals: VoucherTotals;
392
421
  /**
393
422
  * The URL the printed voucher's QR must encode, per ARCA's specification.
394
423
  * Absent only if ARCA answered a CAE the specification cannot encode: an
@@ -1257,4 +1286,4 @@ type ArcaClient = {
1257
1286
  */
1258
1287
  declare function createArcaClient(config?: ArcaClientOptions): ArcaClient;
1259
1288
 
1260
- export { type WsfexCatalogEntry as $, type ArcaClient as A, type IssuePreview as B, type CreateWsfexServiceOptions as C, type DebitNoteInput as D, type ExportCreditNoteInput as E, type FceOptions as F, type IssueRequest as G, type IssuedVoucher as H, type InvoiceFamily as I, type ItemLine as J, type PreviewOptions as K, type RecoveryOptions as L, type VatRate as M, type NotePreview as N, type VoucherAmounts as O, type PeriodNoteInput as P, type VoucherCoordinates as Q, type Receiver as R, type VoucherDateWindowInput as S, type Tribute as T, type VoucherSummary as U, type VatItem as V, type VoucherTypeInfo as W, type VouchersService as X, type WsfeIdentityMatch as Y, type WsfexAssociatedVoucher as Z, type WsfexAuthorizationOutcome as _, ARCA_QR_URL as a, type WsfexCountryTaxId as a0, type WsfexExchangeRate as a1, type WsfexExportType as a2, type WsfexIssueInput as a3, type WsfexItem as a4, type WsfexLanguage as a5, type WsfexPermit as a6, type WsfexSalesPoint as a7, type WsfexService as a8, type WsfexVoucherInfo as a9, type WsfexVoucherInput as aa, type WsfexVoucherLookupResult as ab, type WsfexVoucherType as ac, type WsmtxcaIssueRequest as ad, type WsmtxcaLine as ae, arcaQrPayload as af, arcaQrUrl as ag, createArcaClient as ah, createWsfexService as ai, describeVoucherType as aj, matchWsfeVoucherIdentity as ak, voucherDateWindow as al, type AmountItem as b, type ArcaClientConfigView as c, type ArcaQrInput as d, type ArcaQrPayload as e, type CreditNoteInput as f, type ExportDebitNoteInput as g, type ExportHeader as h, type ExportIssueInput as i, type ExportIssueOutcome as j, type ExportIssueRequest as k, type ExportIssuedVoucher as l, type ExportItem as m, type ExportOfGoods as n, type ExportOfServices as o, type ExportPreview as p, type ExportReceiver as q, type ExportVoucherSummary as r, type ExportVoucherType as s, type FiscalHeader as t, type IssuanceFields as u, type IssueAmounts as v, type IssueCommon as w, type IssueInput as x, type IssueOptions as y, type IssueOutcome as z };
1289
+ export { type WsfexAuthorizationOutcome as $, type ArcaClient as A, type IssueOptions as B, type CreateWsfexServiceOptions as C, type DebitNoteInput as D, type ExportCreditNoteInput as E, type FceOptions as F, type IssueOutcome as G, type IssuePreview as H, type IssuedVoucher as I, type IssueRequest as J, type ItemLine as K, type PreviewOptions as L, type RecoveryOptions as M, type NotePreview as N, type VoucherAmounts as O, type PeriodNoteInput as P, type VoucherCoordinates as Q, type Receiver as R, type VoucherDateWindowInput as S, type Tribute as T, type VoucherSummary as U, type VatRate as V, type VoucherTotals as W, type VoucherTypeInfo as X, type VouchersService as Y, type WsfeIdentityMatch as Z, type WsfexAssociatedVoucher as _, type VatItem as a, type WsfexCatalogEntry as a0, type WsfexCountryTaxId as a1, type WsfexExchangeRate as a2, type WsfexExportType as a3, type WsfexIssueInput as a4, type WsfexItem as a5, type WsfexLanguage as a6, type WsfexPermit as a7, type WsfexSalesPoint as a8, type WsfexService as a9, type WsfexVoucherInfo as aa, type WsfexVoucherInput as ab, type WsfexVoucherLookupResult as ac, type WsfexVoucherType as ad, type WsmtxcaIssueRequest as ae, type WsmtxcaLine as af, arcaQrPayload as ag, arcaQrUrl as ah, createArcaClient as ai, createWsfexService as aj, describeVoucherType as ak, matchWsfeVoucherIdentity as al, voucherDateWindow as am, type AmountItem as b, ARCA_QR_URL as c, type ArcaClientConfigView as d, type ArcaQrInput as e, type ArcaQrPayload as f, type CreditNoteInput as g, type ExportDebitNoteInput as h, type ExportHeader as i, type ExportIssueInput as j, type ExportIssueOutcome as k, type ExportIssueRequest as l, type ExportIssuedVoucher as m, type ExportItem as n, type ExportOfGoods as o, type ExportOfServices as p, type ExportPreview as q, type ExportReceiver as r, type ExportVoucherSummary as s, type ExportVoucherType as t, type FiscalHeader as u, type InvoiceFamily as v, type IssuanceFields as w, type IssueAmounts as x, type IssueCommon as y, type IssueInput as z };
package/dist/index.d.ts CHANGED
@@ -1,4 +1,5 @@
1
- export { a as ARCA_QR_URL, b as AmountItem, A as ArcaClient, c as ArcaClientConfigView, d as ArcaQrInput, e as ArcaQrPayload, C as CreateWsfexServiceOptions, f as CreditNoteInput, D as DebitNoteInput, E as ExportCreditNoteInput, g as ExportDebitNoteInput, h as ExportHeader, i as ExportIssueInput, j as ExportIssueOutcome, k as ExportIssueRequest, l as ExportIssuedVoucher, m as ExportItem, n as ExportOfGoods, o as ExportOfServices, p as ExportPreview, q as ExportReceiver, r as ExportVoucherSummary, s as ExportVoucherType, F as FceOptions, t as FiscalHeader, I as InvoiceFamily, u as IssuanceFields, v as IssueAmounts, w as IssueCommon, x as IssueInput, y as IssueOptions, z as IssueOutcome, B as IssuePreview, G as IssueRequest, H as IssuedVoucher, J as ItemLine, N as NotePreview, P as PeriodNoteInput, K as PreviewOptions, R as Receiver, L as RecoveryOptions, T as Tribute, V as VatItem, M as VatRate, O as VoucherAmounts, Q as VoucherCoordinates, S as VoucherDateWindowInput, U as VoucherSummary, W as VoucherTypeInfo, X as VouchersService, Y as WsfeIdentityMatch, Z as WsfexAssociatedVoucher, _ as WsfexAuthorizationOutcome, $ as WsfexCatalogEntry, a0 as WsfexCountryTaxId, a1 as WsfexExchangeRate, a2 as WsfexExportType, a3 as WsfexIssueInput, a4 as WsfexItem, a5 as WsfexLanguage, a6 as WsfexPermit, a7 as WsfexSalesPoint, a8 as WsfexService, a9 as WsfexVoucherInfo, aa as WsfexVoucherInput, ab as WsfexVoucherLookupResult, ac as WsfexVoucherType, ad as WsmtxcaIssueRequest, ae as WsmtxcaLine, af as arcaQrPayload, ag as arcaQrUrl, ah as createArcaClient, ai as createWsfexService, aj as describeVoucherType, ak as matchWsfeVoucherIdentity, al as voucherDateWindow } from './client-ghHzZdu8.js';
1
+ import { V as VatRate, I as IssuedVoucher, a as VatItem, b as AmountItem } from './client-BK-aaWiG.js';
2
+ export { c as ARCA_QR_URL, A as ArcaClient, d as ArcaClientConfigView, e as ArcaQrInput, f as ArcaQrPayload, C as CreateWsfexServiceOptions, g as CreditNoteInput, D as DebitNoteInput, E as ExportCreditNoteInput, h as ExportDebitNoteInput, i as ExportHeader, j as ExportIssueInput, k as ExportIssueOutcome, l as ExportIssueRequest, m as ExportIssuedVoucher, n as ExportItem, o as ExportOfGoods, p as ExportOfServices, q as ExportPreview, r as ExportReceiver, s as ExportVoucherSummary, t as ExportVoucherType, F as FceOptions, u as FiscalHeader, v as InvoiceFamily, w as IssuanceFields, x as IssueAmounts, y as IssueCommon, z as IssueInput, B as IssueOptions, G as IssueOutcome, H as IssuePreview, J as IssueRequest, K as ItemLine, N as NotePreview, P as PeriodNoteInput, L as PreviewOptions, R as Receiver, M as RecoveryOptions, T as Tribute, O as VoucherAmounts, Q as VoucherCoordinates, S as VoucherDateWindowInput, U as VoucherSummary, W as VoucherTotals, X as VoucherTypeInfo, Y as VouchersService, Z as WsfeIdentityMatch, _ as WsfexAssociatedVoucher, $ as WsfexAuthorizationOutcome, a0 as WsfexCatalogEntry, a1 as WsfexCountryTaxId, a2 as WsfexExchangeRate, a3 as WsfexExportType, a4 as WsfexIssueInput, a5 as WsfexItem, a6 as WsfexLanguage, a7 as WsfexPermit, a8 as WsfexSalesPoint, a9 as WsfexService, aa as WsfexVoucherInfo, ab as WsfexVoucherInput, ac as WsfexVoucherLookupResult, ad as WsfexVoucherType, ae as WsmtxcaIssueRequest, af as WsmtxcaLine, ag as arcaQrPayload, ah as arcaQrUrl, ai as createArcaClient, aj as createWsfexService, ak as describeVoucherType, al as matchWsfeVoucherIdentity, am as voucherDateWindow } from './client-BK-aaWiG.js';
2
3
  import { h as ArcaEnvironment, a as ArcaClientConfig, i as ArcaStore, j as ArcaWsaaSessionStore } from './types-CbvsjIhf.js';
3
4
  export { g as ArcaAuthCredentials, f as ArcaAuthOptions, A as ArcaClientConfig, k as ArcaLockOptions, l as ArcaLogLevel, m as ArcaLoggerConfig, n as ArcaPadronServiceName, o as ArcaRepresentedTaxId, b as ArcaServiceName, p as ArcaServiceTarget, e as ArcaWsaaServiceId, q as ArcaWsaaSessionKey } from './types-CbvsjIhf.js';
4
5
  export { ARCA_FINAL_CONSUMER_IDENTIFICATION_THRESHOLD_MINOR_UNITS, ARCA_INVOICE_CLASS_BY_ISSUER, ARCA_ISSUER_CONDITION_IDS, ARCA_RECEIVER_CONDITION_IDS, ARCA_WSMTXCA_GENERIC_CODES, IssuerCondition, IssuerConditionId, ReceiverCondition, VoucherClass } from './constants.js';
@@ -38,6 +39,193 @@ declare function createArcaClientConfigFromEnv(options?: CreateArcaClientConfigF
38
39
  */
39
40
  declare function assertArcaClientConfig(config: ArcaClientConfig): void;
40
41
 
42
+ /**
43
+ * Fixed texts a printed voucher carries, as the norms word them. Rule ids
44
+ * refer to `.github/PRINTED_VOUCHER_SOURCES.md`.
45
+ */
46
+ declare const PRINTED_VOUCHER_TEXT: {
47
+ /** L4, before the voucher type code. */
48
+ readonly code: "Código Nº";
49
+ /** C7, before the start of activities. */
50
+ readonly activitiesStart: "INICIO DE ACTIVIDADES";
51
+ /** C8 and L9, before the CAE. */
52
+ readonly cae: "C.A.E. N°";
53
+ /** C9 and L9, before the CAE due date, in type of at least 12 pt. */
54
+ readonly caeDueDate: "Fecha Vto.:";
55
+ /** L8, the title of the consumer transparency block. */
56
+ readonly transparencyTitle: "Régimen de Transparencia Fiscal al Consumidor (Ley 27.743)";
57
+ /** L8, the VAT contained in the price. */
58
+ readonly vatContained: "IVA Contenido";
59
+ /** L8 and C24, the other national indirect taxes. */
60
+ readonly otherNationalIndirectTaxes: "Otros Impuestos Nacionales Indirectos";
61
+ };
62
+ /** L9 asks for at least this type size for the CAE due date. */
63
+ declare const PRINTED_CAE_DUE_DATE_MIN_FONT_SIZE_PT = 12;
64
+ /** The issuer conditions a printed voucher can name (C5). */
65
+ type PrintedIssuerCondition = "responsable_inscripto" | "exento" | "no_alcanzado" | "monotributo" | "monotributo_social" | "monotributo_trabajador_independiente_promovido";
66
+ type VoucherDocumentInput = {
67
+ /** The voucher `issue()`, a note method or `recover()` answered authorized. */
68
+ voucher: IssuedVoucher;
69
+ /** The same items the voucher was issued from, each with its description. */
70
+ items: readonly (VatItem | AmountItem)[];
71
+ issuer: {
72
+ /** C1. */
73
+ legalName: string;
74
+ /** L1, only when the issuer has one. */
75
+ tradeName?: string;
76
+ /** C2: where the voucher is issued, or the fiscal address for travelling sellers. */
77
+ address: string;
78
+ /** C3, checked against the voucher's QR. */
79
+ taxId: string;
80
+ /** C5. */
81
+ condition: PrintedIssuerCondition;
82
+ /** C4: the ingresos brutos number, or the non-contributor condition. */
83
+ grossIncome: string;
84
+ /**
85
+ * C7 as `YYYY-MM-DD`. `null` only for university professionals billing
86
+ * their fees and service providers without premises (Anexo II, A, V 6).
87
+ */
88
+ activitiesStartDate: string | null;
89
+ /**
90
+ * G5: the issuer opted to issue class A "PAGO EN CBU INFORMADA" (RG 5762,
91
+ * art. 20 and 21). Only class A vouchers print it.
92
+ */
93
+ paymentToInformedCbu?: boolean;
94
+ };
95
+ /**
96
+ * G3: the observations ARCA returned with the CAE, as
97
+ * `authorization.observations` of an `authorized` outcome carries them. On a
98
+ * class A voucher their codes are printed (RG 4291, art. 12 and 14 c)).
99
+ */
100
+ observations?: readonly {
101
+ code?: string | number;
102
+ }[];
103
+ /** C13 to C17. Name and address are required unless the receiver is a consumidor final. */
104
+ receiver?: {
105
+ name?: string;
106
+ address?: string;
107
+ };
108
+ /** L6: contado, cuenta corriente and so on. */
109
+ saleConditions: string;
110
+ /** C12: the remitos issued for the operation, when there are any. */
111
+ remitos?: readonly string[];
112
+ };
113
+ type VoucherDocumentLine = {
114
+ code?: string;
115
+ description: string;
116
+ quantity: number;
117
+ unit?: number;
118
+ /** Major-unit decimal string: without VAT on class A, with VAT on class B. */
119
+ unitPrice: string;
120
+ discount?: number;
121
+ /** Minor units: without VAT on class A, with VAT on class B, as issued on class C. */
122
+ amount: number;
123
+ /** Class A only: the line's rate, `exempt` or `untaxed`. */
124
+ vatRate?: VatRate;
125
+ };
126
+ /**
127
+ * Everything a printed voucher shows, derived and checked. Money is in minor
128
+ * units of the voucher currency and dates are `YYYY-MM-DD`. Formatting and
129
+ * layout belong to the renderer.
130
+ */
131
+ type VoucherDocument = {
132
+ voucherClass: "A" | "B" | "C";
133
+ voucherType: number;
134
+ /** L4: the type code, three digits. */
135
+ code: string;
136
+ /** G4 and G5: the legend printed next to the letter A, when there is one. */
137
+ letterLegend?: "OPERACIÓN SUJETA A RETENCIÓN" | "PAGO EN CBU INFORMADA";
138
+ title: "FACTURA" | "NOTA DE DÉBITO" | "NOTA DE CRÉDITO";
139
+ /** C6: sales point and number, `00003-00000041`. */
140
+ number: string;
141
+ /** C11. */
142
+ issueDate: string;
143
+ issuer: {
144
+ tradeName?: string;
145
+ legalName: string;
146
+ address: string;
147
+ taxId: string;
148
+ conditionLegend: string;
149
+ grossIncome: string;
150
+ activitiesStartDate?: string;
151
+ };
152
+ receiver: {
153
+ conditionLegend: string;
154
+ name?: string;
155
+ address?: string;
156
+ /** Absent for an unidentified consumidor final. */
157
+ document?: {
158
+ type: number;
159
+ label?: string;
160
+ number: string;
161
+ };
162
+ };
163
+ saleConditions: string;
164
+ remitos: string[];
165
+ /** Concepts 2 and 3. */
166
+ servicePeriod?: {
167
+ from: string;
168
+ to: string;
169
+ };
170
+ paymentDueDate?: string;
171
+ /** C22: the exchange rate is present for any currency but pesos. */
172
+ currency: {
173
+ id: string;
174
+ exchangeRate?: string;
175
+ };
176
+ lines: VoucherDocumentLine[];
177
+ totals: {
178
+ /** Class A: net taxed. Class B: the lines with VAT. Class C: the lines. */
179
+ subtotal: number;
180
+ exempt: number;
181
+ untaxed: number;
182
+ /** C25 and L7, class A only: one row per rate, as authorized. */
183
+ vatRates: {
184
+ id: number;
185
+ rate?: number;
186
+ base: number;
187
+ amount: number;
188
+ }[];
189
+ /** C23: ARCA's Tributos. */
190
+ otherTaxes: {
191
+ id: number;
192
+ description: string;
193
+ amount: number;
194
+ }[];
195
+ /** C23: a VAT adjustment of the header that no line could carry. */
196
+ adjustment: number;
197
+ total: number;
198
+ };
199
+ /** L8 and G2, class B only. */
200
+ transparency?: {
201
+ vatContained: number;
202
+ otherNationalIndirectTaxes: number;
203
+ };
204
+ /** C8, C9 and L9. */
205
+ authorization: {
206
+ kind: "CAE";
207
+ code: string;
208
+ dueDate: string;
209
+ };
210
+ /** Q1 and Q2. */
211
+ qr: string;
212
+ /** Conditional legends, in order, each with its rule id. */
213
+ legends: {
214
+ rule: "G1" | "G3";
215
+ text: string;
216
+ }[];
217
+ };
218
+ /** G1: RG 1415, art. 15, inc. a), as replaced by RG 5003, art. 20. */
219
+ declare const MONOTRIBUTO_CREDIT_LEGEND = "El cr\u00E9dito fiscal discriminado en el presente comprobante, s\u00F3lo podr\u00E1 ser computado a efectos del R\u00E9gimen de Sostenimiento e Inclusi\u00F3n Fiscal para Peque\u00F1os Contribuyentes de la Ley N\u00BA 27.618";
220
+ /**
221
+ * Derives what a printed class A, B or C voucher must show from the
222
+ * authorized voucher, the items it was issued from and the issuer's profile.
223
+ * Pure. It throws `ArcaInputError` when a required datum is missing, when the
224
+ * items do not add up to the authorized money, or for a voucher it does not
225
+ * render: FCE, and class M vouchers issued before 2025-12-01.
226
+ */
227
+ declare function buildVoucherDocument(input: VoucherDocumentInput): VoucherDocument;
228
+
41
229
  /** Persistent store for a single server with a private durable volume. */
42
230
  declare function createFileStore(directory: string): ArcaStore;
43
231
 
@@ -69,4 +257,4 @@ declare function createRedisStore(client: RedisClient, options?: {
69
257
 
70
258
  declare function createMemoryWsaaSessionStore(): ArcaWsaaSessionStore;
71
259
 
72
- export { ARCA_ENVIRONMENTS, ARCA_ENV_VARIABLES, ArcaEnvironment, ArcaStore, ArcaWsaaSessionStore, type CreateArcaClientConfigFromEnvOptions, assertArcaClientConfig, createArcaClientConfigFromEnv, createFileStore, createMemoryStore, createMemoryWsaaSessionStore, createPostgresStore, createRedisStore };
260
+ export { ARCA_ENVIRONMENTS, ARCA_ENV_VARIABLES, AmountItem, ArcaEnvironment, ArcaStore, ArcaWsaaSessionStore, type CreateArcaClientConfigFromEnvOptions, IssuedVoucher, MONOTRIBUTO_CREDIT_LEGEND, PRINTED_CAE_DUE_DATE_MIN_FONT_SIZE_PT, PRINTED_VOUCHER_TEXT, type PrintedIssuerCondition, VatItem, VatRate, type VoucherDocument, type VoucherDocumentInput, type VoucherDocumentLine, assertArcaClientConfig, buildVoucherDocument, createArcaClientConfigFromEnv, createFileStore, createMemoryStore, createMemoryWsaaSessionStore, createPostgresStore, createRedisStore };