@fiado/type-kit 3.198.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.
Files changed (68) hide show
  1. package/bin/loanCredit/dtos/LoanBorrower.d.ts +1 -1
  2. package/bin/loanCredit/dtos/LoanBorrower.js +1 -1
  3. package/bin/loanCredit/dtos/LoanContract.d.ts +27 -0
  4. package/bin/loanCredit/dtos/LoanContract.js +91 -0
  5. package/bin/loanCredit/dtos/LoanCredit.d.ts +5 -1
  6. package/bin/loanCredit/dtos/LoanCredit.js +14 -1
  7. package/bin/loanCredit/dtos/requests/ActivationCheckRequest.d.ts +21 -0
  8. package/bin/loanCredit/dtos/requests/ActivationCheckRequest.js +52 -0
  9. package/bin/loanCredit/dtos/requests/OriginateLoanCreditRequest.d.ts +12 -9
  10. package/bin/loanCredit/dtos/requests/OriginateLoanCreditRequest.js +14 -13
  11. package/bin/loanCredit/dtos/requests/QuoteLoanCreditRequest.d.ts +11 -0
  12. package/bin/loanCredit/dtos/requests/QuoteLoanCreditRequest.js +39 -0
  13. package/bin/loanCredit/dtos/requests/SignLoanCreditRequest.d.ts +17 -0
  14. package/bin/loanCredit/dtos/requests/SignLoanCreditRequest.js +37 -0
  15. package/bin/loanCredit/dtos/requests/UpsertLoanBorrowerRequest.d.ts +1 -1
  16. package/bin/loanCredit/dtos/requests/UpsertLoanBorrowerRequest.js +1 -1
  17. package/bin/loanCredit/dtos/responses/ActivationCheckResponse.d.ts +10 -0
  18. package/bin/loanCredit/dtos/responses/ActivationCheckResponse.js +2 -0
  19. package/bin/loanCredit/dtos/responses/LoanBorrowerResponse.d.ts +1 -1
  20. package/bin/loanCredit/dtos/responses/LoanContractResponse.d.ts +16 -0
  21. package/bin/loanCredit/dtos/responses/LoanContractResponse.js +2 -0
  22. package/bin/loanCredit/dtos/responses/LoanCreditResponse.d.ts +1 -1
  23. package/bin/loanCredit/dtos/responses/OriginateLoanCreditResponse.d.ts +5 -2
  24. package/bin/loanCredit/dtos/responses/QuoteLoanCreditResponse.d.ts +10 -0
  25. package/bin/loanCredit/dtos/responses/QuoteLoanCreditResponse.js +2 -0
  26. package/bin/loanCredit/dtos/responses/SignLoanCreditResponse.d.ts +20 -0
  27. package/bin/loanCredit/dtos/responses/SignLoanCreditResponse.js +2 -0
  28. package/bin/loanCredit/enums/ContractTypeEnum.d.ts +12 -0
  29. package/bin/loanCredit/enums/ContractTypeEnum.js +16 -0
  30. package/bin/loanCredit/enums/LoanInstallmentStatusEnum.d.ts +5 -2
  31. package/bin/loanCredit/enums/LoanInstallmentStatusEnum.js +5 -2
  32. package/bin/loanCredit/index.d.ts +10 -2
  33. package/bin/loanCredit/index.js +13 -2
  34. package/package.json +1 -1
  35. package/src/loanCredit/dtos/LoanBorrower.ts +1 -1
  36. package/src/loanCredit/dtos/LoanContract.ts +70 -0
  37. package/src/loanCredit/dtos/LoanCredit.ts +14 -1
  38. package/src/loanCredit/dtos/requests/ActivationCheckRequest.ts +39 -0
  39. package/src/loanCredit/dtos/requests/OriginateLoanCreditRequest.ts +16 -15
  40. package/src/loanCredit/dtos/requests/QuoteLoanCreditRequest.ts +24 -0
  41. package/src/loanCredit/dtos/requests/SignLoanCreditRequest.ts +24 -0
  42. package/src/loanCredit/dtos/requests/UpsertLoanBorrowerRequest.ts +1 -1
  43. package/src/loanCredit/dtos/responses/ActivationCheckResponse.ts +11 -0
  44. package/src/loanCredit/dtos/responses/LoanBorrowerResponse.ts +1 -1
  45. package/src/loanCredit/dtos/responses/LoanContractResponse.ts +17 -0
  46. package/src/loanCredit/dtos/responses/LoanCreditResponse.ts +1 -1
  47. package/src/loanCredit/dtos/responses/OriginateLoanCreditResponse.ts +5 -2
  48. package/src/loanCredit/dtos/responses/QuoteLoanCreditResponse.ts +11 -0
  49. package/src/loanCredit/dtos/responses/SignLoanCreditResponse.ts +21 -0
  50. package/src/loanCredit/enums/ContractTypeEnum.ts +12 -0
  51. package/src/loanCredit/enums/LoanInstallmentStatusEnum.ts +5 -2
  52. package/src/loanCredit/index.ts +11 -2
  53. package/bin/benefitCenter/enums/BenefitFlowEnum.d.ts +0 -11
  54. package/bin/benefitCenter/enums/BenefitFlowEnum.js +0 -15
  55. package/bin/walletFunding/dtos/CancelFundingReferenceRequest.d.ts +0 -6
  56. package/bin/walletFunding/dtos/CancelFundingReferenceRequest.js +0 -31
  57. package/bin/walletFunding/dtos/CancelFundingReferenceResponse.d.ts +0 -7
  58. package/bin/walletFunding/dtos/CancelFundingReferenceResponse.js +0 -6
  59. package/bin/walletFunding/dtos/CancelFundingRequest.d.ts +0 -11
  60. package/bin/walletFunding/dtos/CancelFundingRequest.js +0 -33
  61. package/bin/walletFunding/dtos/CancelFundingResponse.d.ts +0 -14
  62. package/bin/walletFunding/dtos/CancelFundingResponse.js +0 -12
  63. package/bin/walletFunding/dtos/CancelWalletFundingRequest.d.ts +0 -3
  64. package/bin/walletFunding/dtos/CancelWalletFundingRequest.js +0 -21
  65. package/bin/walletFunding/dtos/CancelWalletFundingResponse.d.ts +0 -7
  66. package/bin/walletFunding/dtos/CancelWalletFundingResponse.js +0 -6
  67. package/src/loanCredit/dtos/requests/UpdateActivationChecklistRequest.ts +0 -29
  68. package/src/loanCredit/enums/ClientLevelEnum.ts +0 -11
