@fiado/api-invoker 1.0.75 → 1.0.76
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/README.md +64 -64
- package/bin/account-fiadoinc/AccountFiadoIncApi.d.ts +3 -1
- package/bin/account-fiadoinc/AccountFiadoIncApi.js +4 -0
- package/bin/account-fiadoinc/interfaces/IAccountFiadoIncApi.d.ts +3 -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 +28 -28
- package/src/account-fiadoinc/AccountFiadoIncApi.ts +45 -37
- package/src/account-fiadoinc/index.ts +1 -1
- package/src/account-fiadoinc/interfaces/IAccountFiadoIncApi.ts +22 -17
- package/src/account-fiadosa/AccountFiadoSAApi.ts +22 -22
- package/src/account-fiadosa/index.ts +1 -1
- package/src/account-fiadosa/interfaces/IAccountFiadoSAApi.ts +9 -9
- package/src/account-pagoconfiado/AccountPagoConfiadoApi.ts +22 -22
- package/src/account-pagoconfiado/index.ts +2 -2
- package/src/account-pagoconfiado/interfaces/IAccountPagoConfiadoApi.ts +8 -8
- package/src/address/AddressApi.ts +46 -46
- package/src/address/index.ts +3 -3
- package/src/address/interfaces/IAddressApi.ts +30 -30
- package/src/authentication/AuthenticationApi.ts +16 -16
- package/src/authentication/index.ts +4 -4
- package/src/authentication/interfaces/IAuthenticationApi.ts +5 -5
- package/src/card/CardApi.ts +33 -33
- package/src/card/index.ts +3 -3
- package/src/card/interfaces/ICardApi.ts +10 -10
- 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 +52 -49
- package/src/contract-generator/ContractGeneratorApi.ts +18 -18
- package/src/contract-generator/index.ts +2 -2
- package/src/contract-generator/interfaces/IContractGeneratorApi.ts +16 -16
- package/src/directory/DirectoryApi.ts +74 -74
- package/src/directory/index.ts +3 -3
- package/src/directory/interfaces/IDirectoryApi.ts +53 -53
- package/src/exchangeRates/ExchangeRatesApi.ts +18 -18
- package/src/exchangeRates/index.ts +1 -1
- package/src/exchangeRates/interfaces/IExchangeRatesApi.ts +5 -5
- package/src/identity/IdentityApi.ts +47 -47
- package/src/identity/index.ts +3 -3
- package/src/identity/interfaces/IIdentityApi.ts +33 -33
- package/src/index.ts +18 -17
- package/src/notificationMessages/index.ts +1 -1
- package/src/notificationMessages/queue/NotificationMessagePublisher.ts +22 -22
- package/src/notificationMessages/queue/interfaces/INotificationMessagesPublisher.ts +4 -4
- package/src/pomelo/api/PomeloApi.ts +99 -99
- package/src/pomelo/api/interfaces/IPomeloApi.ts +27 -27
- package/src/pomelo/index.ts +1 -1
- package/src/product-catalog/ProductCatalogApi.ts +17 -17
- package/src/product-catalog/index.ts +1 -1
- package/src/product-catalog/interfaces/IProductCatalogApi.ts +6 -6
- package/src/sessionActivity/index.ts +2 -2
- package/src/sessionActivity/queue/SessionActivityPublisher.ts +22 -22
- package/src/sessionActivity/queue/interfaces/ISessionActivityPublisher.ts +4 -4
- package/src/stpAccount/api/STPAccountApi.ts +102 -102
- package/src/stpAccount/api/interfaces/ISTPAccountApi.ts +6 -6
- package/src/stpAccount/index.ts +1 -1
- package/src/tern/api/TernApi.ts +96 -96
- package/src/tern/api/interfaces/ITernApi.ts +29 -29
- package/src/tern/index.ts +1 -1
- package/src/transaction/index.ts +2 -2
- package/src/transaction/queue/TransactionPublisher.ts +24 -24
- package/src/transaction/queue/interfaces/ITransactionPublisher.ts +4 -4
- package/tsconfig.json +21 -21
package/README.md
CHANGED
|
@@ -1,64 +1,64 @@
|
|
|
1
|
-
# fiado-api-invoker
|
|
2
|
-
|
|
3
|
-
`fiado-api-invoker` es una librería diseñada para facilitar la invocación de APIs privadas de AWS Lambda a través de API Gateway dentro de la misma VPC. Esta librería simplifica el proceso de configuración y llamada a servicios, permitiendo a los desarrolladores centrarse en la lógica de negocio.
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
## Configuración
|
|
7
|
-
|
|
8
|
-
Antes de usar la librería, asegúrate de configurar la URL base del API Gateway privado que corresponda por ejemplo si vas a usar los servicios del Lambda `Directory` se puede hacer estableciendo la variable de entorno `DIRECTORY_LAMBDA_URL`.
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
## Instalación
|
|
12
|
-
```bash
|
|
13
|
-
`npm install fiado-api-invoker @fiado/http-client`
|
|
14
|
-
```
|
|
15
|
-
|
|
16
|
-
## Configuración del Contenedor de InversifyJS
|
|
17
|
-
|
|
18
|
-
```typescript
|
|
19
|
-
import { Container } from "inversify";
|
|
20
|
-
import { IHttpRequest, AxiosHttpRequest } from "@fiado/http-client";
|
|
21
|
-
import { apiInvokerContainer } from '@fiado/api-invoker';
|
|
22
|
-
|
|
23
|
-
// Crea el contenedor principal de tu aplicación
|
|
24
|
-
const container = new Container();
|
|
25
|
-
|
|
26
|
-
// Aplica las configuraciones de vinculación de fiado-gateway-adapter al contenedor
|
|
27
|
-
container.load(gatewayAdapterBindings);
|
|
28
|
-
|
|
29
|
-
// Registro del cliente HTTP
|
|
30
|
-
container.bind<IHttpRequest>("IHttpRequest").to(AxiosHttpRequest);
|
|
31
|
-
|
|
32
|
-
// Exporta el contenedor para su uso en toda tu aplicación
|
|
33
|
-
export { container };
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
```
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
## Uso de IDirectoryApi en Servicios del Proyecto
|
|
40
|
-
|
|
41
|
-
Para utilizar `fiado-api-invoker`, necesitas configurar el contenedor de InversifyJS en tu aplicación. Aquí te mostramos cómo registrar las dependencias necesarias:
|
|
42
|
-
|
|
43
|
-
```typescript
|
|
44
|
-
import { inject, injectable } from "inversify";
|
|
45
|
-
import { IDirectoryApi } from "fiado-api-invoker";
|
|
46
|
-
import { log } from "@fiado/logger";
|
|
47
|
-
|
|
48
|
-
@injectable()
|
|
49
|
-
export class SomeService {
|
|
50
|
-
constructor(@inject("IDirectoryApi") private directoryApi: IDirectoryApi) {}
|
|
51
|
-
|
|
52
|
-
public async fetchDirectoryDetails(directoryIds: string[]): Promise<void> {
|
|
53
|
-
try {
|
|
54
|
-
const details = await this.directoryApi.getByIds(directoryIds);
|
|
55
|
-
log.info(details);
|
|
56
|
-
|
|
57
|
-
} catch (error) {
|
|
58
|
-
log.error("Error fetching directory details:", error);
|
|
59
|
-
}
|
|
60
|
-
}
|
|
61
|
-
}
|
|
62
|
-
```
|
|
63
|
-
|
|
64
|
-
|
|
1
|
+
# fiado-api-invoker
|
|
2
|
+
|
|
3
|
+
`fiado-api-invoker` es una librería diseñada para facilitar la invocación de APIs privadas de AWS Lambda a través de API Gateway dentro de la misma VPC. Esta librería simplifica el proceso de configuración y llamada a servicios, permitiendo a los desarrolladores centrarse en la lógica de negocio.
|
|
4
|
+
|
|
5
|
+
|
|
6
|
+
## Configuración
|
|
7
|
+
|
|
8
|
+
Antes de usar la librería, asegúrate de configurar la URL base del API Gateway privado que corresponda por ejemplo si vas a usar los servicios del Lambda `Directory` se puede hacer estableciendo la variable de entorno `DIRECTORY_LAMBDA_URL`.
|
|
9
|
+
|
|
10
|
+
|
|
11
|
+
## Instalación
|
|
12
|
+
```bash
|
|
13
|
+
`npm install fiado-api-invoker @fiado/http-client`
|
|
14
|
+
```
|
|
15
|
+
|
|
16
|
+
## Configuración del Contenedor de InversifyJS
|
|
17
|
+
|
|
18
|
+
```typescript
|
|
19
|
+
import { Container } from "inversify";
|
|
20
|
+
import { IHttpRequest, AxiosHttpRequest } from "@fiado/http-client";
|
|
21
|
+
import { apiInvokerContainer } from '@fiado/api-invoker';
|
|
22
|
+
|
|
23
|
+
// Crea el contenedor principal de tu aplicación
|
|
24
|
+
const container = new Container();
|
|
25
|
+
|
|
26
|
+
// Aplica las configuraciones de vinculación de fiado-gateway-adapter al contenedor
|
|
27
|
+
container.load(gatewayAdapterBindings);
|
|
28
|
+
|
|
29
|
+
// Registro del cliente HTTP
|
|
30
|
+
container.bind<IHttpRequest>("IHttpRequest").to(AxiosHttpRequest);
|
|
31
|
+
|
|
32
|
+
// Exporta el contenedor para su uso en toda tu aplicación
|
|
33
|
+
export { container };
|
|
34
|
+
|
|
35
|
+
|
|
36
|
+
```
|
|
37
|
+
|
|
38
|
+
|
|
39
|
+
## Uso de IDirectoryApi en Servicios del Proyecto
|
|
40
|
+
|
|
41
|
+
Para utilizar `fiado-api-invoker`, necesitas configurar el contenedor de InversifyJS en tu aplicación. Aquí te mostramos cómo registrar las dependencias necesarias:
|
|
42
|
+
|
|
43
|
+
```typescript
|
|
44
|
+
import { inject, injectable } from "inversify";
|
|
45
|
+
import { IDirectoryApi } from "fiado-api-invoker";
|
|
46
|
+
import { log } from "@fiado/logger";
|
|
47
|
+
|
|
48
|
+
@injectable()
|
|
49
|
+
export class SomeService {
|
|
50
|
+
constructor(@inject("IDirectoryApi") private directoryApi: IDirectoryApi) {}
|
|
51
|
+
|
|
52
|
+
public async fetchDirectoryDetails(directoryIds: string[]): Promise<void> {
|
|
53
|
+
try {
|
|
54
|
+
const details = await this.directoryApi.getByIds(directoryIds);
|
|
55
|
+
log.info(details);
|
|
56
|
+
|
|
57
|
+
} catch (error) {
|
|
58
|
+
log.error("Error fetching directory details:", error);
|
|
59
|
+
}
|
|
60
|
+
}
|
|
61
|
+
}
|
|
62
|
+
```
|
|
63
|
+
|
|
64
|
+
|
|
@@ -1,7 +1,8 @@
|
|
|
1
1
|
import { IAccountFiadoIncApi } from "./interfaces/IAccountFiadoIncApi";
|
|
2
|
-
import { AccountCreateRequest, AccountCreateResponse, AccountUpdateBalanceRequest, GetAccountResponse, GetPocketBalanceResponse } from "@fiado/type-kit/bin/account";
|
|
2
|
+
import { AccountCreateRequest, AccountCreateResponse, AccountUpdateBalanceRequest, ExecutePocketOperationRequest, 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
|
+
import { OperationEnum } from "@fiado/type-kit/bin/transaction";
|
|
5
6
|
export default class AccountFiadoIncApi implements IAccountFiadoIncApi {
|
|
6
7
|
private httpRequest;
|
|
7
8
|
private readonly baseUrl;
|
|
@@ -10,4 +11,5 @@ export default class AccountFiadoIncApi implements IAccountFiadoIncApi {
|
|
|
10
11
|
getAccountByDirectoryId(directoryId: string): Promise<ApiGatewayResponse<GetAccountResponse[]>>;
|
|
11
12
|
getPocketBalance(directoryId: string): Promise<ApiGatewayResponse<GetPocketBalanceResponse>>;
|
|
12
13
|
updatePocketBalance(pocketId: string, request: AccountUpdateBalanceRequest): Promise<ApiGatewayResponse<null>>;
|
|
14
|
+
executePocketTransaction(pocketId: string, operation: OperationEnum, request: ExecutePocketOperationRequest): Promise<ApiGatewayResponse<any>>;
|
|
13
15
|
}
|
|
@@ -34,6 +34,10 @@ let AccountFiadoIncApi = class AccountFiadoIncApi {
|
|
|
34
34
|
const url = `${this.baseUrl}/pockets/${pocketId}/balance`;
|
|
35
35
|
return await this.httpRequest.put(url, request);
|
|
36
36
|
}
|
|
37
|
+
async executePocketTransaction(pocketId, operation, request) {
|
|
38
|
+
const url = `${this.baseUrl}/pockets/${pocketId}/${operation}`;
|
|
39
|
+
return await this.httpRequest.post(url, request);
|
|
40
|
+
}
|
|
37
41
|
};
|
|
38
42
|
AccountFiadoIncApi = __decorate([
|
|
39
43
|
(0, inversify_1.injectable)(),
|
|
@@ -1,8 +1,10 @@
|
|
|
1
|
-
import { AccountCreateRequest, AccountCreateResponse, AccountUpdateBalanceRequest, GetAccountResponse, GetPocketBalanceResponse } from "@fiado/type-kit/bin/account";
|
|
1
|
+
import { AccountCreateRequest, AccountCreateResponse, AccountUpdateBalanceRequest, ExecutePocketOperationRequest, GetAccountResponse, GetPocketBalanceResponse } from "@fiado/type-kit/bin/account";
|
|
2
2
|
import { ApiGatewayResponse } from "@fiado/gateway-adapter";
|
|
3
|
+
import { OperationEnum } from "@fiado/type-kit/bin/transaction";
|
|
3
4
|
export interface IAccountFiadoIncApi {
|
|
4
5
|
createAccount(data: AccountCreateRequest): Promise<ApiGatewayResponse<AccountCreateResponse>>;
|
|
5
6
|
getAccountByDirectoryId(directoryId: string): Promise<ApiGatewayResponse<GetAccountResponse[]>>;
|
|
6
7
|
getPocketBalance(directoryId: string): Promise<ApiGatewayResponse<GetPocketBalanceResponse>>;
|
|
7
8
|
updatePocketBalance(pocketId: string, request: AccountUpdateBalanceRequest): Promise<ApiGatewayResponse<null>>;
|
|
9
|
+
executePocketTransaction(pocketId: string, operation: OperationEnum, request: ExecutePocketOperationRequest): Promise<ApiGatewayResponse<any>>;
|
|
8
10
|
}
|
|
@@ -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,28 +1,28 @@
|
|
|
1
|
-
{
|
|
2
|
-
"name": "@fiado/api-invoker",
|
|
3
|
-
"version": "1.0.
|
|
4
|
-
"description": "Sirve como un puente entre diferentes funciones lambda, facilitando la comunicación entre ellas a traves de invocaciones http",
|
|
5
|
-
"main": "bin/index.js",
|
|
6
|
-
"types": "bin/index.d.ts",
|
|
7
|
-
"scripts": {
|
|
8
|
-
"test": "test",
|
|
9
|
-
"build": "tsc"
|
|
10
|
-
},
|
|
11
|
-
"keywords": [],
|
|
12
|
-
"author": "Fiado Inc",
|
|
13
|
-
"license": "ISC",
|
|
14
|
-
"dependencies": {
|
|
15
|
-
"@aws-sdk/client-sqs": "^3.572.0",
|
|
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.
|
|
20
|
-
"dotenv": "^16.4.5",
|
|
21
|
-
"inversify": "^6.0.2",
|
|
22
|
-
"reflect-metadata": "^0.2.1",
|
|
23
|
-
"typescript": "^5.4.3"
|
|
24
|
-
},
|
|
25
|
-
"devDependencies": {
|
|
26
|
-
"@types/node": "^20.12.7"
|
|
27
|
-
}
|
|
28
|
-
}
|
|
1
|
+
{
|
|
2
|
+
"name": "@fiado/api-invoker",
|
|
3
|
+
"version": "1.0.76",
|
|
4
|
+
"description": "Sirve como un puente entre diferentes funciones lambda, facilitando la comunicación entre ellas a traves de invocaciones http",
|
|
5
|
+
"main": "bin/index.js",
|
|
6
|
+
"types": "bin/index.d.ts",
|
|
7
|
+
"scripts": {
|
|
8
|
+
"test": "test",
|
|
9
|
+
"build": "tsc"
|
|
10
|
+
},
|
|
11
|
+
"keywords": [],
|
|
12
|
+
"author": "Fiado Inc",
|
|
13
|
+
"license": "ISC",
|
|
14
|
+
"dependencies": {
|
|
15
|
+
"@aws-sdk/client-sqs": "^3.572.0",
|
|
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.46",
|
|
20
|
+
"dotenv": "^16.4.5",
|
|
21
|
+
"inversify": "^6.0.2",
|
|
22
|
+
"reflect-metadata": "^0.2.1",
|
|
23
|
+
"typescript": "^5.4.3"
|
|
24
|
+
},
|
|
25
|
+
"devDependencies": {
|
|
26
|
+
"@types/node": "^20.12.7"
|
|
27
|
+
}
|
|
28
|
+
}
|
|
@@ -1,38 +1,46 @@
|
|
|
1
|
-
import {IAccountFiadoIncApi} from "./interfaces/IAccountFiadoIncApi";
|
|
2
|
-
import {
|
|
3
|
-
AccountCreateRequest,
|
|
4
|
-
AccountCreateResponse,
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
import {
|
|
11
|
-
|
|
12
|
-
@
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
1
|
+
import {IAccountFiadoIncApi} from "./interfaces/IAccountFiadoIncApi";
|
|
2
|
+
import {
|
|
3
|
+
AccountCreateRequest,
|
|
4
|
+
AccountCreateResponse,
|
|
5
|
+
AccountUpdateBalanceRequest,
|
|
6
|
+
ExecutePocketOperationRequest,
|
|
7
|
+
GetAccountResponse,
|
|
8
|
+
GetPocketBalanceResponse
|
|
9
|
+
} from "@fiado/type-kit/bin/account";
|
|
10
|
+
import {inject, injectable} from "inversify";
|
|
11
|
+
import {IHttpRequest} from "@fiado/http-client";
|
|
12
|
+
import {ApiGatewayResponse} from "@fiado/gateway-adapter";
|
|
13
|
+
import {OperationEnum} from "@fiado/type-kit/bin/transaction";
|
|
14
|
+
|
|
15
|
+
@injectable()
|
|
16
|
+
export default class AccountFiadoIncApi implements IAccountFiadoIncApi {
|
|
17
|
+
private readonly baseUrl = process.env.ACCOUNT_FIADOINC_LAMBDA_URL || "";
|
|
18
|
+
|
|
19
|
+
constructor(@inject("IHttpRequest") private httpRequest: IHttpRequest) {
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
async createAccount(data: AccountCreateRequest): Promise<ApiGatewayResponse<AccountCreateResponse>> {
|
|
23
|
+
const url = `${this.baseUrl}`;
|
|
24
|
+
return await this.httpRequest.post(url, data);
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
async getAccountByDirectoryId(directoryId: string): Promise<ApiGatewayResponse<GetAccountResponse[]>> {
|
|
28
|
+
const url = `${this.baseUrl}users/${directoryId}`;
|
|
29
|
+
return await this.httpRequest.get(url);
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
async getPocketBalance(directoryId: string): Promise<ApiGatewayResponse<GetPocketBalanceResponse>> {
|
|
33
|
+
const url = `${this.baseUrl}/pockets/users/${directoryId}/balance`;
|
|
34
|
+
return await this.httpRequest.get(url);
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
async updatePocketBalance(pocketId: string, request: AccountUpdateBalanceRequest): Promise<ApiGatewayResponse<null>> {
|
|
38
|
+
const url = `${this.baseUrl}/pockets/${pocketId}/balance`;
|
|
39
|
+
return await this.httpRequest.put(url, request);
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
async executePocketTransaction(pocketId: string, operation: OperationEnum, request: ExecutePocketOperationRequest): Promise<ApiGatewayResponse<any>> {
|
|
43
|
+
const url = `${this.baseUrl}/pockets/${pocketId}/${operation}`;
|
|
44
|
+
return await this.httpRequest.post(url, request);
|
|
45
|
+
}
|
|
38
46
|
}
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
export * from './interfaces/IAccountFiadoIncApi';
|
|
1
|
+
export * from './interfaces/IAccountFiadoIncApi';
|
|
2
2
|
export * from './AccountFiadoIncApi';
|
|
@@ -1,18 +1,23 @@
|
|
|
1
|
-
import {
|
|
2
|
-
AccountCreateRequest,
|
|
3
|
-
AccountCreateResponse,
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
1
|
+
import {
|
|
2
|
+
AccountCreateRequest,
|
|
3
|
+
AccountCreateResponse,
|
|
4
|
+
AccountUpdateBalanceRequest,
|
|
5
|
+
ExecutePocketOperationRequest,
|
|
6
|
+
GetAccountResponse,
|
|
7
|
+
GetPocketBalanceResponse
|
|
8
|
+
} from "@fiado/type-kit/bin/account";
|
|
9
|
+
import {ApiGatewayResponse} from "@fiado/gateway-adapter";
|
|
10
|
+
import {OperationEnum} from "@fiado/type-kit/bin/transaction";
|
|
11
|
+
|
|
12
|
+
|
|
13
|
+
export interface IAccountFiadoIncApi {
|
|
14
|
+
createAccount(data: AccountCreateRequest): Promise<ApiGatewayResponse<AccountCreateResponse>>;
|
|
15
|
+
|
|
16
|
+
getAccountByDirectoryId(directoryId: string): Promise<ApiGatewayResponse<GetAccountResponse[]>>;
|
|
17
|
+
|
|
18
|
+
getPocketBalance(directoryId: string): Promise<ApiGatewayResponse<GetPocketBalanceResponse>>;
|
|
19
|
+
|
|
20
|
+
updatePocketBalance(pocketId: string, request: AccountUpdateBalanceRequest): Promise<ApiGatewayResponse<null>>;
|
|
21
|
+
|
|
22
|
+
executePocketTransaction(pocketId: string, operation: OperationEnum, request: ExecutePocketOperationRequest): Promise<ApiGatewayResponse<any>>;
|
|
18
23
|
}
|
|
@@ -1,23 +1,23 @@
|
|
|
1
|
-
import {IAccountFiadoSAApi} from "./interfaces/IAccountFiadoSAApi";
|
|
2
|
-
import {AccountCreateRequest, AccountCreateResponse, GetAccountResponse} from "@fiado/type-kit/bin/account";
|
|
3
|
-
import {ApiGatewayResponse} from "@fiado/gateway-adapter";
|
|
4
|
-
import {inject, injectable} from "inversify";
|
|
5
|
-
import {IHttpRequest} from "@fiado/http-client";
|
|
6
|
-
|
|
7
|
-
@injectable()
|
|
8
|
-
export default class AccountFiadoSAApi implements IAccountFiadoSAApi {
|
|
9
|
-
private readonly baseUrl = process.env.ACCOUNT_FIADOSA_LAMBDA_URL || "";
|
|
10
|
-
|
|
11
|
-
constructor(@inject("IHttpRequest") private httpRequest: IHttpRequest) {
|
|
12
|
-
}
|
|
13
|
-
|
|
14
|
-
async createAccount(data: AccountCreateRequest): Promise<ApiGatewayResponse<AccountCreateResponse[]>> {
|
|
15
|
-
const url = `${this.baseUrl}`;
|
|
16
|
-
return await this.httpRequest.post(url, data);
|
|
17
|
-
}
|
|
18
|
-
|
|
19
|
-
async getAccountByDirectoryId(directoryId: string): Promise<ApiGatewayResponse<GetAccountResponse[]>> {
|
|
20
|
-
const url = `${this.baseUrl}users/${directoryId}`;
|
|
21
|
-
return await this.httpRequest.get(url);
|
|
22
|
-
}
|
|
1
|
+
import {IAccountFiadoSAApi} from "./interfaces/IAccountFiadoSAApi";
|
|
2
|
+
import {AccountCreateRequest, AccountCreateResponse, GetAccountResponse} from "@fiado/type-kit/bin/account";
|
|
3
|
+
import {ApiGatewayResponse} from "@fiado/gateway-adapter";
|
|
4
|
+
import {inject, injectable} from "inversify";
|
|
5
|
+
import {IHttpRequest} from "@fiado/http-client";
|
|
6
|
+
|
|
7
|
+
@injectable()
|
|
8
|
+
export default class AccountFiadoSAApi implements IAccountFiadoSAApi {
|
|
9
|
+
private readonly baseUrl = process.env.ACCOUNT_FIADOSA_LAMBDA_URL || "";
|
|
10
|
+
|
|
11
|
+
constructor(@inject("IHttpRequest") private httpRequest: IHttpRequest) {
|
|
12
|
+
}
|
|
13
|
+
|
|
14
|
+
async createAccount(data: AccountCreateRequest): Promise<ApiGatewayResponse<AccountCreateResponse[]>> {
|
|
15
|
+
const url = `${this.baseUrl}`;
|
|
16
|
+
return await this.httpRequest.post(url, data);
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
async getAccountByDirectoryId(directoryId: string): Promise<ApiGatewayResponse<GetAccountResponse[]>> {
|
|
20
|
+
const url = `${this.baseUrl}users/${directoryId}`;
|
|
21
|
+
return await this.httpRequest.get(url);
|
|
22
|
+
}
|
|
23
23
|
}
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
export * from './interfaces/IAccountFiadoSAApi';
|
|
1
|
+
export * from './interfaces/IAccountFiadoSAApi';
|
|
2
2
|
export * from './AccountFiadoSAApi';
|
|
@@ -1,10 +1,10 @@
|
|
|
1
|
-
import {AccountCreateRequest, AccountCreateResponse, GetAccountResponse} from "@fiado/type-kit/bin/account";
|
|
2
|
-
import {ApiGatewayResponse} from "@fiado/gateway-adapter";
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
export interface IAccountFiadoSAApi {
|
|
6
|
-
createAccount(data: AccountCreateRequest): Promise<ApiGatewayResponse<AccountCreateResponse[]>>;
|
|
7
|
-
|
|
8
|
-
getAccountByDirectoryId(directoryId: string): Promise<ApiGatewayResponse<GetAccountResponse[]>>;
|
|
9
|
-
|
|
1
|
+
import {AccountCreateRequest, AccountCreateResponse, GetAccountResponse} from "@fiado/type-kit/bin/account";
|
|
2
|
+
import {ApiGatewayResponse} from "@fiado/gateway-adapter";
|
|
3
|
+
|
|
4
|
+
|
|
5
|
+
export interface IAccountFiadoSAApi {
|
|
6
|
+
createAccount(data: AccountCreateRequest): Promise<ApiGatewayResponse<AccountCreateResponse[]>>;
|
|
7
|
+
|
|
8
|
+
getAccountByDirectoryId(directoryId: string): Promise<ApiGatewayResponse<GetAccountResponse[]>>;
|
|
9
|
+
|
|
10
10
|
}
|
|
@@ -1,23 +1,23 @@
|
|
|
1
|
-
import {IAccountPagoConfiadoApi} from "./interfaces/IAccountPagoConfiadoApi";
|
|
2
|
-
import {AccountCreateRequest, AccountCreateResponse, GetAccountResponse} from "@fiado/type-kit/bin/account";
|
|
3
|
-
import {ApiGatewayResponse} from "@fiado/gateway-adapter";
|
|
4
|
-
import {inject, injectable} from "inversify";
|
|
5
|
-
import {IHttpRequest} from "@fiado/http-client";
|
|
6
|
-
|
|
7
|
-
@injectable()
|
|
8
|
-
export default class AccountPagoConfiadoApi implements IAccountPagoConfiadoApi {
|
|
9
|
-
private readonly baseUrl = process.env.ACCOUNT_PAGOCONFIADO_LAMBDA_URL || "";
|
|
10
|
-
|
|
11
|
-
constructor(@inject("IHttpRequest") private httpRequest: IHttpRequest) {
|
|
12
|
-
}
|
|
13
|
-
|
|
14
|
-
async createAccount(data: AccountCreateRequest): Promise<ApiGatewayResponse<AccountCreateResponse>> {
|
|
15
|
-
const url = `${this.baseUrl}`;
|
|
16
|
-
return await this.httpRequest.post(url, data);
|
|
17
|
-
}
|
|
18
|
-
|
|
19
|
-
async getAccountByDirectoryId(directoryId: string): Promise<ApiGatewayResponse<GetAccountResponse[]>> {
|
|
20
|
-
const url = `${this.baseUrl}users/${directoryId}`;
|
|
21
|
-
return await this.httpRequest.get(url);
|
|
22
|
-
}
|
|
1
|
+
import {IAccountPagoConfiadoApi} from "./interfaces/IAccountPagoConfiadoApi";
|
|
2
|
+
import {AccountCreateRequest, AccountCreateResponse, GetAccountResponse} from "@fiado/type-kit/bin/account";
|
|
3
|
+
import {ApiGatewayResponse} from "@fiado/gateway-adapter";
|
|
4
|
+
import {inject, injectable} from "inversify";
|
|
5
|
+
import {IHttpRequest} from "@fiado/http-client";
|
|
6
|
+
|
|
7
|
+
@injectable()
|
|
8
|
+
export default class AccountPagoConfiadoApi implements IAccountPagoConfiadoApi {
|
|
9
|
+
private readonly baseUrl = process.env.ACCOUNT_PAGOCONFIADO_LAMBDA_URL || "";
|
|
10
|
+
|
|
11
|
+
constructor(@inject("IHttpRequest") private httpRequest: IHttpRequest) {
|
|
12
|
+
}
|
|
13
|
+
|
|
14
|
+
async createAccount(data: AccountCreateRequest): Promise<ApiGatewayResponse<AccountCreateResponse>> {
|
|
15
|
+
const url = `${this.baseUrl}`;
|
|
16
|
+
return await this.httpRequest.post(url, data);
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
async getAccountByDirectoryId(directoryId: string): Promise<ApiGatewayResponse<GetAccountResponse[]>> {
|
|
20
|
+
const url = `${this.baseUrl}users/${directoryId}`;
|
|
21
|
+
return await this.httpRequest.get(url);
|
|
22
|
+
}
|
|
23
23
|
}
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
export * from './interfaces/IAccountPagoConfiadoApi';
|
|
2
|
-
export * from './AccountPagoConfiadoApi';
|
|
1
|
+
export * from './interfaces/IAccountPagoConfiadoApi';
|
|
2
|
+
export * from './AccountPagoConfiadoApi';
|
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
import {AccountCreateRequest, AccountCreateResponse, GetAccountResponse} from "@fiado/type-kit/bin/account";
|
|
2
|
-
import {ApiGatewayResponse} from "@fiado/gateway-adapter";
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
export interface IAccountPagoConfiadoApi {
|
|
6
|
-
createAccount(data: AccountCreateRequest): Promise<ApiGatewayResponse<AccountCreateResponse>>;
|
|
7
|
-
|
|
8
|
-
getAccountByDirectoryId(directoryId: string): Promise<ApiGatewayResponse<GetAccountResponse[]>>;
|
|
1
|
+
import {AccountCreateRequest, AccountCreateResponse, GetAccountResponse} from "@fiado/type-kit/bin/account";
|
|
2
|
+
import {ApiGatewayResponse} from "@fiado/gateway-adapter";
|
|
3
|
+
|
|
4
|
+
|
|
5
|
+
export interface IAccountPagoConfiadoApi {
|
|
6
|
+
createAccount(data: AccountCreateRequest): Promise<ApiGatewayResponse<AccountCreateResponse>>;
|
|
7
|
+
|
|
8
|
+
getAccountByDirectoryId(directoryId: string): Promise<ApiGatewayResponse<GetAccountResponse[]>>;
|
|
9
9
|
}
|