@fiado/api-invoker 3.3.0 → 3.3.2
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/contract-business/api/ContractBusinessApi.d.ts +2 -0
- package/bin/contract-business/api/interfaces/IContractBusinessApi.d.ts +4 -0
- package/bin/credit-statements/api/CreditStatementsApi.d.ts +10 -0
- package/bin/credit-statements/api/CreditStatementsApi.js +38 -0
- package/bin/credit-statements/api/interfaces/ICreditStatementsApi.d.ts +26 -0
- package/bin/credit-statements/api/interfaces/ICreditStatementsApi.js +2 -0
- package/bin/credit-statements/index.d.ts +2 -0
- package/bin/credit-statements/index.js +18 -0
- package/bin/index.d.ts +1 -0
- package/bin/index.js +1 -0
- package/package.json +1 -1
- package/src/container.config.ts +3 -0
- package/src/contract-business/api/ContractBusinessApi.ts +2 -0
- package/src/contract-business/api/interfaces/IContractBusinessApi.ts +4 -0
- package/src/credit-statements/api/CreditStatementsApi.ts +25 -0
- package/src/credit-statements/api/interfaces/ICreditStatementsApi.ts +30 -0
- package/src/credit-statements/index.ts +2 -0
- package/src/index.ts +1 -0
package/bin/container.config.js
CHANGED
|
@@ -23,6 +23,7 @@ const card_1 = require("./card");
|
|
|
23
23
|
const transaction_1 = require("./transaction");
|
|
24
24
|
const contract_generator_1 = require("./contract-generator");
|
|
25
25
|
const ContractBusinessApi_1 = __importDefault(require("./contract-business/api/ContractBusinessApi"));
|
|
26
|
+
const CreditStatementsApi_1 = __importDefault(require("./credit-statements/api/CreditStatementsApi"));
|
|
26
27
|
const ProductCatalogApi_1 = __importDefault(require("./product-catalog/ProductCatalogApi"));
|
|
27
28
|
const collector_1 = require("./collector");
|
|
28
29
|
const P2pContactApi_1 = __importDefault(require("./p2pContact/api/P2pContactApi"));
|
|
@@ -118,6 +119,7 @@ exports.apiInvokerBindings = new inversify_1.ContainerModule((bind) => {
|
|
|
118
119
|
bind("ICardApi").to(card_1.CardApi);
|
|
119
120
|
bind("IContractGeneratorApi").to(contract_generator_1.ContractGeneratorApi);
|
|
120
121
|
bind("IContractBusinessApi").to(ContractBusinessApi_1.default);
|
|
122
|
+
bind("ICreditStatementsApi").to(CreditStatementsApi_1.default);
|
|
121
123
|
bind("ICollectorApi").to(collector_1.CollectorApi);
|
|
122
124
|
bind("IProductCatalogApi").to(ProductCatalogApi_1.default);
|
|
123
125
|
bind("IP2pContactApi").to(P2pContactApi_1.default);
|
|
@@ -6,5 +6,9 @@ export interface IContractBusinessApi {
|
|
|
6
6
|
folio: string;
|
|
7
7
|
sessionId: string;
|
|
8
8
|
metadata?: Record<string, unknown>;
|
|
9
|
+
/** Opcional: partnerId para resolver el template con path profundo en S3 */
|
|
10
|
+
partnerId?: string;
|
|
11
|
+
/** Opcional: category (ej: "credito") para el path profundo de template */
|
|
12
|
+
category?: string;
|
|
9
13
|
}): Promise<any>;
|
|
10
14
|
}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { IHttpRequest } from "@fiado/http-client";
|
|
2
|
+
import { ICreditStatementsApi } from "./interfaces/ICreditStatementsApi";
|
|
3
|
+
export default class CreditStatementsApi implements ICreditStatementsApi {
|
|
4
|
+
private httpRequest;
|
|
5
|
+
private readonly baseUrl;
|
|
6
|
+
constructor(httpRequest: IHttpRequest);
|
|
7
|
+
listByCredit(creditId: string, limit?: number): Promise<any>;
|
|
8
|
+
listByDirectory(directoryId: string, limit?: number): Promise<any>;
|
|
9
|
+
getDownloadUrl(statementId: string): Promise<any>;
|
|
10
|
+
}
|
|
@@ -0,0 +1,38 @@
|
|
|
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 CreditStatementsApi = class CreditStatementsApi {
|
|
17
|
+
constructor(httpRequest) {
|
|
18
|
+
this.httpRequest = httpRequest;
|
|
19
|
+
this.baseUrl = process.env.CREDIT_STATEMENTS_BUSINESS_LAMBDA_URL || "";
|
|
20
|
+
}
|
|
21
|
+
async listByCredit(creditId, limit) {
|
|
22
|
+
const qs = limit ? `?limit=${limit}` : "";
|
|
23
|
+
return await this.httpRequest.get(`${this.baseUrl}private/credits/${creditId}/statements${qs}`);
|
|
24
|
+
}
|
|
25
|
+
async listByDirectory(directoryId, limit) {
|
|
26
|
+
const qs = limit ? `?limit=${limit}` : "";
|
|
27
|
+
return await this.httpRequest.get(`${this.baseUrl}private/directories/${directoryId}/statements${qs}`);
|
|
28
|
+
}
|
|
29
|
+
async getDownloadUrl(statementId) {
|
|
30
|
+
return await this.httpRequest.get(`${this.baseUrl}private/statements/${statementId}/download`);
|
|
31
|
+
}
|
|
32
|
+
};
|
|
33
|
+
CreditStatementsApi = __decorate([
|
|
34
|
+
(0, inversify_1.injectable)(),
|
|
35
|
+
__param(0, (0, inversify_1.inject)("IHttpRequest")),
|
|
36
|
+
__metadata("design:paramtypes", [Object])
|
|
37
|
+
], CreditStatementsApi);
|
|
38
|
+
exports.default = CreditStatementsApi;
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
export interface ICreditStatementListItem {
|
|
2
|
+
statementId: string;
|
|
3
|
+
period: string;
|
|
4
|
+
periodYear: number;
|
|
5
|
+
periodMonth: number;
|
|
6
|
+
status: string;
|
|
7
|
+
generatedAt: string | null;
|
|
8
|
+
}
|
|
9
|
+
export interface ICreditStatementDownload {
|
|
10
|
+
url: string;
|
|
11
|
+
expiresAt: string;
|
|
12
|
+
}
|
|
13
|
+
export interface ICreditStatementsApi {
|
|
14
|
+
/**
|
|
15
|
+
* Lista los estados de cuenta de un crédito (más recientes primero).
|
|
16
|
+
*/
|
|
17
|
+
listByCredit(creditId: string, limit?: number): Promise<any>;
|
|
18
|
+
/**
|
|
19
|
+
* Lista los estados de cuenta de un usuario (todos los créditos del directorio).
|
|
20
|
+
*/
|
|
21
|
+
listByDirectory(directoryId: string, limit?: number): Promise<any>;
|
|
22
|
+
/**
|
|
23
|
+
* Obtiene una URL pre-firmada (15 min) para descargar el PDF del statement.
|
|
24
|
+
*/
|
|
25
|
+
getDownloadUrl(statementId: string): Promise<any>;
|
|
26
|
+
}
|
|
@@ -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/CreditStatementsApi"), exports);
|
|
18
|
+
__exportStar(require("./api/interfaces/ICreditStatementsApi"), exports);
|
package/bin/index.d.ts
CHANGED
|
@@ -16,6 +16,7 @@ export * from "./authentication";
|
|
|
16
16
|
export * from "./transaction";
|
|
17
17
|
export * from "./contract-generator";
|
|
18
18
|
export * from "./contract-business";
|
|
19
|
+
export * from "./credit-statements";
|
|
19
20
|
export * from "./product-catalog";
|
|
20
21
|
export * from "./collector";
|
|
21
22
|
export * from "./p2pContact";
|
package/bin/index.js
CHANGED
|
@@ -32,6 +32,7 @@ __exportStar(require("./authentication"), exports);
|
|
|
32
32
|
__exportStar(require("./transaction"), exports);
|
|
33
33
|
__exportStar(require("./contract-generator"), exports);
|
|
34
34
|
__exportStar(require("./contract-business"), exports);
|
|
35
|
+
__exportStar(require("./credit-statements"), exports);
|
|
35
36
|
__exportStar(require("./product-catalog"), exports);
|
|
36
37
|
__exportStar(require("./collector"), exports);
|
|
37
38
|
__exportStar(require("./p2pContact"), exports);
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@fiado/api-invoker",
|
|
3
|
-
"version": "3.3.
|
|
3
|
+
"version": "3.3.2",
|
|
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",
|
package/src/container.config.ts
CHANGED
|
@@ -25,6 +25,8 @@ import { ITransactionApi, ITransactionPublisher, TransactionPublisher } from "./
|
|
|
25
25
|
import { ContractGeneratorApi, IContractGeneratorApi } from "./contract-generator";
|
|
26
26
|
import { IContractBusinessApi } from "./contract-business";
|
|
27
27
|
import ContractBusinessApi from "./contract-business/api/ContractBusinessApi";
|
|
28
|
+
import { ICreditStatementsApi } from "./credit-statements";
|
|
29
|
+
import CreditStatementsApi from "./credit-statements/api/CreditStatementsApi";
|
|
28
30
|
import { IProductCatalogApi } from "./product-catalog";
|
|
29
31
|
import ProductCatalogApi from "./product-catalog/ProductCatalogApi";
|
|
30
32
|
import { CollectorApi, ICollectorApi } from "./collector";
|
|
@@ -164,6 +166,7 @@ export const apiInvokerBindings = new ContainerModule((bind: interfaces.Bind) =>
|
|
|
164
166
|
bind<ICardApi>("ICardApi").to(CardApi);
|
|
165
167
|
bind<IContractGeneratorApi>("IContractGeneratorApi").to(ContractGeneratorApi);
|
|
166
168
|
bind<IContractBusinessApi>("IContractBusinessApi").to(ContractBusinessApi);
|
|
169
|
+
bind<ICreditStatementsApi>("ICreditStatementsApi").to(CreditStatementsApi);
|
|
167
170
|
bind<ICollectorApi>("ICollectorApi").to(CollectorApi);
|
|
168
171
|
bind<IProductCatalogApi>("IProductCatalogApi").to(ProductCatalogApi);
|
|
169
172
|
bind<IP2pContactApi>("IP2pContactApi").to(P2pContactApi);
|
|
@@ -17,6 +17,8 @@ export default class ContractBusinessApi implements IContractBusinessApi {
|
|
|
17
17
|
folio: string;
|
|
18
18
|
sessionId: string;
|
|
19
19
|
metadata?: Record<string, unknown>;
|
|
20
|
+
partnerId?: string;
|
|
21
|
+
category?: string;
|
|
20
22
|
}): Promise<any> {
|
|
21
23
|
const { documentType, ...body } = params;
|
|
22
24
|
return await this.httpRequest.post(`${this.baseUrl}/sign/${documentType}`, body);
|
|
@@ -6,5 +6,9 @@ export interface IContractBusinessApi {
|
|
|
6
6
|
folio: string;
|
|
7
7
|
sessionId: string;
|
|
8
8
|
metadata?: Record<string, unknown>;
|
|
9
|
+
/** Opcional: partnerId para resolver el template con path profundo en S3 */
|
|
10
|
+
partnerId?: string;
|
|
11
|
+
/** Opcional: category (ej: "credito") para el path profundo de template */
|
|
12
|
+
category?: string;
|
|
9
13
|
}): Promise<any>;
|
|
10
14
|
}
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
import { inject, injectable } from "inversify";
|
|
2
|
+
import { IHttpRequest } from "@fiado/http-client";
|
|
3
|
+
import { ICreditStatementsApi } from "./interfaces/ICreditStatementsApi";
|
|
4
|
+
|
|
5
|
+
@injectable()
|
|
6
|
+
export default class CreditStatementsApi implements ICreditStatementsApi {
|
|
7
|
+
|
|
8
|
+
private readonly baseUrl = process.env.CREDIT_STATEMENTS_BUSINESS_LAMBDA_URL || "";
|
|
9
|
+
|
|
10
|
+
constructor(@inject("IHttpRequest") private httpRequest: IHttpRequest) {}
|
|
11
|
+
|
|
12
|
+
async listByCredit(creditId: string, limit?: number): Promise<any> {
|
|
13
|
+
const qs = limit ? `?limit=${limit}` : "";
|
|
14
|
+
return await this.httpRequest.get(`${this.baseUrl}private/credits/${creditId}/statements${qs}`);
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
async listByDirectory(directoryId: string, limit?: number): Promise<any> {
|
|
18
|
+
const qs = limit ? `?limit=${limit}` : "";
|
|
19
|
+
return await this.httpRequest.get(`${this.baseUrl}private/directories/${directoryId}/statements${qs}`);
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
async getDownloadUrl(statementId: string): Promise<any> {
|
|
23
|
+
return await this.httpRequest.get(`${this.baseUrl}private/statements/${statementId}/download`);
|
|
24
|
+
}
|
|
25
|
+
}
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
export interface ICreditStatementListItem {
|
|
2
|
+
statementId: string;
|
|
3
|
+
period: string;
|
|
4
|
+
periodYear: number;
|
|
5
|
+
periodMonth: number;
|
|
6
|
+
status: string;
|
|
7
|
+
generatedAt: string | null;
|
|
8
|
+
}
|
|
9
|
+
|
|
10
|
+
export interface ICreditStatementDownload {
|
|
11
|
+
url: string;
|
|
12
|
+
expiresAt: string;
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
export interface ICreditStatementsApi {
|
|
16
|
+
/**
|
|
17
|
+
* Lista los estados de cuenta de un crédito (más recientes primero).
|
|
18
|
+
*/
|
|
19
|
+
listByCredit(creditId: string, limit?: number): Promise<any>;
|
|
20
|
+
|
|
21
|
+
/**
|
|
22
|
+
* Lista los estados de cuenta de un usuario (todos los créditos del directorio).
|
|
23
|
+
*/
|
|
24
|
+
listByDirectory(directoryId: string, limit?: number): Promise<any>;
|
|
25
|
+
|
|
26
|
+
/**
|
|
27
|
+
* Obtiene una URL pre-firmada (15 min) para descargar el PDF del statement.
|
|
28
|
+
*/
|
|
29
|
+
getDownloadUrl(statementId: string): Promise<any>;
|
|
30
|
+
}
|
package/src/index.ts
CHANGED
|
@@ -16,6 +16,7 @@ export * from "./authentication";
|
|
|
16
16
|
export * from "./transaction";
|
|
17
17
|
export * from "./contract-generator";
|
|
18
18
|
export * from "./contract-business";
|
|
19
|
+
export * from "./credit-statements";
|
|
19
20
|
export * from "./product-catalog";
|
|
20
21
|
export * from "./collector";
|
|
21
22
|
export * from "./p2pContact";
|