@fiado/api-invoker 5.63.0 → 5.64.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.
@@ -2,6 +2,7 @@ import type { IHttpRequest } from "@fiado/http-client";
2
2
  import { StandardResponse } from "@fiado/gateway-adapter";
3
3
  import { ActivationCheckRequest, ActivationCheckResponse, LoanBorrowerResponse, LoanCreditResponse, OriginateLoanCreditRequest, OriginateLoanCreditResponse, QuoteLoanCreditRequest, QuoteLoanCreditResponse, SignLoanCreditRequest, SignLoanCreditResponse, UpsertLoanBorrowerRequest } from "@fiado/type-kit/bin/loanCredit/index.js";
4
4
  import { LoanCreditAnalyticsBatchRequest, LoanCreditAnalyticsBatchResponse } from "./dtos/LoanCreditAnalyticsBatch.js";
5
+ import { CustomerCreditHistoryResponse } from "./dtos/CustomerCreditHistory.js";
5
6
  import { ILoanCreditBusinessApi } from "./interfaces/ILoanCreditBusinessApi.js";
6
7
  /**
7
8
  * Publisher HTTP del lambda `loan-credit-business` (componente 09 SureKeep F2 — motor de crédito).
@@ -26,6 +27,7 @@ export default class LoanCreditBusinessApi implements ILoanCreditBusinessApi {
26
27
  discard(creditId: string, tenantId: string): Promise<StandardResponse<LoanCreditResponse>>;
27
28
  getCredit(creditId: string, tenantId: string): Promise<StandardResponse<LoanCreditResponse>>;
28
29
  getBorrowerByRetailCustomer(retailCustomerId: string, tenantId: string): Promise<StandardResponse<LoanBorrowerResponse>>;
30
+ getCustomerCreditHistory(retailCustomerId: string, tenantId: string): Promise<StandardResponse<CustomerCreditHistoryResponse>>;
29
31
  batchGetCreditAnalytics(input: LoanCreditAnalyticsBatchRequest, tenantId: string): Promise<StandardResponse<LoanCreditAnalyticsBatchResponse>>;
30
32
  upsertBorrower(input: UpsertLoanBorrowerRequest, tenantId: string): Promise<StandardResponse<LoanBorrowerResponse>>;
31
33
  }
@@ -58,6 +58,10 @@ let LoanCreditBusinessApi = class LoanCreditBusinessApi {
58
58
  const url = `${this.baseUrl}/private/borrowers/by-retail-customer/${encodeURIComponent(retailCustomerId)}?tenantId=${encodeURIComponent(tenantId)}`;
59
59
  return await this.httpRequest.get(url);
60
60
  }
61
+ async getCustomerCreditHistory(retailCustomerId, tenantId) {
62
+ const url = `${this.baseUrl}/private/borrowers/by-retail-customer/${encodeURIComponent(retailCustomerId)}/credit-history?tenantId=${encodeURIComponent(tenantId)}`;
63
+ return await this.httpRequest.get(url);
64
+ }
61
65
  async batchGetCreditAnalytics(input, tenantId) {
62
66
  const url = `${this.baseUrl}/private/credits/analytics?tenantId=${encodeURIComponent(tenantId)}`;
63
67
  return await this.httpRequest.post(url, input);
@@ -0,0 +1,13 @@
1
+ /**
2
+ * Respuesta de `GET /private/borrowers/by-retail-customer/{retailCustomerId}/credit-history`.
3
+ * Historial crediticio agregado del acreditado. CERO PII — solo la FK al cliente retail y cifras.
4
+ */
5
+ export interface CustomerCreditHistoryResponse {
6
+ retailCustomerId: string;
7
+ /**
8
+ * Peor atraso VIGENTE, en días, entre las cuotas vencidas en los últimos 180 días.
9
+ * `null` = el acreditado no tiene ninguna cuota fechada en la ventana (hecho ausente);
10
+ * `0` = tiene cuotas en la ventana y ninguna vencida impaga. NO son lo mismo.
11
+ */
12
+ delinquencyDaysLast6M: number | null;
13
+ }
@@ -0,0 +1 @@
1
+ export {};
@@ -1,6 +1,7 @@
1
1
  import { StandardResponse } from "@fiado/gateway-adapter";
