@fiado/api-invoker 5.51.0 → 5.53.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/collection-engine/api/CollectionEngineApi.d.ts +2 -1
- package/bin/collection-engine/api/CollectionEngineApi.js +4 -0
- package/bin/collection-engine/api/interfaces/ICollectionEngineApi.d.ts +15 -5
- package/bin/loanOfferings/api/LoanOfferingsBusinessApi.d.ts +2 -1
- package/bin/loanOfferings/api/LoanOfferingsBusinessApi.js +4 -0
- package/bin/loanOfferings/api/interfaces/ILoanOfferingsBusinessApi.d.ts +10 -1
- package/package.json +2 -2
- package/src/collection-engine/api/CollectionEngineApi.ts +7 -0
- package/src/collection-engine/api/interfaces/ICollectionEngineApi.ts +17 -4
- package/src/loanOfferings/api/LoanOfferingsBusinessApi.ts +9 -0
- package/src/loanOfferings/api/interfaces/ILoanOfferingsBusinessApi.ts +14 -0
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import type { IHttpRequest } from "@fiado/http-client";
|
|
2
|
-
import { CollectRequest, CollectResponse, DeregisterChargeResponse } from "@fiado/type-kit/bin/collection/index.js";
|
|
2
|
+
import { CollectRequest, CollectResponse, DeregisterChargeResponse, RegisterCollectibleRequest, RegisterCollectibleResponse } from "@fiado/type-kit/bin/collection/index.js";
|
|
3
3
|
import { ICollectionEngineApi } from "./interfaces/ICollectionEngineApi.js";
|
|
4
4
|
type FiadoApiResponse<T> = import("@fiado/type-kit/bin/apiResponse/dtos/FiadoApiResponse.js").default<T>;
|
|
5
5
|
/**
|
|
@@ -10,6 +10,7 @@ export default class CollectionEngineApi implements ICollectionEngineApi {
|
|
|
10
10
|
private httpRequest;
|
|
11
11
|
private readonly baseUrl;
|
|
12
12
|
constructor(httpRequest: IHttpRequest);
|
|
13
|
+
registerCollectible(request: RegisterCollectibleRequest): Promise<FiadoApiResponse<RegisterCollectibleResponse>>;
|
|
13
14
|
collect(request: CollectRequest): Promise<FiadoApiResponse<CollectResponse>>;
|
|
14
15
|
deregister(domain: string, chargeId: string): Promise<FiadoApiResponse<DeregisterChargeResponse>>;
|
|
15
16
|
}
|
|
@@ -21,6 +21,10 @@ let CollectionEngineApi = class CollectionEngineApi {
|
|
|
21
21
|
constructor(httpRequest) {
|
|
22
22
|
this.httpRequest = httpRequest;
|
|
23
23
|
}
|
|
24
|
+
async registerCollectible(request) {
|
|
25
|
+
const url = `${this.baseUrl}collection/register`;
|
|
26
|
+
return await this.httpRequest.post(url, request);
|
|
27
|
+
}
|
|
24
28
|
async collect(request) {
|
|
25
29
|
const url = `${this.baseUrl}collection/collect`;
|
|
26
30
|
return await this.httpRequest.post(url, request);
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { CollectRequest, CollectResponse, DeregisterChargeResponse } from "@fiado/type-kit/bin/collection/index.js";
|
|
1
|
+
import { CollectRequest, CollectResponse, DeregisterChargeResponse, RegisterCollectibleRequest, RegisterCollectibleResponse } from "@fiado/type-kit/bin/collection/index.js";
|
|
2
2
|
type FiadoApiResponse<T> = import("@fiado/type-kit/bin/apiResponse/dtos/FiadoApiResponse.js").default<T>;
|
|
3
3
|
/**
|
|
4
4
|
* Cliente para invocar los endpoints privados del lambda `collection-engine-business`.
|
|
@@ -6,12 +6,22 @@ type FiadoApiResponse<T> = import("@fiado/type-kit/bin/apiResponse/dtos/FiadoApi
|
|
|
6
6
|
* Los endpoints viven bajo `COLLECTION_ENGINE_LAMBDA_URL` (API Gateway privado / VPC).
|
|
7
7
|
* El motor es agnóstico de proveedores y cuentas: el dominio dice QUÉ se debe y el motor
|
|
8
8
|
* decide de dónde cobrarlo según la config del producto.
|
|
9
|
-
*
|
|
10
|
-
* El alta explícita de un cargo cobrable (`registerCollectible`) todavía no existe en el
|
|
11
|
-
* motor: hoy `collect` crea el intent si no lo había, derivando su identidad de
|
|
12
|
-
* `domain#chargeId`. El método se reincorporará cuando el motor exponga la ruta.
|
|
13
9
|
*/
|
|
14
10
|
export interface ICollectionEngineApi {
|
|
11
|
+
/**
|
|
12
|
+
* Alta de un cargo cobrable: el dominio avisa de que hay algo que cobrar, sin decir cuánto.
|
|
13
|
+
* El importe se le pregunta después, al ir a cobrarlo (`/collection/resolve-charges`), porque
|
|
14
|
+
* entre el alta y el cobro puede haber cambiado —por mora, o porque el cliente pagó por otra vía.
|
|
15
|
+
*
|
|
16
|
+
* A partir del alta, el cargo entra en los reintentos del motor: se cobra en cuanto el titular
|
|
17
|
+
* tiene saldo, sin que el dominio tenga que volver a pedirlo.
|
|
18
|
+
*
|
|
19
|
+
* Idempotente por `domain#chargeId`: repetir el alta devuelve `ALREADY_REGISTERED` con el mismo
|
|
20
|
+
* `intentId`, sin duplicar nada.
|
|
21
|
+
*
|
|
22
|
+
* Backend: POST /collection/register (privado VPC).
|
|
23
|
+
*/
|
|
24
|
+
registerCollectible(request: RegisterCollectibleRequest): Promise<FiadoApiResponse<RegisterCollectibleResponse>>;
|
|
15
25
|
/**
|
|
16
26
|
* Cobro on-demand síncrono. El dominio manda el cargo ya resuelto y el motor recorre la
|
|
17
27
|
* cascada de fuentes configurada para el producto. Idempotente por `domain#chargeId`:
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import type { IHttpRequest } from "@fiado/http-client";
|
|
2
2
|
import { StandardResponse } from "@fiado/gateway-adapter";
|
|
3
|
-
import { ConsumePromotionRequest, ConsumePromotionResponse, CreditPlanResponse, FinancierResponse, SimulateCreditPlanRequest, SimulationResultResponse } from "@fiado/type-kit/bin/loanOfferings/index.js";
|
|
3
|
+
import { ConsumePromotionRequest, PromotedSkusResponse, ConsumePromotionResponse, CreditPlanResponse, FinancierResponse, SimulateCreditPlanRequest, SimulationResultResponse } from "@fiado/type-kit/bin/loanOfferings/index.js";
|
|
4
4
|
import { ILoanOfferingsBusinessApi } from "./interfaces/ILoanOfferingsBusinessApi.js";
|
|
5
5
|
/**
|
|
6
6
|
* Publisher HTTP del lambda `loan-offerings-business` (componente 07 SureKeep Fase 1) para sus 5
|
|
@@ -23,4 +23,5 @@ export default class LoanOfferingsBusinessApi implements ILoanOfferingsBusinessA
|
|
|
23
23
|
listActiveFinanciers(tenantId: string): Promise<StandardResponse<FinancierResponse[]>>;
|
|
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
|
+
listPromotedSkus(storeId: string, tenantId: string): Promise<StandardResponse<PromotedSkusResponse>>;
|
|
26
27
|
}
|
|
@@ -50,6 +50,10 @@ let LoanOfferingsBusinessApi = class LoanOfferingsBusinessApi {
|
|
|
50
50
|
const url = `${this.baseUrl}/private/promotions/${encodeURIComponent(promotionId)}/consume?tenantId=${encodeURIComponent(tenantId)}`;
|
|
51
51
|
return await this.httpRequest.post(url, input);
|
|
52
52
|
}
|
|
53
|
+
async listPromotedSkus(storeId, tenantId) {
|
|
54
|
+
const url = `${this.baseUrl}/private/promotions/promoted-skus?storeId=${encodeURIComponent(storeId)}&tenantId=${encodeURIComponent(tenantId)}`;
|
|
55
|
+
return await this.httpRequest.get(url);
|
|
56
|
+
}
|
|
53
57
|
};
|
|
54
58
|
LoanOfferingsBusinessApi = __decorate([
|
|
55
59
|
injectable(),
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { StandardResponse } from "@fiado/gateway-adapter";
|
|
2
|
-
import { ConsumePromotionRequest, ConsumePromotionResponse, CreditPlanResponse, FinancierResponse, SimulateCreditPlanRequest, SimulationResultResponse } from "@fiado/type-kit/bin/loanOfferings/index.js";
|
|
2
|
+
import { ConsumePromotionRequest, PromotedSkusResponse, ConsumePromotionResponse, CreditPlanResponse, FinancierResponse, 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
5
|
* para sus 5 endpoints privados service-to-service (VPC-only): 4 de LECTURA del catálogo SOFOM y
|
|
@@ -74,4 +74,13 @@ export interface ILoanOfferingsBusinessApi {
|
|
|
74
74
|
* @throws si la promoción no existe (`404 PROMOTION_NOT_FOUND`).
|
|
75
75
|
*/
|
|
76
76
|
consumePromotion(promotionId: string, input: ConsumePromotionRequest, tenantId: string): Promise<StandardResponse<ConsumePromotionResponse>>;
|
|
77
|
+
/**
|
|
78
|
+
* GET /private/promotions/promoted-skus — los SKUs con promoción viva en una tienda, para el
|
|
79
|
+
* badge del catálogo del wizard. Devuelve `{ skus: [] }` si no hay ninguna; nunca 404.
|
|
80
|
+
*
|
|
81
|
+
* El filtrado vive en el lambda, no acá: solo entran las promociones que alcanzan a CUALQUIER
|
|
82
|
+
* nivel (el catálogo se pinta antes del score) y las que ACOTAN por SKU (una general marcaría
|
|
83
|
+
* el catálogo entero). El caller no puede aflojar ese criterio.
|
|
84
|
+
*/
|
|
85
|
+
listPromotedSkus(storeId: string, tenantId: string): Promise<StandardResponse<PromotedSkusResponse>>;
|
|
77
86
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@fiado/api-invoker",
|
|
3
|
-
"version": "5.
|
|
3
|
+
"version": "5.53.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.381.0",
|
|
38
38
|
"dotenv": "^16.4.7"
|
|
39
39
|
},
|
|
40
40
|
"peerDependencies": {
|
|
@@ -4,6 +4,8 @@ import {
|
|
|
4
4
|
CollectRequest,
|
|
5
5
|
CollectResponse,
|
|
6
6
|
DeregisterChargeResponse,
|
|
7
|
+
RegisterCollectibleRequest,
|
|
8
|
+
RegisterCollectibleResponse,
|
|
7
9
|
} from "@fiado/type-kit/bin/collection/index.js";
|
|
8
10
|
import { ICollectionEngineApi } from "./interfaces/ICollectionEngineApi.js";
|
|
9
11
|
|
|
@@ -21,6 +23,11 @@ export default class CollectionEngineApi implements ICollectionEngineApi {
|
|
|
21
23
|
constructor(@inject("IHttpRequest") private httpRequest: IHttpRequest) {
|
|
22
24
|
}
|
|
23
25
|
|
|
26
|
+
async registerCollectible(request: RegisterCollectibleRequest): Promise<FiadoApiResponse<RegisterCollectibleResponse>> {
|
|
27
|
+
const url = `${this.baseUrl}collection/register`;
|
|
28
|
+
return await this.httpRequest.post(url, request);
|
|
29
|
+
}
|
|
30
|
+
|
|
24
31
|
async collect(request: CollectRequest): Promise<FiadoApiResponse<CollectResponse>> {
|
|
25
32
|
const url = `${this.baseUrl}collection/collect`;
|
|
26
33
|
return await this.httpRequest.post(url, request);
|
|
@@ -2,6 +2,8 @@ import {
|
|
|
2
2
|
CollectRequest,
|
|
3
3
|
CollectResponse,
|
|
4
4
|
DeregisterChargeResponse,
|
|
5
|
+
RegisterCollectibleRequest,
|
|
6
|
+
RegisterCollectibleResponse,
|
|
5
7
|
} from "@fiado/type-kit/bin/collection/index.js";
|
|
6
8
|
|
|
7
9
|
type FiadoApiResponse<T> = import("@fiado/type-kit/bin/apiResponse/dtos/FiadoApiResponse.js").default<T>;
|
|
@@ -12,13 +14,24 @@ type FiadoApiResponse<T> = import("@fiado/type-kit/bin/apiResponse/dtos/FiadoApi
|
|
|
12
14
|
* Los endpoints viven bajo `COLLECTION_ENGINE_LAMBDA_URL` (API Gateway privado / VPC).
|
|
13
15
|
* El motor es agnóstico de proveedores y cuentas: el dominio dice QUÉ se debe y el motor
|
|
14
16
|
* decide de dónde cobrarlo según la config del producto.
|
|
15
|
-
*
|
|
16
|
-
* El alta explícita de un cargo cobrable (`registerCollectible`) todavía no existe en el
|
|
17
|
-
* motor: hoy `collect` crea el intent si no lo había, derivando su identidad de
|
|
18
|
-
* `domain#chargeId`. El método se reincorporará cuando el motor exponga la ruta.
|
|
19
17
|
*/
|
|
20
18
|
export interface ICollectionEngineApi {
|
|
21
19
|
|
|
20
|
+
/**
|
|
21
|
+
* Alta de un cargo cobrable: el dominio avisa de que hay algo que cobrar, sin decir cuánto.
|
|
22
|
+
* El importe se le pregunta después, al ir a cobrarlo (`/collection/resolve-charges`), porque
|
|
23
|
+
* entre el alta y el cobro puede haber cambiado —por mora, o porque el cliente pagó por otra vía.
|
|
24
|
+
*
|
|
25
|
+
* A partir del alta, el cargo entra en los reintentos del motor: se cobra en cuanto el titular
|
|
26
|
+
* tiene saldo, sin que el dominio tenga que volver a pedirlo.
|
|
27
|
+
*
|
|
28
|
+
* Idempotente por `domain#chargeId`: repetir el alta devuelve `ALREADY_REGISTERED` con el mismo
|
|
29
|
+
* `intentId`, sin duplicar nada.
|
|
30
|
+
*
|
|
31
|
+
* Backend: POST /collection/register (privado VPC).
|
|
32
|
+
*/
|
|
33
|
+
registerCollectible(request: RegisterCollectibleRequest): Promise<FiadoApiResponse<RegisterCollectibleResponse>>;
|
|
34
|
+
|
|
22
35
|
/**
|
|
23
36
|
* Cobro on-demand síncrono. El dominio manda el cargo ya resuelto y el motor recorre la
|
|
24
37
|
* cascada de fuentes configurada para el producto. Idempotente por `domain#chargeId`:
|
|
@@ -3,6 +3,7 @@ import type { IHttpRequest } from "@fiado/http-client";
|
|
|
3
3
|
import { StandardResponse } from "@fiado/gateway-adapter";
|
|
4
4
|
import {
|
|
5
5
|
ConsumePromotionRequest,
|
|
6
|
+
PromotedSkusResponse,
|
|
6
7
|
ConsumePromotionResponse,
|
|
7
8
|
CreditPlanResponse,
|
|
8
9
|
FinancierResponse,
|
|
@@ -70,4 +71,12 @@ export default class LoanOfferingsBusinessApi implements ILoanOfferingsBusinessA
|
|
|
70
71
|
const url = `${this.baseUrl}/private/promotions/${encodeURIComponent(promotionId)}/consume?tenantId=${encodeURIComponent(tenantId)}`;
|
|
71
72
|
return await this.httpRequest.post(url, input);
|
|
72
73
|
}
|
|
74
|
+
|
|
75
|
+
async listPromotedSkus(
|
|
76
|
+
storeId: string,
|
|
77
|
+
tenantId: string,
|
|
78
|
+
): Promise<StandardResponse<PromotedSkusResponse>> {
|
|
79
|
+
const url = `${this.baseUrl}/private/promotions/promoted-skus?storeId=${encodeURIComponent(storeId)}&tenantId=${encodeURIComponent(tenantId)}`;
|
|
80
|
+
return await this.httpRequest.get(url);
|
|
81
|
+
}
|
|
73
82
|
}
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import { StandardResponse } from "@fiado/gateway-adapter";
|
|
2
2
|
import {
|
|
3
3
|
ConsumePromotionRequest,
|
|
4
|
+
PromotedSkusResponse,
|
|
4
5
|
ConsumePromotionResponse,
|
|
5
6
|
CreditPlanResponse,
|
|
6
7
|
FinancierResponse,
|
|
@@ -102,4 +103,17 @@ export interface ILoanOfferingsBusinessApi {
|
|
|
102
103
|
input: ConsumePromotionRequest,
|
|
103
104
|
tenantId: string,
|
|
104
105
|
): Promise<StandardResponse<ConsumePromotionResponse>>;
|
|
106
|
+
|
|
107
|
+
/**
|
|
108
|
+
* GET /private/promotions/promoted-skus — los SKUs con promoción viva en una tienda, para el
|
|
109
|
+
* badge del catálogo del wizard. Devuelve `{ skus: [] }` si no hay ninguna; nunca 404.
|
|
110
|
+
*
|
|
111
|
+
* El filtrado vive en el lambda, no acá: solo entran las promociones que alcanzan a CUALQUIER
|
|
112
|
+
* nivel (el catálogo se pinta antes del score) y las que ACOTAN por SKU (una general marcaría
|
|
113
|
+
* el catálogo entero). El caller no puede aflojar ese criterio.
|
|
114
|
+
*/
|
|
115
|
+
listPromotedSkus(
|
|
116
|
+
storeId: string,
|
|
117
|
+
tenantId: string,
|
|
118
|
+
): Promise<StandardResponse<PromotedSkusResponse>>;
|
|
105
119
|
}
|