@fiado/api-invoker 1.5.40 → 1.5.42

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,5 +1,5 @@
1
1
  import { IHttpRequest } from "@fiado/http-client";
2
- import { AccountCreateRequest, AccountCreateResponse, AccountUpdateBalanceRequest, AccountUpdateRequest, ExecuteP2pOperationRequest, ExecuteP2pOperationResponse, ExecutePocketOperationRequest, ExecutePocketOperationResponse, GetAccountResponse, GetPocketBalanceResponse } from "@fiado/type-kit/bin/account";
2
+ import { AccountCreateRequest, AccountCreateResponse, AccountUpdateBalanceRequest, AccountUpdateRequest, ExecuteP2pOperationRequest, ExecuteP2pOperationResponse, ExecutePocketOperationRequest, ExecutePocketOperationResponse, GetAccountResponse, GetAccountResponseList, GetPocketBalanceResponse } from "@fiado/type-kit/bin/account";
3
3
  import FiadoApiResponse from "@fiado/type-kit/bin/apiResponse/dtos/FiadoApiResponse";
4
4
  import { Provider, ProviderDocumentUploadRequest } from "@fiado/type-kit/bin/provider";
5
5
  import { IAccountFiadoIncApi } from "./interfaces/IAccountFiadoIncApi";
@@ -15,6 +15,7 @@ export default class AccountFiadoIncApi implements IAccountFiadoIncApi {
15
15
  createAccount(provider: Provider, data: AccountCreateRequest): Promise<FiadoApiResponse<AccountCreateResponse>>;
16
16
  getAccountByDirectoryId(provider: Provider, directoryId: string): Promise<FiadoApiResponse<GetAccountResponse[]>>;
17
17
  getAccountByExternalAccountId(provider: Provider, externalAccountId: string): Promise<FiadoApiResponse<GetAccountResponse[]>>;
18
+ scanAllAccounts(provider: Provider | 'ALL', limit?: number, lastEvaluatedKey?: string): Promise<FiadoApiResponse<GetAccountResponseList>>;
18
19
  /** POCKETS **/
19
20
  getPocketBalance(provider: Provider, directoryId: string): Promise<FiadoApiResponse<GetPocketBalanceResponse>>;
20
21
  updatePocketBalance(provider: Provider, pocketId: string, request: AccountUpdateBalanceRequest): Promise<FiadoApiResponse<null>>;
@@ -40,6 +40,16 @@ let AccountFiadoIncApi = class AccountFiadoIncApi {
40
40
  const url = `${this.baseUrl}${provider}/accounts/external/${externalAccountId}`;
41
41
  return await this.httpRequest.get(url);
42
42
  }
43
+ async scanAllAccounts(provider, limit, lastEvaluatedKey) {
44
+ const queryParams = new URLSearchParams();
45
+ queryParams.append('provider', provider);
46
+ if (limit)
47
+ queryParams.append('limit', limit.toString());
48
+ if (lastEvaluatedKey)
49
+ queryParams.append('lastEvaluatedKey', lastEvaluatedKey);
50
+ const url = `${this.baseUrl}accounts/scan?${queryParams.toString()}`;
51
+ return await this.httpRequest.get(url);
52
+ }
43
53
  /** POCKETS **/
44
54
  async getPocketBalance(provider, directoryId) {
45
55
  const url = `${this.baseUrl}${provider}/pockets/users/${directoryId}/balance`;
@@ -1,4 +1,4 @@
1
- import { AccountCreateRequest, AccountCreateResponse, AccountUpdateBalanceRequest, AccountUpdateRequest, ExecuteP2pOperationRequest, ExecuteP2pOperationResponse, ExecutePocketOperationRequest, ExecutePocketOperationResponse, GetAccountResponse, GetPocketBalanceResponse } from "@fiado/type-kit/bin/account";
1
+ import { AccountCreateRequest, AccountCreateResponse, AccountUpdateBalanceRequest, AccountUpdateRequest, ExecuteP2pOperationRequest, ExecuteP2pOperationResponse, ExecutePocketOperationRequest, ExecutePocketOperationResponse, GetAccountResponse, GetAccountResponseList, GetPocketBalanceResponse } from "@fiado/type-kit/bin/account";
2
2
  import FiadoApiResponse from "@fiado/type-kit/bin/apiResponse/dtos/FiadoApiResponse";
3
3
  import { Provider } from "@fiado/type-kit/bin/provider";
4
4
  import { IPublisher } from "../queue/interfaces/IPublisher";
@@ -15,4 +15,5 @@ export interface IAccountFiadoIncApi extends IPublisher {
15
15
  update(provider: Provider, directoryId: string, data: AccountUpdateRequest): Promise<FiadoApiResponse<void>>;
16
16
  replaceExternalAccount(provider: Provider, directoryId: string, externalAccountId: string, isPrincipal: boolean): Promise<FiadoApiResponse<void>>;
17
17
  getAccountByExternalAccountId(provider: Provider, externalAccountId: string): Promise<FiadoApiResponse<GetAccountResponse[]>>;
18
+ scanAllAccounts(provider: Provider | 'ALL', limit?: number, lastEvaluatedKey?: string): Promise<FiadoApiResponse<GetAccountResponseList>>;
18
19
  }
@@ -70,6 +70,7 @@ const ReportProcessorBusinessApi_1 = __importDefault(require("./report-processor
70
70
  const NotificationWSMessagePublisher_1 = __importDefault(require("./notificationWebsockets/queue/NotificationWSMessagePublisher"));
71
71
  const PeopleBusinessApi_1 = __importDefault(require("./people-business/api/PeopleBusinessApi"));
72
72
  const STPBusinessApi_1 = __importDefault(require("./stp-business/api/STPBusinessApi"));
73
+ const MulticommServicePaymentApi_1 = __importDefault(require("./multicommServicePayment/api/MulticommServicePaymentApi"));
73
74
  exports.apiInvokerBindings = new inversify_1.ContainerModule((bind) => {
74
75
  // UTILS bindings
75
76
  bind("InvokerUtils").to(InvokerUtils_1.InvokerUtils);
@@ -99,6 +100,7 @@ exports.apiInvokerBindings = new inversify_1.ContainerModule((bind) => {
99
100
  bind("IAccountBeneficiaryApi").to(account_beneficiary_1.AccountBeneficiaryApi);
100
101
  bind("IStpSpeiApi").to(stpSpei_1.StpSpeiApi);
101
102
  bind("IStpServicePaymentApi").to(StpServicePaymentApi_1.default);
103
+ bind("IMulticommServicePaymentApi").to(MulticommServicePaymentApi_1.default);
102
104
  bind("IBBVARstApi").to(bbvaRst_1.BBVARstApi);
103
105
  bind("IFraudPreventionEngineApi").to(FraudPreventionEngineApi_1.default);
104
106
  bind("IGroupApi").to(group_1.GroupApi);
package/bin/index.d.ts CHANGED
@@ -57,3 +57,4 @@ export * from "./report-processor-business";
57
57
  export * from "./notificationWebsockets";
58
58
  export * from "./people-business";
59
59
  export * from "./stp-business";
60
+ export * from "./multicommServicePayment";
package/bin/index.js CHANGED
@@ -73,3 +73,4 @@ __exportStar(require("./report-processor-business"), exports);
73
73
  __exportStar(require("./notificationWebsockets"), exports);
74
74
  __exportStar(require("./people-business"), exports);
75
75
  __exportStar(require("./stp-business"), exports);
76
+ __exportStar(require("./multicommServicePayment"), exports);
@@ -0,0 +1,20 @@
1
+ import { IMulticommServicePaymentApi } from "./interfaces/IMulticommServicePaymentApi";
2
+ import { IHttpRequest } from "@fiado/http-client";
3
+ import { GetCatalogParams, ServicePaymentRequest } from "@fiado/type-kit/bin/servicePayment";
4
+ import { ApiGatewayResponse } from "@fiado/gateway-adapter";
5
+ export default class MulticommServicePaymentApi implements IMulticommServicePaymentApi {
6
+ private httpRequest;
7
+ private readonly baseUrl;
8
+ constructor(httpRequest: IHttpRequest);
9
+ getSTPTransactionDownload(params: {
10
+ date: string;
11
+ index?: string;
12
+ pageSize?: number;
13
+ sort?: string;
14
+ }): Promise<ApiGatewayResponse<any>>;
15
+ pay(request: ServicePaymentRequest): Promise<ApiGatewayResponse<any>>;
16
+ getTransaction(transactionNumber: string): Promise<ApiGatewayResponse<any>>;
17
+ getById(id: string): Promise<ApiGatewayResponse<any>>;
18
+ getPaymentValidation(transactionNumber: string): Promise<ApiGatewayResponse<any>>;
19
+ getCatalog(params: GetCatalogParams): Promise<ApiGatewayResponse<any>>;
20
+ }
@@ -0,0 +1,54 @@
1
+ "use strict";
2
+ var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
3
+ var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
4
+ if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
5
+ 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;
6
+ return c > 3 && r && Object.defineProperty(target, key, r), r;
7
+ };
8
+ var __metadata = (this && this.__metadata) || function (k, v) {
9
+ if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
10
+ };
11
+ var __param = (this && this.__param) || function (paramIndex, decorator) {
12
+ return function (target, key) { decorator(target, key, paramIndex); }
13
+ };
14
+ Object.defineProperty(exports, "__esModule", { value: true });
15
+ const inversify_1 = require("inversify");
16
+ let MulticommServicePaymentApi = class MulticommServicePaymentApi {
17
+ constructor(httpRequest) {
18
+ this.httpRequest = httpRequest;
19
+ this.baseUrl = process.env.MULTICOMM_SERVICE_PAY_LAMBDA_URL || "";
20
+ }
21
+ async getSTPTransactionDownload(params) {
22
+ const url = `${this.baseUrl}transaction-download?${Object.keys(params).map(key => `${key}=${encodeURIComponent(params[key])}`).join('&')}`;
23
+ return await this.httpRequest.get(url);
24
+ }
25
+ async pay(request) {
26
+ const url = `${this.baseUrl}/pay`;
27
+ return await this.httpRequest.post(url, request);
28
+ }
29
+ async getTransaction(transactionNumber) {
30
+ const url = `${this.baseUrl}/transaction/${transactionNumber}`;
31
+ return await this.httpRequest.get(url);
32
+ }
33
+ async getById(id) {
34
+ const url = `${this.baseUrl}/transaction/${id}`;
35
+ return await this.httpRequest.get(url);
36
+ }
37
+ async getPaymentValidation(transactionNumber) {
38
+ const url = `${this.baseUrl}/pay/validation/${transactionNumber}`;
39
+ return await this.httpRequest.get(url);
40
+ }
41
+ async getCatalog(params) {
42
+ let url = `${this.baseUrl}/catalog`;
43
+ if (params) {
44
+ url += `?${Object.keys(params).map(key => `${key}=${encodeURIComponent(params[key])}`).join('&')}`;
45
+ }
46
+ return await this.httpRequest.get(url);
47
+ }
48
+ };
49
+ MulticommServicePaymentApi = __decorate([
50
+ (0, inversify_1.injectable)(),
51
+ __param(0, (0, inversify_1.inject)("IHttpRequest")),
52
+ __metadata("design:paramtypes", [Object])
53
+ ], MulticommServicePaymentApi);
54
+ exports.default = MulticommServicePaymentApi;
@@ -0,0 +1,15 @@
1
+ import { GetCatalogParams, ServicePaymentRequest } from "@fiado/type-kit/bin/servicePayment";
2
+ import { ApiGatewayResponse } from "@fiado/gateway-adapter";
3
+ export interface IMulticommServicePaymentApi {
4
+ pay(request: ServicePaymentRequest): Promise<ApiGatewayResponse<any>>;
5
+ getTransaction(transactionNumber: string): Promise<ApiGatewayResponse<any>>;
6
+ getPaymentValidation(transactionNumber: string): Promise<ApiGatewayResponse<any>>;
7
+ getCatalog(params: GetCatalogParams): Promise<ApiGatewayResponse<any>>;
8
+ getById(id: string): Promise<ApiGatewayResponse<any>>;
9
+ getSTPTransactionDownload(params: {
10
+ date: string;
11
+ index?: string;
12
+ pageSize?: number;
13
+ sort?: string;
14
+ }): Promise<ApiGatewayResponse<any>>;
15
+ }
@@ -0,0 +1,2 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
@@ -0,0 +1,2 @@
1
+ export * from './api/interfaces/IMulticommServicePaymentApi';
2
+ export * from './api/MulticommServicePaymentApi';
@@ -0,0 +1,18 @@
1
+ "use strict";
2
+ var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
+ if (k2 === undefined) k2 = k;
4
+ var desc = Object.getOwnPropertyDescriptor(m, k);
5
+ if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
6
+ desc = { enumerable: true, get: function() { return m[k]; } };
7
+ }
8
+ Object.defineProperty(o, k2, desc);
9
+ }) : (function(o, m, k, k2) {
10
+ if (k2 === undefined) k2 = k;
11
+ o[k2] = m[k];
12
+ }));
13
+ var __exportStar = (this && this.__exportStar) || function(m, exports) {
14
+ for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
15
+ };
16
+ Object.defineProperty(exports, "__esModule", { value: true });
17
+ __exportStar(require("./api/interfaces/IMulticommServicePaymentApi"), exports);
18
+ __exportStar(require("./api/MulticommServicePaymentApi"), exports);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@fiado/api-invoker",
3
- "version": "1.5.40",
3
+ "version": "1.5.42",
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",
@@ -9,6 +9,7 @@ import {
9
9
  ExecutePocketOperationRequest,
10
10
  ExecutePocketOperationResponse,
11
11
  GetAccountResponse,
12
+ GetAccountResponseList,
12
13
  GetPocketBalanceResponse
13
14
  } from "@fiado/type-kit/bin/account";
14
15
  import FiadoApiResponse from "@fiado/type-kit/bin/apiResponse/dtos/FiadoApiResponse";
@@ -53,6 +54,16 @@ export default class AccountFiadoIncApi implements IAccountFiadoIncApi {
53
54
  return await this.httpRequest.get(url);
54
55
  }
55
56
 
57
+ async scanAllAccounts(provider: Provider | 'ALL', limit?: number, lastEvaluatedKey?: string): Promise<FiadoApiResponse<GetAccountResponseList>> {
58
+ const queryParams = new URLSearchParams();
59
+ queryParams.append('provider', provider);
60
+ if (limit) queryParams.append('limit', limit.toString());
61
+ if (lastEvaluatedKey) queryParams.append('lastEvaluatedKey', lastEvaluatedKey);
62
+
63
+ const url = `${this.baseUrl}accounts/scan?${queryParams.toString()}`;
64
+ return await this.httpRequest.get(url);
65
+ }
66
+
56
67
  /** POCKETS **/
57
68
  async getPocketBalance(provider: Provider, directoryId: string): Promise<FiadoApiResponse<GetPocketBalanceResponse>> {
58
69
  const url = `${this.baseUrl}${provider}/pockets/users/${directoryId}/balance`;
@@ -8,6 +8,7 @@ import {
8
8
  ExecutePocketOperationRequest,
9
9
  ExecutePocketOperationResponse,
10
10
  GetAccountResponse,
11
+ GetAccountResponseList,
11
12
  GetPocketBalanceResponse
12
13
  } from "@fiado/type-kit/bin/account";
13
14
  import FiadoApiResponse from "@fiado/type-kit/bin/apiResponse/dtos/FiadoApiResponse";
@@ -40,4 +41,6 @@ export interface IAccountFiadoIncApi extends IPublisher {
40
41
  replaceExternalAccount(provider: Provider, directoryId: string, externalAccountId:string, isPrincipal:boolean): Promise<FiadoApiResponse<void>>
41
42
 
42
43
  getAccountByExternalAccountId(provider: Provider, externalAccountId: string): Promise<FiadoApiResponse<GetAccountResponse[]>>
44
+
45
+ scanAllAccounts(provider: Provider | 'ALL', limit?: number, lastEvaluatedKey?: string): Promise<FiadoApiResponse<GetAccountResponseList>>
43
46
  }
@@ -92,6 +92,8 @@ import PeopleBusinessApi from "./people-business/api/PeopleBusinessApi";
92
92
  import { IPeopleBusinessApi } from "./people-business";
93
93
  import STPBusinessApi from "./stp-business/api/STPBusinessApi";
94
94
  import { ISTPBusinessApi } from "./stp-business";
95
+ import { IMulticommServicePaymentApi } from "./multicommServicePayment";
96
+ import MulticommServicePaymentApi from "./multicommServicePayment/api/MulticommServicePaymentApi";
95
97
 
96
98
  export const apiInvokerBindings = new ContainerModule((bind: interfaces.Bind) => {
97
99
  // UTILS bindings
@@ -123,6 +125,7 @@ export const apiInvokerBindings = new ContainerModule((bind: interfaces.Bind) =>
123
125
  bind<IAccountBeneficiaryApi>("IAccountBeneficiaryApi").to(AccountBeneficiaryApi);
124
126
  bind<IStpSpeiApi>("IStpSpeiApi").to(StpSpeiApi);
125
127
  bind<IStpServicePaymentApi>("IStpServicePaymentApi").to(StpServicePaymentApi);
128
+ bind<IMulticommServicePaymentApi>("IMulticommServicePaymentApi").to(MulticommServicePaymentApi);
126
129
  bind<IBBVARstApi>("IBBVARstApi").to(BBVARstApi);
127
130
  bind<IFraudPreventionEngineApi>("IFraudPreventionEngineApi").to(FraudPreventionEngineApi);
128
131
  bind<IGroupApi>("IGroupApi").to(GroupApi);
@@ -162,5 +165,4 @@ export const apiInvokerBindings = new ContainerModule((bind: interfaces.Bind) =>
162
165
  bind<IReportProcessorBusinessApi>("IReportProcessorBusinessApi").to(ReportProcessorBusinessApi);
163
166
  bind<IPeopleBusinessApi>("IPeopleBusinessApi").to(PeopleBusinessApi);
164
167
  bind<ISTPBusinessApi>("ISTPBusinessApi").to(STPBusinessApi);
165
-
166
168
  });
package/src/index.ts CHANGED
@@ -57,4 +57,5 @@ export * from "./report-processor-business";
57
57
  export * from "./notificationWebsockets";
58
58
  export * from "./people-business";
59
59
  export * from "./stp-business";
60
+ export * from "./multicommServicePayment";
60
61
 
@@ -0,0 +1,45 @@
1
+ import {IMulticommServicePaymentApi} from "./interfaces/IMulticommServicePaymentApi";
2
+ import {inject, injectable} from "inversify";
3
+ import {IHttpRequest} from "@fiado/http-client";
4
+ import {GetCatalogParams, ServicePaymentRequest} from "@fiado/type-kit/bin/servicePayment";
5
+ import {ApiGatewayResponse} from "@fiado/gateway-adapter";
6
+
7
+ @injectable()
8
+ export default class MulticommServicePaymentApi implements IMulticommServicePaymentApi {
9
+ private readonly baseUrl = process.env.MULTICOMM_SERVICE_PAY_LAMBDA_URL || "";
10
+
11
+ constructor(@inject("IHttpRequest") private httpRequest: IHttpRequest) {
12
+ }
13
+ async getSTPTransactionDownload(params: { date: string; index?: string; pageSize?: number; sort?: string; }): Promise<ApiGatewayResponse<any>> {
14
+ const url= `${this.baseUrl}transaction-download?${Object.keys(params).map(key => `${key}=${encodeURIComponent(params[key])}`).join('&')}`;
15
+ return await this.httpRequest.get(url);
16
+ }
17
+
18
+ async pay(request: ServicePaymentRequest): Promise<ApiGatewayResponse<any>> {
19
+ const url = `${this.baseUrl}/pay`;
20
+ return await this.httpRequest.post(url, request);
21
+ }
22
+
23
+ async getTransaction(transactionNumber: string): Promise<ApiGatewayResponse<any>> {
24
+ const url = `${this.baseUrl}/transaction/${transactionNumber}`;
25
+ return await this.httpRequest.get(url);
26
+ }
27
+
28
+ async getById(id: string): Promise<ApiGatewayResponse<any>> {
29
+ const url = `${this.baseUrl}/transaction/${id}`;
30
+ return await this.httpRequest.get(url);
31
+ }
32
+
33
+ async getPaymentValidation(transactionNumber: string): Promise<ApiGatewayResponse<any>> {
34
+ const url = `${this.baseUrl}/pay/validation/${transactionNumber}`;
35
+ return await this.httpRequest.get(url);
36
+ }
37
+
38
+ async getCatalog(params: GetCatalogParams): Promise<ApiGatewayResponse<any>> {
39
+ let url = `${this.baseUrl}/catalog`;
40
+ if (params) {
41
+ url += `?${Object.keys(params).map(key => `${key}=${encodeURIComponent(params[key])}`).join('&')}`;
42
+ }
43
+ return await this.httpRequest.get(url);
44
+ }
45
+ }
@@ -0,0 +1,16 @@
1
+ import {GetCatalogParams, ServicePaymentRequest} from "@fiado/type-kit/bin/servicePayment";
2
+ import {ApiGatewayResponse} from "@fiado/gateway-adapter";
3
+
4
+ export interface IMulticommServicePaymentApi {
5
+ pay(request: ServicePaymentRequest): Promise<ApiGatewayResponse<any>>;
6
+
7
+ getTransaction(transactionNumber: string): Promise<ApiGatewayResponse<any>>;
8
+
9
+ getPaymentValidation(transactionNumber: string): Promise<ApiGatewayResponse<any>>
10
+
11
+ getCatalog(params: GetCatalogParams): Promise<ApiGatewayResponse<any>>;
12
+
13
+ getById(id: string): Promise<ApiGatewayResponse<any>>;
14
+
15
+ getSTPTransactionDownload(params: {date: string,index?:string,pageSize?:number, sort?:string}): Promise<ApiGatewayResponse<any>>;
16
+ }
@@ -0,0 +1,2 @@
1
+ export * from './api/interfaces/IMulticommServicePaymentApi';
2
+ export * from './api/MulticommServicePaymentApi';