@fiado/api-invoker 1.1.3 → 1.1.5
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.
- package/bin/container.config.js +2 -0
- package/bin/fraudPreventionEngine/api/FraudPreventionEngineApi.d.ts +11 -0
- package/bin/fraudPreventionEngine/api/FraudPreventionEngineApi.js +35 -0
- package/bin/fraudPreventionEngine/api/interfaces/IFraudPreventionEngineApi.d.ts +6 -0
- package/bin/fraudPreventionEngine/api/interfaces/IFraudPreventionEngineApi.js +2 -0
- package/bin/fraudPreventionEngine/index.d.ts +2 -0
- package/bin/fraudPreventionEngine/index.js +18 -0
- package/bin/index.d.ts +1 -0
- package/bin/index.js +1 -0
- package/bin/stpSpei/api/StpSpeiApi.d.ts +1 -1
- package/bin/stpSpei/api/interfaces/IStpSpeiApi.d.ts +1 -1
- package/package.json +2 -2
- package/src/container.config.ts +3 -0
- package/src/fraudPreventionEngine/api/FraudPreventionEngineApi.ts +23 -0
- package/src/fraudPreventionEngine/api/interfaces/IFraudPreventionEngineApi.ts +8 -0
- package/src/fraudPreventionEngine/index.ts +2 -0
- package/src/index.ts +2 -1
- package/src/stpSpei/api/StpSpeiApi.ts +1 -1
- package/src/stpSpei/api/interfaces/IStpSpeiApi.ts +1 -1
package/bin/container.config.js
CHANGED
|
@@ -29,6 +29,7 @@ const account_beneficiary_1 = require("./account-beneficiary");
|
|
|
29
29
|
const stpSpei_1 = require("./stpSpei");
|
|
30
30
|
const StpServicePaymentApi_1 = __importDefault(require("./stpServicePayment/api/StpServicePaymentApi"));
|
|
31
31
|
const bbvaRst_1 = require("./bbvaRst");
|
|
32
|
+
const FraudPreventionEngineApi_1 = __importDefault(require("./fraudPreventionEngine/api/FraudPreventionEngineApi"));
|
|
32
33
|
exports.apiInvokerBindings = new inversify_1.ContainerModule((bind) => {
|
|
33
34
|
bind("IDirectoryApi").to(directory_1.DirectoryApi);
|
|
34
35
|
bind("IIdentityApi").to(identity_1.IdentityApi);
|
|
@@ -54,4 +55,5 @@ exports.apiInvokerBindings = new inversify_1.ContainerModule((bind) => {
|
|
|
54
55
|
bind("IStpSpeiApi").to(stpSpei_1.StpSpeiApi);
|
|
55
56
|
bind("IStpServicePaymentApi").to(StpServicePaymentApi_1.default);
|
|
56
57
|
bind("IBBVARstApi").to(bbvaRst_1.BBVARstApi);
|
|
58
|
+
bind("IFraudPreventionEngineApi").to(FraudPreventionEngineApi_1.default);
|
|
57
59
|
});
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { IFraudPreventionEngineApi } from "./interfaces/IFraudPreventionEngineApi";
|
|
2
|
+
import { IHttpRequest } from "@fiado/http-client";
|
|
3
|
+
import GetAccountLevelParams from "@fiado/type-kit/bin/fraudPreventionEngine/dtos/GetAccountLevelParams";
|
|
4
|
+
import CreateAccountLevelRequest from "@fiado/type-kit/bin/fraudPreventionEngine/dtos/CreateAccountLevelRequest";
|
|
5
|
+
export default class FraudPreventionEngineApi implements IFraudPreventionEngineApi {
|
|
6
|
+
private httpRequest;
|
|
7
|
+
private readonly baseUrl;
|
|
8
|
+
constructor(httpRequest: IHttpRequest);
|
|
9
|
+
getAccountLevel(params: GetAccountLevelParams): Promise<any>;
|
|
10
|
+
createAccountLevel(request: CreateAccountLevelRequest): Promise<any>;
|
|
11
|
+
}
|
|
@@ -0,0 +1,35 @@
|
|
|
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
|
+
const inversify_1 = require("inversify");
|
|
16
|
+
let FraudPreventionEngineApi = class FraudPreventionEngineApi {
|
|
17
|
+
constructor(httpRequest) {
|
|
18
|
+
this.httpRequest = httpRequest;
|
|
19
|
+
this.baseUrl = process.env.FRAUD_PREVENTION_ENGINE_LAMBDA_URL || "";
|
|
20
|
+
}
|
|
21
|
+
async getAccountLevel(params) {
|
|
22
|
+
const url = `${this.baseUrl}/account/levels?${Object.entries(params).map(([key, value]) => `${key}=${encodeURIComponent(value)}`).join('&')}`;
|
|
23
|
+
return await this.httpRequest.get(url);
|
|
24
|
+
}
|
|
25
|
+
async createAccountLevel(request) {
|
|
26
|
+
const url = `${this.baseUrl}/account/levels`;
|
|
27
|
+
return await this.httpRequest.post(url, request);
|
|
28
|
+
}
|
|
29
|
+
};
|
|
30
|
+
FraudPreventionEngineApi = __decorate([
|
|
31
|
+
(0, inversify_1.injectable)(),
|
|
32
|
+
__param(0, (0, inversify_1.inject)("IHttpRequest")),
|
|
33
|
+
__metadata("design:paramtypes", [Object])
|
|
34
|
+
], FraudPreventionEngineApi);
|
|
35
|
+
exports.default = FraudPreventionEngineApi;
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import GetAccountLevelParams from "@fiado/type-kit/bin/fraudPreventionEngine/dtos/GetAccountLevelParams";
|
|
2
|
+
import CreateAccountLevelRequest from "@fiado/type-kit/bin/fraudPreventionEngine/dtos/CreateAccountLevelRequest";
|
|
3
|
+
export interface IFraudPreventionEngineApi {
|
|
4
|
+
getAccountLevel(params: GetAccountLevelParams): Promise<any>;
|
|
5
|
+
createAccountLevel(request: CreateAccountLevelRequest): Promise<any>;
|
|
6
|
+
}
|
|
@@ -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/IFraudPreventionEngineApi"), exports);
|
|
18
|
+
__exportStar(require("./api/FraudPreventionEngineApi"), exports);
|
package/bin/index.d.ts
CHANGED
package/bin/index.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { IStpSpeiApi } from "./interfaces/IStpSpeiApi";
|
|
2
2
|
import { IHttpRequest } from "@fiado/http-client";
|
|
3
|
-
import { PutStpOrderRequest } from "@fiado/type-kit/bin/
|
|
3
|
+
import { PutStpOrderRequest } from "@fiado/type-kit/bin/stpSpei";
|
|
4
4
|
export declare class StpSpeiApi implements IStpSpeiApi {
|
|
5
5
|
private httpRequest;
|
|
6
6
|
private readonly baseUrl;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@fiado/api-invoker",
|
|
3
|
-
"version": "1.1.
|
|
3
|
+
"version": "1.1.5",
|
|
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.31",
|
|
17
17
|
"@fiado/http-client": "^1.0.2",
|
|
18
18
|
"@fiado/logger": "^1.0.2",
|
|
19
|
-
"@fiado/type-kit": "^1.2.
|
|
19
|
+
"@fiado/type-kit": "^1.2.15",
|
|
20
20
|
"dotenv": "^16.4.5",
|
|
21
21
|
"inversify": "^6.0.2",
|
|
22
22
|
"reflect-metadata": "^0.2.1",
|
package/src/container.config.ts
CHANGED
|
@@ -35,6 +35,8 @@ import {IStpSpeiApi, StpSpeiApi} from "./stpSpei";
|
|
|
35
35
|
import StpServicePaymentApi from "./stpServicePayment/api/StpServicePaymentApi";
|
|
36
36
|
import {IStpServicePaymentApi} from "./stpServicePayment";
|
|
37
37
|
import {BBVARstApi, IBBVARstApi} from "./bbvaRst";
|
|
38
|
+
import FraudPreventionEngineApi from "./fraudPreventionEngine/api/FraudPreventionEngineApi";
|
|
39
|
+
import {IFraudPreventionEngineApi} from "./fraudPreventionEngine";
|
|
38
40
|
|
|
39
41
|
export const apiInvokerBindings = new ContainerModule((bind: interfaces.Bind) => {
|
|
40
42
|
bind<IDirectoryApi>("IDirectoryApi").to(DirectoryApi);
|
|
@@ -61,4 +63,5 @@ export const apiInvokerBindings = new ContainerModule((bind: interfaces.Bind) =>
|
|
|
61
63
|
bind<IStpSpeiApi>("IStpSpeiApi").to(StpSpeiApi);
|
|
62
64
|
bind<IStpServicePaymentApi>("IStpServicePaymentApi").to(StpServicePaymentApi);
|
|
63
65
|
bind<IBBVARstApi>("IBBVARstApi").to(BBVARstApi);
|
|
66
|
+
bind<IFraudPreventionEngineApi>("IFraudPreventionEngineApi").to(FraudPreventionEngineApi);
|
|
64
67
|
});
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import {IFraudPreventionEngineApi} from "./interfaces/IFraudPreventionEngineApi";
|
|
2
|
+
import {inject, injectable} from "inversify";
|
|
3
|
+
import {IHttpRequest} from "@fiado/http-client";
|
|
4
|
+
import GetAccountLevelParams from "@fiado/type-kit/bin/fraudPreventionEngine/dtos/GetAccountLevelParams";
|
|
5
|
+
import CreateAccountLevelRequest from "@fiado/type-kit/bin/fraudPreventionEngine/dtos/CreateAccountLevelRequest";
|
|
6
|
+
|
|
7
|
+
@injectable()
|
|
8
|
+
export default class FraudPreventionEngineApi implements IFraudPreventionEngineApi {
|
|
9
|
+
private readonly baseUrl = process.env.FRAUD_PREVENTION_ENGINE_LAMBDA_URL || "";
|
|
10
|
+
|
|
11
|
+
constructor(@inject("IHttpRequest") private httpRequest: IHttpRequest) {
|
|
12
|
+
}
|
|
13
|
+
|
|
14
|
+
async getAccountLevel(params: GetAccountLevelParams): Promise<any> {
|
|
15
|
+
const url: string = `${this.baseUrl}/account/levels?${Object.entries(params).map(([key, value]) => `${key}=${encodeURIComponent(value)}`).join('&')}`;
|
|
16
|
+
return await this.httpRequest.get(url);
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
async createAccountLevel(request: CreateAccountLevelRequest): Promise<any> {
|
|
20
|
+
const url: string = `${this.baseUrl}/account/levels`;
|
|
21
|
+
return await this.httpRequest.post(url, request);
|
|
22
|
+
}
|
|
23
|
+
}
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import GetAccountLevelParams from "@fiado/type-kit/bin/fraudPreventionEngine/dtos/GetAccountLevelParams";
|
|
2
|
+
import CreateAccountLevelRequest from "@fiado/type-kit/bin/fraudPreventionEngine/dtos/CreateAccountLevelRequest";
|
|
3
|
+
|
|
4
|
+
export interface IFraudPreventionEngineApi {
|
|
5
|
+
getAccountLevel(params: GetAccountLevelParams): Promise<any>;
|
|
6
|
+
|
|
7
|
+
createAccountLevel(request: CreateAccountLevelRequest): Promise<any>;
|
|
8
|
+
}
|
package/src/index.ts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import {IStpSpeiApi} from "./interfaces/IStpSpeiApi";
|
|
2
2
|
import {inject, injectable} from "inversify";
|
|
3
3
|
import {IHttpRequest} from "@fiado/http-client";
|
|
4
|
-
import {PutStpOrderRequest} from "@fiado/type-kit/bin/
|
|
4
|
+
import {PutStpOrderRequest} from "@fiado/type-kit/bin/stpSpei";
|
|
5
5
|
|
|
6
6
|
@injectable()
|
|
7
7
|
export class StpSpeiApi implements IStpSpeiApi {
|