facturas 0.5.2 → 0.6.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 +2 -0
- package/dist/errors.d.ts +16 -1
- package/dist/errors.mjs +14 -0
- package/dist/errors.mjs.map +1 -1
- package/dist/fiscal-evidence-DbbFH74x.d.ts +69 -0
- package/dist/{index-CqXVyU0E.d.ts → index-3fdgJ3c2.d.ts} +1 -1
- package/dist/index.d.ts +6 -5
- package/dist/index.mjs +919 -265
- package/dist/index.mjs.map +1 -1
- package/dist/padron.d.ts +2 -2
- package/dist/padron.mjs.map +1 -1
- package/dist/{types-CKKe1Oo4.d.ts → types-Cup-oevW.d.ts} +2 -0
- package/dist/types.d.ts +1 -1
- package/dist/wsfe.d.ts +32 -3
- package/dist/wsfe.mjs +477 -108
- package/dist/wsfe.mjs.map +1 -1
- package/dist/wsmtxca.d.ts +64 -8
- package/dist/wsmtxca.mjs +543 -156
- package/dist/wsmtxca.mjs.map +1 -1
- package/package.json +1 -1
package/dist/padron.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { f as ArcaClientConfig } from './types-
|
|
2
|
-
import { W as WsaaAuthModule, S as SoapTransport } from './index-
|
|
1
|
+
import { f as ArcaClientConfig } from './types-Cup-oevW.js';
|
|
2
|
+
import { W as WsaaAuthModule, S as SoapTransport } from './index-3fdgJ3c2.js';
|
|
3
3
|
|
|
4
4
|
/** Result of a taxpayer lookup via Padron A5. */
|
|
5
5
|
type PadronTaxpayerResult = {
|
package/dist/padron.mjs.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/errors.ts","../src/services/padron.ts"],"sourcesContent":["import type { ArcaServiceName } from \"./internal/types\";\n\n/** Base error class for all ARCA-related errors. */\nexport class ArcaError extends Error {\n readonly code: string;\n override readonly name: string = \"ArcaError\";\n\n constructor(message: string, code = \"ARCA_ERROR\", options?: ErrorOptions) {\n super(message, options);\n this.code = code;\n }\n}\n\n/** Thrown when the ARCA client configuration is missing or invalid. */\nexport class ArcaConfigurationError extends ArcaError {\n override readonly name: string = \"ArcaConfigurationError\";\n\n constructor(message: string, options?: ErrorOptions) {\n super(message, \"ARCA_CONFIGURATION_ERROR\", options);\n }\n}\n\n/** Thrown when caller-provided input data is missing or invalid. */\nexport class ArcaInputError extends ArcaError {\n override readonly name: string = \"ArcaInputError\";\n readonly detail?: unknown;\n\n constructor(\n message: string,\n options?: ErrorOptions & {\n detail?: unknown;\n }\n ) {\n super(message, \"ARCA_INPUT_ERROR\", options);\n this.detail = options?.detail;\n }\n}\n\n/** Thrown when an HTTP request to an ARCA endpoint fails at the transport level. */\nexport class ArcaTransportError extends ArcaError {\n override readonly name: string = \"ArcaTransportError\";\n readonly statusCode?: number;\n readonly contentType?: string;\n readonly responseBody?: string;\n\n constructor(\n message: string,\n options?: ErrorOptions & {\n statusCode?: number;\n contentType?: string;\n responseBody?: string;\n }\n ) {\n super(message, \"ARCA_TRANSPORT_ERROR\", options);\n this.statusCode = options?.statusCode;\n this.contentType = options?.contentType;\n this.responseBody = options?.responseBody;\n }\n}\n\n/** Thrown when the SOAP response contains a Fault element. */\nexport class ArcaSoapFaultError extends ArcaError {\n override readonly name: string = \"ArcaSoapFaultError\";\n readonly faultCode?: string;\n readonly detail?: unknown;\n\n constructor(\n message: string,\n options?: ErrorOptions & {\n faultCode?: string;\n detail?: unknown;\n }\n ) {\n super(message, \"ARCA_SOAP_FAULT\", options);\n this.faultCode = options?.faultCode;\n this.detail = options?.detail;\n }\n}\n\n/** Thrown when a response cannot be parsed as a valid SOAP envelope. */\nexport class ArcaInvalidSoapResponseError extends ArcaError {\n override readonly name: string = \"ArcaInvalidSoapResponseError\";\n readonly service?: ArcaServiceName;\n readonly operation?: string;\n readonly endpointUrl?: string;\n readonly statusCode?: number;\n readonly contentType?: string;\n readonly responseBodyLength?: number;\n readonly responseBodyPreview?: string;\n readonly parsedDetail?: unknown;\n\n constructor(\n message: string,\n options?: ErrorOptions & {\n service?: ArcaServiceName;\n operation?: string;\n endpointUrl?: string;\n statusCode?: number;\n contentType?: string;\n responseBodyLength?: number;\n responseBodyPreview?: string;\n parsedDetail?: unknown;\n }\n ) {\n super(message, \"ARCA_INVALID_SOAP_RESPONSE\", options);\n this.service = options?.service;\n this.operation = options?.operation;\n this.endpointUrl = options?.endpointUrl;\n this.statusCode = options?.statusCode;\n this.contentType = options?.contentType;\n this.responseBodyLength = options?.responseBodyLength;\n this.responseBodyPreview = options?.responseBodyPreview;\n this.parsedDetail = options?.parsedDetail;\n }\n}\n\n/** Thrown when an ARCA service (WSFE, WSMTXCA, Padron) returns a domain-level error. */\nexport class ArcaServiceError extends ArcaError {\n override readonly name: string = \"ArcaServiceError\";\n readonly serviceCode?: string | number;\n readonly detail?: unknown;\n\n constructor(\n message: string,\n options?: ErrorOptions & {\n serviceCode?: string | number;\n detail?: unknown;\n }\n ) {\n super(message, \"ARCA_SERVICE_ERROR\", options);\n this.serviceCode = options?.serviceCode;\n this.detail = options?.detail;\n }\n}\n","import { ArcaSoapFaultError } from \"../errors\";\nimport type {\n ArcaClientConfig,\n ArcaPadronServiceName,\n} from \"../internal/types\";\nimport type { SoapTransport } from \"../soap\";\nimport type { WsaaAuthModule } from \"../wsaa\";\n\n/** Result of a taxpayer lookup via Padron A5. */\nexport type PadronTaxpayerResult = {\n taxId: string;\n personType?: string;\n name?: string;\n raw: Record<string, unknown>;\n};\n\n/** Result of a tax ID lookup by document number via Padron A13. */\nexport type PadronTaxIdLookupResult = {\n taxIds: string[];\n raw: Record<string, unknown>;\n};\n\n/** Padron taxpayer registry service. */\nexport type PadronService = {\n /** Looks up taxpayer details by CUIT. Returns `null` if the taxpayer does not exist. */\n getTaxpayerDetails(\n taxId: number | string\n ): Promise<PadronTaxpayerResult | null>;\n /** Looks up CUITs associated with a document number. Returns `null` if not found. */\n getTaxIdByDocument(\n documentNumber: number | string\n ): Promise<PadronTaxIdLookupResult | null>;\n};\n\nexport type CreatePadronServiceOptions = {\n config: ArcaClientConfig;\n auth: WsaaAuthModule;\n soap: SoapTransport;\n};\n\n/** Creates a Padron service instance wired with authentication and SOAP transport. */\nexport function createPadronService(\n options: CreatePadronServiceOptions\n): PadronService {\n return {\n async getTaxpayerDetails(taxId) {\n const raw = await executePadronOperation(\n options,\n \"padron-a5\",\n \"getPersona_v2\",\n {\n idPersona: Number.parseInt(String(taxId), 10),\n }\n );\n if (!raw) {\n return null;\n }\n const record = raw as Record<string, unknown>;\n const datosGenerales = record.datosGenerales as\n | Record<string, unknown>\n | undefined;\n return {\n taxId: String(record.idPersona ?? \"\"),\n ...(record.tipoPersona === undefined\n ? {}\n : { personType: String(record.tipoPersona) }),\n ...(datosGenerales ? { name: extractPadronName(datosGenerales) } : {}),\n raw: record,\n };\n },\n async getTaxIdByDocument(documentNumber) {\n const raw = await executePadronOperation(\n options,\n \"padron-a13\",\n \"getIdPersonaListByDocumento\",\n {\n documento: String(documentNumber),\n }\n );\n if (!raw) {\n return null;\n }\n const record = raw as Record<string, unknown>;\n const idPersona = record.idPersona;\n const taxIds = Array.isArray(idPersona)\n ? idPersona.map(String)\n : idPersona === undefined\n ? []\n : [String(idPersona)];\n return {\n taxIds,\n raw: record,\n };\n },\n };\n}\n\nfunction extractPadronName(\n datosGenerales: Record<string, unknown>\n): string | undefined {\n if (typeof datosGenerales.razonSocial === \"string\") {\n return datosGenerales.razonSocial;\n }\n const nombre = datosGenerales.nombre;\n const apellido = datosGenerales.apellido;\n if (typeof apellido === \"string\" && typeof nombre === \"string\") {\n return `${apellido} ${nombre}`.trim();\n }\n if (typeof apellido === \"string\") {\n return apellido;\n }\n if (typeof nombre === \"string\") {\n return nombre;\n }\n return undefined;\n}\n\nasync function executePadronOperation(\n options: CreatePadronServiceOptions,\n service: ArcaPadronServiceName,\n operation: string,\n body: Record<string, unknown>\n) {\n const auth = await options.auth.login(\n service === \"padron-a5\"\n ? \"ws_sr_constancia_inscripcion\"\n : \"ws_sr_padron_a13\"\n );\n\n try {\n const response = await options.soap.execute<\n Record<string, unknown>,\n Record<string, unknown>\n >({\n service,\n operation,\n bodyElementNamespaceMode: \"prefix\",\n body: {\n token: auth.token,\n sign: auth.sign,\n cuitRepresentada: Number.parseInt(options.config.taxId, 10),\n ...body,\n },\n });\n\n const operationResponse = response.result as Record<string, unknown>;\n\n if (operation === \"getPersona_v2\") {\n return operationResponse.personaReturn ?? null;\n }\n\n if (operation === \"getIdPersonaListByDocumento\") {\n return operationResponse.idPersonaListReturn ?? null;\n }\n\n return operationResponse.return ?? null;\n } catch (error) {\n if (\n error instanceof ArcaSoapFaultError &&\n // Public Padron A5/A13 WSDLs expose only a generic validation fault, so\n // there is no documented not-found-specific fault code to match here.\n // Keep the current message fallback, but treat it as fragile.\n error.message.toLowerCase().includes(\"no existe\")\n ) {\n return null;\n }\n\n throw error;\n }\n}\n"],"mappings":";AAGO,IAAM,YAAN,cAAwB,MAAM;AAAA,EAC1B;AAAA,EACS,OAAe;AAAA,EAEjC,YAAY,SAAiB,OAAO,cAAc,SAAwB;AACxE,UAAM,SAAS,OAAO;AACtB,SAAK,OAAO;AAAA,EACd;AACF;AAkDO,IAAM,qBAAN,cAAiC,UAAU;AAAA,EAC9B,OAAe;AAAA,EACxB;AAAA,EACA;AAAA,EAET,YACE,SACA,SAIA;AACA,UAAM,SAAS,mBAAmB,OAAO;AACzC,SAAK,YAAY,SAAS;AAC1B,SAAK,SAAS,SAAS;AAAA,EACzB;AACF;;;ACpCO,SAAS,oBACd,SACe;AACf,SAAO;AAAA,IACL,MAAM,mBAAmB,OAAO;AAC9B,YAAM,MAAM,MAAM;AAAA,QAChB;AAAA,QACA;AAAA,QACA;AAAA,QACA;AAAA,UACE,WAAW,OAAO,SAAS,OAAO,KAAK,GAAG,EAAE;AAAA,QAC9C;AAAA,MACF;AACA,UAAI,CAAC,KAAK;AACR,eAAO;AAAA,MACT;AACA,YAAM,SAAS;AACf,YAAM,iBAAiB,OAAO;AAG9B,aAAO;AAAA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,MACA,0BAA0B;AAAA,MAC1B,MAAM;AAAA,QACJ,OAAO,KAAK;AAAA,QACZ,MAAM,KAAK;AAAA,QACX,kBAAkB,OAAO,SAAS,QAAQ,OAAO,OAAO,EAAE;AAAA,QAC1D,GAAG;AAAA,MACL;AAAA,IACF,CAAC;AAED,UAAM,oBAAoB,SAAS;AAEnC,QAAI,cAAc,iBAAiB;AACjC,aAAO,kBAAkB,iBAAiB;AAAA,IAC5C;AAEA,QAAI,cAAc,+BAA+B;AAC/C,aAAO,kBAAkB,uBAAuB;AAAA,IAClD;AAEA,WAAO,kBAAkB,UAAU;AAAA,EACrC,SAAS,OAAO;AACd,QACE,iBAAiB;AAAA;AAAA;AAAA,IAIjB,MAAM,QAAQ,YAAY,EAAE,SAAS,WAAW,GAChD;AACA,aAAO;AAAA,IACT;AAEA,UAAM;AAAA,EACR;AACF;","names":[]}
|
|
1
|
+
{"version":3,"sources":["../src/errors.ts","../src/services/padron.ts"],"sourcesContent":["import type { ArcaServiceName } from \"./internal/types\";\nimport type {\n ArcaFiscalIssue,\n ArcaFiscalResultLevel,\n ArcaFiscalResults,\n} from \"./services/fiscal-evidence\";\n\n/** Base error class for all ARCA-related errors. */\nexport class ArcaError extends Error {\n readonly code: string;\n override readonly name: string = \"ArcaError\";\n\n constructor(message: string, code = \"ARCA_ERROR\", options?: ErrorOptions) {\n super(message, options);\n this.code = code;\n }\n}\n\n/** Thrown when the ARCA client configuration is missing or invalid. */\nexport class ArcaConfigurationError extends ArcaError {\n override readonly name: string = \"ArcaConfigurationError\";\n\n constructor(message: string, options?: ErrorOptions) {\n super(message, \"ARCA_CONFIGURATION_ERROR\", options);\n }\n}\n\n/** Thrown when caller-provided input data is missing or invalid. */\nexport class ArcaInputError extends ArcaError {\n override readonly name: string = \"ArcaInputError\";\n readonly detail?: unknown;\n\n constructor(\n message: string,\n options?: ErrorOptions & {\n detail?: unknown;\n }\n ) {\n super(message, \"ARCA_INPUT_ERROR\", options);\n this.detail = options?.detail;\n }\n}\n\n/** Thrown when an HTTP request to an ARCA endpoint fails at the transport level. */\nexport class ArcaTransportError extends ArcaError {\n override readonly name: string = \"ArcaTransportError\";\n readonly statusCode?: number;\n readonly contentType?: string;\n readonly responseBody?: string;\n\n constructor(\n message: string,\n options?: ErrorOptions & {\n statusCode?: number;\n contentType?: string;\n responseBody?: string;\n }\n ) {\n super(message, \"ARCA_TRANSPORT_ERROR\", options);\n this.statusCode = options?.statusCode;\n this.contentType = options?.contentType;\n this.responseBody = options?.responseBody;\n }\n}\n\n/** Thrown when the SOAP response contains a Fault element. */\nexport class ArcaSoapFaultError extends ArcaError {\n override readonly name: string = \"ArcaSoapFaultError\";\n readonly faultCode?: string;\n readonly detail?: unknown;\n\n constructor(\n message: string,\n options?: ErrorOptions & {\n faultCode?: string;\n detail?: unknown;\n }\n ) {\n super(message, \"ARCA_SOAP_FAULT\", options);\n this.faultCode = options?.faultCode;\n this.detail = options?.detail;\n }\n}\n\n/** Thrown when a response cannot be parsed as a valid SOAP envelope. */\nexport class ArcaInvalidSoapResponseError extends ArcaError {\n override readonly name: string = \"ArcaInvalidSoapResponseError\";\n readonly service?: ArcaServiceName;\n readonly operation?: string;\n readonly endpointUrl?: string;\n readonly statusCode?: number;\n readonly contentType?: string;\n readonly responseBodyLength?: number;\n readonly responseBodyPreview?: string;\n readonly parsedDetail?: unknown;\n\n constructor(\n message: string,\n options?: ErrorOptions & {\n service?: ArcaServiceName;\n operation?: string;\n endpointUrl?: string;\n statusCode?: number;\n contentType?: string;\n responseBodyLength?: number;\n responseBodyPreview?: string;\n parsedDetail?: unknown;\n }\n ) {\n super(message, \"ARCA_INVALID_SOAP_RESPONSE\", options);\n this.service = options?.service;\n this.operation = options?.operation;\n this.endpointUrl = options?.endpointUrl;\n this.statusCode = options?.statusCode;\n this.contentType = options?.contentType;\n this.responseBodyLength = options?.responseBodyLength;\n this.responseBodyPreview = options?.responseBodyPreview;\n this.parsedDetail = options?.parsedDetail;\n }\n}\n\n/** Thrown when an ARCA service (WSFE, WSMTXCA, Padron) returns a domain-level error. */\nexport class ArcaServiceError extends ArcaError {\n override readonly name: string = \"ArcaServiceError\";\n readonly serviceCode?: string | number;\n readonly service?: ArcaServiceName;\n readonly operation?: string;\n readonly result?: string;\n readonly resultLevel?: ArcaFiscalResultLevel;\n readonly results?: ArcaFiscalResults;\n readonly cae?: string;\n readonly issues?: readonly ArcaFiscalIssue[];\n readonly detail?: unknown;\n\n constructor(\n message: string,\n options?: ErrorOptions & {\n serviceCode?: string | number;\n service?: ArcaServiceName;\n operation?: string;\n result?: string;\n resultLevel?: ArcaFiscalResultLevel;\n results?: ArcaFiscalResults;\n cae?: string;\n issues?: readonly ArcaFiscalIssue[];\n detail?: unknown;\n }\n ) {\n super(message, \"ARCA_SERVICE_ERROR\", options);\n this.serviceCode = options?.serviceCode;\n this.service = options?.service;\n this.operation = options?.operation;\n this.result = options?.result;\n this.resultLevel = options?.resultLevel;\n this.results = options?.results;\n this.cae = options?.cae;\n this.issues = options?.issues;\n this.detail = options?.detail;\n }\n}\n","import { ArcaSoapFaultError } from \"../errors\";\nimport type {\n ArcaClientConfig,\n ArcaPadronServiceName,\n} from \"../internal/types\";\nimport type { SoapTransport } from \"../soap\";\nimport type { WsaaAuthModule } from \"../wsaa\";\n\n/** Result of a taxpayer lookup via Padron A5. */\nexport type PadronTaxpayerResult = {\n taxId: string;\n personType?: string;\n name?: string;\n raw: Record<string, unknown>;\n};\n\n/** Result of a tax ID lookup by document number via Padron A13. */\nexport type PadronTaxIdLookupResult = {\n taxIds: string[];\n raw: Record<string, unknown>;\n};\n\n/** Padron taxpayer registry service. */\nexport type PadronService = {\n /** Looks up taxpayer details by CUIT. Returns `null` if the taxpayer does not exist. */\n getTaxpayerDetails(\n taxId: number | string\n ): Promise<PadronTaxpayerResult | null>;\n /** Looks up CUITs associated with a document number. Returns `null` if not found. */\n getTaxIdByDocument(\n documentNumber: number | string\n ): Promise<PadronTaxIdLookupResult | null>;\n};\n\nexport type CreatePadronServiceOptions = {\n config: ArcaClientConfig;\n auth: WsaaAuthModule;\n soap: SoapTransport;\n};\n\n/** Creates a Padron service instance wired with authentication and SOAP transport. */\nexport function createPadronService(\n options: CreatePadronServiceOptions\n): PadronService {\n return {\n async getTaxpayerDetails(taxId) {\n const raw = await executePadronOperation(\n options,\n \"padron-a5\",\n \"getPersona_v2\",\n {\n idPersona: Number.parseInt(String(taxId), 10),\n }\n );\n if (!raw) {\n return null;\n }\n const record = raw as Record<string, unknown>;\n const datosGenerales = record.datosGenerales as\n | Record<string, unknown>\n | undefined;\n return {\n taxId: String(record.idPersona ?? \"\"),\n ...(record.tipoPersona === undefined\n ? {}\n : { personType: String(record.tipoPersona) }),\n ...(datosGenerales ? { name: extractPadronName(datosGenerales) } : {}),\n raw: record,\n };\n },\n async getTaxIdByDocument(documentNumber) {\n const raw = await executePadronOperation(\n options,\n \"padron-a13\",\n \"getIdPersonaListByDocumento\",\n {\n documento: String(documentNumber),\n }\n );\n if (!raw) {\n return null;\n }\n const record = raw as Record<string, unknown>;\n const idPersona = record.idPersona;\n const taxIds = Array.isArray(idPersona)\n ? idPersona.map(String)\n : idPersona === undefined\n ? []\n : [String(idPersona)];\n return {\n taxIds,\n raw: record,\n };\n },\n };\n}\n\nfunction extractPadronName(\n datosGenerales: Record<string, unknown>\n): string | undefined {\n if (typeof datosGenerales.razonSocial === \"string\") {\n return datosGenerales.razonSocial;\n }\n const nombre = datosGenerales.nombre;\n const apellido = datosGenerales.apellido;\n if (typeof apellido === \"string\" && typeof nombre === \"string\") {\n return `${apellido} ${nombre}`.trim();\n }\n if (typeof apellido === \"string\") {\n return apellido;\n }\n if (typeof nombre === \"string\") {\n return nombre;\n }\n return undefined;\n}\n\nasync function executePadronOperation(\n options: CreatePadronServiceOptions,\n service: ArcaPadronServiceName,\n operation: string,\n body: Record<string, unknown>\n) {\n const auth = await options.auth.login(\n service === \"padron-a5\"\n ? \"ws_sr_constancia_inscripcion\"\n : \"ws_sr_padron_a13\"\n );\n\n try {\n const response = await options.soap.execute<\n Record<string, unknown>,\n Record<string, unknown>\n >({\n service,\n operation,\n bodyElementNamespaceMode: \"prefix\",\n body: {\n token: auth.token,\n sign: auth.sign,\n cuitRepresentada: Number.parseInt(options.config.taxId, 10),\n ...body,\n },\n });\n\n const operationResponse = response.result as Record<string, unknown>;\n\n if (operation === \"getPersona_v2\") {\n return operationResponse.personaReturn ?? null;\n }\n\n if (operation === \"getIdPersonaListByDocumento\") {\n return operationResponse.idPersonaListReturn ?? null;\n }\n\n return operationResponse.return ?? null;\n } catch (error) {\n if (\n error instanceof ArcaSoapFaultError &&\n // Public Padron A5/A13 WSDLs expose only a generic validation fault, so\n // there is no documented not-found-specific fault code to match here.\n // Keep the current message fallback, but treat it as fragile.\n error.message.toLowerCase().includes(\"no existe\")\n ) {\n return null;\n }\n\n throw error;\n }\n}\n"],"mappings":";AAQO,IAAM,YAAN,cAAwB,MAAM;AAAA,EAC1B;AAAA,EACS,OAAe;AAAA,EAEjC,YAAY,SAAiB,OAAO,cAAc,SAAwB;AACxE,UAAM,SAAS,OAAO;AACtB,SAAK,OAAO;AAAA,EACd;AACF;AAkDO,IAAM,qBAAN,cAAiC,UAAU;AAAA,EAC9B,OAAe;AAAA,EACxB;AAAA,EACA;AAAA,EAET,YACE,SACA,SAIA;AACA,UAAM,SAAS,mBAAmB,OAAO;AACzC,SAAK,YAAY,SAAS;AAC1B,SAAK,SAAS,SAAS;AAAA,EACzB;AACF;;;ACzCO,SAAS,oBACd,SACe;AACf,SAAO;AAAA,IACL,MAAM,mBAAmB,OAAO;AAC9B,YAAM,MAAM,MAAM;AAAA,QAChB;AAAA,QACA;AAAA,QACA;AAAA,QACA;AAAA,UACE,WAAW,OAAO,SAAS,OAAO,KAAK,GAAG,EAAE;AAAA,QAC9C;AAAA,MACF;AACA,UAAI,CAAC,KAAK;AACR,eAAO;AAAA,MACT;AACA,YAAM,SAAS;AACf,YAAM,iBAAiB,OAAO;AAG9B,aAAO;AAAA,QACL,OAA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A0B;AAAA,MAC1B,MAAM;AAAA,QACJ,OAAO,KAAK;AAAA,QACZ,MAAM,KAAK;AAAA,QACX,kBAAkB,OAAO,SAAS,QAAQ,OAAO,OAAO,EAAE;AAAA,QAC1D,GAAG;AAAA,MACL;AAAA,IACF,CAAC;AAED,UAAM,oBAAoB,SAAS;AAEnC,QAAI,cAAc,iBAAiB;AACjC,aAAO,kBAAkB,iBAAiB;AAAA,IAC5C;AAEA,QAAI,cAAc,+BAA+B;AAC/C,aAAO,kBAAkB,uBAAuB;AAAA,IAClD;AAEA,WAAO,kBAAkB,UAAU;AAAA,EACrC,SAAS,OAAO;AACd,QACE,iBAAiB;AAAA;AAAA;AAAA,IAIjB,MAAM,QAAQ,YAAY,EAAE,SAAS,WAAW,GAChD;AACA,aAAO;AAAA,IACT;AAEA,UAAM;AAAA,EACR;AACF;","names":[]}
|
|
@@ -57,6 +57,8 @@ type ArcaAuthOptions = {
|
|
|
57
57
|
type ArcaSoapExecutionOptions<TBody> = {
|
|
58
58
|
service: ArcaServiceName;
|
|
59
59
|
operation: string;
|
|
60
|
+
/** Overrides client-level retries for this operation. Use zero for fiscal authorization. */
|
|
61
|
+
retries?: number;
|
|
60
62
|
bodyElementName?: string;
|
|
61
63
|
bodyElementNamespaceMode?: "default" | "prefix";
|
|
62
64
|
body: TBody;
|
package/dist/types.d.ts
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
export { e as ArcaAuthCredentials, d as ArcaAuthOptions, f as ArcaClientConfig, g 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-
|
|
1
|
+
export { e as ArcaAuthCredentials, d as ArcaAuthOptions, f as ArcaClientConfig, g 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-Cup-oevW.js';
|
package/dist/wsfe.d.ts
CHANGED
|
@@ -1,5 +1,6 @@
|
|
|
1
|
-
import { f as ArcaClientConfig } from './types-
|
|
2
|
-
import { W as WsaaAuthModule, S as SoapTransport } from './index-
|
|
1
|
+
import { f as ArcaClientConfig } from './types-Cup-oevW.js';
|
|
2
|
+
import { W as WsaaAuthModule, S as SoapTransport } from './index-3fdgJ3c2.js';
|
|
3
|
+
import { d as ArcaAuthorizationOutcome, f as ArcaVoucherLookupResult } from './fiscal-evidence-DbbFH74x.js';
|
|
3
4
|
|
|
4
5
|
/** Accepted public date inputs for WSFE request fields. */
|
|
5
6
|
type WsfeDateInput = `${number}${number}${number}${number}-${number}${number}-${number}${number}` | `${number}${number}${number}${number}${number}${number}${number}${number}`;
|
|
@@ -88,6 +89,8 @@ type WsfeAuthorizationResult = {
|
|
|
88
89
|
voucherNumber: number;
|
|
89
90
|
raw: Record<string, unknown>;
|
|
90
91
|
};
|
|
92
|
+
/** Structured evidence from one exact WSFE authorization attempt. */
|
|
93
|
+
type WsfeAuthorizationOutcome = ArcaAuthorizationOutcome<"wsfe">;
|
|
91
94
|
/** A point-of-sale entry returned by {@link WsfeService.getSalesPoints}. */
|
|
92
95
|
type WsfeSalesPoint = {
|
|
93
96
|
number: number;
|
|
@@ -101,12 +104,25 @@ type WsfeVoucherInfo = {
|
|
|
101
104
|
voucherDate?: string;
|
|
102
105
|
salesPoint?: number;
|
|
103
106
|
voucherType?: number;
|
|
107
|
+
concept?: number;
|
|
108
|
+
documentType?: number;
|
|
109
|
+
documentNumber?: string;
|
|
110
|
+
receiverVatConditionId?: number;
|
|
104
111
|
totalAmount?: number;
|
|
112
|
+
nonTaxableAmount?: number;
|
|
113
|
+
netAmount?: number;
|
|
114
|
+
exemptAmount?: number;
|
|
115
|
+
taxAmount?: number;
|
|
116
|
+
vatAmount?: number;
|
|
117
|
+
currencyId?: string;
|
|
118
|
+
exchangeRate?: number;
|
|
105
119
|
result?: string;
|
|
106
120
|
cae?: string;
|
|
107
121
|
caeExpiry?: string;
|
|
108
122
|
raw: Record<string, unknown>;
|
|
109
123
|
};
|
|
124
|
+
/** Typed exact-voucher consultation result for WSFE. */
|
|
125
|
+
type WsfeVoucherLookupResult = ArcaVoucherLookupResult<WsfeVoucherInfo, "wsfe">;
|
|
110
126
|
type WsfeCatalogEntry = {
|
|
111
127
|
id: number;
|
|
112
128
|
description: string;
|
|
@@ -135,6 +151,11 @@ type WsfeQuotation = {
|
|
|
135
151
|
};
|
|
136
152
|
/** WSFE electronic invoicing service. */
|
|
137
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>;
|
|
138
159
|
/** Authorizes a voucher with the explicit number sent as `CbteDesde` and `CbteHasta`. */
|
|
139
160
|
authorizeVoucher(input: WsfeAuthorizeVoucherInput): Promise<WsfeAuthorizationResult>;
|
|
140
161
|
/** Authorizes a new voucher by fetching the next number and requesting a CAE. */
|
|
@@ -227,6 +248,14 @@ type WsfeService = {
|
|
|
227
248
|
voucherType: number;
|
|
228
249
|
forceRefresh?: boolean;
|
|
229
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>;
|
|
230
259
|
};
|
|
231
260
|
type CreateWsfeServiceOptions = {
|
|
232
261
|
config: ArcaClientConfig;
|
|
@@ -236,4 +265,4 @@ type CreateWsfeServiceOptions = {
|
|
|
236
265
|
/** Creates a WSFE service instance wired with authentication and SOAP transport. */
|
|
237
266
|
declare function createWsfeService(options: CreateWsfeServiceOptions): WsfeService;
|
|
238
267
|
|
|
239
|
-
export { type CreateWsfeServiceOptions, type WsfeActivity, type WsfeActivityType, type WsfeAssociatedPeriod, type WsfeAssociatedVoucher, type WsfeAuthorizationResult, type WsfeAuthorizeVoucherInput, 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, createWsfeService };
|
|
268
|
+
export { type CreateWsfeServiceOptions, type WsfeActivity, type WsfeActivityType, type WsfeAssociatedPeriod, type WsfeAssociatedVoucher, type WsfeAuthorizationOutcome, type WsfeAuthorizationResult, type WsfeAuthorizeVoucherInput, 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, createWsfeService };
|