@fiado/api-invoker 4.53.0 → 4.54.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.
@@ -110,6 +110,8 @@ import { EqualityConnectorApi } from "./equality-connector/index.js";
110
110
  import { ContactsBusinessApi } from "./contacts-business/index.js";
111
111
  // Wallet funding settlement — TransactWriteItems atómico del money path cash-in (spec 15)
112
112
  import { WalletFundingSettlementApi } from "./walletFundingSettlement/index.js";
113
+ // Wallet funding rules — validaciones de riesgo Cash In (cap agregado, exposición, breaker, LFPIORPI)
114
+ import { WalletFundingRulesApi } from "./wallet-funding-rules/index.js";
113
115
  // SNS/SES connector — envío SMS/MAIL síncrono (restaurado para RBAC — DEC-002 messages-business)
114
116
  import { SnsSesConnectorApi } from "./sns-ses-connector/index.js";
115
117
  // Remittance business — pricingResolve (Dashboard Ops Fase B, puente de resolución de precio en send-time)
@@ -236,6 +238,9 @@ export const apiInvokerBindings = new ContainerModule(({ bind }) => {
236
238
  // Wallet funding settlement — TransactWriteItems atómico del money path cash-in
237
239
  // (consumido por equality-connector post processor.walletFundingValidate). Ver spec 15.
238
240
  bind("IWalletFundingSettlementApi").to(WalletFundingSettlementApi);
241
+ // Wallet funding rules — cap agregado + exposición + circuit breaker + LFPIORPI (provider-agnostic).
242
+ // Lo consume transaction-processor en walletFundingValidate y db-conciliacion al liberar exposición.
243
+ bind("IWalletFundingRulesApi").to(WalletFundingRulesApi);
239
244
  // SNS/SES connector — envío SMS/MAIL síncrono (restaurado para RBAC — DEC-002 messages-business)
240
245
  bind("ISnsSesConnectorApi").to(SnsSesConnectorApi);
241
246
  // Remittance business — pricingResolve (Dashboard Ops Fase B, puente de resolución de precio en send-time)
@@ -1,7 +1,7 @@
1
1
  import { IHttpRequest } from "@fiado/http-client";
2
2
  import { ApiGatewayResponse } from "@fiado/gateway-adapter";
3
3
  import { ConnectorCatalogResponse } from "@fiado/type-kit/bin/benefitCenter/index.js";
4
- import { CreateFundingReferenceRequest, CreateFundingReferenceResponse, ListFundingReferencesResponse } from "@fiado/type-kit/bin/walletFunding/index.js";
4
+ import { CreateFundingReferenceRequest, CreateFundingReferenceResponse, ListFundingReferencesResponse, ApplyWalletFundingRequest, ApplyWalletFundingResponse } from "@fiado/type-kit/bin/walletFunding/index.js";
5
5
  import { IEqualityConnectorApi } from "./interfaces/IEqualityConnectorApi.js";
6
6
  export default class EqualityConnectorApi implements IEqualityConnectorApi {
7
7
  private httpRequest;
@@ -13,4 +13,5 @@ export default class EqualityConnectorApi implements IEqualityConnectorApi {
13
13
  benefitId: string;
14
14
  includeDisabled?: boolean;
15
15
  }): Promise<ApiGatewayResponse<ConnectorCatalogResponse>>;
16
+ applyFunding(request: ApplyWalletFundingRequest): Promise<ApiGatewayResponse<ApplyWalletFundingResponse>>;
16
17
  }
@@ -35,6 +35,10 @@ let EqualityConnectorApi = class EqualityConnectorApi {
35
35
  const url = `${this.baseUrl}/catalog/standard?${params.toString()}`;
36
36
  return await this.httpRequest.get(url);
37
37
  }
38
+ async applyFunding(request) {
39
+ const url = `${this.baseUrl}/funding/apply`;
40
+ return await this.httpRequest.post(url, request);
41
+ }
38
42
  };
