@fiado/api-invoker 5.154.0 → 5.156.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.
@@ -1,16 +1,17 @@
1
- import { KycVerificationChangedV1, KycStepCompletedV1, KycProofOfAddressCompletedV1 } from "@fiado/type-kit/bin/kyc/index.js";
1
+ import { KycVerificationChangedV1, KycStepCompletedV1, KycProofOfAddressCompletedV1, KycVerificationProgressV1 } from "@fiado/type-kit/bin/kyc/index.js";
2
2
  /**
3
3
  * Todo lo que `RetailKycInboundQueue` transporta:
4
4
  * - `KycVerificationChangedV1` — el CIERRE de la verificación, con el resultado consolidado.
5
5
  * - `KycStepCompletedV1` — el resultado de UNA estación, en cuanto Metamap la cierra.
6
6
  * - `KycProofOfAddressCompletedV1` — el resultado del COMPROBANTE DE DOMICILIO, un flow aparte del
7
7
  * documento de identidad.
8
+ * - `KycVerificationProgressV1` — el avance de la verificación (iniciada, datos cargados, vencida).
8
9
  *
9
10
  * Es una unión cerrada y no un `unknown` a propósito: el consumidor rutea por `eventType`, así que
10
11
  * agregar un tipo acá obliga a tocar también el consumidor — que es exactamente la conversación que
11
12
  * tiene que pasar antes de meter un mensaje nuevo en una cola compartida.
12
13
  */
