@fiado/type-kit 3.461.0 → 3.463.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 (53) hide show
  1. package/_test_/unit/loanCredit/customerPaymentDtos.test.ts +87 -0
  2. package/_test_/unit/loanCredit/dtos/createCustomerPaymentRequest.test.ts +78 -0
  3. package/_test_/unit/retailLoan/paymentContract.test.ts +128 -0
  4. package/bin/creditEngine/dtos/SettlementQuote.d.ts +9 -0
  5. package/bin/loanCredit/dtos/requests/CreateCustomerPaymentRequest.d.ts +9 -0
  6. package/bin/loanCredit/dtos/requests/CreateCustomerPaymentRequest.js +35 -0
  7. package/bin/loanCredit/dtos/responses/LoanAdHocChargeRequested.d.ts +6 -0
  8. package/bin/loanCredit/dtos/responses/LoanCustomerPaymentOptions.d.ts +33 -0
  9. package/bin/loanCredit/dtos/responses/LoanCustomerPaymentOptions.js +2 -0
  10. package/bin/loanCredit/dtos/responses/LoanCustomerPaymentResult.d.ts +14 -0
  11. package/bin/loanCredit/dtos/responses/LoanCustomerPaymentResult.js +2 -0
  12. package/bin/loanCredit/enums/LoanCustomerPaymentTypeEnum.d.ts +5 -0
  13. package/bin/loanCredit/enums/LoanCustomerPaymentTypeEnum.js +9 -0
  14. package/bin/loanCredit/enums/LoanNextInstallmentModeEnum.d.ts +7 -0
  15. package/bin/loanCredit/enums/LoanNextInstallmentModeEnum.js +11 -0
  16. package/bin/loanCredit/enums/LoanPaymentOptionUnavailableReasonEnum.d.ts +13 -0
  17. package/bin/loanCredit/enums/LoanPaymentOptionUnavailableReasonEnum.js +17 -0
  18. package/bin/loanCredit/index.d.ts +6 -0
  19. package/bin/loanCredit/index.js +7 -0
  20. package/bin/retailLoan/dtos/CreateMyPaymentRequest.d.ts +7 -0
  21. package/bin/retailLoan/dtos/CreateMyPaymentRequest.js +30 -0
  22. package/bin/retailLoan/dtos/CreateMyPaymentResponse.d.ts +9 -0
  23. package/bin/retailLoan/dtos/CreateMyPaymentResponse.js +2 -0
  24. package/bin/retailLoan/dtos/MyPaymentOptions.d.ts +34 -0
  25. package/bin/retailLoan/dtos/MyPaymentOptions.js +2 -0
  26. package/bin/retailLoan/enums/MyCollectionOutcomeEnum.d.ts +11 -0
  27. package/bin/retailLoan/enums/MyCollectionOutcomeEnum.js +15 -0
  28. package/bin/retailLoan/enums/MyNextInstallmentModeEnum.d.ts +5 -0
  29. package/bin/retailLoan/enums/MyNextInstallmentModeEnum.js +9 -0
  30. package/bin/retailLoan/enums/MyPaymentTypeEnum.d.ts +6 -0
  31. package/bin/retailLoan/enums/MyPaymentTypeEnum.js +10 -0
  32. package/bin/retailLoan/enums/MyPaymentUnavailableReasonEnum.d.ts +8 -0
  33. package/bin/retailLoan/enums/MyPaymentUnavailableReasonEnum.js +12 -0
  34. package/bin/retailLoan/index.d.ts +7 -0
  35. package/bin/retailLoan/index.js +8 -0
  36. package/package.json +1 -1
  37. package/src/creditEngine/dtos/SettlementQuote.ts +9 -0
  38. package/src/loanCredit/dtos/requests/CreateCustomerPaymentRequest.ts +21 -0
  39. package/src/loanCredit/dtos/responses/LoanAdHocChargeRequested.ts +3 -0
  40. package/src/loanCredit/dtos/responses/LoanCustomerPaymentOptions.ts +32 -0
  41. package/src/loanCredit/dtos/responses/LoanCustomerPaymentResult.ts +12 -0
  42. package/src/loanCredit/enums/LoanCustomerPaymentTypeEnum.ts +5 -0
  43. package/src/loanCredit/enums/LoanNextInstallmentModeEnum.ts +7 -0
  44. package/src/loanCredit/enums/LoanPaymentOptionUnavailableReasonEnum.ts +13 -0
  45. package/src/loanCredit/index.ts +8 -0
  46. package/src/retailLoan/dtos/CreateMyPaymentRequest.ts +16 -0
  47. package/src/retailLoan/dtos/CreateMyPaymentResponse.ts +10 -0
  48. package/src/retailLoan/dtos/MyPaymentOptions.ts +28 -0
  49. package/src/retailLoan/enums/MyCollectionOutcomeEnum.ts +11 -0
  50. package/src/retailLoan/enums/MyNextInstallmentModeEnum.ts +5 -0
  51. package/src/retailLoan/enums/MyPaymentTypeEnum.ts +6 -0
  52. package/src/retailLoan/enums/MyPaymentUnavailableReasonEnum.ts +8 -0
  53. package/src/retailLoan/index.ts +9 -0
