@munlib/common 1.0.193 → 1.0.195

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.
@@ -4,8 +4,12 @@ export declare const errorCodes: {
4
4
  export declare const statusCodeMapping: {
5
5
  [key: string]: string;
6
6
  };
7
+ export declare const httpStatusCodes: {
8
+ [key: string]: number;
9
+ };
7
10
  export declare class ErrorController {
8
11
  static getGeneralStatus(apiStatusCode: string): string;
9
12
  static getErrorMessage(apiStatusCode: string): string;
10
13
  static getErrorCodes(apiStatusCode: string): string;
14
+ static gethttpStatusCodes(apiStatusCode: string): number;
11
15
  }
@@ -1,7 +1,7 @@
1
1
  "use strict";
2
2
  // Define los códigos de error y el mapeo en el mismo archivo
3
3
  Object.defineProperty(exports, "__esModule", { value: true });
4
- exports.ErrorController = exports.statusCodeMapping = exports.errorCodes = void 0;
4
+ exports.ErrorController = exports.httpStatusCodes = exports.statusCodeMapping = exports.errorCodes = void 0;
5
5
  exports.errorCodes = {
6
6
  "E000": "Ejecucion satisfactoria",
7
7
  "E001": "Clave incorrecta",
@@ -69,7 +69,7 @@ exports.errorCodes = {
69
69
  "M004": "No se puede procesar una orden que fue cancelada",
70
70
  "M005": "Error en los parametros de la orden",
71
71
  "M006": "Error al actualizar la orden de pago",
72
- "M007": "Error al inicializar base de datos Middleware",
72
+ "M007": "Error al inicializar base de datos",
73
73
  "M008": "No se encuentra el pago",
74
74
  "M009": "No se puede reversar una deuda no pagada",
75
75
  "M010": "No se puede procesar una orden que ya fue pagada",
@@ -280,6 +280,134 @@ exports.statusCodeMapping = {
280
280
  "TECNICO": "error",
281
281
  "SUCCESS": "success",
282
282
  };
283
+ exports.httpStatusCodes = {
284
+ "E000": 200,
285
+ "E001": 401,
286
+ "E002": 400,
287
+ "E003": 409,
288
+ "E004": 409,
289
+ "E005": 200,
290
+ "E006": 400,
291
+ "E007": 400,
292
+ "E008": 400,
293
+ "E009": 400,
294
+ "E010": 409,
295
+ "E011": 200,
296
+ "E012": 400,
297
+ "E013": 400,
298
+ "E014": 400,
299
+ "E015": 400,
300
+ "E016": 400,
301
+ "E017": 400,
302
+ "E018": 400,
303
+ "E019": 409,
304
+ "E020": 409,
305
+ "E021": 409,
306
+ "E022": 409,
307
+ "E023": 409,
308
+ "E024": 409,
309
+ "E025": 409,
310
+ "E026": 400,
311
+ "E027": 400,
312
+ "E028": 400,
313
+ "E029": 400,
314
+ "E030": 400,
315
+ "E031": 400,
316
+ "E032": 400,
317
+ "E033": 400,
318
+ "E034": 400,
319
+ "E035": 400,
320
+ "E036": 400,
321
+ "E037": 400,
322
+ "E038": 400,
323
+ "E039": 400,
324
+ "E040": 400,
325
+ "E041": 409,
326
+ "E042": 409,
327
+ "E043": 409,
328
+ "E044": 409,
329
+ "E045": 400,
330
+ "E046": 400,
331
+ "E047": 400,
332
+ "E048": 400,
333
+ "E049": 400,
334
+ "E050": 409,
335
+ "E051": 409,
336
+ "E052": 409,
337
+ "E053": 400,
338
+ "E054": 400,
339
+ "E055": 422,
340
+ "E056": 400,
341
+ "E057": 409,
342
+ "E058": 409,
343
+ "E099": 500,
344
+ "M001": 500,
345
+ "M002": 500,
346
+ "M003": 404,
347
+ "M004": 400,
348
+ "M005": 400,
349
+ "M006": 500,
350
+ "M007": 500,
351
+ "M008": 404,
352
+ "M009": 400,
353
+ "M010": 409,
354
+ "M011": 500,
355
+ "M012": 200,
356
+ "M013": 401,
357
+ "M014": 500,
358
+ "M015": 500,
359
+ "M016": 400,
360
+ "PAG": 200,
361
+ "TRAN": 409,
362
+ "TCOMP": 409,
363
+ "ERRING": 500,
364
+ "NOTC": 409,
365
+ "MON": 400,
366
+ "CTA": 400,
367
+ "INST": 404,
368
+ "AUT": 401,
369
+ "REV": 409,
370
+ "ECAN": 400,
371
+ "ING": 200,
372
+ "FPAG": 409,
373
+ "DEB": 200,
374
+ "BANE": 409,
375
+ "MPAG": 400,
376
+ "SMAN": 503,
377
+ "EMI": 202,
378
+ "CLIR": 403,
379
+ "PPAG": 202,
380
+ "OK": 200,
381
+ "ERROR": 500,
382
+ "TINS": 400,
383
+ "OK200": 200,
384
+ "ERR02": 500,
385
+ "ERR03": 500,
386
+ "ERR11": 400,
387
+ "ERR12": 409,
388
+ "ERR13": 409,
389
+ "ERR14": 500,
390
+ "ERR15": 400,
391
+ "ERR16": 400,
392
+ "ERR17": 400,
393
+ "ERR18": 400,
394
+ "ERR31": 403,
395
+ "ERR32": 403,
396
+ "ERR33": 403,
397
+ "ECONNABORTED": 408,
398
+ "ECONNREFUSED": 503,
399
+ "ENOTFOUND": 404,
400
+ "EHOSTUNREACH": 503,
401
+ "500": 500,
402
+ "404": 404,
403
+ "401": 401,
404
+ "400": 400,
405
+ "ERR_BAD_REQUEST": 400,
406
+ "ERR_NETWORK": 503,
407
+ "ERR_BAD_RESPONSE": 502,
408
+ "ERR_TIMEOUT": 408,
409
+ "ERR_CANCELED": 499
410
+ };
283
411
  var ErrorController = /** @class */ (function () {
284
412
  function ErrorController() {
285
413
  }
@@ -292,6 +420,9 @@ var ErrorController = /** @class */ (function () {
292
420
  ErrorController.getErrorCodes = function (apiStatusCode) {
293
421
  return exports.errorCodes[apiStatusCode];
294
422
  };
423
+ ErrorController.gethttpStatusCodes = function (apiStatusCode) {
424
+ return exports.httpStatusCodes[apiStatusCode];
425
+ };
295
426
  return ErrorController;
296
427
  }());
297
428
  exports.ErrorController = ErrorController;
@@ -7,11 +7,10 @@ var erroresStatus_1 = require("../errors/erroresStatus");
7
7
  var instituciones_pagos_1 = require("../events/types/instituciones-pagos");
8
8
  var validateRequest = function (req, res, next) {
9
9
  var errors = (0, express_validator_1.validationResult)(req);
10
- console.log("VALIDATE REQUEST");
11
10
  if (!errors.isEmpty()) {
12
11
  console.log("VALIDATE REQUEST1111111", errors.array()[0]);
13
12
  // Extraer el primer error y sus detalles personalizados (typeError y userMsg)
14
- var msg = errors.array()[0].msg.msg; // Primer error encontrado
13
+ var msg = errors.array()[0].msg; // Primer error encontrado
15
14
  var typeMsg = instituciones_pagos_1.ErrorCategories.SINTAX;
16
15
  var userMsg = erroresStatus_1.ErrorController.getErrorMessage(instituciones_pagos_1.ErrorCategories.SINTAX);
17
16
  // Lanzar RequestValidationError con los campos personalizados
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@munlib/common",
3
- "version": "1.0.193",
3
+ "version": "1.0.195",
4
4
  "description": "",
5
5
  "main": "./build/index.js",
6
6
  "types": "./build/index.d.ts",