@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.
Files changed (115) 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/walletFunding/dtos/CancelFundingReferenceRequest.d.ts +6 -0
  66. package/bin/walletFunding/dtos/CancelFundingReferenceRequest.js +31 -0
  67. package/bin/walletFunding/dtos/CancelFundingReferenceResponse.d.ts +7 -0
  68. package/bin/walletFunding/dtos/CancelFundingReferenceResponse.js +6 -0
  69. package/bin/walletFunding/dtos/CancelFundingRequest.d.ts +11 -0
  70. package/bin/walletFunding/dtos/CancelFundingRequest.js +33 -0
  71. package/bin/walletFunding/dtos/CancelFundingResponse.d.ts +14 -0
  72. package/bin/walletFunding/dtos/CancelFundingResponse.js +12 -0
  73. package/bin/walletFunding/dtos/CancelWalletFundingRequest.d.ts +3 -0
  74. package/bin/walletFunding/dtos/CancelWalletFundingRequest.js +21 -0
  75. package/bin/walletFunding/dtos/CancelWalletFundingResponse.d.ts +7 -0
  76. package/bin/walletFunding/dtos/CancelWalletFundingResponse.js +6 -0
  77. package/package.json +1 -1
  78. package/src/creditEngine/dtos/AnticipatedPaymentQuote.ts +56 -0
  79. package/src/creditEngine/index.ts +1 -0
  80. package/src/index.ts +7 -0
  81. package/src/loanCredit/dtos/ActivationChecklist.ts +25 -0
  82. package/src/loanCredit/dtos/LoanBeneficiary.ts +22 -0
  83. package/src/loanCredit/dtos/LoanBorrower.ts +71 -0
  84. package/src/loanCredit/dtos/LoanCredit.ts +156 -0
  85. package/src/loanCredit/dtos/LoanInstallment.ts +75 -0
  86. package/src/loanCredit/dtos/requests/ChangeLoanCreditStatusRequest.ts +22 -0
  87. package/src/loanCredit/dtos/requests/OriginateLoanCreditRequest.ts +73 -0
  88. package/src/loanCredit/dtos/requests/UpdateActivationChecklistRequest.ts +29 -0
  89. package/src/loanCredit/dtos/requests/UpsertLoanBorrowerRequest.ts +48 -0
  90. package/src/loanCredit/dtos/responses/LoanBorrowerResponse.ts +22 -0
  91. package/src/loanCredit/dtos/responses/LoanCreditResponse.ts +39 -0
  92. package/src/loanCredit/dtos/responses/LoanInstallmentResponse.ts +18 -0
  93. package/src/loanCredit/dtos/responses/OriginateLoanCreditResponse.ts +11 -0
  94. package/src/loanCredit/enums/ClientLevelEnum.ts +11 -0
  95. package/src/loanCredit/enums/LoanCreditStatusEnum.ts +21 -0
  96. package/src/loanCredit/enums/LoanInstallmentStatusEnum.ts +11 -0
  97. package/src/loanCredit/index.ts +23 -0
  98. package/src/loanScoring/dtos/SciBreakdown.ts +33 -0
  99. package/src/loanScoring/dtos/ScoringDecision.ts +30 -0
  100. package/src/loanScoring/dtos/ScoringOffer.ts +18 -0
  101. package/src/loanScoring/dtos/requests/EvaluateSciRequest.ts +43 -0
  102. package/src/loanScoring/dtos/requests/SciInternalHistoryInput.ts +38 -0
  103. package/src/loanScoring/dtos/responses/EvaluateSciResponse.ts +25 -0
  104. package/src/loanScoring/dtos/responses/SciEvaluationResponse.ts +29 -0
  105. package/src/loanScoring/enums/ClientLevelEnum.ts +13 -0
  106. package/src/loanScoring/enums/SciLayer2SourceEnum.ts +11 -0
  107. package/src/loanScoring/enums/ScoringDecisionEnum.ts +14 -0
  108. package/src/loanScoring/enums/ScoringProviderEnum.ts +12 -0
  109. package/src/loanScoring/index.ts +18 -0
  110. package/bin/loanConfig/enums/ModifiableByRoleEnum.d.ts +0 -11
  111. package/bin/loanConfig/enums/ModifiableByRoleEnum.js +0 -15
  112. package/bin/places/dtos/CashInFeeDto.d.ts +0 -17
  113. package/bin/places/dtos/CashInFeeDto.js +0 -12
  114. package/bin/platformRbac/dtos/ResendOtpRequest.d.ts +0 -22
  115. package/bin/platformRbac/dtos/ResendSelfRegisterOtpRequest.d.ts +0 -11
