@fiado/api-invoker 5.32.1 → 5.33.1

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.
Files changed (38) hide show
  1. package/bin/retailCustomer/api/RetailCustomerBusinessApi.d.ts +4 -3
  2. package/bin/retailCustomer/api/RetailCustomerBusinessApi.js +8 -4
  3. package/bin/retailCustomer/api/interfaces/IRetailCustomerBusinessApi.d.ts +30 -6
  4. package/bin/synergypay-connector/api/SynergyPayConnectorApi.d.ts +1 -0
  5. package/bin/synergypay-connector/api/SynergyPayConnectorApi.js +4 -0
  6. package/bin/synergypay-connector/api/interfaces/ISynergyPayConnectorApi.d.ts +13 -0
  7. package/bin/wallet-funding-rules/api/WalletFundingRulesApi.d.ts +1 -0
  8. package/bin/wallet-funding-rules/api/WalletFundingRulesApi.js +4 -0
  9. package/bin/wallet-funding-rules/api/interfaces/IWalletFundingRulesApi.d.ts +14 -0
  10. package/package.json +3 -3
  11. package/src/retailCustomer/api/RetailCustomerBusinessApi.ts +18 -4
  12. package/src/retailCustomer/api/interfaces/IRetailCustomerBusinessApi.ts +39 -5
  13. package/src/synergypay-connector/api/SynergyPayConnectorApi.ts +5 -0
  14. package/src/synergypay-connector/api/interfaces/ISynergyPayConnectorApi.ts +13 -0
  15. package/src/wallet-funding-rules/api/WalletFundingRulesApi.ts +5 -0
  16. package/src/wallet-funding-rules/api/interfaces/IWalletFundingRulesApi.ts +14 -0
  17. package/bin/membership/MembershipApi.d.ts +0 -12
  18. package/bin/membership/MembershipApi.js +0 -32
  19. package/bin/membership/index.d.ts +0 -2
  20. package/bin/membership/index.js +0 -2
  21. package/bin/membership/interfaces/IMembershipApi.d.ts +0 -15
  22. package/bin/membership/interfaces/IMembershipApi.js +0 -1
  23. package/bin/notificationWebsockets/NotificationWebsocketApi.d.ts +0 -12
  24. package/bin/notificationWebsockets/NotificationWebsocketApi.js +0 -32
  25. package/bin/notificationWebsockets/interfaces/INotificationWebsocketApi.d.ts +0 -15
  26. package/bin/notificationWebsockets/interfaces/INotificationWebsocketApi.js +0 -1
  27. package/bin/performance-profile/PerformanceProfileApi.d.ts +0 -12
  28. package/bin/performance-profile/PerformanceProfileApi.js +0 -32
  29. package/bin/performance-profile/index.d.ts +0 -2
  30. package/bin/performance-profile/index.js +0 -2
  31. package/bin/performance-profile/interfaces/IPerformanceProfileApi.d.ts +0 -15
  32. package/bin/performance-profile/interfaces/IPerformanceProfileApi.js +0 -1
  33. package/bin/presence-websocket/PresenceWebsocketApi.d.ts +0 -12
  34. package/bin/presence-websocket/PresenceWebsocketApi.js +0 -32
  35. package/bin/presence-websocket/index.d.ts +0 -2
  36. package/bin/presence-websocket/index.js +0 -2
  37. package/bin/presence-websocket/interfaces/IPresenceWebsocketApi.d.ts +0 -15
  38. package/bin/presence-websocket/interfaces/IPresenceWebsocketApi.js +0 -1
@@ -1,9 +1,9 @@
1
1
  import type { IHttpRequest } from "@fiado/http-client";
2
2
  import { StandardResponse } from "@fiado/gateway-adapter";
3
- import { UpsertCustomerFromKycRequest, AccountResultRequest, CustomerResponse } from "@fiado/type-kit/bin/retailCustomer/index.js";
3
+ import { UpsertCustomerFromKycRequest, AccountResultRequest, CustomerResponse, WelcomeAccreditationRequest, WelcomeAccreditationResponse, WelcomeAccreditationResultRequest, WelcomeBonusResponse } from "@fiado/type-kit/bin/retailCustomer/index.js";
4
4
  import { IRetailCustomerBusinessApi } from "./interfaces/IRetailCustomerBusinessApi.js";
