facturas 0.7.1 → 0.9.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.
Files changed (37) hide show
  1. package/README.md +799 -27
  2. package/dist/{chunk-IOKZX6CA.mjs → chunk-4QVFXT35.mjs} +2 -2
  3. package/dist/chunk-76WU5BVI.mjs +109 -0
  4. package/dist/chunk-76WU5BVI.mjs.map +1 -0
  5. package/dist/{chunk-EDY3PNKJ.mjs → chunk-7LEKQ4P7.mjs} +2 -2
  6. package/dist/{chunk-OHHXHYLV.mjs → chunk-RCM4NAAG.mjs} +244 -48
  7. package/dist/chunk-RCM4NAAG.mjs.map +1 -0
  8. package/dist/{chunk-A3C3Y5PI.mjs → chunk-XNBD5NVL.mjs} +32 -31
  9. package/dist/chunk-XNBD5NVL.mjs.map +1 -0
  10. package/dist/{chunk-MBWOFO67.mjs → chunk-ZOSNASXB.mjs} +14 -2
  11. package/dist/chunk-ZOSNASXB.mjs.map +1 -0
  12. package/dist/constants.d.ts +49 -1
  13. package/dist/constants.mjs +9 -1
  14. package/dist/errors.d.ts +2 -2
  15. package/dist/errors.mjs +5 -3
  16. package/dist/{fiscal-evidence-BQuBbJ3h.d.ts → fiscal-evidence-DBzakqBE.d.ts} +11 -3
  17. package/dist/{index-CVpygFb0.d.ts → index-CVGQyyYM.d.ts} +1 -1
  18. package/dist/index.d.ts +238 -9
  19. package/dist/index.mjs +1343 -30
  20. package/dist/index.mjs.map +1 -1
  21. package/dist/padron.d.ts +2 -2
  22. package/dist/padron.mjs +2 -2
  23. package/dist/{types-BXq0da71.d.ts → types-BiznC1-X.d.ts} +12 -1
  24. package/dist/types.d.ts +1 -1
  25. package/dist/wsfe-DF0jAE2k.d.ts +325 -0
  26. package/dist/wsfe.d.ts +4 -309
  27. package/dist/wsfe.mjs +4 -4
  28. package/dist/wsmtxca.d.ts +14 -5
  29. package/dist/wsmtxca.mjs +3 -3
  30. package/package.json +1 -1
  31. package/dist/chunk-A3C3Y5PI.mjs.map +0 -1
  32. package/dist/chunk-MBWOFO67.mjs.map +0 -1
  33. package/dist/chunk-OHHXHYLV.mjs.map +0 -1
  34. package/dist/chunk-VVY2LZIZ.mjs +0 -61
  35. package/dist/chunk-VVY2LZIZ.mjs.map +0 -1
  36. /package/dist/{chunk-IOKZX6CA.mjs.map → chunk-4QVFXT35.mjs.map} +0 -0
  37. /package/dist/{chunk-EDY3PNKJ.mjs.map → chunk-7LEKQ4P7.mjs.map} +0 -0
@@ -1,3 +1,12 @@
1
+ /** Durable values. add must atomically create only when the key is absent. */
2
+ type ArcaStore = {
3
+ get(key: string): Promise<string | null>;
4
+ set(key: string, value: string): Promise<void>;
5
+ add(key: string, value: string): Promise<boolean>;
6
+ delete?(key: string): Promise<void>;
7
+ withLock?<T>(key: string, fn: () => Promise<T>): Promise<T>;
8
+ };
9
+
1
10
  /** Target environment for ARCA services. */
2
11
  type ArcaEnvironment = "production" | "test";
3
12
  /** All ARCA service identifiers, including WSAA. */
