@fiado/api-invoker 5.138.0 → 5.139.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 type { ActiveSalePromotionsBySkusRequest, ActiveSalePromotionsBySkusResponse, PrivateReleaseSalePromotionResponse, WelcomeBonusPromotionResponse } from "@fiado/type-kit/bin/retailPromotions/index.js";
3
+ import type { ActiveSalePromotionsBySkusRequest, ActiveSalePromotionsBySkusResponse, CheckSalePromotionPaymentRequest, PrivateSalePromotionPaymentCheckResponse, PrivateReleaseSalePromotionResponse, WelcomeBonusPromotionResponse } from "@fiado/type-kit/bin/retailPromotions/index.js";
4
4
  import { IRetailPromotionsBusinessApi } from "./interfaces/IRetailPromotionsBusinessApi.js";
5
5
  /** Publisher HTTP de los privados de `retail-promotions-business`. Contrato -> `IRetailPromotionsBusinessApi`. */
6
6
  export default class RetailPromotionsBusinessApi implements IRetailPromotionsBusinessApi {
@@ -8,6 +8,7 @@ export default class RetailPromotionsBusinessApi implements IRetailPromotionsBus
8
8
  private readonly baseUrl;
9
9
  constructor(httpRequest: IHttpRequest);
10
10
  releaseSalePromotion(tenantId: string, sessionId: string): Promise<StandardResponse<PrivateReleaseSalePromotionResponse>>;
11
+ checkSalePromotionPayment(tenantId: string, sessionId: string, input: CheckSalePromotionPaymentRequest): Promise<StandardResponse<PrivateSalePromotionPaymentCheckResponse>>;
11
12
  listActiveSalePromotionsBySkus(input: ActiveSalePromotionsBySkusRequest): Promise<StandardResponse<ActiveSalePromotionsBySkusResponse>>;
12
13
  getWelcomeBonus(retailerId: string): Promise<StandardResponse<WelcomeBonusPromotionResponse>>;
13
14
  }
@@ -24,6 +24,11 @@ let RetailPromotionsBusinessApi = class RetailPromotionsBusinessApi {
24
24
  const url = `${this.baseUrl}/private/sessions/${encodeURIComponent(sessionId)}/sale-promotion?${query.toString()}`;
25
25
  return await this.httpRequest.delete(url);
26
26
  }
27
+ async checkSalePromotionPayment(tenantId, sessionId, input) {
28
+ const query = new URLSearchParams({ tenantId });
29
+ const url = `${this.baseUrl}/private/sessions/${encodeURIComponent(sessionId)}/sale-promotion/payment-check?${query.toString()}`;
30
+ return await this.httpRequest.post(url, input);
31
+ }
27
32
  async listActiveSalePromotionsBySkus(input) {
28
33
  return await this.httpRequest.post(`${this.baseUrl}/private/sale-promotions/active-by-skus`, input);
29
34
  }
@@ -1,11 +1,16 @@
1
1
  import { StandardResponse } from "@fiado/gateway-adapter";
