@fiado/api-invoker 5.54.0 → 5.56.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/loanOfferings/api/LoanOfferingsBusinessApi.d.ts +5 -2
- package/bin/loanOfferings/api/LoanOfferingsBusinessApi.js +13 -1
- package/bin/loanOfferings/api/interfaces/ILoanOfferingsBusinessApi.d.ts +32 -3
- package/package.json +2 -2
- package/src/loanOfferings/api/LoanOfferingsBusinessApi.ts +33 -1
- package/src/loanOfferings/api/interfaces/ILoanOfferingsBusinessApi.ts +51 -2
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import type { IHttpRequest } from "@fiado/http-client";
|
|
2
2
|
import { StandardResponse } from "@fiado/gateway-adapter";
|
|
3
|
-
import { ConsumePromotionRequest, PromotedSkusResponse, ConsumePromotionResponse, CreditPlanResponse, FinancierResponse, SimulateCreditPlanRequest, SimulationResultResponse } from "@fiado/type-kit/bin/loanOfferings/index.js";
|
|
3
|
+
import { ConsumePromotionRequest, PromotedSkusResponse, ConsumePromotionResponse, CreditPlanResponse, FinancierResponse, ReservePromotionBonusRequest, ReservePromotionBonusResponse, ResolveCustomerSegmentsRequest, ResolveCustomerSegmentsResponse, SettlePromotionBonusRequest, PromotionBonusResponse, SimulateCreditPlanRequest, SimulationResultResponse } from "@fiado/type-kit/bin/loanOfferings/index.js";
|
|
4
4
|
import { ILoanOfferingsBusinessApi } from "./interfaces/ILoanOfferingsBusinessApi.js";
|
|
5
5
|
/**
|
|
6
|
-
* Publisher HTTP del lambda `loan-offerings-business` (componente 07 SureKeep Fase 1) para sus
|
|
6
|
+
* Publisher HTTP del lambda `loan-offerings-business` (componente 07 SureKeep Fase 1) para sus
|
|
7
7
|
* endpoints privados. Contrato y semántica completos →
|
|
8
8
|
* `ILoanOfferingsBusinessApi` (tenantId obligatorio, `StandardResponse` → leer `result.data`).
|
|
9
9
|
*
|
|
@@ -24,4 +24,7 @@ export default class LoanOfferingsBusinessApi implements ILoanOfferingsBusinessA
|
|
|
24
24
|
simulate(planId: string, input: SimulateCreditPlanRequest, tenantId: string): Promise<StandardResponse<SimulationResultResponse>>;
|
|
25
25
|
consumePromotion(promotionId: string, input: ConsumePromotionRequest, tenantId: string): Promise<StandardResponse<ConsumePromotionResponse>>;
|
|
26
26
|
listPromotedSkus(storeId: string, tenantId: string): Promise<StandardResponse<PromotedSkusResponse>>;
|
|
27
|
+
resolveCustomerSegments(input: ResolveCustomerSegmentsRequest, tenantId: string): Promise<StandardResponse<ResolveCustomerSegmentsResponse>>;
|
|
28
|
+
reservePromotionBonus(promotionId: string, input: ReservePromotionBonusRequest, tenantId: string): Promise<StandardResponse<ReservePromotionBonusResponse>>;
|
|
29
|
+
settlePromotionBonus(promotionId: string, input: SettlePromotionBonusRequest, tenantId: string): Promise<StandardResponse<PromotionBonusResponse>>;
|
|
27
30
|
}
|
|
@@ -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 `loan-offerings-business` (componente 07 SureKeep Fase 1) para sus
|
|
15
|
+
* Publisher HTTP del lambda `loan-offerings-business` (componente 07 SureKeep Fase 1) para sus
|
|
16
16
|
* endpoints privados. Contrato y semántica completos →
|
|
17
17
|
* `ILoanOfferingsBusinessApi` (tenantId obligatorio, `StandardResponse` → leer `result.data`).
|
|
18
18
|
*
|
|
@@ -54,6 +54,18 @@ let LoanOfferingsBusinessApi = class LoanOfferingsBusinessApi {
|
|
|
54
54
|
const url = `${this.baseUrl}/private/promotions/promoted-skus?storeId=${encodeURIComponent(storeId)}&tenantId=${encodeURIComponent(tenantId)}`;
|
|
55
55
|
return await this.httpRequest.get(url);
|
|
56
56
|
}
|
|
57
|
+
async resolveCustomerSegments(input, tenantId) {
|
|
58
|
+
const url = `${this.baseUrl}/private/segments/resolve?tenantId=${encodeURIComponent(tenantId)}`;
|
|
59
|
+
return await this.httpRequest.post(url, input);
|
|
60
|
+
}
|
|
61
|
+
async reservePromotionBonus(promotionId, input, tenantId) {
|
|
62
|
+
const url = `${this.baseUrl}/private/promotions/${encodeURIComponent(promotionId)}/bonus-payment?tenantId=${encodeURIComponent(tenantId)}`;
|
|
63
|
+
return await this.httpRequest.post(url, input);
|
|
64
|
+
}
|
|
65
|
+
async settlePromotionBonus(promotionId, input, tenantId) {
|
|
66
|
+
const url = `${this.baseUrl}/private/promotions/${encodeURIComponent(promotionId)}/bonus-payment/result?tenantId=${encodeURIComponent(tenantId)}`;
|
|
67
|
+
return await this.httpRequest.put(url, input);
|
|
68
|
+
}
|
|
57
69
|
};
|
|
58
70
|
LoanOfferingsBusinessApi = __decorate([
|
|
59
71
|
injectable(),
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import { StandardResponse } from "@fiado/gateway-adapter";
|
|
2
|
-
import { ConsumePromotionRequest, PromotedSkusResponse, ConsumePromotionResponse, CreditPlanResponse, FinancierResponse, SimulateCreditPlanRequest, SimulationResultResponse } from "@fiado/type-kit/bin/loanOfferings/index.js";
|
|
2
|
+
import { ConsumePromotionRequest, PromotedSkusResponse, ConsumePromotionResponse, CreditPlanResponse, FinancierResponse, ReservePromotionBonusRequest, ReservePromotionBonusResponse, ResolveCustomerSegmentsRequest, ResolveCustomerSegmentsResponse, SettlePromotionBonusRequest, PromotionBonusResponse, SimulateCreditPlanRequest, SimulationResultResponse } from "@fiado/type-kit/bin/loanOfferings/index.js";
|
|
3
3
|
/**
|
|
4
4
|
* Contrato del publisher HTTP del lambda `loan-offerings-business` (componente 07 SureKeep Fase 1)
|
|
5
|
-
* para sus
|
|
5
|
+
* para sus endpoints privados service-to-service (VPC-only): LECTURAS del catálogo SOFOM y
|
|
6
6
|
* 1 de ESCRITURA que registra el consumo de una promoción.
|
|
7
7
|
*
|
|
8
8
|
* loan-offerings es el catálogo comercial del SOFOM: planes de crédito + financieras + la relación
|
|
@@ -11,7 +11,7 @@ import { ConsumePromotionRequest, PromotedSkusResponse, ConsumePromotionResponse
|
|
|
11
11
|
* - motor de crédito (F3) → leer un plan · simular la cuota (amortización + IVA + CAT)
|
|
12
12
|
*
|
|
13
13
|
* ─────────────────────────────────────────────────────────────────────────────
|
|
14
|
-
* `tenantId` es OBLIGATORIO en los
|
|
14
|
+
* `tenantId` es OBLIGATORIO en todos los métodos — no es un detalle de firma.
|
|
15
15
|
* ─────────────────────────────────────────────────────────────────────────────
|
|
16
16
|
* Los privados NO llevan token de usuario (`Feature.ANONIMUS`; la protección es la red VPC), así que
|
|
17
17
|
* el lambda destino no tiene `AuthContext.issuer` y NO puede inferir el silo. El caller declara el
|
|
@@ -83,4 +83,33 @@ export interface ILoanOfferingsBusinessApi {
|
|
|
83
83
|
* el catálogo entero). El caller no puede aflojar ese criterio.
|
|
84
84
|
*/
|
|
85
85
|
listPromotedSkus(storeId: string, tenantId: string): Promise<StandardResponse<PromotedSkusResponse>>;
|
|
86
|
+
/**
|
|
87
|
+
* POST /private/segments/resolve — los segmentos a los que pertenece el cliente HOY, evaluados
|
|
88
|
+
* en línea contra los hechos que manda el caller. No hay segmento persistido en el cliente.
|
|
89
|
+
*
|
|
90
|
+
* Los hechos los junta quien ya tiene al cliente delante; este lambda no sale a buscarlos a
|
|
91
|
+
* otro silo. Un hecho AUSENTE hace que su filtro NO se cumpla: sin el dato no se puede afirmar
|
|
92
|
+
* que el cliente califica, y de las dos salidas la segura es dejarlo fuera.
|
|
93
|
+
*
|
|
94
|
+
* `segmentIds` puede venir VACÍO y eso no es un error: significa que el cliente está en
|
|
95
|
+
* Estándar, el catch-all, que nunca se devuelve aquí.
|
|
96
|
+
*
|
|
97
|
+
* El resultado alimenta `customerSegmentIds` de {@link simulate}: sin él, las políticas de
|
|
98
|
+
* tienda acotadas a un segmento no aplican, y las que tienen compuerta encendida rechazan la
|
|
99
|
+
* venta con `422 STORE_POLICY_SCOPE_UNKNOWN`.
|
|
100
|
+
*
|
|
101
|
+
* @throws si el body no trae `retailCustomerId` o un hecho tiene el tipo equivocado
|
|
102
|
+
* (`400`), o si falta el tenant (`400 UNKNOWN_TENANT`).
|
|
103
|
+
*/
|
|
104
|
+
resolveCustomerSegments(input: ResolveCustomerSegmentsRequest, tenantId: string): Promise<StandardResponse<ResolveCustomerSegmentsResponse>>;
|
|
105
|
+
/**
|
|
106
|
+
* `POST /private/promotions/{promotionId}/bonus-payment` — reserva el bono PCF de un crédito
|
|
107
|
+
* recién activado. El candado es el `creditId`: reenviarlo devuelve `reserved: false`.
|
|
108
|
+
*/
|
|
109
|
+
reservePromotionBonus(promotionId: string, input: ReservePromotionBonusRequest, tenantId: string): Promise<StandardResponse<ReservePromotionBonusResponse>>;
|
|
110
|
+
/**
|
|
111
|
+
* `PUT /private/promotions/{promotionId}/bonus-payment/result` — cierra el asiento con lo que
|
|
112
|
+
* contestó el processor. Se llama SIEMPRE, haya pagado o no.
|
|
113
|
+
*/
|
|
114
|
+
settlePromotionBonus(promotionId: string, input: SettlePromotionBonusRequest, tenantId: string): Promise<StandardResponse<PromotionBonusResponse>>;
|
|
86
115
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@fiado/api-invoker",
|
|
3
|
-
"version": "5.
|
|
3
|
+
"version": "5.56.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.385.0",
|
|
38
38
|
"dotenv": "^16.4.7"
|
|
39
39
|
},
|
|
40
40
|
"peerDependencies": {
|
|
@@ -7,13 +7,19 @@ import {
|
|
|
7
7
|
ConsumePromotionResponse,
|
|
8
8
|
CreditPlanResponse,
|
|
9
9
|
FinancierResponse,
|
|
10
|
+
ReservePromotionBonusRequest,
|
|
11
|
+
ReservePromotionBonusResponse,
|
|
12
|
+
ResolveCustomerSegmentsRequest,
|
|
13
|
+
ResolveCustomerSegmentsResponse,
|
|
14
|
+
SettlePromotionBonusRequest,
|
|
15
|
+
PromotionBonusResponse,
|
|
10
16
|
SimulateCreditPlanRequest,
|
|
11
17
|
SimulationResultResponse,
|
|
12
18
|
} from "@fiado/type-kit/bin/loanOfferings/index.js";
|
|
13
19
|
import { ILoanOfferingsBusinessApi } from "./interfaces/ILoanOfferingsBusinessApi.js";
|
|
14
20
|
|
|
15
21
|
/**
|
|
16
|
-
* Publisher HTTP del lambda `loan-offerings-business` (componente 07 SureKeep Fase 1) para sus
|
|
22
|
+
* Publisher HTTP del lambda `loan-offerings-business` (componente 07 SureKeep Fase 1) para sus
|
|
17
23
|
* endpoints privados. Contrato y semántica completos →
|
|
18
24
|
* `ILoanOfferingsBusinessApi` (tenantId obligatorio, `StandardResponse` → leer `result.data`).
|
|
19
25
|
*
|
|
@@ -79,4 +85,30 @@ export default class LoanOfferingsBusinessApi implements ILoanOfferingsBusinessA
|
|
|
79
85
|
const url = `${this.baseUrl}/private/promotions/promoted-skus?storeId=${encodeURIComponent(storeId)}&tenantId=${encodeURIComponent(tenantId)}`;
|
|
80
86
|
return await this.httpRequest.get(url);
|
|
81
87
|
}
|
|
88
|
+
|
|
89
|
+
async resolveCustomerSegments(
|
|
90
|
+
input: ResolveCustomerSegmentsRequest,
|
|
91
|
+
tenantId: string,
|
|
92
|
+
): Promise<StandardResponse<ResolveCustomerSegmentsResponse>> {
|
|
93
|
+
const url = `${this.baseUrl}/private/segments/resolve?tenantId=${encodeURIComponent(tenantId)}`;
|
|
94
|
+
return await this.httpRequest.post(url, input);
|
|
95
|
+
}
|
|
96
|
+
|
|
97
|
+
async reservePromotionBonus(
|
|
98
|
+
promotionId: string,
|
|
99
|
+
input: ReservePromotionBonusRequest,
|
|
100
|
+
tenantId: string,
|
|
101
|
+
): Promise<StandardResponse<ReservePromotionBonusResponse>> {
|
|
102
|
+
const url = `${this.baseUrl}/private/promotions/${encodeURIComponent(promotionId)}/bonus-payment?tenantId=${encodeURIComponent(tenantId)}`;
|
|
103
|
+
return await this.httpRequest.post(url, input);
|
|
104
|
+
}
|
|
105
|
+
|
|
106
|
+
async settlePromotionBonus(
|
|
107
|
+
promotionId: string,
|
|
108
|
+
input: SettlePromotionBonusRequest,
|
|
109
|
+
tenantId: string,
|
|
110
|
+
): Promise<StandardResponse<PromotionBonusResponse>> {
|
|
111
|
+
const url = `${this.baseUrl}/private/promotions/${encodeURIComponent(promotionId)}/bonus-payment/result?tenantId=${encodeURIComponent(tenantId)}`;
|
|
112
|
+
return await this.httpRequest.put(url, input);
|
|
113
|
+
}
|
|
82
114
|
}
|
|
@@ -5,13 +5,19 @@ import {
|
|
|
5
5
|
ConsumePromotionResponse,
|
|
6
6
|
CreditPlanResponse,
|
|
7
7
|
FinancierResponse,
|
|
8
|
+
ReservePromotionBonusRequest,
|
|
9
|
+
ReservePromotionBonusResponse,
|
|
10
|
+
ResolveCustomerSegmentsRequest,
|
|
11
|
+
ResolveCustomerSegmentsResponse,
|
|
12
|
+
SettlePromotionBonusRequest,
|
|
13
|
+
PromotionBonusResponse,
|
|
8
14
|
SimulateCreditPlanRequest,
|
|
9
15
|
SimulationResultResponse,
|
|
10
16
|
} from "@fiado/type-kit/bin/loanOfferings/index.js";
|
|
11
17
|
|
|
12
18
|
/**
|
|
13
19
|
* Contrato del publisher HTTP del lambda `loan-offerings-business` (componente 07 SureKeep Fase 1)
|
|
14
|
-
* para sus
|
|
20
|
+
* para sus endpoints privados service-to-service (VPC-only): LECTURAS del catálogo SOFOM y
|
|
15
21
|
* 1 de ESCRITURA que registra el consumo de una promoción.
|
|
16
22
|
*
|
|
17
23
|
* loan-offerings es el catálogo comercial del SOFOM: planes de crédito + financieras + la relación
|
|
@@ -20,7 +26,7 @@ import {
|
|
|
20
26
|
* - motor de crédito (F3) → leer un plan · simular la cuota (amortización + IVA + CAT)
|
|
21
27
|
*
|
|
22
28
|
* ─────────────────────────────────────────────────────────────────────────────
|
|
23
|
-
* `tenantId` es OBLIGATORIO en los
|
|
29
|
+
* `tenantId` es OBLIGATORIO en todos los métodos — no es un detalle de firma.
|
|
24
30
|
* ─────────────────────────────────────────────────────────────────────────────
|
|
25
31
|
* Los privados NO llevan token de usuario (`Feature.ANONIMUS`; la protección es la red VPC), así que
|
|
26
32
|
* el lambda destino no tiene `AuthContext.issuer` y NO puede inferir el silo. El caller declara el
|
|
@@ -116,4 +122,47 @@ export interface ILoanOfferingsBusinessApi {
|
|
|
116
122
|
storeId: string,
|
|
117
123
|
tenantId: string,
|
|
118
124
|
): Promise<StandardResponse<PromotedSkusResponse>>;
|
|
125
|
+
|
|
126
|
+
/**
|
|
127
|
+
* POST /private/segments/resolve — los segmentos a los que pertenece el cliente HOY, evaluados
|
|
128
|
+
* en línea contra los hechos que manda el caller. No hay segmento persistido en el cliente.
|
|
129
|
+
*
|
|
130
|
+
* Los hechos los junta quien ya tiene al cliente delante; este lambda no sale a buscarlos a
|
|
131
|
+
* otro silo. Un hecho AUSENTE hace que su filtro NO se cumpla: sin el dato no se puede afirmar
|
|
132
|
+
* que el cliente califica, y de las dos salidas la segura es dejarlo fuera.
|
|
133
|
+
*
|
|
134
|
+
* `segmentIds` puede venir VACÍO y eso no es un error: significa que el cliente está en
|
|
135
|
+
* Estándar, el catch-all, que nunca se devuelve aquí.
|
|
136
|
+
*
|
|
137
|
+
* El resultado alimenta `customerSegmentIds` de {@link simulate}: sin él, las políticas de
|
|
138
|
+
* tienda acotadas a un segmento no aplican, y las que tienen compuerta encendida rechazan la
|
|
139
|
+
* venta con `422 STORE_POLICY_SCOPE_UNKNOWN`.
|
|
140
|
+
*
|
|
141
|
+
* @throws si el body no trae `retailCustomerId` o un hecho tiene el tipo equivocado
|
|
142
|
+
* (`400`), o si falta el tenant (`400 UNKNOWN_TENANT`).
|
|
143
|
+
*/
|
|
144
|
+
resolveCustomerSegments(
|
|
145
|
+
input: ResolveCustomerSegmentsRequest,
|
|
146
|
+
tenantId: string,
|
|
147
|
+
): Promise<StandardResponse<ResolveCustomerSegmentsResponse>>;
|
|
148
|
+
|
|
149
|
+
/**
|
|
150
|
+
* `POST /private/promotions/{promotionId}/bonus-payment` — reserva el bono PCF de un crédito
|
|
151
|
+
* recién activado. El candado es el `creditId`: reenviarlo devuelve `reserved: false`.
|
|
152
|
+
*/
|
|
153
|
+
reservePromotionBonus(
|
|
154
|
+
promotionId: string,
|
|
155
|
+
input: ReservePromotionBonusRequest,
|
|
156
|
+
tenantId: string,
|
|
157
|
+
): Promise<StandardResponse<ReservePromotionBonusResponse>>;
|
|
158
|
+
|
|
159
|
+
/**
|
|
160
|
+
* `PUT /private/promotions/{promotionId}/bonus-payment/result` — cierra el asiento con lo que
|
|
161
|
+
* contestó el processor. Se llama SIEMPRE, haya pagado o no.
|
|
162
|
+
*/
|
|
163
|
+
settlePromotionBonus(
|
|
164
|
+
promotionId: string,
|
|
165
|
+
input: SettlePromotionBonusRequest,
|
|
166
|
+
tenantId: string,
|
|
167
|
+
): Promise<StandardResponse<PromotionBonusResponse>>;
|
|
119
168
|
}
|