13
- export type RetailKycInboundMessage = KycVerificationChangedV1 | KycStepCompletedV1 | KycProofOfAddressCompletedV1;
14
+ export type RetailKycInboundMessage = KycVerificationChangedV1 | KycStepCompletedV1 | KycProofOfAddressCompletedV1 | KycVerificationProgressV1;
14
15
  /**
15
16
  * Publisher del KYC hacia `RetailKycInboundQueue`, que consume `retail-wizard-business` (SureKeep F2).
16
17
  *
@@ -1,6 +1,6 @@
1
1
  import type { IHttpRequest } from "@fiado/http-client";
2
2
  import { StandardResponse } from "@fiado/gateway-adapter";
3
- import { ActivationCheckRequest, ActivationCheckResponse, CancelLoanCreditRequest, CreditPaymentAppliedRequest, CreditPaymentAppliedResponse, CreditSettledRequest, CreditSettledResponse, LoanBorrowerResponse, ListMessagingCandidatesRequest, ListMessagingCandidatesResponse, LoanCreditResponse, OriginateLoanCreditRequest, OriginateLoanCreditResponse, QuoteLoanCreditRequest, QuoteLoanCreditResponse, SignLoanCreditRequest, SignLoanCreditResponse, PreviewLoanContractRequest, LoanContractPreview, UpdateLoanBorrowerSciRequest, UpsertLoanBorrowerRequest, LoanBorrowerCreditItem, LoanContractDownloadUrl, LoanContractResponse, ContractTypeEnum, LoanCustomerCreditDocument, LoanCustomerCreditDocumentUrl, LoanCreditDetail, LoanInstallmentResponse, LoanPaymentListResponse, CreateCustomerPaymentRequest, LoanCustomerPaymentOptions, LoanCustomerPaymentResult } from "@fiado/type-kit/bin/loanCredit/index.js";
3
+ import { ActivationCheckRequest, ActivationCheckResponse, CancelLoanCreditRequest, CreditPaymentAppliedRequest, CreditPaymentAppliedResponse, CreditSettledRequest, CreditSettledResponse, LoanBorrowerResponse, ListMessagingCandidatesRequest, ListMessagingCandidatesResponse, LoanCreditResponse, OriginateLoanCreditRequest, OriginateLoanCreditResponse, QuoteLoanCreditRequest, QuoteLoanCreditResponse, SignLoanCreditRequest, SignLoanCreditResponse, PreviewLoanContractRequest, LoanContractPreview, UpdateLoanBorrowerSciRequest, UpsertLoanBorrowerRequest, LoanBorrowerCreditItem, LoanContractDownloadUrl, LoanContractResponse, ContractTypeEnum, LoanCustomerCreditDocument, LoanCustomerCreditDocumentUrl, LoanCreditDetail, LoanInstallmentResponse, LoanPaymentListResponse, CreateCustomerPaymentRequest, LoanCustomerPaymentOptions, LoanCustomerPaymentResult, SegmentFactsBatchRequest, SegmentFactsBatchResponse, SegmentFactsPageRequest, SegmentFactsPageResponse } from "@fiado/type-kit/bin/loanCredit/index.js";
4
4
  import { CreditSummariesBatchRequest, CreditSummariesBatchResponse } from "./dtos/CreditSummariesBatch.js";
5
5
  import { LoanCreditAnalyticsBatchRequest, LoanCreditAnalyticsBatchResponse } from "./dtos/LoanCreditAnalyticsBatch.js";
6
6
  import type { GetCreditOptions } from "./dtos/GetCreditOptions.js";
@@ -37,6 +37,8 @@ export default class LoanCreditBusinessApi implements ILoanCreditBusinessApi {
37
37
  getCustomerCreditHistory(retailCustomerId: string, tenantId: string): Promise<StandardResponse<CustomerCreditHistoryResponse>>;
38
38
  batchGetCreditAnalytics(input: LoanCreditAnalyticsBatchRequest, tenantId: string): Promise<StandardResponse<LoanCreditAnalyticsBatchResponse>>;
39
39
  batchGetCreditSummaries(input: CreditSummariesBatchRequest, tenantId: string): Promise<StandardResponse<CreditSummariesBatchResponse>>;
40
+ getSegmentFacts(input: SegmentFactsBatchRequest, tenantId: string): Promise<StandardResponse<SegmentFactsBatchResponse>>;
41
+ pageSegmentFacts(input: SegmentFactsPageRequest, tenantId: string): Promise<StandardResponse<SegmentFactsPageResponse>>;
40
42
  upsertBorrower(input: UpsertLoanBorrowerRequest, tenantId: string): Promise<StandardResponse<LoanBorrowerResponse>>;
41
43
  updateBorrowerSci(borrowerId: string, input: UpdateLoanBorrowerSciRequest, tenantId: string): Promise<StandardResponse<LoanBorrowerResponse>>;
42
44
  notifyLifecycleFact(creditId: string, input: CreditLifecycleFactRequest, tenantId: string): Promise<StandardResponse<CreditLifecycleFactResponse>>;
@@ -92,6 +92,14 @@ let LoanCreditBusinessApi = class LoanCreditBusinessApi {
92
92
  const url = `${this.baseUrl}/private/borrowers/credit-summaries?tenantId=${encodeURIComponent(tenantId)}`;
93
93
  return await this.httpRequest.post(url, input);
94
94
  }
95
+ async getSegmentFacts(input, tenantId) {
96
+ const url = `${this.baseUrl}/private/borrowers/segment-facts?tenantId=${encodeURIComponent(tenantId)}`;
97
+ return await this.httpRequest.post(url, input);
98
+ }
99
+ async pageSegmentFacts(input, tenantId) {
100
+ const url = `${this.baseUrl}/private/borrowers/segment-facts/page?tenantId=${encodeURIComponent(tenantId)}`;
101
+ return await this.httpRequest.post(url, input);
102
+ }
95
103
  async upsertBorrower(input, tenantId) {
96
104
  const url = `${this.baseUrl}/private/borrowers?tenantId=${encodeURIComponent(tenantId)}`;
97
105
  return await this.httpRequest.post(url, input);
@@ -1,5 +1,5 @@
1
1
  import { StandardResponse } from "@fiado/gateway-adapter";
2
- import { ActivationCheckRequest, CreditPaymentAppliedRequest, CreditPaymentAppliedResponse, CreditSettledRequest, CreditSettledResponse, ActivationCheckResponse, CancelLoanCreditRequest, LoanBorrowerResponse, ListMessagingCandidatesRequest, ListMessagingCandidatesResponse, LoanCreditResponse, OriginateLoanCreditRequest, OriginateLoanCreditResponse, QuoteLoanCreditRequest, QuoteLoanCreditResponse, SignLoanCreditRequest, PreviewLoanContractRequest, LoanContractPreview, SignLoanCreditResponse, UpdateLoanBorrowerSciRequest, UpsertLoanBorrowerRequest, LoanBorrowerCreditItem, LoanContractDownloadUrl, LoanContractResponse, ContractTypeEnum, LoanCustomerCreditDocument, LoanCustomerCreditDocumentUrl, LoanCreditDetail, LoanInstallmentResponse, LoanPaymentListResponse, CreateCustomerPaymentRequest, LoanCustomerPaymentOptions, LoanCustomerPaymentResult } from "@fiado/type-kit/bin/loanCredit/index.js";
2
+ import { ActivationCheckRequest, CreditPaymentAppliedRequest, CreditPaymentAppliedResponse, CreditSettledRequest, CreditSettledResponse, ActivationCheckResponse, CancelLoanCreditRequest, LoanBorrowerResponse, ListMessagingCandidatesRequest, ListMessagingCandidatesResponse, LoanCreditResponse, OriginateLoanCreditRequest, OriginateLoanCreditResponse, QuoteLoanCreditRequest, QuoteLoanCreditResponse, SignLoanCreditRequest, PreviewLoanContractRequest, LoanContractPreview, SignLoanCreditResponse, UpdateLoanBorrowerSciRequest, UpsertLoanBorrowerRequest, LoanBorrowerCreditItem, LoanContractDownloadUrl, LoanContractResponse, ContractTypeEnum, LoanCustomerCreditDocument, LoanCustomerCreditDocumentUrl, LoanCreditDetail, LoanInstallmentResponse, LoanPaymentListResponse, CreateCustomerPaymentRequest, LoanCustomerPaymentOptions, LoanCustomerPaymentResult, SegmentFactsBatchRequest, SegmentFactsBatchResponse, SegmentFactsPageRequest, SegmentFactsPageResponse } from "@fiado/type-kit/bin/loanCredit/index.js";
3
3
  import { CreditSummariesBatchRequest, CreditSummariesBatchResponse } from "../dtos/CreditSummariesBatch.js";
4
4
  import { LoanCreditAnalyticsBatchRequest, LoanCreditAnalyticsBatchResponse } from "../dtos/LoanCreditAnalyticsBatch.js";
5
5
  import type { GetCreditOptions } from "../dtos/GetCreditOptions.js";
@@ -110,6 +110,18 @@ export interface ILoanCreditBusinessApi {
110
110
  * `400 VALIDATION_ERROR` si el lote viene vacío, repite ids o pasa de 100.
111
111
  */