5
5
  /**
6
- * Publisher HTTP del lambda `retail-customer-business` (SureKeep Fase 2, pista Retail) para sus 5
6
+ * Publisher HTTP del lambda `retail-customer-business` (SureKeep Fase 2, pista Retail) para sus 6
7
7
  * endpoints privados de cliente. Contrato y semántica completos → `IRetailCustomerBusinessApi`.
8
8
  *
9
9
  * Los paths y el `?tenantId=` matchean `openapi/private.yaml` del lambda destino (mismo patrón que
@@ -24,5 +24,6 @@ export default class RetailCustomerBusinessApi implements IRetailCustomerBusines
24
24
  setAccountResult(customerId: string, payload: AccountResultRequest, tenantId: string): Promise<StandardResponse<CustomerResponse>>;
25
25
  getCustomerByPhone(phone: string, tenantId: string): Promise<StandardResponse<CustomerResponse>>;
26
26
  getCustomer(customerId: string, tenantId: string): Promise<StandardResponse<CustomerResponse>>;
27
- markWelcomeAccredited(customerId: string, tenantId: string): Promise<StandardResponse<CustomerResponse>>;
27
+ markWelcomeAccredited(customerId: string, tenantId: string, payload?: WelcomeAccreditationRequest): Promise<StandardResponse<WelcomeAccreditationResponse>>;
28
+ setWelcomeAccreditationResult(customerId: string, payload: WelcomeAccreditationResultRequest, tenantId: string): Promise<StandardResponse<WelcomeBonusResponse>>;
28
29
  }
@@ -12,7 +12,7 @@ var __param = (this && this.__param) || function (paramIndex, decorator) {
12
12
  };
13
13
  import { inject, injectable } from "inversify";
14
14
  /**
15
- * Publisher HTTP del lambda `retail-customer-business` (SureKeep Fase 2, pista Retail) para sus 5
15
+ * Publisher HTTP del lambda `retail-customer-business` (SureKeep Fase 2, pista Retail) para sus 6
16
16
  * endpoints privados de cliente. Contrato y semántica completos → `IRetailCustomerBusinessApi`.
17
17
  *
18
18
  * Los paths y el `?tenantId=` matchean `openapi/private.yaml` del lambda destino (mismo patrón que
@@ -47,10 +47,14 @@ let RetailCustomerBusinessApi = class RetailCustomerBusinessApi {
47
47
  const url = `${this.baseUrl}/private/customers/${encodeURIComponent(customerId)}?tenantId=${encodeURIComponent(tenantId)}`;
48
48
  return await this.httpRequest.get(url);
49
49
  }
50
- async markWelcomeAccredited(customerId, tenantId) {
50
+ async markWelcomeAccredited(customerId, tenantId, payload) {
51
51
  const url = `${this.baseUrl}/private/customers/${encodeURIComponent(customerId)}/welcome-accreditation?tenantId=${encodeURIComponent(tenantId)}`;
52
- // Sin body: el cliente va en el path y el actor lo pone el destino desde el contexto privado.
53
- return await this.httpRequest.post(url, {});
52
+ // Body opcional: el actor lo pone el destino desde el contexto privado, no viaja en el payload.
53
+ return await this.httpRequest.post(url, payload ?? {});
54
+ }
55
+ async setWelcomeAccreditationResult(customerId, payload, tenantId) {
56
+ const url = `${this.baseUrl}/private/customers/${encodeURIComponent(customerId)}/welcome-accreditation/result?tenantId=${encodeURIComponent(tenantId)}`;
57
+ return await this.httpRequest.put(url, payload);
54
58
  }
55
59
  };
56
60
  RetailCustomerBusinessApi = __decorate([
@@ -1,15 +1,15 @@
1
1
  import { StandardResponse } from "@fiado/gateway-adapter";
2
- import { UpsertCustomerFromKycRequest, AccountResultRequest, CustomerResponse } from "@fiado/type-kit/bin/retailCustomer/index.js";
2
+ import { UpsertCustomerFromKycRequest, AccountResultRequest, CustomerResponse, WelcomeAccreditationRequest, WelcomeAccreditationResponse, WelcomeAccreditationResultRequest, WelcomeBonusResponse } from "@fiado/type-kit/bin/retailCustomer/index.js";
3
3
  /**
4
4
  * Contrato del publisher HTTP del lambda `retail-customer-business` (SureKeep Fase 2, pista Retail)
5
- * para sus 5 endpoints privados de cliente (service-to-service, VPC-only).
5
+ * para sus 6 endpoints privados de cliente (service-to-service, VPC-only).
6
6
  *
7
7
  * Consumidor previsto:
8
8
  * - `retail-wizard-business` → upsert del cliente post-KYC, aterrizaje del resultado de apertura
9
9
  * de cuenta (D35), y lecturas del cliente por teléfono / id durante la saga de venta.
10
10
  *
11
11
  * ─────────────────────────────────────────────────────────────────────────────
12
- * `tenantId` es OBLIGATORIO en los 5 métodos — no es un detalle de firma.
12
+ * `tenantId` es OBLIGATORIO en los 6 métodos — no es un detalle de firma.
13
13
  * ─────────────────────────────────────────────────────────────────────────────
14
14
  * Los privados NO llevan token de usuario (`Feature.ANONIMUS`; la protección es la red VPC), así que
15
15
  * el lambda destino no tiene `AuthContext.issuer` y NO puede inferir el silo. El caller declara el
@@ -75,7 +75,7 @@ export interface IRetailCustomerBusinessApi {
75
75
  getCustomer(customerId: string, tenantId: string): Promise<StandardResponse<CustomerResponse>>;
76
76
  /**
77
77
  * POST /private/customers/{customerId}/welcome-accreditation?tenantId= — RESERVA la acreditación
78
- * del bono de bienvenida (D33). Sin body: el cliente va en el path, el actor lo pone el destino.
78
+ * del bono de bienvenida (D33) y abre su asiento en el libro de bonos.
79
79
  *
80
80
  * ⚠️ Reserva, NO acredita. El lambda destino es dueño del flag `welcomeAccredited` y su transición
81
81
  * `false → true` es el candado de idempotencia PERMANENTE por cliente (una sola vez para siempre,
@@ -83,11 +83,35 @@ export interface IRetailCustomerBusinessApi {
83
83
  * concurrentes NO pueden ganar los dos.
84
84
  *
85
85
  * Orden obligatorio en el caller: reservar acá PRIMERO, mover plata en el processor DESPUÉS. Al
86
- * revés, un doble click acredita dos veces plata real.
86
+ * revés, un doble click acredita dos veces plata real. Después de mover plata, CERRAR el asiento
87
+ * con `setWelcomeAccreditationResult` — si no, el bono queda `PENDING` para siempre.
88
+ *
89
+ * El `payload` con los datos de la venta es OPCIONAL: sin él el asiento nace incompleto (tienda
90
+ * `UNKNOWN`) pero nace. La respuesta trae `bonus.bonusKey`, que es lo que pide el cierre.
87
91
  *
88
92
  * @throws `409 WELCOME_ALREADY_ACCREDITED` si el bono ya se entregó. Para el caller NO es falla:
89
93
  * es la señal de "no acredites" — la venta sigue su curso normal.
90
94
  * @throws `404 CUSTOMER_NOT_FOUND` si el cliente no existe.
95
+ * @throws `400 VALIDATION_ERROR` si el payload viene mal formado.
96
+ */
97
+ markWelcomeAccredited(customerId: string, tenantId: string, payload?: WelcomeAccreditationRequest): Promise<StandardResponse<WelcomeAccreditationResponse>>;
98
+ /**
99
+ * PUT /private/customers/{customerId}/welcome-accreditation/result?tenantId= — cierra el asiento
100
+ * con el resultado del processor (D33). El `bonusKey` sale de la respuesta de la reserva.
101
+ *
102
+ * `ACCREDITED` cierra con `processorTransactionId`. `FAILED` es un rechazo INEQUÍVOCO y libera el
103
+ * candado para que la venta se reintente. `UNVERIFIED` es un fallo AMBIGUO (timeout, 5xx) y lo
104
+ * deja tomado: el `walletFundingCredit` del processor no deduplica, así que liberarlo podría
105
+ * acreditar plata real dos veces. Un timeout se asienta `UNVERIFIED`, nunca `FAILED`.
106
+ *
107
+ * Reintentar el MISMO resultado es idempotente (200). Un asiento `UNVERIFIED` se cierra después
108
+ * con `ACCREDITED`/`FAILED` mandando además `reconciledBy` y `reconciliationReason`.
109
+ *
110
+ * @throws `409 WELCOME_BONUS_ALREADY_RESOLVED` si ya cerró con OTRO resultado: no reintentar,
111
+ * escalar — pisarlo borraría lo que de verdad pasó con la plata.
112
+ * @throws `422 WELCOME_BONUS_RECONCILIATION_REQUIRED` si se cierra un `UNVERIFIED` sin actor ni motivo.
113
+ * @throws `404 WELCOME_BONUS_NOT_FOUND` si ese cliente no tiene ese asiento.
114
+ * @throws `400 WELCOME_BONUS_KEY_INVALID` si el `bonusKey` no decodifica (bug del caller).
91
115
  */
