@fiado/api-invoker 1.0.73 → 1.0.75
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/tern/api/TernApi.d.ts +2 -1
- package/bin/tern/api/TernApi.js +4 -0
- package/bin/tern/api/interfaces/ITernApi.d.ts +1 -0
- package/package.json +28 -28
- package/src/account-fiadoinc/AccountFiadoIncApi.ts +37 -37
- package/src/account-fiadoinc/index.ts +1 -1
- package/src/account-fiadoinc/interfaces/IAccountFiadoIncApi.ts +17 -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/container.config.ts +49 -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 +16 -16
- 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 -85
- package/src/tern/api/interfaces/ITernApi.ts +29 -27
- 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,6 +1,6 @@
|
|
|
1
1
|
import { ITernApi } from "./interfaces/ITernApi";
|
|
2
2
|
import { IHttpRequest } from "@fiado/http-client";
|
|
3
|
-
import { CreateBankAccountRequest, CreateBankAccountUserRequest, GetBankAccountRequest, GetBankAccountUserRequest } from "@fiado/type-kit/bin/account";
|
|
3
|
+
import { BankAccountP2pTransferRequest, CreateBankAccountRequest, CreateBankAccountUserRequest, GetBankAccountRequest, GetBankAccountUserRequest } from "@fiado/type-kit/bin/account";
|
|
4
4
|
import { ActivateBankAccountCardRequest, AssignCardRequest, CreateBankAccountCardRequest, UpdateBankAccountCardRequest } from "@fiado/type-kit/bin/card";
|
|
5
5
|
export default class TernApi implements ITernApi {
|
|
6
6
|
private httpRequest;
|
|
@@ -18,4 +18,5 @@ export default class TernApi implements ITernApi {
|
|
|
18
18
|
updateCard(request: UpdateBankAccountCardRequest): Promise<any>;
|
|
19
19
|
activateCard(request: ActivateBankAccountCardRequest): Promise<any>;
|
|
20
20
|
assignCardToUser(request: AssignCardRequest): Promise<any>;
|
|
21
|
+
p2pTransfer(request: BankAccountP2pTransferRequest): Promise<any>;
|
|
21
22
|
}
|
package/bin/tern/api/TernApi.js
CHANGED
|
@@ -69,6 +69,10 @@ let TernApi = class TernApi {
|
|
|
69
69
|
const url = `${this.baseUrl}cards/activate`;
|
|
70
70
|
return await this.httpRequest.post(url, request);
|
|
71
71
|
}
|
|
72
|
+
async p2pTransfer(request) {
|
|
73
|
+
const url = `${this.baseUrl}users/accounts/transfer_balances`;
|
|
74
|
+
return await this.httpRequest.patch(url, request);
|
|
75
|
+
}
|
|
72
76
|
};
|
|
73
77
|
TernApi = __decorate([
|
|
74
78
|
(0, inversify_1.injectable)(),
|
|
@@ -14,4 +14,5 @@ export interface ITernApi {
|
|
|
14
14
|
updateCard(request: UpdateBankAccountCardRequest): Promise<any>;
|
|
15
15
|
activateCard(request: ActivateBankAccountCardRequest): Promise<any>;
|
|
16
16
|
assignCardToUser(request: AssignCardRequest): Promise<any>;
|
|
17
|
+
p2pTransfer(request: any): Promise<any>;
|
|
17
18
|
}
|
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.75",
|
|
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.43",
|
|
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,38 @@
|
|
|
1
|
-
import {IAccountFiadoIncApi} from "./interfaces/IAccountFiadoIncApi";
|
|
2
|
-
import {
|
|
3
|
-
AccountCreateRequest,
|
|
4
|
-
AccountCreateResponse, AccountUpdateBalanceRequest,
|
|
5
|
-
GetAccountResponse,
|
|
6
|
-
GetPocketBalanceResponse
|
|
7
|
-
} from "@fiado/type-kit/bin/account";
|
|
8
|
-
import {inject, injectable} from "inversify";
|
|
9
|
-
import {IHttpRequest} from "@fiado/http-client";
|
|
10
|
-
import {ApiGatewayResponse} from "@fiado/gateway-adapter";
|
|
11
|
-
|
|
12
|
-
@injectable()
|
|
13
|
-
export default class AccountFiadoIncApi implements IAccountFiadoIncApi {
|
|
14
|
-
private readonly baseUrl = process.env.ACCOUNT_FIADOINC_LAMBDA_URL || "";
|
|
15
|
-
|
|
16
|
-
constructor(@inject("IHttpRequest") private httpRequest: IHttpRequest) {
|
|
17
|
-
}
|
|
18
|
-
|
|
19
|
-
async createAccount(data: AccountCreateRequest): Promise<ApiGatewayResponse<AccountCreateResponse>> {
|
|
20
|
-
const url = `${this.baseUrl}`;
|
|
21
|
-
return await this.httpRequest.post(url, data);
|
|
22
|
-
}
|
|
23
|
-
|
|
24
|
-
async getAccountByDirectoryId(directoryId: string): Promise<ApiGatewayResponse<GetAccountResponse[]>> {
|
|
25
|
-
const url = `${this.baseUrl}users/${directoryId}`;
|
|
26
|
-
return await this.httpRequest.get(url);
|
|
27
|
-
}
|
|
28
|
-
|
|
29
|
-
async getPocketBalance(directoryId: string): Promise<ApiGatewayResponse<GetPocketBalanceResponse>> {
|
|
30
|
-
const url = `${this.baseUrl}/pockets/users/${directoryId}/balance`;
|
|
31
|
-
return await this.httpRequest.get(url);
|
|
32
|
-
}
|
|
33
|
-
|
|
34
|
-
async updatePocketBalance(pocketId: string, request: AccountUpdateBalanceRequest): Promise<ApiGatewayResponse<null>> {
|
|
35
|
-
const url = `${this.baseUrl}/pockets/${pocketId}/balance`;
|
|
36
|
-
return await this.httpRequest.put(url, request);
|
|
37
|
-
}
|
|
1
|
+
import {IAccountFiadoIncApi} from "./interfaces/IAccountFiadoIncApi";
|
|
2
|
+
import {
|
|
3
|
+
AccountCreateRequest,
|
|
4
|
+
AccountCreateResponse, AccountUpdateBalanceRequest,
|
|
5
|
+
GetAccountResponse,
|
|
6
|
+
GetPocketBalanceResponse
|
|
7
|
+
} from "@fiado/type-kit/bin/account";
|
|
8
|
+
import {inject, injectable} from "inversify";
|
|
9
|
+
import {IHttpRequest} from "@fiado/http-client";
|
|
10
|
+
import {ApiGatewayResponse} from "@fiado/gateway-adapter";
|
|
11
|
+
|
|
12
|
+
@injectable()
|
|
13
|
+
export default class AccountFiadoIncApi implements IAccountFiadoIncApi {
|
|
14
|
+
private readonly baseUrl = process.env.ACCOUNT_FIADOINC_LAMBDA_URL || "";
|
|
15
|
+
|
|
16
|
+
constructor(@inject("IHttpRequest") private httpRequest: IHttpRequest) {
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
async createAccount(data: AccountCreateRequest): Promise<ApiGatewayResponse<AccountCreateResponse>> {
|
|
20
|
+
const url = `${this.baseUrl}`;
|
|
21
|
+
return await this.httpRequest.post(url, data);
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
async getAccountByDirectoryId(directoryId: string): Promise<ApiGatewayResponse<GetAccountResponse[]>> {
|
|
25
|
+
const url = `${this.baseUrl}users/${directoryId}`;
|
|
26
|
+
return await this.httpRequest.get(url);
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
async getPocketBalance(directoryId: string): Promise<ApiGatewayResponse<GetPocketBalanceResponse>> {
|
|
30
|
+
const url = `${this.baseUrl}/pockets/users/${directoryId}/balance`;
|
|
31
|
+
return await this.httpRequest.get(url);
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
async updatePocketBalance(pocketId: string, request: AccountUpdateBalanceRequest): Promise<ApiGatewayResponse<null>> {
|
|
35
|
+
const url = `${this.baseUrl}/pockets/${pocketId}/balance`;
|
|
36
|
+
return await this.httpRequest.put(url, request);
|
|
37
|
+
}
|
|
38
38
|
}
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
export * from './interfaces/IAccountFiadoIncApi';
|
|
1
|
+
export * from './interfaces/IAccountFiadoIncApi';
|
|
2
2
|
export * from './AccountFiadoIncApi';
|
|
@@ -1,18 +1,18 @@
|
|
|
1
|
-
import {
|
|
2
|
-
AccountCreateRequest,
|
|
3
|
-
AccountCreateResponse, AccountUpdateBalanceRequest,
|
|
4
|
-
GetAccountResponse,
|
|
5
|
-
GetPocketBalanceResponse
|
|
6
|
-
} from "@fiado/type-kit/bin/account";
|
|
7
|
-
import {ApiGatewayResponse} from "@fiado/gateway-adapter";
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
export interface IAccountFiadoIncApi {
|
|
11
|
-
createAccount(data: AccountCreateRequest): Promise<ApiGatewayResponse<AccountCreateResponse>>;
|
|
12
|
-
|
|
13
|
-
getAccountByDirectoryId(directoryId: string): Promise<ApiGatewayResponse<GetAccountResponse[]>>;
|
|
14
|
-
|
|
15
|
-
getPocketBalance(directoryId: string): Promise<ApiGatewayResponse<GetPocketBalanceResponse>>;
|
|
16
|
-
|
|
17
|
-
updatePocketBalance(pocketId: string, request: AccountUpdateBalanceRequest): Promise<ApiGatewayResponse<null>>
|
|
1
|
+
import {
|
|
2
|
+
AccountCreateRequest,
|
|
3
|
+
AccountCreateResponse, AccountUpdateBalanceRequest,
|
|
4
|
+
GetAccountResponse,
|
|
5
|
+
GetPocketBalanceResponse
|
|
6
|
+
} from "@fiado/type-kit/bin/account";
|
|
7
|
+
import {ApiGatewayResponse} from "@fiado/gateway-adapter";
|
|
8
|
+
|
|
9
|
+
|
|
10
|
+
export interface IAccountFiadoIncApi {
|
|
11
|
+
createAccount(data: AccountCreateRequest): Promise<ApiGatewayResponse<AccountCreateResponse>>;
|
|
12
|
+
|
|
13
|
+
getAccountByDirectoryId(directoryId: string): Promise<ApiGatewayResponse<GetAccountResponse[]>>;
|
|
14
|
+
|
|
15
|
+
getPocketBalance(directoryId: string): Promise<ApiGatewayResponse<GetPocketBalanceResponse>>;
|
|
16
|
+
|
|
17
|
+
updatePocketBalance(pocketId: string, request: AccountUpdateBalanceRequest): Promise<ApiGatewayResponse<null>>
|
|
18
18
|
}
|
|
@@ -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
|
}
|
|
@@ -1,47 +1,47 @@
|
|
|
1
|
-
import { IHttpRequest } from "@fiado/http-client";
|
|
2
|
-
import { AddressCreateRequest, AddressShippingCardResponse } from "@fiado/type-kit/bin/address";
|
|
3
|
-
import { inject, injectable } from "inversify";
|
|
4
|
-
import { IAddressApi } from "./interfaces/IAddressApi";
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
@injectable()
|
|
8
|
-
export class AddressApi implements IAddressApi {
|
|
9
|
-
|
|
10
|
-
private readonly baseUrl = process.env.ADDRESS_LAMBDA_URL || "";
|
|
11
|
-
constructor(@inject("IHttpRequest") private httpRequest: IHttpRequest) { }
|
|
12
|
-
|
|
13
|
-
async getByDirectoryId(directoryId: string): Promise<any> {
|
|
14
|
-
|
|
15
|
-
this.validateBaseUrl();
|
|
16
|
-
this.validateDirectoryId(directoryId);
|
|
17
|
-
|
|
18
|
-
const url = `${this.baseUrl}users/${directoryId}`;
|
|
19
|
-
|
|
20
|
-
return await this.httpRequest.get(`${url}`, null);
|
|
21
|
-
}
|
|
22
|
-
|
|
23
|
-
async create(directoryId: string, address: AddressCreateRequest): Promise<void> {
|
|
24
|
-
this.validateBaseUrl();
|
|
25
|
-
this.validateDirectoryId(directoryId);
|
|
26
|
-
const url = `${this.baseUrl}users/${directoryId}`;
|
|
27
|
-
await this.httpRequest.post<void>(url, address);
|
|
28
|
-
}
|
|
29
|
-
|
|
30
|
-
async getAddressLocationShipping(directoryId: string): Promise<AddressShippingCardResponse> {
|
|
31
|
-
this.validateBaseUrl();
|
|
32
|
-
const url = `${this.baseUrl}shipping`;
|
|
33
|
-
return await this.httpRequest.post<AddressShippingCardResponse>(url, { directoryId });
|
|
34
|
-
}
|
|
35
|
-
|
|
36
|
-
private validateBaseUrl() {
|
|
37
|
-
if (!this.baseUrl) {
|
|
38
|
-
throw new Error("Environment variable ADDRESS_LAMBDA_URL value not found");
|
|
39
|
-
}
|
|
40
|
-
}
|
|
41
|
-
|
|
42
|
-
private validateDirectoryId(directoryId: string) {
|
|
43
|
-
if (!directoryId) {
|
|
44
|
-
throw new Error("Directory ID is required.");
|
|
45
|
-
}
|
|
46
|
-
}
|
|
1
|
+
import { IHttpRequest } from "@fiado/http-client";
|
|
2
|
+
import { AddressCreateRequest, AddressShippingCardResponse } from "@fiado/type-kit/bin/address";
|
|
3
|
+
import { inject, injectable } from "inversify";
|
|
4
|
+
import { IAddressApi } from "./interfaces/IAddressApi";
|
|
5
|
+
|
|
6
|
+
|
|
7
|
+
@injectable()
|
|
8
|
+
export class AddressApi implements IAddressApi {
|
|
9
|
+
|
|
10
|
+
private readonly baseUrl = process.env.ADDRESS_LAMBDA_URL || "";
|
|
11
|
+
constructor(@inject("IHttpRequest") private httpRequest: IHttpRequest) { }
|
|
12
|
+
|
|
13
|
+
async getByDirectoryId(directoryId: string): Promise<any> {
|
|
14
|
+
|
|
15
|
+
this.validateBaseUrl();
|
|
16
|
+
this.validateDirectoryId(directoryId);
|
|
17
|
+
|
|
18
|
+
const url = `${this.baseUrl}users/${directoryId}`;
|
|
19
|
+
|
|
20
|
+
return await this.httpRequest.get(`${url}`, null);
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
async create(directoryId: string, address: AddressCreateRequest): Promise<void> {
|
|
24
|
+
this.validateBaseUrl();
|
|
25
|
+
this.validateDirectoryId(directoryId);
|
|
26
|
+
const url = `${this.baseUrl}users/${directoryId}`;
|
|
27
|
+
await this.httpRequest.post<void>(url, address);
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
async getAddressLocationShipping(directoryId: string): Promise<AddressShippingCardResponse> {
|
|
31
|
+
this.validateBaseUrl();
|
|
32
|
+
const url = `${this.baseUrl}shipping`;
|
|
33
|
+
return await this.httpRequest.post<AddressShippingCardResponse>(url, { directoryId });
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
private validateBaseUrl() {
|
|
37
|
+
if (!this.baseUrl) {
|
|
38
|
+
throw new Error("Environment variable ADDRESS_LAMBDA_URL value not found");
|
|
39
|
+
}
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
private validateDirectoryId(directoryId: string) {
|
|
43
|
+
if (!directoryId) {
|
|
44
|
+
throw new Error("Directory ID is required.");
|
|
45
|
+
}
|
|
46
|
+
}
|
|
47
47
|
}
|
package/src/address/index.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
export * from './interfaces/IAddressApi';
|
|
1
|
+
|
|
2
|
+
|
|
3
|
+
export * from './interfaces/IAddressApi';
|
|
4
4
|
export * from './AddressApi';
|