@fiado/type-kit 3.299.0 → 3.300.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.
@@ -0,0 +1,49 @@
1
+ import 'reflect-metadata';
2
+ import { plainToInstance } from 'class-transformer';
3
+ import { validateSync } from 'class-validator';
4
+ import { OccupationRequest } from '../../../src/retailWizard/dtos/requests/OccupationRequest';
5
+ import { ProfileQuestionsRequest } from '../../../src/retailWizard/dtos/requests/ProfileQuestionsRequest';
6
+ import { MONTHLY_INCOME_VALUES } from '../../../src/retailWizard/catalog/monthlyIncome';
7
+ import { OccupationEnum } from '../../../src/retailWizard/enums/OccupationEnum';
8
+
9
+ function errorsOf(payload: Record<string, unknown>): string[] {
10
+ const dto = plainToInstance(OccupationRequest, payload, { excludeExtraneousValues: true });
11
+ return validateSync(dto).map((e) => e.property);
12
+ }
13
+
14
+ describe('OccupationRequest — la ocupación viaja con el ingreso mensual (paso 02)', () => {
15
+ it('acepta una ocupación con un ingreso del catálogo', () => {
16
+ expect(errorsOf({ occupation: OccupationEnum.EMPLOYED, monthlyIncome: '20000' })).toEqual([]);
17
+ });
18
+
19
+ it('el ingreso es obligatorio: sin él la ocupación sola no pasa', () => {
20
+ expect(errorsOf({ occupation: OccupationEnum.EMPLOYED })).toContain('monthlyIncome');
21
+ });
22
+
23
+ it('rechaza un ingreso fuera del catálogo', () => {
24
+ expect(errorsOf({ occupation: OccupationEnum.EMPLOYED, monthlyIncome: '999' })).toContain(
25
+ 'monthlyIncome',
26
+ );
27
+ });
28
+
29
+ it.each(MONTHLY_INCOME_VALUES)('acepta el valor %s del catálogo', (valor) => {
30
+ expect(errorsOf({ occupation: OccupationEnum.EMPLOYED, monthlyIncome: valor })).toEqual([]);
31
+ });
32
+
33
+ // Es la MISMA pregunta que el paso 10: si los catálogos se separan, el paso 10 pisaría el paso 02
34
+ // con un valor que el otro no acepta.
35
+ it('el paso 10 valida el ingreso contra el mismo catálogo', () => {
36
+ const dto = plainToInstance(
37
+ ProfileQuestionsRequest,
38
+ {
39
+ monthlyIncome: '150000',
40
+ monthlyExtraSupport: '0',
41
+ usageMonthly: '60',
42
+ maximumTx: '10000',
43
+ beneficialOwner: 'SELF',
44
+ },
45
+ { excludeExtraneousValues: true },
46
+ );
47
+ expect(validateSync(dto)).toEqual([]);
48
+ });
49
+ });
@@ -0,0 +1,6 @@
1
+ /**
2
+ * `dataType=MonthlyIncomeMXN` — catálogo cerrado del ingreso mensual declarado (`AppSelectionData_GT`).
3
+ * Lo comparten el paso 02 (`OccupationRequest`) y el paso 10 (`ProfileQuestionsRequest`).
4
+ */
5
+ export declare const MONTHLY_INCOME_VALUES: readonly ["0", "10000", "20000", "50000", "100000", "150000"];
6
+ export type MonthlyIncomeValue = (typeof MONTHLY_INCOME_VALUES)[number];
@@ -0,0 +1,8 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.MONTHLY_INCOME_VALUES = void 0;
4
+ /**
5
+ * `dataType=MonthlyIncomeMXN` — catálogo cerrado del ingreso mensual declarado (`AppSelectionData_GT`).
6
+ * Lo comparten el paso 02 (`OccupationRequest`) y el paso 10 (`ProfileQuestionsRequest`).
7
+ */
8
+ exports.MONTHLY_INCOME_VALUES = ['0', '10000', '20000', '50000', '100000', '150000'];
@@ -68,6 +68,8 @@ export interface WizardSession {
68
68
  metamapIdentityId: string | null;
69
69
  occupation: OccupationEnum | null;
70
70
  occupationOther: string | null;
71
+ /** Espejo del ingreso mensual declarado del paso 02. El dato VIVE en People de Fiado (D17). */
72
+ monthlyIncome: string | null;
71
73
  /** Del gate `signInPhoneNumber` del 01a (D27). */
72
74
  fiadoPhoneStatus: FiadoPhoneStatusEnum | null;
73
75
  fiadoDirectoryId: string | null;
@@ -1,10 +1,11 @@
1
1
  import { OccupationEnum } from '../../enums/OccupationEnum';
2
2
  /**
3
- * POST /wizard/sessions/:id/occupation — registra la ocupación (dato del expediente PCF, vive en
4
- * People de Fiado — D17). Sin ocupación NO se abre la cuenta (Manual v1.4 §8.13). `OTHER` abre texto ≤60.
5
- * SureKeep Fase 2 — pista Retail.
3
+ * POST /wizard/sessions/:id/occupation — registra la ocupación y el ingreso mensual del expediente
4
+ * PCF (viven en People de Fiado — D17). Los dos obligatorios; `OTHER` abre texto ≤60.
6
5
  */
7
6
  export declare class OccupationRequest {
8
7
  occupation: OccupationEnum;
9
8
  occupationOther?: string;
9
+ /** Mismo catálogo cerrado que el paso 10 (`ProfileQuestionsRequest`). */
10
+ monthlyIncome: string;
10
11
  }
@@ -13,10 +13,10 @@ exports.OccupationRequest = void 0;
13
13
  const class_transformer_1 = require("class-transformer");
14
14
  const class_validator_1 = require("class-validator");
15
15
  const OccupationEnum_1 = require("../../enums/OccupationEnum");
16
+ const monthlyIncome_1 = require("../../catalog/monthlyIncome");
16
17
  /**
17
- * POST /wizard/sessions/:id/occupation — registra la ocupación (dato del expediente PCF, vive en
18
- * People de Fiado — D17). Sin ocupación NO se abre la cuenta (Manual v1.4 §8.13). `OTHER` abre texto ≤60.
19
- * SureKeep Fase 2 — pista Retail.
18
+ * POST /wizard/sessions/:id/occupation — registra la ocupación y el ingreso mensual del expediente
19
+ * PCF (viven en People de Fiado — D17). Los dos obligatorios; `OTHER` abre texto ≤60.
20
20
  */
21
21
  class OccupationRequest {
22
22
  }
@@ -33,3 +33,9 @@ __decorate([
33
33
  (0, class_validator_1.MaxLength)(60),
34
34
  __metadata("design:type", String)
35
35
  ], OccupationRequest.prototype, "occupationOther", void 0);
36
+ __decorate([
37
+ (0, class_transformer_1.Expose)(),
38
+ (0, class_validator_1.IsString)(),
39
+ (0, class_validator_1.IsIn)(monthlyIncome_1.MONTHLY_INCOME_VALUES),
40
+ __metadata("design:type", String)
41
+ ], OccupationRequest.prototype, "monthlyIncome", void 0);
@@ -20,8 +20,6 @@
20
20
  *
21
21
  * SureKeep Fase 2 — pista Retail.
22
22
  */
23
- /** `dataType=MonthlyIncomeMXN` — ingreso mensual declarado. */
24
- export declare const MONTHLY_INCOME_VALUES: readonly ["0", "10000", "20000", "50000", "100000", "150000"];
25
23
  /** `dataType=ExtraSupport` — apoyo económico extra mensual. */
26
24
  export declare const EXTRA_SUPPORT_VALUES: readonly ["0", "2000", "10000", "20000", "50000", "60000"];
27
25
  /**
@@ -9,9 +9,10 @@ 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.ProfileQuestionsRequest = exports.BENEFICIAL_OWNER_VALUES = exports.MAXIMUM_TX_VALUES = exports.USAGE_MONTHLY_VALUES = exports.EXTRA_SUPPORT_VALUES = exports.MONTHLY_INCOME_VALUES = void 0;
12
+ exports.ProfileQuestionsRequest = exports.BENEFICIAL_OWNER_VALUES = exports.MAXIMUM_TX_VALUES = exports.USAGE_MONTHLY_VALUES = exports.EXTRA_SUPPORT_VALUES = void 0;
13
13
  const class_transformer_1 = require("class-transformer");
14
14
  const class_validator_1 = require("class-validator");
15
+ const monthlyIncome_1 = require("../../catalog/monthlyIncome");
15
16
  /**
16
17
  * POST /wizard/sessions/:id/profile-questions — el perfil transaccional del cliente (paso 10).
17
18
  *
@@ -34,8 +35,6 @@ const class_validator_1 = require("class-validator");
34
35
  *
35
36
  * SureKeep Fase 2 — pista Retail.
36
37
  */
37
- /** `dataType=MonthlyIncomeMXN` — ingreso mensual declarado. */
38
- exports.MONTHLY_INCOME_VALUES = ['0', '10000', '20000', '50000', '100000', '150000'];
39
38
  /** `dataType=ExtraSupport` — apoyo económico extra mensual. */
40
39
  exports.EXTRA_SUPPORT_VALUES = ['0', '2000', '10000', '20000', '50000', '60000'];
41
40
  /**
@@ -62,7 +61,7 @@ exports.ProfileQuestionsRequest = ProfileQuestionsRequest;
62
61
  __decorate([
63
62
  (0, class_transformer_1.Expose)(),
64
63
  (0, class_validator_1.IsString)(),
65
- (0, class_validator_1.IsIn)(exports.MONTHLY_INCOME_VALUES),
64
+ (0, class_validator_1.IsIn)(monthlyIncome_1.MONTHLY_INCOME_VALUES),
66
65
  __metadata("design:type", String)
67
66
  ], ProfileQuestionsRequest.prototype, "monthlyIncome", void 0);
68
67
  __decorate([
@@ -1,3 +1,4 @@
1
+ export * from './catalog/monthlyIncome';
1
2
  export * from './enums/WizardStateEnum';
2
3
  export * from './enums/WizardStepEnum';
3
4
  export * from './enums/OtpPurposeEnum';
@@ -14,6 +14,8 @@ var __exportStar = (this && this.__exportStar) || function(m, exports) {
14
14
  for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
15
15
  };
16
16
  Object.defineProperty(exports, "__esModule", { value: true });
17
+ // Catálogos de valores compartidos entre endpoints
18
+ __exportStar(require("./catalog/monthlyIncome"), exports);
17
19
  // Enums
18
20
  __exportStar(require("./enums/WizardStateEnum"), exports);
19
21
  __exportStar(require("./enums/WizardStepEnum"), exports);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@fiado/type-kit",
3
- "version": "3.299.0",
3
+ "version": "3.300.0",
4
4
  "description": "",
5
5
  "main": "bin/index.js",
6
6
  "types": "bin/index.d.ts",
@@ -0,0 +1,7 @@
1
+ /**
2
+ * `dataType=MonthlyIncomeMXN` — catálogo cerrado del ingreso mensual declarado (`AppSelectionData_GT`).
3
+ * Lo comparten el paso 02 (`OccupationRequest`) y el paso 10 (`ProfileQuestionsRequest`).
4
+ */
5
+ export const MONTHLY_INCOME_VALUES = ['0', '10000', '20000', '50000', '100000', '150000'] as const;
6
+
7
+ export type MonthlyIncomeValue = (typeof MONTHLY_INCOME_VALUES)[number];
@@ -72,6 +72,8 @@ export interface WizardSession {
72
72
  metamapIdentityId: string | null;
73
73
  occupation: OccupationEnum | null;
74
74
  occupationOther: string | null;
75
+ /** Espejo del ingreso mensual declarado del paso 02. El dato VIVE en People de Fiado (D17). */
76
+ monthlyIncome: string | null;
75
77
  /** Del gate `signInPhoneNumber` del 01a (D27). */
76
78
  fiadoPhoneStatus: FiadoPhoneStatusEnum | null;
77
79
  fiadoDirectoryId: string | null;
@@ -1,11 +1,11 @@
1
1
  import { Expose } from 'class-transformer';
2
- import { IsEnum, IsOptional, IsString, MaxLength } from 'class-validator';
2
+ import { IsEnum, IsIn, IsOptional, IsString, MaxLength } from 'class-validator';
3
3
  import { OccupationEnum } from '../../enums/OccupationEnum';
4
+ import { MONTHLY_INCOME_VALUES } from '../../catalog/monthlyIncome';
4
5
 
5
6
  /**
6
- * POST /wizard/sessions/:id/occupation — registra la ocupación (dato del expediente PCF, vive en
7
- * People de Fiado — D17). Sin ocupación NO se abre la cuenta (Manual v1.4 §8.13). `OTHER` abre texto ≤60.
8
- * SureKeep Fase 2 — pista Retail.
7
+ * POST /wizard/sessions/:id/occupation — registra la ocupación y el ingreso mensual del expediente
8
+ * PCF (viven en People de Fiado — D17). Los dos obligatorios; `OTHER` abre texto ≤60.
9
9
  */
10
10
  export class OccupationRequest {
11
11
  @Expose()
@@ -17,4 +17,10 @@ export class OccupationRequest {
17
17
  @IsString()
18
18
  @MaxLength(60)
19
19
  occupationOther?: string;
20
+
21
+ /** Mismo catálogo cerrado que el paso 10 (`ProfileQuestionsRequest`). */
22
+ @Expose()
23
+ @IsString()
24
+ @IsIn(MONTHLY_INCOME_VALUES as unknown as string[])
25
+ monthlyIncome!: string;
20
26
  }
@@ -1,5 +1,6 @@
1
1
  import { Expose } from 'class-transformer';
2
2
  import { IsIn, IsString } from 'class-validator';
3
+ import { MONTHLY_INCOME_VALUES } from '../../catalog/monthlyIncome';
3
4
 
4
5
  /**
5
6
  * POST /wizard/sessions/:id/profile-questions — el perfil transaccional del cliente (paso 10).
@@ -24,9 +25,6 @@ import { IsIn, IsString } from 'class-validator';
24
25
  * SureKeep Fase 2 — pista Retail.
25
26
  */
26
27
 
27
- /** `dataType=MonthlyIncomeMXN` — ingreso mensual declarado. */
28
- export const MONTHLY_INCOME_VALUES = ['0', '10000', '20000', '50000', '100000', '150000'] as const;
29
-
30
28
  /** `dataType=ExtraSupport` — apoyo económico extra mensual. */
31
29
  export const EXTRA_SUPPORT_VALUES = ['0', '2000', '10000', '20000', '50000', '60000'] as const;
32
30
 
@@ -1,3 +1,6 @@
1
+ // Catálogos de valores compartidos entre endpoints
2
+ export * from './catalog/monthlyIncome';
3
+
1
4
  // Enums
2
5
  export * from './enums/WizardStateEnum';
3
6
  export * from './enums/WizardStepEnum';