@@ -1,4 +1,4 @@
1
- import { ClientLevelEnum } from '../enums/ClientLevelEnum';
1
+ import { ClientLevelEnum } from '../../loanScoring/enums/ClientLevelEnum';
2
2
  import { LoanBeneficiary } from './LoanBeneficiary';
3
3
  /**
4
4
  * LoanBorrower — el acreditado de la SOFOM (modelo-datos §5b · owner `loan-credit-business`).
@@ -13,7 +13,7 @@ exports.LoanBorrower = void 0;
13
13
  const class_transformer_1 = require("class-transformer");
14
14
  const class_validator_1 = require("class-validator");
15
15
  const regex_1 = require("../../helpers/constans/regex");
16
- const ClientLevelEnum_1 = require("../enums/ClientLevelEnum");
16
+ const ClientLevelEnum_1 = require("../../loanScoring/enums/ClientLevelEnum");
17
17
  const LoanBeneficiary_1 = require("./LoanBeneficiary");
18
18
  /**
19
19
  * LoanBorrower — el acreditado de la SOFOM (modelo-datos §5b · owner `loan-credit-business`).
@@ -0,0 +1,27 @@
1
+ import { ContractTypeEnum } from '../enums/ContractTypeEnum';
2
+ /**
3
+ * LoanContract — documento del contrato de crédito con firma FES (modelo-datos §5b ·
4
+ * `<T>LoanContract_GT` · M2 §4.3-§4.4). Un registro por documento (3 por crédito — C4).
5
+ *
6
+ * Nace DRAFT en la originación (sin PDF); la firma FES genera el PDF, calcula su `sha256`,
7
+ * verifica el OTP y sella con NOM-151. Conservación documental: 10 años (NOM-151).
8
+ * `signedAt` ausente = draft sin firmar.
9
+ */
10
+ export declare class LoanContract {
11
+ contractId: string;
12
+ creditId: string;
13
+ type: ContractTypeEnum;
14
+ /** Key del PDF en el bucket del tenant (`loan-{tenant}-{env}`). Ausente hasta generar (AS-09). */
15
+ pdfS3Key?: string;
16
+ /** Hash SHA-256 del PDF firmado (trazabilidad FES — M2 §4.4). Ausente hasta generar. */
17
+ sha256?: string;
18
+ /** El OTP de firma fue verificado (voluntad de firma — FES). */
19
+ otpVerified: boolean;
20
+ /** Sello de tiempo NOM-151 (TSA). Ausente hasta firmar (AS del TSA connector). */
21
+ nom151Timestamp?: string;
22
+ signedAt?: string;
23
+ createdBy: string;
24
+ updatedBy: string;
25
+ createdAt: string;
26
+ updatedAt: string;
27
+ }
@@ -0,0 +1,91 @@
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.LoanContract = void 0;
13
+ const class_transformer_1 = require("class-transformer");
14
+ const class_validator_1 = require("class-validator");
15
+ const regex_1 = require("../../helpers/constans/regex");
16
+ const ContractTypeEnum_1 = require("../enums/ContractTypeEnum");
17
+ /**
18
+ * LoanContract — documento del contrato de crédito con firma FES (modelo-datos §5b ·
19
+ * `<T>LoanContract_GT` · M2 §4.3-§4.4). Un registro por documento (3 por crédito — C4).
20
+ *
21
+ * Nace DRAFT en la originación (sin PDF); la firma FES genera el PDF, calcula su `sha256`,
22
+ * verifica el OTP y sella con NOM-151. Conservación documental: 10 años (NOM-151).
23
+ * `signedAt` ausente = draft sin firmar.
24
+ */
25
+ class LoanContract {
26
+ }
27
+ exports.LoanContract = LoanContract;
28
+ __decorate([
29
+ (0, class_transformer_1.Expose)(),
30
+ (0, class_validator_1.IsString)(),
31
+ __metadata("design:type", String)
32
+ ], LoanContract.prototype, "contractId", void 0);
33
+ __decorate([
34
+ (0, class_transformer_1.Expose)(),
35
+ (0, class_validator_1.IsString)(),
36
+ __metadata("design:type", String)
37
+ ], LoanContract.prototype, "creditId", void 0);
38
+ __decorate([
39
+ (0, class_transformer_1.Expose)(),
40
+ (0, class_validator_1.IsEnum)(ContractTypeEnum_1.ContractTypeEnum),
41
+ __metadata("design:type", String)
42
+ ], LoanContract.prototype, "type", void 0);
43
+ __decorate([
44
+ (0, class_transformer_1.Expose)(),
45
+ (0, class_validator_1.IsOptional)(),
46
+ (0, class_validator_1.IsString)(),
47
+ __metadata("design:type", String)
48
+ ], LoanContract.prototype, "pdfS3Key", void 0);
49
+ __decorate([
50
+ (0, class_transformer_1.Expose)(),
51
+ (0, class_validator_1.IsOptional)(),
52
+ (0, class_validator_1.IsString)(),
53
+ __metadata("design:type", String)
54
+ ], LoanContract.prototype, "sha256", void 0);
55
+ __decorate([
56
+ (0, class_transformer_1.Expose)(),
57
+ (0, class_validator_1.IsBoolean)(),
58
+ __metadata("design:type", Boolean)
59
+ ], LoanContract.prototype, "otpVerified", void 0);
60
+ __decorate([
61
+ (0, class_transformer_1.Expose)(),
62
+ (0, class_validator_1.IsOptional)(),
63
+ (0, class_validator_1.IsString)(),
64
+ __metadata("design:type", String)
65
+ ], LoanContract.prototype, "nom151Timestamp", void 0);
66
+ __decorate([
67
+ (0, class_transformer_1.Expose)(),
68
+ (0, class_validator_1.IsOptional)(),
69
+ (0, class_validator_1.Matches)(regex_1.regexIso8601),
70
+ __metadata("design:type", String)
71
+ ], LoanContract.prototype, "signedAt", void 0);
72
+ __decorate([
73
+ (0, class_transformer_1.Expose)(),
74
+ (0, class_validator_1.IsString)(),
75
+ __metadata("design:type", String)
76
+ ], LoanContract.prototype, "createdBy", void 0);
77
+ __decorate([
78
+ (0, class_transformer_1.Expose)(),
79
+ (0, class_validator_1.IsString)(),
80
+ __metadata("design:type", String)
81
+ ], LoanContract.prototype, "updatedBy", void 0);
82
+ __decorate([
83
+ (0, class_transformer_1.Expose)(),
84
+ (0, class_validator_1.Matches)(regex_1.regexIso8601),
85
+ __metadata("design:type", String)
86
+ ], LoanContract.prototype, "createdAt", void 0);
87
+ __decorate([
88
+ (0, class_transformer_1.Expose)(),
89
+ (0, class_validator_1.Matches)(regex_1.regexIso8601),
90
+ __metadata("design:type", String)
91
+ ], LoanContract.prototype, "updatedAt", void 0);
@@ -1,4 +1,4 @@
1
- import { ClientLevelEnum } from '../enums/ClientLevelEnum';
1
+ import { ClientLevelEnum } from '../../loanScoring/enums/ClientLevelEnum';
2
2
  import { LoanCreditStatusEnum } from '../enums/LoanCreditStatusEnum';
