@fiado/api-invoker 1.1.6 → 1.1.8

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.
Files changed (95) hide show
  1. package/README.md +64 -64
  2. package/bin/exchangeRates/ExchangeRatesApi.d.ts +2 -0
  3. package/bin/exchangeRates/ExchangeRatesApi.js +6 -0
  4. package/bin/exchangeRates/interfaces/IExchangeRatesApi.d.ts +2 -0
  5. package/bin/group/GroupApi.d.ts +1 -0
  6. package/bin/group/GroupApi.js +4 -0
  7. package/bin/group/interfaces/IGroupApi.d.ts +6 -0
  8. package/package.json +28 -28
  9. package/src/account-beneficiary/AccountBeneficiaryApi.ts +18 -18
  10. package/src/account-beneficiary/index.ts +2 -2
  11. package/src/account-beneficiary/interfaces/IAccountBeneficiaryApi.ts +7 -7
  12. package/src/account-fiadoinc/AccountFiadoIncApi.ts +60 -60
  13. package/src/account-fiadoinc/index.ts +1 -1
  14. package/src/account-fiadoinc/interfaces/IAccountFiadoIncApi.ts +29 -29
  15. package/src/account-fiadosa/AccountFiadoSAApi.ts +22 -22
  16. package/src/account-fiadosa/index.ts +1 -1
  17. package/src/account-fiadosa/interfaces/IAccountFiadoSAApi.ts +9 -9
  18. package/src/account-pagoconfiado/AccountPagoConfiadoApi.ts +27 -27
  19. package/src/account-pagoconfiado/index.ts +2 -2
  20. package/src/account-pagoconfiado/interfaces/IAccountPagoConfiadoApi.ts +8 -8
  21. package/src/address/AddressApi.ts +46 -46
  22. package/src/address/index.ts +3 -3
  23. package/src/address/interfaces/IAddressApi.ts +30 -30
  24. package/src/authentication/AuthenticationApi.ts +16 -16
  25. package/src/authentication/index.ts +4 -4
  26. package/src/authentication/interfaces/IAuthenticationApi.ts +5 -5
  27. package/src/bankAccount/BankAccountApi.ts +37 -37
  28. package/src/bankAccount/index.ts +1 -1
  29. package/src/bankAccount/interfaces/IBankAccountApi.ts +4 -4
  30. package/src/bbvaRst/api/BBVARstApi.ts +16 -16
  31. package/src/bbvaRst/api/interfaces/IBBVARstApi.ts +4 -4
  32. package/src/bbvaRst/index.ts +1 -1
  33. package/src/card/CardApi.ts +33 -33
  34. package/src/card/index.ts +3 -3
  35. package/src/card/interfaces/ICardApi.ts +10 -10
  36. package/src/collector/CollectorApi.ts +21 -21
  37. package/src/collector/index.ts +2 -2
  38. package/src/collector/interfaces/ICollectorApi.ts +19 -19
  39. package/src/container.config.ts +70 -70
  40. package/src/contract-generator/ContractGeneratorApi.ts +18 -18
  41. package/src/contract-generator/index.ts +2 -2
  42. package/src/contract-generator/interfaces/IContractGeneratorApi.ts +16 -16
  43. package/src/directory/DirectoryApi.ts +115 -115
  44. package/src/directory/index.ts +3 -3
  45. package/src/directory/interfaces/IDirectoryApi.ts +66 -66
  46. package/src/exchangeRates/ExchangeRatesApi.ts +27 -18
  47. package/src/exchangeRates/index.ts +1 -1
  48. package/src/exchangeRates/interfaces/IExchangeRatesApi.ts +8 -5
  49. package/src/fraudPreventionEngine/api/FraudPreventionEngineApi.ts +22 -22
  50. package/src/fraudPreventionEngine/api/interfaces/IFraudPreventionEngineApi.ts +7 -7
  51. package/src/fraudPreventionEngine/index.ts +1 -1
  52. package/src/group/GroupApi.ts +24 -18
  53. package/src/group/index.ts +1 -1
  54. package/src/group/interfaces/IGroupApi.ts +23 -15
  55. package/src/identity/IdentityApi.ts +47 -47
  56. package/src/identity/index.ts +3 -3
  57. package/src/identity/interfaces/IIdentityApi.ts +33 -33
  58. package/src/index.ts +25 -25
  59. package/src/notificationMessages/index.ts +1 -1
  60. package/src/notificationMessages/queue/NotificationMessagePublisher.ts +22 -22
  61. package/src/notificationMessages/queue/interfaces/INotificationMessagesPublisher.ts +4 -4
  62. package/src/p2pContact/api/P2pContactApi.ts +19 -19
  63. package/src/p2pContact/api/interfaces/IP2pContactApi.ts +4 -4
  64. package/src/p2pContact/index.ts +1 -1
  65. package/src/pomelo/api/PomeloApi.ts +99 -99
  66. package/src/pomelo/api/interfaces/IPomeloApi.ts +27 -27
  67. package/src/pomelo/index.ts +1 -1
  68. package/src/product-catalog/ProductCatalogApi.ts +17 -17
  69. package/src/product-catalog/index.ts +1 -1
  70. package/src/product-catalog/interfaces/IProductCatalogApi.ts +6 -6
  71. package/src/sessionActivity/index.ts +2 -2
  72. package/src/sessionActivity/queue/SessionActivityPublisher.ts +22 -22
  73. package/src/sessionActivity/queue/interfaces/ISessionActivityPublisher.ts +4 -4
  74. package/src/stpAccount/api/STPAccountApi.ts +102 -102
  75. package/src/stpAccount/api/interfaces/ISTPAccountApi.ts +6 -6
  76. package/src/stpAccount/index.ts +1 -1
  77. package/src/stpServicePayment/api/StpServicePaymentApi.ts +35 -35
  78. package/src/stpServicePayment/api/interfaces/IStpServicePaymentApi.ts +11 -11
  79. package/src/stpServicePayment/index.ts +1 -1
  80. package/src/stpSpei/api/StpSpeiApi.ts +20 -20
  81. package/src/stpSpei/api/interfaces/IStpSpeiApi.ts +4 -4
  82. package/src/stpSpei/index.ts +1 -1
  83. package/src/tern/api/TernApi.ts +96 -96
  84. package/src/tern/api/interfaces/ITernApi.ts +29 -29
  85. package/src/tern/index.ts +1 -1
  86. package/src/transaction/index.ts +2 -2
  87. package/src/transaction/queue/TransactionPublisher.ts +24 -24
  88. package/src/transaction/queue/interfaces/ITransactionPublisher.ts +4 -4
  89. package/tsconfig.json +21 -21
  90. package/bin/activity/ActivityApi.d.ts +0 -17
  91. package/bin/activity/ActivityApi.js +0 -72
  92. package/bin/activity/index.d.ts +0 -2
  93. package/bin/activity/index.js +0 -18
  94. package/bin/activity/interfaces/IActivityApi.d.ts +0 -39
  95. package/bin/activity/interfaces/IActivityApi.js +0 -2
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,9 +1,11 @@
1
1
  import { IExchangeRatesApi } from "./interfaces/IExchangeRatesApi";