@@ -0,0 +1,87 @@
1
+ import 'reflect-metadata';
2
+ import {
3
+ LoanAdHocChargeKindEnum,
4
+ LoanAdHocChargeRequested,
5
+ LoanCustomerPaymentOptions,
6
+ LoanCustomerPaymentResult,
7
+ LoanCustomerPaymentTypeEnum,
8
+ LoanNextInstallmentModeEnum,
9
+ LoanPaymentOptionUnavailableReasonEnum,
10
+ } from '../../../src/loanCredit/index';
11
+ import { CollectionResultStatus } from '../../../src/collection/enums/CollectionResultStatus';
12
+
13
+ describe('loanCredit — opciones y resultado del pago del cliente', () => {
14
+ it('la liquidación trae su cotización y el monto es el de la cotización', () => {
15
+ const options: LoanCustomerPaymentOptions = {
16
+ creditId: 'CR-1',
17
+ nextInstallment: {
18
+ available: true,
19
+ amountCents: 105000,
20
+ mode: LoanNextInstallmentModeEnum.ADVANCE,
21
+ installmentNumber: 4,
22
+ dueDate: '2026-10-01',
23
+ },
24
+ advance: { available: false, unavailableReason: LoanPaymentOptionUnavailableReasonEnum.NOT_AVAILABLE_YET },
25
+ settlement: {
26
+ available: true,
27
+ amountCents: 912345,
28
+ quote: {
29
+ creditId: 'CR-1',
30
+ overdueInstallmentsCents: 0,
31
+ outstandingCapitalCents: 890000,
32
+ currentPeriodInterestCents: 19263,
33
+ currentPeriodInterestIvaCents: 3082,
34
+ elapsedDays: 3,
35
+ periodDays: 7,
36
+ settlementAmountCents: 912345,
37
+ quotedAt: '2026-09-24T15:00:00.000Z',
38
+ },
39
+ savingsCents: 32655,
40
+ },
41
+ };
42
+
43
+ expect(options.settlement.quote?.settlementAmountCents).toBe(options.settlement.amountCents);
44
+ expect(options.pendingCharge).toBeUndefined();
45
+ });
46
+
47
+ it('un cargo en curso se informa con su tipo y su monto', () => {
48
+ const blocked = { available: false, unavailableReason: LoanPaymentOptionUnavailableReasonEnum.PAYMENT_IN_PROGRESS };
49
+ const options: LoanCustomerPaymentOptions = {
50
+ creditId: 'CR-1',
51
+ pendingCharge: { kind: LoanAdHocChargeKindEnum.ADVANCE, amountCents: 105000 },
52
+ nextInstallment: blocked,
53
+ advance: blocked,
54
+ settlement: blocked,
55
+ };
56
+
57
+ expect(options.pendingCharge?.kind).toBe('ADVANCE');
58
+ expect(options.nextInstallment.amountCents).toBeUndefined();
59
+ });
60
+
61
+ it('el resultado del pago puede venir sin la respuesta del motor', () => {
62
+ const result: LoanCustomerPaymentResult = {
63
+ creditId: 'CR-1',
64
+ type: LoanCustomerPaymentTypeEnum.NEXT_INSTALLMENT,
65
+ chargeId: 'CR-1#ADVANCE#1',
66
+ amountCents: 105000,
67
+ };
68
+
69
+ expect(result.collection).toBeUndefined();
70
+ });
71
+
72
+ it('el 202 del cargo ad hoc suma la respuesta del motor como campo opcional', () => {
73
+ const withoutCollection: LoanAdHocChargeRequested = {
74
+ creditId: 'CR-1',
75
+ chargeKind: LoanAdHocChargeKindEnum.ADVANCE,
76
+ chargeId: 'CR-1#ADVANCE#1',
77
+ amountCents: 105000,
78
+ };
79
+ const withCollection: LoanAdHocChargeRequested = {
80
+ ...withoutCollection,
81
+ collection: { status: CollectionResultStatus.PARTIAL, amountCollectedCents: 50000 },
82
+ };
83
+
84
+ expect(withoutCollection.collection).toBeUndefined();
85
+ expect(withCollection.collection?.amountCollectedCents).toBe(50000);
86
+ });
87
+ });
@@ -0,0 +1,78 @@
1
+ import 'reflect-metadata';
2
+ import { plainToInstance } from 'class-transformer';
3
+ import { validate } from 'class-validator';
4
+ import { LoanCredit } from '../../../../src/index';
5
+ import {
6
+ CreateCustomerPaymentRequest,
7
+ LoanCustomerPaymentTypeEnum,
8
+ LoanNextInstallmentModeEnum,
9
+ LoanPaymentOptionUnavailableReasonEnum,
10
+ } from '../../../../src/loanCredit/index';
11
+
12
+ const sortedValues = (enumObject: Record<string, string>) => Object.values(enumObject).sort();
13
+
14
+ const errorProperties = async (body: object): Promise<string[]> => {
15
+ const dto = plainToInstance(CreateCustomerPaymentRequest, body);
16
+ const errors = await validate(dto, { whitelist: true, forbidNonWhitelisted: false });
17
+ return errors.map(error => error.property);
18
+ };
19
+
20
+ const VALID = {
21
+ type: LoanCustomerPaymentTypeEnum.SETTLEMENT,
22
+ expectedAmountCents: 912345,
23
+ idempotencyKey: '3f1c2a9e-8b7d-4c6e-9f10-2a3b4c5d6e7f',
24
+ };
25
+
26
+ describe.each([
27
+ ['LoanCustomerPaymentTypeEnum', LoanCustomerPaymentTypeEnum, ['NEXT_INSTALLMENT', 'SETTLEMENT']],
28
+ ['LoanNextInstallmentModeEnum', LoanNextInstallmentModeEnum, ['ADVANCE', 'COLLECT_DUE']],
29
+ [
30
+ 'LoanPaymentOptionUnavailableReasonEnum',
31
+ LoanPaymentOptionUnavailableReasonEnum,
32
+ ['PAYMENT_IN_PROGRESS', 'CREDIT_NOT_CURRENT', 'USE_SETTLEMENT', 'NOT_AVAILABLE_YET', 'CREDIT_CLOSED'],
33
+ ],
34
+ ])('%s', (_name, enumObject, expected) => {
35
+ it('tiene exactamente los valores del contrato', () => {
36
+ expect(sortedValues(enumObject)).toEqual([...expected].sort());
37
+ });
38
+
39
+ it('cada clave es igual a su valor', () => {
40
+ for (const [key, value] of Object.entries(enumObject)) {
41
+ expect(key).toBe(value);
42
+ }
43
+ });
44
+ });
45
+
46
+ describe('CreateCustomerPaymentRequest', () => {
47
+ it.each([[LoanCustomerPaymentTypeEnum.NEXT_INSTALLMENT], [LoanCustomerPaymentTypeEnum.SETTLEMENT]])(
48
+ 'acepta el tipo %s',
49
+ async type => {
50
+ expect(await errorProperties({ ...VALID, type })).toEqual([]);
51
+ },
52
+ );
53
+
54
+ it('exige tipo, monto esperado y llave de idempotencia', async () => {
55
+ expect(await errorProperties({})).toEqual(
56
+ expect.arrayContaining(['type', 'expectedAmountCents', 'idempotencyKey']),
57
+ );
58
+ });
59
+
60
+ it.each([['ADVANCE'], ['PARTIAL']])('rechaza el tipo %s', async type => {
61
+ expect(await errorProperties({ ...VALID, type })).toEqual(['type']);
62
+ });
63
+
64
+ it.each([[0], [-100], [10.5], ['912345']])('rechaza el monto %p', async expectedAmountCents => {
65
+ expect(await errorProperties({ ...VALID, expectedAmountCents })).toEqual(['expectedAmountCents']);
66
+ });
67
+
68
+ it.each([['abc'], [''], [123]])('rechaza la llave %p', async idempotencyKey => {
69
+ expect(await errorProperties({ ...VALID, idempotencyKey })).toEqual(['idempotencyKey']);
70
+ });
71
+ });
72
+
73
+ describe('export por el index raíz', () => {
74
+ it('expone el request y sus enums en el namespace LoanCredit', () => {
75
+ expect(LoanCredit.CreateCustomerPaymentRequest).toBeDefined();
76
+ expect(LoanCredit.LoanCustomerPaymentTypeEnum.SETTLEMENT).toBe('SETTLEMENT');
77
+ });
78
+ });
@@ -0,0 +1,128 @@
1
+ import 'reflect-metadata';
2
+ import { plainToInstance } from 'class-transformer';
3
+ import { validate } from 'class-validator';
4
+ import { RetailLoan } from '../../../src/index';
5
+ import {
6
+ CreateMyPaymentRequest,
7
+ CreateMyPaymentResponse,
8
+ MyCollectionOutcomeEnum,
9
+ MyNextInstallmentModeEnum,
10
+ MyPaymentOptions,
11
+ MyPaymentTypeEnum,
12
+ MyPaymentUnavailableReasonEnum,
13
+ } from '../../../src/retailLoan/index';
14
+ import { LoanNextInstallmentModeEnum, LoanPaymentOptionUnavailableReasonEnum } from '../../../src/loanCredit/index';
15
+
16
+ const sortedValues = (enumObject: Record<string, string>) => Object.values(enumObject).sort();
17
+
18
+ const errorProperties = async (body: object): Promise<string[]> => {
19
+ const dto = plainToInstance(CreateMyPaymentRequest, body);
20
+ const errors = await validate(dto, { whitelist: true, forbidNonWhitelisted: false });
21
+ return errors.map(error => error.property);
22
+ };
23
+
24
+ describe.each([
25
+ ['MyPaymentTypeEnum', MyPaymentTypeEnum, ['NEXT_INSTALLMENT', 'ADVANCE', 'SETTLEMENT']],
26
+ ['MyNextInstallmentModeEnum', MyNextInstallmentModeEnum, ['ADVANCE', 'COLLECT_DUE']],
27
+ [
28
+ 'MyPaymentUnavailableReasonEnum',
29
+ MyPaymentUnavailableReasonEnum,
30
+ ['PAYMENT_IN_PROGRESS', 'CREDIT_NOT_CURRENT', 'USE_SETTLEMENT', 'NOT_AVAILABLE_YET', 'CREDIT_CLOSED'],
31
+ ],
32
+ ['MyCollectionOutcomeEnum', MyCollectionOutcomeEnum, ['COLLECTED', 'PARTIAL', 'NOT_COLLECTED', 'UNKNOWN']],
33
+ ])('%s', (_name, enumObject, expected) => {
34
+ it('tiene exactamente los valores del contrato', () => {
35
+ expect(sortedValues(enumObject)).toEqual([...expected].sort());
36
+ });
37
+
38
+ it('cada clave es igual a su valor', () => {
39
+ for (const [key, value] of Object.entries(enumObject)) {
40
+ expect(key).toBe(value);
41
+ }
42
+ });
43
+ });
44
+
45
+ describe('paridad con el contrato privado de loan-credit', () => {
46
+ it('los motivos de no disponible son los mismos', () => {
47
+ expect(sortedValues(MyPaymentUnavailableReasonEnum)).toEqual(sortedValues(LoanPaymentOptionUnavailableReasonEnum));
48
+ });
49
+
50
+ it('los modos de la siguiente cuota son los mismos', () => {
51
+ expect(sortedValues(MyNextInstallmentModeEnum)).toEqual(sortedValues(LoanNextInstallmentModeEnum));
52
+ });
53
+ });
54
+
55
+ describe('CreateMyPaymentRequest', () => {
56
+ it.each([
57
+ [{ type: MyPaymentTypeEnum.NEXT_INSTALLMENT, expectedAmount: 1050 }],
58
+ [{ type: MyPaymentTypeEnum.SETTLEMENT, expectedAmount: 9123.45 }],
59
+ [{ type: MyPaymentTypeEnum.ADVANCE, expectedAmount: 2100.5 }],
60
+ ])('acepta %j', async body => {
61
+ expect(await errorProperties(body)).toEqual([]);
62
+ });
63
+
64
+ it('exige tipo y monto esperado', async () => {
65
+ expect(await errorProperties({})).toEqual(expect.arrayContaining(['type', 'expectedAmount']));
66
+ });
67
+
68
+ it('rechaza un tipo fuera del enum', async () => {
69
+ expect(await errorProperties({ type: 'PARTIAL', expectedAmount: 1050 })).toEqual(['type']);
70
+ });
71
+
72
+ it.each([[0], [-1050], [10.123], ['1050']])('rechaza el monto %p', async expectedAmount => {
73
+ expect(await errorProperties({ type: MyPaymentTypeEnum.SETTLEMENT, expectedAmount })).toEqual(['expectedAmount']);
74
+ });
75
+ });
76
+
77
+ describe('retailLoan — opciones y respuesta del pago', () => {
78
+ it('la liquidación trae su desglose y su ahorro en pesos', () => {
79
+ const options: MyPaymentOptions = {
80
+ nextInstallment: {
81
+ available: true,
82
+ amount: 1050,
83
+ mode: MyNextInstallmentModeEnum.ADVANCE,
84
+ installmentNumber: 4,
85
+ dueDate: '2026-10-01',
86
+ },
87
+ advance: { available: false, unavailableReason: MyPaymentUnavailableReasonEnum.NOT_AVAILABLE_YET },
88
+ settlement: {
89
+ available: true,
90
+ amount: 9123.45,
91
+ breakdown: { overdue: 0, capital: 8900, interest: 192.63, iva: 30.82 },
92
+ savings: 326.55,
93
+ quotedAt: '2026-09-24T15:00:00.000Z',
94
+ },
95
+ };
96
+
97
+ expect(options.settlement.breakdown?.capital).toBe(8900);
98
+ expect(options.pendingPayment).toBeUndefined();
99
+ });
100
+
101
+ it('un pago en curso se informa con su tipo y su monto', () => {
102
+ const blocked = { available: false, unavailableReason: MyPaymentUnavailableReasonEnum.PAYMENT_IN_PROGRESS };
103
+ const options: MyPaymentOptions = {
104
+ pendingPayment: { type: MyPaymentTypeEnum.NEXT_INSTALLMENT, amount: 1050 },
105
+ nextInstallment: blocked,
106
+ advance: blocked,
107
+ settlement: blocked,
108
+ };
109
+
110
+ expect(options.pendingPayment?.type).toBe('NEXT_INSTALLMENT');
111
+ });
112
+
113
+ it('la respuesta del pago siempre trae el desenlace del cobro', () => {
114
+ const response: CreateMyPaymentResponse = {
115
+ creditId: 'CR-1',
116
+ type: MyPaymentTypeEnum.SETTLEMENT,
117
+ amount: 9123.45,
118
+ collection: MyCollectionOutcomeEnum.UNKNOWN,
119
+ };
120
+
121
+ expect(response.collection).toBe('UNKNOWN');
122
+ });
123
+
124
+ it('expone el request en el namespace RetailLoan del index raíz', () => {
125
+ expect(RetailLoan.CreateMyPaymentRequest).toBeDefined();
126
+ expect(RetailLoan.MyCollectionOutcomeEnum.NOT_COLLECTED).toBe('NOT_COLLECTED');
127
+ });
128
+ });
@@ -13,4 +13,13 @@ export declare class SettlementQuote {
13
13
  total_settlement_mxn: number;
14
14
  interest_saved_mxn: number;
15
15
  quote_date: string;
16
+ /**
17
+ * USD que se cobrarán realmente al pocket del usuario para cubrir
18
+ * `total_settlement_mxn`. Incluye fee 0.5% + IVA + colchón FX del
19
+ * collector — es el número que debe aparecer en la UI como
20
+ * "equivalente USD", no la conversión cruda `total_settlement_mxn / TC`.
21
+ * Opcional: si el collector no responde a la cotización, el backend
22
+ * omite el campo y la UI debe caer a "solo MXN".
23
+ */
24
+ total_settlement_usd_charge?: number;
16
25
  }
