@fiado/api-invoker 4.17.0 → 4.19.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.
Files changed (25) hide show
  1. package/bin/benefits-marketplace/api/BenefitsMarketplaceApi.d.ts +4 -0
  2. package/bin/benefits-marketplace/api/BenefitsMarketplaceApi.js +15 -0
  3. package/bin/benefits-marketplace/api/interfaces/IBenefitsMarketplaceApi.d.ts +21 -0
  4. package/bin/container.config.js +4 -0
  5. package/bin/equality-connector/api/EqualityConnectorApi.d.ts +12 -0
  6. package/bin/equality-connector/api/EqualityConnectorApi.js +41 -0
  7. package/bin/equality-connector/api/interfaces/IEqualityConnectorApi.d.ts +24 -0
  8. package/bin/equality-connector/api/interfaces/IEqualityConnectorApi.js +1 -0
  9. package/bin/equality-connector/index.d.ts +2 -0
  10. package/bin/equality-connector/index.js +2 -0
  11. package/bin/index.d.ts +1 -0
  12. package/bin/index.js +1 -0
  13. package/bin/transactionProcessor/api/TransactionProcessorApi.d.ts +5 -0
  14. package/bin/transactionProcessor/api/TransactionProcessorApi.js +12 -0
  15. package/bin/transactionProcessor/api/interfaces/ITransactionProcessorApi.d.ts +20 -0
  16. package/package.json +9 -2
  17. package/src/benefits-marketplace/api/BenefitsMarketplaceApi.ts +35 -0
  18. package/src/benefits-marketplace/api/interfaces/IBenefitsMarketplaceApi.ts +41 -0
  19. package/src/container.config.ts +5 -0
  20. package/src/equality-connector/api/EqualityConnectorApi.ts +43 -0
  21. package/src/equality-connector/api/interfaces/IEqualityConnectorApi.ts +41 -0
  22. package/src/equality-connector/index.ts +2 -0
  23. package/src/index.ts +1 -0
  24. package/src/transactionProcessor/api/TransactionProcessorApi.ts +30 -0
  25. package/src/transactionProcessor/api/interfaces/ITransactionProcessorApi.ts +36 -0
@@ -3,6 +3,7 @@ import { IHttpRequest } from "@fiado/http-client";
3
3
  import { BenefitPaymentRequest, BenefitPaymentResponse } from "@fiado/type-kit/bin/benefitCenter/index.js";
4
4
  import { ApiGatewayResponse } from "@fiado/gateway-adapter";
5
5
  import { BenefitLeafDisplayResponse } from "./dtos/BenefitLeafDisplayResponse.js";
6
+ import { CreateFundingReferenceRequest, CreateFundingReferenceResponse, CancelFundingReferenceRequest, CancelFundingReferenceResponse, ListFundingReferencesResponse } from "@fiado/type-kit/bin/walletFunding/index.js";
6
7
  export default class BenefitsMarketplaceApi implements IBenefitsMarketplaceApi {
7
8
  private httpRequest;
8
9
  private readonly baseUrl;
@@ -10,4 +11,7 @@ export default class BenefitsMarketplaceApi implements IBenefitsMarketplaceApi {
10
11
  pay(moduleName: string, request: BenefitPaymentRequest): Promise<ApiGatewayResponse<BenefitPaymentResponse>>;
11
12
  consultPayment(moduleName: string, transactionNumber: string): Promise<ApiGatewayResponse<BenefitPaymentResponse>>;
12
13
  getLeafDisplay(benefitId: string, leafId: string): Promise<ApiGatewayResponse<BenefitLeafDisplayResponse>>;
14
+ fundingCreate(moduleName: string, request: CreateFundingReferenceRequest): Promise<ApiGatewayResponse<CreateFundingReferenceResponse>>;
15
+ fundingCancel(moduleName: string, fundingId: string, request: CancelFundingReferenceRequest): Promise<ApiGatewayResponse<CancelFundingReferenceResponse>>;
16
+ fundingList(moduleName: string, directoryId: string, status?: string): Promise<ApiGatewayResponse<ListFundingReferencesResponse>>;
13
17
  }
@@ -29,6 +29,21 @@ let BenefitsMarketplaceApi = class BenefitsMarketplaceApi {
29
29
  const url = `${this.baseUrl}/${encodeURIComponent(benefitId)}/leaves/${encodeURIComponent(leafId)}/display`;
30
30
  return await this.httpRequest.get(url);
31
31
  }
32
+ async fundingCreate(moduleName, request) {
33
+ const url = `${this.baseUrl}/funding/${encodeURIComponent(moduleName)}`;
34
+ return await this.httpRequest.post(url, request);
35
+ }
36
+ async fundingCancel(moduleName, fundingId, request) {
37
+ const url = `${this.baseUrl}/funding/${encodeURIComponent(moduleName)}/${encodeURIComponent(fundingId)}/cancel`;
38
+ return await this.httpRequest.post(url, request);
39
+ }
40
+ async fundingList(moduleName, directoryId, status) {
41
+ const params = new URLSearchParams({ directoryId });
42
+ if (status)
43
+ params.set("status", status);
44
+ const url = `${this.baseUrl}/funding/${encodeURIComponent(moduleName)}/references?${params.toString()}`;
45
+ return await this.httpRequest.get(url);
46
+ }
32
47
  };
