consultame-sdk 1.2.2 → 1.2.4

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
  {
@@ -136,6 +148,10 @@ var TIPOS_DOCUMENTOS = [
136
148
  codigo: 4,
137
149
  descripcion: "Carnet de residencia"
138
150
  },
151
+ {
152
+ codigo: 5,
153
+ descripcion: "Innominado"
154
+ },
139
155
  {
140
156
  codigo: 9,
141
157
  descripcion: "Otro"
@@ -8491,6 +8507,48 @@ var signXml = async (xml, tag, responseDigitalSign) => {
8491
8507
  throw error;
8492
8508
  }
8493
8509
  };
8510
+ var generateCancelInvoiceXml = (cancelInvocieDto) => {
8511
+ const json = {};
8512
+ json.gGroupGesEve = {};
8513
+ json.gGroupGesEve.rGesEve = {};
8514
+ json.gGroupGesEve.$ = {};
8515
+ json.gGroupGesEve.$["xmlns:xsi"] = "http://www.w3.org/2001/XMLSchema-instance";
8516
+ json.gGroupGesEve.$["xsi:schemaLocation"] = "http://ekuatia.set.gov.py/sifen/xsd siRecepEvento_v150.xsd";
8517
+ json.gGroupGesEve.rGesEve.rEve = {};
8518
+ json.gGroupGesEve.rGesEve.rEve.$ = {};
8519
+ json.gGroupGesEve.rGesEve.rEve.$.Id = 1;
8520
+ json.gGroupGesEve.rGesEve.rEve.dFecFirma = convertToFormatDateSET(/* @__PURE__ */ new Date());
8521
+ json.gGroupGesEve.rGesEve.rEve.dVerFor = 150;
8522
+ json.gGroupGesEve.rGesEve.rEve.gGroupTiEvt = {};
8523
+ json.gGroupGesEve.rGesEve.rEve.gGroupTiEvt.rGeVeCan = {
8524
+ Id: cancelInvocieDto.cdc,
8525
+ mOtEve: cancelInvocieDto.motivo
8526
+ };
8527
+ const builder = new xml2js.Builder({
8528
+ xmldec: {
8529
+ version: "1.0",
8530
+ encoding: "UTF-8",
8531
+ standalone: false
8532
+ }
8533
+ });
8534
+ let xml = builder.buildObject(json);
8535
+ xml = normalizeXML(xml);
8536
+ xml = xml.replace(
8537
+ '<?xml version="1.0" encoding="UTF-8" standalone="no"?>',
8538
+ ""
8539
+ );
8540
+ return `<?xml version="1.0" encoding="UTF-8" standalone="no"?>
8541
+ <env:Envelope xmlns:env="http://www.w3.org/2003/05/soap-envelope">
8542
+ <env:Header/>
8543
+ <env:Body>
8544
+ <rEnviEventoDe xmlns="http://ekuatia.set.gov.py/sifen/xsd">
8545
+ <dId>${cancelInvocieDto.id}</dId>
8546
+ <dEvReg>${xml}</dEvReg>
8547
+ </rEnviEventoDe>
8548
+ </env:Body>
8549
+ </env:Envelope>
8550
+ `;
8551
+ };
8494
8552
 
8495
8553
  // src/shared/clases/detalleDocumento.ts
8496
8554
  var DetalleDocumento = class {
@@ -10110,7 +10168,7 @@ var SifenPersistence = class {
10110
10168
  return xmlFormated;
10111
10169
  }
10112
10170
  cancelationInvoice(cancelInvoiceDto) {
10113
- throw new Error("Method not implemented.");
10171
+ return generateCancelInvoiceXml(cancelInvoiceDto);
10114
10172
  }
10115
10173
  invalidationInvoice(invalidationInvoiceDto) {
10116
10174
  try {
@@ -10187,6 +10245,7 @@ var SifenService = class {
10187
10245
  signedXmlUseCase;
10188
10246
  nominationInvoiceUseCase;
10189
10247
  generateBatchUseCase;
10248
+ cancelDocumentUseCase;
10190
10249
  sifenRepository;
10191
10250
  constructor() {
10192
10251
  this.sifenRepository = new SifenPersistence();
@@ -10207,6 +10266,9 @@ var SifenService = class {
10207
10266
  this.sifenRepository
10208
10267
  );
10209
10268
  this.generateBatchUseCase = new GenerateBatchUseCase(this.sifenRepository);
10269
+ this.cancelDocumentUseCase = new CancelDocumentUseCase(
10270
+ this.sifenRepository
10271
+ );
10210
10272
  }
10211
10273
  consultRuc(consultRucDto) {
10212
10274
  const ruc = this.consultRucUseCase.execute(consultRucDto);
@@ -10258,6 +10320,10 @@ var SifenService = class {
10258
10320
  const xml = this.generateBatchUseCase.execute(generateBatchDto);
10259
10321
  return xml;
10260
10322
  }
10323
+ cancelInvoice(cancelInvocieDto) {
10324
+ const xml = this.cancelDocumentUseCase.execute(cancelInvocieDto);
10325
+ return xml;
10326
+ }
10261
10327
  };
10262
10328
 
10263
10329
  export { SifenService };