@fiado/api-invoker 1.5.42 → 1.5.44
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.
- package/bin/container.config.js +2 -0
- package/bin/index.d.ts +1 -0
- package/bin/index.js +1 -0
- package/bin/product-payment/api/ProductPaymentApi.d.ts +13 -0
- package/bin/product-payment/api/ProductPaymentApi.js +37 -0
- package/bin/product-payment/api/interfaces/IProductPaymentApi.d.ts +8 -0
- package/bin/product-payment/api/interfaces/IProductPaymentApi.js +2 -0
- package/bin/product-payment/index.d.ts +2 -0
- package/bin/product-payment/index.js +18 -0
- package/package.json +2 -2
- package/src/container.config.ts +3 -0
- package/src/index.ts +1 -0
- package/src/product-payment/api/ProductPaymentApi.ts +26 -0
- package/src/product-payment/api/interfaces/IProductPaymentApi.ts +9 -0
- package/src/product-payment/index.ts +2 -0
package/bin/container.config.js
CHANGED
|
@@ -71,6 +71,7 @@ const NotificationWSMessagePublisher_1 = __importDefault(require("./notification
|
|
|
71
71
|
const PeopleBusinessApi_1 = __importDefault(require("./people-business/api/PeopleBusinessApi"));
|
|
72
72
|
const STPBusinessApi_1 = __importDefault(require("./stp-business/api/STPBusinessApi"));
|
|
73
73
|
const MulticommServicePaymentApi_1 = __importDefault(require("./multicommServicePayment/api/MulticommServicePaymentApi"));
|
|
74
|
+
const ProductPaymentApi_1 = __importDefault(require("./product-payment/api/ProductPaymentApi"));
|
|
74
75
|
exports.apiInvokerBindings = new inversify_1.ContainerModule((bind) => {
|
|
75
76
|
// UTILS bindings
|
|
76
77
|
bind("InvokerUtils").to(InvokerUtils_1.InvokerUtils);
|
|
@@ -140,4 +141,5 @@ exports.apiInvokerBindings = new inversify_1.ContainerModule((bind) => {
|
|
|
140
141
|
bind("IReportProcessorBusinessApi").to(ReportProcessorBusinessApi_1.default);
|
|
141
142
|
bind("IPeopleBusinessApi").to(PeopleBusinessApi_1.default);
|
|
142
143
|
bind("ISTPBusinessApi").to(STPBusinessApi_1.default);
|
|
144
|
+
bind("IProductPaymentApi").to(ProductPaymentApi_1.default);
|
|
143
145
|
});
|
package/bin/index.d.ts
CHANGED
package/bin/index.js
CHANGED
|
@@ -74,3 +74,4 @@ __exportStar(require("./notificationWebsockets"), exports);
|
|
|
74
74
|
__exportStar(require("./people-business"), exports);
|
|
75
75
|
__exportStar(require("./stp-business"), exports);
|
|
76
76
|
__exportStar(require("./multicommServicePayment"), exports);
|
|
77
|
+
__exportStar(require("./product-payment"), exports);
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import { IProductPaymentApi } from "./interfaces/IProductPaymentApi";
|
|
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
|
+
import { Provider } from "@fiado/type-kit/bin/provider";
|
|
6
|
+
import { CountryId } from "@fiado/type-kit/bin/country";
|
|
7
|
+
export default class ProductPaymentApi implements IProductPaymentApi {
|
|
8
|
+
private httpRequest;
|
|
9
|
+
private readonly baseUrl;
|
|
10
|
+
constructor(httpRequest: IHttpRequest);
|
|
11
|
+
getCatalog(params: GetCatalogParams, countryId: CountryId): Promise<ApiGatewayResponse<any>>;
|
|
12
|
+
pay(request: ServicePaymentRequest, provider: Provider): Promise<ApiGatewayResponse<any>>;
|
|
13
|
+
}
|
|
@@ -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
|
+
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 getCatalog(params, countryId) {
|
|
22
|
+
const paramsWithCountry = { ...params, countryId };
|
|
23
|
+
const queryParams = Object.keys(paramsWithCountry).map(key => `${key}=${encodeURIComponent(paramsWithCountry[key])}`).join('&');
|
|
24
|
+
const url = `${this.baseUrl}/catalog?${queryParams}`;
|
|
25
|
+
return await this.httpRequest.get(url);
|
|
26
|
+
}
|
|
27
|
+
async pay(request, provider) {
|
|
28
|
+
const url = `${this.baseUrl}/${provider}/pay`;
|
|
29
|
+
return await this.httpRequest.post(url, request);
|
|
30
|
+
}
|
|
31
|
+
};
|
|
32
|
+
ProductPaymentApi = __decorate([
|
|
33
|
+
(0, inversify_1.injectable)(),
|
|
34
|
+
__param(0, (0, inversify_1.inject)("IHttpRequest")),
|
|
35
|
+
__metadata("design:paramtypes", [Object])
|
|
36
|
+
], ProductPaymentApi);
|
|
37
|
+
exports.default = ProductPaymentApi;
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import { GetCatalogParams, ServicePaymentRequest } from "@fiado/type-kit/bin/servicePayment";
|
|
2
|
+
import { ApiGatewayResponse } from "@fiado/gateway-adapter";
|
|
3
|
+
import { Provider } from "@fiado/type-kit/bin/provider";
|
|
4
|
+
import { CountryId } from "@fiado/type-kit/bin/country";
|
|
5
|
+
export interface IProductPaymentApi {
|
|
6
|
+
pay(request: ServicePaymentRequest, provider: Provider): Promise<ApiGatewayResponse<any>>;
|
|
7
|
+
getCatalog(params: GetCatalogParams, countryId: CountryId): Promise<ApiGatewayResponse<any>>;
|
|
8
|
+
}
|
|
@@ -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);
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@fiado/api-invoker",
|
|
3
|
-
"version": "1.5.
|
|
3
|
+
"version": "1.5.44",
|
|
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.
|
|
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"
|
package/src/container.config.ts
CHANGED
|
@@ -94,6 +94,8 @@ import STPBusinessApi from "./stp-business/api/STPBusinessApi";
|
|
|
94
94
|
import { ISTPBusinessApi } from "./stp-business";
|
|
95
95
|
import { IMulticommServicePaymentApi } from "./multicommServicePayment";
|
|
96
96
|
import MulticommServicePaymentApi from "./multicommServicePayment/api/MulticommServicePaymentApi";
|
|
97
|
+
import { IProductPaymentApi } from "./product-payment";
|
|
98
|
+
import ProductPaymentApi from "./product-payment/api/ProductPaymentApi";
|
|
97
99
|
|
|
98
100
|
export const apiInvokerBindings = new ContainerModule((bind: interfaces.Bind) => {
|
|
99
101
|
// UTILS bindings
|
|
@@ -165,4 +167,5 @@ export const apiInvokerBindings = new ContainerModule((bind: interfaces.Bind) =>
|
|
|
165
167
|
bind<IReportProcessorBusinessApi>("IReportProcessorBusinessApi").to(ReportProcessorBusinessApi);
|
|
166
168
|
bind<IPeopleBusinessApi>("IPeopleBusinessApi").to(PeopleBusinessApi);
|
|
167
169
|
bind<ISTPBusinessApi>("ISTPBusinessApi").to(STPBusinessApi);
|
|
170
|
+
bind<IProductPaymentApi>("IProductPaymentApi").to(ProductPaymentApi);
|
|
168
171
|
});
|
package/src/index.ts
CHANGED
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
import {IProductPaymentApi} from "./interfaces/IProductPaymentApi";
|
|
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
|
+
import { Provider } from "@fiado/type-kit/bin/provider";
|
|
7
|
+
import { CountryId } from "@fiado/type-kit/bin/country";
|
|
8
|
+
|
|
9
|
+
@injectable()
|
|
10
|
+
export default class ProductPaymentApi implements IProductPaymentApi {
|
|
11
|
+
private readonly baseUrl = process.env.PRODUCT_PAYMENT_LAMBDA_URL || "";
|
|
12
|
+
|
|
13
|
+
constructor(@inject("IHttpRequest") private httpRequest: IHttpRequest) {
|
|
14
|
+
}
|
|
15
|
+
async getCatalog(params: GetCatalogParams, countryId: CountryId): Promise<ApiGatewayResponse<any>> {
|
|
16
|
+
const paramsWithCountry = { ...params, countryId };
|
|
17
|
+
const queryParams = Object.keys(paramsWithCountry).map(key => `${key}=${encodeURIComponent(paramsWithCountry[key])}`).join('&');
|
|
18
|
+
const url = `${this.baseUrl}/catalog?${queryParams}`;
|
|
19
|
+
return await this.httpRequest.get(url);
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
async pay(request: ServicePaymentRequest, provider:Provider): Promise<ApiGatewayResponse<any>> {
|
|
23
|
+
const url = `${this.baseUrl}/${provider}/pay`;
|
|
24
|
+
return await this.httpRequest.post(url, request);
|
|
25
|
+
}
|
|
26
|
+
}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import {GetCatalogParams, ServicePaymentRequest} from "@fiado/type-kit/bin/servicePayment";
|
|
2
|
+
import {ApiGatewayResponse} from "@fiado/gateway-adapter";
|
|
3
|
+
import { Provider } from "@fiado/type-kit/bin/provider";
|
|
4
|
+
import { CountryId } from "@fiado/type-kit/bin/country";
|
|
5
|
+
|
|
6
|
+
export interface IProductPaymentApi {
|
|
7
|
+
pay(request: ServicePaymentRequest,provider:Provider): Promise<ApiGatewayResponse<any>>;
|
|
8
|
+
getCatalog(params: GetCatalogParams, countryId:CountryId): Promise<ApiGatewayResponse<any>>;
|
|
9
|
+
}
|