@@ -0,0 +1,9 @@
1
+ import { LoanCustomerPaymentTypeEnum } from '../../enums/LoanCustomerPaymentTypeEnum';
2
+ /** Body de `POST /private/customers/:directoryId/credits/:creditId/payments` (loan-credit-business). */
3
+ export declare class CreateCustomerPaymentRequest {
4
+ type: LoanCustomerPaymentTypeEnum;
5
+ /** Monto que vio el cliente; si ya no coincide, responde 409 CUSTOMER_PAYMENT_AMOUNT_CHANGED. */
6
+ expectedAmountCents: number;
7
+ /** Llave del reintento: la misma llave con el mismo cuerpo devuelve la misma respuesta. */
8
+ idempotencyKey: string;
9
+ }
@@ -0,0 +1,35 @@
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.CreateCustomerPaymentRequest = void 0;
13
+ const class_transformer_1 = require("class-transformer");
14
+ const class_validator_1 = require("class-validator");
15
+ const LoanCustomerPaymentTypeEnum_1 = require("../../enums/LoanCustomerPaymentTypeEnum");
16
+ /** Body de `POST /private/customers/:directoryId/credits/:creditId/payments` (loan-credit-business). */
17
+ class CreateCustomerPaymentRequest {
18
+ }
19
+ exports.CreateCustomerPaymentRequest = CreateCustomerPaymentRequest;
20
+ __decorate([
21
+ (0, class_transformer_1.Expose)(),
22
+ (0, class_validator_1.IsEnum)(LoanCustomerPaymentTypeEnum_1.LoanCustomerPaymentTypeEnum),
23
+ __metadata("design:type", String)
24
+ ], CreateCustomerPaymentRequest.prototype, "type", void 0);
25
+ __decorate([
26
+ (0, class_transformer_1.Expose)(),
27
+ (0, class_validator_1.IsInt)(),
28
+ (0, class_validator_1.Min)(1),
29
+ __metadata("design:type", Number)
30
+ ], CreateCustomerPaymentRequest.prototype, "expectedAmountCents", void 0);
31
+ __decorate([
32
+ (0, class_transformer_1.Expose)(),
33
+ (0, class_validator_1.IsUUID)(),
34
+ __metadata("design:type", String)
35
+ ], CreateCustomerPaymentRequest.prototype, "idempotencyKey", void 0);
@@ -1,3 +1,4 @@
1
+ import { CollectionResultStatus } from '../../../collection/enums/CollectionResultStatus';
1
2
  import { LoanAdHocChargeKindEnum } from '../../enums/LoanAdHocChargeKindEnum';
