@fiado/api-invoker 3.7.0 → 3.9.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.
@@ -4,5 +4,5 @@ export default class CnbvApi implements ICnbvApi {
4
4
  private httpRequest;
5
5
  private readonly baseUrl;
6
6
  constructor(httpRequest: IHttpRequest);
7
- validateConcidence(fullName: string, yearOfBirth: string): Promise<any>;
7
+ validateConcidence(fullName: string, yearOfBirth: string, curp10?: string): Promise<any>;
8
8
  }
@@ -18,8 +18,16 @@ let CnbvApi = class CnbvApi {
18
18
  this.httpRequest = httpRequest;
19
19
  this.baseUrl = process.env.CNBV_LAMBDA_URL || "";
20
20
  }
21
- async validateConcidence(fullName, yearOfBirth) {
22
- const url = `${this.baseUrl}?value=${yearOfBirth}&param=YEAR_OF_BIRTH&fullName=${fullName}`;
21
+ async validateConcidence(fullName, yearOfBirth, curp10) {
22
+ const query = [
23
+ `value=${encodeURIComponent(yearOfBirth)}`,
24
+ `param=YEAR_OF_BIRTH`,
25
+ `fullName=${encodeURIComponent(fullName)}`,
26
+ ];
27
+ if (curp10 !== undefined && curp10 !== null && curp10 !== "") {
28
+ query.push(`curp=${encodeURIComponent(curp10)}`);
29
+ }
30
+ const url = `${this.baseUrl}?${query.join("&")}`;
23
31
  return await this.httpRequest.get(url);
24
32
  }
25
33
  };
@@ -1,3 +1,15 @@
1
1
  export interface ICnbvApi {
2
- validateConcidence(fullName: string, yearOfBirth: string): Promise<any>;
2
+ /**
3
+ * Consulta coincidencias en la lista CNBV (LPB).
4
+ * El matching real ya no usa yearOfBirth (cnbv-business hace fuzzy match sólo por nombre
5
+ * sobre toda la tabla ACTIVE). El parámetro se mantiene por compatibilidad con
6
+ * consumidores antiguos pero su valor es ignorado.
7
+ *
8
+ * @param fullName nombre completo del people de Fiado (requerido)
9
+ * @param yearOfBirth año de nacimiento (ignorado en el matching pero el endpoint sigue
10
+ * aceptándolo por backwards compatibility)
11
+ * @param curp10 primeros 10 chars del CURP del people. Si se provee, cnbv-business además
12
+ * hace match exacto contra `rfc.substring(0, 10)` en los registros CNBV.
13
+ */
14
+ validateConcidence(fullName: string, yearOfBirth: string, curp10?: string): Promise<any>;
3
15
  }
@@ -31,4 +31,5 @@ export default class MulticommServicePaymentApi implements IMulticommServicePaym
31
31
  }): Promise<ApiGatewayResponse<ConnectorCatalogResponse>>;
32
32
  payStandard(request: BenefitPaymentRequest): Promise<ApiGatewayResponse<BenefitPaymentResponse>>;
33
33
  consultStandard(transactionNumber: string): Promise<ApiGatewayResponse<BenefitPaymentResponse>>;
34
+ updateService(idServicio: number, patch: Record<string, unknown>): Promise<ApiGatewayResponse<any>>;
34
35
  }
@@ -80,6 +80,10 @@ let MulticommServicePaymentApi = class MulticommServicePaymentApi {
80
80
  const url = `${this.baseUrl}/pay/standard/transactions/${encodeURIComponent(transactionNumber)}`;
81
81
  return await this.httpRequest.get(url);
82
82
  }
83
+ async updateService(idServicio, patch) {
84
+ const url = `${this.baseUrl}/internal/services/${idServicio}`;
85
+ return await this.httpRequest.put(url, patch);
86
+ }
83
87
  };
