@fiado/type-kit 3.490.0 → 3.491.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 (24) hide show
  1. package/_test_/unit/loanCredit/customerPaymentDtos.test.ts +2 -0
  2. package/_test_/unit/loanCredit/dtos/createCustomerPaymentRequest.test.ts +18 -4
  3. package/_test_/unit/retailLoan/paymentContract.test.ts +3 -1
  4. package/bin/loanCredit/dtos/requests/CreateCustomerPaymentRequest.d.ts +3 -1
  5. package/bin/loanCredit/dtos/requests/CreateCustomerPaymentRequest.js +7 -0
  6. package/bin/loanCredit/dtos/responses/LoanCustomerPaymentOptions.d.ts +21 -2
  7. package/bin/loanCredit/dtos/responses/LoanCustomerPaymentResult.d.ts +2 -0
  8. package/bin/loanCredit/enums/LoanCustomerPaymentTypeEnum.d.ts +5 -1
  9. package/bin/loanCredit/enums/LoanCustomerPaymentTypeEnum.js +4 -0
  10. package/bin/retailLoan/dtos/CreateMyPaymentRequest.d.ts +3 -1
  11. package/bin/retailLoan/dtos/CreateMyPaymentRequest.js +7 -0
  12. package/bin/retailLoan/dtos/CreateMyPaymentResponse.d.ts +2 -0
  13. package/bin/retailLoan/dtos/MyPaymentOptions.d.ts +21 -1
  14. package/bin/retailLoan/enums/MyPaymentTypeEnum.d.ts +3 -2
  15. package/bin/retailLoan/enums/MyPaymentTypeEnum.js +2 -1
  16. package/package.json +1 -1
  17. package/src/loanCredit/dtos/requests/CreateCustomerPaymentRequest.ts +9 -2
  18. package/src/loanCredit/dtos/responses/LoanCustomerPaymentOptions.ts +26 -3
  19. package/src/loanCredit/dtos/responses/LoanCustomerPaymentResult.ts +2 -0
  20. package/src/loanCredit/enums/LoanCustomerPaymentTypeEnum.ts +4 -0
  21. package/src/retailLoan/dtos/CreateMyPaymentRequest.ts +9 -2
  22. package/src/retailLoan/dtos/CreateMyPaymentResponse.ts +2 -0
  23. package/src/retailLoan/dtos/MyPaymentOptions.ts +26 -2
  24. package/src/retailLoan/enums/MyPaymentTypeEnum.ts +2 -1
