@fiado/type-kit 3.227.0 → 3.229.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/identity/PeopleSelfieResponse.test.ts +57 -0
- package/bin/account/dtos/AccountCreateRequest.d.ts +7 -1
- package/bin/identity/dtos/PeopleResponse.d.ts +2 -0
- package/bin/identity/dtos/PeopleSelfieResponse.d.ts +7 -20
- package/bin/identity/dtos/PeopleSelfieResponse.js +39 -8
- package/bin/identity/dtos/PeopleUpdateRequest.d.ts +2 -0
- package/bin/identity/index.d.ts +1 -0
- package/bin/identity/index.js +1 -0
- package/package.json +1 -1
- package/src/account/dtos/AccountCreateRequest.ts +7 -1
- package/src/identity/dtos/PeopleResponse.ts +2 -0
- package/src/identity/dtos/PeopleSelfieResponse.ts +26 -0
- package/src/identity/dtos/PeopleUpdateRequest.ts +2 -0
- package/src/identity/index.ts +1 -0
|
@@ -0,0 +1,57 @@
|
|
|
1
|
+
import 'reflect-metadata';
|
|
2
|
+
import { plainToInstance } from 'class-transformer';
|
|
3
|
+
import { validate } from 'class-validator';
|
|
4
|
+
import { PeopleSelfieResponse } from '../../../src/identity/index';
|
|
5
|
+
|
|
6
|
+
describe('PeopleSelfieResponse', () => {
|
|
7
|
+
const valid = {
|
|
8
|
+
directoryId: 'dir-1',
|
|
9
|
+
url: 'https://s3.amazonaws.com/bucket/USER/dir-1/ver-1_MEX_ppl_SELFIE.png?X-Amz-Expires=900',
|
|
10
|
+
key: 'ver-1_MEX_ppl_SELFIE.png',
|
|
11
|
+
expiresInSeconds: 900,
|
|
12
|
+
};
|
|
13
|
+
|
|
14
|
+
it('acepta una respuesta de selfie completa', async () => {
|
|
15
|
+
const dto = plainToInstance(PeopleSelfieResponse, valid, { excludeExtraneousValues: true });
|
|
16
|
+
const errors = await validate(dto as object);
|
|
17
|
+
|
|
18
|
+
expect(errors).toHaveLength(0);
|
|
19
|
+
expect(dto.directoryId).toBe('dir-1');
|
|
20
|
+
expect(dto.key).toBe('ver-1_MEX_ppl_SELFIE.png');
|
|
21
|
+
expect(dto.url).toContain('SELFIE.png');
|
|
22
|
+
expect(dto.expiresInSeconds).toBe(900);
|
|
23
|
+
});
|
|
24
|
+
|
|
25
|
+
it.each(['directoryId', 'url', 'key'])('rechaza %s vacío', async (campo) => {
|
|
26
|
+
const dto = plainToInstance(
|
|
27
|
+
PeopleSelfieResponse,
|
|
28
|
+
{ ...valid, [campo]: '' },
|
|
29
|
+
{ excludeExtraneousValues: true },
|
|
30
|
+
);
|
|
31
|
+
const errors = await validate(dto as object);
|
|
32
|
+
|
|
33
|
+
expect(errors.map((e) => e.property)).toContain(campo);
|
|
34
|
+
});
|
|
35
|
+
|
|
36
|
+
it('rechaza expiresInSeconds no entero', async () => {
|
|
37
|
+
const dto = plainToInstance(
|
|
38
|
+
PeopleSelfieResponse,
|
|
39
|
+
{ ...valid, expiresInSeconds: 12.5 },
|
|
40
|
+
{ excludeExtraneousValues: true },
|
|
41
|
+
);
|
|
42
|
+
const errors = await validate(dto as object);
|
|
43
|
+
|
|
44
|
+
expect(errors.map((e) => e.property)).toContain('expiresInSeconds');
|
|
45
|
+
});
|
|
46
|
+
|
|
47
|
+
it('rechaza expiresInSeconds no positivo', async () => {
|
|
48
|
+
const dto = plainToInstance(
|
|
49
|
+
PeopleSelfieResponse,
|
|
50
|
+
{ ...valid, expiresInSeconds: 0 },
|
|
51
|
+
{ excludeExtraneousValues: true },
|
|
52
|
+
);
|
|
53
|
+
const errors = await validate(dto as object);
|
|
54
|
+
|
|
55
|
+
expect(errors.map((e) => e.property)).toContain('expiresInSeconds');
|
|
56
|
+
});
|
|
57
|
+
});
|
|
@@ -17,7 +17,13 @@ export declare class AccountCreateRequest {
|
|
|
17
17
|
usNames: string;
|
|
18
18
|
usLastNames: string;
|
|
19
19
|
phoneNumber: string;
|
|
20
|
-
|
|
20
|
+
/**
|
|
21
|
+
* Opcional: la apertura MX en LEVEL_1 puede correr sin dirección. Cuando falta, el
|
|
22
|
+
* emisor debe OMITIR la clave (dejarla undefined, que JSON.stringify elimina del body),
|
|
23
|
+
* nunca mandarla en `null`: account-fiadosa-business valida contra type-kit v1, donde
|
|
24
|
+
* `address` lleva @ValidateNested() sin @IsOptional(), y `null` produce un 400.
|
|
25
|
+
*/
|
|
26
|
+
address?: AddressResponse;
|
|
21
27
|
email: string;
|
|
22
28
|
dob: string;
|
|
23
29
|
isHost?: boolean;
|
|
@@ -69,6 +69,8 @@ export declare class PeopleResponse {
|
|
|
69
69
|
MEX_Beneficiaries: boolean;
|
|
70
70
|
MEX_DebitAccount: boolean;
|
|
71
71
|
MEX_DebitAccountWish: boolean;
|
|
72
|
+
/** true = el step de emisión FIADOSA/Pomelo terminó (cuenta + tarjeta virtual). */
|
|
73
|
+
MEX_VirtualCard: boolean;
|
|
72
74
|
MEX_FacematchVerified: boolean | null;
|
|
73
75
|
MEX_ProofAddress: boolean;
|
|
74
76
|
MEX_TemplateMatch: boolean;
|
|
@@ -1,29 +1,16 @@
|
|
|
1
|
-
import { SelfieSourceEnum } from '../enums/SelfieSourceEnum';
|
|
2
1
|
/**
|
|
3
|
-
*
|
|
2
|
+
* Respuesta del endpoint privado que devuelve la selfie del KYC de un usuario:
|
|
3
|
+
* el URL presignado de S3 (es el `userPhotoLink` del facematch) + su vigencia.
|
|
4
4
|
*
|
|
5
|
-
*
|
|
6
|
-
*
|
|
7
|
-
* `userPhotoLinkHash`, y el par va en el `metadata` de la verificación con `customInput: true`.
|
|
8
|
-
*
|
|
9
|
-
* Solo responde a usuarios con cuenta (`MEX_DebitAccount` o `USA_DebitAccount`); si no, el endpoint
|
|
10
|
-
* devuelve 401 con code `NO_ACCOUNT`. Si el usuario tiene cuenta pero no hay imagen de selfie,
|
|
11
|
-
* devuelve code `SELFIE_NOT_FOUND`. fiado-identity-lambda.
|
|
5
|
+
* Versión SIMPLIFICADA (sin `source` / `verificationId` / `lastModified`): el consumidor
|
|
6
|
+
* solo necesita el URL para el facematch y el nombre del archivo para trazabilidad.
|
|
12
7
|
*/
|
|
13
8
|
export declare class PeopleSelfieResponse {
|
|
14
9
|
directoryId: string;
|
|
10
|
+
/** URL presignado de S3 de la foto de cara (el `userPhotoLink` del facematch). */
|
|
11
|
+
url: string;
|
|
15
12
|
/** Nombre del archivo en S3, sin el prefijo `USER/{directoryId}/`. */
|
|
16
13
|
key: string;
|
|
17
|
-
/**
|
|
18
|
-
url: string;
|
|
19
|
-
/**
|
|
20
|
-
* Vigencia del presigned. La emite fiado-s3-lambda y hoy es 3600; el facematch tiene que
|
|
21
|
-
* dispararse dentro de esa ventana o Metamap no podrá descargar la foto.
|
|
22
|
-
*/
|
|
14
|
+
/** Vigencia del presigned URL en segundos. */
|
|
23
15
|
expiresInSeconds: number;
|
|
24
|
-
/** Verificación de Metamap a la que pertenece la selfie. `null` si no se pudo determinar. */
|
|
25
|
-
verificationId: string | null;
|
|
26
|
-
/** Fecha ISO de última modificación del objeto en S3. `null` si S3 no la reportó. */
|
|
27
|
-
lastModified: string | null;
|
|
28
|
-
source: SelfieSourceEnum;
|
|
29
16
|
}
|
|
@@ -1,17 +1,48 @@
|
|
|
1
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
|
+
};
|
|
2
11
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
12
|
exports.PeopleSelfieResponse = void 0;
|
|
13
|
+
const class_transformer_1 = require("class-transformer");
|
|
14
|
+
const class_validator_1 = require("class-validator");
|
|
4
15
|
/**
|
|
5
|
-
*
|
|
16
|
+
* Respuesta del endpoint privado que devuelve la selfie del KYC de un usuario:
|
|
17
|
+
* el URL presignado de S3 (es el `userPhotoLink` del facematch) + su vigencia.
|
|
6
18
|
*
|
|
7
|
-
*
|
|
8
|
-
*
|
|
9
|
-
* `userPhotoLinkHash`, y el par va en el `metadata` de la verificación con `customInput: true`.
|
|
10
|
-
*
|
|
11
|
-
* Solo responde a usuarios con cuenta (`MEX_DebitAccount` o `USA_DebitAccount`); si no, el endpoint
|
|
12
|
-
* devuelve 401 con code `NO_ACCOUNT`. Si el usuario tiene cuenta pero no hay imagen de selfie,
|
|
13
|
-
* devuelve code `SELFIE_NOT_FOUND`. fiado-identity-lambda.
|
|
19
|
+
* Versión SIMPLIFICADA (sin `source` / `verificationId` / `lastModified`): el consumidor
|
|
20
|
+
* solo necesita el URL para el facematch y el nombre del archivo para trazabilidad.
|
|
14
21
|
*/
|
|
15
22
|
class PeopleSelfieResponse {
|
|
16
23
|
}
|
|
17
24
|
exports.PeopleSelfieResponse = PeopleSelfieResponse;
|
|
25
|
+
__decorate([
|
|
26
|
+
(0, class_transformer_1.Expose)(),
|
|
27
|
+
(0, class_validator_1.IsString)(),
|
|
28
|
+
(0, class_validator_1.IsNotEmpty)(),
|
|
29
|
+
__metadata("design:type", String)
|
|
30
|
+
], PeopleSelfieResponse.prototype, "directoryId", void 0);
|
|
31
|
+
__decorate([
|
|
32
|
+
(0, class_transformer_1.Expose)(),
|
|
33
|
+
(0, class_validator_1.IsString)(),
|
|
34
|
+
(0, class_validator_1.IsNotEmpty)(),
|
|
35
|
+
__metadata("design:type", String)
|
|
36
|
+
], PeopleSelfieResponse.prototype, "url", void 0);
|
|
37
|
+
__decorate([
|
|
38
|
+
(0, class_transformer_1.Expose)(),
|
|
39
|
+
(0, class_validator_1.IsString)(),
|
|
40
|
+
(0, class_validator_1.IsNotEmpty)(),
|
|
41
|
+
__metadata("design:type", String)
|
|
42
|
+
], PeopleSelfieResponse.prototype, "key", void 0);
|
|
43
|
+
__decorate([
|
|
44
|
+
(0, class_transformer_1.Expose)(),
|
|
45
|
+
(0, class_validator_1.IsInt)(),
|
|
46
|
+
(0, class_validator_1.IsPositive)(),
|
|
47
|
+
__metadata("design:type", Number)
|
|
48
|
+
], PeopleSelfieResponse.prototype, "expiresInSeconds", void 0);
|
|
@@ -38,6 +38,8 @@ export declare class PeopleUpdateRequest {
|
|
|
38
38
|
tenantId?: string | null;
|
|
39
39
|
USA_DebitAccount?: boolean;
|
|
40
40
|
MEX_DebitAccount?: boolean;
|
|
41
|
+
/** true = el step de emisión FIADOSA/Pomelo terminó (cuenta + tarjeta virtual). */
|
|
42
|
+
MEX_VirtualCard?: boolean;
|
|
41
43
|
MEX_CreditClient?: boolean;
|
|
42
44
|
MEX_CreditAdditional?: boolean;
|
|
43
45
|
magicNumber?: boolean;
|
package/bin/identity/index.d.ts
CHANGED
|
@@ -10,6 +10,7 @@ export * from './dtos/UploadDocumentFile';
|
|
|
10
10
|
export * from './dtos/PeopleSelfVerifiedRequest';
|
|
11
11
|
export * from './dtos/AgentDocumentKeyResponse';
|
|
12
12
|
export * from './dtos/DocumentUploadResponse';
|
|
13
|
+
export * from './dtos/PeopleSelfieResponse';
|
|
13
14
|
export * from './enums/IdentificationDocumentStatus';
|
|
14
15
|
export * from './enums/SexDocument';
|
|
15
16
|
export * from './enums/InfoSelfVerifiedStatus';
|
package/bin/identity/index.js
CHANGED
|
@@ -27,6 +27,7 @@ __exportStar(require("./dtos/UploadDocumentFile"), exports);
|
|
|
27
27
|
__exportStar(require("./dtos/PeopleSelfVerifiedRequest"), exports);
|
|
28
28
|
__exportStar(require("./dtos/AgentDocumentKeyResponse"), exports);
|
|
29
29
|
__exportStar(require("./dtos/DocumentUploadResponse"), exports);
|
|
30
|
+
__exportStar(require("./dtos/PeopleSelfieResponse"), exports);
|
|
30
31
|
//enums
|
|
31
32
|
__exportStar(require("./enums/IdentificationDocumentStatus"), exports);
|
|
32
33
|
__exportStar(require("./enums/SexDocument"), exports);
|
package/package.json
CHANGED
|
@@ -61,10 +61,16 @@ export class AccountCreateRequest {
|
|
|
61
61
|
@IsPhoneNumberFiado()
|
|
62
62
|
phoneNumber: string;
|
|
63
63
|
|
|
64
|
+
/**
|
|
65
|
+
* Opcional: la apertura MX en LEVEL_1 puede correr sin dirección. Cuando falta, el
|
|
66
|
+
* emisor debe OMITIR la clave (dejarla undefined, que JSON.stringify elimina del body),
|
|
67
|
+
* nunca mandarla en `null`: account-fiadosa-business valida contra type-kit v1, donde
|
|
68
|
+
* `address` lleva @ValidateNested() sin @IsOptional(), y `null` produce un 400.
|
|
69
|
+
*/
|
|
64
70
|
@IsOptional()
|
|
65
71
|
@ValidateNested()
|
|
66
72
|
@Type(() => AddressResponse)
|
|
67
|
-
address
|
|
73
|
+
address?: AddressResponse;
|
|
68
74
|
|
|
69
75
|
@IsEmail()
|
|
70
76
|
email: string;
|
|
@@ -72,6 +72,8 @@ export class PeopleResponse {
|
|
|
72
72
|
MEX_Beneficiaries:boolean;
|
|
73
73
|
MEX_DebitAccount:boolean;
|
|
74
74
|
MEX_DebitAccountWish:boolean;
|
|
75
|
+
/** true = el step de emisión FIADOSA/Pomelo terminó (cuenta + tarjeta virtual). */
|
|
76
|
+
MEX_VirtualCard:boolean;
|
|
75
77
|
MEX_FacematchVerified:boolean| null;
|
|
76
78
|
MEX_ProofAddress:boolean;
|
|
77
79
|
MEX_TemplateMatch:boolean;
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
import { Expose } from 'class-transformer';
|
|
2
|
+
import { IsInt, IsNotEmpty, IsPositive, IsString } from 'class-validator';
|
|
3
|
+
|
|
4
|
+
/**
|
|
5
|
+
* Respuesta del endpoint privado que devuelve la selfie del KYC de un usuario:
|
|
6
|
+
* el URL presignado de S3 (es el `userPhotoLink` del facematch) + su vigencia.
|
|
7
|
+
*
|
|
8
|
+
* Versión SIMPLIFICADA (sin `source` / `verificationId` / `lastModified`): el consumidor
|
|
9
|
+
* solo necesita el URL para el facematch y el nombre del archivo para trazabilidad.
|
|
10
|
+
*/
|
|
11
|
+
export class PeopleSelfieResponse {
|
|
12
|
+
@Expose() @IsString() @IsNotEmpty()
|
|
13
|
+
directoryId!: string;
|
|
14
|
+
|
|
15
|
+
/** URL presignado de S3 de la foto de cara (el `userPhotoLink` del facematch). */
|
|
16
|
+
@Expose() @IsString() @IsNotEmpty()
|
|
17
|
+
url!: string;
|
|
18
|
+
|
|
19
|
+
/** Nombre del archivo en S3, sin el prefijo `USER/{directoryId}/`. */
|
|
20
|
+
@Expose() @IsString() @IsNotEmpty()
|
|
21
|
+
key!: string;
|
|
22
|
+
|
|
23
|
+
/** Vigencia del presigned URL en segundos. */
|
|
24
|
+
@Expose() @IsInt() @IsPositive()
|
|
25
|
+
expiresInSeconds!: number;
|
|
26
|
+
}
|
|
@@ -43,6 +43,8 @@ export class PeopleUpdateRequest {
|
|
|
43
43
|
tenantId?: string | null;
|
|
44
44
|
USA_DebitAccount?: boolean;
|
|
45
45
|
MEX_DebitAccount?: boolean;
|
|
46
|
+
/** true = el step de emisión FIADOSA/Pomelo terminó (cuenta + tarjeta virtual). */
|
|
47
|
+
MEX_VirtualCard?: boolean;
|
|
46
48
|
MEX_CreditClient?: boolean;
|
|
47
49
|
MEX_CreditAdditional?: boolean;
|
|
48
50
|
magicNumber?: boolean;
|
package/src/identity/index.ts
CHANGED
|
@@ -12,6 +12,7 @@ export * from './dtos/UploadDocumentFile';
|
|
|
12
12
|
export * from './dtos/PeopleSelfVerifiedRequest';
|
|
13
13
|
export * from './dtos/AgentDocumentKeyResponse';
|
|
14
14
|
export * from './dtos/DocumentUploadResponse';
|
|
15
|
+
export * from './dtos/PeopleSelfieResponse';
|
|
15
16
|
|
|
16
17
|
|
|
17
18
|
//enums
|