@fiado/api-invoker 1.5.41 → 1.5.43

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.
Files changed (38) hide show
  1. package/bin/account-fiadoinc/queue/TransactionPublisher.d.ts +9 -0
  2. package/bin/account-fiadoinc/queue/TransactionPublisher.js +36 -0
  3. package/bin/account-fiadoinc/queue/interfaces/ITransactionPublisher.d.ts +7 -0
  4. package/bin/activity/ActivityApi.d.ts +17 -0
  5. package/bin/activity/ActivityApi.js +72 -0
  6. package/bin/activity/index.d.ts +2 -0
  7. package/bin/activity/index.js +18 -0
  8. package/bin/activity/interfaces/IActivityApi.d.ts +39 -0
  9. package/bin/container.config.js +4 -0
  10. package/bin/index.d.ts +2 -0
  11. package/bin/index.js +2 -0
  12. package/bin/multicommServicePayment/api/MulticommServicePaymentApi.d.ts +20 -0
  13. package/bin/multicommServicePayment/api/MulticommServicePaymentApi.js +54 -0
  14. package/bin/multicommServicePayment/api/interfaces/IMulticommServicePaymentApi.d.ts +15 -0
  15. package/bin/multicommServicePayment/api/interfaces/IMulticommServicePaymentApi.js +2 -0
  16. package/bin/multicommServicePayment/index.d.ts +2 -0
  17. package/bin/multicommServicePayment/index.js +18 -0
  18. package/bin/product-payment/api/ProductPaymentApi.d.ts +11 -0
  19. package/bin/product-payment/api/ProductPaymentApi.js +31 -0
  20. package/bin/product-payment/api/interfaces/IProductPaymentApi.d.ts +6 -0
  21. package/bin/product-payment/api/interfaces/IProductPaymentApi.js +2 -0
  22. package/bin/product-payment/index.d.ts +2 -0
  23. package/bin/product-payment/index.js +18 -0
  24. package/bin/referral-business/PayrollApi.d.ts +9 -0
  25. package/bin/referral-business/PayrollApi.js +37 -0
  26. package/package.json +2 -2
  27. package/src/container.config.ts +6 -1
  28. package/src/index.ts +2 -0
  29. package/src/multicommServicePayment/api/MulticommServicePaymentApi.ts +45 -0
  30. package/src/multicommServicePayment/api/interfaces/IMulticommServicePaymentApi.ts +16 -0
  31. package/src/multicommServicePayment/index.ts +2 -0
  32. package/src/product-payment/api/ProductPaymentApi.ts +19 -0
  33. package/src/product-payment/api/interfaces/IProductPaymentApi.ts +7 -0
  34. package/src/product-payment/index.ts +2 -0
  35. package/bin/cognitoConnector/interfaces/ICognitoConnectorApiV2.d.ts +0 -46
  36. package/bin/report-processor-business/api/IReportProcessorBusiness.d.ts +0 -3
  37. /package/bin/{cognitoConnector/interfaces/ICognitoConnectorApiV2.js → account-fiadoinc/queue/interfaces/ITransactionPublisher.js} +0 -0
  38. /package/bin/{report-processor-business/api/IReportProcessorBusiness.js → activity/interfaces/IActivityApi.js} +0 -0