84
88
  MulticommServicePaymentApi = __decorate([
85
89
  (0, inversify_1.injectable)(),
@@ -26,4 +26,5 @@ export interface IMulticommServicePaymentApi {
26
26
  }): Promise<ApiGatewayResponse<ConnectorCatalogResponse>>;
27
27
  payStandard(request: BenefitPaymentRequest): Promise<ApiGatewayResponse<BenefitPaymentResponse>>;
28
28
  consultStandard(transactionNumber: string): Promise<ApiGatewayResponse<BenefitPaymentResponse>>;
29
+ updateService(idServicio: number, patch: Record<string, unknown>): Promise<ApiGatewayResponse<any>>;
29
30
  }
@@ -27,4 +27,5 @@ export default class StpServicePaymentApi implements IStpServicePaymentApi {
27
27
  }): Promise<ApiGatewayResponse<ConnectorCatalogResponse>>;
28
28
  payStandard(request: BenefitPaymentRequest): Promise<ApiGatewayResponse<BenefitPaymentResponse>>;
29
29
  consultStandard(transactionNumber: string): Promise<ApiGatewayResponse<BenefitPaymentResponse>>;
30
+ updateService(idServicio: number, patch: Record<string, unknown>): Promise<ApiGatewayResponse<any>>;
30
31
  }
@@ -80,6 +80,10 @@ let StpServicePaymentApi = class StpServicePaymentApi {
80
80
  const url = `${this.baseUrl}/pay/standard/transactions/${encodeURIComponent(transactionNumber)}`;
81
81
  return await this.httpRequest.get(url);
82
82
  }
83
+ async updateService(idServicio, patch) {
84
+ const url = `${this.baseUrl}/internal/services/${idServicio}`;
85
+ return await this.httpRequest.put(url, patch);
86
+ }
83
87
  };
84
88
  StpServicePaymentApi = __decorate([
85
89
  (0, inversify_1.injectable)(),
@@ -22,4 +22,5 @@ export interface IStpServicePaymentApi {
22
22
  }): Promise<ApiGatewayResponse<ConnectorCatalogResponse>>;
23
23
  payStandard(request: BenefitPaymentRequest): Promise<ApiGatewayResponse<BenefitPaymentResponse>>;
24
24
  consultStandard(transactionNumber: string): Promise<ApiGatewayResponse<BenefitPaymentResponse>>;
25
+ updateService(idServicio: number, patch: Record<string, unknown>): Promise<ApiGatewayResponse<any>>;
25
26
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@fiado/api-invoker",
3
- "version": "3.7.0",
3
+ "version": "3.9.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
  "main": "bin/index.js",
6
6
  "types": "bin/index.d.ts",
@@ -16,7 +16,7 @@
16
16
  "@fiado/gateway-adapter": "^1.1.50",
17
17
  "@fiado/http-client": "^1.0.7",
18
18
  "@fiado/logger": "^1.0.3",
19
- "@fiado/type-kit": "^3.13.0",
19
+ "@fiado/type-kit": "^3.16.0",
20
20
  "dotenv": "^16.4.7",
21
21
  "i": "^0.3.7",
22
22
  "inversify": "^6.2.2",
@@ -12,11 +12,20 @@ export default class CnbvApi implements ICnbvApi {
12
12
  constructor(@inject("IHttpRequest") private httpRequest: IHttpRequest) { }
13
13
 
14
14
 
15
- async validateConcidence(fullName: string, yearOfBirth: string): Promise<any> {
15
+ async validateConcidence(fullName: string, yearOfBirth: string, curp10?: string): Promise<any> {
16
16
 
17
- const url = `${this.baseUrl}?value=${yearOfBirth}&param=YEAR_OF_BIRTH&fullName=${fullName}`;
17
+ const query: string[] = [
18
+ `value=${encodeURIComponent(yearOfBirth)}`,
19
+ `param=YEAR_OF_BIRTH`,
20
+ `fullName=${encodeURIComponent(fullName)}`,
21
+ ];
22
+
23
+ if (curp10 !== undefined && curp10 !== null && curp10 !== "") {
24
+ query.push(`curp=${encodeURIComponent(curp10)}`);
25
+ }
26
+
27
+ const url = `${this.baseUrl}?${query.join("&")}`;
18
28
 
19
29
  return await this.httpRequest.get(url);
20
30
  }
21
31
  }
22
-
@@ -2,6 +2,18 @@
2
2
 
3
3
  export interface ICnbvApi {
4
4
 
5
- validateConcidence(fullName:string, yearOfBirth: string): Promise<any>
5
+ /**
6
+ * Consulta coincidencias en la lista CNBV (LPB).
7
+ * El matching real ya no usa yearOfBirth (cnbv-business hace fuzzy match sólo por nombre
8
+ * sobre toda la tabla ACTIVE). El parámetro se mantiene por compatibilidad con
9
+ * consumidores antiguos pero su valor es ignorado.
10
+ *
11
+ * @param fullName nombre completo del people de Fiado (requerido)
12
+ * @param yearOfBirth año de nacimiento (ignorado en el matching pero el endpoint sigue
13
+ * aceptándolo por backwards compatibility)
14
+ * @param curp10 primeros 10 chars del CURP del people. Si se provee, cnbv-business además
15
+ * hace match exacto contra `rfc.substring(0, 10)` en los registros CNBV.
16
+ */
17
+ validateConcidence(fullName: string, yearOfBirth: string, curp10?: string): Promise<any>
6
18
 
7
- }
19
+ }
@@ -82,4 +82,9 @@ export default class MulticommServicePaymentApi implements IMulticommServicePaym
82
82
  const url = `${this.baseUrl}/pay/standard/transactions/${encodeURIComponent(transactionNumber)}`;
83
83
  return await this.httpRequest.get(url);
84
84
  }