92
- markWelcomeAccredited(customerId: string, tenantId: string): Promise<StandardResponse<CustomerResponse>>;
116
+ setWelcomeAccreditationResult(customerId: string, payload: WelcomeAccreditationResultRequest, tenantId: string): Promise<StandardResponse<WelcomeBonusResponse>>;
93
117
  }
@@ -14,4 +14,5 @@ export default class SynergyPayConnectorApi implements ISynergyPayConnectorApi {
14
14
  includeDisabled?: boolean;
15
15
  }): Promise<ApiGatewayResponse<ConnectorCatalogResponse>>;
16
16
  applyFunding(request: ApplyWalletFundingRequest): Promise<ApiGatewayResponse<ApplyWalletFundingResponse>>;
17
+ getPendingFunding(directoryId: string): Promise<ApiGatewayResponse<any>>;
17
18
  }
@@ -39,6 +39,10 @@ let SynergyPayConnectorApi = class SynergyPayConnectorApi {
39
39
  const url = `${this.baseUrl}/funding/apply`;
40
40
  return await this.httpRequest.post(url, request);
41
41
  }
42
+ async getPendingFunding(directoryId) {
43
+ const url = `${this.baseUrl}/funding/pending?directoryId=${encodeURIComponent(directoryId)}`;
44
+ return await this.httpRequest.get(url);
45
+ }
42
46
  };