@@ -0,0 +1,12 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.CancelFundingResponse = void 0;
4
+ /**
5
+ * Response del cancel via Centro de Beneficios (spec 13 v2.0).
6
+ * `status` reusa `BenefitPaymentStatusEnum` (APPROVED = cancel aceptado;
7
+ * REJECTED = no se pudo) para consistencia con `CancelFundingReferenceResponse`
8
+ * (marketplace ↔ connector). Idempotente: re-cancelar devuelve APPROVED.
9
+ */
10
+ class CancelFundingResponse {
11
+ }
12
+ exports.CancelFundingResponse = CancelFundingResponse;
@@ -0,0 +1,3 @@
1
+ export declare class CancelWalletFundingRequest {
2
+ idempotencyKey: string;
3
+ }
@@ -0,0 +1,21 @@
1
+ "use strict";
2
+ var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
3
+ var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
4
+ if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
5
+ else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
6
+ return c > 3 && r && Object.defineProperty(target, key, r), r;
7
+ };
8
+ var __metadata = (this && this.__metadata) || function (k, v) {
9
+ if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
10
+ };
11
+ Object.defineProperty(exports, "__esModule", { value: true });
12
+ exports.CancelWalletFundingRequest = void 0;
13
+ const class_validator_1 = require("class-validator");
14
+ class CancelWalletFundingRequest {
15
+ }
16
+ exports.CancelWalletFundingRequest = CancelWalletFundingRequest;
17
+ __decorate([
18
+ (0, class_validator_1.IsString)(),
19
+ (0, class_validator_1.MaxLength)(64),
20
+ __metadata("design:type", String)
21
+ ], CancelWalletFundingRequest.prototype, "idempotencyKey", void 0);
@@ -0,0 +1,7 @@
1
+ import { BenefitPaymentStatusEnum } from "../../benefitCenter/enums/BenefitPaymentStatusEnum";
2
+ import { WalletFundingErrorCodeEnum } from "../enums/WalletFundingErrorCodeEnum";
3
+ export declare class CancelWalletFundingResponse {
4
+ status: BenefitPaymentStatusEnum;
5
+ errorCode?: WalletFundingErrorCodeEnum;
6
+ reference?: string;
7
+ }
@@ -0,0 +1,6 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.CancelWalletFundingResponse = void 0;
4
+ class CancelWalletFundingResponse {
5
+ }
6
+ exports.CancelWalletFundingResponse = CancelWalletFundingResponse;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@fiado/type-kit",
3
- "version": "3.196.0",
3
+ "version": "3.198.0",
4
4
  "description": "",
5
5
  "main": "bin/index.js",
6
6
  "types": "bin/index.d.ts",
@@ -0,0 +1,56 @@
1
+ import { PaymentScheduleItemResponse } from "./PaymentScheduleItemResponse";
2
+
3
+ /**
4
+ * Preview / cotizacion de un abono a capital (ANTICIPATED) antes de ejecutarlo.
5
+ *
6
+ * Reusa el mismo motor de recalculo que la ejecucion real
7
+ * (ScheduleRecalculationService.redistributeCapital) — no persiste nada.
8
+ *
9
+ * Regla de negocio: el abono acorta la cuota semanal, NO el plazo. El numero
10
+ * de cupones se mantiene igual; los PENDING se re-amortizan sobre el nuevo
11
+ * saldo, los PARTIAL se escalan proporcionalmente y los PAID quedan intactos.
12
+ */
13
+ export class AnticipatedPaymentQuote {
14
+ creditId!: string;
15
+
16
+ /** Monto que el usuario propuso, capeado al outstanding real del credito. */
17
+ amountMxn!: number;
18
+
19
+ /** Estado actual (as-is) del credito, antes de aplicar el abono. */
20
+ current!: AnticipatedPaymentSummary;
21
+
22
+ /** Estado proyectado (as-if) despues de aplicar el abono. */
23
+ after!: AnticipatedPaymentSummary;
24
+
25
+ /** Diferencia entre `current` y `after` — cuanto ahorra el usuario. */
26
+ savings!: AnticipatedPaymentSavings;
27
+
28
+ /**
29
+ * Calendario completo proyectado (todos los cupones: PAID historicos,
30
+ * PARTIAL escalados, PENDING re-amortizados). Mismo shape que
31
+ * `GET /credit/{creditId}/schedule` para que el frontend renderice con
32
+ * el mismo componente.
33
+ */
34
+ newSchedule!: PaymentScheduleItemResponse[];
35
+
36
+ /** ISO timestamp de la cotizacion. */
37
+ quoteDate!: string;
38
+ }
39
+
40
+ export class AnticipatedPaymentSummary {
41
+ /** Cuota semanal vigente. */
42
+ weeklyPaymentMxn!: number;
43
+ /** Saldo insoluto (capital pendiente). */
44
+ outstandingMxn!: number;
45
+ /** Cupones que aun no estan PAID (incluye PARTIAL). */
46
+ remainingCoupons!: number;
47
+ /** Total pendiente a pagar (capital + interes + IVA de cupones no PAID). */
48
+ totalToPayMxn!: number;
49
+ }
50
+
51
+ export class AnticipatedPaymentSavings {
52
+ /** Reduccion en la cuota semanal (current - after). */
53
+ weeklyMxn!: number;
54
+ /** Reduccion total en intereses + IVA a pagar (current - after). */
55
+ totalInterestMxn!: number;
56
+ }
@@ -18,3 +18,4 @@ export * from './dtos/CreditSignatureResult';
18
18
  export * from './dtos/EarlyPaymentResult';
