@fiado/api-invoker 4.68.0 → 4.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.
Files changed (118) hide show
  1. package/bin/activity-business/ActivityApi.d.ts +5 -0
  2. package/bin/activity-business/ActivityApi.js +4 -0
  3. package/bin/activity-business/interfaces/IActivityApi.d.ts +10 -0
  4. package/bin/address/AddressApi.d.ts +5 -0
  5. package/bin/address/AddressApi.js +4 -0
  6. package/bin/address/interfaces/IAddressApi.d.ts +10 -0
  7. package/bin/auth-business/AuthBusinessApi.d.ts +12 -0
  8. package/bin/auth-business/AuthBusinessApi.js +32 -0
  9. package/bin/auth-business/index.d.ts +2 -0
  10. package/bin/auth-business/index.js +2 -0
  11. package/bin/auth-business/interfaces/IAuthBusinessApi.d.ts +15 -0
  12. package/bin/auth-business/interfaces/IAuthBusinessApi.js +1 -0
  13. package/bin/bankAccount/BankAccountApi.d.ts +3 -0
  14. package/bin/bankAccount/BankAccountApi.js +4 -0
  15. package/bin/bankAccount/interfaces/IBankAccountApi.d.ts +10 -0
  16. package/bin/beneficiary/BeneficiaryApi.d.ts +12 -0
  17. package/bin/beneficiary/BeneficiaryApi.js +32 -0
  18. package/bin/beneficiary/index.d.ts +2 -0
  19. package/bin/beneficiary/index.js +2 -0
  20. package/bin/beneficiary/interfaces/IBeneficiaryApi.d.ts +15 -0
  21. package/bin/beneficiary/interfaces/IBeneficiaryApi.js +1 -0
  22. package/bin/contactInformation/ContactInformationApi.d.ts +5 -0
  23. package/bin/contactInformation/ContactInformationApi.js +4 -0
  24. package/bin/contactInformation/interface/IContactInformationApi.d.ts +10 -0
  25. package/bin/container.config.js +15 -0
  26. package/bin/directorySetting/DirectorySettingApi.d.ts +3 -0
  27. package/bin/directorySetting/DirectorySettingApi.js +4 -0
  28. package/bin/directorySetting/interfaces/IDirectorySettingApi.d.ts +8 -0
  29. package/bin/group/GroupApi.d.ts +3 -0
  30. package/bin/group/GroupApi.js +4 -0
  31. package/bin/group/interfaces/IGroupApi.d.ts +8 -0
  32. package/bin/index.d.ts +8 -0
  33. package/bin/index.js +8 -0
  34. package/bin/membership/MembershipApi.d.ts +12 -0
  35. package/bin/membership/MembershipApi.js +32 -0
  36. package/bin/membership/index.d.ts +2 -0
  37. package/bin/membership/index.js +2 -0
  38. package/bin/membership/interfaces/IMembershipApi.d.ts +15 -0
  39. package/bin/membership/interfaces/IMembershipApi.js +1 -0
  40. package/bin/notificationWebsockets/NotificationWebsocketApi.d.ts +12 -0
  41. package/bin/notificationWebsockets/NotificationWebsocketApi.js +32 -0
  42. package/bin/notificationWebsockets/index.d.ts +2 -0
  43. package/bin/notificationWebsockets/index.js +2 -0
  44. package/bin/notificationWebsockets/interfaces/INotificationWebsocketApi.d.ts +15 -0
  45. package/bin/notificationWebsockets/interfaces/INotificationWebsocketApi.js +1 -0
  46. package/bin/performance-profile/PerformanceProfileApi.d.ts +12 -0
  47. package/bin/performance-profile/PerformanceProfileApi.js +32 -0
  48. package/bin/performance-profile/index.d.ts +2 -0
  49. package/bin/performance-profile/index.js +2 -0
  50. package/bin/performance-profile/interfaces/IPerformanceProfileApi.d.ts +15 -0
  51. package/bin/performance-profile/interfaces/IPerformanceProfileApi.js +1 -0
  52. package/bin/places-business/api/PlacesBusinessApi.d.ts +12 -0
  53. package/bin/places-business/api/PlacesBusinessApi.js +32 -0
  54. package/bin/places-business/api/interfaces/IPlacesBusinessApi.d.ts +9 -0
  55. package/bin/places-business/api/interfaces/IPlacesBusinessApi.js +1 -0
  56. package/bin/places-business/index.d.ts +2 -0
  57. package/bin/places-business/index.js +2 -0
  58. package/bin/presence-websocket/PresenceWebsocketApi.d.ts +12 -0
  59. package/bin/presence-websocket/PresenceWebsocketApi.js +32 -0
  60. package/bin/presence-websocket/index.d.ts +2 -0
  61. package/bin/presence-websocket/index.js +2 -0
  62. package/bin/presence-websocket/interfaces/IPresenceWebsocketApi.d.ts +15 -0
  63. package/bin/presence-websocket/interfaces/IPresenceWebsocketApi.js +1 -0
  64. package/bin/retailCustomer/api/RetailCustomerBusinessApi.d.ts +27 -0
  65. package/bin/retailCustomer/api/RetailCustomerBusinessApi.js +56 -0
  66. package/bin/retailCustomer/api/interfaces/IRetailCustomerBusinessApi.d.ts +76 -0
  67. package/bin/retailCustomer/api/interfaces/IRetailCustomerBusinessApi.js +1 -0
  68. package/bin/retailCustomer/index.d.ts +2 -0
  69. package/bin/retailCustomer/index.js +2 -0
  70. package/bin/riskProfile/api/RiskProfileApi.d.ts +4 -0
  71. package/bin/riskProfile/api/RiskProfileApi.js +4 -0
  72. package/bin/riskProfile/api/interfaces/IRiskProfileApi.d.ts +9 -0
  73. package/bin/zendesk/ZendeskApi.d.ts +3 -0
  74. package/bin/zendesk/ZendeskApi.js +4 -0
  75. package/bin/zendesk/interfaces/IZendeskApi.d.ts +8 -0
  76. package/package.json +2 -2
  77. package/src/activity-business/ActivityApi.ts +6 -0
  78. package/src/activity-business/interfaces/IActivityApi.ts +9 -1
  79. package/src/address/AddressApi.ts +6 -0
  80. package/src/address/interfaces/IAddressApi.ts +10 -1
  81. package/src/auth-business/AuthBusinessApi.ts +20 -0
  82. package/src/auth-business/index.ts +2 -0
  83. package/src/auth-business/interfaces/IAuthBusinessApi.ts +15 -0
  84. package/src/bankAccount/BankAccountApi.ts +5 -0
  85. package/src/bankAccount/interfaces/IBankAccountApi.ts +10 -0
  86. package/src/beneficiary/BeneficiaryApi.ts +20 -0
  87. package/src/beneficiary/index.ts +2 -0
  88. package/src/beneficiary/interfaces/IBeneficiaryApi.ts +15 -0
  89. package/src/contactInformation/ContactInformationApi.ts +6 -0
  90. package/src/contactInformation/interface/IContactInformationApi.ts +10 -1
  91. package/src/container.config.ts +17 -0
  92. package/src/directorySetting/DirectorySettingApi.ts +5 -0
  93. package/src/directorySetting/interfaces/IDirectorySettingApi.ts +8 -1
  94. package/src/group/GroupApi.ts +5 -0
  95. package/src/group/interfaces/IGroupApi.ts +8 -0
  96. package/src/index.ts +8 -0
  97. package/src/membership/MembershipApi.ts +20 -0
  98. package/src/membership/index.ts +2 -0
  99. package/src/membership/interfaces/IMembershipApi.ts +15 -0
  100. package/src/notificationWebsockets/NotificationWebsocketApi.ts +20 -0
  101. package/src/notificationWebsockets/index.ts +3 -1
  102. package/src/notificationWebsockets/interfaces/INotificationWebsocketApi.ts +15 -0
  103. package/src/performance-profile/PerformanceProfileApi.ts +20 -0
  104. package/src/performance-profile/index.ts +2 -0
  105. package/src/performance-profile/interfaces/IPerformanceProfileApi.ts +15 -0
  106. package/src/places-business/api/PlacesBusinessApi.ts +22 -0
  107. package/src/places-business/api/interfaces/IPlacesBusinessApi.ts +9 -0
  108. package/src/places-business/index.ts +2 -0
  109. package/src/presence-websocket/PresenceWebsocketApi.ts +20 -0
  110. package/src/presence-websocket/index.ts +2 -0
  111. package/src/presence-websocket/interfaces/IPresenceWebsocketApi.ts +15 -0
  112. package/src/retailCustomer/api/RetailCustomerBusinessApi.ts +63 -0
  113. package/src/retailCustomer/api/interfaces/IRetailCustomerBusinessApi.ts +97 -0
  114. package/src/retailCustomer/index.ts +2 -0
  115. package/src/riskProfile/api/RiskProfileApi.ts +6 -0
  116. package/src/riskProfile/api/interfaces/IRiskProfileApi.ts +9 -0
  117. package/src/zendesk/ZendeskApi.ts +5 -0
  118. package/src/zendesk/interfaces/IZendeskApi.ts +8 -0
