@fiado/api-invoker 5.107.0 → 5.109.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 (26) hide show
  1. package/bin/cognitoConnector/CognitoConnectorApi.d.ts +8 -2
  2. package/bin/cognitoConnector/CognitoConnectorApi.js +8 -0
  3. package/bin/cognitoConnector/interfaces/ICognitoConnectorApi.d.ts +7 -0
  4. package/bin/fiadoMessages/api/FiadoMessagesApi.d.ts +4 -2
  5. package/bin/fiadoMessages/api/FiadoMessagesApi.js +4 -0
  6. package/bin/fiadoMessages/api/interfaces/IFiadoMessagesApi.d.ts +21 -0
  7. package/bin/file-storage/FileStorageApi.d.ts +2 -1
  8. package/bin/file-storage/FileStorageApi.js +6 -0
  9. package/bin/file-storage/interfaces/IFileStorageApi.d.ts +10 -0
  10. package/bin/onboarding/api/OnboardingApi.d.ts +2 -0
  11. package/bin/onboarding/api/OnboardingApi.js +4 -0
  12. package/bin/onboarding/api/interfaces/IOnboardingApi.d.ts +2 -0
  13. package/bin/retailCustomer/api/RetailCustomerBusinessApi.d.ts +2 -1
  14. package/bin/retailCustomer/api/RetailCustomerBusinessApi.js +5 -0
  15. package/bin/retailCustomer/api/interfaces/IRetailCustomerBusinessApi.d.ts +10 -1
  16. package/package.json +2 -2
  17. package/src/cognitoConnector/CognitoConnectorApi.ts +11 -4
  18. package/src/cognitoConnector/interfaces/ICognitoConnectorApi.ts +8 -0
  19. package/src/fiadoMessages/api/FiadoMessagesApi.ts +8 -3
  20. package/src/fiadoMessages/api/interfaces/IFiadoMessagesApi.ts +23 -1
  21. package/src/file-storage/FileStorageApi.ts +10 -1
  22. package/src/file-storage/interfaces/IFileStorageApi.ts +8 -0
  23. package/src/onboarding/api/OnboardingApi.ts +5 -0
  24. package/src/onboarding/api/interfaces/IOnboardingApi.ts +2 -0
  25. package/src/retailCustomer/api/RetailCustomerBusinessApi.ts +12 -0
  26. package/src/retailCustomer/api/interfaces/IRetailCustomerBusinessApi.ts +16 -0
@@ -1,6 +1,6 @@
1
- import { IHttpRequest } from "@fiado/http-client";
1
+ import type { IHttpRequest } from "@fiado/http-client";
2
2
  import { GetUserRequest, GetUserResponse, RefreshTokenRequest, RefreshTokenResponse, RespondToAuthChallengeRequest, SetPasswordRequest, SignInRequest, SignInResponse, SignUpConfirmRequest, SignUpRequest, SignUpResponse } from "@fiado/type-kit/bin/cognitoConnector/index.js";
3
- import { ICognitoConnectorApi } from "./interfaces/ICognitoConnectorApi.js";
3
+ import type { CognitoUpdatePhoneNumberRequest, ICognitoConnectorApi } from "./interfaces/ICognitoConnectorApi.js";
4
4
  import { TypeOfDirectoryId } from "@fiado/type-kit/bin/directory/index.js";
5
5
  export default class CognitoConnectorApi implements ICognitoConnectorApi {
6
6
  private httpRequest;
@@ -15,4 +15,10 @@ export default class CognitoConnectorApi implements ICognitoConnectorApi {
15
15
  changePassword(input: SetPasswordRequest): Promise<void>;
16
16
  respondToNewPasswordChallenge(input: RespondToAuthChallengeRequest): Promise<SignInResponse>;
17
17
  resetPassword(username: string, typeOfDirectoryId: string): Promise<void>;
18
+ /**
19
+ * Cambia el phone_number de un usuario (PUT cognito/user del conector). Mismo contrato que
20
+ * CognitoAdapter.updateAttribute de fiado-directory-lambda: `username` es el identityId del usuario
21
+ * o, si no lo tiene, su teléfono actual.
22
+ */
23
+ updatePhoneNumber(input: CognitoUpdatePhoneNumberRequest): Promise<void>;
18
24
  }
@@ -84,6 +84,14 @@ let CognitoConnectorApi = class CognitoConnectorApi {
84
84
  const url = `${this.baseUrl}cognito/resetPassword`;
85
85
  return await this.httpRequest.post(url, { username, typeOfDirectoryId }, { operationName: "postConnectorCognitoResetPassword" });
86
86
  }
87
+ /**
88
+ * Cambia el phone_number de un usuario (PUT cognito/user del conector). Mismo contrato que
89
+ * CognitoAdapter.updateAttribute de fiado-directory-lambda: `username` es el identityId del usuario
90
+ * o, si no lo tiene, su teléfono actual.
91
+ */
92
+ async updatePhoneNumber(input) {
93
+ await this.httpRequest.put(`${this.baseUrl}cognito/user`, input);
94
+ }
87
95
  };