3
3
  import { ActivationChecklist } from './ActivationChecklist';
4
4
  /**
@@ -30,6 +30,10 @@ export declare class LoanCredit {
30
30
  totalIvaCents: number;
31
31
  /** Total a pagar = capital + intereses + IVA. */
32
32
  totalToPayCents: number;
33
+ /** CAT decimal (`3.85` = 385%) — lo calcula el simulador de loan-offerings (C3/AS-01). */
34
+ catAnnual?: number;
35
+ /** Sesión del wizard que originó — clave de idempotencia del originate (AS-07). */
36
+ wizardSessionId?: string;
33
37
  /** IMEI del equipo financiado (se fija en el enrolamiento MDM). */
34
38
  imei?: string;
35
39
  activationChecklist: ActivationChecklist;
@@ -13,7 +13,7 @@ exports.LoanCredit = void 0;
13
13
  const class_transformer_1 = require("class-transformer");
14
14
  const class_validator_1 = require("class-validator");
15
15
  const regex_1 = require("../../helpers/constans/regex");
16
- const ClientLevelEnum_1 = require("../enums/ClientLevelEnum");
16
+ const ClientLevelEnum_1 = require("../../loanScoring/enums/ClientLevelEnum");
17
17
  const LoanCreditStatusEnum_1 = require("../enums/LoanCreditStatusEnum");
