@fiado/api-invoker 5.16.0 → 5.17.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/container.config.js +3 -0
- package/bin/domain-callback/api/DomainCallbackApi.d.ts +15 -0
- package/bin/domain-callback/api/DomainCallbackApi.js +34 -0
- package/bin/domain-callback/api/interfaces/IDomainCallbackApi.d.ts +19 -0
- package/bin/domain-callback/api/interfaces/IDomainCallbackApi.js +1 -0
- package/bin/domain-callback/index.d.ts +2 -0
- package/bin/domain-callback/index.js +2 -0
- package/bin/index.d.ts +1 -0
- package/bin/index.js +1 -0
- package/package.json +2 -2
- package/src/container.config.ts +7 -0
- package/src/domain-callback/api/DomainCallbackApi.ts +23 -0
- package/src/domain-callback/api/interfaces/IDomainCallbackApi.ts +21 -0
- package/src/domain-callback/index.ts +2 -0
- package/src/index.ts +1 -0
package/bin/container.config.js
CHANGED
|
@@ -129,6 +129,7 @@ import { AuthBusinessApi } from "./auth-business/index.js";
|
|
|
129
129
|
// KYC verifications business — lectura confirmatoria server-side del KYC por directoryId (SureKeep F2)
|
|
130
130
|
import { KycVerificationsBusinessApi } from "./kyc/index.js";
|
|
131
131
|
import CollectionEngineApi from "./collection-engine/api/CollectionEngineApi.js";
|
|
132
|
+
import DomainCallbackApi from "./domain-callback/api/DomainCallbackApi.js";
|
|
132
133
|
export const apiInvokerBindings = new ContainerModule(({ bind }) => {
|
|
133
134
|
// UTILS bindings
|
|
134
135
|
bind("InvokerUtils").to(InvokerUtils);
|
|
@@ -274,4 +275,6 @@ export const apiInvokerBindings = new ContainerModule(({ bind }) => {
|
|
|
274
275
|
bind("IKycVerificationsBusinessApi").to(KycVerificationsBusinessApi);
|
|
275
276
|
// Collection engine — motor de cobro central multitenant (collect/registerCollectible/deregister)
|
|
276
277
|
bind("ICollectionEngineApi").to(CollectionEngineApi);
|
|
278
|
+
// Domain callback — el motor notifica al dominio dueño del cargo (applyCollectionResult)
|
|
279
|
+
bind("IDomainCallbackApi").to(DomainCallbackApi);
|
|
277
280
|
});
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import type { IHttpRequest } from "@fiado/http-client";
|
|
2
|
+
import { ApplyCollectionResultRequest } from "@fiado/type-kit/bin/collection/index.js";
|
|
3
|
+
import { IDomainCallbackApi } from "./interfaces/IDomainCallbackApi.js";
|
|
4
|
+
type FiadoApiResponse<T> = import("@fiado/type-kit/bin/apiResponse/dtos/FiadoApiResponse.js").default<T>;
|
|
5
|
+
/**
|
|
6
|
+
* Cliente genérico del callback de cobro (motor → dominio). La baseUrl no viene de una env
|
|
7
|
+
* fija del constructor: el motor la resuelve por `domain` (registry `domain→API`) y la pasa
|
|
8
|
+
* en cada llamada, así este mismo cliente sirve para cualquier dominio consumidor.
|
|
9
|
+
*/
|
|
10
|
+
export default class DomainCallbackApi implements IDomainCallbackApi {
|
|
11
|
+
private httpRequest;
|
|
12
|
+
constructor(httpRequest: IHttpRequest);
|
|
13
|
+
applyCollectionResult(baseUrl: string, request: ApplyCollectionResultRequest): Promise<FiadoApiResponse<boolean>>;
|
|
14
|
+
}
|
|
15
|
+
export {};
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
|
|
2
|
+
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
3
|
+
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
|
4
|
+
else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
|
5
|
+
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
6
|
+
};
|
|
7
|
+
var __metadata = (this && this.__metadata) || function (k, v) {
|
|
8
|
+
if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
|
|
9
|
+
};
|
|
10
|
+
var __param = (this && this.__param) || function (paramIndex, decorator) {
|
|
11
|
+
return function (target, key) { decorator(target, key, paramIndex); }
|
|
12
|
+
};
|
|
13
|
+
import { inject, injectable } from "inversify";
|
|
14
|
+
/**
|
|
15
|
+
* Cliente genérico del callback de cobro (motor → dominio). La baseUrl no viene de una env
|
|
16
|
+
* fija del constructor: el motor la resuelve por `domain` (registry `domain→API`) y la pasa
|
|
17
|
+
* en cada llamada, así este mismo cliente sirve para cualquier dominio consumidor.
|
|
18
|
+
*/
|
|
19
|
+
let DomainCallbackApi = class DomainCallbackApi {
|
|
20
|
+
httpRequest;
|
|
21
|
+
constructor(httpRequest) {
|
|
22
|
+
this.httpRequest = httpRequest;
|
|
23
|
+
}
|
|
24
|
+
async applyCollectionResult(baseUrl, request) {
|
|
25
|
+
const url = `${baseUrl.replace(/\/+$/, "")}/collection/apply-result`;
|
|
26
|
+
return await this.httpRequest.post(url, request);
|
|
27
|
+
}
|
|
28
|
+
};
|
|
29
|
+
DomainCallbackApi = __decorate([
|
|
30
|
+
injectable(),
|
|
31
|
+
__param(0, inject("IHttpRequest")),
|
|
32
|
+
__metadata("design:paramtypes", [Object])
|
|
33
|
+
], DomainCallbackApi);
|
|
34
|
+
export default DomainCallbackApi;
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import { ApplyCollectionResultRequest } from "@fiado/type-kit/bin/collection/index.js";
|
|
2
|
+
type FiadoApiResponse<T> = import("@fiado/type-kit/bin/apiResponse/dtos/FiadoApiResponse.js").default<T>;
|
|
3
|
+
/**
|
|
4
|
+
* Cliente genérico que usa el motor de cobro central para notificar a cualquier dominio
|
|
5
|
+
* consumidor (une-credit, surekeep-retail, etc.) el resultado de un cobro (total o parcial).
|
|
6
|
+
*
|
|
7
|
+
* A diferencia del resto de los Api de la lib, la baseUrl NO sale de una env fija del
|
|
8
|
+
* constructor: el dispatcher del outbox la resuelve por `domain` (registry `domain→API`,
|
|
9
|
+
* SSM/env) y la pasa por llamada — cada dominio consumidor implementa este mismo endpoint.
|
|
10
|
+
*/
|
|
11
|
+
export interface IDomainCallbackApi {
|
|
12
|
+
/**
|
|
13
|
+
* Notifica el resultado de un intento de cobro (FULL/PARTIAL/NONE) al dominio dueño
|
|
14
|
+
* del cargo. El dominio lo aplica idempotente a su ledger (dedupe por `attemptId`).
|
|
15
|
+
* Backend: POST {baseUrl}/collection/apply-result (privado VPC, expuesto por el dominio).
|
|
16
|
+
*/
|
|
17
|
+
applyCollectionResult(baseUrl: string, request: ApplyCollectionResultRequest): Promise<FiadoApiResponse<boolean>>;
|
|
18
|
+
}
|
|
19
|
+
export {};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
package/bin/index.d.ts
CHANGED
package/bin/index.js
CHANGED
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@fiado/api-invoker",
|
|
3
|
-
"version": "5.
|
|
3
|
+
"version": "5.17.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.272.0",
|
|
38
38
|
"dotenv": "^16.4.7"
|
|
39
39
|
},
|
|
40
40
|
"peerDependencies": {
|
package/src/container.config.ts
CHANGED
|
@@ -195,6 +195,10 @@ import { IKycVerificationsBusinessApi, KycVerificationsBusinessApi } from "./kyc
|
|
|
195
195
|
// Collection engine — cliente del motor de cobro central (collect/registerCollectible/deregister)
|
|
196
196
|
import { ICollectionEngineApi } from "./collection-engine/index.js";
|
|
197
197
|
import CollectionEngineApi from "./collection-engine/api/CollectionEngineApi.js";
|
|
198
|
+
// Domain callback — cliente genérico que usa el motor para notificar a cualquier dominio
|
|
199
|
+
// consumidor el resultado de un cobro (applyCollectionResult); baseUrl viaja por llamada
|
|
200
|
+
import { IDomainCallbackApi } from "./domain-callback/index.js";
|
|
201
|
+
import DomainCallbackApi from "./domain-callback/api/DomainCallbackApi.js";
|
|
198
202
|
|
|
199
203
|
export const apiInvokerBindings = new ContainerModule(({ bind }) => {
|
|
200
204
|
// UTILS bindings
|
|
@@ -364,4 +368,7 @@ export const apiInvokerBindings = new ContainerModule(({ bind }) => {
|
|
|
364
368
|
|
|
365
369
|
// Collection engine — motor de cobro central multitenant (collect/registerCollectible/deregister)
|
|
366
370
|
bind<ICollectionEngineApi>("ICollectionEngineApi").to(CollectionEngineApi);
|
|
371
|
+
|
|
372
|
+
// Domain callback — el motor notifica al dominio dueño del cargo (applyCollectionResult)
|
|
373
|
+
bind<IDomainCallbackApi>("IDomainCallbackApi").to(DomainCallbackApi);
|
|
367
374
|
});
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import { inject, injectable } from "inversify";
|
|
2
|
+
import type { IHttpRequest } from "@fiado/http-client";
|
|
3
|
+
import { ApplyCollectionResultRequest } from "@fiado/type-kit/bin/collection/index.js";
|
|
4
|
+
import { IDomainCallbackApi } from "./interfaces/IDomainCallbackApi.js";
|
|
5
|
+
|
|
6
|
+
type FiadoApiResponse<T> = import("@fiado/type-kit/bin/apiResponse/dtos/FiadoApiResponse.js").default<T>;
|
|
7
|
+
|
|
8
|
+
/**
|
|
9
|
+
* Cliente genérico del callback de cobro (motor → dominio). La baseUrl no viene de una env
|
|
10
|
+
* fija del constructor: el motor la resuelve por `domain` (registry `domain→API`) y la pasa
|
|
11
|
+
* en cada llamada, así este mismo cliente sirve para cualquier dominio consumidor.
|
|
12
|
+
*/
|
|
13
|
+
@injectable()
|
|
14
|
+
export default class DomainCallbackApi implements IDomainCallbackApi {
|
|
15
|
+
|
|
16
|
+
constructor(@inject("IHttpRequest") private httpRequest: IHttpRequest) {
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
async applyCollectionResult(baseUrl: string, request: ApplyCollectionResultRequest): Promise<FiadoApiResponse<boolean>> {
|
|
20
|
+
const url = `${baseUrl.replace(/\/+$/, "")}/collection/apply-result`;
|
|
21
|
+
return await this.httpRequest.post(url, request);
|
|
22
|
+
}
|
|
23
|
+
}
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import { ApplyCollectionResultRequest } from "@fiado/type-kit/bin/collection/index.js";
|
|
2
|
+
|
|
3
|
+
type FiadoApiResponse<T> = import("@fiado/type-kit/bin/apiResponse/dtos/FiadoApiResponse.js").default<T>;
|
|
4
|
+
|
|
5
|
+
/**
|
|
6
|
+
* Cliente genérico que usa el motor de cobro central para notificar a cualquier dominio
|
|
7
|
+
* consumidor (une-credit, surekeep-retail, etc.) el resultado de un cobro (total o parcial).
|
|
8
|
+
*
|
|
9
|
+
* A diferencia del resto de los Api de la lib, la baseUrl NO sale de una env fija del
|
|
10
|
+
* constructor: el dispatcher del outbox la resuelve por `domain` (registry `domain→API`,
|
|
11
|
+
* SSM/env) y la pasa por llamada — cada dominio consumidor implementa este mismo endpoint.
|
|
12
|
+
*/
|
|
13
|
+
export interface IDomainCallbackApi {
|
|
14
|
+
|
|
15
|
+
/**
|
|
16
|
+
* Notifica el resultado de un intento de cobro (FULL/PARTIAL/NONE) al dominio dueño
|
|
17
|
+
* del cargo. El dominio lo aplica idempotente a su ledger (dedupe por `attemptId`).
|
|
18
|
+
* Backend: POST {baseUrl}/collection/apply-result (privado VPC, expuesto por el dominio).
|
|
19
|
+
*/
|
|
20
|
+
applyCollectionResult(baseUrl: string, request: ApplyCollectionResultRequest): Promise<FiadoApiResponse<boolean>>;
|
|
21
|
+
}
|
package/src/index.ts
CHANGED