@fiado/type-kit 3.482.0 → 3.483.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.
|
@@ -0,0 +1,56 @@
|
|
|
1
|
+
import 'reflect-metadata';
|
|
2
|
+
import {
|
|
3
|
+
GetSaleCouponResponse,
|
|
4
|
+
SaleAppliedPromotion,
|
|
5
|
+
SaleCouponAvailabilityEnum,
|
|
6
|
+
SalePromotionKindEnum,
|
|
7
|
+
} from '../../../src/retailPromotions/index';
|
|
8
|
+
|
|
9
|
+
const gift: SaleAppliedPromotion = {
|
|
10
|
+
promotionId: 'promo-gift',
|
|
11
|
+
version: 2,
|
|
12
|
+
name: 'Regalo de mica',
|
|
13
|
+
kind: SalePromotionKindEnum.GIFT,
|
|
14
|
+
};
|
|
15
|
+
|
|
16
|
+
const sale: SaleAppliedPromotion = {
|
|
17
|
+
promotionId: 'promo-sale',
|
|
18
|
+
version: 1,
|
|
19
|
+
name: 'Descuento de temporada',
|
|
20
|
+
kind: SalePromotionKindEnum.SALE,
|
|
21
|
+
};
|
|
22
|
+
|
|
23
|
+
describe('GetSaleCouponResponse.appliedPromotions', () => {
|
|
24
|
+
it('lleva las promos de regalo y de venta con su versión y nombre', () => {
|
|
25
|
+
const response: GetSaleCouponResponse = {
|
|
26
|
+
saleId: 'sale-1',
|
|
27
|
+
availability: Object.values(SaleCouponAvailabilityEnum)[0],
|
|
28
|
+
coupon: null,
|
|
29
|
+
entitlements: [],
|
|
30
|
+
appliedPromotions: [gift, sale],
|
|
31
|
+
};
|
|
32
|
+
|
|
33
|
+
expect(response.appliedPromotions.map((p) => p.kind)).toEqual([
|
|
34
|
+
SalePromotionKindEnum.GIFT,
|
|
35
|
+
SalePromotionKindEnum.SALE,
|
|
36
|
+
]);
|
|
37
|
+
expect(response.appliedPromotions[0]).toEqual({
|
|
38
|
+
promotionId: 'promo-gift',
|
|
39
|
+
version: 2,
|
|
40
|
+
name: 'Regalo de mica',
|
|
41
|
+
kind: SalePromotionKindEnum.GIFT,
|
|
42
|
+
});
|
|
43
|
+
});
|
|
44
|
+
|
|
45
|
+
it('acepta una venta sin promos aplicadas', () => {
|
|
46
|
+
const response: GetSaleCouponResponse = {
|
|
47
|
+
saleId: 'sale-2',
|
|
48
|
+
availability: Object.values(SaleCouponAvailabilityEnum)[0],
|
|
49
|
+
coupon: null,
|
|
50
|
+
entitlements: [],
|
|
51
|
+
appliedPromotions: [],
|
|
52
|
+
};
|
|
53
|
+
|
|
54
|
+
expect(response.appliedPromotions).toHaveLength(0);
|
|
55
|
+
});
|
|
56
|
+
});
|
|
@@ -106,10 +106,19 @@ export interface SaleEntitlement {
|
|
|
106
106
|
amountCents: number | null;
|
|
107
107
|
quantity: number | null;
|
|
108
108
|
}
|
|
109
|
+
/** Promo que tomó una venta cerrada, con el nombre que tenía en esa versión. */
|
|
110
|
+
export interface SaleAppliedPromotion {
|
|
111
|
+
promotionId: string;
|
|
112
|
+
version: number;
|
|
113
|
+
name: string;
|
|
114
|
+
kind: SalePromotionKindEnum;
|
|
115
|
+
}
|
|
109
116
|
/** Cupón y «lo que se lleva» de una venta cerrada (publicGetSaleCoupon). */
|
|
110
117
|
export interface GetSaleCouponResponse {
|
|
111
118
|
saleId: string;
|
|
112
119
|
availability: SaleCouponAvailabilityEnum;
|
|
113
120
|
coupon: SaleCoupon | null;
|
|
114
121
|
entitlements: SaleEntitlement[];
|
|
122
|
+
/** Promos que aplicaron a la venta (regalo y venta), con su nombre en esa versión. */
|
|
123
|
+
appliedPromotions: SaleAppliedPromotion[];
|
|
115
124
|
}
|
package/package.json
CHANGED
|
@@ -120,10 +120,20 @@ export interface SaleEntitlement {
|
|
|
120
120
|
quantity: number | null;
|
|
121
121
|
}
|
|
122
122
|
|
|
123
|
+
/** Promo que tomó una venta cerrada, con el nombre que tenía en esa versión. */
|
|
124
|
+
export interface SaleAppliedPromotion {
|
|
125
|
+
promotionId: string;
|
|
126
|
+
version: number;
|
|
127
|
+
name: string;
|
|
128
|
+
kind: SalePromotionKindEnum;
|
|
129
|
+
}
|
|
130
|
+
|
|
123
131
|
/** Cupón y «lo que se lleva» de una venta cerrada (publicGetSaleCoupon). */
|
|
124
132
|
export interface GetSaleCouponResponse {
|
|
125
133
|
saleId: string;
|
|
126
134
|
availability: SaleCouponAvailabilityEnum;
|
|
127
135
|
coupon: SaleCoupon | null;
|
|
128
136
|
entitlements: SaleEntitlement[];
|
|
137
|
+
/** Promos que aplicaron a la venta (regalo y venta), con su nombre en esa versión. */
|
|
138
|
+
appliedPromotions: SaleAppliedPromotion[];
|
|
129
139
|
}
|