@fiado/api-invoker 5.78.0 → 5.80.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/account-fiadoinc/AccountFiadoIncApi.d.ts +2 -1
- package/bin/account-fiadoinc/AccountFiadoIncApi.js +7 -0
- package/bin/account-fiadoinc/interfaces/IAccountFiadoIncApi.d.ts +9 -1
- package/bin/loanCredit/api/LoanCreditBusinessApi.d.ts +2 -0
- package/bin/loanCredit/api/LoanCreditBusinessApi.js +4 -0
- package/bin/loanCredit/api/dtos/CreditLifecycleFact.d.ts +31 -0
- package/bin/loanCredit/api/dtos/CreditLifecycleFact.js +17 -0
- package/bin/loanCredit/api/interfaces/ILoanCreditBusinessApi.d.ts +12 -0
- package/bin/loanCredit/index.d.ts +1 -0
- package/bin/loanCredit/index.js +1 -0
- package/package.json +1 -1
- package/src/account-fiadoinc/AccountFiadoIncApi.ts +10 -1
- package/src/account-fiadoinc/interfaces/IAccountFiadoIncApi.ts +11 -1
- package/src/loanCredit/api/LoanCreditBusinessApi.ts +13 -0
- package/src/loanCredit/api/dtos/CreditLifecycleFact.ts +33 -0
- package/src/loanCredit/api/interfaces/ILoanCreditBusinessApi.ts +20 -0
- package/src/loanCredit/index.ts +1 -0
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { IHttpRequest } from "@fiado/http-client";
|
|
2
|
-
import { AccountCreateRequest, AccountCreateResponse, AccountUpdateBalanceRequest, AccountUpdateRequest, ExecuteP2pOperationRequest, ExecuteP2pOperationResponse, ExecutePocketOperationRequest, ExecutePocketOperationResponse, GetAccountResponse, GetAccountResponseList, GetBankAccountUserResponse, GetPocketBalanceResponse } from "@fiado/type-kit/bin/account/index.js";
|
|
2
|
+
import { AccountCreateRequest, AccountCreateResponse, AccountUpdateBalanceRequest, AccountUpdateRequest, ExecuteP2pOperationRequest, ExecuteP2pOperationResponse, ExecutePocketOperationRequest, ExecutePocketOperationResponse, GetAccountResponse, GetAccountResponseList, GetBankAccountUserResponse, GetPocketBalanceResponse, UpdateBankAccountUserRequest } from "@fiado/type-kit/bin/account/index.js";
|
|
3
3
|
type FiadoApiResponse<T> = import("@fiado/type-kit/bin/apiResponse/dtos/FiadoApiResponse.js").default<T>;
|
|
4
4
|
import { Provider, ProviderDocumentUploadRequest } from "@fiado/type-kit/bin/provider/index.js";
|
|
5
5
|
import { IAccountFiadoIncApi } from "./interfaces/IAccountFiadoIncApi.js";
|
|
@@ -16,6 +16,7 @@ export default class AccountFiadoIncApi implements IAccountFiadoIncApi {
|
|
|
16
16
|
getAccountByDirectoryId(provider: Provider, directoryId: string): Promise<FiadoApiResponse<GetAccountResponse[]>>;
|
|
17
17
|
getAccountByExternalAccountId(provider: Provider, externalAccountId: string): Promise<FiadoApiResponse<GetAccountResponse[]>>;
|
|
18
18
|
getExternalUser(provider: Provider, directoryId: string): Promise<FiadoApiResponse<GetBankAccountUserResponse>>;
|
|
19
|
+
updateExternalUser(provider: Provider, directoryId: string, input: UpdateBankAccountUserRequest): Promise<FiadoApiResponse<GetBankAccountUserResponse>>;
|
|
19
20
|
scanAllAccounts(provider: Provider | 'ALL', limit?: number, lastEvaluatedKey?: string): Promise<FiadoApiResponse<GetAccountResponseList>>;
|
|
20
21
|
scanAccountsByDateRange(provider: Provider | 'ALL', startDate: number, endDate: number, limit?: number, lastEvaluatedKey?: string): Promise<FiadoApiResponse<GetAccountResponseList>>;
|
|
21
22
|
/** POCKETS **/
|
|
@@ -44,6 +44,13 @@ let AccountFiadoIncApi = class AccountFiadoIncApi {
|
|
|
44
44
|
const url = `${this.baseUrl}${provider}/users/${directoryId}/external`;
|
|
45
45
|
return await this.httpRequest.get(url);
|
|
46
46
|
}
|
|
47
|
+
// Misma URL que getExternalUser, con el verbo de escritura. PUT y no PATCH porque las
|
|
48
|
+
// librerias de la casa no soportan PATCH; coincide con el put declarado en el
|
|
49
|
+
// openapi/private.yaml del lambda (operationId privateUpdateExternalUser).
|
|
50
|
+
async updateExternalUser(provider, directoryId, input) {
|
|
51
|
+
const url = `${this.baseUrl}${provider}/users/${directoryId}/external`;
|
|
52
|
+
return await this.httpRequest.put(url, input);
|
|
53
|
+
}
|
|
47
54
|
async scanAllAccounts(provider, limit, lastEvaluatedKey) {
|
|
48
55
|
const queryParams = new URLSearchParams();
|
|
49
56
|
queryParams.append('provider', provider);
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { AccountCreateRequest, AccountCreateResponse, AccountUpdateBalanceRequest, AccountUpdateRequest, ExecuteP2pOperationRequest, ExecuteP2pOperationResponse, ExecutePocketOperationRequest, ExecutePocketOperationResponse, GetAccountResponse, GetAccountResponseList, GetBankAccountUserResponse, GetPocketBalanceResponse } from "@fiado/type-kit/bin/account/index.js";
|
|
1
|
+
import { AccountCreateRequest, AccountCreateResponse, AccountUpdateBalanceRequest, AccountUpdateRequest, ExecuteP2pOperationRequest, ExecuteP2pOperationResponse, ExecutePocketOperationRequest, ExecutePocketOperationResponse, GetAccountResponse, GetAccountResponseList, GetBankAccountUserResponse, GetPocketBalanceResponse, UpdateBankAccountUserRequest } from "@fiado/type-kit/bin/account/index.js";
|
|
2
2
|
type FiadoApiResponse<T> = import("@fiado/type-kit/bin/apiResponse/dtos/FiadoApiResponse.js").default<T>;
|
|
3
3
|
import { Provider } from "@fiado/type-kit/bin/provider/index.js";
|
|
4
4
|
import { IPublisher } from "../queue/interfaces/IPublisher.js";
|
|
@@ -16,6 +16,14 @@ export interface IAccountFiadoIncApi extends IPublisher {
|
|
|
16
16
|
replaceExternalAccount(provider: Provider, directoryId: string, externalAccountId: string, isPrincipal: boolean): Promise<FiadoApiResponse<void>>;
|
|
17
17
|
getAccountByExternalAccountId(provider: Provider, externalAccountId: string): Promise<FiadoApiResponse<GetAccountResponse[]>>;
|
|
18
18
|
getExternalUser(provider: Provider, directoryId: string): Promise<FiadoApiResponse<GetBankAccountUserResponse>>;
|
|
19
|
+
/**
|
|
20
|
+
* Actualiza los nombres del usuario externo del proveedor.
|
|
21
|
+
*
|
|
22
|
+
* El nombre tiene que llamarse igual en las tres capas (lambda, aqui y el consumidor):
|
|
23
|
+
* el binding se resuelve por nombre. Ojo con updateExternalUserId, que es otra cosa
|
|
24
|
+
* (guarda el id externo en el directorio, no los nombres del usuario bancario).
|
|
25
|
+
*/
|
|
26
|
+
updateExternalUser(provider: Provider, directoryId: string, input: UpdateBankAccountUserRequest): Promise<FiadoApiResponse<GetBankAccountUserResponse>>;
|
|
19
27
|
scanAllAccounts(provider: Provider | 'ALL', limit?: number, lastEvaluatedKey?: string): Promise<FiadoApiResponse<GetAccountResponseList>>;
|
|
20
28
|
scanAccountsByDateRange(provider: Provider | 'ALL', startDate: number, endDate: number, limit?: number, lastEvaluatedKey?: string): Promise<FiadoApiResponse<GetAccountResponseList>>;
|
|
21
29
|
}
|
|
@@ -3,6 +3,7 @@ import { StandardResponse } from "@fiado/gateway-adapter";
|
|
|
3
3
|
import { ActivationCheckRequest, ActivationCheckResponse, CreditPaymentAppliedRequest, CreditPaymentAppliedResponse, CreditSettledRequest, CreditSettledResponse, LoanBorrowerResponse, ListMessagingCandidatesRequest, ListMessagingCandidatesResponse, LoanCreditResponse, OriginateLoanCreditRequest, OriginateLoanCreditResponse, QuoteLoanCreditRequest, QuoteLoanCreditResponse, SignLoanCreditRequest, SignLoanCreditResponse, UpsertLoanBorrowerRequest } from "@fiado/type-kit/bin/loanCredit/index.js";
|
|
4
4
|
import { LoanCreditAnalyticsBatchRequest, LoanCreditAnalyticsBatchResponse } from "./dtos/LoanCreditAnalyticsBatch.js";
|
|
5
5
|
import { CustomerCreditHistoryResponse } from "./dtos/CustomerCreditHistory.js";
|
|
6
|
+
import { CreditLifecycleFactRequest, CreditLifecycleFactResponse } from "./dtos/CreditLifecycleFact.js";
|
|
6
7
|
import { ILoanCreditBusinessApi } from "./interfaces/ILoanCreditBusinessApi.js";
|
|
7
8
|
/**
|
|
8
9
|
* Publisher HTTP del lambda `loan-credit-business` (componente 09 SureKeep F2 — motor de crédito).
|
|
@@ -32,5 +33,6 @@ export default class LoanCreditBusinessApi implements ILoanCreditBusinessApi {
|
|
|
32
33
|
getCustomerCreditHistory(retailCustomerId: string, tenantId: string): Promise<StandardResponse<CustomerCreditHistoryResponse>>;
|
|
33
34
|
batchGetCreditAnalytics(input: LoanCreditAnalyticsBatchRequest, tenantId: string): Promise<StandardResponse<LoanCreditAnalyticsBatchResponse>>;
|
|
34
35
|
upsertBorrower(input: UpsertLoanBorrowerRequest, tenantId: string): Promise<StandardResponse<LoanBorrowerResponse>>;
|
|
36
|
+
notifyLifecycleFact(creditId: string, input: CreditLifecycleFactRequest, tenantId: string): Promise<StandardResponse<CreditLifecycleFactResponse>>;
|
|
35
37
|
listMessagingCandidates(input: ListMessagingCandidatesRequest, tenantId: string): Promise<StandardResponse<ListMessagingCandidatesResponse>>;
|
|
36
38
|
}
|
|
@@ -78,6 +78,10 @@ let LoanCreditBusinessApi = class LoanCreditBusinessApi {
|
|
|
78
78
|
const url = `${this.baseUrl}/private/borrowers?tenantId=${encodeURIComponent(tenantId)}`;
|
|
79
79
|
return await this.httpRequest.post(url, input);
|
|
80
80
|
}
|
|
81
|
+
async notifyLifecycleFact(creditId, input, tenantId) {
|
|
82
|
+
const url = `${this.baseUrl}/private/credits/${encodeURIComponent(creditId)}/lifecycle-facts?tenantId=${encodeURIComponent(tenantId)}`;
|
|
83
|
+
return await this.httpRequest.post(url, input);
|
|
84
|
+
}
|
|
81
85
|
async listMessagingCandidates(input, tenantId) {
|
|
82
86
|
const url = `${this.baseUrl}/private/messaging/candidates?tenantId=${encodeURIComponent(tenantId)}`;
|
|
83
87
|
return await this.httpRequest.post(url, input);
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Los HECHOS del ciclo del crédito que le avisan algo al cliente. El productor nombra el hecho y
|
|
3
|
+
* nada más — el momento, la plantilla, el canal y el texto los resuelve `loan-credit-business`.
|
|
4
|
+
*/
|
|
5
|
+
export declare enum CreditLifecycleFactEnum {
|
|
6
|
+
APPLICATION_APPROVED = "APPLICATION_APPROVED",
|
|
7
|
+
DOWN_PAYMENT_RECEIVED = "DOWN_PAYMENT_RECEIVED",
|
|
8
|
+
CONTRACT_SIGNED = "CONTRACT_SIGNED",
|
|
9
|
+
MDM_ACTIVATED = "MDM_ACTIVATED",
|
|
10
|
+
PAYMENT_APPLIED = "PAYMENT_APPLIED",
|
|
11
|
+
PAYMENT_REJECTED = "PAYMENT_REJECTED",
|
|
12
|
+
CREDIT_SETTLED = "CREDIT_SETTLED",
|
|
13
|
+
DEVICE_UNLOCKED = "DEVICE_UNLOCKED",
|
|
14
|
+
/** Bienvenida al cerrar la venta. Solo la pista de crédito: la de contado no tiene `creditId`. */
|
|
15
|
+
APP_WELCOME = "APP_WELCOME"
|
|
16
|
+
}
|
|
17
|
+
/** Body de `POST /private/credits/{creditId}/lifecycle-facts`. */
|
|
18
|
+
export interface CreditLifecycleFactRequest {
|
|
19
|
+
fact: CreditLifecycleFactEnum;
|
|
20
|
+
/**
|
|
21
|
+
* Rastro hasta el hecho de origen. Es SOLO trazabilidad: viaja a la referencia del aviso y NO
|
|
22
|
+
* deduplica. El motor acota su largo y su charset — ver `notifyLifecycleFact`.
|
|
23
|
+
*/
|
|
24
|
+
factReference?: string;
|
|
25
|
+
}
|
|
26
|
+
/** Acuse (202) del hecho recibido: repite lo que entró para que el caller lo correlacione. */
|
|
27
|
+
export interface CreditLifecycleFactResponse {
|
|
28
|
+
creditId: string;
|
|
29
|
+
fact: CreditLifecycleFactEnum;
|
|
30
|
+
factReference: string | null;
|
|
31
|
+
}
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Los HECHOS del ciclo del crédito que le avisan algo al cliente. El productor nombra el hecho y
|
|
3
|
+
* nada más — el momento, la plantilla, el canal y el texto los resuelve `loan-credit-business`.
|
|
4
|
+
*/
|
|
5
|
+
export var CreditLifecycleFactEnum;
|
|
6
|
+
(function (CreditLifecycleFactEnum) {
|
|
7
|
+
CreditLifecycleFactEnum["APPLICATION_APPROVED"] = "APPLICATION_APPROVED";
|
|
8
|
+
CreditLifecycleFactEnum["DOWN_PAYMENT_RECEIVED"] = "DOWN_PAYMENT_RECEIVED";
|
|
9
|
+
CreditLifecycleFactEnum["CONTRACT_SIGNED"] = "CONTRACT_SIGNED";
|
|
10
|
+
CreditLifecycleFactEnum["MDM_ACTIVATED"] = "MDM_ACTIVATED";
|
|
11
|
+
CreditLifecycleFactEnum["PAYMENT_APPLIED"] = "PAYMENT_APPLIED";
|
|
12
|
+
CreditLifecycleFactEnum["PAYMENT_REJECTED"] = "PAYMENT_REJECTED";
|
|
13
|
+
CreditLifecycleFactEnum["CREDIT_SETTLED"] = "CREDIT_SETTLED";
|
|
14
|
+
CreditLifecycleFactEnum["DEVICE_UNLOCKED"] = "DEVICE_UNLOCKED";
|
|
15
|
+
/** Bienvenida al cerrar la venta. Solo la pista de crédito: la de contado no tiene `creditId`. */
|
|
16
|
+
CreditLifecycleFactEnum["APP_WELCOME"] = "APP_WELCOME";
|
|
17
|
+
})(CreditLifecycleFactEnum || (CreditLifecycleFactEnum = {}));
|
|
@@ -2,6 +2,7 @@ import { StandardResponse } from "@fiado/gateway-adapter";
|
|
|
2
2
|
import { ActivationCheckRequest, CreditPaymentAppliedRequest, CreditPaymentAppliedResponse, CreditSettledRequest, CreditSettledResponse, ActivationCheckResponse, LoanBorrowerResponse, ListMessagingCandidatesRequest, ListMessagingCandidatesResponse, LoanCreditResponse, OriginateLoanCreditRequest, OriginateLoanCreditResponse, QuoteLoanCreditRequest, QuoteLoanCreditResponse, SignLoanCreditRequest, SignLoanCreditResponse, UpsertLoanBorrowerRequest } from "@fiado/type-kit/bin/loanCredit/index.js";
|
|
3
3
|
import { LoanCreditAnalyticsBatchRequest, LoanCreditAnalyticsBatchResponse } from "../dtos/LoanCreditAnalyticsBatch.js";
|
|
4
4
|
import { CustomerCreditHistoryResponse } from "../dtos/CustomerCreditHistory.js";
|
|
5
|
+
import { CreditLifecycleFactRequest, CreditLifecycleFactResponse } from "../dtos/CreditLifecycleFact.js";
|
|
5
6
|
/**
|
|
6
7
|
* Contrato del publisher de `loan-credit-business` (componente 09 SureKeep F2 — motor de crédito
|
|
7
8
|
* SOFOM, pista Loan). Endpoints PRIVADOS (VPC) consumidos por `retail-wizard-business` (pasos
|
|
@@ -95,6 +96,17 @@ export interface ILoanCreditBusinessApi {
|
|
|
95
96
|
* del evento `CustomerKycVerifiedV1` — fallback operativo mientras la cola no exista).
|
|
96
97
|
*/
|
|
97
98
|
upsertBorrower(input: UpsertLoanBorrowerRequest, tenantId: string): Promise<StandardResponse<LoanBorrowerResponse>>;
|
|
99
|
+
/**
|
|
100
|
+
* Puerta de los hechos del ciclo: el caller nombra el HECHO que ya ocurrió en su propio lambda
|
|
101
|
+
* (originación, enganche, firma, MDM, bienvenida) y el motor resuelve el momento, la plantilla,
|
|
102
|
+
* el canal y el texto. Se llama DESPUÉS de que el hecho quedó asentado.
|
|
103
|
+
*
|
|
104
|
+
* Responde `202` — el aviso es best-effort y no se promete entregado. `factReference` es solo
|
|
105
|
+
* trazabilidad hasta el hecho de origen: NO deduplica.
|
|
106
|
+
* `400 VALIDATION_ERROR` si el hecho está fuera del catálogo del motor o el `factReference`
|
|
107
|
+
* pasa los 120 caracteres o trae `#` / `~` · `400 UNKNOWN_TENANT`.
|
|
108
|
+
*/
|
|
109
|
+
notifyLifecycleFact(creditId: string, input: CreditLifecycleFactRequest, tenantId: string): Promise<StandardResponse<CreditLifecycleFactResponse>>;
|
|
98
110
|
/**
|
|
99
111
|
* Devuelve UNA PÁGINA de candidatos a mensaje del `slot` y el día de tienda pedidos: la persona,
|
|
100
112
|
* el momento que le toca, el canal y las variables ya resueltas. El motor barre su cartera, aplica
|
package/bin/loanCredit/index.js
CHANGED
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@fiado/api-invoker",
|
|
3
|
-
"version": "5.
|
|
3
|
+
"version": "5.80.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",
|
|
@@ -11,7 +11,8 @@ import {
|
|
|
11
11
|
GetAccountResponse,
|
|
12
12
|
GetAccountResponseList,
|
|
13
13
|
GetBankAccountUserResponse,
|
|
14
|
-
GetPocketBalanceResponse
|
|
14
|
+
GetPocketBalanceResponse,
|
|
15
|
+
UpdateBankAccountUserRequest
|
|
15
16
|
} from "@fiado/type-kit/bin/account/index.js";
|
|
16
17
|
type FiadoApiResponse<T> = import("@fiado/type-kit/bin/apiResponse/dtos/FiadoApiResponse.js").default<T>;
|
|
17
18
|
import { Provider, ProviderDocumentUploadRequest } from "@fiado/type-kit/bin/provider/index.js";
|
|
@@ -60,6 +61,14 @@ export default class AccountFiadoIncApi implements IAccountFiadoIncApi {
|
|
|
60
61
|
return await this.httpRequest.get(url);
|
|
61
62
|
}
|
|
62
63
|
|
|
64
|
+
// Misma URL que getExternalUser, con el verbo de escritura. PUT y no PATCH porque las
|
|
65
|
+
// librerias de la casa no soportan PATCH; coincide con el put declarado en el
|
|
66
|
+
// openapi/private.yaml del lambda (operationId privateUpdateExternalUser).
|
|
67
|
+
async updateExternalUser(provider: Provider, directoryId: string, input: UpdateBankAccountUserRequest): Promise<FiadoApiResponse<GetBankAccountUserResponse>> {
|
|
68
|
+
const url = `${this.baseUrl}${provider}/users/${directoryId}/external`;
|
|
69
|
+
return await this.httpRequest.put(url, input);
|
|
70
|
+
}
|
|
71
|
+
|
|
63
72
|
async scanAllAccounts(provider: Provider | 'ALL', limit?: number, lastEvaluatedKey?: string): Promise<FiadoApiResponse<GetAccountResponseList>> {
|
|
64
73
|
const queryParams = new URLSearchParams();
|
|
65
74
|
queryParams.append('provider', provider);
|
|
@@ -10,7 +10,8 @@ import {
|
|
|
10
10
|
GetAccountResponse,
|
|
11
11
|
GetAccountResponseList,
|
|
12
12
|
GetBankAccountUserResponse,
|
|
13
|
-
GetPocketBalanceResponse
|
|
13
|
+
GetPocketBalanceResponse,
|
|
14
|
+
UpdateBankAccountUserRequest
|
|
14
15
|
} from "@fiado/type-kit/bin/account/index.js";
|
|
15
16
|
type FiadoApiResponse<T> = import("@fiado/type-kit/bin/apiResponse/dtos/FiadoApiResponse.js").default<T>;
|
|
16
17
|
import { Provider } from "@fiado/type-kit/bin/provider/index.js";
|
|
@@ -45,6 +46,15 @@ export interface IAccountFiadoIncApi extends IPublisher {
|
|
|
45
46
|
|
|
46
47
|
getExternalUser(provider: Provider, directoryId: string): Promise<FiadoApiResponse<GetBankAccountUserResponse>>
|
|
47
48
|
|
|
49
|
+
/**
|
|
50
|
+
* Actualiza los nombres del usuario externo del proveedor.
|
|
51
|
+
*
|
|
52
|
+
* El nombre tiene que llamarse igual en las tres capas (lambda, aqui y el consumidor):
|
|
53
|
+
* el binding se resuelve por nombre. Ojo con updateExternalUserId, que es otra cosa
|
|
54
|
+
* (guarda el id externo en el directorio, no los nombres del usuario bancario).
|
|
55
|
+
*/
|
|
56
|
+
updateExternalUser(provider: Provider, directoryId: string, input: UpdateBankAccountUserRequest): Promise<FiadoApiResponse<GetBankAccountUserResponse>>
|
|
57
|
+
|
|
48
58
|
scanAllAccounts(provider: Provider | 'ALL', limit?: number, lastEvaluatedKey?: string): Promise<FiadoApiResponse<GetAccountResponseList>>
|
|
49
59
|
|
|
50
60
|
scanAccountsByDateRange(provider: Provider | 'ALL', startDate: number, endDate: number, limit?: number, lastEvaluatedKey?: string): Promise<FiadoApiResponse<GetAccountResponseList>>
|
|
@@ -25,6 +25,10 @@ import {
|
|
|
25
25
|
LoanCreditAnalyticsBatchResponse,
|
|
26
26
|
} from "./dtos/LoanCreditAnalyticsBatch.js";
|
|
27
27
|
import { CustomerCreditHistoryResponse } from "./dtos/CustomerCreditHistory.js";
|
|
28
|
+
import {
|
|
29
|
+
CreditLifecycleFactRequest,
|
|
30
|
+
CreditLifecycleFactResponse,
|
|
31
|
+
} from "./dtos/CreditLifecycleFact.js";
|
|
28
32
|
import { ILoanCreditBusinessApi } from "./interfaces/ILoanCreditBusinessApi.js";
|
|
29
33
|
|
|
30
34
|
/**
|
|
@@ -147,6 +151,15 @@ export default class LoanCreditBusinessApi implements ILoanCreditBusinessApi {
|
|
|
147
151
|
return await this.httpRequest.post(url, input);
|
|
148
152
|
}
|
|
149
153
|
|
|
154
|
+
async notifyLifecycleFact(
|
|
155
|
+
creditId: string,
|
|
156
|
+
input: CreditLifecycleFactRequest,
|
|
157
|
+
tenantId: string,
|
|
158
|
+
): Promise<StandardResponse<CreditLifecycleFactResponse>> {
|
|
159
|
+
const url = `${this.baseUrl}/private/credits/${encodeURIComponent(creditId)}/lifecycle-facts?tenantId=${encodeURIComponent(tenantId)}`;
|
|
160
|
+
return await this.httpRequest.post(url, input);
|
|
161
|
+
}
|
|
162
|
+
|
|
150
163
|
async listMessagingCandidates(
|
|
151
164
|
input: ListMessagingCandidatesRequest,
|
|
152
165
|
tenantId: string,
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Los HECHOS del ciclo del crédito que le avisan algo al cliente. El productor nombra el hecho y
|
|
3
|
+
* nada más — el momento, la plantilla, el canal y el texto los resuelve `loan-credit-business`.
|
|
4
|
+
*/
|
|
5
|
+
export enum CreditLifecycleFactEnum {
|
|
6
|
+
APPLICATION_APPROVED = "APPLICATION_APPROVED",
|
|
7
|
+
DOWN_PAYMENT_RECEIVED = "DOWN_PAYMENT_RECEIVED",
|
|
8
|
+
CONTRACT_SIGNED = "CONTRACT_SIGNED",
|
|
9
|
+
MDM_ACTIVATED = "MDM_ACTIVATED",
|
|
10
|
+
PAYMENT_APPLIED = "PAYMENT_APPLIED",
|
|
11
|
+
PAYMENT_REJECTED = "PAYMENT_REJECTED",
|
|
12
|
+
CREDIT_SETTLED = "CREDIT_SETTLED",
|
|
13
|
+
DEVICE_UNLOCKED = "DEVICE_UNLOCKED",
|
|
14
|
+
/** Bienvenida al cerrar la venta. Solo la pista de crédito: la de contado no tiene `creditId`. */
|
|
15
|
+
APP_WELCOME = "APP_WELCOME",
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
/** Body de `POST /private/credits/{creditId}/lifecycle-facts`. */
|
|
19
|
+
export interface CreditLifecycleFactRequest {
|
|
20
|
+
fact: CreditLifecycleFactEnum;
|
|
21
|
+
/**
|
|
22
|
+
* Rastro hasta el hecho de origen. Es SOLO trazabilidad: viaja a la referencia del aviso y NO
|
|
23
|
+
* deduplica. El motor acota su largo y su charset — ver `notifyLifecycleFact`.
|
|
24
|
+
*/
|
|
25
|
+
factReference?: string;
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
/** Acuse (202) del hecho recibido: repite lo que entró para que el caller lo correlacione. */
|
|
29
|
+
export interface CreditLifecycleFactResponse {
|
|
30
|
+
creditId: string;
|
|
31
|
+
fact: CreditLifecycleFactEnum;
|
|
32
|
+
factReference: string | null;
|
|
33
|
+
}
|
|
@@ -23,6 +23,10 @@ import {
|
|
|
23
23
|
LoanCreditAnalyticsBatchResponse,
|
|
24
24
|
} from "../dtos/LoanCreditAnalyticsBatch.js";
|
|
25
25
|
import { CustomerCreditHistoryResponse } from "../dtos/CustomerCreditHistory.js";
|
|
26
|
+
import {
|
|
27
|
+
CreditLifecycleFactRequest,
|
|
28
|
+
CreditLifecycleFactResponse,
|
|
29
|
+
} from "../dtos/CreditLifecycleFact.js";
|
|
26
30
|
|
|
27
31
|
/**
|
|
28
32
|
* Contrato del publisher de `loan-credit-business` (componente 09 SureKeep F2 — motor de crédito
|
|
@@ -170,6 +174,22 @@ export interface ILoanCreditBusinessApi {
|
|
|
170
174
|
tenantId: string,
|
|
171
175
|
): Promise<StandardResponse<LoanBorrowerResponse>>;
|
|
172
176
|
|
|
177
|
+
/**
|
|
178
|
+
* Puerta de los hechos del ciclo: el caller nombra el HECHO que ya ocurrió en su propio lambda
|
|
179
|
+
* (originación, enganche, firma, MDM, bienvenida) y el motor resuelve el momento, la plantilla,
|
|
180
|
+
* el canal y el texto. Se llama DESPUÉS de que el hecho quedó asentado.
|
|
181
|
+
*
|
|
182
|
+
* Responde `202` — el aviso es best-effort y no se promete entregado. `factReference` es solo
|
|
183
|
+
* trazabilidad hasta el hecho de origen: NO deduplica.
|
|
184
|
+
* `400 VALIDATION_ERROR` si el hecho está fuera del catálogo del motor o el `factReference`
|
|
185
|
+
* pasa los 120 caracteres o trae `#` / `~` · `400 UNKNOWN_TENANT`.
|
|
186
|
+
*/
|
|
187
|
+
notifyLifecycleFact(
|
|
188
|
+
creditId: string,
|
|
189
|
+
input: CreditLifecycleFactRequest,
|
|
190
|
+
tenantId: string,
|
|
191
|
+
): Promise<StandardResponse<CreditLifecycleFactResponse>>;
|
|
192
|
+
|
|
173
193
|
/**
|
|
174
194
|
* Devuelve UNA PÁGINA de candidatos a mensaje del `slot` y el día de tienda pedidos: la persona,
|
|
175
195
|
* el momento que le toca, el canal y las variables ya resueltas. El motor barre su cartera, aplica
|
package/src/loanCredit/index.ts
CHANGED