@fiado/type-kit 3.195.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.
Files changed (133) hide show
  1. package/bin/creditEngine/dtos/AnticipatedPaymentQuote.d.ts +47 -0
  2. package/bin/creditEngine/dtos/AnticipatedPaymentQuote.js +22 -0
  3. package/bin/creditEngine/index.d.ts +1 -0
  4. package/bin/creditEngine/index.js +1 -0
  5. package/bin/index.d.ts +2 -0
  6. package/bin/index.js +8 -1
  7. package/bin/loanCredit/dtos/ActivationChecklist.d.ts +11 -0
  8. package/bin/loanCredit/dtos/ActivationChecklist.js +42 -0
  9. package/bin/loanCredit/dtos/LoanBeneficiary.d.ts +8 -0
  10. package/bin/{platformRbac/dtos/ResendOtpRequest.js → loanCredit/dtos/LoanBeneficiary.js} +14 -12
  11. package/bin/loanCredit/dtos/LoanBorrower.d.ts +22 -0
  12. package/bin/loanCredit/dtos/LoanBorrower.js +82 -0
  13. package/bin/loanCredit/dtos/LoanCredit.d.ts +50 -0
  14. package/bin/loanCredit/dtos/LoanCredit.js +174 -0
  15. package/bin/loanCredit/dtos/LoanInstallment.d.ts +27 -0
  16. package/bin/loanCredit/dtos/LoanInstallment.js +97 -0
  17. package/bin/loanCredit/dtos/requests/ChangeLoanCreditStatusRequest.d.ts +12 -0
  18. package/bin/{platformRbac/dtos/ResendSelfRegisterOtpRequest.js → loanCredit/dtos/requests/ChangeLoanCreditStatusRequest.js} +13 -13
  19. package/bin/loanCredit/dtos/requests/OriginateLoanCreditRequest.d.ts +22 -0
  20. package/bin/loanCredit/dtos/requests/OriginateLoanCreditRequest.js +84 -0
  21. package/bin/loanCredit/dtos/requests/UpdateActivationChecklistRequest.d.ts +11 -0
  22. package/bin/loanCredit/dtos/requests/UpdateActivationChecklistRequest.js +46 -0
  23. package/bin/loanCredit/dtos/requests/UpsertLoanBorrowerRequest.d.ts +14 -0
  24. package/bin/loanCredit/dtos/requests/UpsertLoanBorrowerRequest.js +57 -0
  25. package/bin/loanCredit/dtos/responses/LoanBorrowerResponse.d.ts +21 -0
  26. package/bin/loanCredit/dtos/responses/LoanBorrowerResponse.js +2 -0
  27. package/bin/loanCredit/dtos/responses/LoanCreditResponse.d.ts +38 -0
  28. package/bin/loanCredit/dtos/responses/LoanCreditResponse.js +2 -0
  29. package/bin/loanCredit/dtos/responses/LoanInstallmentResponse.d.ts +17 -0
  30. package/bin/loanCredit/dtos/responses/LoanInstallmentResponse.js +2 -0
  31. package/bin/loanCredit/dtos/responses/OriginateLoanCreditResponse.d.ts +10 -0
  32. package/bin/loanCredit/dtos/responses/OriginateLoanCreditResponse.js +2 -0
  33. package/bin/loanCredit/enums/ClientLevelEnum.d.ts +11 -0
  34. package/bin/loanCredit/enums/ClientLevelEnum.js +15 -0
  35. package/bin/loanCredit/enums/LoanCreditStatusEnum.d.ts +21 -0
  36. package/bin/loanCredit/enums/LoanCreditStatusEnum.js +25 -0
  37. package/bin/loanCredit/enums/LoanInstallmentStatusEnum.d.ts +11 -0
  38. package/bin/loanCredit/enums/LoanInstallmentStatusEnum.js +15 -0
  39. package/bin/loanCredit/index.d.ts +16 -0
  40. package/bin/loanCredit/index.js +36 -0
  41. package/bin/loanScoring/dtos/SciBreakdown.d.ts +29 -0
  42. package/bin/loanScoring/dtos/SciBreakdown.js +2 -0
  43. package/bin/loanScoring/dtos/ScoringDecision.d.ts +29 -0
  44. package/bin/loanScoring/dtos/ScoringDecision.js +2 -0
  45. package/bin/loanScoring/dtos/ScoringOffer.d.ts +18 -0
  46. package/bin/loanScoring/dtos/ScoringOffer.js +2 -0
  47. package/bin/loanScoring/dtos/requests/EvaluateSciRequest.d.ts +23 -0
  48. package/bin/loanScoring/dtos/requests/EvaluateSciRequest.js +54 -0
  49. package/bin/loanScoring/dtos/requests/SciInternalHistoryInput.d.ts +19 -0
  50. package/bin/loanScoring/dtos/requests/SciInternalHistoryInput.js +51 -0
  51. package/bin/loanScoring/dtos/responses/EvaluateSciResponse.d.ts +24 -0
  52. package/bin/loanScoring/dtos/responses/EvaluateSciResponse.js +2 -0
  53. package/bin/loanScoring/dtos/responses/SciEvaluationResponse.d.ts +28 -0
  54. package/bin/loanScoring/dtos/responses/SciEvaluationResponse.js +2 -0
  55. package/bin/loanScoring/enums/ClientLevelEnum.d.ts +13 -0
  56. package/bin/loanScoring/enums/ClientLevelEnum.js +17 -0
  57. package/bin/loanScoring/enums/SciLayer2SourceEnum.d.ts +11 -0
  58. package/bin/loanScoring/enums/SciLayer2SourceEnum.js +15 -0
  59. package/bin/loanScoring/enums/ScoringDecisionEnum.d.ts +14 -0
  60. package/bin/loanScoring/enums/ScoringDecisionEnum.js +18 -0
  61. package/bin/loanScoring/enums/ScoringProviderEnum.d.ts +12 -0
  62. package/bin/loanScoring/enums/ScoringProviderEnum.js +16 -0
  63. package/bin/loanScoring/index.d.ts +11 -0
  64. package/bin/loanScoring/index.js +31 -0
  65. package/bin/places/dtos/AddressCandidate.d.ts +23 -0
  66. package/bin/places/dtos/AddressCandidate.js +11 -0
  67. package/bin/places/dtos/ReverseGeocodeRequest.d.ts +9 -0
  68. package/bin/places/dtos/ReverseGeocodeRequest.js +39 -0
  69. package/bin/places/dtos/ReverseGeocodeResponse.d.ts +5 -0
  70. package/bin/places/dtos/ReverseGeocodeResponse.js +7 -0
  71. package/bin/places/dtos/SearchAddressRequest.d.ts +10 -0
  72. package/bin/places/dtos/SearchAddressRequest.js +38 -0
  73. package/bin/places/dtos/SearchAddressResponse.d.ts +5 -0
  74. package/bin/places/dtos/SearchAddressResponse.js +7 -0
  75. package/bin/places/index.d.ts +5 -0
  76. package/bin/places/index.js +5 -0
  77. package/bin/walletFunding/dtos/CancelFundingReferenceRequest.d.ts +6 -0
  78. package/bin/walletFunding/dtos/CancelFundingReferenceRequest.js +31 -0
  79. package/bin/walletFunding/dtos/CancelFundingReferenceResponse.d.ts +7 -0
  80. package/bin/walletFunding/dtos/CancelFundingReferenceResponse.js +6 -0
  81. package/bin/walletFunding/dtos/CancelFundingRequest.d.ts +11 -0
  82. package/bin/walletFunding/dtos/CancelFundingRequest.js +33 -0
  83. package/bin/walletFunding/dtos/CancelFundingResponse.d.ts +14 -0
  84. package/bin/walletFunding/dtos/CancelFundingResponse.js +12 -0
  85. package/bin/walletFunding/dtos/CancelWalletFundingRequest.d.ts +3 -0
  86. package/bin/walletFunding/dtos/CancelWalletFundingRequest.js +21 -0
  87. package/bin/walletFunding/dtos/CancelWalletFundingResponse.d.ts +7 -0
  88. package/bin/walletFunding/dtos/CancelWalletFundingResponse.js +6 -0
  89. package/package.json +1 -1
  90. package/src/creditEngine/dtos/AnticipatedPaymentQuote.ts +56 -0
  91. package/src/creditEngine/index.ts +1 -0
  92. package/src/index.ts +7 -0
  93. package/src/loanCredit/dtos/ActivationChecklist.ts +25 -0
  94. package/src/loanCredit/dtos/LoanBeneficiary.ts +22 -0
  95. package/src/loanCredit/dtos/LoanBorrower.ts +71 -0
  96. package/src/loanCredit/dtos/LoanCredit.ts +156 -0
  97. package/src/loanCredit/dtos/LoanInstallment.ts +75 -0
  98. package/src/loanCredit/dtos/requests/ChangeLoanCreditStatusRequest.ts +22 -0
  99. package/src/loanCredit/dtos/requests/OriginateLoanCreditRequest.ts +73 -0
  100. package/src/loanCredit/dtos/requests/UpdateActivationChecklistRequest.ts +29 -0
  101. package/src/loanCredit/dtos/requests/UpsertLoanBorrowerRequest.ts +48 -0
  102. package/src/loanCredit/dtos/responses/LoanBorrowerResponse.ts +22 -0
  103. package/src/loanCredit/dtos/responses/LoanCreditResponse.ts +39 -0
  104. package/src/loanCredit/dtos/responses/LoanInstallmentResponse.ts +18 -0
  105. package/src/loanCredit/dtos/responses/OriginateLoanCreditResponse.ts +11 -0
  106. package/src/loanCredit/enums/ClientLevelEnum.ts +11 -0
  107. package/src/loanCredit/enums/LoanCreditStatusEnum.ts +21 -0
  108. package/src/loanCredit/enums/LoanInstallmentStatusEnum.ts +11 -0
  109. package/src/loanCredit/index.ts +23 -0
  110. package/src/loanScoring/dtos/SciBreakdown.ts +33 -0
  111. package/src/loanScoring/dtos/ScoringDecision.ts +30 -0
  112. package/src/loanScoring/dtos/ScoringOffer.ts +18 -0
  113. package/src/loanScoring/dtos/requests/EvaluateSciRequest.ts +43 -0
  114. package/src/loanScoring/dtos/requests/SciInternalHistoryInput.ts +38 -0
  115. package/src/loanScoring/dtos/responses/EvaluateSciResponse.ts +25 -0
  116. package/src/loanScoring/dtos/responses/SciEvaluationResponse.ts +29 -0
  117. package/src/loanScoring/enums/ClientLevelEnum.ts +13 -0
  118. package/src/loanScoring/enums/SciLayer2SourceEnum.ts +11 -0
  119. package/src/loanScoring/enums/ScoringDecisionEnum.ts +14 -0
  120. package/src/loanScoring/enums/ScoringProviderEnum.ts +12 -0
  121. package/src/loanScoring/index.ts +18 -0
  122. package/src/places/dtos/AddressCandidate.ts +23 -0
  123. package/src/places/dtos/ReverseGeocodeRequest.ts +23 -0
  124. package/src/places/dtos/ReverseGeocodeResponse.ts +6 -0
  125. package/src/places/dtos/SearchAddressRequest.ts +23 -0
  126. package/src/places/dtos/SearchAddressResponse.ts +6 -0
  127. package/src/places/index.ts +5 -0
  128. package/bin/loanConfig/enums/ModifiableByRoleEnum.d.ts +0 -11
  129. package/bin/loanConfig/enums/ModifiableByRoleEnum.js +0 -15
  130. package/bin/places/dtos/CashInFeeDto.d.ts +0 -17
  131. package/bin/places/dtos/CashInFeeDto.js +0 -12
  132. package/bin/platformRbac/dtos/ResendOtpRequest.d.ts +0 -22
  133. package/bin/platformRbac/dtos/ResendSelfRegisterOtpRequest.d.ts +0 -11
