@fiado/api-invoker 4.78.0 → 5.0.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/credit-engine/CreditEngineApi.js +9 -2
- package/bin/credit-engine/interfaces/ICreditEngineApi.d.ts +9 -0
- package/bin/kyc/api/KycVerificationsBusinessApi.js +5 -4
- package/package.json +1 -1
- package/src/credit-engine/CreditEngineApi.ts +10 -2
- package/src/credit-engine/interfaces/ICreditEngineApi.ts +9 -0
- package/src/kyc/api/KycVerificationsBusinessApi.ts +5 -4
|
@@ -29,11 +29,18 @@ let CreditEngineApi = class CreditEngineApi {
|
|
|
29
29
|
}
|
|
30
30
|
async getCreditProfile(directoryId, partnerId) {
|
|
31
31
|
const url = `${this.baseUrl}credit/profile/${directoryId}`;
|
|
32
|
-
|
|
32
|
+
// El endpoint devuelve el envelope de `ApiResponse.createResponse`
|
|
33
|
+
// (`@fiado/gateway-adapter`): { code, date, data, description, msg }.
|
|
34
|
+
// Desenvolvemos acá para que el consumer reciba el objeto de dominio
|
|
35
|
+
// directo — ver docs/TECH_DEBT.md TD-002 en benefits-marketplace-business.
|
|
36
|
+
const envelope = await this.httpRequest.get(url, { partnerId }, { operationName: "getCreditProfile" });
|
|
37
|
+
return envelope.data;
|
|
33
38
|
}
|
|
34
39
|
async getActiveCredit(directoryId) {
|
|
35
40
|
const url = `${this.baseUrl}credit/active/${directoryId}`;
|
|
36
|
-
|
|
41
|
+
// Mismo envelope que getCreditProfile — desenvolvemos `.data` acá.
|
|
42
|
+
const envelope = await this.httpRequest.get(url, undefined, { operationName: "getActiveCredit" });
|
|
43
|
+
return envelope.data;
|
|
37
44
|
}
|
|
38
45
|
async enrichDirectories(directoryIds) {
|
|
39
46
|
const url = `${this.baseUrl}credit/private/enrich-directories`;
|
|
@@ -18,6 +18,12 @@ export interface ICreditEngineApi {
|
|
|
18
18
|
* Obtiene el perfil financiero del directorio para un partner específico.
|
|
19
19
|
* Endpoint: `GET /credit/profile/{directoryId}?partnerId={partnerId}`
|
|
20
20
|
*
|
|
21
|
+
* El envelope HTTP (`{code, date, data, description, msg}` de
|
|
22
|
+
* `ApiResponse.createResponse`) se desenvuelve internamente — este método
|
|
23
|
+
* devuelve el objeto de dominio directo, el consumer NUNCA debe leer
|
|
24
|
+
* `.data` manualmente (ver docs/TECH_DEBT.md TD-002 en
|
|
25
|
+
* benefits-marketplace-business, resuelto en la raíz por este cambio).
|
|
26
|
+
*
|
|
21
27
|
* @param directoryId ID del directorio del usuario.
|
|
22
28
|
* @param partnerId ID del partner (tenant) del perfil a consultar.
|
|
23
29
|
*/
|
|
@@ -26,6 +32,9 @@ export interface ICreditEngineApi {
|
|
|
26
32
|
* Obtiene el crédito activo del cliente, si existe.
|
|
27
33
|
* Endpoint: `GET /credit/active/{directoryId}`
|
|
28
34
|
*
|
|
35
|
+
* El envelope HTTP se desenvuelve internamente (mismo criterio que
|
|
36
|
+
* `getCreditProfile`) — el consumer recibe el objeto de dominio directo.
|
|
37
|
+
*
|
|
29
38
|
* @param directoryId ID del directorio del usuario.
|
|
30
39
|
* @returns Detalle del crédito activo, o `null` si no hay crédito activo.
|
|
31
40
|
*/
|
|
@@ -21,10 +21,11 @@ let KycVerificationsBusinessApi = class KycVerificationsBusinessApi {
|
|
|
21
21
|
this.httpRequest = httpRequest;
|
|
22
22
|
}
|
|
23
23
|
async getByDirectory(directoryId) {
|
|
24
|
-
// ⚠️
|
|
25
|
-
//
|
|
26
|
-
//
|
|
27
|
-
|
|
24
|
+
// ⚠️ SIN prefijo `/private`: la API de `kyc-verifications-business` que resuelve el SSM
|
|
25
|
+
// es PRIVADA COMPLETA (`Type: PRIVATE`, VPC-only), así que sus paths no lo llevan.
|
|
26
|
+
// Verificado contra los recursos desplegados en dev: `/`, `/verifications`,
|
|
27
|
+
// `/{verificationId}`. La 4.75.0 salió con un `/private` de más y daba 404.
|
|
28
|
+
const url = `${this.baseUrl}/verifications/by-directory/${encodeURIComponent(directoryId)}`;
|
|
28
29
|
return await this.httpRequest.get(url);
|
|
29
30
|
}
|
|
30
31
|
};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@fiado/api-invoker",
|
|
3
|
-
"version": "
|
|
3
|
+
"version": "5.0.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",
|
|
@@ -4,6 +4,7 @@ import { IHttpRequest } from "@fiado/http-client";
|
|
|
4
4
|
import { ICreditEngineApi } from "./interfaces/ICreditEngineApi.js";
|
|
5
5
|
import { CreditProfileResponse } from "@fiado/type-kit/bin/credit/dtos/internal/CreditProfileResponse.js";
|
|
6
6
|
import { CreditDetailResponse } from "@fiado/type-kit/bin/creditEngine/index.js";
|
|
7
|
+
type FiadoApiResponse<T> = import("@fiado/type-kit/bin/apiResponse/dtos/FiadoApiResponse.js").default<T>;
|
|
7
8
|
dotenv.config();
|
|
8
9
|
|
|
9
10
|
/**
|
|
@@ -24,20 +25,27 @@ export class CreditEngineApi implements ICreditEngineApi {
|
|
|
24
25
|
|
|
25
26
|
public async getCreditProfile(directoryId: string, partnerId: string): Promise<CreditProfileResponse> {
|
|
26
27
|
const url = `${this.baseUrl}credit/profile/${directoryId}`;
|
|
27
|
-
|
|
28
|
+
// El endpoint devuelve el envelope de `ApiResponse.createResponse`
|
|
29
|
+
// (`@fiado/gateway-adapter`): { code, date, data, description, msg }.
|
|
30
|
+
// Desenvolvemos acá para que el consumer reciba el objeto de dominio
|
|
31
|
+
// directo — ver docs/TECH_DEBT.md TD-002 en benefits-marketplace-business.
|
|
32
|
+
const envelope = await this.httpRequest.get<FiadoApiResponse<CreditProfileResponse>>(
|
|
28
33
|
url,
|
|
29
34
|
{ partnerId },
|
|
30
35
|
{ operationName: "getCreditProfile" },
|
|
31
36
|
);
|
|
37
|
+
return envelope.data;
|
|
32
38
|
}
|
|
33
39
|
|
|
34
40
|
public async getActiveCredit(directoryId: string): Promise<CreditDetailResponse | null> {
|
|
35
41
|
const url = `${this.baseUrl}credit/active/${directoryId}`;
|
|
36
|
-
|
|
42
|
+
// Mismo envelope que getCreditProfile — desenvolvemos `.data` acá.
|
|
43
|
+
const envelope = await this.httpRequest.get<FiadoApiResponse<CreditDetailResponse | null>>(
|
|
37
44
|
url,
|
|
38
45
|
undefined,
|
|
39
46
|
{ operationName: "getActiveCredit" },
|
|
40
47
|
);
|
|
48
|
+
return envelope.data;
|
|
41
49
|
}
|
|
42
50
|
|
|
43
51
|
public async enrichDirectories(directoryIds: string[]): Promise<any> {
|
|
@@ -18,6 +18,12 @@ export interface ICreditEngineApi {
|
|
|
18
18
|
* Obtiene el perfil financiero del directorio para un partner específico.
|
|
19
19
|
* Endpoint: `GET /credit/profile/{directoryId}?partnerId={partnerId}`
|
|
20
20
|
*
|
|
21
|
+
* El envelope HTTP (`{code, date, data, description, msg}` de
|
|
22
|
+
* `ApiResponse.createResponse`) se desenvuelve internamente — este método
|
|
23
|
+
* devuelve el objeto de dominio directo, el consumer NUNCA debe leer
|
|
24
|
+
* `.data` manualmente (ver docs/TECH_DEBT.md TD-002 en
|
|
25
|
+
* benefits-marketplace-business, resuelto en la raíz por este cambio).
|
|
26
|
+
*
|
|
21
27
|
* @param directoryId ID del directorio del usuario.
|
|
22
28
|
* @param partnerId ID del partner (tenant) del perfil a consultar.
|
|
23
29
|
*/
|
|
@@ -27,6 +33,9 @@ export interface ICreditEngineApi {
|
|
|
27
33
|
* Obtiene el crédito activo del cliente, si existe.
|
|
28
34
|
* Endpoint: `GET /credit/active/{directoryId}`
|
|
29
35
|
*
|
|
36
|
+
* El envelope HTTP se desenvuelve internamente (mismo criterio que
|
|
37
|
+
* `getCreditProfile`) — el consumer recibe el objeto de dominio directo.
|
|
38
|
+
*
|
|
30
39
|
* @param directoryId ID del directorio del usuario.
|
|
31
40
|
* @returns Detalle del crédito activo, o `null` si no hay crédito activo.
|
|
32
41
|
*/
|
|
@@ -15,10 +15,11 @@ export class KycVerificationsBusinessApi implements IKycVerificationsBusinessApi
|
|
|
15
15
|
constructor(@inject("IHttpRequest") private httpRequest: IHttpRequest) { }
|
|
16
16
|
|
|
17
17
|
async getByDirectory(directoryId: string): Promise<StandardResponse<KycByDirectoryResponse>> {
|
|
18
|
-
// ⚠️
|
|
19
|
-
//
|
|
20
|
-
//
|
|
21
|
-
|
|
18
|
+
// ⚠️ SIN prefijo `/private`: la API de `kyc-verifications-business` que resuelve el SSM
|
|
19
|
+
// es PRIVADA COMPLETA (`Type: PRIVATE`, VPC-only), así que sus paths no lo llevan.
|
|
20
|
+
// Verificado contra los recursos desplegados en dev: `/`, `/verifications`,
|
|
21
|
+
// `/{verificationId}`. La 4.75.0 salió con un `/private` de más y daba 404.
|
|
22
|
+
const url = `${this.baseUrl}/verifications/by-directory/${encodeURIComponent(directoryId)}`;
|
|
22
23
|
return await this.httpRequest.get<StandardResponse<KycByDirectoryResponse>>(url);
|
|
23
24
|
}
|
|
24
25
|
}
|