@fiado/api-invoker 5.41.0 → 5.42.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.
- package/bin/loanCredit/api/LoanCreditBusinessApi.d.ts +2 -0
- package/bin/loanCredit/api/LoanCreditBusinessApi.js +4 -0
- package/bin/loanCredit/api/dtos/LoanCreditAnalyticsBatch.d.ts +31 -0
- package/bin/loanCredit/api/dtos/LoanCreditAnalyticsBatch.js +1 -0
- package/bin/loanCredit/api/interfaces/ILoanCreditBusinessApi.d.ts +11 -0
- package/bin/loanCredit/index.d.ts +1 -0
- package/bin/loanCredit/index.js +1 -0
- package/package.json +1 -1
- package/src/loanCredit/api/LoanCreditBusinessApi.ts +12 -0
- package/src/loanCredit/api/dtos/LoanCreditAnalyticsBatch.ts +34 -0
- package/src/loanCredit/api/interfaces/ILoanCreditBusinessApi.ts +18 -0
- package/src/loanCredit/index.ts +1 -0
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
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
|
+
import { LoanCreditAnalyticsBatchRequest, LoanCreditAnalyticsBatchResponse } from "./dtos/LoanCreditAnalyticsBatch.js";
|
|
4
5
|
import { ILoanCreditBusinessApi } from "./interfaces/ILoanCreditBusinessApi.js";
|
|
5
6
|
/**
|
|
6
7
|
* Publisher HTTP del lambda `loan-credit-business` (componente 09 SureKeep F2 — motor de crédito).
|
|
@@ -25,5 +26,6 @@ export default class LoanCreditBusinessApi implements ILoanCreditBusinessApi {
|
|
|
25
26
|
discard(creditId: string, tenantId: string): Promise<StandardResponse<LoanCreditResponse>>;
|
|
26
27
|
getCredit(creditId: string, tenantId: string): Promise<StandardResponse<LoanCreditResponse>>;
|
|
27
28
|
getBorrowerByRetailCustomer(retailCustomerId: string, tenantId: string): Promise<StandardResponse<LoanBorrowerResponse>>;
|
|
29
|
+
batchGetCreditAnalytics(input: LoanCreditAnalyticsBatchRequest, tenantId: string): Promise<StandardResponse<LoanCreditAnalyticsBatchResponse>>;
|
|
28
30
|
upsertBorrower(input: UpsertLoanBorrowerRequest, tenantId: string): Promise<StandardResponse<LoanBorrowerResponse>>;
|
|
29
31
|
}
|
|
@@ -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 batchGetCreditAnalytics(input, tenantId) {
|
|
62
|
+
const url = `${this.baseUrl}/private/credits/analytics?tenantId=${encodeURIComponent(tenantId)}`;
|
|
63
|
+
return await this.httpRequest.post(url, input);
|
|
64
|
+
}
|
|
61
65
|
async upsertBorrower(input, tenantId) {
|
|
62
66
|
const url = `${this.baseUrl}/private/borrowers?tenantId=${encodeURIComponent(tenantId)}`;
|
|
63
67
|
return await this.httpRequest.post(url, input);
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
import { LoanCreditStatusEnum } from "@fiado/type-kit/bin/loanCredit/index.js";
|
|
2
|
+
import { ClientLevelEnum } from "@fiado/type-kit/bin/loanScoring/index.js";
|
|
3
|
+
/** Body de `POST /private/credits/analytics`. Hasta 500 ids por request; el caller pagina. */
|
|
4
|
+
export interface LoanCreditAnalyticsBatchRequest {
|
|
5
|
+
creditIds: string[];
|
|
6
|
+
}
|
|
7
|
+
/**
|
|
8
|
+
* Lo mínimo de un crédito para contar: eje de riesgo, plan, cifras del enganche, estado y fecha.
|
|
9
|
+
* CERO PII — ni acreditado, ni nombre, ni teléfono.
|
|
10
|
+
*/
|
|
11
|
+
export interface LoanCreditAnalyticsItem {
|
|
12
|
+
creditId: string;
|
|
13
|
+
/** Nivel CONGELADO al originar; ausente en los créditos que se originaron sin SCI. */
|
|
14
|
+
clientLevelAtOrigination?: ClientLevelEnum;
|
|
15
|
+
/** Score CONGELADO al originar; ausente en los créditos que se originaron sin SCI. */
|
|
16
|
+
sciAtOrigination?: number;
|
|
17
|
+
/** Plan comercial con el que se originó. Es lo que distingue una venta a empleado. */
|
|
18
|
+
planId: string;
|
|
19
|
+
equipmentPriceCents: number;
|
|
20
|
+
downPaymentCents: number;
|
|
21
|
+
status: LoanCreditStatusEnum;
|
|
22
|
+
createdAt: string;
|
|
23
|
+
}
|
|
24
|
+
/**
|
|
25
|
+
* Los ids que no existen simplemente no vuelven; los que DynamoDB no alcanzó a leer salen
|
|
26
|
+
* NOMBRADOS para que el caller no los cuente como cero.
|
|
27
|
+
*/
|
|
28
|
+
export interface LoanCreditAnalyticsBatchResponse {
|
|
29
|
+
items: LoanCreditAnalyticsItem[];
|
|
30
|
+
unresolvedCreditIds: string[];
|
|
31
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -1,5 +1,6 @@
|
|
|
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
|
+
import { LoanCreditAnalyticsBatchRequest, LoanCreditAnalyticsBatchResponse } from "../dtos/LoanCreditAnalyticsBatch.js";
|
|
3
4
|
/**
|
|
4
5
|
* Contrato del publisher de `loan-credit-business` (componente 09 SureKeep F2 — motor de crédito
|
|
5
6
|
* SOFOM, pista Loan). Endpoints PRIVADOS (VPC) consumidos por `retail-wizard-business` (pasos
|
|
@@ -56,6 +57,16 @@ export interface ILoanCreditBusinessApi {
|
|
|
56
57
|
* `404 BORROWER_NOT_FOUND` si el evento KYC aún no lo hidrató.
|
|
57
58
|
*/
|
|
58
59
|
getBorrowerByRetailCustomer(retailCustomerId: string, tenantId: string): Promise<StandardResponse<LoanBorrowerResponse>>;
|
|
60
|
+
/**
|
|
61
|
+
* Lee créditos EN LOTE por su id y devuelve solo lo que se cuenta: el eje de riesgo congelado
|
|
62
|
+
* al originar, el plan, las cifras del enganche, el estado y la fecha. **Cero PII.**
|
|
63
|
+
*
|
|
64
|
+
* Se resuelve por BatchGetItem sobre la clave primaria, así que el orden de salida NO es el de
|
|
65
|
+
* entrada. Un id que no existe no vuelve; uno que DynamoDB no alcanzó a leer vuelve nombrado en
|
|
66
|
+
* `unresolvedCreditIds` — nunca se confunde «no pude leerlo» con «no existe».
|
|
67
|
+
* `400 VALIDATION_ERROR` si el lote pasa de 500 ids o trae uno que no es ULID.
|
|
68
|
+
*/
|
|
69
|
+
batchGetCreditAnalytics(input: LoanCreditAnalyticsBatchRequest, tenantId: string): Promise<StandardResponse<LoanCreditAnalyticsBatchResponse>>;
|
|
59
70
|
/**
|
|
60
71
|
* Upsert idempotente del acreditado por `retailCustomerId` (mismo contrato que el consumidor
|
|
61
72
|
* del evento `CustomerKycVerifiedV1` — fallback operativo mientras la cola no exista).
|
package/bin/loanCredit/index.js
CHANGED
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@fiado/api-invoker",
|
|
3
|
-
"version": "5.
|
|
3
|
+
"version": "5.42.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",
|
|
@@ -14,6 +14,10 @@ import {
|
|
|
14
14
|
SignLoanCreditResponse,
|
|
15
15
|
UpsertLoanBorrowerRequest,
|
|
16
16
|
} from "@fiado/type-kit/bin/loanCredit/index.js";
|
|
17
|
+
import {
|
|
18
|
+
LoanCreditAnalyticsBatchRequest,
|
|
19
|
+
LoanCreditAnalyticsBatchResponse,
|
|
20
|
+
} from "./dtos/LoanCreditAnalyticsBatch.js";
|
|
17
21
|
import { ILoanCreditBusinessApi } from "./interfaces/ILoanCreditBusinessApi.js";
|
|
18
22
|
|
|
19
23
|
/**
|
|
@@ -94,6 +98,14 @@ export default class LoanCreditBusinessApi implements ILoanCreditBusinessApi {
|
|
|
94
98
|
return await this.httpRequest.get(url);
|
|
95
99
|
}
|
|
96
100
|
|
|
101
|
+
async batchGetCreditAnalytics(
|
|
102
|
+
input: LoanCreditAnalyticsBatchRequest,
|
|
103
|
+
tenantId: string,
|
|
104
|
+
): Promise<StandardResponse<LoanCreditAnalyticsBatchResponse>> {
|
|
105
|
+
const url = `${this.baseUrl}/private/credits/analytics?tenantId=${encodeURIComponent(tenantId)}`;
|
|
106
|
+
return await this.httpRequest.post(url, input);
|
|
107
|
+
}
|
|
108
|
+
|
|
97
109
|
async upsertBorrower(
|
|
98
110
|
input: UpsertLoanBorrowerRequest,
|
|
99
111
|
tenantId: string,
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
import { LoanCreditStatusEnum } from "@fiado/type-kit/bin/loanCredit/index.js";
|
|
2
|
+
import { ClientLevelEnum } from "@fiado/type-kit/bin/loanScoring/index.js";
|
|
3
|
+
|
|
4
|
+
/** Body de `POST /private/credits/analytics`. Hasta 500 ids por request; el caller pagina. */
|
|
5
|
+
export interface LoanCreditAnalyticsBatchRequest {
|
|
6
|
+
creditIds: string[];
|
|
7
|
+
}
|
|
8
|
+
|
|
9
|
+
/**
|
|
10
|
+
* Lo mínimo de un crédito para contar: eje de riesgo, plan, cifras del enganche, estado y fecha.
|
|
11
|
+
* CERO PII — ni acreditado, ni nombre, ni teléfono.
|
|
12
|
+
*/
|
|
13
|
+
export interface LoanCreditAnalyticsItem {
|
|
14
|
+
creditId: string;
|
|
15
|
+
/** Nivel CONGELADO al originar; ausente en los créditos que se originaron sin SCI. */
|
|
16
|
+
clientLevelAtOrigination?: ClientLevelEnum;
|
|
17
|
+
/** Score CONGELADO al originar; ausente en los créditos que se originaron sin SCI. */
|
|
18
|
+
sciAtOrigination?: number;
|
|
19
|
+
/** Plan comercial con el que se originó. Es lo que distingue una venta a empleado. */
|
|
20
|
+
planId: string;
|
|
21
|
+
equipmentPriceCents: number;
|
|
22
|
+
downPaymentCents: number;
|
|
23
|
+
status: LoanCreditStatusEnum;
|
|
24
|
+
createdAt: string;
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
/**
|
|
28
|
+
* Los ids que no existen simplemente no vuelven; los que DynamoDB no alcanzó a leer salen
|
|
29
|
+
* NOMBRADOS para que el caller no los cuente como cero.
|
|
30
|
+
*/
|
|
31
|
+
export interface LoanCreditAnalyticsBatchResponse {
|
|
32
|
+
items: LoanCreditAnalyticsItem[];
|
|
33
|
+
unresolvedCreditIds: string[];
|
|
34
|
+
}
|
|
@@ -12,6 +12,10 @@ import {
|
|
|
12
12
|
SignLoanCreditResponse,
|
|
13
13
|
UpsertLoanBorrowerRequest,
|
|
14
14
|
} from "@fiado/type-kit/bin/loanCredit/index.js";
|
|
15
|
+
import {
|
|
16
|
+
LoanCreditAnalyticsBatchRequest,
|
|
17
|
+
LoanCreditAnalyticsBatchResponse,
|
|
18
|
+
} from "../dtos/LoanCreditAnalyticsBatch.js";
|
|
15
19
|
|
|
16
20
|
/**
|
|
17
21
|
* Contrato del publisher de `loan-credit-business` (componente 09 SureKeep F2 — motor de crédito
|
|
@@ -100,6 +104,20 @@ export interface ILoanCreditBusinessApi {
|
|
|
100
104
|
tenantId: string,
|
|
101
105
|
): Promise<StandardResponse<LoanBorrowerResponse>>;
|
|
102
106
|
|
|
107
|
+
/**
|
|
108
|
+
* Lee créditos EN LOTE por su id y devuelve solo lo que se cuenta: el eje de riesgo congelado
|
|
109
|
+
* al originar, el plan, las cifras del enganche, el estado y la fecha. **Cero PII.**
|
|
110
|
+
*
|
|
111
|
+
* Se resuelve por BatchGetItem sobre la clave primaria, así que el orden de salida NO es el de
|
|
112
|
+
* entrada. Un id que no existe no vuelve; uno que DynamoDB no alcanzó a leer vuelve nombrado en
|
|
113
|
+
* `unresolvedCreditIds` — nunca se confunde «no pude leerlo» con «no existe».
|
|
114
|
+
* `400 VALIDATION_ERROR` si el lote pasa de 500 ids o trae uno que no es ULID.
|
|
115
|
+
*/
|
|
116
|
+
batchGetCreditAnalytics(
|
|
117
|
+
input: LoanCreditAnalyticsBatchRequest,
|
|
118
|
+
tenantId: string,
|
|
119
|
+
): Promise<StandardResponse<LoanCreditAnalyticsBatchResponse>>;
|
|
120
|
+
|
|
103
121
|
/**
|
|
104
122
|
* Upsert idempotente del acreditado por `retailCustomerId` (mismo contrato que el consumidor
|
|
105
123
|
* del evento `CustomerKycVerifiedV1` — fallback operativo mientras la cola no exista).
|
package/src/loanCredit/index.ts
CHANGED