@fiado/api-invoker 5.50.1 → 5.52.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/package.json +2 -2
- package/src/collection-engine/api/CollectionEngineApi.ts +7 -0
- package/src/collection-engine/api/interfaces/ICollectionEngineApi.ts +17 -4
|
@@ -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`:
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@fiado/api-invoker",
|
|
3
|
-
"version": "5.
|
|
3
|
+
"version": "5.52.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.375.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`:
|