@fiado/api-invoker 5.3.0 → 5.5.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.
@@ -8,6 +8,7 @@ import { AddressApi } from "./address/index.js";
8
8
  import { Publisher } from "./account-fiadoinc/index.js";
9
9
  import AccountFiadoIncApi from "./account-fiadoinc/AccountFiadoIncApi.js";
10
10
  import AccountPagoConfiadoApi from "./account-pagoconfiado/AccountPagoConfiadoApi.js";
11
+ import MetamapConnectorApi from "./metamap-connector/MetamapConnectorApi.js";
11
12
  import AccountFiadoSAApi from "./account-fiadosa/AccountFiadoSAApi.js";
12
13
  import STPAccountApi from "./stpAccount/api/STPAccountApi.js";
13
14
  import { SessionActivityPublisher } from "./sessionActivity/index.js";
@@ -137,6 +138,7 @@ export const apiInvokerBindings = new ContainerModule(({ bind }) => {
137
138
  bind("ISTPAccountApi").to(STPAccountApi);
138
139
  bind("IAccountFiadoIncApi").to(AccountFiadoIncApi);
139
140
  bind("IAccountPagoConfiadoApi").to(AccountPagoConfiadoApi);
141
+ bind("IMetamapConnectorApi").to(MetamapConnectorApi);
140
142
  bind("IAccountFiadoSAApi").to(AccountFiadoSAApi);
141
143
  bind("INotificationMessagesPublisher").to(NotificationMessagePublisher);
142
144
  bind("INotificationWSMessagesPublisher").to(NotificationWSMessagePublisher);
package/bin/index.d.ts CHANGED
@@ -10,6 +10,7 @@ export * from "./container.config.js";
10
10
  export * from "./account-fiadoinc/index.js";
11
11
  export * from "./account-fiadosa/index.js";
12
12
  export * from "./account-pagoconfiado/index.js";
13
+ export * from "./metamap-connector/index.js";
13
14
  export * from "./account-beneficiary/index.js";
14
15
  export * from "./exchangeRates/index.js";
15
16
  export * from "./authentication/index.js";
package/bin/index.js CHANGED
@@ -10,6 +10,7 @@ export * from "./container.config.js";
10
10
  export * from "./account-fiadoinc/index.js";
11
11
  export * from "./account-fiadosa/index.js";
12
12
  export * from "./account-pagoconfiado/index.js";
13
+ export * from "./metamap-connector/index.js";
13
14
  export * from "./account-beneficiary/index.js";
14
15
  export * from "./exchangeRates/index.js";
15
16
  export * from "./authentication/index.js";
@@ -22,6 +22,7 @@ export default class LoanCreditBusinessApi implements ILoanCreditBusinessApi {
22
22
  quote(creditId: string, input: QuoteLoanCreditRequest, tenantId: string): Promise<StandardResponse<QuoteLoanCreditResponse>>;
23
23
  sign(creditId: string, input: SignLoanCreditRequest, tenantId: string): Promise<StandardResponse<SignLoanCreditResponse>>;
24
24
  activateCheck(creditId: string, input: ActivationCheckRequest, tenantId: string): Promise<StandardResponse<ActivationCheckResponse>>;
25
+ discard(creditId: string, tenantId: string): Promise<StandardResponse<LoanCreditResponse>>;
25
26
  getCredit(creditId: string, tenantId: string): Promise<StandardResponse<LoanCreditResponse>>;
26
27
  getBorrowerByRetailCustomer(retailCustomerId: string, tenantId: string): Promise<StandardResponse<LoanBorrowerResponse>>;
27
28
  upsertBorrower(input: UpsertLoanBorrowerRequest, tenantId: string): Promise<StandardResponse<LoanBorrowerResponse>>;
@@ -46,6 +46,10 @@ let LoanCreditBusinessApi = class LoanCreditBusinessApi {
46
46
  const url = `${this.baseUrl}/private/credits/${encodeURIComponent(creditId)}/activate-check?tenantId=${encodeURIComponent(tenantId)}`;
47
47
  return await this.httpRequest.post(url, input);
48
48
  }
49
+ async discard(creditId, tenantId) {
50
+ const url = `${this.baseUrl}/private/credits/${encodeURIComponent(creditId)}/discard?tenantId=${encodeURIComponent(tenantId)}`;
51
+ return await this.httpRequest.post(url, {});
52
+ }
49
53
  async getCredit(creditId, tenantId) {
50
54
  const url = `${this.baseUrl}/private/credits/${encodeURIComponent(creditId)}?tenantId=${encodeURIComponent(tenantId)}`;
51
55
  return await this.httpRequest.get(url);
@@ -42,6 +42,13 @@ export interface ILoanCreditBusinessApi {
42
42
  * el crédito pasa a `ACTIVE` (vencimientos +7d, ventana de cancelación 7d).
43
43
  */
44
44
  activateCheck(creditId: string, input: ActivationCheckRequest, tenantId: string): Promise<StandardResponse<ActivationCheckResponse>>;
45
+ /**
46
+ * Descarta un crédito PENDING_ACTIVATION → DISCARDED (compensación del wizard al cancelar la
47
+ * venta — sin esto el crédito huérfano bloquea al cliente vía un-crédito-vivo). Idempotente.
48
+ * `400 CREDIT_NOT_PENDING` si el crédito ya avanzó (ACTIVE/IN_ARREARS jamás se descartan) ·
49
+ * `404 CREDIT_NOT_FOUND`.
50
+ */
51
+ discard(creditId: string, tenantId: string): Promise<StandardResponse<LoanCreditResponse>>;
45
52
  /** Estado completo del crédito (checklist, status, términos). */
46
53
  getCredit(creditId: string, tenantId: string): Promise<StandardResponse<LoanCreditResponse>>;
47
54
  /**
@@ -0,0 +1,10 @@
1
+ import { IMetamapConnectorApi } from "./interfaces/IMetamapConnectorApi.js";
2
+ import { BuildFacematchSignatureRequest, FacematchSignatureResponse } from "@fiado/type-kit/bin/metamapConnector/index.js";
3
+ import { ApiGatewayResponse } from "@fiado/gateway-adapter";
4
+ import { IHttpRequest } from "@fiado/http-client";
5
+ export default class MetamapConnectorApi implements IMetamapConnectorApi {
6
+ private httpRequest;
7
+ private readonly baseUrl;
8
+ constructor(httpRequest: IHttpRequest);
9
+ buildFacematchSignature(data: BuildFacematchSignatureRequest): Promise<ApiGatewayResponse<FacematchSignatureResponse>>;
10
+ }
@@ -0,0 +1,30 @@
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
+ let MetamapConnectorApi = class MetamapConnectorApi {
15
+ httpRequest;
16
+ baseUrl = process.env.METAMAP_CONNECTOR_LAMBDA_URL || "";
17
+ constructor(httpRequest) {
18
+ this.httpRequest = httpRequest;
19
+ }
20
+ async buildFacematchSignature(data) {
21
+ const url = `${this.baseUrl}facematch/signature`;
22
+ return await this.httpRequest.post(url, data);
23
+ }
24
+ };
25
+ MetamapConnectorApi = __decorate([
26
+ injectable(),
27
+ __param(0, inject("IHttpRequest")),
28
+ __metadata("design:paramtypes", [Object])
29
+ ], MetamapConnectorApi);
30
+ export default MetamapConnectorApi;
@@ -0,0 +1,2 @@
1
+ export * from './interfaces/IMetamapConnectorApi.js';
2
+ export * from './MetamapConnectorApi.js';
@@ -0,0 +1,2 @@
1
+ export * from './interfaces/IMetamapConnectorApi.js';
2
+ export * from './MetamapConnectorApi.js';
@@ -0,0 +1,10 @@
1
+ import { BuildFacematchSignatureRequest, FacematchSignatureResponse } from "@fiado/type-kit/bin/metamapConnector/index.js";
2
+ import { ApiGatewayResponse } from "@fiado/gateway-adapter";
3
+ export interface IMetamapConnectorApi {
4
+ /**
5
+ * Arma la firma que Metamap exige para el facematch contra una foto de referencia
6
+ * (`userPhotoLinkHash`) sin exponer el Client Secret. `POST /private/facematch/signature`
7
+ * del metamap-connector.
8
+ */
9
+ buildFacematchSignature(data: BuildFacematchSignatureRequest): Promise<ApiGatewayResponse<FacematchSignatureResponse>>;
10
+ }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@fiado/api-invoker",
3
- "version": "5.3.0",
3
+ "version": "5.5.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.221.0",
37
+ "@fiado/type-kit": "^3.224.0",
38
38
  "dotenv": "^16.4.7"
39
39
  },
40
40
  "peerDependencies": {
@@ -12,6 +12,8 @@ import { IAccountFiadoIncApi, IPublisher, Publisher } from "./account-fiadoinc/i
12
12
  import AccountFiadoIncApi from "./account-fiadoinc/AccountFiadoIncApi.js";
13
13
  import { IAccountPagoConfiadoApi } from "./account-pagoconfiado/index.js";
14
14
  import AccountPagoConfiadoApi from "./account-pagoconfiado/AccountPagoConfiadoApi.js";
15
+ import { IMetamapConnectorApi } from "./metamap-connector/index.js";
16
+ import MetamapConnectorApi from "./metamap-connector/MetamapConnectorApi.js";
15
17
  import { IAccountFiadoSAApi } from "./account-fiadosa/index.js";
16
18
  import AccountFiadoSAApi from "./account-fiadosa/AccountFiadoSAApi.js";
17
19
  import { ISTPAccountApi } from "./stpAccount/index.js";
@@ -199,6 +201,7 @@ export const apiInvokerBindings = new ContainerModule(({ bind }) => {
199
201
  bind<ISTPAccountApi>("ISTPAccountApi").to(STPAccountApi);
200
202
  bind<IAccountFiadoIncApi>("IAccountFiadoIncApi").to(AccountFiadoIncApi);
201
203
  bind<IAccountPagoConfiadoApi>("IAccountPagoConfiadoApi").to(AccountPagoConfiadoApi);
204
+ bind<IMetamapConnectorApi>("IMetamapConnectorApi").to(MetamapConnectorApi);
202
205
  bind<IAccountFiadoSAApi>("IAccountFiadoSAApi").to(AccountFiadoSAApi);
203
206
  bind<INotificationMessagesPublisher>("INotificationMessagesPublisher").to(NotificationMessagePublisher);
204
207
  bind<INotificationWSMessagesPublisher>("INotificationWSMessagesPublisher").to(NotificationWSMessagePublisher);
package/src/index.ts CHANGED
@@ -10,6 +10,7 @@ export * from "./container.config.js";
10
10
  export * from "./account-fiadoinc/index.js";
11
11
  export * from "./account-fiadosa/index.js";
12
12
  export * from "./account-pagoconfiado/index.js";
13
+ export * from "./metamap-connector/index.js";
13
14
  export * from "./account-beneficiary/index.js";
14
15
  export * from "./exchangeRates/index.js";
15
16
  export * from "./authentication/index.js";
@@ -70,6 +70,14 @@ export default class LoanCreditBusinessApi implements ILoanCreditBusinessApi {
70
70
  return await this.httpRequest.post(url, input);
71
71
  }
72
72
 
73
+ async discard(
74
+ creditId: string,
75
+ tenantId: string,
76
+ ): Promise<StandardResponse<LoanCreditResponse>> {
77
+ const url = `${this.baseUrl}/private/credits/${encodeURIComponent(creditId)}/discard?tenantId=${encodeURIComponent(tenantId)}`;
78
+ return await this.httpRequest.post(url, {});
79
+ }
80
+
73
81
  async getCredit(
74
82
  creditId: string,
75
83
  tenantId: string,
@@ -74,6 +74,17 @@ export interface ILoanCreditBusinessApi {
74
74
  tenantId: string,
75
75
  ): Promise<StandardResponse<ActivationCheckResponse>>;
76
76
 
77
+ /**
78
+ * Descarta un crédito PENDING_ACTIVATION → DISCARDED (compensación del wizard al cancelar la
79
+ * venta — sin esto el crédito huérfano bloquea al cliente vía un-crédito-vivo). Idempotente.
80
+ * `400 CREDIT_NOT_PENDING` si el crédito ya avanzó (ACTIVE/IN_ARREARS jamás se descartan) ·
81
+ * `404 CREDIT_NOT_FOUND`.
82
+ */
83
+ discard(
84
+ creditId: string,
85
+ tenantId: string,
86
+ ): Promise<StandardResponse<LoanCreditResponse>>;
87
+
77
88
  /** Estado completo del crédito (checklist, status, términos). */
78
89
  getCredit(
79
90
  creditId: string,
@@ -0,0 +1,17 @@
1
+ import { IMetamapConnectorApi } from "./interfaces/IMetamapConnectorApi.js";
2
+ import { BuildFacematchSignatureRequest, FacematchSignatureResponse } from "@fiado/type-kit/bin/metamapConnector/index.js";
3
+ import { ApiGatewayResponse } from "@fiado/gateway-adapter";
4
+ import { inject, injectable } from "inversify";
5
+ import { IHttpRequest } from "@fiado/http-client";
6
+
7
+ @injectable()
8
+ export default class MetamapConnectorApi implements IMetamapConnectorApi {
9
+ private readonly baseUrl = process.env.METAMAP_CONNECTOR_LAMBDA_URL || "";
10
+
11
+ constructor(@inject("IHttpRequest") private httpRequest: IHttpRequest) {}
12
+
13
+ async buildFacematchSignature(data: BuildFacematchSignatureRequest): Promise<ApiGatewayResponse<FacematchSignatureResponse>> {
14
+ const url = `${this.baseUrl}facematch/signature`;
15
+ return await this.httpRequest.post(url, data);
16
+ }
17
+ }
@@ -0,0 +1,2 @@
1
+ export * from './interfaces/IMetamapConnectorApi.js';
2
+ export * from './MetamapConnectorApi.js';
@@ -0,0 +1,11 @@
1
+ import { BuildFacematchSignatureRequest, FacematchSignatureResponse } from "@fiado/type-kit/bin/metamapConnector/index.js";
2
+ import { ApiGatewayResponse } from "@fiado/gateway-adapter";
3
+
4
+ export interface IMetamapConnectorApi {
5
+ /**
6
+ * Arma la firma que Metamap exige para el facematch contra una foto de referencia
7
+ * (`userPhotoLinkHash`) sin exponer el Client Secret. `POST /private/facematch/signature`
8
+ * del metamap-connector.
9
+ */
10
+ buildFacematchSignature(data: BuildFacematchSignatureRequest): Promise<ApiGatewayResponse<FacematchSignatureResponse>>;
11
+ }