@fiado/type-kit 3.548.0 → 3.550.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.
- package/_test_/unit/loanCredit/cancelLoanCreditRequest.test.ts +5 -0
- package/_test_/unit/retailWizard/saleCancellation.test.ts +3 -1
- package/bin/loanCredit/dtos/requests/CancelLoanCreditRequest.d.ts +2 -0
- package/bin/loanCredit/dtos/requests/CancelLoanCreditRequest.js +9 -0
- package/bin/loanCredit/dtos/responses/LoanPrepaymentQuote.d.ts +2 -0
- package/bin/retailWizard/dtos/SaleCancellation.d.ts +2 -0
- package/package.json +1 -1
- package/src/loanCredit/dtos/requests/CancelLoanCreditRequest.ts +10 -1
- package/src/loanCredit/dtos/responses/LoanPrepaymentQuote.ts +2 -0
- package/src/retailWizard/dtos/SaleCancellation.ts +2 -0
|
@@ -28,6 +28,11 @@ describe('CancelLoanCreditRequest', () => {
|
|
|
28
28
|
it('rechaza un saleId con caracteres fuera de la referencia del hecho', async () => {
|
|
29
29
|
expect(await errorsOf({ ...VALID, saleId: 'SALE#123' })).toEqual(['saleId']);
|
|
30
30
|
});
|
|
31
|
+
it('cancelledBy es opcional y comparte el charset de saleId', async () => {
|
|
32
|
+
expect(await errorsOf({ ...VALID, cancelledBy: 'sub-123:admin.vl' })).toEqual([]);
|
|
33
|
+
expect(await errorsOf({ ...VALID, cancelledBy: 'actor#1' })).toEqual(['cancelledBy']);
|
|
34
|
+
expect(await errorsOf({ ...VALID, cancelledBy: 'x'.repeat(121) })).toEqual(['cancelledBy']);
|
|
35
|
+
});
|
|
31
36
|
});
|
|
32
37
|
|
|
33
38
|
describe('LoanCreditResponse.hasPayments', () => {
|
|
@@ -16,10 +16,12 @@ describe('SaleCancellation', () => {
|
|
|
16
16
|
it('viaja opcional en la venta', () => {
|
|
17
17
|
const cancellation: SaleCancellation = {
|
|
18
18
|
allowed: false,
|
|
19
|
-
reason: SaleCancellationReasonEnum.
|
|
19
|
+
reason: SaleCancellationReasonEnum.CANCEL_WINDOW_EXPIRED,
|
|
20
20
|
windowEndsAt: '2026-10-26T00:00:00.000Z',
|
|
21
|
+
lateCancelExceptionId: 'EXC-1',
|
|
21
22
|
};
|
|
22
23
|
const sale: Pick<Sale, 'cancellation'> = { cancellation };
|
|
23
24
|
expect(sale.cancellation?.allowed).toBe(false);
|
|
25
|
+
expect(sale.cancellation?.lateCancelExceptionId).toBe('EXC-1');
|
|
24
26
|
});
|
|
25
27
|
});
|
|
@@ -4,4 +4,6 @@ export declare class CancelLoanCreditRequest {
|
|
|
4
4
|
saleId: string;
|
|
5
5
|
/** Motivo de la cancelación; va a la auditoría del crédito y no se loguea. */
|
|
6
6
|
reason: string;
|
|
7
|
+
/** Quién cancela la venta; es el actor de la auditoría del crédito. Sin él, el sistema. */
|
|
8
|
+
cancelledBy?: string;
|
|
7
9
|
}
|
|
@@ -31,3 +31,12 @@ __decorate([
|
|
|
31
31
|
(0, class_validator_1.MaxLength)(500),
|
|
32
32
|
__metadata("design:type", String)
|
|
33
33
|
], CancelLoanCreditRequest.prototype, "reason", void 0);
|
|
34
|
+
__decorate([
|
|
35
|
+
(0, class_transformer_1.Expose)(),
|
|
36
|
+
(0, class_validator_1.IsOptional)(),
|
|
37
|
+
(0, class_validator_1.IsString)(),
|
|
38
|
+
(0, class_validator_1.IsNotEmpty)(),
|
|
39
|
+
(0, class_validator_1.MaxLength)(120),
|
|
40
|
+
(0, class_validator_1.Matches)(/^[A-Za-z0-9._:-]+$/),
|
|
41
|
+
__metadata("design:type", String)
|
|
42
|
+
], CancelLoanCreditRequest.prototype, "cancelledBy", void 0);
|
|
@@ -7,6 +7,8 @@ export interface LoanPrepaymentQuote {
|
|
|
7
7
|
periodPaymentCents: number;
|
|
8
8
|
/** Mínimo del abono según el plan del crédito; con mínimo `ANY`, 1 centavo. */
|
|
9
9
|
minAmountCents?: number;
|
|
10
|
+
/** Máximo del abono: un centavo menos que lo menor entre la liquidación y el capital que se re-amortiza. */
|
|
11
|
+
maxAmountCents?: number;
|
|
10
12
|
/** Monto de liquidación anticipada: el techo del abono. */
|
|
11
13
|
settlementAmountCents: number;
|
|
12
14
|
}
|
|
@@ -6,4 +6,6 @@ export interface SaleCancellation {
|
|
|
6
6
|
reason?: SaleCancellationReasonEnum;
|
|
7
7
|
/** Fin de la ventana de cancelación voluntaria, ISO-8601. */
|
|
8
8
|
windowEndsAt?: string;
|
|
9
|
+
/** Con `CANCEL_WINDOW_EXPIRED`: la excepción LATE_CANCEL aprobada más reciente de la venta, si existe. */
|
|
10
|
+
lateCancelExceptionId?: string;
|
|
9
11
|
}
|
package/package.json
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { Expose } from 'class-transformer';
|
|
2
|
-
import { IsNotEmpty, IsString, Matches, MaxLength } from 'class-validator';
|
|
2
|
+
import { IsNotEmpty, IsOptional, IsString, Matches, MaxLength } from 'class-validator';
|
|
3
3
|
|
|
4
4
|
/** Body de `POST /private/credits/:creditId/cancel` (loan-credit-business): la venta que se cancela. */
|
|
5
5
|
export class CancelLoanCreditRequest {
|
|
@@ -17,4 +17,13 @@ export class CancelLoanCreditRequest {
|
|
|
17
17
|
@IsNotEmpty()
|
|
18
18
|
@MaxLength(500)
|
|
19
19
|
reason!: string;
|
|
20
|
+
|
|
21
|
+
/** Quién cancela la venta; es el actor de la auditoría del crédito. Sin él, el sistema. */
|
|
22
|
+
@Expose()
|
|
23
|
+
@IsOptional()
|
|
24
|
+
@IsString()
|
|
25
|
+
@IsNotEmpty()
|
|
26
|
+
@MaxLength(120)
|
|
27
|
+
@Matches(/^[A-Za-z0-9._:-]+$/)
|
|
28
|
+
cancelledBy?: string;
|
|
20
29
|
}
|
|
@@ -7,6 +7,8 @@ export interface LoanPrepaymentQuote {
|
|
|
7
7
|
periodPaymentCents: number;
|
|
8
8
|
/** Mínimo del abono según el plan del crédito; con mínimo `ANY`, 1 centavo. */
|
|
9
9
|
minAmountCents?: number;
|
|
10
|
+
/** Máximo del abono: un centavo menos que lo menor entre la liquidación y el capital que se re-amortiza. */
|
|
11
|
+
maxAmountCents?: number;
|
|
10
12
|
/** Monto de liquidación anticipada: el techo del abono. */
|
|
11
13
|
settlementAmountCents: number;
|
|
12
14
|
}
|
|
@@ -7,4 +7,6 @@ export interface SaleCancellation {
|
|
|
7
7
|
reason?: SaleCancellationReasonEnum;
|
|
8
8
|
/** Fin de la ventana de cancelación voluntaria, ISO-8601. */
|
|
9
9
|
windowEndsAt?: string;
|
|
10
|
+
/** Con `CANCEL_WINDOW_EXPIRED`: la excepción LATE_CANCEL aprobada más reciente de la venta, si existe. */
|
|
11
|
+
lateCancelExceptionId?: string;
|
|
10
12
|
}
|