@fiado/api-invoker 5.45.0 → 5.46.0
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/bin/account-pagoconfiado/AccountPagoConfiadoApi.d.ts +3 -2
- package/bin/account-pagoconfiado/AccountPagoConfiadoApi.js +4 -0
- package/bin/account-pagoconfiado/interfaces/IAccountPagoConfiadoApi.d.ts +13 -1
- package/package.json +2 -2
- package/src/account-pagoconfiado/AccountPagoConfiadoApi.ts +7 -2
- package/src/account-pagoconfiado/interfaces/IAccountPagoConfiadoApi.ts +14 -8
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { IAccountPagoConfiadoApi } from "./interfaces/IAccountPagoConfiadoApi.js";
|
|
2
|
-
import { AccountCreateRequest, AccountCreateResponse, AccountUpdateBalanceRequest, AccountUpdateRequest, GetAccountResponse, GetAccountResponseList } from "@fiado/type-kit/bin/account/index.js";
|
|
2
|
+
import { AccountCreateRequest, AccountCreateResponse, AccountUpdateBalanceRequest, AccountUpdateRequest, CollectDebitRequest, CollectDebitResponse, GetAccountResponse, GetAccountResponseList } from "@fiado/type-kit/bin/account/index.js";
|
|
3
3
|
import { ApiGatewayResponse } from "@fiado/gateway-adapter";
|
|
4
|
-
import { IHttpRequest } from "@fiado/http-client";
|
|
4
|
+
import type { IHttpRequest } from "@fiado/http-client";
|
|
5
5
|
import { Provider } from "@fiado/type-kit/bin/provider/index.js";
|
|
6
6
|
export default class AccountPagoConfiadoApi implements IAccountPagoConfiadoApi {
|
|
7
7
|
private httpRequest;
|
|
@@ -11,6 +11,7 @@ export default class AccountPagoConfiadoApi implements IAccountPagoConfiadoApi {
|
|
|
11
11
|
createAccount(provider: Provider, data: AccountCreateRequest): Promise<ApiGatewayResponse<AccountCreateResponse>>;
|
|
12
12
|
getAccountByDirectoryId(directoryId: string): Promise<ApiGatewayResponse<GetAccountResponse[]>>;
|
|
13
13
|
updateAccountBalance(accountId: string, params: AccountUpdateBalanceRequest): Promise<ApiGatewayResponse<Boolean>>;
|
|
14
|
+
collectDebit(accountId: string, request: CollectDebitRequest): Promise<ApiGatewayResponse<CollectDebitResponse>>;
|
|
14
15
|
update(directoryId: string, data: AccountUpdateRequest): Promise<ApiGatewayResponse<void>>;
|
|
15
16
|
updateByAccountNumber(accountNumber: string, data: AccountUpdateRequest): Promise<ApiGatewayResponse<void>>;
|
|
16
17
|
getAccountByAccountNumber(accountNumber: string): Promise<ApiGatewayResponse<void>>;
|
|
@@ -33,6 +33,10 @@ let AccountPagoConfiadoApi = class AccountPagoConfiadoApi {
|
|
|
33
33
|
const url = `${this.baseUrl}${accountId}/balance`;
|
|
34
34
|
return await this.httpRequest.put(url, params);
|
|
35
35
|
}
|
|
36
|
+
async collectDebit(accountId, request) {
|
|
37
|
+
const url = `${this.baseUrl}accounts/${accountId}/collect-debit`;
|
|
38
|
+
return await this.httpRequest.post(url, request);
|
|
39
|
+
}
|
|
36
40
|
async update(directoryId, data) {
|
|
37
41
|
const url = `${this.baseUrl}users/${directoryId}`;
|
|
38
42
|
return await this.httpRequest.put(url, data);
|
|
@@ -1,10 +1,22 @@
|
|
|
1
|
-
import { AccountCreateRequest, AccountCreateResponse, AccountUpdateBalanceRequest, AccountUpdateRequest, GetAccountResponse, GetAccountResponseList } from "@fiado/type-kit/bin/account/index.js";
|
|
1
|
+
import { AccountCreateRequest, AccountCreateResponse, AccountUpdateBalanceRequest, AccountUpdateRequest, CollectDebitRequest, CollectDebitResponse, GetAccountResponse, GetAccountResponseList } from "@fiado/type-kit/bin/account/index.js";
|
|
2
2
|
import { ApiGatewayResponse } from "@fiado/gateway-adapter";
|
|
3
3
|
import { Provider } from "@fiado/type-kit/bin/provider/index.js";
|
|
4
4
|
export interface IAccountPagoConfiadoApi {
|
|
5
5
|
createAccount(provider: Provider, data: AccountCreateRequest): Promise<ApiGatewayResponse<AccountCreateResponse>>;
|
|
6
6
|
getAccountByDirectoryId(directoryId: string, provider: string): Promise<ApiGatewayResponse<GetAccountResponse[]>>;
|
|
7
7
|
updateAccountBalance(accountId: string, params: AccountUpdateBalanceRequest): Promise<ApiGatewayResponse<Boolean>>;
|
|
8
|
+
/**
|
|
9
|
+
* Debita el saldo disponible de la cuenta para cobrar una deuda, en una sola operación que lleva
|
|
10
|
+
* la condición de fondos consigo: entre comprobar el saldo y descontarlo no cabe otra escritura,
|
|
11
|
+
* de modo que dos cobros simultáneos no pueden sobregirar la cuenta.
|
|
12
|
+
*
|
|
13
|
+
* Idempotente por `executionId`: reintentar el mismo intento de cobro devuelve el resultado del
|
|
14
|
+
* primero en vez de volver a debitar. Saldo insuficiente NO es un error — responde 200 con
|
|
15
|
+
* `result: NONE`, y quien cobra decide si buscar el dinero en otra fuente.
|
|
16
|
+
*
|
|
17
|
+
* Backend: POST /accounts/{accountId}/collect-debit (privado VPC).
|
|
18
|
+
*/
|
|
19
|
+
collectDebit(accountId: string, request: CollectDebitRequest): Promise<ApiGatewayResponse<CollectDebitResponse>>;
|
|
8
20
|
update(directoryId: string, data: AccountUpdateRequest): Promise<ApiGatewayResponse<void>>;
|
|
9
21
|
updateByAccountNumber(accountNumber: string, data: AccountUpdateRequest): Promise<ApiGatewayResponse<void>>;
|
|
10
22
|
getAccountByAccountNumber(accountNumber: string): Promise<ApiGatewayResponse<void>>;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@fiado/api-invoker",
|
|
3
|
-
"version": "5.
|
|
3
|
+
"version": "5.46.0",
|
|
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
|
"type": "module",
|
|
6
6
|
"main": "bin/index.js",
|
|
@@ -34,7 +34,7 @@
|
|
|
34
34
|
"@fiado/gateway-adapter": "^3.9.0",
|
|
35
35
|
"@fiado/http-client": "^2.0.1",
|
|
36
36
|
"@fiado/logger": "^1.1.3",
|
|
37
|
-
"@fiado/type-kit": "^3.
|
|
37
|
+
"@fiado/type-kit": "^3.368.0",
|
|
38
38
|
"dotenv": "^16.4.7"
|
|
39
39
|
},
|
|
40
40
|
"peerDependencies": {
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import {IAccountPagoConfiadoApi} from "./interfaces/IAccountPagoConfiadoApi.js";
|
|
2
|
-
import {AccountCreateRequest, AccountCreateResponse, AccountUpdateBalanceRequest, AccountUpdateRequest, GetAccountResponse, GetAccountResponseList} from "@fiado/type-kit/bin/account/index.js";
|
|
2
|
+
import {AccountCreateRequest, AccountCreateResponse, AccountUpdateBalanceRequest, AccountUpdateRequest, CollectDebitRequest, CollectDebitResponse, GetAccountResponse, GetAccountResponseList} from "@fiado/type-kit/bin/account/index.js";
|
|
3
3
|
import {ApiGatewayResponse} from "@fiado/gateway-adapter";
|
|
4
4
|
import {inject, injectable} from "inversify";
|
|
5
|
-
import {IHttpRequest} from "@fiado/http-client";
|
|
5
|
+
import type {IHttpRequest} from "@fiado/http-client";
|
|
6
6
|
import { Provider } from "@fiado/type-kit/bin/provider/index.js";
|
|
7
7
|
|
|
8
8
|
@injectable()
|
|
@@ -31,6 +31,11 @@ export default class AccountPagoConfiadoApi implements IAccountPagoConfiadoApi {
|
|
|
31
31
|
return await this.httpRequest.put(url,params);
|
|
32
32
|
}
|
|
33
33
|
|
|
34
|
+
async collectDebit(accountId: string, request: CollectDebitRequest): Promise<ApiGatewayResponse<CollectDebitResponse>> {
|
|
35
|
+
const url = `${this.baseUrl}accounts/${accountId}/collect-debit`;
|
|
36
|
+
return await this.httpRequest.post(url, request);
|
|
37
|
+
}
|
|
38
|
+
|
|
34
39
|
async update(directoryId: string, data: AccountUpdateRequest): Promise<ApiGatewayResponse<void>> {
|
|
35
40
|
const url = `${this.baseUrl}users/${directoryId}`;
|
|
36
41
|
return await this.httpRequest.put(url, data);
|
|
@@ -1,11 +1,4 @@
|
|
|
1
|
-
import {
|
|
2
|
-
AccountCreateRequest,
|
|
3
|
-
AccountCreateResponse,
|
|
4
|
-
AccountUpdateBalanceRequest,
|
|
5
|
-
AccountUpdateRequest,
|
|
6
|
-
GetAccountResponse,
|
|
7
|
-
GetAccountResponseList
|
|
8
|
-
} from "@fiado/type-kit/bin/account/index.js";
|
|
1
|
+
import {AccountCreateRequest, AccountCreateResponse, AccountUpdateBalanceRequest, AccountUpdateRequest, CollectDebitRequest, CollectDebitResponse, GetAccountResponse, GetAccountResponseList} from "@fiado/type-kit/bin/account/index.js";
|
|
9
2
|
import { ApiGatewayResponse } from "@fiado/gateway-adapter";
|
|
10
3
|
import { Provider } from "@fiado/type-kit/bin/provider/index.js";
|
|
11
4
|
|
|
@@ -17,6 +10,19 @@ export interface IAccountPagoConfiadoApi {
|
|
|
17
10
|
|
|
18
11
|
updateAccountBalance(accountId: string, params: AccountUpdateBalanceRequest): Promise<ApiGatewayResponse<Boolean>>;
|
|
19
12
|
|
|
13
|
+
/**
|
|
14
|
+
* Debita el saldo disponible de la cuenta para cobrar una deuda, en una sola operación que lleva
|
|
15
|
+
* la condición de fondos consigo: entre comprobar el saldo y descontarlo no cabe otra escritura,
|
|
16
|
+
* de modo que dos cobros simultáneos no pueden sobregirar la cuenta.
|
|
17
|
+
*
|
|
18
|
+
* Idempotente por `executionId`: reintentar el mismo intento de cobro devuelve el resultado del
|
|
19
|
+
* primero en vez de volver a debitar. Saldo insuficiente NO es un error — responde 200 con
|
|
20
|
+
* `result: NONE`, y quien cobra decide si buscar el dinero en otra fuente.
|
|
21
|
+
*
|
|
22
|
+
* Backend: POST /accounts/{accountId}/collect-debit (privado VPC).
|
|
23
|
+
*/
|
|
24
|
+
collectDebit(accountId: string, request: CollectDebitRequest): Promise<ApiGatewayResponse<CollectDebitResponse>>;
|
|
25
|
+
|
|
20
26
|
update(directoryId: string, data: AccountUpdateRequest): Promise<ApiGatewayResponse<void>>;
|
|
21
27
|
|
|
22
28
|
updateByAccountNumber(accountNumber: string, data: AccountUpdateRequest): Promise<ApiGatewayResponse<void>>;
|