39
43
  EqualityConnectorApi = __decorate([
40
44
  injectable(),
@@ -1,6 +1,6 @@
1
1
  import { ApiGatewayResponse } from "@fiado/gateway-adapter";
2
2
  import { ConnectorCatalogResponse } from "@fiado/type-kit/bin/benefitCenter/index.js";
3
- import { CreateFundingReferenceRequest, CreateFundingReferenceResponse, ListFundingReferencesResponse } from "@fiado/type-kit/bin/walletFunding/index.js";
3
+ import { CreateFundingReferenceRequest, CreateFundingReferenceResponse, ListFundingReferencesResponse, ApplyWalletFundingRequest, ApplyWalletFundingResponse } from "@fiado/type-kit/bin/walletFunding/index.js";
4
4
  /**
5
5
  * Cliente del marketplace hacia equality-connector (privado, dentro de la VPC).
6
6
  *
@@ -33,4 +33,10 @@ export interface IEqualityConnectorApi {
33
33
  benefitId: string;
34
34
  includeDisabled?: boolean;
35
35
  }): Promise<ApiGatewayResponse<ConnectorCatalogResponse>>;
36
+ /**
37
+ * Dispara el acreditamiento diferido de un pago ya verificado (POST /funding/apply).
38
+ * Lo invoca `db-conciliacion` cuando la verificación autoritativa contra el portal
39
+ * resuelve: APPROVED → acredita (processor.credit → settle); REJECTED → revierte.
40
+ */
41
+ applyFunding(request: ApplyWalletFundingRequest): Promise<ApiGatewayResponse<ApplyWalletFundingResponse>>;
36
42
  }
package/bin/index.d.ts CHANGED
@@ -82,5 +82,6 @@ export * from "./equality-connector/index.js";
82
82
  export * from "./contacts-business/index.js";
83
83
  export * from "./uniteller-connector/index.js";
84
84
  export * from "./walletFundingSettlement/index.js";
85
+ export * from "./wallet-funding-rules/index.js";
85
86
  export * from "./sns-ses-connector/index.js";
86
87
  export * from "./remittance-business/index.js";
package/bin/index.js CHANGED
@@ -82,5 +82,6 @@ export * from "./equality-connector/index.js";
82
82
  export * from "./contacts-business/index.js";
83
83
  export * from "./uniteller-connector/index.js";
84
84
  export * from "./walletFundingSettlement/index.js";
85
+ export * from "./wallet-funding-rules/index.js";
85
86
  export * from "./sns-ses-connector/index.js";
86
87
  export * from "./remittance-business/index.js";
@@ -0,0 +1,12 @@
1
+ import { IHttpRequest } from "@fiado/http-client";
2
+ import { ApiGatewayResponse } from "@fiado/gateway-adapter";
3
+ import { ReserveExposureRequest, ReserveExposureResponse, ReleaseExposureRequest, ReleaseExposureResponse, GetExposureStateResponse } from "@fiado/type-kit/bin/walletFunding/index.js";
4
+ import { IWalletFundingRulesApi } from "./interfaces/IWalletFundingRulesApi.js";
5
+ export default class WalletFundingRulesApi implements IWalletFundingRulesApi {
6
+ private httpRequest;
7
+ private readonly baseUrl;
8
+ constructor(httpRequest: IHttpRequest);
9
+ reserveExposure(request: ReserveExposureRequest): Promise<ApiGatewayResponse<ReserveExposureResponse>>;
10
+ releaseExposure(request: ReleaseExposureRequest): Promise<ApiGatewayResponse<ReleaseExposureResponse>>;
11
+ getExposureState(): Promise<ApiGatewayResponse<GetExposureStateResponse>>;
12
+ }
@@ -0,0 +1,38 @@
1
+ var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
2
+ var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
3
+ if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
4
+ 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;
5
+ return c > 3 && r && Object.defineProperty(target, key, r), r;
6
+ };
7
+ var __metadata = (this && this.__metadata) || function (k, v) {
8
+ if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
9
+ };
10
+ var __param = (this && this.__param) || function (paramIndex, decorator) {
11
+ return function (target, key) { decorator(target, key, paramIndex); }
12
+ };
13
+ import { inject, injectable } from "inversify";
14
+ let WalletFundingRulesApi = class WalletFundingRulesApi {
15
+ httpRequest;
16
+ baseUrl = process.env.WALLET_FUNDING_RULES_LAMBDA_URL || "";
17
+ constructor(httpRequest) {
18
+ this.httpRequest = httpRequest;
19
+ }
20
+ async reserveExposure(request) {
21
+ const url = `${this.baseUrl}/reserve`;
22
+ return await this.httpRequest.post(url, request);
23
+ }
24
+ async releaseExposure(request) {
25
+ const url = `${this.baseUrl}/release`;
26
+ return await this.httpRequest.post(url, request);
27
+ }
28
+ async getExposureState() {
29
+ const url = `${this.baseUrl}/state`;
30
+ return await this.httpRequest.get(url);
31
+ }
32
+ };
33
+ WalletFundingRulesApi = __decorate([
34
+ injectable(),
35
+ __param(0, inject("IHttpRequest")),
36
+ __metadata("design:paramtypes", [Object])
37
+ ], WalletFundingRulesApi);
38
+ export default WalletFundingRulesApi;
@@ -0,0 +1,23 @@
1
+ import { ApiGatewayResponse } from "@fiado/gateway-adapter";
2
+ import { ReserveExposureRequest, ReserveExposureResponse, ReleaseExposureRequest, ReleaseExposureResponse, GetExposureStateResponse } from "@fiado/type-kit/bin/walletFunding/index.js";
3
+ /**
4
+ * Cliente hacia `wallet-funding-rules-business` (lambda privado VPC).
5
+ *
6
+ * Dueño de las validaciones de riesgo del tipo Cash In: cap agregado FSA,
7
+ * exposición, circuit breaker y LFPIORPI. Provider-agnostic — lo consume el
8
+ * `transaction-processor` en `walletFundingValidate` (cap gate) y la
9
+ * conciliación (`db-conciliacion`) al liberar exposición.
10
+ *
11
+ * Endpoints backend en wallet-funding-rules:
12
+ * - POST /reserve (privado VPC) — reserva atómica single-region
13
+ * - POST /release (privado VPC)
14
+ * - GET /state (privado VPC)
15
+ */
16
+ export interface IWalletFundingRulesApi {
17
+ /** Reserva monto contra la exposición agregada (cap gate). Atómico single-region. */
18
+ reserveExposure(request: ReserveExposureRequest): Promise<ApiGatewayResponse<ReserveExposureResponse>>;
19
+ /** Libera monto de la exposición agregada (liquidación / rechazo). Puede reactivar el servicio. */
20
+ releaseExposure(request: ReleaseExposureRequest): Promise<ApiGatewayResponse<ReleaseExposureResponse>>;
21
+ /** Devuelve el estado actual de la exposición agregada + circuit breaker. */
22
+ getExposureState(): Promise<ApiGatewayResponse<GetExposureStateResponse>>;
23
+ }
@@ -0,0 +1,2 @@
1
+ export * from "./api/interfaces/IWalletFundingRulesApi.js";
2
+ export { default as WalletFundingRulesApi } from "./api/WalletFundingRulesApi.js";
@@ -0,0 +1,2 @@
1
+ export * from "./api/interfaces/IWalletFundingRulesApi.js";
2
+ export { default as WalletFundingRulesApi } from "./api/WalletFundingRulesApi.js";
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@fiado/api-invoker",
3
- "version": "4.53.0",
3
+ "version": "4.54.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.162.0",
37
+ "@fiado/type-kit": "^3.163.0",
38
38
  "dotenv": "^16.4.7"