18
18
  const ActivationChecklist_1 = require("./ActivationChecklist");
19
19
  /**
@@ -102,6 +102,19 @@ __decorate([
102
102
  (0, class_validator_1.IsInt)(),
103
103
  __metadata("design:type", Number)
104
104
  ], LoanCredit.prototype, "totalToPayCents", void 0);
105
+ __decorate([
106
+ (0, class_transformer_1.Expose)(),
107
+ (0, class_validator_1.IsOptional)(),
108
+ (0, class_validator_1.IsNumber)(),
109
+ (0, class_validator_1.Min)(0),
110
+ __metadata("design:type", Number)
111
+ ], LoanCredit.prototype, "catAnnual", void 0);
112
+ __decorate([
113
+ (0, class_transformer_1.Expose)(),
114
+ (0, class_validator_1.IsOptional)(),
115
+ (0, class_validator_1.IsString)(),
116
+ __metadata("design:type", String)
117
+ ], LoanCredit.prototype, "wizardSessionId", void 0);
105
118
  __decorate([
106
119
  (0, class_transformer_1.Expose)(),
107
120
  (0, class_validator_1.IsOptional)(),
@@ -0,0 +1,21 @@
1
+ /**
2
+ * Body de `POST /private/credits/:creditId/activate-check` (loan-credit-business — M2 §5).
3
+ * Marca condiciones del checklist de activación cumplidas (solo las que cambian, solo a `true`):
4
+ * `downPayment` la reporta el wizard al confirmar el enganche (paso 07); `imeiEnrolled` +
5
+ * `lockVerified` las dispara el paso 09 variante crédito (enrolamiento MDM vía la abstracción de
6
+ * proveedor). `contractSigned` NO se marca por acá — solo la firma FES (endpoint sign).
7
+ *
8
+ * Cuando las 4 condiciones quedan `true` en el mismo request → el crédito pasa a `ACTIVE`:
9
+ * vencimientos `activatedAt + n×7d` (domingo→lunes), `voluntaryCancelDeadline = +7d`, flag de
10
+ * cobro PCF configurado (C7 — solo flag, el débito real requiere adendum).
11
+ */
12
+ export declare class ActivationCheckRequest {
13
+ /** Enganche confirmado (efectivo/débito inmediato; SPEI espera confirmación — M2 §5). */
14
+ downPayment?: boolean;
15
+ /** IMEI enrolado en MDM. Dispara el enroll vía `MdmConnectorRouter` si aún no se hizo. */
16
+ imeiEnrolled?: boolean;
17
+ /** Software de bloqueo verificado (el MDM reporta "activo"). */
18
+ lockVerified?: boolean;
19
+ /** IMEI del equipo (paso 09) si no se fijó en el originate. Luhn-validado por el motor. */
20
+ imei?: string;
21
+ }
@@ -0,0 +1,52 @@
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.ActivationCheckRequest = void 0;
13
+ const class_transformer_1 = require("class-transformer");
14
+ const class_validator_1 = require("class-validator");
15
+ /**
16
+ * Body de `POST /private/credits/:creditId/activate-check` (loan-credit-business — M2 §5).
17
+ * Marca condiciones del checklist de activación cumplidas (solo las que cambian, solo a `true`):
18
+ * `downPayment` la reporta el wizard al confirmar el enganche (paso 07); `imeiEnrolled` +
19
+ * `lockVerified` las dispara el paso 09 variante crédito (enrolamiento MDM vía la abstracción de
20
+ * proveedor). `contractSigned` NO se marca por acá — solo la firma FES (endpoint sign).
21
+ *
22
+ * Cuando las 4 condiciones quedan `true` en el mismo request → el crédito pasa a `ACTIVE`:
23
+ * vencimientos `activatedAt + n×7d` (domingo→lunes), `voluntaryCancelDeadline = +7d`, flag de
24
+ * cobro PCF configurado (C7 — solo flag, el débito real requiere adendum).
25
+ */
26
+ class ActivationCheckRequest {
27
+ }
28
+ exports.ActivationCheckRequest = ActivationCheckRequest;
29
+ __decorate([
30
+ (0, class_transformer_1.Expose)(),
31
+ (0, class_validator_1.IsOptional)(),
32
+ (0, class_validator_1.IsBoolean)(),
33
+ __metadata("design:type", Boolean)
34
+ ], ActivationCheckRequest.prototype, "downPayment", void 0);
35
+ __decorate([
36
+ (0, class_transformer_1.Expose)(),
37
+ (0, class_validator_1.IsOptional)(),
38
+ (0, class_validator_1.IsBoolean)(),
39
+ __metadata("design:type", Boolean)
40
+ ], ActivationCheckRequest.prototype, "imeiEnrolled", void 0);
41
+ __decorate([
42
+ (0, class_transformer_1.Expose)(),
43
+ (0, class_validator_1.IsOptional)(),
44
+ (0, class_validator_1.IsBoolean)(),
45
+ __metadata("design:type", Boolean)
46
+ ], ActivationCheckRequest.prototype, "lockVerified", void 0);
47
+ __decorate([
48
+ (0, class_transformer_1.Expose)(),
49
+ (0, class_validator_1.IsOptional)(),
50
+ (0, class_validator_1.IsString)(),
51
+ __metadata("design:type", String)
52
+ ], ActivationCheckRequest.prototype, "imei", void 0);
@@ -1,22 +1,25 @@
1
- import { ClientLevelEnum } from '../../enums/ClientLevelEnum';
1
+ import { ClientLevelEnum } from '../../../loanScoring/enums/ClientLevelEnum';
2
2
  /**
3
- * Body de POST /credits (loan-credit-business). Origina el crédito en `PENDING_ACTIVATION` y genera
4
- * su plan de cuotas (amortización francesa + IVA 16% M2 §3 / 05_MOTOR §4).
3
+ * Body de `POST /private/credits/originate` (loan-credit-business wizard, vía api-invoker).
4
+ * Origina el crédito en `PENDING_ACTIVATION`: valida (M2 §4.2: sin otro crédito vivo, plan activo,
5
+ * IMEI libre), invoca el simulador de loan-offerings con `planId+termWeeks+precio+enganche` (la
6
+ * TNA y el CAT los resuelve el PLAN — el caller NO los manda) y persiste crédito + cuotas +
7
+ * contratos draft.
5
8
  *
6
- * Los términos financieros (`planId`, `termWeeks`, `tnaAnnual`) vienen de la cotización hecha con
7
- * loan-offerings; el motor recalcula la tabla internamente (la cotización es informativa, el plan
8
- * de cuotas del crédito lo genera y persiste este lambda).
9
+ * **Idempotente por `wizardSessionId`** (el wizard reintenta): mismo wizardSessionId devuelve el
10
+ * crédito ya originado, no crea otro. El tenant viaja por query `?tenantId=` (convención privados).
9
11
  */