19
19
  export * from './dtos/OfferResult';
20
20
  export * from './dtos/SettlementQuote';
21
+ export * from './dtos/AnticipatedPaymentQuote';
package/src/index.ts CHANGED
@@ -123,5 +123,12 @@ export * as LoanOfferings from './loanOfferings';
123
123
  // LoanCollectorAssignment: DTOs/enums del lambda loan-collector-assignment-business (comp 08 — reglas de
124
124
  // asignación de cartera de cobranza + asignaciones crédito↔cobrador; SureKeep Fase 1 — pista Loan).
125
125
  export * as LoanCollectorAssignment from './loanCollectorAssignment';
126
+ // LoanCredit: DTOs/enums del lambda loan-credit-business (comp 09 F2/F3 — motor de crédito SOFOM:
127
+ // acreditado, crédito, plan de cuotas con amortización francesa + IVA 16%; SureKeep — pista Loan).
128
+ export * as LoanCredit from './loanCredit';
129
+ // LoanScoring: DTOs/enums del lambda loan-scoring-business (comp 08 F2 — SCI M7 de 3 capas +
130
+ // ScoringProviderRouter configurable Modelias|Círculo con contrato agnóstico ScoringDecision;
131
+ // SureKeep Fase 2 — pista Loan/SOFOM).
132
+ export * as LoanScoring from './loanScoring';
126
133
  export * from './messaging';
127
134
  export * from './complaint';
