@pisell/pisellos 2.2.267 → 2.2.269
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/dist/core/index.d.ts +2 -0
- package/dist/core/index.js +7 -0
- package/dist/model/strategy/adapter/promotion/adapter.d.ts +4 -0
- package/dist/model/strategy/adapter/promotion/adapter.js +23 -0
- package/dist/model/strategy/adapter/promotion/evaluator.d.ts +17 -0
- package/dist/model/strategy/adapter/promotion/evaluator.js +279 -6
- package/dist/model/strategy/adapter/promotion/examples.d.ts +86 -0
- package/dist/model/strategy/adapter/promotion/examples.js +99 -0
- package/dist/model/strategy/adapter/promotion/index.d.ts +1 -1
- package/dist/model/strategy/adapter/promotion/index.js +9 -0
- package/dist/model/strategy/adapter/promotion/type.d.ts +90 -2
- package/dist/model/strategy/adapter/promotion/type.js +45 -0
- package/dist/modules/BookingContext/utils/buildCacheItemFromOrderLine.js +12 -10
- package/dist/modules/OpenData/index.d.ts +2 -0
- package/dist/modules/OpenData/index.js +8 -0
- package/dist/modules/Order/index.d.ts +33 -13
- package/dist/modules/Order/index.js +883 -524
- package/dist/modules/Order/payment-utils.d.ts +26 -0
- package/dist/modules/Order/payment-utils.js +225 -0
- package/dist/modules/Order/types.d.ts +56 -4
- package/dist/modules/Order/types.js +11 -0
- package/dist/modules/Order/utils/orderCollectionIdentity.js +7 -2
- package/dist/modules/Order/utils.js +10 -6
- package/dist/modules/Payment/index.d.ts +2 -0
- package/dist/modules/Payment/index.js +78 -49
- package/dist/modules/Payment/types.d.ts +104 -25
- package/dist/modules/Payment/types.js +17 -0
- package/dist/modules/Payment/walletpass.d.ts +38 -1
- package/dist/modules/Payment/walletpass.js +917 -114
- package/dist/modules/Rules/index.d.ts +3 -0
- package/dist/modules/Rules/index.js +146 -106
- package/dist/modules/SalesSummary/utils.js +7 -1
- package/dist/server/index.d.ts +16 -0
- package/dist/server/index.js +1940 -1043
- package/dist/server/modules/index.d.ts +1 -1
- package/dist/server/modules/order/index.d.ts +70 -4
- package/dist/server/modules/order/index.js +1816 -728
- package/dist/server/modules/order/types.d.ts +25 -3
- package/dist/server/modules/order/types.js +7 -1
- package/dist/solution/BaseSales/index.d.ts +118 -9
- package/dist/solution/BaseSales/index.js +1849 -480
- package/dist/solution/BaseSales/types.d.ts +55 -1
- package/dist/solution/BaseSales/types.js +2 -1
- package/dist/solution/BaseSales/utils/cartPromotion.d.ts +3 -1
- package/dist/solution/BaseSales/utils/cartPromotion.js +90 -31
- package/dist/solution/BaseSales/utils/parseSalesResponse.d.ts +6 -1
- package/dist/solution/BaseSales/utils/transformBaseProductToOrderProduct.js +6 -3
- package/dist/solution/BookingTicket/index.d.ts +8 -16
- package/dist/solution/BookingTicket/index.js +138 -52
- package/dist/solution/BookingTicket/types.d.ts +4 -0
- package/dist/solution/BookingTicket/utils/cartView.js +44 -32
- package/dist/solution/BookingTicket/utils/scan/applyGlobalScan.d.ts +8 -0
- package/dist/solution/BookingTicket/utils/scan/applyGlobalScan.js +173 -83
- package/dist/solution/Sales/index.d.ts +2 -0
- package/dist/solution/Sales/index.js +26 -4
- package/dist/solution/ScanOrder/index.js +31 -20
- package/dist/solution/VenueBooking/index.d.ts +1 -0
- package/dist/solution/VenueBooking/index.js +30 -19
- package/dist/types/index.d.ts +1 -0
- package/dist/utils/payment-number.d.ts +9 -0
- package/dist/utils/payment-number.js +69 -0
- package/lib/core/index.d.ts +2 -0
- package/lib/core/index.js +4 -0
- package/lib/model/strategy/adapter/promotion/adapter.d.ts +4 -0
- package/lib/model/strategy/adapter/promotion/adapter.js +20 -0
- package/lib/model/strategy/adapter/promotion/evaluator.d.ts +17 -0
- package/lib/model/strategy/adapter/promotion/evaluator.js +235 -0
- package/lib/model/strategy/adapter/promotion/examples.d.ts +86 -0
- package/lib/model/strategy/adapter/promotion/examples.js +91 -0
- package/lib/model/strategy/adapter/promotion/index.d.ts +1 -1
- package/lib/model/strategy/adapter/promotion/type.d.ts +90 -2
- package/lib/model/strategy/adapter/promotion/type.js +2 -0
- package/lib/modules/BookingContext/utils/buildCacheItemFromOrderLine.js +3 -1
- package/lib/modules/OpenData/index.d.ts +2 -0
- package/lib/modules/OpenData/index.js +5 -0
- package/lib/modules/Order/index.d.ts +33 -13
- package/lib/modules/Order/index.js +306 -79
- package/lib/modules/Order/payment-utils.d.ts +26 -0
- package/lib/modules/Order/payment-utils.js +224 -0
- package/lib/modules/Order/types.d.ts +56 -4
- package/lib/modules/Order/utils/orderCollectionIdentity.js +3 -0
- package/lib/modules/Order/utils.js +11 -4
- package/lib/modules/Payment/index.d.ts +2 -0
- package/lib/modules/Payment/index.js +33 -12
- package/lib/modules/Payment/types.d.ts +104 -25
- package/lib/modules/Payment/types.js +1 -0
- package/lib/modules/Payment/walletpass.d.ts +38 -1
- package/lib/modules/Payment/walletpass.js +730 -21
- package/lib/modules/Rules/index.d.ts +3 -0
- package/lib/modules/Rules/index.js +54 -21
- package/lib/modules/SalesSummary/utils.js +5 -1
- package/lib/server/index.d.ts +16 -0
- package/lib/server/index.js +670 -18
- package/lib/server/modules/index.d.ts +1 -1
- package/lib/server/modules/order/index.d.ts +70 -4
- package/lib/server/modules/order/index.js +818 -69
- package/lib/server/modules/order/types.d.ts +25 -3
- package/lib/server/modules/order/types.js +1 -0
- package/lib/solution/BaseSales/index.d.ts +118 -9
- package/lib/solution/BaseSales/index.js +902 -38
- package/lib/solution/BaseSales/types.d.ts +55 -1
- package/lib/solution/BaseSales/types.js +2 -1
- package/lib/solution/BaseSales/utils/cartPromotion.d.ts +3 -1
- package/lib/solution/BaseSales/utils/cartPromotion.js +63 -12
- package/lib/solution/BaseSales/utils/parseSalesResponse.d.ts +6 -1
- package/lib/solution/BaseSales/utils/transformBaseProductToOrderProduct.js +3 -2
- package/lib/solution/BookingTicket/index.d.ts +8 -16
- package/lib/solution/BookingTicket/index.js +63 -9
- package/lib/solution/BookingTicket/types.d.ts +4 -0
- package/lib/solution/BookingTicket/utils/cartView.js +43 -30
- package/lib/solution/BookingTicket/utils/scan/applyGlobalScan.d.ts +8 -0
- package/lib/solution/BookingTicket/utils/scan/applyGlobalScan.js +37 -5
- package/lib/solution/Sales/index.d.ts +2 -0
- package/lib/solution/Sales/index.js +20 -6
- package/lib/solution/ScanOrder/index.js +8 -0
- package/lib/solution/VenueBooking/index.d.ts +1 -0
- package/lib/solution/VenueBooking/index.js +8 -0
- package/lib/types/index.d.ts +1 -0
- package/lib/utils/payment-number.d.ts +9 -0
- package/lib/utils/payment-number.js +64 -0
- package/package.json +1 -1
|
@@ -27,6 +27,8 @@ export declare class RulesModule extends BaseModule implements Module, RulesModu
|
|
|
27
27
|
}): {
|
|
28
28
|
isAvailable: boolean;
|
|
29
29
|
discountList: Discount[];
|
|
30
|
+
/** 完整规则计算后的列表;调用方可用于保留暂时无适用商品的扫码卡券。 */
|
|
31
|
+
evaluatedDiscountList?: Discount[];
|
|
30
32
|
productList: any[];
|
|
31
33
|
unavailableReason?: UnavailableReason;
|
|
32
34
|
};
|
|
@@ -35,6 +37,7 @@ export declare class RulesModule extends BaseModule implements Module, RulesModu
|
|
|
35
37
|
excludeDiscountListByType(discountList: Discount[], type: string): Discount[];
|
|
36
38
|
/** 手动改价场景:去掉 promotion,保留 type=product 等行内折扣 */
|
|
37
39
|
resolveDiscountListForManualOverride(discountList: Discount[]): Discount[];
|
|
40
|
+
private isItemRewardProductDiscount;
|
|
38
41
|
private getUnavailableReason;
|
|
39
42
|
calcDiscount({ discountList, productList, holders, isFormSubject, orderTotalAmount }: {
|
|
40
43
|
discountList: Discount[];
|
|
@@ -94,7 +94,7 @@ var RulesModule = class extends import_BaseModule.BaseModule {
|
|
|
94
94
|
productList
|
|
95
95
|
};
|
|
96
96
|
}
|
|
97
|
-
if (productList.every((item) => {
|
|
97
|
+
if (productList.length > 0 && productList.every((item) => {
|
|
98
98
|
var _a;
|
|
99
99
|
const product = this.hooks.getProduct(item);
|
|
100
100
|
return product.booking_id && (((_a = product.discount_list) == null ? void 0 : _a.length) || product.total == 0);
|
|
@@ -152,6 +152,7 @@ var RulesModule = class extends import_BaseModule.BaseModule {
|
|
|
152
152
|
return {
|
|
153
153
|
isAvailable: hasApplicableDiscount,
|
|
154
154
|
discountList: hasApplicableDiscount ? result.discountList : oldDiscountList,
|
|
155
|
+
evaluatedDiscountList: result.discountList,
|
|
155
156
|
productList: hasApplicableDiscount ? result.productList : productList,
|
|
156
157
|
unavailableReason
|
|
157
158
|
};
|
|
@@ -167,13 +168,27 @@ var RulesModule = class extends import_BaseModule.BaseModule {
|
|
|
167
168
|
resolveDiscountListForManualOverride(discountList) {
|
|
168
169
|
return this.excludeDiscountListByType(discountList, "promotion");
|
|
169
170
|
}
|
|
171
|
+
isItemRewardProductDiscount(product) {
|
|
172
|
+
var _a;
|
|
173
|
+
const discountList = Array.isArray(product == null ? void 0 : product.discount_list) ? product.discount_list : [];
|
|
174
|
+
return ((_a = product == null ? void 0 : product._promotion) == null ? void 0 : _a.actionType) === "ITEM_REWARD" && discountList.some(
|
|
175
|
+
(item) => {
|
|
176
|
+
var _a2, _b;
|
|
177
|
+
return (item == null ? void 0 : item.type) === "product" && ((_a2 = item == null ? void 0 : item.metadata) == null ? void 0 : _a2.source) === "promotion" && ((_b = item == null ? void 0 : item.metadata) == null ? void 0 : _b.actionType) === "ITEM_REWARD";
|
|
178
|
+
}
|
|
179
|
+
);
|
|
180
|
+
}
|
|
170
181
|
// 获取券不可用的原因
|
|
171
182
|
getUnavailableReason(discountList, productList) {
|
|
172
183
|
var _a;
|
|
173
184
|
for (const discount of discountList) {
|
|
174
|
-
|
|
185
|
+
const bookingTimes = productList.length ? productList.map((item) => {
|
|
175
186
|
const product = this.hooks.getProduct(item);
|
|
176
|
-
|
|
187
|
+
return ((product == null ? void 0 : product.startDate) || (0, import_dayjs.default)()).format(
|
|
188
|
+
"YYYY-MM-DD HH:mm:ss"
|
|
189
|
+
);
|
|
190
|
+
}) : [(0, import_dayjs.default)().format("YYYY-MM-DD HH:mm:ss")];
|
|
191
|
+
for (const bookingTime of bookingTimes) {
|
|
177
192
|
const filteredList = (0, import_utils.filterDiscountListByBookingTime)([discount], bookingTime);
|
|
178
193
|
if (filteredList.length === 0) {
|
|
179
194
|
return import_types.UnavailableReason.TimeLimit;
|
|
@@ -228,7 +243,7 @@ var RulesModule = class extends import_BaseModule.BaseModule {
|
|
|
228
243
|
const discountType = selectedDiscount.tag || selectedDiscount.type;
|
|
229
244
|
return selectedDiscount.isEditMode === true && selectedDiscount.isSelected === true && ["good_pass", "discount_card", "product_discount_card"].includes(discountType);
|
|
230
245
|
};
|
|
231
|
-
const
|
|
246
|
+
const resolveReapplyBookingDiscountPercent = (originProduct, selectedDiscount) => {
|
|
232
247
|
var _a2;
|
|
233
248
|
if (!shouldReapplyBookingDiscount(originProduct, selectedDiscount))
|
|
234
249
|
return void 0;
|
|
@@ -302,8 +317,10 @@ var RulesModule = class extends import_BaseModule.BaseModule {
|
|
|
302
317
|
bundleIndex,
|
|
303
318
|
// 虚拟商品属性
|
|
304
319
|
price: Number(bundleItem.price || 0),
|
|
305
|
-
|
|
306
|
-
//
|
|
320
|
+
// 新增商品运行态通常带 _bundle_product_id;订单 hydrate 后只有
|
|
321
|
+
// bundle_product_id。Change time 必须兼容两种结构,否则 bundle
|
|
322
|
+
// 子项无法命中折扣卡的 limited_relation_product_data.product_ids。
|
|
323
|
+
id: bundleItem.bundle_product_id ?? bundleItem._bundle_product_id ?? bundleItem.product_id,
|
|
307
324
|
_id: `${product._id}_bundle_${bundleIndex}`,
|
|
308
325
|
parentId: product._id,
|
|
309
326
|
num: bundleItem.num || 1,
|
|
@@ -500,6 +517,9 @@ var RulesModule = class extends import_BaseModule.BaseModule {
|
|
|
500
517
|
startDate: (_a2 = flatItem.parentProduct) == null ? void 0 : _a2.startDate
|
|
501
518
|
};
|
|
502
519
|
}
|
|
520
|
+
if (this.isItemRewardProductDiscount(product)) {
|
|
521
|
+
return false;
|
|
522
|
+
}
|
|
503
523
|
const isAvailableProduct = flatItem.type === "main" ? !((product == null ? void 0 : product.booking_id) && ((_b = product == null ? void 0 : product.discount_list) == null ? void 0 : _b.length) && ((_c = product == null ? void 0 : product.discount_list) == null ? void 0 : _c.every((d) => d.id && ["good_pass", "discount_card", "product_discount_card"].includes(d.tag || d.type)))) : !((flatItem == null ? void 0 : flatItem.booking_id) && !!((_e = (_d = flatItem == null ? void 0 : flatItem.bundleItem) == null ? void 0 : _d.discount_list) == null ? void 0 : _e.length) && ((_g = (_f = flatItem == null ? void 0 : flatItem.bundleItem) == null ? void 0 : _f.discount_list) == null ? void 0 : _g.every((d) => d.id)));
|
|
504
524
|
if (!isAvailableProduct) {
|
|
505
525
|
return false;
|
|
@@ -625,6 +645,7 @@ var RulesModule = class extends import_BaseModule.BaseModule {
|
|
|
625
645
|
};
|
|
626
646
|
originProduct = flatItem.originProduct;
|
|
627
647
|
}
|
|
648
|
+
const isItemRewardProductDiscount = this.isItemRewardProductDiscount(product);
|
|
628
649
|
addModeDiscount.forEach((discount) => {
|
|
629
650
|
var _a3, _b, _c, _d, _e, _f, _g, _h, _i, _j;
|
|
630
651
|
const limitedData = discount == null ? void 0 : discount.limited_relation_product_data;
|
|
@@ -648,7 +669,7 @@ var RulesModule = class extends import_BaseModule.BaseModule {
|
|
|
648
669
|
].includes(discount2.tag || discount2.type)
|
|
649
670
|
))) : !((flatItem == null ? void 0 : flatItem.booking_id) && !!((_d = (_c = flatItem == null ? void 0 : flatItem.bundleItem) == null ? void 0 : _c.discount_list) == null ? void 0 : _d.length) && ((_f = (_e = flatItem == null ? void 0 : flatItem.bundleItem) == null ? void 0 : _e.discount_list) == null ? void 0 : _f.every((discount2) => discount2.id)));
|
|
650
671
|
const isBundleAvailable = this.checkPackageSubItemUsageRules(discount, flatItem);
|
|
651
|
-
if (isAvailableProduct && isLimitedProduct && timeLimit && isBundleAvailable && ((_g = discount.config) == null ? void 0 : _g.isAvailable)) {
|
|
672
|
+
if (isAvailableProduct && !isItemRewardProductDiscount && isLimitedProduct && timeLimit && isBundleAvailable && ((_g = discount.config) == null ? void 0 : _g.isAvailable)) {
|
|
652
673
|
(_h = discountApplicability.get(discount.id)) == null ? void 0 : _h.push(product.id);
|
|
653
674
|
const applicableProducts = discountApplicableProducts.get(discount.id) || [];
|
|
654
675
|
const discountType = discount.tag || discount.type;
|
|
@@ -759,18 +780,13 @@ var RulesModule = class extends import_BaseModule.BaseModule {
|
|
|
759
780
|
if (isPersistedProduct && hasExistingWalletDiscount) {
|
|
760
781
|
if (flatItem.type === "main") {
|
|
761
782
|
processedProductsMap.set(product._id, [originProduct]);
|
|
762
|
-
} else {
|
|
763
|
-
processedFlatItemsMap.set(flatItem._id, [
|
|
764
|
-
{
|
|
765
|
-
...flatItem,
|
|
766
|
-
processed: true
|
|
767
|
-
}
|
|
768
|
-
]);
|
|
769
783
|
}
|
|
770
784
|
return;
|
|
771
785
|
}
|
|
772
786
|
const applicableDiscounts = sortedDiscountList.filter((discount) => {
|
|
773
787
|
var _a3, _b2, _c2, _d2;
|
|
788
|
+
if (this.isItemRewardProductDiscount(product))
|
|
789
|
+
return false;
|
|
774
790
|
const discountType = discount.tag || discount.type;
|
|
775
791
|
const currentOriginUid = getOriginProductUid(originProduct);
|
|
776
792
|
const isReapplyEditModeDiscountForProduct = discount.isEditMode && reapplyBookingDiscountProductUids.size > 0 && currentOriginUid && reapplyBookingDiscountProductUids.has(String(currentOriginUid)) && discount.isSelected === true;
|
|
@@ -840,11 +856,17 @@ var RulesModule = class extends import_BaseModule.BaseModule {
|
|
|
840
856
|
}
|
|
841
857
|
return false;
|
|
842
858
|
});
|
|
843
|
-
const
|
|
859
|
+
const explicitlySelectedDiscountCard = (options == null ? void 0 : options.isSelected) === true && options.discountId !== void 0 ? applicableDiscounts.find((discount) => {
|
|
860
|
+
const discountType = discount.tag || discount.type;
|
|
861
|
+
return String(discount.id) === String(options.discountId) && ["discount_card", "product_discount_card"].includes(discountType);
|
|
862
|
+
}) : void 0;
|
|
863
|
+
const scannedSelectedDiscountCard = applicableDiscounts.find(
|
|
844
864
|
(n) => n.isScan && n.isSelected && (n.tag || n.type) !== "good_pass"
|
|
845
865
|
);
|
|
866
|
+
const selectedDiscountCard = explicitlySelectedDiscountCard || scannedSelectedDiscountCard;
|
|
846
867
|
const selectedDiscount = selectedDiscountCard || applicableDiscounts[0];
|
|
847
868
|
let isManualDiscount = false;
|
|
869
|
+
let isItemRewardProductDiscount = false;
|
|
848
870
|
if (flatItem.type === "main") {
|
|
849
871
|
isManualDiscount = typeof product.isManualDiscount === "boolean" ? product.isManualDiscount : ((_g = product.discount_list) == null ? void 0 : _g.some((item) => item.type === "product")) || product.total != product.origin_total && (product.bundle || []).every(
|
|
850
872
|
(item) => {
|
|
@@ -855,7 +877,8 @@ var RulesModule = class extends import_BaseModule.BaseModule {
|
|
|
855
877
|
_i,
|
|
856
878
|
(item) => item.type === "product"
|
|
857
879
|
)));
|
|
858
|
-
|
|
880
|
+
isItemRewardProductDiscount = this.isItemRewardProductDiscount(product);
|
|
881
|
+
if (product.inPromotion && !isItemRewardProductDiscount) {
|
|
859
882
|
isManualDiscount = false;
|
|
860
883
|
}
|
|
861
884
|
} else {
|
|
@@ -969,7 +992,7 @@ var RulesModule = class extends import_BaseModule.BaseModule {
|
|
|
969
992
|
} else {
|
|
970
993
|
let total = product.inPromotion ? ((_w = product == null ? void 0 : product._promotion) == null ? void 0 : _w.finalPrice) ?? product.origin_total ?? product.total : product.origin_total ?? product.total;
|
|
971
994
|
let main_product_selling_price = product.price;
|
|
972
|
-
if ((product.discount_list || []).some((item) => item.type === "promotion") || (0, import_lodash_es.isBoolean)(product.vouchersApplicable) && !product.vouchersApplicable) {
|
|
995
|
+
if ((product.discount_list || []).some((item) => item.type === "promotion") || isItemRewardProductDiscount || (0, import_lodash_es.isBoolean)(product.vouchersApplicable) && !product.vouchersApplicable) {
|
|
973
996
|
total = product.total ?? product.origin_total;
|
|
974
997
|
main_product_selling_price = product.main_product_selling_price ?? main_product_selling_price;
|
|
975
998
|
}
|
|
@@ -977,7 +1000,8 @@ var RulesModule = class extends import_BaseModule.BaseModule {
|
|
|
977
1000
|
this.hooks.setProduct(originProduct, {
|
|
978
1001
|
...isManualDiscount ? {
|
|
979
1002
|
price: product.price,
|
|
980
|
-
main_product_selling_price: product.price
|
|
1003
|
+
main_product_selling_price: isItemRewardProductDiscount ? main_product_selling_price : product.price,
|
|
1004
|
+
...isItemRewardProductDiscount ? { total } : {}
|
|
981
1005
|
} : {
|
|
982
1006
|
_id: product._id.split("___")[0] + "___" + index,
|
|
983
1007
|
total,
|
|
@@ -1061,8 +1085,8 @@ var RulesModule = class extends import_BaseModule.BaseModule {
|
|
|
1061
1085
|
amount = productAllocation.discountAmount;
|
|
1062
1086
|
productDiscountDifference = productAllocation.difference;
|
|
1063
1087
|
mainProductSellingPrice = Math.max(new import_decimal.default(product.price).minus(amount).toNumber(), 0);
|
|
1064
|
-
} else if (
|
|
1065
|
-
const percent =
|
|
1088
|
+
} else if (resolveReapplyBookingDiscountPercent(originProduct, selectedDiscount2) !== void 0) {
|
|
1089
|
+
const percent = resolveReapplyBookingDiscountPercent(originProduct, selectedDiscount2);
|
|
1066
1090
|
reapplyDiscountPercent = new import_decimal.default(percent).toFixed(2);
|
|
1067
1091
|
mainProductSellingPrice = new import_decimal.default(product.price || 0).mul(new import_decimal.default(100).minus(percent)).div(100).toDecimalPlaces(2).toNumber();
|
|
1068
1092
|
amount = new import_decimal.default(product.price).minus(mainProductSellingPrice).toNumber();
|
|
@@ -1235,10 +1259,19 @@ var RulesModule = class extends import_BaseModule.BaseModule {
|
|
|
1235
1259
|
let targetProductTotal;
|
|
1236
1260
|
let fixedAmountPerItem;
|
|
1237
1261
|
let productDiscountDifference;
|
|
1262
|
+
let reapplyDiscountPercent;
|
|
1238
1263
|
if (isOrderLevel && productAllocation) {
|
|
1239
1264
|
fixedAmountPerItem = productAllocation.discountAmount;
|
|
1240
1265
|
productDiscountDifference = productAllocation.difference;
|
|
1241
1266
|
targetProductTotal = Math.max(new import_decimal.default(productOriginTotal).minus(fixedAmountPerItem).toNumber(), 0);
|
|
1267
|
+
} else if (resolveReapplyBookingDiscountPercent(originProduct, selectedDiscount2) !== void 0) {
|
|
1268
|
+
const percent = resolveReapplyBookingDiscountPercent(
|
|
1269
|
+
originProduct,
|
|
1270
|
+
selectedDiscount2
|
|
1271
|
+
);
|
|
1272
|
+
reapplyDiscountPercent = new import_decimal.default(percent).toFixed(2);
|
|
1273
|
+
targetProductTotal = new import_decimal.default(productOriginTotal).mul(new import_decimal.default(100).minus(percent)).div(100).toDecimalPlaces(2).toNumber();
|
|
1274
|
+
fixedAmountPerItem = new import_decimal.default(productOriginTotal).minus(targetProductTotal).toNumber();
|
|
1242
1275
|
} else {
|
|
1243
1276
|
targetProductTotal = (0, import_utils.getDiscountAmount)(
|
|
1244
1277
|
selectedDiscount2,
|
|
@@ -1260,7 +1293,7 @@ var RulesModule = class extends import_BaseModule.BaseModule {
|
|
|
1260
1293
|
title: selectedDiscount2.format_title,
|
|
1261
1294
|
original_amount: product.original_price,
|
|
1262
1295
|
product_id: product.id || product.product_id,
|
|
1263
|
-
percent: selectedDiscount2.par_value,
|
|
1296
|
+
percent: reapplyDiscountPercent ?? selectedDiscount2.par_value,
|
|
1264
1297
|
discount_product_id: selectedDiscount2.product_id
|
|
1265
1298
|
},
|
|
1266
1299
|
metadata: {
|
|
@@ -99,7 +99,11 @@ function getUnitOriginalTotal(product) {
|
|
|
99
99
|
function isGeneratedVoucherProduct(product) {
|
|
100
100
|
const record = product;
|
|
101
101
|
const metadata = (record == null ? void 0 : record.metadata) || {};
|
|
102
|
-
|
|
102
|
+
const isGeneratedChild = metadata.parent_order_detail_id !== void 0 || metadata.gift_card_type !== void 0;
|
|
103
|
+
if (isGeneratedChild)
|
|
104
|
+
return true;
|
|
105
|
+
const isPersisted = (record == null ? void 0 : record.order_detail_id) !== void 0 && (record == null ? void 0 : record.order_detail_id) !== null;
|
|
106
|
+
return (record == null ? void 0 : record.extension_type) === "product_voucher" && !isPersisted;
|
|
103
107
|
}
|
|
104
108
|
function buildSurchargeServiceItems(products) {
|
|
105
109
|
return products.map((product) => {
|
package/lib/server/index.d.ts
CHANGED
|
@@ -57,6 +57,7 @@ declare class Server {
|
|
|
57
57
|
private readonly BOOKING_REMOTE_CACHE_MAX_ENTRIES;
|
|
58
58
|
private salesSearchSubscribers;
|
|
59
59
|
private deviceTaskActionsRegistered;
|
|
60
|
+
private localPaymentUpdateQueues;
|
|
60
61
|
private floorPlanQuerySubscribers;
|
|
61
62
|
private moduleRegistry;
|
|
62
63
|
constructor(core: PisellCore);
|
|
@@ -120,6 +121,8 @@ declare class Server {
|
|
|
120
121
|
private handleSyncSalesTask;
|
|
121
122
|
private runCheckoutSync;
|
|
122
123
|
private omitCheckoutSyncMode;
|
|
124
|
+
private buildRemoteCheckoutData;
|
|
125
|
+
private mergeCheckoutSyncPayments;
|
|
123
126
|
private persistSyncedCheckoutOrder;
|
|
124
127
|
/**
|
|
125
128
|
* 将普通层 QuotationModule 的报价单计算能力桥接到 Server Products 模块。
|
|
@@ -453,6 +456,18 @@ declare class Server {
|
|
|
453
456
|
*/
|
|
454
457
|
private handleUpdateLocalOrder;
|
|
455
458
|
private handleOrderSalesCheckout;
|
|
459
|
+
private handleOrderSalesDraft;
|
|
460
|
+
private createLocalPaymentOperationId;
|
|
461
|
+
private buildLocalPaymentOrderLogContext;
|
|
462
|
+
private isValidLocalPaymentDecimal;
|
|
463
|
+
private getInvalidLocalPaymentSurchargeFields;
|
|
464
|
+
private buildLocalPaymentSurchargeUpdate;
|
|
465
|
+
private handleGetLocalPayment;
|
|
466
|
+
private handleUpdateLocalPayment;
|
|
467
|
+
private runLocalPaymentUpdateInQueue;
|
|
468
|
+
private processLocalPaymentUpdate;
|
|
469
|
+
private processSuccessfulLocalPayment;
|
|
470
|
+
private sanitizeLocalRecoveryOrder;
|
|
456
471
|
private handleOrderCheckout;
|
|
457
472
|
private getDeviceTaskPlugin;
|
|
458
473
|
private getIdGeneratorPlugin;
|
|
@@ -480,6 +495,7 @@ declare class Server {
|
|
|
480
495
|
private syncMachinecodeRedeemStatusToLocalOrder;
|
|
481
496
|
private handleOrderCheckoutSubmit;
|
|
482
497
|
private handleSyncCheckoutSubmit;
|
|
498
|
+
private handleOrderDraftSubmit;
|
|
483
499
|
private handlePendingSyncCheckoutOrder;
|
|
484
500
|
private buildPendingSyncCheckoutOrder;
|
|
485
501
|
private shouldBuildSmallTicketData;
|