@fiado/api-invoker 1.0.22 → 1.0.24

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.
@@ -1,5 +1,5 @@
1
- import { IDirectoryApi } from "./interfaces/IDirectoryApi";
2
1
  import { IHttpRequest } from "@fiado/http-client";
2
+ import { IDirectoryApi } from "./interfaces/IDirectoryApi";
3
3
  export declare class DirectoryApi implements IDirectoryApi {
4
4
  private httpRequest;
5
5
  private readonly baseUrl;
@@ -16,8 +16,8 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
16
16
  };
17
17
  Object.defineProperty(exports, "__esModule", { value: true });
18
18
  exports.DirectoryApi = void 0;
19
- const inversify_1 = require("inversify");
20
19
  const dotenv_1 = __importDefault(require("dotenv"));
20
+ const inversify_1 = require("inversify");
21
21
  dotenv_1.default.config();
22
22
  let DirectoryApi = class DirectoryApi {
23
23
  constructor(httpRequest) {
@@ -1,10 +1,12 @@
1
1
  import { IPomeloApi } from "./interfaces/IPomeloApi";
2
2
  import { IHttpRequest } from "@fiado/http-client";
3
- import { CreateBankAccountUserRequest, CreateBankAccountUserResponse } from "@fiado/type-kit/bin/account";
3
+ import { CreateBankAccountUserRequest, CreateBankAccountUserResponse, GetBankAccountUserResponse, UpdateBankAccountUserRequest, UpdateBankAccountUserResponse } from "@fiado/type-kit/bin/account";
4
4
  import { ApiGatewayResponse } from "@fiado/gateway-adapter";
5
5
  export default class PomeloApi implements IPomeloApi {
6
6
  private httpRequest;
7
7
  private readonly baseUrl;
8
8
  constructor(httpRequest: IHttpRequest);
9
9
  createUser(request: CreateBankAccountUserRequest): Promise<ApiGatewayResponse<CreateBankAccountUserResponse>>;
10
+ getUserById(externalUserId: string): Promise<GetBankAccountUserResponse>;
11
+ updateUser(object: UpdateBankAccountUserRequest): Promise<UpdateBankAccountUserResponse>;
10
12
  }
@@ -18,10 +18,19 @@ let PomeloApi = class PomeloApi {
18
18
  this.httpRequest = httpRequest;
19
19
  this.baseUrl = process.env.POMELO_LAMBDA_URL || "";
20
20
  }
21
+ //USER
21
22
  async createUser(request) {
22
23
  const url = `${this.baseUrl}users/create`;
23
24
  return await this.httpRequest.post(url, request);
24
25
  }
26
+ async getUserById(externalUserId) {
27
+ const url = `${this.baseUrl}users/${externalUserId}`;
28
+ return await this.httpRequest.get(url);
29
+ }
30
+ async updateUser(object) {
31
+ const url = `${this.baseUrl}/users/${object.id}`;
32
+ return await this.httpRequest.put(url, object);
33
+ }
25
34
  };
26
35
  PomeloApi = __decorate([
27
36
  (0, inversify_1.injectable)(),
@@ -1,11 +1,7 @@
1
1
  import { ITernApi } from "./interfaces/ITernApi";
2
2
  import { IHttpRequest } from "@fiado/http-client";
3
- import { CreateBankAccountRequest, CreateBankAccountResponse, CreateBankAccountUserRequest, CreateBankAccountUserResponse } from "@fiado/type-kit/bin/account";
4
3
  import { ApiGatewayResponse } from "@fiado/gateway-adapter";
5
- import { GetBankAccountUserRequest } from "@fiado/type-kit/bin/account/dtos/GetBankAccountUserRequest";
6
- import { GetBankAccountUserResponse } from "@fiado/type-kit/bin/account/dtos/GetBankAccountUserResponse";
7
- import { GetBankAccountRequest } from "@fiado/type-kit/bin/account/dtos/GetBankAccountRequest";
8
- import { GetBankAccountResponse } from "@fiado/type-kit/bin/account/dtos/GetBankAccountResponse";
4
+ import { CreateBankAccountRequest, CreateBankAccountResponse, CreateBankAccountUserRequest, CreateBankAccountUserResponse, GetBankAccountRequest, GetBankAccountResponse, GetBankAccountUserRequest, GetBankAccountUserResponse } from "@fiado/type-kit/bin/account";
9
5
  export default class TernApi implements ITernApi {
10
6
  private httpRequest;
11
7
  private readonly baseUrl;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@fiado/api-invoker",
3
- "version": "1.0.22",
3
+ "version": "1.0.24",
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/api-invoker": "^1.0.19",
17
17
  "@fiado/gateway-adapter": "^1.0.30",
18
18
  "@fiado/http-client": "^1.0.1",
19
- "@fiado/type-kit": "^1.0.67",
19
+ "@fiado/type-kit": "^1.0.71",
20
20
  "dotenv": "^16.4.5",
21
21
  "inversify": "^6.0.2",
22
22
  "reflect-metadata": "^0.2.1",
@@ -1,7 +1,8 @@
1
- import { inject, injectable } from "inversify";
2
- import { IDirectoryApi } from "./interfaces/IDirectoryApi";
3
- import { IHttpRequest } from "@fiado/http-client";
4
1
  import dotenv from 'dotenv';
2
+ import {inject, injectable} from "inversify";
3
+ import {IHttpRequest} from "@fiado/http-client";
4
+ import {IDirectoryApi} from "./interfaces/IDirectoryApi";
5
+
5
6
  dotenv.config();
6
7
 
7
8
  @injectable()
@@ -9,7 +10,8 @@ export class DirectoryApi implements IDirectoryApi {
9
10
 
10
11
  private readonly baseUrl = process.env.DIRECTORY_LAMBDA_URL || "";
11
12
 
12
- constructor(@inject("IHttpRequest") private httpRequest: IHttpRequest) { }
13
+ constructor(@inject("IHttpRequest") private httpRequest: IHttpRequest) {
14
+ }
13
15
 
14
16
  public async getByIds(ids: string[]): Promise<any> {
15
17
 
@@ -20,6 +22,6 @@ export class DirectoryApi implements IDirectoryApi {
20
22
  const url = `${this.baseUrl}?${ids.map(id => `directoryId=${encodeURIComponent(id)}`).join('&')}`;
21
23
  const operationName = "getUserInfoByIds";
22
24
 
23
- return await this.httpRequest.post(`${url}`, null, { 'operationName': operationName });
25
+ return await this.httpRequest.post(`${url}`, null, {'operationName': operationName});
24
26
  }
25
27
  }
package/src/index.ts CHANGED
@@ -5,7 +5,6 @@ export * from './sessionActivity';
5
5
  export * from './tern';
6
6
  export * from './pomelo';
7
7
  export * from './address';
8
-
9
8
  export * from "./container.config";
10
9
 
11
10
 
@@ -1,20 +1,96 @@
1
1
  import {IPomeloApi } from "./interfaces/IPomeloApi";
2
2
  import {inject, injectable} from "inversify";
3
3
  import {IHttpRequest} from "@fiado/http-client";
4
- import {CreateBankAccountUserRequest, CreateBankAccountUserResponse} from "@fiado/type-kit/bin/account";
4
+ import {CreateBankAccountUserRequest, CreateBankAccountUserResponse, GetBankAccountUserRequest, GetBankAccountUserResponse, UpdateBankAccountUserRequest, UpdateBankAccountUserResponse} from "@fiado/type-kit/bin/account";
5
5
  import {ApiGatewayResponse} from "@fiado/gateway-adapter";
6
6
 
7
7
 
8
8
  @injectable()
9
9
  export default class PomeloApi implements IPomeloApi {
10
+
11
+
10
12
  private readonly baseUrl = process.env.POMELO_LAMBDA_URL || "";
11
13
 
12
14
  constructor(@inject("IHttpRequest") private httpRequest: IHttpRequest) {
13
15
  }
14
-
16
+
17
+
18
+ //USER
15
19
  async createUser(request: CreateBankAccountUserRequest): Promise<ApiGatewayResponse<CreateBankAccountUserResponse>> {
16
20
  const url: string = `${this.baseUrl}users/create`;
17
21
  return await this.httpRequest.post(url, request);
18
22
  }
19
23
 
24
+ public async getUserById(externalUserId: string): Promise<GetBankAccountUserResponse> {
25
+ const url: string = `${this.baseUrl}users/${externalUserId}`;
26
+ return await this.httpRequest.get(url);
27
+ }
28
+
29
+ public async updateUser(object: UpdateBankAccountUserRequest): Promise<UpdateBankAccountUserResponse> {
30
+ const url: string = `${this.baseUrl}/users/${object.id}`;
31
+ return await this.httpRequest.put(url, object);
32
+ }
33
+
34
+ // //Card
35
+ // public async getCardSensitiveInformation(externalCardId: string, externalUserId?: string): Promise<GetBankAccountSensitiveInformationOutput> {
36
+ // const url: string = `${this.baseUrl}cards/${externalCardId}/sensitive?externalUserId=${externalUserId}`;
37
+ // return await this.httpRequest.get(url);
38
+ // }
39
+
40
+ // public async getCardsById(externalCardId: string): Promise<GetBankAccountCardOutput> {
41
+ // const url: string = `${this.baseUrl}cards?externalCardId=${externalCardId}`;
42
+ // return await this.httpRequest.get(url);
43
+ // }
44
+
45
+ // public async getCardsByUserId(externalUserId: string): Promise<GetBankAccountCardOutput> {
46
+ // const url: string = `${this.baseUrl}cards?externalUserId=${externalUserId}`;
47
+ // return await this.httpRequest.get(url);
48
+ // }
49
+
50
+ // public async createCard(object: CreateBankAccountCardInput): Promise<CreateBankAccountCardOutput> {
51
+ // const url: string = `${this.baseUrl}cards/create`;
52
+ // return await this.httpRequest.post(url, object);
53
+ // }
54
+
55
+ // public async blockCard(object: UpdateBankAccountCardInput): Promise<UpdateBankAccountCardOutput> {
56
+ // const url: string = `${this.baseUrl}cards/${object.cardId}/`;
57
+ // return await this.httpRequest.put(url, object);
58
+ // }
59
+
60
+ // public async changePin(object: UpdateBankAccountCardInput): Promise<UpdateBankAccountCardOutput> {
61
+ // const url: string = `${this.baseUrl}cards/${object.cardId}/`;
62
+ // return await this.httpRequest.put(url, object);
63
+ // }
64
+
65
+ // public async activateCard(object: ActivateBankAccountCardInput): Promise<ActivateBankAccountCardOutput> {
66
+ // const url: string = `${this.baseUrl}cards/activate`;
67
+ // return await this.httpRequest.post(url, object);
68
+ // }
69
+
70
+ // public async updateCard(object: UpdateBankAccountCardInput): Promise<UpdateBankAccountCardOutput> {
71
+ // const url: string = `${this.baseUrl}cards/${object.cardId}/`;
72
+ // return await this.httpRequest.put(url, object);
73
+ // }
74
+
75
+
76
+ // //Shipping
77
+
78
+ // public async createShipment(object: CreateBankAccountCardShippingInput): Promise<any> {
79
+ // const url: string = `${this.baseUrl}shipment/create`;
80
+ // return await this.httpRequest.post(url, object);
81
+ // }
82
+
83
+ // public async getShipment(object: GetBankAccountShippingInput): Promise<GetBankAccountShippingOutput> {
84
+ // const url: string = `${this.baseUrl}shipment/${object.shippingId}`;
85
+ // return await this.httpRequest.get(url);
86
+ // }
87
+
88
+ // public async replaceCardByExternalId(object: ExternalReplaceCardInput): Promise<ExternalReplaceCardOutput> {
89
+ // const url: string = `${this.baseUrl}cards/${object.externalCardId}/replace`;
90
+ // return await this.httpRequest.put(url, object);
91
+ // }
92
+
93
+
94
+
95
+
20
96
  }
@@ -1,4 +1,4 @@
1
- import {CreateBankAccountUserRequest, CreateBankAccountUserResponse} from "@fiado/type-kit/bin/account";
1
+ import {CreateBankAccountUserRequest, CreateBankAccountUserResponse, GetBankAccountUserRequest, GetBankAccountUserResponse} from "@fiado/type-kit/bin/account";
2
2
  import {ApiGatewayResponse} from "@fiado/gateway-adapter";
3
3
 
4
4
  export interface IPomeloApi {
@@ -1,17 +1,17 @@
1
1
  import {ITernApi} from "./interfaces/ITernApi";
2
2
  import {inject, injectable} from "inversify";
3
3
  import {IHttpRequest} from "@fiado/http-client";
4
+ import {ApiGatewayResponse} from "@fiado/gateway-adapter";
4
5
  import {
5
6
  CreateBankAccountRequest,
6
7
  CreateBankAccountResponse,
7
8
  CreateBankAccountUserRequest,
8
- CreateBankAccountUserResponse
9
+ CreateBankAccountUserResponse,
10
+ GetBankAccountRequest,
11
+ GetBankAccountResponse,
12
+ GetBankAccountUserRequest,
13
+ GetBankAccountUserResponse
9
14
  } from "@fiado/type-kit/bin/account";
10
- import {ApiGatewayResponse} from "@fiado/gateway-adapter";
11
- import {GetBankAccountUserRequest} from "@fiado/type-kit/bin/account/dtos/GetBankAccountUserRequest";
12
- import {GetBankAccountUserResponse} from "@fiado/type-kit/bin/account/dtos/GetBankAccountUserResponse";
13
- import {GetBankAccountRequest} from "@fiado/type-kit/bin/account/dtos/GetBankAccountRequest";
14
- import {GetBankAccountResponse} from "@fiado/type-kit/bin/account/dtos/GetBankAccountResponse";
15
15
 
16
16
 
17
17
  @injectable()