@fiado/api-invoker 5.52.0 → 5.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.
@@ -9,7 +9,7 @@ export default class AccountPagoConfiadoApi implements IAccountPagoConfiadoApi {
9
9
  constructor(httpRequest: IHttpRequest);
10
10
  cancelAccount(directoryId: string, accountNumber?: string, documentNumber?: string): Promise<ApiGatewayResponse<void>>;
11
11
  createAccount(provider: Provider, data: AccountCreateRequest): Promise<ApiGatewayResponse<AccountCreateResponse>>;
12
- getAccountByDirectoryId(directoryId: string): Promise<ApiGatewayResponse<GetAccountResponse[]>>;
12
+ getAccountByDirectoryId(directoryId: string): Promise<ApiGatewayResponse<GetAccountResponse>>;
13
13
  updateAccountBalance(accountId: string, params: AccountUpdateBalanceRequest): Promise<ApiGatewayResponse<Boolean>>;
14
14
  collectDebit(accountId: string, request: CollectDebitRequest): Promise<ApiGatewayResponse<CollectDebitResponse>>;
15
15
  update(directoryId: string, data: AccountUpdateRequest): Promise<ApiGatewayResponse<void>>;
@@ -3,7 +3,15 @@ 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
- getAccountByDirectoryId(directoryId: string, provider: string): Promise<ApiGatewayResponse<GetAccountResponse[]>>;
6
+ /**
7
+ * La cuenta del titular. Devuelve UN objeto, no una lista: el lambda responde
8
+ * `ApiResponse.success({ data: account })`.
9
+ *
10
+ * Estuvo declarado como lista y no correspondia con lo que llega. Nadie lo noto porque sus
11
+ * consumidores lo leen sin tipar, pero el primero que confio en la declaracion escribio
12
+ * `data[0]` y su cobro reportaba como inexistente una cuenta que si estaba y tenia saldo.
13
+ */
14
+ getAccountByDirectoryId(directoryId: string, provider: string): Promise<ApiGatewayResponse<GetAccountResponse>>;
7
15
  updateAccountBalance(accountId: string, params: AccountUpdateBalanceRequest): Promise<ApiGatewayResponse<Boolean>>;
8
16
  /**
9
17
  * Debita el saldo disponible de la cuenta para cobrar una deuda, en una sola operación que lleva
@@ -1,6 +1,6 @@
1
1
  import type { IHttpRequest } from "@fiado/http-client";
2
2
  import { StandardResponse } from "@fiado/gateway-adapter";
3
- import { ConsumePromotionRequest, ConsumePromotionResponse, CreditPlanResponse, FinancierResponse, SimulateCreditPlanRequest, SimulationResultResponse } from "@fiado/type-kit/bin/loanOfferings/index.js";
3
+ import { ConsumePromotionRequest, PromotedSkusResponse, ConsumePromotionResponse, CreditPlanResponse, FinancierResponse, SimulateCreditPlanRequest, SimulationResultResponse } from "@fiado/type-kit/bin/loanOfferings/index.js";
4
4
  import { ILoanOfferingsBusinessApi } from "./interfaces/ILoanOfferingsBusinessApi.js";
5
5
  /**
6
6
  * Publisher HTTP del lambda `loan-offerings-business` (componente 07 SureKeep Fase 1) para sus 5
@@ -23,4 +23,5 @@ export default class LoanOfferingsBusinessApi implements ILoanOfferingsBusinessA
23
23
  listActiveFinanciers(tenantId: string): Promise<StandardResponse<FinancierResponse[]>>;
24
24
  simulate(planId: string, input: SimulateCreditPlanRequest, tenantId: string): Promise<StandardResponse<SimulationResultResponse>>;
25
25
  consumePromotion(promotionId: string, input: ConsumePromotionRequest, tenantId: string): Promise<StandardResponse<ConsumePromotionResponse>>;
26
+ listPromotedSkus(storeId: string, tenantId: string): Promise<StandardResponse<PromotedSkusResponse>>;
26
27
  }
@@ -50,6 +50,10 @@ let LoanOfferingsBusinessApi = class LoanOfferingsBusinessApi {
50
50
  const url = `${this.baseUrl}/private/promotions/${encodeURIComponent(promotionId)}/consume?tenantId=${encodeURIComponent(tenantId)}`;
51
51
  return await this.httpRequest.post(url, input);
52
52
  }
53
+ async listPromotedSkus(storeId, tenantId) {
54
+ const url = `${this.baseUrl}/private/promotions/promoted-skus?storeId=${encodeURIComponent(storeId)}&tenantId=${encodeURIComponent(tenantId)}`;
55
+ return await this.httpRequest.get(url);
56
+ }
53
57
  };
54
58
  LoanOfferingsBusinessApi = __decorate([
55
59
  injectable(),
@@ -1,5 +1,5 @@
1
1
  import { StandardResponse } from "@fiado/gateway-adapter";
2
- import { ConsumePromotionRequest, ConsumePromotionResponse, CreditPlanResponse, FinancierResponse, SimulateCreditPlanRequest, SimulationResultResponse } from "@fiado/type-kit/bin/loanOfferings/index.js";
2
+ import { ConsumePromotionRequest, PromotedSkusResponse, ConsumePromotionResponse, CreditPlanResponse, FinancierResponse, SimulateCreditPlanRequest, SimulationResultResponse } from "@fiado/type-kit/bin/loanOfferings/index.js";
3
3
  /**
4
4
  * Contrato del publisher HTTP del lambda `loan-offerings-business` (componente 07 SureKeep Fase 1)
5
5
  * para sus 5 endpoints privados service-to-service (VPC-only): 4 de LECTURA del catálogo SOFOM y
@@ -74,4 +74,13 @@ export interface ILoanOfferingsBusinessApi {
74
74
  * @throws si la promoción no existe (`404 PROMOTION_NOT_FOUND`).
75
75
  */
76
76
  consumePromotion(promotionId: string, input: ConsumePromotionRequest, tenantId: string): Promise<StandardResponse<ConsumePromotionResponse>>;
77
+ /**
78
+ * GET /private/promotions/promoted-skus — los SKUs con promoción viva en una tienda, para el
79
+ * badge del catálogo del wizard. Devuelve `{ skus: [] }` si no hay ninguna; nunca 404.
80
+ *
81
+ * El filtrado vive en el lambda, no acá: solo entran las promociones que alcanzan a CUALQUIER
82
+ * nivel (el catálogo se pinta antes del score) y las que ACOTAN por SKU (una general marcaría
83
+ * el catálogo entero). El caller no puede aflojar ese criterio.
84
+ */
85
+ listPromotedSkus(storeId: string, tenantId: string): Promise<StandardResponse<PromotedSkusResponse>>;
77
86
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@fiado/api-invoker",
3
- "version": "5.52.0",
3
+ "version": "5.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.375.0",
37
+ "@fiado/type-kit": "^3.382.0",
38
38
  "dotenv": "^16.4.7"
39
39
  },
