@fiado/api-invoker 1.1.48 → 1.1.50

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.
@@ -0,0 +1,8 @@
1
+ import { IHttpRequest } from "@fiado/http-client";
2
+ import { IFiadoMessagesApi } from "./interfaces/IFiadoMessagesApi";
3
+ export declare class FiadoMessagesApi implements IFiadoMessagesApi {
4
+ private httpRequest;
5
+ private readonly baseUrl;
6
+ constructor(httpRequest: IHttpRequest);
7
+ getValidatedOtpByDirectoryIdAndOtpCode(directoryId: string, otpCode: string): Promise<any>;
8
+ }
@@ -0,0 +1,37 @@
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
+ Object.defineProperty(exports, "__esModule", { value: true });
15
+ exports.FiadoMessagesApi = void 0;
16
+ const inversify_1 = require("inversify");
17
+ let FiadoMessagesApi = class FiadoMessagesApi {
18
+ constructor(httpRequest) {
19
+ this.httpRequest = httpRequest;
20
+ this.baseUrl = process.env.MESSAGE_LAMBDA_URL || "";
21
+ }
22
+ async getValidatedOtpByDirectoryIdAndOtpCode(directoryId, otpCode) {
23
+ const url = `${this.baseUrl}`;
24
+ const operationName = "getValidatedOtpByDirectoryIdAndOtpCode";
25
+ const request = {
26
+ directoryId: directoryId,
27
+ otpCode: otpCode
28
+ };
29
+ return await this.httpRequest.post(`${url}`, request, { 'operationName': operationName });
30
+ }
31
+ };
32
+ exports.FiadoMessagesApi = FiadoMessagesApi;
33
+ exports.FiadoMessagesApi = FiadoMessagesApi = __decorate([
34
+ (0, inversify_1.injectable)(),
35
+ __param(0, (0, inversify_1.inject)("IHttpRequest")),
36
+ __metadata("design:paramtypes", [Object])
37
+ ], FiadoMessagesApi);
@@ -0,0 +1,3 @@
1
+ export interface IFiadoMessagesApi {
2
+ getValidatedOtpByDirectoryIdAndOtpCode(directoryId: string, otpCode: string): Promise<any>;
3
+ }
@@ -0,0 +1,2 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
@@ -0,0 +1,2 @@
1
+ export * from './api/interfaces/IFiadoMessagesApi';
2
+ export * from './api/FiadoMessagesApi';
@@ -0,0 +1,18 @@
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("./api/interfaces/IFiadoMessagesApi"), exports);
18
+ __exportStar(require("./api/FiadoMessagesApi"), exports);
package/bin/index.d.ts CHANGED
@@ -27,3 +27,4 @@ export * from "./group";
27
27
  export * from "./activity-business";
28
28
  export * from "./transactionProcessor";
29
29
  export * from "./riskProfile";
30
+ export * from "./fiadoMessages";
package/bin/index.js CHANGED
@@ -43,3 +43,4 @@ __exportStar(require("./group"), exports);
43
43
  __exportStar(require("./activity-business"), exports);
44
44
  __exportStar(require("./transactionProcessor"), exports);
45
45
  __exportStar(require("./riskProfile"), exports);