2
2
  import { ActivationCheckRequest, ActivationCheckResponse, LoanBorrowerResponse, LoanCreditResponse, OriginateLoanCreditRequest, OriginateLoanCreditResponse, QuoteLoanCreditRequest, QuoteLoanCreditResponse, SignLoanCreditRequest, SignLoanCreditResponse, UpsertLoanBorrowerRequest } from "@fiado/type-kit/bin/loanCredit/index.js";
3
3
  import { LoanCreditAnalyticsBatchRequest, LoanCreditAnalyticsBatchResponse } from "../dtos/LoanCreditAnalyticsBatch.js";
4
+ import { CustomerCreditHistoryResponse } from "../dtos/CustomerCreditHistory.js";
4
5
  /**
5
6
  * Contrato del publisher de `loan-credit-business` (componente 09 SureKeep F2 — motor de crédito
6
7
  * SOFOM, pista Loan). Endpoints PRIVADOS (VPC) consumidos por `retail-wizard-business` (pasos
@@ -57,6 +58,14 @@ export interface ILoanCreditBusinessApi {
57
58
  * `404 BORROWER_NOT_FOUND` si el evento KYC aún no lo hidrató.
58
59
  */
59
60
  getBorrowerByRetailCustomer(retailCustomerId: string, tenantId: string): Promise<StandardResponse<LoanBorrowerResponse>>;
61
+ /**
62
+ * Historial crediticio agregado del acreditado, resuelto por su FK al cliente retail. Hoy
63
+ * devuelve el peor atraso VIGENTE en la ventana de 180 días — `null` cuando el acreditado no
64
+ * tiene ninguna cuota fechada en esa ventana, `0` cuando las tiene y ninguna está vencida
65
+ * impaga. Ese `null` es «hecho ausente», nunca se colapsa a `0`.
66
+ * `404 BORROWER_NOT_FOUND` si el evento KYC aún no hidrató al acreditado.
67
+ */
68
+ getCustomerCreditHistory(retailCustomerId: string, tenantId: string): Promise<StandardResponse<CustomerCreditHistoryResponse>>;
60
69
  /**
61
70
  * Lee créditos EN LOTE por su id y devuelve solo lo que se cuenta: el eje de riesgo congelado
62
71
  * al originar, el plan, las cifras del enganche, el estado, las fechas de originación y
@@ -1,3 +1,4 @@
1
+ export * from "./api/dtos/CustomerCreditHistory.js";
1
2
  export * from "./api/dtos/LoanCreditAnalyticsBatch.js";
2
3
  export * from "./api/interfaces/ILoanCreditBusinessApi.js";
3
4
  export { default as LoanCreditBusinessApi } from "./api/LoanCreditBusinessApi.js";
@@ -1,3 +1,4 @@
1
+ export * from "./api/dtos/CustomerCreditHistory.js";
1
2
  export * from "./api/dtos/LoanCreditAnalyticsBatch.js";
2
3
  export * from "./api/interfaces/ILoanCreditBusinessApi.js";
3
4
  export { default as LoanCreditBusinessApi } from "./api/LoanCreditBusinessApi.js";
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@fiado/api-invoker",
3
- "version": "5.63.0",
3
+ "version": "5.64.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",
@@ -18,6 +18,7 @@ import {
18
18
  LoanCreditAnalyticsBatchRequest,
19
19
  LoanCreditAnalyticsBatchResponse,
20
20
  } from "./dtos/LoanCreditAnalyticsBatch.js";
21
+ import { CustomerCreditHistoryResponse } from "./dtos/CustomerCreditHistory.js";
21
22
  import { ILoanCreditBusinessApi } from "./interfaces/ILoanCreditBusinessApi.js";
22
23
 
23
24
  /**
@@ -98,6 +99,14 @@ export default class LoanCreditBusinessApi implements ILoanCreditBusinessApi {
98
99
  return await this.httpRequest.get(url);
99
100
  }
100
101
 
102
+ async getCustomerCreditHistory(
103
+ retailCustomerId: string,
104
+ tenantId: string,
105
+ ): Promise<StandardResponse<CustomerCreditHistoryResponse>> {
106
+ const url = `${this.baseUrl}/private/borrowers/by-retail-customer/${encodeURIComponent(retailCustomerId)}/credit-history?tenantId=${encodeURIComponent(tenantId)}`;
107
+ return await this.httpRequest.get(url);
108
+ }
109
+
101
110
  async batchGetCreditAnalytics(
102
111
  input: LoanCreditAnalyticsBatchRequest,
103
112
  tenantId: string,
@@ -0,0 +1,13 @@
1
+ /**
2
+ * Respuesta de `GET /private/borrowers/by-retail-customer/{retailCustomerId}/credit-history`.
3
+ * Historial crediticio agregado del acreditado. CERO PII — solo la FK al cliente retail y cifras.
4
+ */
5
+ export interface CustomerCreditHistoryResponse {
6
+ retailCustomerId: string;
7
+ /**
8
+ * Peor atraso VIGENTE, en días, entre las cuotas vencidas en los últimos 180 días.
9
+ * `null` = el acreditado no tiene ninguna cuota fechada en la ventana (hecho ausente);
10
+ * `0` = tiene cuotas en la ventana y ninguna vencida impaga. NO son lo mismo.
11
+ */
12
+ delinquencyDaysLast6M: number | null;
13
+ }
@@ -16,6 +16,7 @@ import {
16
16
  LoanCreditAnalyticsBatchRequest,
17
17
  LoanCreditAnalyticsBatchResponse,
18
18
  } from "../dtos/LoanCreditAnalyticsBatch.js";