@@ -0,0 +1,25 @@
1
+ import { Expose } from 'class-transformer';
2
+ import { IsBoolean } from 'class-validator';
3
+
4
+ /**
5
+ * Las 4 condiciones de activación del crédito (M2 §5 / 05_MOTOR §7). El crédito solo puede pasar a
6
+ * `ACTIVE` cuando las 4 son `true`. `downPayment`/`contractSigned` las marca la firma del contrato;
7
+ * `imeiEnrolled`/`lockVerified` las marca el enrolamiento MDM.
8
+ */
9
+ export class ActivationChecklist {
10
+ @Expose()
11
+ @IsBoolean()
12
+ downPayment!: boolean;
13
+
14
+ @Expose()
15
+ @IsBoolean()
16
+ contractSigned!: boolean;
17
+
18
+ @Expose()
19
+ @IsBoolean()
20
+ imeiEnrolled!: boolean;
21
+
22
+ @Expose()
23
+ @IsBoolean()
24
+ lockVerified!: boolean;
25
+ }
@@ -0,0 +1,22 @@
1
+ import { Expose } from 'class-transformer';
2
+ import { IsNotEmpty, IsOptional, IsString } from 'class-validator';
3
+
4
+ /**
5
+ * Beneficiario declarado por el acreditado (modelo-datos §5b `LoanBorrower.beneficiary`).
6
+ */
7
+ export class LoanBeneficiary {
8
+ @Expose()
9
+ @IsString()
10
+ @IsNotEmpty()
11
+ fullName!: string;
12
+
13
+ @Expose()
14
+ @IsOptional()
15
+ @IsString()
16
+ relationship?: string;
17
+
18
+ @Expose()
19
+ @IsOptional()
20
+ @IsString()
21
+ phone?: string;
22
+ }
@@ -0,0 +1,71 @@
1
+ import { Expose, Type } from 'class-transformer';
2
+ import {
3
+ IsInt,
4
+ IsEnum,
5
+ IsOptional,
6
+ IsString,
7
+ Matches,
8
+ Max,
9
+ Min,
10
+ ValidateNested,
11
+ } from 'class-validator';
12
+ import { regexIso8601 } from '../../helpers/constans/regex';
13
+ import { ClientLevelEnum } from '../enums/ClientLevelEnum';
14
+ import { LoanBeneficiary } from './LoanBeneficiary';
15
+
16
+ /**
17
+ * LoanBorrower — el acreditado de la SOFOM (modelo-datos §5b · owner `loan-credit-business`).
18
+ * Se hidrata desde el evento `CustomerKycVerifiedV1` de retail-customer (idempotente por
19
+ * `retailCustomerId`). `sciScore`/`clientLevel` los actualiza loan-scoring tras cada evaluación.
20
+ */
21
+ export class LoanBorrower {
22
+ @Expose()
23
+ @IsString()
24
+ borrowerId!: string;
25
+
26
+ /** FK al comprador de retail (`RetailCustomer` — owner retail-customer-business). */
27
+ @Expose()
28
+ @IsString()
29
+ retailCustomerId!: string;
30
+
31
+ /** SCI vigente 0-100 (M7). Ausente hasta la primera evaluación. */
32
+ @Expose()
33
+ @IsOptional()
34
+ @IsInt()
35
+ @Min(0)
36
+ @Max(100)
37
+ sciScore?: number;
38
+
39
+ @Expose()
40
+ @IsOptional()
41
+ @IsEnum(ClientLevelEnum)
42
+ clientLevel?: ClientLevelEnum;
43
+
44
+ /** Score FICO/FIS del buró en la última consulta (Círculo de Crédito). */
45
+ @Expose()
46
+ @IsOptional()
47
+ @IsInt()
48
+ bureauScore?: number;
49
+
50
+ @Expose()
51
+ @IsOptional()
52
+ @ValidateNested()
53
+ @Type(() => LoanBeneficiary)
54
+ beneficiary?: LoanBeneficiary;
55
+
56
+ @Expose()
57
+ @IsString()
58
+ createdBy!: string;
59
+
60
+ @Expose()
61
+ @IsString()
62
+ updatedBy!: string;
63
+
64
+ @Expose()
65
+ @Matches(regexIso8601)
66
+ createdAt!: string;
67
+
68
+ @Expose()
69
+ @Matches(regexIso8601)
70
+ updatedAt!: string;
71
+ }
@@ -0,0 +1,156 @@
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 '../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
+ /** IMEI del equipo financiado (se fija en el enrolamiento MDM). */
95
+ @Expose()
96
+ @IsOptional()
97
+ @IsString()
98
+ imei?: string;
99
+
100
+ @Expose()
101
+ @ValidateNested()
102
+ @Type(() => ActivationChecklist)
103
+ activationChecklist!: ActivationChecklist;
104
+
105
+ /** SCI del cliente al originar (snapshot, 0-100). */
106
+ @Expose()
107
+ @IsOptional()
108
+ @IsInt()
109
+ @Min(0)
110
+ @Max(100)
111
+ sciAtOrigination?: number;
112
+
113
+ @Expose()
114
+ @IsOptional()
115
+ @IsEnum(ClientLevelEnum)
116
+ clientLevelAtOrigination?: ClientLevelEnum;
117
+
118
+ @Expose()
119
+ @IsOptional()
120
+ @Matches(regexIso8601)
121
+ activatedAt?: string;
122
+
123
+ /** Fin de la ventana de cancelación voluntaria = activatedAt + 7 días naturales (M2 §11.3). */
124
+ @Expose()
125
+ @IsOptional()
126
+ @Matches(regexIso8601)
127
+ voluntaryCancelDeadline?: string;
128
+
129
+ /** Vencimiento de la primera cuota (primer viernes después de la activación). */
130
+ @Expose()
131
+ @IsOptional()
132
+ @IsString()
133
+ firstDueDate?: string;
134
+
135
+ /** Vencimiento de la última cuota. */
136
+ @Expose()
137
+ @IsOptional()
138
+ @IsString()
139
+ lastDueDate?: string;
140
+
141
+ @Expose()
142
+ @IsString()
143
+ createdBy!: string;
144
+
145
+ @Expose()
146
+ @IsString()
147
+ updatedBy!: string;
148
+
149
+ @Expose()
150
+ @Matches(regexIso8601)
151
+ createdAt!: string;
152
+
153
+ @Expose()
154
+ @Matches(regexIso8601)
155
+ updatedAt!: string;
156
+ }
@@ -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
+ }