2
2
  import { IHttpRequest } from "@fiado/http-client";
3
3
  import GetExchangeRatesRequest from "@fiado/type-kit/bin/exchangeRate/dtos/GetExchangeRatesRequest";
4
+ import { ExchangeRateCreateRequest } from "@fiado/type-kit/bin/exchangeRate";
4
5
  export default class ExchangeRatesApi implements IExchangeRatesApi {
5
6
  private httpRequest;
6
7
  private readonly baseUrl;
7
8
  constructor(httpRequest: IHttpRequest);
8
9
  getExchangeRates(request: GetExchangeRatesRequest): Promise<any>;
10
+ postExchangeRates(request: ExchangeRateCreateRequest): Promise<any>;
9
11
  }
@@ -24,6 +24,12 @@ let ExchangeRatesApi = class ExchangeRatesApi {
24
24
  };
25
25
  return await this.httpRequest.post(this.baseUrl, request, headers);
26
26
  }
27
+ async postExchangeRates(request) {
28
+ const headers = {
29
+ "operationName": "postExchangeRates"
30
+ };
31
+ return await this.httpRequest.post(this.baseUrl, request, headers);
32
+ }
27
33
  };
28
34
  ExchangeRatesApi = __decorate([
29
35
  (0, inversify_1.injectable)(),
@@ -1,4 +1,6 @@
1
1
  import GetExchangeRatesRequest from "@fiado/type-kit/bin/exchangeRate/dtos/GetExchangeRatesRequest";
2
+ import { ExchangeRateCreateRequest } from "@fiado/type-kit/bin/exchangeRate";
2
3
  export interface IExchangeRatesApi {
3
4
  getExchangeRates(request: GetExchangeRatesRequest): Promise<any>;
5
+ postExchangeRates(request: ExchangeRateCreateRequest): Promise<any>;
4
6
  }
@@ -5,5 +5,6 @@ export declare class GroupApi implements IGroupApi {
5
5
  private httpRequest;
6
6
  private readonly baseUrl;
7
7
  constructor(httpRequest: IHttpRequest);
8
+ findByCategory(categoryId: string): Promise<any>;
8
9
  members(params: GroupAddDirectoryRequest): Promise<any>;
9
10
  }
@@ -24,6 +24,10 @@ let GroupApi = class GroupApi {
24
24
  this.httpRequest = httpRequest;
25
25
  this.baseUrl = process.env.FIADO_GROUP_LAMBDA_URL || "";
26
26
  }
27
+ async findByCategory(categoryId) {
28
+ const url = `${this.baseUrl}groups/categories/${categoryId}`;
29
+ return await this.httpRequest.get(`${url}`);
30
+ }
27
31
  async members(params) {
28
32
  const url = `${this.baseUrl}members`;
29
33
  return await this.httpRequest.post(`${url}`, params);
@@ -9,4 +9,10 @@ export interface IGroupApi {
9
9
  * @throws {Error} Lanza un error si los parámetros de entrada son inválidos.
10
10
  */
11
11
  members(params: GroupAddDirectoryRequest): Promise<any>;
12
+ /**
13
+ * Buscar grupos por categoria.
14
+ * @param categoryId ID de la categoria.
15
+ * @throws {Error} Lanza un error si los parámetros de entrada son inválidos.
16
+ */
17
+ findByCategory(categoryId: string): Promise<any>;
12
18
  }
package/package.json CHANGED
@@ -1,28 +1,28 @@
1
- {
2
- "name": "@fiado/api-invoker",
3
- "version": "1.1.6",
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.2.15",
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.8",
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.2.15",
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
  }
@@ -1,61 +1,61 @@
1
- import {IAccountFiadoIncApi} from "./interfaces/IAccountFiadoIncApi";
2
- import {
3
- AccountCreateRequest,
4
- AccountCreateResponse,
5
- AccountUpdateBalanceRequest, ExecuteP2pOperationRequest,
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 getPocketBalanceById(pocketId: string): Promise<ApiGatewayResponse<GetPocketBalanceResponse>> {
43
- const url = `${this.baseUrl}/pockets/${pocketId}/balance`;
44
- return await this.httpRequest.get(url);
45
- }
46
-
47
- async executePocketTransaction(pocketId: string, operation: OperationEnum, request: ExecutePocketOperationRequest): Promise<ApiGatewayResponse<any>> {
48
- const url = `${this.baseUrl}/pockets/${pocketId}/${operation}`;
49
- return await this.httpRequest.post(url, request);
50
- }
51
-
52
- async executeP2pTransaction(request: ExecuteP2pOperationRequest): Promise<ApiGatewayResponse<any>> {
53
- const url = `${this.baseUrl}/p2p/send`;
54
- return await this.httpRequest.post(url, request);
55
- }
56
-
57
- async deletePocket(pocketId: string): Promise<ApiGatewayResponse<void>> {
58
- const url = `${this.baseUrl}pockets/${pocketId}`;
59
- return await this.httpRequest.delete(url);
60
- }
1
+ import {IAccountFiadoIncApi} from "./interfaces/IAccountFiadoIncApi";
2
+ import {
3
+ AccountCreateRequest,
4
+ AccountCreateResponse,
5
+ AccountUpdateBalanceRequest, ExecuteP2pOperationRequest,
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 getPocketBalanceById(pocketId: string): Promise<ApiGatewayResponse<GetPocketBalanceResponse>> {
43
+ const url = `${this.baseUrl}/pockets/${pocketId}/balance`;
44
+ return await this.httpRequest.get(url);
45
+ }
46
+
47
+ async executePocketTransaction(pocketId: string, operation: OperationEnum, request: ExecutePocketOperationRequest): Promise<ApiGatewayResponse<any>> {
48
+ const url = `${this.baseUrl}/pockets/${pocketId}/${operation}`;
49
+ return await this.httpRequest.post(url, request);
50
+ }
51
+
52
+ async executeP2pTransaction(request: ExecuteP2pOperationRequest): Promise<ApiGatewayResponse<any>> {
53
+ const url = `${this.baseUrl}/p2p/send`;
54
+ return await this.httpRequest.post(url, request);
55
+ }
56
+
57
+ async deletePocket(pocketId: string): Promise<ApiGatewayResponse<void>> {
58
+ const url = `${this.baseUrl}pockets/${pocketId}`;
59
+ return await this.httpRequest.delete(url);
60
+ }
61
61
  }
@@ -1,2 +1,2 @@
1
- export * from './interfaces/IAccountFiadoIncApi';
1
+ export * from './interfaces/IAccountFiadoIncApi';
2
2
  export * from './AccountFiadoIncApi';
@@ -1,30 +1,30 @@
1
- import {
2
- AccountCreateRequest,
3
- AccountCreateResponse,
4
- AccountUpdateBalanceRequest,
5
- ExecuteP2pOperationRequest,
6
- ExecutePocketOperationRequest,
7
- GetAccountResponse,
8
- GetPocketBalanceResponse
9
- } from "@fiado/type-kit/bin/account";
10
- import {ApiGatewayResponse} from "@fiado/gateway-adapter";
11
- import {OperationEnum} from "@fiado/type-kit/bin/transaction";
12
-
13
-
14
- export interface IAccountFiadoIncApi {
15
- createAccount(data: AccountCreateRequest): Promise<ApiGatewayResponse<AccountCreateResponse>>;
16
-
17
- getAccountByDirectoryId(directoryId: string): Promise<ApiGatewayResponse<GetAccountResponse[]>>;
18
-
19
- getPocketBalance(directoryId: string): Promise<ApiGatewayResponse<GetPocketBalanceResponse>>;
20
-
21
- updatePocketBalance(pocketId: string, request: AccountUpdateBalanceRequest): Promise<ApiGatewayResponse<null>>;
22
-
23
- getPocketBalanceById(pocketId: string): Promise<ApiGatewayResponse<GetPocketBalanceResponse>>;
24
-
25
- executePocketTransaction(pocketId: string, operation: OperationEnum, request: ExecutePocketOperationRequest): Promise<ApiGatewayResponse<any>>;
26
-
27
- executeP2pTransaction(request: ExecuteP2pOperationRequest): Promise<ApiGatewayResponse<any>>;
28
-
29
- deletePocket(pocketId: string): Promise<ApiGatewayResponse<void>>
1
+ import {
2
+ AccountCreateRequest,
3
+ AccountCreateResponse,
4
+ AccountUpdateBalanceRequest,
5
+ ExecuteP2pOperationRequest,
6
+ ExecutePocketOperationRequest,
7
+ GetAccountResponse,
8
+ GetPocketBalanceResponse
9
+ } from "@fiado/type-kit/bin/account";
10
+ import {ApiGatewayResponse} from "@fiado/gateway-adapter";
11
+ import {OperationEnum} from "@fiado/type-kit/bin/transaction";
12
+
13
+
14
+ export interface IAccountFiadoIncApi {
15
+ createAccount(data: AccountCreateRequest): Promise<ApiGatewayResponse<AccountCreateResponse>>;
16
+
17
+ getAccountByDirectoryId(directoryId: string): Promise<ApiGatewayResponse<GetAccountResponse[]>>;
18
+
19
+ getPocketBalance(directoryId: string): Promise<ApiGatewayResponse<GetPocketBalanceResponse>>;
20
+
21
+ updatePocketBalance(pocketId: string, request: AccountUpdateBalanceRequest): Promise<ApiGatewayResponse<null>>;
22
+
23
+ getPocketBalanceById(pocketId: string): Promise<ApiGatewayResponse<GetPocketBalanceResponse>>;
24
+
25
+ executePocketTransaction(pocketId: string, operation: OperationEnum, request: ExecutePocketOperationRequest): Promise<ApiGatewayResponse<any>>;
26
+
27
+ executeP2pTransaction(request: ExecuteP2pOperationRequest): Promise<ApiGatewayResponse<any>>;
28
+
29
+ deletePocket(pocketId: string): Promise<ApiGatewayResponse<void>>
30
30
  }
@@ -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,28 +1,28 @@
1
- import {IAccountPagoConfiadoApi} from "./interfaces/IAccountPagoConfiadoApi";
2
- import {AccountCreateRequest, AccountCreateResponse, AccountUpdateBalanceRequest, 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
-
24
- async updateAccountBalance(accountId:string, params: AccountUpdateBalanceRequest): Promise<ApiGatewayResponse<Boolean>> {
25
- const url = `${this.baseUrl}${accountId}/balance`;
26
- return await this.httpRequest.put(url,params);
27
- }
1
+ import {IAccountPagoConfiadoApi} from "./interfaces/IAccountPagoConfiadoApi";
2
+ import {AccountCreateRequest, AccountCreateResponse, AccountUpdateBalanceRequest, 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
+
24
+ async updateAccountBalance(accountId:string, params: AccountUpdateBalanceRequest): Promise<ApiGatewayResponse<Boolean>> {
25
+ const url = `${this.baseUrl}${accountId}/balance`;
26
+ return await this.httpRequest.put(url,params);
27
+ }
28
28
  }
@@ -1,2 +1,2 @@
1
- export * from './interfaces/IAccountPagoConfiadoApi';
2
- export * from './AccountPagoConfiadoApi';
1
+ export * from './interfaces/IAccountPagoConfiadoApi';
2
+ export * from './AccountPagoConfiadoApi';