43
47
  SynergyPayConnectorApi = __decorate([
44
48
  injectable(),
@@ -42,4 +42,17 @@ export interface ISynergyPayConnectorApi {
42
42
  * queda para el cierre SETTLED (conciliación bancaria) — mismo contrato canónico.
43
43
  */
44
44
  applyFunding(request: ApplyWalletFundingRequest): Promise<ApiGatewayResponse<ApplyWalletFundingResponse>>;
45
+ /**
46
+ * Cash-in AUTORIZADO pero aun no acreditado del cliente, en el mes en curso.
47
+ *
48
+ * Este dato existe SOLO en el connector: el settlement lleva el log por
49
+ * cliente pero unicamente de lo ya acreditado, porque la reserva de
50
+ * exposicion ocurre al acreditar y no al autorizar. Sin esto, en la ventana
51
+ * entre autorizar y acreditar el usuario veria un disponible inflado.
52
+ */
53
+ getPendingFunding(directoryId: string): Promise<ApiGatewayResponse<{
54
+ pendingAmount: number;
55
+ count: number;
56
+ currency: string;
57
+ }>>;
45
58
  }
@@ -9,4 +9,5 @@ export default class WalletFundingRulesApi implements IWalletFundingRulesApi {
9
9
  reserveExposure(request: ReserveExposureRequest): Promise<ApiGatewayResponse<ReserveExposureResponse>>;
10
10
  releaseExposure(request: ReleaseExposureRequest): Promise<ApiGatewayResponse<ReleaseExposureResponse>>;
11
11
  getExposureState(): Promise<ApiGatewayResponse<GetExposureStateResponse>>;
12
+ getCustomerLimit(directoryId: string): Promise<ApiGatewayResponse<any>>;
12
13
  }
@@ -29,6 +29,10 @@ let WalletFundingRulesApi = class WalletFundingRulesApi {
29
29
  const url = `${this.baseUrl}/state`;
30
30
  return await this.httpRequest.get(url);
31
31
  }
32
+ async getCustomerLimit(directoryId) {
33
+ const url = `${this.baseUrl}/customer-limit?directoryId=${encodeURIComponent(directoryId)}`;
34
+ return await this.httpRequest.get(url);
35
+ }
32
36
  };
33
37
  WalletFundingRulesApi = __decorate([
34
38
  injectable(),
@@ -20,4 +20,18 @@ export interface IWalletFundingRulesApi {
20
20
  releaseExposure(request: ReleaseExposureRequest): Promise<ApiGatewayResponse<ReleaseExposureResponse>>;
21
21
  /** Devuelve el estado actual de la exposición agregada + circuit breaker. */
22
22
  getExposureState(): Promise<ApiGatewayResponse<GetExposureStateResponse>>;
23
+ /**
24
+ * Tope mensual de cash-in de UN cliente: cuanto puede fondear todavia este
25
+ * mes por este canal.
26
+ *
27
+ * Devuelve SOLO lo acreditado. Los pendientes (autorizados sin acreditar)
28
+ * viven en la tabla de cada connector, porque la reserva de exposicion
29
+ * ocurre al acreditar y no al autorizar — los suma quien orquesta.
30
+ */
31
+ getCustomerLimit(directoryId: string): Promise<ApiGatewayResponse<{
32
+ monthlyLimit: number;
33
+ monthlyConsumed: number;
34
+ remainingAmount: number;
35
+ currency: string;
36
+ }>>;
23
37
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@fiado/api-invoker",
3
- "version": "5.32.1",
3
+ "version": "5.33.1",
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.9.0",
35
35
  "@fiado/http-client": "^2.0.1",
36
36
  "@fiado/logger": "^1.1.3",
37
- "@fiado/type-kit": "^3.316.0",
37
+ "@fiado/type-kit": "^3.319.0",
38
38
  "dotenv": "^16.4.7"
39
39
  },
40
40
  "peerDependencies": {
@@ -53,4 +53,4 @@
53
53
  "ts-jest": "^29.4.11",
54
54
  "typescript": "^6.0.3"
55
55
  }
56
- }
56
+ }
@@ -5,11 +5,15 @@ import {
5
5
  UpsertCustomerFromKycRequest,
6
6
  AccountResultRequest,
7
7
  CustomerResponse,
8
+ WelcomeAccreditationRequest,
9
+ WelcomeAccreditationResponse,
10
+ WelcomeAccreditationResultRequest,
11
+ WelcomeBonusResponse,
8
12
  } from "@fiado/type-kit/bin/retailCustomer/index.js";
9
13
  import { IRetailCustomerBusinessApi } from "./interfaces/IRetailCustomerBusinessApi.js";
10
14
 
11
15
  /**
12
- * Publisher HTTP del lambda `retail-customer-business` (SureKeep Fase 2, pista Retail) para sus 5
16
+ * Publisher HTTP del lambda `retail-customer-business` (SureKeep Fase 2, pista Retail) para sus 6
13
17
  * endpoints privados de cliente. Contrato y semántica completos → `IRetailCustomerBusinessApi`.
14
18
  *
15
19
  * Los paths y el `?tenantId=` matchean `openapi/private.yaml` del lambda destino (mismo patrón que
@@ -64,9 +68,19 @@ export default class RetailCustomerBusinessApi implements IRetailCustomerBusines
64
68
  async markWelcomeAccredited(
65
69
  customerId: string,
66
70
  tenantId: string,
67
- ): Promise<StandardResponse<CustomerResponse>> {
71
+ payload?: WelcomeAccreditationRequest,
72
+ ): Promise<StandardResponse<WelcomeAccreditationResponse>> {
68
73
  const url = `${this.baseUrl}/private/customers/${encodeURIComponent(customerId)}/welcome-accreditation?tenantId=${encodeURIComponent(tenantId)}`;
69
- // Sin body: el cliente va en el path y el actor lo pone el destino desde el contexto privado.
70
- return await this.httpRequest.post(url, {});
74
+ // Body opcional: el actor lo pone el destino desde el contexto privado, no viaja en el payload.
75
+ return await this.httpRequest.post(url, payload ?? {});
76
+ }
77
+
78
+ async setWelcomeAccreditationResult(
79
+ customerId: string,
80
+ payload: WelcomeAccreditationResultRequest,
81
+ tenantId: string,
82
+ ): Promise<StandardResponse<WelcomeBonusResponse>> {
83
+ const url = `${this.baseUrl}/private/customers/${encodeURIComponent(customerId)}/welcome-accreditation/result?tenantId=${encodeURIComponent(tenantId)}`;
84
+ return await this.httpRequest.put(url, payload);
71
85
  }
72
86
  }
@@ -3,18 +3,22 @@ import {
3
3
  UpsertCustomerFromKycRequest,
4
4
  AccountResultRequest,
5
5
  CustomerResponse,
6
+ WelcomeAccreditationRequest,
7
+ WelcomeAccreditationResponse,
8
+ WelcomeAccreditationResultRequest,
9
+ WelcomeBonusResponse,
6
10
  } from "@fiado/type-kit/bin/retailCustomer/index.js";
7
11
 
8
12
  /**
9
13
  * Contrato del publisher HTTP del lambda `retail-customer-business` (SureKeep Fase 2, pista Retail)
10
- * para sus 5 endpoints privados de cliente (service-to-service, VPC-only).
14
+ * para sus 6 endpoints privados de cliente (service-to-service, VPC-only).
11
15
  *
12
16
  * Consumidor previsto:
13
17
  * - `retail-wizard-business` → upsert del cliente post-KYC, aterrizaje del resultado de apertura
14
18
  * de cuenta (D35), y lecturas del cliente por teléfono / id durante la saga de venta.
15
19
  *
16
20
  * ─────────────────────────────────────────────────────────────────────────────
17
- * `tenantId` es OBLIGATORIO en los 5 métodos — no es un detalle de firma.
21
+ * `tenantId` es OBLIGATORIO en los 6 métodos — no es un detalle de firma.
18
22
  * ─────────────────────────────────────────────────────────────────────────────
19
23
  * Los privados NO llevan token de usuario (`Feature.ANONIMUS`; la protección es la red VPC), así que
20
24
  * el lambda destino no tiene `AuthContext.issuer` y NO puede inferir el silo. El caller declara el
@@ -97,7 +101,7 @@ export interface IRetailCustomerBusinessApi {
97
101
 
98
102
  /**
99
103
  * POST /private/customers/{customerId}/welcome-accreditation?tenantId= — RESERVA la acreditación
100
- * del bono de bienvenida (D33). Sin body: el cliente va en el path, el actor lo pone el destino.
104
+ * del bono de bienvenida (D33) y abre su asiento en el libro de bonos.
101
105
  *
102
106
  * ⚠️ Reserva, NO acredita. El lambda destino es dueño del flag `welcomeAccredited` y su transición
103
107
  * `false → true` es el candado de idempotencia PERMANENTE por cliente (una sola vez para siempre,
@@ -105,14 +109,44 @@ export interface IRetailCustomerBusinessApi {
105
109
  * concurrentes NO pueden ganar los dos.
106
110
  *
107
111
  * Orden obligatorio en el caller: reservar acá PRIMERO, mover plata en el processor DESPUÉS. Al
108
- * revés, un doble click acredita dos veces plata real.
112
+ * revés, un doble click acredita dos veces plata real. Después de mover plata, CERRAR el asiento
113
+ * con `setWelcomeAccreditationResult` — si no, el bono queda `PENDING` para siempre.
114
+ *
115
+ * El `payload` con los datos de la venta es OPCIONAL: sin él el asiento nace incompleto (tienda
116
+ * `UNKNOWN`) pero nace. La respuesta trae `bonus.bonusKey`, que es lo que pide el cierre.
109
117
  *
110
118
  * @throws `409 WELCOME_ALREADY_ACCREDITED` si el bono ya se entregó. Para el caller NO es falla:
111
119
  * es la señal de "no acredites" — la venta sigue su curso normal.
112
120
  * @throws `404 CUSTOMER_NOT_FOUND` si el cliente no existe.
121
+ * @throws `400 VALIDATION_ERROR` si el payload viene mal formado.
113
122
  */
114
123
  markWelcomeAccredited(
115
124
  customerId: string,
116
125
  tenantId: string,
117
- ): Promise<StandardResponse<CustomerResponse>>;
126
+ payload?: WelcomeAccreditationRequest,
127
+ ): Promise<StandardResponse<WelcomeAccreditationResponse>>;
128
+
129
+ /**
130
+ * PUT /private/customers/{customerId}/welcome-accreditation/result?tenantId= — cierra el asiento
131
+ * con el resultado del processor (D33). El `bonusKey` sale de la respuesta de la reserva.
132
+ *
133
+ * `ACCREDITED` cierra con `processorTransactionId`. `FAILED` es un rechazo INEQUÍVOCO y libera el
134
+ * candado para que la venta se reintente. `UNVERIFIED` es un fallo AMBIGUO (timeout, 5xx) y lo
135
+ * deja tomado: el `walletFundingCredit` del processor no deduplica, así que liberarlo podría
136
+ * acreditar plata real dos veces. Un timeout se asienta `UNVERIFIED`, nunca `FAILED`.
137
+ *
138
+ * Reintentar el MISMO resultado es idempotente (200). Un asiento `UNVERIFIED` se cierra después
139
+ * con `ACCREDITED`/`FAILED` mandando además `reconciledBy` y `reconciliationReason`.
140
+ *
141
+ * @throws `409 WELCOME_BONUS_ALREADY_RESOLVED` si ya cerró con OTRO resultado: no reintentar,
142
+ * escalar — pisarlo borraría lo que de verdad pasó con la plata.
143
+ * @throws `422 WELCOME_BONUS_RECONCILIATION_REQUIRED` si se cierra un `UNVERIFIED` sin actor ni motivo.
144
+ * @throws `404 WELCOME_BONUS_NOT_FOUND` si ese cliente no tiene ese asiento.
145
+ * @throws `400 WELCOME_BONUS_KEY_INVALID` si el `bonusKey` no decodifica (bug del caller).
146
+ */
147
+ setWelcomeAccreditationResult(
148
+ customerId: string,
149
+ payload: WelcomeAccreditationResultRequest,
150
+ tenantId: string,
151
+ ): Promise<StandardResponse<WelcomeBonusResponse>>;
118
152
  }
