@fiado/api-invoker 1.1.79 → 1.1.81

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.
@@ -41,6 +41,7 @@ const fiadoMessages_1 = require("./fiadoMessages");
41
41
  const CnbvApi_1 = __importDefault(require("./cnbv-business/CnbvApi"));
42
42
  const TransactionApi_1 = __importDefault(require("./transaction/api/TransactionApi"));
43
43
  const pomeloProcessor_1 = require("./pomeloProcessor");
44
+ const disputes_1 = require("./disputes");
44
45
  exports.apiInvokerBindings = new inversify_1.ContainerModule((bind) => {
45
46
  bind("IDirectoryApi").to(directory_1.DirectoryApi);
46
47
  bind("IIdentityApi").to(identity_1.IdentityApi);
@@ -78,4 +79,5 @@ exports.apiInvokerBindings = new inversify_1.ContainerModule((bind) => {
78
79
  bind("IFiadoMessagesApi").to(fiadoMessages_1.FiadoMessagesApi);
79
80
  bind("ICnbvApi").to(CnbvApi_1.default);
80
81
  bind("IPomeloProcessorApi").to(pomeloProcessor_1.PomeloProcessorApi);
82
+ bind("IDisputesApi").to(disputes_1.DisputesApi);
81
83
  });
@@ -0,0 +1,12 @@
1
+ import { IHttpRequest } from "@fiado/http-client";
2
+ import { IDisputesApi } from "./interfaces/IDisputesApi";
3
+ export declare class DisputesApi implements IDisputesApi {
4
+ private httpRequest;
5
+ private readonly baseUrl;
6
+ constructor(httpRequest: IHttpRequest);
7
+ getByDirectoryId(params: {
8
+ directoryId: string;
9
+ pageSize?: number;
10
+ index?: string;
11
+ }): Promise<void>;
12
+ }
@@ -0,0 +1,44 @@
1
+ "use strict";
2
+ var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
3
+ var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
4
+ if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
5
+ else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
6
+ return c > 3 && r && Object.defineProperty(target, key, r), r;
7
+ };
8
+ var __metadata = (this && this.__metadata) || function (k, v) {
9
+ if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
10
+ };
11
+ var __param = (this && this.__param) || function (paramIndex, decorator) {
12
+ return function (target, key) { decorator(target, key, paramIndex); }
13
+ };
14
+ var __importDefault = (this && this.__importDefault) || function (mod) {
15
+ return (mod && mod.__esModule) ? mod : { "default": mod };
16
+ };
17
+ Object.defineProperty(exports, "__esModule", { value: true });
18
+ exports.DisputesApi = void 0;
19
+ const inversify_1 = require("inversify");
20
+ const dotenv_1 = __importDefault(require("dotenv"));
21
+ dotenv_1.default.config();
22
+ let DisputesApi = class DisputesApi {
23
+ constructor(httpRequest) {
24
+ this.httpRequest = httpRequest;
25
+ this.baseUrl = process.env.DISPUTES_LAMBDA_URL || "";
26
+ }
27
+ async getByDirectoryId(params) {
28
+ let queryParams = [];
29
+ if (!params.index) {
30
+ queryParams.push(`index=${params.index}`);
31
+ }
32
+ if (!params.pageSize) {
33
+ queryParams.push(`pageSize=${params.pageSize}`);
34
+ }
35
+ const url = `${this.baseUrl}disputes/${params.directoryId}?${queryParams.join('&')}`;
36
+ return await this.httpRequest.get(url);
37
+ }
38
+ };
39
+ exports.DisputesApi = DisputesApi;
40
+ exports.DisputesApi = DisputesApi = __decorate([
41
+ (0, inversify_1.injectable)(),
42
+ __param(0, (0, inversify_1.inject)("IHttpRequest")),
43
+ __metadata("design:paramtypes", [Object])
44
+ ], DisputesApi);
@@ -0,0 +1,2 @@
1
+ export * from './interfaces/IDisputesApi';
2
+ export * from './DisputesApi';
@@ -14,5 +14,5 @@ var __exportStar = (this && this.__exportStar) || function(m, exports) {
14
14
  for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
15
15
  };
16
16
  Object.defineProperty(exports, "__esModule", { value: true });
17
- __exportStar(require("./interfaces/IActivityApi"), exports);
18
- __exportStar(require("./ActivityApi"), exports);
17
+ __exportStar(require("./interfaces/IDisputesApi"), exports);
18
+ __exportStar(require("./DisputesApi"), exports);
@@ -0,0 +1,18 @@
1
+ /**
2
+ * Interfaz que define las operaciones que se pueden realizar en el servicio de disputas.
3
+ */
4
+ export interface IDisputesApi {
5
+ /**
6
+ * Obtener disputas por directoryId.
7
+ * @param directoryId DirectoryId del usuario a consultar.
8
+ * @param pageSize Tamaño de la página.
9
+ * @param index Índice de la página.
10
+ * @returns Una promesa que resuelve a void.
11
+ * @throws {Error} Lanza un error si los parámetros de entrada son inválidos.
12
+ */
13
+ getByDirectoryId(params: {
14
+ directoryId: string;
15
+ pageSize?: number;
16
+ index?: string;
17
+ }): Promise<void>;
18
+ }
@@ -6,6 +6,7 @@ export declare class IdentityApi implements IIdentityApi {
6
6
  private readonly baseUrl;
7
7
  constructor(httpRequest: IHttpRequest);
8
8
  getPeopleByIds(ids: string[]): Promise<any>;
9
+ getPeopleByCurp(curp: string): Promise<any>;
9
10
  updatePeopleById(id: string, data: PeopleUpdateRequest): Promise<void>;
10
11
  getProfilePicture(directoryId: string): Promise<any>;
11
12
  }
@@ -31,6 +31,14 @@ let IdentityApi = class IdentityApi {
31
31
  const url = `${this.baseUrl}identities/people?${ids.map(id => `id=${encodeURIComponent(id)}`).join('&')}`;
32
32
  return await this.httpRequest.get(`${url}`);
33
33
  }
34
+ async getPeopleByCurp(curp) {
35
+ if (!curp) {
36
+ throw new Error("CURP is required.");
37
+ }
38
+ const operationName = "getPeopleByCurp";
39
+ const url = `${this.baseUrl}?curp=${curp}`;
40
+ return await this.httpRequest.post(`${url}`, null, { 'operationName': operationName });
41
+ }
34
42
  async updatePeopleById(id, data) {
35
43
  if (!id) {
36
44
  throw new Error("People ID is required.");
@@ -26,4 +26,5 @@ export interface IIdentityApi {
26
26
  * @throws {Error} Lanza un error si los parámetros de entrada son inválidos.
27
27
  */
28
28
  getProfilePicture(directoryId: string): Promise<any>;
29
+ getPeopleByCurp(curp: string): Promise<any>;
29
30
  }
package/bin/index.d.ts CHANGED
@@ -30,3 +30,4 @@ export * from "./riskProfile";
30
30
  export * from "./fiadoMessages";
31
31
  export * from "./cnbv-business";
32
32
  export * from "./pomeloProcessor";
33
+ export * from "./disputes";
package/bin/index.js CHANGED
@@ -46,3 +46,4 @@ __exportStar(require("./riskProfile"), exports);
46
46
  __exportStar(require("./fiadoMessages"), exports);
47
47
  __exportStar(require("./cnbv-business"), exports);
48
48
  __exportStar(require("./pomeloProcessor"), exports);
49
+ __exportStar(require("./disputes"), exports);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@fiado/api-invoker",
3
- "version": "1.1.79",
3
+ "version": "1.1.81",
4
4
  "description": "Sirve como un puente entre diferentes funciones lambda, facilitando la comunicación entre ellas a traves de invocaciones http",
5
5
  "main": "bin/index.js",
6
6
  "types": "bin/index.d.ts",
@@ -51,6 +51,7 @@ import CnbvApi from "./cnbv-business/CnbvApi";
51
51
  import { ICnbvApi } from "./cnbv-business";
52
52
  import TransactionApi from "./transaction/api/TransactionApi";
53
53
  import { IPomeloProcessorApi, PomeloProcessorApi } from "./pomeloProcessor";
54
+ import { DisputesApi, IDisputesApi } from "./disputes";
54
55
 
55
56
  export const apiInvokerBindings = new ContainerModule((bind: interfaces.Bind) => {
56
57
  bind<IDirectoryApi>("IDirectoryApi").to(DirectoryApi);
@@ -89,4 +90,6 @@ export const apiInvokerBindings = new ContainerModule((bind: interfaces.Bind) =>
89
90
  bind<IFiadoMessagesApi>("IFiadoMessagesApi").to(FiadoMessagesApi);
90
91
  bind<ICnbvApi>("ICnbvApi").to(CnbvApi);
91
92
  bind<IPomeloProcessorApi>("IPomeloProcessorApi").to(PomeloProcessorApi);
93
+ bind<IDisputesApi>("IDisputesApi").to(DisputesApi);
94
+
92
95
  });
@@ -0,0 +1,31 @@
1
+ import { inject, injectable } from "inversify";
2
+ import { IHttpRequest } from "@fiado/http-client";
3
+ import dotenv from 'dotenv';
4
+ import { PeopleUpdateRequest } from "@fiado/type-kit/bin/identity";
5
+ import { IDisputesApi } from "./interfaces/IDisputesApi";
6
+ dotenv.config();
7
+
8
+ @injectable()
9
+ export class DisputesApi implements IDisputesApi {
10
+
11
+ private readonly baseUrl = process.env.DISPUTES_LAMBDA_URL || "";
12
+
13
+ constructor(@inject("IHttpRequest") private httpRequest: IHttpRequest) { }
14
+
15
+
16
+ async getByDirectoryId(params: { directoryId: string; pageSize?: number; index?: string; }): Promise<void> {
17
+
18
+ let queryParams = [];
19
+ if (!params.index) {
20
+ queryParams.push(`index=${params.index}`);
21
+ }
22
+
23
+ if (!params.pageSize) {
24
+ queryParams.push(`pageSize=${params.pageSize}`);
25
+ }
26
+
27
+ const url = `${this.baseUrl}disputes/${params.directoryId}?${queryParams.join('&')}`;
28
+ return await this.httpRequest.get(url);
29
+ }
30
+
31
+ }
@@ -0,0 +1,3 @@
1
+
2
+ export * from './interfaces/IDisputesApi';
3
+ export * from './DisputesApi';
@@ -0,0 +1,22 @@
1
+
2
+ /**
3
+ * Interfaz que define las operaciones que se pueden realizar en el servicio de disputas.
4
+ */
5
+ export interface IDisputesApi {
6
+
7
+ /**
8
+ * Obtener disputas por directoryId.
9
+ * @param directoryId DirectoryId del usuario a consultar.
10
+ * @param pageSize Tamaño de la página.
11
+ * @param index Índice de la página.
12
+ * @returns Una promesa que resuelve a void.
13
+ * @throws {Error} Lanza un error si los parámetros de entrada son inválidos.
14
+ */
15
+ getByDirectoryId(params:{
16
+ directoryId:string,
17
+ pageSize?:number,
18
+ index?:string
19
+ }): Promise<void>;
20
+
21
+
22
+ }
@@ -2,7 +2,7 @@ import { inject, injectable } from "inversify";
2
2
  import { IIdentityApi } from "./interfaces/IIdentityApi";
3
3
  import { IHttpRequest } from "@fiado/http-client";
4
4
  import dotenv from 'dotenv';
5
- import { PeopleUpdateRequest } from "@fiado/type-kit/bin/identity";
5
+ import { PeopleResponse, PeopleUpdateRequest } from "@fiado/type-kit/bin/identity";
6
6
  dotenv.config();
7
7
 
8
8
  @injectable()
@@ -22,6 +22,19 @@ export class IdentityApi implements IIdentityApi {
22
22
  return await this.httpRequest.get(`${url}`);
23
23
  }
24
24
 
25
+ async getPeopleByCurp(curp: string): Promise<any> {
26
+
27
+ if (!curp) {
28
+ throw new Error("CURP is required.")
29
+ }
30
+
31
+ const operationName = "getPeopleByCurp";
32
+
33
+ const url = `${this.baseUrl}?curp=${curp}`;
34
+
35
+ return await this.httpRequest.post(`${url}`, null, { 'operationName': operationName });
36
+ }
37
+
25
38
  async updatePeopleById(id: string, data: PeopleUpdateRequest): Promise<void> {
26
39
 
27
40
  if (!id) {
@@ -30,4 +30,6 @@ export interface IIdentityApi {
30
30
  */
31
31
  getProfilePicture(directoryId: string): Promise<any>;
32
32
 
33
+ getPeopleByCurp(curp: string): Promise<any>;
34
+
33
35
  }
package/src/index.ts CHANGED
@@ -29,4 +29,5 @@ export * from "./transactionProcessor";
29
29
  export * from "./riskProfile";
30
30
  export * from "./fiadoMessages";
31
31
  export * from "./cnbv-business";
32
- export * from "./pomeloProcessor";
32
+ export * from "./pomeloProcessor";
33
+ export * from "./disputes";
@@ -1,17 +0,0 @@
1
- import { IHttpRequest } from "@fiado/http-client";
2
- import { IActivityApi } from './interfaces/IActivityApi';
3
- import { TypeOfDirectoryId } from '@fiado/type-kit/bin/directory';
4
- export declare class ActivityApi implements IActivityApi {
5
- private httpRequest;
6
- private readonly baseUrl;
7
- constructor(httpRequest: IHttpRequest);
8
- getActivities(typeOfActivities: string[]): Promise<any>;
9
- getActivitiesByDirectoryIdAndTypeOfActivity(directoryId: string, typeOfActivities: string[]): Promise<any>;
10
- postActivity(params: {
11
- directoryId: string;
12
- typeOfDirectoryId: TypeOfDirectoryId;
13
- typeOfActivity: string;
14
- amount: string;
15
- date: string;
16
- }): Promise<any>;
17
- }
@@ -1,72 +0,0 @@
1
- "use strict";
2
- var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
3
- var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
4
- if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
5
- else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
6
- return c > 3 && r && Object.defineProperty(target, key, r), r;
7
- };
8
- var __metadata = (this && this.__metadata) || function (k, v) {
9
- if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
10
- };
11
- var __param = (this && this.__param) || function (paramIndex, decorator) {
12
- return function (target, key) { decorator(target, key, paramIndex); }
13
- };
14
- var __importDefault = (this && this.__importDefault) || function (mod) {
15
- return (mod && mod.__esModule) ? mod : { "default": mod };
16
- };
17
- Object.defineProperty(exports, "__esModule", { value: true });
18
- exports.ActivityApi = void 0;
19
- const dotenv_1 = __importDefault(require("dotenv"));
20
- const inversify_1 = require("inversify");
21
- dotenv_1.default.config();
22
- let ActivityApi = class ActivityApi {
23
- constructor(httpRequest) {
24
- this.httpRequest = httpRequest;
25
- this.baseUrl = process.env.ACTIVITY_LAMBDA_URL || "";
26
- }
27
- async getActivities(typeOfActivities) {
28
- let url = `${this.baseUrl}activities`;
29
- if (typeOfActivities.length > 0) {
30
- url = `${this.baseUrl}activities?${typeOfActivities.map(id => `typeOfActivities=${encodeURIComponent(id)}`).join('&')}`;
31
- }
32
- const operationName = "getActivities";
33
- return await this.httpRequest.post(`${url}`, null, { 'operationName': operationName });
34
- }
35
- async getActivitiesByDirectoryIdAndTypeOfActivity(directoryId, typeOfActivities) {
36
- if (directoryId == null || directoryId == undefined || directoryId == "") {
37
- throw new Error("At least directory ID is required.");
38
- }
39
- let url = `${this.baseUrl}activities/directory/${directoryId}`;
40
- if (typeOfActivities.length > 0) {
41
- url = `${this.baseUrl}activities/directory/${directoryId}?${typeOfActivities.map(id => `typeOfActivities=${encodeURIComponent(id)}`).join('&')}`;
42
- }
43
- const operationName = "getActivitiesByDirectoryIdAndTypeOfActivity";
44
- return await this.httpRequest.post(`${url}`, null, { 'operationName': operationName });
45
- }
46
- async postActivity(params) {
47
- if (params.directoryId == null || params.directoryId == undefined || params.directoryId == "") {
48
- throw new Error("At least directory ID is required.");
49
- }
50
- if (params.typeOfDirectoryId == null || params.typeOfDirectoryId == undefined) {
51
- throw new Error("At least typeOfDirectoryId is required.");
52
- }
53
- if (params.typeOfActivity == null || params.typeOfActivity == undefined || params.typeOfActivity == "") {
54
- throw new Error("At least typeOfActivity is required.");
55
- }
56
- if (params.amount == null || params.amount == undefined || params.amount == "") {
57
- throw new Error("At least amount is required.");
58
- }
59
- if (params.date == null || params.date == undefined || params.date == "") {
60
- throw new Error("At least date is required.");
61
- }
62
- const url = `${this.baseUrl}/activities/create`;
63
- const operationName = "postActivity";
64
- return await this.httpRequest.post(`${url}`, params, { 'operationName': operationName });
65
- }
66
- };
67
- exports.ActivityApi = ActivityApi;
68
- exports.ActivityApi = ActivityApi = __decorate([
69
- (0, inversify_1.injectable)(),
70
- __param(0, (0, inversify_1.inject)("IHttpRequest")),
71
- __metadata("design:paramtypes", [Object])
72
- ], ActivityApi);
@@ -1,2 +0,0 @@
1
- export * from './interfaces/IActivityApi';
2
- export * from './ActivityApi';
@@ -1,39 +0,0 @@
1
- import { TypeOfDirectoryId } from "@fiado/type-kit/bin/directory";
2
- /**
3
- * Interfaz para el servicio Directory que permite operaciones sobre directorios.
4
- */
5
- export interface IActivityApi {
6
- /**
7
- * Obtiene una lista de entidades de la tabla ActivityDirectory.
8
- * @param directoryId Directorio que se va a consultar.
9
- * @param typeOfActivities Array de tipos de actividades (Opcional).
10
- * @returns Retorna un arreglo de objetos de ActivityDirectory.
11
- * @throws {Error} Lanza un error si los parámetros de entrada son inválidos.
12
- */
13
- getActivitiesByDirectoryIdAndTypeOfActivity(directoryId: string, typeOfActivities: string[]): Promise<any>;
14
- /**
15
- * Obtener actividades globales.
16
- * @param typeOfActivity Tipo de actividad
17
- * Puede devolver un arreglo vacío si no se encuentran coincidencias.
18
- * @throws {Error} Lanza un error si los parámetros de entrada son inválidos.
19
- */
20
- getActivities(typeOfActivities: string[]): Promise<any>;
21
- /**
22
- * Proceso para agregar a las actividades.
23
- * @param directoryId Directorio
24
- * @param typeOfDirectoryId Tipo de directorio
25
- * @param typeOfActivity Tipo de actividad
26
- * @param amount Monto de la actividad
27
- * @param date Fecha de la actividad
28
- * @returns Retorna un objeto de ActivityDirectory.
29
- * Puede devolver un arreglo vacío si no se encuentran coincidencias.
30
- * @throws {Error} Lanza un error si los parámetros de entrada son inválidos.
31
- */
32
- postActivity(params: {
33
- directoryId: string;
34
- typeOfDirectoryId: TypeOfDirectoryId;
35
- typeOfActivity: string;
36
- amount: string;
37
- date: string;
38
- }): Promise<any>;
39
- }