@fiado/api-invoker 3.6.1 → 3.8.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.
@@ -1,7 +1,7 @@
1
1
  import { ApiGatewayResponse } from "@fiado/gateway-adapter";
2
2
  import { IHttpRequest } from "@fiado/http-client";
3
- import { CardIssuanceObservationUpdateRequest, CardResponse, CardUpdateIssuanceRequest, UpdateBankAccountCardRequest } from "@fiado/type-kit/bin/card";
4
- import { ICardApi } from "./interfaces/ICardApi";
3
+ import { CardIssuanceObservationUpdateRequest, CardResponse, CardUpdateIssuanceRequest, Status, UpdateBankAccountCardRequest } from "@fiado/type-kit/bin/card";
4
+ import { CardsByStatusResponse, ICardApi } from "./interfaces/ICardApi";
5
5
  import { Provider } from "@fiado/type-kit/bin/provider";
6
6
  import { InfoSelfVerifiedStatus } from "@fiado/type-kit/bin/identity";
7
7
  export declare class CardApi implements ICardApi {
@@ -12,6 +12,7 @@ export declare class CardApi implements ICardApi {
12
12
  getById(provider: Provider, id: string, onlyDb?: boolean): Promise<ApiGatewayResponse<CardResponse>>;
13
13
  getByExternalId(provider: Provider, externalId: string): Promise<ApiGatewayResponse<CardResponse>>;
14
14
  getCardByIdExternal(externalCardId: string): Promise<ApiGatewayResponse<any>>;
15
+ getByStatus(provider: Provider, status: Status | string, index?: string, pageSize?: number, order?: "ascending" | "descending"): Promise<ApiGatewayResponse<CardsByStatusResponse>>;
15
16
  evaluateAccountLevelUpdate(directoryId: string): Promise<void>;
16
17
  findCardIssuanceByIds(directoryIds: string[]): Promise<ApiGatewayResponse<any>>;
17
18
  updateIssuance(provider: Provider, input: CardUpdateIssuanceRequest): Promise<ApiGatewayResponse<void>>;
@@ -35,6 +35,18 @@ let CardApi = class CardApi {
35
35
  const url = `${this.baseUrl}/cards/${externalCardId}?raw=true`;
36
36
  return await this.httpRequest.get(url);
37
37
  }
38
+ async getByStatus(provider, status, index, pageSize, order) {
39
+ const queryParts = [];
40
+ if (index !== undefined)
41
+ queryParts.push(`index=${encodeURIComponent(index)}`);
42
+ if (pageSize !== undefined)
43
+ queryParts.push(`pageSize=${pageSize}`);
44
+ if (order !== undefined)
45
+ queryParts.push(`order=${order}`);
46
+ const queryString = queryParts.length ? `?${queryParts.join("&")}` : "";
47
+ const url = `${this.baseUrl}${provider}/status/${status}${queryString}`;
48
+ return await this.httpRequest.get(url);
49
+ }
38
50
  async evaluateAccountLevelUpdate(directoryId) {
39
51
  const url = `${this.baseUrl}accounts/levels`;
40
52
  await this.httpRequest.post(url, { directoryId });
@@ -1,12 +1,17 @@
1
1
  import { ApiGatewayResponse } from "@fiado/gateway-adapter";
2
- import { CardIssuanceObservationUpdateRequest, CardResponse, CardUpdateIssuanceRequest, UpdateBankAccountCardRequest } from "@fiado/type-kit/bin/card";
2
+ import { CardIssuanceObservationUpdateRequest, CardResponse, CardUpdateIssuanceRequest, Status, UpdateBankAccountCardRequest } from "@fiado/type-kit/bin/card";
3
3
  import { InfoSelfVerifiedStatus } from "@fiado/type-kit/bin/identity";
4
4
  import { Provider } from "@fiado/type-kit/bin/provider";
5
+ export interface CardsByStatusResponse {
6
+ items: CardResponse[];
7
+ index: string | null;
8
+ }
5
9
  export interface ICardApi {
6
10
  getByDirectoryId(provider: Provider, directoryId: string, onlyDb?: boolean): Promise<ApiGatewayResponse<CardResponse>>;
7
11
  getById(provider: Provider, id: string, onlyDb?: boolean): Promise<ApiGatewayResponse<CardResponse>>;
8
12
  getByExternalId(provider: Provider, externalId: string): Promise<ApiGatewayResponse<CardResponse>>;
9
13
  getCardByIdExternal(externalCardId: string): Promise<ApiGatewayResponse<any>>;
14
+ getByStatus(provider: Provider, status: Status | string, index?: string, pageSize?: number, order?: "ascending" | "descending"): Promise<ApiGatewayResponse<CardsByStatusResponse>>;
10
15
  findCardIssuanceByIds(directoryIds: string[]): Promise<ApiGatewayResponse<any>>;
11
16
  updateIssuance(provider: Provider, input: CardUpdateIssuanceRequest): Promise<ApiGatewayResponse<void>>;
12
17
  updateIssuanceObservation(directoryId: string, input: CardIssuanceObservationUpdateRequest): Promise<ApiGatewayResponse<void>>;
@@ -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.6.1",
3
+ "version": "3.8.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",
@@ -1,8 +1,8 @@
1
1
  import { ApiGatewayResponse } from "@fiado/gateway-adapter";
2
2
  import { IHttpRequest } from "@fiado/http-client";
3
- import { CardIssuanceObservationUpdateRequest, CardResponse, CardUpdateIssuanceRequest, UpdateBankAccountCardRequest } from "@fiado/type-kit/bin/card";
3
+ import { CardIssuanceObservationUpdateRequest, CardResponse, CardUpdateIssuanceRequest, Status, UpdateBankAccountCardRequest } from "@fiado/type-kit/bin/card";
4
4
  import { inject, injectable } from "inversify";
5
- import { ICardApi } from "./interfaces/ICardApi";
5
+ import { CardsByStatusResponse, ICardApi } from "./interfaces/ICardApi";
6
6
  import { Provider } from "@fiado/type-kit/bin/provider";
7
7
  import { InfoSelfVerifiedStatus } from "@fiado/type-kit/bin/identity";
8
8
 
@@ -39,6 +39,24 @@ export class CardApi implements ICardApi {
39
39
  return await this.httpRequest.get(url);
40
40
  }
41
41
 
42
+ async getByStatus(
43
+ provider: Provider,
44
+ status: Status | string,
45
+ index?: string,
46
+ pageSize?: number,
47
+ order?: "ascending" | "descending"
48
+ ): Promise<ApiGatewayResponse<CardsByStatusResponse>> {
49
+
50
+ const queryParts: string[] = [];
51
+ if (index !== undefined) queryParts.push(`index=${encodeURIComponent(index)}`);
52
+ if (pageSize !== undefined) queryParts.push(`pageSize=${pageSize}`);
53
+ if (order !== undefined) queryParts.push(`order=${order}`);
54
+ const queryString = queryParts.length ? `?${queryParts.join("&")}` : "";
55
+
56
+ const url = `${this.baseUrl}${provider}/status/${status}${queryString}`;
57
+ return await this.httpRequest.get(url);
58
+ }
59
+
42
60
  async evaluateAccountLevelUpdate(directoryId: string): Promise<void> {
43
61
 
44
62
  const url = `${this.baseUrl}accounts/levels`
@@ -1,8 +1,13 @@
1
1
  import { ApiGatewayResponse } from "@fiado/gateway-adapter";
2
- import { CardIssuanceObservationUpdateRequest, CardResponse, CardUpdateIssuanceRequest, UpdateBankAccountCardRequest } from "@fiado/type-kit/bin/card";
2
+ import { CardIssuanceObservationUpdateRequest, CardResponse, CardUpdateIssuanceRequest, Status, UpdateBankAccountCardRequest } from "@fiado/type-kit/bin/card";
3
3
  import { InfoSelfVerifiedStatus } from "@fiado/type-kit/bin/identity";
4
4
  import { Provider } from "@fiado/type-kit/bin/provider";
5
5
 
6
+ export interface CardsByStatusResponse {
7
+ items: CardResponse[];
8
+ index: string | null;
9
+ }
10
+
6
11
  export interface ICardApi {
7
12
 
8
13
  getByDirectoryId(provider: Provider, directoryId: string, onlyDb?: boolean): Promise<ApiGatewayResponse<CardResponse>>
@@ -13,6 +18,8 @@ export interface ICardApi {
13
18
 
14
19
  getCardByIdExternal(externalCardId: string): Promise<ApiGatewayResponse<any>>;
15
20
 
21
+ getByStatus(provider: Provider, status: Status | string, index?: string, pageSize?: number, order?: "ascending" | "descending"): Promise<ApiGatewayResponse<CardsByStatusResponse>>;
22
+
16
23
  findCardIssuanceByIds(directoryIds: string[]): Promise<ApiGatewayResponse<any>>;
17
24
 
18
25
  updateIssuance(provider: Provider, input: CardUpdateIssuanceRequest): Promise<ApiGatewayResponse<void>>
@@ -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
  }