@fiado/api-invoker 5.108.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.
@@ -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.108.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": {
@@ -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.