10
12
  export declare class OriginateLoanCreditRequest {
13
+ /** Sesión del wizard que origina — clave de idempotencia (AS-07). */
14
+ wizardSessionId: string;
11
15
  borrowerId: string;
12
16
  planId: string;
13
17
  termWeeks: number;
14
18
  equipmentPriceCents: number;
15
19
  downPaymentCents: number;
16
- /** TNA decimal (`2.30` = 230%). */
17
- tnaAnnual: number;
18
- /** SCI del cliente al originar (snapshot). */
20
+ /** SCI del cliente al originar (snapshot de la evaluación del paso 05). */
19
21
  sciAtOrigination?: number;
20
22
  clientLevelAtOrigination?: ClientLevelEnum;
23
+ /** IMEI del equipo si ya se conoce (también puede fijarse en el paso 09 vía activate-check). */
21
24
  imei?: string;
22
25
  }
@@ -12,18 +12,26 @@ Object.defineProperty(exports, "__esModule", { value: true });
12
12
  exports.OriginateLoanCreditRequest = void 0;
13
13
  const class_transformer_1 = require("class-transformer");
14
14
  const class_validator_1 = require("class-validator");
15
- const ClientLevelEnum_1 = require("../../enums/ClientLevelEnum");
15
+ const ClientLevelEnum_1 = require("../../../loanScoring/enums/ClientLevelEnum");
16
16
  /**
17
- * Body de POST /credits (loan-credit-business). Origina el crédito en `PENDING_ACTIVATION` y genera
18
- * su plan de cuotas (amortización francesa + IVA 16% M2 §3 / 05_MOTOR §4).
17
+ * Body de `POST /private/credits/originate` (loan-credit-business wizard, vía api-invoker).
18
+ * Origina el crédito en `PENDING_ACTIVATION`: valida (M2 §4.2: sin otro crédito vivo, plan activo,
19
+ * IMEI libre), invoca el simulador de loan-offerings con `planId+termWeeks+precio+enganche` (la
20
+ * TNA y el CAT los resuelve el PLAN — el caller NO los manda) y persiste crédito + cuotas +
21
+ * contratos draft.
19
22
  *
20
- * Los términos financieros (`planId`, `termWeeks`, `tnaAnnual`) vienen de la cotización hecha con
21
- * loan-offerings; el motor recalcula la tabla internamente (la cotización es informativa, el plan
22
- * de cuotas del crédito lo genera y persiste este lambda).
23
+ * **Idempotente por `wizardSessionId`** (el wizard reintenta): mismo wizardSessionId devuelve el
24
+ * crédito ya originado, no crea otro. El tenant viaja por query `?tenantId=` (convención privados).
23
25
  */
24
26
  class OriginateLoanCreditRequest {
25
27
  }
26
28
  exports.OriginateLoanCreditRequest = OriginateLoanCreditRequest;