40
40
  "peerDependencies": {
@@ -21,7 +21,7 @@ export default class AccountPagoConfiadoApi implements IAccountPagoConfiadoApi {
21
21
  return await this.httpRequest.post(url, data);
22
22
  }
23
23
 
24
- async getAccountByDirectoryId(directoryId: string): Promise<ApiGatewayResponse<GetAccountResponse[]>> {
24
+ async getAccountByDirectoryId(directoryId: string): Promise<ApiGatewayResponse<GetAccountResponse>> {
25
25
  const url = `${this.baseUrl}users/${directoryId}`;
26
26
  return await this.httpRequest.get(url);
27
27
  }
@@ -6,7 +6,15 @@ import { Provider } from "@fiado/type-kit/bin/provider/index.js";
6
6
  export interface IAccountPagoConfiadoApi {
7
7
  createAccount(provider: Provider, data: AccountCreateRequest): Promise<ApiGatewayResponse<AccountCreateResponse>>;
8
8
 
9
- getAccountByDirectoryId(directoryId: string, provider: string): Promise<ApiGatewayResponse<GetAccountResponse[]>>;
9
+ /**
10
+ * La cuenta del titular. Devuelve UN objeto, no una lista: el lambda responde
11
+ * `ApiResponse.success({ data: account })`.
12
+ *
13
+ * Estuvo declarado como lista y no correspondia con lo que llega. Nadie lo noto porque sus
14
+ * consumidores lo leen sin tipar, pero el primero que confio en la declaracion escribio
15
+ * `data[0]` y su cobro reportaba como inexistente una cuenta que si estaba y tenia saldo.
16
+ */
17
+ getAccountByDirectoryId(directoryId: string, provider: string): Promise<ApiGatewayResponse<GetAccountResponse>>;
10
18
 
11
19
  updateAccountBalance(accountId: string, params: AccountUpdateBalanceRequest): Promise<ApiGatewayResponse<Boolean>>;
12
20
 
@@ -3,6 +3,7 @@ import type { IHttpRequest } from "@fiado/http-client";
3
3
  import { StandardResponse } from "@fiado/gateway-adapter";
4
4
  import {
5
5
  ConsumePromotionRequest,
6
+ PromotedSkusResponse,
6
7
  ConsumePromotionResponse,
7
8
  CreditPlanResponse,
8
9
  FinancierResponse,
@@ -70,4 +71,12 @@ export default class LoanOfferingsBusinessApi implements ILoanOfferingsBusinessA
70
71
  const url = `${this.baseUrl}/private/promotions/${encodeURIComponent(promotionId)}/consume?tenantId=${encodeURIComponent(tenantId)}`;
71
72
  return await this.httpRequest.post(url, input);
72
73
  }
74
+
75
+ async listPromotedSkus(
76
+ storeId: string,
77
+ tenantId: string,
78
+ ): Promise<StandardResponse<PromotedSkusResponse>> {
79
+ const url = `${this.baseUrl}/private/promotions/promoted-skus?storeId=${encodeURIComponent(storeId)}&tenantId=${encodeURIComponent(tenantId)}`;
80
+ return await this.httpRequest.get(url);
81
+ }
73
82
  }
@@ -1,6 +1,7 @@
1
1
  import { StandardResponse } from "@fiado/gateway-adapter";
2
2
  import {
3
3
  ConsumePromotionRequest,
4
+ PromotedSkusResponse,
4
5
  ConsumePromotionResponse,
5
6
  CreditPlanResponse,
6
7
  FinancierResponse,
@@ -102,4 +103,17 @@ export interface ILoanOfferingsBusinessApi {
102
103
  input: ConsumePromotionRequest,
103
104
  tenantId: string,
104
105
  ): Promise<StandardResponse<ConsumePromotionResponse>>;
106
+
107
+ /**
108
+ * GET /private/promotions/promoted-skus — los SKUs con promoción viva en una tienda, para el
109
+ * badge del catálogo del wizard. Devuelve `{ skus: [] }` si no hay ninguna; nunca 404.
110
+ *
111
+ * El filtrado vive en el lambda, no acá: solo entran las promociones que alcanzan a CUALQUIER
112
+ * nivel (el catálogo se pinta antes del score) y las que ACOTAN por SKU (una general marcaría
113
+ * el catálogo entero). El caller no puede aflojar ese criterio.
114
+ */
115
+ listPromotedSkus(
116
+ storeId: string,
117
+ tenantId: string,
118
+ ): Promise<StandardResponse<PromotedSkusResponse>>;
105
119
  }