@fiado/api-invoker 4.64.0 → 4.65.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/retailOrg/api/RetailOrgBusinessApi.d.ts +4 -3
- package/bin/retailOrg/api/RetailOrgBusinessApi.js +6 -2
- package/bin/retailOrg/api/interfaces/IRetailOrgBusinessApi.d.ts +20 -5
- package/package.json +2 -2
- package/src/retailOrg/api/RetailOrgBusinessApi.ts +11 -2
- package/src/retailOrg/api/interfaces/IRetailOrgBusinessApi.ts +24 -4
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
import type { IHttpRequest } from "@fiado/http-client";
|
|
2
2
|
import { StandardResponse } from "@fiado/gateway-adapter";
|
|
3
|
-
import { RetailerValidationDto, StoreValidationDto, RetailUserValidationDto } from "@fiado/type-kit/bin/retailOrg/index.js";
|
|
3
|
+
import { RetailerValidationDto, StoreValidationDto, RetailUserValidationDto, CollectorValidationDto } from "@fiado/type-kit/bin/retailOrg/index.js";
|
|
4
4
|
import { IRetailOrgBusinessApi } from "./interfaces/IRetailOrgBusinessApi.js";
|
|
5
5
|
/**
|
|
6
|
-
* Publisher HTTP del lambda `retail-org-business` (componente 04 SureKeep Fase 1) para sus
|
|
6
|
+
* Publisher HTTP del lambda `retail-org-business` (componente 04 SureKeep Fase 1) para sus 6
|
|
7
7
|
* endpoints privados de validación. Contrato y semántica completos → `IRetailOrgBusinessApi`.
|
|
8
8
|
*
|
|
9
|
-
* Los
|
|
9
|
+
* Los paths y el `?tenantId=` fueron verificados contra dev (200 + negativos 400/404) el
|
|
10
10
|
* 2026-07-16 y matchean `openapi/private.yaml` del lambda destino.
|
|
11
11
|
*
|
|
12
12
|
* Env var requerida en el consumer: `RETAIL_ORG_BUSINESS_URL`.
|
|
@@ -25,4 +25,5 @@ export default class RetailOrgBusinessApi implements IRetailOrgBusinessApi {
|
|
|
25
25
|
getStore(retailerId: string, storeId: string, tenantId: string): Promise<StandardResponse<StoreValidationDto>>;
|
|
26
26
|
getStoreUsers(retailerId: string, storeId: string, tenantId: string): Promise<StandardResponse<RetailUserValidationDto[]>>;
|
|
27
27
|
getUserByCognitoSub(cognitoSub: string, tenantId: string): Promise<StandardResponse<RetailUserValidationDto>>;
|
|
28
|
+
listActiveCollectorsByRetailer(retailerId: string, tenantId: string): Promise<StandardResponse<CollectorValidationDto[]>>;
|
|
28
29
|
}
|
|
@@ -12,10 +12,10 @@ var __param = (this && this.__param) || function (paramIndex, decorator) {
|
|
|
12
12
|
};
|
|
13
13
|
import { inject, injectable } from "inversify";
|
|
14
14
|
/**
|
|
15
|
-
* Publisher HTTP del lambda `retail-org-business` (componente 04 SureKeep Fase 1) para sus
|
|
15
|
+
* Publisher HTTP del lambda `retail-org-business` (componente 04 SureKeep Fase 1) para sus 6
|
|
16
16
|
* endpoints privados de validación. Contrato y semántica completos → `IRetailOrgBusinessApi`.
|
|
17
17
|
*
|
|
18
|
-
* Los
|
|
18
|
+
* Los paths y el `?tenantId=` fueron verificados contra dev (200 + negativos 400/404) el
|
|
19
19
|
* 2026-07-16 y matchean `openapi/private.yaml` del lambda destino.
|
|
20
20
|
*
|
|
21
21
|
* Env var requerida en el consumer: `RETAIL_ORG_BUSINESS_URL`.
|
|
@@ -51,6 +51,10 @@ let RetailOrgBusinessApi = class RetailOrgBusinessApi {
|
|
|
51
51
|
const url = `${this.baseUrl}/private/users/by-cognito-sub/${encodeURIComponent(cognitoSub)}?tenantId=${encodeURIComponent(tenantId)}`;
|
|
52
52
|
return await this.httpRequest.get(url);
|
|
53
53
|
}
|
|
54
|
+
async listActiveCollectorsByRetailer(retailerId, tenantId) {
|
|
55
|
+
const url = `${this.baseUrl}/private/retailers/${encodeURIComponent(retailerId)}/collectors?tenantId=${encodeURIComponent(tenantId)}`;
|
|
56
|
+
return await this.httpRequest.get(url);
|
|
57
|
+
}
|
|
54
58
|
};
|
|
55
59
|
RetailOrgBusinessApi = __decorate([
|
|
56
60
|
injectable(),
|
|
@@ -1,14 +1,15 @@
|
|
|
1
1
|
import { StandardResponse } from "@fiado/gateway-adapter";
|
|
2
|
-
import { RetailerValidationDto, StoreValidationDto, RetailUserValidationDto } from "@fiado/type-kit/bin/retailOrg/index.js";
|
|
2
|
+
import { RetailerValidationDto, StoreValidationDto, RetailUserValidationDto, CollectorValidationDto } from "@fiado/type-kit/bin/retailOrg/index.js";
|
|
3
3
|
/**
|
|
4
4
|
* Contrato del publisher HTTP del lambda `retail-org-business` (componente 04 SureKeep Fase 1)
|
|
5
|
-
* para sus
|
|
5
|
+
* para sus 6 endpoints privados de VALIDACIÓN (service-to-service, VPC-only).
|
|
6
6
|
*
|
|
7
7
|
* Consumidores previstos (regla R5 — cruces entre lambdas son SOLO lecturas de validación;
|
|
8
8
|
* ningún lambda escribe en tabla ajena):
|
|
9
|
-
* - `retail-catalog-business`
|
|
10
|
-
* - `retail-cards-business`
|
|
11
|
-
* - `loan-*`
|
|
9
|
+
* - `retail-catalog-business` → valida `storeId` al registrar IMEIs
|
|
10
|
+
* - `retail-cards-business` → valida `storeId` de un lote de tarjetas PCF
|
|
11
|
+
* - `loan-*` → valida retailer / store / usuarios retail
|
|
12
|
+
* - `loan-collector-assignment-business` → lista cobradores ACTIVE del retailer para asignar cartera
|
|
12
13
|
*
|
|
13
14
|
* ─────────────────────────────────────────────────────────────────────────────
|
|
14
15
|
* `tenantId` es OBLIGATORIO en los 4 métodos — no es un detalle de firma.
|
|
@@ -87,4 +88,18 @@ export interface IRetailOrgBusinessApi {
|
|
|
87
88
|
* @throws si no hay usuario retail para ese sub (`404 RETAIL_USER_NOT_FOUND`).
|
|
88
89
|
*/
|
|
89
90
|
getUserByCognitoSub(cognitoSub: string, tenantId: string): Promise<StandardResponse<RetailUserValidationDto>>;
|
|
91
|
+
/**
|
|
92
|
+
* GET /private/retailers/{retailerId}/collectors — lista los COBRADORES del retailer que están
|
|
93
|
+
* `status=ACTIVE`. El criterio de "cobrador" lo aplica retail-org por `commissionTier === 'collector'`
|
|
94
|
+
* (el caller no lo declara). Lo consume `loan-collector-assignment-business` para alimentar su
|
|
95
|
+
* algoritmo de asignación de cartera.
|
|
96
|
+
*
|
|
97
|
+
* `tenantId` es OBLIGATORIO (igual que el resto de privados): sin él → `400 UNKNOWN_TENANT`
|
|
98
|
+
* (fail-closed). Nunca hay tenant por default — caer a uno sería fail-OPEN y podría filtrar
|
|
99
|
+
* cobradores de otra SOFOM.
|
|
100
|
+
*
|
|
101
|
+
* Devuelve el body PELADO en `StandardResponse<CollectorValidationDto[]>` (el consumer lee
|
|
102
|
+
* `result.data`, NO `result.body`). Retorna `[]` (no 404) si el retailer no tiene cobradores activos.
|
|
103
|
+
*/
|
|
104
|
+
listActiveCollectorsByRetailer(retailerId: string, tenantId: string): Promise<StandardResponse<CollectorValidationDto[]>>;
|
|
90
105
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@fiado/api-invoker",
|
|
3
|
-
"version": "4.
|
|
3
|
+
"version": "4.65.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.191.0",
|
|
38
38
|
"dotenv": "^16.4.7"
|
|
39
39
|
},
|
|
40
40
|
"peerDependencies": {
|
|
@@ -5,14 +5,15 @@ import {
|
|
|
5
5
|
RetailerValidationDto,
|
|
6
6
|
StoreValidationDto,
|
|
7
7
|
RetailUserValidationDto,
|
|
8
|
+
CollectorValidationDto,
|
|
8
9
|
} from "@fiado/type-kit/bin/retailOrg/index.js";
|
|
9
10
|
import { IRetailOrgBusinessApi } from "./interfaces/IRetailOrgBusinessApi.js";
|
|
10
11
|
|
|
11
12
|
/**
|
|
12
|
-
* Publisher HTTP del lambda `retail-org-business` (componente 04 SureKeep Fase 1) para sus
|
|
13
|
+
* Publisher HTTP del lambda `retail-org-business` (componente 04 SureKeep Fase 1) para sus 6
|
|
13
14
|
* endpoints privados de validación. Contrato y semántica completos → `IRetailOrgBusinessApi`.
|
|
14
15
|
*
|
|
15
|
-
* Los
|
|
16
|
+
* Los paths y el `?tenantId=` fueron verificados contra dev (200 + negativos 400/404) el
|
|
16
17
|
* 2026-07-16 y matchean `openapi/private.yaml` del lambda destino.
|
|
17
18
|
*
|
|
18
19
|
* Env var requerida en el consumer: `RETAIL_ORG_BUSINESS_URL`.
|
|
@@ -69,4 +70,12 @@ export default class RetailOrgBusinessApi implements IRetailOrgBusinessApi {
|
|
|
69
70
|
const url = `${this.baseUrl}/private/users/by-cognito-sub/${encodeURIComponent(cognitoSub)}?tenantId=${encodeURIComponent(tenantId)}`;
|
|
70
71
|
return await this.httpRequest.get(url);
|
|
71
72
|
}
|
|
73
|
+
|
|
74
|
+
async listActiveCollectorsByRetailer(
|
|
75
|
+
retailerId: string,
|
|
76
|
+
tenantId: string,
|
|
77
|
+
): Promise<StandardResponse<CollectorValidationDto[]>> {
|
|
78
|
+
const url = `${this.baseUrl}/private/retailers/${encodeURIComponent(retailerId)}/collectors?tenantId=${encodeURIComponent(tenantId)}`;
|
|
79
|
+
return await this.httpRequest.get(url);
|
|
80
|
+
}
|
|
72
81
|
}
|
|
@@ -3,17 +3,19 @@ import {
|
|
|
3
3
|
RetailerValidationDto,
|
|
4
4
|
StoreValidationDto,
|
|
5
5
|
RetailUserValidationDto,
|
|
6
|
+
CollectorValidationDto,
|
|
6
7
|
} from "@fiado/type-kit/bin/retailOrg/index.js";
|
|
7
8
|
|
|
8
9
|
/**
|
|
9
10
|
* Contrato del publisher HTTP del lambda `retail-org-business` (componente 04 SureKeep Fase 1)
|
|
10
|
-
* para sus
|
|
11
|
+
* para sus 6 endpoints privados de VALIDACIÓN (service-to-service, VPC-only).
|
|
11
12
|
*
|
|
12
13
|
* Consumidores previstos (regla R5 — cruces entre lambdas son SOLO lecturas de validación;
|
|
13
14
|
* ningún lambda escribe en tabla ajena):
|
|
14
|
-
* - `retail-catalog-business`
|
|
15
|
-
* - `retail-cards-business`
|
|
16
|
-
* - `loan-*`
|
|
15
|
+
* - `retail-catalog-business` → valida `storeId` al registrar IMEIs
|
|
16
|
+
* - `retail-cards-business` → valida `storeId` de un lote de tarjetas PCF
|
|
17
|
+
* - `loan-*` → valida retailer / store / usuarios retail
|
|
18
|
+
* - `loan-collector-assignment-business` → lista cobradores ACTIVE del retailer para asignar cartera
|
|
17
19
|
*
|
|
18
20
|
* ─────────────────────────────────────────────────────────────────────────────
|
|
19
21
|
* `tenantId` es OBLIGATORIO en los 4 métodos — no es un detalle de firma.
|
|
@@ -113,4 +115,22 @@ export interface IRetailOrgBusinessApi {
|
|
|
113
115
|
cognitoSub: string,
|
|
114
116
|
tenantId: string,
|
|
115
117
|
): Promise<StandardResponse<RetailUserValidationDto>>;
|
|
118
|
+
|
|
119
|
+
/**
|
|
120
|
+
* GET /private/retailers/{retailerId}/collectors — lista los COBRADORES del retailer que están
|
|
121
|
+
* `status=ACTIVE`. El criterio de "cobrador" lo aplica retail-org por `commissionTier === 'collector'`
|
|
122
|
+
* (el caller no lo declara). Lo consume `loan-collector-assignment-business` para alimentar su
|
|
123
|
+
* algoritmo de asignación de cartera.
|
|
124
|
+
*
|
|
125
|
+
* `tenantId` es OBLIGATORIO (igual que el resto de privados): sin él → `400 UNKNOWN_TENANT`
|
|
126
|
+
* (fail-closed). Nunca hay tenant por default — caer a uno sería fail-OPEN y podría filtrar
|
|
127
|
+
* cobradores de otra SOFOM.
|
|
128
|
+
*
|
|
129
|
+
* Devuelve el body PELADO en `StandardResponse<CollectorValidationDto[]>` (el consumer lee
|
|
130
|
+
* `result.data`, NO `result.body`). Retorna `[]` (no 404) si el retailer no tiene cobradores activos.
|
|
131
|
+
*/
|
|
132
|
+
listActiveCollectorsByRetailer(
|
|
133
|
+
retailerId: string,
|
|
134
|
+
tenantId: string,
|
|
135
|
+
): Promise<StandardResponse<CollectorValidationDto[]>>;
|
|
116
136
|
}
|