@fiado/api-invoker 5.151.0 → 5.153.0
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/README.md +1 -0
- package/bin/container.config.js +5 -0
- package/bin/gsf-connector/index.d.ts +2 -0
- package/bin/gsf-connector/index.js +2 -0
- package/bin/gsf-connector/queue/GsfSyncPublisher.d.ts +6 -0
- package/bin/gsf-connector/queue/GsfSyncPublisher.js +36 -0
- package/bin/gsf-connector/queue/interfaces/IGsfSyncPublisher.d.ts +9 -0
- package/bin/gsf-connector/queue/interfaces/IGsfSyncPublisher.js +1 -0
- package/bin/index.d.ts +1 -0
- package/bin/index.js +1 -0
- package/bin/loanCredit/api/LoanCreditBusinessApi.d.ts +3 -1
- package/bin/loanCredit/api/LoanCreditBusinessApi.js +7 -0
- package/bin/loanCredit/api/interfaces/ILoanCreditBusinessApi.d.ts +5 -1
- package/package.json +2 -2
- package/src/container.config.ts +6 -0
- package/src/gsf-connector/index.ts +2 -0
- package/src/gsf-connector/queue/GsfSyncPublisher.ts +30 -0
- package/src/gsf-connector/queue/interfaces/IGsfSyncPublisher.ts +10 -0
- package/src/index.ts +1 -0
- package/src/loanCredit/api/LoanCreditBusinessApi.ts +25 -0
- package/src/loanCredit/api/interfaces/ILoanCreditBusinessApi.ts +20 -0
package/README.md
CHANGED
|
@@ -266,6 +266,7 @@ Para comunicación asíncrona, la librería provee publishers que envían mensaj
|
|
|
266
266
|
| `ITransactionPublisher` | Eventos de transacción | `TRANSACTION_QUEUE` |
|
|
267
267
|
| `IActivityPublisher` | Eventos de actividad | `ACTIVITY_QUEUE` |
|
|
268
268
|
| `ITransactionAlarmPublisher` | Alarmas de transacción | `TRANSACTION_ALARM_QUEUE` |
|
|
269
|
+
| `IGsfSyncPublisher` | Alta del crédito y pagos hacia GSF (`GsfSyncQueue.fifo`) | `GSF_SYNC_QUEUE_URL` |
|
|
269
270
|
| `IPublisher` | Publisher genérico | Configurable |
|
|
270
271
|
|
|
271
272
|
### Ejemplo de Publisher
|
package/bin/container.config.js
CHANGED
|
@@ -153,6 +153,8 @@ import { RewardsEligibilityPublisher, RewardsEligibilityBusinessApi } from "./re
|
|
|
153
153
|
import { RulesApi } from "./rules-business/index.js";
|
|
154
154
|
import CollectionEngineApi from "./collection-engine/api/CollectionEngineApi.js";
|
|
155
155
|
import DomainCallbackApi from "./domain-callback/api/DomainCallbackApi.js";
|
|
156
|
+
// GSF connector — publisher de la cola FIFO de sincronización de créditos y pagos
|
|
157
|
+
import { GsfSyncPublisher } from "./gsf-connector/index.js";
|
|
156
158
|
export const apiInvokerBindings = new ContainerModule(({ bind }) => {
|
|
157
159
|
// UTILS bindings
|
|
158
160
|
bind("InvokerUtils").to(InvokerUtils);
|
|
@@ -329,4 +331,7 @@ export const apiInvokerBindings = new ContainerModule(({ bind }) => {
|
|
|
329
331
|
bind("ICollectionEngineApi").to(CollectionEngineApi);
|
|
330
332
|
// Domain callback — el motor notifica al dominio dueño del cargo (applyCollectionResult)
|
|
331
333
|
bind("IDomainCallbackApi").to(DomainCallbackApi);
|
|
334
|
+
// GSF connector — alta del crédito y pagos hacia GsfSyncQueue.fifo.
|
|
335
|
+
// El productor necesita GSF_SYNC_QUEUE_URL y sqs:SendMessage sobre la cola.
|
|
336
|
+
bind("IGsfSyncPublisher").to(GsfSyncPublisher);
|
|
332
337
|
});
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import type { GsfCreateCreditMessage, GsfPaymentMessage } from "@fiado/type-kit/bin/gsfConnector/index.js";
|
|
2
|
+
import { IGsfSyncPublisher } from "./interfaces/IGsfSyncPublisher.js";
|
|
3
|
+
export declare class GsfSyncPublisher implements IGsfSyncPublisher {
|
|
4
|
+
private readonly GSF_SYNC_QUEUE_URL;
|
|
5
|
+
publish(message: GsfCreateCreditMessage | GsfPaymentMessage): Promise<void>;
|
|
6
|
+
}
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
|
|
2
|
+
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
3
|
+
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
|
4
|
+
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;
|
|
5
|
+
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
6
|
+
};
|
|
7
|
+
import { SendMessageCommand, SQSClient } from "@aws-sdk/client-sqs";
|
|
8
|
+
import { injectable } from "inversify";
|
|
9
|
+
let GsfSyncPublisher = class GsfSyncPublisher {
|
|
10
|
+
GSF_SYNC_QUEUE_URL = process.env.GSF_SYNC_QUEUE_URL;
|
|
11
|
+
async publish(message) {
|
|
12
|
+
if (!this.GSF_SYNC_QUEUE_URL) {
|
|
13
|
+
throw new Error("Error publishing message to GsfSyncQueue.fifo: GSF_SYNC_QUEUE_URL no está configurada");
|
|
14
|
+
}
|
|
15
|
+
try {
|
|
16
|
+
const client = new SQSClient();
|
|
17
|
+
// FIFO: un grupo por crédito para que los pagos lleguen después de su alta.
|
|
18
|
+
const sendMessageRequest = {
|
|
19
|
+
QueueUrl: this.GSF_SYNC_QUEUE_URL,
|
|
20
|
+
MessageBody: JSON.stringify(message),
|
|
21
|
+
MessageGroupId: message.externalCreditId,
|
|
22
|
+
MessageDeduplicationId: message.messageId,
|
|
23
|
+
};
|
|
24
|
+
await client.send(new SendMessageCommand(sendMessageRequest));
|
|
25
|
+
}
|
|
26
|
+
catch (error) {
|
|
27
|
+
// El cuerpo lleva datos personales: el error solo nombra la cola y el motivo.
|
|
28
|
+
const errorMessage = error instanceof Error ? error.message : String(error);
|
|
29
|
+
throw new Error(`Error publishing message to GsfSyncQueue.fifo: ${errorMessage}`);
|
|
30
|
+
}
|
|
31
|
+
}
|
|
32
|
+
};
|
|
33
|
+
GsfSyncPublisher = __decorate([
|
|
34
|
+
injectable()
|
|
35
|
+
], GsfSyncPublisher);
|
|
36
|
+
export { GsfSyncPublisher };
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import type { GsfCreateCreditMessage, GsfPaymentMessage } from "@fiado/type-kit/bin/gsfConnector/index.js";
|
|
2
|
+
/**
|
|
3
|
+
* Publisher hacia `GsfSyncQueue.fifo`, que consume `gsf-connector`: alta del crédito y sus pagos.
|
|
4
|
+
* El productor necesita la env var `GSF_SYNC_QUEUE_URL` (export `GsfSyncQueueUrl`) y `sqs:SendMessage`
|
|
5
|
+
* sobre la cola (export `GsfSyncQueueArn`).
|
|
6
|
+
*/
|
|
7
|
+
export interface IGsfSyncPublisher {
|
|
8
|
+
publish(message: GsfCreateCreditMessage | GsfPaymentMessage): Promise<void>;
|
|
9
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
package/bin/index.d.ts
CHANGED
package/bin/index.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import type { IHttpRequest } from "@fiado/http-client";
|
|
2
2
|
import { StandardResponse } from "@fiado/gateway-adapter";
|
|
3
|
-
import { ActivationCheckRequest, ActivationCheckResponse, CancelLoanCreditRequest, CreditPaymentAppliedRequest, CreditPaymentAppliedResponse, CreditSettledRequest, CreditSettledResponse, LoanBorrowerResponse, ListMessagingCandidatesRequest, ListMessagingCandidatesResponse, LoanCreditResponse, OriginateLoanCreditRequest, OriginateLoanCreditResponse, QuoteLoanCreditRequest, QuoteLoanCreditResponse, SignLoanCreditRequest, SignLoanCreditResponse, PreviewLoanContractRequest, LoanContractPreview, UpdateLoanBorrowerSciRequest, UpsertLoanBorrowerRequest, LoanBorrowerCreditItem, LoanContractDownloadUrl, LoanContractResponse, LoanCreditDetail, LoanInstallmentResponse, LoanPaymentListResponse, CreateCustomerPaymentRequest, LoanCustomerPaymentOptions, LoanCustomerPaymentResult } from "@fiado/type-kit/bin/loanCredit/index.js";
|
|
3
|
+
import { ActivationCheckRequest, ActivationCheckResponse, CancelLoanCreditRequest, CreditPaymentAppliedRequest, CreditPaymentAppliedResponse, CreditSettledRequest, CreditSettledResponse, LoanBorrowerResponse, ListMessagingCandidatesRequest, ListMessagingCandidatesResponse, LoanCreditResponse, OriginateLoanCreditRequest, OriginateLoanCreditResponse, QuoteLoanCreditRequest, QuoteLoanCreditResponse, SignLoanCreditRequest, SignLoanCreditResponse, PreviewLoanContractRequest, LoanContractPreview, UpdateLoanBorrowerSciRequest, UpsertLoanBorrowerRequest, LoanBorrowerCreditItem, LoanContractDownloadUrl, LoanContractResponse, ContractTypeEnum, LoanCustomerCreditDocument, LoanCustomerCreditDocumentUrl, LoanCreditDetail, LoanInstallmentResponse, LoanPaymentListResponse, CreateCustomerPaymentRequest, LoanCustomerPaymentOptions, LoanCustomerPaymentResult } from "@fiado/type-kit/bin/loanCredit/index.js";
|
|
4
4
|
import { CreditSummariesBatchRequest, CreditSummariesBatchResponse } from "./dtos/CreditSummariesBatch.js";
|
|
5
5
|
import { LoanCreditAnalyticsBatchRequest, LoanCreditAnalyticsBatchResponse } from "./dtos/LoanCreditAnalyticsBatch.js";
|
|
6
6
|
import type { GetCreditOptions } from "./dtos/GetCreditOptions.js";
|
|
@@ -51,6 +51,8 @@ export default class LoanCreditBusinessApi implements ILoanCreditBusinessApi {
|
|
|
51
51
|
}): Promise<StandardResponse<LoanPaymentListResponse>>;
|
|
52
52
|
listCustomerCreditContracts(directoryId: string, creditId: string, tenantId: string): Promise<StandardResponse<LoanContractResponse[]>>;
|
|
53
53
|
getCustomerCreditContractUrl(directoryId: string, creditId: string, contractId: string, tenantId: string): Promise<StandardResponse<LoanContractDownloadUrl>>;
|
|
54
|
+
listCustomerCreditDocuments(directoryId: string, creditId: string, type: ContractTypeEnum, tenantId: string): Promise<StandardResponse<LoanCustomerCreditDocument[]>>;
|
|
55
|
+
getCustomerCreditDocumentUrl(directoryId: string, creditId: string, documentType: ContractTypeEnum, documentKey: string, tenantId: string): Promise<StandardResponse<LoanCustomerCreditDocumentUrl>>;
|
|
54
56
|
getCustomerPaymentOptions(directoryId: string, creditId: string, tenantId: string): Promise<StandardResponse<LoanCustomerPaymentOptions>>;
|
|
55
57
|
createCustomerPayment(directoryId: string, creditId: string, tenantId: string, body: CreateCustomerPaymentRequest): Promise<StandardResponse<LoanCustomerPaymentResult>>;
|
|
56
58
|
}
|
|
@@ -136,6 +136,13 @@ let LoanCreditBusinessApi = class LoanCreditBusinessApi {
|
|
|
136
136
|
async getCustomerCreditContractUrl(directoryId, creditId, contractId, tenantId) {
|
|
137
137
|
return await this.httpRequest.get(`${this.customerCreditsUrl(directoryId, creditId)}/contracts/${encodeURIComponent(contractId)}/url?tenantId=${encodeURIComponent(tenantId)}`);
|
|
138
138
|
}
|
|
139
|
+
async listCustomerCreditDocuments(directoryId, creditId, type, tenantId) {
|
|
140
|
+
const query = new URLSearchParams({ tenantId, type });
|
|
141
|
+
return await this.httpRequest.get(`${this.customerCreditsUrl(directoryId, creditId)}/documents?${query.toString()}`);
|
|
142
|
+
}
|
|
143
|
+
async getCustomerCreditDocumentUrl(directoryId, creditId, documentType, documentKey, tenantId) {
|
|
144
|
+
return await this.httpRequest.get(`${this.customerCreditsUrl(directoryId, creditId)}/documents/${encodeURIComponent(documentType)}/${encodeURIComponent(documentKey)}/url?tenantId=${encodeURIComponent(tenantId)}`);
|
|
145
|
+
}
|
|
139
146
|
// ─── Pagos de cliente (retail-loan-business) ────────────────────────────────
|
|
140
147
|
async getCustomerPaymentOptions(directoryId, creditId, tenantId) {
|
|
141
148
|
return await this.httpRequest.get(`${this.customerCreditsUrl(directoryId, creditId)}/payment-options?tenantId=${encodeURIComponent(tenantId)}`);
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { StandardResponse } from "@fiado/gateway-adapter";
|
|
2
|
-
import { ActivationCheckRequest, CreditPaymentAppliedRequest, CreditPaymentAppliedResponse, CreditSettledRequest, CreditSettledResponse, ActivationCheckResponse, CancelLoanCreditRequest, LoanBorrowerResponse, ListMessagingCandidatesRequest, ListMessagingCandidatesResponse, LoanCreditResponse, OriginateLoanCreditRequest, OriginateLoanCreditResponse, QuoteLoanCreditRequest, QuoteLoanCreditResponse, SignLoanCreditRequest, PreviewLoanContractRequest, LoanContractPreview, SignLoanCreditResponse, UpdateLoanBorrowerSciRequest, UpsertLoanBorrowerRequest, LoanBorrowerCreditItem, LoanContractDownloadUrl, LoanContractResponse, LoanCreditDetail, LoanInstallmentResponse, LoanPaymentListResponse, CreateCustomerPaymentRequest, LoanCustomerPaymentOptions, LoanCustomerPaymentResult } from "@fiado/type-kit/bin/loanCredit/index.js";
|
|
2
|
+
import { ActivationCheckRequest, CreditPaymentAppliedRequest, CreditPaymentAppliedResponse, CreditSettledRequest, CreditSettledResponse, ActivationCheckResponse, CancelLoanCreditRequest, LoanBorrowerResponse, ListMessagingCandidatesRequest, ListMessagingCandidatesResponse, LoanCreditResponse, OriginateLoanCreditRequest, OriginateLoanCreditResponse, QuoteLoanCreditRequest, QuoteLoanCreditResponse, SignLoanCreditRequest, PreviewLoanContractRequest, LoanContractPreview, SignLoanCreditResponse, UpdateLoanBorrowerSciRequest, UpsertLoanBorrowerRequest, LoanBorrowerCreditItem, LoanContractDownloadUrl, LoanContractResponse, ContractTypeEnum, LoanCustomerCreditDocument, LoanCustomerCreditDocumentUrl, LoanCreditDetail, LoanInstallmentResponse, LoanPaymentListResponse, CreateCustomerPaymentRequest, LoanCustomerPaymentOptions, LoanCustomerPaymentResult } from "@fiado/type-kit/bin/loanCredit/index.js";
|
|
3
3
|
import { CreditSummariesBatchRequest, CreditSummariesBatchResponse } from "../dtos/CreditSummariesBatch.js";
|
|
4
4
|
import { LoanCreditAnalyticsBatchRequest, LoanCreditAnalyticsBatchResponse } from "../dtos/LoanCreditAnalyticsBatch.js";
|
|
5
5
|
import type { GetCreditOptions } from "../dtos/GetCreditOptions.js";
|
|
@@ -156,6 +156,10 @@ export interface ILoanCreditBusinessApi {
|
|
|
156
156
|
listCustomerCreditContracts(directoryId: string, creditId: string, tenantId: string): Promise<StandardResponse<LoanContractResponse[]>>;
|
|
157
157
|
/** URL prefirmada del PDF de un contrato. 404 CONTRACT_NOT_FOUND · 409 CONTRACT_PDF_NOT_READY. */
|
|
158
158
|
getCustomerCreditContractUrl(directoryId: string, creditId: string, contractId: string, tenantId: string): Promise<StandardResponse<LoanContractDownloadUrl>>;
|
|
159
|
+
/** Documentos de un tipo del ciclo de vida del crédito (comprobantes, estados de cuenta), el más reciente primero. */
|
|
160
|
+
listCustomerCreditDocuments(directoryId: string, creditId: string, type: ContractTypeEnum, tenantId: string): Promise<StandardResponse<LoanCustomerCreditDocument[]>>;
|
|
161
|
+
/** URL prefirmada del PDF de un documento del ciclo de vida. 404 CREDIT_DOCUMENT_NOT_FOUND si no existe o no tiene PDF. */
|
|
162
|
+
getCustomerCreditDocumentUrl(directoryId: string, creditId: string, documentType: ContractTypeEnum, documentKey: string, tenantId: string): Promise<StandardResponse<LoanCustomerCreditDocumentUrl>>;
|
|
159
163
|
/** Opciones de pago de un crédito del cliente, con montos ya calculados. */
|
|
160
164
|
getCustomerPaymentOptions(directoryId: string, creditId: string, tenantId: string): Promise<StandardResponse<LoanCustomerPaymentOptions>>;
|
|
161
165
|
/**
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@fiado/api-invoker",
|
|
3
|
-
"version": "5.
|
|
3
|
+
"version": "5.153.0",
|
|
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
|
"type": "module",
|
|
6
6
|
"main": "bin/index.js",
|
|
@@ -34,7 +34,7 @@
|
|
|
34
34
|
"@fiado/gateway-adapter": "^3.14.0",
|
|
35
35
|
"@fiado/http-client": "^2.0.1",
|
|
36
36
|
"@fiado/logger": "^1.1.3",
|
|
37
|
-
"@fiado/type-kit": "^3.
|
|
37
|
+
"@fiado/type-kit": "^3.612.0",
|
|
38
38
|
"dotenv": "^16.4.7"
|
|
39
39
|
},
|
|
40
40
|
"peerDependencies": {
|
package/src/container.config.ts
CHANGED
|
@@ -226,6 +226,8 @@ import CollectionEngineApi from "./collection-engine/api/CollectionEngineApi.js"
|
|
|
226
226
|
// consumidor el resultado de un cobro (applyCollectionResult); baseUrl viaja por llamada
|
|
227
227
|
import { IDomainCallbackApi } from "./domain-callback/index.js";
|
|
228
228
|
import DomainCallbackApi from "./domain-callback/api/DomainCallbackApi.js";
|
|
229
|
+
// GSF connector — publisher de la cola FIFO de sincronización de créditos y pagos
|
|
230
|
+
import { IGsfSyncPublisher, GsfSyncPublisher } from "./gsf-connector/index.js";
|
|
229
231
|
|
|
230
232
|
export const apiInvokerBindings = new ContainerModule(({ bind }) => {
|
|
231
233
|
// UTILS bindings
|
|
@@ -432,4 +434,8 @@ export const apiInvokerBindings = new ContainerModule(({ bind }) => {
|
|
|
432
434
|
|
|
433
435
|
// Domain callback — el motor notifica al dominio dueño del cargo (applyCollectionResult)
|
|
434
436
|
bind<IDomainCallbackApi>("IDomainCallbackApi").to(DomainCallbackApi);
|
|
437
|
+
|
|
438
|
+
// GSF connector — alta del crédito y pagos hacia GsfSyncQueue.fifo.
|
|
439
|
+
// El productor necesita GSF_SYNC_QUEUE_URL y sqs:SendMessage sobre la cola.
|
|
440
|
+
bind<IGsfSyncPublisher>("IGsfSyncPublisher").to(GsfSyncPublisher);
|
|
435
441
|
});
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
import { SendMessageCommand, SendMessageRequest, SQSClient } from "@aws-sdk/client-sqs";
|
|
2
|
+
import { injectable } from "inversify";
|
|
3
|
+
import type { GsfCreateCreditMessage, GsfPaymentMessage } from "@fiado/type-kit/bin/gsfConnector/index.js";
|
|
4
|
+
import { IGsfSyncPublisher } from "./interfaces/IGsfSyncPublisher.js";
|
|
5
|
+
|
|
6
|
+
@injectable()
|
|
7
|
+
export class GsfSyncPublisher implements IGsfSyncPublisher {
|
|
8
|
+
private readonly GSF_SYNC_QUEUE_URL = process.env.GSF_SYNC_QUEUE_URL;
|
|
9
|
+
|
|
10
|
+
async publish(message: GsfCreateCreditMessage | GsfPaymentMessage): Promise<void> {
|
|
11
|
+
if (!this.GSF_SYNC_QUEUE_URL) {
|
|
12
|
+
throw new Error("Error publishing message to GsfSyncQueue.fifo: GSF_SYNC_QUEUE_URL no está configurada");
|
|
13
|
+
}
|
|
14
|
+
try {
|
|
15
|
+
const client: SQSClient = new SQSClient();
|
|
16
|
+
// FIFO: un grupo por crédito para que los pagos lleguen después de su alta.
|
|
17
|
+
const sendMessageRequest: SendMessageRequest = {
|
|
18
|
+
QueueUrl: this.GSF_SYNC_QUEUE_URL,
|
|
19
|
+
MessageBody: JSON.stringify(message),
|
|
20
|
+
MessageGroupId: message.externalCreditId,
|
|
21
|
+
MessageDeduplicationId: message.messageId,
|
|
22
|
+
};
|
|
23
|
+
await client.send(new SendMessageCommand(sendMessageRequest));
|
|
24
|
+
} catch (error) {
|
|
25
|
+
// El cuerpo lleva datos personales: el error solo nombra la cola y el motivo.
|
|
26
|
+
const errorMessage = error instanceof Error ? error.message : String(error);
|
|
27
|
+
throw new Error(`Error publishing message to GsfSyncQueue.fifo: ${errorMessage}`);
|
|
28
|
+
}
|
|
29
|
+
}
|
|
30
|
+
}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import type { GsfCreateCreditMessage, GsfPaymentMessage } from "@fiado/type-kit/bin/gsfConnector/index.js";
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* Publisher hacia `GsfSyncQueue.fifo`, que consume `gsf-connector`: alta del crédito y sus pagos.
|
|
5
|
+
* El productor necesita la env var `GSF_SYNC_QUEUE_URL` (export `GsfSyncQueueUrl`) y `sqs:SendMessage`
|
|
6
|
+
* sobre la cola (export `GsfSyncQueueArn`).
|
|
7
|
+
*/
|
|
8
|
+
export interface IGsfSyncPublisher {
|
|
9
|
+
publish(message: GsfCreateCreditMessage | GsfPaymentMessage): Promise<void>;
|
|
10
|
+
}
|
package/src/index.ts
CHANGED
|
@@ -26,6 +26,9 @@ import {
|
|
|
26
26
|
LoanBorrowerCreditItem,
|
|
27
27
|
LoanContractDownloadUrl,
|
|
28
28
|
LoanContractResponse,
|
|
29
|
+
ContractTypeEnum,
|
|
30
|
+
LoanCustomerCreditDocument,
|
|
31
|
+
LoanCustomerCreditDocumentUrl,
|
|
29
32
|
LoanCreditDetail,
|
|
30
33
|
LoanInstallmentResponse,
|
|
31
34
|
LoanPaymentListResponse,
|
|
@@ -294,6 +297,28 @@ export default class LoanCreditBusinessApi implements ILoanCreditBusinessApi {
|
|
|
294
297
|
);
|
|
295
298
|
}
|
|
296
299
|
|
|
300
|
+
async listCustomerCreditDocuments(
|
|
301
|
+
directoryId: string,
|
|
302
|
+
creditId: string,
|
|
303
|
+
type: ContractTypeEnum,
|
|
304
|
+
tenantId: string,
|
|
305
|
+
): Promise<StandardResponse<LoanCustomerCreditDocument[]>> {
|
|
306
|
+
const query = new URLSearchParams({ tenantId, type });
|
|
307
|
+
return await this.httpRequest.get(`${this.customerCreditsUrl(directoryId, creditId)}/documents?${query.toString()}`);
|
|
308
|
+
}
|
|
309
|
+
|
|
310
|
+
async getCustomerCreditDocumentUrl(
|
|
311
|
+
directoryId: string,
|
|
312
|
+
creditId: string,
|
|
313
|
+
documentType: ContractTypeEnum,
|
|
314
|
+
documentKey: string,
|
|
315
|
+
tenantId: string,
|
|
316
|
+
): Promise<StandardResponse<LoanCustomerCreditDocumentUrl>> {
|
|
317
|
+
return await this.httpRequest.get(
|
|
318
|
+
`${this.customerCreditsUrl(directoryId, creditId)}/documents/${encodeURIComponent(documentType)}/${encodeURIComponent(documentKey)}/url?tenantId=${encodeURIComponent(tenantId)}`,
|
|
319
|
+
);
|
|
320
|
+
}
|
|
321
|
+
|
|
297
322
|
// ─── Pagos de cliente (retail-loan-business) ────────────────────────────────
|
|
298
323
|
|
|
299
324
|
async getCustomerPaymentOptions(
|
|
@@ -24,6 +24,9 @@ import {
|
|
|
24
24
|
LoanBorrowerCreditItem,
|
|
25
25
|
LoanContractDownloadUrl,
|
|
26
26
|
LoanContractResponse,
|
|
27
|
+
ContractTypeEnum,
|
|
28
|
+
LoanCustomerCreditDocument,
|
|
29
|
+
LoanCustomerCreditDocumentUrl,
|
|
27
30
|
LoanCreditDetail,
|
|
28
31
|
LoanInstallmentResponse,
|
|
29
32
|
LoanPaymentListResponse,
|
|
@@ -311,6 +314,23 @@ export interface ILoanCreditBusinessApi {
|
|
|
311
314
|
tenantId: string,
|
|
312
315
|
): Promise<StandardResponse<LoanContractDownloadUrl>>;
|
|
313
316
|
|
|
317
|
+
/** Documentos de un tipo del ciclo de vida del crédito (comprobantes, estados de cuenta), el más reciente primero. */
|
|
318
|
+
listCustomerCreditDocuments(
|
|
319
|
+
directoryId: string,
|
|
320
|
+
creditId: string,
|
|
321
|
+
type: ContractTypeEnum,
|
|
322
|
+
tenantId: string,
|
|
323
|
+
): Promise<StandardResponse<LoanCustomerCreditDocument[]>>;
|
|
324
|
+
|
|
325
|
+
/** URL prefirmada del PDF de un documento del ciclo de vida. 404 CREDIT_DOCUMENT_NOT_FOUND si no existe o no tiene PDF. */
|
|
326
|
+
getCustomerCreditDocumentUrl(
|
|
327
|
+
directoryId: string,
|
|
328
|
+
creditId: string,
|
|
329
|
+
documentType: ContractTypeEnum,
|
|
330
|
+
documentKey: string,
|
|
331
|
+
tenantId: string,
|
|
332
|
+
): Promise<StandardResponse<LoanCustomerCreditDocumentUrl>>;
|
|
333
|
+
|
|
314
334
|
// ─── Pagos de cliente (retail-loan-business) ────────────────────────────────
|
|
315
335
|
|
|
316
336
|
/** Opciones de pago de un crédito del cliente, con montos ya calculados. */
|