@fiado/api-invoker 5.137.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.
- package/bin/retailPromotions/api/RetailPromotionsBusinessApi.d.ts +3 -1
- package/bin/retailPromotions/api/RetailPromotionsBusinessApi.js +8 -0
- package/bin/retailPromotions/api/interfaces/IRetailPromotionsBusinessApi.d.ts +11 -1
- package/package.json +2 -2
- package/src/retailPromotions/api/RetailPromotionsBusinessApi.ts +17 -0
- package/src/retailPromotions/api/interfaces/IRetailPromotionsBusinessApi.ts +19 -0
|
@@ -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 } 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,5 +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>>;
|
|
13
|
+
getWelcomeBonus(retailerId: string): Promise<StandardResponse<WelcomeBonusPromotionResponse>>;
|
|
12
14
|
}
|
|
@@ -24,9 +24,17 @@ 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
|
}
|
|
35
|
+
async getWelcomeBonus(retailerId) {
|
|
36
|
+
return await this.httpRequest.get(`${this.baseUrl}/private/retailers/${encodeURIComponent(retailerId)}/welcome-bonus`);
|
|
37
|
+
}
|
|
30
38
|
};
|
|
31
39
|
RetailPromotionsBusinessApi = __decorate([
|
|
32
40
|
injectable(),
|
|
@@ -1,14 +1,24 @@
|
|
|
1
1
|
import { StandardResponse } from "@fiado/gateway-adapter";
|
|
2
|
-
import type { ActiveSalePromotionsBySkusRequest, ActiveSalePromotionsBySkusResponse, PrivateReleaseSalePromotionResponse } 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.
|
|
12
17
|
*/
|
|
13
18
|
listActiveSalePromotionsBySkus(input: ActiveSalePromotionsBySkusRequest): Promise<StandardResponse<ActiveSalePromotionsBySkusResponse>>;
|
|
19
|
+
/**
|
|
20
|
+
* `GET /private/retailers/{retailerId}/welcome-bonus`: promo de sistema del bono de bienvenida.
|
|
21
|
+
* Sin `tenantId`; la siembra si no existe. `active=false` = pausada, el wizard no paga bono.
|
|
22
|
+
*/
|
|
23
|
+
getWelcomeBonus(retailerId: string): Promise<StandardResponse<WelcomeBonusPromotionResponse>>;
|
|
14
24
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@fiado/api-invoker",
|
|
3
|
-
"version": "5.
|
|
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.
|
|
37
|
+
"@fiado/type-kit": "^3.565.0",
|
|
38
38
|
"dotenv": "^16.4.7"
|
|
39
39
|
},
|
|
40
40
|
"peerDependencies": {
|
|
@@ -4,7 +4,10 @@ import { StandardResponse } from "@fiado/gateway-adapter";
|
|
|
4
4
|
import type {
|
|
5
5
|
ActiveSalePromotionsBySkusRequest,
|
|
6
6
|
ActiveSalePromotionsBySkusResponse,
|
|
7
|
+
CheckSalePromotionPaymentRequest,
|
|
8
|
+
PrivateSalePromotionPaymentCheckResponse,
|
|
7
9
|
PrivateReleaseSalePromotionResponse,
|
|
10
|
+
WelcomeBonusPromotionResponse,
|
|
8
11
|
} from "@fiado/type-kit/bin/retailPromotions/index.js";
|
|
9
12
|
import { IRetailPromotionsBusinessApi } from "./interfaces/IRetailPromotionsBusinessApi.js";
|
|
10
13
|
|
|
@@ -25,9 +28,23 @@ export default class RetailPromotionsBusinessApi implements IRetailPromotionsBus
|
|
|
25
28
|
return await this.httpRequest.delete(url);
|
|
26
29
|
}
|
|
27
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
|
+
|
|
28
41
|
async listActiveSalePromotionsBySkus(
|
|
29
42
|
input: ActiveSalePromotionsBySkusRequest,
|
|
30
43
|
): Promise<StandardResponse<ActiveSalePromotionsBySkusResponse>> {
|
|
31
44
|
return await this.httpRequest.post(`${this.baseUrl}/private/sale-promotions/active-by-skus`, input);
|
|
32
45
|
}
|
|
46
|
+
|
|
47
|
+
async getWelcomeBonus(retailerId: string): Promise<StandardResponse<WelcomeBonusPromotionResponse>> {
|
|
48
|
+
return await this.httpRequest.get(`${this.baseUrl}/private/retailers/${encodeURIComponent(retailerId)}/welcome-bonus`);
|
|
49
|
+
}
|
|
33
50
|
}
|
|
@@ -2,7 +2,10 @@ import { StandardResponse } from "@fiado/gateway-adapter";
|
|
|
2
2
|
import type {
|
|
3
3
|
ActiveSalePromotionsBySkusRequest,
|
|
4
4
|
ActiveSalePromotionsBySkusResponse,
|
|
5
|
+
CheckSalePromotionPaymentRequest,
|
|
6
|
+
PrivateSalePromotionPaymentCheckResponse,
|
|
5
7
|
PrivateReleaseSalePromotionResponse,
|
|
8
|
+
WelcomeBonusPromotionResponse,
|
|
6
9
|
} from "@fiado/type-kit/bin/retailPromotions/index.js";
|
|
7
10
|
|
|
8
11
|
// Contrato de los privados de `retail-promotions-business`; el caller manda `tenantId` por query o en el body.
|
|
@@ -17,6 +20,16 @@ export interface IRetailPromotionsBusinessApi {
|
|
|
17
20
|
sessionId: string,
|
|
18
21
|
): Promise<StandardResponse<PrivateReleaseSalePromotionResponse>>;
|
|
19
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
|
+
|
|
20
33
|
/**
|
|
21
34
|
* `POST /private/sale-promotions/active-by-skus`: promos de venta vigentes por SKU, hasta 100 por llamada.
|
|
22
35
|
* Una entrada por SKU en el orden pedido; `UNAVAILABLE` por entrada si no se pudieron leer.
|
|
@@ -24,4 +37,10 @@ export interface IRetailPromotionsBusinessApi {
|
|
|
24
37
|
listActiveSalePromotionsBySkus(
|
|
25
38
|
input: ActiveSalePromotionsBySkusRequest,
|
|
26
39
|
): Promise<StandardResponse<ActiveSalePromotionsBySkusResponse>>;
|
|
40
|
+
|
|
41
|
+
/**
|
|
42
|
+
* `GET /private/retailers/{retailerId}/welcome-bonus`: promo de sistema del bono de bienvenida.
|
|
43
|
+
* Sin `tenantId`; la siembra si no existe. `active=false` = pausada, el wizard no paga bono.
|
|
44
|
+
*/
|
|
45
|
+
getWelcomeBonus(retailerId: string): Promise<StandardResponse<WelcomeBonusPromotionResponse>>;
|
|
27
46
|
}
|