@fiado/api-invoker 1.1.62 → 1.1.63
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/activity/ActivityApi.d.ts +17 -0
- package/bin/activity/ActivityApi.js +72 -0
- package/bin/activity/index.d.ts +2 -0
- package/bin/activity/index.js +18 -0
- package/bin/activity/interfaces/IActivityApi.d.ts +39 -0
- package/bin/activity/interfaces/IActivityApi.js +2 -0
- package/bin/transaction/api/TransactionApi.d.ts +22 -0
- package/bin/transaction/api/TransactionApi.js +52 -0
- package/bin/transaction/api/interfaces/ITransactionApi.d.ts +17 -0
- package/bin/transaction/api/interfaces/ITransactionApi.js +2 -0
- package/bin/transaction/index.d.ts +2 -0
- package/bin/transaction/index.js +2 -0
- package/package.json +28 -28
- package/src/account-beneficiary/AccountBeneficiaryApi.ts +18 -18
- package/src/account-beneficiary/index.ts +2 -2
- package/src/account-beneficiary/interfaces/IAccountBeneficiaryApi.ts +7 -7
- package/src/account-fiadoinc/AccountFiadoIncApi.ts +65 -65
- package/src/account-fiadoinc/index.ts +1 -1
- package/src/account-fiadoinc/interfaces/IAccountFiadoIncApi.ts +32 -32
- package/src/account-fiadosa/AccountFiadoSAApi.ts +32 -32
- package/src/account-fiadosa/index.ts +1 -1
- package/src/account-fiadosa/interfaces/IAccountFiadoSAApi.ts +13 -13
- package/src/account-pagoconfiado/AccountPagoConfiadoApi.ts +46 -46
- package/src/account-pagoconfiado/index.ts +2 -2
- package/src/account-pagoconfiado/interfaces/IAccountPagoConfiadoApi.ts +24 -24
- package/src/activity-business/ActivityApi.ts +34 -34
- package/src/activity-business/index.ts +5 -5
- package/src/activity-business/interfaces/IActivityApi.ts +9 -9
- package/src/activity-business/queue/ActivityPublisher.ts +28 -28
- package/src/activity-business/queue/IActivityPublisher.ts +4 -4
- 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/bankAccount/BankAccountApi.ts +48 -48
- package/src/bankAccount/index.ts +1 -1
- package/src/bankAccount/interfaces/IBankAccountApi.ts +6 -6
- package/src/bbvaRst/api/BBVARstApi.ts +16 -16
- package/src/bbvaRst/api/interfaces/IBBVARstApi.ts +4 -4
- package/src/bbvaRst/index.ts +1 -1
- package/src/card/CardApi.ts +36 -36
- package/src/card/index.ts +3 -3
- package/src/card/interfaces/ICardApi.ts +10 -10
- package/src/cnbv-business/CnbvApi.ts +22 -22
- package/src/cnbv-business/index.ts +4 -4
- package/src/cnbv-business/interfaces/ICnbvApi.ts +6 -6
- package/src/collector/CollectorApi.ts +25 -25
- package/src/collector/index.ts +2 -2
- package/src/collector/interfaces/ICollectorApi.ts +21 -21
- package/src/contactInformation/ContactInformationApi.ts +20 -20
- package/src/contactInformation/index.ts +2 -2
- package/src/contactInformation/interface/IContactInformationApi.ts +8 -8
- package/src/container.config.ts +88 -88
- 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 +128 -128
- package/src/directory/index.ts +3 -3
- package/src/directory/interfaces/IDirectoryApi.ts +63 -63
- package/src/exchangeRates/ExchangeRatesApi.ts +27 -27
- package/src/exchangeRates/index.ts +1 -1
- package/src/exchangeRates/interfaces/IExchangeRatesApi.ts +8 -8
- package/src/fiadoMessages/api/FiadoMessagesApi.ts +20 -20
- package/src/fiadoMessages/api/interfaces/IFiadoMessagesApi.ts +2 -2
- package/src/fiadoMessages/index.ts +1 -1
- package/src/fraudPreventionEngine/api/FraudPreventionEngineApi.ts +22 -22
- package/src/fraudPreventionEngine/api/interfaces/IFraudPreventionEngineApi.ts +7 -7
- package/src/fraudPreventionEngine/index.ts +1 -1
- package/src/group/GroupApi.ts +24 -24
- package/src/group/index.ts +1 -1
- package/src/group/interfaces/IGroupApi.ts +23 -23
- 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 +31 -31
- 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/p2pContact/api/P2pContactApi.ts +19 -19
- package/src/p2pContact/api/interfaces/IP2pContactApi.ts +4 -4
- package/src/p2pContact/index.ts +1 -1
- 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/pomeloProcessor/api/PomeloProcessorApi.ts +17 -17
- package/src/pomeloProcessor/api/interfaces/IPomeloProcessorApi.ts +2 -2
- package/src/pomeloProcessor/index.ts +2 -2
- 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/riskProfile/api/RiskProfileApi.ts +29 -29
- package/src/riskProfile/api/interfaces/IRiskProfileApi.ts +10 -10
- package/src/riskProfile/index.ts +4 -4
- package/src/riskProfile/queue/TransactionAlarmPublisher.ts +24 -24
- package/src/riskProfile/queue/interfaces/ITransactionAlarmPublisher.ts +4 -4
- 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 +111 -111
- package/src/stpAccount/api/interfaces/ISTPAccountApi.ts +7 -7
- package/src/stpAccount/index.ts +1 -1
- package/src/stpServicePayment/api/StpServicePaymentApi.ts +40 -40
- package/src/stpServicePayment/api/interfaces/IStpServicePaymentApi.ts +13 -13
- package/src/stpServicePayment/index.ts +1 -1
- package/src/stpSpei/api/StpSpeiApi.ts +32 -32
- package/src/stpSpei/api/interfaces/IStpSpeiApi.ts +6 -6
- package/src/stpSpei/index.ts +1 -1
- package/src/tern/api/TernApi.ts +137 -137
- package/src/tern/api/interfaces/ITernApi.ts +38 -38
- package/src/tern/index.ts +1 -1
- package/src/transaction/api/TransactionApi.ts +46 -0
- package/src/transaction/api/interfaces/ITransactionApi.ts +20 -0
- package/src/transaction/index.ts +5 -2
- package/src/transaction/queue/TransactionPublisher.ts +24 -24
- package/src/transaction/queue/interfaces/ITransactionPublisher.ts +4 -4
- package/src/transactionProcessor/api/TransactionProcessorApi.ts +37 -37
- package/src/transactionProcessor/api/interfaces/ITransactionProcessorApi.ts +15 -15
- package/src/transactionProcessor/index.ts +1 -1
- 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
|
+
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import { IHttpRequest } from "@fiado/http-client";
|
|
2
|
+
import { IActivityApi } from './interfaces/IActivityApi';
|
|
3
|
+
import { TypeOfDirectoryId } from '@fiado/type-kit/bin/directory';
|
|
4
|
+
export declare class ActivityApi implements IActivityApi {
|
|
5
|
+
private httpRequest;
|
|
6
|
+
private readonly baseUrl;
|
|
7
|
+
constructor(httpRequest: IHttpRequest);
|
|
8
|
+
getActivities(typeOfActivities: string[]): Promise<any>;
|
|
9
|
+
getActivitiesByDirectoryIdAndTypeOfActivity(directoryId: string, typeOfActivities: string[]): Promise<any>;
|
|
10
|
+
postActivity(params: {
|
|
11
|
+
directoryId: string;
|
|
12
|
+
typeOfDirectoryId: TypeOfDirectoryId;
|
|
13
|
+
typeOfActivity: string;
|
|
14
|
+
amount: string;
|
|
15
|
+
date: string;
|
|
16
|
+
}): Promise<any>;
|
|
17
|
+
}
|
|
@@ -0,0 +1,72 @@
|
|
|
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.ActivityApi = void 0;
|
|
19
|
+
const dotenv_1 = __importDefault(require("dotenv"));
|
|
20
|
+
const inversify_1 = require("inversify");
|
|
21
|
+
dotenv_1.default.config();
|
|
22
|
+
let ActivityApi = class ActivityApi {
|
|
23
|
+
constructor(httpRequest) {
|
|
24
|
+
this.httpRequest = httpRequest;
|
|
25
|
+
this.baseUrl = process.env.ACTIVITY_LAMBDA_URL || "";
|
|
26
|
+
}
|
|
27
|
+
async getActivities(typeOfActivities) {
|
|
28
|
+
let url = `${this.baseUrl}activities`;
|
|
29
|
+
if (typeOfActivities.length > 0) {
|
|
30
|
+
url = `${this.baseUrl}activities?${typeOfActivities.map(id => `typeOfActivities=${encodeURIComponent(id)}`).join('&')}`;
|
|
31
|
+
}
|
|
32
|
+
const operationName = "getActivities";
|
|
33
|
+
return await this.httpRequest.post(`${url}`, null, { 'operationName': operationName });
|
|
34
|
+
}
|
|
35
|
+
async getActivitiesByDirectoryIdAndTypeOfActivity(directoryId, typeOfActivities) {
|
|
36
|
+
if (directoryId == null || directoryId == undefined || directoryId == "") {
|
|
37
|
+
throw new Error("At least directory ID is required.");
|
|
38
|
+
}
|
|
39
|
+
let url = `${this.baseUrl}activities/directory/${directoryId}`;
|
|
40
|
+
if (typeOfActivities.length > 0) {
|
|
41
|
+
url = `${this.baseUrl}activities/directory/${directoryId}?${typeOfActivities.map(id => `typeOfActivities=${encodeURIComponent(id)}`).join('&')}`;
|
|
42
|
+
}
|
|
43
|
+
const operationName = "getActivitiesByDirectoryIdAndTypeOfActivity";
|
|
44
|
+
return await this.httpRequest.post(`${url}`, null, { 'operationName': operationName });
|
|
45
|
+
}
|
|
46
|
+
async postActivity(params) {
|
|
47
|
+
if (params.directoryId == null || params.directoryId == undefined || params.directoryId == "") {
|
|
48
|
+
throw new Error("At least directory ID is required.");
|
|
49
|
+
}
|
|
50
|
+
if (params.typeOfDirectoryId == null || params.typeOfDirectoryId == undefined) {
|
|
51
|
+
throw new Error("At least typeOfDirectoryId is required.");
|
|
52
|
+
}
|
|
53
|
+
if (params.typeOfActivity == null || params.typeOfActivity == undefined || params.typeOfActivity == "") {
|
|
54
|
+
throw new Error("At least typeOfActivity is required.");
|
|
55
|
+
}
|
|
56
|
+
if (params.amount == null || params.amount == undefined || params.amount == "") {
|
|
57
|
+
throw new Error("At least amount is required.");
|
|
58
|
+
}
|
|
59
|
+
if (params.date == null || params.date == undefined || params.date == "") {
|
|
60
|
+
throw new Error("At least date is required.");
|
|
61
|
+
}
|
|
62
|
+
const url = `${this.baseUrl}/activities/create`;
|
|
63
|
+
const operationName = "postActivity";
|
|
64
|
+
return await this.httpRequest.post(`${url}`, params, { 'operationName': operationName });
|
|
65
|
+
}
|
|
66
|
+
};
|
|
67
|
+
exports.ActivityApi = ActivityApi;
|
|
68
|
+
exports.ActivityApi = ActivityApi = __decorate([
|
|
69
|
+
(0, inversify_1.injectable)(),
|
|
70
|
+
__param(0, (0, inversify_1.inject)("IHttpRequest")),
|
|
71
|
+
__metadata("design:paramtypes", [Object])
|
|
72
|
+
], ActivityApi);
|
|
@@ -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/IActivityApi"), exports);
|
|
18
|
+
__exportStar(require("./ActivityApi"), exports);
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
import { TypeOfDirectoryId } from "@fiado/type-kit/bin/directory";
|
|
2
|
+
/**
|
|
3
|
+
* Interfaz para el servicio Directory que permite operaciones sobre directorios.
|
|
4
|
+
*/
|
|
5
|
+
export interface IActivityApi {
|
|
6
|
+
/**
|
|
7
|
+
* Obtiene una lista de entidades de la tabla ActivityDirectory.
|
|
8
|
+
* @param directoryId Directorio que se va a consultar.
|
|
9
|
+
* @param typeOfActivities Array de tipos de actividades (Opcional).
|
|
10
|
+
* @returns Retorna un arreglo de objetos de ActivityDirectory.
|
|
11
|
+
* @throws {Error} Lanza un error si los parámetros de entrada son inválidos.
|
|
12
|
+
*/
|
|
13
|
+
getActivitiesByDirectoryIdAndTypeOfActivity(directoryId: string, typeOfActivities: string[]): Promise<any>;
|
|
14
|
+
/**
|
|
15
|
+
* Obtener actividades globales.
|
|
16
|
+
* @param typeOfActivity Tipo de actividad
|
|
17
|
+
* Puede devolver un arreglo vacío si no se encuentran coincidencias.
|
|
18
|
+
* @throws {Error} Lanza un error si los parámetros de entrada son inválidos.
|
|
19
|
+
*/
|
|
20
|
+
getActivities(typeOfActivities: string[]): Promise<any>;
|
|
21
|
+
/**
|
|
22
|
+
* Proceso para agregar a las actividades.
|
|
23
|
+
* @param directoryId Directorio
|
|
24
|
+
* @param typeOfDirectoryId Tipo de directorio
|
|
25
|
+
* @param typeOfActivity Tipo de actividad
|
|
26
|
+
* @param amount Monto de la actividad
|
|
27
|
+
* @param date Fecha de la actividad
|
|
28
|
+
* @returns Retorna un objeto de ActivityDirectory.
|
|
29
|
+
* Puede devolver un arreglo vacío si no se encuentran coincidencias.
|
|
30
|
+
* @throws {Error} Lanza un error si los parámetros de entrada son inválidos.
|
|
31
|
+
*/
|
|
32
|
+
postActivity(params: {
|
|
33
|
+
directoryId: string;
|
|
34
|
+
typeOfDirectoryId: TypeOfDirectoryId;
|
|
35
|
+
typeOfActivity: string;
|
|
36
|
+
amount: string;
|
|
37
|
+
date: string;
|
|
38
|
+
}): Promise<any>;
|
|
39
|
+
}
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import { IHttpRequest } from "@fiado/http-client";
|
|
2
|
+
import { ITransactionApi } from "./interfaces/ITransactionApi";
|
|
3
|
+
import { TransactionSourceEnum } from "@fiado/type-kit/bin/transaction";
|
|
4
|
+
export default class TransactionApi implements ITransactionApi {
|
|
5
|
+
private httpRequest;
|
|
6
|
+
private readonly baseUrl;
|
|
7
|
+
constructor(httpRequest: IHttpRequest);
|
|
8
|
+
getTransactionsByDirectoryIdAndSource(params: {
|
|
9
|
+
directoryId: string;
|
|
10
|
+
source: TransactionSourceEnum;
|
|
11
|
+
index?: string;
|
|
12
|
+
pageSize?: number;
|
|
13
|
+
}): Promise<any>;
|
|
14
|
+
getFiadoTxByDirectoryAndBetweenDates(params: {
|
|
15
|
+
directoryId: string;
|
|
16
|
+
targetOrSource: string;
|
|
17
|
+
startDate: string;
|
|
18
|
+
endDate: string;
|
|
19
|
+
index?: string;
|
|
20
|
+
pageSize?: number;
|
|
21
|
+
}): Promise<any>;
|
|
22
|
+
}
|
|
@@ -0,0 +1,52 @@
|
|
|
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 TransactionApi = class TransactionApi {
|
|
17
|
+
constructor(httpRequest) {
|
|
18
|
+
this.httpRequest = httpRequest;
|
|
19
|
+
this.baseUrl = process.env.TERN_LAMBDA_URL || "";
|
|
20
|
+
}
|
|
21
|
+
async getTransactionsByDirectoryIdAndSource(params) {
|
|
22
|
+
let queryParams = [];
|
|
23
|
+
if (!params.index) {
|
|
24
|
+
queryParams.push(`index=${params.index}`);
|
|
25
|
+
}
|
|
26
|
+
if (!params.pageSize) {
|
|
27
|
+
queryParams.push(`pageSize=${params.pageSize}`);
|
|
28
|
+
}
|
|
29
|
+
const url = `${this.baseUrl}trx/transactions/${params.source}/${params.directoryId}?${queryParams.join('&')}`;
|
|
30
|
+
return await this.httpRequest.get(url);
|
|
31
|
+
}
|
|
32
|
+
async getFiadoTxByDirectoryAndBetweenDates(params) {
|
|
33
|
+
let queryParams = [];
|
|
34
|
+
if (!params.index) {
|
|
35
|
+
queryParams.push(`index=${params.index}`);
|
|
36
|
+
}
|
|
37
|
+
if (!params.pageSize) {
|
|
38
|
+
queryParams.push(`pageSize=${params.pageSize}`);
|
|
39
|
+
}
|
|
40
|
+
queryParams.push(`startDate=${params.startDate}`);
|
|
41
|
+
queryParams.push(`endDate=${params.endDate}`);
|
|
42
|
+
queryParams.push(`targetOrSource=${params.targetOrSource}`);
|
|
43
|
+
const url = `${this.baseUrl}trx/fiadotx/${params.directoryId}/bdates?${queryParams.join('&')}`;
|
|
44
|
+
return await this.httpRequest.get(url);
|
|
45
|
+
}
|
|
46
|
+
};
|
|
47
|
+
TransactionApi = __decorate([
|
|
48
|
+
(0, inversify_1.injectable)(),
|
|
49
|
+
__param(0, (0, inversify_1.inject)("IHttpRequest")),
|
|
50
|
+
__metadata("design:paramtypes", [Object])
|
|
51
|
+
], TransactionApi);
|
|
52
|
+
exports.default = TransactionApi;
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import { TransactionSourceEnum } from "@fiado/type-kit/bin/transaction";
|
|
2
|
+
export interface ITransactionApi {
|
|
3
|
+
getTransactionsByDirectoryIdAndSource(params: {
|
|
4
|
+
directoryId: string;
|
|
5
|
+
source: TransactionSourceEnum;
|
|
6
|
+
index?: string;
|
|
7
|
+
pageSize?: number;
|
|
8
|
+
}): Promise<any>;
|
|
9
|
+
getFiadoTxByDirectoryAndBetweenDates(params: {
|
|
10
|
+
directoryId: string;
|
|
11
|
+
targetOrSource: string;
|
|
12
|
+
startDate: string;
|
|
13
|
+
endDate: string;
|
|
14
|
+
index?: string;
|
|
15
|
+
pageSize?: number;
|
|
16
|
+
}): Promise<any>;
|
|
17
|
+
}
|
package/bin/transaction/index.js
CHANGED
|
@@ -16,3 +16,5 @@ var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
|
16
16
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
17
17
|
__exportStar(require("./queue/TransactionPublisher"), exports);
|
|
18
18
|
__exportStar(require("./queue/interfaces/ITransactionPublisher"), exports);
|
|
19
|
+
__exportStar(require("./api/TransactionApi"), exports);
|
|
20
|
+
__exportStar(require("./api/interfaces/ITransactionApi"), exports);
|
package/package.json
CHANGED
|
@@ -1,28 +1,28 @@
|
|
|
1
|
-
{
|
|
2
|
-
"name": "@fiado/api-invoker",
|
|
3
|
-
"version": "1.1.
|
|
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.33",
|
|
17
|
-
"@fiado/http-client": "^1.0.2",
|
|
18
|
-
"@fiado/logger": "^1.0.2",
|
|
19
|
-
"@fiado/type-kit": "^1.4.51",
|
|
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.1.63",
|
|
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.33",
|
|
17
|
+
"@fiado/http-client": "^1.0.2",
|
|
18
|
+
"@fiado/logger": "^1.0.2",
|
|
19
|
+
"@fiado/type-kit": "^1.4.51",
|
|
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,19 +1,19 @@
|
|
|
1
|
-
import { inject, injectable } from "inversify";
|
|
2
|
-
import { IAccountBeneficiaryApi } from "./interfaces/IAccountBeneficiaryApi";
|
|
3
|
-
import { IHttpRequest } from "@fiado/http-client";
|
|
4
|
-
import { AccountBeneficiaryCreateRequest } from "@fiado/type-kit/bin/beneficiary";
|
|
5
|
-
import { CountryId } from "@fiado/type-kit/bin/country";
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
@injectable()
|
|
9
|
-
export class AccountBeneficiaryApi implements IAccountBeneficiaryApi {
|
|
10
|
-
private readonly baseUrl = process.env.ACCOUNT_BENEFICIARY_LAMBDA_URL || "";
|
|
11
|
-
|
|
12
|
-
constructor(@inject("IHttpRequest") private httpRequest: IHttpRequest) {
|
|
13
|
-
}
|
|
14
|
-
|
|
15
|
-
async create(directoryId: string, countryId: CountryId, input: AccountBeneficiaryCreateRequest[]): Promise<void> {
|
|
16
|
-
const url = `${this.baseUrl}${countryId}/users/${directoryId}`;
|
|
17
|
-
return await this.httpRequest.post(url, input);
|
|
18
|
-
}
|
|
1
|
+
import { inject, injectable } from "inversify";
|
|
2
|
+
import { IAccountBeneficiaryApi } from "./interfaces/IAccountBeneficiaryApi";
|
|
3
|
+
import { IHttpRequest } from "@fiado/http-client";
|
|
4
|
+
import { AccountBeneficiaryCreateRequest } from "@fiado/type-kit/bin/beneficiary";
|
|
5
|
+
import { CountryId } from "@fiado/type-kit/bin/country";
|
|
6
|
+
|
|
7
|
+
|
|
8
|
+
@injectable()
|
|
9
|
+
export class AccountBeneficiaryApi implements IAccountBeneficiaryApi {
|
|
10
|
+
private readonly baseUrl = process.env.ACCOUNT_BENEFICIARY_LAMBDA_URL || "";
|
|
11
|
+
|
|
12
|
+
constructor(@inject("IHttpRequest") private httpRequest: IHttpRequest) {
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
async create(directoryId: string, countryId: CountryId, input: AccountBeneficiaryCreateRequest[]): Promise<void> {
|
|
16
|
+
const url = `${this.baseUrl}${countryId}/users/${directoryId}`;
|
|
17
|
+
return await this.httpRequest.post(url, input);
|
|
18
|
+
}
|
|
19
19
|
}
|
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
|
|
2
|
-
export * from './interfaces/IAccountBeneficiaryApi';
|
|
1
|
+
|
|
2
|
+
export * from './interfaces/IAccountBeneficiaryApi';
|
|
3
3
|
export * from './AccountBeneficiaryApi';
|
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
import { AccountBeneficiaryCreateRequest } from "@fiado/type-kit/bin/beneficiary";
|
|
2
|
-
import { CountryId } from "@fiado/type-kit/bin/country";
|
|
3
|
-
|
|
4
|
-
export interface IAccountBeneficiaryApi {
|
|
5
|
-
|
|
6
|
-
create(directoryId: string, countryId: CountryId, input: AccountBeneficiaryCreateRequest[]): Promise<void>;
|
|
7
|
-
|
|
1
|
+
import { AccountBeneficiaryCreateRequest } from "@fiado/type-kit/bin/beneficiary";
|
|
2
|
+
import { CountryId } from "@fiado/type-kit/bin/country";
|
|
3
|
+
|
|
4
|
+
export interface IAccountBeneficiaryApi {
|
|
5
|
+
|
|
6
|
+
create(directoryId: string, countryId: CountryId, input: AccountBeneficiaryCreateRequest[]): Promise<void>;
|
|
7
|
+
|
|
8
8
|
}
|