@@ -0,0 +1,97 @@
1
+ import { StandardResponse } from "@fiado/gateway-adapter";
2
+ import {
3
+ UpsertCustomerFromKycRequest,
4
+ AccountResultRequest,
5
+ CustomerResponse,
6
+ } from "@fiado/type-kit/bin/retailCustomer/index.js";
7
+
8
+ /**
9
+ * Contrato del publisher HTTP del lambda `retail-customer-business` (SureKeep Fase 2, pista Retail)
10
+ * para sus 4 endpoints privados de cliente (service-to-service, VPC-only).
11
+ *
12
+ * Consumidor previsto:
13
+ * - `retail-wizard-business` → upsert del cliente post-KYC, aterrizaje del resultado de apertura
14
+ * de cuenta (D35), y lecturas del cliente por teléfono / id durante la saga de venta.
15
+ *
16
+ * ─────────────────────────────────────────────────────────────────────────────
17
+ * `tenantId` es OBLIGATORIO en los 4 métodos — no es un detalle de firma.
18
+ * ─────────────────────────────────────────────────────────────────────────────
19
+ * Los privados NO llevan token de usuario (`Feature.ANONIMUS`; la protección es la red VPC), así que
20
+ * el lambda destino no tiene `AuthContext.issuer` y NO puede inferir el silo. El caller declara el
21
+ * tenant explícito por query (`?tenantId=`) y `@fiado/tenant-context` (`withContextByTenantId`) asume
22
+ * el rol de ESE silo. Sin `tenantId` → `400 UNKNOWN_TENANT` (fail-closed). Nunca hay default: caer a un
23
+ * tenant por default sería fail-OPEN y podría devolver datos de otra SOFOM.
24
+ *
25
+ * ⚠️ `tenantId` = el tenant CANÓNICO (p.ej. `'surekeep'`), NO el issuer Cognito ni la URL del pool.
26
+ * Es el mismo valor que consume `retail-org-business` en sus privados (`withContextByTenantId`).
27
+ *
28
+ * ─────────────────────────────────────────────────────────────────────────────
29
+ * ⚠️ Patrón de retorno: `StandardResponse<T>` — el consumer accede `result.data`, NO `result.body`.
30
+ * ─────────────────────────────────────────────────────────────────────────────
31
+ * `@fiado/http-client` entrega el BODY PELADO (hace `return response.data` en `AxiosHttpRequest`), así
32
+ * que `.statusCode`/`.body` no existen en runtime. El envelope real del lambda destino es
33
+ * `{ code, date, data, msg, description }` = `StandardResponse<T>` (ya exportado por
34
+ * `@fiado/gateway-adapter`). El consumer lee el shape del cliente en `result.data`.
35
+ *
36
+ * Errores: el lambda destino lanza `DomainError` tipado → el publisher RECHAZA (no devuelve null).
37
+ * Cada consumer mapea a su propio error de dominio (ver `fiado-api-invoker § 6`):
38
+ * `404 CUSTOMER_NOT_FOUND` (por id / por teléfono inexistente)
39
+ * `400 UNKNOWN_TENANT` (tenantId ausente o desconocido)
40
+ *
41
+ * Env var requerida en el consumer: `RETAIL_CUSTOMER_BUSINESS_URL`.
42
+ * El template.yml del consumer la setea con:
43
+ *
44
+ * RETAIL_CUSTOMER_BUSINESS_URL: '{{resolve:ssm:retail-customer-business}}'
45
+ *
46
+ * Convención CLAUDE.md global: SSM key = nombre del lambda owner de la URL.
47
+ */
48
+ export interface IRetailCustomerBusinessApi {
49
+ /**
50
+ * POST /private/customers/upsert-from-kyc?tenantId= — upsert idempotente del cliente tras el KYC
51
+ * (paso 02f). El lambda resuelve UNIQ#PHONE + UNIQ#CURP en la misma TX y setea
52
+ * `accountStatus=OPENING` server-side (la apertura corre en background, D35). Responde `201`.
53
+ *
54
+ * NOTA (TD-014 del customer): el `address` del type-kit tipa el `AddressBase` canónico (pesado);
55
+ * el lambda valida con un DTO local ligero. El domicilio OCR-parcial se salda con `RetailAddress`
56
+ * aditivo al type-kit (backlog) — no acá.
57
+ */
58
+ upsertCustomerFromKyc(
59
+ payload: UpsertCustomerFromKycRequest,
60
+ tenantId: string,
61
+ ): Promise<StandardResponse<CustomerResponse>>;
62
+
63
+ /**
64
+ * PUT /private/customers/{customerId}/account-result?tenantId= — aterriza el resultado terminal de
65
+ * la apertura de cuenta async (D35). Solo acepta OPEN/FAILED (nunca el intermedio OPENING). OPEN
66
+ * llega con `pcfClabe`/`pcfAccountLevel`; FAILED con `failReason`.
67
+ *
68
+ * @throws si el cliente no existe (`404 CUSTOMER_NOT_FOUND`).
69
+ */
70
+ setAccountResult(
71
+ customerId: string,
72
+ payload: AccountResultRequest,
73
+ tenantId: string,
74
+ ): Promise<StandardResponse<CustomerResponse>>;
75
+
76
+ /**
77
+ * GET /private/customers/by-phone/{phone}?tenantId= — resuelve el cliente por su teléfono MX (10
78
+ * dígitos, ya normalizado sin separadores). Usado por el wizard para saber si el teléfono ya es
79
+ * cliente del silo.
80
+ *
81
+ * @throws si no hay cliente con ese teléfono (`404 CUSTOMER_NOT_FOUND`).
82
+ */
83
+ getCustomerByPhone(
84
+ phone: string,
85
+ tenantId: string,
86
+ ): Promise<StandardResponse<CustomerResponse>>;
87
+
88
+ /**
89
+ * GET /private/customers/{customerId}?tenantId= — resuelve el cliente por su id.
90
+ *
91
+ * @throws si el cliente no existe (`404 CUSTOMER_NOT_FOUND`).
92
+ */
93
+ getCustomer(
94
+ customerId: string,
95
+ tenantId: string,
96
+ ): Promise<StandardResponse<CustomerResponse>>;
97
+ }
@@ -0,0 +1,2 @@
1
+ export * from "./api/interfaces/IRetailCustomerBusinessApi.js";
2
+ export { default as RetailCustomerBusinessApi } from "./api/RetailCustomerBusinessApi.js";
@@ -5,6 +5,7 @@ import {CreatePrivateAlarm, CreateRiskProfileRequest} from "@fiado/type-kit/bin/
5
5
  type UpdateRiskProfileRequest = import("@fiado/type-kit/bin/riskProfile/dtos/UpdateRiskProfileRequest.js").default;