46
+ __exportStar(require("./fiadoMessages"), exports);
@@ -9,6 +9,7 @@ export default class TernApi implements ITernApi {
9
9
  getUser(request: GetBankAccountUserRequest): Promise<any>;
10
10
  createUser(request: CreateBankAccountUserRequest): Promise<any>;
11
11
  getAccount(request: GetBankAccountRequest): Promise<any>;
12
+ getBusinessAccount(request: GetBankAccountRequest): Promise<any>;
12
13
  createAccount(request: CreateBankAccountRequest): Promise<any>;
13
14
  getCardSensitiveInformation(externalCardId: string, externalUserId?: string): Promise<any>;
14
15
  getCardsById(externalCardId: string): Promise<any>;
@@ -29,7 +29,11 @@ let TernApi = class TernApi {
29
29
  }
30
30
  /// ACCOUNTS
31
31
  async getAccount(request) {
32
- const url = `${this.baseUrl}accounts/${request.externalAccountId}?accountType=${request.accountType ?? 'USER'}`;
32
+ const url = `${this.baseUrl}accounts/${request.externalAccountId}`;
33
+ return await this.httpRequest.get(url);
34
+ }
35
+ async getBusinessAccount(request) {
36
+ const url = `${this.baseUrl}accounts/${request.externalAccountId}?accountType=BUSINESS`;
33
37
  return await this.httpRequest.get(url);
34
38
  }
35
39
  async createAccount(request) {
@@ -5,6 +5,7 @@ import { ActivateBankAccountCardRequest, AssignCardRequest, CreateBankAccountCar
5
5
  export interface ITernApi {
6
6
  getUser(request: GetBankAccountUserRequest): Promise<any>;
7
7
  getAccount(request: GetBankAccountRequest): Promise<any>;
8
+ getBusinessAccount(request: GetBankAccountRequest): Promise<any>;
8
9
  createUser(request: CreateBankAccountUserRequest): Promise<any>;
9
10
  createAccount(request: CreateBankAccountRequest): Promise<any>;
10
11
  getCardsById(externalCardId: string): Promise<any>;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@fiado/api-invoker",
3
- "version": "1.1.48",
3
+ "version": "1.1.50",
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",
@@ -0,0 +1,21 @@
1
+ import {inject, injectable} from "inversify";
2
+ import {IHttpRequest} from "@fiado/http-client";
3
+ import {IFiadoMessagesApi} from "./interfaces/IFiadoMessagesApi";
4
+
5
+ @injectable()
6
+ export class FiadoMessagesApi implements IFiadoMessagesApi {
7
+ private readonly baseUrl = process.env.MESSAGE_LAMBDA_URL || "";
8
+
9
+ constructor(@inject("IHttpRequest") private httpRequest: IHttpRequest) {
10
+ }
11
+
12
+ async getValidatedOtpByDirectoryIdAndOtpCode(directoryId: string, otpCode: string): Promise<any> {
13
+ const url: string = `${this.baseUrl}`;
14
+ const operationName: string = "getValidatedOtpByDirectoryIdAndOtpCode";
15
+ const request = {
16
+ directoryId: directoryId,
17
+ otpCode: otpCode
18
+ };
19
+ return await this.httpRequest.post(`${url}`, request, {'operationName': operationName});
20
+ }
21
+ }
@@ -0,0 +1,3 @@
1
+ export interface IFiadoMessagesApi {
2
+ getValidatedOtpByDirectoryIdAndOtpCode(directoryId: string, otpCode: string): Promise<any>;
3
+ }
@@ -0,0 +1,2 @@
1
+ export * from './api/interfaces/IFiadoMessagesApi';
2
+ export * from './api/FiadoMessagesApi';
package/src/index.ts CHANGED
@@ -26,4 +26,5 @@ export * from "./fraudPreventionEngine";
26
26
  export * from "./group";
27
27
  export * from "./activity-business";
28
28
  export * from "./transactionProcessor";
29
- export * from "./riskProfile";
29
+ export * from "./riskProfile";
30
+ export * from "./fiadoMessages";
@@ -36,7 +36,12 @@ export default class TernApi implements ITernApi {
36
36
 
37
37
  /// ACCOUNTS
38
38
  async getAccount(request: GetBankAccountRequest): Promise<any> {
39
- const url: string = `${this.baseUrl}accounts/${request.externalAccountId}?accountType=${request.accountType??'USER'}`;
39
+ const url: string = `${this.baseUrl}accounts/${request.externalAccountId}`;
40
+ return await this.httpRequest.get(url);
41
+ }
42
+
43
+ async getBusinessAccount(request: GetBankAccountRequest): Promise<any> {
44
+ const url: string = `${this.baseUrl}accounts/${request.externalAccountId}?accountType=BUSINESS`;
40
45
  return await this.httpRequest.get(url);
41
46
  }
42
47
 
@@ -8,6 +8,8 @@ export interface ITernApi {
8
8
 
9
9
  getAccount(request: GetBankAccountRequest): Promise<any>;
10
10
 
11
+ getBusinessAccount(request: GetBankAccountRequest): Promise<any>
12
+
11
13
  createUser(request: CreateBankAccountUserRequest): Promise<any>;
12
14
 
13
15
  createAccount(request: CreateBankAccountRequest): Promise<any>