@@ -0,0 +1,9 @@
1
+ import { ITransactionPublisher } from "./interfaces/ITransactionPublisher";
2
+ import { ProviderDocumentUploadRequest } from "@fiado/type-kit/bin/provider";
3
+ export declare class TransactionPublisher implements ITransactionPublisher {
4
+ private readonly FIADO_INC_KYC_MESSAGE_QUEUE;
5
+ publish(message: {
6
+ externalUserId: string;
7
+ input: ProviderDocumentUploadRequest;
8
+ }): Promise<void>;
9
+ }
@@ -0,0 +1,36 @@
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
+ Object.defineProperty(exports, "__esModule", { value: true });
9
+ exports.TransactionPublisher = void 0;
10
+ const client_sqs_1 = require("@aws-sdk/client-sqs");
11
+ const inversify_1 = require("inversify");
12
+ let TransactionPublisher = class TransactionPublisher {
13
+ constructor() {
14
+ this.FIADO_INC_KYC_MESSAGE_QUEUE = process.env.FIADO_INC_KYC_MESSAGE_QUEUE;
15
+ }
16
+ async publish(message) {
17
+ try {
18
+ const client = new client_sqs_1.SQSClient();
19
+ const sendMessageRequest = {
20
+ QueueUrl: this.FIADO_INC_KYC_MESSAGE_QUEUE,
21
+ MessageBody: JSON.stringify(message),
22
+ MessageGroupId: message.externalUserId,
23
+ MessageDeduplicationId: message.externalUserId
24
+ };
25
+ const command = new client_sqs_1.SendMessageCommand(sendMessageRequest);
26
+ await client.send(command);
27
+ }
28
+ catch (error) {
29
+ throw new Error(`Error publishing message to queue ${': ' + error.message}`);
30
+ }
31
+ }
32
+ };
33
+ exports.TransactionPublisher = TransactionPublisher;
34
+ exports.TransactionPublisher = TransactionPublisher = __decorate([
35
+ (0, inversify_1.injectable)()
36
+ ], TransactionPublisher);
@@ -0,0 +1,7 @@
1
+ import { ProviderDocumentUploadRequest } from "@fiado/type-kit/bin/provider";
2
+ export interface ITransactionPublisher {
3
+ publish(params: {
4
+ externalUserId: string;
5
+ input: ProviderDocumentUploadRequest;
6
+ }): Promise<void>;
7
+ }
@@ -0,0 +1,17 @@
1
+ import { IHttpRequest } from "@fiado/http-client";
2
+ import { IActivityApi } from './interfaces/IActivityApi';
3
+ import { TypeOfDirectoryId } from '@fiado/type-kit/bin/directory';
4
+ export declare class ActivityApi implements IActivityApi {
5
+ private httpRequest;
6
+ private readonly baseUrl;
7
+ constructor(httpRequest: IHttpRequest);
8
+ getActivities(typeOfActivities: string[]): Promise<any>;
9
+ getActivitiesByDirectoryIdAndTypeOfActivity(directoryId: string, typeOfActivities: string[]): Promise<any>;
10
+ postActivity(params: {
11
+ directoryId: string;
12
+ typeOfDirectoryId: TypeOfDirectoryId;
13
+ typeOfActivity: string;
14
+ amount: string;
15
+ date: string;
16
+ }): Promise<any>;
17
+ }
@@ -0,0 +1,72 @@
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
+ var __importDefault = (this && this.__importDefault) || function (mod) {
15
+ return (mod && mod.__esModule) ? mod : { "default": mod };
16
+ };
17
+ Object.defineProperty(exports, "__esModule", { value: true });
18
+ exports.ActivityApi = void 0;
19
+ const dotenv_1 = __importDefault(require("dotenv"));
20
+ const inversify_1 = require("inversify");
21
+ dotenv_1.default.config();
22
+ let ActivityApi = class ActivityApi {
23
+ constructor(httpRequest) {
24
+ this.httpRequest = httpRequest;
25
+ this.baseUrl = process.env.ACTIVITY_LAMBDA_URL || "";
26
+ }
27
+ async getActivities(typeOfActivities) {
28
+ let url = `${this.baseUrl}activities`;
29
+ if (typeOfActivities.length > 0) {
30
+ url = `${this.baseUrl}activities?${typeOfActivities.map(id => `typeOfActivities=${encodeURIComponent(id)}`).join('&')}`;
31
+ }
32
+ const operationName = "getActivities";
33
+ return await this.httpRequest.post(`${url}`, null, { 'operationName': operationName });
34
+ }
35
+ async getActivitiesByDirectoryIdAndTypeOfActivity(directoryId, typeOfActivities) {
36
+ if (directoryId == null || directoryId == undefined || directoryId == "") {
37
+ throw new Error("At least directory ID is required.");
38
+ }
39
+ let url = `${this.baseUrl}activities/directory/${directoryId}`;
40
+ if (typeOfActivities.length > 0) {
41
+ url = `${this.baseUrl}activities/directory/${directoryId}?${typeOfActivities.map(id => `typeOfActivities=${encodeURIComponent(id)}`).join('&')}`;
42
+ }
43
+ const operationName = "getActivitiesByDirectoryIdAndTypeOfActivity";
44
+ return await this.httpRequest.post(`${url}`, null, { 'operationName': operationName });
45
+ }
46
+ async postActivity(params) {
47
+ if (params.directoryId == null || params.directoryId == undefined || params.directoryId == "") {
48
+ throw new Error("At least directory ID is required.");
49
+ }
50
+ if (params.typeOfDirectoryId == null || params.typeOfDirectoryId == undefined) {
51
+ throw new Error("At least typeOfDirectoryId is required.");
52
+ }
53
+ if (params.typeOfActivity == null || params.typeOfActivity == undefined || params.typeOfActivity == "") {
54
+ throw new Error("At least typeOfActivity is required.");
55
+ }
56
+ if (params.amount == null || params.amount == undefined || params.amount == "") {
57
+ throw new Error("At least amount is required.");
58
+ }
59
+ if (params.date == null || params.date == undefined || params.date == "") {
60
+ throw new Error("At least date is required.");
61
+ }
62
+ const url = `${this.baseUrl}/activities/create`;
63
+ const operationName = "postActivity";
64
+ return await this.httpRequest.post(`${url}`, params, { 'operationName': operationName });
65
+ }
66
+ };
67
+ exports.ActivityApi = ActivityApi;
68
+ exports.ActivityApi = ActivityApi = __decorate([
69
+ (0, inversify_1.injectable)(),
70
+ __param(0, (0, inversify_1.inject)("IHttpRequest")),
71
+ __metadata("design:paramtypes", [Object])
72
+ ], ActivityApi);
@@ -0,0 +1,2 @@
1
+ export * from './interfaces/IActivityApi';
2
+ export * from './ActivityApi';
@@ -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("./interfaces/IActivityApi"), exports);
18
+ __exportStar(require("./ActivityApi"), exports);
@@ -0,0 +1,39 @@
1
+ import { TypeOfDirectoryId } from "@fiado/type-kit/bin/directory";
2
+ /**
3
+ * Interfaz para el servicio Directory que permite operaciones sobre directorios.
4
+ */
5
+ export interface IActivityApi {
6
+ /**
7
+ * Obtiene una lista de entidades de la tabla ActivityDirectory.
8
+ * @param directoryId Directorio que se va a consultar.
9
+ * @param typeOfActivities Array de tipos de actividades (Opcional).
10
+ * @returns Retorna un arreglo de objetos de ActivityDirectory.
11
+ * @throws {Error} Lanza un error si los parámetros de entrada son inválidos.
12
+ */
13
+ getActivitiesByDirectoryIdAndTypeOfActivity(directoryId: string, typeOfActivities: string[]): Promise<any>;
14
+ /**
15
+ * Obtener actividades globales.
16
+ * @param typeOfActivity Tipo de actividad
17
+ * Puede devolver un arreglo vacío si no se encuentran coincidencias.
18
+ * @throws {Error} Lanza un error si los parámetros de entrada son inválidos.
19
+ */
20
+ getActivities(typeOfActivities: string[]): Promise<any>;
21
+ /**
22
+ * Proceso para agregar a las actividades.
23
+ * @param directoryId Directorio
24
+ * @param typeOfDirectoryId Tipo de directorio
25
+ * @param typeOfActivity Tipo de actividad
26
+ * @param amount Monto de la actividad
27
+ * @param date Fecha de la actividad
28
+ * @returns Retorna un objeto de ActivityDirectory.
29
+ * Puede devolver un arreglo vacío si no se encuentran coincidencias.
30
+ * @throws {Error} Lanza un error si los parámetros de entrada son inválidos.
31
+ */
32
+ postActivity(params: {
33
+ directoryId: string;
34
+ typeOfDirectoryId: TypeOfDirectoryId;
35
+ typeOfActivity: string;
36
+ amount: string;
37
+ date: string;
38
+ }): Promise<any>;
39
+ }
@@ -70,6 +70,8 @@ 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"));
74
+ const ProductPaymentApi_1 = __importDefault(require("./product-payment/api/ProductPaymentApi"));
73
75
  exports.apiInvokerBindings = new inversify_1.ContainerModule((bind) => {
74
76
  // UTILS bindings
75
77
  bind("InvokerUtils").to(InvokerUtils_1.InvokerUtils);
@@ -99,6 +101,7 @@ exports.apiInvokerBindings = new inversify_1.ContainerModule((bind) => {
99
101
  bind("IAccountBeneficiaryApi").to(account_beneficiary_1.AccountBeneficiaryApi);
100
102
  bind("IStpSpeiApi").to(stpSpei_1.StpSpeiApi);
101
103
  bind("IStpServicePaymentApi").to(StpServicePaymentApi_1.default);
104
+ bind("IMulticommServicePaymentApi").to(MulticommServicePaymentApi_1.default);
102
105
  bind("IBBVARstApi").to(bbvaRst_1.BBVARstApi);
103
106
  bind("IFraudPreventionEngineApi").to(FraudPreventionEngineApi_1.default);
104
107
  bind("IGroupApi").to(group_1.GroupApi);
@@ -138,4 +141,5 @@ exports.apiInvokerBindings = new inversify_1.ContainerModule((bind) => {
138
141
  bind("IReportProcessorBusinessApi").to(ReportProcessorBusinessApi_1.default);
139
142
  bind("IPeopleBusinessApi").to(PeopleBusinessApi_1.default);
140
143
  bind("ISTPBusinessApi").to(STPBusinessApi_1.default);
144
+ bind("IProductPaymentApi").to(ProductPaymentApi_1.default);
141
145
  });
package/bin/index.d.ts CHANGED
@@ -57,3 +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";
61
+ export * from "./product-payment";
package/bin/index.js CHANGED
@@ -73,3 +73,5 @@ __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);
77
+ __exportStar(require("./product-payment"), 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);
@@ -0,0 +1,11 @@
1
+ import { IProductPaymentApi } from "./interfaces/IProductPaymentApi";
2
+ import { IHttpRequest } from "@fiado/http-client";
3
+ import { ServicePaymentRequest } from "@fiado/type-kit/bin/servicePayment";
4
+ import { ApiGatewayResponse } from "@fiado/gateway-adapter";
5
+ import { Provider } from "@fiado/type-kit/bin/provider";
6
+ export default class ProductPaymentApi implements IProductPaymentApi {
7
+ private httpRequest;
8
+ private readonly baseUrl;
9
+ constructor(httpRequest: IHttpRequest);
10
+ pay(request: ServicePaymentRequest, provider: Provider): Promise<ApiGatewayResponse<any>>;
11
+ }
@@ -0,0 +1,31 @@
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 ProductPaymentApi = class ProductPaymentApi {
17
+ constructor(httpRequest) {
18
+ this.httpRequest = httpRequest;
19
+ this.baseUrl = process.env.PRODUCT_PAYMENT_LAMBDA_URL || "";
20
+ }
21
+ async pay(request, provider) {
22
+ const url = `${this.baseUrl}/${provider}/pay`;
23
+ return await this.httpRequest.post(url, request);
24
+ }
25
+ };
26
+ ProductPaymentApi = __decorate([
27
+ (0, inversify_1.injectable)(),
28
+ __param(0, (0, inversify_1.inject)("IHttpRequest")),
29
+ __metadata("design:paramtypes", [Object])
30
+ ], ProductPaymentApi);
31
+ exports.default = ProductPaymentApi;
@@ -0,0 +1,6 @@
1
+ import { ServicePaymentRequest } from "@fiado/type-kit/bin/servicePayment";
2
+ import { ApiGatewayResponse } from "@fiado/gateway-adapter";
3
+ import { Provider } from "@fiado/type-kit/bin/provider";
4
+ export interface IProductPaymentApi {
5
+ pay(request: ServicePaymentRequest, provider: Provider): Promise<ApiGatewayResponse<any>>;
6
+ }
@@ -0,0 +1,2 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
@@ -0,0 +1,2 @@
1
+ export * from './api/interfaces/IProductPaymentApi';
2
+ export * from './api/ProductPaymentApi';
@@ -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/IProductPaymentApi"), exports);
18
+ __exportStar(require("./api/ProductPaymentApi"), exports);
@@ -0,0 +1,9 @@
1
+ import { IHttpRequest } from "@fiado/http-client";
2
+ import { IReferralBusinessApi } from "./interfaces/IReferralBusinessApi";
3
+ import FiadoApiResponse from "@fiado/type-kit/bin/apiResponse/dtos/FiadoApiResponse";
4
+ export declare class ReferralBusinessApi implements IReferralBusinessApi {
5
+ private httpRequest;
6
+ private readonly baseUrl;
7
+ constructor(httpRequest: IHttpRequest);
8
+ getByDirectoryId(directoryId: string): Promise<FiadoApiResponse<any>>;
9
+ }
@@ -0,0 +1,37 @@
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
+ var __importDefault = (this && this.__importDefault) || function (mod) {
15
+ return (mod && mod.__esModule) ? mod : { "default": mod };
16
+ };
17
+ Object.defineProperty(exports, "__esModule", { value: true });
18
+ exports.ReferralBusinessApi = void 0;
19
+ const inversify_1 = require("inversify");
20
+ const dotenv_1 = __importDefault(require("dotenv"));
21
+ dotenv_1.default.config();
22
+ let ReferralBusinessApi = class ReferralBusinessApi {
23
+ constructor(httpRequest) {
24
+ this.httpRequest = httpRequest;
25
+ this.baseUrl = process.env.PAYROLL_BUSINESS_LAMBDA_URL || "";
26
+ }
27
+ async getByDirectoryId(directoryId) {
28
+ const url = `${this.baseUrl}private/agents/directoryId/${directoryId}`;
29
+ return await this.httpRequest.get(url);
30
+ }
31
+ };
32
+ exports.ReferralBusinessApi = ReferralBusinessApi;
33
+ exports.ReferralBusinessApi = ReferralBusinessApi = __decorate([
34
+ (0, inversify_1.injectable)(),
35
+ __param(0, (0, inversify_1.inject)("IHttpRequest")),
36
+ __metadata("design:paramtypes", [Object])
37
+ ], ReferralBusinessApi);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@fiado/api-invoker",
3
- "version": "1.5.41",
3
+ "version": "1.5.43",
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": "^2.1.28",
19
+ "@fiado/type-kit": "^2.1.45",
20
20
  "dotenv": "^16.4.7",
21
21
  "inversify": "^6.2.2",
22
22
  "reflect-metadata": "^0.2.2"
@@ -92,6 +92,10 @@ 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";
97
+ import { IProductPaymentApi } from "./product-payment";
98
+ import ProductPaymentApi from "./product-payment/api/ProductPaymentApi";
95
99
 
96
100
  export const apiInvokerBindings = new ContainerModule((bind: interfaces.Bind) => {
97
101
  // UTILS bindings
@@ -123,6 +127,7 @@ export const apiInvokerBindings = new ContainerModule((bind: interfaces.Bind) =>
123
127
  bind<IAccountBeneficiaryApi>("IAccountBeneficiaryApi").to(AccountBeneficiaryApi);
124
128
  bind<IStpSpeiApi>("IStpSpeiApi").to(StpSpeiApi);
125
129
  bind<IStpServicePaymentApi>("IStpServicePaymentApi").to(StpServicePaymentApi);
130
+ bind<IMulticommServicePaymentApi>("IMulticommServicePaymentApi").to(MulticommServicePaymentApi);
126
131
  bind<IBBVARstApi>("IBBVARstApi").to(BBVARstApi);
127
132
  bind<IFraudPreventionEngineApi>("IFraudPreventionEngineApi").to(FraudPreventionEngineApi);
128
133
  bind<IGroupApi>("IGroupApi").to(GroupApi);
@@ -162,5 +167,5 @@ export const apiInvokerBindings = new ContainerModule((bind: interfaces.Bind) =>
162
167
  bind<IReportProcessorBusinessApi>("IReportProcessorBusinessApi").to(ReportProcessorBusinessApi);
163
168
  bind<IPeopleBusinessApi>("IPeopleBusinessApi").to(PeopleBusinessApi);
164
169
  bind<ISTPBusinessApi>("ISTPBusinessApi").to(STPBusinessApi);
165
-
170
+ bind<IProductPaymentApi>("IProductPaymentApi").to(ProductPaymentApi);
166
171
  });
package/src/index.ts CHANGED
@@ -57,4 +57,6 @@ 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";
61
+ export * from "./product-payment";
60
62
 
@@ -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';
@@ -0,0 +1,19 @@
1
+ import {IProductPaymentApi} from "./interfaces/IProductPaymentApi";
2
+ import {inject, injectable} from "inversify";
3
+ import {IHttpRequest} from "@fiado/http-client";
4
+ import {ServicePaymentRequest} from "@fiado/type-kit/bin/servicePayment";
5
+ import {ApiGatewayResponse} from "@fiado/gateway-adapter";
6
+ import { Provider } from "@fiado/type-kit/bin/provider";
7
+
8
+ @injectable()
9
+ export default class ProductPaymentApi implements IProductPaymentApi {
10
+ private readonly baseUrl = process.env.PRODUCT_PAYMENT_LAMBDA_URL || "";
11
+
12
+ constructor(@inject("IHttpRequest") private httpRequest: IHttpRequest) {
13
+ }
14
+
15
+ async pay(request: ServicePaymentRequest, provider:Provider): Promise<ApiGatewayResponse<any>> {
16
+ const url = `${this.baseUrl}/${provider}/pay`;
17
+ return await this.httpRequest.post(url, request);
18
+ }
19
+ }
@@ -0,0 +1,7 @@
1
+ import {ServicePaymentRequest} from "@fiado/type-kit/bin/servicePayment";
2
+ import {ApiGatewayResponse} from "@fiado/gateway-adapter";
3
+ import { Provider } from "@fiado/type-kit/bin/provider";
4
+
5
+ export interface IProductPaymentApi {
6
+ pay(request: ServicePaymentRequest,provider:Provider): Promise<ApiGatewayResponse<any>>;
7
+ }
@@ -0,0 +1,2 @@
1
+ export * from './api/interfaces/IProductPaymentApi';
2
+ export * from './api/ProductPaymentApi';
@@ -1,46 +0,0 @@
1
- import { ChangePasswordRequest, GetUserRequest, GetUserResponse, RefreshTokenRequest, RefreshTokenResponse, RespondToAuthChallengeRequest, SetPasswordRequest, SignInRequest, SignInResponse, SignUpConfirmRequest, SignUpRequest, SignUpResponse } from "@fiado/type-kit/bin/cognitoConnector";
2
- export interface ICognitoApi {
3
- /**
4
- * Healthcheck for the cognito-connector
5
- */
6
- healthcheck(): Promise<HealthcheckResponse>;
7
- /**
8
- * Create a new user in Cognito
9
- */
10
- signUp(request: SignUpRequest): Promise<SignUpResponse>;
11
- /**
12
- * Confirm sign-up for a user in Cognito
13
- */
14
- signUpConfirm(request: SignUpConfirmRequest): Promise<void>;
15
- /**
16
- * Sign in a user
17
- */
18
- signIn(request: SignInRequest): Promise<SignInResponse>;
19
- /**
20
- * Sign out a user
21
- */
22
- signOut(): Promise<void>;
23
- /**
24
- * Change a user's password
25
- */
26
- changePassword(request: ChangePasswordRequest): Promise<void>;
27
- /**
28
- * Retrieve user details
29
- */
30
- getUser(request: GetUserRequest): Promise<GetUserResponse>;
31
- /**
32
- * Refresh a user's tokens
33
- */
34
- refreshToken(request: RefreshTokenRequest): Promise<RefreshTokenResponse>;
35
- /**
36
- * Respond to an auth challenge
37
- */
38
- respondToAuthChallenge(request: RespondToAuthChallengeRequest): Promise<any>;
39
- /**
40
- * Reset a user's password
41
- */
42
- resetPassword(request: SetPasswordRequest): Promise<void>;
43
- }
44
- export interface HealthcheckResponse {
45
- status: string;
46
- }
@@ -1,3 +0,0 @@
1
- export interface IReportProcessorBusiness {
2
- processReports(key: string): Promise<void>;
3
- }