33
48
  BenefitsMarketplaceApi = __decorate([
34
49
  injectable(),
@@ -1,6 +1,7 @@
1
1
  import { BenefitPaymentRequest, BenefitPaymentResponse } from "@fiado/type-kit/bin/benefitCenter/index.js";
2
2
  import { ApiGatewayResponse } from "@fiado/gateway-adapter";
3
3
  import { BenefitLeafDisplayResponse } from "../dtos/BenefitLeafDisplayResponse.js";
4
+ import { CreateFundingReferenceRequest, CreateFundingReferenceResponse, CancelFundingReferenceRequest, CancelFundingReferenceResponse, ListFundingReferencesResponse } from "@fiado/type-kit/bin/walletFunding/index.js";
4
5
  /**
5
6
  * Cliente único del procesador hacia benefits-marketplace-business (Fase 2).
6
7
  *
@@ -53,4 +54,24 @@ export interface IBenefitsMarketplaceApi {
53
54
  * @param leafId Identificador del leaf (`base64url("<moduleName>::<idServicio>")`).
54
55
  */
55
56
  getLeafDisplay(benefitId: string, leafId: string): Promise<ApiGatewayResponse<BenefitLeafDisplayResponse>>;
57
+ /**
58
+ * Genera una referencia de fondeo de wallet via Passport.
59
+ * Backend: POST /funding/{moduleName} (privado VPC).
60
+ *
61
+ * El marketplace resuelve `moduleName` a un EqualityFundingPublisher y delega.
62
+ * Hoy `moduleName` es siempre `"equality-connector"`; queda extensible para
63
+ * futuros providers (OpenPay, etc.).
64
+ */
65
+ fundingCreate(moduleName: string, request: CreateFundingReferenceRequest): Promise<ApiGatewayResponse<CreateFundingReferenceResponse>>;
66
+ /**
67
+ * Cancela una referencia ACTIVA.
68
+ * Backend: POST /funding/{moduleName}/{fundingId}/cancel (privado VPC).
69
+ * El marketplace delega al connector que verifica ownership por directoryId.
70
+ */
71
+ fundingCancel(moduleName: string, fundingId: string, request: CancelFundingReferenceRequest): Promise<ApiGatewayResponse<CancelFundingReferenceResponse>>;
72
+ /**
73
+ * Lista las referencias del usuario.
74
+ * Backend: GET /funding/{moduleName}/references?directoryId=&status=
75
+ */
76
+ fundingList(moduleName: string, directoryId: string, status?: string): Promise<ApiGatewayResponse<ListFundingReferencesResponse>>;
56
77
  }
@@ -103,6 +103,8 @@ import { MessagesBusinessApi } from "./messages-business/index.js";
103
103
  import MessagesBusinessPublisher from "./messages-business/queue/MessagesBusinessPublisher.js";
104
104
  // Totp security — connector HTTP-only síncrono (Fase 2 SureKeep)
105
105
  import { TotpSecurityApi } from "./totp-security/index.js";
106
+ // Equality connector — wallet-funding HTTP client (benefits-marketplace → equality-connector)
107
+ import { EqualityConnectorApi } from "./equality-connector/index.js";
106
108
  export const apiInvokerBindings = new ContainerModule(({ bind }) => {
107
109
  // UTILS bindings
108
110
  bind("InvokerUtils").to(InvokerUtils);
@@ -217,4 +219,6 @@ export const apiInvokerBindings = new ContainerModule(({ bind }) => {
217
219
  bind("IMessagesBusinessPublisher").to(MessagesBusinessPublisher);
218
220
  // Totp security — connector HTTP-only síncrono (Fase 2 SureKeep)
219
221
  bind("ITotpSecurityApi").to(TotpSecurityApi);
222
+ // Equality connector — wallet-funding (benefits-marketplace → equality-connector)
223
+ bind("IEqualityConnectorApi").to(EqualityConnectorApi);
220
224
  });
@@ -0,0 +1,12 @@
1
+ import { IHttpRequest } from "@fiado/http-client";
2
+ import { ApiGatewayResponse } from "@fiado/gateway-adapter";
3
+ import { CreateFundingReferenceRequest, CreateFundingReferenceResponse, CancelFundingReferenceRequest, CancelFundingReferenceResponse, ListFundingReferencesResponse } from "@fiado/type-kit/bin/walletFunding/index.js";
4
+ import { IEqualityConnectorApi } from "./interfaces/IEqualityConnectorApi.js";
5
+ export default class EqualityConnectorApi implements IEqualityConnectorApi {
6
+ private httpRequest;
7
+ private readonly baseUrl;
8
+ constructor(httpRequest: IHttpRequest);
9
+ createFundingReference(request: CreateFundingReferenceRequest): Promise<ApiGatewayResponse<CreateFundingReferenceResponse>>;
10
+ cancelFundingReference(fundingId: string, request: CancelFundingReferenceRequest): Promise<ApiGatewayResponse<CancelFundingReferenceResponse>>;
11
+ listFundingReferences(directoryId: string, status?: string): Promise<ApiGatewayResponse<ListFundingReferencesResponse>>;
12
+ }
@@ -0,0 +1,41 @@
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 EqualityConnectorApi = class EqualityConnectorApi {
15
+ httpRequest;
16
+ baseUrl = process.env.EQUALITY_CONNECTOR_LAMBDA_URL || "";
17
+ constructor(httpRequest) {
18
+ this.httpRequest = httpRequest;
19
+ }
20
+ async createFundingReference(request) {
21
+ const url = `${this.baseUrl}/funding`;
22
+ return await this.httpRequest.post(url, request);
23
+ }
24
+ async cancelFundingReference(fundingId, request) {
25
+ const url = `${this.baseUrl}/funding/${encodeURIComponent(fundingId)}/cancel`;
26
+ return await this.httpRequest.post(url, request);
27
+ }
28
+ async listFundingReferences(directoryId, status) {
29
+ const params = new URLSearchParams({ directoryId });
30
+ if (status)
31
+ params.set("status", status);
32
+ const url = `${this.baseUrl}/funding/references?${params.toString()}`;
33
+ return await this.httpRequest.get(url);
34
+ }
35
+ };
36
+ EqualityConnectorApi = __decorate([
37
+ injectable(),
38
+ __param(0, inject("IHttpRequest")),
39
+ __metadata("design:paramtypes", [Object])
40
+ ], EqualityConnectorApi);
41
+ export default EqualityConnectorApi;
@@ -0,0 +1,24 @@
1
+ import { ApiGatewayResponse } from "@fiado/gateway-adapter";
2
+ import { CreateFundingReferenceRequest, CreateFundingReferenceResponse, CancelFundingReferenceRequest, CancelFundingReferenceResponse, ListFundingReferencesResponse } from "@fiado/type-kit/bin/walletFunding/index.js";
3
+ /**
4
+ * Cliente del marketplace hacia equality-connector (privado, dentro de la VPC).
5
+ *
6
+ * Lo consume exclusivamente `EqualityFundingPublisher` del benefits-marketplace-business.
7
+ * Ningún otro lambda conoce este cliente.
8
+ *
9
+ * Endpoints backend en equality-connector:
10
+ * - POST /funding (privado VPC)
11
+ * - POST /funding/{fundingId}/cancel (privado VPC)
12
+ * - GET /funding/references?directoryId=&status= (privado VPC)
13
+ */
14
+ export interface IEqualityConnectorApi {
15
+ /** Genera una referencia de fondeo en Passport via el connector. */
16
+ createFundingReference(request: CreateFundingReferenceRequest): Promise<ApiGatewayResponse<CreateFundingReferenceResponse>>;
17
+ /** Cancela una referencia ACTIVA. Verifica ownership por `directoryId`. */
18
+ cancelFundingReference(fundingId: string, request: CancelFundingReferenceRequest): Promise<ApiGatewayResponse<CancelFundingReferenceResponse>>;
19
+ /**
20
+ * Lista las referencias del usuario, opcionalmente filtradas por status.
21
+ * Status default (cuando no se pasa) lo decide el connector — hoy: ACTIVE.
22
+ */
23
+ listFundingReferences(directoryId: string, status?: string): Promise<ApiGatewayResponse<ListFundingReferencesResponse>>;
24
+ }
@@ -0,0 +1,2 @@
1
+ export * from "./api/interfaces/IEqualityConnectorApi.js";
2
+ export { default as EqualityConnectorApi } from "./api/EqualityConnectorApi.js";
@@ -0,0 +1,2 @@
1
+ export * from "./api/interfaces/IEqualityConnectorApi.js";
2
+ export { default as EqualityConnectorApi } from "./api/EqualityConnectorApi.js";
package/bin/index.d.ts CHANGED
@@ -77,3 +77,4 @@ export * from "./cognitoBackofficeConnector/index.js";
77
77
  export * from "./platformRbac/index.js";
78
78
  export * from "./messages-business/index.js";
79
79
  export * from "./totp-security/index.js";
80
+ export * from "./equality-connector/index.js";
package/bin/index.js CHANGED
@@ -77,3 +77,4 @@ export * from "./cognitoBackofficeConnector/index.js";
77
77
  export * from "./platformRbac/index.js";
78
78
  export * from "./messages-business/index.js";
79
79
  export * from "./totp-security/index.js";
80
+ export * from "./equality-connector/index.js";
@@ -1,6 +1,8 @@
1
1
  import { ITransactionProcessorApi } from "./interfaces/ITransactionProcessorApi.js";
2
2
  import { IHttpRequest } from "@fiado/http-client";
3
3
  import { AuthorizeCollectorOrderRequest, AuthorizeCollectorOrderResponse, AuthorizeCollectorTransactionRequest, AuthorizeCreditCardPurchaseRequest, AuthorizeSpeiBankTransferNcRequest, AuthorizeSpeiMexBankTransferInRequest, AuthorizeRenewalPreAuthRequest, AuthorizeRenewalPreAuthResponse } from "@fiado/type-kit/bin/transactionProcessor/index.js";
4
+ import { ApiGatewayResponse } from "@fiado/gateway-adapter";
5
+ import { ValidateWalletFundingRequest, ValidateWalletFundingResponse, CreditWalletFundingRequest, CreditWalletFundingResponse, ReverseWalletFundingRequest, ReverseWalletFundingResponse } from "@fiado/type-kit/bin/walletFunding/index.js";
4
6
  type ProcessUpdateLevelRequest = import("@fiado/type-kit/bin/transactionProcessor/dtos/ProcessUpdateLevelRequest.js").default;
5
7
  type FiadoApiResponse<T> = import("@fiado/type-kit/bin/apiResponse/dtos/FiadoApiResponse.js").default<T>;
6
8
  export default class TransactionProcessorApi implements ITransactionProcessorApi {
@@ -14,5 +16,8 @@ export default class TransactionProcessorApi implements ITransactionProcessorApi
14
16
  authorizePagoConfiadoSpeiTransaction(request: AuthorizeSpeiBankTransferNcRequest): Promise<any>;
15
17
  authorizeCollectorOrderTransaction(request: AuthorizeCollectorOrderRequest): Promise<FiadoApiResponse<AuthorizeCollectorOrderResponse>>;
16
18
  authorizeRenewalPreAuthTransaction(request: AuthorizeRenewalPreAuthRequest): Promise<FiadoApiResponse<AuthorizeRenewalPreAuthResponse>>;
19
+ walletFundingValidate(request: ValidateWalletFundingRequest): Promise<ApiGatewayResponse<ValidateWalletFundingResponse>>;
20
+ walletFundingCredit(request: CreditWalletFundingRequest): Promise<ApiGatewayResponse<CreditWalletFundingResponse>>;
21
+ walletFundingReverse(request: ReverseWalletFundingRequest): Promise<ApiGatewayResponse<ReverseWalletFundingResponse>>;
17
22
  }
18
23
  export {};
@@ -45,6 +45,18 @@ let TransactionProcessorApi = class TransactionProcessorApi {
45
45
  const url = `${this.baseUrl}authorize`;
46
46
  return await this.httpRequest.post(url, request);
47
47
  }
48
+ async walletFundingValidate(request) {
49
+ const url = `${this.baseUrl}transaction-processor/wallet-funding/validate`;
50
+ return await this.httpRequest.post(url, request);
51
+ }
52
+ async walletFundingCredit(request) {
53
+ const url = `${this.baseUrl}transaction-processor/wallet-funding/credit`;
54
+ return await this.httpRequest.post(url, request);
55
+ }
56
+ async walletFundingReverse(request) {
57
+ const url = `${this.baseUrl}transaction-processor/wallet-funding/reverse`;
58
+ return await this.httpRequest.post(url, request);
59
+ }
48
60
  };
49
61
  TransactionProcessorApi = __decorate([
50
62
  injectable(),
@@ -1,5 +1,7 @@
1
1
  type FiadoApiResponse<T> = import("@fiado/type-kit/bin/apiResponse/dtos/FiadoApiResponse.js").default<T>;
2
2
  import { AuthorizeCollectorOrderRequest, AuthorizeCollectorOrderResponse, AuthorizeCollectorTransactionRequest, AuthorizeCreditCardPurchaseRequest, AuthorizeSpeiBankTransferNcRequest, AuthorizeSpeiMexBankTransferInRequest, AuthorizeRenewalPreAuthRequest, AuthorizeRenewalPreAuthResponse } from "@fiado/type-kit/bin/transactionProcessor/index.js";
3
+ import { ApiGatewayResponse } from "@fiado/gateway-adapter";
4
+ import { ValidateWalletFundingRequest, ValidateWalletFundingResponse, CreditWalletFundingRequest, CreditWalletFundingResponse, ReverseWalletFundingRequest, ReverseWalletFundingResponse } from "@fiado/type-kit/bin/walletFunding/index.js";
3
5
  type ProcessUpdateLevelRequest = import("@fiado/type-kit/bin/transactionProcessor/dtos/ProcessUpdateLevelRequest.js").default;
4
6
  export interface ITransactionProcessorApi {
5
7
  authorizeTransaction(request: AuthorizeCreditCardPurchaseRequest): Promise<any>;
@@ -9,5 +11,23 @@ export interface ITransactionProcessorApi {
9
11
  authorizePagoConfiadoSpeiTransaction(request: AuthorizeSpeiBankTransferNcRequest): Promise<any>;
10
12
  authorizeCollectorOrderTransaction(request: AuthorizeCollectorOrderRequest): Promise<FiadoApiResponse<AuthorizeCollectorOrderResponse>>;
11
13
  authorizeRenewalPreAuthTransaction(request: AuthorizeRenewalPreAuthRequest): Promise<FiadoApiResponse<AuthorizeRenewalPreAuthResponse>>;
14
+ /**
15
+ * Pre-check de fondeo de wallet (validate antes de COMMIT).
16
+ * Backend: POST /transaction-processor/wallet-funding/validate (privado VPC).
17
+ * Lo consume benefits-marketplace-business en outbound (antes de redirigir al provider).
18
+ */
19
+ walletFundingValidate(request: ValidateWalletFundingRequest): Promise<ApiGatewayResponse<ValidateWalletFundingResponse>>;
20
+ /**
21
+ * Acredita el fondeo confirmado por el provider (webhook PAID).
22
+ * Backend: POST /transaction-processor/wallet-funding/credit (privado VPC).
23
+ * Lo consume equality-connector cuando Passport confirma el cobro.
24
+ */
25
+ walletFundingCredit(request: CreditWalletFundingRequest): Promise<ApiGatewayResponse<CreditWalletFundingResponse>>;
26
+ /**
27
+ * Reversa un fondeo previamente acreditado (webhook REVERSED/REFUNDED).
28
+ * Backend: POST /transaction-processor/wallet-funding/reverse (privado VPC).
29
+ * Lo consume equality-connector ante refunds del provider.
30
+ */
31
+ walletFundingReverse(request: ReverseWalletFundingRequest): Promise<ApiGatewayResponse<ReverseWalletFundingResponse>>;
12
32
  }
13
33
  export {};
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@fiado/api-invoker",
3
- "version": "4.17.0",
3
+ "version": "4.19.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",
@@ -11,7 +11,14 @@
11
11
  "import": "./bin/index.js",
12
12
  "default": "./bin/index.js"
13
13
  },
14
- "./bin/*": "./bin/*.js",
14
+ "./bin/*.js": {
15
+ "types": "./bin/*.d.ts",
16
+ "default": "./bin/*.js"
17
+ },
18
+ "./bin/*": {
19
+ "types": "./bin/*.d.ts",
20
+ "default": "./bin/*.js"
21
+ },
15
22
  "./package.json": "./package.json"
16
23
  },
17
24
  "scripts": {
@@ -4,6 +4,13 @@ import {IHttpRequest} from "@fiado/http-client";
4
4
  import {BenefitPaymentRequest, BenefitPaymentResponse} from "@fiado/type-kit/bin/benefitCenter/index.js";
5
5
  import {ApiGatewayResponse} from "@fiado/gateway-adapter";
6
6
  import {BenefitLeafDisplayResponse} from "./dtos/BenefitLeafDisplayResponse.js";
7
+ import {
8
+ CreateFundingReferenceRequest,
9
+ CreateFundingReferenceResponse,
10
+ CancelFundingReferenceRequest,
11
+ CancelFundingReferenceResponse,
12
+ ListFundingReferencesResponse,
13
+ } from "@fiado/type-kit/bin/walletFunding/index.js";
7
14
 
8
15
  @injectable()
9
16
  export default class BenefitsMarketplaceApi implements IBenefitsMarketplaceApi {
@@ -32,4 +39,32 @@ export default class BenefitsMarketplaceApi implements IBenefitsMarketplaceApi {
32
39
  const url = `${this.baseUrl}/${encodeURIComponent(benefitId)}/leaves/${encodeURIComponent(leafId)}/display`;
33
40
  return await this.httpRequest.get(url);
34
41
  }
42
+
43
+ async fundingCreate(
44
+ moduleName: string,
45
+ request: CreateFundingReferenceRequest,
46
+ ): Promise<ApiGatewayResponse<CreateFundingReferenceResponse>> {
47
+ const url = `${this.baseUrl}/funding/${encodeURIComponent(moduleName)}`;
48
+ return await this.httpRequest.post(url, request);
49
+ }
50
+
51
+ async fundingCancel(
52
+ moduleName: string,
53
+ fundingId: string,
54
+ request: CancelFundingReferenceRequest,
55
+ ): Promise<ApiGatewayResponse<CancelFundingReferenceResponse>> {
56
+ const url = `${this.baseUrl}/funding/${encodeURIComponent(moduleName)}/${encodeURIComponent(fundingId)}/cancel`;
57
+ return await this.httpRequest.post(url, request);
58
+ }
59
+
60
+ async fundingList(
61
+ moduleName: string,
62
+ directoryId: string,
63
+ status?: string,
64
+ ): Promise<ApiGatewayResponse<ListFundingReferencesResponse>> {
65
+ const params = new URLSearchParams({ directoryId });
66
+ if (status) params.set("status", status);
67
+ const url = `${this.baseUrl}/funding/${encodeURIComponent(moduleName)}/references?${params.toString()}`;
68
+ return await this.httpRequest.get(url);
69
+ }
35
70
  }
@@ -1,6 +1,13 @@
1
1
  import {BenefitPaymentRequest, BenefitPaymentResponse} from "@fiado/type-kit/bin/benefitCenter/index.js";
2
2
  import {ApiGatewayResponse} from "@fiado/gateway-adapter";
3
3
  import {BenefitLeafDisplayResponse} from "../dtos/BenefitLeafDisplayResponse.js";
4
+ import {
5
+ CreateFundingReferenceRequest,
6
+ CreateFundingReferenceResponse,
7
+ CancelFundingReferenceRequest,
8
+ CancelFundingReferenceResponse,
9
+ ListFundingReferencesResponse,
10
+ } from "@fiado/type-kit/bin/walletFunding/index.js";
4
11
 
5
12
  /**
6
13
  * Cliente único del procesador hacia benefits-marketplace-business (Fase 2).
@@ -59,4 +66,38 @@ export interface IBenefitsMarketplaceApi {
59
66
  benefitId: string,
60
67
  leafId: string,
61
68
  ): Promise<ApiGatewayResponse<BenefitLeafDisplayResponse>>;
69
+
70
+ /**
71
+ * Genera una referencia de fondeo de wallet via Passport.
72
+ * Backend: POST /funding/{moduleName} (privado VPC).
73
+ *
74
+ * El marketplace resuelve `moduleName` a un EqualityFundingPublisher y delega.
75
+ * Hoy `moduleName` es siempre `"equality-connector"`; queda extensible para
76
+ * futuros providers (OpenPay, etc.).
77
+ */
78
+ fundingCreate(
79
+ moduleName: string,
80
+ request: CreateFundingReferenceRequest,
81
+ ): Promise<ApiGatewayResponse<CreateFundingReferenceResponse>>;
82
+
83
+ /**
84
+ * Cancela una referencia ACTIVA.
85
+ * Backend: POST /funding/{moduleName}/{fundingId}/cancel (privado VPC).
86
+ * El marketplace delega al connector que verifica ownership por directoryId.
87
+ */
88
+ fundingCancel(
89
+ moduleName: string,
90
+ fundingId: string,
91
+ request: CancelFundingReferenceRequest,
92
+ ): Promise<ApiGatewayResponse<CancelFundingReferenceResponse>>;
93
+
94
+ /**
95
+ * Lista las referencias del usuario.
96
+ * Backend: GET /funding/{moduleName}/references?directoryId=&status=
97
+ */
98
+ fundingList(
99
+ moduleName: string,
100
+ directoryId: string,
101
+ status?: string,
102
+ ): Promise<ApiGatewayResponse<ListFundingReferencesResponse>>;
62
103
  }
@@ -162,6 +162,8 @@ import MessagesBusinessPublisher from "./messages-business/queue/MessagesBusines
162
162
  import { IMessagesBusinessPublisher } from "./messages-business/queue/interfaces/IMessagesBusinessPublisher.js";
163
163
  // Totp security — connector HTTP-only síncrono (Fase 2 SureKeep)
164
164
  import { ITotpSecurityApi, TotpSecurityApi } from "./totp-security/index.js";
165
+ // Equality connector — wallet-funding HTTP client (benefits-marketplace → equality-connector)
166
+ import { IEqualityConnectorApi, EqualityConnectorApi } from "./equality-connector/index.js";
165
167
 
166
168
  export const apiInvokerBindings = new ContainerModule(({ bind }) => {
167
169
  // UTILS bindings
@@ -291,4 +293,7 @@ export const apiInvokerBindings = new ContainerModule(({ bind }) => {
291
293
 
292
294
  // Totp security — connector HTTP-only síncrono (Fase 2 SureKeep)
293
295
  bind<ITotpSecurityApi>("ITotpSecurityApi").to(TotpSecurityApi);
296
+
297
+ // Equality connector — wallet-funding (benefits-marketplace → equality-connector)
298
+ bind<IEqualityConnectorApi>("IEqualityConnectorApi").to(EqualityConnectorApi);
294
299
  });
@@ -0,0 +1,43 @@
1
+ import { inject, injectable } from "inversify";
2
+ import { IHttpRequest } from "@fiado/http-client";
3
+ import { ApiGatewayResponse } from "@fiado/gateway-adapter";
4
+ import {
5
+ CreateFundingReferenceRequest,
6
+ CreateFundingReferenceResponse,
7
+ CancelFundingReferenceRequest,
8
+ CancelFundingReferenceResponse,
9
+ ListFundingReferencesResponse,
10
+ } from "@fiado/type-kit/bin/walletFunding/index.js";
11
+ import { IEqualityConnectorApi } from "./interfaces/IEqualityConnectorApi.js";
12
+
13
+ @injectable()
14
+ export default class EqualityConnectorApi implements IEqualityConnectorApi {
15
+ private readonly baseUrl = process.env.EQUALITY_CONNECTOR_LAMBDA_URL || "";
16
+
17
+ constructor(@inject("IHttpRequest") private httpRequest: IHttpRequest) {}
18
+
19
+ async createFundingReference(
20
+ request: CreateFundingReferenceRequest,
21
+ ): Promise<ApiGatewayResponse<CreateFundingReferenceResponse>> {
22
+ const url = `${this.baseUrl}/funding`;
23
+ return await this.httpRequest.post(url, request);
24
+ }
25
+
26
+ async cancelFundingReference(
27
+ fundingId: string,
28
+ request: CancelFundingReferenceRequest,
29
+ ): Promise<ApiGatewayResponse<CancelFundingReferenceResponse>> {
30
+ const url = `${this.baseUrl}/funding/${encodeURIComponent(fundingId)}/cancel`;
31
+ return await this.httpRequest.post(url, request);
32
+ }
33
+
34
+ async listFundingReferences(
35
+ directoryId: string,
36
+ status?: string,
37
+ ): Promise<ApiGatewayResponse<ListFundingReferencesResponse>> {
38
+ const params = new URLSearchParams({ directoryId });
39
+ if (status) params.set("status", status);
40
+ const url = `${this.baseUrl}/funding/references?${params.toString()}`;
41
+ return await this.httpRequest.get(url);
42
+ }
43
+ }
@@ -0,0 +1,41 @@
1
+ import { ApiGatewayResponse } from "@fiado/gateway-adapter";
2
+ import {
3
+ CreateFundingReferenceRequest,
4
+ CreateFundingReferenceResponse,
5
+ CancelFundingReferenceRequest,
6
+ CancelFundingReferenceResponse,
7
+ ListFundingReferencesResponse,
8
+ } from "@fiado/type-kit/bin/walletFunding/index.js";
9
+
10
+ /**
11
+ * Cliente del marketplace hacia equality-connector (privado, dentro de la VPC).
12
+ *
13
+ * Lo consume exclusivamente `EqualityFundingPublisher` del benefits-marketplace-business.
14
+ * Ningún otro lambda conoce este cliente.
15
+ *
16
+ * Endpoints backend en equality-connector:
17
+ * - POST /funding (privado VPC)
18
+ * - POST /funding/{fundingId}/cancel (privado VPC)
19
+ * - GET /funding/references?directoryId=&status= (privado VPC)
20
+ */
21
+ export interface IEqualityConnectorApi {
22
+ /** Genera una referencia de fondeo en Passport via el connector. */
23
+ createFundingReference(
24
+ request: CreateFundingReferenceRequest,
25
+ ): Promise<ApiGatewayResponse<CreateFundingReferenceResponse>>;
26
+
27
+ /** Cancela una referencia ACTIVA. Verifica ownership por `directoryId`. */
28
+ cancelFundingReference(
29
+ fundingId: string,
30
+ request: CancelFundingReferenceRequest,
31
+ ): Promise<ApiGatewayResponse<CancelFundingReferenceResponse>>;
32
+
33
+ /**
34
+ * Lista las referencias del usuario, opcionalmente filtradas por status.
35
+ * Status default (cuando no se pasa) lo decide el connector — hoy: ACTIVE.
36
+ */
37
+ listFundingReferences(
38
+ directoryId: string,
39
+ status?: string,
40
+ ): Promise<ApiGatewayResponse<ListFundingReferencesResponse>>;
41
+ }
@@ -0,0 +1,2 @@
1
+ export * from "./api/interfaces/IEqualityConnectorApi.js";
2
+ export { default as EqualityConnectorApi } from "./api/EqualityConnectorApi.js";
package/src/index.ts CHANGED
@@ -77,3 +77,4 @@ export * from "./cognitoBackofficeConnector/index.js";
77
77
  export * from "./platformRbac/index.js";
78
78
  export * from "./messages-business/index.js";
79
79
  export * from "./totp-security/index.js";
80
+ export * from "./equality-connector/index.js";
@@ -10,6 +10,15 @@ import {
10
10
  AuthorizeRenewalPreAuthRequest,
11
11
  AuthorizeRenewalPreAuthResponse
12
12
  } from "@fiado/type-kit/bin/transactionProcessor/index.js";
13
+ import { ApiGatewayResponse } from "@fiado/gateway-adapter";
14
+ import {
15
+ ValidateWalletFundingRequest,
16
+ ValidateWalletFundingResponse,
17
+ CreditWalletFundingRequest,
18
+ CreditWalletFundingResponse,
19
+ ReverseWalletFundingRequest,
20
+ ReverseWalletFundingResponse,
21
+ } from "@fiado/type-kit/bin/walletFunding/index.js";
13
22
  type ProcessUpdateLevelRequest = import("@fiado/type-kit/bin/transactionProcessor/dtos/ProcessUpdateLevelRequest.js").default;
14
23
  type FiadoApiResponse<T> = import("@fiado/type-kit/bin/apiResponse/dtos/FiadoApiResponse.js").default<T>;
15
24
 
@@ -55,4 +64,25 @@ export default class TransactionProcessorApi implements ITransactionProcessorApi
55
64
  const url: string = `${this.baseUrl}authorize`;
56
65
  return await this.httpRequest.post(url, request);
57
66
  }
67
+
68
+ async walletFundingValidate(
69
+ request: ValidateWalletFundingRequest,
70
+ ): Promise<ApiGatewayResponse<ValidateWalletFundingResponse>> {
71
+ const url = `${this.baseUrl}transaction-processor/wallet-funding/validate`;
72
+ return await this.httpRequest.post(url, request);
73
+ }
74
+
75
+ async walletFundingCredit(
76
+ request: CreditWalletFundingRequest,
77
+ ): Promise<ApiGatewayResponse<CreditWalletFundingResponse>> {
78
+ const url = `${this.baseUrl}transaction-processor/wallet-funding/credit`;
79
+ return await this.httpRequest.post(url, request);
80
+ }
81
+
82
+ async walletFundingReverse(
83
+ request: ReverseWalletFundingRequest,
84
+ ): Promise<ApiGatewayResponse<ReverseWalletFundingResponse>> {
85
+ const url = `${this.baseUrl}transaction-processor/wallet-funding/reverse`;
86
+ return await this.httpRequest.post(url, request);
87
+ }
58
88
  }
@@ -9,6 +9,15 @@ import {
9
9
  AuthorizeRenewalPreAuthRequest,
10
10
  AuthorizeRenewalPreAuthResponse
11
11
  } from "@fiado/type-kit/bin/transactionProcessor/index.js";
12
+ import { ApiGatewayResponse } from "@fiado/gateway-adapter";
13
+ import {
14
+ ValidateWalletFundingRequest,
15
+ ValidateWalletFundingResponse,
16
+ CreditWalletFundingRequest,
17
+ CreditWalletFundingResponse,
18
+ ReverseWalletFundingRequest,
19
+ ReverseWalletFundingResponse,
20
+ } from "@fiado/type-kit/bin/walletFunding/index.js";
12
21
  type ProcessUpdateLevelRequest = import("@fiado/type-kit/bin/transactionProcessor/dtos/ProcessUpdateLevelRequest.js").default;
13
22
 
14
23
  export interface ITransactionProcessorApi {
@@ -26,4 +35,31 @@ export interface ITransactionProcessorApi {
26
35
  authorizeCollectorOrderTransaction(request: AuthorizeCollectorOrderRequest): Promise<FiadoApiResponse<AuthorizeCollectorOrderResponse>>;
27
36
 
28
37
  authorizeRenewalPreAuthTransaction(request: AuthorizeRenewalPreAuthRequest): Promise<FiadoApiResponse<AuthorizeRenewalPreAuthResponse>>;
38
+
39
+ /**
40
+ * Pre-check de fondeo de wallet (validate antes de COMMIT).
41
+ * Backend: POST /transaction-processor/wallet-funding/validate (privado VPC).
42
+ * Lo consume benefits-marketplace-business en outbound (antes de redirigir al provider).
43
+ */
44
+ walletFundingValidate(
45
+ request: ValidateWalletFundingRequest,
46
+ ): Promise<ApiGatewayResponse<ValidateWalletFundingResponse>>;
47
+
48
+ /**
49
+ * Acredita el fondeo confirmado por el provider (webhook PAID).
50
+ * Backend: POST /transaction-processor/wallet-funding/credit (privado VPC).
51
+ * Lo consume equality-connector cuando Passport confirma el cobro.
52
+ */
53
+ walletFundingCredit(
54
+ request: CreditWalletFundingRequest,
55
+ ): Promise<ApiGatewayResponse<CreditWalletFundingResponse>>;
56
+
57
+ /**
58
+ * Reversa un fondeo previamente acreditado (webhook REVERSED/REFUNDED).
59
+ * Backend: POST /transaction-processor/wallet-funding/reverse (privado VPC).
60
+ * Lo consume equality-connector ante refunds del provider.
61
+ */
62
+ walletFundingReverse(
63
+ request: ReverseWalletFundingRequest,
64
+ ): Promise<ApiGatewayResponse<ReverseWalletFundingResponse>>;
29
65
  }