@@ -31,6 +40,7 @@ type ArcaClientConfig = {
31
40
  certificatePem: string;
32
41
  privateKeyPem: string;
33
42
  environment: ArcaEnvironment;
43
+ store?: ArcaStore;
34
44
  timeout?: number;
35
45
  retries?: number;
36
46
  retryDelay?: number;
@@ -63,5 +73,6 @@ type ArcaSoapExecutionOptions<TBody> = {
63
73
  bodyElementNamespaceMode?: "default" | "prefix";
64
74
  body: TBody;
65
75
  };
76
+ type ArcaClientOptions = Omit<ArcaClientConfig, "taxId" | "certificatePem" | "privateKeyPem" | "environment"> & Partial<Pick<ArcaClientConfig, "taxId" | "certificatePem" | "privateKeyPem" | "environment">>;
66
77
 
67
- export type { ArcaServiceName as A, ArcaSoapExecutionOptions as a, ArcaSoapResponse as b, ArcaWsaaServiceId as c, ArcaAuthOptions as d, ArcaAuthCredentials as e, ArcaEnvironment as f, ArcaClientConfig as g, ArcaWsaaSessionStore as h, ArcaLogLevel as i, ArcaLoggerConfig as j, ArcaPadronServiceName as k, ArcaRepresentedTaxId as l, ArcaServiceTarget as m, ArcaWsaaSessionKey as n };
78
+ export type { ArcaServiceName as A, ArcaSoapExecutionOptions as a, ArcaSoapResponse as b, ArcaWsaaServiceId as c, ArcaAuthOptions as d, ArcaAuthCredentials as e, ArcaEnvironment as f, ArcaClientOptions as g, ArcaClientConfig as h, ArcaStore as i, ArcaWsaaSessionStore as j, ArcaLogLevel as k, ArcaLoggerConfig as l, ArcaPadronServiceName as m, ArcaRepresentedTaxId as n, ArcaServiceTarget as o, ArcaWsaaSessionKey as p };
package/dist/types.d.ts CHANGED
@@ -1 +1 @@
1
- export { e as ArcaAuthCredentials, d as ArcaAuthOptions, g as ArcaClientConfig, f as ArcaEnvironment, i as ArcaLogLevel, j as ArcaLoggerConfig, k as ArcaPadronServiceName, l as ArcaRepresentedTaxId, A as ArcaServiceName, m as ArcaServiceTarget, c as ArcaWsaaServiceId, n as ArcaWsaaSessionKey, h as ArcaWsaaSessionStore } from './types-BXq0da71.js';
1
+ export { e as ArcaAuthCredentials, d as ArcaAuthOptions, g as ArcaClientConfig, f as ArcaEnvironment, k as ArcaLogLevel, l as ArcaLoggerConfig, m as ArcaPadronServiceName, n as ArcaRepresentedTaxId, A as ArcaServiceName, o as ArcaServiceTarget, c as ArcaWsaaServiceId, p as ArcaWsaaSessionKey, j as ArcaWsaaSessionStore } from './types-BiznC1-X.js';
@@ -0,0 +1,325 @@
1
+ import { h as ArcaClientConfig } from './types-BiznC1-X.js';
2
+ import { W as WsaaAuthModule, S as SoapTransport } from './index-CVGQyyYM.js';
3
+ import { A as ArcaAuthorizationOutcome, t as ArcaVoucherLookupResult } from './fiscal-evidence-DBzakqBE.js';
4
+
5
+ /** Accepted public date inputs for WSFE request fields. */
6
+ type WsfeDateInput = `${number}${number}${number}${number}-${number}${number}-${number}${number}` | `${number}${number}${number}${number}${number}${number}${number}${number}`;
7
+ /** An associated voucher referenced by a WSFE invoice request. */
8
+ type WsfeAssociatedVoucher = {
9
+ type: number;
10
+ salesPoint: number;
11
+ number: number;
12
+ taxId?: string;
13
+ voucherDate?: WsfeDateInput;
14
+ };
15
+ /** An associated period used by WSFE credit/debit notes without associated vouchers. */
16
+ type WsfeAssociatedPeriod = {
17
+ startDate: WsfeDateInput;
18
+ endDate: WsfeDateInput;
19
+ };
20
+ /** A tax (tributo) item in a WSFE invoice request. */
21
+ type WsfeTax = {
22
+ id: number;
23
+ description?: string;
24
+ baseAmount: number;
25
+ rate: number;
26
+ amount: number;
27
+ };
28
+ /** A VAT rate (alícuota IVA) item in a WSFE invoice request. */
29
+ type WsfeVatRate = {
30
+ id: number;
31
+ baseAmount: number;
32
+ amount: number;
33
+ };
34
+ /** An optional field (campo opcional) in a WSFE invoice request. */
35
+ type WsfeOptionalField = {
36
+ id: string;
37
+ value: string;
38
+ };
39
+ /** A buyer (comprador) in a WSFE invoice request. */
40
+ type WsfeBuyer = {
41
+ documentType: number;
42
+ documentNumber: number;
43
+ percentage: number;
44
+ };
45
+ /** An activity associated with a WSFE invoice request. */
46
+ type WsfeActivity = {
47
+ id: number;
48
+ };
49
+ /** Input data for authorizing a WSFE voucher. */
50
+ type WsfeVoucherInput = {
51
+ salesPoint: number;
52
+ voucherType: number;
53
+ concept: number;
54
+ documentType: number;
55
+ documentNumber: number;
56
+ receiverVatConditionId: number;
57
+ voucherDate: WsfeDateInput;
58
+ totalAmount: number;
59
+ nonTaxableAmount: number;
60
+ netAmount: number;
61
+ exemptAmount: number;
62
+ taxAmount: number;
63
+ vatAmount: number;
64
+ currencyId: string;
65
+ exchangeRate?: number | string;
66
+ sameCurrencyForeignCancellation?: "S" | "N";
67
+ serviceStartDate?: WsfeDateInput;
68
+ serviceEndDate?: WsfeDateInput;
69
+ paymentDueDate?: WsfeDateInput;
70
+ associatedVouchers?: WsfeAssociatedVoucher[];
71
+ associatedPeriod?: WsfeAssociatedPeriod;
72
+ taxes?: WsfeTax[];
73
+ vatRates?: WsfeVatRate[];
74
+ optionalFields?: WsfeOptionalField[];
75
+ buyers?: WsfeBuyer[];
76
+ activities?: WsfeActivity[];
77
+ };
78
+ /** Input for authorizing a WSFE voucher with an explicit voucher number. */
79
+ type WsfeAuthorizeVoucherInput = {
80
+ representedTaxId?: number | string;
81
+ data: WsfeVoucherInput;
82
+ voucherNumber: number;
83
+ forceRefresh?: boolean;
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
+ /** Structured evidence from one exact WSFE authorization attempt. */
93
+ type WsfeAuthorizationOutcome = ArcaAuthorizationOutcome<"wsfe">;
94
+ /** A point-of-sale entry returned by {@link WsfeService.getSalesPoints}. */
95
+ type WsfeSalesPoint = {
96
+ number: number;
97
+ emissionType?: string;
98
+ blocked?: string;
99
+ deletedSince?: string;
100
+ };
101
+ /** Voucher details returned by {@link WsfeService.getVoucherInfo}. */
102
+ type WsfeVoucherInfo = {
103
+ voucherNumber: number;
104
+ voucherDate?: string;
105
+ salesPoint?: number;
106
+ voucherType?: number;
107
+ concept?: number;
108
+ documentType?: number;
109
+ documentNumber?: string;
110
+ receiverVatConditionId?: number;
111
+ totalAmount?: number;
112
+ nonTaxableAmount?: number;
113
+ netAmount?: number;
114
+ exemptAmount?: number;
115
+ taxAmount?: number;
116
+ vatAmount?: number;
117
+ currencyId?: string;
118
+ exchangeRate?: number;
119
+ result?: string;
120
+ cae?: string;
121
+ caeExpiry?: string;
122
+ vatRates?: WsfeVatRate[];
123
+ serviceStartDate?: string;
124
+ serviceEndDate?: string;
125
+ paymentDueDate?: string;
126
+ taxes?: WsfeTax[];
127
+ associatedVouchers?: WsfeAssociatedVoucher[];
128
+ raw: Record<string, unknown>;
129
+ };
130
+ /** Typed exact-voucher consultation result for WSFE. */
131
+ type WsfeVoucherLookupResult = ArcaVoucherLookupResult<WsfeVoucherInfo, "wsfe">;
132
+ type WsfeCatalogEntry = {
133
+ id: number;
134
+ description: string;
135
+ };
136
+ type WsfeActivityType = WsfeCatalogEntry & {
137
+ order: number;
138
+ };
139
+ type WsfeReceiverVatCondition = WsfeCatalogEntry & {
140
+ voucherClass: string;
141
+ };
142
+ type WsfeCurrencyType = {
143
+ id: string;
144
+ description: string;
145
+ validFrom: string;
146
+ validTo: string;
147
+ };
148
+ type WsfeServerStatus = {
149
+ appServer: string;
150
+ dbServer: string;
151
+ authServer: string;
152
+ };
153
+ type WsfeQuotation = {
154
+ currencyId: string;
155
+ rate: number;
156
+ date: string;
157
+ };
158
+ /** WSFE electronic invoicing service. */
159
+ type WsfeService = {
160
+ /**
161
+ * Issues one exact voucher: a single FECAESolicitar for the caller-owned
162
+ * `voucherNumber`, without transport retries, returning structured evidence
163
+ * (`authorized`, `rejected` or `indeterminate`) instead of throwing.
164
+ */
165
+ 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
+ /** Returns the next available voucher number for the given sales point and type. */
184
+ getNextVoucherNumber(input: {
185
+ representedTaxId?: number | string;
186
+ salesPoint: number;
187
+ voucherType: number;
188
+ forceRefresh?: boolean;
189
+ }): Promise<number>;
190
+ /**
191
+ * @deprecated Use `getNextVoucherNumber()` instead.
192
+ * Returns the next available voucher number, not the last authorized one.
193
+ */
194
+ getLastVoucher(input: {
195
+ representedTaxId?: number | string;
196
+ salesPoint: number;
197
+ voucherType: number;
198
+ forceRefresh?: boolean;
199
+ }): Promise<number>;
200
+ /** Lists all configured points of sale for the taxpayer. */
201
+ getSalesPoints(input: {
202
+ representedTaxId?: number | string;
203
+ forceRefresh?: boolean;
204
+ }): Promise<WsfeSalesPoint[]>;
205
+ /** Lists voucher types accepted by WSFE. */
206
+ getVoucherTypes(input: {
207
+ representedTaxId?: number | string;
208
+ forceRefresh?: boolean;
209
+ }): Promise<WsfeCatalogEntry[]>;
210
+ /** Lists document types accepted by WSFE. */
211
+ getDocumentTypes(input: {
212
+ representedTaxId?: number | string;
213
+ forceRefresh?: boolean;
214
+ }): Promise<WsfeCatalogEntry[]>;
215
+ /** Lists concept types accepted by WSFE. */
216
+ getConceptTypes(input: {
217
+ representedTaxId?: number | string;
218
+ forceRefresh?: boolean;
219
+ }): Promise<WsfeCatalogEntry[]>;
220
+ /** Lists live ARCA currency identifiers such as PES and DOL, not ISO codes. */
221
+ getCurrencyTypes(input: {
222
+ representedTaxId?: number | string;
223
+ forceRefresh?: boolean;
224
+ }): Promise<WsfeCurrencyType[]>;
225
+ /** Lists VAT rates accepted by WSFE. */
226
+ getVatRates(input: {
227
+ representedTaxId?: number | string;
228
+ forceRefresh?: boolean;
229
+ }): Promise<WsfeCatalogEntry[]>;
230
+ /** Lists tax types accepted by WSFE. */
231
+ getTaxTypes(input: {
232
+ representedTaxId?: number | string;
233
+ forceRefresh?: boolean;
234
+ }): Promise<WsfeCatalogEntry[]>;
235
+ /** Lists optional field types accepted by WSFE. */
236
+ getOptionalTypes(input: {
237
+ representedTaxId?: number | string;
238
+ forceRefresh?: boolean;
239
+ }): Promise<WsfeCatalogEntry[]>;
240
+ /** Lists activities enabled for the taxpayer. */
241
+ getActivities(input: {
242
+ representedTaxId?: number | string;
243
+ forceRefresh?: boolean;
244
+ }): Promise<WsfeActivityType[]>;
245
+ /** Lists receiver VAT condition values accepted by WSFE. */
246
+ getReceiverVatConditions(input: {
247
+ representedTaxId?: number | string;
248
+ voucherClass?: string;
249
+ forceRefresh?: boolean;
250
+ }): Promise<WsfeReceiverVatCondition[]>;
251
+ /** Reports WSFE backend status without requiring taxpayer authorization. */
252
+ getServerStatus(): Promise<WsfeServerStatus>;
253
+ /** Returns the exchange rate for a given currency. */
254
+ getQuotation(input: {
255
+ currencyId: string;
256
+ representedTaxId?: number | string;
257
+ forceRefresh?: boolean;
258
+ }): Promise<WsfeQuotation>;
259
+ /** Retrieves details for a specific voucher. Returns `null` if not found. */
260
+ getVoucherInfo(input: {
261
+ representedTaxId?: number | string;
262
+ number: number;
263
+ salesPoint: number;
264
+ voucherType: number;
265
+ forceRefresh?: boolean;
266
+ }): Promise<WsfeVoucherInfo | null>;
267
+ /** Consults one exact voucher and normalizes WSFE error 602 to `not_found`. */
268
+ lookupVoucher(input: {
269
+ representedTaxId?: number | string;
270
+ number: number;
271
+ salesPoint: number;
272
+ voucherType: number;
273
+ forceRefresh?: boolean;
274
+ }): Promise<WsfeVoucherLookupResult>;
275
+ };
276
+ type CreateWsfeServiceOptions = {
277
+ config: ArcaClientConfig;
278
+ auth: WsaaAuthModule;
279
+ soap: SoapTransport;
280
+ };
281
+ /** Creates a WSFE service instance wired with authentication and SOAP transport. */
282
+ declare function createWsfeService(options: CreateWsfeServiceOptions): WsfeService;
283
+
284
+ declare const SUPPORTED_VAT_RATES: readonly [0, 2.5, 5, 10.5, 21, 27];
285
+ type SupportedVatRate = (typeof SUPPORTED_VAT_RATES)[number];
286
+
287
+ type WsfeBuilderCurrencyInput = {
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 };
package/dist/wsfe.d.ts CHANGED
@@ -1,309 +1,4 @@
1
- import { g as ArcaClientConfig } from './types-BXq0da71.js';
2
- import { W as WsaaAuthModule, S as SoapTransport } from './index-CVpygFb0.js';
3
- import { e as ArcaAuthorizationOutcome, s as ArcaVoucherLookupResult } from './fiscal-evidence-BQuBbJ3h.js';
4
-
5
- /** Accepted public date inputs for WSFE request fields. */
6
- type WsfeDateInput = `${number}${number}${number}${number}-${number}${number}-${number}${number}` | `${number}${number}${number}${number}${number}${number}${number}${number}`;
7
- /** An associated voucher referenced by a WSFE invoice request. */
8
- type WsfeAssociatedVoucher = {
9
- type: number;
10
- salesPoint: number;
11
- number: number;
12
- taxId?: string;
13
- voucherDate?: WsfeDateInput;
14
- };
15
- /** An associated period used by WSFE credit/debit notes without associated vouchers. */
16
- type WsfeAssociatedPeriod = {
17
- startDate: WsfeDateInput;
18
- endDate: WsfeDateInput;
19
- };
20
- /** A tax (tributo) item in a WSFE invoice request. */
21
- type WsfeTax = {
22
- id: number;
23
- description?: string;
24
- baseAmount: number;
25
- rate: number;
26
- amount: number;
27
- };
28
- /** A VAT rate (alícuota IVA) item in a WSFE invoice request. */
29
- type WsfeVatRate = {
30
- id: number;
31
- baseAmount: number;
32
- amount: number;
33
- };
34
- /** An optional field (campo opcional) in a WSFE invoice request. */
35
- type WsfeOptionalField = {
36
- id: string;
37
- value: string;
38
- };
39
- /** A buyer (comprador) in a WSFE invoice request. */
40
- type WsfeBuyer = {
41
- documentType: number;
42
- documentNumber: number;
43
- percentage: number;
44
- };
45
- /** An activity associated with a WSFE invoice request. */
46
- type WsfeActivity = {
47
- id: number;
48
- };
49
- /** Input data for authorizing a WSFE voucher. */
50
- type WsfeVoucherInput = {
51
- salesPoint: number;
52
- voucherType: number;
53
- concept: number;
54
- documentType: number;
55
- documentNumber: number;
56
- receiverVatConditionId: number;
57
- voucherDate: WsfeDateInput;
58
- totalAmount: number;
59
- nonTaxableAmount: number;
60
- netAmount: number;
61
- exemptAmount: number;
62
- taxAmount: number;
63
- vatAmount: number;
64
- currencyId: string;
65
- exchangeRate?: number | string;
66
- sameCurrencyForeignCancellation?: "S" | "N";
67
- serviceStartDate?: WsfeDateInput;
68
- serviceEndDate?: WsfeDateInput;
69
- paymentDueDate?: WsfeDateInput;
70
- associatedVouchers?: WsfeAssociatedVoucher[];
71
- associatedPeriod?: WsfeAssociatedPeriod;
72
- taxes?: WsfeTax[];
73
- vatRates?: WsfeVatRate[];
74
- optionalFields?: WsfeOptionalField[];
75
- buyers?: WsfeBuyer[];
76
- activities?: WsfeActivity[];
77
- };
78
- /** Input for authorizing a WSFE voucher with an explicit voucher number. */
79
- type WsfeAuthorizeVoucherInput = {
80
- representedTaxId?: number | string;
81
- data: WsfeVoucherInput;
82
- voucherNumber: number;
83
- forceRefresh?: boolean;
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
- /** Structured evidence from one exact WSFE authorization attempt. */
93
- type WsfeAuthorizationOutcome = ArcaAuthorizationOutcome<"wsfe">;
94
- /** A point-of-sale entry returned by {@link WsfeService.getSalesPoints}. */
95
- type WsfeSalesPoint = {
96
- number: number;
97
- emissionType?: string;
98
- blocked?: string;
99
- deletedSince?: string;
100
- };
101
- /** Voucher details returned by {@link WsfeService.getVoucherInfo}. */
102
- type WsfeVoucherInfo = {
103
- voucherNumber: number;
104
- voucherDate?: string;
105
- salesPoint?: number;
106
- voucherType?: number;
107
- concept?: number;
108
- documentType?: number;
109
- documentNumber?: string;
110
- receiverVatConditionId?: number;
111
- totalAmount?: number;
112
- nonTaxableAmount?: number;
113
- netAmount?: number;
114
- exemptAmount?: number;
115
- taxAmount?: number;
116
- vatAmount?: number;
117
- currencyId?: string;
118
- exchangeRate?: number;
119
- result?: string;
120
- cae?: string;
121
- caeExpiry?: string;
122
- raw: Record<string, unknown>;
123
- };
124
- /** Typed exact-voucher consultation result for WSFE. */
125
- type WsfeVoucherLookupResult = ArcaVoucherLookupResult<WsfeVoucherInfo, "wsfe">;
126
- type WsfeCatalogEntry = {
127
- id: number;
128
- description: string;
129
- };
130
- type WsfeActivityType = WsfeCatalogEntry & {
131
- order: number;
132
- };
133
- type WsfeReceiverVatCondition = WsfeCatalogEntry & {
134
- voucherClass: string;
135
- };
136
- type WsfeCurrencyType = {
137
- id: string;
138
- description: string;
139
- validFrom: string;
140
- validTo: string;
141
- };
142
- type WsfeServerStatus = {
143
- appServer: string;
144
- dbServer: string;
145
- authServer: string;
146
- };
147
- type WsfeQuotation = {
148
- currencyId: string;
149
- rate: number;
150
- date: string;
151
- };
152
- /** WSFE electronic invoicing service. */
153
- type WsfeService = {
154
- /**
155
- * Attempts one exact authorization without transport retries and returns
156
- * structured provider evidence instead of flattening the result to throw/success.
157
- */
158
- authorizeVoucherOutcome(input: WsfeAuthorizeVoucherInput): Promise<WsfeAuthorizationOutcome>;
159
- /** Authorizes a voucher with the explicit number sent as `CbteDesde` and `CbteHasta`. */
160
- authorizeVoucher(input: WsfeAuthorizeVoucherInput): Promise<WsfeAuthorizationResult>;
161
- /** Authorizes a new voucher by fetching the next number and requesting a CAE. */
162
- createNextVoucher(input: {
163
- representedTaxId?: number | string;
164
- data: WsfeVoucherInput;
165
- forceRefresh?: boolean;
166
- }): Promise<WsfeAuthorizationResult>;
167
- /** Returns the next available voucher number for the given sales point and type. */
168
- getNextVoucherNumber(input: {
169
- representedTaxId?: number | string;
170
- salesPoint: number;
171
- voucherType: number;
172
- forceRefresh?: boolean;
173
- }): Promise<number>;
174
- /**
175
- * @deprecated Use `getNextVoucherNumber()` instead.
176
- * Returns the next available voucher number, not the last authorized one.
177
- */
178
- getLastVoucher(input: {
179
- representedTaxId?: number | string;
180
- salesPoint: number;
181
- voucherType: number;
182
- forceRefresh?: boolean;
183
- }): Promise<number>;
184
- /** Lists all configured points of sale for the taxpayer. */
185
- getSalesPoints(input: {
186
- representedTaxId?: number | string;
187
- forceRefresh?: boolean;
188
- }): Promise<WsfeSalesPoint[]>;
189
- /** Lists voucher types accepted by WSFE. */
190
- getVoucherTypes(input: {
191
- representedTaxId?: number | string;
192
- forceRefresh?: boolean;
193
- }): Promise<WsfeCatalogEntry[]>;
194
- /** Lists document types accepted by WSFE. */
195
- getDocumentTypes(input: {
196
- representedTaxId?: number | string;
197
- forceRefresh?: boolean;
198
- }): Promise<WsfeCatalogEntry[]>;
199
- /** Lists concept types accepted by WSFE. */
200
- getConceptTypes(input: {
201
- representedTaxId?: number | string;
202
- forceRefresh?: boolean;
203
- }): Promise<WsfeCatalogEntry[]>;
204
- /** Lists live ARCA currency identifiers such as PES and DOL, not ISO codes. */
205
- getCurrencyTypes(input: {
206
- representedTaxId?: number | string;
207
- forceRefresh?: boolean;
208
- }): Promise<WsfeCurrencyType[]>;
209
- /** Lists VAT rates accepted by WSFE. */
210
- getVatRates(input: {
211
- representedTaxId?: number | string;
212
- forceRefresh?: boolean;
213
- }): Promise<WsfeCatalogEntry[]>;
214
- /** Lists tax types accepted by WSFE. */
215
- getTaxTypes(input: {
216
- representedTaxId?: number | string;
217
- forceRefresh?: boolean;
218
- }): Promise<WsfeCatalogEntry[]>;
219
- /** Lists optional field types accepted by WSFE. */
220
- getOptionalTypes(input: {
221
- representedTaxId?: number | string;
222
- forceRefresh?: boolean;
223
- }): Promise<WsfeCatalogEntry[]>;
224
- /** Lists activities enabled for the taxpayer. */
225
- getActivities(input: {
226
- representedTaxId?: number | string;
227
- forceRefresh?: boolean;
228
- }): Promise<WsfeActivityType[]>;
229
- /** Lists receiver VAT condition values accepted by WSFE. */
230
- getReceiverVatConditions(input: {
231
- representedTaxId?: number | string;
232
- voucherClass?: string;
233
- forceRefresh?: boolean;
234
- }): Promise<WsfeReceiverVatCondition[]>;
235
- /** Reports WSFE backend status without requiring taxpayer authorization. */
236
- getServerStatus(): Promise<WsfeServerStatus>;
237
- /** Returns the exchange rate for a given currency. */
238
- getQuotation(input: {
239
- currencyId: string;
240
- representedTaxId?: number | string;
241
- forceRefresh?: boolean;
242
- }): Promise<WsfeQuotation>;
243
- /** Retrieves details for a specific voucher. Returns `null` if not found. */
244
- getVoucherInfo(input: {
245
- representedTaxId?: number | string;
246
- number: number;
247
- salesPoint: number;
248
- voucherType: number;
249
- forceRefresh?: boolean;
250
- }): Promise<WsfeVoucherInfo | null>;
251
- /** Consults one exact voucher and normalizes WSFE error 602 to `not_found`. */
252
- lookupVoucher(input: {
253
- representedTaxId?: number | string;
254
- number: number;
255
- salesPoint: number;
256
- voucherType: number;
257
- forceRefresh?: boolean;
258
- }): Promise<WsfeVoucherLookupResult>;
259
- };
260
- type CreateWsfeServiceOptions = {
261
- config: ArcaClientConfig;
262
- auth: WsaaAuthModule;
263
- soap: SoapTransport;
264
- };
265
- /** Creates a WSFE service instance wired with authentication and SOAP transport. */
266
- declare function createWsfeService(options: CreateWsfeServiceOptions): WsfeService;
267
-
268
- declare const SUPPORTED_VAT_RATES: readonly [0, 2.5, 5, 10.5, 21, 27];
269
- type SupportedVatRate = (typeof SUPPORTED_VAT_RATES)[number];
270
-
271
- type WsfeBuilderCurrencyInput = {
272
- currency?: "ARS";
273
- exchangeRate?: never;
274
- sameCurrencyForeignCancellation?: never;
275
- } | {
276
- currency: "USD";
277
- exchangeRate: string;
278
- sameCurrencyForeignCancellation?: false;
279
- } | {
280
- currency: "USD";
281
- exchangeRate?: never;
282
- sameCurrencyForeignCancellation: true;
283
- };
284
- type WsfeBuilderVatRate = SupportedVatRate;
285
- type WsfeInvoiceBuilderBaseInput = {
286
- salesPoint: number;
287
- concept: number;
288
- documentType: number;
289
- documentNumber: number;
290
- receiverVatConditionId: number;
291
- voucherDate: WsfeDateInput;
292
- serviceStartDate?: WsfeDateInput;
293
- serviceEndDate?: WsfeDateInput;
294
- paymentDueDate?: WsfeDateInput;
295
- };
296
- type BuildFacturaBInput = WsfeInvoiceBuilderBaseInput & WsfeBuilderCurrencyInput & {
297
- /** Positive integer currency minor units forming the taxable base. */
298
- taxableAmount: number;
299
- vatRate: WsfeBuilderVatRate;
300
- };
301
- type BuildFacturaCInput = WsfeInvoiceBuilderBaseInput & WsfeBuilderCurrencyInput & {
302
- amount: number;
303
- };
304
- /** Builds a narrow Factura B exact WSFE input from integer currency minor units. */
305
- declare function buildFacturaB(input: BuildFacturaBInput): WsfeVoucherInput;
306
- /** Builds a narrow Factura C exact WSFE input from integer currency minor units. */
307
- declare function buildFacturaC(input: BuildFacturaCInput): WsfeVoucherInput;
308
-
309
- export { type BuildFacturaBInput, type BuildFacturaCInput, type CreateWsfeServiceOptions, type WsfeActivity, type WsfeActivityType, type WsfeAssociatedPeriod, type WsfeAssociatedVoucher, type WsfeAuthorizationOutcome, type WsfeAuthorizationResult, type WsfeAuthorizeVoucherInput, type WsfeBuilderCurrencyInput, type WsfeBuilderVatRate, type WsfeBuyer, type WsfeCatalogEntry, type WsfeCurrencyType, type WsfeDateInput, type WsfeOptionalField, type WsfeQuotation, type WsfeReceiverVatCondition, type WsfeSalesPoint, type WsfeServerStatus, type WsfeService, type WsfeTax, type WsfeVatRate, type WsfeVoucherInfo, type WsfeVoucherInput, type WsfeVoucherLookupResult, buildFacturaB, buildFacturaC, createWsfeService };
1
+ export { B as BuildFacturaBInput, d as BuildFacturaCInput, C as CreateWsfeServiceOptions, e as WsfeActivity, f as WsfeActivityType, g as WsfeAssociatedPeriod, h as WsfeAssociatedVoucher, i as WsfeAuthorizationOutcome, j as WsfeAuthorizationResult, k as WsfeAuthorizeVoucherInput, l as WsfeBuilderCurrencyInput, m as WsfeBuilderVatRate, n as WsfeBuyer, o as WsfeCatalogEntry, p as WsfeCurrencyType, b as WsfeDateInput, q as WsfeOptionalField, r as WsfeQuotation, s as WsfeReceiverVatCondition, t as WsfeSalesPoint, u as WsfeServerStatus, c as WsfeService, v as WsfeTax, w as WsfeVatRate, a as WsfeVoucherInfo, W as WsfeVoucherInput, x as WsfeVoucherLookupResult, y as buildFacturaB, z as buildFacturaC, A as createWsfeService } from './wsfe-DF0jAE2k.js';
2
+ import './types-BiznC1-X.js';
3
+ import './index-CVGQyyYM.js';
4
+ import './fiscal-evidence-DBzakqBE.js';
package/dist/wsfe.mjs CHANGED
@@ -2,10 +2,10 @@ import {
2
2
  buildFacturaB,
3
3
  buildFacturaC,
4
4
  createWsfeService
5
- } from "./chunk-OHHXHYLV.mjs";
6
- import "./chunk-VVY2LZIZ.mjs";
7
- import "./chunk-IOKZX6CA.mjs";
8
- import "./chunk-MBWOFO67.mjs";
5
+ } from "./chunk-RCM4NAAG.mjs";
6
+ import "./chunk-76WU5BVI.mjs";
7
+ import "./chunk-4QVFXT35.mjs";
8
+ import "./chunk-ZOSNASXB.mjs";
9
9
  export {
10
10
  buildFacturaB,
11
11
  buildFacturaC,