@fiado/api-invoker 3.18.0 → 3.18.1

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.
@@ -2,10 +2,12 @@ import { IBenefitsMarketplaceApi } from "./interfaces/IBenefitsMarketplaceApi";
2
2
  import { IHttpRequest } from "@fiado/http-client";
3
3
  import { BenefitPaymentRequest, BenefitPaymentResponse } from "@fiado/type-kit/bin/benefitCenter";
4
4
  import { ApiGatewayResponse } from "@fiado/gateway-adapter";
5
+ import { BenefitLeafDisplayResponse } from "./dtos/BenefitLeafDisplayResponse";
5
6
  export default class BenefitsMarketplaceApi implements IBenefitsMarketplaceApi {
6
7
  private httpRequest;
7
8
  private readonly baseUrl;
8
9
  constructor(httpRequest: IHttpRequest);
9
10
  pay(moduleName: string, request: BenefitPaymentRequest): Promise<ApiGatewayResponse<BenefitPaymentResponse>>;
10
11
  consultPayment(moduleName: string, transactionNumber: string): Promise<ApiGatewayResponse<BenefitPaymentResponse>>;
12
+ getLeafDisplay(benefitId: string, leafId: string): Promise<ApiGatewayResponse<BenefitLeafDisplayResponse>>;
11
13
  }
@@ -26,6 +26,10 @@ let BenefitsMarketplaceApi = class BenefitsMarketplaceApi {
26
26
  const url = `${this.baseUrl}/pay/${encodeURIComponent(moduleName)}/transactions/${encodeURIComponent(transactionNumber)}`;
27
27
  return await this.httpRequest.get(url);
28
28
  }
29
+ async getLeafDisplay(benefitId, leafId) {
30
+ const url = `${this.baseUrl}/${encodeURIComponent(benefitId)}/leaves/${encodeURIComponent(leafId)}/display`;
31
+ return await this.httpRequest.get(url);
32
+ }
29
33
  };