2
- import type { ActiveSalePromotionsBySkusRequest, ActiveSalePromotionsBySkusResponse, PrivateReleaseSalePromotionResponse, WelcomeBonusPromotionResponse } from "@fiado/type-kit/bin/retailPromotions/index.js";
2
+ import type { ActiveSalePromotionsBySkusRequest, ActiveSalePromotionsBySkusResponse, CheckSalePromotionPaymentRequest, PrivateSalePromotionPaymentCheckResponse, PrivateReleaseSalePromotionResponse, WelcomeBonusPromotionResponse } from "@fiado/type-kit/bin/retailPromotions/index.js";
3
3
  export interface IRetailPromotionsBusinessApi {
4
4
  /**
5
5
  * `DELETE /private/sessions/{sessionId}/sale-promotion`: suelta el apartado de la promo de venta.
6
6
  * Lo llama el wizard al cancelar. Es idempotente: `released: false` si no había apartado.
7
7
  */
8
8
  releaseSalePromotion(tenantId: string, sessionId: string): Promise<StandardResponse<PrivateReleaseSalePromotionResponse>>;
9
+ /**
10
+ * `POST /private/sessions/{sessionId}/sale-promotion/payment-check`: antes del cobro de contado.
11
+ * 422 `PROMOTION_PAYMENT_NOT_ELIGIBLE` si alguna promo apartada no acepta el medio.
12
+ */
13
+ checkSalePromotionPayment(tenantId: string, sessionId: string, input: CheckSalePromotionPaymentRequest): Promise<StandardResponse<PrivateSalePromotionPaymentCheckResponse>>;
9
14
  /**
10
15
  * `POST /private/sale-promotions/active-by-skus`: promos de venta vigentes por SKU, hasta 100 por llamada.
11
16
  * Una entrada por SKU en el orden pedido; `UNAVAILABLE` por entrada si no se pudieron leer.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@fiado/api-invoker",
3
- "version": "5.138.0",
3
+ "version": "5.139.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.14.0",
35
35
  "@fiado/http-client": "^2.0.1",
36
36
  "@fiado/logger": "^1.1.3",
37
- "@fiado/type-kit": "^3.564.0",
37
+ "@fiado/type-kit": "^3.565.0",
38
38
  "dotenv": "^16.4.7"
39
39
  },
40
40
  "peerDependencies": {
@@ -4,6 +4,8 @@ import { StandardResponse } from "@fiado/gateway-adapter";
4
4
  import type {
5
5
  ActiveSalePromotionsBySkusRequest,
6
6
  ActiveSalePromotionsBySkusResponse,
7
+ CheckSalePromotionPaymentRequest,
8
+ PrivateSalePromotionPaymentCheckResponse,
7
9
  PrivateReleaseSalePromotionResponse,
8
10
  WelcomeBonusPromotionResponse,
9
11
  } from "@fiado/type-kit/bin/retailPromotions/index.js";
@@ -26,6 +28,16 @@ export default class RetailPromotionsBusinessApi implements IRetailPromotionsBus
26
28
  return await this.httpRequest.delete(url);
27
29
  }
28
30
 
31
+ async checkSalePromotionPayment(
32
+ tenantId: string,
33
+ sessionId: string,
34
+ input: CheckSalePromotionPaymentRequest,
35
+ ): Promise<StandardResponse<PrivateSalePromotionPaymentCheckResponse>> {
36
+ const query = new URLSearchParams({ tenantId });
37
+ const url = `${this.baseUrl}/private/sessions/${encodeURIComponent(sessionId)}/sale-promotion/payment-check?${query.toString()}`;
38
+ return await this.httpRequest.post(url, input);
39
+ }
40
+
29
41
  async listActiveSalePromotionsBySkus(
30
42
  input: ActiveSalePromotionsBySkusRequest,
31
43
  ): Promise<StandardResponse<ActiveSalePromotionsBySkusResponse>> {
@@ -2,6 +2,8 @@ import { StandardResponse } from "@fiado/gateway-adapter";
2
2
  import type {
3
3
  ActiveSalePromotionsBySkusRequest,
4
4
  ActiveSalePromotionsBySkusResponse,
5
+ CheckSalePromotionPaymentRequest,
6
+ PrivateSalePromotionPaymentCheckResponse,
5
7
  PrivateReleaseSalePromotionResponse,
6
8
  WelcomeBonusPromotionResponse,
7
9
  } from "@fiado/type-kit/bin/retailPromotions/index.js";
@@ -18,6 +20,16 @@ export interface IRetailPromotionsBusinessApi {
18
20
  sessionId: string,
19
21
  ): Promise<StandardResponse<PrivateReleaseSalePromotionResponse>>;
20
22
 
23
+ /**
24
+ * `POST /private/sessions/{sessionId}/sale-promotion/payment-check`: antes del cobro de contado.
25
+ * 422 `PROMOTION_PAYMENT_NOT_ELIGIBLE` si alguna promo apartada no acepta el medio.
26
+ */
27
+ checkSalePromotionPayment(
28
+ tenantId: string,
29
+ sessionId: string,
30
+ input: CheckSalePromotionPaymentRequest,
31
+ ): Promise<StandardResponse<PrivateSalePromotionPaymentCheckResponse>>;
32
+
21
33
  /**
22
34
  * `POST /private/sale-promotions/active-by-skus`: promos de venta vigentes por SKU, hasta 100 por llamada.
23
35
  * Una entrada por SKU en el orden pedido; `UNAVAILABLE` por entrada si no se pudieron leer.