@fiado/api-invoker 5.46.0 → 5.48.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/datacultrConnector/api/DatacultrConnectorApi.d.ts +6 -2
- package/bin/datacultrConnector/api/DatacultrConnectorApi.js +12 -0
- package/bin/datacultrConnector/api/interfaces/IDatacultrConnectorApi.d.ts +31 -1
- package/bin/retailCustomer/api/RetailCustomerBusinessApi.d.ts +3 -1
- package/bin/retailCustomer/api/RetailCustomerBusinessApi.js +5 -1
- package/bin/retailCustomer/api/dtos/CustomersBatch.d.ts +23 -0
- package/bin/retailCustomer/api/dtos/CustomersBatch.js +5 -0
- package/bin/retailCustomer/api/interfaces/IRetailCustomerBusinessApi.d.ts +22 -2
- package/bin/retailCustomer/index.d.ts +1 -0
- package/bin/retailCustomer/index.js +1 -0
- package/package.json +1 -1
- package/src/datacultrConnector/api/DatacultrConnectorApi.ts +33 -0
- package/src/datacultrConnector/api/interfaces/IDatacultrConnectorApi.ts +51 -0
- package/src/retailCustomer/api/RetailCustomerBusinessApi.ts +10 -1
- package/src/retailCustomer/api/dtos/CustomersBatch.ts +26 -0
- package/src/retailCustomer/api/interfaces/IRetailCustomerBusinessApi.ts +26 -2
- package/src/retailCustomer/index.ts +1 -0
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import type { IHttpRequest } from "@fiado/http-client";
|
|
2
2
|
import { StandardResponse } from "@fiado/gateway-adapter";
|
|
3
|
-
import { DeviceAutoLockScheduleRequest, DeviceAutoLockScheduleResponse, DeviceEnrollInitiateResponse, DeviceEnrollRequest, DeviceEnrollStatusRequest, DeviceEnrollStatusResponse, DeviceLastSeenRequest, DeviceLastSeenResponse, DeviceLockRequest, DeviceLockResponse, DeviceStatusRequest, DeviceStatusResponse, DeviceUnlockRequest, DeviceUnlockResponse } from "@fiado/type-kit/bin/mdm/index.js";
|
|
4
|
-
import { DeviceBatchRequest, DeviceBatchResult, IDatacultrConnectorApi } from "./interfaces/IDatacultrConnectorApi.js";
|
|
3
|
+
import { DeviceAutoLockScheduleRequest, DeviceAutoLockScheduleResponse, DeviceEnrollInitiateResponse, DeviceEnrollRequest, DeviceEnrollStatusRequest, DeviceEnrollStatusResponse, DeviceLastSeenRequest, DeviceLastSeenResponse, DeviceLockRequest, DeviceLockResponse, DeviceNotifyRequest, DeviceNotifyResponse, DevicePinUnlockRequest, DevicePinUnlockResponse, DeviceReleaseInitiateResponse, DeviceReleaseRequest, DeviceReleaseStatusRequest, DeviceReleaseStatusResponse, DeviceStatusRequest, DeviceStatusResponse, DeviceUnlockRequest, DeviceUnlockResponse } from "@fiado/type-kit/bin/mdm/index.js";
|
|
4
|
+
import { DeviceBatchRequest, DeviceBatchResult, DeviceSingleResult, IDatacultrConnectorApi } from "./interfaces/IDatacultrConnectorApi.js";
|
|
5
5
|
/**
|
|
6
6
|
* Publisher HTTP del lambda `datacultr-connector` (provider MDM de SureKeep). Contrato y semántica
|
|
7
7
|
* completos → `IDatacultrConnectorApi` (paths sin prefijo `/private`, sin tenant, `StandardResponse`
|
|
@@ -25,4 +25,8 @@ export default class DatacultrConnectorApi implements IDatacultrConnectorApi {
|
|
|
25
25
|
lockDevices(input: DeviceBatchRequest<DeviceLockRequest>): Promise<StandardResponse<DeviceBatchResult<DeviceLockResponse>>>;
|
|
26
26
|
unlockDevices(input: DeviceBatchRequest<DeviceUnlockRequest>): Promise<StandardResponse<DeviceBatchResult<DeviceUnlockResponse>>>;
|
|
27
27
|
autoLockSchedule(input: DeviceBatchRequest<DeviceAutoLockScheduleRequest>): Promise<StandardResponse<DeviceBatchResult<DeviceAutoLockScheduleResponse>>>;
|
|
28
|
+
pinUnlock(input: DevicePinUnlockRequest): Promise<StandardResponse<DeviceSingleResult<DevicePinUnlockResponse>>>;
|
|
29
|
+
notifyDevices(input: DeviceBatchRequest<DeviceNotifyRequest>): Promise<StandardResponse<DeviceBatchResult<DeviceNotifyResponse>>>;
|
|
30
|
+
releaseDevices(input: DeviceBatchRequest<DeviceReleaseRequest>): Promise<StandardResponse<DeviceBatchResult<DeviceReleaseInitiateResponse>>>;
|
|
31
|
+
releaseStatus(input: DeviceBatchRequest<DeviceReleaseStatusRequest>): Promise<StandardResponse<DeviceBatchResult<DeviceReleaseStatusResponse>>>;
|
|
28
32
|
}
|
|
@@ -51,6 +51,18 @@ let DatacultrConnectorApi = class DatacultrConnectorApi {
|
|
|
51
51
|
async autoLockSchedule(input) {
|
|
52
52
|
return await this.httpRequest.post(`${this.baseUrl}/devices/auto-lock-schedule`, input);
|
|
53
53
|
}
|
|
54
|
+
async pinUnlock(input) {
|
|
55
|
+
return await this.httpRequest.post(`${this.baseUrl}/devices/pin-unlock`, input);
|
|
56
|
+
}
|
|
57
|
+
async notifyDevices(input) {
|
|
58
|
+
return await this.httpRequest.post(`${this.baseUrl}/devices/notify`, input);
|
|
59
|
+
}
|
|
60
|
+
async releaseDevices(input) {
|
|
61
|
+
return await this.httpRequest.post(`${this.baseUrl}/devices/release`, input);
|
|
62
|
+
}
|
|
63
|
+
async releaseStatus(input) {
|
|
64
|
+
return await this.httpRequest.post(`${this.baseUrl}/devices/release/status`, input);
|
|
65
|
+
}
|
|
54
66
|
};
|
|
55
67
|
DatacultrConnectorApi = __decorate([
|
|
56
68
|
injectable(),
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { StandardResponse } from "@fiado/gateway-adapter";
|
|
2
|
-
import { DeviceAutoLockScheduleRequest, DeviceAutoLockScheduleResponse, DeviceEnrollInitiateResponse, DeviceEnrollRequest, DeviceEnrollStatusRequest, DeviceEnrollStatusResponse, DeviceLastSeenRequest, DeviceLastSeenResponse, DeviceLockRequest, DeviceLockResponse, DeviceStatusRequest, DeviceStatusResponse, DeviceUnlockRequest, DeviceUnlockResponse } from "@fiado/type-kit/bin/mdm/index.js";
|
|
2
|
+
import { DeviceAutoLockScheduleRequest, DeviceAutoLockScheduleResponse, DeviceEnrollInitiateResponse, DeviceEnrollRequest, DeviceEnrollStatusRequest, DeviceEnrollStatusResponse, DeviceLastSeenRequest, DeviceLastSeenResponse, DeviceLockRequest, DeviceLockResponse, DeviceNotifyRequest, DeviceNotifyResponse, DevicePinUnlockRequest, DevicePinUnlockResponse, DeviceReleaseInitiateResponse, DeviceReleaseRequest, DeviceReleaseStatusRequest, DeviceReleaseStatusResponse, DeviceStatusRequest, DeviceStatusResponse, DeviceUnlockRequest, DeviceUnlockResponse } from "@fiado/type-kit/bin/mdm/index.js";
|
|
3
3
|
/**
|
|
4
4
|
* Contrato del publisher HTTP del lambda `datacultr-connector` — el provider MDM que traduce el
|
|
5
5
|
* contrato agnóstico de dispositivo (`@fiado/type-kit/bin/mdm`) a la API de Datacultr. Su consumidor
|
|
@@ -58,6 +58,10 @@ export interface DeviceBatchRequest<TItem> {
|
|
|
58
58
|
export interface DeviceBatchResult<TItem> {
|
|
59
59
|
results: TItem[];
|
|
60
60
|
}
|
|
61
|
+
/** Sobre de salida de los endpoints de UN solo IMEI. Hoy solo `pinUnlock` no es batch. */
|
|
62
|
+
export interface DeviceSingleResult<TItem> {
|
|
63
|
+
result: TItem;
|
|
64
|
+
}
|
|
61
65
|
export interface IDatacultrConnectorApi {
|
|
62
66
|
/**
|
|
63
67
|
* POST `/devices/enroll` — pre-registra la expectativa de enrolamiento de cada IMEI.
|
|
@@ -102,4 +106,30 @@ export interface IDatacultrConnectorApi {
|
|
|
102
106
|
* Es la vía real del bloqueo en Datacultr: el inmediato no surte efecto, el programado sí.
|
|
103
107
|
*/
|
|
104
108
|
autoLockSchedule(input: DeviceBatchRequest<DeviceAutoLockScheduleRequest>): Promise<StandardResponse<DeviceBatchResult<DeviceAutoLockScheduleResponse>>>;
|
|
109
|
+
/**
|
|
110
|
+
* POST `/devices/pin-unlock` — pide a Datacultr el passcode de desbloqueo del equipo.
|
|
111
|
+
*
|
|
112
|
+
* ⚠️ NO ES BATCH, a diferencia del resto del contrato: recibe UN `DevicePinUnlockRequest` y
|
|
113
|
+
* devuelve `{ result }`, no `{ results }`. El destino lo declara así en su `PrivateController`.
|
|
114
|
+
*
|
|
115
|
+
* Es el camino del "desbloqueo especial" del backoffice: el operador le dicta el PIN al cliente
|
|
116
|
+
* que se quedó sin señal. `pin`, `validitySeconds` y `generatedAt` solo vienen con `status`
|
|
117
|
+
* `SUCCESS`; si el proveedor no devolvió passcode, el ítem llega en `ERROR` con su `error.code`.
|
|
118
|
+
*/
|
|
119
|
+
pinUnlock(input: DevicePinUnlockRequest): Promise<StandardResponse<DeviceSingleResult<DevicePinUnlockResponse>>>;
|
|
120
|
+
/**
|
|
121
|
+
* POST `/devices/notify` — manda una notificación al equipo de cada IMEI.
|
|
122
|
+
*
|
|
123
|
+
* ⚠️ `notificationCode` es OBLIGATORIO y sale del catálogo de mensajes predefinidos de Datacultr,
|
|
124
|
+
* que hoy NO tenemos. Sin ese catálogo el caller no puede armar un request válido: pedirlo antes
|
|
125
|
+
* de construir encima.
|
|
126
|
+
*/
|
|
127
|
+
notifyDevices(input: DeviceBatchRequest<DeviceNotifyRequest>): Promise<StandardResponse<DeviceBatchResult<DeviceNotifyResponse>>>;
|
|
128
|
+
/**
|
|
129
|
+
* POST `/devices/release` — libera definitivamente cada IMEI del MDM (crédito liquidado o
|
|
130
|
+
* cancelado). Es asíncrono: el ítem suele volver en `PENDING` y se confirma con `releaseStatus`.
|
|
131
|
+
*/
|
|
132
|
+
releaseDevices(input: DeviceBatchRequest<DeviceReleaseRequest>): Promise<StandardResponse<DeviceBatchResult<DeviceReleaseInitiateResponse>>>;
|
|
133
|
+
/** POST `/devices/release/status` — consulta en qué punto va la liberación de cada IMEI. */
|
|
134
|
+
releaseStatus(input: DeviceBatchRequest<DeviceReleaseStatusRequest>): Promise<StandardResponse<DeviceBatchResult<DeviceReleaseStatusResponse>>>;
|
|
105
135
|
}
|
|
@@ -1,9 +1,10 @@
|
|
|
1
1
|
import type { IHttpRequest } from "@fiado/http-client";
|
|
2
2
|
import { StandardResponse } from "@fiado/gateway-adapter";
|
|
3
3
|
import { UpsertCustomerFromKycRequest, AccountResultRequest, CustomerResponse, WelcomeAccreditationRequest, WelcomeAccreditationResponse, WelcomeAccreditationResultRequest, WelcomeBonusResponse } from "@fiado/type-kit/bin/retailCustomer/index.js";
|
|
4
|
+
import { CustomersBatchRequest, CustomersBatchResponse } from "./dtos/CustomersBatch.js";
|
|
4
5
|
import { IRetailCustomerBusinessApi } from "./interfaces/IRetailCustomerBusinessApi.js";
|
|
5
6
|
/**
|
|
6
|
-
* Publisher HTTP del lambda `retail-customer-business` (SureKeep Fase 2, pista Retail) para sus
|
|
7
|
+
* Publisher HTTP del lambda `retail-customer-business` (SureKeep Fase 2, pista Retail) para sus 7
|
|
7
8
|
* endpoints privados de cliente. Contrato y semántica completos → `IRetailCustomerBusinessApi`.
|
|
8
9
|
*
|
|
9
10
|
* Los paths y el `?tenantId=` matchean `openapi/private.yaml` del lambda destino (mismo patrón que
|
|
@@ -26,4 +27,5 @@ export default class RetailCustomerBusinessApi implements IRetailCustomerBusines
|
|
|
26
27
|
getCustomer(customerId: string, tenantId: string): Promise<StandardResponse<CustomerResponse>>;
|
|
27
28
|
markWelcomeAccredited(customerId: string, tenantId: string, payload?: WelcomeAccreditationRequest): Promise<StandardResponse<WelcomeAccreditationResponse>>;
|
|
28
29
|
setWelcomeAccreditationResult(customerId: string, payload: WelcomeAccreditationResultRequest, tenantId: string): Promise<StandardResponse<WelcomeBonusResponse>>;
|
|
30
|
+
getCustomersBatch(payload: CustomersBatchRequest, tenantId: string): Promise<StandardResponse<CustomersBatchResponse>>;
|
|
29
31
|
}
|
|
@@ -12,7 +12,7 @@ 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-customer-business` (SureKeep Fase 2, pista Retail) para sus
|
|
15
|
+
* Publisher HTTP del lambda `retail-customer-business` (SureKeep Fase 2, pista Retail) para sus 7
|
|
16
16
|
* endpoints privados de cliente. Contrato y semántica completos → `IRetailCustomerBusinessApi`.
|
|
17
17
|
*
|
|
18
18
|
* Los paths y el `?tenantId=` matchean `openapi/private.yaml` del lambda destino (mismo patrón que
|
|
@@ -56,6 +56,10 @@ let RetailCustomerBusinessApi = class RetailCustomerBusinessApi {
|
|
|
56
56
|
const url = `${this.baseUrl}/private/customers/${encodeURIComponent(customerId)}/welcome-accreditation/result?tenantId=${encodeURIComponent(tenantId)}`;
|
|
57
57
|
return await this.httpRequest.put(url, payload);
|
|
58
58
|
}
|
|
59
|
+
async getCustomersBatch(payload, tenantId) {
|
|
60
|
+
const url = `${this.baseUrl}/private/customers/batch?tenantId=${encodeURIComponent(tenantId)}`;
|
|
61
|
+
return await this.httpRequest.post(url, payload);
|
|
62
|
+
}
|
|
59
63
|
};
|
|
60
64
|
RetailCustomerBusinessApi = __decorate([
|
|
61
65
|
injectable(),
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Tipos del lote de nombres de cliente. Viven en esta lib (y no en `@fiado/type-kit`) porque el
|
|
3
|
+
* type-kit todavía no modela esta vista reducida — el lambda destino la tiene como DTO local (TD-029).
|
|
4
|
+
*/
|
|
5
|
+
/** Body de `POST /private/customers/batch`. Hasta 100 ids por request; el caller pagina. */
|
|
6
|
+
export interface CustomersBatchRequest {
|
|
7
|
+
retailCustomerIds: string[];
|
|
8
|
+
}
|
|
9
|
+
/**
|
|
10
|
+
* Lo mínimo para pintar un nombre. `fullName: null` significa que el cliente existe pero no tiene
|
|
11
|
+
* nombre resuelto — es distinto de que el id no vuelva.
|
|
12
|
+
*/
|
|
13
|
+
export interface CustomerBatchItem {
|
|
14
|
+
retailCustomerId: string;
|
|
15
|
+
fullName: string | null;
|
|
16
|
+
}
|
|
17
|
+
/**
|
|
18
|
+
* Los ids que no existen simplemente NO vuelven: `items` puede ser más corto que lo que mandaste.
|
|
19
|
+
* El caller indexa por `retailCustomerId`, nunca aparea por posición.
|
|
20
|
+
*/
|
|
21
|
+
export interface CustomersBatchResponse {
|
|
22
|
+
items: CustomerBatchItem[];
|
|
23
|
+
}
|
|
@@ -1,15 +1,16 @@
|
|
|
1
1
|
import { StandardResponse } from "@fiado/gateway-adapter";
|
|
2
2
|
import { UpsertCustomerFromKycRequest, AccountResultRequest, CustomerResponse, WelcomeAccreditationRequest, WelcomeAccreditationResponse, WelcomeAccreditationResultRequest, WelcomeBonusResponse } from "@fiado/type-kit/bin/retailCustomer/index.js";
|
|
3
|
+
import { CustomersBatchRequest, CustomersBatchResponse } from "../dtos/CustomersBatch.js";
|
|
3
4
|
/**
|
|
4
5
|
* Contrato del publisher HTTP del lambda `retail-customer-business` (SureKeep Fase 2, pista Retail)
|
|
5
|
-
* para sus
|
|
6
|
+
* para sus 7 endpoints privados de cliente (service-to-service, VPC-only).
|
|
6
7
|
*
|
|
7
8
|
* Consumidor previsto:
|
|
8
9
|
* - `retail-wizard-business` → upsert del cliente post-KYC, aterrizaje del resultado de apertura
|
|
9
10
|
* de cuenta (D35), y lecturas del cliente por teléfono / id durante la saga de venta.
|
|
10
11
|
*
|
|
11
12
|
* ─────────────────────────────────────────────────────────────────────────────
|
|
12
|
-
* `tenantId` es OBLIGATORIO en los
|
|
13
|
+
* `tenantId` es OBLIGATORIO en los 7 métodos — no es un detalle de firma.
|
|
13
14
|
* ─────────────────────────────────────────────────────────────────────────────
|
|
14
15
|
* Los privados NO llevan token de usuario (`Feature.ANONIMUS`; la protección es la red VPC), así que
|
|
15
16
|
* el lambda destino no tiene `AuthContext.issuer` y NO puede inferir el silo. El caller declara el
|
|
@@ -114,4 +115,23 @@ export interface IRetailCustomerBusinessApi {
|
|
|
114
115
|
* @throws `400 WELCOME_BONUS_KEY_INVALID` si el `bonusKey` no decodifica (bug del caller).
|
|
115
116
|
*/
|
|
116
117
|
setWelcomeAccreditationResult(customerId: string, payload: WelcomeAccreditationResultRequest, tenantId: string): Promise<StandardResponse<WelcomeBonusResponse>>;
|
|
118
|
+
/**
|
|
119
|
+
* POST /private/customers/batch?tenantId= — resuelve NOMBRES de cliente EN LOTE por sus ids.
|
|
120
|
+
* Pensado para pintar una lista sin caer en N+1 contra el privado de un cliente por vez.
|
|
121
|
+
*
|
|
122
|
+
* ⚠️ Un id que NO existe simplemente no aparece en `items`: el arreglo puede volver más corto que
|
|
123
|
+
* lo que mandaste. Indexa el resultado por `retailCustomerId` — NUNCA aparees por posición.
|
|
124
|
+
* `fullName: null` es otra cosa: el cliente existe y no tiene nombre resuelto.
|
|
125
|
+
*
|
|
126
|
+
* El resultado puede ser PARCIAL si DynamoDB deja claves sin procesar tras sus reintentos: faltan
|
|
127
|
+
* renglones, no explota. Trata la ausencia como «sin nombre», no como error.
|
|
128
|
+
*
|
|
129
|
+
* Tope de 100 ids por request, medido sobre lo que manda el caller (el destino deduplica adentro,
|
|
130
|
+
* pero eso no baja tu cuenta). Lista vacía → `200` con `items: []`, no es error.
|
|
131
|
+
*
|
|
132
|
+
* @throws `400 CUSTOMER_BATCH_TOO_LARGE` si el lote pasa de 100 ids. Reintentar igual vuelve a
|
|
133
|
+
* fallar: hay que paginar.
|
|
134
|
+
* @throws `400 UNKNOWN_TENANT` si el `tenantId` viene ausente o desconocido.
|
|
135
|
+
*/
|
|
136
|
+
getCustomersBatch(payload: CustomersBatchRequest, tenantId: string): Promise<StandardResponse<CustomersBatchResponse>>;
|
|
117
137
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@fiado/api-invoker",
|
|
3
|
-
"version": "5.
|
|
3
|
+
"version": "5.48.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",
|
|
@@ -12,6 +12,14 @@ import {
|
|
|
12
12
|
DeviceLastSeenResponse,
|
|
13
13
|
DeviceLockRequest,
|
|
14
14
|
DeviceLockResponse,
|
|
15
|
+
DeviceNotifyRequest,
|
|
16
|
+
DeviceNotifyResponse,
|
|
17
|
+
DevicePinUnlockRequest,
|
|
18
|
+
DevicePinUnlockResponse,
|
|
19
|
+
DeviceReleaseInitiateResponse,
|
|
20
|
+
DeviceReleaseRequest,
|
|
21
|
+
DeviceReleaseStatusRequest,
|
|
22
|
+
DeviceReleaseStatusResponse,
|
|
15
23
|
DeviceStatusRequest,
|
|
16
24
|
DeviceStatusResponse,
|
|
17
25
|
DeviceUnlockRequest,
|
|
@@ -20,6 +28,7 @@ import {
|
|
|
20
28
|
import {
|
|
21
29
|
DeviceBatchRequest,
|
|
22
30
|
DeviceBatchResult,
|
|
31
|
+
DeviceSingleResult,
|
|
23
32
|
IDatacultrConnectorApi,
|
|
24
33
|
} from "./interfaces/IDatacultrConnectorApi.js";
|
|
25
34
|
|
|
@@ -83,4 +92,28 @@ export default class DatacultrConnectorApi implements IDatacultrConnectorApi {
|
|
|
83
92
|
): Promise<StandardResponse<DeviceBatchResult<DeviceAutoLockScheduleResponse>>> {
|
|
84
93
|
return await this.httpRequest.post(`${this.baseUrl}/devices/auto-lock-schedule`, input);
|
|
85
94
|
}
|
|
95
|
+
|
|
96
|
+
async pinUnlock(
|
|
97
|
+
input: DevicePinUnlockRequest,
|
|
98
|
+
): Promise<StandardResponse<DeviceSingleResult<DevicePinUnlockResponse>>> {
|
|
99
|
+
return await this.httpRequest.post(`${this.baseUrl}/devices/pin-unlock`, input);
|
|
100
|
+
}
|
|
101
|
+
|
|
102
|
+
async notifyDevices(
|
|
103
|
+
input: DeviceBatchRequest<DeviceNotifyRequest>,
|
|
104
|
+
): Promise<StandardResponse<DeviceBatchResult<DeviceNotifyResponse>>> {
|
|
105
|
+
return await this.httpRequest.post(`${this.baseUrl}/devices/notify`, input);
|
|
106
|
+
}
|
|
107
|
+
|
|
108
|
+
async releaseDevices(
|
|
109
|
+
input: DeviceBatchRequest<DeviceReleaseRequest>,
|
|
110
|
+
): Promise<StandardResponse<DeviceBatchResult<DeviceReleaseInitiateResponse>>> {
|
|
111
|
+
return await this.httpRequest.post(`${this.baseUrl}/devices/release`, input);
|
|
112
|
+
}
|
|
113
|
+
|
|
114
|
+
async releaseStatus(
|
|
115
|
+
input: DeviceBatchRequest<DeviceReleaseStatusRequest>,
|
|
116
|
+
): Promise<StandardResponse<DeviceBatchResult<DeviceReleaseStatusResponse>>> {
|
|
117
|
+
return await this.httpRequest.post(`${this.baseUrl}/devices/release/status`, input);
|
|
118
|
+
}
|
|
86
119
|
}
|
|
@@ -10,6 +10,14 @@ import {
|
|
|
10
10
|
DeviceLastSeenResponse,
|
|
11
11
|
DeviceLockRequest,
|
|
12
12
|
DeviceLockResponse,
|
|
13
|
+
DeviceNotifyRequest,
|
|
14
|
+
DeviceNotifyResponse,
|
|
15
|
+
DevicePinUnlockRequest,
|
|
16
|
+
DevicePinUnlockResponse,
|
|
17
|
+
DeviceReleaseInitiateResponse,
|
|
18
|
+
DeviceReleaseRequest,
|
|
19
|
+
DeviceReleaseStatusRequest,
|
|
20
|
+
DeviceReleaseStatusResponse,
|
|
13
21
|
DeviceStatusRequest,
|
|
14
22
|
DeviceStatusResponse,
|
|
15
23
|
DeviceUnlockRequest,
|
|
@@ -77,6 +85,11 @@ export interface DeviceBatchResult<TItem> {
|
|
|
77
85
|
results: TItem[];
|
|
78
86
|
}
|
|
79
87
|
|
|
88
|
+
/** Sobre de salida de los endpoints de UN solo IMEI. Hoy solo `pinUnlock` no es batch. */
|
|
89
|
+
export interface DeviceSingleResult<TItem> {
|
|
90
|
+
result: TItem;
|
|
91
|
+
}
|
|
92
|
+
|
|
80
93
|
export interface IDatacultrConnectorApi {
|
|
81
94
|
/**
|
|
82
95
|
* POST `/devices/enroll` — pre-registra la expectativa de enrolamiento de cada IMEI.
|
|
@@ -141,4 +154,42 @@ export interface IDatacultrConnectorApi {
|
|
|
141
154
|
autoLockSchedule(
|
|
142
155
|
input: DeviceBatchRequest<DeviceAutoLockScheduleRequest>,
|
|
143
156
|
): Promise<StandardResponse<DeviceBatchResult<DeviceAutoLockScheduleResponse>>>;
|
|
157
|
+
|
|
158
|
+
/**
|
|
159
|
+
* POST `/devices/pin-unlock` — pide a Datacultr el passcode de desbloqueo del equipo.
|
|
160
|
+
*
|
|
161
|
+
* ⚠️ NO ES BATCH, a diferencia del resto del contrato: recibe UN `DevicePinUnlockRequest` y
|
|
162
|
+
* devuelve `{ result }`, no `{ results }`. El destino lo declara así en su `PrivateController`.
|
|
163
|
+
*
|
|
164
|
+
* Es el camino del "desbloqueo especial" del backoffice: el operador le dicta el PIN al cliente
|
|
165
|
+
* que se quedó sin señal. `pin`, `validitySeconds` y `generatedAt` solo vienen con `status`
|
|
166
|
+
* `SUCCESS`; si el proveedor no devolvió passcode, el ítem llega en `ERROR` con su `error.code`.
|
|
167
|
+
*/
|
|
168
|
+
pinUnlock(
|
|
169
|
+
input: DevicePinUnlockRequest,
|
|
170
|
+
): Promise<StandardResponse<DeviceSingleResult<DevicePinUnlockResponse>>>;
|
|
171
|
+
|
|
172
|
+
/**
|
|
173
|
+
* POST `/devices/notify` — manda una notificación al equipo de cada IMEI.
|
|
174
|
+
*
|
|
175
|
+
* ⚠️ `notificationCode` es OBLIGATORIO y sale del catálogo de mensajes predefinidos de Datacultr,
|
|
176
|
+
* que hoy NO tenemos. Sin ese catálogo el caller no puede armar un request válido: pedirlo antes
|
|
177
|
+
* de construir encima.
|
|
178
|
+
*/
|
|
179
|
+
notifyDevices(
|
|
180
|
+
input: DeviceBatchRequest<DeviceNotifyRequest>,
|
|
181
|
+
): Promise<StandardResponse<DeviceBatchResult<DeviceNotifyResponse>>>;
|
|
182
|
+
|
|
183
|
+
/**
|
|
184
|
+
* POST `/devices/release` — libera definitivamente cada IMEI del MDM (crédito liquidado o
|
|
185
|
+
* cancelado). Es asíncrono: el ítem suele volver en `PENDING` y se confirma con `releaseStatus`.
|
|
186
|
+
*/
|
|
187
|
+
releaseDevices(
|
|
188
|
+
input: DeviceBatchRequest<DeviceReleaseRequest>,
|
|
189
|
+
): Promise<StandardResponse<DeviceBatchResult<DeviceReleaseInitiateResponse>>>;
|
|
190
|
+
|
|
191
|
+
/** POST `/devices/release/status` — consulta en qué punto va la liberación de cada IMEI. */
|
|
192
|
+
releaseStatus(
|
|
193
|
+
input: DeviceBatchRequest<DeviceReleaseStatusRequest>,
|
|
194
|
+
): Promise<StandardResponse<DeviceBatchResult<DeviceReleaseStatusResponse>>>;
|
|
144
195
|
}
|
|
@@ -10,10 +10,11 @@ import {
|
|
|
10
10
|
WelcomeAccreditationResultRequest,
|
|
11
11
|
WelcomeBonusResponse,
|
|
12
12
|
} from "@fiado/type-kit/bin/retailCustomer/index.js";
|
|
13
|
+
import { CustomersBatchRequest, CustomersBatchResponse } from "./dtos/CustomersBatch.js";
|
|
13
14
|
import { IRetailCustomerBusinessApi } from "./interfaces/IRetailCustomerBusinessApi.js";
|
|
14
15
|
|
|
15
16
|
/**
|
|
16
|
-
* Publisher HTTP del lambda `retail-customer-business` (SureKeep Fase 2, pista Retail) para sus
|
|
17
|
+
* Publisher HTTP del lambda `retail-customer-business` (SureKeep Fase 2, pista Retail) para sus 7
|
|
17
18
|
* endpoints privados de cliente. Contrato y semántica completos → `IRetailCustomerBusinessApi`.
|
|
18
19
|
*
|
|
19
20
|
* Los paths y el `?tenantId=` matchean `openapi/private.yaml` del lambda destino (mismo patrón que
|
|
@@ -83,4 +84,12 @@ export default class RetailCustomerBusinessApi implements IRetailCustomerBusines
|
|
|
83
84
|
const url = `${this.baseUrl}/private/customers/${encodeURIComponent(customerId)}/welcome-accreditation/result?tenantId=${encodeURIComponent(tenantId)}`;
|
|
84
85
|
return await this.httpRequest.put(url, payload);
|
|
85
86
|
}
|
|
87
|
+
|
|
88
|
+
async getCustomersBatch(
|
|
89
|
+
payload: CustomersBatchRequest,
|
|
90
|
+
tenantId: string,
|
|
91
|
+
): Promise<StandardResponse<CustomersBatchResponse>> {
|
|
92
|
+
const url = `${this.baseUrl}/private/customers/batch?tenantId=${encodeURIComponent(tenantId)}`;
|
|
93
|
+
return await this.httpRequest.post(url, payload);
|
|
94
|
+
}
|
|
86
95
|
}
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Tipos del lote de nombres de cliente. Viven en esta lib (y no en `@fiado/type-kit`) porque el
|
|
3
|
+
* type-kit todavía no modela esta vista reducida — el lambda destino la tiene como DTO local (TD-029).
|
|
4
|
+
*/
|
|
5
|
+
|
|
6
|
+
/** Body de `POST /private/customers/batch`. Hasta 100 ids por request; el caller pagina. */
|
|
7
|
+
export interface CustomersBatchRequest {
|
|
8
|
+
retailCustomerIds: string[];
|
|
9
|
+
}
|
|
10
|
+
|
|
11
|
+
/**
|
|
12
|
+
* Lo mínimo para pintar un nombre. `fullName: null` significa que el cliente existe pero no tiene
|
|
13
|
+
* nombre resuelto — es distinto de que el id no vuelva.
|
|
14
|
+
*/
|
|
15
|
+
export interface CustomerBatchItem {
|
|
16
|
+
retailCustomerId: string;
|
|
17
|
+
fullName: string | null;
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
/**
|
|
21
|
+
* Los ids que no existen simplemente NO vuelven: `items` puede ser más corto que lo que mandaste.
|
|
22
|
+
* El caller indexa por `retailCustomerId`, nunca aparea por posición.
|
|
23
|
+
*/
|
|
24
|
+
export interface CustomersBatchResponse {
|
|
25
|
+
items: CustomerBatchItem[];
|
|
26
|
+
}
|
|
@@ -8,17 +8,18 @@ import {
|
|
|
8
8
|
WelcomeAccreditationResultRequest,
|
|
9
9
|
WelcomeBonusResponse,
|
|
10
10
|
} from "@fiado/type-kit/bin/retailCustomer/index.js";
|
|
11
|
+
import { CustomersBatchRequest, CustomersBatchResponse } from "../dtos/CustomersBatch.js";
|
|
11
12
|
|
|
12
13
|
/**
|
|
13
14
|
* Contrato del publisher HTTP del lambda `retail-customer-business` (SureKeep Fase 2, pista Retail)
|
|
14
|
-
* para sus
|
|
15
|
+
* para sus 7 endpoints privados de cliente (service-to-service, VPC-only).
|
|
15
16
|
*
|
|
16
17
|
* Consumidor previsto:
|
|
17
18
|
* - `retail-wizard-business` → upsert del cliente post-KYC, aterrizaje del resultado de apertura
|
|
18
19
|
* de cuenta (D35), y lecturas del cliente por teléfono / id durante la saga de venta.
|
|
19
20
|
*
|
|
20
21
|
* ─────────────────────────────────────────────────────────────────────────────
|
|
21
|
-
* `tenantId` es OBLIGATORIO en los
|
|
22
|
+
* `tenantId` es OBLIGATORIO en los 7 métodos — no es un detalle de firma.
|
|
22
23
|
* ─────────────────────────────────────────────────────────────────────────────
|
|
23
24
|
* Los privados NO llevan token de usuario (`Feature.ANONIMUS`; la protección es la red VPC), así que
|
|
24
25
|
* el lambda destino no tiene `AuthContext.issuer` y NO puede inferir el silo. El caller declara el
|
|
@@ -149,4 +150,27 @@ export interface IRetailCustomerBusinessApi {
|
|
|
149
150
|
payload: WelcomeAccreditationResultRequest,
|
|
150
151
|
tenantId: string,
|
|
151
152
|
): Promise<StandardResponse<WelcomeBonusResponse>>;
|
|
153
|
+
|
|
154
|
+
/**
|
|
155
|
+
* POST /private/customers/batch?tenantId= — resuelve NOMBRES de cliente EN LOTE por sus ids.
|
|
156
|
+
* Pensado para pintar una lista sin caer en N+1 contra el privado de un cliente por vez.
|
|
157
|
+
*
|
|
158
|
+
* ⚠️ Un id que NO existe simplemente no aparece en `items`: el arreglo puede volver más corto que
|
|
159
|
+
* lo que mandaste. Indexa el resultado por `retailCustomerId` — NUNCA aparees por posición.
|
|
160
|
+
* `fullName: null` es otra cosa: el cliente existe y no tiene nombre resuelto.
|
|
161
|
+
*
|
|
162
|
+
* El resultado puede ser PARCIAL si DynamoDB deja claves sin procesar tras sus reintentos: faltan
|
|
163
|
+
* renglones, no explota. Trata la ausencia como «sin nombre», no como error.
|
|
164
|
+
*
|
|
165
|
+
* Tope de 100 ids por request, medido sobre lo que manda el caller (el destino deduplica adentro,
|
|
166
|
+
* pero eso no baja tu cuenta). Lista vacía → `200` con `items: []`, no es error.
|
|
167
|
+
*
|
|
168
|
+
* @throws `400 CUSTOMER_BATCH_TOO_LARGE` si el lote pasa de 100 ids. Reintentar igual vuelve a
|
|
169
|
+
* fallar: hay que paginar.
|
|
170
|
+
* @throws `400 UNKNOWN_TENANT` si el `tenantId` viene ausente o desconocido.
|
|
171
|
+
*/
|
|
172
|
+
getCustomersBatch(
|
|
173
|
+
payload: CustomersBatchRequest,
|
|
174
|
+
tenantId: string,
|
|
175
|
+
): Promise<StandardResponse<CustomersBatchResponse>>;
|
|
152
176
|
}
|