@fiado/api-invoker 1.0.72 → 1.0.74
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/account-fiadoinc/AccountFiadoIncApi.d.ts +2 -1
- package/bin/account-fiadoinc/AccountFiadoIncApi.js +6 -2
- package/bin/account-fiadoinc/interfaces/IAccountFiadoIncApi.d.ts +2 -1
- package/bin/account-fiadosa/AccountFiadoSAApi.js +1 -1
- package/bin/account-pagoconfiado/AccountPagoConfiadoApi.js +1 -1
- package/bin/collector/CollectorApi.d.ts +9 -0
- package/bin/collector/CollectorApi.js +37 -0
- package/bin/collector/index.d.ts +2 -0
- package/bin/collector/index.js +18 -0
- package/bin/collector/interfaces/ICollectorApi.d.ts +14 -0
- package/bin/collector/interfaces/ICollectorApi.js +2 -0
- package/bin/container.config.js +2 -0
- package/bin/index.d.ts +1 -0
- package/bin/index.js +1 -0
- package/package.json +5 -5
- package/src/account-fiadoinc/AccountFiadoIncApi.ts +8 -3
- package/src/account-fiadoinc/interfaces/IAccountFiadoIncApi.ts +3 -1
- package/src/account-fiadosa/AccountFiadoSAApi.ts +1 -1
- package/src/account-pagoconfiado/AccountPagoConfiadoApi.ts +1 -1
- package/src/collector/CollectorApi.ts +21 -0
- package/src/collector/index.ts +3 -0
- package/src/collector/interfaces/ICollectorApi.ts +19 -0
- package/src/container.config.ts +3 -0
- package/src/index.ts +2 -1
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { IAccountFiadoIncApi } from "./interfaces/IAccountFiadoIncApi";
|
|
2
|
-
import { AccountCreateRequest, AccountCreateResponse, GetAccountResponse, GetPocketBalanceResponse } from "@fiado/type-kit/bin/account";
|
|
2
|
+
import { AccountCreateRequest, AccountCreateResponse, AccountUpdateBalanceRequest, GetAccountResponse, GetPocketBalanceResponse } from "@fiado/type-kit/bin/account";
|
|
3
3
|
import { IHttpRequest } from "@fiado/http-client";
|
|
4
4
|
import { ApiGatewayResponse } from "@fiado/gateway-adapter";
|
|
5
5
|
export default class AccountFiadoIncApi implements IAccountFiadoIncApi {
|
|
@@ -9,4 +9,5 @@ export default class AccountFiadoIncApi implements IAccountFiadoIncApi {
|
|
|
9
9
|
createAccount(data: AccountCreateRequest): Promise<ApiGatewayResponse<AccountCreateResponse>>;
|
|
10
10
|
getAccountByDirectoryId(directoryId: string): Promise<ApiGatewayResponse<GetAccountResponse[]>>;
|
|
11
11
|
getPocketBalance(directoryId: string): Promise<ApiGatewayResponse<GetPocketBalanceResponse>>;
|
|
12
|
+
updatePocketBalance(pocketId: string, request: AccountUpdateBalanceRequest): Promise<ApiGatewayResponse<null>>;
|
|
12
13
|
}
|
|
@@ -23,13 +23,17 @@ let AccountFiadoIncApi = class AccountFiadoIncApi {
|
|
|
23
23
|
return await this.httpRequest.post(url, data);
|
|
24
24
|
}
|
|
25
25
|
async getAccountByDirectoryId(directoryId) {
|
|
26
|
-
const url = `${this.baseUrl}/${directoryId}`;
|
|
26
|
+
const url = `${this.baseUrl}users/${directoryId}`;
|
|
27
27
|
return await this.httpRequest.get(url);
|
|
28
28
|
}
|
|
29
29
|
async getPocketBalance(directoryId) {
|
|
30
|
-
const url = `${this.baseUrl}/pockets/${directoryId}/balance`;
|
|
30
|
+
const url = `${this.baseUrl}/pockets/users/${directoryId}/balance`;
|
|
31
31
|
return await this.httpRequest.get(url);
|
|
32
32
|
}
|
|
33
|
+
async updatePocketBalance(pocketId, request) {
|
|
34
|
+
const url = `${this.baseUrl}/pockets/${pocketId}/balance`;
|
|
35
|
+
return await this.httpRequest.put(url, request);
|
|
36
|
+
}
|
|
33
37
|
};
|
|
34
38
|
AccountFiadoIncApi = __decorate([
|
|
35
39
|
(0, inversify_1.injectable)(),
|
|
@@ -1,7 +1,8 @@
|
|
|
1
|
-
import { AccountCreateRequest, AccountCreateResponse, GetAccountResponse, GetPocketBalanceResponse } from "@fiado/type-kit/bin/account";
|
|
1
|
+
import { AccountCreateRequest, AccountCreateResponse, AccountUpdateBalanceRequest, GetAccountResponse, GetPocketBalanceResponse } from "@fiado/type-kit/bin/account";
|
|
2
2
|
import { ApiGatewayResponse } from "@fiado/gateway-adapter";
|
|
3
3
|
export interface IAccountFiadoIncApi {
|
|
4
4
|
createAccount(data: AccountCreateRequest): Promise<ApiGatewayResponse<AccountCreateResponse>>;
|
|
5
5
|
getAccountByDirectoryId(directoryId: string): Promise<ApiGatewayResponse<GetAccountResponse[]>>;
|
|
6
6
|
getPocketBalance(directoryId: string): Promise<ApiGatewayResponse<GetPocketBalanceResponse>>;
|
|
7
|
+
updatePocketBalance(pocketId: string, request: AccountUpdateBalanceRequest): Promise<ApiGatewayResponse<null>>;
|
|
7
8
|
}
|
|
@@ -23,7 +23,7 @@ let AccountFiadoSAApi = class AccountFiadoSAApi {
|
|
|
23
23
|
return await this.httpRequest.post(url, data);
|
|
24
24
|
}
|
|
25
25
|
async getAccountByDirectoryId(directoryId) {
|
|
26
|
-
const url = `${this.baseUrl}/${directoryId}`;
|
|
26
|
+
const url = `${this.baseUrl}users/${directoryId}`;
|
|
27
27
|
return await this.httpRequest.get(url);
|
|
28
28
|
}
|
|
29
29
|
};
|
|
@@ -23,7 +23,7 @@ let AccountPagoConfiadoApi = class AccountPagoConfiadoApi {
|
|
|
23
23
|
return await this.httpRequest.post(url, data);
|
|
24
24
|
}
|
|
25
25
|
async getAccountByDirectoryId(directoryId) {
|
|
26
|
-
const url = `${this.baseUrl}/${directoryId}`;
|
|
26
|
+
const url = `${this.baseUrl}users/${directoryId}`;
|
|
27
27
|
return await this.httpRequest.get(url);
|
|
28
28
|
}
|
|
29
29
|
};
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import { IHttpRequest } from "@fiado/http-client";
|
|
2
|
+
import { ICollectorApi } from './interfaces/ICollectorApi';
|
|
3
|
+
import CreditContractCreateRequest from '@fiado/type-kit/bin/creditContract/dtos/CreditContractCreateRequest';
|
|
4
|
+
export declare class CollectorApi implements ICollectorApi {
|
|
5
|
+
private httpRequest;
|
|
6
|
+
private readonly baseUrl;
|
|
7
|
+
constructor(httpRequest: IHttpRequest);
|
|
8
|
+
createCreditContract(object: CreditContractCreateRequest): Promise<any>;
|
|
9
|
+
}
|
|
@@ -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
|
+
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.CollectorApi = void 0;
|
|
19
|
+
const dotenv_1 = __importDefault(require("dotenv"));
|
|
20
|
+
const inversify_1 = require("inversify");
|
|
21
|
+
dotenv_1.default.config();
|
|
22
|
+
let CollectorApi = class CollectorApi {
|
|
23
|
+
constructor(httpRequest) {
|
|
24
|
+
this.httpRequest = httpRequest;
|
|
25
|
+
this.baseUrl = process.env.COLLECTOR_LAMBDA_URL || "";
|
|
26
|
+
}
|
|
27
|
+
async createCreditContract(object) {
|
|
28
|
+
const url = `${this.baseUrl}collector/creditcontracts/create`;
|
|
29
|
+
return await this.httpRequest.post(url, object);
|
|
30
|
+
}
|
|
31
|
+
};
|
|
32
|
+
exports.CollectorApi = CollectorApi;
|
|
33
|
+
exports.CollectorApi = CollectorApi = __decorate([
|
|
34
|
+
(0, inversify_1.injectable)(),
|
|
35
|
+
__param(0, (0, inversify_1.inject)("IHttpRequest")),
|
|
36
|
+
__metadata("design:paramtypes", [Object])
|
|
37
|
+
], CollectorApi);
|
|
@@ -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("./interfaces/ICollectorApi"), exports);
|
|
18
|
+
__exportStar(require("./CollectorApi"), exports);
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import CreditContractCreateRequest from "@fiado/type-kit/bin/creditContract/dtos/CreditContractCreateRequest";
|
|
2
|
+
/**
|
|
3
|
+
* Interfaz para el servicio Contract Generator.
|
|
4
|
+
*/
|
|
5
|
+
export interface ICollectorApi {
|
|
6
|
+
/**
|
|
7
|
+
* Crea un nuevo contrato de crédito.
|
|
8
|
+
* @param CreditContractCreateRequest Objeto con la información necesaria para crear el contrato.
|
|
9
|
+
* @returns Una promesa que resuelve a un arreglo de objetos de people.
|
|
10
|
+
* Puede devolver un arreglo vacío si no se encuentran coincidencias.
|
|
11
|
+
* @throws {Error} Lanza un error si los parámetros de entrada son inválidos.
|
|
12
|
+
*/
|
|
13
|
+
createCreditContract(object: CreditContractCreateRequest): Promise<any>;
|
|
14
|
+
}
|
package/bin/container.config.js
CHANGED
|
@@ -22,6 +22,7 @@ const card_1 = require("./card");
|
|
|
22
22
|
const transaction_1 = require("./transaction");
|
|
23
23
|
const contract_generator_1 = require("./contract-generator");
|
|
24
24
|
const ProductCatalogApi_1 = __importDefault(require("./product-catalog/ProductCatalogApi"));
|
|
25
|
+
const CollectorApi_1 = require("./collector/CollectorApi");
|
|
25
26
|
exports.apiInvokerBindings = new inversify_1.ContainerModule((bind) => {
|
|
26
27
|
bind("IDirectoryApi").to(directory_1.DirectoryApi);
|
|
27
28
|
bind("IIdentityApi").to(identity_1.IdentityApi);
|
|
@@ -39,5 +40,6 @@ exports.apiInvokerBindings = new inversify_1.ContainerModule((bind) => {
|
|
|
39
40
|
bind("IAuthenticationApi").to(authentication_1.AuthenticationApi);
|
|
40
41
|
bind("ICardApi").to(card_1.CardApi);
|
|
41
42
|
bind("IContractGeneratorApi").to(contract_generator_1.ContractGeneratorApi);
|
|
43
|
+
bind("ICollectorApi").to(CollectorApi_1.CollectorApi);
|
|
42
44
|
bind("IProductCatalogApi").to(ProductCatalogApi_1.default);
|
|
43
45
|
});
|
package/bin/index.d.ts
CHANGED
package/bin/index.js
CHANGED
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@fiado/api-invoker",
|
|
3
|
-
"version": "1.0.
|
|
3
|
+
"version": "1.0.74",
|
|
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",
|
|
@@ -13,10 +13,10 @@
|
|
|
13
13
|
"license": "ISC",
|
|
14
14
|
"dependencies": {
|
|
15
15
|
"@aws-sdk/client-sqs": "^3.572.0",
|
|
16
|
-
"@fiado/
|
|
17
|
-
"@fiado/
|
|
18
|
-
"@fiado/
|
|
19
|
-
"@fiado/type-kit": "^1.1.
|
|
16
|
+
"@fiado/gateway-adapter": "^1.1.31",
|
|
17
|
+
"@fiado/http-client": "^1.0.2",
|
|
18
|
+
"@fiado/logger": "^1.0.2",
|
|
19
|
+
"@fiado/type-kit": "^1.1.33",
|
|
20
20
|
"dotenv": "^16.4.5",
|
|
21
21
|
"inversify": "^6.0.2",
|
|
22
22
|
"reflect-metadata": "^0.2.1",
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import {IAccountFiadoIncApi} from "./interfaces/IAccountFiadoIncApi";
|
|
2
2
|
import {
|
|
3
3
|
AccountCreateRequest,
|
|
4
|
-
AccountCreateResponse,
|
|
4
|
+
AccountCreateResponse, AccountUpdateBalanceRequest,
|
|
5
5
|
GetAccountResponse,
|
|
6
6
|
GetPocketBalanceResponse
|
|
7
7
|
} from "@fiado/type-kit/bin/account";
|
|
@@ -22,12 +22,17 @@ export default class AccountFiadoIncApi implements IAccountFiadoIncApi {
|
|
|
22
22
|
}
|
|
23
23
|
|
|
24
24
|
async getAccountByDirectoryId(directoryId: string): Promise<ApiGatewayResponse<GetAccountResponse[]>> {
|
|
25
|
-
const url = `${this.baseUrl}/${directoryId}`;
|
|
25
|
+
const url = `${this.baseUrl}users/${directoryId}`;
|
|
26
26
|
return await this.httpRequest.get(url);
|
|
27
27
|
}
|
|
28
28
|
|
|
29
29
|
async getPocketBalance(directoryId: string): Promise<ApiGatewayResponse<GetPocketBalanceResponse>> {
|
|
30
|
-
const url = `${this.baseUrl}/pockets/${directoryId}/balance`;
|
|
30
|
+
const url = `${this.baseUrl}/pockets/users/${directoryId}/balance`;
|
|
31
31
|
return await this.httpRequest.get(url);
|
|
32
32
|
}
|
|
33
|
+
|
|
34
|
+
async updatePocketBalance(pocketId: string, request: AccountUpdateBalanceRequest): Promise<ApiGatewayResponse<null>> {
|
|
35
|
+
const url = `${this.baseUrl}/pockets/${pocketId}/balance`;
|
|
36
|
+
return await this.httpRequest.put(url, request);
|
|
37
|
+
}
|
|
33
38
|
}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import {
|
|
2
2
|
AccountCreateRequest,
|
|
3
|
-
AccountCreateResponse,
|
|
3
|
+
AccountCreateResponse, AccountUpdateBalanceRequest,
|
|
4
4
|
GetAccountResponse,
|
|
5
5
|
GetPocketBalanceResponse
|
|
6
6
|
} from "@fiado/type-kit/bin/account";
|
|
@@ -13,4 +13,6 @@ export interface IAccountFiadoIncApi {
|
|
|
13
13
|
getAccountByDirectoryId(directoryId: string): Promise<ApiGatewayResponse<GetAccountResponse[]>>;
|
|
14
14
|
|
|
15
15
|
getPocketBalance(directoryId: string): Promise<ApiGatewayResponse<GetPocketBalanceResponse>>;
|
|
16
|
+
|
|
17
|
+
updatePocketBalance(pocketId: string, request: AccountUpdateBalanceRequest): Promise<ApiGatewayResponse<null>>
|
|
16
18
|
}
|
|
@@ -17,7 +17,7 @@ export default class AccountFiadoSAApi implements IAccountFiadoSAApi {
|
|
|
17
17
|
}
|
|
18
18
|
|
|
19
19
|
async getAccountByDirectoryId(directoryId: string): Promise<ApiGatewayResponse<GetAccountResponse[]>> {
|
|
20
|
-
const url = `${this.baseUrl}/${directoryId}`;
|
|
20
|
+
const url = `${this.baseUrl}users/${directoryId}`;
|
|
21
21
|
return await this.httpRequest.get(url);
|
|
22
22
|
}
|
|
23
23
|
}
|
|
@@ -17,7 +17,7 @@ export default class AccountPagoConfiadoApi implements IAccountPagoConfiadoApi {
|
|
|
17
17
|
}
|
|
18
18
|
|
|
19
19
|
async getAccountByDirectoryId(directoryId: string): Promise<ApiGatewayResponse<GetAccountResponse[]>> {
|
|
20
|
-
const url = `${this.baseUrl}/${directoryId}`;
|
|
20
|
+
const url = `${this.baseUrl}users/${directoryId}`;
|
|
21
21
|
return await this.httpRequest.get(url);
|
|
22
22
|
}
|
|
23
23
|
}
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import dotenv from 'dotenv';
|
|
2
|
+
import { inject, injectable } from "inversify";
|
|
3
|
+
import { IHttpRequest } from "@fiado/http-client";
|
|
4
|
+
import { ICollectorApi } from './interfaces/ICollectorApi';
|
|
5
|
+
import CreditContractCreateRequest from '@fiado/type-kit/bin/creditContract/dtos/CreditContractCreateRequest';
|
|
6
|
+
|
|
7
|
+
dotenv.config();
|
|
8
|
+
|
|
9
|
+
@injectable()
|
|
10
|
+
export class CollectorApi implements ICollectorApi {
|
|
11
|
+
|
|
12
|
+
private readonly baseUrl = process.env.COLLECTOR_LAMBDA_URL || "";
|
|
13
|
+
|
|
14
|
+
constructor(@inject("IHttpRequest") private httpRequest: IHttpRequest) {}
|
|
15
|
+
|
|
16
|
+
async createCreditContract(object: CreditContractCreateRequest): Promise<any> {
|
|
17
|
+
const url = `${this.baseUrl}collector/creditcontracts/create`;
|
|
18
|
+
return await this.httpRequest.post(url, object);
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
}
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import { ContractCreateRequest } from "@fiado/type-kit/bin/contract";
|
|
2
|
+
import CreditContractCreateRequest from "@fiado/type-kit/bin/creditContract/dtos/CreditContractCreateRequest";
|
|
3
|
+
|
|
4
|
+
/**
|
|
5
|
+
* Interfaz para el servicio Contract Generator.
|
|
6
|
+
*/
|
|
7
|
+
export interface ICollectorApi {
|
|
8
|
+
|
|
9
|
+
/**
|
|
10
|
+
* Crea un nuevo contrato de crédito.
|
|
11
|
+
* @param CreditContractCreateRequest Objeto con la información necesaria para crear el contrato.
|
|
12
|
+
* @returns Una promesa que resuelve a un arreglo de objetos de people.
|
|
13
|
+
* Puede devolver un arreglo vacío si no se encuentran coincidencias.
|
|
14
|
+
* @throws {Error} Lanza un error si los parámetros de entrada son inválidos.
|
|
15
|
+
*/
|
|
16
|
+
createCreditContract(object: CreditContractCreateRequest): Promise<any>
|
|
17
|
+
|
|
18
|
+
|
|
19
|
+
}
|
package/src/container.config.ts
CHANGED
|
@@ -27,6 +27,8 @@ import {ContractGeneratorApi} from "./contract-generator";
|
|
|
27
27
|
import {IContractGeneratorApi} from "./contract-generator";
|
|
28
28
|
import {IProductCatalogApi} from "./product-catalog";
|
|
29
29
|
import ProductCatalogApi from "./product-catalog/ProductCatalogApi";
|
|
30
|
+
import { ICollectorApi } from "./collector/interfaces/ICollectorApi";
|
|
31
|
+
import { CollectorApi } from "./collector/CollectorApi";
|
|
30
32
|
|
|
31
33
|
export const apiInvokerBindings = new ContainerModule((bind: interfaces.Bind) => {
|
|
32
34
|
bind<IDirectoryApi>("IDirectoryApi").to(DirectoryApi);
|
|
@@ -45,5 +47,6 @@ export const apiInvokerBindings = new ContainerModule((bind: interfaces.Bind) =>
|
|
|
45
47
|
bind<IAuthenticationApi>("IAuthenticationApi").to(AuthenticationApi);
|
|
46
48
|
bind<ICardApi>("ICardApi").to(CardApi);
|
|
47
49
|
bind<IContractGeneratorApi>("IContractGeneratorApi").to(ContractGeneratorApi);
|
|
50
|
+
bind<ICollectorApi>("ICollectorApi").to(CollectorApi);
|
|
48
51
|
bind<IProductCatalogApi>("IProductCatalogApi").to(ProductCatalogApi);
|
|
49
52
|
});
|
package/src/index.ts
CHANGED