@pisell/pisellos 2.3.39 → 2.3.41
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 +5 -3
- package/dist/modules/BookingContext/utils/buildNormalProductCacheItemFromOrderLine.js +6 -3
- package/dist/modules/Discount/index.d.ts +0 -1
- package/dist/modules/Discount/index.js +11 -40
- package/dist/modules/Discount/types.d.ts +0 -1
- package/dist/modules/OpenData/index.d.ts +2 -0
- package/dist/modules/OpenData/index.js +10 -2
- package/dist/modules/Order/index.d.ts +29 -12
- package/dist/modules/Order/index.js +750 -509
- 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 +33 -10
- package/dist/modules/Order/utils/orderCollectionIdentity.js +7 -2
- package/dist/modules/Order/utils.d.ts +0 -10
- package/dist/modules/Order/utils.js +13 -41
- package/dist/modules/Payment/index.d.ts +2 -0
- package/dist/modules/Payment/index.js +79 -50
- package/dist/modules/Payment/types.d.ts +99 -28
- package/dist/modules/Payment/types.js +20 -3
- package/dist/modules/Payment/walletpass.d.ts +25 -1
- package/dist/modules/Payment/walletpass.js +707 -157
- package/dist/modules/Product/types.d.ts +0 -1
- package/dist/modules/ProductList/index.js +14 -33
- package/dist/modules/Quotation/index.d.ts +1 -1
- package/dist/modules/Quotation/index.js +2 -2
- package/dist/modules/Rules/index.d.ts +1 -0
- package/dist/modules/Rules/index.js +89 -96
- package/dist/modules/SalesSummary/index.js +13 -12
- package/dist/modules/ScanOrderLogger/index.d.ts +0 -2
- package/dist/modules/ScanOrderLogger/index.js +2 -15
- package/dist/modules/ScanOrderLogger/providers/feishu.js +27 -45
- package/dist/modules/ScanOrderLogger/types.d.ts +0 -1
- package/dist/modules/Schedule/index.d.ts +1 -3
- package/dist/modules/Schedule/index.js +16 -21
- package/dist/modules/Summary/utils.js +13 -38
- package/dist/modules/index.d.ts +0 -2
- package/dist/modules/index.js +1 -3
- package/dist/plugins/window.d.ts +0 -1
- package/dist/server/index.d.ts +16 -14
- package/dist/server/index.js +1925 -1143
- package/dist/server/modules/order/index.d.ts +54 -4
- package/dist/server/modules/order/index.js +1600 -700
- package/dist/server/modules/order/types.d.ts +11 -3
- package/dist/server/modules/order/types.js +1 -1
- package/dist/solution/BaseSales/index.d.ts +109 -20
- package/dist/solution/BaseSales/index.js +1800 -480
- package/dist/solution/BaseSales/types.d.ts +52 -0
- 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/BookingByStep/index.d.ts +2 -17
- package/dist/solution/BookingByStep/index.js +215 -294
- package/dist/solution/BookingByStep/types.d.ts +1 -2
- package/dist/solution/BookingByStep/types.js +1 -3
- package/dist/solution/BookingByStep/utils/capacity.js +1 -17
- package/dist/solution/BookingByStep/utils/timeslots.d.ts +1 -3
- package/dist/solution/BookingByStep/utils/timeslots.js +12 -19
- package/dist/solution/BookingTicket/index.d.ts +7 -3
- package/dist/solution/BookingTicket/index.js +132 -49
- package/dist/solution/BookingTicket/utils/addProductDecision.js +6 -0
- package/dist/solution/BookingTicket/utils/scan/applyGlobalScan.d.ts +8 -0
- package/dist/solution/BookingTicket/utils/scan/applyGlobalScan.js +172 -82
- package/dist/solution/BookingTicket/utils/weighingProductSku.d.ts +5 -0
- package/dist/solution/BookingTicket/utils/weighingProductSku.js +45 -0
- package/dist/solution/Sales/index.d.ts +1 -0
- package/dist/solution/Sales/index.js +10 -2
- package/dist/solution/ScanOrder/index.d.ts +14 -26
- package/dist/solution/ScanOrder/index.js +756 -1148
- package/dist/solution/ScanOrder/types.d.ts +1 -21
- package/dist/solution/ScanOrder/utils.d.ts +0 -8
- package/dist/solution/ScanOrder/utils.js +25 -66
- package/dist/solution/ShopDiscount/index.d.ts +0 -1
- package/dist/solution/ShopDiscount/index.js +87 -125
- package/dist/solution/VenueBooking/index.d.ts +11 -39
- package/dist/solution/VenueBooking/index.js +860 -1176
- package/dist/solution/VenueBooking/types.d.ts +0 -3
- package/dist/solution/VenueBooking/utils/resource.js +0 -1
- package/dist/solution/VenueBooking/utils/slotMerge.d.ts +4 -4
- package/dist/solution/VenueBooking/utils/slotMerge.js +5 -10
- package/dist/solution/index.d.ts +0 -1
- package/dist/solution/index.js +1 -2
- package/dist/types/index.d.ts +1 -1
- 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/index.js +51 -0
- 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 +2 -1
- package/lib/modules/BookingContext/utils/buildNormalProductCacheItemFromOrderLine.js +2 -1
- package/lib/modules/Discount/index.d.ts +0 -1
- package/lib/modules/Discount/index.js +0 -9
- package/lib/modules/Discount/types.d.ts +0 -1
- package/lib/modules/OpenData/index.d.ts +2 -0
- package/lib/modules/OpenData/index.js +6 -1
- package/lib/modules/Order/index.d.ts +29 -12
- package/lib/modules/Order/index.js +196 -86
- 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 +33 -10
- package/lib/modules/Order/utils/orderCollectionIdentity.js +3 -0
- package/lib/modules/Order/utils.d.ts +0 -10
- package/lib/modules/Order/utils.js +16 -40
- package/lib/modules/Payment/index.d.ts +2 -0
- package/lib/modules/Payment/index.js +34 -13
- package/lib/modules/Payment/types.d.ts +99 -28
- package/lib/modules/Payment/types.js +4 -3
- package/lib/modules/Payment/walletpass.d.ts +25 -1
- package/lib/modules/Payment/walletpass.js +470 -21
- package/lib/modules/Product/types.d.ts +0 -1
- package/lib/modules/ProductList/index.js +31 -40
- package/lib/modules/Quotation/index.d.ts +1 -1
- package/lib/modules/Quotation/index.js +2 -2
- package/lib/modules/Rules/index.d.ts +1 -0
- package/lib/modules/Rules/index.js +47 -40
- package/lib/modules/SalesSummary/index.js +7 -6
- package/lib/modules/ScanOrderLogger/index.d.ts +0 -2
- package/lib/modules/ScanOrderLogger/index.js +1 -13
- package/lib/modules/ScanOrderLogger/providers/feishu.js +6 -15
- package/lib/modules/ScanOrderLogger/types.d.ts +0 -1
- package/lib/modules/Schedule/index.d.ts +1 -3
- package/lib/modules/Schedule/index.js +8 -10
- package/lib/modules/Summary/utils.js +1 -21
- package/lib/modules/index.d.ts +0 -2
- package/lib/modules/index.js +1 -5
- package/lib/plugins/window.d.ts +0 -1
- package/lib/server/index.d.ts +16 -14
- package/lib/server/index.js +675 -83
- package/lib/server/modules/order/index.d.ts +54 -4
- package/lib/server/modules/order/index.js +679 -66
- package/lib/server/modules/order/types.d.ts +11 -3
- package/lib/solution/BaseSales/index.d.ts +109 -20
- package/lib/solution/BaseSales/index.js +883 -70
- package/lib/solution/BaseSales/types.d.ts +52 -0
- 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/BookingByStep/index.d.ts +2 -17
- package/lib/solution/BookingByStep/index.js +18 -60
- package/lib/solution/BookingByStep/types.d.ts +1 -2
- package/lib/solution/BookingByStep/types.js +0 -5
- package/lib/solution/BookingByStep/utils/capacity.js +1 -20
- package/lib/solution/BookingByStep/utils/timeslots.d.ts +1 -3
- package/lib/solution/BookingByStep/utils/timeslots.js +11 -19
- package/lib/solution/BookingTicket/index.d.ts +7 -3
- package/lib/solution/BookingTicket/index.js +62 -9
- package/lib/solution/BookingTicket/utils/addProductDecision.js +4 -0
- package/lib/solution/BookingTicket/utils/scan/applyGlobalScan.d.ts +8 -0
- package/lib/solution/BookingTicket/utils/scan/applyGlobalScan.js +36 -4
- package/lib/solution/BookingTicket/utils/weighingProductSku.d.ts +5 -0
- package/lib/solution/BookingTicket/utils/weighingProductSku.js +63 -0
- package/lib/solution/Sales/index.d.ts +1 -0
- package/lib/solution/Sales/index.js +5 -3
- package/lib/solution/ScanOrder/index.d.ts +14 -26
- package/lib/solution/ScanOrder/index.js +190 -449
- package/lib/solution/ScanOrder/types.d.ts +1 -21
- package/lib/solution/ScanOrder/utils.d.ts +0 -8
- package/lib/solution/ScanOrder/utils.js +0 -31
- package/lib/solution/ShopDiscount/index.d.ts +0 -1
- package/lib/solution/ShopDiscount/index.js +0 -14
- package/lib/solution/VenueBooking/index.d.ts +11 -39
- package/lib/solution/VenueBooking/index.js +123 -328
- package/lib/solution/VenueBooking/types.d.ts +0 -3
- package/lib/solution/VenueBooking/utils/resource.js +0 -1
- package/lib/solution/VenueBooking/utils/slotMerge.d.ts +4 -4
- package/lib/solution/VenueBooking/utils/slotMerge.js +4 -6
- package/lib/solution/index.d.ts +0 -1
- package/lib/solution/index.js +1 -3
- package/lib/types/index.d.ts +1 -1
- package/lib/utils/payment-number.d.ts +9 -0
- package/lib/utils/payment-number.js +64 -0
- package/package.json +1 -1
- package/dist/modules/Holder/index.d.ts +0 -48
- package/dist/modules/Holder/index.js +0 -640
- package/dist/modules/Holder/types.d.ts +0 -123
- package/dist/modules/Holder/types.js +0 -1
- package/dist/modules/Holder/utils.d.ts +0 -13
- package/dist/modules/Holder/utils.js +0 -34
- package/dist/modules/ResourcePlanner/index.d.ts +0 -24
- package/dist/modules/ResourcePlanner/index.js +0 -181
- package/dist/modules/ResourcePlanner/planner.d.ts +0 -14
- package/dist/modules/ResourcePlanner/planner.js +0 -1069
- package/dist/modules/ResourcePlanner/types.d.ts +0 -227
- package/dist/modules/ResourcePlanner/types.js +0 -1
- package/dist/solution/UnifiedBookingSales/index.d.ts +0 -183
- package/dist/solution/UnifiedBookingSales/index.js +0 -1871
- package/dist/solution/UnifiedBookingSales/types.d.ts +0 -143
- package/dist/solution/UnifiedBookingSales/types.js +0 -11
- package/lib/modules/Holder/index.d.ts +0 -48
- package/lib/modules/Holder/index.js +0 -402
- package/lib/modules/Holder/types.d.ts +0 -123
- package/lib/modules/Holder/types.js +0 -17
- package/lib/modules/Holder/utils.d.ts +0 -13
- package/lib/modules/Holder/utils.js +0 -71
- package/lib/modules/ResourcePlanner/index.d.ts +0 -24
- package/lib/modules/ResourcePlanner/index.js +0 -148
- package/lib/modules/ResourcePlanner/planner.d.ts +0 -14
- package/lib/modules/ResourcePlanner/planner.js +0 -933
- package/lib/modules/ResourcePlanner/types.d.ts +0 -227
- package/lib/modules/ResourcePlanner/types.js +0 -17
- package/lib/solution/UnifiedBookingSales/index.d.ts +0 -183
- package/lib/solution/UnifiedBookingSales/index.js +0 -1076
- package/lib/solution/UnifiedBookingSales/types.d.ts +0 -143
- package/lib/solution/UnifiedBookingSales/types.js +0 -33
|
@@ -37,6 +37,8 @@ var import_types = require("./types");
|
|
|
37
37
|
var import_utils = require("./utils");
|
|
38
38
|
var import_utils2 = require("../Product/utils");
|
|
39
39
|
var import_dayjs = __toESM(require("dayjs"));
|
|
40
|
+
var import_payment_utils = require("./payment-utils");
|
|
41
|
+
var import_payment_number = require("../../utils/payment-number");
|
|
40
42
|
var import_cartPromotion = require("../../solution/BaseSales/utils/cartPromotion");
|
|
41
43
|
var import_utils3 = require("../../solution/ScanOrder/utils");
|
|
42
44
|
var import_manualProductDiscount = require("./utils/manualProductDiscount");
|
|
@@ -83,6 +85,11 @@ function isPaidPaymentRecord(payment) {
|
|
|
83
85
|
function isCommittedVoucherPaymentRecord(payment) {
|
|
84
86
|
return isVoucherPaymentRecord(payment) && (payment == null ? void 0 : payment.status) !== "voided" && (hasSyncedOrderPaymentRecord(payment) || isPaidPaymentRecord(payment));
|
|
85
87
|
}
|
|
88
|
+
function getVoucherPaymentLifecycleKey(payment) {
|
|
89
|
+
if (!isVoucherPaymentRecord(payment))
|
|
90
|
+
return null;
|
|
91
|
+
return `${String(payment.voucher_id)}::${String(payment.status || "")}`;
|
|
92
|
+
}
|
|
86
93
|
var OrderModule = class extends import_BaseModule.BaseModule {
|
|
87
94
|
constructor(name, version) {
|
|
88
95
|
super(name || "order", version);
|
|
@@ -300,7 +307,7 @@ var OrderModule = class extends import_BaseModule.BaseModule {
|
|
|
300
307
|
});
|
|
301
308
|
}
|
|
302
309
|
async initialize(core, options) {
|
|
303
|
-
var _a, _b, _c
|
|
310
|
+
var _a, _b, _c;
|
|
304
311
|
this.core = core;
|
|
305
312
|
this.store = options.store;
|
|
306
313
|
if (!this.store.tempOrder) {
|
|
@@ -313,19 +320,19 @@ var OrderModule = class extends import_BaseModule.BaseModule {
|
|
|
313
320
|
this.store.availableWalletIds = [];
|
|
314
321
|
}
|
|
315
322
|
this.request = this.core.getPlugin("request");
|
|
316
|
-
|
|
317
|
-
if (!appPlugin) {
|
|
318
|
-
|
|
323
|
+
this.appPlugin = this.core.getPlugin("app");
|
|
324
|
+
if (!this.appPlugin) {
|
|
325
|
+
throw new Error("Order 模块需要 app 插件支持");
|
|
319
326
|
}
|
|
320
|
-
const app =
|
|
321
|
-
this.logger = app
|
|
327
|
+
const app = this.appPlugin.getApp();
|
|
328
|
+
this.logger = app.logger;
|
|
322
329
|
this.window = this.core.getPlugin("window");
|
|
323
330
|
const otherParams = options.otherParams || {};
|
|
324
331
|
this.cacheId = otherParams.cacheId;
|
|
325
332
|
this.salesSummaryModuleName = otherParams.salesSummaryModuleName;
|
|
326
|
-
this.rulesHooksOverride = (
|
|
333
|
+
this.rulesHooksOverride = (_a = otherParams.rules) == null ? void 0 : _a.hooks;
|
|
327
334
|
this.moduleHooksOverride = options.hooks;
|
|
328
|
-
this.orderHooks = this.moduleHooksOverride || ((
|
|
335
|
+
this.orderHooks = this.moduleHooksOverride || ((_b = otherParams.order) == null ? void 0 : _b.hooks) || ((_c = otherParams.hooks) == null ? void 0 : _c.order);
|
|
329
336
|
this.otherParams = otherParams;
|
|
330
337
|
this.registerDiscountModules(options);
|
|
331
338
|
this.logInfo("OrderModule initialized successfully");
|
|
@@ -834,16 +841,6 @@ var OrderModule = class extends import_BaseModule.BaseModule {
|
|
|
834
841
|
/** @deprecated OrderModule 不再负责 tempOrder localStorage 持久化;草稿保存请使用 IndexedDB saveDraft。 */
|
|
835
842
|
persistTempOrder() {
|
|
836
843
|
}
|
|
837
|
-
notifyTempOrderChanged() {
|
|
838
|
-
if (!this.store.tempOrder)
|
|
839
|
-
return;
|
|
840
|
-
this.store.tempOrder = {
|
|
841
|
-
...this.store.tempOrder,
|
|
842
|
-
products: [...this.store.tempOrder.products],
|
|
843
|
-
bookings: this.store.tempOrder.bookings ? [...this.store.tempOrder.bookings] : []
|
|
844
|
-
};
|
|
845
|
-
this.persistTempOrder();
|
|
846
|
-
}
|
|
847
844
|
// ─── TempOrder: 创建 & 获取 ───
|
|
848
845
|
createDefaultTempOrderInstance() {
|
|
849
846
|
return (0, import_utils.createDefaultTempOrder)({
|
|
@@ -1063,17 +1060,40 @@ var OrderModule = class extends import_BaseModule.BaseModule {
|
|
|
1063
1060
|
const depositPaidAmount = this.calculateDepositPaidAmount(tempOrder.payments || []);
|
|
1064
1061
|
return depositPaidAmount.lt(depositAmount) ? "deposit" : "normal";
|
|
1065
1062
|
}
|
|
1063
|
+
getPaymentNumberAppData(key) {
|
|
1064
|
+
var _a, _b, _c, _d, _e;
|
|
1065
|
+
const appPlugin = this.appPlugin;
|
|
1066
|
+
if (!appPlugin)
|
|
1067
|
+
return void 0;
|
|
1068
|
+
const getData = (_a = appPlugin.getData) == null ? void 0 : _a.call(appPlugin);
|
|
1069
|
+
if (typeof getData === "function")
|
|
1070
|
+
return getData(key);
|
|
1071
|
+
const app = appPlugin.getApp();
|
|
1072
|
+
const coreData = (_e = (_c = (_b = app == null ? void 0 : app.models) == null ? void 0 : _b.getStore) == null ? void 0 : (_d = _c.call(_b)).getDataByModel) == null ? void 0 : _e.call(_d, "core", "core");
|
|
1073
|
+
return coreData == null ? void 0 : coreData[key];
|
|
1074
|
+
}
|
|
1075
|
+
getPaymentNumberDevicePrefixSync() {
|
|
1076
|
+
return (0, import_payment_number.resolvePaymentNumberDevicePrefixFromDeviceId)(
|
|
1077
|
+
(key) => this.getPaymentNumberAppData(key)
|
|
1078
|
+
);
|
|
1079
|
+
}
|
|
1080
|
+
getPaymentNumberDevicePrefixAsync() {
|
|
1081
|
+
return (0, import_payment_number.resolvePaymentNumberDevicePrefix)(
|
|
1082
|
+
(key) => this.getPaymentNumberAppData(key)
|
|
1083
|
+
);
|
|
1084
|
+
}
|
|
1066
1085
|
normalizePaymentSource(payment, options) {
|
|
1067
1086
|
const paymentRecord = payment;
|
|
1068
1087
|
const metadata = paymentRecord.metadata && typeof paymentRecord.metadata === "object" ? { ...paymentRecord.metadata } : {};
|
|
1069
|
-
|
|
1070
|
-
|
|
1071
|
-
|
|
1072
|
-
|
|
1073
|
-
|
|
1074
|
-
|
|
1075
|
-
|
|
1076
|
-
|
|
1088
|
+
const normalized = (0, import_payment_utils.ensureOrderPaymentNumber)(
|
|
1089
|
+
{
|
|
1090
|
+
...paymentRecord,
|
|
1091
|
+
metadata,
|
|
1092
|
+
origin_amount: paymentRecord.origin_amount ?? paymentRecord.amount ?? "0.00"
|
|
1093
|
+
},
|
|
1094
|
+
(options == null ? void 0 : options.devicePrefix) || this.getPaymentNumberDevicePrefixSync(),
|
|
1095
|
+
import_utils.createUuidV4
|
|
1096
|
+
);
|
|
1077
1097
|
if (paymentRecord.status !== void 0) {
|
|
1078
1098
|
normalized.status = paymentRecord.status;
|
|
1079
1099
|
} else if ((options == null ? void 0 : options.defaultPaid) !== false) {
|
|
@@ -2494,17 +2514,36 @@ var OrderModule = class extends import_BaseModule.BaseModule {
|
|
|
2494
2514
|
* 用一组支付来源覆盖当前订单支付项。
|
|
2495
2515
|
*
|
|
2496
2516
|
* 入参允许来自 PaymentModule 的 PaymentItem,内部统一映射为 Sales 协议:
|
|
2497
|
-
* uuid
|
|
2517
|
+
* 新支付来源的 uuid 会作为 payment_number 的唯一号段,id -> custom_payment_id,
|
|
2498
2518
|
* isSynced 等运行态字段不会进入 tempOrder.payments。
|
|
2499
2519
|
*/
|
|
2500
2520
|
setOrderPayments(payments) {
|
|
2501
2521
|
const tempOrder = this.ensureTempOrder();
|
|
2502
|
-
tempOrder.payments = (0, import_utils.mapPaymentItemsToOrderPayments)(
|
|
2522
|
+
tempOrder.payments = (0, import_utils.mapPaymentItemsToOrderPayments)(
|
|
2523
|
+
(payments || []).map((payment) => this.normalizePaymentSource(payment, { defaultPaid: false }))
|
|
2524
|
+
);
|
|
2503
2525
|
this.persistTempOrder();
|
|
2504
2526
|
return tempOrder.payments;
|
|
2505
2527
|
}
|
|
2506
|
-
/**
|
|
2528
|
+
/** 同步兼容入口:按调用当下的 device_id 或 LOCAL 生成支付编号。 */
|
|
2507
2529
|
addOrderPayment(payment) {
|
|
2530
|
+
const hasPaymentNumber = String(
|
|
2531
|
+
payment.payment_number || ""
|
|
2532
|
+
).trim() !== "";
|
|
2533
|
+
return this.addOrderPaymentWithDevicePrefix(
|
|
2534
|
+
payment,
|
|
2535
|
+
hasPaymentNumber ? "LOCAL" : this.getPaymentNumberDevicePrefixSync()
|
|
2536
|
+
);
|
|
2537
|
+
}
|
|
2538
|
+
/** 异步入口:创建支付项时读取最新 IoT 设备短号。 */
|
|
2539
|
+
async addOrderPaymentAsync(payment) {
|
|
2540
|
+
const hasPaymentNumber = String(
|
|
2541
|
+
payment.payment_number || ""
|
|
2542
|
+
).trim() !== "";
|
|
2543
|
+
const devicePrefix = hasPaymentNumber ? "LOCAL" : await this.getPaymentNumberDevicePrefixAsync();
|
|
2544
|
+
return this.addOrderPaymentWithDevicePrefix(payment, devicePrefix);
|
|
2545
|
+
}
|
|
2546
|
+
addOrderPaymentWithDevicePrefix(payment, devicePrefix) {
|
|
2508
2547
|
this.logInfo("addOrderPayment", {
|
|
2509
2548
|
payment
|
|
2510
2549
|
});
|
|
@@ -2517,7 +2556,7 @@ var OrderModule = class extends import_BaseModule.BaseModule {
|
|
|
2517
2556
|
type: orderPaymentType,
|
|
2518
2557
|
order_payment_type: orderPaymentType
|
|
2519
2558
|
},
|
|
2520
|
-
{ defaultPaid: true }
|
|
2559
|
+
{ defaultPaid: true, devicePrefix }
|
|
2521
2560
|
)
|
|
2522
2561
|
]);
|
|
2523
2562
|
tempOrder.payments = [...tempOrder.payments || [], ...mapped];
|
|
@@ -2530,57 +2569,55 @@ var OrderModule = class extends import_BaseModule.BaseModule {
|
|
|
2530
2569
|
return tempOrder.payments;
|
|
2531
2570
|
}
|
|
2532
2571
|
/**
|
|
2533
|
-
*
|
|
2534
|
-
*
|
|
2535
|
-
* 该方法服务 PaymentModal 的 void / 编辑场景;更新 metadata 时会做浅合并,
|
|
2536
|
-
* 避免覆盖 unique_payment_number、现金实付/找零等已有元数据。
|
|
2572
|
+
* 默认按支付唯一号精确更新;仅显式指定 legacy 时兼容历史支付标识。
|
|
2573
|
+
* metadata 与 transactions 会分别合并,避免覆盖支付会话号和已有交易记录。
|
|
2537
2574
|
*/
|
|
2538
|
-
updateOrderPayment(paymentIdentity, updates) {
|
|
2575
|
+
async updateOrderPayment(paymentIdentity, updates, options = {}) {
|
|
2539
2576
|
const tempOrder = this.ensureTempOrder();
|
|
2540
2577
|
const identity = String(paymentIdentity);
|
|
2541
|
-
|
|
2542
|
-
|
|
2543
|
-
|
|
2544
|
-
|
|
2545
|
-
|
|
2546
|
-
|
|
2547
|
-
|
|
2548
|
-
|
|
2549
|
-
|
|
2550
|
-
|
|
2551
|
-
|
|
2552
|
-
|
|
2553
|
-
if (!matched)
|
|
2578
|
+
const matchMode = options.matchBy === "compat" || options.matchBy === "legacy" ? "compat" : "payment_number";
|
|
2579
|
+
const matchedPayment = (0, import_payment_utils.resolveOrderPaymentIdentity)(
|
|
2580
|
+
tempOrder.payments || [],
|
|
2581
|
+
identity,
|
|
2582
|
+
matchMode
|
|
2583
|
+
);
|
|
2584
|
+
if (!matchedPayment) {
|
|
2585
|
+
throw new Error(`未找到支付项: ${identity}`);
|
|
2586
|
+
}
|
|
2587
|
+
let updatedPayment = null;
|
|
2588
|
+
tempOrder.payments = (tempOrder.payments || []).map((payment, index) => {
|
|
2589
|
+
if (index !== matchedPayment.index)
|
|
2554
2590
|
return payment;
|
|
2555
|
-
|
|
2556
|
-
...payment,
|
|
2591
|
+
const nextPayment = (0, import_payment_utils.mergeOrderPaymentRecord)(payment, {
|
|
2557
2592
|
...updates,
|
|
2558
|
-
|
|
2559
|
-
|
|
2560
|
-
|
|
2561
|
-
|
|
2562
|
-
};
|
|
2593
|
+
updated_at: updates.updated_at || (0, import_dayjs.default)().format("YYYY-MM-DD HH:mm:ss")
|
|
2594
|
+
});
|
|
2595
|
+
updatedPayment = nextPayment;
|
|
2596
|
+
return nextPayment;
|
|
2563
2597
|
});
|
|
2564
2598
|
this.persistTempOrder();
|
|
2565
|
-
|
|
2599
|
+
const summary = await this.recalculateSummary({ createIfMissing: true });
|
|
2600
|
+
this.persistTempOrder();
|
|
2601
|
+
const payments = tempOrder.payments;
|
|
2602
|
+
return {
|
|
2603
|
+
updated: true,
|
|
2604
|
+
payment: payments[matchedPayment.index] || updatedPayment,
|
|
2605
|
+
payments,
|
|
2606
|
+
summary
|
|
2607
|
+
};
|
|
2566
2608
|
}
|
|
2567
2609
|
/** 从当前订单支付项中移除指定支付项。 */
|
|
2568
2610
|
deleteOrderPayment(paymentIdentity) {
|
|
2569
2611
|
const tempOrder = this.ensureTempOrder();
|
|
2570
2612
|
const identity = String(paymentIdentity);
|
|
2571
|
-
|
|
2572
|
-
|
|
2573
|
-
|
|
2574
|
-
|
|
2575
|
-
|
|
2576
|
-
|
|
2577
|
-
return
|
|
2578
|
-
|
|
2579
|
-
orderPaymentId,
|
|
2580
|
-
customPaymentId,
|
|
2581
|
-
uuid
|
|
2582
|
-
].some((value) => value !== void 0 && String(value) === identity);
|
|
2583
|
-
});
|
|
2613
|
+
const matchedPayment = (0, import_payment_utils.resolveOrderPaymentIdentity)(
|
|
2614
|
+
tempOrder.payments || [],
|
|
2615
|
+
identity,
|
|
2616
|
+
"compat"
|
|
2617
|
+
);
|
|
2618
|
+
if (!matchedPayment)
|
|
2619
|
+
return tempOrder.payments;
|
|
2620
|
+
tempOrder.payments = (tempOrder.payments || []).filter((_, index) => index !== matchedPayment.index);
|
|
2584
2621
|
this.persistTempOrder();
|
|
2585
2622
|
return tempOrder.payments;
|
|
2586
2623
|
}
|
|
@@ -2689,7 +2726,10 @@ var OrderModule = class extends import_BaseModule.BaseModule {
|
|
|
2689
2726
|
payments.map(
|
|
2690
2727
|
(payment) => this.normalizePaymentSource(
|
|
2691
2728
|
normalizeVoucherPaymentStatus(withVoucherPaymentType(payment)),
|
|
2692
|
-
{
|
|
2729
|
+
{
|
|
2730
|
+
defaultPaid: false,
|
|
2731
|
+
devicePrefix: options == null ? void 0 : options.devicePrefix
|
|
2732
|
+
}
|
|
2693
2733
|
)
|
|
2694
2734
|
)
|
|
2695
2735
|
).filter((payment) => {
|
|
@@ -2711,14 +2751,15 @@ var OrderModule = class extends import_BaseModule.BaseModule {
|
|
|
2711
2751
|
const committedVoucherPaymentIds = new Set(
|
|
2712
2752
|
committedVoucherPayments.filter((payment) => hasSyncedOrderPaymentRecord(payment)).map((payment) => String(payment.order_payment_id))
|
|
2713
2753
|
);
|
|
2714
|
-
const
|
|
2715
|
-
committedVoucherPayments.map((payment) =>
|
|
2754
|
+
const committedVoucherLifecycleKeys = new Set(
|
|
2755
|
+
committedVoucherPayments.map((payment) => getVoucherPaymentLifecycleKey(payment)).filter((key) => key !== null)
|
|
2716
2756
|
);
|
|
2717
2757
|
const replaceableVouchers = mappedVouchers.filter((payment) => {
|
|
2718
2758
|
if (hasSyncedOrderPaymentRecord(payment) && committedVoucherPaymentIds.has(String(payment.order_payment_id))) {
|
|
2719
2759
|
return false;
|
|
2720
2760
|
}
|
|
2721
|
-
|
|
2761
|
+
const lifecycleKey = getVoucherPaymentLifecycleKey(payment);
|
|
2762
|
+
if (lifecycleKey && committedVoucherLifecycleKeys.has(lifecycleKey)) {
|
|
2722
2763
|
return false;
|
|
2723
2764
|
}
|
|
2724
2765
|
return true;
|
|
@@ -2740,6 +2781,14 @@ var OrderModule = class extends import_BaseModule.BaseModule {
|
|
|
2740
2781
|
});
|
|
2741
2782
|
return tempOrder.payments;
|
|
2742
2783
|
}
|
|
2784
|
+
async updateVoucherOrderPaymentsAsync(payments, options) {
|
|
2785
|
+
const needsPaymentNumber = (payments || []).some((payment) => String(payment.payment_number || "").trim() === "");
|
|
2786
|
+
const devicePrefix = needsPaymentNumber ? await this.getPaymentNumberDevicePrefixAsync() : "LOCAL";
|
|
2787
|
+
return this.updateVoucherOrderPayments(payments, {
|
|
2788
|
+
...options,
|
|
2789
|
+
devicePrefix
|
|
2790
|
+
});
|
|
2791
|
+
}
|
|
2743
2792
|
async shouldMergeProductToOrder(params) {
|
|
2744
2793
|
var _a;
|
|
2745
2794
|
const onBeforeMergeProductToOrder = (_a = this.orderHooks) == null ? void 0 : _a.onBeforeMergeProductToOrder;
|
|
@@ -3570,6 +3619,38 @@ var OrderModule = class extends import_BaseModule.BaseModule {
|
|
|
3570
3619
|
await this.saveDraft();
|
|
3571
3620
|
return tempOrder;
|
|
3572
3621
|
}
|
|
3622
|
+
async saveTempOrderAsDraft(params) {
|
|
3623
|
+
var _a, _b, _c, _d, _e;
|
|
3624
|
+
const tempOrder = this.ensureTempOrder();
|
|
3625
|
+
this.ensureExternalSaleNumber(tempOrder);
|
|
3626
|
+
this.persistTempOrder();
|
|
3627
|
+
const latestSummary = await this.recalculateSummary({ createIfMissing: true }) || this.store.summary || (0, import_utils.createEmptySummary)();
|
|
3628
|
+
const payload = (0, import_utils.buildSubmitPayload)({
|
|
3629
|
+
tempOrder,
|
|
3630
|
+
cacheId: (params == null ? void 0 : params.cacheId) ?? this.cacheId,
|
|
3631
|
+
platform: (params == null ? void 0 : params.platform) || ((_a = this.otherParams) == null ? void 0 : _a.platform),
|
|
3632
|
+
businessCode: (params == null ? void 0 : params.businessCode) || ((_b = this.otherParams) == null ? void 0 : _b.businessCode) || ((_c = this.otherParams) == null ? void 0 : _c.business_code) || tempOrder.business_code,
|
|
3633
|
+
channel: params == null ? void 0 : params.channel,
|
|
3634
|
+
type: (params == null ? void 0 : params.type) ?? ((_d = this.otherParams) == null ? void 0 : _d.type),
|
|
3635
|
+
summary: latestSummary,
|
|
3636
|
+
enhance: params == null ? void 0 : params.enhancePayload
|
|
3637
|
+
});
|
|
3638
|
+
if (!payload.created_at) {
|
|
3639
|
+
payload.created_at = (0, import_dayjs.default)().format("YYYY-MM-DD HH:mm:ss");
|
|
3640
|
+
}
|
|
3641
|
+
payload.need_sync = 0;
|
|
3642
|
+
payload.is_draft_order = 1;
|
|
3643
|
+
this.logInfo("saveTempOrderAsDraft calling sales draft", {
|
|
3644
|
+
orderId: payload.order_id,
|
|
3645
|
+
externalSaleNumber: payload.external_sale_number,
|
|
3646
|
+
productsCount: ((_e = payload.products) == null ? void 0 : _e.length) || 0
|
|
3647
|
+
});
|
|
3648
|
+
return this.request.post("/order/sales/draft", payload, {
|
|
3649
|
+
osServer: true,
|
|
3650
|
+
customToast: () => {
|
|
3651
|
+
}
|
|
3652
|
+
});
|
|
3653
|
+
}
|
|
3573
3654
|
/**
|
|
3574
3655
|
* 提交当前 Sales tempOrder。
|
|
3575
3656
|
*
|
|
@@ -3770,8 +3851,13 @@ var OrderModule = class extends import_BaseModule.BaseModule {
|
|
|
3770
3851
|
}
|
|
3771
3852
|
async syncPaymentsToOrder(params) {
|
|
3772
3853
|
const tempOrder = this.ensureTempOrder();
|
|
3854
|
+
const needsPaymentNumber = (params.payments || []).some((payment) => String(payment.payment_number || "").trim() === "");
|
|
3855
|
+
const devicePrefix = needsPaymentNumber ? await this.getPaymentNumberDevicePrefixAsync() : "LOCAL";
|
|
3773
3856
|
const mappedPayments = (0, import_utils.mapPaymentItemsToOrderPayments)(
|
|
3774
|
-
params.payments || []
|
|
3857
|
+
(params.payments || []).map((payment) => this.normalizePaymentSource(payment, {
|
|
3858
|
+
defaultPaid: false,
|
|
3859
|
+
devicePrefix
|
|
3860
|
+
}))
|
|
3775
3861
|
);
|
|
3776
3862
|
const shouldConfirmPendingVoucherPayments = params.confirmPendingVoucherPayments ?? params.submitWhenPaid === true;
|
|
3777
3863
|
const effectivePayments = shouldConfirmPendingVoucherPayments ? this.confirmPendingVoucherPaymentsInList(mappedPayments) : params.confirmPendingVoucherPayments === false ? this.discardPendingVoucherPaymentsFromList(mappedPayments) : mappedPayments;
|
|
@@ -3793,7 +3879,7 @@ var OrderModule = class extends import_BaseModule.BaseModule {
|
|
|
3793
3879
|
tempOrder,
|
|
3794
3880
|
effectivePayments
|
|
3795
3881
|
);
|
|
3796
|
-
const
|
|
3882
|
+
const submitResult = await this.submitTempOrder({
|
|
3797
3883
|
payments: effectivePayments,
|
|
3798
3884
|
paymentStatus,
|
|
3799
3885
|
smallTicketDataFlag: params.smallTicketDataFlag,
|
|
@@ -3807,8 +3893,7 @@ var OrderModule = class extends import_BaseModule.BaseModule {
|
|
|
3807
3893
|
};
|
|
3808
3894
|
return nextPayload;
|
|
3809
3895
|
}
|
|
3810
|
-
};
|
|
3811
|
-
const submitResult = params.checkoutSyncTaskEnabled === false ? await this.submitTempOrderAsync(submitParams) : await this.submitTempOrder(submitParams);
|
|
3896
|
+
});
|
|
3812
3897
|
return { ...completion, submitResult };
|
|
3813
3898
|
}
|
|
3814
3899
|
createOrder(params) {
|
|
@@ -3825,13 +3910,11 @@ var OrderModule = class extends import_BaseModule.BaseModule {
|
|
|
3825
3910
|
is_deposit: 0,
|
|
3826
3911
|
relation_products: [],
|
|
3827
3912
|
relation_forms: [],
|
|
3828
|
-
business_code: params == null ? void 0 : params.business_code,
|
|
3829
3913
|
...(params == null ? void 0 : params.extraData) || {}
|
|
3830
3914
|
};
|
|
3831
3915
|
let is_deposit = 0;
|
|
3832
3916
|
if (params.cartItems.length > 0) {
|
|
3833
3917
|
params.cartItems.forEach((item) => {
|
|
3834
|
-
var _a2;
|
|
3835
3918
|
if (!item._origin.duration) {
|
|
3836
3919
|
const { duration, durationType } = (0, import_utils.generateDuration)(item);
|
|
3837
3920
|
item._origin.duration = duration;
|
|
@@ -3840,9 +3923,6 @@ var OrderModule = class extends import_BaseModule.BaseModule {
|
|
|
3840
3923
|
item._origin.sub_type = (0, import_utils.normalizeBookingSubType)(item._origin);
|
|
3841
3924
|
const discountList = (0, import_utils.getAllDiscountList)(item);
|
|
3842
3925
|
item._origin.product.discount_list = discountList;
|
|
3843
|
-
if ((_a2 = params == null ? void 0 : params.extraData) == null ? void 0 : _a2.is_add_holder_info) {
|
|
3844
|
-
(0, import_utils.ensureCartItemOriginHolder)(item, this.window);
|
|
3845
|
-
}
|
|
3846
3926
|
if ((0, import_utils2.isNormalProduct)(item._origin)) {
|
|
3847
3927
|
order.relation_products.push(item._origin.product);
|
|
3848
3928
|
const relationForms = item._origin.relation_forms || [];
|
|
@@ -4153,6 +4233,12 @@ var OrderModule = class extends import_BaseModule.BaseModule {
|
|
|
4153
4233
|
}
|
|
4154
4234
|
}
|
|
4155
4235
|
const nextTempOrder = this.normalizeTempOrderForRuntime(raw, { makeEditMark: true });
|
|
4236
|
+
const sourceLastOrderInfo = raw.lastOrderInfo || raw;
|
|
4237
|
+
const isDraftOrder = Number(nextTempOrder.is_draft_order || 0) === 1;
|
|
4238
|
+
const syntheticIdentityOptions = {
|
|
4239
|
+
isDraftOrder,
|
|
4240
|
+
externalSaleNumber: nextTempOrder.external_sale_number
|
|
4241
|
+
};
|
|
4156
4242
|
const rawSummary = raw.summary && typeof raw.summary === "object" ? raw.summary : {};
|
|
4157
4243
|
const summarySurcharges = Array.isArray(rawSummary.surcharges) ? rawSummary.surcharges.map((s) => ({ ...s || {} })) : (0, import_lodash_es.cloneDeep)(nextTempOrder.surcharges || []);
|
|
4158
4244
|
this.store.tempOrder = nextTempOrder;
|
|
@@ -4173,7 +4259,14 @@ var OrderModule = class extends import_BaseModule.BaseModule {
|
|
|
4173
4259
|
productFingerprint: this.buildOrderProductsFingerprint(nextTempOrder.products || [])
|
|
4174
4260
|
}
|
|
4175
4261
|
};
|
|
4176
|
-
this.store.lastOrderInfo =
|
|
4262
|
+
this.store.lastOrderInfo = this.withoutSyntheticDraftOrderIdForRuntime(
|
|
4263
|
+
sourceLastOrderInfo,
|
|
4264
|
+
syntheticIdentityOptions
|
|
4265
|
+
);
|
|
4266
|
+
const hadSyntheticDraftOrderId = this.isSyntheticDraftOrderIdForRuntime(raw, syntheticIdentityOptions) || this.isSyntheticDraftOrderIdForRuntime(sourceLastOrderInfo, syntheticIdentityOptions);
|
|
4267
|
+
if (hadSyntheticDraftOrderId && this.store.syncState !== "submitting") {
|
|
4268
|
+
this.store.syncState = "local";
|
|
4269
|
+
}
|
|
4177
4270
|
const hydratedEditDiscounts = this.collectHydratedEditDiscounts(nextTempOrder.products);
|
|
4178
4271
|
const currentDiscounts = typeof ((_a = this.store.discount) == null ? void 0 : _a.getDiscountList) === "function" ? this.store.discount.getDiscountList() || [] : [];
|
|
4179
4272
|
const currentScanDiscounts = currentDiscounts.filter((discount) => discount == null ? void 0 : discount.isScan);
|
|
@@ -4286,12 +4379,13 @@ var OrderModule = class extends import_BaseModule.BaseModule {
|
|
|
4286
4379
|
}
|
|
4287
4380
|
normalizeTempOrderForRuntime(raw, options) {
|
|
4288
4381
|
var _a, _b;
|
|
4382
|
+
const runtimeRaw = this.withoutSyntheticDraftOrderIdForRuntime(raw);
|
|
4289
4383
|
const nextTempOrder = {
|
|
4290
4384
|
...this.createDefaultTempOrderInstance(),
|
|
4291
|
-
...
|
|
4385
|
+
...runtimeRaw || {}
|
|
4292
4386
|
};
|
|
4293
|
-
if ((nextTempOrder.order_id === void 0 || nextTempOrder.order_id === null) && (
|
|
4294
|
-
nextTempOrder.order_id =
|
|
4387
|
+
if ((nextTempOrder.order_id === void 0 || nextTempOrder.order_id === null) && (runtimeRaw == null ? void 0 : runtimeRaw.id) !== void 0 && (runtimeRaw == null ? void 0 : runtimeRaw.id) !== null) {
|
|
4388
|
+
nextTempOrder.order_id = runtimeRaw.id;
|
|
4295
4389
|
}
|
|
4296
4390
|
delete nextTempOrder.summary;
|
|
4297
4391
|
delete nextTempOrder.lastOrderInfo;
|
|
@@ -4359,6 +4453,22 @@ var OrderModule = class extends import_BaseModule.BaseModule {
|
|
|
4359
4453
|
nextTempOrder.vouchers = raw.vouchers || [];
|
|
4360
4454
|
return nextTempOrder;
|
|
4361
4455
|
}
|
|
4456
|
+
isSyntheticDraftOrderIdForRuntime(record, options) {
|
|
4457
|
+
const isDraftOrder = (options == null ? void 0 : options.isDraftOrder) ?? Number((record == null ? void 0 : record.is_draft_order) || 0) === 1;
|
|
4458
|
+
const externalSaleNumber = (record == null ? void 0 : record.external_sale_number) ?? (options == null ? void 0 : options.externalSaleNumber);
|
|
4459
|
+
const orderId = record == null ? void 0 : record.order_id;
|
|
4460
|
+
return Boolean(
|
|
4461
|
+
isDraftOrder && orderId !== void 0 && orderId !== null && orderId !== "" && externalSaleNumber !== void 0 && externalSaleNumber !== null && externalSaleNumber !== "" && String(orderId) === String(externalSaleNumber)
|
|
4462
|
+
);
|
|
4463
|
+
}
|
|
4464
|
+
withoutSyntheticDraftOrderIdForRuntime(record, options) {
|
|
4465
|
+
if (!this.isSyntheticDraftOrderIdForRuntime(record, options))
|
|
4466
|
+
return record;
|
|
4467
|
+
return {
|
|
4468
|
+
...record,
|
|
4469
|
+
order_id: null
|
|
4470
|
+
};
|
|
4471
|
+
}
|
|
4362
4472
|
hydrateLinkedBookingIdentity(tempOrder) {
|
|
4363
4473
|
const bookingUidByProductUid = /* @__PURE__ */ new Map();
|
|
4364
4474
|
const productByUid = /* @__PURE__ */ new Map();
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
export type OrderPaymentTransactionStatus = 'success' | 'fail';
|
|
2
|
+
export interface OrderPaymentTransaction {
|
|
3
|
+
number: string;
|
|
4
|
+
status: OrderPaymentTransactionStatus;
|
|
5
|
+
}
|
|
6
|
+
export type OrderPaymentIdentityType = 'order_payment_id' | 'payment_number' | 'unique_payment_number';
|
|
7
|
+
export interface OrderPaymentIdentityMatch<T> {
|
|
8
|
+
index: number;
|
|
9
|
+
payment: T;
|
|
10
|
+
matchedBy: OrderPaymentIdentityType;
|
|
11
|
+
}
|
|
12
|
+
export declare function getOrderPaymentIdentityKeys(payment: unknown): string[];
|
|
13
|
+
export declare function isPendingOrderPayment(payment: unknown): boolean;
|
|
14
|
+
export declare function isIdentifiedPendingOrderPayment(payment: unknown): boolean;
|
|
15
|
+
export declare function hasOrderPaymentIdentityOverlap(left: unknown, right: unknown): boolean;
|
|
16
|
+
export declare function resolveOrderPaymentIdentity<T extends Record<string, any>>(payments: T[] | null | undefined, identity: string | number, mode?: 'payment_number' | 'compat'): OrderPaymentIdentityMatch<T> | null;
|
|
17
|
+
export declare function ensureOrderPaymentNumber<T extends Record<string, any>>(payment: T, devicePrefix: string, createPaymentNumber: () => string): T & {
|
|
18
|
+
payment_number: string;
|
|
19
|
+
};
|
|
20
|
+
export declare function mergeOrderPaymentTransactions(current: unknown, incoming: unknown): OrderPaymentTransaction[];
|
|
21
|
+
export declare function mergeOrderPaymentRecord<T extends Record<string, any>>(payment: T, updates: Record<string, any>): T;
|
|
22
|
+
export declare function mergeOrderPaymentSnapshot<T extends Record<string, any>>(current: T, incoming: T): T;
|
|
23
|
+
export declare function mergeOrderPaymentListsByIdentity<T extends Record<string, any>>(existing: T[] | null | undefined, incoming: T[] | null | undefined, options?: {
|
|
24
|
+
preserveUnmatchedExisting?: boolean;
|
|
25
|
+
preserveUnmatchedExistingWhen?: (payment: T) => boolean;
|
|
26
|
+
}): T[];
|