arca-sdk 1.2.0 → 1.2.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.js CHANGED
@@ -1,15 +1,15 @@
1
1
  // src/constants/endpoints.ts
2
2
  var WSAA_ENDPOINTS = {
3
- homologacion: "https://wsaahomo.afip.gov.ar/ws/services/LoginCms",
4
- produccion: "https://wsaa.afip.gov.ar/ws/services/LoginCms"
3
+ homologacion: "https://wsaahomo.arca.gob.ar/ws/services/LoginCms",
4
+ produccion: "https://wsaa.arca.gob.ar/ws/services/LoginCms"
5
5
  };
6
6
  var WSFE_ENDPOINTS = {
7
- homologacion: "https://wswhomo.afip.gov.ar/wsfev1/service.asmx",
8
- produccion: "https://servicios1.afip.gov.ar/wsfev1/service.asmx"
7
+ homologacion: "https://wswhomo.arca.gob.ar/wsfev1/service.asmx",
8
+ produccion: "https://servicios1.arca.gob.ar/wsfev1/service.asmx"
9
9
  };
10
10
  var PADRON_A13_ENDPOINTS = {
11
- homologacion: "https://awshomo.afip.gov.ar/sr-padron/webservices/personaServiceA13",
12
- produccion: "https://aws.afip.gov.ar/sr-padron/webservices/personaServiceA13"
11
+ homologacion: "https://awshomo.arca.gob.ar/sr-padron/webservices/personaServiceA13",
12
+ produccion: "https://aws.arca.gob.ar/sr-padron/webservices/personaServiceA13"
13
13
  };
14
14
  function getWsaaEndpoint(environment) {
15
15
  return WSAA_ENDPOINTS[environment];
@@ -244,6 +244,18 @@ var TicketManager = class {
244
244
 
245
245
  // src/utils/network.ts
246
246
  import https from "https";
247
+ import tls from "tls";
248
+ function checkArcaServerIdentity(hostname, cert) {
249
+ const error = tls.checkServerIdentity(hostname, cert);
250
+ if (error && hostname.endsWith("arca.gob.ar")) {
251
+ const fallbackHost = hostname.replace("arca.gob.ar", "afip.gov.ar");
252
+ const retryError = tls.checkServerIdentity(fallbackHost, cert);
253
+ if (!retryError) {
254
+ return void 0;
255
+ }
256
+ }
257
+ return error;
258
+ }
247
259
  async function callArcaApi(url, options) {
248
260
  const timeout = options.timeout || 15e3;
249
261
  const isNode = typeof process !== "undefined" && process.versions && process.versions.node;
@@ -259,7 +271,8 @@ async function callArcaApi(url, options) {
259
271
  minVersion: "TLSv1",
260
272
  // @ts-ignore - Propiedad específica para mitigar "dh key too small" en Node 18+
261
273
  minDHSize: 1024,
262
- rejectUnauthorized: true
274
+ rejectUnauthorized: true,
275
+ checkServerIdentity: checkArcaServerIdentity
263
276
  });
264
277
  const reqOptions = {
265
278
  method: options.method,
@@ -573,7 +586,7 @@ function generateQRUrl(caeResponse, issuerCUIT, total, buyer) {
573
586
  qrData.codAut = Number(cleanCAE);
574
587
  const jsonString = JSON.stringify(qrData);
575
588
  const base64 = typeof Buffer !== "undefined" ? Buffer.from(jsonString).toString("base64") : btoa(jsonString);
576
- return `https://www.afip.gob.ar/fe/qr/?p=${base64}`;
589
+ return `https://www.arca.gob.ar/fe/qr/?p=${base64}`;
577
590
  }
578
591
 
579
592
  // src/constants/errors.ts