112
112
  batchGetCreditSummaries(input: CreditSummariesBatchRequest, tenantId: string): Promise<StandardResponse<CreditSummariesBatchResponse>>;
113
+ /**
114
+ * Datos para evaluar cohorts de segmentos de hasta 100 clientes retail en lote, ya normalizados:
115
+ * un cliente sin acreditado sale con conteos en `0` y `borrowerId: null`. Un ítem por id pedido,
116
+ * en el mismo orden.
117
+ * `400` si el lote viene vacío o pasa de 100.
118
+ */
119
+ getSegmentFacts(input: SegmentFactsBatchRequest, tenantId: string): Promise<StandardResponse<SegmentFactsBatchResponse>>;
120
+ /**
121
+ * Recorre la cartera de acreditados por páginas (hasta 100) con sus datos para evaluar cohorts.
122
+ * Es para el recálculo de conteos. `nextCursor` en `null` significa que ya no quedan acreditados.
123
+ */
124
+ pageSegmentFacts(input: SegmentFactsPageRequest, tenantId: string): Promise<StandardResponse<SegmentFactsPageResponse>>;
113
125
  /**
114
126
  * Upsert idempotente del acreditado por `retailCustomerId` (mismo contrato que el consumidor
115
127
  * del evento `CustomerKycVerifiedV1` — fallback operativo mientras la cola no exista).
@@ -1,7 +1,6 @@
1
1
  import type { IHttpRequest } from "@fiado/http-client";
2
2
  import { StandardResponse } from "@fiado/gateway-adapter";
3
- import { AmortizationScheduleResponse, ComputeAmortizationScheduleRequest, ConsumePromotionRequest, PromotedSkusResponse, ConsumePromotionResponse, CreditPlanLevelEnum, CreditPlanResponse, FinancierResponse, ListPromotedSkusRequest, ListSkuPromotionsRequest, ReservePromotionBonusRequest, ReservePromotionBonusResponse, ResolveCustomerSegmentsRequest, ResolveCustomerSegmentsResponse, ScopeWidePromotionsResponse, SegmentCatalogResponse, SegmentStatusEnum, SkuPromotionsResponse, SettlePromotionBonusRequest, PromotionBonusResponse, SimulateCreditPlanRequest, SimulationResultResponse } from "@fiado/type-kit/bin/loanOfferings/index.js";
4
- import { SegmentMembersResponse } from "./dtos/SegmentMembers.js";
3
+ import { AmortizationScheduleResponse, ComputeAmortizationScheduleRequest, ConsumePromotionRequest, PromotedSkusResponse, ConsumePromotionResponse, CreditPlanLevelEnum, CreditPlanResponse, FinancierResponse, ListPromotedSkusRequest, ListSkuPromotionsRequest, ReservePromotionBonusRequest, ReservePromotionBonusResponse, ResolveCustomerSegmentsRequest, ResolveCustomerSegmentsResponse, ResolveSegmentMembersRequest, ScopeWidePromotionsResponse, SegmentCatalogResponse, SegmentMembersResponse, SegmentStatusEnum, SkuPromotionsResponse, SettlePromotionBonusRequest, PromotionBonusResponse, SimulateCreditPlanRequest, SimulationResultResponse } from "@fiado/type-kit/bin/loanOfferings/index.js";
5
4
  import { ILoanOfferingsBusinessApi } from "./interfaces/ILoanOfferingsBusinessApi.js";
6
5
  /**
7
6
  * Publisher HTTP del lambda `loan-offerings-business` (componente 07 SureKeep Fase 1) para sus
@@ -33,6 +32,8 @@ export default class LoanOfferingsBusinessApi implements ILoanOfferingsBusinessA
33
32
  listSkuPromotions(storeId: string, tenantId: string, level?: CreditPlanLevelEnum, segmentId?: string): Promise<StandardResponse<SkuPromotionsResponse>>;
34
33
  listSkuPromotionsBatch(input: ListSkuPromotionsRequest, tenantId: string): Promise<StandardResponse<SkuPromotionsResponse>>;
35
34
  listScopeWidePromotions(storeId: string, tenantId: string, level?: CreditPlanLevelEnum, segmentId?: string): Promise<StandardResponse<ScopeWidePromotionsResponse>>;
35
+ /** @deprecated Usar `resolveSegmentMembers`: este GET solo mira la lista manual. */
36
36
  getSegmentMembers(retailCustomerIds: string[], tenantId: string): Promise<StandardResponse<SegmentMembersResponse>>;
