@fiado/type-kit 3.530.0 → 3.532.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/signLoanCreditRequest.test.ts +15 -0
- package/_test_/unit/rewardsEligibility/backofficeBarrel.test.ts +5 -1
- package/_test_/unit/rewardsEligibility/catalogDtos.test.ts +1 -7
- package/_test_/unit/rewardsEligibility/evaluationDtos.test.ts +7 -0
- package/bin/loanCredit/dtos/LoanContractDetails.d.ts +6 -0
- package/bin/loanCredit/dtos/LoanContractDetails.js +20 -1
- package/bin/rewardsEligibility/dtos/EvaluationTrigger.d.ts +0 -3
- package/bin/rewardsEligibility/index.d.ts +0 -2
- package/bin/rewardsEligibility/index.js +0 -2
- package/package.json +1 -1
- package/src/loanCredit/dtos/LoanContractDetails.ts +17 -0
- package/src/rewardsEligibility/dtos/EvaluationTrigger.ts +0 -3
- package/src/rewardsEligibility/index.ts +0 -2
- package/bin/rewardsEligibility/dtos/PopulationRef.d.ts +0 -6
- package/bin/rewardsEligibility/dtos/PopulationRef.js +0 -7
- package/bin/rewardsEligibility/dtos/backoffice/PopulationSourceResponse.d.ts +0 -11
- package/bin/rewardsEligibility/dtos/backoffice/PopulationSourceResponse.js +0 -7
- package/src/rewardsEligibility/dtos/PopulationRef.ts +0 -7
- package/src/rewardsEligibility/dtos/backoffice/PopulationSourceResponse.ts +0 -12
|
@@ -61,6 +61,21 @@ describe('SignLoanCreditRequest', () => {
|
|
|
61
61
|
expect(await errorsOf({ contractDetails: details })).toEqual(['contractDetails.device.imei']);
|
|
62
62
|
});
|
|
63
63
|
|
|
64
|
+
it('acepta la cuenta Pago Confiado con su CLABE de 18 dígitos', async () => {
|
|
65
|
+
const details = { ...DETAILS, pcfAccount: { clabe: '646180157000000004' } };
|
|
66
|
+
expect(await errorsOf({ contractDetails: details })).toEqual([]);
|
|
67
|
+
});
|
|
68
|
+
|
|
69
|
+
it('la cuenta Pago Confiado es opcional', async () => {
|
|
70
|
+
expect(DETAILS).not.toHaveProperty('pcfAccount');
|
|
71
|
+
expect(await errorsOf({ contractDetails: DETAILS })).toEqual([]);
|
|
72
|
+
});
|
|
73
|
+
|
|
74
|
+
it('rechaza una CLABE que no tiene 18 dígitos', async () => {
|
|
75
|
+
const details = { ...DETAILS, pcfAccount: { clabe: 'dummy' } };
|
|
76
|
+
expect(await errorsOf({ contractDetails: details })).toEqual(['contractDetails.pcfAccount.clabe']);
|
|
77
|
+
});
|
|
78
|
+
|
|
64
79
|
it('rechaza un texto más largo que el máximo', async () => {
|
|
65
80
|
const details = { ...DETAILS, provider: { legalName: 'x'.repeat(301) } };
|
|
66
81
|
expect(await errorsOf({ contractDetails: details })).toEqual(['contractDetails.provider.legalName']);
|
|
@@ -6,7 +6,7 @@ describe('barrel rewardsEligibility incluye el backoffice', () => {
|
|
|
6
6
|
'CampaignRequest', 'CampaignStatusRequest', 'CampaignResponse', 'CampaignListResponse', 'QuotaUsageResponse', 'CampaignSummaryResponse',
|
|
7
7
|
'EventTypeRequest', 'EventTypeResponse', 'EventTypeListResponse', 'EvaluationRequest', 'EvaluationStatusRequest', 'EvaluationResponse',
|
|
8
8
|
'EvaluationListResponse', 'ResultTraceResponse', 'TraceGroupResponse', 'TraceConditionResponse', 'SimulateRequest', 'SimulateResponse',
|
|
9
|
-
'RuleCatalogResponse', 'RuleCatalogSourceResponse', 'RuleCatalogFieldResponse', '
|
|
9
|
+
'RuleCatalogResponse', 'RuleCatalogSourceResponse', 'RuleCatalogFieldResponse', 'InputTypeResponse',
|
|
10
10
|
'CreateRunRequest', 'PopulationRunRequest', 'ApproveRunRequest', 'QuotaImpactResponse', 'RunResponse', 'RunListResponse',
|
|
11
11
|
'RunResultResponse', 'RunResultListResponse', 'CreateRunResponse', 'MetricsPointResponse', 'FailedConditionStatResponse', 'MetricsQuery',
|
|
12
12
|
'MetricsDimensionEnum', 'RuleValueTypeEnum', 'ELIGIBILITY_ID_PATTERN', 'EVENT_KEY_PATTERN', 'REQUEST_ID_PATTERN', 'MAX_QUOTAS_PER_CAMPAIGN',
|
|
@@ -20,4 +20,8 @@ describe('barrel rewardsEligibility incluye el backoffice', () => {
|
|
|
20
20
|
])('exporta %s', (name) => {
|
|
21
21
|
expect((kit as Record<string, object | string | number | RegExp>)[name]).toBeDefined();
|
|
22
22
|
});
|
|
23
|
+
|
|
24
|
+
it.each(['PopulationSourceResponse', 'PopulationRef'])('ya no exporta %s (reemplazado por segmentos)', (name) => {
|
|
25
|
+
expect((kit as Record<string, object | string | number | RegExp>)[name]).toBeUndefined();
|
|
26
|
+
});
|
|
23
27
|
});
|
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
import { RuleValueTypeEnum } from '../../../src/rewardsEligibility/enums/RuleValueTypeEnum';
|
|
2
2
|
import { InputFieldTypeEnum } from '../../../src/dynamicForm/enums/InputFieldTypeEnum';
|
|
3
3
|
import type { RuleCatalogResponse } from '../../../src/rewardsEligibility/dtos/backoffice/RuleCatalogResponse';
|
|
4
|
-
import type { PopulationSourceResponse } from '../../../src/rewardsEligibility/dtos/backoffice/PopulationSourceResponse';
|
|
5
4
|
import type { InputTypeResponse } from '../../../src/rewardsEligibility/dtos/backoffice/InputTypeResponse';
|
|
6
5
|
|
|
7
6
|
describe('DTOs de catálogos (forma)', () => {
|
|
@@ -15,13 +14,8 @@ describe('DTOs de catálogos (forma)', () => {
|
|
|
15
14
|
};
|
|
16
15
|
expect(catalog.sources[0]?.fields[0]?.valueType).toBe('NUMBER');
|
|
17
16
|
});
|
|
18
|
-
it('
|
|
19
|
-
const source: PopulationSourceResponse = {
|
|
20
|
-
source: 'TX_ACTIVE_IN_WINDOW', label: 'Con transacciones', description: 'd',
|
|
21
|
-
paramsSchema: [{ key: 'window', type: InputFieldTypeEnum.TEXT, label: 'Ventana', required: true }], provides: ['directoryId'],
|
|
22
|
-
};
|
|
17
|
+
it('un tipo de input', () => {
|
|
23
18
|
const type: InputTypeResponse = { type: InputFieldTypeEnum.DIRECTORY, label: 'Usuario' };
|
|
24
|
-
expect(source.provides).toEqual(['directoryId']);
|
|
25
19
|
expect(type.type).toBe('DIRECTORY');
|
|
26
20
|
});
|
|
27
21
|
});
|
|
@@ -3,6 +3,7 @@ import { plainToInstance } from 'class-transformer';
|
|
|
3
3
|
import { validate } from 'class-validator';
|
|
4
4
|
import { EvaluationRequest } from '../../../src/rewardsEligibility/dtos/backoffice/EvaluationRequest';
|
|
5
5
|
import { EvaluationStatusRequest } from '../../../src/rewardsEligibility/dtos/backoffice/EvaluationStatusRequest';
|
|
6
|
+
import { EvaluationTrigger } from '../../../src/rewardsEligibility/dtos/EvaluationTrigger';
|
|
6
7
|
import { SimulateRequest } from '../../../src/rewardsEligibility/dtos/backoffice/SimulateRequest';
|
|
7
8
|
|
|
8
9
|
const parse = <T extends object>(cls: new () => T, value: object): T => plainToInstance(cls, value, { excludeExtraneousValues: true });
|
|
@@ -51,3 +52,9 @@ describe('EvaluationStatusRequest / SimulateRequest', () => {
|
|
|
51
52
|
expect((await validate(parse(SimulateRequest, { evaluationId: 'x' }))).length).toBeGreaterThan(0);
|
|
52
53
|
});
|
|
53
54
|
});
|
|
55
|
+
|
|
56
|
+
describe('EvaluationTrigger', () => {
|
|
57
|
+
it('ya no declara `population` (reemplazado por populationSegmentId de la evaluacion)', () => {
|
|
58
|
+
expect('population' in new EvaluationTrigger()).toBe(false);
|
|
59
|
+
});
|
|
60
|
+
});
|
|
@@ -29,6 +29,10 @@ export declare class LoanContractDeviceDetails {
|
|
|
29
29
|
export declare class LoanContractProviderDetails {
|
|
30
30
|
legalName: string;
|
|
31
31
|
}
|
|
32
|
+
/** Cuenta Pago Confiado del acreditado, de la que se cobra el crédito (Secciones VI y VIII). */
|
|
33
|
+
export declare class LoanContractPcfAccountDetails {
|
|
34
|
+
clabe: string;
|
|
35
|
+
}
|
|
32
36
|
/**
|
|
33
37
|
* Datos del contrato que el motor de crédito no guarda: los aporta el wizard al iniciar la firma
|
|
34
38
|
* y se imprimen en las plantillas de pdf-render-business. Son PII transitoria: no se persisten ni
|
|
@@ -39,4 +43,6 @@ export declare class LoanContractDetails {
|
|
|
39
43
|
device: LoanContractDeviceDetails;
|
|
40
44
|
/** Si falta, el motor lo resuelve con la tienda del crédito. */
|
|
41
45
|
provider?: LoanContractProviderDetails;
|
|
46
|
+
/** Si falta, el contrato deja la cuenta en blanco. */
|
|
47
|
+
pcfAccount?: LoanContractPcfAccountDetails;
|
|
42
48
|
}
|
|
@@ -9,7 +9,7 @@ var __metadata = (this && this.__metadata) || function (k, v) {
|
|
|
9
9
|
if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
|
|
10
10
|
};
|
|
11
11
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
12
|
-
exports.LoanContractDetails = exports.LoanContractProviderDetails = exports.LoanContractDeviceDetails = exports.LoanContractBorrowerDetails = void 0;
|
|
12
|
+
exports.LoanContractDetails = exports.LoanContractPcfAccountDetails = exports.LoanContractProviderDetails = exports.LoanContractDeviceDetails = exports.LoanContractBorrowerDetails = void 0;
|
|
13
13
|
const class_transformer_1 = require("class-transformer");
|
|
14
14
|
const class_validator_1 = require("class-validator");
|
|
15
15
|
/** Largo máximo de un texto corto del contrato (RFC, ocupación, marca…). */
|
|
@@ -18,6 +18,8 @@ const SHORT_TEXT = 120;
|
|
|
18
18
|
const LONG_TEXT = 300;
|
|
19
19
|
/** IMEI: exactamente 15 dígitos. */
|
|
20
20
|
const IMEI_PATTERN = /^\d{15}$/;
|
|
21
|
+
/** CLABE: exactamente 18 dígitos. */
|
|
22
|
+
const CLABE_PATTERN = /^\d{18}$/;
|
|
21
23
|
/** Datos del acreditado tal como se imprimen en el contrato (Sección II.1). */
|
|
22
24
|
class LoanContractBorrowerDetails {
|
|
23
25
|
}
|
|
@@ -156,6 +158,16 @@ __decorate([
|
|
|
156
158
|
(0, class_validator_1.MaxLength)(LONG_TEXT),
|
|
157
159
|
__metadata("design:type", String)
|
|
158
160
|
], LoanContractProviderDetails.prototype, "legalName", void 0);
|
|
161
|
+
/** Cuenta Pago Confiado del acreditado, de la que se cobra el crédito (Secciones VI y VIII). */
|
|
162
|
+
class LoanContractPcfAccountDetails {
|
|
163
|
+
}
|
|
164
|
+
exports.LoanContractPcfAccountDetails = LoanContractPcfAccountDetails;
|
|
165
|
+
__decorate([
|
|
166
|
+
(0, class_transformer_1.Expose)(),
|
|
167
|
+
(0, class_validator_1.IsString)(),
|
|
168
|
+
(0, class_validator_1.Matches)(CLABE_PATTERN, { message: 'clabe admite solo 18 dígitos' }),
|
|
169
|
+
__metadata("design:type", String)
|
|
170
|
+
], LoanContractPcfAccountDetails.prototype, "clabe", void 0);
|
|
159
171
|
/**
|
|
160
172
|
* Datos del contrato que el motor de crédito no guarda: los aporta el wizard al iniciar la firma
|
|
161
173
|
* y se imprimen en las plantillas de pdf-render-business. Son PII transitoria: no se persisten ni
|
|
@@ -185,3 +197,10 @@ __decorate([
|
|
|
185
197
|
(0, class_transformer_1.Type)(() => LoanContractProviderDetails),
|
|
186
198
|
__metadata("design:type", LoanContractProviderDetails)
|
|
187
199
|
], LoanContractDetails.prototype, "provider", void 0);
|
|
200
|
+
__decorate([
|
|
201
|
+
(0, class_transformer_1.Expose)(),
|
|
202
|
+
(0, class_validator_1.IsOptional)(),
|
|
203
|
+
(0, class_validator_1.ValidateNested)(),
|
|
204
|
+
(0, class_transformer_1.Type)(() => LoanContractPcfAccountDetails),
|
|
205
|
+
__metadata("design:type", LoanContractPcfAccountDetails)
|
|
206
|
+
], LoanContractDetails.prototype, "pcfAccount", void 0);
|
|
@@ -1,6 +1,5 @@
|
|
|
1
1
|
import { ApprovalModeEnum } from '../enums/ApprovalModeEnum';
|
|
2
2
|
import { TriggerTypeEnum } from '../enums/TriggerTypeEnum';
|
|
3
|
-
import { PopulationRef } from './PopulationRef';
|
|
4
3
|
/** Disparador de una evaluacion (spec B 5.1). Una evaluacion tiene a lo sumo UN disparador `EVENT`. */
|
|
5
4
|
export declare class EvaluationTrigger {
|
|
6
5
|
type: TriggerTypeEnum;
|
|
@@ -9,6 +8,4 @@ export declare class EvaluationTrigger {
|
|
|
9
8
|
eventKey?: string;
|
|
10
9
|
/** Solo `CRON`: cron de 5 campos, granularidad de 15 minutos (fase 4). */
|
|
11
10
|
schedule?: string;
|
|
12
|
-
/** Solo `CRON` (fase 4). */
|
|
13
|
-
population?: PopulationRef;
|
|
14
11
|
}
|
|
@@ -26,7 +26,6 @@ export * from './types/RewardInputRef';
|
|
|
26
26
|
export * from './dtos/GrantPolicy';
|
|
27
27
|
export * from './dtos/CampaignQuota';
|
|
28
28
|
export * from './dtos/CampaignAlerts';
|
|
29
|
-
export * from './dtos/PopulationRef';
|
|
30
29
|
export * from './dtos/EvaluationReward';
|
|
31
30
|
export * from './dtos/EvaluationTrigger';
|
|
32
31
|
export * from './enums/MetricsDimensionEnum';
|
|
@@ -50,7 +49,6 @@ export * from './dtos/backoffice/ResultTraceResponse';
|
|
|
50
49
|
export * from './dtos/backoffice/SimulateRequest';
|
|
51
50
|
export * from './dtos/backoffice/SimulateResponse';
|
|
52
51
|
export * from './dtos/backoffice/RuleCatalogResponse';
|
|
53
|
-
export * from './dtos/backoffice/PopulationSourceResponse';
|
|
54
52
|
export * from './dtos/backoffice/InputTypeResponse';
|
|
55
53
|
export * from './dtos/backoffice/RulesChatTurn';
|
|
56
54
|
export * from './dtos/backoffice/GenerateRulesRequest';
|
|
@@ -47,7 +47,6 @@ __exportStar(require("./types/RewardInputRef"), exports);
|
|
|
47
47
|
__exportStar(require("./dtos/GrantPolicy"), exports);
|
|
48
48
|
__exportStar(require("./dtos/CampaignQuota"), exports);
|
|
49
49
|
__exportStar(require("./dtos/CampaignAlerts"), exports);
|
|
50
|
-
__exportStar(require("./dtos/PopulationRef"), exports);
|
|
51
50
|
__exportStar(require("./dtos/EvaluationReward"), exports);
|
|
52
51
|
__exportStar(require("./dtos/EvaluationTrigger"), exports);
|
|
53
52
|
//Backoffice (fase 3): enums, constantes y DTOs
|
|
@@ -72,7 +71,6 @@ __exportStar(require("./dtos/backoffice/ResultTraceResponse"), exports);
|
|
|
72
71
|
__exportStar(require("./dtos/backoffice/SimulateRequest"), exports);
|
|
73
72
|
__exportStar(require("./dtos/backoffice/SimulateResponse"), exports);
|
|
74
73
|
__exportStar(require("./dtos/backoffice/RuleCatalogResponse"), exports);
|
|
75
|
-
__exportStar(require("./dtos/backoffice/PopulationSourceResponse"), exports);
|
|
76
74
|
__exportStar(require("./dtos/backoffice/InputTypeResponse"), exports);
|
|
77
75
|
__exportStar(require("./dtos/backoffice/RulesChatTurn"), exports);
|
|
78
76
|
__exportStar(require("./dtos/backoffice/GenerateRulesRequest"), exports);
|
package/package.json
CHANGED
|
@@ -7,6 +7,8 @@ const SHORT_TEXT = 120;
|
|
|
7
7
|
const LONG_TEXT = 300;
|
|
8
8
|
/** IMEI: exactamente 15 dígitos. */
|
|
9
9
|
const IMEI_PATTERN = /^\d{15}$/;
|
|
10
|
+
/** CLABE: exactamente 18 dígitos. */
|
|
11
|
+
const CLABE_PATTERN = /^\d{18}$/;
|
|
10
12
|
|
|
11
13
|
/** Datos del acreditado tal como se imprimen en el contrato (Sección II.1). */
|
|
12
14
|
export class LoanContractBorrowerDetails {
|
|
@@ -129,6 +131,14 @@ export class LoanContractProviderDetails {
|
|
|
129
131
|
legalName: string;
|
|
130
132
|
}
|
|
131
133
|
|
|
134
|
+
/** Cuenta Pago Confiado del acreditado, de la que se cobra el crédito (Secciones VI y VIII). */
|
|
135
|
+
export class LoanContractPcfAccountDetails {
|
|
136
|
+
@Expose()
|
|
137
|
+
@IsString()
|
|
138
|
+
@Matches(CLABE_PATTERN, { message: 'clabe admite solo 18 dígitos' })
|
|
139
|
+
clabe: string;
|
|
140
|
+
}
|
|
141
|
+
|
|
132
142
|
/**
|
|
133
143
|
* Datos del contrato que el motor de crédito no guarda: los aporta el wizard al iniciar la firma
|
|
134
144
|
* y se imprimen en las plantillas de pdf-render-business. Son PII transitoria: no se persisten ni
|
|
@@ -153,4 +163,11 @@ export class LoanContractDetails {
|
|
|
153
163
|
@ValidateNested()
|
|
154
164
|
@Type(() => LoanContractProviderDetails)
|
|
155
165
|
provider?: LoanContractProviderDetails;
|
|
166
|
+
|
|
167
|
+
/** Si falta, el contrato deja la cuenta en blanco. */
|
|
168
|
+
@Expose()
|
|
169
|
+
@IsOptional()
|
|
170
|
+
@ValidateNested()
|
|
171
|
+
@Type(() => LoanContractPcfAccountDetails)
|
|
172
|
+
pcfAccount?: LoanContractPcfAccountDetails;
|
|
156
173
|
}
|
|
@@ -1,6 +1,5 @@
|
|
|
1
1
|
import { ApprovalModeEnum } from '../enums/ApprovalModeEnum';
|
|
2
2
|
import { TriggerTypeEnum } from '../enums/TriggerTypeEnum';
|
|
3
|
-
import { PopulationRef } from './PopulationRef';
|
|
4
3
|
|
|
5
4
|
/** Disparador de una evaluacion (spec B 5.1). Una evaluacion tiene a lo sumo UN disparador `EVENT`. */
|
|
6
5
|
export class EvaluationTrigger {
|
|
@@ -10,6 +9,4 @@ export class EvaluationTrigger {
|
|
|
10
9
|
eventKey?: string;
|
|
11
10
|
/** Solo `CRON`: cron de 5 campos, granularidad de 15 minutos (fase 4). */
|
|
12
11
|
schedule?: string;
|
|
13
|
-
/** Solo `CRON` (fase 4). */
|
|
14
|
-
population?: PopulationRef;
|
|
15
12
|
}
|
|
@@ -35,7 +35,6 @@ export * from './types/RewardInputRef';
|
|
|
35
35
|
export * from './dtos/GrantPolicy';
|
|
36
36
|
export * from './dtos/CampaignQuota';
|
|
37
37
|
export * from './dtos/CampaignAlerts';
|
|
38
|
-
export * from './dtos/PopulationRef';
|
|
39
38
|
export * from './dtos/EvaluationReward';
|
|
40
39
|
export * from './dtos/EvaluationTrigger';
|
|
41
40
|
|
|
@@ -61,7 +60,6 @@ export * from './dtos/backoffice/ResultTraceResponse';
|
|
|
61
60
|
export * from './dtos/backoffice/SimulateRequest';
|
|
62
61
|
export * from './dtos/backoffice/SimulateResponse';
|
|
63
62
|
export * from './dtos/backoffice/RuleCatalogResponse';
|
|
64
|
-
export * from './dtos/backoffice/PopulationSourceResponse';
|
|
65
63
|
export * from './dtos/backoffice/InputTypeResponse';
|
|
66
64
|
export * from './dtos/backoffice/RulesChatTurn';
|
|
67
65
|
export * from './dtos/backoffice/GenerateRulesRequest';
|
|
@@ -1,11 +0,0 @@
|
|
|
1
|
-
import { InputField } from '../../../dynamicForm/dtos/InputField';
|
|
2
|
-
/** `GET /population-sources`: fuente de población para un disparador `CRON` (la ejecución llega en la fase 4). */
|
|
3
|
-
export declare class PopulationSourceResponse {
|
|
4
|
-
source: string;
|
|
5
|
-
label: string;
|
|
6
|
-
description: string;
|
|
7
|
-
/** Formulario de los params de la fuente. */
|
|
8
|
-
paramsSchema: InputField[];
|
|
9
|
-
/** Keys de input que la fuente provee por sujeto. */
|
|
10
|
-
provides: string[];
|
|
11
|
-
}
|
|
@@ -1,7 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.PopulationSourceResponse = void 0;
|
|
4
|
-
/** `GET /population-sources`: fuente de población para un disparador `CRON` (la ejecución llega en la fase 4). */
|
|
5
|
-
class PopulationSourceResponse {
|
|
6
|
-
}
|
|
7
|
-
exports.PopulationSourceResponse = PopulationSourceResponse;
|
|
@@ -1,12 +0,0 @@
|
|
|
1
|
-
import { InputField } from '../../../dynamicForm/dtos/InputField';
|
|
2
|
-
|
|
3
|
-
/** `GET /population-sources`: fuente de población para un disparador `CRON` (la ejecución llega en la fase 4). */
|
|
4
|
-
export class PopulationSourceResponse {
|
|
5
|
-
source: string;
|
|
6
|
-
label: string;
|
|
7
|
-
description: string;
|
|
8
|
-
/** Formulario de los params de la fuente. */
|
|
9
|
-
paramsSchema: InputField[];
|
|
10
|
-
/** Keys de input que la fuente provee por sujeto. */
|
|
11
|
-
provides: string[];
|
|
12
|
-
}
|