@fiado/api-invoker 5.116.0 → 5.118.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.
@@ -74,6 +74,7 @@ import { EventHistoryApi } from "./event-history-business/index.js";
74
74
  import ReportProcessorBusinessApi from "./report-processor-business/api/ReportProcessorBusinessApi.js";
75
75
  import NotificationWSMessagePublisher from "./notificationWebsockets/queue/NotificationWSMessagePublisher.js";
76
76
  import PeopleBusinessApi from "./people-business/api/PeopleBusinessApi.js";
77
+ import DatalakeReportsApi from "./datalake-reports-business/api/DatalakeReportsApi.js";
77
78
  import PlacesBusinessApi from "./places-business/api/PlacesBusinessApi.js";
78
79
  import STPBusinessApi from "./stp-business/api/STPBusinessApi.js";
79
80
  import MulticommServicePaymentApi from "./multicommServicePayment/api/MulticommServicePaymentApi.js";
@@ -225,6 +226,7 @@ export const apiInvokerBindings = new ContainerModule(({ bind }) => {
225
226
  bind("IEventHistoryApi").to(EventHistoryApi);
226
227
  bind("IReportProcessorBusinessApi").to(ReportProcessorBusinessApi);
227
228
  bind("IPeopleBusinessApi").to(PeopleBusinessApi);
229
+ bind("IDatalakeReportsApi").to(DatalakeReportsApi);
228
230
  bind("IPlacesBusinessApi").to(PlacesBusinessApi);
229
231
  bind("ISTPBusinessApi").to(STPBusinessApi);
230
232
  bind("IProductPaymentApi").to(ProductPaymentApi);
@@ -0,0 +1,13 @@
1
+ import type { IHttpRequest } from "@fiado/http-client";
2
+ import { DatalakeReportDefinition, DatalakeReportResult, IDatalakeReportsApi } from "./interfaces/IDatalakeReportsApi.js";
3
+ type FiadoApiResponse<T> = import("@fiado/type-kit/bin/apiResponse/dtos/FiadoApiResponse.js").default<T>;
4
+ export default class DatalakeReportsApi implements IDatalakeReportsApi {
5
+ private httpRequest;
6
+ private readonly baseUrl;
7
+ constructor(httpRequest: IHttpRequest);
8
+ listReports(): Promise<FiadoApiResponse<DatalakeReportDefinition[]>>;
9
+ getReport(id: string): Promise<FiadoApiResponse<DatalakeReportDefinition>>;
10
+ runReport(id: string, params: Record<string, unknown>): Promise<FiadoApiResponse<DatalakeReportResult>>;
11
+ getJob(jobId: string, nextToken?: string): Promise<FiadoApiResponse<DatalakeReportResult>>;
12
+ }
13
+ export {};
@@ -0,0 +1,39 @@
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 DatalakeReportsApi = class DatalakeReportsApi {
15
+ httpRequest;
16
+ baseUrl = process.env.DATALAKE_REPORTS_BUSINESS_LAMBDA_URL || "";
17
+ constructor(httpRequest) {
18
+ this.httpRequest = httpRequest;
19
+ }
20
+ listReports() {
21
+ return this.httpRequest.get(`${this.baseUrl}private/reports`);
22
+ }
23
+ getReport(id) {
24
+ return this.httpRequest.get(`${this.baseUrl}private/reports/${encodeURIComponent(id)}`);
25
+ }
26
+ runReport(id, params) {
27
+ return this.httpRequest.post(`${this.baseUrl}private/reports/${encodeURIComponent(id)}/run`, { params });
28
+ }
29
+ getJob(jobId, nextToken) {
30
+ const qs = nextToken ? `?nextToken=${encodeURIComponent(nextToken)}` : "";
31
+ return this.httpRequest.get(`${this.baseUrl}private/reports/jobs/${encodeURIComponent(jobId)}${qs}`);
32
+ }
33
+ };
34
+ DatalakeReportsApi = __decorate([
35
+ injectable(),
36
+ __param(0, inject("IHttpRequest")),
37
+ __metadata("design:paramtypes", [Object])
38
+ ], DatalakeReportsApi);
39
+ export default DatalakeReportsApi;
@@ -0,0 +1,58 @@
1
+ type FiadoApiResponse<T> = import("@fiado/type-kit/bin/apiResponse/dtos/FiadoApiResponse.js").default<T>;
2
+ /** Contrato local hasta que @fiado/type-kit publique el dominio DatalakeReports (misma forma). */
3
+ export interface DatalakeReportDefinition {
4
+ id: string;
5
+ version: number;
6
+ title: string;
7
+ description: string;
8
+ source: {
9
+ layer: "gold" | "silver";
10
+ databases: string[];
11
+ };
12
+ pii: boolean;
13
+ audiences: string[];
14
+ permission: string;
15
+ mode: "sync" | "async";
16
+ cacheSeconds: number;
17
+ params: Record<string, {
18
+ type: string;
19
+ required?: boolean;
20
+ default?: unknown;
21
+ values?: string[];
22
+ max?: number;
23
+ min?: number;
24
+ }>;
25
+ principalParams: string[];
26
+ columns: Array<{
27
+ name: string;
28
+ type: string;
29
+ label: string;
30
+ }>;
31
+ }
32
+ export interface DatalakeReportResult {
33
+ status: "RUNNING" | "DONE" | "FAILED";
34
+ reportId?: string;
35
+ version?: number;
36
+ jobId: string;
37
+ columns?: Array<{
38
+ name: string;
39
+ type: string;
40
+ label: string;
41
+ }>;
42
+ rows?: Array<Record<string, string | number | boolean | null>>;
43
+ rowCount?: number;
44
+ nextToken?: string;
45
+ computedAt?: string;
46
+ fromCache?: boolean;
47
+ bytesScanned?: number;
48
+ reason?: string;
49
+ }
50
+ /** Canal privado de datalake-reports-business (reportes predefinidos sobre Gold y Silver). */
51
+ export interface IDatalakeReportsApi {
52
+ listReports(): Promise<FiadoApiResponse<DatalakeReportDefinition[]>>;
53
+ getReport(id: string): Promise<FiadoApiResponse<DatalakeReportDefinition>>;
54
+ /** 200 con filas, o 200 con status RUNNING y jobId si la corrida cae a asíncrono. */
55
+ runReport(id: string, params: Record<string, unknown>): Promise<FiadoApiResponse<DatalakeReportResult>>;
56
+ getJob(jobId: string, nextToken?: string): Promise<FiadoApiResponse<DatalakeReportResult>>;
57
+ }
58
+ export {};
@@ -0,0 +1,2 @@
1
+ export * from './api/DatalakeReportsApi.js';
2
+ export * from './api/interfaces/IDatalakeReportsApi.js';
@@ -0,0 +1,2 @@
1
+ export * from './api/DatalakeReportsApi.js';
2
+ export * from './api/interfaces/IDatalakeReportsApi.js';
package/bin/index.d.ts CHANGED
@@ -65,6 +65,7 @@ export * from "./event-history-business/index.js";
65
65
  export * from "./report-processor-business/index.js";
66
66
  export * from "./notificationWebsockets/index.js";
67
67
  export * from "./people-business/index.js";
68
+ export * from "./datalake-reports-business/index.js";
68
69
  export * from "./places-business/index.js";
69
70
  export * from "./stp-business/index.js";
70
71
  export * from "./multicommServicePayment/index.js";
package/bin/index.js CHANGED
@@ -65,6 +65,7 @@ export * from "./event-history-business/index.js";
65
65
  export * from "./report-processor-business/index.js";
66
66
  export * from "./notificationWebsockets/index.js";
67
67
  export * from "./people-business/index.js";
68
+ export * from "./datalake-reports-business/index.js";
68
69
  export * from "./places-business/index.js";
69
70
  export * from "./stp-business/index.js";
70
71
  export * from "./multicommServicePayment/index.js";
@@ -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, CreditPaymentAppliedRequest, CreditPaymentAppliedResponse, CreditSettledRequest, CreditSettledResponse, LoanBorrowerResponse, ListMessagingCandidatesRequest, ListMessagingCandidatesResponse, LoanCreditResponse, OriginateLoanCreditRequest, OriginateLoanCreditResponse, QuoteLoanCreditRequest, QuoteLoanCreditResponse, SignLoanCreditRequest, SignLoanCreditResponse, UpsertLoanBorrowerRequest, LoanBorrowerCreditItem, LoanContractDownloadUrl, LoanContractResponse, LoanCreditDetail, LoanInstallmentResponse, LoanPaymentListResponse, CreateCustomerPaymentRequest, LoanCustomerPaymentOptions, LoanCustomerPaymentResult } from "@fiado/type-kit/bin/loanCredit/index.js";
3
+ import { ActivationCheckRequest, ActivationCheckResponse, CreditPaymentAppliedRequest, CreditPaymentAppliedResponse, CreditSettledRequest, CreditSettledResponse, LoanBorrowerResponse, ListMessagingCandidatesRequest, ListMessagingCandidatesResponse, LoanCreditResponse, OriginateLoanCreditRequest, OriginateLoanCreditResponse, QuoteLoanCreditRequest, QuoteLoanCreditResponse, SignLoanCreditRequest, SignLoanCreditResponse, UpdateLoanBorrowerSciRequest, UpsertLoanBorrowerRequest, LoanBorrowerCreditItem, LoanContractDownloadUrl, LoanContractResponse, LoanCreditDetail, LoanInstallmentResponse, LoanPaymentListResponse, CreateCustomerPaymentRequest, LoanCustomerPaymentOptions, LoanCustomerPaymentResult } 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 { CustomerCreditHistoryResponse } from "./dtos/CustomerCreditHistory.js";
@@ -35,6 +35,7 @@ export default class LoanCreditBusinessApi implements ILoanCreditBusinessApi {
35
35
  batchGetCreditAnalytics(input: LoanCreditAnalyticsBatchRequest, tenantId: string): Promise<StandardResponse<LoanCreditAnalyticsBatchResponse>>;
36
36
  batchGetCreditSummaries(input: CreditSummariesBatchRequest, tenantId: string): Promise<StandardResponse<CreditSummariesBatchResponse>>;
37
37
  upsertBorrower(input: UpsertLoanBorrowerRequest, tenantId: string): Promise<StandardResponse<LoanBorrowerResponse>>;
38
+ updateBorrowerSci(borrowerId: string, input: UpdateLoanBorrowerSciRequest, tenantId: string): Promise<StandardResponse<LoanBorrowerResponse>>;
38
39
  notifyLifecycleFact(creditId: string, input: CreditLifecycleFactRequest, tenantId: string): Promise<StandardResponse<CreditLifecycleFactResponse>>;
39
40
  listMessagingCandidates(input: ListMessagingCandidatesRequest, tenantId: string): Promise<StandardResponse<ListMessagingCandidatesResponse>>;
40
41
  private customerCreditsUrl;
@@ -11,6 +11,11 @@ var __param = (this && this.__param) || function (paramIndex, decorator) {
11
11
  return function (target, key) { decorator(target, key, paramIndex); }
12
12
  };
13
13
  import { inject, injectable } from "inversify";
14
+ /**
15
+ * Tope de `updateBorrowerSci`: se llama al final de una evaluación SCI, dentro del Lambda de
16
+ * scoring. Si loan-credit tarda más, la evaluación termina igual y el nivel llega en la próxima.
17
+ */
18
+ const BORROWER_SCI_TIMEOUT_MS = 2000;
14
19
  /**
15
20
  * Publisher HTTP del lambda `loan-credit-business` (componente 09 SureKeep F2 — motor de crédito).
16
21
  * Contrato y semántica completos → `ILoanCreditBusinessApi` (tenantId obligatorio,
@@ -82,6 +87,10 @@ let LoanCreditBusinessApi = class LoanCreditBusinessApi {
82
87
  const url = `${this.baseUrl}/private/borrowers?tenantId=${encodeURIComponent(tenantId)}`;
83
88
  return await this.httpRequest.post(url, input);
84
89
  }
90
+ async updateBorrowerSci(borrowerId, input, tenantId) {
91
+ const url = `${this.baseUrl}/private/borrowers/${encodeURIComponent(borrowerId)}/sci?tenantId=${encodeURIComponent(tenantId)}`;
92
+ return await this.httpRequest.put(url, input, {}, undefined, false, { timeout: BORROWER_SCI_TIMEOUT_MS });
93
+ }
85
94
  async notifyLifecycleFact(creditId, input, tenantId) {
86
95
  const url = `${this.baseUrl}/private/credits/${encodeURIComponent(creditId)}/lifecycle-facts?tenantId=${encodeURIComponent(tenantId)}`;
87
96
  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, LoanBorrowerResponse, ListMessagingCandidatesRequest, ListMessagingCandidatesResponse, LoanCreditResponse, OriginateLoanCreditRequest, OriginateLoanCreditResponse, QuoteLoanCreditRequest, QuoteLoanCreditResponse, SignLoanCreditRequest, SignLoanCreditResponse, UpsertLoanBorrowerRequest, LoanBorrowerCreditItem, LoanContractDownloadUrl, LoanContractResponse, LoanCreditDetail, LoanInstallmentResponse, LoanPaymentListResponse, CreateCustomerPaymentRequest, LoanCustomerPaymentOptions, LoanCustomerPaymentResult } from "@fiado/type-kit/bin/loanCredit/index.js";
2
+ import { ActivationCheckRequest, CreditPaymentAppliedRequest, CreditPaymentAppliedResponse, CreditSettledRequest, CreditSettledResponse, ActivationCheckResponse, LoanBorrowerResponse, ListMessagingCandidatesRequest, ListMessagingCandidatesResponse, LoanCreditResponse, OriginateLoanCreditRequest, OriginateLoanCreditResponse, QuoteLoanCreditRequest, QuoteLoanCreditResponse, SignLoanCreditRequest, SignLoanCreditResponse, UpdateLoanBorrowerSciRequest, UpsertLoanBorrowerRequest, LoanBorrowerCreditItem, LoanContractDownloadUrl, LoanContractResponse, LoanCreditDetail, LoanInstallmentResponse, LoanPaymentListResponse, CreateCustomerPaymentRequest, LoanCustomerPaymentOptions, LoanCustomerPaymentResult } 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 { CustomerCreditHistoryResponse } from "../dtos/CustomerCreditHistory.js";
@@ -103,6 +103,12 @@ export interface ILoanCreditBusinessApi {
103
103
  * del evento `CustomerKycVerifiedV1` — fallback operativo mientras la cola no exista).
104
104
  */
105
105
  upsertBorrower(input: UpsertLoanBorrowerRequest, tenantId: string): Promise<StandardResponse<LoanBorrowerResponse>>;
106
+ /**
107
+ * Deja en el acreditado el SCI y el nivel de una evaluación (loan-scoring, al terminarla).
108
+ * Gana la evaluación más reciente: una más vieja que la guardada responde `200` sin cambiar
109
+ * nada. `404 BORROWER_NOT_FOUND` si el acreditado no existe · `400 VALIDATION_ERROR`.
110
+ */
111
+ updateBorrowerSci(borrowerId: string, input: UpdateLoanBorrowerSciRequest, tenantId: string): Promise<StandardResponse<LoanBorrowerResponse>>;
106
112
  /**
107
113
  * Puerta de los hechos del ciclo: el caller nombra el HECHO que ya ocurrió en su propio lambda
108
114
  * (originación, enganche, firma, MDM, bienvenida) y el motor resuelve el momento, la plantilla,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@fiado/api-invoker",
3
- "version": "5.116.0",
3
+ "version": "5.118.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.510.0",
37
+ "@fiado/type-kit": "^3.512.0",
38
38
  "dotenv": "^16.4.7"
39
39
  },
40
40
  "peerDependencies": {
@@ -107,6 +107,8 @@ import { IReportProcessorBusinessApi } from "./report-processor-business/index.j
107
107
  import { INotificationWSMessagesPublisher } from "./notificationWebsockets/index.js";
108
108
  import NotificationWSMessagePublisher from "./notificationWebsockets/queue/NotificationWSMessagePublisher.js";
109
109
  import PeopleBusinessApi from "./people-business/api/PeopleBusinessApi.js";
110
+ import DatalakeReportsApi from "./datalake-reports-business/api/DatalakeReportsApi.js";
111
+ import { IDatalakeReportsApi } from "./datalake-reports-business/index.js";
110
112
  import { IPeopleBusinessApi } from "./people-business/index.js";
111
113
  import PlacesBusinessApi from "./places-business/api/PlacesBusinessApi.js";
112
114
  import { IPlacesBusinessApi } from "./places-business/index.js";
@@ -297,6 +299,7 @@ export const apiInvokerBindings = new ContainerModule(({ bind }) => {
297
299
  bind<IEventHistoryApi>("IEventHistoryApi").to(EventHistoryApi);
298
300
  bind<IReportProcessorBusinessApi>("IReportProcessorBusinessApi").to(ReportProcessorBusinessApi);
299
301
  bind<IPeopleBusinessApi>("IPeopleBusinessApi").to(PeopleBusinessApi);
302
+ bind<IDatalakeReportsApi>("IDatalakeReportsApi").to(DatalakeReportsApi);
300
303
  bind<IPlacesBusinessApi>("IPlacesBusinessApi").to(PlacesBusinessApi);
301
304
  bind<ISTPBusinessApi>("ISTPBusinessApi").to(STPBusinessApi);
302
305
  bind<IProductPaymentApi>("IProductPaymentApi").to(ProductPaymentApi);
@@ -0,0 +1,30 @@
1
+ import { inject, injectable } from "inversify";
2
+ import type { IHttpRequest } from "@fiado/http-client";
3
+ import { DatalakeReportDefinition, DatalakeReportResult, IDatalakeReportsApi } from "./interfaces/IDatalakeReportsApi.js";
4
+ type FiadoApiResponse<T> = import("@fiado/type-kit/bin/apiResponse/dtos/FiadoApiResponse.js").default<T>;
5
+
6
+ @injectable()
7
+ export default class DatalakeReportsApi implements IDatalakeReportsApi {
8
+
9
+ private readonly baseUrl = process.env.DATALAKE_REPORTS_BUSINESS_LAMBDA_URL || "";
10
+
11
+ constructor(@inject("IHttpRequest") private httpRequest: IHttpRequest) {
12
+ }
13
+
14
+ listReports(): Promise<FiadoApiResponse<DatalakeReportDefinition[]>> {
15
+ return this.httpRequest.get(`${this.baseUrl}private/reports`);
16
+ }
17
+
18
+ getReport(id: string): Promise<FiadoApiResponse<DatalakeReportDefinition>> {
19
+ return this.httpRequest.get(`${this.baseUrl}private/reports/${encodeURIComponent(id)}`);
20
+ }
21
+
22
+ runReport(id: string, params: Record<string, unknown>): Promise<FiadoApiResponse<DatalakeReportResult>> {
23
+ return this.httpRequest.post(`${this.baseUrl}private/reports/${encodeURIComponent(id)}/run`, { params });
24
+ }
25
+
26
+ getJob(jobId: string, nextToken?: string): Promise<FiadoApiResponse<DatalakeReportResult>> {
27
+ const qs = nextToken ? `?nextToken=${encodeURIComponent(nextToken)}` : "";
28
+ return this.httpRequest.get(`${this.baseUrl}private/reports/jobs/${encodeURIComponent(jobId)}${qs}`);
29
+ }
30
+ }
@@ -0,0 +1,27 @@
1
+ type FiadoApiResponse<T> = import("@fiado/type-kit/bin/apiResponse/dtos/FiadoApiResponse.js").default<T>;
2
+
3
+ /** Contrato local hasta que @fiado/type-kit publique el dominio DatalakeReports (misma forma). */
4
+ export interface DatalakeReportDefinition {
5
+ id: string; version: number; title: string; description: string;
6
+ source: { layer: "gold" | "silver"; databases: string[] };
7
+ pii: boolean; audiences: string[]; permission: string; mode: "sync" | "async"; cacheSeconds: number;
8
+ params: Record<string, { type: string; required?: boolean; default?: unknown; values?: string[]; max?: number; min?: number }>;
9
+ principalParams: string[];
10
+ columns: Array<{ name: string; type: string; label: string }>;
11
+ }
12
+ export interface DatalakeReportResult {
13
+ status: "RUNNING" | "DONE" | "FAILED";
14
+ reportId?: string; version?: number; jobId: string;
15
+ columns?: Array<{ name: string; type: string; label: string }>;
16
+ rows?: Array<Record<string, string | number | boolean | null>>;
17
+ rowCount?: number; nextToken?: string; computedAt?: string; fromCache?: boolean; bytesScanned?: number; reason?: string;
18
+ }
19
+
20
+ /** Canal privado de datalake-reports-business (reportes predefinidos sobre Gold y Silver). */
21
+ export interface IDatalakeReportsApi {
22
+ listReports(): Promise<FiadoApiResponse<DatalakeReportDefinition[]>>;
23
+ getReport(id: string): Promise<FiadoApiResponse<DatalakeReportDefinition>>;
24
+ /** 200 con filas, o 200 con status RUNNING y jobId si la corrida cae a asíncrono. */
25
+ runReport(id: string, params: Record<string, unknown>): Promise<FiadoApiResponse<DatalakeReportResult>>;
26
+ getJob(jobId: string, nextToken?: string): Promise<FiadoApiResponse<DatalakeReportResult>>;
27
+ }
@@ -0,0 +1,2 @@
1
+ export * from './api/DatalakeReportsApi.js';
2
+ export * from './api/interfaces/IDatalakeReportsApi.js';
package/src/index.ts CHANGED
@@ -65,6 +65,7 @@ export * from "./event-history-business/index.js";
65
65
  export * from "./report-processor-business/index.js";
66
66
  export * from "./notificationWebsockets/index.js";
67
67
  export * from "./people-business/index.js";
68
+ export * from "./datalake-reports-business/index.js";
68
69
  export * from "./places-business/index.js";
69
70
  export * from "./stp-business/index.js";
70
71
  export * from "./multicommServicePayment/index.js";
@@ -18,6 +18,7 @@ import {
18
18
  QuoteLoanCreditResponse,
19
19
  SignLoanCreditRequest,
20
20
  SignLoanCreditResponse,
21
+ UpdateLoanBorrowerSciRequest,
21
22
  UpsertLoanBorrowerRequest,
22
23
  LoanBorrowerCreditItem,
23
24
  LoanContractDownloadUrl,
@@ -44,6 +45,12 @@ import {
44
45
  } from "./dtos/CreditLifecycleFact.js";
45
46
  import { ILoanCreditBusinessApi } from "./interfaces/ILoanCreditBusinessApi.js";
46
47
 
48
+ /**
49
+ * Tope de `updateBorrowerSci`: se llama al final de una evaluación SCI, dentro del Lambda de
50
+ * scoring. Si loan-credit tarda más, la evaluación termina igual y el nivel llega en la próxima.
51
+ */
52
+ const BORROWER_SCI_TIMEOUT_MS = 2000;
53
+
47
54
  /**
48
55
  * Publisher HTTP del lambda `loan-credit-business` (componente 09 SureKeep F2 — motor de crédito).
49
56
  * Contrato y semántica completos → `ILoanCreditBusinessApi` (tenantId obligatorio,
@@ -172,6 +179,15 @@ export default class LoanCreditBusinessApi implements ILoanCreditBusinessApi {
172
179
  return await this.httpRequest.post(url, input);
173
180
  }
174
181
 
182
+ async updateBorrowerSci(
183
+ borrowerId: string,
184
+ input: UpdateLoanBorrowerSciRequest,
185
+ tenantId: string,
186
+ ): Promise<StandardResponse<LoanBorrowerResponse>> {
187
+ const url = `${this.baseUrl}/private/borrowers/${encodeURIComponent(borrowerId)}/sci?tenantId=${encodeURIComponent(tenantId)}`;
188
+ return await this.httpRequest.put(url, input, {}, undefined, false, { timeout: BORROWER_SCI_TIMEOUT_MS });
189
+ }
190
+
175
191
  async notifyLifecycleFact(
176
192
  creditId: string,
177
193
  input: CreditLifecycleFactRequest,
@@ -16,6 +16,7 @@ import {
16
16
  QuoteLoanCreditResponse,
17
17
  SignLoanCreditRequest,
18
18
  SignLoanCreditResponse,
19
+ UpdateLoanBorrowerSciRequest,
19
20
  UpsertLoanBorrowerRequest,
20
21
  LoanBorrowerCreditItem,
21
22
  LoanContractDownloadUrl,
@@ -197,6 +198,17 @@ export interface ILoanCreditBusinessApi {
197
198
  tenantId: string,
198
199
  ): Promise<StandardResponse<LoanBorrowerResponse>>;
199
200
 
201
+ /**
202
+ * Deja en el acreditado el SCI y el nivel de una evaluación (loan-scoring, al terminarla).
203
+ * Gana la evaluación más reciente: una más vieja que la guardada responde `200` sin cambiar
204
+ * nada. `404 BORROWER_NOT_FOUND` si el acreditado no existe · `400 VALIDATION_ERROR`.
205
+ */
206
+ updateBorrowerSci(
207
+ borrowerId: string,
208
+ input: UpdateLoanBorrowerSciRequest,
209
+ tenantId: string,
210
+ ): Promise<StandardResponse<LoanBorrowerResponse>>;
211
+
200
212
  /**
201
213
  * Puerta de los hechos del ciclo: el caller nombra el HECHO que ya ocurrió en su propio lambda
202
214
  * (originación, enganche, firma, MDM, bienvenida) y el motor resuelve el momento, la plantilla,