2
3
  /** Response 202 de recovery-collection, prepayments y advances. El 202 no mueve el libro; lo mueve el apply-result. */
3
4
  export interface LoanAdHocChargeRequested {
@@ -6,4 +7,9 @@ export interface LoanAdHocChargeRequested {
6
7
  /** `<creditId>#<chargeKind>#<n>`. */
7
8
  chargeId: string;
8
9
  amountCents: number;
10
+ /** Respuesta síncrona del motor; ausente si no contestó a tiempo. */
11
+ collection?: {
12
+ status: CollectionResultStatus;
13
+ amountCollectedCents: number;
14
+ };
9
15
  }
@@ -0,0 +1,33 @@
1
+ import { LoanAdHocChargeKindEnum } from '../../enums/LoanAdHocChargeKindEnum';
2
+ import { LoanNextInstallmentModeEnum } from '../../enums/LoanNextInstallmentModeEnum';
3
+ import { LoanPaymentOptionUnavailableReasonEnum } from '../../enums/LoanPaymentOptionUnavailableReasonEnum';
4
+ import { LoanSettlementQuote } from './LoanSettlementQuote';
5
+ /** Una opción de pago. `amountCents` solo viene si está disponible. */
6
+ export interface LoanCustomerPaymentOption {
7
+ available: boolean;
8
+ unavailableReason?: LoanPaymentOptionUnavailableReasonEnum;
9
+ amountCents?: number;
10
+ }
11
+ /** Response de `GET /private/customers/:directoryId/credits/:creditId/payment-options`. Montos en cents. */
12
+ export interface LoanCustomerPaymentOptions {
13
+ creditId: string;
14
+ /** Cargo ad hoc en curso; mientras exista, ninguna opción está disponible. */
15
+ pendingCharge?: {
16
+ kind: LoanAdHocChargeKindEnum;
17
+ amountCents: number;
18
+ };
19
+ nextInstallment: LoanCustomerPaymentOption & {
20
+ mode?: LoanNextInstallmentModeEnum;
21
+ installmentNumber?: number;
22
+ /** `YYYY-MM-DD`. */
23
+ dueDate?: string;
24
+ };
25
+ /** Varias cuotas: hoy siempre `available: false` con `NOT_AVAILABLE_YET`. */
26
+ advance: LoanCustomerPaymentOption;
27
+ settlement: LoanCustomerPaymentOption & {
28
+ /** La cotización de hoy; su `settlementAmountCents` es el `amountCents`. */
29
+ quote?: LoanSettlementQuote;
30
+ /** Lo que deben las cuotas abiertas menos `settlementAmountCents`. */
31
+ savingsCents?: number;
32
+ };
33
+ }
@@ -0,0 +1,2 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
@@ -0,0 +1,14 @@
1
+ import { CollectionResultStatus } from '../../../collection/enums/CollectionResultStatus';
2
+ import { LoanCustomerPaymentTypeEnum } from '../../enums/LoanCustomerPaymentTypeEnum';
3
+ /** Response 202 de `POST /private/customers/:directoryId/credits/:creditId/payments`. */
4
+ export interface LoanCustomerPaymentResult {
5
+ creditId: string;
6
+ type: LoanCustomerPaymentTypeEnum;
7
+ chargeId: string;
8
+ amountCents: number;
9
+ /** Respuesta síncrona del motor; ausente si no contestó a tiempo. */
10
+ collection?: {
11
+ status: CollectionResultStatus;
12
+ amountCollectedCents: number;
13
+ };
14
+ }
@@ -0,0 +1,2 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
@@ -0,0 +1,5 @@
1
+ /** Pago que el cliente puede pedir desde la app. */
2
+ export declare enum LoanCustomerPaymentTypeEnum {
3
+ NEXT_INSTALLMENT = "NEXT_INSTALLMENT",
4
+ SETTLEMENT = "SETTLEMENT"
5
+ }
@@ -0,0 +1,9 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.LoanCustomerPaymentTypeEnum = void 0;
4
+ /** Pago que el cliente puede pedir desde la app. */
5
+ var LoanCustomerPaymentTypeEnum;
6
+ (function (LoanCustomerPaymentTypeEnum) {
7
+ LoanCustomerPaymentTypeEnum["NEXT_INSTALLMENT"] = "NEXT_INSTALLMENT";
8
+ LoanCustomerPaymentTypeEnum["SETTLEMENT"] = "SETTLEMENT";
9
+ })(LoanCustomerPaymentTypeEnum || (exports.LoanCustomerPaymentTypeEnum = LoanCustomerPaymentTypeEnum = {}));
@@ -0,0 +1,7 @@
1
+ /** Cómo se cobra la siguiente cuota. */
2
+ export declare enum LoanNextInstallmentModeEnum {
3
+ /** La cuota aún no está registrada en el motor: se adelanta. */
4
+ ADVANCE = "ADVANCE",
5
+ /** Vence hoy o hay vencidas: se cobra lo exigible. */
6
+ COLLECT_DUE = "COLLECT_DUE"
7
+ }
@@ -0,0 +1,11 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.LoanNextInstallmentModeEnum = void 0;
4
+ /** Cómo se cobra la siguiente cuota. */
5
+ var LoanNextInstallmentModeEnum;
6
+ (function (LoanNextInstallmentModeEnum) {
7
+ /** La cuota aún no está registrada en el motor: se adelanta. */
8
+ LoanNextInstallmentModeEnum["ADVANCE"] = "ADVANCE";
9
+ /** Vence hoy o hay vencidas: se cobra lo exigible. */
10
+ LoanNextInstallmentModeEnum["COLLECT_DUE"] = "COLLECT_DUE";
11
+ })(LoanNextInstallmentModeEnum || (exports.LoanNextInstallmentModeEnum = LoanNextInstallmentModeEnum = {}));
@@ -0,0 +1,13 @@
1
+ /** Por qué una opción de pago no está disponible. */
2
+ export declare enum LoanPaymentOptionUnavailableReasonEnum {
3
+ /** Hay un cargo ad hoc en curso. */
4
+ PAYMENT_IN_PROGRESS = "PAYMENT_IN_PROGRESS",
5
+ /** El crédito todavía no está activo. */
6
+ CREDIT_NOT_CURRENT = "CREDIT_NOT_CURRENT",
7
+ /** Adelantar cubriría todo lo abierto: se liquida. */
8
+ USE_SETTLEMENT = "USE_SETTLEMENT",
9
+ /** La opción aún no está habilitada. */
10
+ NOT_AVAILABLE_YET = "NOT_AVAILABLE_YET",
11
+ /** SETTLED, WRITTEN_OFF, CANCELLED o DISCARDED. */
12
+ CREDIT_CLOSED = "CREDIT_CLOSED"
13
+ }
@@ -0,0 +1,17 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.LoanPaymentOptionUnavailableReasonEnum = void 0;
4
+ /** Por qué una opción de pago no está disponible. */
5
+ var LoanPaymentOptionUnavailableReasonEnum;
6
+ (function (LoanPaymentOptionUnavailableReasonEnum) {
7
+ /** Hay un cargo ad hoc en curso. */
8
+ LoanPaymentOptionUnavailableReasonEnum["PAYMENT_IN_PROGRESS"] = "PAYMENT_IN_PROGRESS";
9
+ /** El crédito todavía no está activo. */
10
+ LoanPaymentOptionUnavailableReasonEnum["CREDIT_NOT_CURRENT"] = "CREDIT_NOT_CURRENT";
11
+ /** Adelantar cubriría todo lo abierto: se liquida. */
12
+ LoanPaymentOptionUnavailableReasonEnum["USE_SETTLEMENT"] = "USE_SETTLEMENT";
13
+ /** La opción aún no está habilitada. */
14
+ LoanPaymentOptionUnavailableReasonEnum["NOT_AVAILABLE_YET"] = "NOT_AVAILABLE_YET";
15
+ /** SETTLED, WRITTEN_OFF, CANCELLED o DISCARDED. */
16
+ LoanPaymentOptionUnavailableReasonEnum["CREDIT_CLOSED"] = "CREDIT_CLOSED";
17
+ })(LoanPaymentOptionUnavailableReasonEnum || (exports.LoanPaymentOptionUnavailableReasonEnum = LoanPaymentOptionUnavailableReasonEnum = {}));
@@ -131,3 +131,9 @@ export * from './dtos/responses/LoanPrepaymentQuote';
131
131
  export * from './dtos/responses/LoanPaymentReviewItem';
132
132
  export * from './dtos/responses/LoanPaymentReviewListResponse';
133
133
  export * from './dtos/responses/LoanPaymentReviewResolution';
134
+ export * from './enums/LoanCustomerPaymentTypeEnum';
135
+ export * from './enums/LoanNextInstallmentModeEnum';
136
+ export * from './enums/LoanPaymentOptionUnavailableReasonEnum';
137
+ export * from './dtos/requests/CreateCustomerPaymentRequest';
138
+ export * from './dtos/responses/LoanCustomerPaymentOptions';
139
+ export * from './dtos/responses/LoanCustomerPaymentResult';
@@ -172,3 +172,10 @@ __exportStar(require("./dtos/responses/LoanPrepaymentQuote"), exports);
172
172
  __exportStar(require("./dtos/responses/LoanPaymentReviewItem"), exports);
173
173
  __exportStar(require("./dtos/responses/LoanPaymentReviewListResponse"), exports);
174
174
  __exportStar(require("./dtos/responses/LoanPaymentReviewResolution"), exports);
175
+ // Pagos del cliente: contrato privado con retail-loan-business
176
+ __exportStar(require("./enums/LoanCustomerPaymentTypeEnum"), exports);
177
+ __exportStar(require("./enums/LoanNextInstallmentModeEnum"), exports);
178
+ __exportStar(require("./enums/LoanPaymentOptionUnavailableReasonEnum"), exports);
179
+ __exportStar(require("./dtos/requests/CreateCustomerPaymentRequest"), exports);
180
+ __exportStar(require("./dtos/responses/LoanCustomerPaymentOptions"), exports);
181
+ __exportStar(require("./dtos/responses/LoanCustomerPaymentResult"), exports);
@@ -0,0 +1,7 @@
1
+ import { MyPaymentTypeEnum } from '../enums/MyPaymentTypeEnum';
2
+ /** Body de `POST /benefits/{benefitId}/credits/{creditId}/payments`. La llave va en el header `Idempotency-Key`. */
3
+ export declare class CreateMyPaymentRequest {
4
+ type: MyPaymentTypeEnum;
5
+ /** Monto en pesos que vio el cliente; si ya no coincide, responde PAYMENT_AMOUNT_CHANGED. */
6
+ expectedAmount: number;
7
+ }
@@ -0,0 +1,30 @@
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.CreateMyPaymentRequest = void 0;
13
+ const class_transformer_1 = require("class-transformer");
14
+ const class_validator_1 = require("class-validator");
15
+ const MyPaymentTypeEnum_1 = require("../enums/MyPaymentTypeEnum");
16
+ /** Body de `POST /benefits/{benefitId}/credits/{creditId}/payments`. La llave va en el header `Idempotency-Key`. */
17
+ class CreateMyPaymentRequest {
18
+ }
19
+ exports.CreateMyPaymentRequest = CreateMyPaymentRequest;
20
+ __decorate([
21
+ (0, class_transformer_1.Expose)(),
22
+ (0, class_validator_1.IsEnum)(MyPaymentTypeEnum_1.MyPaymentTypeEnum),
23
+ __metadata("design:type", String)
24
+ ], CreateMyPaymentRequest.prototype, "type", void 0);
25
+ __decorate([
26
+ (0, class_transformer_1.Expose)(),
27
+ (0, class_validator_1.IsNumber)({ maxDecimalPlaces: 2 }),
28
+ (0, class_validator_1.IsPositive)(),
29
+ __metadata("design:type", Number)
30
+ ], CreateMyPaymentRequest.prototype, "expectedAmount", void 0);
@@ -0,0 +1,9 @@
1
+ import { MyCollectionOutcomeEnum } from '../enums/MyCollectionOutcomeEnum';
2
+ import { MyPaymentTypeEnum } from '../enums/MyPaymentTypeEnum';
3
+ /** Response 202 del pago. `amount` en pesos. */
4
+ export interface CreateMyPaymentResponse {
5
+ creditId: string;
6
+ type: MyPaymentTypeEnum;
7
+ amount: number;
8
+ collection: MyCollectionOutcomeEnum;
9
+ }
@@ -0,0 +1,2 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
@@ -0,0 +1,34 @@
1
+ import { MyNextInstallmentModeEnum } from '../enums/MyNextInstallmentModeEnum';
2
+ import { MyPaymentTypeEnum } from '../enums/MyPaymentTypeEnum';
3
+ import { MyPaymentUnavailableReasonEnum } from '../enums/MyPaymentUnavailableReasonEnum';
4
+ /** Una opción de pago. `amount` en pesos, solo si está disponible. */
5
+ export interface MyPaymentOption {
6
+ available: boolean;
7
+ unavailableReason?: MyPaymentUnavailableReasonEnum;
8
+ amount?: number;
9
+ }
10
+ /** Opciones de pago de un crédito (`GET /benefits/{benefitId}/credits/{creditId}/payment-options`). Montos en pesos. */
11
+ export interface MyPaymentOptions {
12
+ /** Pago en curso; mientras exista, ninguna opción está disponible. */
13
+ pendingPayment?: {
14
+ type: MyPaymentTypeEnum;
15
+ amount: number;
16
+ };
17
+ nextInstallment: MyPaymentOption & {
18
+ mode?: MyNextInstallmentModeEnum;
19
+ installmentNumber?: number;
20
+ /** `YYYY-MM-DD`. */
21
+ dueDate?: string;
22
+ };
23
+ advance: MyPaymentOption;
24
+ settlement: MyPaymentOption & {
25
+ breakdown?: {
26
+ overdue: number;
27
+ capital: number;
28
+ interest: number;
29
+ iva: number;
30
+ };
31
+ savings?: number;
32
+ quotedAt?: string;
33
+ };
34
+ }
@@ -0,0 +1,2 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
@@ -0,0 +1,11 @@
1
+ /** Desenlace del cobro tal como lo contestó el motor. */
2
+ export declare enum MyCollectionOutcomeEnum {
3
+ /** FULL */
4
+ COLLECTED = "COLLECTED",
5
+ /** PARTIAL */
6
+ PARTIAL = "PARTIAL",
7
+ /** NONE */
8
+ NOT_COLLECTED = "NOT_COLLECTED",
9
+ /** El motor no contestó a tiempo. */
10
+ UNKNOWN = "UNKNOWN"
11
+ }
@@ -0,0 +1,15 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.MyCollectionOutcomeEnum = void 0;
4
+ /** Desenlace del cobro tal como lo contestó el motor. */
5
+ var MyCollectionOutcomeEnum;
6
+ (function (MyCollectionOutcomeEnum) {
7
+ /** FULL */
8
+ MyCollectionOutcomeEnum["COLLECTED"] = "COLLECTED";
9
+ /** PARTIAL */
10
+ MyCollectionOutcomeEnum["PARTIAL"] = "PARTIAL";
11
+ /** NONE */
12
+ MyCollectionOutcomeEnum["NOT_COLLECTED"] = "NOT_COLLECTED";
13
+ /** El motor no contestó a tiempo. */
14
+ MyCollectionOutcomeEnum["UNKNOWN"] = "UNKNOWN";
15
+ })(MyCollectionOutcomeEnum || (exports.MyCollectionOutcomeEnum = MyCollectionOutcomeEnum = {}));
@@ -0,0 +1,5 @@
1
+ /** Cómo se cobra la siguiente cuota: se adelanta, o se cobra lo que ya vence o venció. */
2
+ export declare enum MyNextInstallmentModeEnum {
3
+ ADVANCE = "ADVANCE",
4
+ COLLECT_DUE = "COLLECT_DUE"
5
+ }
@@ -0,0 +1,9 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.MyNextInstallmentModeEnum = void 0;
4
+ /** Cómo se cobra la siguiente cuota: se adelanta, o se cobra lo que ya vence o venció. */
5
+ var MyNextInstallmentModeEnum;
6
+ (function (MyNextInstallmentModeEnum) {
7
+ MyNextInstallmentModeEnum["ADVANCE"] = "ADVANCE";
8
+ MyNextInstallmentModeEnum["COLLECT_DUE"] = "COLLECT_DUE";
9
+ })(MyNextInstallmentModeEnum || (exports.MyNextInstallmentModeEnum = MyNextInstallmentModeEnum = {}));
@@ -0,0 +1,6 @@
1
+ /** Pago que el cliente pide desde la app. `ADVANCE` = varias cuotas. */
2
+ export declare enum MyPaymentTypeEnum {
3
+ NEXT_INSTALLMENT = "NEXT_INSTALLMENT",
4
+ ADVANCE = "ADVANCE",
5
+ SETTLEMENT = "SETTLEMENT"
6
+ }
@@ -0,0 +1,10 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.MyPaymentTypeEnum = void 0;
4
+ /** Pago que el cliente pide desde la app. `ADVANCE` = varias cuotas. */
5
+ var MyPaymentTypeEnum;
6
+ (function (MyPaymentTypeEnum) {
7
+ MyPaymentTypeEnum["NEXT_INSTALLMENT"] = "NEXT_INSTALLMENT";
8
+ MyPaymentTypeEnum["ADVANCE"] = "ADVANCE";
9
+ MyPaymentTypeEnum["SETTLEMENT"] = "SETTLEMENT";
10
+ })(MyPaymentTypeEnum || (exports.MyPaymentTypeEnum = MyPaymentTypeEnum = {}));
@@ -0,0 +1,8 @@
1
+ /** Por qué una opción de pago no está disponible. Mismos valores que manda loan-credit. */
2
+ export declare enum MyPaymentUnavailableReasonEnum {
3
+ PAYMENT_IN_PROGRESS = "PAYMENT_IN_PROGRESS",
4
+ CREDIT_NOT_CURRENT = "CREDIT_NOT_CURRENT",
5
+ USE_SETTLEMENT = "USE_SETTLEMENT",
6
+ NOT_AVAILABLE_YET = "NOT_AVAILABLE_YET",
7
+ CREDIT_CLOSED = "CREDIT_CLOSED"
8
+ }
@@ -0,0 +1,12 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.MyPaymentUnavailableReasonEnum = void 0;
4
+ /** Por qué una opción de pago no está disponible. Mismos valores que manda loan-credit. */
5
+ var MyPaymentUnavailableReasonEnum;
6
+ (function (MyPaymentUnavailableReasonEnum) {
7
+ MyPaymentUnavailableReasonEnum["PAYMENT_IN_PROGRESS"] = "PAYMENT_IN_PROGRESS";
8
+ MyPaymentUnavailableReasonEnum["CREDIT_NOT_CURRENT"] = "CREDIT_NOT_CURRENT";
9
+ MyPaymentUnavailableReasonEnum["USE_SETTLEMENT"] = "USE_SETTLEMENT";
10
+ MyPaymentUnavailableReasonEnum["NOT_AVAILABLE_YET"] = "NOT_AVAILABLE_YET";
11
+ MyPaymentUnavailableReasonEnum["CREDIT_CLOSED"] = "CREDIT_CLOSED";
12
+ })(MyPaymentUnavailableReasonEnum || (exports.MyPaymentUnavailableReasonEnum = MyPaymentUnavailableReasonEnum = {}));
@@ -10,3 +10,10 @@ export * from './dtos/MyInstallment';
10
10
  export * from './dtos/MyPayment';
11
11
  export * from './dtos/MyDocument';
12
12
  export * from './dtos/MyDocumentUrl';
13
+ export * from './enums/MyPaymentTypeEnum';
14
+ export * from './enums/MyNextInstallmentModeEnum';
15
+ export * from './enums/MyPaymentUnavailableReasonEnum';
16
+ export * from './enums/MyCollectionOutcomeEnum';
17
+ export * from './dtos/MyPaymentOptions';
18
+ export * from './dtos/CreateMyPaymentRequest';
19
+ export * from './dtos/CreateMyPaymentResponse';
@@ -28,3 +28,11 @@ __exportStar(require("./dtos/MyInstallment"), exports);
28
28
  __exportStar(require("./dtos/MyPayment"), exports);
29
29
  __exportStar(require("./dtos/MyDocument"), exports);
30
30
  __exportStar(require("./dtos/MyDocumentUrl"), exports);
31
+ // Pagos
32
+ __exportStar(require("./enums/MyPaymentTypeEnum"), exports);
33
+ __exportStar(require("./enums/MyNextInstallmentModeEnum"), exports);
34
+ __exportStar(require("./enums/MyPaymentUnavailableReasonEnum"), exports);
35
+ __exportStar(require("./enums/MyCollectionOutcomeEnum"), exports);
36
+ __exportStar(require("./dtos/MyPaymentOptions"), exports);
37
+ __exportStar(require("./dtos/CreateMyPaymentRequest"), exports);
38
+ __exportStar(require("./dtos/CreateMyPaymentResponse"), exports);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@fiado/type-kit",
3
- "version": "3.461.0",
3
+ "version": "3.463.0",
4
4
  "description": "",
5
5
  "main": "bin/index.js",
6
6
  "types": "bin/index.d.ts",
@@ -13,4 +13,13 @@ export class SettlementQuote {
13
13
  total_settlement_mxn!: number;
14
14
  interest_saved_mxn!: number;
15
15
  quote_date!: string;
16
+ /**
17
+ * USD que se cobrarán realmente al pocket del usuario para cubrir
18
+ * `total_settlement_mxn`. Incluye fee 0.5% + IVA + colchón FX del
19
+ * collector — es el número que debe aparecer en la UI como
20
+ * "equivalente USD", no la conversión cruda `total_settlement_mxn / TC`.
21
+ * Opcional: si el collector no responde a la cotización, el backend
22
+ * omite el campo y la UI debe caer a "solo MXN".
23
+ */
24
+ total_settlement_usd_charge?: number;
16
25
  }
@@ -0,0 +1,21 @@
1
+ import { Expose } from 'class-transformer';
2
+ import { IsEnum, IsInt, IsUUID, Min } from 'class-validator';
3
+ import { LoanCustomerPaymentTypeEnum } from '../../enums/LoanCustomerPaymentTypeEnum';
4
+
5
+ /** Body de `POST /private/customers/:directoryId/credits/:creditId/payments` (loan-credit-business). */
6
+ export class CreateCustomerPaymentRequest {
7
+ @Expose()
8
+ @IsEnum(LoanCustomerPaymentTypeEnum)
9
+ type!: LoanCustomerPaymentTypeEnum;
10
+
11
+ /** Monto que vio el cliente; si ya no coincide, responde 409 CUSTOMER_PAYMENT_AMOUNT_CHANGED. */
12
+ @Expose()
13
+ @IsInt()
14
+ @Min(1)
15
+ expectedAmountCents!: number;
16
+
17
+ /** Llave del reintento: la misma llave con el mismo cuerpo devuelve la misma respuesta. */
18
+ @Expose()
19
+ @IsUUID()
20
+ idempotencyKey!: string;
21
+ }
@@ -1,3 +1,4 @@
1
+ import { CollectionResultStatus } from '../../../collection/enums/CollectionResultStatus';
1
2
  import { LoanAdHocChargeKindEnum } from '../../enums/LoanAdHocChargeKindEnum';
2
3
 
3
4
  /** Response 202 de recovery-collection, prepayments y advances. El 202 no mueve el libro; lo mueve el apply-result. */
@@ -7,4 +8,6 @@ export interface LoanAdHocChargeRequested {
7
8
  /** `<creditId>#<chargeKind>#<n>`. */
8
9
  chargeId: string;
9
10
  amountCents: number;
11
+ /** Respuesta síncrona del motor; ausente si no contestó a tiempo. */
12
+ collection?: { status: CollectionResultStatus; amountCollectedCents: number };
10
13
  }
@@ -0,0 +1,32 @@
1
+ import { LoanAdHocChargeKindEnum } from '../../enums/LoanAdHocChargeKindEnum';
2
+ import { LoanNextInstallmentModeEnum } from '../../enums/LoanNextInstallmentModeEnum';
3
+ import { LoanPaymentOptionUnavailableReasonEnum } from '../../enums/LoanPaymentOptionUnavailableReasonEnum';
4
+ import { LoanSettlementQuote } from './LoanSettlementQuote';
5
+
6
+ /** Una opción de pago. `amountCents` solo viene si está disponible. */
7
+ export interface LoanCustomerPaymentOption {
8
+ available: boolean;
9
+ unavailableReason?: LoanPaymentOptionUnavailableReasonEnum;
10
+ amountCents?: number;
11
+ }
12
+
13
+ /** Response de `GET /private/customers/:directoryId/credits/:creditId/payment-options`. Montos en cents. */
14
+ export interface LoanCustomerPaymentOptions {
15
+ creditId: string;
16
+ /** Cargo ad hoc en curso; mientras exista, ninguna opción está disponible. */
17
+ pendingCharge?: { kind: LoanAdHocChargeKindEnum; amountCents: number };
18
+ nextInstallment: LoanCustomerPaymentOption & {
19
+ mode?: LoanNextInstallmentModeEnum;
20
+ installmentNumber?: number;
21
+ /** `YYYY-MM-DD`. */
22
+ dueDate?: string;
23
+ };
24
+ /** Varias cuotas: hoy siempre `available: false` con `NOT_AVAILABLE_YET`. */
25
+ advance: LoanCustomerPaymentOption;
26
+ settlement: LoanCustomerPaymentOption & {
27
+ /** La cotización de hoy; su `settlementAmountCents` es el `amountCents`. */
28
+ quote?: LoanSettlementQuote;
29
+ /** Lo que deben las cuotas abiertas menos `settlementAmountCents`. */
30
+ savingsCents?: number;
31
+ };
32
+ }
@@ -0,0 +1,12 @@
1
+ import { CollectionResultStatus } from '../../../collection/enums/CollectionResultStatus';
2
+ import { LoanCustomerPaymentTypeEnum } from '../../enums/LoanCustomerPaymentTypeEnum';
3
+
4
+ /** Response 202 de `POST /private/customers/:directoryId/credits/:creditId/payments`. */
5
+ export interface LoanCustomerPaymentResult {
6
+ creditId: string;
7
+ type: LoanCustomerPaymentTypeEnum;
8
+ chargeId: string;
9
+ amountCents: number;
10
+ /** Respuesta síncrona del motor; ausente si no contestó a tiempo. */
11
+ collection?: { status: CollectionResultStatus; amountCollectedCents: number };
12
+ }
@@ -0,0 +1,5 @@
1
+ /** Pago que el cliente puede pedir desde la app. */
2
+ export enum LoanCustomerPaymentTypeEnum {
3
+ NEXT_INSTALLMENT = 'NEXT_INSTALLMENT',
4
+ SETTLEMENT = 'SETTLEMENT',
5
+ }
@@ -0,0 +1,7 @@
1
+ /** Cómo se cobra la siguiente cuota. */
2
+ export enum LoanNextInstallmentModeEnum {
3
+ /** La cuota aún no está registrada en el motor: se adelanta. */
4
+ ADVANCE = 'ADVANCE',
5
+ /** Vence hoy o hay vencidas: se cobra lo exigible. */
6
+ COLLECT_DUE = 'COLLECT_DUE',
7
+ }
@@ -0,0 +1,13 @@
1
+ /** Por qué una opción de pago no está disponible. */
2
+ export enum LoanPaymentOptionUnavailableReasonEnum {
3
+ /** Hay un cargo ad hoc en curso. */
4
+ PAYMENT_IN_PROGRESS = 'PAYMENT_IN_PROGRESS',
5
+ /** El crédito todavía no está activo. */
6
+ CREDIT_NOT_CURRENT = 'CREDIT_NOT_CURRENT',
7
+ /** Adelantar cubriría todo lo abierto: se liquida. */
8
+ USE_SETTLEMENT = 'USE_SETTLEMENT',
9
+ /** La opción aún no está habilitada. */
10
+ NOT_AVAILABLE_YET = 'NOT_AVAILABLE_YET',
11
+ /** SETTLED, WRITTEN_OFF, CANCELLED o DISCARDED. */
12
+ CREDIT_CLOSED = 'CREDIT_CLOSED',
13
+ }
@@ -154,3 +154,11 @@ export * from './dtos/responses/LoanPrepaymentQuote';
154
154
  export * from './dtos/responses/LoanPaymentReviewItem';
155
155
  export * from './dtos/responses/LoanPaymentReviewListResponse';
156
156
  export * from './dtos/responses/LoanPaymentReviewResolution';
157
+
158
+ // Pagos del cliente: contrato privado con retail-loan-business
159
+ export * from './enums/LoanCustomerPaymentTypeEnum';
160
+ export * from './enums/LoanNextInstallmentModeEnum';
161
+ export * from './enums/LoanPaymentOptionUnavailableReasonEnum';
162
+ export * from './dtos/requests/CreateCustomerPaymentRequest';
163
+ export * from './dtos/responses/LoanCustomerPaymentOptions';
164
+ export * from './dtos/responses/LoanCustomerPaymentResult';
@@ -0,0 +1,16 @@
1
+ import { Expose } from 'class-transformer';
2
+ import { IsEnum, IsNumber, IsPositive } from 'class-validator';
3
+ import { MyPaymentTypeEnum } from '../enums/MyPaymentTypeEnum';
4
+
5
+ /** Body de `POST /benefits/{benefitId}/credits/{creditId}/payments`. La llave va en el header `Idempotency-Key`. */
6
+ export class CreateMyPaymentRequest {
7
+ @Expose()
8
+ @IsEnum(MyPaymentTypeEnum)
9
+ type!: MyPaymentTypeEnum;
10
+
11
+ /** Monto en pesos que vio el cliente; si ya no coincide, responde PAYMENT_AMOUNT_CHANGED. */
12
+ @Expose()
13
+ @IsNumber({ maxDecimalPlaces: 2 })
14
+ @IsPositive()
15
+ expectedAmount!: number;
16
+ }
@@ -0,0 +1,10 @@
1
+ import { MyCollectionOutcomeEnum } from '../enums/MyCollectionOutcomeEnum';
2
+ import { MyPaymentTypeEnum } from '../enums/MyPaymentTypeEnum';
3
+
4
+ /** Response 202 del pago. `amount` en pesos. */
5
+ export interface CreateMyPaymentResponse {
6
+ creditId: string;
7
+ type: MyPaymentTypeEnum;
8
+ amount: number;
9
+ collection: MyCollectionOutcomeEnum;
10
+ }
@@ -0,0 +1,28 @@
1
+ import { MyNextInstallmentModeEnum } from '../enums/MyNextInstallmentModeEnum';
2
+ import { MyPaymentTypeEnum } from '../enums/MyPaymentTypeEnum';
3
+ import { MyPaymentUnavailableReasonEnum } from '../enums/MyPaymentUnavailableReasonEnum';
4
+
5
+ /** Una opción de pago. `amount` en pesos, solo si está disponible. */
6
+ export interface MyPaymentOption {
7
+ available: boolean;
8
+ unavailableReason?: MyPaymentUnavailableReasonEnum;
9
+ amount?: number;
10
+ }
11
+
12
+ /** Opciones de pago de un crédito (`GET /benefits/{benefitId}/credits/{creditId}/payment-options`). Montos en pesos. */
13
+ export interface MyPaymentOptions {
14
+ /** Pago en curso; mientras exista, ninguna opción está disponible. */
15
+ pendingPayment?: { type: MyPaymentTypeEnum; amount: number };
16
+ nextInstallment: MyPaymentOption & {
17
+ mode?: MyNextInstallmentModeEnum;
18
+ installmentNumber?: number;
19
+ /** `YYYY-MM-DD`. */
20
+ dueDate?: string;
21
+ };
22
+ advance: MyPaymentOption;
23
+ settlement: MyPaymentOption & {
24
+ breakdown?: { overdue: number; capital: number; interest: number; iva: number };
25
+ savings?: number;
26
+ quotedAt?: string;
27
+ };
28
+ }
@@ -0,0 +1,11 @@
1
+ /** Desenlace del cobro tal como lo contestó el motor. */
2
+ export enum MyCollectionOutcomeEnum {
3
+ /** FULL */
4
+ COLLECTED = 'COLLECTED',
5
+ /** PARTIAL */
6
+ PARTIAL = 'PARTIAL',
7
+ /** NONE */
8
+ NOT_COLLECTED = 'NOT_COLLECTED',
9
+ /** El motor no contestó a tiempo. */
10
+ UNKNOWN = 'UNKNOWN',
11
+ }
@@ -0,0 +1,5 @@
1
+ /** Cómo se cobra la siguiente cuota: se adelanta, o se cobra lo que ya vence o venció. */
2
+ export enum MyNextInstallmentModeEnum {
3
+ ADVANCE = 'ADVANCE',
4
+ COLLECT_DUE = 'COLLECT_DUE',
5
+ }
@@ -0,0 +1,6 @@
1
+ /** Pago que el cliente pide desde la app. `ADVANCE` = varias cuotas. */
2
+ export enum MyPaymentTypeEnum {
3
+ NEXT_INSTALLMENT = 'NEXT_INSTALLMENT',
4
+ ADVANCE = 'ADVANCE',
5
+ SETTLEMENT = 'SETTLEMENT',
6
+ }
@@ -0,0 +1,8 @@
1
+ /** Por qué una opción de pago no está disponible. Mismos valores que manda loan-credit. */
2
+ export enum MyPaymentUnavailableReasonEnum {
3
+ PAYMENT_IN_PROGRESS = 'PAYMENT_IN_PROGRESS',
4
+ CREDIT_NOT_CURRENT = 'CREDIT_NOT_CURRENT',
5
+ USE_SETTLEMENT = 'USE_SETTLEMENT',
6
+ NOT_AVAILABLE_YET = 'NOT_AVAILABLE_YET',
7
+ CREDIT_CLOSED = 'CREDIT_CLOSED',
8
+ }
@@ -13,3 +13,12 @@ export * from './dtos/MyInstallment';
13
13
  export * from './dtos/MyPayment';
14
14
  export * from './dtos/MyDocument';
15
15
  export * from './dtos/MyDocumentUrl';
16
+
17
+ // Pagos
18
+ export * from './enums/MyPaymentTypeEnum';
19
+ export * from './enums/MyNextInstallmentModeEnum';
20
+ export * from './enums/MyPaymentUnavailableReasonEnum';
21
+ export * from './enums/MyCollectionOutcomeEnum';
22
+ export * from './dtos/MyPaymentOptions';
23
+ export * from './dtos/CreateMyPaymentRequest';
24
+ export * from './dtos/CreateMyPaymentResponse';