85
+
86
+ async updateService(idServicio: number, patch: Record<string, unknown>): Promise<ApiGatewayResponse<any>> {
87
+ const url = `${this.baseUrl}/internal/services/${idServicio}`;
88
+ return await this.httpRequest.put(url, patch);
89
+ }
85
90
  }
@@ -33,4 +33,9 @@ export interface IMulticommServicePaymentApi {
33
33
  // hace el mapping legacy → estándar internamente). Usado por el cron de timeout
34
34
  // reconciliation del marketplace para consultar transacciones async sin ver shapes legacy.
35
35
  consultStandard(transactionNumber: string): Promise<ApiGatewayResponse<BenefitPaymentResponse>>;
36
+
37
+ // Agregado en v3.8.0 — consume PUT /backoffice/services/{idServicio} del conector
38
+ // admin. Consumido por LeafAdminManager de benefits-marketplace-business para
39
+ // edición editorial in-place (admin-leaves v2).
40
+ updateService(idServicio: number, patch: Record<string, unknown>): Promise<ApiGatewayResponse<any>>;
36
41
  }
@@ -82,4 +82,9 @@ export default class StpServicePaymentApi implements IStpServicePaymentApi {
82
82
  const url = `${this.baseUrl}/pay/standard/transactions/${encodeURIComponent(transactionNumber)}`;
83
83
  return await this.httpRequest.get(url);
84
84
  }
85
+
86
+ async updateService(idServicio: number, patch: Record<string, unknown>): Promise<ApiGatewayResponse<any>> {
87
+ const url = `${this.baseUrl}/internal/services/${idServicio}`;
88
+ return await this.httpRequest.put(url, patch);
89
+ }
85
90
  }
@@ -33,4 +33,9 @@ export interface IStpServicePaymentApi {
33
33
  // hace el mapping legacy → estándar internamente). Usado por el cron de timeout
34
34
  // reconciliation del marketplace para consultar transacciones async sin ver shapes legacy.
35
35
  consultStandard(transactionNumber: string): Promise<ApiGatewayResponse<BenefitPaymentResponse>>;
36
+
37
+ // Agregado en v3.8.0 — consume PUT /backoffice/services/{idServicio} del conector
38
+ // admin. Consumido por LeafAdminManager de benefits-marketplace-business para
39
+ // edición editorial in-place (admin-leaves v2).
40
+ updateService(idServicio: number, patch: Record<string, unknown>): Promise<ApiGatewayResponse<any>>;
36
41
  }