@@ -49,4 +49,9 @@ export default class SynergyPayConnectorApi implements ISynergyPayConnectorApi {
49
49
  const url = `${this.baseUrl}/funding/apply`;
50
50
  return await this.httpRequest.post(url, request);
51
51
  }
52
+
53
+ async getPendingFunding(directoryId: string): Promise<ApiGatewayResponse<any>> {
54
+ const url = `${this.baseUrl}/funding/pending?directoryId=${encodeURIComponent(directoryId)}`;
55
+ return await this.httpRequest.get(url);
56
+ }
52
57
  }
@@ -58,4 +58,17 @@ export interface ISynergyPayConnectorApi {
58
58
  applyFunding(
59
59
  request: ApplyWalletFundingRequest,
60
60
  ): Promise<ApiGatewayResponse<ApplyWalletFundingResponse>>;
61
+ /**
62
+ * Cash-in AUTORIZADO pero aun no acreditado del cliente, en el mes en curso.
63
+ *
64
+ * Este dato existe SOLO en el connector: el settlement lleva el log por
65
+ * cliente pero unicamente de lo ya acreditado, porque la reserva de
66
+ * exposicion ocurre al acreditar y no al autorizar. Sin esto, en la ventana
67
+ * entre autorizar y acreditar el usuario veria un disponible inflado.
68
+ */
69
+ getPendingFunding(directoryId: string): Promise<ApiGatewayResponse<{
70
+ pendingAmount: number;
71
+ count: number;
72
+ currency: string;
73
+ }>>;
61
74
  }
