@fiado/type-kit 3.563.0 → 3.564.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/_test_/unit/retailCustomer/welcomeBonusRequests.test.ts +1 -1
- package/_test_/unit/retailPromotions/constants.test.ts +1 -1
- package/_test_/unit/retailPromotions/welcomeBonusPromotion.test.ts +34 -0
- package/bin/retailCustomer/enums/WelcomeBonusAmountSourceEnum.d.ts +3 -1
- package/bin/retailCustomer/enums/WelcomeBonusAmountSourceEnum.js +2 -0
- package/bin/retailPromotions/constants/retailPromotionsErrorHttpStatus.js +2 -0
- package/bin/retailPromotions/dtos/SalePromotion.d.ts +3 -0
- package/bin/retailPromotions/dtos/responses/WelcomeBonusPromotionResponse.d.ts +6 -0
- package/bin/retailPromotions/dtos/responses/WelcomeBonusPromotionResponse.js +2 -0
- package/bin/retailPromotions/enums/RetailPromotionsErrorCodeEnum.d.ts +5 -1
- package/bin/retailPromotions/enums/RetailPromotionsErrorCodeEnum.js +4 -0
- package/bin/retailPromotions/enums/SalePromotionSystemKeyEnum.d.ts +5 -0
- package/bin/retailPromotions/enums/SalePromotionSystemKeyEnum.js +9 -0
- package/bin/retailPromotions/index.d.ts +2 -0
- package/bin/retailPromotions/index.js +2 -0
- package/package.json +1 -1
- package/src/retailCustomer/enums/WelcomeBonusAmountSourceEnum.ts +2 -0
- package/src/retailPromotions/constants/retailPromotionsErrorHttpStatus.ts +2 -0
- package/src/retailPromotions/dtos/SalePromotion.ts +3 -0
- package/src/retailPromotions/dtos/responses/WelcomeBonusPromotionResponse.ts +6 -0
- package/src/retailPromotions/enums/RetailPromotionsErrorCodeEnum.ts +4 -0
- package/src/retailPromotions/enums/SalePromotionSystemKeyEnum.ts +5 -0
- package/src/retailPromotions/index.ts +2 -0
|
@@ -219,6 +219,6 @@ describe('enums del bono de bienvenida', () => {
|
|
|
219
219
|
});
|
|
220
220
|
|
|
221
221
|
it('el origen del monto distingue el parámetro del fallback local', () => {
|
|
222
|
-
expect(Object.values(WelcomeBonusAmountSourceEnum)).toEqual(['PARAM', 'DEFAULT']);
|
|
222
|
+
expect(Object.values(WelcomeBonusAmountSourceEnum)).toEqual(['PARAM', 'DEFAULT', 'SALE_PROMOTION']);
|
|
223
223
|
});
|
|
224
224
|
});
|
|
@@ -43,7 +43,7 @@ describe('catálogo de errores', () => {
|
|
|
43
43
|
expect(RETAIL_PROMOTIONS_ERROR_HTTP_STATUS.CODE_NOT_FOUND).toBe(404);
|
|
44
44
|
expect(RETAIL_PROMOTIONS_ERROR_HTTP_STATUS.DISCOUNT_AFTER_QUOTE).toBe(409);
|
|
45
45
|
expect(RETAIL_PROMOTIONS_ERROR_HTTP_STATUS.CODE_NOT_OWNED).toBe(422);
|
|
46
|
-
expect(Object.keys(RetailPromotionsErrorCodeEnum)).toHaveLength(
|
|
46
|
+
expect(Object.keys(RetailPromotionsErrorCodeEnum)).toHaveLength(34);
|
|
47
47
|
expect(RETAIL_PROMOTIONS_ERROR_HTTP_STATUS.SPLIT_FINANCING_DISABLED).toBe(409);
|
|
48
48
|
});
|
|
49
49
|
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
import 'reflect-metadata';
|
|
2
|
+
import {
|
|
3
|
+
RETAIL_PROMOTIONS_ERROR_HTTP_STATUS,
|
|
4
|
+
RetailPromotionsErrorCodeEnum,
|
|
5
|
+
SalePromotion,
|
|
6
|
+
SalePromotionSystemKeyEnum,
|
|
7
|
+
WelcomeBonusPromotionResponse,
|
|
8
|
+
} from '../../../src/retailPromotions/index';
|
|
9
|
+
import { WelcomeBonusAmountSourceEnum } from '../../../src/retailCustomer/index';
|
|
10
|
+
|
|
11
|
+
describe('promo de sistema del bono de bienvenida', () => {
|
|
12
|
+
it('la llave de sistema solo tiene WELCOME_BONUS', () => {
|
|
13
|
+
expect(Object.values(SalePromotionSystemKeyEnum)).toEqual(['WELCOME_BONUS']);
|
|
14
|
+
});
|
|
15
|
+
|
|
16
|
+
it('la promo de venta expone systemKey opcional', () => {
|
|
17
|
+
const systemKey: SalePromotion['systemKey'] = SalePromotionSystemKeyEnum.WELCOME_BONUS;
|
|
18
|
+
expect(systemKey).toBe('WELCOME_BONUS');
|
|
19
|
+
});
|
|
20
|
+
|
|
21
|
+
it('la respuesta privada trae id, estado y monto', () => {
|
|
22
|
+
const response: WelcomeBonusPromotionResponse = { promotionId: 'p', active: true, amountCents: 2500 };
|
|
23
|
+
expect(Object.keys(response)).toEqual(['promotionId', 'active', 'amountCents']);
|
|
24
|
+
});
|
|
25
|
+
|
|
26
|
+
it('los candados de la promo de sistema son 422', () => {
|
|
27
|
+
expect(RETAIL_PROMOTIONS_ERROR_HTTP_STATUS[RetailPromotionsErrorCodeEnum.SYSTEM_PROMOTION_TRANSITION_NOT_ALLOWED]).toBe(422);
|
|
28
|
+
expect(RETAIL_PROMOTIONS_ERROR_HTTP_STATUS[RetailPromotionsErrorCodeEnum.SYSTEM_PROMOTION_FIELD_LOCKED]).toBe(422);
|
|
29
|
+
});
|
|
30
|
+
|
|
31
|
+
it('el monto del bono puede salir de la promo de venta', () => {
|
|
32
|
+
expect(WelcomeBonusAmountSourceEnum.SALE_PROMOTION).toBe('SALE_PROMOTION');
|
|
33
|
+
});
|
|
34
|
+
});
|
|
@@ -8,5 +8,7 @@ export declare enum WelcomeBonusAmountSourceEnum {
|
|
|
8
8
|
/** Parámetro de negocio de `loan-config` (`WELCOME_BONUS/amount_cents`). */
|
|
9
9
|
PARAM = "PARAM",
|
|
10
10
|
/** Default local del wizard, usado porque `loan-config` no respondió. */
|
|
11
|
-
DEFAULT = "DEFAULT"
|
|
11
|
+
DEFAULT = "DEFAULT",
|
|
12
|
+
/** Monto de la promo de venta de sistema `WELCOME_BONUS` del retailer. */
|
|
13
|
+
SALE_PROMOTION = "SALE_PROMOTION"
|
|
12
14
|
}
|
|
@@ -13,4 +13,6 @@ var WelcomeBonusAmountSourceEnum;
|
|
|
13
13
|
WelcomeBonusAmountSourceEnum["PARAM"] = "PARAM";
|
|
14
14
|
/** Default local del wizard, usado porque `loan-config` no respondió. */
|
|
15
15
|
WelcomeBonusAmountSourceEnum["DEFAULT"] = "DEFAULT";
|
|
16
|
+
/** Monto de la promo de venta de sistema `WELCOME_BONUS` del retailer. */
|
|
17
|
+
WelcomeBonusAmountSourceEnum["SALE_PROMOTION"] = "SALE_PROMOTION";
|
|
16
18
|
})(WelcomeBonusAmountSourceEnum || (exports.WelcomeBonusAmountSourceEnum = WelcomeBonusAmountSourceEnum = {}));
|
|
@@ -36,4 +36,6 @@ exports.RETAIL_PROMOTIONS_ERROR_HTTP_STATUS = {
|
|
|
36
36
|
[RetailPromotionsErrorCodeEnum_1.RetailPromotionsErrorCodeEnum.SPLIT_FINANCING_DISABLED]: 409,
|
|
37
37
|
[RetailPromotionsErrorCodeEnum_1.RetailPromotionsErrorCodeEnum.PROMOTION_NOT_STACKABLE]: 422,
|
|
38
38
|
[RetailPromotionsErrorCodeEnum_1.RetailPromotionsErrorCodeEnum.PROMOTION_PAYMENT_NOT_ELIGIBLE]: 422,
|
|
39
|
+
[RetailPromotionsErrorCodeEnum_1.RetailPromotionsErrorCodeEnum.SYSTEM_PROMOTION_TRANSITION_NOT_ALLOWED]: 422,
|
|
40
|
+
[RetailPromotionsErrorCodeEnum_1.RetailPromotionsErrorCodeEnum.SYSTEM_PROMOTION_FIELD_LOCKED]: 422,
|
|
39
41
|
};
|
|
@@ -2,11 +2,14 @@ import { PromotionAppliesToEnum } from '../enums/PromotionAppliesToEnum';
|
|
|
2
2
|
import { PromotionPaymentOptionEnum } from '../enums/PromotionPaymentOptionEnum';
|
|
3
3
|
import { SalePromotionPhaseEnum } from '../enums/SalePromotionPhaseEnum';
|
|
4
4
|
import { SalePromotionStatusEnum } from '../enums/SalePromotionStatusEnum';
|
|
5
|
+
import { SalePromotionSystemKeyEnum } from '../enums/SalePromotionSystemKeyEnum';
|
|
5
6
|
import { SalePromotionLevers, SalePromotionScope, SalePromotionSegmentation } from './SalePromotionLevers';
|
|
6
7
|
/** Promo de venta tal como la devuelve el CRUD. Dinero en centavos, fechas ISO. */
|
|
7
8
|
export interface SalePromotion {
|
|
8
9
|
promotionId: string;
|
|
9
10
|
retailerId: string;
|
|
11
|
+
/** Presente solo en promos sembradas por el sistema; ausente en las del admin. */
|
|
12
|
+
systemKey?: SalePromotionSystemKeyEnum;
|
|
10
13
|
name: string;
|
|
11
14
|
/** Texto que ve el cliente en el wizard. */
|
|
12
15
|
customerText: string;
|
|
@@ -48,5 +48,9 @@ export declare enum RetailPromotionsErrorCodeEnum {
|
|
|
48
48
|
/** La promo no acumulable choca con otra en la misma línea. */
|
|
49
49
|
PROMOTION_NOT_STACKABLE = "PROMOTION_NOT_STACKABLE",
|
|
50
50
|
/** La promo no acepta la forma de pago o el medio de cobro de la venta. */
|
|
51
|
-
PROMOTION_PAYMENT_NOT_ELIGIBLE = "PROMOTION_PAYMENT_NOT_ELIGIBLE"
|
|
51
|
+
PROMOTION_PAYMENT_NOT_ELIGIBLE = "PROMOTION_PAYMENT_NOT_ELIGIBLE",
|
|
52
|
+
/** La promo de sistema solo admite pausar y reanudar. */
|
|
53
|
+
SYSTEM_PROMOTION_TRANSITION_NOT_ALLOWED = "SYSTEM_PROMOTION_TRANSITION_NOT_ALLOWED",
|
|
54
|
+
/** De la promo de sistema solo se edita el monto del bono. */
|
|
55
|
+
SYSTEM_PROMOTION_FIELD_LOCKED = "SYSTEM_PROMOTION_FIELD_LOCKED"
|
|
52
56
|
}
|
|
@@ -53,4 +53,8 @@ var RetailPromotionsErrorCodeEnum;
|
|
|
53
53
|
RetailPromotionsErrorCodeEnum["PROMOTION_NOT_STACKABLE"] = "PROMOTION_NOT_STACKABLE";
|
|
54
54
|
/** La promo no acepta la forma de pago o el medio de cobro de la venta. */
|
|
55
55
|
RetailPromotionsErrorCodeEnum["PROMOTION_PAYMENT_NOT_ELIGIBLE"] = "PROMOTION_PAYMENT_NOT_ELIGIBLE";
|
|
56
|
+
/** La promo de sistema solo admite pausar y reanudar. */
|
|
57
|
+
RetailPromotionsErrorCodeEnum["SYSTEM_PROMOTION_TRANSITION_NOT_ALLOWED"] = "SYSTEM_PROMOTION_TRANSITION_NOT_ALLOWED";
|
|
58
|
+
/** De la promo de sistema solo se edita el monto del bono. */
|
|
59
|
+
RetailPromotionsErrorCodeEnum["SYSTEM_PROMOTION_FIELD_LOCKED"] = "SYSTEM_PROMOTION_FIELD_LOCKED";
|
|
56
60
|
})(RetailPromotionsErrorCodeEnum || (exports.RetailPromotionsErrorCodeEnum = RetailPromotionsErrorCodeEnum = {}));
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.SalePromotionSystemKeyEnum = void 0;
|
|
4
|
+
/** Promos de venta que siembra el sistema; solo se pausan, reanudan o editan su monto. */
|
|
5
|
+
var SalePromotionSystemKeyEnum;
|
|
6
|
+
(function (SalePromotionSystemKeyEnum) {
|
|
7
|
+
/** Bono de bienvenida por apertura de cuenta, una por retailer. */
|
|
8
|
+
SalePromotionSystemKeyEnum["WELCOME_BONUS"] = "WELCOME_BONUS";
|
|
9
|
+
})(SalePromotionSystemKeyEnum || (exports.SalePromotionSystemKeyEnum = SalePromotionSystemKeyEnum = {}));
|
|
@@ -19,6 +19,7 @@ export * from './enums/SaleCouponAvailabilityEnum';
|
|
|
19
19
|
export * from './enums/RetailPromotionsErrorCodeEnum';
|
|
20
20
|
export * from './enums/SalePromotionKindEnum';
|
|
21
21
|
export * from './enums/SkuSalePromotionLookupStatusEnum';
|
|
22
|
+
export * from './enums/SalePromotionSystemKeyEnum';
|
|
22
23
|
export * from './constants/retailPromotionsErrorHttpStatus';
|
|
23
24
|
export * from './constants/salePromotionTransitions';
|
|
24
25
|
export * from './constants/bonusPreMoney';
|
|
@@ -60,3 +61,4 @@ export * from './dtos/responses/WizardSalePromotionResponses';
|
|
|
60
61
|
export * from './dtos/responses/SkuSalePromotionsResponse';
|
|
61
62
|
export * from './dtos/responses/SalePromotionSegmentsResponse';
|
|
62
63
|
export * from './dtos/responses/ActiveSalePromotionsBySkusResponse';
|
|
64
|
+
export * from './dtos/responses/WelcomeBonusPromotionResponse';
|
|
@@ -36,6 +36,7 @@ __exportStar(require("./enums/SaleCouponAvailabilityEnum"), exports);
|
|
|
36
36
|
__exportStar(require("./enums/RetailPromotionsErrorCodeEnum"), exports);
|
|
37
37
|
__exportStar(require("./enums/SalePromotionKindEnum"), exports);
|
|
38
38
|
__exportStar(require("./enums/SkuSalePromotionLookupStatusEnum"), exports);
|
|
39
|
+
__exportStar(require("./enums/SalePromotionSystemKeyEnum"), exports);
|
|
39
40
|
// Constantes y helpers puros
|
|
40
41
|
__exportStar(require("./constants/retailPromotionsErrorHttpStatus"), exports);
|
|
41
42
|
__exportStar(require("./constants/salePromotionTransitions"), exports);
|
|
@@ -82,3 +83,4 @@ __exportStar(require("./dtos/responses/WizardSalePromotionResponses"), exports);
|
|
|
82
83
|
__exportStar(require("./dtos/responses/SkuSalePromotionsResponse"), exports);
|
|
83
84
|
__exportStar(require("./dtos/responses/SalePromotionSegmentsResponse"), exports);
|
|
84
85
|
__exportStar(require("./dtos/responses/ActiveSalePromotionsBySkusResponse"), exports);
|
|
86
|
+
__exportStar(require("./dtos/responses/WelcomeBonusPromotionResponse"), exports);
|
package/package.json
CHANGED
|
@@ -9,4 +9,6 @@ export enum WelcomeBonusAmountSourceEnum {
|
|
|
9
9
|
PARAM = 'PARAM',
|
|
10
10
|
/** Default local del wizard, usado porque `loan-config` no respondió. */
|
|
11
11
|
DEFAULT = 'DEFAULT',
|
|
12
|
+
/** Monto de la promo de venta de sistema `WELCOME_BONUS` del retailer. */
|
|
13
|
+
SALE_PROMOTION = 'SALE_PROMOTION',
|
|
12
14
|
}
|
|
@@ -34,4 +34,6 @@ export const RETAIL_PROMOTIONS_ERROR_HTTP_STATUS: Readonly<Record<C, 400 | 403 |
|
|
|
34
34
|
[C.SPLIT_FINANCING_DISABLED]: 409,
|
|
35
35
|
[C.PROMOTION_NOT_STACKABLE]: 422,
|
|
36
36
|
[C.PROMOTION_PAYMENT_NOT_ELIGIBLE]: 422,
|
|
37
|
+
[C.SYSTEM_PROMOTION_TRANSITION_NOT_ALLOWED]: 422,
|
|
38
|
+
[C.SYSTEM_PROMOTION_FIELD_LOCKED]: 422,
|
|
37
39
|
};
|
|
@@ -2,12 +2,15 @@ import { PromotionAppliesToEnum } from '../enums/PromotionAppliesToEnum';
|
|
|
2
2
|
import { PromotionPaymentOptionEnum } from '../enums/PromotionPaymentOptionEnum';
|
|
3
3
|
import { SalePromotionPhaseEnum } from '../enums/SalePromotionPhaseEnum';
|
|
4
4
|
import { SalePromotionStatusEnum } from '../enums/SalePromotionStatusEnum';
|
|
5
|
+
import { SalePromotionSystemKeyEnum } from '../enums/SalePromotionSystemKeyEnum';
|
|
5
6
|
import { SalePromotionLevers, SalePromotionScope, SalePromotionSegmentation } from './SalePromotionLevers';
|
|
6
7
|
|
|
7
8
|
/** Promo de venta tal como la devuelve el CRUD. Dinero en centavos, fechas ISO. */
|
|
8
9
|
export interface SalePromotion {
|
|
9
10
|
promotionId: string;
|
|
10
11
|
retailerId: string;
|
|
12
|
+
/** Presente solo en promos sembradas por el sistema; ausente en las del admin. */
|
|
13
|
+
systemKey?: SalePromotionSystemKeyEnum;
|
|
11
14
|
name: string;
|
|
12
15
|
/** Texto que ve el cliente en el wizard. */
|
|
13
16
|
customerText: string;
|
|
@@ -49,4 +49,8 @@ export enum RetailPromotionsErrorCodeEnum {
|
|
|
49
49
|
PROMOTION_NOT_STACKABLE = 'PROMOTION_NOT_STACKABLE',
|
|
50
50
|
/** La promo no acepta la forma de pago o el medio de cobro de la venta. */
|
|
51
51
|
PROMOTION_PAYMENT_NOT_ELIGIBLE = 'PROMOTION_PAYMENT_NOT_ELIGIBLE',
|
|
52
|
+
/** La promo de sistema solo admite pausar y reanudar. */
|
|
53
|
+
SYSTEM_PROMOTION_TRANSITION_NOT_ALLOWED = 'SYSTEM_PROMOTION_TRANSITION_NOT_ALLOWED',
|
|
54
|
+
/** De la promo de sistema solo se edita el monto del bono. */
|
|
55
|
+
SYSTEM_PROMOTION_FIELD_LOCKED = 'SYSTEM_PROMOTION_FIELD_LOCKED',
|
|
52
56
|
}
|
|
@@ -20,6 +20,7 @@ export * from './enums/SaleCouponAvailabilityEnum';
|
|
|
20
20
|
export * from './enums/RetailPromotionsErrorCodeEnum';
|
|
21
21
|
export * from './enums/SalePromotionKindEnum';
|
|
22
22
|
export * from './enums/SkuSalePromotionLookupStatusEnum';
|
|
23
|
+
export * from './enums/SalePromotionSystemKeyEnum';
|
|
23
24
|
|
|
24
25
|
// Constantes y helpers puros
|
|
25
26
|
export * from './constants/retailPromotionsErrorHttpStatus';
|
|
@@ -71,3 +72,4 @@ export * from './dtos/responses/WizardSalePromotionResponses';
|
|
|
71
72
|
export * from './dtos/responses/SkuSalePromotionsResponse';
|
|
72
73
|
export * from './dtos/responses/SalePromotionSegmentsResponse';
|
|
73
74
|
export * from './dtos/responses/ActiveSalePromotionsBySkusResponse';
|
|
75
|
+
export * from './dtos/responses/WelcomeBonusPromotionResponse';
|