@@ -22,6 +22,7 @@ describe('loanCredit — opciones y resultado del pago del cliente', () => {
22
22
  dueDate: '2026-10-01',
23
23
  },
24
24
  advance: { available: false, unavailableReason: LoanPaymentOptionUnavailableReasonEnum.NOT_AVAILABLE_YET },
25
+ prepayment: { available: false, unavailableReason: LoanPaymentOptionUnavailableReasonEnum.NOT_AVAILABLE_YET },
25
26
  settlement: {
26
27
  available: true,
27
28
  amountCents: 912345,
@@ -51,6 +52,7 @@ describe('loanCredit — opciones y resultado del pago del cliente', () => {
51
52
  pendingCharge: { kind: LoanAdHocChargeKindEnum.ADVANCE, amountCents: 105000 },
52
53
  nextInstallment: blocked,
53
54
  advance: blocked,
55
+ prepayment: blocked,
54
56
  settlement: blocked,
55
57
  };
56
58
 
@@ -24,7 +24,7 @@ const VALID = {
24
24
  };
25
25
 
26
26
  describe.each([
27
- ['LoanCustomerPaymentTypeEnum', LoanCustomerPaymentTypeEnum, ['NEXT_INSTALLMENT', 'SETTLEMENT']],
27
+ ['LoanCustomerPaymentTypeEnum', LoanCustomerPaymentTypeEnum, ['NEXT_INSTALLMENT', 'SETTLEMENT', 'ADVANCE', 'PREPAYMENT']],
28
28
  ['LoanNextInstallmentModeEnum', LoanNextInstallmentModeEnum, ['ADVANCE', 'COLLECT_DUE']],
29
29
  [
30
30
  'LoanPaymentOptionUnavailableReasonEnum',
@@ -44,7 +44,11 @@ describe.each([
44
44
  });
45
45
 
46
46
  describe('CreateCustomerPaymentRequest', () => {
47
- it.each([[LoanCustomerPaymentTypeEnum.NEXT_INSTALLMENT], [LoanCustomerPaymentTypeEnum.SETTLEMENT]])(
47
+ it.each([
48
+ [LoanCustomerPaymentTypeEnum.NEXT_INSTALLMENT],
49
+ [LoanCustomerPaymentTypeEnum.SETTLEMENT],
50
+ [LoanCustomerPaymentTypeEnum.PREPAYMENT],
51
+ ])(
48
52
  'acepta el tipo %s',
49
53
  async type => {
50
54
  expect(await errorProperties({ ...VALID, type })).toEqual([]);
@@ -57,8 +61,18 @@ describe('CreateCustomerPaymentRequest', () => {
57
61
  );
58
62
  });
59
63
 
60
- it.each([['ADVANCE'], ['PARTIAL']])('rechaza el tipo %s', async type => {
61
- expect(await errorProperties({ ...VALID, type })).toEqual(['type']);
64
+ it('acepta varias cuotas con su número de cuotas', async () => {
65
+ expect(await errorProperties({ ...VALID, type: LoanCustomerPaymentTypeEnum.ADVANCE, installmentCount: 3 })).toEqual([]);
66
+ });
67
+
68
+ it.each([[1], [0], [2.5], ['3']])('rechaza el número de cuotas %p', async installmentCount => {
69
+ expect(await errorProperties({ ...VALID, type: LoanCustomerPaymentTypeEnum.ADVANCE, installmentCount })).toEqual([
70
+ 'installmentCount',
71
+ ]);
72
+ });
73
+
74
+ it('rechaza un tipo desconocido', async () => {
75
+ expect(await errorProperties({ ...VALID, type: 'PARTIAL' })).toEqual(['type']);
62
76
  });
63
77
 
64
78
  it.each([[0], [-100], [10.5], ['912345']])('rechaza el monto %p', async expectedAmountCents => {
@@ -22,7 +22,7 @@ const errorProperties = async (body: object): Promise<string[]> => {
22
22
  };
23
23
 
24
24
  describe.each([
25
- ['MyPaymentTypeEnum', MyPaymentTypeEnum, ['NEXT_INSTALLMENT', 'ADVANCE', 'SETTLEMENT']],
25
+ ['MyPaymentTypeEnum', MyPaymentTypeEnum, ['NEXT_INSTALLMENT', 'ADVANCE', 'SETTLEMENT', 'PREPAYMENT']],
26
26
  ['MyNextInstallmentModeEnum', MyNextInstallmentModeEnum, ['ADVANCE', 'COLLECT_DUE']],
27
27
  [
28
28
  'MyPaymentUnavailableReasonEnum',
@@ -85,6 +85,7 @@ describe('retailLoan — opciones y respuesta del pago', () => {
85
85
  dueDate: '2026-10-01',
86
86
  },
87
87
  advance: { available: false, unavailableReason: MyPaymentUnavailableReasonEnum.NOT_AVAILABLE_YET },
88
+ prepayment: { available: false, unavailableReason: MyPaymentUnavailableReasonEnum.NOT_AVAILABLE_YET },
88
89
  settlement: {
89
90
  available: true,
90
91
  amount: 9123.45,
@@ -104,6 +105,7 @@ describe('retailLoan — opciones y respuesta del pago', () => {
104
105
  pendingPayment: { type: MyPaymentTypeEnum.NEXT_INSTALLMENT, amount: 1050 },
105
106
  nextInstallment: blocked,
106
107
  advance: blocked,
108
+ prepayment: blocked,
107
109
  settlement: blocked,
108
110
  };
109
111
 
@@ -2,8 +2,10 @@ import { LoanCustomerPaymentTypeEnum } from '../../enums/LoanCustomerPaymentType
2
2
  /** Body de `POST /private/customers/:directoryId/credits/:creditId/payments` (loan-credit-business). */
3
3
  export declare class CreateCustomerPaymentRequest {
4
4
  type: LoanCustomerPaymentTypeEnum;
5
- /** Monto que vio el cliente; si ya no coincide, responde 409 CUSTOMER_PAYMENT_AMOUNT_CHANGED. */
5
+ /** Monto que vio el cliente (en PREPAYMENT, el que eligió); si ya no coincide, responde 409 CUSTOMER_PAYMENT_AMOUNT_CHANGED. */
6
6
  expectedAmountCents: number;
7
7
  /** Llave del reintento: la misma llave con el mismo cuerpo devuelve la misma respuesta. */
8
8
  idempotencyKey: string;
9
+ /** Solo ADVANCE: cuántas cuotas adelanta. */
10
+ installmentCount?: number;
9
11
  }
@@ -33,3 +33,10 @@ __decorate([
33
33
  (0, class_validator_1.IsUUID)(),
34
34
  __metadata("design:type", String)
35
35
  ], CreateCustomerPaymentRequest.prototype, "idempotencyKey", void 0);
36
+ __decorate([
37
+ (0, class_transformer_1.Expose)(),
38
+ (0, class_validator_1.IsOptional)(),
39
+ (0, class_validator_1.IsInt)(),
40
+ (0, class_validator_1.Min)(2),
41
+ __metadata("design:type", Number)
42
+ ], CreateCustomerPaymentRequest.prototype, "installmentCount", void 0);
@@ -8,6 +8,13 @@ export interface LoanCustomerPaymentOption {
8
8
  unavailableReason?: LoanPaymentOptionUnavailableReasonEnum;
9
9
  amountCents?: number;
10
10
  }
11
+ /** Una cuota que se puede adelantar. */
12
+ export interface LoanCustomerAdvanceInstallment {
13
+ installmentNumber: number;
14
+ /** `YYYY-MM-DD`. */
15
+ dueDate: string;
16
+ amountCents: number;
17
+ }
11
18
  /** Response de `GET /private/customers/:directoryId/credits/:creditId/payment-options`. Montos en cents. */
12
19
  export interface LoanCustomerPaymentOptions {
13
20
  creditId: string;
@@ -15,6 +22,8 @@ export interface LoanCustomerPaymentOptions {
15
22
  pendingCharge?: {
16
23
  kind: LoanAdHocChargeKindEnum;
17
24
  amountCents: number;
25
+ /** Solo en un adelanto: las cuotas que cubre. */
26
+ installmentNumbers?: number[];
18
27
  };
19
28
  nextInstallment: LoanCustomerPaymentOption & {
20
29
  mode?: LoanNextInstallmentModeEnum;
@@ -22,8 +31,18 @@ export interface LoanCustomerPaymentOptions {
22
31
  /** `YYYY-MM-DD`. */
23
32
  dueDate?: string;
24
33
  };
25
- /** Varias cuotas: hoy siempre `available: false` con `NOT_AVAILABLE_YET`. */
26
- advance: LoanCustomerPaymentOption;
34
+ /** Varias cuotas. `installments` trae las `maxInstallments` que se pueden adelantar, en orden. */
35
+ advance: LoanCustomerPaymentOption & {
36
+ minInstallments?: number;
37
+ maxInstallments?: number;
38
+ installments?: LoanCustomerAdvanceInstallment[];
39
+ };
40
+ /** Abono a capital: monto libre entre `minAmountCents` y `maxAmountCents`. */
41
+ prepayment: LoanCustomerPaymentOption & {
42
+ minAmountCents?: number;
43
+ maxAmountCents?: number;
44
+ outstandingCapitalCents?: number;
45
+ };
27
46
  settlement: LoanCustomerPaymentOption & {
28
47
  /** La cotización de hoy; su `settlementAmountCents` es el `amountCents`. */
29
48
  quote?: LoanSettlementQuote;
@@ -11,4 +11,6 @@ export interface LoanCustomerPaymentResult {
11
11
  status: CollectionResultStatus;
12
12
  amountCollectedCents: number;
13
13
  };
14
+ /** Solo ADVANCE: cuántas cuotas cubre. */
15
+ installmentCount?: number;
14
16
  }
@@ -1,5 +1,9 @@
1
1
  /** Pago que el cliente puede pedir desde la app. */
2
2
  export declare enum LoanCustomerPaymentTypeEnum {
3
3
  NEXT_INSTALLMENT = "NEXT_INSTALLMENT",
4
- SETTLEMENT = "SETTLEMENT"
4
+ SETTLEMENT = "SETTLEMENT",
5
+ /** Varias cuotas: las siguientes N tal como están, sin cambiar la tabla. */
6
+ ADVANCE = "ADVANCE",
7
+ /** Abono a capital: va completo a capital y baja las cuotas siguientes. */
8
+ PREPAYMENT = "PREPAYMENT"
5
9
  }
@@ -6,4 +6,8 @@ var LoanCustomerPaymentTypeEnum;
6
6
  (function (LoanCustomerPaymentTypeEnum) {
7
7
  LoanCustomerPaymentTypeEnum["NEXT_INSTALLMENT"] = "NEXT_INSTALLMENT";
8
8
  LoanCustomerPaymentTypeEnum["SETTLEMENT"] = "SETTLEMENT";
9
+ /** Varias cuotas: las siguientes N tal como están, sin cambiar la tabla. */
10
+ LoanCustomerPaymentTypeEnum["ADVANCE"] = "ADVANCE";
11
+ /** Abono a capital: va completo a capital y baja las cuotas siguientes. */
12
+ LoanCustomerPaymentTypeEnum["PREPAYMENT"] = "PREPAYMENT";
9
13
  })(LoanCustomerPaymentTypeEnum || (exports.LoanCustomerPaymentTypeEnum = LoanCustomerPaymentTypeEnum = {}));
@@ -2,6 +2,8 @@ import { MyPaymentTypeEnum } from '../enums/MyPaymentTypeEnum';
2
2
  /** Body de `POST /benefits/{benefitId}/credits/{creditId}/payments`. La llave va en el header `Idempotency-Key`. */
3
3
  export declare class CreateMyPaymentRequest {
4
4
  type: MyPaymentTypeEnum;
5
- /** Monto en pesos que vio el cliente; si ya no coincide, responde PAYMENT_AMOUNT_CHANGED. */
5
+ /** Monto en pesos que vio el cliente (en PREPAYMENT, el que eligió); si ya no coincide, responde PAYMENT_AMOUNT_CHANGED. */
6
6
  expectedAmount: number;
7
+ /** Solo ADVANCE: cuántas cuotas adelanta. */
8
+ installmentCount?: number;
7
9
  }
@@ -28,3 +28,10 @@ __decorate([
28
28
  (0, class_validator_1.IsPositive)(),
29
29
  __metadata("design:type", Number)
30
30
  ], CreateMyPaymentRequest.prototype, "expectedAmount", void 0);
31
+ __decorate([
32
+ (0, class_transformer_1.Expose)(),
33
+ (0, class_validator_1.IsOptional)(),
34
+ (0, class_validator_1.IsInt)(),
35
+ (0, class_validator_1.Min)(2),
36
+ __metadata("design:type", Number)
37
+ ], CreateMyPaymentRequest.prototype, "installmentCount", void 0);
@@ -6,4 +6,6 @@ export interface CreateMyPaymentResponse {
6
6
  type: MyPaymentTypeEnum;
7
7
  amount: number;
8
8
  collection: MyCollectionOutcomeEnum;
9
+ /** Solo ADVANCE: cuántas cuotas cubre. */
10
+ installmentCount?: number;
9
11
  }
@@ -7,12 +7,21 @@ export interface MyPaymentOption {
7
7
  unavailableReason?: MyPaymentUnavailableReasonEnum;
8
8
  amount?: number;
9
9
  }
10
+ /** Una cuota que se puede adelantar. `amount` en pesos. */
11
+ export interface MyAdvanceInstallment {
12
+ installmentNumber: number;
13
+ /** `YYYY-MM-DD`. */
14
+ dueDate: string;
15
+ amount: number;
16
+ }
10
17
  /** Opciones de pago de un crédito (`GET /benefits/{benefitId}/credits/{creditId}/payment-options`). Montos en pesos. */
11
18
  export interface MyPaymentOptions {
12
19
  /** Pago en curso; mientras exista, ninguna opción está disponible. */
13
20
  pendingPayment?: {
14
21
  type: MyPaymentTypeEnum;
15
22
  amount: number;
23
+ /** Solo en varias cuotas: las cuotas que cubre. */
24
+ installmentNumbers?: number[];
16
25
  };
17
26
  nextInstallment: MyPaymentOption & {
18
27
  mode?: MyNextInstallmentModeEnum;
@@ -20,7 +29,18 @@ export interface MyPaymentOptions {
20
29
  /** `YYYY-MM-DD`. */
21
30
  dueDate?: string;
22
31
  };
23
- advance: MyPaymentOption;
32
+ /** Varias cuotas. `installments` trae las `maxInstallments` que se pueden adelantar, en orden. */
33
+ advance: MyPaymentOption & {
34
+ minInstallments?: number;
35
+ maxInstallments?: number;
36
+ installments?: MyAdvanceInstallment[];
37
+ };
38
+ /** Abono a capital: monto libre entre `minAmount` y `maxAmount`. */
39
+ prepayment: MyPaymentOption & {
40
+ minAmount?: number;
41
+ maxAmount?: number;
42
+ outstandingCapital?: number;
43
+ };
24
44
  settlement: MyPaymentOption & {
25
45
  breakdown?: {
26
46
  overdue: number;
@@ -1,6 +1,7 @@
1
- /** Pago que el cliente pide desde la app. `ADVANCE` = varias cuotas. */
1
+ /** Pago que el cliente pide desde la app. `ADVANCE` = varias cuotas; `PREPAYMENT` = abono a capital. */
2
2
  export declare enum MyPaymentTypeEnum {
3
3
  NEXT_INSTALLMENT = "NEXT_INSTALLMENT",
4
4
  ADVANCE = "ADVANCE",
5
- SETTLEMENT = "SETTLEMENT"
5
+ SETTLEMENT = "SETTLEMENT",
6
+ PREPAYMENT = "PREPAYMENT"
6
7
  }
@@ -1,10 +1,11 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.MyPaymentTypeEnum = void 0;
4
- /** Pago que el cliente pide desde la app. `ADVANCE` = varias cuotas. */
4
+ /** Pago que el cliente pide desde la app. `ADVANCE` = varias cuotas; `PREPAYMENT` = abono a capital. */
5
5
  var MyPaymentTypeEnum;
6
6
  (function (MyPaymentTypeEnum) {
7
7
  MyPaymentTypeEnum["NEXT_INSTALLMENT"] = "NEXT_INSTALLMENT";
8
8
  MyPaymentTypeEnum["ADVANCE"] = "ADVANCE";
9
9
  MyPaymentTypeEnum["SETTLEMENT"] = "SETTLEMENT";
10
+ MyPaymentTypeEnum["PREPAYMENT"] = "PREPAYMENT";
10
11
  })(MyPaymentTypeEnum || (exports.MyPaymentTypeEnum = MyPaymentTypeEnum = {}));
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@fiado/type-kit",
3
- "version": "3.490.0",
3
+ "version": "3.491.0",
4
4
  "description": "",
5
5
  "main": "bin/index.js",
6
6
  "types": "bin/index.d.ts",
@@ -1,5 +1,5 @@
1
1
  import { Expose } from 'class-transformer';
2
- import { IsEnum, IsInt, IsUUID, Min } from 'class-validator';
2
+ import { IsEnum, IsInt, IsOptional, IsUUID, Min } from 'class-validator';
3
3
  import { LoanCustomerPaymentTypeEnum } from '../../enums/LoanCustomerPaymentTypeEnum';
4
4
 
5
5
  /** Body de `POST /private/customers/:directoryId/credits/:creditId/payments` (loan-credit-business). */
@@ -8,7 +8,7 @@ export class CreateCustomerPaymentRequest {
8
8
  @IsEnum(LoanCustomerPaymentTypeEnum)
9
9
  type!: LoanCustomerPaymentTypeEnum;
10
10
 
11
- /** Monto que vio el cliente; si ya no coincide, responde 409 CUSTOMER_PAYMENT_AMOUNT_CHANGED. */
11
+ /** Monto que vio el cliente (en PREPAYMENT, el que eligió); si ya no coincide, responde 409 CUSTOMER_PAYMENT_AMOUNT_CHANGED. */
12
12
  @Expose()
13
13
  @IsInt()
14
14
  @Min(1)
@@ -18,4 +18,11 @@ export class CreateCustomerPaymentRequest {
18
18
  @Expose()
19
19
  @IsUUID()
20
20
  idempotencyKey!: string;
21
+
22
+ /** Solo ADVANCE: cuántas cuotas adelanta. */
23
+ @Expose()
24
+ @IsOptional()
25
+ @IsInt()
26
+ @Min(2)
27
+ installmentCount?: number;
21
28
  }
@@ -10,19 +10,42 @@ export interface LoanCustomerPaymentOption {
10
10
  amountCents?: number;
11
11
  }
12
12
 
13
+ /** Una cuota que se puede adelantar. */
14
+ export interface LoanCustomerAdvanceInstallment {
15
+ installmentNumber: number;
16
+ /** `YYYY-MM-DD`. */
17
+ dueDate: string;
18
+ amountCents: number;
19
+ }
20
+
13
21
  /** Response de `GET /private/customers/:directoryId/credits/:creditId/payment-options`. Montos en cents. */
14
22
  export interface LoanCustomerPaymentOptions {
15
23
  creditId: string;
16
24
  /** Cargo ad hoc en curso; mientras exista, ninguna opción está disponible. */
17
- pendingCharge?: { kind: LoanAdHocChargeKindEnum; amountCents: number };
25
+ pendingCharge?: {
26
+ kind: LoanAdHocChargeKindEnum;
27
+ amountCents: number;
28
+ /** Solo en un adelanto: las cuotas que cubre. */
29
+ installmentNumbers?: number[];
30
+ };
18
31
  nextInstallment: LoanCustomerPaymentOption & {
19
32
  mode?: LoanNextInstallmentModeEnum;
20
33
  installmentNumber?: number;
21
34
  /** `YYYY-MM-DD`. */
22
35
  dueDate?: string;
23
36
  };
24
- /** Varias cuotas: hoy siempre `available: false` con `NOT_AVAILABLE_YET`. */
25
- advance: LoanCustomerPaymentOption;
37
+ /** Varias cuotas. `installments` trae las `maxInstallments` que se pueden adelantar, en orden. */
38
+ advance: LoanCustomerPaymentOption & {
39
+ minInstallments?: number;
40
+ maxInstallments?: number;
41
+ installments?: LoanCustomerAdvanceInstallment[];
42
+ };
43
+ /** Abono a capital: monto libre entre `minAmountCents` y `maxAmountCents`. */
44
+ prepayment: LoanCustomerPaymentOption & {
45
+ minAmountCents?: number;
46
+ maxAmountCents?: number;
47
+ outstandingCapitalCents?: number;
48
+ };
26
49
  settlement: LoanCustomerPaymentOption & {
27
50
  /** La cotización de hoy; su `settlementAmountCents` es el `amountCents`. */
28
51
  quote?: LoanSettlementQuote;
@@ -9,4 +9,6 @@ export interface LoanCustomerPaymentResult {
9
9
  amountCents: number;
10
10
  /** Respuesta síncrona del motor; ausente si no contestó a tiempo. */
11
11
  collection?: { status: CollectionResultStatus; amountCollectedCents: number };
12
+ /** Solo ADVANCE: cuántas cuotas cubre. */
13
+ installmentCount?: number;
12
14
  }
@@ -2,4 +2,8 @@
2
2
  export enum LoanCustomerPaymentTypeEnum {
3
3
  NEXT_INSTALLMENT = 'NEXT_INSTALLMENT',
4
4
  SETTLEMENT = 'SETTLEMENT',
5
+ /** Varias cuotas: las siguientes N tal como están, sin cambiar la tabla. */
6
+ ADVANCE = 'ADVANCE',
7
+ /** Abono a capital: va completo a capital y baja las cuotas siguientes. */
8
+ PREPAYMENT = 'PREPAYMENT',
5
9
  }
@@ -1,5 +1,5 @@
1
1
  import { Expose } from 'class-transformer';
2
- import { IsEnum, IsNumber, IsPositive } from 'class-validator';
2
+ import { IsEnum, IsInt, IsNumber, IsOptional, IsPositive, Min } from 'class-validator';
3
3
  import { MyPaymentTypeEnum } from '../enums/MyPaymentTypeEnum';
4
4
 
5
5
  /** Body de `POST /benefits/{benefitId}/credits/{creditId}/payments`. La llave va en el header `Idempotency-Key`. */
@@ -8,9 +8,16 @@ export class CreateMyPaymentRequest {
8
8
  @IsEnum(MyPaymentTypeEnum)
9
9
  type!: MyPaymentTypeEnum;
10
10
 
11
- /** Monto en pesos que vio el cliente; si ya no coincide, responde PAYMENT_AMOUNT_CHANGED. */
11
+ /** Monto en pesos que vio el cliente (en PREPAYMENT, el que eligió); si ya no coincide, responde PAYMENT_AMOUNT_CHANGED. */
12
12
  @Expose()
13
13
  @IsNumber({ maxDecimalPlaces: 2 })
14
14
  @IsPositive()
15
15
  expectedAmount!: number;
16
+
17
+ /** Solo ADVANCE: cuántas cuotas adelanta. */
18
+ @Expose()
19
+ @IsOptional()
20
+ @IsInt()
21
+ @Min(2)
22
+ installmentCount?: number;
16
23
  }
@@ -7,4 +7,6 @@ export interface CreateMyPaymentResponse {
7
7
  type: MyPaymentTypeEnum;
8
8
  amount: number;
9
9
  collection: MyCollectionOutcomeEnum;
10
+ /** Solo ADVANCE: cuántas cuotas cubre. */
11
+ installmentCount?: number;
10
12
  }
@@ -9,17 +9,41 @@ export interface MyPaymentOption {
9
9
  amount?: number;
10
10
  }
11
11
 
12
+ /** Una cuota que se puede adelantar. `amount` en pesos. */
13
+ export interface MyAdvanceInstallment {
14
+ installmentNumber: number;
15
+ /** `YYYY-MM-DD`. */
16
+ dueDate: string;
17
+ amount: number;
18
+ }
19
+
12
20
  /** Opciones de pago de un crédito (`GET /benefits/{benefitId}/credits/{creditId}/payment-options`). Montos en pesos. */
13
21
  export interface MyPaymentOptions {
14
22
  /** Pago en curso; mientras exista, ninguna opción está disponible. */
15
- pendingPayment?: { type: MyPaymentTypeEnum; amount: number };
23
+ pendingPayment?: {
24
+ type: MyPaymentTypeEnum;
25
+ amount: number;
26
+ /** Solo en varias cuotas: las cuotas que cubre. */
27
+ installmentNumbers?: number[];
28
+ };
16
29
  nextInstallment: MyPaymentOption & {
17
30
  mode?: MyNextInstallmentModeEnum;
18
31
  installmentNumber?: number;
19
32
  /** `YYYY-MM-DD`. */
20
33
  dueDate?: string;
21
34
  };
22
- advance: MyPaymentOption;
35
+ /** Varias cuotas. `installments` trae las `maxInstallments` que se pueden adelantar, en orden. */
36
+ advance: MyPaymentOption & {
37
+ minInstallments?: number;
38
+ maxInstallments?: number;
39
+ installments?: MyAdvanceInstallment[];
40
+ };
41
+ /** Abono a capital: monto libre entre `minAmount` y `maxAmount`. */
42
+ prepayment: MyPaymentOption & {
43
+ minAmount?: number;
44
+ maxAmount?: number;
45
+ outstandingCapital?: number;
46
+ };
23
47
  settlement: MyPaymentOption & {
24
48
  breakdown?: { overdue: number; capital: number; interest: number; iva: number };
25
49
  savings?: number;
@@ -1,6 +1,7 @@
1
- /** Pago que el cliente pide desde la app. `ADVANCE` = varias cuotas. */
1
+ /** Pago que el cliente pide desde la app. `ADVANCE` = varias cuotas; `PREPAYMENT` = abono a capital. */
2
2
  export enum MyPaymentTypeEnum {
3
3
  NEXT_INSTALLMENT = 'NEXT_INSTALLMENT',
4
4
  ADVANCE = 'ADVANCE',
5
5
  SETTLEMENT = 'SETTLEMENT',
6
+ PREPAYMENT = 'PREPAYMENT',
6
7
  }