@fiado/api-invoker 1.3.21 → 1.3.23
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.
|
@@ -1,10 +1,13 @@
|
|
|
1
|
-
import { IBankAccountApi } from "./interfaces/IBankAccountApi";
|
|
2
1
|
import { IHttpRequest } from "@fiado/http-client";
|
|
2
|
+
import { IBankAccountApi } from "./interfaces/IBankAccountApi";
|
|
3
|
+
import GetExternalBankAccountResponse from "@fiado/type-kit/bin/bankAccount/dtos/GetExternalBankAccountResponse";
|
|
4
|
+
import FiadoApiResponse from "@fiado/type-kit/bin/apiResponse/dtos/FiadoApiResponse";
|
|
5
|
+
import { GetExternalBankResponse } from "@fiado/type-kit/bin/bankAccount";
|
|
3
6
|
export default class BankAccountApi implements IBankAccountApi {
|
|
4
7
|
private httpRequest;
|
|
5
8
|
private readonly baseUrl;
|
|
6
9
|
constructor(httpRequest: IHttpRequest);
|
|
7
|
-
getBankAccountById(bankAccountId: string): Promise<
|
|
8
|
-
getBankById(bankId: string): Promise<
|
|
9
|
-
getBankByCode(bankCode?: string, shortBankCode?: string): Promise<
|
|
10
|
+
getBankAccountById(bankAccountId: string): Promise<FiadoApiResponse<GetExternalBankAccountResponse>>;
|
|
11
|
+
getBankById(bankId: string): Promise<FiadoApiResponse<GetExternalBankResponse>>;
|
|
12
|
+
getBankByCode(bankCode?: string, shortBankCode?: string): Promise<FiadoApiResponse<GetExternalBankResponse[]>>;
|
|
10
13
|
}
|
|
@@ -19,35 +19,20 @@ let BankAccountApi = class BankAccountApi {
|
|
|
19
19
|
this.baseUrl = process.env.BANK_ACCOUNT_LAMBDA_UR || "";
|
|
20
20
|
}
|
|
21
21
|
async getBankAccountById(bankAccountId) {
|
|
22
|
-
const url = `${this.baseUrl}`;
|
|
23
|
-
|
|
24
|
-
accountId: bankAccountId
|
|
25
|
-
};
|
|
26
|
-
const headers = {
|
|
27
|
-
'Content-Type': 'application/json',
|
|
28
|
-
operationName: "postBankAccountId"
|
|
29
|
-
};
|
|
30
|
-
return await this.httpRequest.post(url, body, headers);
|
|
22
|
+
const url = `${this.baseUrl}/accounts/${bankAccountId}`;
|
|
23
|
+
return await this.httpRequest.get(url);
|
|
31
24
|
}
|
|
32
25
|
async getBankById(bankId) {
|
|
33
|
-
const url = `${this.baseUrl}`;
|
|
34
|
-
|
|
35
|
-
bankId: bankId
|
|
36
|
-
};
|
|
37
|
-
const headers = {
|
|
38
|
-
'Content-Type': 'application/json',
|
|
39
|
-
operationName: "getBanksBankId"
|
|
40
|
-
};
|
|
41
|
-
return await this.httpRequest.post(url, body, headers);
|
|
26
|
+
const url = `${this.baseUrl}/banks/${bankId}`;
|
|
27
|
+
return await this.httpRequest.get(url);
|
|
42
28
|
}
|
|
43
29
|
async getBankByCode(bankCode, shortBankCode) {
|
|
44
|
-
const url = `${this.baseUrl}`;
|
|
45
|
-
const params =
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
operationName: "getBanks"
|
|
30
|
+
const url = `${this.baseUrl}/banks`;
|
|
31
|
+
const params = {
|
|
32
|
+
...bankCode && { bankCode: bankCode },
|
|
33
|
+
...shortBankCode && { shortBankCode: shortBankCode },
|
|
49
34
|
};
|
|
50
|
-
return await this.httpRequest.
|
|
35
|
+
return await this.httpRequest.get(url, { params });
|
|
51
36
|
}
|
|
52
37
|
};
|
|
53
38
|
BankAccountApi = __decorate([
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@fiado/api-invoker",
|
|
3
|
-
"version": "1.3.
|
|
3
|
+
"version": "1.3.23",
|
|
4
4
|
"description": "Sirve como un puente entre diferentes funciones lambda, facilitando la comunicación entre ellas a través de invocaciones http",
|
|
5
5
|
"main": "bin/index.js",
|
|
6
6
|
"types": "bin/index.d.ts",
|
|
@@ -1,7 +1,11 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
4
|
-
import
|
|
1
|
+
import { ApiResponse } from "@fiado/gateway-adapter";
|
|
2
|
+
import { IHttpRequest } from "@fiado/http-client";
|
|
3
|
+
import { inject, injectable } from "inversify";
|
|
4
|
+
import { IBankAccountApi } from "./interfaces/IBankAccountApi";
|
|
5
|
+
import GetExternalBankAccountResponse from "@fiado/type-kit/bin/bankAccount/dtos/GetExternalBankAccountResponse";
|
|
6
|
+
import FiadoApiResponse from "@fiado/type-kit/bin/apiResponse/dtos/FiadoApiResponse";
|
|
7
|
+
import { GetExternalBankResponse } from "@fiado/type-kit/bin/bankAccount";
|
|
8
|
+
|
|
5
9
|
|
|
6
10
|
@injectable()
|
|
7
11
|
export default class BankAccountApi implements IBankAccountApi {
|
|
@@ -10,40 +14,22 @@ export default class BankAccountApi implements IBankAccountApi {
|
|
|
10
14
|
constructor(@inject("IHttpRequest") private httpRequest: IHttpRequest) {
|
|
11
15
|
}
|
|
12
16
|
|
|
13
|
-
async getBankAccountById(bankAccountId: string): Promise<
|
|
14
|
-
const url = `${this.baseUrl}`;
|
|
15
|
-
|
|
16
|
-
accountId: bankAccountId
|
|
17
|
-
} as GetExternalBankAccountRequest;
|
|
18
|
-
const headers = {
|
|
19
|
-
'Content-Type': 'application/json',
|
|
20
|
-
operationName: "postBankAccountId"
|
|
21
|
-
};
|
|
22
|
-
|
|
23
|
-
return await this.httpRequest.post(url, body, headers);
|
|
17
|
+
async getBankAccountById(bankAccountId: string): Promise<FiadoApiResponse<GetExternalBankAccountResponse>> {
|
|
18
|
+
const url = `${this.baseUrl}/accounts/${bankAccountId}`;
|
|
19
|
+
return await this.httpRequest.get(url);
|
|
24
20
|
}
|
|
25
21
|
|
|
26
|
-
async getBankById(bankId: string): Promise<
|
|
27
|
-
const url = `${this.baseUrl}`;
|
|
28
|
-
|
|
29
|
-
bankId: bankId
|
|
30
|
-
} as GetExternalBankAccountRequest;
|
|
31
|
-
const headers = {
|
|
32
|
-
'Content-Type': 'application/json',
|
|
33
|
-
operationName: "getBanksBankId"
|
|
34
|
-
};
|
|
35
|
-
|
|
36
|
-
return await this.httpRequest.post(url, body, headers);
|
|
22
|
+
async getBankById(bankId: string): Promise<FiadoApiResponse<GetExternalBankResponse>> {
|
|
23
|
+
const url = `${this.baseUrl}/banks/${bankId}`;
|
|
24
|
+
return await this.httpRequest.get(url);
|
|
37
25
|
}
|
|
38
26
|
|
|
39
|
-
async getBankByCode(bankCode?: string, shortBankCode?: string): Promise<
|
|
40
|
-
const url = `${this.baseUrl}`;
|
|
41
|
-
const params =
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
operationName: "getBanks"
|
|
27
|
+
async getBankByCode(bankCode?: string, shortBankCode?: string): Promise<FiadoApiResponse<GetExternalBankResponse[]>> {
|
|
28
|
+
const url = `${this.baseUrl}/banks`;
|
|
29
|
+
const params = {
|
|
30
|
+
...bankCode && { bankCode: bankCode },
|
|
31
|
+
...shortBankCode && { shortBankCode: shortBankCode },
|
|
45
32
|
};
|
|
46
|
-
|
|
47
|
-
return await this.httpRequest.post(`${url}?${params}`, null, headers);
|
|
33
|
+
return await this.httpRequest.get(url, { params });
|
|
48
34
|
}
|
|
49
35
|
}
|