@fiado/api-invoker 5.70.0 → 5.71.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.
@@ -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, LoanBorrowerResponse, LoanCreditResponse, OriginateLoanCreditRequest, OriginateLoanCreditResponse, QuoteLoanCreditRequest, QuoteLoanCreditResponse, SignLoanCreditRequest, SignLoanCreditResponse, UpsertLoanBorrowerRequest } from "@fiado/type-kit/bin/loanCredit/index.js";
3
+ import { ActivationCheckRequest, ActivationCheckResponse, CreditPaymentAppliedRequest, CreditPaymentAppliedResponse, CreditSettledRequest, CreditSettledResponse, LoanBorrowerResponse, 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
6
  import { ILoanCreditBusinessApi } from "./interfaces/ILoanCreditBusinessApi.js";
@@ -23,6 +23,8 @@ export default class LoanCreditBusinessApi implements ILoanCreditBusinessApi {
23
23
  originate(input: OriginateLoanCreditRequest, tenantId: string): Promise<StandardResponse<OriginateLoanCreditResponse>>;
24
24
  quote(creditId: string, input: QuoteLoanCreditRequest, tenantId: string): Promise<StandardResponse<QuoteLoanCreditResponse>>;
25
25
  sign(creditId: string, input: SignLoanCreditRequest, tenantId: string): Promise<StandardResponse<SignLoanCreditResponse>>;
26
+ applyPayment(creditId: string, input: CreditPaymentAppliedRequest, tenantId: string): Promise<StandardResponse<CreditPaymentAppliedResponse>>;
27
+ settle(creditId: string, input: CreditSettledRequest, tenantId: string): Promise<StandardResponse<CreditSettledResponse>>;
26
28
  activateCheck(creditId: string, input: ActivationCheckRequest, tenantId: string): Promise<StandardResponse<ActivationCheckResponse>>;
27
29
  discard(creditId: string, tenantId: string): Promise<StandardResponse<LoanCreditResponse>>;
28
30
  getCredit(creditId: string, tenantId: string): Promise<StandardResponse<LoanCreditResponse>>;
@@ -42,6 +42,14 @@ let LoanCreditBusinessApi = class LoanCreditBusinessApi {
42
42
  const url = `${this.baseUrl}/private/credits/${encodeURIComponent(creditId)}/sign?tenantId=${encodeURIComponent(tenantId)}`;
43
43
  return await this.httpRequest.post(url, input);
44
44
  }
45
+ async applyPayment(creditId, input, tenantId) {
46
+ const url = `${this.baseUrl}/private/credits/${encodeURIComponent(creditId)}/payment-applied?tenantId=${encodeURIComponent(tenantId)}`;
47
+ return await this.httpRequest.post(url, input);
48
+ }
49
+ async settle(creditId, input, tenantId) {
50
+ const url = `${this.baseUrl}/private/credits/${encodeURIComponent(creditId)}/settled?tenantId=${encodeURIComponent(tenantId)}`;
51
+ return await this.httpRequest.post(url, input);
52
+ }
45
53
  async activateCheck(creditId, input, tenantId) {
46
54
  const url = `${this.baseUrl}/private/credits/${encodeURIComponent(creditId)}/activate-check?tenantId=${encodeURIComponent(tenantId)}`;
47
55
  return await this.httpRequest.post(url, input);
@@ -1,5 +1,5 @@
1
1
  import { StandardResponse } from "@fiado/gateway-adapter";
2
- import { ActivationCheckRequest, ActivationCheckResponse, LoanBorrowerResponse, LoanCreditResponse, OriginateLoanCreditRequest, OriginateLoanCreditResponse, QuoteLoanCreditRequest, QuoteLoanCreditResponse, SignLoanCreditRequest, SignLoanCreditResponse, UpsertLoanBorrowerRequest } from "@fiado/type-kit/bin/loanCredit/index.js";
2
+ import { ActivationCheckRequest, CreditPaymentAppliedRequest, CreditPaymentAppliedResponse, CreditSettledRequest, CreditSettledResponse, ActivationCheckResponse, LoanBorrowerResponse, 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
5
  /**
@@ -43,6 +43,18 @@ export interface ILoanCreditBusinessApi {
43
43
  * `imeiEnrolled`/`lockVerified` (paso 09, dispara el MDM vía abstracción). Con las 4 en `true`
44
44
  * el crédito pasa a `ACTIVE` (vencimientos +7d, ventana de cancelación 7d).
45
45
  */
46
+ /**
47
+ * Pago aplicado: cura la mora del crédito y suelta el equipo si el candado era el de la mora.
48
+ * El body es opcional. Un candado por fraude o manual NO se suelta pagando, y un pago que no
49
+ * alcanza el umbral escalonado deja el equipo bloqueado — el `unlockDecision` dice cuál fue.
50
+ */
51
+ applyPayment(creditId: string, input: CreditPaymentAppliedRequest, tenantId: string): Promise<StandardResponse<CreditPaymentAppliedResponse>>;
52
+ /**
53
+ * Liquidación: VERIFICA que el crédito no deba nada, lo pasa a `SETTLED` y libera el equipo.
54
+ * No le cree al caller — un plan incompleto o una cuota viva lo rechazan. La liberación es
55
+ * IRREVERSIBLE: el equipo sale del enrolamiento, no queda desbloqueado.
56
+ */
57
+ settle(creditId: string, input: CreditSettledRequest, tenantId: string): Promise<StandardResponse<CreditSettledResponse>>;
46
58
  activateCheck(creditId: string, input: ActivationCheckRequest, tenantId: string): Promise<StandardResponse<ActivationCheckResponse>>;
47
59
  /**
48
60
  * Descarta un crédito PENDING_ACTIVATION → DISCARDED (compensación del wizard al cancelar la
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@fiado/api-invoker",
3
- "version": "5.70.0",
3
+ "version": "5.71.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",
@@ -4,6 +4,10 @@ import { StandardResponse } from "@fiado/gateway-adapter";
4
4
  import {
5
5
  ActivationCheckRequest,
6
6
  ActivationCheckResponse,
7
+ CreditPaymentAppliedRequest,
8
+ CreditPaymentAppliedResponse,
9
+ CreditSettledRequest,
10
+ CreditSettledResponse,
7
11
  LoanBorrowerResponse,
8
12
  LoanCreditResponse,
9
13
  OriginateLoanCreditRequest,
@@ -66,6 +70,24 @@ export default class LoanCreditBusinessApi implements ILoanCreditBusinessApi {
66
70
  return await this.httpRequest.post(url, input);
67
71
  }
68
72
 
73
+ async applyPayment(
74
+ creditId: string,
75
+ input: CreditPaymentAppliedRequest,
76
+ tenantId: string,
77
+ ): Promise<StandardResponse<CreditPaymentAppliedResponse>> {
78
+ const url = `${this.baseUrl}/private/credits/${encodeURIComponent(creditId)}/payment-applied?tenantId=${encodeURIComponent(tenantId)}`;
79
+ return await this.httpRequest.post(url, input);
80
+ }
81
+
82
+ async settle(
83
+ creditId: string,
84
+ input: CreditSettledRequest,
85
+ tenantId: string,
86
+ ): Promise<StandardResponse<CreditSettledResponse>> {
87
+ const url = `${this.baseUrl}/private/credits/${encodeURIComponent(creditId)}/settled?tenantId=${encodeURIComponent(tenantId)}`;
88
+ return await this.httpRequest.post(url, input);
89
+ }
90
+
69
91
  async activateCheck(
70
92
  creditId: string,
71
93
  input: ActivationCheckRequest,
@@ -1,6 +1,10 @@
1
1
  import { StandardResponse } from "@fiado/gateway-adapter";
2
2
  import {
3
3
  ActivationCheckRequest,
4
+ CreditPaymentAppliedRequest,
5
+ CreditPaymentAppliedResponse,
6
+ CreditSettledRequest,
7
+ CreditSettledResponse,
4
8
  ActivationCheckResponse,
5
9
  LoanBorrowerResponse,
6
10
  LoanCreditResponse,
@@ -73,6 +77,28 @@ export interface ILoanCreditBusinessApi {
73
77
  * `imeiEnrolled`/`lockVerified` (paso 09, dispara el MDM vía abstracción). Con las 4 en `true`
74
78
  * el crédito pasa a `ACTIVE` (vencimientos +7d, ventana de cancelación 7d).
75
79
  */
80
+ /**
81
+ * Pago aplicado: cura la mora del crédito y suelta el equipo si el candado era el de la mora.
82
+ * El body es opcional. Un candado por fraude o manual NO se suelta pagando, y un pago que no
83
+ * alcanza el umbral escalonado deja el equipo bloqueado — el `unlockDecision` dice cuál fue.
84
+ */
85
+ applyPayment(
86
+ creditId: string,
87
+ input: CreditPaymentAppliedRequest,
88
+ tenantId: string,
89
+ ): Promise<StandardResponse<CreditPaymentAppliedResponse>>;
90
+
91
+ /**
92
+ * Liquidación: VERIFICA que el crédito no deba nada, lo pasa a `SETTLED` y libera el equipo.
93
+ * No le cree al caller — un plan incompleto o una cuota viva lo rechazan. La liberación es
94
+ * IRREVERSIBLE: el equipo sale del enrolamiento, no queda desbloqueado.
95
+ */
96
+ settle(
97
+ creditId: string,
98
+ input: CreditSettledRequest,
99
+ tenantId: string,
100
+ ): Promise<StandardResponse<CreditSettledResponse>>;
101
+
76
102
  activateCheck(
77
103
  creditId: string,
78
104
  input: ActivationCheckRequest,