@@ -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,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,73 @@
1
+ import { Expose } from 'class-transformer';
2
+ import {
3
+ IsEnum,
4
+ IsInt,
5
+ IsNotEmpty,
6
+ IsNumber,
7
+ IsOptional,
8
+ IsString,
9
+ Max,
10
+ Min,
11
+ } from 'class-validator';
12
+ import { ClientLevelEnum } from '../../enums/ClientLevelEnum';
13
+
14
+ /**
15
+ * Body de POST /credits (loan-credit-business). Origina el crédito en `PENDING_ACTIVATION` y genera
16
+ * su plan de cuotas (amortización francesa + IVA 16% — M2 §3 / 05_MOTOR §4).
17
+ *
18
+ * Los términos financieros (`planId`, `termWeeks`, `tnaAnnual`) vienen de la cotización hecha con
19
+ * loan-offerings; el motor recalcula la tabla internamente (la cotización es informativa, el plan
20
+ * de cuotas del crédito lo genera y persiste este lambda).
21
+ */
22
+ export class OriginateLoanCreditRequest {
23
+ @Expose()
24
+ @IsString()
25
+ @IsNotEmpty()
26
+ borrowerId!: string;
27
+
28
+ @Expose()
29
+ @IsString()
30
+ @IsNotEmpty()
31
+ planId!: string;
32
+
33
+ @Expose()
34
+ @IsInt()
35
+ @Min(1)
36
+ @Max(104)
37
+ termWeeks!: number;
38
+
39
+ @Expose()
40
+ @IsInt()
41
+ @Min(1)
42
+ equipmentPriceCents!: number;
43
+
44
+ @Expose()
45
+ @IsInt()
46
+ @Min(0)
47
+ downPaymentCents!: number;
48
+
49
+ /** TNA decimal (`2.30` = 230%). */
50
+ @Expose()
51
+ @IsNumber()
52
+ @Min(0)
53
+ @Max(10)
54
+ tnaAnnual!: number;
55
+
56
+ /** SCI del cliente al originar (snapshot). */
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
+ @Expose()
70
+ @IsOptional()
71
+ @IsString()
72
+ imei?: string;
73
+ }
@@ -0,0 +1,29 @@
1
+ import { Expose } from 'class-transformer';
2
+ import { IsBoolean, IsOptional } from 'class-validator';
3
+
4
+ /**
5
+ * Body de PUT /credits/:creditId/checklist (loan-credit-business). Marca condiciones de activación
6
+ * cumplidas. Solo se mandan las que cambian; en F3 las marcarán los flujos de firma de contrato
7
+ * (`downPayment` + `contractSigned`) y de enrolamiento MDM (`imeiEnrolled` + `lockVerified`).
8
+ */
9
+ export class UpdateActivationChecklistRequest {
10
+ @Expose()
11
+ @IsOptional()
12
+ @IsBoolean()
13
+ downPayment?: boolean;
14
+
15
+ @Expose()
16
+ @IsOptional()
17
+ @IsBoolean()
18
+ contractSigned?: boolean;
19
+
20
+ @Expose()
21
+ @IsOptional()
22
+ @IsBoolean()
23
+ imeiEnrolled?: boolean;
24
+
25
+ @Expose()
26
+ @IsOptional()
27
+ @IsBoolean()
28
+ lockVerified?: boolean;
29
+ }
@@ -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 '../../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,22 @@
1
+ import { ClientLevelEnum } from '../../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,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
+ }