@fiado/api-invoker 1.1.58 → 1.1.60

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.
@@ -6,6 +6,7 @@ export default class AccountFiadoSAApi implements IAccountFiadoSAApi {
6
6
  private httpRequest;
7
7
  private readonly baseUrl;
8
8
  constructor(httpRequest: IHttpRequest);
9
+ cancelAccount(directoryId: string, accountNumber: string, documentNumber: string): Promise<ApiGatewayResponse<void>>;
9
10
  createAccount(data: AccountCreateRequest): Promise<ApiGatewayResponse<AccountCreateResponse[]>>;
10
11
  getAccountByDirectoryId(directoryId: string): Promise<ApiGatewayResponse<GetAccountResponse[]>>;
11
12
  update(directoryId: string, data: AccountUpdateRequest): Promise<ApiGatewayResponse<void>>;
@@ -18,6 +18,10 @@ let AccountFiadoSAApi = class AccountFiadoSAApi {
18
18
  this.httpRequest = httpRequest;
19
19
  this.baseUrl = process.env.ACCOUNT_FIADOSA_LAMBDA_URL || "";
20
20
  }
21
+ async cancelAccount(directoryId, accountNumber, documentNumber) {
22
+ const url = `${this.baseUrl}/cancel`;
23
+ return await this.httpRequest.post(url, { directoryId, accountNumber, documentNumber });
24
+ }
21
25
  async createAccount(data) {
22
26
  const url = `${this.baseUrl}`;
23
27
  return await this.httpRequest.post(url, data);
@@ -4,4 +4,5 @@ export interface IAccountFiadoSAApi {
4
4
  createAccount(data: AccountCreateRequest): Promise<ApiGatewayResponse<AccountCreateResponse[]>>;
5
5
  getAccountByDirectoryId(directoryId: string): Promise<ApiGatewayResponse<GetAccountResponse[]>>;
6
6
  update(directoryId: string, data: AccountUpdateRequest): Promise<ApiGatewayResponse<void>>;
7
+ cancelAccount(directoryId: string, accountNumber: string, documentNumber: string): Promise<ApiGatewayResponse<void>>;
7
8
  }
@@ -6,7 +6,7 @@ export default class AccountPagoConfiadoApi implements IAccountPagoConfiadoApi {
6
6
  private httpRequest;
7
7
  private readonly baseUrl;
8
8
  constructor(httpRequest: IHttpRequest);
9
- cancelAccount(directoryId: string, accountNumber: string, documentNumber: string): Promise<ApiGatewayResponse<void>>;
9
+ cancelAccount(directoryId: string, accountNumber?: string, documentNumber?: string): Promise<ApiGatewayResponse<void>>;
10
10
  createAccount(data: AccountCreateRequest): Promise<ApiGatewayResponse<AccountCreateResponse>>;
11
11
  getAccountByDirectoryId(directoryId: string): Promise<ApiGatewayResponse<GetAccountResponse[]>>;
12
12
  updateAccountBalance(accountId: string, params: AccountUpdateBalanceRequest): Promise<ApiGatewayResponse<Boolean>>;
@@ -7,5 +7,5 @@ export interface IAccountPagoConfiadoApi {
7
7
  update(directoryId: string, data: AccountUpdateRequest): Promise<ApiGatewayResponse<void>>;
8
8
  updateByAccountNumber(accountNumber: string, data: AccountUpdateRequest): Promise<ApiGatewayResponse<void>>;
9
9
  getAccountByAccountNumber(accountNumber: string): Promise<ApiGatewayResponse<void>>;
10
- cancelAccount(directoryId: string, accountNumber: string, documentNumber: string): Promise<ApiGatewayResponse<void>>;
10
+ cancelAccount(directoryId: string, accountNumber?: string, documentNumber?: string): Promise<ApiGatewayResponse<void>>;
11
11
  }
@@ -2,6 +2,7 @@ import { IHttpRequest } from "@fiado/http-client";
2
2
  import { IDirectoryApi } from "./interfaces/IDirectoryApi";
3
3
  import { Provider } from '@fiado/type-kit/bin/provider';
4
4
  import { Profile } from '@fiado/type-kit/bin/directory/enums/Profile';
5
+ import { Status } from '@fiado/type-kit/bin/directory/enums/Status';
5
6
  export declare class DirectoryApi implements IDirectoryApi {
6
7
  private httpRequest;
7
8
  private readonly baseUrl;
@@ -14,4 +15,5 @@ export declare class DirectoryApi implements IDirectoryApi {
14
15
  addOwnerDirectoryId(directoryId: string, newOwnerDirectoryId: any): Promise<any>;
15
16
  updateOwnerDirectoryId(directoryId: string, newOwnerDirectoryId: any): Promise<any>;
16
17
  updateUserProfile(directoryId: string, profile: Profile): Promise<void>;
18
+ updateStatus(directoryId: string, status: Status.CANCELLED): Promise<void>;
17
19
  }
@@ -91,6 +91,15 @@ let DirectoryApi = class DirectoryApi {
91
91
  };
92
92
  return await this.httpRequest.post(`${url}`, body, { 'operationName': operationName });
93
93
  }
94
+ async updateStatus(directoryId, status) {
95
+ const url = `${this.baseUrl}`;
96
+ const operationName = "updateStatus";
97
+ const body = {
98
+ directoryId: directoryId,
99
+ status: status
100
+ };
101
+ await this.httpRequest.post(`${url}`, body, { 'operationName': operationName });
102
+ }
94
103
  };
95
104
  exports.DirectoryApi = DirectoryApi;
96
105
  exports.DirectoryApi = DirectoryApi = __decorate([
@@ -1,4 +1,5 @@
1
1
  import { Profile } from "@fiado/type-kit/bin/directory/enums/Profile";
2
+ import { Status } from "@fiado/type-kit/bin/directory/enums/Status";
2
3
  import { Provider } from "@fiado/type-kit/bin/provider";
3
4
  /**
4
5
  * Interfaz para el servicio Directory que permite operaciones sobre directorios.
@@ -48,4 +49,5 @@ export interface IDirectoryApi {
48
49
  addOwnerDirectoryId(directoryId: string, newOwnerDirectoryId: any): Promise<any>;
49
50
  updateUserProfile(directoryId: string, profile: Profile): Promise<void>;
50
51
  updateOwnerDirectoryId(directoryId: string, newOwnerDirectoryId: any): Promise<any>;
52
+ updateStatus(directoryId: string, status: Status.CANCELLED): Promise<void>;
51
53
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@fiado/api-invoker",
3
- "version": "1.1.58",
3
+ "version": "1.1.60",
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",
@@ -16,7 +16,7 @@
16
16
  "@fiado/gateway-adapter": "^1.1.33",
17
17
  "@fiado/http-client": "^1.0.2",
18
18
  "@fiado/logger": "^1.0.2",
19
- "@fiado/type-kit": "^1.4.46",
19
+ "@fiado/type-kit": "^1.4.51",
20
20
  "dotenv": "^16.4.5",
21
21
  "inversify": "^6.0.2",
22
22
  "reflect-metadata": "^0.2.1",
@@ -11,6 +11,11 @@ export default class AccountFiadoSAApi implements IAccountFiadoSAApi {
11
11
  constructor(@inject("IHttpRequest") private httpRequest: IHttpRequest) {
12
12
  }
13
13
 
14
+ async cancelAccount(directoryId:string,accountNumber: string, documentNumber: string): Promise<ApiGatewayResponse<void>> {
15
+ const url = `${this.baseUrl}/cancel`;
16
+ return await this.httpRequest.post(url, {directoryId,accountNumber,documentNumber});
17
+ }
18
+
14
19
  async createAccount(data: AccountCreateRequest): Promise<ApiGatewayResponse<AccountCreateResponse[]>> {
15
20
  const url = `${this.baseUrl}`;
16
21
  return await this.httpRequest.post(url, data);
@@ -7,6 +7,8 @@ export interface IAccountFiadoSAApi {
7
7
 
8
8
  getAccountByDirectoryId(directoryId: string): Promise<ApiGatewayResponse<GetAccountResponse[]>>;
9
9
 
10
- update(directoryId: string, data: AccountUpdateRequest): Promise<ApiGatewayResponse<void>>
10
+ update(directoryId: string, data: AccountUpdateRequest): Promise<ApiGatewayResponse<void>>
11
+
12
+ cancelAccount(directoryId:string,accountNumber:string,documentNumber:string): Promise<ApiGatewayResponse<void>>;
11
13
 
12
14
  }
@@ -10,7 +10,7 @@ export default class AccountPagoConfiadoApi implements IAccountPagoConfiadoApi {
10
10
 
11
11
  constructor(@inject("IHttpRequest") private httpRequest: IHttpRequest) {}
12
12
 
13
- async cancelAccount(directoryId:string,accountNumber: string, documentNumber: string): Promise<ApiGatewayResponse<void>> {
13
+ async cancelAccount(directoryId:string,accountNumber?: string, documentNumber?: string): Promise<ApiGatewayResponse<void>> {
14
14
  const url = `${this.baseUrl}/cancel`;
15
15
  return await this.httpRequest.post(url, {directoryId,accountNumber,documentNumber});
16
16
  }
@@ -21,5 +21,5 @@ export interface IAccountPagoConfiadoApi {
21
21
 
22
22
  getAccountByAccountNumber(accountNumber: string): Promise<ApiGatewayResponse<void>>;
23
23
 
24
- cancelAccount(directoryId:string,accountNumber:string,documentNumber:string): Promise<ApiGatewayResponse<void>>;
24
+ cancelAccount(directoryId:string,accountNumber?:string,documentNumber?:string): Promise<ApiGatewayResponse<void>>;
25
25
  }
@@ -4,7 +4,7 @@ import { IHttpRequest } from "@fiado/http-client";
4
4
  import { IDirectoryApi } from "./interfaces/IDirectoryApi";
5
5
  import { Provider } from '@fiado/type-kit/bin/provider';
6
6
  import { Profile } from '@fiado/type-kit/bin/directory/enums/Profile';
7
-
7
+ import { Status } from '@fiado/type-kit/bin/directory/enums/Status';
8
8
  dotenv.config();
9
9
 
10
10
  @injectable()
@@ -112,4 +112,17 @@ export class DirectoryApi implements IDirectoryApi {
112
112
 
113
113
  return await this.httpRequest.post(`${url}`, body, { 'operationName': operationName });
114
114
  }
115
+
116
+ public async updateStatus(directoryId: string, status: Status.CANCELLED): Promise<void> {
117
+
118
+ const url = `${this.baseUrl}`;
119
+ const operationName = "updateStatus";
120
+
121
+ const body = {
122
+ directoryId: directoryId,
123
+ status: status
124
+ }
125
+
126
+ await this.httpRequest.post(`${url}`, body, { 'operationName': operationName });
127
+ }
115
128
  }
@@ -1,4 +1,5 @@
1
1
  import { Profile } from "@fiado/type-kit/bin/directory/enums/Profile";
2
+ import { Status } from "@fiado/type-kit/bin/directory/enums/Status";
2
3
  import { Provider } from "@fiado/type-kit/bin/provider";
3
4
 
4
5
  /**
@@ -52,15 +53,11 @@ export interface IDirectoryApi {
52
53
  */
53
54
  getByPhoneNumber(phoneNumber: string): Promise<any>
54
55
 
55
-
56
-
57
56
  addOwnerDirectoryId(directoryId: string, newOwnerDirectoryId): Promise<any>
58
57
 
59
-
60
-
61
58
  updateUserProfile(directoryId: string, profile: Profile): Promise<void>
62
59
 
63
60
  updateOwnerDirectoryId(directoryId: string, newOwnerDirectoryId): Promise<any>
64
61
 
65
-
62
+ updateStatus(directoryId: string, status: Status.CANCELLED): Promise<void>
66
63
  }
@@ -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,18 +0,0 @@
1
- "use strict";
2
- var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
- if (k2 === undefined) k2 = k;
4
- var desc = Object.getOwnPropertyDescriptor(m, k);
5
- if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
6
- desc = { enumerable: true, get: function() { return m[k]; } };
7
- }
8
- Object.defineProperty(o, k2, desc);
9
- }) : (function(o, m, k, k2) {
10
- if (k2 === undefined) k2 = k;
11
- o[k2] = m[k];
12
- }));
13
- var __exportStar = (this && this.__exportStar) || function(m, exports) {
14
- for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
15
- };
16
- Object.defineProperty(exports, "__esModule", { value: true });
17
- __exportStar(require("./interfaces/IActivityApi"), exports);
18
- __exportStar(require("./ActivityApi"), exports);
@@ -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
- }
@@ -1,2 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });