@fiado/type-kit 3.200.0 → 3.203.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 (58) hide show
  1. package/_test_/unit/auth/SignUpProspectRequest.test.ts +32 -0
  2. package/_test_/unit/auth/SignUpProspectResponse.test.ts +26 -0
  3. package/_test_/unit/kyc/KycByDirectoryResponse.test.ts +139 -0
  4. package/_test_/unit/kyc/KycVerificationChangedV1.test.ts +99 -0
  5. package/_test_/unit/messagesConnector/SendMessageRequest.test.ts +48 -0
  6. package/bin/auth/dtos/SignUpProspectRequest.d.ts +15 -0
  7. package/bin/{platformRbac/dtos/ResendSelfRegisterOtpRequest.js → auth/dtos/SignUpProspectRequest.js} +19 -11
  8. package/bin/auth/dtos/SignUpProspectResponse.d.ts +11 -0
  9. package/bin/{platformRbac/dtos/ResendOtpRequest.js → auth/dtos/SignUpProspectResponse.js} +11 -11
  10. package/bin/auth/index.d.ts +2 -0
  11. package/bin/auth/index.js +2 -0
  12. package/bin/index.d.ts +1 -0
  13. package/bin/index.js +5 -0
  14. package/bin/kyc/dtos/responses/KycByDirectoryResponse.d.ts +49 -0
  15. package/bin/kyc/dtos/responses/KycByDirectoryResponse.js +91 -0
  16. package/bin/kyc/dtos/responses/KycPersonData.d.ts +11 -0
  17. package/bin/kyc/dtos/responses/KycPersonData.js +51 -0
  18. package/bin/kyc/enums/KycVerificationStatusEnum.d.ts +18 -0
  19. package/bin/kyc/enums/KycVerificationStatusEnum.js +22 -0
  20. package/bin/kyc/events/KycVerificationChangedV1.d.ts +35 -0
  21. package/bin/kyc/events/KycVerificationChangedV1.js +76 -0
  22. package/bin/kyc/index.d.ts +4 -0
  23. package/bin/kyc/index.js +24 -0
  24. package/bin/loanCredit/dtos/LoanBorrower.d.ts +2 -0
  25. package/bin/loanCredit/dtos/LoanBorrower.js +6 -0
  26. package/bin/loanCredit/dtos/requests/SignLoanCreditRequest.d.ts +12 -0
  27. package/bin/loanCredit/dtos/requests/SignLoanCreditRequest.js +12 -0
  28. package/bin/loanCredit/dtos/requests/UpdateActivationChecklistRequest.d.ts +11 -0
  29. package/bin/loanCredit/dtos/requests/UpdateActivationChecklistRequest.js +46 -0
  30. package/bin/loanCredit/dtos/requests/UpsertLoanBorrowerRequest.d.ts +2 -0
  31. package/bin/loanCredit/dtos/requests/UpsertLoanBorrowerRequest.js +6 -0
  32. package/bin/loanCredit/dtos/responses/LoanBorrowerResponse.d.ts +1 -0
  33. package/bin/loanCredit/enums/ClientLevelEnum.d.ts +11 -0
  34. package/bin/loanCredit/enums/ClientLevelEnum.js +15 -0
  35. package/bin/messagesConnector/dtos/SendMessageRequest.js +2 -1
  36. package/package.json +1 -1
  37. package/src/auth/dtos/SignUpProspectRequest.ts +23 -0
  38. package/src/auth/dtos/SignUpProspectResponse.ts +17 -0
  39. package/src/auth/index.ts +2 -0
  40. package/src/index.ts +4 -0
  41. package/src/kyc/dtos/responses/KycByDirectoryResponse.ts +69 -0
  42. package/src/kyc/dtos/responses/KycPersonData.ts +23 -0
  43. package/src/kyc/enums/KycVerificationStatusEnum.ts +18 -0
  44. package/src/kyc/events/KycVerificationChangedV1.ts +51 -0
  45. package/src/kyc/index.ts +10 -0
  46. package/src/loanCredit/dtos/LoanBorrower.ts +6 -0
  47. package/src/loanCredit/dtos/requests/SignLoanCreditRequest.ts +20 -0
  48. package/src/loanCredit/dtos/requests/UpsertLoanBorrowerRequest.ts +6 -0
  49. package/src/loanCredit/dtos/responses/LoanBorrowerResponse.ts +1 -0
  50. package/src/messagesConnector/dtos/SendMessageRequest.ts +8 -1
  51. package/bin/benefitCenter/enums/BenefitFlowEnum.d.ts +0 -11
  52. package/bin/benefitCenter/enums/BenefitFlowEnum.js +0 -15
  53. package/bin/loanConfig/enums/ModifiableByRoleEnum.d.ts +0 -11
  54. package/bin/loanConfig/enums/ModifiableByRoleEnum.js +0 -15
  55. package/bin/places/dtos/CashInFeeDto.d.ts +0 -17
  56. package/bin/places/dtos/CashInFeeDto.js +0 -12
  57. package/bin/platformRbac/dtos/ResendOtpRequest.d.ts +0 -22
  58. package/bin/platformRbac/dtos/ResendSelfRegisterOtpRequest.d.ts +0 -11
@@ -0,0 +1,32 @@
1
+ import 'reflect-metadata';
2
+ import { plainToInstance } from 'class-transformer';
3
+ import { validate } from 'class-validator';
4
+ import { SignUpProspectRequest } from '../../../src/auth/index';
5
+
6
+ describe('SignUpProspectRequest', () => {
7
+ it('acepta un alta válida de prospecto', async () => {
8
+ const dto = plainToInstance(SignUpProspectRequest,
9
+ { name: 'Paulina Garcia', phoneNumber: '5512345678', tenantId: 'surekeep' },
10
+ { excludeExtraneousValues: true });
11
+
12
+ expect(await validate(dto as object)).toHaveLength(0);
13
+ });
14
+
15
+ it('rechaza si falta el tenantId (el hardcode FIADO_BETA es justo lo que se elimina)', async () => {
16
+ const dto = plainToInstance(SignUpProspectRequest,
17
+ { name: 'Paulina Garcia', phoneNumber: '5512345678' },
18
+ { excludeExtraneousValues: true });
19
+
20
+ const errors = await validate(dto as object);
21
+ expect(errors.map((e) => e.property)).toContain('tenantId');
22
+ });
23
+
24
+ it('rechaza campos vacíos en vez de dejarlos pasar', async () => {
25
+ const dto = plainToInstance(SignUpProspectRequest,
26
+ { name: '', phoneNumber: '', tenantId: '' },
27
+ { excludeExtraneousValues: true });
28
+
29
+ const props = (await validate(dto as object)).map((e) => e.property);
30
+ expect(props).toEqual(expect.arrayContaining(['name', 'phoneNumber', 'tenantId']));
31
+ });
32
+ });
@@ -0,0 +1,26 @@
1
+ import 'reflect-metadata';
2
+ import { plainToInstance } from 'class-transformer';
3
+ import { validate } from 'class-validator';
4
+ import { SignUpProspectResponse } from '../../../src/auth/index';
5
+
6
+ describe('SignUpProspectResponse', () => {
7
+ it('acepta una respuesta válida con ambos identificadores', async () => {
8
+ const dto = plainToInstance(SignUpProspectResponse,
9
+ { directoryId: 'dir-1', peopleId: 'ppl-1' },
10
+ { excludeExtraneousValues: true });
11
+
12
+ expect(await validate(dto as object)).toHaveLength(0);
13
+ });
14
+
15
+ // DEC-KYC-015: el destino ya demostró devolver strings vacíos. @IsString() pelado los dejaría
16
+ // pasar y la falla aparecería tres pasos río abajo. Candado simétrico sobre los DOS campos —
17
+ // con solo directoryId cubierto se podía quitar el @IsNotEmpty() de peopleId sin ponerse rojo.
18
+ it.each(['directoryId', 'peopleId'])('rechaza %s vacío en vez de dejarlo pasar', async (campo) => {
19
+ const dto = plainToInstance(SignUpProspectResponse,
20
+ { directoryId: 'dir-1', peopleId: 'ppl-1', [campo]: '' },
21
+ { excludeExtraneousValues: true });
22
+
23
+ const errors = await validate(dto as object);
24
+ expect(errors.map((e) => e.property)).toContain(campo);
25
+ });
26
+ });
@@ -0,0 +1,139 @@
1
+ import 'reflect-metadata';
2
+ import { plainToInstance } from 'class-transformer';
3
+ import { validate } from 'class-validator';
4
+ import { KycByDirectoryResponse } from '../../../src/kyc/index';
5
+
6
+ describe('KycByDirectoryResponse', () => {
7
+ it('acepta una respuesta completa con datos de persona', async () => {
8
+ const raw = {
9
+ consolidated: 'VERIFIED',
10
+ verificationId: 'ver-1',
11
+ peopleId: 'ppl-1',
12
+ metamapFlowId: 'flow-1',
13
+ verificationStatus: 'COMPLETED',
14
+ verificationResult: 'VERIFIED',
15
+ createDate: '2026-07-21T10:00:00.000Z',
16
+ updateDate: '2026-07-21T10:05:00.000Z',
17
+ person: {
18
+ names: 'PAULINA',
19
+ paternalLastName: 'GARCIA',
20
+ maternalLastName: 'MICHAUS',
21
+ curp: 'GAMP981028MDFRCL08',
22
+ dateOfBirth: '1998-10-28',
23
+ },
24
+ };
25
+
26
+ const dto = plainToInstance(KycByDirectoryResponse, raw, { excludeExtraneousValues: true });
27
+ const errors = await validate(dto as object);
28
+
29
+ expect(errors).toHaveLength(0);
30
+ expect(dto.person?.curp).toBe('GAMP981028MDFRCL08');
31
+ });
32
+
33
+ it('acepta una respuesta sin datos de persona (KYC aún sin completar)', async () => {
34
+ const raw = {
35
+ consolidated: 'PENDING',
36
+ verificationId: 'ver-2',
37
+ peopleId: 'ppl-2',
38
+ verificationStatus: 'IN_PROGRESS',
39
+ verificationResult: 'UNVERIFIED',
40
+ createDate: '2026-07-21T10:00:00.000Z',
41
+ updateDate: '2026-07-21T10:00:00.000Z',
42
+ };
43
+
44
+ const dto = plainToInstance(KycByDirectoryResponse, raw, { excludeExtraneousValues: true });
45
+
46
+ expect(await validate(dto as object)).toHaveLength(0);
47
+ expect(dto.person).toBeUndefined();
48
+ });
49
+
50
+ it('rechaza un verificationStatus fuera del enum', async () => {
51
+ const raw = {
52
+ consolidated: 'VERIFIED', verificationId: 'v', peopleId: 'p',
53
+ verificationStatus: 'INVENTADO', verificationResult: 'VERIFIED',
54
+ createDate: '2026-07-21T10:00:00.000Z', updateDate: '2026-07-21T10:00:00.000Z',
55
+ };
56
+
57
+ const dto = plainToInstance(KycByDirectoryResponse, raw, { excludeExtraneousValues: true });
58
+ const errors = await validate(dto as object);
59
+
60
+ expect(errors.map((e) => e.property)).toContain('verificationStatus');
61
+ });
62
+
63
+ // DEC-KYC-015: el 7.3% de las filas de dev trae peopleId vacío, 5 de ellas COMPLETED.
64
+ // @IsString() lo aceptaría en silencio y la falla aparecería tres pasos más adelante.
65
+ it('rechaza peopleId vacío en vez de dejarlo pasar', async () => {
66
+ const raw = {
67
+ consolidated: 'VERIFIED', verificationId: 'ver-1', peopleId: '',
68
+ verificationStatus: 'COMPLETED', verificationResult: 'VERIFIED',
69
+ createDate: '2026-07-21T10:00:00.000Z', updateDate: '2026-07-21T10:00:00.000Z',
70
+ };
71
+
72
+ const dto = plainToInstance(KycByDirectoryResponse, raw, { excludeExtraneousValues: true });
73
+ const errors = await validate(dto as object);
74
+
75
+ expect(errors.map((e) => e.property)).toContain('peopleId');
76
+ });
77
+
78
+ // DEC-KYC-015: candado simétrico al de peopleId. Sin este caso, alguien puede borrar el
79
+ // @IsNotEmpty() de verificationId y la suite sigue verde.
80
+ it('rechaza verificationId vacío en vez de dejarlo pasar', async () => {
81
+ const raw = {
82
+ consolidated: 'VERIFIED', verificationId: '', peopleId: 'ppl-1',
83
+ verificationStatus: 'COMPLETED', verificationResult: 'VERIFIED',
84
+ createDate: '2026-07-21T10:00:00.000Z', updateDate: '2026-07-21T10:00:00.000Z',
85
+ };
86
+
87
+ const dto = plainToInstance(KycByDirectoryResponse, raw, { excludeExtraneousValues: true });
88
+ const errors = await validate(dto as object);
89
+
90
+ expect(errors.map((e) => e.property)).toContain('verificationId');
91
+ });
92
+
93
+ // DEC-KYC-014: "sin verificación" se responde con 404, NO con un consolidated fuera de
94
+ // RetailKycStatusEnum. Este test es el candado de esa decisión.
95
+ it('rechaza un consolidated fuera de RetailKycStatusEnum (p.ej. el NONE descartado)', async () => {
96
+ const raw = {
97
+ consolidated: 'NONE', verificationId: 'ver-1', peopleId: 'ppl-1',
98
+ verificationStatus: 'COMPLETED', verificationResult: 'VERIFIED',
99
+ createDate: '2026-07-21T10:00:00.000Z', updateDate: '2026-07-21T10:00:00.000Z',
100
+ };
101
+
102
+ const dto = plainToInstance(KycByDirectoryResponse, raw, { excludeExtraneousValues: true });
103
+ const errors = await validate(dto as object);
104
+
105
+ expect(errors.map((e) => e.property)).toContain('consolidated');
106
+ });
107
+
108
+ // DEC-KYC-016: `verificationResult` está acotado a IdentificationDocumentStatus. Sin este
109
+ // candado se puede degradar el campo a @IsString() y la suite sigue verde (antipattern
110
+ // STRING_FOR_ENUM_FIELD). 'COMPLETED' es un valor del OTRO enum — el error de tipeo real.
111
+ it('rechaza un verificationResult que en realidad es un valor de verificationStatus', async () => {
112
+ const raw = {
113
+ consolidated: 'VERIFIED', verificationId: 'ver-1', peopleId: 'ppl-1',
114
+ verificationStatus: 'COMPLETED', verificationResult: 'COMPLETED',
115
+ createDate: '2026-07-21T10:00:00.000Z', updateDate: '2026-07-21T10:00:00.000Z',
116
+ };
117
+
118
+ const dto = plainToInstance(KycByDirectoryResponse, raw, { excludeExtraneousValues: true });
119
+ const errors = await validate(dto as object);
120
+
121
+ expect(errors.map((e) => e.property)).toContain('verificationResult');
122
+ });
123
+
124
+ // El ordenamiento del endpoint (spec §6) se apoya en fechas ISO-8601 léxicamente ordenables.
125
+ // Sin este candado se puede quitar el @IsISO8601() y la suite sigue verde.
126
+ it.each(['createDate', 'updateDate'])('rechaza %s con formato no ISO-8601', async (campo) => {
127
+ const raw = {
128
+ consolidated: 'VERIFIED', verificationId: 'ver-1', peopleId: 'ppl-1',
129
+ verificationStatus: 'COMPLETED', verificationResult: 'VERIFIED',
130
+ createDate: '2026-07-21T10:00:00.000Z', updateDate: '2026-07-21T10:00:00.000Z',
131
+ [campo]: '21/07/2026',
132
+ };
133
+
134
+ const dto = plainToInstance(KycByDirectoryResponse, raw, { excludeExtraneousValues: true });
135
+ const errors = await validate(dto as object);
136
+
137
+ expect(errors.map((e) => e.property)).toContain(campo);
138
+ });
139
+ });
@@ -0,0 +1,99 @@
1
+ import 'reflect-metadata';
2
+ import { plainToInstance } from 'class-transformer';
3
+ import { validate } from 'class-validator';
4
+ import { KycVerificationChangedV1 } from '../../../src/kyc/index';
5
+
6
+ describe('KycVerificationChangedV1', () => {
7
+ it('valida el shape que produce el Pipe desde el NewImage', async () => {
8
+ const raw = {
9
+ verificationId: 'ver-1',
10
+ directoryId: 'dir-1',
11
+ peopleId: 'ppl-1',
12
+ metamapFlowId: 'flow-1',
13
+ verificationStatus: 'COMPLETED',
14
+ verificationResult: 'VERIFIED',
15
+ updateDate: '2026-07-21T10:05:00.000Z',
16
+ };
17
+
18
+ const dto = plainToInstance(KycVerificationChangedV1, raw, { excludeExtraneousValues: true });
19
+
20
+ expect(await validate(dto as object)).toHaveLength(0);
21
+ expect(dto.verificationId).toBe('ver-1');
22
+ });
23
+
24
+ it('rechaza un evento sin directoryId (sin él no hay gate posible)', async () => {
25
+ const raw = {
26
+ verificationId: 'ver-1', peopleId: 'ppl-1',
27
+ verificationStatus: 'COMPLETED', verificationResult: 'VERIFIED',
28
+ updateDate: '2026-07-21T10:05:00.000Z',
29
+ };
30
+
31
+ const dto = plainToInstance(KycVerificationChangedV1, raw, { excludeExtraneousValues: true });
32
+ const errors = await validate(dto as object);
33
+
34
+ expect(errors.map((e) => e.property)).toContain('directoryId');
35
+ });
36
+
37
+ // DEC-KYC-015. El NewImage de DDB puede traer S: "" — pasa como string vacío, no como ausente.
38
+ it.each(['verificationId', 'directoryId', 'peopleId'])(
39
+ 'rechaza %s vacío (el 7.3% de las filas de dev trae peopleId: "")',
40
+ async (campo) => {
41
+ const raw = {
42
+ verificationId: 'ver-1', directoryId: 'dir-1', peopleId: 'ppl-1',
43
+ verificationStatus: 'COMPLETED', verificationResult: 'VERIFIED',
44
+ updateDate: '2026-07-21T10:05:00.000Z',
45
+ [campo]: '',
46
+ };
47
+
48
+ const dto = plainToInstance(KycVerificationChangedV1, raw, { excludeExtraneousValues: true });
49
+ const errors = await validate(dto as object);
50
+
51
+ expect(errors.map((e) => e.property)).toContain(campo);
52
+ },
53
+ );
54
+
55
+ // Este es el boundary del Pipe: un estado no reconocido DEBE caer al DLQ, no colarse.
56
+ // Sin este candado se puede degradar verificationStatus a @IsString() y la suite sigue verde.
57
+ it('rechaza un verificationStatus fuera del enum', async () => {
58
+ const raw = {
59
+ verificationId: 'ver-1', directoryId: 'dir-1', peopleId: 'ppl-1',
60
+ verificationStatus: 'INVENTADO', verificationResult: 'VERIFIED',
61
+ updateDate: '2026-07-21T10:05:00.000Z',
62
+ };
63
+
64
+ const dto = plainToInstance(KycVerificationChangedV1, raw, { excludeExtraneousValues: true });
65
+ const errors = await validate(dto as object);
66
+
67
+ expect(errors.map((e) => e.property)).toContain('verificationStatus');
68
+ });
69
+
70
+ // DEC-KYC-016: `verificationResult` está acotado a IdentificationDocumentStatus. Sin este
71
+ // candado se puede degradar el campo a @IsString() y la suite sigue verde (antipattern
72
+ // STRING_FOR_ENUM_FIELD). 'COMPLETED' es un valor del OTRO enum — el error de tipeo real.
73
+ it('rechaza un verificationResult que en realidad es un valor de verificationStatus', async () => {
74
+ const raw = {
75
+ verificationId: 'ver-1', directoryId: 'dir-1', peopleId: 'ppl-1',
76
+ verificationStatus: 'COMPLETED', verificationResult: 'COMPLETED',
77
+ updateDate: '2026-07-21T10:05:00.000Z',
78
+ };
79
+
80
+ const dto = plainToInstance(KycVerificationChangedV1, raw, { excludeExtraneousValues: true });
81
+ const errors = await validate(dto as object);
82
+
83
+ expect(errors.map((e) => e.property)).toContain('verificationResult');
84
+ });
85
+
86
+ // El consumidor ordena por updateDate (spec §6): sin @IsISO8601() el orden es una asunción.
87
+ it('rechaza updateDate con formato no ISO-8601', async () => {
88
+ const raw = {
89
+ verificationId: 'ver-1', directoryId: 'dir-1', peopleId: 'ppl-1',
90
+ verificationStatus: 'COMPLETED', verificationResult: 'VERIFIED',
91
+ updateDate: '21/07/2026',
92
+ };
93
+
94
+ const dto = plainToInstance(KycVerificationChangedV1, raw, { excludeExtraneousValues: true });
95
+ const errors = await validate(dto as object);
96
+
97
+ expect(errors.map((e) => e.property)).toContain('updateDate');
98
+ });
99
+ });
@@ -0,0 +1,48 @@
1
+ import 'reflect-metadata';
2
+ import { plainToInstance } from 'class-transformer';
3
+ import { validate } from 'class-validator';
4
+ import { SendMessageRequest } from '../../../src/messagesConnector/dtos/SendMessageRequest';
5
+ import { DeliveryChannelEnum } from '../../../src/messaging';
6
+
7
+ /**
8
+ * Candado: `directoryId` es una LLAVE DE CORRELACIÓN opaca para messages-business (rate-limit + log +
9
+ * verify), NO una FK a un directorio. Volver a ponerle `@IsUUID()` rompe dos casos productivos:
10
+ * los cognitoSub UUID v7 (que class-validator rechaza) y el OTP de teléfono del wizard retail, donde
11
+ * el cliente todavía no tiene identidad Fiado cuando se envía el código.
12
+ */
13
+ const base = {
14
+ channelType: DeliveryChannelEnum.SMS,
15
+ messageType: 'OTP_CODE',
16
+ typeOfDirectory: 'PHONE',
17
+ language: 'es',
18
+ country: 'MX',
19
+ destination: '4422194128',
20
+ };
21
+
22
+ const errorsOn = async (directoryId: unknown) => {
23
+ const dto = plainToInstance(SendMessageRequest, { ...base, directoryId });
24
+ const errors = await validate(dto);
25
+ return errors.filter((e) => e.property === 'directoryId');
26
+ };
27
+
28
+ describe('SendMessageRequest.directoryId', () => {
29
+ it('acepta un teléfono (OTP del wizard retail: aún no hay identidad Fiado)', async () => {
30
+ expect(await errorsOn('4422194128')).toHaveLength(0);
31
+ });
32
+
33
+ it('acepta un UUID v7 (cognitoSub de los pools backoffice)', async () => {
34
+ expect(await errorsOn('01930b5e-7c3a-7f21-9a4e-1c8d5f2b6a90')).toHaveLength(0);
35
+ });
36
+
37
+ it('sigue aceptando un UUID v4 (consumidores legacy)', async () => {
38
+ expect(await errorsOn('6aeacae2-92ff-4593-8dfe-410f1f4a2ee6')).toHaveLength(0);
39
+ });
40
+
41
+ it('rechaza vacío (la llave de correlación es obligatoria)', async () => {
42
+ expect(await errorsOn('')).not.toHaveLength(0);
43
+ });
44
+
45
+ it('rechaza un no-string', async () => {
46
+ expect(await errorsOn(12345)).not.toHaveLength(0);
47
+ });
48
+ });
@@ -0,0 +1,15 @@
1
+ /**
2
+ * Alta de prospecto M2M en `auth-business` (crea onboarding + People + DirectoryUser).
3
+ * Contrato REDUCIDO respecto del de agente: sin caller, sin referral, sin campos de app.
4
+ *
5
+ * `tenantId` es OBLIGATORIO y explícito: la variante de agente lo tiene hardcodeado a
6
+ * `FIADO_BETA`, y eliminar ese hardcode es parte del contrato de este endpoint privado.
7
+ *
8
+ * ⚠️ PII: nombre y teléfono — nunca loguear el request completo.
9
+ */
10
+ export declare class SignUpProspectRequest {
11
+ name: string;
12
+ phoneNumber: string;
13
+ /** Decidido: sin `@Matches(/^[a-z0-9-]+$/)` — `FIADO_BETA` es un tenant real y ese regex lo rechazaría. */
14
+ tenantId: string;
15
+ }
@@ -9,28 +9,36 @@ 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.ResendSelfRegisterOtpRequest = void 0;
12
+ exports.SignUpProspectRequest = void 0;
13
13
  const class_transformer_1 = require("class-transformer");
14
14
  const class_validator_1 = require("class-validator");
15
15
  /**
16
- * Body del POST /self-register/resend-otp (público, anónimo). DEC-RBAC-054.
17
- * Re-envía el OTP del autoregistro (mecanismo messages-business, NO Cognito) tras validar un
18
- * `pending` existente. Misma postura anti-enumeración del start. El email se normaliza lowercase
19
- * server-side. DTO propio por endpoint (NO reusa SelfRegisterStartRequest, que exige roleId/scope/
20
- * scopeRef, ni SelfRegisterVerifyOtpRequest, que exige otp).
16
+ * Alta de prospecto M2M en `auth-business` (crea onboarding + People + DirectoryUser).
17
+ * Contrato REDUCIDO respecto del de agente: sin caller, sin referral, sin campos de app.
18
+ *
19
+ * `tenantId` es OBLIGATORIO y explícito: la variante de agente lo tiene hardcodeado a
20
+ * `FIADO_BETA`, y eliminar ese hardcode es parte del contrato de este endpoint privado.
21
+ *
22
+ * ⚠️ PII: nombre y teléfono — nunca loguear el request completo.
21
23
  */
22
- class ResendSelfRegisterOtpRequest {
24
+ class SignUpProspectRequest {
23
25
  }
24
- exports.ResendSelfRegisterOtpRequest = ResendSelfRegisterOtpRequest;
26
+ exports.SignUpProspectRequest = SignUpProspectRequest;
25
27
  __decorate([
26
28
  (0, class_transformer_1.Expose)(),
27
29
  (0, class_validator_1.IsString)(),
28
30
  (0, class_validator_1.IsNotEmpty)(),
29
31
  __metadata("design:type", String)
30
- ], ResendSelfRegisterOtpRequest.prototype, "tenantId", void 0);
32
+ ], SignUpProspectRequest.prototype, "name", void 0);
31
33
  __decorate([
32
34
  (0, class_transformer_1.Expose)(),
33
- (0, class_validator_1.IsEmail)(),
35
+ (0, class_validator_1.IsString)(),
36
+ (0, class_validator_1.IsNotEmpty)(),
37
+ __metadata("design:type", String)
38
+ ], SignUpProspectRequest.prototype, "phoneNumber", void 0);
39
+ __decorate([
40
+ (0, class_transformer_1.Expose)(),
41
+ (0, class_validator_1.IsString)(),
34
42
  (0, class_validator_1.IsNotEmpty)(),
35
43
  __metadata("design:type", String)
36
- ], ResendSelfRegisterOtpRequest.prototype, "email", void 0);
44
+ ], SignUpProspectRequest.prototype, "tenantId", void 0);
@@ -0,0 +1,11 @@
1
+ /**
2
+ * Identidad Fiado creada (o reusada) para el prospecto.
3
+ *
4
+ * DEC-KYC-015: `directoryId` y `peopleId` llevan `@IsNotEmpty()` — son los mismos dos
5
+ * identificadores que en el dominio `kyc`, y vienen de un destino que ya demostró devolver
6
+ * strings vacíos. `@IsString()` pelado los dejaría pasar en silencio.
7
+ */
8
+ export declare class SignUpProspectResponse {
9
+ directoryId: string;
10
+ peopleId: string;
11
+ }
@@ -9,28 +9,28 @@ 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.ResendOtpRequest = void 0;
12
+ exports.SignUpProspectResponse = void 0;
13
13
  const class_transformer_1 = require("class-transformer");
14
14
  const class_validator_1 = require("class-validator");
15
15
  /**
16
- * Body del POST /auth/resend-otp (público, anónimo). DEC-RBAC-054.
17
- * Reenvía el OTP del login re-disparando el challenge real CUSTOM_AUTH (EMAIL_OTP) para la
18
- * identidad SIN password. `tenantId` obligatorio (DEC-064el picker ya lo resolvió, NO "solo email").
19
- * El email se normaliza lowercase server-side. Postura anti-enumeración: respuesta 200 genérica
20
- * siempre, sin filtrar existencia (ver AuthLoginManager.resendChallengeOtp).
16
+ * Identidad Fiado creada (o reusada) para el prospecto.
17
+ *
18
+ * DEC-KYC-015: `directoryId` y `peopleId` llevan `@IsNotEmpty()`son los mismos dos
19
+ * identificadores que en el dominio `kyc`, y vienen de un destino que ya demostró devolver
20
+ * strings vacíos. `@IsString()` pelado los dejaría pasar en silencio.
21
21
  */
22
- class ResendOtpRequest {
22
+ class SignUpProspectResponse {
23
23
  }
24
- exports.ResendOtpRequest = ResendOtpRequest;
24
+ exports.SignUpProspectResponse = SignUpProspectResponse;
25
25
  __decorate([
26
26
  (0, class_transformer_1.Expose)(),
27
- (0, class_validator_1.IsEmail)(),
27
+ (0, class_validator_1.IsString)(),
28
28
  (0, class_validator_1.IsNotEmpty)(),
29
29
  __metadata("design:type", String)
30
- ], ResendOtpRequest.prototype, "email", void 0);
30
+ ], SignUpProspectResponse.prototype, "directoryId", void 0);
31
31
  __decorate([
32
32
  (0, class_transformer_1.Expose)(),
33
33
  (0, class_validator_1.IsString)(),
34
34
  (0, class_validator_1.IsNotEmpty)(),
35
35
  __metadata("design:type", String)
36
- ], ResendOtpRequest.prototype, "tenantId", void 0);
36
+ ], SignUpProspectResponse.prototype, "peopleId", void 0);
@@ -3,3 +3,5 @@ export * from './dtos/ResetPasswordBackofficeRequest';
3
3
  export * from './dtos/SignInBackofficeRequest';
4
4
  export * from './dtos/SignInBackofficeResponse';
5
5
  export * from './dtos/SignUpBackofficeRequest';
6
+ export * from './dtos/SignUpProspectRequest';
7
+ export * from './dtos/SignUpProspectResponse';
package/bin/auth/index.js CHANGED
@@ -20,3 +20,5 @@ __exportStar(require("./dtos/ResetPasswordBackofficeRequest"), exports);
20
20
  __exportStar(require("./dtos/SignInBackofficeRequest"), exports);
21
21
  __exportStar(require("./dtos/SignInBackofficeResponse"), exports);
22
22
  __exportStar(require("./dtos/SignUpBackofficeRequest"), exports);
23
+ __exportStar(require("./dtos/SignUpProspectRequest"), exports);
24
+ __exportStar(require("./dtos/SignUpProspectResponse"), exports);
package/bin/index.d.ts CHANGED
@@ -98,5 +98,6 @@ export * as LoanOfferings from './loanOfferings';
98
98
  export * as LoanCollectorAssignment from './loanCollectorAssignment';
99
99
  export * as LoanCredit from './loanCredit';
100
100
  export * as LoanScoring from './loanScoring';
101
+ export * as Kyc from './kyc';
101
102
  export * from './messaging';
102
103
  export * from './complaint';