88
96
  CognitoConnectorApi = __decorate([
89
97
  injectable(),
@@ -1,5 +1,11 @@
1
1
  import { GetUserRequest, GetUserResponse, RefreshTokenRequest, RefreshTokenResponse, RespondToAuthChallengeRequest, SetPasswordRequest, SignInRequest, SignInResponse, SignUpConfirmRequest, SignUpRequest, SignUpResponse } from "@fiado/type-kit/bin/cognitoConnector/index.js";
2
2
  import { TypeOfDirectoryId } from "@fiado/type-kit/bin/directory/index.js";
3
+ /** Body de PUT cognito/user: `username` es el identityId o, si no hay, el teléfono actual. */
4
+ export interface CognitoUpdatePhoneNumberRequest {
5
+ username: string;
6
+ phoneNumber: string;
7
+ typeOfDirectoryId: TypeOfDirectoryId;
8
+ }
3
9
  export interface ICognitoConnectorApi {
4
10
  signUp(input: SignUpRequest): Promise<SignUpResponse>;
5
11
  signIn(input: SignInRequest): Promise<SignInResponse>;
@@ -10,4 +16,5 @@ export interface ICognitoConnectorApi {
10
16
  respondToNewPasswordChallenge(input: RespondToAuthChallengeRequest): Promise<SignInResponse>;
11
17
  resetPassword(username: string, typeOfDirectoryId: TypeOfDirectoryId): Promise<void>;
12
18
  deleteCognitoUser(identityId: string, typeOfDirectoryId?: TypeOfDirectoryId): Promise<void>;
19
+ updatePhoneNumber(input: CognitoUpdatePhoneNumberRequest): Promise<void>;
13
20
  }
@@ -1,8 +1,10 @@
1
- import { IHttpRequest } from "@fiado/http-client";
2
- import { IFiadoMessagesApi } from "./interfaces/IFiadoMessagesApi.js";
1
+ import type { IHttpRequest } from "@fiado/http-client";
2
+ import type { IFiadoMessagesApi, SendMessageRequest } from "./interfaces/IFiadoMessagesApi.js";
3
3
  export declare class FiadoMessagesApi implements IFiadoMessagesApi {
4
4
  private httpRequest;
5
5
  private readonly baseUrl;
6
6
  constructor(httpRequest: IHttpRequest);
7
7
  getValidatedOtpByDirectoryIdAndOtpCode(directoryId: string, otpCode: string): Promise<any>;
8
+ /** Envía un mensaje (SMS, etc.) por fiado-messages-lambda. Mismo contrato que MessageAdapter.sendSMS de fiado-directory-lambda. */
9
+ sendMessage(message: SendMessageRequest): Promise<any>;
8
10
  }
@@ -26,6 +26,10 @@ let FiadoMessagesApi = class FiadoMessagesApi {
26
26
  };
27
27
  return await this.httpRequest.post(`${url}`, request, { 'operationName': operationName });
28
28
  }
29
+ /** Envía un mensaje (SMS, etc.) por fiado-messages-lambda. Mismo contrato que MessageAdapter.sendSMS de fiado-directory-lambda. */
30
+ async sendMessage(message) {
31
+ return await this.httpRequest.post(this.baseUrl, message, { operationName: "postSendMessage", app: "USERS_APP" });
32
+ }
29
33
  };
30
34
  FiadoMessagesApi = __decorate([
31
35
  injectable(),
@@ -1,3 +1,24 @@
1
+ /** Body de postSendMessage en fiado-messages-lambda (NotificationPush de los lambdas legacy). */
2
+ export interface SendMessageRequest {
3
+ messageType: string;
4
+ channelType: string;
5
+ directoryId: string | null;
6
+ typeOfDirectory: string | null;
7
+ destination: string;
8
+ language: string;
9
+ referenceMessageId: string | null;
10
+ country: string;
11
+ beneficiaryDirectoryId: string | null;
12
+ beneficiaryTypeOfDirectoryId: string | null;
13
+ status: string;
14
+ transactionNumber: string;
15
+ var1: unknown;
16
+ var2: unknown;
17
+ var3: unknown;
18
+ var4: unknown;
19
+ options: unknown;
20
+ }
1
21
  export interface IFiadoMessagesApi {
2
22
  getValidatedOtpByDirectoryIdAndOtpCode(directoryId: string, otpCode: string): Promise<any>;
23
+ sendMessage(message: SendMessageRequest): Promise<any>;
3
24
  }
@@ -1,6 +1,6 @@
1
1
  import type { IHttpRequest } from "@fiado/http-client";
2
2
  import type { UserDocumentItem } from "@fiado/type-kit/bin/fileStorage/index.js";
3
- import type { IFileStorageApi } from "./interfaces/IFileStorageApi.js";
3
+ import type { IFileStorageApi, SaveFilesRequest } from "./interfaces/IFileStorageApi.js";
4
4
  type FiadoApiResponse<T> = import("@fiado/type-kit/bin/apiResponse/dtos/FiadoApiResponse.js").default<T>;
5
5
  export declare class FileStorageApi implements IFileStorageApi {
6
6
  private readonly httpRequest;
@@ -11,5 +11,6 @@ export declare class FileStorageApi implements IFileStorageApi {
11
11
  getUserDocumentSignUrl(key: string): Promise<FiadoApiResponse<{
12
12
  url: string;
13
13
  }>>;
14
+ saveFiles(request: SaveFilesRequest): Promise<FiadoApiResponse<unknown>>;
14
15
  }
15
16
  export {};
@@ -37,6 +37,12 @@ let FileStorageApi = class FileStorageApi {
37
37
  }
38
38
  return await this.httpRequest.post(this.baseUrl, { key }, { operationName: "getUserDocumentSignUrl" });
39
39
  }
40
+ async saveFiles(request) {
41
+ if (!request?.path || !request.files?.length) {
42
+ throw new Error("path and at least one file are required.");
43
+ }
44
+ return await this.httpRequest.post(this.baseUrl, request, { operationName: "postDocumentCheck" });
45
+ }
40
46
  };
41
47
  FileStorageApi = __decorate([
42
48
  injectable(),
@@ -4,6 +4,14 @@ type FiadoApiResponse<T> = import("@fiado/type-kit/bin/apiResponse/dtos/FiadoApi
4
4
  * Cliente de fiado-s3-lambda (documentos de usuario en S3). Una sola ruta POST; la operación viaja en el
5
5
  * header `operationName`. Mismo contrato que consumía el S3Adapter de fiado-identity-lambda.
6
6
  */
7
+ /** Archivos en base64 (sin el prefijo `data:...;base64,`) a guardar bajo `path`, p. ej. `USER/{directoryId}`. */
8
+ export interface SaveFilesRequest {
9
+ path: string;
10
+ files: Array<{
11
+ fileName: string;
12
+ content: string;
13
+ }>;
14
+ }
7
15
  export interface IFileStorageApi {
8
16
  /** Lista los objetos bajo un prefijo, p. ej. `USER/{directoryId}`. Devuelve key completa, lastModified, sizeKb y url firmada. */
9
17
  listDirectoryDocuments(directory: string): Promise<FiadoApiResponse<UserDocumentItem[]>>;
@@ -13,5 +21,7 @@ export interface IFileStorageApi {
13
21
  getUserDocumentSignUrl(key: string): Promise<FiadoApiResponse<{
14
22
  url: string;
15
23
  }>>;
24
+ /** Guarda archivos (operación postDocumentCheck). Mismo contrato que DocumentAdapter.saveFileToS3 de fiado-directory-lambda. */
25
+ saveFiles(request: SaveFilesRequest): Promise<FiadoApiResponse<unknown>>;
16
26
  }
17
27
  export {};
@@ -9,4 +9,6 @@ export default class OnboardingApi implements IOnboardingApi {
9
9
  getOnboardingSteps(directoryId: string, countryId: string): Promise<OnboardingStepsEnvelope>;
10
10
  /** Onboardings por lote de fiado-onboarding-lambda (GET ids?directoryId=...). Lo usa la actividad diaria del backoffice. */
11
11
  getByIds(directoryIds: string[]): Promise<any>;
12
+ /** Cambia el teléfono del onboarding (PUT raíz de fiado-onboarding-lambda). Lo usa el cambio de teléfono del backoffice. */
13
+ updatePhoneNumber(directoryId: string, phoneNumber: string): Promise<any>;
12
14
  }
@@ -37,6 +37,10 @@ let OnboardingApi = class OnboardingApi {
37
37
  const query = directoryIds.map((id) => `directoryId=${encodeURIComponent(id)}`).join("&");
38
38
  return await this.httpRequest.get(`${this.baseUrl}ids?${query}`);
39
39
  }
40
+ /** Cambia el teléfono del onboarding (PUT raíz de fiado-onboarding-lambda). Lo usa el cambio de teléfono del backoffice. */
41
+ async updatePhoneNumber(directoryId, phoneNumber) {
42
+ return await this.httpRequest.put(this.baseUrl, { directoryId, phoneNumber });
43
+ }
40
44
  };
41
45
  OnboardingApi = __decorate([
42
46
  injectable(),
@@ -12,4 +12,6 @@ export interface IOnboardingApi {
12
12
  getOnboardingSteps(directoryId: string, countryId: string): Promise<OnboardingStepsEnvelope>;
13
13
  /** Onboardings por lote (envelope con data: onboarding[] con id = directoryId y referralCode). */
14
14
  getByIds(directoryIds: string[]): Promise<any>;
15
+ /** PUT raíz de fiado-onboarding-lambda con {directoryId, phoneNumber}. */
16
+ updatePhoneNumber(directoryId: string, phoneNumber: string): Promise<any>;
15
17
  }
@@ -1,6 +1,6 @@
1
1
  import type { IHttpRequest } from "@fiado/http-client";
2
2
  import { StandardResponse } from "@fiado/gateway-adapter";
3
- import { UpsertCustomerFromKycRequest, AccountResultRequest, CustomerResponse, WelcomeAccreditationRequest, WelcomeAccreditationResponse, WelcomeAccreditationResultRequest, WelcomeBonusResponse } from "@fiado/type-kit/bin/retailCustomer/index.js";
3
+ import { UpsertCustomerFromKycRequest, AccountResultRequest, CustomerResponse, PromotionBonusEntryResponse, UpsertPromotionBonusRequest, WelcomeAccreditationRequest, WelcomeAccreditationResponse, WelcomeAccreditationResultRequest, WelcomeBonusResponse } from "@fiado/type-kit/bin/retailCustomer/index.js";
4
4
  import { CustomersBatchRequest, CustomersBatchResponse } from "./dtos/CustomersBatch.js";
5
5
  import { CustomersPageQuery, PrivateCustomerListItem } from "./dtos/CustomersPage.js";
6
6
  import { PaginatedResult } from "@fiado/type-kit/bin/retailOrg/index.js";
@@ -29,6 +29,7 @@ export default class RetailCustomerBusinessApi implements IRetailCustomerBusines
29
29
  getCustomer(customerId: string, tenantId: string): Promise<StandardResponse<CustomerResponse>>;
30
30
  markWelcomeAccredited(customerId: string, tenantId: string, payload?: WelcomeAccreditationRequest): Promise<StandardResponse<WelcomeAccreditationResponse>>;
31
31
  setWelcomeAccreditationResult(customerId: string, payload: WelcomeAccreditationResultRequest, tenantId: string): Promise<StandardResponse<WelcomeBonusResponse>>;
32
+ upsertPromotionBonus(customerId: string, payload: UpsertPromotionBonusRequest, tenantId: string): Promise<StandardResponse<PromotionBonusEntryResponse>>;
32
33
  getCustomersBatch(payload: CustomersBatchRequest, tenantId: string): Promise<StandardResponse<CustomersBatchResponse>>;
33
34
  listCustomersPage(query: CustomersPageQuery, tenantId: string): Promise<StandardResponse<PaginatedResult<PrivateCustomerListItem>>>;
34
35
  }
@@ -56,6 +56,11 @@ let RetailCustomerBusinessApi = class RetailCustomerBusinessApi {
56
56
  const url = `${this.baseUrl}/private/customers/${encodeURIComponent(customerId)}/welcome-accreditation/result?tenantId=${encodeURIComponent(tenantId)}`;
57
57
  return await this.httpRequest.put(url, payload);
58
58
  }
59
+ async upsertPromotionBonus(customerId, payload, tenantId) {
60
+ const url = `${this.baseUrl}/private/customers/${encodeURIComponent(customerId)}/promotion-bonuses?tenantId=${encodeURIComponent(tenantId)}`;
61
+ // Firma de http-client: put(url, data, headers, basicAuth, enableTimeout).
62
+ return await this.httpRequest.put(url, payload, {}, undefined, true);
63
+ }
59
64
  async getCustomersBatch(payload, tenantId) {
60
65
  const url = `${this.baseUrl}/private/customers/batch?tenantId=${encodeURIComponent(tenantId)}`;
61
66
  return await this.httpRequest.post(url, payload);
@@ -1,5 +1,5 @@
1
1
  import { StandardResponse } from "@fiado/gateway-adapter";
2
- import { UpsertCustomerFromKycRequest, AccountResultRequest, CustomerResponse, WelcomeAccreditationRequest, WelcomeAccreditationResponse, WelcomeAccreditationResultRequest, WelcomeBonusResponse } from "@fiado/type-kit/bin/retailCustomer/index.js";
2
+ import { UpsertCustomerFromKycRequest, AccountResultRequest, CustomerResponse, PromotionBonusEntryResponse, UpsertPromotionBonusRequest, WelcomeAccreditationRequest, WelcomeAccreditationResponse, WelcomeAccreditationResultRequest, WelcomeBonusResponse } from "@fiado/type-kit/bin/retailCustomer/index.js";
3
3
  import { CustomersBatchRequest, CustomersBatchResponse } from "../dtos/CustomersBatch.js";
4
4
  import { CustomersPageQuery, PrivateCustomerListItem } from "../dtos/CustomersPage.js";
5
5
  import { PaginatedResult } from "@fiado/type-kit/bin/retailOrg/index.js";
@@ -117,6 +117,15 @@ export interface IRetailCustomerBusinessApi {
117
117
  * @throws `400 WELCOME_BONUS_KEY_INVALID` si el `bonusKey` no decodifica (bug del caller).
118
118
  */
119
119
  setWelcomeAccreditationResult(customerId: string, payload: WelcomeAccreditationResultRequest, tenantId: string): Promise<StandardResponse<WelcomeBonusResponse>>;
120
+ /**
121
+ * PUT /private/customers/{customerId}/promotion-bonuses?tenantId= — asienta un bono de promoción
122
+ * en el libro de bonos. Matriz cerrada: reintentar el mismo estado es idempotente (200).
123
+ *
124
+ * @throws `409 PROMOTION_BONUS_INVALID_TRANSITION` si la transición no procede o el asiento es de otro cliente.
125
+ * @throws `404 CUSTOMER_NOT_FOUND` si el cliente no existe.
126
+ * @throws `400 VALIDATION_ERROR` si el body viene mal formado.
127
+ */
128
+ upsertPromotionBonus(customerId: string, payload: UpsertPromotionBonusRequest, tenantId: string): Promise<StandardResponse<PromotionBonusEntryResponse>>;
120
129
  /**
121
130
  * POST /private/customers/batch?tenantId= — resuelve NOMBRES de cliente EN LOTE por sus ids.
122
131
  * Pensado para pintar una lista sin caer en N+1 contra el privado de un cliente por vez.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@fiado/api-invoker",
3
- "version": "5.107.0",
3
+ "version": "5.109.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.9.0",
35
35
  "@fiado/http-client": "^2.0.1",
36
36
  "@fiado/logger": "^1.1.3",
37
- "@fiado/type-kit": "^3.488.0",
37
+ "@fiado/type-kit": "^3.490.0",
38
38
  "dotenv": "^16.4.7"
39
39
  },
40
40
  "peerDependencies": {
@@ -1,7 +1,7 @@
1
- import { IHttpRequest } from "@fiado/http-client";
1
+ import type { IHttpRequest } from "@fiado/http-client";
2
2
  import { GetUserRequest, GetUserResponse, RefreshTokenRequest, RefreshTokenResponse, RespondToAuthChallengeRequest, SetPasswordRequest, SignInRequest, SignInResponse, SignUpConfirmRequest, SignUpRequest, SignUpResponse } from "@fiado/type-kit/bin/cognitoConnector/index.js";
3
3
  import { inject, injectable } from "inversify";
4
- import { ICognitoConnectorApi } from "./interfaces/ICognitoConnectorApi.js";
4
+ import type { CognitoUpdatePhoneNumberRequest, ICognitoConnectorApi } from "./interfaces/ICognitoConnectorApi.js";
5
5
  import { TypeOfDirectoryId } from "@fiado/type-kit/bin/directory/index.js";
6
6
 
7
7
  @injectable()
@@ -107,6 +107,13 @@ export default class CognitoConnectorApi implements ICognitoConnectorApi {
107
107
  const url = `${this.baseUrl}cognito/resetPassword`;
108
108
  return await this.httpRequest.post(url, { username, typeOfDirectoryId }, { operationName: "postConnectorCognitoResetPassword" });
109
109
  }
110
- }
111
-
112
110
 
111
+ /**
112
+ * Cambia el phone_number de un usuario (PUT cognito/user del conector). Mismo contrato que
113
+ * CognitoAdapter.updateAttribute de fiado-directory-lambda: `username` es el identityId del usuario
114
+ * o, si no lo tiene, su teléfono actual.
115
+ */
116
+ async updatePhoneNumber(input: CognitoUpdatePhoneNumberRequest): Promise<void> {
117
+ await this.httpRequest.put(`${this.baseUrl}cognito/user`, input);
118
+ }
119
+ }
@@ -3,6 +3,13 @@ import { TypeOfDirectoryId } from "@fiado/type-kit/bin/directory/index.js";
3
3
 
4
4
 
5
5
 
6
+ /** Body de PUT cognito/user: `username` es el identityId o, si no hay, el teléfono actual. */
7
+ export interface CognitoUpdatePhoneNumberRequest {
8
+ username: string;
9
+ phoneNumber: string;
10
+ typeOfDirectoryId: TypeOfDirectoryId;
11
+ }
12
+
6
13
  export interface ICognitoConnectorApi {
7
14
 
8
15
  signUp(input: SignUpRequest): Promise<SignUpResponse>;
@@ -14,4 +21,5 @@ export interface ICognitoConnectorApi {
14
21
  respondToNewPasswordChallenge(input: RespondToAuthChallengeRequest): Promise<SignInResponse>;
15
22
  resetPassword(username: string, typeOfDirectoryId: TypeOfDirectoryId): Promise<void>;
16
23
  deleteCognitoUser(identityId: string, typeOfDirectoryId?: TypeOfDirectoryId): Promise<void>;
24
+ updatePhoneNumber(input: CognitoUpdatePhoneNumberRequest): Promise<void>;
17
25
  }
@@ -1,6 +1,6 @@
1
1
  import {inject, injectable} from "inversify";
2
- import {IHttpRequest} from "@fiado/http-client";
3
- import {IFiadoMessagesApi} from "./interfaces/IFiadoMessagesApi.js";
2
+ import type {IHttpRequest} from "@fiado/http-client";
3
+ import type {IFiadoMessagesApi, SendMessageRequest} from "./interfaces/IFiadoMessagesApi.js";
4
4
 
5
5
  @injectable()
6
6
  export class FiadoMessagesApi implements IFiadoMessagesApi {
@@ -18,4 +18,9 @@ export class FiadoMessagesApi implements IFiadoMessagesApi {
18
18
  };
19
19
  return await this.httpRequest.post(`${url}`, request, {'operationName': operationName});
20
20
  }
21
- }
21
+
22
+ /** Envía un mensaje (SMS, etc.) por fiado-messages-lambda. Mismo contrato que MessageAdapter.sendSMS de fiado-directory-lambda. */
23
+ async sendMessage(message: SendMessageRequest): Promise<any> {
24
+ return await this.httpRequest.post(this.baseUrl, message, { operationName: "postSendMessage", app: "USERS_APP" });
25
+ }
26
+ }
@@ -1,3 +1,25 @@
1
+ /** Body de postSendMessage en fiado-messages-lambda (NotificationPush de los lambdas legacy). */
2
+ export interface SendMessageRequest {
3
+ messageType: string;
4
+ channelType: string;
5
+ directoryId: string | null;
6
+ typeOfDirectory: string | null;
7
+ destination: string;
8
+ language: string;
9
+ referenceMessageId: string | null;
10
+ country: string;
11
+ beneficiaryDirectoryId: string | null;
12
+ beneficiaryTypeOfDirectoryId: string | null;
13
+ status: string;
14
+ transactionNumber: string;
15
+ var1: unknown;
16
+ var2: unknown;
17
+ var3: unknown;
18
+ var4: unknown;
19
+ options: unknown;
20
+ }
21
+
1
22
  export interface IFiadoMessagesApi {
2
23
  getValidatedOtpByDirectoryIdAndOtpCode(directoryId: string, otpCode: string): Promise<any>;
3
- }
24
+ sendMessage(message: SendMessageRequest): Promise<any>;
25
+ }
@@ -2,7 +2,7 @@ import { inject, injectable } from "inversify";
2
2
  import type { IHttpRequest } from "@fiado/http-client";
3
3
  import dotenv from "dotenv";
4
4
  import type { UserDocumentItem } from "@fiado/type-kit/bin/fileStorage/index.js";
5
- import type { IFileStorageApi } from "./interfaces/IFileStorageApi.js";
5
+ import type { IFileStorageApi, SaveFilesRequest } from "./interfaces/IFileStorageApi.js";
6
6
  type FiadoApiResponse<T> = import("@fiado/type-kit/bin/apiResponse/dtos/FiadoApiResponse.js").default<T>;
7
7
 
8
8
  dotenv.config();
@@ -40,4 +40,13 @@ export class FileStorageApi implements IFileStorageApi {
40
40
  this.baseUrl, { key }, { operationName: "getUserDocumentSignUrl" },
41
41
  );
42
42
  }
43
+
44
+ async saveFiles(request: SaveFilesRequest): Promise<FiadoApiResponse<unknown>> {
45
+ if (!request?.path || !request.files?.length) {
46
+ throw new Error("path and at least one file are required.");
47
+ }
48
+ return await this.httpRequest.post<FiadoApiResponse<unknown>>(
49
+ this.baseUrl, request, { operationName: "postDocumentCheck" },
50
+ );
51
+ }
43
52
  }
@@ -5,6 +5,12 @@ type FiadoApiResponse<T> = import("@fiado/type-kit/bin/apiResponse/dtos/FiadoApi
5
5
  * Cliente de fiado-s3-lambda (documentos de usuario en S3). Una sola ruta POST; la operación viaja en el
6
6
  * header `operationName`. Mismo contrato que consumía el S3Adapter de fiado-identity-lambda.
7
7
  */
8
+ /** Archivos en base64 (sin el prefijo `data:...;base64,`) a guardar bajo `path`, p. ej. `USER/{directoryId}`. */
9
+ export interface SaveFilesRequest {
10
+ path: string;
11
+ files: Array<{ fileName: string; content: string }>;
12
+ }
13
+
8
14
  export interface IFileStorageApi {
9
15
  /** Lista los objetos bajo un prefijo, p. ej. `USER/{directoryId}`. Devuelve key completa, lastModified, sizeKb y url firmada. */
10
16
  listDirectoryDocuments(directory: string): Promise<FiadoApiResponse<UserDocumentItem[]>>;
@@ -12,4 +18,6 @@ export interface IFileStorageApi {
12
18
  deleteUserDocument(fileName: string): Promise<FiadoApiResponse<void>>;
13
19
  /** URL firmada de lectura para una key completa. */
14
20
  getUserDocumentSignUrl(key: string): Promise<FiadoApiResponse<{ url: string }>>;
21
+ /** Guarda archivos (operación postDocumentCheck). Mismo contrato que DocumentAdapter.saveFileToS3 de fiado-directory-lambda. */
22
+ saveFiles(request: SaveFilesRequest): Promise<FiadoApiResponse<unknown>>;
15
23
  }
@@ -33,4 +33,9 @@ export default class OnboardingApi implements IOnboardingApi {
33
33
  const query = directoryIds.map((id) => `directoryId=${encodeURIComponent(id)}`).join("&");
34
34
  return await this.httpRequest.get(`${this.baseUrl}ids?${query}`);
35
35
  }
36
+
37
+ /** Cambia el teléfono del onboarding (PUT raíz de fiado-onboarding-lambda). Lo usa el cambio de teléfono del backoffice. */
38
+ async updatePhoneNumber(directoryId: string, phoneNumber: string): Promise<any> {
39
+ return await this.httpRequest.put(this.baseUrl, { directoryId, phoneNumber });
40
+ }
36
41
  }
@@ -14,5 +14,7 @@ export interface IOnboardingApi {
14
14
 
15
15
  /** Onboardings por lote (envelope con data: onboarding[] con id = directoryId y referralCode). */
16
16
  getByIds(directoryIds: string[]): Promise<any>;
17
+ /** PUT raíz de fiado-onboarding-lambda con {directoryId, phoneNumber}. */
18
+ updatePhoneNumber(directoryId: string, phoneNumber: string): Promise<any>;
17
19
 
18
20
  }
@@ -5,6 +5,8 @@ import {
5
5
  UpsertCustomerFromKycRequest,
6
6
  AccountResultRequest,
7
7
  CustomerResponse,
8
+ PromotionBonusEntryResponse,
9
+ UpsertPromotionBonusRequest,
8
10
  WelcomeAccreditationRequest,
9
11
  WelcomeAccreditationResponse,
10
12
  WelcomeAccreditationResultRequest,
@@ -87,6 +89,16 @@ export default class RetailCustomerBusinessApi implements IRetailCustomerBusines
87
89
  return await this.httpRequest.put(url, payload);
88
90
  }
89
91
 
92
+ async upsertPromotionBonus(
93
+ customerId: string,
94
+ payload: UpsertPromotionBonusRequest,
95
+ tenantId: string,
96
+ ): Promise<StandardResponse<PromotionBonusEntryResponse>> {
97
+ const url = `${this.baseUrl}/private/customers/${encodeURIComponent(customerId)}/promotion-bonuses?tenantId=${encodeURIComponent(tenantId)}`;
98
+ // Firma de http-client: put(url, data, headers, basicAuth, enableTimeout).
99
+ return await this.httpRequest.put(url, payload, {}, undefined, true);
100
+ }
101
+
90
102
  async getCustomersBatch(
91
103
  payload: CustomersBatchRequest,
92
104
  tenantId: string,
@@ -3,6 +3,8 @@ import {
3
3
  UpsertCustomerFromKycRequest,
4
4
  AccountResultRequest,
5
5
  CustomerResponse,
6
+ PromotionBonusEntryResponse,
7
+ UpsertPromotionBonusRequest,
6
8
  WelcomeAccreditationRequest,
7
9
  WelcomeAccreditationResponse,
8
10
  WelcomeAccreditationResultRequest,
@@ -153,6 +155,20 @@ export interface IRetailCustomerBusinessApi {
153
155
  tenantId: string,
154
156
  ): Promise<StandardResponse<WelcomeBonusResponse>>;
155
157
 
158
+ /**
159
+ * PUT /private/customers/{customerId}/promotion-bonuses?tenantId= — asienta un bono de promoción
160
+ * en el libro de bonos. Matriz cerrada: reintentar el mismo estado es idempotente (200).
161
+ *
162
+ * @throws `409 PROMOTION_BONUS_INVALID_TRANSITION` si la transición no procede o el asiento es de otro cliente.
163
+ * @throws `404 CUSTOMER_NOT_FOUND` si el cliente no existe.
164
+ * @throws `400 VALIDATION_ERROR` si el body viene mal formado.
165
+ */
166
+ upsertPromotionBonus(
167
+ customerId: string,
168
+ payload: UpsertPromotionBonusRequest,
169
+ tenantId: string,
170
+ ): Promise<StandardResponse<PromotionBonusEntryResponse>>;
171
+
156
172
  /**
157
173
  * POST /private/customers/batch?tenantId= — resuelve NOMBRES de cliente EN LOTE por sus ids.
158
174
  * Pensado para pintar una lista sin caer en N+1 contra el privado de un cliente por vez.