herramientaenvioestupendo 1.0.49 → 1.0.51

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 CHANGED
@@ -14,7 +14,7 @@ Para instalar el aplicativo CLI, deben realizar el siguiente procedimiento :
14
14
  ```npm i -g herramientaenvioestupendo```
15
15
 
16
16
  - Luego de esto deben validar la version de la herramienta :
17
- ```estupendo --version```, si esta indica que es la 1.0.49 es la correcta.
17
+ ```estupendo --version```, si esta indica que es la 1.0.51 es la correcta.
18
18
 
19
19
  - Para conocer que opciones tienen de comandos solo deben ingresar en su CMD :
20
20
  ```estupendo --help```
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "herramientaenvioestupendo",
3
- "version": "1.0.49",
3
+ "version": "1.0.51",
4
4
  "private": false,
5
5
  "description": "Proyecto para envio documentos masivos",
6
6
  "keywords": [],
package/src/index.js CHANGED
@@ -3,7 +3,7 @@ import { program } from "commander"
3
3
  import { sendTxt, sendXml, sendAttached, sendJson, requestDocumentRace } from "./services.js"
4
4
 
5
5
 
6
- program.name("estupendo").version("1.0.49")
6
+ program.name("estupendo").version("1.0.51")
7
7
 
8
8
  program.command("send_xml")
9
9
  .requiredOption("-d, --directory <char>", "Directorio donde se encuentran los documentos XML")
@@ -32,6 +32,8 @@ program.command("send_json")
32
32
  program.command("request_document_race")
33
33
  .requiredOption("-d, --directory <char>", "Directorio donde se encuentran los documentos XML")
34
34
  .option("-p, --prod", "Producción, si no es enviado recibe el api pruebas")
35
+ .option("-fi, --fechaIni", "Fecha inicio")
36
+ .option("-fe, --fechaEnd", "Fecha fin")
35
37
  .requiredOption("-n, --nit <char>", "Nit de la empresa")
36
38
  .requiredOption("-t, --token <char>", "apiKey de la empresa")
37
39
  .description("Descargar xml y pdf de los documentos recepcionados")
package/src/services.js CHANGED
@@ -309,6 +309,8 @@ const requestDocumentRace = async (options) => {
309
309
  let urlBase = "https://pruebas.estupendo.com.co/api"
310
310
  let identificacion = "";
311
311
  let token = "";
312
+ let fechaIni = "";
313
+ let fechaEnd = "";
312
314
  if (options.prod) {
313
315
  urlBase = "https://app.estupendo.com.co/api"
314
316
  }
@@ -328,21 +330,26 @@ const requestDocumentRace = async (options) => {
328
330
  if (!fs.existsSync(xmlDir)) fs.mkdirSync(xmlDir);
329
331
 
330
332
  console.log("Procesando...")
331
- const yesterday = new Date();
332
- yesterday.setDate(yesterday.getDate() - 1);
333
333
 
334
- const year = yesterday.getFullYear();
335
- const month = String(yesterday.getMonth() + 1).padStart(2, '0');
336
- const day = String(yesterday.getDate()).padStart(2, '0');
334
+ if(options.fechaIni && options.fechaEnd){
335
+ fechaIni = options.fechaIni
336
+ fechaEnd = options.fechaEnd
337
+ }else{
338
+ const today = new Date();
339
+ const year = today.getFullYear();
340
+ const month = String(today.getMonth() + 1).padStart(2, '0');
341
+ const day = String(today.getDate()).padStart(2, '0');
342
+ const fechaHoy = `${year}-${month}-${day}`;
343
+ fechaIni = fechaHoy
344
+ fechaEnd = fechaHoy
345
+ }
337
346
 
338
- const fechaAnterior = `${year}-${month}-${day}`;
339
347
 
340
- console.log(fechaAnterior)
341
348
  console.log(token)
342
349
  try {
343
350
  const data = await requestGet(urlApiConsulta, {
344
- fechaIni:"2025-07-01",
345
- fechaFin:"2025-07-10",
351
+ fechaIni: fechaIni,
352
+ fechaFin: fechaEnd,
346
353
  nit: identificacion
347
354
  }, token)
348
355
  console.log(data)