@@ -34,4 +34,9 @@ export default class WalletFundingRulesApi implements IWalletFundingRulesApi {
34
34
  const url = `${this.baseUrl}/state`;
35
35
  return await this.httpRequest.get(url);
36
36
  }
37
+
38
+ async getCustomerLimit(directoryId: string): Promise<ApiGatewayResponse<any>> {
39
+ const url = `${this.baseUrl}/customer-limit?directoryId=${encodeURIComponent(directoryId)}`;
40
+ return await this.httpRequest.get(url);
41
+ }
37
42
  }
@@ -33,4 +33,18 @@ export interface IWalletFundingRulesApi {
33
33
 
34
34
  /** Devuelve el estado actual de la exposición agregada + circuit breaker. */
35
35
  getExposureState(): Promise<ApiGatewayResponse<GetExposureStateResponse>>;
36
+ /**
37
+ * Tope mensual de cash-in de UN cliente: cuanto puede fondear todavia este
38
+ * mes por este canal.
39
+ *
40
+ * Devuelve SOLO lo acreditado. Los pendientes (autorizados sin acreditar)
41
+ * viven en la tabla de cada connector, porque la reserva de exposicion
42
+ * ocurre al acreditar y no al autorizar — los suma quien orquesta.
43
+ */
44
+ getCustomerLimit(directoryId: string): Promise<ApiGatewayResponse<{
45
+ monthlyLimit: number;
46
+ monthlyConsumed: number;
47
+ remainingAmount: number;
48
+ currency: string;
49
+ }>>;
36
50
  }