6
6
  type UpdateAlarmProfileRequest = import("@fiado/type-kit/bin/riskProfile/dtos/UpdateAlarmProfileRequest.js").default;
7
7
  import { ResponseOptions } from "@fiado/gateway-adapter";
8
+ type FiadoApiResponse<T> = import("@fiado/type-kit/bin/apiResponse/dtos/FiadoApiResponse.js").default<T>;
8
9
  import {
9
10
  SetCustomAlarmRequest,
10
11
  SetCustomAlarmResponse,
@@ -86,4 +87,9 @@ export default class RiskProfileApi implements IRiskProfileApi {
86
87
  return await this.httpRequest.get(url);
87
88
  }
88
89
 
90
+ async deleteByDirectoryId(directoryId: string): Promise<FiadoApiResponse<{ deletedCount: number }>> {
91
+ const url = `${this.baseUrl}/private/directory/${directoryId}`;
92
+ return await this.httpRequest.delete<FiadoApiResponse<{ deletedCount: number }>>(url);
93
+ }
94
+
89
95
  }
@@ -2,6 +2,7 @@ import {CreatePrivateAlarm, CreateRiskProfileRequest} from "@fiado/type-kit/bin/
2
2
  type UpdateAlarmProfileRequest = import("@fiado/type-kit/bin/riskProfile/dtos/UpdateAlarmProfileRequest.js").default;
