arca-sdk 1.3.0 → 1.3.1

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.cjs CHANGED
@@ -386,6 +386,7 @@ async function callArcaApi(url, options) {
386
386
  }
387
387
 
388
388
  // src/auth/wsaa.ts
389
+ var import_fast_xml_parser2 = require("fast-xml-parser");
389
390
  var WsaaService = class {
390
391
  config;
391
392
  ticketManager;
@@ -487,13 +488,27 @@ var WsaaService = class {
487
488
  body: this.buildSoapRequest(cms),
488
489
  timeout: this.config.timeout
489
490
  });
491
+ const responseText = await response.text();
490
492
  if (!response.ok) {
493
+ let errorMessage = `Error HTTP al comunicarse con WSAA: ${response.status} ${response.statusText}`;
494
+ try {
495
+ const parser = new import_fast_xml_parser2.XMLParser({
496
+ ignoreAttributes: false,
497
+ removeNSPrefix: true
498
+ });
499
+ const result = parser.parse(responseText);
500
+ const fault = result.Envelope?.Body?.Fault;
501
+ if (fault && fault.faultstring) {
502
+ errorMessage = `Error AFIP WSAA: ${fault.faultstring}`;
503
+ }
504
+ } catch (e) {
505
+ }
491
506
  throw new ArcaAuthError(
492
- `Error HTTP al comunicarse con WSAA: ${response.status} ${response.statusText}`,
493
- { status: response.status, statusText: response.statusText }
507
+ errorMessage,
508
+ { status: response.status, statusText: response.statusText, body: responseText }
494
509
  );
495
510
  }
496
- const responseXml = await response.text();
511
+ const responseXml = responseText;
497
512
  return parseWsaaResponse(responseXml);
498
513
  }
499
514
  /**
@@ -1395,7 +1410,7 @@ var WsfeService = class _WsfeService {
1395
1410
  };
1396
1411
 
1397
1412
  // src/services/padron.ts
1398
- var import_fast_xml_parser2 = require("fast-xml-parser");
1413
+ var import_fast_xml_parser3 = require("fast-xml-parser");
1399
1414
  var PadronService = class {
1400
1415
  wsaa;
1401
1416
  config;
@@ -1454,7 +1469,7 @@ var PadronService = class {
1454
1469
  * Parsea la respuesta XML de getPersona
1455
1470
  */
1456
1471
  parseResponse(xml) {
1457
- const parser = new import_fast_xml_parser2.XMLParser({
1472
+ const parser = new import_fast_xml_parser3.XMLParser({
1458
1473
  ignoreAttributes: false,
1459
1474
  removeNSPrefix: true
1460
1475
  });