19
+ import { CustomerCreditHistoryResponse } from "../dtos/CustomerCreditHistory.js";
19
20
 
20
21
  /**
21
22
  * Contrato del publisher de `loan-credit-business` (componente 09 SureKeep F2 — motor de crédito
@@ -104,6 +105,18 @@ export interface ILoanCreditBusinessApi {
104
105
  tenantId: string,
105
106
  ): Promise<StandardResponse<LoanBorrowerResponse>>;
106
107
 
108
+ /**
109
+ * Historial crediticio agregado del acreditado, resuelto por su FK al cliente retail. Hoy
110
+ * devuelve el peor atraso VIGENTE en la ventana de 180 días — `null` cuando el acreditado no
111
+ * tiene ninguna cuota fechada en esa ventana, `0` cuando las tiene y ninguna está vencida
112
+ * impaga. Ese `null` es «hecho ausente», nunca se colapsa a `0`.
113
+ * `404 BORROWER_NOT_FOUND` si el evento KYC aún no hidrató al acreditado.
114
+ */
115
+ getCustomerCreditHistory(
116
+ retailCustomerId: string,
117
+ tenantId: string,
118
+ ): Promise<StandardResponse<CustomerCreditHistoryResponse>>;
119
+
107
120
  /**
108
121
  * Lee créditos EN LOTE por su id y devuelve solo lo que se cuenta: el eje de riesgo congelado
109
122
  * al originar, el plan, las cifras del enganche, el estado, las fechas de originación y
@@ -1,3 +1,4 @@
1
+ export * from "./api/dtos/CustomerCreditHistory.js";
1
2
  export * from "./api/dtos/LoanCreditAnalyticsBatch.js";
2
3
  export * from "./api/interfaces/ILoanCreditBusinessApi.js";
3
4
  export { default as LoanCreditBusinessApi } from "./api/LoanCreditBusinessApi.js";