facturas 0.6.0 → 0.7.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 +9 -2
- package/dist/chunk-C55KOV5N.mjs +1586 -0
- package/dist/chunk-C55KOV5N.mjs.map +1 -0
- package/dist/chunk-EDY3PNKJ.mjs +106 -0
- package/dist/chunk-EDY3PNKJ.mjs.map +1 -0
- package/dist/chunk-IOKZX6CA.mjs +195 -0
- package/dist/chunk-IOKZX6CA.mjs.map +1 -0
- package/dist/chunk-MBWOFO67.mjs +215 -0
- package/dist/chunk-MBWOFO67.mjs.map +1 -0
- package/dist/chunk-PKE4Z4GE.mjs +702 -0
- package/dist/chunk-PKE4Z4GE.mjs.map +1 -0
- package/dist/chunk-VVY2LZIZ.mjs +61 -0
- package/dist/chunk-VVY2LZIZ.mjs.map +1 -0
- package/dist/constants.d.ts +32 -2
- package/dist/constants.mjs +14 -29
- package/dist/constants.mjs.map +1 -1
- package/dist/errors.d.ts +2 -92
- package/dist/errors.mjs +14 -92
- package/dist/errors.mjs.map +1 -1
- package/dist/fiscal-evidence-BQuBbJ3h.d.ts +189 -0
- package/dist/{index-3fdgJ3c2.d.ts → index-CVpygFb0.d.ts} +1 -1
- package/dist/index.d.ts +15 -8
- package/dist/index.mjs +269 -1878
- package/dist/index.mjs.map +1 -1
- package/dist/padron.d.ts +2 -2
- package/dist/padron.mjs +4 -117
- package/dist/padron.mjs.map +1 -1
- package/dist/{types-Cup-oevW.d.ts → types-BXq0da71.d.ts} +1 -1
- package/dist/types.d.ts +1 -1
- package/dist/wsfe.d.ts +48 -7
- package/dist/wsfe.mjs +10 -1007
- package/dist/wsfe.mjs.map +1 -1
- package/dist/wsmtxca.d.ts +3 -3
- package/dist/wsmtxca.mjs +5 -641
- package/dist/wsmtxca.mjs.map +1 -1
- package/package.json +2 -2
- package/dist/fiscal-evidence-DbbFH74x.d.ts +0 -69
|
@@ -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 createArcaAuthenticationErrorFromEvidence,\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};\n\n/** Result of a successful WSMTXCA voucher authorization. */\nexport type WsmtxcaAuthorizationResult = {\n cae: string;\n caeExpiry?: string;\n voucherNumber: number;\n messages: string[];\n raw: Record<string, unknown>;\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 /** Attempts one authorization without transport retries and returns provider evidence. */\n authorizeVoucherOutcome(\n input: WsmtxcaAuthorizeVoucherInput\n ): Promise<WsmtxcaAuthorizationOutcome>;\n /** Authorizes a voucher and returns the CAE. */\n authorizeVoucher(\n input: WsmtxcaAuthorizeVoucherInput\n ): Promise<WsmtxcaAuthorizationResult>;\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 }): 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 }): 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 },\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 });\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 bodyElementName: `${operation}Request`,\n bodyElementNamespaceMode: \"prefix\",\n body: {\n ...body,\n authRequest: createWsmtxcaAuth(\n input.representedTaxId ?? options.config.taxId,\n auth.token,\n auth.sign\n ),\n },\n });\n\n return unwrapWsmtxcaOperationResponse(response.result, operation);\n }\n\n async function executeWsmtxcaAuthorization({\n representedTaxId,\n data,\n forceRefresh,\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 },\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 authorizeVoucherOutcome(\n input: WsmtxcaAuthorizeVoucherInput\n ): Promise<WsmtxcaAuthorizationOutcome> {\n return (await executeWsmtxcaAuthorization(input)).outcome;\n }\n\n function authorizeVoucher(\n input: WsmtxcaAuthorizeVoucherInput\n ): Promise<WsmtxcaAuthorizationResult> {\n return executeWithAuthenticationRecovery({\n service: \"wsmtxca\",\n operation: \"autorizarComprobante\",\n forceRefresh: input.forceRefresh,\n execute: (forceRefresh) =>\n authorizeVoucherOnce({ ...input, forceRefresh }),\n });\n }\n\n async function authorizeVoucherOnce(\n input: WsmtxcaAuthorizeVoucherInput\n ): Promise<WsmtxcaAuthorizationResult> {\n const execution = await executeWsmtxcaAuthorization(input);\n if (execution.error) {\n throw execution.error;\n }\n if (execution.outcome.kind !== \"authorized\") {\n throw createWsmtxcaOutcomeError(execution.outcome);\n }\n\n const { outcome } = execution;\n return {\n cae: outcome.cae,\n ...(outcome.caeExpiry === undefined\n ? {}\n : { caeExpiry: outcome.caeExpiry }),\n voucherNumber: outcome.voucherNumber,\n messages: formatWsmtxcaIssues([\n ...outcome.errors,\n ...outcome.observations,\n ]),\n raw: outcome.raw ?? {},\n };\n }\n\n function getLastAuthorizedVoucher({\n representedTaxId,\n voucherType,\n salesPoint,\n forceRefresh,\n }: {\n representedTaxId?: ArcaRepresentedTaxId;\n voucherType: number;\n salesPoint: number;\n forceRefresh?: boolean;\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 }),\n });\n }\n\n async function getLastAuthorizedVoucherOnce({\n representedTaxId,\n voucherType,\n salesPoint,\n forceRefresh,\n }: {\n representedTaxId?: ArcaRepresentedTaxId;\n voucherType: number;\n salesPoint: number;\n forceRefresh?: boolean;\n }): Promise<WsmtxcaLastAuthorizedVoucherResult> {\n const operation = \"consultarUltimoComprobanteAutorizado\";\n const raw = await executeWsmtxcaAuthenticatedOperation(\n operation,\n { representedTaxId, forceRefresh },\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 }: {\n representedTaxId?: ArcaRepresentedTaxId;\n voucherType: number;\n salesPoint: number;\n voucherNumber: number;\n forceRefresh?: boolean;\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 }),\n });\n }\n\n async function lookupVoucherOnce({\n representedTaxId,\n voucherType,\n salesPoint,\n voucherNumber,\n forceRefresh,\n }: {\n representedTaxId?: ArcaRepresentedTaxId;\n voucherType: number;\n salesPoint: number;\n voucherNumber: number;\n forceRefresh?: boolean;\n }): Promise<WsmtxcaVoucherLookupOutcome> {\n const operation = \"consultarComprobante\";\n const raw = await executeWsmtxcaAuthenticatedOperation(\n operation,\n { representedTaxId, forceRefresh },\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 authorizeVoucherOutcome,\n authorizeVoucher,\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 createWsmtxcaOutcomeError(\n outcome: Exclude<WsmtxcaAuthorizationOutcome, { kind: \"authorized\" }>\n) {\n if (outcome.kind === \"indeterminate\" && outcome.authentication) {\n return createArcaAuthenticationErrorFromEvidence(outcome.authentication, {\n service: \"wsmtxca\",\n operation: outcome.operation,\n });\n }\n\n const issues = [...outcome.errors, ...outcome.observations];\n const messages = formatWsmtxcaIssues(issues);\n const firstIssue = issues[0];\n return new ArcaServiceError(\n messages.join(\" | \") ||\n (outcome.kind === \"rejected\"\n ? \"WSMTXCA rejected the voucher authorization\"\n : \"WSMTXCA did not return conclusive voucher authorization data\"),\n {\n service: \"wsmtxca\",\n operation: outcome.operation,\n ...(firstIssue?.code === undefined\n ? {}\n : { serviceCode: firstIssue.code }),\n ...(outcome.result === undefined ? {} : { result: outcome.result }),\n ...(outcome.resultLevel === undefined\n ? {}\n : { resultLevel: outcome.resultLevel }),\n results: outcome.results,\n ...(outcome.kind === \"indeterminate\" && outcome.cae\n ? { cae: outcome.cae }\n : {}),\n issues,\n }\n );\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 assignWsmtxcaValue(\n voucher,\n \"taxAmount\",\n parseOptionalNumber(raw.importeOtrosTributos)\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":";;;;;;;;;;;;;;;;AAmJO,SAAS,qBACd,SACgB;AAChB,iBAAe,qCACb,WACA,OAIA,OAAgC,CAAC,GACjC,SACA;AACA,UAAM,OAAO,MAAM,QAAQ,KAAK,MAAM,WAAW;AAAA,MAC/C,kBAAkB,MAAM;AAAA,MACxB,cA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+
MONOTRIBUTISTA: 6,
|
|
23
|
+
IVA_NO_ALCANZADO: 15
|
|
24
|
+
};
|
|
25
|
+
var ARCA_CONCEPT_TYPES = {
|
|
26
|
+
PRODUCTOS: 1,
|
|
27
|
+
SERVICIOS: 2,
|
|
28
|
+
PRODUCTOS_Y_SERVICIOS: 3
|
|
29
|
+
};
|
|
30
|
+
var ARCA_VAT_RATES = {
|
|
31
|
+
IVA_0: 3,
|
|
32
|
+
IVA_10_5: 4,
|
|
33
|
+
IVA_21: 5,
|
|
34
|
+
IVA_27: 6,
|
|
35
|
+
IVA_5: 8,
|
|
36
|
+
IVA_2_5: 9
|
|
37
|
+
};
|
|
38
|
+
var ISO_CURRENCIES = {
|
|
39
|
+
ARS: "ARS",
|
|
40
|
+
USD: "USD"
|
|
41
|
+
};
|
|
42
|
+
var ARCA_CURRENCY_IDS = {
|
|
43
|
+
ARS: "PES",
|
|
44
|
+
USD: "DOL"
|
|
45
|
+
};
|
|
46
|
+
var ARCA_CURRENCIES = {
|
|
47
|
+
PES: "PES",
|
|
48
|
+
DOL: "DOL"
|
|
49
|
+
};
|
|
50
|
+
|
|
51
|
+
export {
|
|
52
|
+
ARCA_VOUCHER_TYPES,
|
|
53
|
+
ARCA_DOCUMENT_TYPES,
|
|
54
|
+
ARCA_RECEIVER_VAT_CONDITIONS,
|
|
55
|
+
ARCA_CONCEPT_TYPES,
|
|
56
|
+
ARCA_VAT_RATES,
|
|
57
|
+
ISO_CURRENCIES,
|
|
58
|
+
ARCA_CURRENCY_IDS,
|
|
59
|
+
ARCA_CURRENCIES
|
|
60
|
+
};
|
|
61
|
+
//# sourceMappingURL=chunk-VVY2LZIZ.mjs.map
|
|
@@ -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 for builders or ARCA_CURRENCY_IDS at the exact provider boundary.\n */\nexport const ARCA_CURRENCIES = {\n PES: \"PES\",\n DOL: \"DOL\",\n} as const;\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;","names":[]}
|
package/dist/constants.d.ts
CHANGED
|
@@ -6,11 +6,26 @@ declare const ARCA_VOUCHER_TYPES: {
|
|
|
6
6
|
readonly FACTURA_B: 6;
|
|
7
7
|
readonly NOTA_DEBITO_B: 7;
|
|
8
8
|
readonly NOTA_CREDITO_B: 8;
|
|
9
|
+
readonly FACTURA_C: 11;
|
|
10
|
+
readonly NOTA_DEBITO_C: 12;
|
|
11
|
+
readonly NOTA_CREDITO_C: 13;
|
|
9
12
|
};
|
|
10
13
|
/** Common document types accepted by ARCA services. */
|
|
11
14
|
declare const ARCA_DOCUMENT_TYPES: {
|
|
12
15
|
readonly CUIT: 80;
|
|
13
16
|
readonly DNI: 96;
|
|
17
|
+
readonly CONSUMIDOR_FINAL: 99;
|
|
18
|
+
};
|
|
19
|
+
/**
|
|
20
|
+
* Common receiver IVA condition identifiers used by WSFE.
|
|
21
|
+
* Allowed values depend on the voucher class and ARCA's live catalog.
|
|
22
|
+
*/
|
|
23
|
+
declare const ARCA_RECEIVER_VAT_CONDITIONS: {
|
|
24
|
+
readonly RESPONSABLE_INSCRIPTO: 1;
|
|
25
|
+
readonly EXENTO: 4;
|
|
26
|
+
readonly CONSUMIDOR_FINAL: 5;
|
|
27
|
+
readonly MONOTRIBUTISTA: 6;
|
|
28
|
+
readonly IVA_NO_ALCANZADO: 15;
|
|
14
29
|
};
|
|
15
30
|
/** Supported invoice concept types for WSFE requests. */
|
|
16
31
|
declare const ARCA_CONCEPT_TYPES: {
|
|
@@ -24,11 +39,26 @@ declare const ARCA_VAT_RATES: {
|
|
|
24
39
|
readonly IVA_10_5: 4;
|
|
25
40
|
readonly IVA_21: 5;
|
|
26
41
|
readonly IVA_27: 6;
|
|
42
|
+
readonly IVA_5: 8;
|
|
43
|
+
readonly IVA_2_5: 9;
|
|
44
|
+
};
|
|
45
|
+
/** ISO currency codes accepted by the high-level WSFE builders. */
|
|
46
|
+
declare const ISO_CURRENCIES: {
|
|
47
|
+
readonly ARS: "ARS";
|
|
48
|
+
readonly USD: "USD";
|
|
49
|
+
};
|
|
50
|
+
/** ARCA currency identifiers keyed by their corresponding ISO currency. */
|
|
51
|
+
declare const ARCA_CURRENCY_IDS: {
|
|
52
|
+
readonly ARS: "PES";
|
|
53
|
+
readonly USD: "DOL";
|
|
27
54
|
};
|
|
28
|
-
/**
|
|
55
|
+
/**
|
|
56
|
+
* Common ARCA currency identifiers.
|
|
57
|
+
* @deprecated Use ISO_CURRENCIES for builders or ARCA_CURRENCY_IDS at the exact provider boundary.
|
|
58
|
+
*/
|
|
29
59
|
declare const ARCA_CURRENCIES: {
|
|
30
60
|
readonly PES: "PES";
|
|
31
61
|
readonly DOL: "DOL";
|
|
32
62
|
};
|
|
33
63
|
|
|
34
|
-
export { ARCA_CONCEPT_TYPES, ARCA_CURRENCIES, ARCA_DOCUMENT_TYPES, ARCA_VAT_RATES, ARCA_VOUCHER_TYPES };
|
|
64
|
+
export { ARCA_CONCEPT_TYPES, ARCA_CURRENCIES, ARCA_CURRENCY_IDS, ARCA_DOCUMENT_TYPES, ARCA_RECEIVER_VAT_CONDITIONS, ARCA_VAT_RATES, ARCA_VOUCHER_TYPES, ISO_CURRENCIES };
|
package/dist/constants.mjs
CHANGED
|
@@ -1,36 +1,21 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
CUIT: 80,
|
|
12
|
-
DNI: 96
|
|
13
|
-
};
|
|
14
|
-
var ARCA_CONCEPT_TYPES = {
|
|
15
|
-
PRODUCTOS: 1,
|
|
16
|
-
SERVICIOS: 2,
|
|
17
|
-
PRODUCTOS_Y_SERVICIOS: 3
|
|
18
|
-
};
|
|
19
|
-
var ARCA_VAT_RATES = {
|
|
20
|
-
IVA_0: 3,
|
|
21
|
-
IVA_10_5: 4,
|
|
22
|
-
IVA_21: 5,
|
|
23
|
-
IVA_27: 6
|
|
24
|
-
};
|
|
25
|
-
var ARCA_CURRENCIES = {
|
|
26
|
-
PES: "PES",
|
|
27
|
-
DOL: "DOL"
|
|
28
|
-
};
|
|
1
|
+
import {
|
|
2
|
+
ARCA_CONCEPT_TYPES,
|
|
3
|
+
ARCA_CURRENCIES,
|
|
4
|
+
ARCA_CURRENCY_IDS,
|
|
5
|
+
ARCA_DOCUMENT_TYPES,
|
|
6
|
+
ARCA_RECEIVER_VAT_CONDITIONS,
|
|
7
|
+
ARCA_VAT_RATES,
|
|
8
|
+
ARCA_VOUCHER_TYPES,
|
|
9
|
+
ISO_CURRENCIES
|
|
10
|
+
} from "./chunk-VVY2LZIZ.mjs";
|
|
29
11
|
export {
|
|
30
12
|
ARCA_CONCEPT_TYPES,
|
|
31
13
|
ARCA_CURRENCIES,
|
|
14
|
+
ARCA_CURRENCY_IDS,
|
|
32
15
|
ARCA_DOCUMENT_TYPES,
|
|
16
|
+
ARCA_RECEIVER_VAT_CONDITIONS,
|
|
33
17
|
ARCA_VAT_RATES,
|
|
34
|
-
ARCA_VOUCHER_TYPES
|
|
18
|
+
ARCA_VOUCHER_TYPES,
|
|
19
|
+
ISO_CURRENCIES
|
|
35
20
|
};
|
|
36
21
|
//# sourceMappingURL=constants.mjs.map
|
package/dist/constants.mjs.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":[
|
|
1
|
+
{"version":3,"sources":[],"sourcesContent":[],"mappings":"","names":[]}
|
package/dist/errors.d.ts
CHANGED
|
@@ -1,92 +1,2 @@
|
|
|
1
|
-
import
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
/** Base error class for all ARCA-related errors. */
|
|
5
|
-
declare class ArcaError extends Error {
|
|
6
|
-
readonly code: string;
|
|
7
|
-
readonly name: string;
|
|
8
|
-
constructor(message: string, code?: string, options?: ErrorOptions);
|
|
9
|
-
}
|
|
10
|
-
/** Thrown when the ARCA client configuration is missing or invalid. */
|
|
11
|
-
declare class ArcaConfigurationError extends ArcaError {
|
|
12
|
-
readonly name: string;
|
|
13
|
-
constructor(message: string, options?: ErrorOptions);
|
|
14
|
-
}
|
|
15
|
-
/** Thrown when caller-provided input data is missing or invalid. */
|
|
16
|
-
declare class ArcaInputError extends ArcaError {
|
|
17
|
-
readonly name: string;
|
|
18
|
-
readonly detail?: unknown;
|
|
19
|
-
constructor(message: string, options?: ErrorOptions & {
|
|
20
|
-
detail?: unknown;
|
|
21
|
-
});
|
|
22
|
-
}
|
|
23
|
-
/** Thrown when an HTTP request to an ARCA endpoint fails at the transport level. */
|
|
24
|
-
declare class ArcaTransportError extends ArcaError {
|
|
25
|
-
readonly name: string;
|
|
26
|
-
readonly statusCode?: number;
|
|
27
|
-
readonly contentType?: string;
|
|
28
|
-
readonly responseBody?: string;
|
|
29
|
-
constructor(message: string, options?: ErrorOptions & {
|
|
30
|
-
statusCode?: number;
|
|
31
|
-
contentType?: string;
|
|
32
|
-
responseBody?: string;
|
|
33
|
-
});
|
|
34
|
-
}
|
|
35
|
-
/** Thrown when the SOAP response contains a Fault element. */
|
|
36
|
-
declare class ArcaSoapFaultError extends ArcaError {
|
|
37
|
-
readonly name: string;
|
|
38
|
-
readonly faultCode?: string;
|
|
39
|
-
readonly detail?: unknown;
|
|
40
|
-
constructor(message: string, options?: ErrorOptions & {
|
|
41
|
-
faultCode?: string;
|
|
42
|
-
detail?: unknown;
|
|
43
|
-
});
|
|
44
|
-
}
|
|
45
|
-
/** Thrown when a response cannot be parsed as a valid SOAP envelope. */
|
|
46
|
-
declare class ArcaInvalidSoapResponseError extends ArcaError {
|
|
47
|
-
readonly name: string;
|
|
48
|
-
readonly service?: ArcaServiceName;
|
|
49
|
-
readonly operation?: string;
|
|
50
|
-
readonly endpointUrl?: string;
|
|
51
|
-
readonly statusCode?: number;
|
|
52
|
-
readonly contentType?: string;
|
|
53
|
-
readonly responseBodyLength?: number;
|
|
54
|
-
readonly responseBodyPreview?: string;
|
|
55
|
-
readonly parsedDetail?: unknown;
|
|
56
|
-
constructor(message: string, options?: ErrorOptions & {
|
|
57
|
-
service?: ArcaServiceName;
|
|
58
|
-
operation?: string;
|
|
59
|
-
endpointUrl?: string;
|
|
60
|
-
statusCode?: number;
|
|
61
|
-
contentType?: string;
|
|
62
|
-
responseBodyLength?: number;
|
|
63
|
-
responseBodyPreview?: string;
|
|
64
|
-
parsedDetail?: unknown;
|
|
65
|
-
});
|
|
66
|
-
}
|
|
67
|
-
/** Thrown when an ARCA service (WSFE, WSMTXCA, Padron) returns a domain-level error. */
|
|
68
|
-
declare class ArcaServiceError extends ArcaError {
|
|
69
|
-
readonly name: string;
|
|
70
|
-
readonly serviceCode?: string | number;
|
|
71
|
-
readonly service?: ArcaServiceName;
|
|
72
|
-
readonly operation?: string;
|
|
73
|
-
readonly result?: string;
|
|
74
|
-
readonly resultLevel?: ArcaFiscalResultLevel;
|
|
75
|
-
readonly results?: ArcaFiscalResults;
|
|
76
|
-
readonly cae?: string;
|
|
77
|
-
readonly issues?: readonly ArcaFiscalIssue[];
|
|
78
|
-
readonly detail?: unknown;
|
|
79
|
-
constructor(message: string, options?: ErrorOptions & {
|
|
80
|
-
serviceCode?: string | number;
|
|
81
|
-
service?: ArcaServiceName;
|
|
82
|
-
operation?: string;
|
|
83
|
-
result?: string;
|
|
84
|
-
resultLevel?: ArcaFiscalResultLevel;
|
|
85
|
-
results?: ArcaFiscalResults;
|
|
86
|
-
cae?: string;
|
|
87
|
-
issues?: readonly ArcaFiscalIssue[];
|
|
88
|
-
detail?: unknown;
|
|
89
|
-
});
|
|
90
|
-
}
|
|
91
|
-
|
|
92
|
-
export { ArcaConfigurationError, ArcaError, ArcaInputError, ArcaInvalidSoapResponseError, ArcaServiceError, ArcaSoapFaultError, ArcaTransportError };
|
|
1
|
+
import './types-BXq0da71.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 ArcaServiceError, q as ArcaSoapFaultError, r as ArcaTransportError, t as isArcaAuthenticationError } from './fiscal-evidence-BQuBbJ3h.js';
|
package/dist/errors.mjs
CHANGED
|
@@ -1,101 +1,23 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
constructor(message, options) {
|
|
13
|
-
super(message, "ARCA_CONFIGURATION_ERROR", options);
|
|
14
|
-
}
|
|
15
|
-
};
|
|
16
|
-
var ArcaInputError = class extends ArcaError {
|
|
17
|
-
name = "ArcaInputError";
|
|
18
|
-
detail;
|
|
19
|
-
constructor(message, options) {
|
|
20
|
-
super(message, "ARCA_INPUT_ERROR", options);
|
|
21
|
-
this.detail = options?.detail;
|
|
22
|
-
}
|
|
23
|
-
};
|
|
24
|
-
var ArcaTransportError = class extends ArcaError {
|
|
25
|
-
name = "ArcaTransportError";
|
|
26
|
-
statusCode;
|
|
27
|
-
contentType;
|
|
28
|
-
responseBody;
|
|
29
|
-
constructor(message, options) {
|
|
30
|
-
super(message, "ARCA_TRANSPORT_ERROR", options);
|
|
31
|
-
this.statusCode = options?.statusCode;
|
|
32
|
-
this.contentType = options?.contentType;
|
|
33
|
-
this.responseBody = options?.responseBody;
|
|
34
|
-
}
|
|
35
|
-
};
|
|
36
|
-
var ArcaSoapFaultError = class extends ArcaError {
|
|
37
|
-
name = "ArcaSoapFaultError";
|
|
38
|
-
faultCode;
|
|
39
|
-
detail;
|
|
40
|
-
constructor(message, options) {
|
|
41
|
-
super(message, "ARCA_SOAP_FAULT", options);
|
|
42
|
-
this.faultCode = options?.faultCode;
|
|
43
|
-
this.detail = options?.detail;
|
|
44
|
-
}
|
|
45
|
-
};
|
|
46
|
-
var ArcaInvalidSoapResponseError = class extends ArcaError {
|
|
47
|
-
name = "ArcaInvalidSoapResponseError";
|
|
48
|
-
service;
|
|
49
|
-
operation;
|
|
50
|
-
endpointUrl;
|
|
51
|
-
statusCode;
|
|
52
|
-
contentType;
|
|
53
|
-
responseBodyLength;
|
|
54
|
-
responseBodyPreview;
|
|
55
|
-
parsedDetail;
|
|
56
|
-
constructor(message, options) {
|
|
57
|
-
super(message, "ARCA_INVALID_SOAP_RESPONSE", options);
|
|
58
|
-
this.service = options?.service;
|
|
59
|
-
this.operation = options?.operation;
|
|
60
|
-
this.endpointUrl = options?.endpointUrl;
|
|
61
|
-
this.statusCode = options?.statusCode;
|
|
62
|
-
this.contentType = options?.contentType;
|
|
63
|
-
this.responseBodyLength = options?.responseBodyLength;
|
|
64
|
-
this.responseBodyPreview = options?.responseBodyPreview;
|
|
65
|
-
this.parsedDetail = options?.parsedDetail;
|
|
66
|
-
}
|
|
67
|
-
};
|
|
68
|
-
var ArcaServiceError = class extends ArcaError {
|
|
69
|
-
name = "ArcaServiceError";
|
|
70
|
-
serviceCode;
|
|
71
|
-
service;
|
|
72
|
-
operation;
|
|
73
|
-
result;
|
|
74
|
-
resultLevel;
|
|
75
|
-
results;
|
|
76
|
-
cae;
|
|
77
|
-
issues;
|
|
78
|
-
detail;
|
|
79
|
-
constructor(message, options) {
|
|
80
|
-
super(message, "ARCA_SERVICE_ERROR", options);
|
|
81
|
-
this.serviceCode = options?.serviceCode;
|
|
82
|
-
this.service = options?.service;
|
|
83
|
-
this.operation = options?.operation;
|
|
84
|
-
this.result = options?.result;
|
|
85
|
-
this.resultLevel = options?.resultLevel;
|
|
86
|
-
this.results = options?.results;
|
|
87
|
-
this.cae = options?.cae;
|
|
88
|
-
this.issues = options?.issues;
|
|
89
|
-
this.detail = options?.detail;
|
|
90
|
-
}
|
|
91
|
-
};
|
|
1
|
+
import {
|
|
2
|
+
ArcaAuthenticationError,
|
|
3
|
+
ArcaConfigurationError,
|
|
4
|
+
ArcaError,
|
|
5
|
+
ArcaInputError,
|
|
6
|
+
ArcaInvalidSoapResponseError,
|
|
7
|
+
ArcaServiceError,
|
|
8
|
+
ArcaSoapFaultError,
|
|
9
|
+
ArcaTransportError,
|
|
10
|
+
isArcaAuthenticationError
|
|
11
|
+
} from "./chunk-MBWOFO67.mjs";
|
|
92
12
|
export {
|
|
13
|
+
ArcaAuthenticationError,
|
|
93
14
|
ArcaConfigurationError,
|
|
94
15
|
ArcaError,
|
|
95
16
|
ArcaInputError,
|
|
96
17
|
ArcaInvalidSoapResponseError,
|
|
97
18
|
ArcaServiceError,
|
|
98
19
|
ArcaSoapFaultError,
|
|
99
|
-
ArcaTransportError
|
|
20
|
+
ArcaTransportError,
|
|
21
|
+
isArcaAuthenticationError
|
|
100
22
|
};
|
|
101
23
|
//# sourceMappingURL=errors.mjs.map
|
package/dist/errors.mjs.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":[
|
|
1
|
+
{"version":3,"sources":[],"sourcesContent":[],"mappings":"","names":[]}
|