@@ -1,12 +0,0 @@
1
- import { IHttpRequest } from "@fiado/http-client";
2
- import { IMembershipApi } from "./interfaces/IMembershipApi.js";
3
- type FiadoApiResponse<T> = import("@fiado/type-kit/bin/apiResponse/dtos/FiadoApiResponse.js").default<T>;
4
- export declare class MembershipApi implements IMembershipApi {
5
- private httpRequest;
6
- private readonly baseUrl;
7
- constructor(httpRequest: IHttpRequest);
8
- deleteByDirectoryId(directoryId: string): Promise<FiadoApiResponse<{
9
- deletedCount: number;
10
- }>>;
11
- }
12
- export {};
@@ -1,32 +0,0 @@
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
- import dotenv from 'dotenv';
15
- dotenv.config();
16
- let MembershipApi = class MembershipApi {
17
- httpRequest;
18
- baseUrl = process.env.MEMBERSHIP_BUSINESS_LAMBDA_URL || "";
19
- constructor(httpRequest) {
20
- this.httpRequest = httpRequest;
21
- }
22
- async deleteByDirectoryId(directoryId) {
23
- const url = `${this.baseUrl}private/directory/${directoryId}`;
24
- return await this.httpRequest.delete(url);
25
- }
26
- };
27
- MembershipApi = __decorate([
28
- injectable(),
29
- __param(0, inject("IHttpRequest")),
30
- __metadata("design:paramtypes", [Object])
31
- ], MembershipApi);
32
- export { MembershipApi };
@@ -1,2 +0,0 @@
1
- export * from './interfaces/IMembershipApi.js';
2
- export * from './MembershipApi.js';
@@ -1,2 +0,0 @@
1
- export * from './interfaces/IMembershipApi.js';
2
- export * from './MembershipApi.js';
@@ -1,15 +0,0 @@
1
- type FiadoApiResponse<T> = import("@fiado/type-kit/bin/apiResponse/dtos/FiadoApiResponse.js").default<T>;
2
- /**
3
- * Interfaz para el servicio Membership (membership-business).
4
- */
5
- export interface IMembershipApi {
6
- /**
7
- * Borra en cascada las membresías asociadas a un directoryId.
8
- * @param directoryId ID del directorio.
9
- * @throws {Error} Lanza un error si los parámetros de entrada son inválidos.
10
- */
11
- deleteByDirectoryId(directoryId: string): Promise<FiadoApiResponse<{
12
- deletedCount: number;
13
- }>>;
14
- }
15
- export {};
@@ -1 +0,0 @@
1
- export {};
@@ -1,12 +0,0 @@
1
- import { IHttpRequest } from "@fiado/http-client";
2
- import { INotificationWebsocketApi } from "./interfaces/INotificationWebsocketApi.js";
3
- type FiadoApiResponse<T> = import("@fiado/type-kit/bin/apiResponse/dtos/FiadoApiResponse.js").default<T>;
4
- export declare class NotificationWebsocketApi implements INotificationWebsocketApi {
5
- private httpRequest;
6
- private readonly baseUrl;
7
- constructor(httpRequest: IHttpRequest);
8
- deleteByDirectoryId(directoryId: string): Promise<FiadoApiResponse<{
9
- deletedCount: number;
10
- }>>;
11
- }
12
- export {};
@@ -1,32 +0,0 @@
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
- import dotenv from 'dotenv';
15
- dotenv.config();
16
- let NotificationWebsocketApi = class NotificationWebsocketApi {
17
- httpRequest;
18
- baseUrl = process.env.NOTIFICATIONS_WEBSOCKET_LAMBDA_URL || "";
19
- constructor(httpRequest) {
20
- this.httpRequest = httpRequest;
21
- }
22
- async deleteByDirectoryId(directoryId) {
23
- const url = `${this.baseUrl}private/directory/${directoryId}`;
24
- return await this.httpRequest.delete(url);
25
- }
26
- };
27
- NotificationWebsocketApi = __decorate([
28
- injectable(),
29
- __param(0, inject("IHttpRequest")),
30
- __metadata("design:paramtypes", [Object])
31
- ], NotificationWebsocketApi);
32
- export { NotificationWebsocketApi };
@@ -1,15 +0,0 @@
1
- type FiadoApiResponse<T> = import("@fiado/type-kit/bin/apiResponse/dtos/FiadoApiResponse.js").default<T>;
2
- /**
3
- * Interfaz para el servicio Notifications Websocket (notifications-websocket).
4
- */
5
- export interface INotificationWebsocketApi {
6
- /**
7
- * Borra en cascada las conexiones/notificaciones WS asociadas a un directoryId.
8
- * @param directoryId ID del directorio.
9
- * @throws {Error} Lanza un error si los parámetros de entrada son inválidos.
10
- */
11
- deleteByDirectoryId(directoryId: string): Promise<FiadoApiResponse<{
12
- deletedCount: number;
13
- }>>;
14
- }
15
- export {};
@@ -1,12 +0,0 @@
1
- import { IHttpRequest } from "@fiado/http-client";
2
- import { IPerformanceProfileApi } from "./interfaces/IPerformanceProfileApi.js";
3
- type FiadoApiResponse<T> = import("@fiado/type-kit/bin/apiResponse/dtos/FiadoApiResponse.js").default<T>;
4
- export declare class PerformanceProfileApi implements IPerformanceProfileApi {
5
- private httpRequest;
6
- private readonly baseUrl;
7
- constructor(httpRequest: IHttpRequest);
8
- deleteByDirectoryId(directoryId: string): Promise<FiadoApiResponse<{
9
- deletedCount: number;
10
- }>>;
11
- }
12
- export {};
@@ -1,32 +0,0 @@
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
- import dotenv from 'dotenv';
15
- dotenv.config();
16
- let PerformanceProfileApi = class PerformanceProfileApi {
17
- httpRequest;
18
- baseUrl = process.env.PERFORMANCE_PROFILE_BUSINESS_LAMBDA_URL || "";
19
- constructor(httpRequest) {
20
- this.httpRequest = httpRequest;
21
- }
22
- async deleteByDirectoryId(directoryId) {
23
- const url = `${this.baseUrl}private/directory/${directoryId}`;
24
- return await this.httpRequest.delete(url);
25
- }
26
- };
27
- PerformanceProfileApi = __decorate([
28
- injectable(),
29
- __param(0, inject("IHttpRequest")),
30
- __metadata("design:paramtypes", [Object])
31
- ], PerformanceProfileApi);
32
- export { PerformanceProfileApi };
@@ -1,2 +0,0 @@
1
- export * from './interfaces/IPerformanceProfileApi.js';
2
- export * from './PerformanceProfileApi.js';
@@ -1,2 +0,0 @@
1
- export * from './interfaces/IPerformanceProfileApi.js';
2
- export * from './PerformanceProfileApi.js';
@@ -1,15 +0,0 @@
1
- type FiadoApiResponse<T> = import("@fiado/type-kit/bin/apiResponse/dtos/FiadoApiResponse.js").default<T>;
2
- /**
3
- * Interfaz para el servicio Performance Profile (performance-profile-business).
4
- */
5
- export interface IPerformanceProfileApi {
6
- /**
7
- * Borra en cascada los perfiles de desempeño asociados a un directoryId.
8
- * @param directoryId ID del directorio.
9
- * @throws {Error} Lanza un error si los parámetros de entrada son inválidos.
10
- */
11
- deleteByDirectoryId(directoryId: string): Promise<FiadoApiResponse<{
12
- deletedCount: number;
13
- }>>;
14
- }
15
- export {};
@@ -1,12 +0,0 @@
1
- import { IHttpRequest } from "@fiado/http-client";
2
- import { IPresenceWebsocketApi } from "./interfaces/IPresenceWebsocketApi.js";
3
- type FiadoApiResponse<T> = import("@fiado/type-kit/bin/apiResponse/dtos/FiadoApiResponse.js").default<T>;
4
- export declare class PresenceWebsocketApi implements IPresenceWebsocketApi {
5
- private httpRequest;
6
- private readonly baseUrl;
7
- constructor(httpRequest: IHttpRequest);
8
- deleteByDirectoryId(directoryId: string): Promise<FiadoApiResponse<{
9
- deletedCount: number;
10
- }>>;
11
- }
12
- export {};
@@ -1,32 +0,0 @@
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
- import dotenv from 'dotenv';
15
- dotenv.config();
16
- let PresenceWebsocketApi = class PresenceWebsocketApi {
17
- httpRequest;
18
- baseUrl = process.env.PRESENCE_WEBSOCKET_LAMBDA_URL || "";
19
- constructor(httpRequest) {
20
- this.httpRequest = httpRequest;
21
- }
22
- async deleteByDirectoryId(directoryId) {
23
- const url = `${this.baseUrl}private/directory/${directoryId}`;
24
- return await this.httpRequest.delete(url);
25
- }
26
- };
27
- PresenceWebsocketApi = __decorate([
28
- injectable(),
29
- __param(0, inject("IHttpRequest")),
30
- __metadata("design:paramtypes", [Object])
31
- ], PresenceWebsocketApi);
32
- export { PresenceWebsocketApi };
@@ -1,2 +0,0 @@
1
- export * from './interfaces/IPresenceWebsocketApi.js';
2
- export * from './PresenceWebsocketApi.js';
@@ -1,2 +0,0 @@
1
- export * from './interfaces/IPresenceWebsocketApi.js';
2
- export * from './PresenceWebsocketApi.js';
@@ -1,15 +0,0 @@
1
- type FiadoApiResponse<T> = import("@fiado/type-kit/bin/apiResponse/dtos/FiadoApiResponse.js").default<T>;
2
- /**
3
- * Interfaz para el servicio Presence Websocket (presence-websocket).
4
- */
5
- export interface IPresenceWebsocketApi {
6
- /**
7
- * Borra en cascada los registros de presencia asociados a un directoryId.
8
- * @param directoryId ID del directorio.
9
- * @throws {Error} Lanza un error si los parámetros de entrada son inválidos.
10
- */
11
- deleteByDirectoryId(directoryId: string): Promise<FiadoApiResponse<{
12
- deletedCount: number;
13
- }>>;
14
- }
15
- export {};