37
+ resolveSegmentMembers(input: ResolveSegmentMembersRequest, tenantId: string): Promise<StandardResponse<SegmentMembersResponse>>;
37
38
  listSegments(tenantId: string, status?: SegmentStatusEnum): Promise<StandardResponse<SegmentCatalogResponse>>;
38
39
  }
@@ -98,6 +98,7 @@ let LoanOfferingsBusinessApi = class LoanOfferingsBusinessApi {
98
98
  url += `&segmentId=${encodeURIComponent(segmentId)}`;
99
99
  return await this.httpRequest.get(url);
100
100
  }
101
+ /** @deprecated Usar `resolveSegmentMembers`: este GET solo mira la lista manual. */
101
102
  async getSegmentMembers(retailCustomerIds, tenantId) {
102
103
  const params = new URLSearchParams({
103
104
  retailCustomerIds: retailCustomerIds.join(","),
@@ -106,6 +107,10 @@ let LoanOfferingsBusinessApi = class LoanOfferingsBusinessApi {
106
107
  const url = `${this.baseUrl}/private/segments/members?${params.toString()}`;
107
108
  return await this.httpRequest.get(url);
108
109
  }
110
+ async resolveSegmentMembers(input, tenantId) {
111
+ const url = `${this.baseUrl}/private/segments/members?tenantId=${encodeURIComponent(tenantId)}`;
112
+ return await this.httpRequest.post(url, input);
113
+ }
109
114
  async listSegments(tenantId, status) {
110
115
  const params = new URLSearchParams({ tenantId });
111
116
  if (status)
@@ -1,23 +1,7 @@
1
- /**
2
- * Tipos de la pertenencia a segmentos EN LOTE. Viven en esta lib (y no en `@fiado/type-kit`) porque
3
- * el type-kit todavía no modela esta vista reducida — el lambda destino la tiene como DTO local.
4
- */
5
- /** Un segmento al que pertenece el cliente, con lo mínimo para pintarlo. */
6
- export interface CustomerSegmentMembership {
7
- segmentId: string;
8
- name: string;
9
- /**
10
- * Segmento por omisión del catálogo. Su semántica cambia por motor (alcanza a todos en
11
- * promociones y a nadie en políticas), así que el consumidor decide si lo pinta.
12
- */
13
- isDefault: boolean;
14
- }
15
- /** Un cliente y los segmentos que le tocan. `segments: []` afirma que no está en ninguno. */
16
- export interface SegmentMembersItem {
17
- retailCustomerId: string;
18
- segments: CustomerSegmentMembership[];
19
- }
20
- /** Una fila por cada id PEDIDO, no por cada id con segmentos. */
21
- export interface SegmentMembersResponse {
22
- items: SegmentMembersItem[];
23
- }
1
+ import type { CustomerSegmentRef, CustomerSegmentsItem, SegmentMembersResponse } from "@fiado/type-kit/bin/loanOfferings/index.js";
2
+ /** Pertenencia a segmentos en lote. La forma vive en `@fiado/type-kit`. */
3
+ export type { SegmentMembersResponse };
4
+ /** @deprecated Usar `CustomerSegmentRef` de `@fiado/type-kit/bin/loanOfferings`. */
5
+ export type CustomerSegmentMembership = CustomerSegmentRef;
6
+ /** @deprecated Usar `CustomerSegmentsItem` de `@fiado/type-kit/bin/loanOfferings`. */
7
+ export type SegmentMembersItem = CustomerSegmentsItem;
@@ -1,5 +1 @@
1
- /**
2
- * Tipos de la pertenencia a segmentos EN LOTE. Viven en esta lib (y no en `@fiado/type-kit`) porque
3
- * el type-kit todavía no modela esta vista reducida — el lambda destino la tiene como DTO local.
4
- */
5
1
  export {};
@@ -1,6 +1,5 @@
1
1
  import { StandardResponse } from "@fiado/gateway-adapter";
2
- import { SegmentMembersResponse } from "../dtos/SegmentMembers.js";
3
- import { ListPromotedSkusRequest, ListSkuPromotionsRequest, AmortizationScheduleResponse, ComputeAmortizationScheduleRequest, ConsumePromotionRequest, PromotedSkusResponse, ConsumePromotionResponse, CreditPlanLevelEnum, CreditPlanResponse, FinancierResponse, ReservePromotionBonusRequest, ReservePromotionBonusResponse, ResolveCustomerSegmentsRequest, ResolveCustomerSegmentsResponse, ScopeWidePromotionsResponse, SegmentCatalogResponse, SegmentStatusEnum, SkuPromotionsResponse, SettlePromotionBonusRequest, PromotionBonusResponse, SimulateCreditPlanRequest, SimulationResultResponse } from "@fiado/type-kit/bin/loanOfferings/index.js";
2
+ import { ListPromotedSkusRequest, ListSkuPromotionsRequest, AmortizationScheduleResponse, ComputeAmortizationScheduleRequest, ConsumePromotionRequest, PromotedSkusResponse, ConsumePromotionResponse, CreditPlanLevelEnum, CreditPlanResponse, FinancierResponse, ReservePromotionBonusRequest, ReservePromotionBonusResponse, ResolveCustomerSegmentsRequest, ResolveCustomerSegmentsResponse, ResolveSegmentMembersRequest, ScopeWidePromotionsResponse, SegmentCatalogResponse, SegmentMembersResponse, SegmentStatusEnum, SkuPromotionsResponse, SettlePromotionBonusRequest, PromotionBonusResponse, SimulateCreditPlanRequest, SimulationResultResponse } from "@fiado/type-kit/bin/loanOfferings/index.js";
4
3
  /**
5
4
  * Contrato del publisher HTTP del lambda `loan-offerings-business` (componente 07 SureKeep Fase 1)
6
5
  * para sus endpoints privados service-to-service (VPC-only): LECTURAS del catálogo SOFOM y
@@ -99,11 +98,10 @@ export interface ILoanOfferingsBusinessApi {
99
98
  listPromotedSkusBatch(input: ListPromotedSkusRequest, tenantId: string): Promise<StandardResponse<PromotedSkusResponse>>;
100
99
  /**
101
100
  * POST /private/segments/resolve — los segmentos a los que pertenece el cliente HOY, evaluados
102
- * en línea contra los hechos que manda el caller. No hay segmento persistido en el cliente.
101
+ * en línea con sus cohorts. No hay segmento persistido en el cliente.
103
102
  *
104
- * Los hechos los junta quien ya tiene al cliente delante; este lambda no sale a buscarlos a
105
- * otro silo. Un hecho AUSENTE hace que su filtro NO se cumpla: sin el dato no se puede afirmar
106
- * que el cliente califica, y de las dos salidas la segura es dejarlo fuera.
103
+ * Los datos del cliente son opcionales: si el caller no los manda, loan-offerings los pide a
104
+ * loan-credit. Un dato ausente hace que su condición no se cumpla.
107
105
  *
108
106
  * `segmentIds` puede venir VACÍO y eso no es un error: significa que el cliente está en
109
107
  * Estándar, el catch-all, que nunca se devuelve aquí.
@@ -160,8 +158,21 @@ export interface ILoanOfferingsBusinessApi {
160
158
  *
161
159
  * @throws `400 SEGMENT_MEMBERS_BATCH_TOO_LARGE` si el lote pasa de 100 ids.
162
160
  * @throws `400 UNKNOWN_TENANT` si el `tenantId` viene ausente o desconocido.
161
+ * @deprecated Solo cruza la lista manual del segmento, no evalúa cohorts. Usar
162
+ * {@link resolveSegmentMembers}.
163
163
  */
164
164
  getSegmentMembers(retailCustomerIds: string[], tenantId: string): Promise<StandardResponse<SegmentMembersResponse>>;
165
+ /**
166
+ * `POST /private/segments/members` — pertenencia a segmentos EN LOTE, evaluando cohorts y lista
167
+ * manual igual que el resolve. Hasta 100 clientes; cada uno viaja con sus datos si el caller
168
+ * los tiene.
169
+ *
170
+ * Devuelve una fila por cada cliente pedido, en el mismo orden.
171
+ *
172
+ * @throws `400` si el lote viene vacío, pasa de 100 o un dato tiene el tipo equivocado.
173
+ * @throws `400 UNKNOWN_TENANT` si el `tenantId` viene ausente o desconocido.
174
+ */
175
+ resolveSegmentMembers(input: ResolveSegmentMembersRequest, tenantId: string): Promise<StandardResponse<SegmentMembersResponse>>;
165
176
  /**
166
177
  * `GET /private/segments` — catálogo de segmentos del silo, sin miembros; el catch-all viaja con `isDefault: true`.
167
178
  * Sin `status` devuelve todos los estados.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@fiado/api-invoker",
3
- "version": "5.154.0",
3
+ "version": "5.156.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.14.0",
35
35
  "@fiado/http-client": "^2.0.1",
36
36
  "@fiado/logger": "^1.1.3",
37
- "@fiado/type-kit": "^3.612.0",
37
+ "@fiado/type-kit": "^3.614.0",
38
38
  "dotenv": "^16.4.7"
39
39
  },
40
40
  "peerDependencies": {
@@ -1,4 +1,4 @@
1
- import { KycVerificationChangedV1, KycStepCompletedV1, KycProofOfAddressCompletedV1 } from "@fiado/type-kit/bin/kyc/index.js";
1
+ import { KycVerificationChangedV1, KycStepCompletedV1, KycProofOfAddressCompletedV1, KycVerificationProgressV1 } from "@fiado/type-kit/bin/kyc/index.js";
2
2
 
3
3
  /**
4
4
  * Todo lo que `RetailKycInboundQueue` transporta:
@@ -6,12 +6,17 @@ import { KycVerificationChangedV1, KycStepCompletedV1, KycProofOfAddressComplete
6
6
  * - `KycStepCompletedV1` — el resultado de UNA estación, en cuanto Metamap la cierra.
7
7
  * - `KycProofOfAddressCompletedV1` — el resultado del COMPROBANTE DE DOMICILIO, un flow aparte del
8
8
  * documento de identidad.
9
+ * - `KycVerificationProgressV1` — el avance de la verificación (iniciada, datos cargados, vencida).
9
10
  *
10
11
  * Es una unión cerrada y no un `unknown` a propósito: el consumidor rutea por `eventType`, así que
11
12
  * agregar un tipo acá obliga a tocar también el consumidor — que es exactamente la conversación que
12
13
  * tiene que pasar antes de meter un mensaje nuevo en una cola compartida.
13
14
  */
14
- export type RetailKycInboundMessage = KycVerificationChangedV1 | KycStepCompletedV1 | KycProofOfAddressCompletedV1;
15
+ export type RetailKycInboundMessage =
16
+ | KycVerificationChangedV1
17
+ | KycStepCompletedV1
18
+ | KycProofOfAddressCompletedV1
19
+ | KycVerificationProgressV1;
15
20
 
16
21
  /**
17
22
  * Publisher del KYC hacia `RetailKycInboundQueue`, que consume `retail-wizard-business` (SureKeep F2).
@@ -35,6 +35,10 @@ import {
35
35
  CreateCustomerPaymentRequest,
36
36
  LoanCustomerPaymentOptions,
37
37
  LoanCustomerPaymentResult,
38
+ SegmentFactsBatchRequest,
39
+ SegmentFactsBatchResponse,
40
+ SegmentFactsPageRequest,
41
+ SegmentFactsPageResponse,
38
42
  } from "@fiado/type-kit/bin/loanCredit/index.js";
39
43
  import {
40
44
  CreditSummariesBatchRequest,
@@ -198,6 +202,22 @@ export default class LoanCreditBusinessApi implements ILoanCreditBusinessApi {
198
202
  return await this.httpRequest.post(url, input);
199
203
  }
200
204
 
205
+ async getSegmentFacts(
206
+ input: SegmentFactsBatchRequest,
207
+ tenantId: string,
208
+ ): Promise<StandardResponse<SegmentFactsBatchResponse>> {
209
+ const url = `${this.baseUrl}/private/borrowers/segment-facts?tenantId=${encodeURIComponent(tenantId)}`;
210
+ return await this.httpRequest.post(url, input);
211
+ }
212
+
213
+ async pageSegmentFacts(
214
+ input: SegmentFactsPageRequest,
215
+ tenantId: string,
216
+ ): Promise<StandardResponse<SegmentFactsPageResponse>> {
217
+ const url = `${this.baseUrl}/private/borrowers/segment-facts/page?tenantId=${encodeURIComponent(tenantId)}`;
218
+ return await this.httpRequest.post(url, input);
219
+ }
220
+
201
221
  async upsertBorrower(
202
222
  input: UpsertLoanBorrowerRequest,
203
223
  tenantId: string,
@@ -33,6 +33,10 @@ import {
33
33
  CreateCustomerPaymentRequest,
34
34
  LoanCustomerPaymentOptions,
35
35
  LoanCustomerPaymentResult,
36
+ SegmentFactsBatchRequest,
37
+ SegmentFactsBatchResponse,
38
+ SegmentFactsPageRequest,
39
+ SegmentFactsPageResponse,
36
40
  } from "@fiado/type-kit/bin/loanCredit/index.js";
37
41
  import {
38
42
  CreditSummariesBatchRequest,
@@ -218,6 +222,26 @@ export interface ILoanCreditBusinessApi {
218
222
  tenantId: string,
219
223
  ): Promise<StandardResponse<CreditSummariesBatchResponse>>;
220
224
 
225
+ /**
226
+ * Datos para evaluar cohorts de segmentos de hasta 100 clientes retail en lote, ya normalizados:
227
+ * un cliente sin acreditado sale con conteos en `0` y `borrowerId: null`. Un ítem por id pedido,
228
+ * en el mismo orden.
229
+ * `400` si el lote viene vacío o pasa de 100.
230
+ */
231
+ getSegmentFacts(
232
+ input: SegmentFactsBatchRequest,
233
+ tenantId: string,
234
+ ): Promise<StandardResponse<SegmentFactsBatchResponse>>;
235
+
236
+ /**
237
+ * Recorre la cartera de acreditados por páginas (hasta 100) con sus datos para evaluar cohorts.
238
+ * Es para el recálculo de conteos. `nextCursor` en `null` significa que ya no quedan acreditados.
239
+ */
240
+ pageSegmentFacts(
241
+ input: SegmentFactsPageRequest,
242
+ tenantId: string,
243
+ ): Promise<StandardResponse<SegmentFactsPageResponse>>;
244
+
221
245
  /**
222
246
  * Upsert idempotente del acreditado por `retailCustomerId` (mismo contrato que el consumidor
223
247
  * del evento `CustomerKycVerifiedV1` — fallback operativo mientras la cola no exista).
@@ -16,8 +16,10 @@ import {
16
16
  ReservePromotionBonusResponse,
17
17
  ResolveCustomerSegmentsRequest,
18
18
  ResolveCustomerSegmentsResponse,
19
+ ResolveSegmentMembersRequest,
19
20
  ScopeWidePromotionsResponse,
20
21
  SegmentCatalogResponse,
22
+ SegmentMembersResponse,
21
23
  SegmentStatusEnum,
22
24
  SkuPromotionsResponse,
23
25
  SettlePromotionBonusRequest,
@@ -25,7 +27,6 @@ import {
25
27
  SimulateCreditPlanRequest,
26
28
  SimulationResultResponse,
27
29
  } from "@fiado/type-kit/bin/loanOfferings/index.js";
28
- import { SegmentMembersResponse } from "./dtos/SegmentMembers.js";
29
30
  import { ILoanOfferingsBusinessApi } from "./interfaces/ILoanOfferingsBusinessApi.js";
30
31
 
31
32
  /**
@@ -174,6 +175,7 @@ export default class LoanOfferingsBusinessApi implements ILoanOfferingsBusinessA
174
175
  return await this.httpRequest.get(url);
175
176
  }
176
177
 
178
+ /** @deprecated Usar `resolveSegmentMembers`: este GET solo mira la lista manual. */
177
179
  async getSegmentMembers(
178
180
  retailCustomerIds: string[],
179
181
  tenantId: string,
@@ -186,6 +188,14 @@ export default class LoanOfferingsBusinessApi implements ILoanOfferingsBusinessA
186
188
  return await this.httpRequest.get(url);
187
189
  }
188
190
 
191
+ async resolveSegmentMembers(
192
+ input: ResolveSegmentMembersRequest,
193
+ tenantId: string,
194
+ ): Promise<StandardResponse<SegmentMembersResponse>> {
195
+ const url = `${this.baseUrl}/private/segments/members?tenantId=${encodeURIComponent(tenantId)}`;
196
+ return await this.httpRequest.post(url, input);
197
+ }
198
+
189
199
  async listSegments(
190
200
  tenantId: string,
191
201
  status?: SegmentStatusEnum,
@@ -1,26 +1,14 @@
1
- /**
2
- * Tipos de la pertenencia a segmentos EN LOTE. Viven en esta lib (y no en `@fiado/type-kit`) porque
3
- * el type-kit todavía no modela esta vista reducida — el lambda destino la tiene como DTO local.
4
- */
1
+ import type {
2
+ CustomerSegmentRef,
3
+ CustomerSegmentsItem,
4
+ SegmentMembersResponse,
5
+ } from "@fiado/type-kit/bin/loanOfferings/index.js";
5
6
 
6
- /** Un segmento al que pertenece el cliente, con lo mínimo para pintarlo. */
7
- export interface CustomerSegmentMembership {
8
- segmentId: string;
9
- name: string;
10
- /**
11
- * Segmento por omisión del catálogo. Su semántica cambia por motor (alcanza a todos en
12
- * promociones y a nadie en políticas), así que el consumidor decide si lo pinta.
13
- */
14
- isDefault: boolean;
15
- }
7
+ /** Pertenencia a segmentos en lote. La forma vive en `@fiado/type-kit`. */
8
+ export type { SegmentMembersResponse };
16
9
 
17
- /** Un cliente y los segmentos que le tocan. `segments: []` afirma que no está en ninguno. */
18
- export interface SegmentMembersItem {
19
- retailCustomerId: string;
20
- segments: CustomerSegmentMembership[];
21
- }
10
+ /** @deprecated Usar `CustomerSegmentRef` de `@fiado/type-kit/bin/loanOfferings`. */
11
+ export type CustomerSegmentMembership = CustomerSegmentRef;
22
12
 
23
- /** Una fila por cada id PEDIDO, no por cada id con segmentos. */
24
- export interface SegmentMembersResponse {
25
- items: SegmentMembersItem[];
26
- }
13
+ /** @deprecated Usar `CustomerSegmentsItem` de `@fiado/type-kit/bin/loanOfferings`. */
14
+ export type SegmentMembersItem = CustomerSegmentsItem;
@@ -1,5 +1,4 @@
1
1
  import { StandardResponse } from "@fiado/gateway-adapter";
2
- import { SegmentMembersResponse } from "../dtos/SegmentMembers.js";
3
2
  import {
4
3
  ListPromotedSkusRequest,
5
4
  ListSkuPromotionsRequest,
@@ -15,8 +14,10 @@ import {
15
14
  ReservePromotionBonusResponse,
16
15
  ResolveCustomerSegmentsRequest,
17
16
  ResolveCustomerSegmentsResponse,
17
+ ResolveSegmentMembersRequest,
18
18
  ScopeWidePromotionsResponse,
19
19
  SegmentCatalogResponse,
20
+ SegmentMembersResponse,
20
21
  SegmentStatusEnum,
21
22
  SkuPromotionsResponse,
22
23
  SettlePromotionBonusRequest,
@@ -158,11 +159,10 @@ export interface ILoanOfferingsBusinessApi {
158
159
 
159
160
  /**
160
161
  * POST /private/segments/resolve — los segmentos a los que pertenece el cliente HOY, evaluados
161
- * en línea contra los hechos que manda el caller. No hay segmento persistido en el cliente.
162
+ * en línea con sus cohorts. No hay segmento persistido en el cliente.
162
163
  *
163
- * Los hechos los junta quien ya tiene al cliente delante; este lambda no sale a buscarlos a
164
- * otro silo. Un hecho AUSENTE hace que su filtro NO se cumpla: sin el dato no se puede afirmar
165
- * que el cliente califica, y de las dos salidas la segura es dejarlo fuera.
164
+ * Los datos del cliente son opcionales: si el caller no los manda, loan-offerings los pide a
165
+ * loan-credit. Un dato ausente hace que su condición no se cumpla.
166
166
  *
167
167
  * `segmentIds` puede venir VACÍO y eso no es un error: significa que el cliente está en
168
168
  * Estándar, el catch-all, que nunca se devuelve aquí.
@@ -249,12 +249,29 @@ export interface ILoanOfferingsBusinessApi {
249
249
  *
250
250
  * @throws `400 SEGMENT_MEMBERS_BATCH_TOO_LARGE` si el lote pasa de 100 ids.
251
251
  * @throws `400 UNKNOWN_TENANT` si el `tenantId` viene ausente o desconocido.
252
+ * @deprecated Solo cruza la lista manual del segmento, no evalúa cohorts. Usar
253
+ * {@link resolveSegmentMembers}.
252
254
  */
253
255
  getSegmentMembers(
254
256
  retailCustomerIds: string[],
255
257
  tenantId: string,
256
258
  ): Promise<StandardResponse<SegmentMembersResponse>>;
257
259
 
260
+ /**
261
+ * `POST /private/segments/members` — pertenencia a segmentos EN LOTE, evaluando cohorts y lista
262
+ * manual igual que el resolve. Hasta 100 clientes; cada uno viaja con sus datos si el caller
263
+ * los tiene.
264
+ *
265
+ * Devuelve una fila por cada cliente pedido, en el mismo orden.
266
+ *
267
+ * @throws `400` si el lote viene vacío, pasa de 100 o un dato tiene el tipo equivocado.
268
+ * @throws `400 UNKNOWN_TENANT` si el `tenantId` viene ausente o desconocido.
269
+ */
270
+ resolveSegmentMembers(
271
+ input: ResolveSegmentMembersRequest,
272
+ tenantId: string,
273
+ ): Promise<StandardResponse<SegmentMembersResponse>>;
274
+
258
275
  /**
259
276
  * `GET /private/segments` — catálogo de segmentos del silo, sin miembros; el catch-all viaja con `isDefault: true`.
260
277
  * Sin `status` devuelve todos los estados.