package/bin/index.js CHANGED
@@ -38,6 +38,7 @@ var __exportStar = (this && this.__exportStar) || function(m, exports) {
38
38
  Object.defineProperty(exports, "__esModule", { value: true });
39
39
  exports.Device = exports.Observations = exports.IssuanceBusiness = exports.Blacklist = exports.CentralPayments = exports.Helpdesk = exports.FiadoApiResponse = exports.Auth = exports.LegalDocumentsBusiness = exports.Role = exports.STPAccount = exports.RiskProfile = exports.FraudPreventionEngine = exports.BBVARst = exports.Stp = exports.BenefitCenter = exports.BankAccount = exports.P2pContact = exports.CreditContract = exports.Contract = exports.ProductCatalog = exports.ContactInfo = exports.TransactionAnalytics = exports.Transaction = exports.TransactionProcessor = exports.GenericMessage = exports.EventBridgeMessage = exports.SessionActivity = exports.NotificationMessages = exports.ServicePayment = exports.Header = exports.Identity = exports.UserTags = exports.Group = exports.File = exports.ExchangeRate = exports.Directory = exports.Currency = exports.Country = exports.Card = exports.Authentication = exports.AppContent = exports.App = exports.Offices = exports.Places = exports.Address = exports.Beneficiary = exports.Activity = exports.Account = exports.Crypto = void 0;
40
40
  exports.LoanScoring = exports.LoanCredit = exports.LoanCollectorAssignment = exports.LoanOfferings = exports.LoanConfig = exports.RetailWizard = exports.RetailCustomer = exports.RetailCards = exports.RetailCatalog = exports.RetailOrg = exports.EmailVerification = exports.NetworkConnector = exports.Modelias = exports.TotpSecurity = exports.Passport = exports.WalletFunding = exports.Remittance = exports.PlatformRbac = exports.CognitoBackofficeConnector = exports.TwilioConnector = exports.MessagesConnector = exports.Mdm = exports.MilestoneBusiness = exports.CirculoCredito = exports.CreditStatements = exports.Sentry = exports.AiEngine = exports.Funnel = exports.TeamsConnector = exports.PlatformErrorEvents = exports.CustomerFile = exports.CreditBackoffice = exports.CreditDashboard = exports.CreditEngine = exports.Credit = exports.ComissionBusiness = exports.ReferralBusiness = exports.ZendeskMessaging = exports.NotificationWS = exports.Event = exports.PayrollBusiness = exports.Cnbv = exports.DirectorySetting = exports.InvoiceCollector = exports.Collector = exports.Pricelist = exports.Company = exports.Services = exports.AccountIssuanceBusiness = exports.AppSelectionData = void 0;
41
+ exports.Kyc = void 0;
41
42
  exports.Crypto = __importStar(require("./crypto"));
42
43
  exports.Account = __importStar(require("./account"));
43
44
  exports.Activity = __importStar(require("./activity"));
@@ -170,5 +171,9 @@ exports.LoanCredit = __importStar(require("./loanCredit"));
170
171
  // ScoringProviderRouter configurable Modelias|Círculo con contrato agnóstico ScoringDecision;
171
172
  // SureKeep Fase 2 — pista Loan/SOFOM).
172
173
  exports.LoanScoring = __importStar(require("./loanScoring"));
174
+ // Kyc: contrato de la lectura confirmatoria del KYC (kyc-verifications-business) — estado
175
+ // consolidado + estados crudos + datos de persona. El consolidado reusa RetailKycStatusEnum
176
+ // (no hay enum consolidado propio — DEC-KYC-014). SureKeep Fase 2.
177
+ exports.Kyc = __importStar(require("./kyc"));
173
178
  __exportStar(require("./messaging"), exports);
174
179
  __exportStar(require("./complaint"), exports);
@@ -0,0 +1,49 @@
1
+ import { IdentificationDocumentStatus } from '../../../identity/enums/IdentificationDocumentStatus';
2
+ import { RetailKycStatusEnum } from '../../../retailCustomer/enums/RetailKycStatusEnum';
3
+ import { KycVerificationStatusEnum } from '../../enums/KycVerificationStatusEnum';
4
+ import { KycPersonData } from './KycPersonData';
5
+ /**
6
+ * Estado consolidado del KYC de un directorio + los estados crudos + los datos de persona.
7
+ *
8
+ * Los campos crudos viajan además del consolidado para que el consumidor NO tenga que
9
+ * reimplementar el mapeo de otro dominio.
10
+ *
11
+ * DEC-KYC-014: "sin verificación" se responde con 404, NO con un valor de enum. Por eso todos
12
+ * los campos de identidad y estado son REQUERIDOS — este DTO solo describe el caso en que sí
13
+ * existe una verificación.
14
+ *
15
+ * DEC-KYC-004: el vocabulario del consolidado es `RetailKycStatusEnum`, el único de la lib.
16
+ *
17
+ * DEC-KYC-016: `verificationResult` reusa `IdentificationDocumentStatus` — es el enum que el
18
+ * lambda productor (`kyc-verifications-business`) escribe literalmente en la tabla; duplicarlo
19
+ * aquí sería drift garantizado.
20
+ *
21
+ * ⚠️ Lleva PII en `person` (CURP y nombre completo).
22
+ */
23
+ export declare class KycByDirectoryResponse {
24
+ consolidated: RetailKycStatusEnum;
25
+ /** La PK de la fila (`id`) mapeada a nombre de negocio. */
26
+ verificationId: string;
27
+ /** DEC-KYC-015: `@IsNotEmpty()` — el 7.3% de las filas de dev trae string vacío. */
28
+ peopleId: string;
29
+ metamapFlowId?: string;
30
+ verificationStatus: KycVerificationStatusEnum;
31
+ /**
32
+ * Requerido y acotado al enum: se escanearon las 193 filas de `KycVerifications` en dev y los
33
+ * valores son exactamente los tres — `IN_PROGRESS+UNVERIFIED` 104, `COMPLETED+VERIFIED` 69,
34
+ * `COMPLETED+UNVERIFIED` 19, `COMPLETED+REJECTED` 1. Cero valores fuera del set, cero vacíos.
35
+ * Verificado, no asumido (2026-07-21).
36
+ */
37
+ verificationResult: IdentificationDocumentStatus;
38
+ /**
39
+ * ISO-8601 obligatorio: el ordenamiento del endpoint (spec §6) se apoya en que estas fechas
40
+ * son léxicamente ordenables — si no se valida el formato, el orden es una asunción sin red.
41
+ * Se escanearon las 193 filas de `KycVerifications` en dev: `createDate` 193/193 ISO-8601 y
42
+ * `updateDate` 193/193 — 386/386, cero excepciones (ejemplo real: '2025-10-06T21:40:58.277Z').
43
+ * Verificado, no asumido (2026-07-21).
44
+ */
45
+ createDate: string;
46
+ /** ISO-8601 obligatorio — mismo escaneo de dev: 386/386 fechas ISO-8601 (2026-07-21). */
47
+ updateDate: string;
48
+ person?: KycPersonData;
49
+ }
@@ -0,0 +1,91 @@
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.KycByDirectoryResponse = void 0;
13
+ const class_transformer_1 = require("class-transformer");
14
+ const class_validator_1 = require("class-validator");
15
+ const IdentificationDocumentStatus_1 = require("../../../identity/enums/IdentificationDocumentStatus");
16
+ const RetailKycStatusEnum_1 = require("../../../retailCustomer/enums/RetailKycStatusEnum");
17
+ const KycVerificationStatusEnum_1 = require("../../enums/KycVerificationStatusEnum");
18
+ const KycPersonData_1 = require("./KycPersonData");
19
+ /**
20
+ * Estado consolidado del KYC de un directorio + los estados crudos + los datos de persona.
21
+ *
22
+ * Los campos crudos viajan además del consolidado para que el consumidor NO tenga que
23
+ * reimplementar el mapeo de otro dominio.
24
+ *
25
+ * DEC-KYC-014: "sin verificación" se responde con 404, NO con un valor de enum. Por eso todos
26
+ * los campos de identidad y estado son REQUERIDOS — este DTO solo describe el caso en que sí
27
+ * existe una verificación.
28
+ *
29
+ * DEC-KYC-004: el vocabulario del consolidado es `RetailKycStatusEnum`, el único de la lib.
30
+ *
31
+ * DEC-KYC-016: `verificationResult` reusa `IdentificationDocumentStatus` — es el enum que el
32
+ * lambda productor (`kyc-verifications-business`) escribe literalmente en la tabla; duplicarlo
33
+ * aquí sería drift garantizado.
34
+ *
35
+ * ⚠️ Lleva PII en `person` (CURP y nombre completo).
36
+ */
37
+ class KycByDirectoryResponse {
38
+ }
39
+ exports.KycByDirectoryResponse = KycByDirectoryResponse;
40
+ __decorate([
41
+ (0, class_transformer_1.Expose)(),
42
+ (0, class_validator_1.IsEnum)(RetailKycStatusEnum_1.RetailKycStatusEnum),
43
+ __metadata("design:type", String)
44
+ ], KycByDirectoryResponse.prototype, "consolidated", void 0);
45
+ __decorate([
46
+ (0, class_transformer_1.Expose)(),
47
+ (0, class_validator_1.IsString)(),
48
+ (0, class_validator_1.IsNotEmpty)(),
49
+ __metadata("design:type", String)
50
+ ], KycByDirectoryResponse.prototype, "verificationId", void 0);
51
+ __decorate([
52
+ (0, class_transformer_1.Expose)(),
53
+ (0, class_validator_1.IsString)(),
54
+ (0, class_validator_1.IsNotEmpty)(),
55
+ __metadata("design:type", String)
56
+ ], KycByDirectoryResponse.prototype, "peopleId", void 0);
57
+ __decorate([
58
+ (0, class_transformer_1.Expose)(),
59
+ (0, class_validator_1.IsOptional)(),
60
+ (0, class_validator_1.IsString)(),
61
+ __metadata("design:type", String)
62
+ ], KycByDirectoryResponse.prototype, "metamapFlowId", void 0);
63
+ __decorate([
64
+ (0, class_transformer_1.Expose)(),
65
+ (0, class_validator_1.IsEnum)(KycVerificationStatusEnum_1.KycVerificationStatusEnum),
66
+ __metadata("design:type", String)
67
+ ], KycByDirectoryResponse.prototype, "verificationStatus", void 0);
68
+ __decorate([
69
+ (0, class_transformer_1.Expose)(),
70
+ (0, class_validator_1.IsEnum)(IdentificationDocumentStatus_1.IdentificationDocumentStatus),
71
+ __metadata("design:type", String)
72
+ ], KycByDirectoryResponse.prototype, "verificationResult", void 0);
73
+ __decorate([
74
+ (0, class_transformer_1.Expose)(),
75
+ (0, class_validator_1.IsString)(),
76
+ (0, class_validator_1.IsISO8601)(),
77
+ __metadata("design:type", String)
78
+ ], KycByDirectoryResponse.prototype, "createDate", void 0);
79
+ __decorate([
80
+ (0, class_transformer_1.Expose)(),
81
+ (0, class_validator_1.IsString)(),
82
+ (0, class_validator_1.IsISO8601)(),
83
+ __metadata("design:type", String)
84
+ ], KycByDirectoryResponse.prototype, "updateDate", void 0);
85
+ __decorate([
86
+ (0, class_transformer_1.Expose)(),
87
+ (0, class_validator_1.IsOptional)(),
88
+ (0, class_validator_1.ValidateNested)(),
89
+ (0, class_transformer_1.Type)(() => KycPersonData_1.KycPersonData),
90
+ __metadata("design:type", KycPersonData_1.KycPersonData)
91
+ ], KycByDirectoryResponse.prototype, "person", void 0);