consultame-sdk 1.2.2 → 1.2.3

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.mjs CHANGED
@@ -118,6 +118,18 @@ var GenerateBatchUseCase = class {
118
118
  }
119
119
  };
120
120
 
121
+ // src/sifen/domain/useCases/cancelDocument.useCase.ts
122
+ var CancelDocumentUseCase = class {
123
+ constructor(sifenRepository) {
124
+ this.sifenRepository = sifenRepository;
125
+ }
126
+ sifenRepository;
127
+ execute(cancelInvoiceDto) {
128
+ const xml = this.sifenRepository.cancelationInvoice(cancelInvoiceDto);
129
+ return xml;
130
+ }
131
+ };
132
+
121
133
  // src/shared/utils/dictionary.utils.ts
122
134
  var TIPOS_DOCUMENTOS = [
123
135
  {
@@ -8491,6 +8503,48 @@ var signXml = async (xml, tag, responseDigitalSign) => {
8491
8503
  throw error;
8492
8504
  }
8493
8505
  };
8506
+ var generateCancelInvoiceXml = (cancelInvocieDto) => {
8507
+ const json = {};
8508
+ json.gGroupGesEve = {};
8509
+ json.gGroupGesEve.rGesEve = {};
8510
+ json.gGroupGesEve.$ = {};
8511
+ json.gGroupGesEve.$["xmlns:xsi"] = "http://www.w3.org/2001/XMLSchema-instance";
8512
+ json.gGroupGesEve.$["xsi:schemaLocation"] = "http://ekuatia.set.gov.py/sifen/xsd siRecepEvento_v150.xsd";
8513
+ json.gGroupGesEve.rGesEve.rEve = {};
8514
+ json.gGroupGesEve.rGesEve.rEve.$ = {};
8515
+ json.gGroupGesEve.rGesEve.rEve.$.Id = 1;
8516
+ json.gGroupGesEve.rGesEve.rEve.dFecFirma = convertToFormatDateSET(/* @__PURE__ */ new Date());
8517
+ json.gGroupGesEve.rGesEve.rEve.dVerFor = 150;
8518
+ json.gGroupGesEve.rGesEve.rEve.gGroupTiEvt = {};
8519
+ json.gGroupGesEve.rGesEve.rEve.gGroupTiEvt.rGeVeCan = {
8520
+ Id: cancelInvocieDto.cdc,
8521
+ mOtEve: cancelInvocieDto.motivo
8522
+ };
8523
+ const builder = new xml2js.Builder({
8524
+ xmldec: {
8525
+ version: "1.0",
8526
+ encoding: "UTF-8",
8527
+ standalone: false
8528
+ }
8529
+ });
8530
+ let xml = builder.buildObject(json);
8531
+ xml = normalizeXML(xml);
8532
+ xml = xml.replace(
8533
+ '<?xml version="1.0" encoding="UTF-8" standalone="no"?>',
8534
+ ""
8535
+ );
8536
+ return `<?xml version="1.0" encoding="UTF-8" standalone="no"?>
8537
+ <env:Envelope xmlns:env="http://www.w3.org/2003/05/soap-envelope">
8538
+ <env:Header/>
8539
+ <env:Body>
8540
+ <rEnviEventoDe xmlns="http://ekuatia.set.gov.py/sifen/xsd">
8541
+ <dId>${cancelInvocieDto.id}</dId>
8542
+ <dEvReg>${xml}</dEvReg>
8543
+ </rEnviEventoDe>
8544
+ </env:Body>
8545
+ </env:Envelope>
8546
+ `;
8547
+ };
8494
8548
 
8495
8549
  // src/shared/clases/detalleDocumento.ts
8496
8550
  var DetalleDocumento = class {
@@ -10110,7 +10164,7 @@ var SifenPersistence = class {
10110
10164
  return xmlFormated;
10111
10165
  }
10112
10166
  cancelationInvoice(cancelInvoiceDto) {
10113
- throw new Error("Method not implemented.");
10167
+ return generateCancelInvoiceXml(cancelInvoiceDto);
10114
10168
  }
10115
10169
  invalidationInvoice(invalidationInvoiceDto) {
10116
10170
  try {
@@ -10187,6 +10241,7 @@ var SifenService = class {
10187
10241
  signedXmlUseCase;
10188
10242
  nominationInvoiceUseCase;
10189
10243
  generateBatchUseCase;
10244
+ cancelDocumentUseCase;
10190
10245
  sifenRepository;
10191
10246
  constructor() {
10192
10247
  this.sifenRepository = new SifenPersistence();
@@ -10207,6 +10262,9 @@ var SifenService = class {
10207
10262
  this.sifenRepository
10208
10263
  );
10209
10264
  this.generateBatchUseCase = new GenerateBatchUseCase(this.sifenRepository);
10265
+ this.cancelDocumentUseCase = new CancelDocumentUseCase(
10266
+ this.sifenRepository
10267
+ );
10210
10268
  }
10211
10269
  consultRuc(consultRucDto) {
10212
10270
  const ruc = this.consultRucUseCase.execute(consultRucDto);
@@ -10258,6 +10316,10 @@ var SifenService = class {
10258
10316
  const xml = this.generateBatchUseCase.execute(generateBatchDto);
10259
10317
  return xml;
10260
10318
  }
10319
+ cancelInvoice(cancelInvocieDto) {
10320
+ const xml = this.cancelDocumentUseCase.execute(cancelInvocieDto);
10321
+ return xml;
10322
+ }
10261
10323
  };
10262
10324
 
10263
10325
  export { SifenService };