@fiado/api-invoker 5.131.0 → 5.133.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/bin/index.d.ts +1 -0
- package/bin/index.js +1 -0
- package/bin/loanCredit/api/LoanCreditBusinessApi.d.ts +4 -2
- package/bin/loanCredit/api/LoanCreditBusinessApi.js +7 -2
- package/bin/loanCredit/api/dtos/GetCreditOptions.d.ts +5 -0
- package/bin/loanCredit/api/dtos/GetCreditOptions.js +1 -0
- package/bin/loanCredit/api/interfaces/ILoanCreditBusinessApi.d.ts +10 -3
- package/bin/loanCredit/index.d.ts +1 -0
- package/bin/loanCredit/index.js +1 -0
- package/bin/loanRetailAudit/api/LoanRetailAuditBusinessApi.d.ts +12 -0
- package/bin/loanRetailAudit/api/LoanRetailAuditBusinessApi.js +44 -0
- package/bin/loanRetailAudit/api/interfaces/ILoanRetailAuditBusinessApi.d.ts +14 -0
- package/bin/loanRetailAudit/api/interfaces/ILoanRetailAuditBusinessApi.js +1 -0
- package/bin/loanRetailAudit/index.d.ts +2 -0
- package/bin/loanRetailAudit/index.js +2 -0
- package/package.json +2 -2
- package/src/index.ts +1 -0
- package/src/loanCredit/api/LoanCreditBusinessApi.ts +14 -1
- package/src/loanCredit/api/dtos/GetCreditOptions.ts +5 -0
- package/src/loanCredit/api/interfaces/ILoanCreditBusinessApi.ts +15 -1
- package/src/loanCredit/index.ts +1 -0
- package/src/loanRetailAudit/api/LoanRetailAuditBusinessApi.ts +40 -0
- package/src/loanRetailAudit/api/interfaces/ILoanRetailAuditBusinessApi.ts +29 -0
- package/src/loanRetailAudit/index.ts +2 -0
package/bin/index.d.ts
CHANGED
|
@@ -93,6 +93,7 @@ export * from "./retailCards/index.js";
|
|
|
93
93
|
export * from "./retailNotifications/index.js";
|
|
94
94
|
export * from "./retailWizard/index.js";
|
|
95
95
|
export * from "./retailPromotions/index.js";
|
|
96
|
+
export * from "./loanRetailAudit/index.js";
|
|
96
97
|
export * from "./retailCommission/index.js";
|
|
97
98
|
export * from "./retailIntegration/index.js";
|
|
98
99
|
export * from "./shortlink/index.js";
|
package/bin/index.js
CHANGED
|
@@ -93,6 +93,7 @@ export * from "./retailCards/index.js";
|
|
|
93
93
|
export * from "./retailNotifications/index.js";
|
|
94
94
|
export * from "./retailWizard/index.js";
|
|
95
95
|
export * from "./retailPromotions/index.js";
|
|
96
|
+
export * from "./loanRetailAudit/index.js";
|
|
96
97
|
export * from "./retailCommission/index.js";
|
|
97
98
|
export * from "./retailIntegration/index.js";
|
|
98
99
|
export * from "./shortlink/index.js";
|
|
@@ -1,8 +1,9 @@
|
|
|
1
1
|
import type { IHttpRequest } from "@fiado/http-client";
|
|
2
2
|
import { StandardResponse } from "@fiado/gateway-adapter";
|
|
3
|
-
import { ActivationCheckRequest, ActivationCheckResponse, 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, 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
|
+
import type { GetCreditOptions } from "./dtos/GetCreditOptions.js";
|
|
6
7
|
import { CustomerCreditHistoryResponse } from "./dtos/CustomerCreditHistory.js";
|
|
7
8
|
import { CreditLifecycleFactRequest, CreditLifecycleFactResponse } from "./dtos/CreditLifecycleFact.js";
|
|
8
9
|
import { ILoanCreditBusinessApi } from "./interfaces/ILoanCreditBusinessApi.js";
|
|
@@ -30,7 +31,8 @@ export default class LoanCreditBusinessApi implements ILoanCreditBusinessApi {
|
|
|
30
31
|
settle(creditId: string, input: CreditSettledRequest, tenantId: string): Promise<StandardResponse<CreditSettledResponse>>;
|
|
31
32
|
activateCheck(creditId: string, input: ActivationCheckRequest, tenantId: string): Promise<StandardResponse<ActivationCheckResponse>>;
|
|
32
33
|
discard(creditId: string, tenantId: string): Promise<StandardResponse<LoanCreditResponse>>;
|
|
33
|
-
|
|
34
|
+
cancel(creditId: string, input: CancelLoanCreditRequest, tenantId: string): Promise<StandardResponse<LoanCreditResponse>>;
|
|
35
|
+
getCredit(creditId: string, tenantId: string, options?: GetCreditOptions): Promise<StandardResponse<LoanCreditResponse>>;
|
|
34
36
|
getBorrowerByRetailCustomer(retailCustomerId: string, tenantId: string): Promise<StandardResponse<LoanBorrowerResponse>>;
|
|
35
37
|
getCustomerCreditHistory(retailCustomerId: string, tenantId: string): Promise<StandardResponse<CustomerCreditHistoryResponse>>;
|
|
36
38
|
batchGetCreditAnalytics(input: LoanCreditAnalyticsBatchRequest, tenantId: string): Promise<StandardResponse<LoanCreditAnalyticsBatchResponse>>;
|
|
@@ -67,8 +67,13 @@ let LoanCreditBusinessApi = class LoanCreditBusinessApi {
|
|
|
67
67
|
const url = `${this.baseUrl}/private/credits/${encodeURIComponent(creditId)}/discard?tenantId=${encodeURIComponent(tenantId)}`;
|
|
68
68
|
return await this.httpRequest.post(url, {});
|
|
69
69
|
}
|
|
70
|
-
async
|
|
71
|
-
const url = `${this.baseUrl}/private/credits/${encodeURIComponent(creditId)}?tenantId=${encodeURIComponent(tenantId)}`;
|
|
70
|
+
async cancel(creditId, input, tenantId) {
|
|
71
|
+
const url = `${this.baseUrl}/private/credits/${encodeURIComponent(creditId)}/cancel?tenantId=${encodeURIComponent(tenantId)}`;
|
|
72
|
+
return await this.httpRequest.post(url, input);
|
|
73
|
+
}
|
|
74
|
+
async getCredit(creditId, tenantId, options = {}) {
|
|
75
|
+
const include = options.includePaymentEvidence ? "&include=paymentEvidence" : "";
|
|
76
|
+
const url = `${this.baseUrl}/private/credits/${encodeURIComponent(creditId)}?tenantId=${encodeURIComponent(tenantId)}${include}`;
|
|
72
77
|
return await this.httpRequest.get(url);
|
|
73
78
|
}
|
|
74
79
|
async getBorrowerByRetailCustomer(retailCustomerId, tenantId) {
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -1,7 +1,8 @@
|
|
|
1
1
|
import { StandardResponse } from "@fiado/gateway-adapter";
|
|
2
|
-
import { ActivationCheckRequest, CreditPaymentAppliedRequest, CreditPaymentAppliedResponse, CreditSettledRequest, CreditSettledResponse, ActivationCheckResponse, 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, 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
|
+
import type { GetCreditOptions } from "../dtos/GetCreditOptions.js";
|
|
5
6
|
import { CustomerCreditHistoryResponse } from "../dtos/CustomerCreditHistory.js";
|
|
6
7
|
import { CreditLifecycleFactRequest, CreditLifecycleFactResponse } from "../dtos/CreditLifecycleFact.js";
|
|
7
8
|
/**
|
|
@@ -70,8 +71,14 @@ export interface ILoanCreditBusinessApi {
|
|
|
70
71
|
* `404 CREDIT_NOT_FOUND`.
|
|
71
72
|
*/
|
|
72
73
|
discard(creditId: string, tenantId: string): Promise<StandardResponse<LoanCreditResponse>>;
|
|
73
|
-
/**
|
|
74
|
-
|
|
74
|
+
/**
|
|
75
|
+
* Cancela el crédito de una venta cancelada: ACTIVE → CANCELLED (PENDING_ACTIVATION se descarta).
|
|
76
|
+
* Idempotente sobre CANCELLED. `404 CREDIT_NOT_FOUND` · `409 CREDIT_NOT_CANCELLABLE` ·
|
|
77
|
+
* `409 CREDIT_HAS_PAYMENTS` · `502 COLLECTION_DEREGISTER_FAILED`.
|
|
78
|
+
*/
|
|
79
|
+
cancel(creditId: string, input: CancelLoanCreditRequest, tenantId: string): Promise<StandardResponse<LoanCreditResponse>>;
|
|
80
|
+
/** Estado completo del crédito (checklist, status, términos); `hasPayments` solo si se pide. */
|
|
81
|
+
getCredit(creditId: string, tenantId: string, options?: GetCreditOptions): Promise<StandardResponse<LoanCreditResponse>>;
|
|
75
82
|
/**
|
|
76
83
|
* Busca el acreditado por su FK al cliente retail (lookup del wizard/scoring).
|
|
77
84
|
* `404 BORROWER_NOT_FOUND` si el evento KYC aún no lo hidrató.
|
|
@@ -2,6 +2,7 @@ export * from "./api/dtos/CreditLifecycleFact.js";
|
|
|
2
2
|
export * from "./api/dtos/CustomerCreditHistory.js";
|
|
3
3
|
export * from "./api/dtos/CreditSummariesBatch.js";
|
|
4
4
|
export * from "./api/dtos/LoanCreditAnalyticsBatch.js";
|
|
5
|
+
export * from "./api/dtos/GetCreditOptions.js";
|
|
5
6
|
export * from "./api/interfaces/ILoanCreditBusinessApi.js";
|
|
6
7
|
export { default as LoanCreditBusinessApi } from "./api/LoanCreditBusinessApi.js";
|
|
7
8
|
export * from "./api/interfaces/ILoanCreditDeviceApi.js";
|
package/bin/loanCredit/index.js
CHANGED
|
@@ -2,6 +2,7 @@ export * from "./api/dtos/CreditLifecycleFact.js";
|
|
|
2
2
|
export * from "./api/dtos/CustomerCreditHistory.js";
|
|
3
3
|
export * from "./api/dtos/CreditSummariesBatch.js";
|
|
4
4
|
export * from "./api/dtos/LoanCreditAnalyticsBatch.js";
|
|
5
|
+
export * from "./api/dtos/GetCreditOptions.js";
|
|
5
6
|
export * from "./api/interfaces/ILoanCreditBusinessApi.js";
|
|
6
7
|
export { default as LoanCreditBusinessApi } from "./api/LoanCreditBusinessApi.js";
|
|
7
8
|
export * from "./api/interfaces/ILoanCreditDeviceApi.js";
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import type { IHttpRequest } from "@fiado/http-client";
|
|
2
|
+
import { StandardResponse } from "@fiado/gateway-adapter";
|
|
3
|
+
import type { CreatePiiAccessLogRequest, CreatePiiAccessLogResponse, ListAuditTrailQuery, ListAuditTrailResponse } from "@fiado/type-kit/bin/loanRetailAudit/index.js";
|
|
4
|
+
import { ILoanRetailAuditBusinessApi } from "./interfaces/ILoanRetailAuditBusinessApi.js";
|
|
5
|
+
/** Publisher HTTP de los privados de `loan-retail-audit-business`. Contrato -> `ILoanRetailAuditBusinessApi`. */
|
|
6
|
+
export default class LoanRetailAuditBusinessApi implements ILoanRetailAuditBusinessApi {
|
|
7
|
+
private httpRequest;
|
|
8
|
+
private readonly baseUrl;
|
|
9
|
+
constructor(httpRequest: IHttpRequest);
|
|
10
|
+
createPiiAccessLog(request: CreatePiiAccessLogRequest, tenantId: string): Promise<StandardResponse<CreatePiiAccessLogResponse>>;
|
|
11
|
+
listAuditTrail(query: ListAuditTrailQuery, tenantId: string): Promise<StandardResponse<ListAuditTrailResponse>>;
|
|
12
|
+
}
|
|
@@ -0,0 +1,44 @@
|
|
|
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
|
+
var __metadata = (this && this.__metadata) || function (k, v) {
|
|
8
|
+
if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
|
|
9
|
+
};
|
|
10
|
+
var __param = (this && this.__param) || function (paramIndex, decorator) {
|
|
11
|
+
return function (target, key) { decorator(target, key, paramIndex); }
|
|
12
|
+
};
|
|
13
|
+
import { inject, injectable } from "inversify";
|
|
14
|
+
/** Publisher HTTP de los privados de `loan-retail-audit-business`. Contrato -> `ILoanRetailAuditBusinessApi`. */
|
|
15
|
+
let LoanRetailAuditBusinessApi = class LoanRetailAuditBusinessApi {
|
|
16
|
+
httpRequest;
|
|
17
|
+
// El buildspec publica la URL en SSM con "/" final; se normaliza para no armar "//private".
|
|
18
|
+
baseUrl = (process.env.LOAN_RETAIL_AUDIT_BUSINESS_URL || "").replace(/\/+$/, "");
|
|
19
|
+
constructor(httpRequest) {
|
|
20
|
+
this.httpRequest = httpRequest;
|
|
21
|
+
}
|
|
22
|
+
async createPiiAccessLog(request, tenantId) {
|
|
23
|
+
const query = new URLSearchParams({ tenantId });
|
|
24
|
+
const url = `${this.baseUrl}/private/pii-access-logs?${query.toString()}`;
|
|
25
|
+
// Firma de http-client: post(url, data, headers, basicAuth, enableTimeout).
|
|
26
|
+
return await this.httpRequest.post(url, request, {}, undefined, true);
|
|
27
|
+
}
|
|
28
|
+
async listAuditTrail(query, tenantId) {
|
|
29
|
+
const params = new URLSearchParams({ tenantId, entityType: query.entityType, entityId: query.entityId });
|
|
30
|
+
if (query.order)
|
|
31
|
+
params.set("order", query.order);
|
|
32
|
+
if (query.limit !== undefined)
|
|
33
|
+
params.set("limit", String(query.limit));
|
|
34
|
+
if (query.nextToken)
|
|
35
|
+
params.set("nextToken", query.nextToken);
|
|
36
|
+
return await this.httpRequest.get(`${this.baseUrl}/private/audit-trail?${params.toString()}`);
|
|
37
|
+
}
|
|
38
|
+
};
|
|
39
|
+
LoanRetailAuditBusinessApi = __decorate([
|
|
40
|
+
injectable(),
|
|
41
|
+
__param(0, inject("IHttpRequest")),
|
|
42
|
+
__metadata("design:paramtypes", [Object])
|
|
43
|
+
], LoanRetailAuditBusinessApi);
|
|
44
|
+
export default LoanRetailAuditBusinessApi;
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import { StandardResponse } from "@fiado/gateway-adapter";
|
|
2
|
+
import type { CreatePiiAccessLogRequest, CreatePiiAccessLogResponse, ListAuditTrailQuery, ListAuditTrailResponse } from "@fiado/type-kit/bin/loanRetailAudit/index.js";
|
|
3
|
+
export interface ILoanRetailAuditBusinessApi {
|
|
4
|
+
/**
|
|
5
|
+
* `POST /private/pii-access-logs`: registra un acceso a PII. Lleva timeout; si el central no
|
|
6
|
+
* responde, rechaza y el caller falla cerrado. El mismo `accessId` en un reintento no duplica.
|
|
7
|
+
*/
|
|
8
|
+
createPiiAccessLog(request: CreatePiiAccessLogRequest, tenantId: string): Promise<StandardResponse<CreatePiiAccessLogResponse>>;
|
|
9
|
+
/**
|
|
10
|
+
* `GET /private/audit-trail`: una página de la bitácora de una entidad (`order` default `desc`).
|
|
11
|
+
* `nextToken` es opaco y viaja tal cual; `null` en la respuesta = última página.
|
|
12
|
+
*/
|
|
13
|
+
listAuditTrail(query: ListAuditTrailQuery, tenantId: string): Promise<StandardResponse<ListAuditTrailResponse>>;
|
|
14
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@fiado/api-invoker",
|
|
3
|
-
"version": "5.
|
|
3
|
+
"version": "5.133.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.550.0",
|
|
38
38
|
"dotenv": "^16.4.7"
|
|
39
39
|
},
|
|
40
40
|
"peerDependencies": {
|
package/src/index.ts
CHANGED
|
@@ -93,6 +93,7 @@ export * from "./retailCards/index.js";
|
|
|
93
93
|
export * from "./retailNotifications/index.js";
|
|
94
94
|
export * from "./retailWizard/index.js";
|
|
95
95
|
export * from "./retailPromotions/index.js";
|
|
96
|
+
export * from "./loanRetailAudit/index.js";
|
|
96
97
|
export * from "./retailCommission/index.js";
|
|
97
98
|
export * from "./retailIntegration/index.js";
|
|
98
99
|
export * from "./shortlink/index.js";
|
|
@@ -4,6 +4,7 @@ import { StandardResponse } from "@fiado/gateway-adapter";
|
|
|
4
4
|
import {
|
|
5
5
|
ActivationCheckRequest,
|
|
6
6
|
ActivationCheckResponse,
|
|
7
|
+
CancelLoanCreditRequest,
|
|
7
8
|
CreditPaymentAppliedRequest,
|
|
8
9
|
CreditPaymentAppliedResponse,
|
|
9
10
|
CreditSettledRequest,
|
|
@@ -40,6 +41,7 @@ import {
|
|
|
40
41
|
LoanCreditAnalyticsBatchRequest,
|
|
41
42
|
LoanCreditAnalyticsBatchResponse,
|
|
42
43
|
} from "./dtos/LoanCreditAnalyticsBatch.js";
|
|
44
|
+
import type { GetCreditOptions } from "./dtos/GetCreditOptions.js";
|
|
43
45
|
import { CustomerCreditHistoryResponse } from "./dtos/CustomerCreditHistory.js";
|
|
44
46
|
import {
|
|
45
47
|
CreditLifecycleFactRequest,
|
|
@@ -142,11 +144,22 @@ export default class LoanCreditBusinessApi implements ILoanCreditBusinessApi {
|
|
|
142
144
|
return await this.httpRequest.post(url, {});
|
|
143
145
|
}
|
|
144
146
|
|
|
147
|
+
async cancel(
|
|
148
|
+
creditId: string,
|
|
149
|
+
input: CancelLoanCreditRequest,
|
|
150
|
+
tenantId: string,
|
|
151
|
+
): Promise<StandardResponse<LoanCreditResponse>> {
|
|
152
|
+
const url = `${this.baseUrl}/private/credits/${encodeURIComponent(creditId)}/cancel?tenantId=${encodeURIComponent(tenantId)}`;
|
|
153
|
+
return await this.httpRequest.post(url, input);
|
|
154
|
+
}
|
|
155
|
+
|
|
145
156
|
async getCredit(
|
|
146
157
|
creditId: string,
|
|
147
158
|
tenantId: string,
|
|
159
|
+
options: GetCreditOptions = {},
|
|
148
160
|
): Promise<StandardResponse<LoanCreditResponse>> {
|
|
149
|
-
const
|
|
161
|
+
const include = options.includePaymentEvidence ? "&include=paymentEvidence" : "";
|
|
162
|
+
const url = `${this.baseUrl}/private/credits/${encodeURIComponent(creditId)}?tenantId=${encodeURIComponent(tenantId)}${include}`;
|
|
150
163
|
return await this.httpRequest.get(url);
|
|
151
164
|
}
|
|
152
165
|
|
|
@@ -6,6 +6,7 @@ import {
|
|
|
6
6
|
CreditSettledRequest,
|
|
7
7
|
CreditSettledResponse,
|
|
8
8
|
ActivationCheckResponse,
|
|
9
|
+
CancelLoanCreditRequest,
|
|
9
10
|
LoanBorrowerResponse,
|
|
10
11
|
ListMessagingCandidatesRequest,
|
|
11
12
|
ListMessagingCandidatesResponse,
|
|
@@ -38,6 +39,7 @@ import {
|
|
|
38
39
|
LoanCreditAnalyticsBatchRequest,
|
|
39
40
|
LoanCreditAnalyticsBatchResponse,
|
|
40
41
|
} from "../dtos/LoanCreditAnalyticsBatch.js";
|
|
42
|
+
import type { GetCreditOptions } from "../dtos/GetCreditOptions.js";
|
|
41
43
|
import { CustomerCreditHistoryResponse } from "../dtos/CustomerCreditHistory.js";
|
|
42
44
|
import {
|
|
43
45
|
CreditLifecycleFactRequest,
|
|
@@ -148,10 +150,22 @@ export interface ILoanCreditBusinessApi {
|
|
|
148
150
|
tenantId: string,
|
|
149
151
|
): Promise<StandardResponse<LoanCreditResponse>>;
|
|
150
152
|
|
|
151
|
-
/**
|
|
153
|
+
/**
|
|
154
|
+
* Cancela el crédito de una venta cancelada: ACTIVE → CANCELLED (PENDING_ACTIVATION se descarta).
|
|
155
|
+
* Idempotente sobre CANCELLED. `404 CREDIT_NOT_FOUND` · `409 CREDIT_NOT_CANCELLABLE` ·
|
|
156
|
+
* `409 CREDIT_HAS_PAYMENTS` · `502 COLLECTION_DEREGISTER_FAILED`.
|
|
157
|
+
*/
|
|
158
|
+
cancel(
|
|
159
|
+
creditId: string,
|
|
160
|
+
input: CancelLoanCreditRequest,
|
|
161
|
+
tenantId: string,
|
|
162
|
+
): Promise<StandardResponse<LoanCreditResponse>>;
|
|
163
|
+
|
|
164
|
+
/** Estado completo del crédito (checklist, status, términos); `hasPayments` solo si se pide. */
|
|
152
165
|
getCredit(
|
|
153
166
|
creditId: string,
|
|
154
167
|
tenantId: string,
|
|
168
|
+
options?: GetCreditOptions,
|
|
155
169
|
): Promise<StandardResponse<LoanCreditResponse>>;
|
|
156
170
|
|
|
157
171
|
/**
|
package/src/loanCredit/index.ts
CHANGED
|
@@ -2,6 +2,7 @@ export * from "./api/dtos/CreditLifecycleFact.js";
|
|
|
2
2
|
export * from "./api/dtos/CustomerCreditHistory.js";
|
|
3
3
|
export * from "./api/dtos/CreditSummariesBatch.js";
|
|
4
4
|
export * from "./api/dtos/LoanCreditAnalyticsBatch.js";
|
|
5
|
+
export * from "./api/dtos/GetCreditOptions.js";
|
|
5
6
|
export * from "./api/interfaces/ILoanCreditBusinessApi.js";
|
|
6
7
|
export { default as LoanCreditBusinessApi } from "./api/LoanCreditBusinessApi.js";
|
|
7
8
|
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
import { inject, injectable } from "inversify";
|
|
2
|
+
import type { IHttpRequest } from "@fiado/http-client";
|
|
3
|
+
import { StandardResponse } from "@fiado/gateway-adapter";
|
|
4
|
+
import type {
|
|
5
|
+
CreatePiiAccessLogRequest,
|
|
6
|
+
CreatePiiAccessLogResponse,
|
|
7
|
+
ListAuditTrailQuery,
|
|
8
|
+
ListAuditTrailResponse,
|
|
9
|
+
} from "@fiado/type-kit/bin/loanRetailAudit/index.js";
|
|
10
|
+
import { ILoanRetailAuditBusinessApi } from "./interfaces/ILoanRetailAuditBusinessApi.js";
|
|
11
|
+
|
|
12
|
+
/** Publisher HTTP de los privados de `loan-retail-audit-business`. Contrato -> `ILoanRetailAuditBusinessApi`. */
|
|
13
|
+
@injectable()
|
|
14
|
+
export default class LoanRetailAuditBusinessApi implements ILoanRetailAuditBusinessApi {
|
|
15
|
+
// El buildspec publica la URL en SSM con "/" final; se normaliza para no armar "//private".
|
|
16
|
+
private readonly baseUrl = (process.env.LOAN_RETAIL_AUDIT_BUSINESS_URL || "").replace(/\/+$/, "");
|
|
17
|
+
|
|
18
|
+
constructor(@inject("IHttpRequest") private httpRequest: IHttpRequest) {}
|
|
19
|
+
|
|
20
|
+
async createPiiAccessLog(
|
|
21
|
+
request: CreatePiiAccessLogRequest,
|
|
22
|
+
tenantId: string,
|
|
23
|
+
): Promise<StandardResponse<CreatePiiAccessLogResponse>> {
|
|
24
|
+
const query = new URLSearchParams({ tenantId });
|
|
25
|
+
const url = `${this.baseUrl}/private/pii-access-logs?${query.toString()}`;
|
|
26
|
+
// Firma de http-client: post(url, data, headers, basicAuth, enableTimeout).
|
|
27
|
+
return await this.httpRequest.post(url, request, {}, undefined, true);
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
async listAuditTrail(
|
|
31
|
+
query: ListAuditTrailQuery,
|
|
32
|
+
tenantId: string,
|
|
33
|
+
): Promise<StandardResponse<ListAuditTrailResponse>> {
|
|
34
|
+
const params = new URLSearchParams({ tenantId, entityType: query.entityType, entityId: query.entityId });
|
|
35
|
+
if (query.order) params.set("order", query.order);
|
|
36
|
+
if (query.limit !== undefined) params.set("limit", String(query.limit));
|
|
37
|
+
if (query.nextToken) params.set("nextToken", query.nextToken);
|
|
38
|
+
return await this.httpRequest.get(`${this.baseUrl}/private/audit-trail?${params.toString()}`);
|
|
39
|
+
}
|
|
40
|
+
}
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
import { StandardResponse } from "@fiado/gateway-adapter";
|
|
2
|
+
import type {
|
|
3
|
+
CreatePiiAccessLogRequest,
|
|
4
|
+
CreatePiiAccessLogResponse,
|
|
5
|
+
ListAuditTrailQuery,
|
|
6
|
+
ListAuditTrailResponse,
|
|
7
|
+
} from "@fiado/type-kit/bin/loanRetailAudit/index.js";
|
|
8
|
+
|
|
9
|
+
// Contrato de los privados de `loan-retail-audit-business`; el caller manda `tenantId` por query.
|
|
10
|
+
// El consumer necesita `LOAN_RETAIL_AUDIT_BUSINESS_URL` = `{{resolve:ssm:loan-retail-audit-business}}`.
|
|
11
|
+
export interface ILoanRetailAuditBusinessApi {
|
|
12
|
+
/**
|
|
13
|
+
* `POST /private/pii-access-logs`: registra un acceso a PII. Lleva timeout; si el central no
|
|
14
|
+
* responde, rechaza y el caller falla cerrado. El mismo `accessId` en un reintento no duplica.
|
|
15
|
+
*/
|
|
16
|
+
createPiiAccessLog(
|
|
17
|
+
request: CreatePiiAccessLogRequest,
|
|
18
|
+
tenantId: string,
|
|
19
|
+
): Promise<StandardResponse<CreatePiiAccessLogResponse>>;
|
|
20
|
+
|
|
21
|
+
/**
|
|
22
|
+
* `GET /private/audit-trail`: una página de la bitácora de una entidad (`order` default `desc`).
|
|
23
|
+
* `nextToken` es opaco y viaja tal cual; `null` en la respuesta = última página.
|
|
24
|
+
*/
|
|
25
|
+
listAuditTrail(
|
|
26
|
+
query: ListAuditTrailQuery,
|
|
27
|
+
tenantId: string,
|
|
28
|
+
): Promise<StandardResponse<ListAuditTrailResponse>>;
|
|
29
|
+
}
|