@fiado/api-invoker 1.0.90 → 1.0.92
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/account-fiadoinc/AccountFiadoIncApi.d.ts +1 -0
- package/bin/account-fiadoinc/AccountFiadoIncApi.js +4 -0
- package/bin/container.config.js +2 -0
- package/bin/index.d.ts +1 -0
- package/bin/index.js +1 -0
- package/bin/stpServicePayment/api/StpServicePaymentApi.d.ts +13 -0
- package/bin/stpServicePayment/api/StpServicePaymentApi.js +46 -0
- package/bin/stpServicePayment/api/interfaces/IStpServicePaymentApi.d.ts +8 -0
- package/bin/stpServicePayment/api/interfaces/IStpServicePaymentApi.js +2 -0
- package/bin/stpServicePayment/index.d.ts +2 -0
- package/bin/stpServicePayment/index.js +18 -0
- package/package.json +2 -2
- package/src/account-fiadoinc/AccountFiadoIncApi.ts +5 -0
- package/src/container.config.ts +3 -0
- package/src/index.ts +2 -1
- package/src/stpServicePayment/api/StpServicePaymentApi.ts +36 -0
- package/src/stpServicePayment/api/interfaces/IStpServicePaymentApi.ts +12 -0
- package/src/stpServicePayment/index.ts +2 -0
|
@@ -14,4 +14,5 @@ export default class AccountFiadoIncApi implements IAccountFiadoIncApi {
|
|
|
14
14
|
getPocketBalanceById(pocketId: string): Promise<ApiGatewayResponse<GetPocketBalanceResponse>>;
|
|
15
15
|
executePocketTransaction(pocketId: string, operation: OperationEnum, request: ExecutePocketOperationRequest): Promise<ApiGatewayResponse<any>>;
|
|
16
16
|
executeP2pTransaction(request: ExecuteP2pOperationRequest): Promise<ApiGatewayResponse<any>>;
|
|
17
|
+
deletePocket(pocketId: string): Promise<ApiGatewayResponse<void>>;
|
|
17
18
|
}
|
|
@@ -46,6 +46,10 @@ let AccountFiadoIncApi = class AccountFiadoIncApi {
|
|
|
46
46
|
const url = `${this.baseUrl}/p2p/send`;
|
|
47
47
|
return await this.httpRequest.post(url, request);
|
|
48
48
|
}
|
|
49
|
+
async deletePocket(pocketId) {
|
|
50
|
+
const url = `${this.baseUrl}pockets/${pocketId}`;
|
|
51
|
+
return await this.httpRequest.delete(url);
|
|
52
|
+
}
|
|
49
53
|
};
|
|
50
54
|
AccountFiadoIncApi = __decorate([
|
|
51
55
|
(0, inversify_1.injectable)(),
|
package/bin/container.config.js
CHANGED
|
@@ -27,6 +27,7 @@ const P2pContactApi_1 = __importDefault(require("./p2pContact/api/P2pContactApi"
|
|
|
27
27
|
const BankAccountApi_1 = __importDefault(require("./bankAccount/BankAccountApi"));
|
|
28
28
|
const account_beneficiary_1 = require("./account-beneficiary");
|
|
29
29
|
const stpSpei_1 = require("./stpSpei");
|
|
30
|
+
const StpServicePaymentApi_1 = __importDefault(require("./stpServicePayment/api/StpServicePaymentApi"));
|
|
30
31
|
exports.apiInvokerBindings = new inversify_1.ContainerModule((bind) => {
|
|
31
32
|
bind("IDirectoryApi").to(directory_1.DirectoryApi);
|
|
32
33
|
bind("IIdentityApi").to(identity_1.IdentityApi);
|
|
@@ -50,4 +51,5 @@ exports.apiInvokerBindings = new inversify_1.ContainerModule((bind) => {
|
|
|
50
51
|
bind("IBankAccountApi").to(BankAccountApi_1.default);
|
|
51
52
|
bind("IAccountBeneficiaryApi").to(account_beneficiary_1.AccountBeneficiaryApi);
|
|
52
53
|
bind("IStpSpeiApi").to(stpSpei_1.StpSpeiApi);
|
|
54
|
+
bind("IStpServicePaymentApi").to(StpServicePaymentApi_1.default);
|
|
53
55
|
});
|
package/bin/index.d.ts
CHANGED
package/bin/index.js
CHANGED
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import { IStpServicePaymentApi } from "./interfaces/IStpServicePaymentApi";
|
|
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 StpServicePaymentApi implements IStpServicePaymentApi {
|
|
6
|
+
private httpRequest;
|
|
7
|
+
private readonly baseUrl;
|
|
8
|
+
constructor(httpRequest: IHttpRequest);
|
|
9
|
+
pay(request: ServicePaymentRequest): Promise<ApiGatewayResponse<any>>;
|
|
10
|
+
getTransaction(transactionNumber: string): Promise<ApiGatewayResponse<any>>;
|
|
11
|
+
getPaymentValidation(transactionNumber: string): Promise<ApiGatewayResponse<any>>;
|
|
12
|
+
getCatalog(params: GetCatalogParams): Promise<ApiGatewayResponse<any>>;
|
|
13
|
+
}
|
|
@@ -0,0 +1,46 @@
|
|
|
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 StpServicePaymentApi = class StpServicePaymentApi {
|
|
17
|
+
constructor(httpRequest) {
|
|
18
|
+
this.httpRequest = httpRequest;
|
|
19
|
+
this.baseUrl = process.env.STP_SERVICE_PAY_LAMBDA_URL || "";
|
|
20
|
+
}
|
|
21
|
+
async pay(request) {
|
|
22
|
+
const url = `${this.baseUrl}/pay`;
|
|
23
|
+
return await this.httpRequest.post(url, request);
|
|
24
|
+
}
|
|
25
|
+
async getTransaction(transactionNumber) {
|
|
26
|
+
const url = `${this.baseUrl}/transaction/${transactionNumber}`;
|
|
27
|
+
return await this.httpRequest.get(url);
|
|
28
|
+
}
|
|
29
|
+
async getPaymentValidation(transactionNumber) {
|
|
30
|
+
const url = `${this.baseUrl}/pay/validation/${transactionNumber}`;
|
|
31
|
+
return await this.httpRequest.get(url);
|
|
32
|
+
}
|
|
33
|
+
async getCatalog(params) {
|
|
34
|
+
let url = `${this.baseUrl}/catalog`;
|
|
35
|
+
if (params) {
|
|
36
|
+
url += `?${Object.keys(params).map(key => `${key}=${encodeURIComponent(params[key])}`).join('&')}`;
|
|
37
|
+
}
|
|
38
|
+
return await this.httpRequest.get(url);
|
|
39
|
+
}
|
|
40
|
+
};
|
|
41
|
+
StpServicePaymentApi = __decorate([
|
|
42
|
+
(0, inversify_1.injectable)(),
|
|
43
|
+
__param(0, (0, inversify_1.inject)("IHttpRequest")),
|
|
44
|
+
__metadata("design:paramtypes", [Object])
|
|
45
|
+
], StpServicePaymentApi);
|
|
46
|
+
exports.default = StpServicePaymentApi;
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import { GetCatalogParams, ServicePaymentRequest } from "@fiado/type-kit/bin/servicePayment";
|
|
2
|
+
import { ApiGatewayResponse } from "@fiado/gateway-adapter";
|
|
3
|
+
export interface IStpServicePaymentApi {
|
|
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
|
+
}
|
|
@@ -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/IStpServicePaymentApi"), exports);
|
|
18
|
+
__exportStar(require("./api/StpServicePaymentApi"), exports);
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@fiado/api-invoker",
|
|
3
|
-
"version": "1.0.
|
|
3
|
+
"version": "1.0.92",
|
|
4
4
|
"description": "Sirve como un puente entre diferentes funciones lambda, facilitando la comunicación entre ellas a traves 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.31",
|
|
17
17
|
"@fiado/http-client": "^1.0.2",
|
|
18
18
|
"@fiado/logger": "^1.0.2",
|
|
19
|
-
"@fiado/type-kit": "^1.1.
|
|
19
|
+
"@fiado/type-kit": "^1.1.90",
|
|
20
20
|
"dotenv": "^16.4.5",
|
|
21
21
|
"inversify": "^6.0.2",
|
|
22
22
|
"reflect-metadata": "^0.2.1",
|
|
@@ -53,4 +53,9 @@ export default class AccountFiadoIncApi implements IAccountFiadoIncApi {
|
|
|
53
53
|
const url = `${this.baseUrl}/p2p/send`;
|
|
54
54
|
return await this.httpRequest.post(url, request);
|
|
55
55
|
}
|
|
56
|
+
|
|
57
|
+
async deletePocket(pocketId: string): Promise<ApiGatewayResponse<void>> {
|
|
58
|
+
const url = `${this.baseUrl}pockets/${pocketId}`;
|
|
59
|
+
return await this.httpRequest.delete(url);
|
|
60
|
+
}
|
|
56
61
|
}
|
package/src/container.config.ts
CHANGED
|
@@ -32,6 +32,8 @@ import {IBankAccountApi} from "./bankAccount";
|
|
|
32
32
|
import BankAccountApi from "./bankAccount/BankAccountApi";
|
|
33
33
|
import {AccountBeneficiaryApi, IAccountBeneficiaryApi} from "./account-beneficiary";
|
|
34
34
|
import {IStpSpeiApi, StpSpeiApi} from "./stpSpei";
|
|
35
|
+
import StpServicePaymentApi from "./stpServicePayment/api/StpServicePaymentApi";
|
|
36
|
+
import {IStpServicePaymentApi} from "./stpServicePayment";
|
|
35
37
|
|
|
36
38
|
export const apiInvokerBindings = new ContainerModule((bind: interfaces.Bind) => {
|
|
37
39
|
bind<IDirectoryApi>("IDirectoryApi").to(DirectoryApi);
|
|
@@ -56,4 +58,5 @@ export const apiInvokerBindings = new ContainerModule((bind: interfaces.Bind) =>
|
|
|
56
58
|
bind<IBankAccountApi>("IBankAccountApi").to(BankAccountApi);
|
|
57
59
|
bind<IAccountBeneficiaryApi>("IAccountBeneficiaryApi").to(AccountBeneficiaryApi);
|
|
58
60
|
bind<IStpSpeiApi>("IStpSpeiApi").to(StpSpeiApi);
|
|
61
|
+
bind<IStpServicePaymentApi>("IStpServicePaymentApi").to(StpServicePaymentApi);
|
|
59
62
|
});
|
package/src/index.ts
CHANGED
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
import {IStpServicePaymentApi} from "./interfaces/IStpServicePaymentApi";
|
|
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 StpServicePaymentApi implements IStpServicePaymentApi {
|
|
9
|
+
private readonly baseUrl = process.env.STP_SERVICE_PAY_LAMBDA_URL || "";
|
|
10
|
+
|
|
11
|
+
constructor(@inject("IHttpRequest") private httpRequest: IHttpRequest) {
|
|
12
|
+
}
|
|
13
|
+
|
|
14
|
+
async pay(request: ServicePaymentRequest): Promise<ApiGatewayResponse<any>> {
|
|
15
|
+
const url = `${this.baseUrl}/pay`;
|
|
16
|
+
return await this.httpRequest.post(url, request);
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
async getTransaction(transactionNumber: string): Promise<ApiGatewayResponse<any>> {
|
|
20
|
+
const url = `${this.baseUrl}/transaction/${transactionNumber}`;
|
|
21
|
+
return await this.httpRequest.get(url);
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
async getPaymentValidation(transactionNumber: string): Promise<ApiGatewayResponse<any>> {
|
|
25
|
+
const url = `${this.baseUrl}/pay/validation/${transactionNumber}`;
|
|
26
|
+
return await this.httpRequest.get(url);
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
async getCatalog(params: GetCatalogParams): Promise<ApiGatewayResponse<any>> {
|
|
30
|
+
let url = `${this.baseUrl}/catalog`;
|
|
31
|
+
if (params) {
|
|
32
|
+
url += `?${Object.keys(params).map(key => `${key}=${encodeURIComponent(params[key])}`).join('&')}`;
|
|
33
|
+
}
|
|
34
|
+
return await this.httpRequest.get(url);
|
|
35
|
+
}
|
|
36
|
+
}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import {GetCatalogParams, ServicePaymentRequest} from "@fiado/type-kit/bin/servicePayment";
|
|
2
|
+
import {ApiGatewayResponse} from "@fiado/gateway-adapter";
|
|
3
|
+
|
|
4
|
+
export interface IStpServicePaymentApi {
|
|
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
|
+
}
|