@fiado/api-invoker 4.73.0 → 4.75.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/bin/auth-business/AuthBusinessApi.d.ts +4 -2
- package/bin/auth-business/AuthBusinessApi.js +12 -2
- package/bin/auth-business/interfaces/IAuthBusinessApi.d.ts +15 -0
- package/bin/container.config.js +5 -0
- package/bin/index.d.ts +2 -0
- package/bin/index.js +2 -0
- package/bin/kyc/api/KycVerificationsBusinessApi.d.ts +11 -0
- package/bin/kyc/api/KycVerificationsBusinessApi.js +36 -0
- package/bin/kyc/api/interfaces/IKycVerificationsBusinessApi.d.ts +32 -0
- package/bin/kyc/api/interfaces/IKycVerificationsBusinessApi.js +1 -0
- package/bin/kyc/index.d.ts +2 -0
- package/bin/kyc/index.js +2 -0
- package/bin/retailCatalog/api/interfaces/IRetailCatalogBusinessApi.d.ts +14 -0
- package/bin/shortlink/api/ShortlinkBusinessApi.d.ts +10 -0
- package/bin/shortlink/api/ShortlinkBusinessApi.js +32 -0
- package/bin/shortlink/api/interfaces/IShortlinkBusinessApi.d.ts +25 -0
- package/bin/shortlink/api/interfaces/IShortlinkBusinessApi.js +1 -0
- package/bin/shortlink/index.d.ts +2 -0
- package/bin/shortlink/index.js +2 -0
- package/package.json +2 -2
- package/src/auth-business/AuthBusinessApi.ts +16 -4
- package/src/auth-business/interfaces/IAuthBusinessApi.ts +17 -0
- package/src/container.config.ts +6 -0
- package/src/index.ts +2 -0
- package/src/kyc/api/KycVerificationsBusinessApi.ts +24 -0
- package/src/kyc/api/interfaces/IKycVerificationsBusinessApi.ts +33 -0
- package/src/kyc/index.ts +2 -0
- package/src/retailCatalog/api/interfaces/IRetailCatalogBusinessApi.ts +17 -0
- package/src/shortlink/api/ShortlinkBusinessApi.ts +24 -0
- package/src/shortlink/api/interfaces/IShortlinkBusinessApi.ts +29 -0
- package/src/shortlink/index.ts +2 -0
|
@@ -1,5 +1,6 @@
|
|
|
1
|
-
import { IHttpRequest } from "@fiado/http-client";
|
|
2
|
-
import { IAuthBusinessApi } from "./interfaces/IAuthBusinessApi.js";
|
|
1
|
+
import type { IHttpRequest } from "@fiado/http-client";
|
|
2
|
+
import type { IAuthBusinessApi } from "./interfaces/IAuthBusinessApi.js";
|
|
3
|
+
import type { SignUpProspectRequest, SignUpProspectResponse } from "@fiado/type-kit/bin/auth/index.js";
|
|
3
4
|
type FiadoApiResponse<T> = import("@fiado/type-kit/bin/apiResponse/dtos/FiadoApiResponse.js").default<T>;
|
|
4
5
|
export declare class AuthBusinessApi implements IAuthBusinessApi {
|
|
5
6
|
private httpRequest;
|
|
@@ -8,5 +9,6 @@ export declare class AuthBusinessApi implements IAuthBusinessApi {
|
|
|
8
9
|
deleteByDirectoryId(directoryId: string): Promise<FiadoApiResponse<{
|
|
9
10
|
deletedCount: number;
|
|
10
11
|
}>>;
|
|
12
|
+
signUpProspect(request: SignUpProspectRequest): Promise<FiadoApiResponse<SignUpProspectResponse>>;
|
|
11
13
|
}
|
|
12
14
|
export {};
|
|
@@ -15,14 +15,24 @@ import dotenv from 'dotenv';
|
|
|
15
15
|
dotenv.config();
|
|
16
16
|
let AuthBusinessApi = class AuthBusinessApi {
|
|
17
17
|
httpRequest;
|
|
18
|
-
|
|
18
|
+
// El buildspec publica la URL en SSM con "/" final — se normaliza para no armar "//private"
|
|
19
|
+
// ni, si alguien limpia ese valor en SSM, un "...localprivate/..." sin slash.
|
|
20
|
+
baseUrl = (process.env.AUTH_BUSINESS_LAMBDA_URL || "").replace(/\/+$/, "");
|
|
19
21
|
constructor(httpRequest) {
|
|
20
22
|
this.httpRequest = httpRequest;
|
|
21
23
|
}
|
|
22
24
|
async deleteByDirectoryId(directoryId) {
|
|
23
|
-
const url = `${this.baseUrl}private/directory/${directoryId}`;
|
|
25
|
+
const url = `${this.baseUrl}/private/directory/${directoryId}`;
|
|
24
26
|
return await this.httpRequest.delete(url);
|
|
25
27
|
}
|
|
28
|
+
async signUpProspect(request) {
|
|
29
|
+
// ⚠️ Ruta PROPUESTA, no confirmada: esta es la primera operación privada de `auth-business`
|
|
30
|
+
// (su openapi/private.yaml está vacío y su PrivateController es una clase vacía). Podría
|
|
31
|
+
// terminar resolviéndose por el estilo `POST /` + header `operationName` que usan los otros
|
|
32
|
+
// clientes de auth. Se confirma con el equipo dueño al construir el endpoint.
|
|
33
|
+
const url = `${this.baseUrl}/private/signup-prospect`;
|
|
34
|
+
return await this.httpRequest.post(url, request);
|
|
35
|
+
}
|
|
26
36
|
};
|
|
27
37
|
AuthBusinessApi = __decorate([
|
|
28
38
|
injectable(),
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import type { SignUpProspectRequest, SignUpProspectResponse } from "@fiado/type-kit/bin/auth/index.js";
|
|
1
2
|
type FiadoApiResponse<T> = import("@fiado/type-kit/bin/apiResponse/dtos/FiadoApiResponse.js").default<T>;
|
|
2
3
|
/**
|
|
3
4
|
* Interfaz para el servicio Auth Business (auth-business).
|
|
@@ -11,5 +12,19 @@ export interface IAuthBusinessApi {
|
|
|
11
12
|
deleteByDirectoryId(directoryId: string): Promise<FiadoApiResponse<{
|
|
12
13
|
deletedCount: number;
|
|
13
14
|
}>>;
|
|
15
|
+
/**
|
|
16
|
+
* Alta M2M de prospecto: crea (o reusa) onboarding + People + DirectoryUser y devuelve
|
|
17
|
+
* la identidad Fiado. Lo usa el paso 01d del wizard de SureKeep.
|
|
18
|
+
*
|
|
19
|
+
* `tenantId` es explícito — la variante de agente lo tiene hardcodeado a FIADO_BETA.
|
|
20
|
+
*
|
|
21
|
+
* ⚠️ NO es idempotente del lado del destino: el consumidor DEBE hacer lookup por teléfono
|
|
22
|
+
* antes de llamar, o creará People duplicados (el `peopleId` se regenera en cada llamada).
|
|
23
|
+
*
|
|
24
|
+
* ⚠️ PII: el request lleva nombre y teléfono — nunca loguees el payload completo.
|
|
25
|
+
*
|
|
26
|
+
* @throws propaga el error del destino; nunca devuelve fallback.
|
|
27
|
+
*/
|
|
28
|
+
signUpProspect(request: SignUpProspectRequest): Promise<FiadoApiResponse<SignUpProspectResponse>>;
|
|
14
29
|
}
|
|
15
30
|
export {};
|
package/bin/container.config.js
CHANGED
|
@@ -125,6 +125,8 @@ import { PerformanceProfileApi } from "./performance-profile/index.js";
|
|
|
125
125
|
import { AuthBusinessApi } from "./auth-business/index.js";
|
|
126
126
|
import { PresenceWebsocketApi } from "./presence-websocket/index.js";
|
|
127
127
|
import { NotificationWebsocketApi } from "./notificationWebsockets/index.js";
|
|
128
|
+
// KYC verifications business — lectura confirmatoria server-side del KYC por directoryId (SureKeep F2)
|
|
129
|
+
import { KycVerificationsBusinessApi } from "./kyc/index.js";
|
|
128
130
|
export const apiInvokerBindings = new ContainerModule(({ bind }) => {
|
|
129
131
|
// UTILS bindings
|
|
130
132
|
bind("InvokerUtils").to(InvokerUtils);
|
|
@@ -264,4 +266,7 @@ export const apiInvokerBindings = new ContainerModule(({ bind }) => {
|
|
|
264
266
|
bind("IAuthBusinessApi").to(AuthBusinessApi);
|
|
265
267
|
bind("IPresenceWebsocketApi").to(PresenceWebsocketApi);
|
|
266
268
|
bind("INotificationWebsocketApi").to(NotificationWebsocketApi);
|
|
269
|
+
// KYC verifications business — lectura confirmatoria server-side del KYC por directoryId.
|
|
270
|
+
// La consume el wizard de SureKeep F2 tras el aviso async del stream de `KycVerifications`.
|
|
271
|
+
bind("IKycVerificationsBusinessApi").to(KycVerificationsBusinessApi);
|
|
267
272
|
});
|
package/bin/index.d.ts
CHANGED
|
@@ -81,6 +81,7 @@ export * from "./retailOrg/index.js";
|
|
|
81
81
|
export * from "./retailCustomer/index.js";
|
|
82
82
|
export * from "./retailCatalog/index.js";
|
|
83
83
|
export * from "./retailCards/index.js";
|
|
84
|
+
export * from "./shortlink/index.js";
|
|
84
85
|
export * from "./loanConfig/index.js";
|
|
85
86
|
export * from "./loanOfferings/index.js";
|
|
86
87
|
export * from "./loanCollectorAssignment/index.js";
|
|
@@ -102,3 +103,4 @@ export * from "./membership/index.js";
|
|
|
102
103
|
export * from "./performance-profile/index.js";
|
|
103
104
|
export * from "./auth-business/index.js";
|
|
104
105
|
export * from "./presence-websocket/index.js";
|
|
106
|
+
export * from "./kyc/index.js";
|
package/bin/index.js
CHANGED
|
@@ -81,6 +81,7 @@ export * from "./retailOrg/index.js";
|
|
|
81
81
|
export * from "./retailCustomer/index.js";
|
|
82
82
|
export * from "./retailCatalog/index.js";
|
|
83
83
|
export * from "./retailCards/index.js";
|
|
84
|
+
export * from "./shortlink/index.js";
|
|
84
85
|
export * from "./loanConfig/index.js";
|
|
85
86
|
export * from "./loanOfferings/index.js";
|
|
86
87
|
export * from "./loanCollectorAssignment/index.js";
|
|
@@ -102,3 +103,4 @@ export * from "./membership/index.js";
|
|
|
102
103
|
export * from "./performance-profile/index.js";
|
|
103
104
|
export * from "./auth-business/index.js";
|
|
104
105
|
export * from "./presence-websocket/index.js";
|
|
106
|
+
export * from "./kyc/index.js";
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import type { StandardResponse } from "@fiado/gateway-adapter";
|
|
2
|
+
import type { IHttpRequest } from "@fiado/http-client";
|
|
3
|
+
import type { KycByDirectoryResponse } from "@fiado/type-kit/bin/kyc/index.js";
|
|
4
|
+
import type { IKycVerificationsBusinessApi } from "./interfaces/IKycVerificationsBusinessApi.js";
|
|
5
|
+
/** Contrato y semántica completos → `IKycVerificationsBusinessApi` (`StandardResponse` → leer `result.data`). */
|
|
6
|
+
export declare class KycVerificationsBusinessApi implements IKycVerificationsBusinessApi {
|
|
7
|
+
private httpRequest;
|
|
8
|
+
private readonly baseUrl;
|
|
9
|
+
constructor(httpRequest: IHttpRequest);
|
|
10
|
+
getByDirectory(directoryId: string): Promise<StandardResponse<KycByDirectoryResponse>>;
|
|
11
|
+
}
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
|
|
2
|
+
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
3
|
+
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
|
4
|
+
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;
|
|
5
|
+
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
6
|
+
};
|
|
7
|
+
var __metadata = (this && this.__metadata) || function (k, v) {
|
|
8
|
+
if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
|
|
9
|
+
};
|
|
10
|
+
var __param = (this && this.__param) || function (paramIndex, decorator) {
|
|
11
|
+
return function (target, key) { decorator(target, key, paramIndex); }
|
|
12
|
+
};
|
|
13
|
+
import { inject, injectable } from "inversify";
|
|
14
|
+
/** Contrato y semántica completos → `IKycVerificationsBusinessApi` (`StandardResponse` → leer `result.data`). */
|
|
15
|
+
let KycVerificationsBusinessApi = class KycVerificationsBusinessApi {
|
|
16
|
+
httpRequest;
|
|
17
|
+
// El buildspec publica la URL en SSM con "/" final — se normaliza para no armar "//private"
|
|
18
|
+
// ni, si alguien limpia ese valor en SSM, un "...localprivate/..." sin slash.
|
|
19
|
+
baseUrl = (process.env.KYC_VERIFICATIONS_BUSINESS_URL || "").replace(/\/+$/, "");
|
|
20
|
+
constructor(httpRequest) {
|
|
21
|
+
this.httpRequest = httpRequest;
|
|
22
|
+
}
|
|
23
|
+
async getByDirectory(directoryId) {
|
|
24
|
+
// ⚠️ El endpoint del otro lado TODAVÍA NO EXISTE — lo construye el Plan 2 del KYC de
|
|
25
|
+
// SureKeep F2. Este client se escribe contra el contrato del spec; si el Plan 2 cambia
|
|
26
|
+
// la ruta o el shape, hay que sincronizar ambos lados en el mismo turno.
|
|
27
|
+
const url = `${this.baseUrl}/private/verifications/by-directory/${encodeURIComponent(directoryId)}`;
|
|
28
|
+
return await this.httpRequest.get(url);
|
|
29
|
+
}
|
|
30
|
+
};
|
|
31
|
+
KycVerificationsBusinessApi = __decorate([
|
|
32
|
+
injectable(),
|
|
33
|
+
__param(0, inject("IHttpRequest")),
|
|
34
|
+
__metadata("design:paramtypes", [Object])
|
|
35
|
+
], KycVerificationsBusinessApi);
|
|
36
|
+
export { KycVerificationsBusinessApi };
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
import type { StandardResponse } from "@fiado/gateway-adapter";
|
|
2
|
+
import type { KycByDirectoryResponse } from "@fiado/type-kit/bin/kyc/index.js";
|
|
3
|
+
/**
|
|
4
|
+
* Publisher del privado de `kyc-verifications-business`.
|
|
5
|
+
*
|
|
6
|
+
* Devuelve `StandardResponse<T>` → leer `result.data`, igual que el resto de los módulos
|
|
7
|
+
* de SureKeep F2 (`retailCustomer`, `retailCatalog`, `loanCredit`, …). NO uses
|
|
8
|
+
* `FiadoApiResponse`: los dos tipos NO son intercambiables en TypeScript
|
|
9
|
+
* (`code`/`date` admiten `null` en uno y no en el otro).
|
|
10
|
+
*
|
|
11
|
+
* Env var requerida en el consumer: `KYC_VERIFICATIONS_BUSINESS_URL`.
|
|
12
|
+
* El template.yml del consumer la setea con:
|
|
13
|
+
*
|
|
14
|
+
* KYC_VERIFICATIONS_BUSINESS_URL: '{{resolve:ssm:kyc-verifications-business}}'
|
|
15
|
+
*
|
|
16
|
+
* El endpoint es GLOBAL: se lee por `directoryId`, que ya es global en Fiado.
|
|
17
|
+
* NO lleva parámetro de tenant (ni `?tenantId=` ni header `x-tenant-issuer`).
|
|
18
|
+
*
|
|
19
|
+
* ⚠️ La respuesta lleva PII (CURP y nombre completo en `person`): nunca la loguees ni la
|
|
20
|
+
* expongas en un endpoint de alta frecuencia.
|
|
21
|
+
*/
|
|
22
|
+
export interface IKycVerificationsBusinessApi {
|
|
23
|
+
/**
|
|
24
|
+
* Estado consolidado del KYC de un directorio + estados crudos + datos de persona.
|
|
25
|
+
*
|
|
26
|
+
* ⚠️ Si el directorio NO tiene ninguna verificación, el destino responde **404** —
|
|
27
|
+
* no un cuerpo vacío. El consumidor debe manejar ese caso explícitamente.
|
|
28
|
+
*
|
|
29
|
+
* @throws propaga el error del destino; nunca devuelve fallback.
|
|
30
|
+
*/
|
|
31
|
+
getByDirectory(directoryId: string): Promise<StandardResponse<KycByDirectoryResponse>>;
|
|
32
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
package/bin/kyc/index.js
ADDED
|
@@ -31,6 +31,20 @@ export interface StoreCatalogItem {
|
|
|
31
31
|
imei: string;
|
|
32
32
|
cashPriceCents: number;
|
|
33
33
|
available: boolean;
|
|
34
|
+
/** Marca comercial (p. ej. "Apple"). */
|
|
35
|
+
brand: string;
|
|
36
|
+
/** Modelo (p. ej. "iPhone 15 Pro"). */
|
|
37
|
+
model: string;
|
|
38
|
+
/** Capacidad de almacenamiento (p. ej. "128GB"). */
|
|
39
|
+
capacity: string;
|
|
40
|
+
/** Color comercial (p. ej. "Black"). */
|
|
41
|
+
color: string;
|
|
42
|
+
/** Imagen del producto; `null` si no tiene una cargada. */
|
|
43
|
+
imageUrl: string | null;
|
|
44
|
+
/** Gama del producto (PREMIUM/HIGH/…); el consumidor decide si la usa para ordenar. */
|
|
45
|
+
tier: string;
|
|
46
|
+
/** Financieras alternativas habilitadas (derivación externa, paso 04 del wizard). */
|
|
47
|
+
eligibleFinanciers: string[];
|
|
34
48
|
}
|
|
35
49
|
/** Resultado de la reserva (espeja `ReserveInventoryResponse` del destino). */
|
|
36
50
|
export interface ReserveInventoryResult {
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { IHttpRequest } from "@fiado/http-client";
|
|
2
|
+
import { StandardResponse } from "@fiado/gateway-adapter";
|
|
3
|
+
import { CreateShortLinkRequest, CreateShortLinkResponse } from "@fiado/type-kit/bin/shortlink/index.js";
|
|
4
|
+
import { IShortlinkBusinessApi } from "./interfaces/IShortlinkBusinessApi.js";
|
|
5
|
+
export default class ShortlinkBusinessApi implements IShortlinkBusinessApi {
|
|
6
|
+
private httpRequest;
|
|
7
|
+
private readonly baseUrl;
|
|
8
|
+
constructor(httpRequest: IHttpRequest);
|
|
9
|
+
createLink(payload: CreateShortLinkRequest): Promise<StandardResponse<CreateShortLinkResponse>>;
|
|
10
|
+
}
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
|
|
2
|
+
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
3
|
+
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
|
4
|
+
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;
|
|
5
|
+
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
6
|
+
};
|
|
7
|
+
var __metadata = (this && this.__metadata) || function (k, v) {
|
|
8
|
+
if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
|
|
9
|
+
};
|
|
10
|
+
var __param = (this && this.__param) || function (paramIndex, decorator) {
|
|
11
|
+
return function (target, key) { decorator(target, key, paramIndex); }
|
|
12
|
+
};
|
|
13
|
+
import { inject, injectable } from "inversify";
|
|
14
|
+
let ShortlinkBusinessApi = class ShortlinkBusinessApi {
|
|
15
|
+
httpRequest;
|
|
16
|
+
// La SSM `shortlink-business` apunta a la API PRIVADA (VPC-only). Se limpian las barras
|
|
17
|
+
// finales porque el buildspec publica la URL terminada en `/v1/`.
|
|
18
|
+
baseUrl = (process.env.SHORTLINK_BUSINESS_URL || "").replace(/\/+$/, "");
|
|
19
|
+
constructor(httpRequest) {
|
|
20
|
+
this.httpRequest = httpRequest;
|
|
21
|
+
}
|
|
22
|
+
async createLink(payload) {
|
|
23
|
+
const url = `${this.baseUrl}/private/links`;
|
|
24
|
+
return await this.httpRequest.post(url, payload);
|
|
25
|
+
}
|
|
26
|
+
};
|
|
27
|
+
ShortlinkBusinessApi = __decorate([
|
|
28
|
+
injectable(),
|
|
29
|
+
__param(0, inject("IHttpRequest")),
|
|
30
|
+
__metadata("design:paramtypes", [Object])
|
|
31
|
+
], ShortlinkBusinessApi);
|
|
32
|
+
export default ShortlinkBusinessApi;
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
import { StandardResponse } from "@fiado/gateway-adapter";
|
|
2
|
+
import { CreateShortLinkRequest, CreateShortLinkResponse } from "@fiado/type-kit/bin/shortlink/index.js";
|
|
3
|
+
/**
|
|
4
|
+
* Contrato del publisher HTTP del lambda `shortlink-business` para su endpoint privado
|
|
5
|
+
* de creación de links (service-to-service, VPC-only).
|
|
6
|
+
*
|
|
7
|
+
* Consumidor previsto:
|
|
8
|
+
* - `retail-wizard-business` → QR de instalación de la app (paso 09, D9) y link de KYC
|
|
9
|
+
* en modalidad `CUSTOMER_LINK` (paso 02, QR en tablet o SMS).
|
|
10
|
+
*
|
|
11
|
+
* A diferencia de los clients de retail-customer / retail-catalog, este **NO lleva tenant**:
|
|
12
|
+
* `shortlink-business` es un servicio global de plataforma, no está siloizado por SOFOM.
|
|
13
|
+
*
|
|
14
|
+
* URL: `SHORTLINK_BUSINESS_URL` (SSM `shortlink-business`, que apunta a la API PRIVADA).
|
|
15
|
+
*/
|
|
16
|
+
export interface IShortlinkBusinessApi {
|
|
17
|
+
/**
|
|
18
|
+
* Acorta una URL. Devuelve el código y la URL corta lista para mandar por SMS o pintar como QR.
|
|
19
|
+
*
|
|
20
|
+
* `payload.expireAt` es **obligatorio en la práctica**: va en epoch **segundos** y debe ser
|
|
21
|
+
* futuro. Si falta o ya venció, el destino responde 400 `INVALID_EXPIRE_AT`.
|
|
22
|
+
* `payload.destination` debe ser **HTTPS** o responde 400 `INVALID_DESTINATION_URL`.
|
|
23
|
+
*/
|
|
24
|
+
createLink(payload: CreateShortLinkRequest): Promise<StandardResponse<CreateShortLinkResponse>>;
|
|
25
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@fiado/api-invoker",
|
|
3
|
-
"version": "4.
|
|
3
|
+
"version": "4.75.0",
|
|
4
4
|
"description": "Sirve como un puente entre diferentes funciones lambda, facilitando la comunicación entre ellas a través de invocaciones http",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "bin/index.js",
|
|
@@ -34,7 +34,7 @@
|
|
|
34
34
|
"@fiado/gateway-adapter": "^3.9.0",
|
|
35
35
|
"@fiado/http-client": "^2.0.1",
|
|
36
36
|
"@fiado/logger": "^1.1.3",
|
|
37
|
-
"@fiado/type-kit": "^3.
|
|
37
|
+
"@fiado/type-kit": "^3.202.0",
|
|
38
38
|
"dotenv": "^16.4.7"
|
|
39
39
|
},
|
|
40
40
|
"peerDependencies": {
|
|
@@ -1,7 +1,8 @@
|
|
|
1
1
|
import { inject, injectable } from "inversify";
|
|
2
|
-
import { IHttpRequest } from "@fiado/http-client";
|
|
2
|
+
import type { IHttpRequest } from "@fiado/http-client";
|
|
3
3
|
import dotenv from 'dotenv';
|
|
4
|
-
import { IAuthBusinessApi } from "./interfaces/IAuthBusinessApi.js";
|
|
4
|
+
import type { IAuthBusinessApi } from "./interfaces/IAuthBusinessApi.js";
|
|
5
|
+
import type { SignUpProspectRequest, SignUpProspectResponse } from "@fiado/type-kit/bin/auth/index.js";
|
|
5
6
|
type FiadoApiResponse<T> = import("@fiado/type-kit/bin/apiResponse/dtos/FiadoApiResponse.js").default<T>;
|
|
6
7
|
|
|
7
8
|
dotenv.config();
|
|
@@ -9,12 +10,23 @@ dotenv.config();
|
|
|
9
10
|
@injectable()
|
|
10
11
|
export class AuthBusinessApi implements IAuthBusinessApi {
|
|
11
12
|
|
|
12
|
-
|
|
13
|
+
// El buildspec publica la URL en SSM con "/" final — se normaliza para no armar "//private"
|
|
14
|
+
// ni, si alguien limpia ese valor en SSM, un "...localprivate/..." sin slash.
|
|
15
|
+
private readonly baseUrl = (process.env.AUTH_BUSINESS_LAMBDA_URL || "").replace(/\/+$/, "");
|
|
13
16
|
|
|
14
17
|
constructor(@inject("IHttpRequest") private httpRequest: IHttpRequest) { }
|
|
15
18
|
|
|
16
19
|
async deleteByDirectoryId(directoryId: string): Promise<FiadoApiResponse<{ deletedCount: number }>> {
|
|
17
|
-
const url = `${this.baseUrl}private/directory/${directoryId}`;
|
|
20
|
+
const url = `${this.baseUrl}/private/directory/${directoryId}`;
|
|
18
21
|
return await this.httpRequest.delete<FiadoApiResponse<{ deletedCount: number }>>(url);
|
|
19
22
|
}
|
|
23
|
+
|
|
24
|
+
async signUpProspect(request: SignUpProspectRequest): Promise<FiadoApiResponse<SignUpProspectResponse>> {
|
|
25
|
+
// ⚠️ Ruta PROPUESTA, no confirmada: esta es la primera operación privada de `auth-business`
|
|
26
|
+
// (su openapi/private.yaml está vacío y su PrivateController es una clase vacía). Podría
|
|
27
|
+
// terminar resolviéndose por el estilo `POST /` + header `operationName` que usan los otros
|
|
28
|
+
// clientes de auth. Se confirma con el equipo dueño al construir el endpoint.
|
|
29
|
+
const url = `${this.baseUrl}/private/signup-prospect`;
|
|
30
|
+
return await this.httpRequest.post<FiadoApiResponse<SignUpProspectResponse>>(url, request);
|
|
31
|
+
}
|
|
20
32
|
}
|
|
@@ -1,3 +1,5 @@
|
|
|
1
|
+
import type { SignUpProspectRequest, SignUpProspectResponse } from "@fiado/type-kit/bin/auth/index.js";
|
|
2
|
+
|
|
1
3
|
type FiadoApiResponse<T> = import("@fiado/type-kit/bin/apiResponse/dtos/FiadoApiResponse.js").default<T>;
|
|
2
4
|
|
|
3
5
|
/**
|
|
@@ -12,4 +14,19 @@ export interface IAuthBusinessApi {
|
|
|
12
14
|
*/
|
|
13
15
|
// TODO(type-kit): swap a Directory.DeleteByDirectoryResponse cuando se publique
|
|
14
16
|
deleteByDirectoryId(directoryId: string): Promise<FiadoApiResponse<{ deletedCount: number }>>;
|
|
17
|
+
|
|
18
|
+
/**
|
|
19
|
+
* Alta M2M de prospecto: crea (o reusa) onboarding + People + DirectoryUser y devuelve
|
|
20
|
+
* la identidad Fiado. Lo usa el paso 01d del wizard de SureKeep.
|
|
21
|
+
*
|
|
22
|
+
* `tenantId` es explícito — la variante de agente lo tiene hardcodeado a FIADO_BETA.
|
|
23
|
+
*
|
|
24
|
+
* ⚠️ NO es idempotente del lado del destino: el consumidor DEBE hacer lookup por teléfono
|
|
25
|
+
* antes de llamar, o creará People duplicados (el `peopleId` se regenera en cada llamada).
|
|
26
|
+
*
|
|
27
|
+
* ⚠️ PII: el request lleva nombre y teléfono — nunca loguees el payload completo.
|
|
28
|
+
*
|
|
29
|
+
* @throws propaga el error del destino; nunca devuelve fallback.
|
|
30
|
+
*/
|
|
31
|
+
signUpProspect(request: SignUpProspectRequest): Promise<FiadoApiResponse<SignUpProspectResponse>>;
|
|
15
32
|
}
|
package/src/container.config.ts
CHANGED
|
@@ -185,6 +185,8 @@ import { IPerformanceProfileApi, PerformanceProfileApi } from "./performance-pro
|
|
|
185
185
|
import { IAuthBusinessApi, AuthBusinessApi } from "./auth-business/index.js";
|
|
186
186
|
import { IPresenceWebsocketApi, PresenceWebsocketApi } from "./presence-websocket/index.js";
|
|
187
187
|
import { INotificationWebsocketApi, NotificationWebsocketApi } from "./notificationWebsockets/index.js";
|
|
188
|
+
// KYC verifications business — lectura confirmatoria server-side del KYC por directoryId (SureKeep F2)
|
|
189
|
+
import { IKycVerificationsBusinessApi, KycVerificationsBusinessApi } from "./kyc/index.js";
|
|
188
190
|
|
|
189
191
|
export const apiInvokerBindings = new ContainerModule(({ bind }) => {
|
|
190
192
|
// UTILS bindings
|
|
@@ -346,4 +348,8 @@ export const apiInvokerBindings = new ContainerModule(({ bind }) => {
|
|
|
346
348
|
bind<IAuthBusinessApi>("IAuthBusinessApi").to(AuthBusinessApi);
|
|
347
349
|
bind<IPresenceWebsocketApi>("IPresenceWebsocketApi").to(PresenceWebsocketApi);
|
|
348
350
|
bind<INotificationWebsocketApi>("INotificationWebsocketApi").to(NotificationWebsocketApi);
|
|
351
|
+
|
|
352
|
+
// KYC verifications business — lectura confirmatoria server-side del KYC por directoryId.
|
|
353
|
+
// La consume el wizard de SureKeep F2 tras el aviso async del stream de `KycVerifications`.
|
|
354
|
+
bind<IKycVerificationsBusinessApi>("IKycVerificationsBusinessApi").to(KycVerificationsBusinessApi);
|
|
349
355
|
});
|
package/src/index.ts
CHANGED
|
@@ -81,6 +81,7 @@ export * from "./retailOrg/index.js";
|
|
|
81
81
|
export * from "./retailCustomer/index.js";
|
|
82
82
|
export * from "./retailCatalog/index.js";
|
|
83
83
|
export * from "./retailCards/index.js";
|
|
84
|
+
export * from "./shortlink/index.js";
|
|
84
85
|
export * from "./loanConfig/index.js";
|
|
85
86
|
export * from "./loanOfferings/index.js";
|
|
86
87
|
export * from "./loanCollectorAssignment/index.js";
|
|
@@ -102,3 +103,4 @@ export * from "./membership/index.js";
|
|
|
102
103
|
export * from "./performance-profile/index.js";
|
|
103
104
|
export * from "./auth-business/index.js";
|
|
104
105
|
export * from "./presence-websocket/index.js";
|
|
106
|
+
export * from "./kyc/index.js";
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
import { inject, injectable } from "inversify";
|
|
2
|
+
import type { StandardResponse } from "@fiado/gateway-adapter";
|
|
3
|
+
import type { IHttpRequest } from "@fiado/http-client";
|
|
4
|
+
import type { KycByDirectoryResponse } from "@fiado/type-kit/bin/kyc/index.js";
|
|
5
|
+
import type { IKycVerificationsBusinessApi } from "./interfaces/IKycVerificationsBusinessApi.js";
|
|
6
|
+
|
|
7
|
+
/** Contrato y semántica completos → `IKycVerificationsBusinessApi` (`StandardResponse` → leer `result.data`). */
|
|
8
|
+
@injectable()
|
|
9
|
+
export class KycVerificationsBusinessApi implements IKycVerificationsBusinessApi {
|
|
10
|
+
|
|
11
|
+
// El buildspec publica la URL en SSM con "/" final — se normaliza para no armar "//private"
|
|
12
|
+
// ni, si alguien limpia ese valor en SSM, un "...localprivate/..." sin slash.
|
|
13
|
+
private readonly baseUrl = (process.env.KYC_VERIFICATIONS_BUSINESS_URL || "").replace(/\/+$/, "");
|
|
14
|
+
|
|
15
|
+
constructor(@inject("IHttpRequest") private httpRequest: IHttpRequest) { }
|
|
16
|
+
|
|
17
|
+
async getByDirectory(directoryId: string): Promise<StandardResponse<KycByDirectoryResponse>> {
|
|
18
|
+
// ⚠️ El endpoint del otro lado TODAVÍA NO EXISTE — lo construye el Plan 2 del KYC de
|
|
19
|
+
// SureKeep F2. Este client se escribe contra el contrato del spec; si el Plan 2 cambia
|
|
20
|
+
// la ruta o el shape, hay que sincronizar ambos lados en el mismo turno.
|
|
21
|
+
const url = `${this.baseUrl}/private/verifications/by-directory/${encodeURIComponent(directoryId)}`;
|
|
22
|
+
return await this.httpRequest.get<StandardResponse<KycByDirectoryResponse>>(url);
|
|
23
|
+
}
|
|
24
|
+
}
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
import type { StandardResponse } from "@fiado/gateway-adapter";
|
|
2
|
+
import type { KycByDirectoryResponse } from "@fiado/type-kit/bin/kyc/index.js";
|
|
3
|
+
|
|
4
|
+
/**
|
|
5
|
+
* Publisher del privado de `kyc-verifications-business`.
|
|
6
|
+
*
|
|
7
|
+
* Devuelve `StandardResponse<T>` → leer `result.data`, igual que el resto de los módulos
|
|
8
|
+
* de SureKeep F2 (`retailCustomer`, `retailCatalog`, `loanCredit`, …). NO uses
|
|
9
|
+
* `FiadoApiResponse`: los dos tipos NO son intercambiables en TypeScript
|
|
10
|
+
* (`code`/`date` admiten `null` en uno y no en el otro).
|
|
11
|
+
*
|
|
12
|
+
* Env var requerida en el consumer: `KYC_VERIFICATIONS_BUSINESS_URL`.
|
|
13
|
+
* El template.yml del consumer la setea con:
|
|
14
|
+
*
|
|
15
|
+
* KYC_VERIFICATIONS_BUSINESS_URL: '{{resolve:ssm:kyc-verifications-business}}'
|
|
16
|
+
*
|
|
17
|
+
* El endpoint es GLOBAL: se lee por `directoryId`, que ya es global en Fiado.
|
|
18
|
+
* NO lleva parámetro de tenant (ni `?tenantId=` ni header `x-tenant-issuer`).
|
|
19
|
+
*
|
|
20
|
+
* ⚠️ La respuesta lleva PII (CURP y nombre completo en `person`): nunca la loguees ni la
|
|
21
|
+
* expongas en un endpoint de alta frecuencia.
|
|
22
|
+
*/
|
|
23
|
+
export interface IKycVerificationsBusinessApi {
|
|
24
|
+
/**
|
|
25
|
+
* Estado consolidado del KYC de un directorio + estados crudos + datos de persona.
|
|
26
|
+
*
|
|
27
|
+
* ⚠️ Si el directorio NO tiene ninguna verificación, el destino responde **404** —
|
|
28
|
+
* no un cuerpo vacío. El consumidor debe manejar ese caso explícitamente.
|
|
29
|
+
*
|
|
30
|
+
* @throws propaga el error del destino; nunca devuelve fallback.
|
|
31
|
+
*/
|
|
32
|
+
getByDirectory(directoryId: string): Promise<StandardResponse<KycByDirectoryResponse>>;
|
|
33
|
+
}
|
package/src/kyc/index.ts
ADDED
|
@@ -33,6 +33,23 @@ export interface StoreCatalogItem {
|
|
|
33
33
|
imei: string;
|
|
34
34
|
cashPriceCents: number;
|
|
35
35
|
available: boolean;
|
|
36
|
+
// Atributos del producto (2026-07-21, MINOR aditivo). El consumidor real —el paso 03 del wizard—
|
|
37
|
+
// pinta TARJETAS DE PRODUCTO: sin marca/modelo/capacidad el catálogo es inusable en la UI. El
|
|
38
|
+
// destino ya cargaba el producto completo para su join anti-N+1, así que no cuesta I/O extra.
|
|
39
|
+
/** Marca comercial (p. ej. "Apple"). */
|
|
40
|
+
brand: string;
|
|
41
|
+
/** Modelo (p. ej. "iPhone 15 Pro"). */
|
|
42
|
+
model: string;
|
|
43
|
+
/** Capacidad de almacenamiento (p. ej. "128GB"). */
|
|
44
|
+
capacity: string;
|
|
45
|
+
/** Color comercial (p. ej. "Black"). */
|
|
46
|
+
color: string;
|
|
47
|
+
/** Imagen del producto; `null` si no tiene una cargada. */
|
|
48
|
+
imageUrl: string | null;
|
|
49
|
+
/** Gama del producto (PREMIUM/HIGH/…); el consumidor decide si la usa para ordenar. */
|
|
50
|
+
tier: string;
|
|
51
|
+
/** Financieras alternativas habilitadas (derivación externa, paso 04 del wizard). */
|
|
52
|
+
eligibleFinanciers: string[];
|
|
36
53
|
}
|
|
37
54
|
|
|
38
55
|
/** Resultado de la reserva (espeja `ReserveInventoryResponse` del destino). */
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
import { inject, injectable } from "inversify";
|
|
2
|
+
import { IHttpRequest } from "@fiado/http-client";
|
|
3
|
+
import { StandardResponse } from "@fiado/gateway-adapter";
|
|
4
|
+
import {
|
|
5
|
+
CreateShortLinkRequest,
|
|
6
|
+
CreateShortLinkResponse,
|
|
7
|
+
} from "@fiado/type-kit/bin/shortlink/index.js";
|
|
8
|
+
import { IShortlinkBusinessApi } from "./interfaces/IShortlinkBusinessApi.js";
|
|
9
|
+
|
|
10
|
+
@injectable()
|
|
11
|
+
export default class ShortlinkBusinessApi implements IShortlinkBusinessApi {
|
|
12
|
+
// La SSM `shortlink-business` apunta a la API PRIVADA (VPC-only). Se limpian las barras
|
|
13
|
+
// finales porque el buildspec publica la URL terminada en `/v1/`.
|
|
14
|
+
private readonly baseUrl = (process.env.SHORTLINK_BUSINESS_URL || "").replace(/\/+$/, "");
|
|
15
|
+
|
|
16
|
+
constructor(@inject("IHttpRequest") private httpRequest: IHttpRequest) {}
|
|
17
|
+
|
|
18
|
+
async createLink(
|
|
19
|
+
payload: CreateShortLinkRequest,
|
|
20
|
+
): Promise<StandardResponse<CreateShortLinkResponse>> {
|
|
21
|
+
const url = `${this.baseUrl}/private/links`;
|
|
22
|
+
return await this.httpRequest.post(url, payload);
|
|
23
|
+
}
|
|
24
|
+
}
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
import { StandardResponse } from "@fiado/gateway-adapter";
|
|
2
|
+
import {
|
|
3
|
+
CreateShortLinkRequest,
|
|
4
|
+
CreateShortLinkResponse,
|
|
5
|
+
} from "@fiado/type-kit/bin/shortlink/index.js";
|
|
6
|
+
|
|
7
|
+
/**
|
|
8
|
+
* Contrato del publisher HTTP del lambda `shortlink-business` para su endpoint privado
|
|
9
|
+
* de creación de links (service-to-service, VPC-only).
|
|
10
|
+
*
|
|
11
|
+
* Consumidor previsto:
|
|
12
|
+
* - `retail-wizard-business` → QR de instalación de la app (paso 09, D9) y link de KYC
|
|
13
|
+
* en modalidad `CUSTOMER_LINK` (paso 02, QR en tablet o SMS).
|
|
14
|
+
*
|
|
15
|
+
* A diferencia de los clients de retail-customer / retail-catalog, este **NO lleva tenant**:
|
|
16
|
+
* `shortlink-business` es un servicio global de plataforma, no está siloizado por SOFOM.
|
|
17
|
+
*
|
|
18
|
+
* URL: `SHORTLINK_BUSINESS_URL` (SSM `shortlink-business`, que apunta a la API PRIVADA).
|
|
19
|
+
*/
|
|
20
|
+
export interface IShortlinkBusinessApi {
|
|
21
|
+
/**
|
|
22
|
+
* Acorta una URL. Devuelve el código y la URL corta lista para mandar por SMS o pintar como QR.
|
|
23
|
+
*
|
|
24
|
+
* `payload.expireAt` es **obligatorio en la práctica**: va en epoch **segundos** y debe ser
|
|
25
|
+
* futuro. Si falta o ya venció, el destino responde 400 `INVALID_EXPIRE_AT`.
|
|
26
|
+
* `payload.destination` debe ser **HTTPS** o responde 400 `INVALID_DESTINATION_URL`.
|
|
27
|
+
*/
|
|
28
|
+
createLink(payload: CreateShortLinkRequest): Promise<StandardResponse<CreateShortLinkResponse>>;
|
|
29
|
+
}
|