39
39
  },
40
40
  "peerDependencies": {
@@ -169,6 +169,8 @@ import { IEqualityConnectorApi, EqualityConnectorApi } from "./equality-connecto
169
169
  import { IContactsBusinessApi, ContactsBusinessApi } from "./contacts-business/index.js";
170
170
  // Wallet funding settlement — TransactWriteItems atómico del money path cash-in (spec 15)
171
171
  import { IWalletFundingSettlementApi, WalletFundingSettlementApi } from "./walletFundingSettlement/index.js";
172
+ // Wallet funding rules — validaciones de riesgo Cash In (cap agregado, exposición, breaker, LFPIORPI)
173
+ import { IWalletFundingRulesApi, WalletFundingRulesApi } from "./wallet-funding-rules/index.js";
172
174
  // SNS/SES connector — envío SMS/MAIL síncrono (restaurado para RBAC — DEC-002 messages-business)
173
175
  import { ISnsSesConnectorApi, SnsSesConnectorApi } from "./sns-ses-connector/index.js";
174
176
  // Remittance business — pricingResolve (Dashboard Ops Fase B, puente de resolución de precio en send-time)
@@ -314,6 +316,10 @@ export const apiInvokerBindings = new ContainerModule(({ bind }) => {
314
316
  // (consumido por equality-connector post processor.walletFundingValidate). Ver spec 15.
315
317
  bind<IWalletFundingSettlementApi>("IWalletFundingSettlementApi").to(WalletFundingSettlementApi);
316
318
 
319
+ // Wallet funding rules — cap agregado + exposición + circuit breaker + LFPIORPI (provider-agnostic).
320
+ // Lo consume transaction-processor en walletFundingValidate y db-conciliacion al liberar exposición.
321
+ bind<IWalletFundingRulesApi>("IWalletFundingRulesApi").to(WalletFundingRulesApi);
322
+
317
323
  // SNS/SES connector — envío SMS/MAIL síncrono (restaurado para RBAC — DEC-002 messages-business)
318
324
  bind<ISnsSesConnectorApi>("ISnsSesConnectorApi").to(SnsSesConnectorApi);
319
325
 
@@ -6,6 +6,8 @@ import {
6
6
  CreateFundingReferenceRequest,
7
7
  CreateFundingReferenceResponse,
8
8
  ListFundingReferencesResponse,
9
+ ApplyWalletFundingRequest,
10
+ ApplyWalletFundingResponse,
9
11
  } from "@fiado/type-kit/bin/walletFunding/index.js";
10
12
  import { IEqualityConnectorApi } from "./interfaces/IEqualityConnectorApi.js";
11
13
 
@@ -40,4 +42,11 @@ export default class EqualityConnectorApi implements IEqualityConnectorApi {
40
42
  const url = `${this.baseUrl}/catalog/standard?${params.toString()}`;
41
43
  return await this.httpRequest.get(url);
42
44
  }
45
+
46
+ async applyFunding(
47
+ request: ApplyWalletFundingRequest,
48
+ ): Promise<ApiGatewayResponse<ApplyWalletFundingResponse>> {
49
+ const url = `${this.baseUrl}/funding/apply`;
50
+ return await this.httpRequest.post(url, request);
51
+ }
43
52
  }
@@ -4,6 +4,8 @@ import {
4
4
  CreateFundingReferenceRequest,
5
5
  CreateFundingReferenceResponse,
6
6
  ListFundingReferencesResponse,
7
+ ApplyWalletFundingRequest,
8
+ ApplyWalletFundingResponse,
7
9
  } from "@fiado/type-kit/bin/walletFunding/index.js";
8
10
 
9
11
  /**
@@ -44,4 +46,13 @@ export interface IEqualityConnectorApi {
44
46
  getStandardCatalog(
45
47
  query: { benefitId: string; includeDisabled?: boolean },
46
48
  ): Promise<ApiGatewayResponse<ConnectorCatalogResponse>>;
49
+
50
+ /**
51
+ * Dispara el acreditamiento diferido de un pago ya verificado (POST /funding/apply).
52
+ * Lo invoca `db-conciliacion` cuando la verificación autoritativa contra el portal
53
+ * resuelve: APPROVED → acredita (processor.credit → settle); REJECTED → revierte.
54
+ */
55
+ applyFunding(
56
+ request: ApplyWalletFundingRequest,
57
+ ): Promise<ApiGatewayResponse<ApplyWalletFundingResponse>>;
47
58
  }
package/src/index.ts CHANGED
@@ -82,5 +82,6 @@ export * from "./equality-connector/index.js";
82
82
  export * from "./contacts-business/index.js";
83
83
  export * from "./uniteller-connector/index.js";
84
84
  export * from "./walletFundingSettlement/index.js";
85
+ export * from "./wallet-funding-rules/index.js";
85
86
  export * from "./sns-ses-connector/index.js";
86
87
  export * from "./remittance-business/index.js";
@@ -0,0 +1,37 @@
1
+ import { inject, injectable } from "inversify";
2
+ import { IHttpRequest } from "@fiado/http-client";
3
+ import { ApiGatewayResponse } from "@fiado/gateway-adapter";
4
+ import {
5
+ ReserveExposureRequest,
6
+ ReserveExposureResponse,
7
+ ReleaseExposureRequest,
8
+ ReleaseExposureResponse,
9
+ GetExposureStateResponse,
10
+ } from "@fiado/type-kit/bin/walletFunding/index.js";
11
+ import { IWalletFundingRulesApi } from "./interfaces/IWalletFundingRulesApi.js";
12
+
13
+ @injectable()
14
+ export default class WalletFundingRulesApi implements IWalletFundingRulesApi {
15
+ private readonly baseUrl = process.env.WALLET_FUNDING_RULES_LAMBDA_URL || "";
16
+
17
+ constructor(@inject("IHttpRequest") private httpRequest: IHttpRequest) {}
18
+
19
+ async reserveExposure(
20
+ request: ReserveExposureRequest,
21
+ ): Promise<ApiGatewayResponse<ReserveExposureResponse>> {
22
+ const url = `${this.baseUrl}/reserve`;
23
+ return await this.httpRequest.post(url, request);
24
+ }
25
+
26
+ async releaseExposure(
27
+ request: ReleaseExposureRequest,
28
+ ): Promise<ApiGatewayResponse<ReleaseExposureResponse>> {
29
+ const url = `${this.baseUrl}/release`;
30
+ return await this.httpRequest.post(url, request);
31
+ }
32
+
33
+ async getExposureState(): Promise<ApiGatewayResponse<GetExposureStateResponse>> {
34
+ const url = `${this.baseUrl}/state`;
35
+ return await this.httpRequest.get(url);
36
+ }
37
+ }
@@ -0,0 +1,36 @@
1
+ import { ApiGatewayResponse } from "@fiado/gateway-adapter";
2
+ import {
3
+ ReserveExposureRequest,
4
+ ReserveExposureResponse,
5
+ ReleaseExposureRequest,
6
+ ReleaseExposureResponse,
7
+ GetExposureStateResponse,
8
+ } from "@fiado/type-kit/bin/walletFunding/index.js";
9
+
10
+ /**
11
+ * Cliente hacia `wallet-funding-rules-business` (lambda privado VPC).
12
+ *
13
+ * Dueño de las validaciones de riesgo del tipo Cash In: cap agregado FSA,
14
+ * exposición, circuit breaker y LFPIORPI. Provider-agnostic — lo consume el
15
+ * `transaction-processor` en `walletFundingValidate` (cap gate) y la
16
+ * conciliación (`db-conciliacion`) al liberar exposición.
17
+ *
18
+ * Endpoints backend en wallet-funding-rules:
19
+ * - POST /reserve (privado VPC) — reserva atómica single-region
20
+ * - POST /release (privado VPC)
21
+ * - GET /state (privado VPC)
22
+ */
23
+ export interface IWalletFundingRulesApi {
24
+ /** Reserva monto contra la exposición agregada (cap gate). Atómico single-region. */
25
+ reserveExposure(
26
+ request: ReserveExposureRequest,
27
+ ): Promise<ApiGatewayResponse<ReserveExposureResponse>>;
28
+
29
+ /** Libera monto de la exposición agregada (liquidación / rechazo). Puede reactivar el servicio. */
30
+ releaseExposure(
31
+ request: ReleaseExposureRequest,
32
+ ): Promise<ApiGatewayResponse<ReleaseExposureResponse>>;
33
+
34
+ /** Devuelve el estado actual de la exposición agregada + circuit breaker. */
35
+ getExposureState(): Promise<ApiGatewayResponse<GetExposureStateResponse>>;
36
+ }
@@ -0,0 +1,2 @@
1
+ export * from "./api/interfaces/IWalletFundingRulesApi.js";
2
+ export { default as WalletFundingRulesApi } from "./api/WalletFundingRulesApi.js";