3
3
  type UpdateRiskProfileRequest = import("@fiado/type-kit/bin/riskProfile/dtos/UpdateRiskProfileRequest.js").default;
4
4
  import { ResponseOptions } from "@fiado/gateway-adapter";
5
+ type FiadoApiResponse<T> = import("@fiado/type-kit/bin/apiResponse/dtos/FiadoApiResponse.js").default<T>;
5
6
  import {
6
7
  SetCustomAlarmRequest,
7
8
  SetCustomAlarmResponse,
@@ -67,4 +68,12 @@ export interface IRiskProfileApi {
67
68
  * Paginación: pasar `continuationToken` de la respuesta previa; `null` = fin.
68
69
  */
69
70
  listClientFinancialHistory(directoryId: string, params?: { limit?: number; continuationToken?: string }): Promise<ResponseOptions<ListClientFinancialHistoryResponse>>;
71
+
72
+ /**
73
+ * Borra en cascada el perfil de riesgo asociado a un directoryId.
74
+ * @param directoryId ID del directorio.
75
+ * @throws {Error} Lanza un error si los parámetros de entrada son inválidos.
76
+ */
77
+ // TODO(type-kit): swap a Directory.DeleteByDirectoryResponse cuando se publique
78
+ deleteByDirectoryId(directoryId: string): Promise<FiadoApiResponse<{ deletedCount: number }>>;
70
79
  }
@@ -21,4 +21,9 @@ export class ZendeskApi implements IZendeskApi {
21
21
  const url: string = `${this.baseUrl}tickets/create`;
22
22
  return await this.httpRequest.post(url,data);
23
23
  }
24
+
25
+ async deleteByDirectoryId(directoryId: string): Promise<FiadoApiResponse<{ deletedCount: number }>> {
26
+ const url = `${this.baseUrl}private/directory/${directoryId}`;
27
+ return await this.httpRequest.delete<FiadoApiResponse<{ deletedCount: number }>>(url);
28
+ }
24
29
  }
@@ -7,4 +7,12 @@ import { HelpdeskCreateTicketRequest, HelpdeskCreateUserRequest } from '@fiado/t
7
7
  export interface IZendeskApi {
8
8
  createUser(data: HelpdeskCreateUserRequest): Promise<FiadoApiResponse<any>>;
9
9
  createTicket(data: HelpdeskCreateTicketRequest): Promise<FiadoApiResponse<any>>;
10
+
11
+ /**
12
+ * Borra en cascada los registros de Zendesk asociados a un directoryId.
13
+ * @param directoryId ID del directorio.
14
+ * @throws {Error} Lanza un error si los parámetros de entrada son inválidos.
15
+ */
16
+ // TODO(type-kit): swap a Directory.DeleteByDirectoryResponse cuando se publique
17
+ deleteByDirectoryId(directoryId: string): Promise<FiadoApiResponse<{ deletedCount: number }>>;
10
18
  }