@managesome/eposmatic-toolkit 0.2.258 → 0.2.260
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/lib/helpers/store/cart-actions.js +95 -78
- package/lib/helpers/utils/common.d.ts +9 -0
- package/lib/helpers/utils/common.js +21 -0
- package/lib/helpers/utils/offers-helpers.d.ts +2 -0
- package/lib/helpers/utils/offers-helpers.js +25 -2
- package/lib/schemas/models/offers.d.ts +6 -0
- package/lib/schemas/models/offers.js +10 -0
- package/lib/schemas/models/offers_fingerprints.d.ts +6 -3
- package/lib/schemas/models/offers_fingerprints.js +6 -2
- package/lib/schemas/types/offers.d.ts +2 -0
- package/lib/schemas/types/offers_fingerprints.d.ts +2 -1
- package/package.json +1 -1
|
@@ -1993,60 +1993,82 @@ offers) {
|
|
|
1993
1993
|
};
|
|
1994
1994
|
let hasChanges = false;
|
|
1995
1995
|
const categories = data.categories ?? [];
|
|
1996
|
+
const orderLevelDiscountBaseAmount = categories.reduce((subtotal, category) => {
|
|
1997
|
+
return subtotal + category.items.reduce((itemSubtotal, item) => itemSubtotal + (item.subtotal ?? 0), 0);
|
|
1998
|
+
}, 0);
|
|
1996
1999
|
let order_discount_details = data.order_discount_details;
|
|
2000
|
+
const clearOrderLevelDiscount = (discountType) => {
|
|
2001
|
+
if (order_discount_details == null) {
|
|
2002
|
+
return;
|
|
2003
|
+
}
|
|
2004
|
+
if (discountType === 'loyalty') {
|
|
2005
|
+
order_discount_details = {
|
|
2006
|
+
...order_discount_details,
|
|
2007
|
+
loyalty_discount_id: undefined,
|
|
2008
|
+
loyalty_discount_name: undefined,
|
|
2009
|
+
loyalty_discount: undefined,
|
|
2010
|
+
is_loyalty_discount_percentage: false,
|
|
2011
|
+
};
|
|
2012
|
+
}
|
|
2013
|
+
else {
|
|
2014
|
+
order_discount_details = {
|
|
2015
|
+
...order_discount_details,
|
|
2016
|
+
voucher_discount_id: undefined,
|
|
2017
|
+
voucher_discount_name: undefined,
|
|
2018
|
+
voucher_discount: undefined,
|
|
2019
|
+
is_voucher_discount_percentage: false,
|
|
2020
|
+
};
|
|
2021
|
+
}
|
|
2022
|
+
hasChanges = true;
|
|
2023
|
+
};
|
|
1997
2024
|
if (order_discount_details != null) {
|
|
1998
2025
|
// we check if either the loyalty_discount_id or voucher_discount_id
|
|
1999
2026
|
const loyaltyDiscountId = order_discount_details.loyalty_discount_id;
|
|
2000
2027
|
if (loyaltyDiscountId != null) {
|
|
2001
2028
|
if (unlockedOffersMap[loyaltyDiscountId] == null || unlockedOffersMap[loyaltyDiscountId] <= 0) {
|
|
2002
|
-
|
|
2003
|
-
...order_discount_details,
|
|
2004
|
-
loyalty_discount_id: undefined,
|
|
2005
|
-
loyalty_discount_name: undefined,
|
|
2006
|
-
loyalty_discount: undefined,
|
|
2007
|
-
is_loyalty_discount_percentage: false,
|
|
2008
|
-
};
|
|
2009
|
-
hasChanges = true;
|
|
2029
|
+
clearOrderLevelDiscount('loyalty');
|
|
2010
2030
|
}
|
|
2011
2031
|
else {
|
|
2012
2032
|
// Find the offer to check for excluded_refs
|
|
2013
2033
|
const loyaltyOffer = offers.find((o) => o._id === loyaltyDiscountId);
|
|
2014
2034
|
if (loyaltyOffer?.reward_discount != null) {
|
|
2015
|
-
|
|
2016
|
-
const {
|
|
2017
|
-
|
|
2018
|
-
|
|
2019
|
-
|
|
2020
|
-
|
|
2021
|
-
|
|
2022
|
-
|
|
2023
|
-
|
|
2024
|
-
|
|
2025
|
-
|
|
2026
|
-
|
|
2027
|
-
|
|
2028
|
-
|
|
2029
|
-
|
|
2030
|
-
|
|
2031
|
-
|
|
2032
|
-
|
|
2033
|
-
|
|
2034
|
-
|
|
2035
|
-
|
|
2036
|
-
|
|
2037
|
-
|
|
2038
|
-
|
|
2039
|
-
|
|
2040
|
-
};
|
|
2041
|
-
hasChanges = true;
|
|
2035
|
+
const { discount_value, excluded_refs, is_discount_percentage, max_discount_amount, max_discount_percentage, } = loyaltyOffer.reward_discount;
|
|
2036
|
+
const { subtotal: eligibleSubtotal, hasExcludedRefs } = excluded_refs != null && excluded_refs.length > 0
|
|
2037
|
+
? calculateEligibleOfferDiscountDetails(categories, excluded_refs)
|
|
2038
|
+
: {
|
|
2039
|
+
subtotal: orderLevelDiscountBaseAmount,
|
|
2040
|
+
hasExcludedRefs: false,
|
|
2041
|
+
};
|
|
2042
|
+
// Static discounts with exclusions are not supported - silently skip
|
|
2043
|
+
if (hasExcludedRefs && !is_discount_percentage) {
|
|
2044
|
+
clearOrderLevelDiscount('loyalty');
|
|
2045
|
+
}
|
|
2046
|
+
else {
|
|
2047
|
+
const hasRelevantCap = is_discount_percentage &&
|
|
2048
|
+
max_discount_amount != null &&
|
|
2049
|
+
Number.isFinite(max_discount_amount) &&
|
|
2050
|
+
max_discount_amount >= 0;
|
|
2051
|
+
const hasRelevantPercentageCap = !is_discount_percentage &&
|
|
2052
|
+
max_discount_percentage != null &&
|
|
2053
|
+
Number.isFinite(max_discount_percentage) &&
|
|
2054
|
+
max_discount_percentage >= 0;
|
|
2055
|
+
const shouldNormalizeToStatic = hasExcludedRefs || hasRelevantCap || hasRelevantPercentageCap;
|
|
2056
|
+
const discountBaseAmount = hasExcludedRefs ? eligibleSubtotal : orderLevelDiscountBaseAmount;
|
|
2057
|
+
if (shouldNormalizeToStatic) {
|
|
2058
|
+
if (discountBaseAmount <= 0) {
|
|
2059
|
+
clearOrderLevelDiscount('loyalty');
|
|
2042
2060
|
}
|
|
2043
2061
|
else {
|
|
2044
|
-
|
|
2045
|
-
|
|
2046
|
-
|
|
2062
|
+
const calculatedDiscount = (0, utils_1.getCappedOfferDiscountAmount)({
|
|
2063
|
+
baseAmount: discountBaseAmount,
|
|
2064
|
+
discountValue: discount_value,
|
|
2065
|
+
isDiscountPercentage: is_discount_percentage,
|
|
2066
|
+
maxDiscountAmount: max_discount_amount,
|
|
2067
|
+
maxDiscountPercentage: max_discount_percentage,
|
|
2068
|
+
});
|
|
2047
2069
|
order_discount_details = {
|
|
2048
2070
|
...order_discount_details,
|
|
2049
|
-
loyalty_discount: (0, utils_1.parseNum)(
|
|
2071
|
+
loyalty_discount: (0, utils_1.parseNum)(calculatedDiscount),
|
|
2050
2072
|
is_loyalty_discount_percentage: false,
|
|
2051
2073
|
};
|
|
2052
2074
|
hasChanges = true;
|
|
@@ -2060,54 +2082,49 @@ offers) {
|
|
|
2060
2082
|
const voucherDiscountId = order_discount_details.voucher_discount_id;
|
|
2061
2083
|
if (voucherDiscountId != null) {
|
|
2062
2084
|
if (unlockedOffersMap[voucherDiscountId] == null || unlockedOffersMap[voucherDiscountId] <= 0) {
|
|
2063
|
-
|
|
2064
|
-
...order_discount_details,
|
|
2065
|
-
voucher_discount_id: undefined,
|
|
2066
|
-
voucher_discount_name: undefined,
|
|
2067
|
-
voucher_discount: undefined,
|
|
2068
|
-
is_voucher_discount_percentage: false,
|
|
2069
|
-
};
|
|
2070
|
-
hasChanges = true;
|
|
2085
|
+
clearOrderLevelDiscount('voucher');
|
|
2071
2086
|
}
|
|
2072
2087
|
else {
|
|
2073
2088
|
// Find the offer to check for excluded_refs
|
|
2074
2089
|
const voucherOffer = offers.find((o) => o._id === voucherDiscountId);
|
|
2075
2090
|
if (voucherOffer?.reward_discount != null) {
|
|
2076
|
-
|
|
2077
|
-
const {
|
|
2078
|
-
|
|
2079
|
-
|
|
2080
|
-
|
|
2081
|
-
|
|
2082
|
-
|
|
2083
|
-
|
|
2084
|
-
|
|
2085
|
-
|
|
2086
|
-
|
|
2087
|
-
|
|
2088
|
-
|
|
2089
|
-
|
|
2090
|
-
|
|
2091
|
-
|
|
2092
|
-
|
|
2093
|
-
|
|
2094
|
-
|
|
2095
|
-
|
|
2096
|
-
|
|
2097
|
-
|
|
2098
|
-
|
|
2099
|
-
|
|
2100
|
-
|
|
2101
|
-
};
|
|
2102
|
-
hasChanges = true;
|
|
2091
|
+
const { discount_value, excluded_refs, is_discount_percentage, max_discount_amount, max_discount_percentage, } = voucherOffer.reward_discount;
|
|
2092
|
+
const { subtotal: eligibleSubtotal, hasExcludedRefs } = excluded_refs != null && excluded_refs.length > 0
|
|
2093
|
+
? calculateEligibleOfferDiscountDetails(categories, excluded_refs)
|
|
2094
|
+
: {
|
|
2095
|
+
subtotal: orderLevelDiscountBaseAmount,
|
|
2096
|
+
hasExcludedRefs: false,
|
|
2097
|
+
};
|
|
2098
|
+
// Static discounts with exclusions are not supported - silently skip
|
|
2099
|
+
if (hasExcludedRefs && !is_discount_percentage) {
|
|
2100
|
+
clearOrderLevelDiscount('voucher');
|
|
2101
|
+
}
|
|
2102
|
+
else {
|
|
2103
|
+
const hasRelevantCap = is_discount_percentage &&
|
|
2104
|
+
max_discount_amount != null &&
|
|
2105
|
+
Number.isFinite(max_discount_amount) &&
|
|
2106
|
+
max_discount_amount >= 0;
|
|
2107
|
+
const hasRelevantPercentageCap = !is_discount_percentage &&
|
|
2108
|
+
max_discount_percentage != null &&
|
|
2109
|
+
Number.isFinite(max_discount_percentage) &&
|
|
2110
|
+
max_discount_percentage >= 0;
|
|
2111
|
+
const shouldNormalizeToStatic = hasExcludedRefs || hasRelevantCap || hasRelevantPercentageCap;
|
|
2112
|
+
const discountBaseAmount = hasExcludedRefs ? eligibleSubtotal : orderLevelDiscountBaseAmount;
|
|
2113
|
+
if (shouldNormalizeToStatic) {
|
|
2114
|
+
if (discountBaseAmount <= 0) {
|
|
2115
|
+
clearOrderLevelDiscount('voucher');
|
|
2103
2116
|
}
|
|
2104
2117
|
else {
|
|
2105
|
-
|
|
2106
|
-
|
|
2107
|
-
|
|
2118
|
+
const calculatedDiscount = (0, utils_1.getCappedOfferDiscountAmount)({
|
|
2119
|
+
baseAmount: discountBaseAmount,
|
|
2120
|
+
discountValue: discount_value,
|
|
2121
|
+
isDiscountPercentage: is_discount_percentage,
|
|
2122
|
+
maxDiscountAmount: max_discount_amount,
|
|
2123
|
+
maxDiscountPercentage: max_discount_percentage,
|
|
2124
|
+
});
|
|
2108
2125
|
order_discount_details = {
|
|
2109
2126
|
...order_discount_details,
|
|
2110
|
-
voucher_discount: (0, utils_1.parseNum)(
|
|
2127
|
+
voucher_discount: (0, utils_1.parseNum)(calculatedDiscount),
|
|
2111
2128
|
is_voucher_discount_percentage: false,
|
|
2112
2129
|
};
|
|
2113
2130
|
hasChanges = true;
|
|
@@ -34,3 +34,12 @@ export declare function formattedStoreName(name: string): string;
|
|
|
34
34
|
export declare const formatFieldName: (field: string) => string;
|
|
35
35
|
export declare function getPercentage(total: number, num: number): number;
|
|
36
36
|
export declare function getPercentageAmount(total: number, percent: number): number;
|
|
37
|
+
interface IGetCappedOfferDiscountAmount {
|
|
38
|
+
baseAmount: number;
|
|
39
|
+
discountValue: number;
|
|
40
|
+
isDiscountPercentage: boolean;
|
|
41
|
+
maxDiscountAmount?: number | null;
|
|
42
|
+
maxDiscountPercentage?: number | null;
|
|
43
|
+
}
|
|
44
|
+
export declare function getCappedOfferDiscountAmount({ baseAmount, discountValue, isDiscountPercentage, maxDiscountAmount, maxDiscountPercentage, }: IGetCappedOfferDiscountAmount): number;
|
|
45
|
+
export {};
|
|
@@ -28,6 +28,7 @@ exports.getFormattedCancellationReason = getFormattedCancellationReason;
|
|
|
28
28
|
exports.formattedStoreName = formattedStoreName;
|
|
29
29
|
exports.getPercentage = getPercentage;
|
|
30
30
|
exports.getPercentageAmount = getPercentageAmount;
|
|
31
|
+
exports.getCappedOfferDiscountAmount = getCappedOfferDiscountAmount;
|
|
31
32
|
const google_libphonenumber_1 = require("google-libphonenumber");
|
|
32
33
|
const moment_1 = __importDefault(require("moment"));
|
|
33
34
|
const constants_1 = require("../../constants");
|
|
@@ -330,3 +331,23 @@ function getPercentage(total, num) {
|
|
|
330
331
|
function getPercentageAmount(total, percent) {
|
|
331
332
|
return (total * percent) / 100;
|
|
332
333
|
}
|
|
334
|
+
function getCappedOfferDiscountAmount({ baseAmount, discountValue, isDiscountPercentage, maxDiscountAmount, maxDiscountPercentage, }) {
|
|
335
|
+
const normalizedBaseAmount = Number.isFinite(baseAmount) ? Math.max(0, baseAmount) : 0;
|
|
336
|
+
const normalizedDiscountValue = Number.isFinite(discountValue) ? Math.max(0, discountValue) : 0;
|
|
337
|
+
if (normalizedBaseAmount <= 0 || normalizedDiscountValue <= 0) {
|
|
338
|
+
return 0;
|
|
339
|
+
}
|
|
340
|
+
if (isDiscountPercentage) {
|
|
341
|
+
let amount = getPercentageAmount(normalizedBaseAmount, normalizedDiscountValue);
|
|
342
|
+
if (maxDiscountAmount != null && Number.isFinite(maxDiscountAmount) && maxDiscountAmount >= 0) {
|
|
343
|
+
amount = Math.min(amount, maxDiscountAmount);
|
|
344
|
+
}
|
|
345
|
+
return Math.min(amount, normalizedBaseAmount);
|
|
346
|
+
}
|
|
347
|
+
let amount = normalizedDiscountValue;
|
|
348
|
+
if (maxDiscountPercentage != null && Number.isFinite(maxDiscountPercentage) && maxDiscountPercentage >= 0) {
|
|
349
|
+
const maxAmountFromPercentage = getPercentageAmount(normalizedBaseAmount, maxDiscountPercentage);
|
|
350
|
+
amount = Math.min(amount, maxAmountFromPercentage);
|
|
351
|
+
}
|
|
352
|
+
return Math.min(amount, normalizedBaseAmount);
|
|
353
|
+
}
|
|
@@ -22,6 +22,8 @@ export interface IRewardPreview {
|
|
|
22
22
|
label: string;
|
|
23
23
|
discount_value?: number;
|
|
24
24
|
is_percentage?: boolean;
|
|
25
|
+
max_discount_amount?: number | null;
|
|
26
|
+
max_discount_percentage?: number | null;
|
|
25
27
|
free_items_count?: number;
|
|
26
28
|
points_value?: number;
|
|
27
29
|
cashback_value?: number;
|
|
@@ -100,6 +100,14 @@ function getOfferWithPrice(offer, writeable) {
|
|
|
100
100
|
delete newOffer.reward_cashback;
|
|
101
101
|
delete newOffer.reward_gift_cards;
|
|
102
102
|
}
|
|
103
|
+
if (newOffer.reward_type === constants_1.OFFER_REWARD_TYPE_ENUM.DISCOUNT && newOffer.reward_discount != null) {
|
|
104
|
+
if (newOffer.reward_discount.is_discount_percentage) {
|
|
105
|
+
newOffer.reward_discount.max_discount_percentage = null;
|
|
106
|
+
}
|
|
107
|
+
else {
|
|
108
|
+
newOffer.reward_discount.max_discount_amount = null;
|
|
109
|
+
}
|
|
110
|
+
}
|
|
103
111
|
}
|
|
104
112
|
return {
|
|
105
113
|
...newOffer,
|
|
@@ -151,6 +159,12 @@ function getOfferWithPrice(offer, writeable) {
|
|
|
151
159
|
reward_discount: {
|
|
152
160
|
...newOffer.reward_discount,
|
|
153
161
|
discount_value: convertToNum(newOffer.reward_discount.discount_value),
|
|
162
|
+
max_discount_amount: newOffer.reward_discount.max_discount_amount != null
|
|
163
|
+
? convertToNum(newOffer.reward_discount.max_discount_amount)
|
|
164
|
+
: null,
|
|
165
|
+
max_discount_percentage: newOffer.reward_discount.max_discount_percentage != null
|
|
166
|
+
? convertToNum(newOffer.reward_discount.max_discount_percentage)
|
|
167
|
+
: null,
|
|
154
168
|
},
|
|
155
169
|
}
|
|
156
170
|
: {}),
|
|
@@ -506,12 +520,21 @@ function buildRewardPreview(offer) {
|
|
|
506
520
|
case constants_1.OFFER_REWARD_TYPE_ENUM.DISCOUNT: {
|
|
507
521
|
if (offer.reward_discount == null)
|
|
508
522
|
return null;
|
|
509
|
-
const { discount_value, is_discount_percentage } = offer.reward_discount;
|
|
523
|
+
const { discount_value, is_discount_percentage, max_discount_amount, max_discount_percentage } = offer.reward_discount;
|
|
524
|
+
let label = is_discount_percentage ? `${discount_value}% off` : `${discount_value} off`;
|
|
525
|
+
if (is_discount_percentage && max_discount_amount != null) {
|
|
526
|
+
label += ` (max ${max_discount_amount})`;
|
|
527
|
+
}
|
|
528
|
+
if (!is_discount_percentage && max_discount_percentage != null) {
|
|
529
|
+
label += ` (max ${max_discount_percentage}%)`;
|
|
530
|
+
}
|
|
510
531
|
return {
|
|
511
532
|
type: constants_1.OFFER_REWARD_TYPE_ENUM.DISCOUNT,
|
|
512
|
-
label
|
|
533
|
+
label,
|
|
513
534
|
discount_value,
|
|
514
535
|
is_percentage: is_discount_percentage,
|
|
536
|
+
max_discount_amount,
|
|
537
|
+
max_discount_percentage,
|
|
515
538
|
};
|
|
516
539
|
}
|
|
517
540
|
case constants_1.OFFER_REWARD_TYPE_ENUM.DISCOUNT_ITEMS: {
|
|
@@ -356,6 +356,8 @@ export declare const OfferSchema: Schema<any, import("mongoose").Model<any, any,
|
|
|
356
356
|
is_discount_percentage: boolean;
|
|
357
357
|
excluded_refs: string[];
|
|
358
358
|
discount_value: number;
|
|
359
|
+
max_discount_amount?: number | null | undefined;
|
|
360
|
+
max_discount_percentage?: number | null | undefined;
|
|
359
361
|
} | null | undefined;
|
|
360
362
|
reward_discount_items?: {
|
|
361
363
|
is_discount_percentage: boolean;
|
|
@@ -743,6 +745,8 @@ export declare const OfferSchema: Schema<any, import("mongoose").Model<any, any,
|
|
|
743
745
|
is_discount_percentage: boolean;
|
|
744
746
|
excluded_refs: string[];
|
|
745
747
|
discount_value: number;
|
|
748
|
+
max_discount_amount?: number | null | undefined;
|
|
749
|
+
max_discount_percentage?: number | null | undefined;
|
|
746
750
|
} | null | undefined;
|
|
747
751
|
reward_discount_items?: {
|
|
748
752
|
is_discount_percentage: boolean;
|
|
@@ -1130,6 +1134,8 @@ export declare const OfferSchema: Schema<any, import("mongoose").Model<any, any,
|
|
|
1130
1134
|
is_discount_percentage: boolean;
|
|
1131
1135
|
excluded_refs: string[];
|
|
1132
1136
|
discount_value: number;
|
|
1137
|
+
max_discount_amount?: number | null | undefined;
|
|
1138
|
+
max_discount_percentage?: number | null | undefined;
|
|
1133
1139
|
} | null | undefined;
|
|
1134
1140
|
reward_discount_items?: {
|
|
1135
1141
|
is_discount_percentage: boolean;
|
|
@@ -168,6 +168,16 @@ const RewardDiscountSchema = new mongoose_1.Schema({
|
|
|
168
168
|
type: Boolean,
|
|
169
169
|
required: true,
|
|
170
170
|
},
|
|
171
|
+
max_discount_amount: {
|
|
172
|
+
type: Number,
|
|
173
|
+
required: false,
|
|
174
|
+
default: null,
|
|
175
|
+
},
|
|
176
|
+
max_discount_percentage: {
|
|
177
|
+
type: Number,
|
|
178
|
+
required: false,
|
|
179
|
+
default: null,
|
|
180
|
+
},
|
|
171
181
|
excluded_refs: {
|
|
172
182
|
type: [String],
|
|
173
183
|
required: true,
|
|
@@ -8,10 +8,11 @@ export declare const OfferFingerprintSchema: Schema<any, import("mongoose").Mode
|
|
|
8
8
|
updatedAt: NativeDate;
|
|
9
9
|
} & {
|
|
10
10
|
_id: import("mongoose").Types.ObjectId;
|
|
11
|
-
|
|
11
|
+
tenants: string[];
|
|
12
12
|
createdAt_mins: number;
|
|
13
13
|
createdAt: NativeDate;
|
|
14
14
|
updatedAt: NativeDate;
|
|
15
|
+
brand_id: string;
|
|
15
16
|
customer_phone: string;
|
|
16
17
|
offer_id: import("mongoose").Types.ObjectId;
|
|
17
18
|
redeemed_times: number;
|
|
@@ -21,10 +22,11 @@ export declare const OfferFingerprintSchema: Schema<any, import("mongoose").Mode
|
|
|
21
22
|
updatedAt: NativeDate;
|
|
22
23
|
} & {
|
|
23
24
|
_id: import("mongoose").Types.ObjectId;
|
|
24
|
-
|
|
25
|
+
tenants: string[];
|
|
25
26
|
createdAt_mins: number;
|
|
26
27
|
createdAt: NativeDate;
|
|
27
28
|
updatedAt: NativeDate;
|
|
29
|
+
brand_id: string;
|
|
28
30
|
customer_phone: string;
|
|
29
31
|
offer_id: import("mongoose").Types.ObjectId;
|
|
30
32
|
redeemed_times: number;
|
|
@@ -34,10 +36,11 @@ export declare const OfferFingerprintSchema: Schema<any, import("mongoose").Mode
|
|
|
34
36
|
updatedAt: NativeDate;
|
|
35
37
|
} & {
|
|
36
38
|
_id: import("mongoose").Types.ObjectId;
|
|
37
|
-
|
|
39
|
+
tenants: string[];
|
|
38
40
|
createdAt_mins: number;
|
|
39
41
|
createdAt: NativeDate;
|
|
40
42
|
updatedAt: NativeDate;
|
|
43
|
+
brand_id: string;
|
|
41
44
|
customer_phone: string;
|
|
42
45
|
offer_id: import("mongoose").Types.ObjectId;
|
|
43
46
|
redeemed_times: number;
|
|
@@ -8,11 +8,15 @@ exports.OfferFingerprintSchema = new mongoose_1.Schema({
|
|
|
8
8
|
required: true,
|
|
9
9
|
immutable: true,
|
|
10
10
|
},
|
|
11
|
-
|
|
11
|
+
brand_id: {
|
|
12
12
|
type: String,
|
|
13
13
|
required: true,
|
|
14
14
|
immutable: true,
|
|
15
|
-
ref: '
|
|
15
|
+
ref: 'brands',
|
|
16
|
+
},
|
|
17
|
+
tenants: {
|
|
18
|
+
type: [String],
|
|
19
|
+
default: [],
|
|
16
20
|
},
|
|
17
21
|
offer_id: {
|
|
18
22
|
type: mongoose_1.Schema.Types.ObjectId,
|
|
@@ -74,6 +74,8 @@ export interface IRewardTypeDiscount {
|
|
|
74
74
|
*/
|
|
75
75
|
discount_value: number;
|
|
76
76
|
is_discount_percentage: boolean;
|
|
77
|
+
max_discount_amount: number | null;
|
|
78
|
+
max_discount_percentage: number | null;
|
|
77
79
|
excluded_refs: string[];
|
|
78
80
|
}
|
|
79
81
|
export interface IRewardTypeDiscountItems {
|