30
34
  BenefitsMarketplaceApi = __decorate([
31
35
  (0, inversify_1.injectable)(),
@@ -0,0 +1,21 @@
1
+ /**
2
+ * Respuesta del endpoint privado `GET /{benefitId}/leaves/{leafId}/display`
3
+ * del marketplace. Pensado para que el procesador resuelva nombres legibles
4
+ * (categoria/servicio) al armar la transacción, sin descargar el árbol entero
5
+ * del catálogo.
6
+ *
7
+ * Equivalente conceptual al `subcategoria`/`servicio` que el procesador lee
8
+ * del catálogo SPEI cuando arma `productDetail.targetName`.
9
+ */
10
+ export interface BenefitLeafDisplayResponse {
11
+ /**
12
+ * Nombre de la subcategoría a la que pertenece el leaf (ej. "TELMEX", "CFE").
13
+ * El procesador lo usa como `targetName` con `.toUpperCase()`, paridad con SPEI.
14
+ */
15
+ subcategoryName: string;
16
+ /**
17
+ * Nombre del servicio específico dentro de la subcategoría (ej. "Telmex Hogar Plan 500").
18
+ * Disponible para descripciones / detalle de transacción si el caller lo necesita.
19
+ */
20
+ serviceName: string;
21
+ }
@@ -1,5 +1,6 @@
1
1
  import { BenefitPaymentRequest, BenefitPaymentResponse } from "@fiado/type-kit/bin/benefitCenter";
2
2
  import { ApiGatewayResponse } from "@fiado/gateway-adapter";
3
+ import { BenefitLeafDisplayResponse } from "../dtos/BenefitLeafDisplayResponse";
3
4
  /**
4
5
  * Cliente único del procesador hacia benefits-marketplace-business (Fase 2).
5
6
  *
@@ -37,4 +38,19 @@ export interface IBenefitsMarketplaceApi {
37
38
  * que viajó en el `BenefitPaymentRequest` original.
38
39
  */
39
40
  consultPayment(moduleName: string, transactionNumber: string): Promise<ApiGatewayResponse<BenefitPaymentResponse>>;
41
+ /**
42
+ * Resuelve los nombres legibles del leaf (subcategoría y servicio) para que
43
+ * el procesador arme `productDetail.targetName` con paridad al flujo SPEI.
44
+ * Backend: GET /{benefitId}/leaves/{leafId}/display.
45
+ *
46
+ * Endpoint dedicado y barato: solo trae los dos nombres necesarios, sin
47
+ * descargar el árbol completo del catálogo. El procesador lo invoca dentro
48
+ * de `authorize()`, antes de cualquier débito, y aborta la operación si la
49
+ * respuesta no es válida.
50
+ *
51
+ * @param benefitId Identificador del beneficio (filtro requerido por el
52
+ * resolver del marketplace para invocar al conector correcto).
53
+ * @param leafId Identificador del leaf (`base64url("<moduleName>::<idServicio>")`).
54
+ */
55
+ getLeafDisplay(benefitId: string, leafId: string): Promise<ApiGatewayResponse<BenefitLeafDisplayResponse>>;
40
56
  }
@@ -1,2 +1,3 @@
1
1
  export * from './api/interfaces/IBenefitsMarketplaceApi';
2
2
  export * from './api/BenefitsMarketplaceApi';
3
+ export * from './api/dtos/BenefitLeafDisplayResponse';
@@ -16,3 +16,4 @@ var __exportStar = (this && this.__exportStar) || function(m, exports) {
16
16
  Object.defineProperty(exports, "__esModule", { value: true });
17
17
  __exportStar(require("./api/interfaces/IBenefitsMarketplaceApi"), exports);
18
18
  __exportStar(require("./api/BenefitsMarketplaceApi"), exports);
19
+ __exportStar(require("./api/dtos/BenefitLeafDisplayResponse"), exports);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@fiado/api-invoker",
3
- "version": "3.18.0",
3
+ "version": "3.18.1",
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",
@@ -3,6 +3,7 @@ import {inject, injectable} from "inversify";
3
3
  import {IHttpRequest} from "@fiado/http-client";
4
4
  import {BenefitPaymentRequest, BenefitPaymentResponse} from "@fiado/type-kit/bin/benefitCenter";
5
5
  import {ApiGatewayResponse} from "@fiado/gateway-adapter";
6
+ import {BenefitLeafDisplayResponse} from "./dtos/BenefitLeafDisplayResponse";
6
7
 
7
8
  @injectable()
8
9
  export default class BenefitsMarketplaceApi implements IBenefitsMarketplaceApi {
@@ -23,4 +24,12 @@ export default class BenefitsMarketplaceApi implements IBenefitsMarketplaceApi {
23
24
  const url = `${this.baseUrl}/pay/${encodeURIComponent(moduleName)}/transactions/${encodeURIComponent(transactionNumber)}`;
24
25
  return await this.httpRequest.get(url);
25
26
  }
27
+
28
+ async getLeafDisplay(
29
+ benefitId: string,
30
+ leafId: string,
31
+ ): Promise<ApiGatewayResponse<BenefitLeafDisplayResponse>> {
32
+ const url = `${this.baseUrl}/${encodeURIComponent(benefitId)}/leaves/${encodeURIComponent(leafId)}/display`;
33
+ return await this.httpRequest.get(url);
34
+ }
26
35
  }
@@ -0,0 +1,21 @@
1
+ /**
2
+ * Respuesta del endpoint privado `GET /{benefitId}/leaves/{leafId}/display`
3
+ * del marketplace. Pensado para que el procesador resuelva nombres legibles
4
+ * (categoria/servicio) al armar la transacción, sin descargar el árbol entero
5
+ * del catálogo.
6
+ *
7
+ * Equivalente conceptual al `subcategoria`/`servicio` que el procesador lee
8
+ * del catálogo SPEI cuando arma `productDetail.targetName`.
9
+ */
10
+ export interface BenefitLeafDisplayResponse {
11
+ /**
12
+ * Nombre de la subcategoría a la que pertenece el leaf (ej. "TELMEX", "CFE").
13
+ * El procesador lo usa como `targetName` con `.toUpperCase()`, paridad con SPEI.
14
+ */
15
+ subcategoryName: string;
16
+ /**
17
+ * Nombre del servicio específico dentro de la subcategoría (ej. "Telmex Hogar Plan 500").
18
+ * Disponible para descripciones / detalle de transacción si el caller lo necesita.
19
+ */
20
+ serviceName: string;
21
+ }
@@ -1,5 +1,6 @@
1
1
  import {BenefitPaymentRequest, BenefitPaymentResponse} from "@fiado/type-kit/bin/benefitCenter";
2
2
  import {ApiGatewayResponse} from "@fiado/gateway-adapter";
3
+ import {BenefitLeafDisplayResponse} from "../dtos/BenefitLeafDisplayResponse";
3
4
 
4
5
  /**
5
6
  * Cliente único del procesador hacia benefits-marketplace-business (Fase 2).
@@ -39,4 +40,23 @@ export interface IBenefitsMarketplaceApi {
39
40
  * que viajó en el `BenefitPaymentRequest` original.
40
41
  */
41
42
  consultPayment(moduleName: string, transactionNumber: string): Promise<ApiGatewayResponse<BenefitPaymentResponse>>;
43
+
44
+ /**
45
+ * Resuelve los nombres legibles del leaf (subcategoría y servicio) para que
46
+ * el procesador arme `productDetail.targetName` con paridad al flujo SPEI.
47
+ * Backend: GET /{benefitId}/leaves/{leafId}/display.
48
+ *
49
+ * Endpoint dedicado y barato: solo trae los dos nombres necesarios, sin
50
+ * descargar el árbol completo del catálogo. El procesador lo invoca dentro
51
+ * de `authorize()`, antes de cualquier débito, y aborta la operación si la
52
+ * respuesta no es válida.
53
+ *
54
+ * @param benefitId Identificador del beneficio (filtro requerido por el
55
+ * resolver del marketplace para invocar al conector correcto).
56
+ * @param leafId Identificador del leaf (`base64url("<moduleName>::<idServicio>")`).
57
+ */
58
+ getLeafDisplay(
59
+ benefitId: string,
60
+ leafId: string,
61
+ ): Promise<ApiGatewayResponse<BenefitLeafDisplayResponse>>;
42
62
  }
@@ -1,2 +1,3 @@
1
1
  export * from './api/interfaces/IBenefitsMarketplaceApi';
2
2
  export * from './api/BenefitsMarketplaceApi';
3
+ export * from './api/dtos/BenefitLeafDisplayResponse';
@@ -1,46 +0,0 @@
1
- import { ChangePasswordRequest, GetUserRequest, GetUserResponse, RefreshTokenRequest, RefreshTokenResponse, RespondToAuthChallengeRequest, SetPasswordRequest, SignInRequest, SignInResponse, SignUpConfirmRequest, SignUpRequest, SignUpResponse } from "@fiado/type-kit/bin/cognitoConnector";
2
- export interface ICognitoApi {
3
- /**
4
- * Healthcheck for the cognito-connector
5
- */
6
- healthcheck(): Promise<HealthcheckResponse>;
7
- /**
8
- * Create a new user in Cognito
9
- */
10
- signUp(request: SignUpRequest): Promise<SignUpResponse>;
11
- /**
12
- * Confirm sign-up for a user in Cognito
13
- */
14
- signUpConfirm(request: SignUpConfirmRequest): Promise<void>;
15
- /**
16
- * Sign in a user
17
- */
18
- signIn(request: SignInRequest): Promise<SignInResponse>;
19
- /**
20
- * Sign out a user
21
- */
22
- signOut(): Promise<void>;
23
- /**
24
- * Change a user's password
25
- */
26
- changePassword(request: ChangePasswordRequest): Promise<void>;
27
- /**
28
- * Retrieve user details
29
- */
30
- getUser(request: GetUserRequest): Promise<GetUserResponse>;
31
- /**
32
- * Refresh a user's tokens
33
- */
34
- refreshToken(request: RefreshTokenRequest): Promise<RefreshTokenResponse>;
35
- /**
36
- * Respond to an auth challenge
37
- */
38
- respondToAuthChallenge(request: RespondToAuthChallengeRequest): Promise<any>;
39
- /**
40
- * Reset a user's password
41
- */
42
- resetPassword(request: SetPasswordRequest): Promise<void>;
43
- }
44
- export interface HealthcheckResponse {
45
- status: string;
46
- }
File without changes
File without changes
@@ -1,3 +0,0 @@
1
- export interface IReportProcessorBusiness {
2
- processReports(key: string): Promise<void>;
3
- }
@@ -1,2 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });