@fiado/type-kit 3.196.0 → 3.198.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/creditEngine/dtos/AnticipatedPaymentQuote.d.ts +47 -0
- package/bin/creditEngine/dtos/AnticipatedPaymentQuote.js +22 -0
- package/bin/creditEngine/index.d.ts +1 -0
- package/bin/creditEngine/index.js +1 -0
- package/bin/index.d.ts +2 -0
- package/bin/index.js +8 -1
- package/bin/loanCredit/dtos/ActivationChecklist.d.ts +11 -0
- package/bin/loanCredit/dtos/ActivationChecklist.js +42 -0
- package/bin/loanCredit/dtos/LoanBeneficiary.d.ts +8 -0
- package/bin/{platformRbac/dtos/ResendOtpRequest.js → loanCredit/dtos/LoanBeneficiary.js} +14 -12
- package/bin/loanCredit/dtos/LoanBorrower.d.ts +22 -0
- package/bin/loanCredit/dtos/LoanBorrower.js +82 -0
- package/bin/loanCredit/dtos/LoanCredit.d.ts +50 -0
- package/bin/loanCredit/dtos/LoanCredit.js +174 -0
- package/bin/loanCredit/dtos/LoanInstallment.d.ts +27 -0
- package/bin/loanCredit/dtos/LoanInstallment.js +97 -0
- package/bin/loanCredit/dtos/requests/ChangeLoanCreditStatusRequest.d.ts +12 -0
- package/bin/{platformRbac/dtos/ResendSelfRegisterOtpRequest.js → loanCredit/dtos/requests/ChangeLoanCreditStatusRequest.js} +13 -13
- package/bin/loanCredit/dtos/requests/OriginateLoanCreditRequest.d.ts +22 -0
- package/bin/loanCredit/dtos/requests/OriginateLoanCreditRequest.js +84 -0
- package/bin/loanCredit/dtos/requests/UpdateActivationChecklistRequest.d.ts +11 -0
- package/bin/loanCredit/dtos/requests/UpdateActivationChecklistRequest.js +46 -0
- package/bin/loanCredit/dtos/requests/UpsertLoanBorrowerRequest.d.ts +14 -0
- package/bin/loanCredit/dtos/requests/UpsertLoanBorrowerRequest.js +57 -0
- package/bin/loanCredit/dtos/responses/LoanBorrowerResponse.d.ts +21 -0
- package/bin/loanCredit/dtos/responses/LoanBorrowerResponse.js +2 -0
- package/bin/loanCredit/dtos/responses/LoanCreditResponse.d.ts +38 -0
- package/bin/loanCredit/dtos/responses/LoanCreditResponse.js +2 -0
- package/bin/loanCredit/dtos/responses/LoanInstallmentResponse.d.ts +17 -0
- package/bin/loanCredit/dtos/responses/LoanInstallmentResponse.js +2 -0
- package/bin/loanCredit/dtos/responses/OriginateLoanCreditResponse.d.ts +10 -0
- package/bin/loanCredit/dtos/responses/OriginateLoanCreditResponse.js +2 -0
- package/bin/loanCredit/enums/ClientLevelEnum.d.ts +11 -0
- package/bin/loanCredit/enums/ClientLevelEnum.js +15 -0
- package/bin/loanCredit/enums/LoanCreditStatusEnum.d.ts +21 -0
- package/bin/loanCredit/enums/LoanCreditStatusEnum.js +25 -0
- package/bin/loanCredit/enums/LoanInstallmentStatusEnum.d.ts +11 -0
- package/bin/loanCredit/enums/LoanInstallmentStatusEnum.js +15 -0
- package/bin/loanCredit/index.d.ts +16 -0
- package/bin/loanCredit/index.js +36 -0
- package/bin/loanScoring/dtos/SciBreakdown.d.ts +29 -0
- package/bin/loanScoring/dtos/SciBreakdown.js +2 -0
- package/bin/loanScoring/dtos/ScoringDecision.d.ts +29 -0
- package/bin/loanScoring/dtos/ScoringDecision.js +2 -0
- package/bin/loanScoring/dtos/ScoringOffer.d.ts +18 -0
- package/bin/loanScoring/dtos/ScoringOffer.js +2 -0
- package/bin/loanScoring/dtos/requests/EvaluateSciRequest.d.ts +23 -0
- package/bin/loanScoring/dtos/requests/EvaluateSciRequest.js +54 -0
- package/bin/loanScoring/dtos/requests/SciInternalHistoryInput.d.ts +19 -0
- package/bin/loanScoring/dtos/requests/SciInternalHistoryInput.js +51 -0
- package/bin/loanScoring/dtos/responses/EvaluateSciResponse.d.ts +24 -0
- package/bin/loanScoring/dtos/responses/EvaluateSciResponse.js +2 -0
- package/bin/loanScoring/dtos/responses/SciEvaluationResponse.d.ts +28 -0
- package/bin/loanScoring/dtos/responses/SciEvaluationResponse.js +2 -0
- package/bin/loanScoring/enums/ClientLevelEnum.d.ts +13 -0
- package/bin/loanScoring/enums/ClientLevelEnum.js +17 -0
- package/bin/loanScoring/enums/SciLayer2SourceEnum.d.ts +11 -0
- package/bin/loanScoring/enums/SciLayer2SourceEnum.js +15 -0
- package/bin/loanScoring/enums/ScoringDecisionEnum.d.ts +14 -0
- package/bin/loanScoring/enums/ScoringDecisionEnum.js +18 -0
- package/bin/loanScoring/enums/ScoringProviderEnum.d.ts +12 -0
- package/bin/loanScoring/enums/ScoringProviderEnum.js +16 -0
- package/bin/loanScoring/index.d.ts +11 -0
- package/bin/loanScoring/index.js +31 -0
- package/bin/walletFunding/dtos/CancelFundingReferenceRequest.d.ts +6 -0
- package/bin/walletFunding/dtos/CancelFundingReferenceRequest.js +31 -0
- package/bin/walletFunding/dtos/CancelFundingReferenceResponse.d.ts +7 -0
- package/bin/walletFunding/dtos/CancelFundingReferenceResponse.js +6 -0
- package/bin/walletFunding/dtos/CancelFundingRequest.d.ts +11 -0
- package/bin/walletFunding/dtos/CancelFundingRequest.js +33 -0
- package/bin/walletFunding/dtos/CancelFundingResponse.d.ts +14 -0
- package/bin/walletFunding/dtos/CancelFundingResponse.js +12 -0
- package/bin/walletFunding/dtos/CancelWalletFundingRequest.d.ts +3 -0
- package/bin/walletFunding/dtos/CancelWalletFundingRequest.js +21 -0
- package/bin/walletFunding/dtos/CancelWalletFundingResponse.d.ts +7 -0
- package/bin/walletFunding/dtos/CancelWalletFundingResponse.js +6 -0
- package/package.json +1 -1
- package/src/creditEngine/dtos/AnticipatedPaymentQuote.ts +56 -0
- package/src/creditEngine/index.ts +1 -0
- package/src/index.ts +7 -0
- package/src/loanCredit/dtos/ActivationChecklist.ts +25 -0
- package/src/loanCredit/dtos/LoanBeneficiary.ts +22 -0
- package/src/loanCredit/dtos/LoanBorrower.ts +71 -0
- package/src/loanCredit/dtos/LoanCredit.ts +156 -0
- package/src/loanCredit/dtos/LoanInstallment.ts +75 -0
- package/src/loanCredit/dtos/requests/ChangeLoanCreditStatusRequest.ts +22 -0
- package/src/loanCredit/dtos/requests/OriginateLoanCreditRequest.ts +73 -0
- package/src/loanCredit/dtos/requests/UpdateActivationChecklistRequest.ts +29 -0
- package/src/loanCredit/dtos/requests/UpsertLoanBorrowerRequest.ts +48 -0
- package/src/loanCredit/dtos/responses/LoanBorrowerResponse.ts +22 -0
- package/src/loanCredit/dtos/responses/LoanCreditResponse.ts +39 -0
- package/src/loanCredit/dtos/responses/LoanInstallmentResponse.ts +18 -0
- package/src/loanCredit/dtos/responses/OriginateLoanCreditResponse.ts +11 -0
- package/src/loanCredit/enums/ClientLevelEnum.ts +11 -0
- package/src/loanCredit/enums/LoanCreditStatusEnum.ts +21 -0
- package/src/loanCredit/enums/LoanInstallmentStatusEnum.ts +11 -0
- package/src/loanCredit/index.ts +23 -0
- package/src/loanScoring/dtos/SciBreakdown.ts +33 -0
- package/src/loanScoring/dtos/ScoringDecision.ts +30 -0
- package/src/loanScoring/dtos/ScoringOffer.ts +18 -0
- package/src/loanScoring/dtos/requests/EvaluateSciRequest.ts +43 -0
- package/src/loanScoring/dtos/requests/SciInternalHistoryInput.ts +38 -0
- package/src/loanScoring/dtos/responses/EvaluateSciResponse.ts +25 -0
- package/src/loanScoring/dtos/responses/SciEvaluationResponse.ts +29 -0
- package/src/loanScoring/enums/ClientLevelEnum.ts +13 -0
- package/src/loanScoring/enums/SciLayer2SourceEnum.ts +11 -0
- package/src/loanScoring/enums/ScoringDecisionEnum.ts +14 -0
- package/src/loanScoring/enums/ScoringProviderEnum.ts +12 -0
- package/src/loanScoring/index.ts +18 -0
- package/bin/loanConfig/enums/ModifiableByRoleEnum.d.ts +0 -11
- package/bin/loanConfig/enums/ModifiableByRoleEnum.js +0 -15
- package/bin/places/dtos/CashInFeeDto.d.ts +0 -17
- package/bin/places/dtos/CashInFeeDto.js +0 -12
- package/bin/platformRbac/dtos/ResendOtpRequest.d.ts +0 -22
- package/bin/platformRbac/dtos/ResendSelfRegisterOtpRequest.d.ts +0 -11
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
import { ClientLevelEnum } from '../../enums/ClientLevelEnum';
|
|
2
|
+
import { LoanCreditStatusEnum } from '../../enums/LoanCreditStatusEnum';
|
|
3
|
+
|
|
4
|
+
/**
|
|
5
|
+
* Response de los endpoints de LoanCredit (loan-credit-business). Montos en cents; TNA decimal.
|
|
6
|
+
*/
|
|
7
|
+
export interface LoanCreditResponse {
|
|
8
|
+
creditId: string;
|
|
9
|
+
borrowerId: string;
|
|
10
|
+
status: LoanCreditStatusEnum;
|
|
11
|
+
planId: string;
|
|
12
|
+
termWeeks: number;
|
|
13
|
+
equipmentPriceCents: number;
|
|
14
|
+
downPaymentCents: number;
|
|
15
|
+
financedCapitalCents: number;
|
|
16
|
+
tnaAnnual: number;
|
|
17
|
+
weeklyPaymentCents: number;
|
|
18
|
+
weeklyPaymentWithIvaCents: number;
|
|
19
|
+
totalInterestCents: number;
|
|
20
|
+
totalIvaCents: number;
|
|
21
|
+
totalToPayCents: number;
|
|
22
|
+
imei?: string;
|
|
23
|
+
activationChecklist: {
|
|
24
|
+
downPayment: boolean;
|
|
25
|
+
contractSigned: boolean;
|
|
26
|
+
imeiEnrolled: boolean;
|
|
27
|
+
lockVerified: boolean;
|
|
28
|
+
};
|
|
29
|
+
sciAtOrigination?: number;
|
|
30
|
+
clientLevelAtOrigination?: ClientLevelEnum;
|
|
31
|
+
activatedAt?: string;
|
|
32
|
+
voluntaryCancelDeadline?: string;
|
|
33
|
+
firstDueDate?: string;
|
|
34
|
+
lastDueDate?: string;
|
|
35
|
+
createdBy: string;
|
|
36
|
+
updatedBy: string;
|
|
37
|
+
createdAt: string;
|
|
38
|
+
updatedAt: string;
|
|
39
|
+
}
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import { LoanInstallmentStatusEnum } from '../../enums/LoanInstallmentStatusEnum';
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* Response de una cuota del plan de pagos (loan-credit-business). Montos en cents; el IVA (16%)
|
|
5
|
+
* aplica solo sobre el interés de la cuota.
|
|
6
|
+
*/
|
|
7
|
+
export interface LoanInstallmentResponse {
|
|
8
|
+
creditId: string;
|
|
9
|
+
installmentNumber: number;
|
|
10
|
+
status: LoanInstallmentStatusEnum;
|
|
11
|
+
dueDate?: string;
|
|
12
|
+
capitalCents: number;
|
|
13
|
+
interestCents: number;
|
|
14
|
+
ivaCents: number;
|
|
15
|
+
totalCents: number;
|
|
16
|
+
outstandingBalanceCents: number;
|
|
17
|
+
paidAt?: string;
|
|
18
|
+
}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { LoanCreditResponse } from './LoanCreditResponse';
|
|
2
|
+
import { LoanInstallmentResponse } from './LoanInstallmentResponse';
|
|
3
|
+
|
|
4
|
+
/**
|
|
5
|
+
* Response de POST /credits (loan-credit-business): el crédito recién originado en
|
|
6
|
+
* `PENDING_ACTIVATION` + su plan de cuotas completo (las fechas se fijan al activar).
|
|
7
|
+
*/
|
|
8
|
+
export interface OriginateLoanCreditResponse {
|
|
9
|
+
credit: LoanCreditResponse;
|
|
10
|
+
installments: LoanInstallmentResponse[];
|
|
11
|
+
}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Nivel del cliente según su SCI (M7/05_MOTOR §3.2): 21-60 Bronce · 61-80 Plata · 81-100 Oro.
|
|
3
|
+
* Distinto de `CreditPlanLevelEnum` de loanOfferings (que además tiene `ALL` para planes):
|
|
4
|
+
* un CLIENTE nunca es `ALL`.
|
|
5
|
+
* @enum {string}
|
|
6
|
+
*/
|
|
7
|
+
export enum ClientLevelEnum {
|
|
8
|
+
BRONZE = 'BRONZE',
|
|
9
|
+
SILVER = 'SILVER',
|
|
10
|
+
GOLD = 'GOLD',
|
|
11
|
+
}
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Estado del crédito SOFOM SureKeep (M2 §10 — ciclo de vida).
|
|
3
|
+
*
|
|
4
|
+
* `PENDING_ACTIVATION` (pendiente_activacion) → condiciones en proceso, reanudable, caduca a 30 días.
|
|
5
|
+
* `ACTIVE` (activo) → vigente, al corriente.
|
|
6
|
+
* `IN_ARREARS` (en_mora) → cuotas vencidas, dispositivo bloqueado.
|
|
7
|
+
* `SETTLED` (liquidado) → saldo pagado; historial positivo. Final.
|
|
8
|
+
* `CANCELLED` (cancelado) → cancelación voluntaria (ventana 7 días); enganche devuelto. Final.
|
|
9
|
+
* `DISCARDED` (descartado) → nunca se activó (caducó a 30 días). Sin efecto. Final.
|
|
10
|
+
* `WRITTEN_OFF` (baja_contable) → 180 días sin pago. Se desbloquea si paga. Final.
|
|
11
|
+
* @enum {string}
|
|
12
|
+
*/
|
|
13
|
+
export enum LoanCreditStatusEnum {
|
|
14
|
+
PENDING_ACTIVATION = 'PENDING_ACTIVATION',
|
|
15
|
+
ACTIVE = 'ACTIVE',
|
|
16
|
+
IN_ARREARS = 'IN_ARREARS',
|
|
17
|
+
SETTLED = 'SETTLED',
|
|
18
|
+
CANCELLED = 'CANCELLED',
|
|
19
|
+
DISCARDED = 'DISCARDED',
|
|
20
|
+
WRITTEN_OFF = 'WRITTEN_OFF',
|
|
21
|
+
}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Estado de una cuota semanal del crédito (M2 §6.1 / 05_MOTOR §5).
|
|
3
|
+
* `RESTRUCTURED` (reestructurado) = la cuota dejó de aplicar por reestructura o cancelación.
|
|
4
|
+
* @enum {string}
|
|
5
|
+
*/
|
|
6
|
+
export enum LoanInstallmentStatusEnum {
|
|
7
|
+
PENDING = 'PENDING',
|
|
8
|
+
PAID = 'PAID',
|
|
9
|
+
OVERDUE = 'OVERDUE',
|
|
10
|
+
RESTRUCTURED = 'RESTRUCTURED',
|
|
11
|
+
}
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
// Enums
|
|
2
|
+
export * from './enums/LoanCreditStatusEnum';
|
|
3
|
+
export * from './enums/LoanInstallmentStatusEnum';
|
|
4
|
+
export * from './enums/ClientLevelEnum';
|
|
5
|
+
|
|
6
|
+
// Entity DTOs
|
|
7
|
+
export * from './dtos/LoanBorrower';
|
|
8
|
+
export * from './dtos/LoanBeneficiary';
|
|
9
|
+
export * from './dtos/LoanCredit';
|
|
10
|
+
export * from './dtos/LoanInstallment';
|
|
11
|
+
export * from './dtos/ActivationChecklist';
|
|
12
|
+
|
|
13
|
+
// Request DTOs
|
|
14
|
+
export * from './dtos/requests/UpsertLoanBorrowerRequest';
|
|
15
|
+
export * from './dtos/requests/OriginateLoanCreditRequest';
|
|
16
|
+
export * from './dtos/requests/UpdateActivationChecklistRequest';
|
|
17
|
+
export * from './dtos/requests/ChangeLoanCreditStatusRequest';
|
|
18
|
+
|
|
19
|
+
// Response DTOs
|
|
20
|
+
export * from './dtos/responses/LoanBorrowerResponse';
|
|
21
|
+
export * from './dtos/responses/LoanCreditResponse';
|
|
22
|
+
export * from './dtos/responses/LoanInstallmentResponse';
|
|
23
|
+
export * from './dtos/responses/OriginateLoanCreditResponse';
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
import { SciLayer2SourceEnum } from '../enums/SciLayer2SourceEnum';
|
|
2
|
+
|
|
3
|
+
/** Capa 1 — gate anti-fraude (M7 §2). Binario: pasa o no pasa (KYC/Metamap, lo declara el caller). */
|
|
4
|
+
export interface SciLayer1Breakdown {
|
|
5
|
+
passed: boolean;
|
|
6
|
+
}
|
|
7
|
+
|
|
8
|
+
/** Capa 2 — buró (M7 §3). Sub-scores normalizados 0-100 por variable cuando la fuente es FICO. */
|
|
9
|
+
export interface SciLayer2Breakdown {
|
|
10
|
+
/** Score de la capa, 0-100. */
|
|
11
|
+
score: number;
|
|
12
|
+
source: SciLayer2SourceEnum;
|
|
13
|
+
/** Sub-scores 0-100 por variable (fico, worstDelinquency, openCredits, historyAge, inquiries). */
|
|
14
|
+
components?: Record<string, number>;
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
/** Capa 3 — historial interno SureKeep (M7 §4). */
|
|
18
|
+
export interface SciLayer3Breakdown {
|
|
19
|
+
/** Score de la capa, 0-100. */
|
|
20
|
+
score: number;
|
|
21
|
+
/** Sub-scores 0-100 por variable (onTime, avgDelay, episodes, restructures, completed, writeOff). */
|
|
22
|
+
components?: Record<string, number>;
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
/**
|
|
26
|
+
* Desglose por capas del SCI (M7) que se snapshotea en `LoanSciEvaluation_GT`.
|
|
27
|
+
* Con proveedor Modelias solo viaja `layer1` (la decisión llega completa, sin SCI local).
|
|
28
|
+
*/
|
|
29
|
+
export interface SciBreakdown {
|
|
30
|
+
layer1: SciLayer1Breakdown;
|
|
31
|
+
layer2?: SciLayer2Breakdown;
|
|
32
|
+
layer3?: SciLayer3Breakdown;
|
|
33
|
+
}
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
import { ClientLevelEnum } from '../enums/ClientLevelEnum';
|
|
2
|
+
import { ScoringDecisionEnum } from '../enums/ScoringDecisionEnum';
|
|
3
|
+
import { ScoringProviderEnum } from '../enums/ScoringProviderEnum';
|
|
4
|
+
import { SciBreakdown } from './SciBreakdown';
|
|
5
|
+
import { ScoringOffer } from './ScoringOffer';
|
|
6
|
+
|
|
7
|
+
/**
|
|
8
|
+
* Contrato AGNÓSTICO de salida del scoring (diagramas F2 §credito · patrón spec 12): todos los
|
|
9
|
+
* proveedores (Modelias decisión-directa, Círculo insumos+SCI M7, futuros) normalizan a esta forma.
|
|
10
|
+
* El consumidor (wizard paso 05, motor de crédito) NO sabe qué proveedor la produjo; el proveedor
|
|
11
|
+
* usado queda snapshoteado en la evaluación (`LoanSciEvaluation_GT`).
|
|
12
|
+
*/
|
|
13
|
+
export interface ScoringDecision {
|
|
14
|
+
provider: ScoringProviderEnum;
|
|
15
|
+
/** Score en la escala canónica SCI 0-100 (C2 resuelta: la escala es 0-100). */
|
|
16
|
+
sciTotal: number;
|
|
17
|
+
level: ClientLevelEnum;
|
|
18
|
+
decision: ScoringDecisionEnum;
|
|
19
|
+
/** Oferta pre-aprobada si el proveedor la entrega (Modelias); null en el camino Círculo+SCI. */
|
|
20
|
+
offer: ScoringOffer | null;
|
|
21
|
+
/**
|
|
22
|
+
* Thin-file (M7 §3 / INT4): el proveedor CONFIRMÓ que la persona no tiene historial en buró.
|
|
23
|
+
* Es un dato de negocio válido (capa 2 neutra o FIS) — NUNCA se confunde con un error del
|
|
24
|
+
* connector (ese camino lanza DomainError; antipatrón API_ADAPTER_SWALLOW).
|
|
25
|
+
*/
|
|
26
|
+
thinFile: boolean;
|
|
27
|
+
breakdown: SciBreakdown;
|
|
28
|
+
/** Marcas/flags del proveedor (`marcas` de Modelias). Vacío si no aplica. */
|
|
29
|
+
flags: string[];
|
|
30
|
+
}
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Oferta pre-aprobada que acompaña una decisión de scoring (cuando el proveedor la entrega —
|
|
3
|
+
* Modelias la devuelve completa; el camino Círculo+SCI no produce oferta, el plan lo resuelve
|
|
4
|
+
* loan-offerings por nivel).
|
|
5
|
+
*
|
|
6
|
+
* ⚠️ Los valores numéricos se transportan TAL CUAL los entrega el proveedor (el contrato Modelias
|
|
7
|
+
* no confirma unidades de `linea_credito`/`enganche` — ver TD del módulo modelias). NO asumir cents.
|
|
8
|
+
*/
|
|
9
|
+
export interface ScoringOffer {
|
|
10
|
+
/** Línea de crédito aprobada (unidad según proveedor). */
|
|
11
|
+
creditLine: number | null;
|
|
12
|
+
/** Enganche requerido (unidad/base según proveedor). */
|
|
13
|
+
downPayment: number | null;
|
|
14
|
+
/** Plazos ofrecidos, en semanas. */
|
|
15
|
+
termsWeeks: number[];
|
|
16
|
+
/** Tasas por plazo (clave = plazo, valor = tasa decimal). */
|
|
17
|
+
rates: Record<string, number>;
|
|
18
|
+
}
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
import { Type } from 'class-transformer';
|
|
2
|
+
import { IsBoolean, IsEmail, IsNotEmpty, IsOptional, IsString, ValidateNested } from 'class-validator';
|
|
3
|
+
import { SciInternalHistoryInput } from './SciInternalHistoryInput';
|
|
4
|
+
|
|
5
|
+
/**
|
|
6
|
+
* Body de `POST /private/scoring/evaluations` de loan-scoring-business (wizard paso 05 / motor de
|
|
7
|
+
* crédito, vía api-invoker). El proveedor NO se elige acá: lo resuelve el `ScoringProviderRouter`
|
|
8
|
+
* por configuración del tenant (spec 12). El tenant viaja por query `?tenantId=` (convención de
|
|
9
|
+
* los privados Fiado), no en este body.
|
|
10
|
+
*/
|
|
11
|
+
export class EvaluateSciRequest {
|
|
12
|
+
/** Acreditado a evaluar (`LoanBorrower`). La evaluación queda ligada a él en el historial. */
|
|
13
|
+
@IsString()
|
|
14
|
+
@IsNotEmpty()
|
|
15
|
+
borrowerId!: string;
|
|
16
|
+
|
|
17
|
+
/** CURP del solicitante (requerido por los proveedores de scoring). */
|
|
18
|
+
@IsString()
|
|
19
|
+
@IsNotEmpty()
|
|
20
|
+
curp!: string;
|
|
21
|
+
|
|
22
|
+
/** Celular del solicitante (requerido por Modelias). */
|
|
23
|
+
@IsString()
|
|
24
|
+
@IsNotEmpty()
|
|
25
|
+
cellphone!: string;
|
|
26
|
+
|
|
27
|
+
@IsOptional()
|
|
28
|
+
@IsEmail()
|
|
29
|
+
email?: string;
|
|
30
|
+
|
|
31
|
+
/**
|
|
32
|
+
* Resultado del gate anti-fraude (M7 §2 — KYC/Metamap, se ejecuta UNA vez en el paso 01/02
|
|
33
|
+
* del wizard). El caller lo declara: `false` → decisión REJECTED sin consultar proveedor.
|
|
34
|
+
*/
|
|
35
|
+
@IsBoolean()
|
|
36
|
+
antiFraudPassed!: boolean;
|
|
37
|
+
|
|
38
|
+
/** Historial interno del acreditado (capa 3). Ausente = cliente nuevo (capa 2 pesa 100%). */
|
|
39
|
+
@IsOptional()
|
|
40
|
+
@ValidateNested()
|
|
41
|
+
@Type(() => SciInternalHistoryInput)
|
|
42
|
+
internalHistory?: SciInternalHistoryInput;
|
|
43
|
+
}
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
import { IsBoolean, IsInt, IsNumber, Max, Min } from 'class-validator';
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* Resumen del historial interno SureKeep del acreditado (M7 §4 — capa 3 del SCI). Lo aporta el
|
|
5
|
+
* caller (loan-credit-business es el dueño de cuotas/moras); ausente = cliente sin historial
|
|
6
|
+
* interno (la capa 2 pesa 100% — M7 §5).
|
|
7
|
+
*/
|
|
8
|
+
export class SciInternalHistoryInput {
|
|
9
|
+
/** % de cuotas pagadas a tiempo, 0-100 (peso 30%). */
|
|
10
|
+
@IsNumber()
|
|
11
|
+
@Min(0)
|
|
12
|
+
@Max(100)
|
|
13
|
+
pctOnTimeInstallments!: number;
|
|
14
|
+
|
|
15
|
+
/** Días promedio de atraso (peso 20%). */
|
|
16
|
+
@IsNumber()
|
|
17
|
+
@Min(0)
|
|
18
|
+
avgDelinquencyDays!: number;
|
|
19
|
+
|
|
20
|
+
/** Episodios de mora (peso 20%). */
|
|
21
|
+
@IsInt()
|
|
22
|
+
@Min(0)
|
|
23
|
+
delinquencyEpisodes!: number;
|
|
24
|
+
|
|
25
|
+
/** Reestructuras (peso 15%; máx 1 por crédito — M2). */
|
|
26
|
+
@IsInt()
|
|
27
|
+
@Min(0)
|
|
28
|
+
restructures!: number;
|
|
29
|
+
|
|
30
|
+
/** Créditos completados sin mora (peso 10%). */
|
|
31
|
+
@IsInt()
|
|
32
|
+
@Min(0)
|
|
33
|
+
completedCredits!: number;
|
|
34
|
+
|
|
35
|
+
/** Baja contable previa (peso 5% — penaliza fuerte). */
|
|
36
|
+
@IsBoolean()
|
|
37
|
+
previousWriteOff!: boolean;
|
|
38
|
+
}
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
import { ClientLevelEnum } from '../../enums/ClientLevelEnum';
|
|
2
|
+
import { ScoringDecisionEnum } from '../../enums/ScoringDecisionEnum';
|
|
3
|
+
import { ScoringProviderEnum } from '../../enums/ScoringProviderEnum';
|
|
4
|
+
import { SciBreakdown } from '../SciBreakdown';
|
|
5
|
+
import { ScoringOffer } from '../ScoringOffer';
|
|
6
|
+
|
|
7
|
+
/**
|
|
8
|
+
* Response de `POST /private/scoring/evaluations`: la `ScoringDecision` normalizada + la identidad
|
|
9
|
+
* del snapshot persistido en `LoanSciEvaluation_GT` (el motor de crédito guarda `evaluationId`
|
|
10
|
+
* como `sciAtOrigination`).
|
|
11
|
+
*/
|
|
12
|
+
export interface EvaluateSciResponse {
|
|
13
|
+
evaluationId: string;
|
|
14
|
+
borrowerId: string;
|
|
15
|
+
provider: ScoringProviderEnum;
|
|
16
|
+
/** Escala canónica SCI 0-100. */
|
|
17
|
+
sciTotal: number;
|
|
18
|
+
level: ClientLevelEnum;
|
|
19
|
+
decision: ScoringDecisionEnum;
|
|
20
|
+
offer: ScoringOffer | null;
|
|
21
|
+
thinFile: boolean;
|
|
22
|
+
breakdown: SciBreakdown;
|
|
23
|
+
flags: string[];
|
|
24
|
+
createdAt: string;
|
|
25
|
+
}
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
import { ClientLevelEnum } from '../../enums/ClientLevelEnum';
|
|
2
|
+
import { ScoringDecisionEnum } from '../../enums/ScoringDecisionEnum';
|
|
3
|
+
import { ScoringProviderEnum } from '../../enums/ScoringProviderEnum';
|
|
4
|
+
import { SciBreakdown } from '../SciBreakdown';
|
|
5
|
+
import { ScoringOffer } from '../ScoringOffer';
|
|
6
|
+
|
|
7
|
+
/**
|
|
8
|
+
* Detalle de una evaluación SCI snapshoteada en `LoanSciEvaluation_GT` (lecturas: detalle e
|
|
9
|
+
* historial por acreditado del backoffice, y GET privado del motor de crédito). Incluye la
|
|
10
|
+
* metadata de auditoría del snapshot.
|
|
11
|
+
*/
|
|
12
|
+
export interface SciEvaluationResponse {
|
|
13
|
+
evaluationId: string;
|
|
14
|
+
borrowerId: string;
|
|
15
|
+
provider: ScoringProviderEnum;
|
|
16
|
+
/** Escala canónica SCI 0-100. */
|
|
17
|
+
sciTotal: number;
|
|
18
|
+
level: ClientLevelEnum;
|
|
19
|
+
decision: ScoringDecisionEnum;
|
|
20
|
+
offer: ScoringOffer | null;
|
|
21
|
+
thinFile: boolean;
|
|
22
|
+
breakdown: SciBreakdown;
|
|
23
|
+
flags: string[];
|
|
24
|
+
version: number;
|
|
25
|
+
createdBy: string;
|
|
26
|
+
updatedBy: string;
|
|
27
|
+
createdAt: string;
|
|
28
|
+
updatedAt: string;
|
|
29
|
+
}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Nivel del cliente derivado del SCI (M7 §5: 0-20 no elegible · 21-60 bronce · 61-80 plata ·
|
|
3
|
+
* 81-100 oro). Valores en inglés alineados con `CreditPlanLevelEnum` de loanOfferings
|
|
4
|
+
* (BRONZE/SILVER/GOLD) — el plan de crédito se resuelve cruzando este nivel con el catálogo.
|
|
5
|
+
* `NOT_ELIGIBLE` no existe en el catálogo de planes: significa "no se ofrece crédito".
|
|
6
|
+
* @enum {string}
|
|
7
|
+
*/
|
|
8
|
+
export enum ClientLevelEnum {
|
|
9
|
+
NOT_ELIGIBLE = 'NOT_ELIGIBLE',
|
|
10
|
+
BRONZE = 'BRONZE',
|
|
11
|
+
SILVER = 'SILVER',
|
|
12
|
+
GOLD = 'GOLD',
|
|
13
|
+
}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Fuente de la capa 2 (buró) del SCI — M7 §3 + INT4 v2.0 (thin-file):
|
|
3
|
+
* `FICO` = historial pleno en Círculo · `FIS` = thin-file con Financial Inclusion Score
|
|
4
|
+
* (INT4 v2.0 supersede el "50 neutro" de M7 §3) · `NEUTRAL` = sin dato de buró (SCI base 50).
|
|
5
|
+
* @enum {string}
|
|
6
|
+
*/
|
|
7
|
+
export enum SciLayer2SourceEnum {
|
|
8
|
+
FICO = 'FICO',
|
|
9
|
+
FIS = 'FIS',
|
|
10
|
+
NEUTRAL = 'NEUTRAL',
|
|
11
|
+
}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Decisión agnóstica del scoring (contrato `ScoringDecision`): el motor de crédito NO sabe qué
|
|
3
|
+
* proveedor la produjo (regla spec 12).
|
|
4
|
+
* - `APPROVED`: SCI dentro de un nivel elegible (o ACEPTADO directo de Modelias).
|
|
5
|
+
* - `REJECTED`: gate anti-fraude no pasó (M7 §2) o RECHAZADO directo del proveedor.
|
|
6
|
+
* - `NO_ELIGIBLE`: pasó el gate pero el SCI quedó bajo el piso (`SCORING/sci_min_eligible`,
|
|
7
|
+
* rango 0-20 de M7 §5) — no se ofrece crédito SureKeep (se puede derivar a financiera externa).
|
|
8
|
+
* @enum {string}
|
|
9
|
+
*/
|
|
10
|
+
export enum ScoringDecisionEnum {
|
|
11
|
+
APPROVED = 'APPROVED',
|
|
12
|
+
REJECTED = 'REJECTED',
|
|
13
|
+
NO_ELIGIBLE = 'NO_ELIGIBLE',
|
|
14
|
+
}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Proveedor de scoring soportado por el `ScoringProviderRouter` de loan-scoring-business
|
|
3
|
+
* (diagramas F2 §credito · patrón spec 12): la selección es configurable per-tenant y SOLO el
|
|
4
|
+
* router conoce el proveedor. Extensible: un proveedor nuevo = un valor nuevo + su adapter.
|
|
5
|
+
* @enum {string}
|
|
6
|
+
*/
|
|
7
|
+
export enum ScoringProviderEnum {
|
|
8
|
+
/** modelias-connector — devuelve la decisión COMPLETA (score, decisión, línea, enganche, plazos, tasas). */
|
|
9
|
+
MODELIAS = 'MODELIAS',
|
|
10
|
+
/** Connector de CONSULTA a Círculo de Crédito — devuelve insumos crudos; el SCI (M7) se calcula local. */
|
|
11
|
+
CIRCULO = 'CIRCULO',
|
|
12
|
+
}
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
// Enums
|
|
2
|
+
export * from './enums/ScoringProviderEnum';
|
|
3
|
+
export * from './enums/ClientLevelEnum';
|
|
4
|
+
export * from './enums/ScoringDecisionEnum';
|
|
5
|
+
export * from './enums/SciLayer2SourceEnum';
|
|
6
|
+
|
|
7
|
+
// Contrato agnóstico + shapes compartidos
|
|
8
|
+
export * from './dtos/ScoringDecision';
|
|
9
|
+
export * from './dtos/ScoringOffer';
|
|
10
|
+
export * from './dtos/SciBreakdown';
|
|
11
|
+
|
|
12
|
+
// Request DTOs
|
|
13
|
+
export * from './dtos/requests/EvaluateSciRequest';
|
|
14
|
+
export * from './dtos/requests/SciInternalHistoryInput';
|
|
15
|
+
|
|
16
|
+
// Response DTOs
|
|
17
|
+
export * from './dtos/responses/EvaluateSciResponse';
|
|
18
|
+
export * from './dtos/responses/SciEvaluationResponse';
|
|
@@ -1,11 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Rol RBAC mínimo que puede modificar un parámetro (RBAC a nivel de parámetro, modelo-datos §8).
|
|
3
|
-
* `retailer_admin` = "Admin VentasLuga" de M6 §8. Valores = identificadores de rol de RBAC F0.
|
|
4
|
-
* TD-004: confirmar mapeo super_admin ↔ platform_super_admin con el naming real de F0.
|
|
5
|
-
* @enum {string}
|
|
6
|
-
*/
|
|
7
|
-
export declare enum ModifiableByRoleEnum {
|
|
8
|
-
SUPER_ADMIN = "super_admin",
|
|
9
|
-
SOFOM_ADMIN = "sofom_admin",
|
|
10
|
-
RETAILER_ADMIN = "retailer_admin"
|
|
11
|
-
}
|
|
@@ -1,15 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.ModifiableByRoleEnum = void 0;
|
|
4
|
-
/**
|
|
5
|
-
* Rol RBAC mínimo que puede modificar un parámetro (RBAC a nivel de parámetro, modelo-datos §8).
|
|
6
|
-
* `retailer_admin` = "Admin VentasLuga" de M6 §8. Valores = identificadores de rol de RBAC F0.
|
|
7
|
-
* TD-004: confirmar mapeo super_admin ↔ platform_super_admin con el naming real de F0.
|
|
8
|
-
* @enum {string}
|
|
9
|
-
*/
|
|
10
|
-
var ModifiableByRoleEnum;
|
|
11
|
-
(function (ModifiableByRoleEnum) {
|
|
12
|
-
ModifiableByRoleEnum["SUPER_ADMIN"] = "super_admin";
|
|
13
|
-
ModifiableByRoleEnum["SOFOM_ADMIN"] = "sofom_admin";
|
|
14
|
-
ModifiableByRoleEnum["RETAILER_ADMIN"] = "retailer_admin";
|
|
15
|
-
})(ModifiableByRoleEnum || (exports.ModifiableByRoleEnum = ModifiableByRoleEnum = {}));
|
|
@@ -1,17 +0,0 @@
|
|
|
1
|
-
import { CurrencyId } from '../../currency/enums/CurrencyId';
|
|
2
|
-
/**
|
|
3
|
-
* Comisión que cobra un punto de cash-in (lo que el lambda MUESTRA, no cobra).
|
|
4
|
-
* - GreenDot (US): representativo por cadena → `fixed` + `cap` (cada tienda cobra hasta el tope).
|
|
5
|
-
* - Passport (MX): por red → `fixed` + `percentage`.
|
|
6
|
-
* Response DTO — sin decoradores de validación.
|
|
7
|
-
*/
|
|
8
|
-
export declare class CashInFeeDto {
|
|
9
|
-
/** Comisión fija, en la moneda del país. */
|
|
10
|
-
fixed?: number;
|
|
11
|
-
/** Porcentaje del monto depositado (0–100). */
|
|
12
|
-
percentage?: number;
|
|
13
|
-
/** Tope máximo de comisión (GreenDot: el asociado cobra hasta este cap). */
|
|
14
|
-
cap?: number;
|
|
15
|
-
/** Moneda del fee: USD (GreenDot) | MXN (Passport). */
|
|
16
|
-
currency: CurrencyId;
|
|
17
|
-
}
|
|
@@ -1,12 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.CashInFeeDto = void 0;
|
|
4
|
-
/**
|
|
5
|
-
* Comisión que cobra un punto de cash-in (lo que el lambda MUESTRA, no cobra).
|
|
6
|
-
* - GreenDot (US): representativo por cadena → `fixed` + `cap` (cada tienda cobra hasta el tope).
|
|
7
|
-
* - Passport (MX): por red → `fixed` + `percentage`.
|
|
8
|
-
* Response DTO — sin decoradores de validación.
|
|
9
|
-
*/
|
|
10
|
-
class CashInFeeDto {
|
|
11
|
-
}
|
|
12
|
-
exports.CashInFeeDto = CashInFeeDto;
|
|
@@ -1,22 +0,0 @@
|
|
|
1
|
-
import { MfaMethodEnum } from '../enums/MfaMethodEnum';
|
|
2
|
-
/**
|
|
3
|
-
* Body del POST /auth/resend-otp (público, anónimo). DEC-RBAC-054.
|
|
4
|
-
* Reenvía el OTP del login re-disparando el challenge real CUSTOM_AUTH (EMAIL_OTP) para la
|
|
5
|
-
* identidad SIN password. `tenantId` obligatorio (DEC-064 — el picker ya lo resolvió, NO "solo email").
|
|
6
|
-
* El email se normaliza lowercase server-side. Postura anti-enumeración: respuesta 200 genérica
|
|
7
|
-
* siempre, sin filtrar existencia (ver AuthLoginManager.resendChallengeOtp).
|
|
8
|
-
*/
|
|
9
|
-
export declare class ResendOtpRequest {
|
|
10
|
-
email: string;
|
|
11
|
-
tenantId: string;
|
|
12
|
-
}
|
|
13
|
-
/**
|
|
14
|
-
* Respuesta del resend-otp. `session`/`mfaMethod` frescos del nuevo challenge CUSTOM_AUTH.
|
|
15
|
-
* Plain sin validators (no validamos lo que mandamos al cliente — fiado-validation-and-dtos § 7).
|
|
16
|
-
* Ambos opcionales: en los caminos de rechazo silencioso (anti-enumeración) o ramas sin CUSTOM_AUTH
|
|
17
|
-
* el server responde 200 genérico sin session ni método.
|
|
18
|
-
*/
|
|
19
|
-
export interface ResendOtpResponse {
|
|
20
|
-
session?: string;
|
|
21
|
-
mfaMethod?: MfaMethodEnum;
|
|
22
|
-
}
|
|
@@ -1,11 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Body del POST /self-register/resend-otp (público, anónimo). DEC-RBAC-054.
|
|
3
|
-
* Re-envía el OTP del autoregistro (mecanismo messages-business, NO Cognito) tras validar un
|
|
4
|
-
* `pending` existente. Misma postura anti-enumeración del start. El email se normaliza lowercase
|
|
5
|
-
* server-side. DTO propio por endpoint (NO reusa SelfRegisterStartRequest, que exige roleId/scope/
|
|
6
|
-
* scopeRef, ni SelfRegisterVerifyOtpRequest, que exige otp).
|
|
7
|
-
*/
|
|
8
|
-
export declare class ResendSelfRegisterOtpRequest {
|
|
9
|
-
tenantId: string;
|
|
10
|
-
email: string;
|
|
11
|
-
}
|