@fiado/api-invoker 5.62.0 → 5.64.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/loanCredit/api/LoanCreditBusinessApi.d.ts +2 -0
- package/bin/loanCredit/api/LoanCreditBusinessApi.js +4 -0
- package/bin/loanCredit/api/dtos/CustomerCreditHistory.d.ts +13 -0
- package/bin/loanCredit/api/dtos/CustomerCreditHistory.js +1 -0
- package/bin/loanCredit/api/interfaces/ILoanCreditBusinessApi.d.ts +9 -0
- package/bin/loanCredit/index.d.ts +1 -0
- package/bin/loanCredit/index.js +1 -0
- package/bin/loanOfferings/api/LoanOfferingsBusinessApi.d.ts +2 -0
- package/bin/loanOfferings/api/LoanOfferingsBusinessApi.js +8 -0
- package/bin/loanOfferings/api/dtos/SegmentMembers.d.ts +23 -0
- package/bin/loanOfferings/api/dtos/SegmentMembers.js +5 -0
- package/bin/loanOfferings/api/interfaces/ILoanOfferingsBusinessApi.d.ts +14 -0
- package/bin/loanOfferings/index.d.ts +1 -0
- package/bin/loanOfferings/index.js +1 -0
- package/bin/retailCustomer/api/RetailCustomerBusinessApi.d.ts +3 -0
- package/bin/retailCustomer/api/RetailCustomerBusinessApi.js +10 -0
- package/bin/retailCustomer/api/dtos/CustomersPage.d.ts +25 -0
- package/bin/retailCustomer/api/dtos/CustomersPage.js +6 -0
- package/bin/retailCustomer/api/interfaces/IRetailCustomerBusinessApi.d.ts +16 -0
- package/bin/retailCustomer/index.d.ts +1 -0
- package/bin/retailCustomer/index.js +1 -0
- package/package.json +1 -1
- package/src/loanCredit/api/LoanCreditBusinessApi.ts +9 -0
- package/src/loanCredit/api/dtos/CustomerCreditHistory.ts +13 -0
- package/src/loanCredit/api/interfaces/ILoanCreditBusinessApi.ts +13 -0
- package/src/loanCredit/index.ts +1 -0
- package/src/loanOfferings/api/LoanOfferingsBusinessApi.ts +13 -0
- package/src/loanOfferings/api/dtos/SegmentMembers.ts +26 -0
- package/src/loanOfferings/api/interfaces/ILoanOfferingsBusinessApi.ts +18 -0
- package/src/loanOfferings/index.ts +1 -0
- package/src/retailCustomer/api/RetailCustomerBusinessApi.ts +14 -0
- package/src/retailCustomer/api/dtos/CustomersPage.ts +27 -0
- package/src/retailCustomer/api/interfaces/IRetailCustomerBusinessApi.ts +20 -0
- package/src/retailCustomer/index.ts +1 -0
|
@@ -2,6 +2,7 @@ import type { IHttpRequest } from "@fiado/http-client";
|
|
|
2
2
|
import { StandardResponse } from "@fiado/gateway-adapter";
|
|
3
3
|
import { ActivationCheckRequest, ActivationCheckResponse, LoanBorrowerResponse, LoanCreditResponse, OriginateLoanCreditRequest, OriginateLoanCreditResponse, QuoteLoanCreditRequest, QuoteLoanCreditResponse, SignLoanCreditRequest, SignLoanCreditResponse, UpsertLoanBorrowerRequest } from "@fiado/type-kit/bin/loanCredit/index.js";
|
|
4
4
|
import { LoanCreditAnalyticsBatchRequest, LoanCreditAnalyticsBatchResponse } from "./dtos/LoanCreditAnalyticsBatch.js";
|
|
5
|
+
import { CustomerCreditHistoryResponse } from "./dtos/CustomerCreditHistory.js";
|
|
5
6
|
import { ILoanCreditBusinessApi } from "./interfaces/ILoanCreditBusinessApi.js";
|
|
6
7
|
/**
|
|
7
8
|
* Publisher HTTP del lambda `loan-credit-business` (componente 09 SureKeep F2 — motor de crédito).
|
|
@@ -26,6 +27,7 @@ export default class LoanCreditBusinessApi implements ILoanCreditBusinessApi {
|
|
|
26
27
|
discard(creditId: string, tenantId: string): Promise<StandardResponse<LoanCreditResponse>>;
|
|
27
28
|
getCredit(creditId: string, tenantId: string): Promise<StandardResponse<LoanCreditResponse>>;
|
|
28
29
|
getBorrowerByRetailCustomer(retailCustomerId: string, tenantId: string): Promise<StandardResponse<LoanBorrowerResponse>>;
|
|
30
|
+
getCustomerCreditHistory(retailCustomerId: string, tenantId: string): Promise<StandardResponse<CustomerCreditHistoryResponse>>;
|
|
29
31
|
batchGetCreditAnalytics(input: LoanCreditAnalyticsBatchRequest, tenantId: string): Promise<StandardResponse<LoanCreditAnalyticsBatchResponse>>;
|
|
30
32
|
upsertBorrower(input: UpsertLoanBorrowerRequest, tenantId: string): Promise<StandardResponse<LoanBorrowerResponse>>;
|
|
31
33
|
}
|
|
@@ -58,6 +58,10 @@ let LoanCreditBusinessApi = class LoanCreditBusinessApi {
|
|
|
58
58
|
const url = `${this.baseUrl}/private/borrowers/by-retail-customer/${encodeURIComponent(retailCustomerId)}?tenantId=${encodeURIComponent(tenantId)}`;
|
|
59
59
|
return await this.httpRequest.get(url);
|
|
60
60
|
}
|
|
61
|
+
async getCustomerCreditHistory(retailCustomerId, tenantId) {
|
|
62
|
+
const url = `${this.baseUrl}/private/borrowers/by-retail-customer/${encodeURIComponent(retailCustomerId)}/credit-history?tenantId=${encodeURIComponent(tenantId)}`;
|
|
63
|
+
return await this.httpRequest.get(url);
|
|
64
|
+
}
|
|
61
65
|
async batchGetCreditAnalytics(input, tenantId) {
|
|
62
66
|
const url = `${this.baseUrl}/private/credits/analytics?tenantId=${encodeURIComponent(tenantId)}`;
|
|
63
67
|
return await this.httpRequest.post(url, input);
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Respuesta de `GET /private/borrowers/by-retail-customer/{retailCustomerId}/credit-history`.
|
|
3
|
+
* Historial crediticio agregado del acreditado. CERO PII — solo la FK al cliente retail y cifras.
|
|
4
|
+
*/
|
|
5
|
+
export interface CustomerCreditHistoryResponse {
|
|
6
|
+
retailCustomerId: string;
|
|
7
|
+
/**
|
|
8
|
+
* Peor atraso VIGENTE, en días, entre las cuotas vencidas en los últimos 180 días.
|
|
9
|
+
* `null` = el acreditado no tiene ninguna cuota fechada en la ventana (hecho ausente);
|
|
10
|
+
* `0` = tiene cuotas en la ventana y ninguna vencida impaga. NO son lo mismo.
|
|
11
|
+
*/
|
|
12
|
+
delinquencyDaysLast6M: number | null;
|
|
13
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import { StandardResponse } from "@fiado/gateway-adapter";
|
|
2
2
|
import { ActivationCheckRequest, ActivationCheckResponse, LoanBorrowerResponse, LoanCreditResponse, OriginateLoanCreditRequest, OriginateLoanCreditResponse, QuoteLoanCreditRequest, QuoteLoanCreditResponse, SignLoanCreditRequest, SignLoanCreditResponse, UpsertLoanBorrowerRequest } from "@fiado/type-kit/bin/loanCredit/index.js";
|
|
3
3
|
import { LoanCreditAnalyticsBatchRequest, LoanCreditAnalyticsBatchResponse } from "../dtos/LoanCreditAnalyticsBatch.js";
|
|
4
|
+
import { CustomerCreditHistoryResponse } from "../dtos/CustomerCreditHistory.js";
|
|
4
5
|
/**
|
|
5
6
|
* Contrato del publisher de `loan-credit-business` (componente 09 SureKeep F2 — motor de crédito
|
|
6
7
|
* SOFOM, pista Loan). Endpoints PRIVADOS (VPC) consumidos por `retail-wizard-business` (pasos
|
|
@@ -57,6 +58,14 @@ export interface ILoanCreditBusinessApi {
|
|
|
57
58
|
* `404 BORROWER_NOT_FOUND` si el evento KYC aún no lo hidrató.
|
|
58
59
|
*/
|
|
59
60
|
getBorrowerByRetailCustomer(retailCustomerId: string, tenantId: string): Promise<StandardResponse<LoanBorrowerResponse>>;
|
|
61
|
+
/**
|
|
62
|
+
* Historial crediticio agregado del acreditado, resuelto por su FK al cliente retail. Hoy
|
|
63
|
+
* devuelve el peor atraso VIGENTE en la ventana de 180 días — `null` cuando el acreditado no
|
|
64
|
+
* tiene ninguna cuota fechada en esa ventana, `0` cuando las tiene y ninguna está vencida
|
|
65
|
+
* impaga. Ese `null` es «hecho ausente», nunca se colapsa a `0`.
|
|
66
|
+
* `404 BORROWER_NOT_FOUND` si el evento KYC aún no hidrató al acreditado.
|
|
67
|
+
*/
|
|
68
|
+
getCustomerCreditHistory(retailCustomerId: string, tenantId: string): Promise<StandardResponse<CustomerCreditHistoryResponse>>;
|
|
60
69
|
/**
|
|
61
70
|
* Lee créditos EN LOTE por su id y devuelve solo lo que se cuenta: el eje de riesgo congelado
|
|
62
71
|
* al originar, el plan, las cifras del enganche, el estado, las fechas de originación y
|
package/bin/loanCredit/index.js
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import type { IHttpRequest } from "@fiado/http-client";
|
|
2
2
|
import { StandardResponse } from "@fiado/gateway-adapter";
|
|
3
3
|
import { ConsumePromotionRequest, PromotedSkusResponse, ConsumePromotionResponse, CreditPlanLevelEnum, CreditPlanResponse, FinancierResponse, ReservePromotionBonusRequest, ReservePromotionBonusResponse, ResolveCustomerSegmentsRequest, ResolveCustomerSegmentsResponse, ScopeWidePromotionsResponse, SkuPromotionsResponse, SettlePromotionBonusRequest, PromotionBonusResponse, SimulateCreditPlanRequest, SimulationResultResponse } from "@fiado/type-kit/bin/loanOfferings/index.js";
|
|
4
|
+
import { SegmentMembersResponse } from "./dtos/SegmentMembers.js";
|
|
4
5
|
import { ILoanOfferingsBusinessApi } from "./interfaces/ILoanOfferingsBusinessApi.js";
|
|
5
6
|
/**
|
|
6
7
|
* Publisher HTTP del lambda `loan-offerings-business` (componente 07 SureKeep Fase 1) para sus
|
|
@@ -29,4 +30,5 @@ export default class LoanOfferingsBusinessApi implements ILoanOfferingsBusinessA
|
|
|
29
30
|
settlePromotionBonus(promotionId: string, input: SettlePromotionBonusRequest, tenantId: string): Promise<StandardResponse<PromotionBonusResponse>>;
|
|
30
31
|
listSkuPromotions(storeId: string, tenantId: string, level?: CreditPlanLevelEnum, segmentId?: string): Promise<StandardResponse<SkuPromotionsResponse>>;
|
|
31
32
|
listScopeWidePromotions(storeId: string, tenantId: string, level?: CreditPlanLevelEnum, segmentId?: string): Promise<StandardResponse<ScopeWidePromotionsResponse>>;
|
|
33
|
+
getSegmentMembers(retailCustomerIds: string[], tenantId: string): Promise<StandardResponse<SegmentMembersResponse>>;
|
|
32
34
|
}
|
|
@@ -86,6 +86,14 @@ let LoanOfferingsBusinessApi = class LoanOfferingsBusinessApi {
|
|
|
86
86
|
url += `&segmentId=${encodeURIComponent(segmentId)}`;
|
|
87
87
|
return await this.httpRequest.get(url);
|
|
88
88
|
}
|
|
89
|
+
async getSegmentMembers(retailCustomerIds, tenantId) {
|
|
90
|
+
const params = new URLSearchParams({
|
|
91
|
+
retailCustomerIds: retailCustomerIds.join(","),
|
|
92
|
+
tenantId,
|
|
93
|
+
});
|
|
94
|
+
const url = `${this.baseUrl}/private/segments/members?${params.toString()}`;
|
|
95
|
+
return await this.httpRequest.get(url);
|
|
96
|
+
}
|
|
89
97
|
};
|
|
90
98
|
LoanOfferingsBusinessApi = __decorate([
|
|
91
99
|
injectable(),
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Tipos de la pertenencia a segmentos EN LOTE. Viven en esta lib (y no en `@fiado/type-kit`) porque
|
|
3
|
+
* el type-kit todavía no modela esta vista reducida — el lambda destino la tiene como DTO local.
|
|
4
|
+
*/
|
|
5
|
+
/** Un segmento al que pertenece el cliente, con lo mínimo para pintarlo. */
|
|
6
|
+
export interface CustomerSegmentMembership {
|
|
7
|
+
segmentId: string;
|
|
8
|
+
name: string;
|
|
9
|
+
/**
|
|
10
|
+
* Segmento por omisión del catálogo. Su semántica cambia por motor (alcanza a todos en
|
|
11
|
+
* promociones y a nadie en políticas), así que el consumidor decide si lo pinta.
|
|
12
|
+
*/
|
|
13
|
+
isDefault: boolean;
|
|
14
|
+
}
|
|
15
|
+
/** Un cliente y los segmentos que le tocan. `segments: []` afirma que no está en ninguno. */
|
|
16
|
+
export interface SegmentMembersItem {
|
|
17
|
+
retailCustomerId: string;
|
|
18
|
+
segments: CustomerSegmentMembership[];
|
|
19
|
+
}
|
|
20
|
+
/** Una fila por cada id PEDIDO, no por cada id con segmentos. */
|
|
21
|
+
export interface SegmentMembersResponse {
|
|
22
|
+
items: SegmentMembersItem[];
|
|
23
|
+
}
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { StandardResponse } from "@fiado/gateway-adapter";
|
|
2
|
+
import { SegmentMembersResponse } from "../dtos/SegmentMembers.js";
|
|
2
3
|
import { ConsumePromotionRequest, PromotedSkusResponse, ConsumePromotionResponse, CreditPlanLevelEnum, CreditPlanResponse, FinancierResponse, ReservePromotionBonusRequest, ReservePromotionBonusResponse, ResolveCustomerSegmentsRequest, ResolveCustomerSegmentsResponse, ScopeWidePromotionsResponse, SkuPromotionsResponse, SettlePromotionBonusRequest, PromotionBonusResponse, SimulateCreditPlanRequest, SimulationResultResponse } from "@fiado/type-kit/bin/loanOfferings/index.js";
|
|
3
4
|
/**
|
|
4
5
|
* Contrato del publisher HTTP del lambda `loan-offerings-business` (componente 07 SureKeep Fase 1)
|
|
@@ -133,4 +134,17 @@ export interface ILoanOfferingsBusinessApi {
|
|
|
133
134
|
* hay ninguna vigente; nunca 404.
|
|
134
135
|
*/
|
|
135
136
|
listScopeWidePromotions(storeId: string, tenantId: string, level?: CreditPlanLevelEnum, segmentId?: string): Promise<StandardResponse<ScopeWidePromotionsResponse>>;
|
|
137
|
+
/**
|
|
138
|
+
* `GET /private/segments/members?retailCustomerIds=<csv>` — pertenencia a segmentos EN LOTE.
|
|
139
|
+
* Es la alternativa a resolver segmento por cliente: una llamada por página de tabla.
|
|
140
|
+
*
|
|
141
|
+
* Devuelve una fila por cada id PEDIDO: los que no están en ningún segmento vuelven con
|
|
142
|
+
* `segments: []`, no se omiten. Aun así, indexa por `retailCustomerId` — nunca por posición.
|
|
143
|
+
*
|
|
144
|
+
* Tope de 100 ids por request, medido sobre lo que manda el caller.
|
|
145
|
+
*
|
|
146
|
+
* @throws `400 SEGMENT_MEMBERS_BATCH_TOO_LARGE` si el lote pasa de 100 ids.
|
|
147
|
+
* @throws `400 UNKNOWN_TENANT` si el `tenantId` viene ausente o desconocido.
|
|
148
|
+
*/
|
|
149
|
+
getSegmentMembers(retailCustomerIds: string[], tenantId: string): Promise<StandardResponse<SegmentMembersResponse>>;
|
|
136
150
|
}
|
|
@@ -2,6 +2,8 @@ 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
4
|
import { CustomersBatchRequest, CustomersBatchResponse } from "./dtos/CustomersBatch.js";
|
|
5
|
+
import { CustomersPageQuery, PrivateCustomerListItem } from "./dtos/CustomersPage.js";
|
|
6
|
+
import { PaginatedResult } from "@fiado/type-kit/bin/retailOrg/index.js";
|
|
5
7
|
import { IRetailCustomerBusinessApi } from "./interfaces/IRetailCustomerBusinessApi.js";
|
|
6
8
|
/**
|
|
7
9
|
* Publisher HTTP del lambda `retail-customer-business` (SureKeep Fase 2, pista Retail) para sus 7
|
|
@@ -28,4 +30,5 @@ export default class RetailCustomerBusinessApi implements IRetailCustomerBusines
|
|
|
28
30
|
markWelcomeAccredited(customerId: string, tenantId: string, payload?: WelcomeAccreditationRequest): Promise<StandardResponse<WelcomeAccreditationResponse>>;
|
|
29
31
|
setWelcomeAccreditationResult(customerId: string, payload: WelcomeAccreditationResultRequest, tenantId: string): Promise<StandardResponse<WelcomeBonusResponse>>;
|
|
30
32
|
getCustomersBatch(payload: CustomersBatchRequest, tenantId: string): Promise<StandardResponse<CustomersBatchResponse>>;
|
|
33
|
+
listCustomersPage(query: CustomersPageQuery, tenantId: string): Promise<StandardResponse<PaginatedResult<PrivateCustomerListItem>>>;
|
|
31
34
|
}
|
|
@@ -60,6 +60,16 @@ let RetailCustomerBusinessApi = class RetailCustomerBusinessApi {
|
|
|
60
60
|
const url = `${this.baseUrl}/private/customers/batch?tenantId=${encodeURIComponent(tenantId)}`;
|
|
61
61
|
return await this.httpRequest.post(url, payload);
|
|
62
62
|
}
|
|
63
|
+
async listCustomersPage(query, tenantId) {
|
|
64
|
+
const params = new URLSearchParams({ tenantId });
|
|
65
|
+
if (query.limit !== undefined)
|
|
66
|
+
params.set("limit", String(query.limit));
|
|
67
|
+
// El cursor viaja tal cual lo entregó el destino: componerlo o re-codificarlo lo rompe.
|
|
68
|
+
if (query.nextToken)
|
|
69
|
+
params.set("nextToken", query.nextToken);
|
|
70
|
+
const url = `${this.baseUrl}/private/customers?${params.toString()}`;
|
|
71
|
+
return await this.httpRequest.get(url);
|
|
72
|
+
}
|
|
63
73
|
};
|
|
64
74
|
RetailCustomerBusinessApi = __decorate([
|
|
65
75
|
injectable(),
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Tipos del listado paginado de clientes del tenant. Viven en esta lib (y no en `@fiado/type-kit`)
|
|
3
|
+
* porque el type-kit todavía no modela esta vista reducida — el lambda destino la tiene como DTO
|
|
4
|
+
* local, mismo criterio que `CustomersBatch`.
|
|
5
|
+
*/
|
|
6
|
+
/** Query de `GET /private/customers`. `limit` default 25, máximo 100 del lado del destino. */
|
|
7
|
+
export interface CustomersPageQuery {
|
|
8
|
+
limit?: number;
|
|
9
|
+
/** Cursor opaco de la página anterior. Ausente = primera página. */
|
|
10
|
+
nextToken?: string;
|
|
11
|
+
}
|
|
12
|
+
/**
|
|
13
|
+
* Lo mínimo para pintar el renglón de un cliente. `fullName: null` significa que el cliente existe
|
|
14
|
+
* y no tiene ninguna parte del nombre resuelta — es distinto de que el id no vuelva.
|
|
15
|
+
*/
|
|
16
|
+
export interface PrivateCustomerListItem {
|
|
17
|
+
retailCustomerId: string;
|
|
18
|
+
/** `names + paternalLastName + maternalLastName` ya compuesto por el destino. */
|
|
19
|
+
fullName: string | null;
|
|
20
|
+
phone: string | null;
|
|
21
|
+
/** Tienda donde se dio de alta. La ficha del backoffice la nombra y resuelve su KYC con ella. */
|
|
22
|
+
originStoreId: string | null;
|
|
23
|
+
/** Alta del cliente en ISO-8601 UTC. Es el orden del listado (descendente). */
|
|
24
|
+
createdAt: string;
|
|
25
|
+
}
|
|
@@ -1,6 +1,8 @@
|
|
|
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
3
|
import { CustomersBatchRequest, CustomersBatchResponse } from "../dtos/CustomersBatch.js";
|
|
4
|
+
import { CustomersPageQuery, PrivateCustomerListItem } from "../dtos/CustomersPage.js";
|
|
5
|
+
import { PaginatedResult } from "@fiado/type-kit/bin/retailOrg/index.js";
|
|
4
6
|
/**
|
|
5
7
|
* Contrato del publisher HTTP del lambda `retail-customer-business` (SureKeep Fase 2, pista Retail)
|
|
6
8
|
* para sus 7 endpoints privados de cliente (service-to-service, VPC-only).
|
|
@@ -134,4 +136,18 @@ export interface IRetailCustomerBusinessApi {
|
|
|
134
136
|
* @throws `400 UNKNOWN_TENANT` si el `tenantId` viene ausente o desconocido.
|
|
135
137
|
*/
|
|
136
138
|
getCustomersBatch(payload: CustomersBatchRequest, tenantId: string): Promise<StandardResponse<CustomersBatchResponse>>;
|
|
139
|
+
/**
|
|
140
|
+
* GET /private/customers?limit&nextToken&tenantId= — UNA página del padrón de clientes del
|
|
141
|
+
* tenant, del alta más reciente a la más vieja. Es el listado que alimenta las tablas de
|
|
142
|
+
* backoffice: una sola Query sobre el GSI de listado, sin fan-out por negocio.
|
|
143
|
+
*
|
|
144
|
+
* `nextToken` es OPACO: se pasea tal cual, no se compone ni se re-codifica. Ausente en la
|
|
145
|
+
* respuesta = última página. `count` son las filas de ESA página, nunca el total del padrón.
|
|
146
|
+
*
|
|
147
|
+
* `limit` default 25, máximo 100.
|
|
148
|
+
*
|
|
149
|
+
* @throws `400 INVALID_QUERY_PARAM` si `limit` no parsea o se pasa del tope.
|
|
150
|
+
* @throws `400 UNKNOWN_TENANT` si el `tenantId` viene ausente o desconocido.
|
|
151
|
+
*/
|
|
152
|
+
listCustomersPage(query: CustomersPageQuery, tenantId: string): Promise<StandardResponse<PaginatedResult<PrivateCustomerListItem>>>;
|
|
137
153
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@fiado/api-invoker",
|
|
3
|
-
"version": "5.
|
|
3
|
+
"version": "5.64.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",
|
|
@@ -18,6 +18,7 @@ import {
|
|
|
18
18
|
LoanCreditAnalyticsBatchRequest,
|
|
19
19
|
LoanCreditAnalyticsBatchResponse,
|
|
20
20
|
} from "./dtos/LoanCreditAnalyticsBatch.js";
|
|
21
|
+
import { CustomerCreditHistoryResponse } from "./dtos/CustomerCreditHistory.js";
|
|
21
22
|
import { ILoanCreditBusinessApi } from "./interfaces/ILoanCreditBusinessApi.js";
|
|
22
23
|
|
|
23
24
|
/**
|
|
@@ -98,6 +99,14 @@ export default class LoanCreditBusinessApi implements ILoanCreditBusinessApi {
|
|
|
98
99
|
return await this.httpRequest.get(url);
|
|
99
100
|
}
|
|
100
101
|
|
|
102
|
+
async getCustomerCreditHistory(
|
|
103
|
+
retailCustomerId: string,
|
|
104
|
+
tenantId: string,
|
|
105
|
+
): Promise<StandardResponse<CustomerCreditHistoryResponse>> {
|
|
106
|
+
const url = `${this.baseUrl}/private/borrowers/by-retail-customer/${encodeURIComponent(retailCustomerId)}/credit-history?tenantId=${encodeURIComponent(tenantId)}`;
|
|
107
|
+
return await this.httpRequest.get(url);
|
|
108
|
+
}
|
|
109
|
+
|
|
101
110
|
async batchGetCreditAnalytics(
|
|
102
111
|
input: LoanCreditAnalyticsBatchRequest,
|
|
103
112
|
tenantId: string,
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Respuesta de `GET /private/borrowers/by-retail-customer/{retailCustomerId}/credit-history`.
|
|
3
|
+
* Historial crediticio agregado del acreditado. CERO PII — solo la FK al cliente retail y cifras.
|
|
4
|
+
*/
|
|
5
|
+
export interface CustomerCreditHistoryResponse {
|
|
6
|
+
retailCustomerId: string;
|
|
7
|
+
/**
|
|
8
|
+
* Peor atraso VIGENTE, en días, entre las cuotas vencidas en los últimos 180 días.
|
|
9
|
+
* `null` = el acreditado no tiene ninguna cuota fechada en la ventana (hecho ausente);
|
|
10
|
+
* `0` = tiene cuotas en la ventana y ninguna vencida impaga. NO son lo mismo.
|
|
11
|
+
*/
|
|
12
|
+
delinquencyDaysLast6M: number | null;
|
|
13
|
+
}
|
|
@@ -16,6 +16,7 @@ import {
|
|
|
16
16
|
LoanCreditAnalyticsBatchRequest,
|
|
17
17
|
LoanCreditAnalyticsBatchResponse,
|
|
18
18
|
} from "../dtos/LoanCreditAnalyticsBatch.js";
|
|
19
|
+
import { CustomerCreditHistoryResponse } from "../dtos/CustomerCreditHistory.js";
|
|
19
20
|
|
|
20
21
|
/**
|
|
21
22
|
* Contrato del publisher de `loan-credit-business` (componente 09 SureKeep F2 — motor de crédito
|
|
@@ -104,6 +105,18 @@ export interface ILoanCreditBusinessApi {
|
|
|
104
105
|
tenantId: string,
|
|
105
106
|
): Promise<StandardResponse<LoanBorrowerResponse>>;
|
|
106
107
|
|
|
108
|
+
/**
|
|
109
|
+
* Historial crediticio agregado del acreditado, resuelto por su FK al cliente retail. Hoy
|
|
110
|
+
* devuelve el peor atraso VIGENTE en la ventana de 180 días — `null` cuando el acreditado no
|
|
111
|
+
* tiene ninguna cuota fechada en esa ventana, `0` cuando las tiene y ninguna está vencida
|
|
112
|
+
* impaga. Ese `null` es «hecho ausente», nunca se colapsa a `0`.
|
|
113
|
+
* `404 BORROWER_NOT_FOUND` si el evento KYC aún no hidrató al acreditado.
|
|
114
|
+
*/
|
|
115
|
+
getCustomerCreditHistory(
|
|
116
|
+
retailCustomerId: string,
|
|
117
|
+
tenantId: string,
|
|
118
|
+
): Promise<StandardResponse<CustomerCreditHistoryResponse>>;
|
|
119
|
+
|
|
107
120
|
/**
|
|
108
121
|
* Lee créditos EN LOTE por su id y devuelve solo lo que se cuenta: el eje de riesgo congelado
|
|
109
122
|
* al originar, el plan, las cifras del enganche, el estado, las fechas de originación y
|
package/src/loanCredit/index.ts
CHANGED
|
@@ -19,6 +19,7 @@ import {
|
|
|
19
19
|
SimulateCreditPlanRequest,
|
|
20
20
|
SimulationResultResponse,
|
|
21
21
|
} from "@fiado/type-kit/bin/loanOfferings/index.js";
|
|
22
|
+
import { SegmentMembersResponse } from "./dtos/SegmentMembers.js";
|
|
22
23
|
import { ILoanOfferingsBusinessApi } from "./interfaces/ILoanOfferingsBusinessApi.js";
|
|
23
24
|
|
|
24
25
|
/**
|
|
@@ -142,4 +143,16 @@ export default class LoanOfferingsBusinessApi implements ILoanOfferingsBusinessA
|
|
|
142
143
|
if (segmentId) url += `&segmentId=${encodeURIComponent(segmentId)}`;
|
|
143
144
|
return await this.httpRequest.get(url);
|
|
144
145
|
}
|
|
146
|
+
|
|
147
|
+
async getSegmentMembers(
|
|
148
|
+
retailCustomerIds: string[],
|
|
149
|
+
tenantId: string,
|
|
150
|
+
): Promise<StandardResponse<SegmentMembersResponse>> {
|
|
151
|
+
const params = new URLSearchParams({
|
|
152
|
+
retailCustomerIds: retailCustomerIds.join(","),
|
|
153
|
+
tenantId,
|
|
154
|
+
});
|
|
155
|
+
const url = `${this.baseUrl}/private/segments/members?${params.toString()}`;
|
|
156
|
+
return await this.httpRequest.get(url);
|
|
157
|
+
}
|
|
145
158
|
}
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Tipos de la pertenencia a segmentos EN LOTE. Viven en esta lib (y no en `@fiado/type-kit`) porque
|
|
3
|
+
* el type-kit todavía no modela esta vista reducida — el lambda destino la tiene como DTO local.
|
|
4
|
+
*/
|
|
5
|
+
|
|
6
|
+
/** Un segmento al que pertenece el cliente, con lo mínimo para pintarlo. */
|
|
7
|
+
export interface CustomerSegmentMembership {
|
|
8
|
+
segmentId: string;
|
|
9
|
+
name: string;
|
|
10
|
+
/**
|
|
11
|
+
* Segmento por omisión del catálogo. Su semántica cambia por motor (alcanza a todos en
|
|
12
|
+
* promociones y a nadie en políticas), así que el consumidor decide si lo pinta.
|
|
13
|
+
*/
|
|
14
|
+
isDefault: boolean;
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
/** Un cliente y los segmentos que le tocan. `segments: []` afirma que no está en ninguno. */
|
|
18
|
+
export interface SegmentMembersItem {
|
|
19
|
+
retailCustomerId: string;
|
|
20
|
+
segments: CustomerSegmentMembership[];
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
/** Una fila por cada id PEDIDO, no por cada id con segmentos. */
|
|
24
|
+
export interface SegmentMembersResponse {
|
|
25
|
+
items: SegmentMembersItem[];
|
|
26
|
+
}
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { StandardResponse } from "@fiado/gateway-adapter";
|
|
2
|
+
import { SegmentMembersResponse } from "../dtos/SegmentMembers.js";
|
|
2
3
|
import {
|
|
3
4
|
ConsumePromotionRequest,
|
|
4
5
|
PromotedSkusResponse,
|
|
@@ -203,4 +204,21 @@ export interface ILoanOfferingsBusinessApi {
|
|
|
203
204
|
level?: CreditPlanLevelEnum,
|
|
204
205
|
segmentId?: string,
|
|
205
206
|
): Promise<StandardResponse<ScopeWidePromotionsResponse>>;
|
|
207
|
+
|
|
208
|
+
/**
|
|
209
|
+
* `GET /private/segments/members?retailCustomerIds=<csv>` — pertenencia a segmentos EN LOTE.
|
|
210
|
+
* Es la alternativa a resolver segmento por cliente: una llamada por página de tabla.
|
|
211
|
+
*
|
|
212
|
+
* Devuelve una fila por cada id PEDIDO: los que no están en ningún segmento vuelven con
|
|
213
|
+
* `segments: []`, no se omiten. Aun así, indexa por `retailCustomerId` — nunca por posición.
|
|
214
|
+
*
|
|
215
|
+
* Tope de 100 ids por request, medido sobre lo que manda el caller.
|
|
216
|
+
*
|
|
217
|
+
* @throws `400 SEGMENT_MEMBERS_BATCH_TOO_LARGE` si el lote pasa de 100 ids.
|
|
218
|
+
* @throws `400 UNKNOWN_TENANT` si el `tenantId` viene ausente o desconocido.
|
|
219
|
+
*/
|
|
220
|
+
getSegmentMembers(
|
|
221
|
+
retailCustomerIds: string[],
|
|
222
|
+
tenantId: string,
|
|
223
|
+
): Promise<StandardResponse<SegmentMembersResponse>>;
|
|
206
224
|
}
|
|
@@ -11,6 +11,8 @@ import {
|
|
|
11
11
|
WelcomeBonusResponse,
|
|
12
12
|
} from "@fiado/type-kit/bin/retailCustomer/index.js";
|
|
13
13
|
import { CustomersBatchRequest, CustomersBatchResponse } from "./dtos/CustomersBatch.js";
|
|
14
|
+
import { CustomersPageQuery, PrivateCustomerListItem } from "./dtos/CustomersPage.js";
|
|
15
|
+
import { PaginatedResult } from "@fiado/type-kit/bin/retailOrg/index.js";
|
|
14
16
|
import { IRetailCustomerBusinessApi } from "./interfaces/IRetailCustomerBusinessApi.js";
|
|
15
17
|
|
|
16
18
|
/**
|
|
@@ -92,4 +94,16 @@ export default class RetailCustomerBusinessApi implements IRetailCustomerBusines
|
|
|
92
94
|
const url = `${this.baseUrl}/private/customers/batch?tenantId=${encodeURIComponent(tenantId)}`;
|
|
93
95
|
return await this.httpRequest.post(url, payload);
|
|
94
96
|
}
|
|
97
|
+
|
|
98
|
+
async listCustomersPage(
|
|
99
|
+
query: CustomersPageQuery,
|
|
100
|
+
tenantId: string,
|
|
101
|
+
): Promise<StandardResponse<PaginatedResult<PrivateCustomerListItem>>> {
|
|
102
|
+
const params = new URLSearchParams({ tenantId });
|
|
103
|
+
if (query.limit !== undefined) params.set("limit", String(query.limit));
|
|
104
|
+
// El cursor viaja tal cual lo entregó el destino: componerlo o re-codificarlo lo rompe.
|
|
105
|
+
if (query.nextToken) params.set("nextToken", query.nextToken);
|
|
106
|
+
const url = `${this.baseUrl}/private/customers?${params.toString()}`;
|
|
107
|
+
return await this.httpRequest.get(url);
|
|
108
|
+
}
|
|
95
109
|
}
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Tipos del listado paginado de clientes del tenant. Viven en esta lib (y no en `@fiado/type-kit`)
|
|
3
|
+
* porque el type-kit todavía no modela esta vista reducida — el lambda destino la tiene como DTO
|
|
4
|
+
* local, mismo criterio que `CustomersBatch`.
|
|
5
|
+
*/
|
|
6
|
+
|
|
7
|
+
/** Query de `GET /private/customers`. `limit` default 25, máximo 100 del lado del destino. */
|
|
8
|
+
export interface CustomersPageQuery {
|
|
9
|
+
limit?: number;
|
|
10
|
+
/** Cursor opaco de la página anterior. Ausente = primera página. */
|
|
11
|
+
nextToken?: string;
|
|
12
|
+
}
|
|
13
|
+
|
|
14
|
+
/**
|
|
15
|
+
* Lo mínimo para pintar el renglón de un cliente. `fullName: null` significa que el cliente existe
|
|
16
|
+
* y no tiene ninguna parte del nombre resuelta — es distinto de que el id no vuelva.
|
|
17
|
+
*/
|
|
18
|
+
export interface PrivateCustomerListItem {
|
|
19
|
+
retailCustomerId: string;
|
|
20
|
+
/** `names + paternalLastName + maternalLastName` ya compuesto por el destino. */
|
|
21
|
+
fullName: string | null;
|
|
22
|
+
phone: string | null;
|
|
23
|
+
/** Tienda donde se dio de alta. La ficha del backoffice la nombra y resuelve su KYC con ella. */
|
|
24
|
+
originStoreId: string | null;
|
|
25
|
+
/** Alta del cliente en ISO-8601 UTC. Es el orden del listado (descendente). */
|
|
26
|
+
createdAt: string;
|
|
27
|
+
}
|
|
@@ -9,6 +9,8 @@ import {
|
|
|
9
9
|
WelcomeBonusResponse,
|
|
10
10
|
} from "@fiado/type-kit/bin/retailCustomer/index.js";
|
|
11
11
|
import { CustomersBatchRequest, CustomersBatchResponse } from "../dtos/CustomersBatch.js";
|
|
12
|
+
import { CustomersPageQuery, PrivateCustomerListItem } from "../dtos/CustomersPage.js";
|
|
13
|
+
import { PaginatedResult } from "@fiado/type-kit/bin/retailOrg/index.js";
|
|
12
14
|
|
|
13
15
|
/**
|
|
14
16
|
* Contrato del publisher HTTP del lambda `retail-customer-business` (SureKeep Fase 2, pista Retail)
|
|
@@ -173,4 +175,22 @@ export interface IRetailCustomerBusinessApi {
|
|
|
173
175
|
payload: CustomersBatchRequest,
|
|
174
176
|
tenantId: string,
|
|
175
177
|
): Promise<StandardResponse<CustomersBatchResponse>>;
|
|
178
|
+
|
|
179
|
+
/**
|
|
180
|
+
* GET /private/customers?limit&nextToken&tenantId= — UNA página del padrón de clientes del
|
|
181
|
+
* tenant, del alta más reciente a la más vieja. Es el listado que alimenta las tablas de
|
|
182
|
+
* backoffice: una sola Query sobre el GSI de listado, sin fan-out por negocio.
|
|
183
|
+
*
|
|
184
|
+
* `nextToken` es OPACO: se pasea tal cual, no se compone ni se re-codifica. Ausente en la
|
|
185
|
+
* respuesta = última página. `count` son las filas de ESA página, nunca el total del padrón.
|
|
186
|
+
*
|
|
187
|
+
* `limit` default 25, máximo 100.
|
|
188
|
+
*
|
|
189
|
+
* @throws `400 INVALID_QUERY_PARAM` si `limit` no parsea o se pasa del tope.
|
|
190
|
+
* @throws `400 UNKNOWN_TENANT` si el `tenantId` viene ausente o desconocido.
|
|
191
|
+
*/
|
|
192
|
+
listCustomersPage(
|
|
193
|
+
query: CustomersPageQuery,
|
|
194
|
+
tenantId: string,
|
|
195
|
+
): Promise<StandardResponse<PaginatedResult<PrivateCustomerListItem>>>;
|
|
176
196
|
}
|