29
+ __decorate([
30
+ (0, class_transformer_1.Expose)(),
31
+ (0, class_validator_1.IsString)(),
32
+ (0, class_validator_1.IsNotEmpty)(),
33
+ __metadata("design:type", String)
34
+ ], OriginateLoanCreditRequest.prototype, "wizardSessionId", void 0);
27
35
  __decorate([
28
36
  (0, class_transformer_1.Expose)(),
29
37
  (0, class_validator_1.IsString)(),
@@ -55,13 +63,6 @@ __decorate([
55
63
  (0, class_validator_1.Min)(0),
56
64
  __metadata("design:type", Number)
57
65
  ], OriginateLoanCreditRequest.prototype, "downPaymentCents", void 0);
58
- __decorate([
59
- (0, class_transformer_1.Expose)(),
60
- (0, class_validator_1.IsNumber)(),
61
- (0, class_validator_1.Min)(0),
62
- (0, class_validator_1.Max)(10),
63
- __metadata("design:type", Number)
64
- ], OriginateLoanCreditRequest.prototype, "tnaAnnual", void 0);
65
66
  __decorate([
66
67
  (0, class_transformer_1.Expose)(),
67
68
  (0, class_validator_1.IsOptional)(),
@@ -0,0 +1,11 @@
1
+ /**
2
+ * Body de `POST /private/credits/:creditId/quote` (loan-credit-business — wizard paso 06).
3
+ * Re-cotiza el crédito en `PENDING_ACTIVATION` con términos nuevos (el cliente itera
4
+ * plazo/enganche en el cotizador) e invoca el simulador de loan-offerings; regenera las cuotas.
5
+ * Campos ausentes = conservar el valor actual del crédito. Rechaza si el crédito no está PENDING
6
+ * o si el contrato ya se firmó (los términos quedan congelados con la firma).
7
+ */
8
+ export declare class QuoteLoanCreditRequest {
9
+ termWeeks?: number;
10
+ downPaymentCents?: number;
11
+ }
@@ -0,0 +1,39 @@
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.QuoteLoanCreditRequest = void 0;
13
+ const class_transformer_1 = require("class-transformer");
14
+ const class_validator_1 = require("class-validator");
15
+ /**
16
+ * Body de `POST /private/credits/:creditId/quote` (loan-credit-business — wizard paso 06).
17
+ * Re-cotiza el crédito en `PENDING_ACTIVATION` con términos nuevos (el cliente itera
18
+ * plazo/enganche en el cotizador) e invoca el simulador de loan-offerings; regenera las cuotas.
19
+ * Campos ausentes = conservar el valor actual del crédito. Rechaza si el crédito no está PENDING
20
+ * o si el contrato ya se firmó (los términos quedan congelados con la firma).
21
+ */
22
+ class QuoteLoanCreditRequest {
23
+ }
24
+ exports.QuoteLoanCreditRequest = QuoteLoanCreditRequest;
25
+ __decorate([
26
+ (0, class_transformer_1.Expose)(),
27
+ (0, class_validator_1.IsOptional)(),
28
+ (0, class_validator_1.IsInt)(),
29
+ (0, class_validator_1.Min)(1),
30
+ (0, class_validator_1.Max)(104),
31
+ __metadata("design:type", Number)
32
+ ], QuoteLoanCreditRequest.prototype, "termWeeks", void 0);
33
+ __decorate([
34
+ (0, class_transformer_1.Expose)(),
35
+ (0, class_validator_1.IsOptional)(),
36
+ (0, class_validator_1.IsInt)(),
37
+ (0, class_validator_1.Min)(0),
38
+ __metadata("design:type", Number)
39
+ ], QuoteLoanCreditRequest.prototype, "downPaymentCents", void 0);
@@ -0,0 +1,17 @@
1
+ /**
2
+ * Body de `POST /private/credits/:creditId/sign` (loan-credit-business — wizard paso 08, firma FES
3
+ * M2 §4.4). Endpoint de DOS tiempos sobre el mismo contrato:
4
+ *
5
+ * 1. **SIN `otpCode`** → INICIA la firma: congela términos, genera los 3 PDFs (C4), calcula sus
6
+ * sha256 y dispara el OTP dedicado de firma (4 dígitos, 5 min, vía messages-business — D5;
7
+ * distinto al OTP del paso 01). Responde `otpSent: true`.
8
+ * 2. **CON `otpCode`** → VERIFICA el OTP y firma: marca los contratos `otpVerified` + `signedAt` +
9
+ * NOM-151, y pone `activationChecklist.contractSigned = true`.
10
+ *
11
+ * Errores: `OTP_INVALID` · `OTP_EXPIRED` · `OTP_MAX_ATTEMPTS` · `CREDIT_NOT_PENDING`.
12
+ * (Semántica a ratificar con el contrato del wizard — AS-07.)
13
+ */
14
+ export declare class SignLoanCreditRequest {
15
+ /** Código OTP de firma. Ausente = iniciar la firma (generar PDFs + enviar OTP). */
16
+ otpCode?: string;
17
+ }
@@ -0,0 +1,37 @@
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.SignLoanCreditRequest = void 0;
13
+ const class_transformer_1 = require("class-transformer");
14
+ const class_validator_1 = require("class-validator");
15
+ /**
16
+ * Body de `POST /private/credits/:creditId/sign` (loan-credit-business — wizard paso 08, firma FES
17
+ * M2 §4.4). Endpoint de DOS tiempos sobre el mismo contrato:
18
+ *
19
+ * 1. **SIN `otpCode`** → INICIA la firma: congela términos, genera los 3 PDFs (C4), calcula sus
20
+ * sha256 y dispara el OTP dedicado de firma (4 dígitos, 5 min, vía messages-business — D5;
21
+ * distinto al OTP del paso 01). Responde `otpSent: true`.
22
+ * 2. **CON `otpCode`** → VERIFICA el OTP y firma: marca los contratos `otpVerified` + `signedAt` +
23
+ * NOM-151, y pone `activationChecklist.contractSigned = true`.
24
+ *
25
+ * Errores: `OTP_INVALID` · `OTP_EXPIRED` · `OTP_MAX_ATTEMPTS` · `CREDIT_NOT_PENDING`.
26
+ * (Semántica a ratificar con el contrato del wizard — AS-07.)
27
+ */
28
+ class SignLoanCreditRequest {
29
+ }
30
+ exports.SignLoanCreditRequest = SignLoanCreditRequest;
31
+ __decorate([
32
+ (0, class_transformer_1.Expose)(),
33
+ (0, class_validator_1.IsOptional)(),
34
+ (0, class_validator_1.IsString)(),
35
+ (0, class_validator_1.Length)(4, 4),
36
+ __metadata("design:type", String)
37
+ ], SignLoanCreditRequest.prototype, "otpCode", void 0);
@@ -1,4 +1,4 @@
1
- import { ClientLevelEnum } from '../../enums/ClientLevelEnum';
1
+ import { ClientLevelEnum } from '../../../loanScoring/enums/ClientLevelEnum';
2
2
  import { LoanBeneficiary } from '../LoanBeneficiary';
3
3
  /**
4
4
  * Body de POST /borrowers y POST /private/borrowers (loan-credit-business).
@@ -12,7 +12,7 @@ Object.defineProperty(exports, "__esModule", { value: true });
12
12
  exports.UpsertLoanBorrowerRequest = void 0;
13
13
  const class_transformer_1 = require("class-transformer");
14
14
  const class_validator_1 = require("class-validator");
15
- const ClientLevelEnum_1 = require("../../enums/ClientLevelEnum");
15
+ const ClientLevelEnum_1 = require("../../../loanScoring/enums/ClientLevelEnum");
16
16
  const LoanBeneficiary_1 = require("../LoanBeneficiary");
17
17
  /**
18
18
  * Body de POST /borrowers y POST /private/borrowers (loan-credit-business).
@@ -0,0 +1,10 @@
1
+ import { LoanCreditResponse } from './LoanCreditResponse';
2
+ /**
3
+ * Response de `POST /private/credits/:creditId/activate-check` (loan-credit-business — M2 §5):
4
+ * el crédito con el checklist actualizado. `missingItems` lista las condiciones que faltan
5
+ * (vacío cuando el crédito quedó `ACTIVE`).
6
+ */
7
+ export interface ActivationCheckResponse {
8
+ credit: LoanCreditResponse;
9
+ missingItems: string[];
10
+ }
@@ -0,0 +1,2 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
@@ -1,4 +1,4 @@
1
- import { ClientLevelEnum } from '../../enums/ClientLevelEnum';
1
+ import { ClientLevelEnum } from '../../../loanScoring/enums/ClientLevelEnum';
2
2
  /**
3
3
  * Response de los endpoints de LoanBorrower (loan-credit-business). Interface plain (las salidas
4
4
  * solo se tipan, no se validan en runtime).
@@ -0,0 +1,16 @@
1
+ import { ContractTypeEnum } from '../../enums/ContractTypeEnum';
2
+ /**
3
+ * Response de un documento del contrato (loan-credit-business). `signedAt` ausente = draft.
4
+ */
5
+ export interface LoanContractResponse {
6
+ contractId: string;
7
+ creditId: string;
8
+ type: ContractTypeEnum;
9
+ pdfS3Key?: string;
10
+ sha256?: string;
11
+ otpVerified: boolean;
12
+ nom151Timestamp?: string;
13
+ signedAt?: string;
14
+ createdAt: string;
15
+ updatedAt: string;
16
+ }
@@ -0,0 +1,2 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
@@ -1,4 +1,4 @@
1
- import { ClientLevelEnum } from '../../enums/ClientLevelEnum';
1
+ import { ClientLevelEnum } from '../../../loanScoring/enums/ClientLevelEnum';
2
2
  import { LoanCreditStatusEnum } from '../../enums/LoanCreditStatusEnum';
3
3
  /**
4
4
  * Response de los endpoints de LoanCredit (loan-credit-business). Montos en cents; TNA decimal.
@@ -1,10 +1,13 @@
1
+ import { LoanContractResponse } from './LoanContractResponse';
1
2
  import { LoanCreditResponse } from './LoanCreditResponse';
2
3
  import { LoanInstallmentResponse } from './LoanInstallmentResponse';
3
4
  /**
4
- * Response de POST /credits (loan-credit-business): el crédito recién originado en
5
- * `PENDING_ACTIVATION` + su plan de cuotas completo (las fechas se fijan al activar).
5
+ * Response de `POST /private/credits/originate` (loan-credit-business): el crédito recién
6
+ * originado en `PENDING_ACTIVATION` + su plan de cuotas (fechas ausentes hasta activar) + los 3
7
+ * contratos draft (C4 — se firman en el paso 08).
6
8
  */
7
9
  export interface OriginateLoanCreditResponse {
8
10
  credit: LoanCreditResponse;
9
11
  installments: LoanInstallmentResponse[];
12
+ contracts: LoanContractResponse[];
10
13
  }
@@ -0,0 +1,10 @@
1
+ import { LoanCreditResponse } from './LoanCreditResponse';
2
+ import { LoanInstallmentResponse } from './LoanInstallmentResponse';
3
+ /**
4
+ * Response de `POST /private/credits/:creditId/quote` (loan-credit-business): el crédito con los
5
+ * términos re-cotizados + el plan de cuotas regenerado (fechas ausentes hasta activar).
6
+ */
7
+ export interface QuoteLoanCreditResponse {
8
+ credit: LoanCreditResponse;
9
+ installments: LoanInstallmentResponse[];
10
+ }
@@ -0,0 +1,2 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
@@ -0,0 +1,20 @@
1
+ import { LoanContractResponse } from './LoanContractResponse';
2
+ /**
3
+ * Response de `POST /private/credits/:creditId/sign` (loan-credit-business — firma FES en 2
4
+ * tiempos): al INICIAR (`otpSent: true`, contratos con PDF+hash sin firmar); al VERIFICAR
5
+ * (`signed: true`, contratos firmados + checklist con `contractSigned = true`).
6
+ */
7
+ export interface SignLoanCreditResponse {
8
+ creditId: string;
9
+ /** true cuando el request inició la firma y el OTP fue despachado. */
10
+ otpSent: boolean;
11
+ /** true cuando el OTP fue verificado y los contratos quedaron firmados. */
12
+ signed: boolean;
13
+ contracts: LoanContractResponse[];
14
+ activationChecklist: {
15
+ downPayment: boolean;
16
+ contractSigned: boolean;
17
+ imeiEnrolled: boolean;
18
+ lockVerified: boolean;
19
+ };
20
+ }
@@ -0,0 +1,2 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
@@ -0,0 +1,12 @@
1
+ /**
2
+ * Tipo de documento del contrato de crédito (M2 §4.3 / C4 — 3 documentos):
3
+ * `CREDIT` = contrato de crédito celular (RECA 16145-439-038506/04-01076-0525) ·
4
+ * `PROMISSORY_NOTE` = pagaré (garantiza el crédito; mismo monto/tasa/plazo) ·
5
+ * `SIC_AUTHORIZATION` = autorización de consulta/reporte a Círculo de Crédito (Art. 28 LRSIC).
6
+ * @enum {string}
7
+ */
8
+ export declare enum ContractTypeEnum {
9
+ CREDIT = "CREDIT",
10
+ PROMISSORY_NOTE = "PROMISSORY_NOTE",
11
+ SIC_AUTHORIZATION = "SIC_AUTHORIZATION"
12
+ }
@@ -0,0 +1,16 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.ContractTypeEnum = void 0;
4
+ /**
5
+ * Tipo de documento del contrato de crédito (M2 §4.3 / C4 — 3 documentos):
6
+ * `CREDIT` = contrato de crédito celular (RECA 16145-439-038506/04-01076-0525) ·
7
+ * `PROMISSORY_NOTE` = pagaré (garantiza el crédito; mismo monto/tasa/plazo) ·
8
+ * `SIC_AUTHORIZATION` = autorización de consulta/reporte a Círculo de Crédito (Art. 28 LRSIC).
9
+ * @enum {string}
10
+ */
11
+ var ContractTypeEnum;
12
+ (function (ContractTypeEnum) {
13
+ ContractTypeEnum["CREDIT"] = "CREDIT";
14
+ ContractTypeEnum["PROMISSORY_NOTE"] = "PROMISSORY_NOTE";
15
+ ContractTypeEnum["SIC_AUTHORIZATION"] = "SIC_AUTHORIZATION";
16
+ })(ContractTypeEnum || (exports.ContractTypeEnum = ContractTypeEnum = {}));
@@ -1,11 +1,14 @@
1
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.
2
+ * Estado de una cuota semanal del crédito (M2 §6.1: pendiente · pagado · pagado_adelantado ·
3
+ * vencido · reestructurado). `PAID_IN_ADVANCE` = pago adelantado (cubre cuota futura tal cual,
4
+ * sin recalcular tabla — M2 §3.7). `RESTRUCTURED` = la cuota dejó de aplicar por
5
+ * reestructura o cancelación.
4
6
  * @enum {string}
5
7
  */
6
8
  export declare enum LoanInstallmentStatusEnum {
7
9
  PENDING = "PENDING",
8
10
  PAID = "PAID",
11
+ PAID_IN_ADVANCE = "PAID_IN_ADVANCE",
9
12
  OVERDUE = "OVERDUE",
10
13
  RESTRUCTURED = "RESTRUCTURED"
11
14
  }