@fiado/api-invoker 5.117.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.
@@ -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.117.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": {
@@ -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,