@fiado/type-kit 3.196.0 → 3.199.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/LoanContract.d.ts +27 -0
- package/bin/loanCredit/dtos/LoanContract.js +91 -0
- package/bin/loanCredit/dtos/LoanCredit.d.ts +54 -0
- package/bin/loanCredit/dtos/LoanCredit.js +187 -0
- package/bin/loanCredit/dtos/LoanInstallment.d.ts +27 -0
- package/bin/loanCredit/dtos/LoanInstallment.js +97 -0
- package/bin/loanCredit/dtos/requests/ActivationCheckRequest.d.ts +21 -0
- package/bin/loanCredit/dtos/requests/ActivationCheckRequest.js +52 -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 +25 -0
- package/bin/loanCredit/dtos/requests/OriginateLoanCreditRequest.js +85 -0
- package/bin/loanCredit/dtos/requests/QuoteLoanCreditRequest.d.ts +11 -0
- package/bin/loanCredit/dtos/requests/QuoteLoanCreditRequest.js +39 -0
- package/bin/loanCredit/dtos/requests/SignLoanCreditRequest.d.ts +17 -0
- package/bin/loanCredit/dtos/requests/SignLoanCreditRequest.js +37 -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/ActivationCheckResponse.d.ts +10 -0
- package/bin/loanCredit/dtos/responses/ActivationCheckResponse.js +2 -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/LoanContractResponse.d.ts +16 -0
- package/bin/loanCredit/dtos/responses/LoanContractResponse.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 +13 -0
- package/bin/loanCredit/dtos/responses/OriginateLoanCreditResponse.js +2 -0
- package/bin/loanCredit/dtos/responses/QuoteLoanCreditResponse.d.ts +10 -0
- package/bin/loanCredit/dtos/responses/QuoteLoanCreditResponse.js +2 -0
- package/bin/loanCredit/dtos/responses/SignLoanCreditResponse.d.ts +20 -0
- package/bin/loanCredit/dtos/responses/SignLoanCreditResponse.js +2 -0
- package/bin/loanCredit/enums/ClientLevelEnum.d.ts +11 -0
- package/bin/loanCredit/enums/ClientLevelEnum.js +15 -0
- package/bin/loanCredit/enums/ContractTypeEnum.d.ts +12 -0
- package/bin/loanCredit/enums/ContractTypeEnum.js +16 -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 +14 -0
- package/bin/loanCredit/enums/LoanInstallmentStatusEnum.js +18 -0
- package/bin/loanCredit/index.d.ts +24 -0
- package/bin/loanCredit/index.js +47 -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/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/LoanContract.ts +70 -0
- package/src/loanCredit/dtos/LoanCredit.ts +169 -0
- package/src/loanCredit/dtos/LoanInstallment.ts +75 -0
- package/src/loanCredit/dtos/requests/ActivationCheckRequest.ts +39 -0
- package/src/loanCredit/dtos/requests/ChangeLoanCreditStatusRequest.ts +22 -0
- package/src/loanCredit/dtos/requests/OriginateLoanCreditRequest.ts +74 -0
- package/src/loanCredit/dtos/requests/QuoteLoanCreditRequest.ts +24 -0
- package/src/loanCredit/dtos/requests/SignLoanCreditRequest.ts +24 -0
- package/src/loanCredit/dtos/requests/UpsertLoanBorrowerRequest.ts +48 -0
- package/src/loanCredit/dtos/responses/ActivationCheckResponse.ts +11 -0
- package/src/loanCredit/dtos/responses/LoanBorrowerResponse.ts +22 -0
- package/src/loanCredit/dtos/responses/LoanContractResponse.ts +17 -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 +14 -0
- package/src/loanCredit/dtos/responses/QuoteLoanCreditResponse.ts +11 -0
- package/src/loanCredit/dtos/responses/SignLoanCreditResponse.ts +21 -0
- package/src/loanCredit/enums/ContractTypeEnum.ts +12 -0
- package/src/loanCredit/enums/LoanCreditStatusEnum.ts +21 -0
- package/src/loanCredit/enums/LoanInstallmentStatusEnum.ts +14 -0
- package/src/loanCredit/index.ts +32 -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/benefitCenter/enums/BenefitFlowEnum.d.ts +0 -11
- package/bin/benefitCenter/enums/BenefitFlowEnum.js +0 -15
- 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,70 @@
|
|
|
1
|
+
import { Expose } from 'class-transformer';
|
|
2
|
+
import { IsBoolean, IsEnum, IsOptional, IsString, Matches } from 'class-validator';
|
|
3
|
+
import { regexIso8601 } from '../../helpers/constans/regex';
|
|
4
|
+
import { ContractTypeEnum } from '../enums/ContractTypeEnum';
|
|
5
|
+
|
|
6
|
+
/**
|
|
7
|
+
* LoanContract — documento del contrato de crédito con firma FES (modelo-datos §5b ·
|
|
8
|
+
* `<T>LoanContract_GT` · M2 §4.3-§4.4). Un registro por documento (3 por crédito — C4).
|
|
9
|
+
*
|
|
10
|
+
* Nace DRAFT en la originación (sin PDF); la firma FES genera el PDF, calcula su `sha256`,
|
|
11
|
+
* verifica el OTP y sella con NOM-151. Conservación documental: 10 años (NOM-151).
|
|
12
|
+
* `signedAt` ausente = draft sin firmar.
|
|
13
|
+
*/
|
|
14
|
+
export class LoanContract {
|
|
15
|
+
@Expose()
|
|
16
|
+
@IsString()
|
|
17
|
+
contractId!: string;
|
|
18
|
+
|
|
19
|
+
@Expose()
|
|
20
|
+
@IsString()
|
|
21
|
+
creditId!: string;
|
|
22
|
+
|
|
23
|
+
@Expose()
|
|
24
|
+
@IsEnum(ContractTypeEnum)
|
|
25
|
+
type!: ContractTypeEnum;
|
|
26
|
+
|
|
27
|
+
/** Key del PDF en el bucket del tenant (`loan-{tenant}-{env}`). Ausente hasta generar (AS-09). */
|
|
28
|
+
@Expose()
|
|
29
|
+
@IsOptional()
|
|
30
|
+
@IsString()
|
|
31
|
+
pdfS3Key?: string;
|
|
32
|
+
|
|
33
|
+
/** Hash SHA-256 del PDF firmado (trazabilidad FES — M2 §4.4). Ausente hasta generar. */
|
|
34
|
+
@Expose()
|
|
35
|
+
@IsOptional()
|
|
36
|
+
@IsString()
|
|
37
|
+
sha256?: string;
|
|
38
|
+
|
|
39
|
+
/** El OTP de firma fue verificado (voluntad de firma — FES). */
|
|
40
|
+
@Expose()
|
|
41
|
+
@IsBoolean()
|
|
42
|
+
otpVerified!: boolean;
|
|
43
|
+
|
|
44
|
+
/** Sello de tiempo NOM-151 (TSA). Ausente hasta firmar (AS del TSA connector). */
|
|
45
|
+
@Expose()
|
|
46
|
+
@IsOptional()
|
|
47
|
+
@IsString()
|
|
48
|
+
nom151Timestamp?: string;
|
|
49
|
+
|
|
50
|
+
@Expose()
|
|
51
|
+
@IsOptional()
|
|
52
|
+
@Matches(regexIso8601)
|
|
53
|
+
signedAt?: string;
|
|
54
|
+
|
|
55
|
+
@Expose()
|
|
56
|
+
@IsString()
|
|
57
|
+
createdBy!: string;
|
|
58
|
+
|
|
59
|
+
@Expose()
|
|
60
|
+
@IsString()
|
|
61
|
+
updatedBy!: string;
|
|
62
|
+
|
|
63
|
+
@Expose()
|
|
64
|
+
@Matches(regexIso8601)
|
|
65
|
+
createdAt!: string;
|
|
66
|
+
|
|
67
|
+
@Expose()
|
|
68
|
+
@Matches(regexIso8601)
|
|
69
|
+
updatedAt!: string;
|
|
70
|
+
}
|
|
@@ -0,0 +1,169 @@
|
|
|
1
|
+
import { Expose, Type } from 'class-transformer';
|
|
2
|
+
import {
|
|
3
|
+
IsEnum,
|
|
4
|
+
IsInt,
|
|
5
|
+
IsNumber,
|
|
6
|
+
IsOptional,
|
|
7
|
+
IsString,
|
|
8
|
+
Matches,
|
|
9
|
+
Max,
|
|
10
|
+
Min,
|
|
11
|
+
ValidateNested,
|
|
12
|
+
} from 'class-validator';
|
|
13
|
+
import { regexIso8601 } from '../../helpers/constans/regex';
|
|
14
|
+
import { ClientLevelEnum } from '../../loanScoring/enums/ClientLevelEnum';
|
|
15
|
+
import { LoanCreditStatusEnum } from '../enums/LoanCreditStatusEnum';
|
|
16
|
+
import { ActivationChecklist } from './ActivationChecklist';
|
|
17
|
+
|
|
18
|
+
/**
|
|
19
|
+
* LoanCredit — el crédito SOFOM (modelo-datos §5b · M2 · owner `loan-credit-business`).
|
|
20
|
+
*
|
|
21
|
+
* Convenciones: montos en **cents** (entero); TNA decimal (`2.30` = 230%); porcentajes decimal
|
|
22
|
+
* sobre 1. La estructura financiera es amortización francesa + IVA 16% sobre intereses, sin interés
|
|
23
|
+
* moratorio (M2 §3). El snapshot `sciAtOrigination`/`clientLevelAtOrigination` congela las
|
|
24
|
+
* condiciones del cliente al originar (el SCI vivo evoluciona en `LoanBorrower`).
|
|
25
|
+
*/
|
|
26
|
+
export class LoanCredit {
|
|
27
|
+
@Expose()
|
|
28
|
+
@IsString()
|
|
29
|
+
creditId!: string;
|
|
30
|
+
|
|
31
|
+
@Expose()
|
|
32
|
+
@IsString()
|
|
33
|
+
borrowerId!: string;
|
|
34
|
+
|
|
35
|
+
@Expose()
|
|
36
|
+
@IsEnum(LoanCreditStatusEnum)
|
|
37
|
+
status!: LoanCreditStatusEnum;
|
|
38
|
+
|
|
39
|
+
/** Plan de crédito del catálogo de loan-offerings con el que se originó. */
|
|
40
|
+
@Expose()
|
|
41
|
+
@IsString()
|
|
42
|
+
planId!: string;
|
|
43
|
+
|
|
44
|
+
@Expose()
|
|
45
|
+
@IsInt()
|
|
46
|
+
@Min(1)
|
|
47
|
+
termWeeks!: number;
|
|
48
|
+
|
|
49
|
+
@Expose()
|
|
50
|
+
@IsInt()
|
|
51
|
+
@Min(1)
|
|
52
|
+
equipmentPriceCents!: number;
|
|
53
|
+
|
|
54
|
+
@Expose()
|
|
55
|
+
@IsInt()
|
|
56
|
+
@Min(0)
|
|
57
|
+
downPaymentCents!: number;
|
|
58
|
+
|
|
59
|
+
/** Capital financiado = precio del equipo − enganche. */
|
|
60
|
+
@Expose()
|
|
61
|
+
@IsInt()
|
|
62
|
+
@Min(1)
|
|
63
|
+
financedCapitalCents!: number;
|
|
64
|
+
|
|
65
|
+
/** TNA decimal (`2.30` = 230%). */
|
|
66
|
+
@Expose()
|
|
67
|
+
@IsNumber()
|
|
68
|
+
@Min(0)
|
|
69
|
+
tnaAnnual!: number;
|
|
70
|
+
|
|
71
|
+
/** Cuota semanal sin IVA (constante en amortización francesa). */
|
|
72
|
+
@Expose()
|
|
73
|
+
@IsInt()
|
|
74
|
+
weeklyPaymentCents!: number;
|
|
75
|
+
|
|
76
|
+
/** Cuota semanal con IVA de la primera semana (informativa — el IVA decrece por cuota). */
|
|
77
|
+
@Expose()
|
|
78
|
+
@IsInt()
|
|
79
|
+
weeklyPaymentWithIvaCents!: number;
|
|
80
|
+
|
|
81
|
+
@Expose()
|
|
82
|
+
@IsInt()
|
|
83
|
+
totalInterestCents!: number;
|
|
84
|
+
|
|
85
|
+
@Expose()
|
|
86
|
+
@IsInt()
|
|
87
|
+
totalIvaCents!: number;
|
|
88
|
+
|
|
89
|
+
/** Total a pagar = capital + intereses + IVA. */
|
|
90
|
+
@Expose()
|
|
91
|
+
@IsInt()
|
|
92
|
+
totalToPayCents!: number;
|
|
93
|
+
|
|
94
|
+
/** CAT decimal (`3.85` = 385%) — lo calcula el simulador de loan-offerings (C3/AS-01). */
|
|
95
|
+
@Expose()
|
|
96
|
+
@IsOptional()
|
|
97
|
+
@IsNumber()
|
|
98
|
+
@Min(0)
|
|
99
|
+
catAnnual?: number;
|
|
100
|
+
|
|
101
|
+
/** Sesión del wizard que originó — clave de idempotencia del originate (AS-07). */
|
|
102
|
+
@Expose()
|
|
103
|
+
@IsOptional()
|
|
104
|
+
@IsString()
|
|
105
|
+
wizardSessionId?: string;
|
|
106
|
+
|
|
107
|
+
/** IMEI del equipo financiado (se fija en el enrolamiento MDM). */
|
|
108
|
+
@Expose()
|
|
109
|
+
@IsOptional()
|
|
110
|
+
@IsString()
|
|
111
|
+
imei?: string;
|
|
112
|
+
|
|
113
|
+
@Expose()
|
|
114
|
+
@ValidateNested()
|
|
115
|
+
@Type(() => ActivationChecklist)
|
|
116
|
+
activationChecklist!: ActivationChecklist;
|
|
117
|
+
|
|
118
|
+
/** SCI del cliente al originar (snapshot, 0-100). */
|
|
119
|
+
@Expose()
|
|
120
|
+
@IsOptional()
|
|
121
|
+
@IsInt()
|
|
122
|
+
@Min(0)
|
|
123
|
+
@Max(100)
|
|
124
|
+
sciAtOrigination?: number;
|
|
125
|
+
|
|
126
|
+
@Expose()
|
|
127
|
+
@IsOptional()
|
|
128
|
+
@IsEnum(ClientLevelEnum)
|
|
129
|
+
clientLevelAtOrigination?: ClientLevelEnum;
|
|
130
|
+
|
|
131
|
+
@Expose()
|
|
132
|
+
@IsOptional()
|
|
133
|
+
@Matches(regexIso8601)
|
|
134
|
+
activatedAt?: string;
|
|
135
|
+
|
|
136
|
+
/** Fin de la ventana de cancelación voluntaria = activatedAt + 7 días naturales (M2 §11.3). */
|
|
137
|
+
@Expose()
|
|
138
|
+
@IsOptional()
|
|
139
|
+
@Matches(regexIso8601)
|
|
140
|
+
voluntaryCancelDeadline?: string;
|
|
141
|
+
|
|
142
|
+
/** Vencimiento de la primera cuota (primer viernes después de la activación). */
|
|
143
|
+
@Expose()
|
|
144
|
+
@IsOptional()
|
|
145
|
+
@IsString()
|
|
146
|
+
firstDueDate?: string;
|
|
147
|
+
|
|
148
|
+
/** Vencimiento de la última cuota. */
|
|
149
|
+
@Expose()
|
|
150
|
+
@IsOptional()
|
|
151
|
+
@IsString()
|
|
152
|
+
lastDueDate?: string;
|
|
153
|
+
|
|
154
|
+
@Expose()
|
|
155
|
+
@IsString()
|
|
156
|
+
createdBy!: string;
|
|
157
|
+
|
|
158
|
+
@Expose()
|
|
159
|
+
@IsString()
|
|
160
|
+
updatedBy!: string;
|
|
161
|
+
|
|
162
|
+
@Expose()
|
|
163
|
+
@Matches(regexIso8601)
|
|
164
|
+
createdAt!: string;
|
|
165
|
+
|
|
166
|
+
@Expose()
|
|
167
|
+
@Matches(regexIso8601)
|
|
168
|
+
updatedAt!: string;
|
|
169
|
+
}
|
|
@@ -0,0 +1,75 @@
|
|
|
1
|
+
import { Expose } from 'class-transformer';
|
|
2
|
+
import { IsEnum, IsInt, IsOptional, IsString, Matches, Min } from 'class-validator';
|
|
3
|
+
import { regexIso8601 } from '../../helpers/constans/regex';
|
|
4
|
+
import { LoanInstallmentStatusEnum } from '../enums/LoanInstallmentStatusEnum';
|
|
5
|
+
|
|
6
|
+
/**
|
|
7
|
+
* LoanInstallment — cuota semanal del crédito (modelo-datos §5b). Montos en cents; el IVA (16%)
|
|
8
|
+
* aplica SOLO sobre el interés de la cuota (M2 §3.3). `dueDate` (YYYY-MM-DD) queda ausente hasta la
|
|
9
|
+
* activación: las fechas se fijan a partir del primer viernes después de `activatedAt` (05_MOTOR §7).
|
|
10
|
+
*/
|
|
11
|
+
export class LoanInstallment {
|
|
12
|
+
@Expose()
|
|
13
|
+
@IsString()
|
|
14
|
+
creditId!: string;
|
|
15
|
+
|
|
16
|
+
/** Número de cuota 1-based. */
|
|
17
|
+
@Expose()
|
|
18
|
+
@IsInt()
|
|
19
|
+
@Min(1)
|
|
20
|
+
installmentNumber!: number;
|
|
21
|
+
|
|
22
|
+
@Expose()
|
|
23
|
+
@IsEnum(LoanInstallmentStatusEnum)
|
|
24
|
+
status!: LoanInstallmentStatusEnum;
|
|
25
|
+
|
|
26
|
+
/** Vencimiento YYYY-MM-DD (viernes; festivo → lunes siguiente). Ausente hasta activar. */
|
|
27
|
+
@Expose()
|
|
28
|
+
@IsOptional()
|
|
29
|
+
@IsString()
|
|
30
|
+
dueDate?: string;
|
|
31
|
+
|
|
32
|
+
@Expose()
|
|
33
|
+
@IsInt()
|
|
34
|
+
capitalCents!: number;
|
|
35
|
+
|
|
36
|
+
@Expose()
|
|
37
|
+
@IsInt()
|
|
38
|
+
interestCents!: number;
|
|
39
|
+
|
|
40
|
+
/** IVA 16% sobre el interés de la cuota. */
|
|
41
|
+
@Expose()
|
|
42
|
+
@IsInt()
|
|
43
|
+
ivaCents!: number;
|
|
44
|
+
|
|
45
|
+
/** capital + interés + IVA. */
|
|
46
|
+
@Expose()
|
|
47
|
+
@IsInt()
|
|
48
|
+
totalCents!: number;
|
|
49
|
+
|
|
50
|
+
/** Saldo insoluto de capital tras aplicar la cuota. */
|
|
51
|
+
@Expose()
|
|
52
|
+
@IsInt()
|
|
53
|
+
outstandingBalanceCents!: number;
|
|
54
|
+
|
|
55
|
+
@Expose()
|
|
56
|
+
@IsOptional()
|
|
57
|
+
@Matches(regexIso8601)
|
|
58
|
+
paidAt?: string;
|
|
59
|
+
|
|
60
|
+
@Expose()
|
|
61
|
+
@IsString()
|
|
62
|
+
createdBy!: string;
|
|
63
|
+
|
|
64
|
+
@Expose()
|
|
65
|
+
@IsString()
|
|
66
|
+
updatedBy!: string;
|
|
67
|
+
|
|
68
|
+
@Expose()
|
|
69
|
+
@Matches(regexIso8601)
|
|
70
|
+
createdAt!: string;
|
|
71
|
+
|
|
72
|
+
@Expose()
|
|
73
|
+
@Matches(regexIso8601)
|
|
74
|
+
updatedAt!: string;
|
|
75
|
+
}
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
import { Expose } from 'class-transformer';
|
|
2
|
+
import { IsBoolean, IsOptional, IsString } from 'class-validator';
|
|
3
|
+
|
|
4
|
+
/**
|
|
5
|
+
* Body de `POST /private/credits/:creditId/activate-check` (loan-credit-business — M2 §5).
|
|
6
|
+
* Marca condiciones del checklist de activación cumplidas (solo las que cambian, solo a `true`):
|
|
7
|
+
* `downPayment` la reporta el wizard al confirmar el enganche (paso 07); `imeiEnrolled` +
|
|
8
|
+
* `lockVerified` las dispara el paso 09 variante crédito (enrolamiento MDM vía la abstracción de
|
|
9
|
+
* proveedor). `contractSigned` NO se marca por acá — solo la firma FES (endpoint sign).
|
|
10
|
+
*
|
|
11
|
+
* Cuando las 4 condiciones quedan `true` en el mismo request → el crédito pasa a `ACTIVE`:
|
|
12
|
+
* vencimientos `activatedAt + n×7d` (domingo→lunes), `voluntaryCancelDeadline = +7d`, flag de
|
|
13
|
+
* cobro PCF configurado (C7 — solo flag, el débito real requiere adendum).
|
|
14
|
+
*/
|
|
15
|
+
export class ActivationCheckRequest {
|
|
16
|
+
/** Enganche confirmado (efectivo/débito inmediato; SPEI espera confirmación — M2 §5). */
|
|
17
|
+
@Expose()
|
|
18
|
+
@IsOptional()
|
|
19
|
+
@IsBoolean()
|
|
20
|
+
downPayment?: boolean;
|
|
21
|
+
|
|
22
|
+
/** IMEI enrolado en MDM. Dispara el enroll vía `MdmConnectorRouter` si aún no se hizo. */
|
|
23
|
+
@Expose()
|
|
24
|
+
@IsOptional()
|
|
25
|
+
@IsBoolean()
|
|
26
|
+
imeiEnrolled?: boolean;
|
|
27
|
+
|
|
28
|
+
/** Software de bloqueo verificado (el MDM reporta "activo"). */
|
|
29
|
+
@Expose()
|
|
30
|
+
@IsOptional()
|
|
31
|
+
@IsBoolean()
|
|
32
|
+
lockVerified?: boolean;
|
|
33
|
+
|
|
34
|
+
/** IMEI del equipo (paso 09) si no se fijó en el originate. Luhn-validado por el motor. */
|
|
35
|
+
@Expose()
|
|
36
|
+
@IsOptional()
|
|
37
|
+
@IsString()
|
|
38
|
+
imei?: string;
|
|
39
|
+
}
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import { Expose } from 'class-transformer';
|
|
2
|
+
import { IsEnum, IsNotEmpty, IsString, MaxLength } from 'class-validator';
|
|
3
|
+
import { LoanCreditStatusEnum } from '../../enums/LoanCreditStatusEnum';
|
|
4
|
+
|
|
5
|
+
/**
|
|
6
|
+
* Body de PUT /credits/:creditId/status (loan-credit-business). Cambio MANUAL de estado (05_MOTOR
|
|
7
|
+
* §8.2 — solo admin). Transiciones válidas: PENDING_ACTIVATION→CANCELLED (siempre),
|
|
8
|
+
* ACTIVE→CANCELLED (solo dentro de la ventana de 7 días), ACTIVE→WRITTEN_OFF,
|
|
9
|
+
* IN_ARREARS→WRITTEN_OFF. Cualquier otra → 400 INVALID_TRANSITION.
|
|
10
|
+
*/
|
|
11
|
+
export class ChangeLoanCreditStatusRequest {
|
|
12
|
+
@Expose()
|
|
13
|
+
@IsEnum(LoanCreditStatusEnum)
|
|
14
|
+
newStatus!: LoanCreditStatusEnum;
|
|
15
|
+
|
|
16
|
+
/** Razón del cambio (obligatoria — va al audit trail). */
|
|
17
|
+
@Expose()
|
|
18
|
+
@IsString()
|
|
19
|
+
@IsNotEmpty()
|
|
20
|
+
@MaxLength(500)
|
|
21
|
+
reason!: string;
|
|
22
|
+
}
|
|
@@ -0,0 +1,74 @@
|
|
|
1
|
+
import { Expose } from 'class-transformer';
|
|
2
|
+
import {
|
|
3
|
+
IsEnum,
|
|
4
|
+
IsInt,
|
|
5
|
+
IsNotEmpty,
|
|
6
|
+
IsOptional,
|
|
7
|
+
IsString,
|
|
8
|
+
Max,
|
|
9
|
+
Min,
|
|
10
|
+
} from 'class-validator';
|
|
11
|
+
import { ClientLevelEnum } from '../../../loanScoring/enums/ClientLevelEnum';
|
|
12
|
+
|
|
13
|
+
/**
|
|
14
|
+
* Body de `POST /private/credits/originate` (loan-credit-business — wizard, vía api-invoker).
|
|
15
|
+
* Origina el crédito en `PENDING_ACTIVATION`: valida (M2 §4.2: sin otro crédito vivo, plan activo,
|
|
16
|
+
* IMEI libre), invoca el simulador de loan-offerings con `planId+termWeeks+precio+enganche` (la
|
|
17
|
+
* TNA y el CAT los resuelve el PLAN — el caller NO los manda) y persiste crédito + cuotas +
|
|
18
|
+
* contratos draft.
|
|
19
|
+
*
|
|
20
|
+
* **Idempotente por `wizardSessionId`** (el wizard reintenta): mismo wizardSessionId → devuelve el
|
|
21
|
+
* crédito ya originado, no crea otro. El tenant viaja por query `?tenantId=` (convención privados).
|
|
22
|
+
*/
|
|
23
|
+
export class OriginateLoanCreditRequest {
|
|
24
|
+
/** Sesión del wizard que origina — clave de idempotencia (AS-07). */
|
|
25
|
+
@Expose()
|
|
26
|
+
@IsString()
|
|
27
|
+
@IsNotEmpty()
|
|
28
|
+
wizardSessionId!: string;
|
|
29
|
+
|
|
30
|
+
@Expose()
|
|
31
|
+
@IsString()
|
|
32
|
+
@IsNotEmpty()
|
|
33
|
+
borrowerId!: string;
|
|
34
|
+
|
|
35
|
+
@Expose()
|
|
36
|
+
@IsString()
|
|
37
|
+
@IsNotEmpty()
|
|
38
|
+
planId!: string;
|
|
39
|
+
|
|
40
|
+
@Expose()
|
|
41
|
+
@IsInt()
|
|
42
|
+
@Min(1)
|
|
43
|
+
@Max(104)
|
|
44
|
+
termWeeks!: number;
|
|
45
|
+
|
|
46
|
+
@Expose()
|
|
47
|
+
@IsInt()
|
|
48
|
+
@Min(1)
|
|
49
|
+
equipmentPriceCents!: number;
|
|
50
|
+
|
|
51
|
+
@Expose()
|
|
52
|
+
@IsInt()
|
|
53
|
+
@Min(0)
|
|
54
|
+
downPaymentCents!: number;
|
|
55
|
+
|
|
56
|
+
/** SCI del cliente al originar (snapshot de la evaluación del paso 05). */
|
|
57
|
+
@Expose()
|
|
58
|
+
@IsOptional()
|
|
59
|
+
@IsInt()
|
|
60
|
+
@Min(0)
|
|
61
|
+
@Max(100)
|
|
62
|
+
sciAtOrigination?: number;
|
|
63
|
+
|
|
64
|
+
@Expose()
|
|
65
|
+
@IsOptional()
|
|
66
|
+
@IsEnum(ClientLevelEnum)
|
|
67
|
+
clientLevelAtOrigination?: ClientLevelEnum;
|
|
68
|
+
|
|
69
|
+
/** IMEI del equipo si ya se conoce (también puede fijarse en el paso 09 vía activate-check). */
|
|
70
|
+
@Expose()
|
|
71
|
+
@IsOptional()
|
|
72
|
+
@IsString()
|
|
73
|
+
imei?: string;
|
|
74
|
+
}
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
import { Expose } from 'class-transformer';
|
|
2
|
+
import { IsInt, IsOptional, Max, Min } from 'class-validator';
|
|
3
|
+
|
|
4
|
+
/**
|
|
5
|
+
* Body de `POST /private/credits/:creditId/quote` (loan-credit-business — wizard paso 06).
|
|
6
|
+
* Re-cotiza el crédito en `PENDING_ACTIVATION` con términos nuevos (el cliente itera
|
|
7
|
+
* plazo/enganche en el cotizador) e invoca el simulador de loan-offerings; regenera las cuotas.
|
|
8
|
+
* Campos ausentes = conservar el valor actual del crédito. Rechaza si el crédito no está PENDING
|
|
9
|
+
* o si el contrato ya se firmó (los términos quedan congelados con la firma).
|
|
10
|
+
*/
|
|
11
|
+
export class QuoteLoanCreditRequest {
|
|
12
|
+
@Expose()
|
|
13
|
+
@IsOptional()
|
|
14
|
+
@IsInt()
|
|
15
|
+
@Min(1)
|
|
16
|
+
@Max(104)
|
|
17
|
+
termWeeks?: number;
|
|
18
|
+
|
|
19
|
+
@Expose()
|
|
20
|
+
@IsOptional()
|
|
21
|
+
@IsInt()
|
|
22
|
+
@Min(0)
|
|
23
|
+
downPaymentCents?: number;
|
|
24
|
+
}
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
import { Expose } from 'class-transformer';
|
|
2
|
+
import { IsOptional, IsString, Length } from 'class-validator';
|
|
3
|
+
|
|
4
|
+
/**
|
|
5
|
+
* Body de `POST /private/credits/:creditId/sign` (loan-credit-business — wizard paso 08, firma FES
|
|
6
|
+
* M2 §4.4). Endpoint de DOS tiempos sobre el mismo contrato:
|
|
7
|
+
*
|
|
8
|
+
* 1. **SIN `otpCode`** → INICIA la firma: congela términos, genera los 3 PDFs (C4), calcula sus
|
|
9
|
+
* sha256 y dispara el OTP dedicado de firma (4 dígitos, 5 min, vía messages-business — D5;
|
|
10
|
+
* distinto al OTP del paso 01). Responde `otpSent: true`.
|
|
11
|
+
* 2. **CON `otpCode`** → VERIFICA el OTP y firma: marca los contratos `otpVerified` + `signedAt` +
|
|
12
|
+
* NOM-151, y pone `activationChecklist.contractSigned = true`.
|
|
13
|
+
*
|
|
14
|
+
* Errores: `OTP_INVALID` · `OTP_EXPIRED` · `OTP_MAX_ATTEMPTS` · `CREDIT_NOT_PENDING`.
|
|
15
|
+
* (Semántica a ratificar con el contrato del wizard — AS-07.)
|
|
16
|
+
*/
|
|
17
|
+
export class SignLoanCreditRequest {
|
|
18
|
+
/** Código OTP de firma. Ausente = iniciar la firma (generar PDFs + enviar OTP). */
|
|
19
|
+
@Expose()
|
|
20
|
+
@IsOptional()
|
|
21
|
+
@IsString()
|
|
22
|
+
@Length(4, 4)
|
|
23
|
+
otpCode?: string;
|
|
24
|
+
}
|
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
import { Expose, Type } from 'class-transformer';
|
|
2
|
+
import {
|
|
3
|
+
IsEnum,
|
|
4
|
+
IsInt,
|
|
5
|
+
IsNotEmpty,
|
|
6
|
+
IsOptional,
|
|
7
|
+
IsString,
|
|
8
|
+
Max,
|
|
9
|
+
Min,
|
|
10
|
+
ValidateNested,
|
|
11
|
+
} from 'class-validator';
|
|
12
|
+
import { ClientLevelEnum } from '../../../loanScoring/enums/ClientLevelEnum';
|
|
13
|
+
import { LoanBeneficiary } from '../LoanBeneficiary';
|
|
14
|
+
|
|
15
|
+
/**
|
|
16
|
+
* Body de POST /borrowers y POST /private/borrowers (loan-credit-business).
|
|
17
|
+
* Upsert idempotente por `retailCustomerId`: si el borrower ya existe se actualizan los campos
|
|
18
|
+
* presentes; si no, se crea (mismo contrato que el consumidor de `CustomerKycVerifiedV1`).
|
|
19
|
+
*/
|
|
20
|
+
export class UpsertLoanBorrowerRequest {
|
|
21
|
+
@Expose()
|
|
22
|
+
@IsString()
|
|
23
|
+
@IsNotEmpty()
|
|
24
|
+
retailCustomerId!: string;
|
|
25
|
+
|
|
26
|
+
@Expose()
|
|
27
|
+
@IsOptional()
|
|
28
|
+
@IsInt()
|
|
29
|
+
@Min(0)
|
|
30
|
+
@Max(100)
|
|
31
|
+
sciScore?: number;
|
|
32
|
+
|
|
33
|
+
@Expose()
|
|
34
|
+
@IsOptional()
|
|
35
|
+
@IsEnum(ClientLevelEnum)
|
|
36
|
+
clientLevel?: ClientLevelEnum;
|
|
37
|
+
|
|
38
|
+
@Expose()
|
|
39
|
+
@IsOptional()
|
|
40
|
+
@IsInt()
|
|
41
|
+
bureauScore?: number;
|
|
42
|
+
|
|
43
|
+
@Expose()
|
|
44
|
+
@IsOptional()
|
|
45
|
+
@ValidateNested()
|
|
46
|
+
@Type(() => LoanBeneficiary)
|
|
47
|
+
beneficiary?: LoanBeneficiary;
|
|
48
|
+
}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { LoanCreditResponse } from './LoanCreditResponse';
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* Response de `POST /private/credits/:creditId/activate-check` (loan-credit-business — M2 §5):
|
|
5
|
+
* el crédito con el checklist actualizado. `missingItems` lista las condiciones que faltan
|
|
6
|
+
* (vacío cuando el crédito quedó `ACTIVE`).
|
|
7
|
+
*/
|
|
8
|
+
export interface ActivationCheckResponse {
|
|
9
|
+
credit: LoanCreditResponse;
|
|
10
|
+
missingItems: string[];
|
|
11
|
+
}
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import { ClientLevelEnum } from '../../../loanScoring/enums/ClientLevelEnum';
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* Response de los endpoints de LoanBorrower (loan-credit-business). Interface plain (las salidas
|
|
5
|
+
* solo se tipan, no se validan en runtime).
|
|
6
|
+
*/
|
|
7
|
+
export interface LoanBorrowerResponse {
|
|
8
|
+
borrowerId: string;
|
|
9
|
+
retailCustomerId: string;
|
|
10
|
+
sciScore?: number;
|
|
11
|
+
clientLevel?: ClientLevelEnum;
|
|
12
|
+
bureauScore?: number;
|
|
13
|
+
beneficiary?: {
|
|
14
|
+
fullName: string;
|
|
15
|
+
relationship?: string;
|
|
16
|
+
phone?: string;
|
|
17
|
+
};
|
|
18
|
+
createdBy: string;
|
|
19
|
+
updatedBy: string;
|
|
20
|
+
createdAt: string;
|
|
21
|
+
updatedAt: string;
|
|
22
|
+
}
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import { ContractTypeEnum } from '../../enums/ContractTypeEnum';
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* Response de un documento del contrato (loan-credit-business). `signedAt` ausente = draft.
|
|
5
|
+
*/
|
|
6
|
+
export interface LoanContractResponse {
|
|
7
|
+
contractId: string;
|
|
8
|
+
creditId: string;
|
|
9
|
+
type: ContractTypeEnum;
|
|
10
|
+
pdfS3Key?: string;
|
|
11
|
+
sha256?: string;
|
|
12
|
+
otpVerified: boolean;
|
|
13
|
+
nom151Timestamp?: string;
|
|
14
|
+
signedAt?: string;
|
|
15
|
+
createdAt: string;
|
|
16
|
+
updatedAt: string;
|
|
17
|
+
}
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
import { ClientLevelEnum } from '../../../loanScoring/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,14 @@
|
|
|
1
|
+
import { LoanContractResponse } from './LoanContractResponse';
|
|
2
|
+
import { LoanCreditResponse } from './LoanCreditResponse';
|
|
3
|
+
import { LoanInstallmentResponse } from './LoanInstallmentResponse';
|
|
4
|
+
|
|
5
|
+
/**
|
|
6
|
+
* Response de `POST /private/credits/originate` (loan-credit-business): el crédito recién
|
|
7
|
+
* originado en `PENDING_ACTIVATION` + su plan de cuotas (fechas ausentes hasta activar) + los 3
|
|
8
|
+
* contratos draft (C4 — se firman en el paso 08).
|
|
9
|
+
*/
|
|
10
|
+
export interface OriginateLoanCreditResponse {
|
|
11
|
+
credit: LoanCreditResponse;
|
|
12
|
+
installments: LoanInstallmentResponse[];
|
|
13
|
+
contracts: LoanContractResponse[];
|
|
14
|
+
}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { LoanCreditResponse } from './LoanCreditResponse';
|
|
2
|
+
import { LoanInstallmentResponse } from './LoanInstallmentResponse';
|
|
3
|
+
|
|
4
|
+
/**
|
|
5
|
+
* Response de `POST /private/credits/:creditId/quote` (loan-credit-business): el crédito con los
|
|
6
|
+
* términos re-cotizados + el plan de cuotas regenerado (fechas ausentes hasta activar).
|
|
7
|
+
*/
|
|
8
|
+
export interface QuoteLoanCreditResponse {
|
|
9
|
+
credit: LoanCreditResponse;
|
|
10
|
+
installments: LoanInstallmentResponse[];
|
|
11
|
+
}
|