@pisell/pisellos 2.3.36 → 2.3.37
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/server/index.js
CHANGED
|
@@ -4924,12 +4924,9 @@ var Server = /*#__PURE__*/function () {
|
|
|
4924
4924
|
case 10:
|
|
4925
4925
|
this.logInfo('processSuccessfulLocalPayment: BaseSales 初始化完成', recoveryContext);
|
|
4926
4926
|
_context50.next = 13;
|
|
4927
|
-
return baseSales.
|
|
4928
|
-
externalSaleNumber: String(params.saleId),
|
|
4929
|
-
preloadedSalesDetail: order
|
|
4930
|
-
});
|
|
4927
|
+
return baseSales.replaceTempOrder(order);
|
|
4931
4928
|
case 13:
|
|
4932
|
-
this.logInfo('processSuccessfulLocalPayment: 本地订单
|
|
4929
|
+
this.logInfo('processSuccessfulLocalPayment: 本地订单 tempOrder 恢复完成', recoveryContext);
|
|
4933
4930
|
this.logInfo('processSuccessfulLocalPayment: 开始更新支付项并提交', _objectSpread(_objectSpread({}, recoveryContext), {}, {
|
|
4934
4931
|
incoming_payment_update: params.paymentUpdate
|
|
4935
4932
|
}));
|
|
@@ -7400,6 +7397,12 @@ var Server = /*#__PURE__*/function () {
|
|
|
7400
7397
|
|
|
7401
7398
|
// 使用 filterOrders 进行过滤、排序、分页
|
|
7402
7399
|
result = filterOrders(rawList, data);
|
|
7400
|
+
result.list.forEach(function (order) {
|
|
7401
|
+
var _order$payments;
|
|
7402
|
+
order.payments = (_order$payments = order.payments) === null || _order$payments === void 0 ? void 0 : _order$payments.filter(function (payment) {
|
|
7403
|
+
return !isPendingOrderPayment(payment);
|
|
7404
|
+
});
|
|
7405
|
+
});
|
|
7403
7406
|
this.logInfo('computeOrderQueryResult: 过滤结果', {
|
|
7404
7407
|
rawCount: rawList.length,
|
|
7405
7408
|
filteredCount: result.count,
|
|
@@ -7413,7 +7416,7 @@ var Server = /*#__PURE__*/function () {
|
|
|
7413
7416
|
message: '',
|
|
7414
7417
|
status: true
|
|
7415
7418
|
});
|
|
7416
|
-
case
|
|
7419
|
+
case 11:
|
|
7417
7420
|
case "end":
|
|
7418
7421
|
return _context71.stop();
|
|
7419
7422
|
}
|
|
@@ -37,7 +37,7 @@ import Decimal from 'decimal.js';
|
|
|
37
37
|
import { cloneDeep, mergeWith } from 'lodash-es';
|
|
38
38
|
import { createModule } from "../BookingByStep/types";
|
|
39
39
|
import { composeLinePrice, createUuidV4, ensureProductSku, getProductSkuOptions, resolveIsFormSubject, sumOptionUnitPrice } from "../../modules/Order/utils";
|
|
40
|
-
import { ensureOrderPaymentNumber, isIdentifiedPendingOrderPayment, mergeOrderPaymentListsByIdentity, resolveOrderPaymentIdentity } from "../../modules/Order/payment-utils";
|
|
40
|
+
import { ensureOrderPaymentNumber, isIdentifiedPendingOrderPayment, isPendingOrderPayment, mergeOrderPaymentListsByIdentity, resolveOrderPaymentIdentity } from "../../modules/Order/payment-utils";
|
|
41
41
|
import { resolvePaymentNumberDevicePrefix, resolvePaymentNumberDevicePrefixFromDeviceId } from "../../utils/payment-number";
|
|
42
42
|
import { applyOrderCollectionUidRemaps, getOrderCollectionPersistentId, getOrderCollectionReferenceUid, getOrderCollectionUid, isSameOrderCollectionItem, mergeOrderCollectionItems, normalizeOrderCollection, normalizeOrderCollections, setOrderCollectionUid } from "../../modules/Order/utils/orderCollectionIdentity";
|
|
43
43
|
import dayjs from 'dayjs';
|
|
@@ -269,6 +269,22 @@ function mergeSalesDetailRecordWithTempOrder(currentTempOrder, loadedRecord, str
|
|
|
269
269
|
delete mergedRecord.request_unique_idempotency_token;
|
|
270
270
|
return normalizeBaseSalesRecordCollections(applyOrderCollectionUidRemaps(mergedRecord, uidRemaps));
|
|
271
271
|
}
|
|
272
|
+
function filterPendingPaymentsFromLoadedSalesDetail(sourceRecord) {
|
|
273
|
+
if (!sourceRecord || _typeof(sourceRecord) !== 'object') return sourceRecord;
|
|
274
|
+
var record = _objectSpread({}, sourceRecord);
|
|
275
|
+
if (Array.isArray(sourceRecord.payments)) {
|
|
276
|
+
record.payments = sourceRecord.payments.filter(function (payment) {
|
|
277
|
+
return !isPendingOrderPayment(payment);
|
|
278
|
+
});
|
|
279
|
+
}
|
|
280
|
+
// 兼容少量历史详情数据使用的单数 payment 字段。
|
|
281
|
+
if (Array.isArray(sourceRecord.payment)) {
|
|
282
|
+
record.payment = sourceRecord.payment.filter(function (payment) {
|
|
283
|
+
return !isPendingOrderPayment(payment);
|
|
284
|
+
});
|
|
285
|
+
}
|
|
286
|
+
return record;
|
|
287
|
+
}
|
|
272
288
|
export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
|
|
273
289
|
_inherits(BaseSalesImpl, _BaseModule);
|
|
274
290
|
var _super = _createSuper(BaseSalesImpl);
|
|
@@ -1323,7 +1339,7 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
1323
1339
|
key: "loadSalesDetail",
|
|
1324
1340
|
value: (function () {
|
|
1325
1341
|
var _loadSalesDetail = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee13(orderIdOrParams) {
|
|
1326
|
-
var loadSequence, _ref17, _ref18, _ref19, _ref20, _params$orderId, params, externalSaleNumber, preloadedSalesDetail, lookup, loadedRecord, message, remoteRecord, currentTempOrder, record;
|
|
1342
|
+
var loadSequence, _ref17, _ref18, _ref19, _ref20, _params$orderId, params, externalSaleNumber, preloadedSalesDetail, lookup, loadedRecord, message, remoteRecord, currentTempOrder, mergedRecord, record;
|
|
1327
1343
|
return _regeneratorRuntime().wrap(function _callee13$(_context13) {
|
|
1328
1344
|
while (1) switch (_context13.prev = _context13.next) {
|
|
1329
1345
|
case 0:
|
|
@@ -1372,39 +1388,40 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
1372
1388
|
message = loadedRecord && (loadedRecord.message || loadedRecord.msg) || "\u52A0\u8F7D\u9500\u552E\u8BE6\u60C5\u5931\u8D25: ".concat(lookup);
|
|
1373
1389
|
throw new Error(message);
|
|
1374
1390
|
case 22:
|
|
1375
|
-
remoteRecord = preloadedSalesDetail !== null && preloadedSalesDetail !== void 0 ? preloadedSalesDetail : loadedRecord.data;
|
|
1391
|
+
remoteRecord = filterPendingPaymentsFromLoadedSalesDetail(preloadedSalesDetail !== null && preloadedSalesDetail !== void 0 ? preloadedSalesDetail : loadedRecord.data);
|
|
1376
1392
|
currentTempOrder = params.merge ? this.store.order.getTempOrder() : null;
|
|
1377
|
-
|
|
1378
|
-
|
|
1393
|
+
mergedRecord = params.merge ? mergeSalesDetailRecordWithTempOrder(currentTempOrder, remoteRecord, 'preserve-local') : remoteRecord;
|
|
1394
|
+
record = filterPendingPaymentsFromLoadedSalesDetail(mergedRecord);
|
|
1395
|
+
_context13.next = 28;
|
|
1379
1396
|
return this.hydrateLatestLoadedSalesDetail(record, loadSequence);
|
|
1380
|
-
case 27:
|
|
1381
|
-
return _context13.abrupt("return", _context13.sent);
|
|
1382
1397
|
case 28:
|
|
1383
|
-
_context13.
|
|
1398
|
+
return _context13.abrupt("return", _context13.sent);
|
|
1399
|
+
case 29:
|
|
1400
|
+
_context13.prev = 29;
|
|
1384
1401
|
this.salesDetailLoadInFlightCount = Math.max(0, this.salesDetailLoadInFlightCount - 1);
|
|
1385
1402
|
if (!(this.salesDetailLoadInFlightCount === 0)) {
|
|
1386
|
-
_context13.next =
|
|
1403
|
+
_context13.next = 40;
|
|
1387
1404
|
break;
|
|
1388
1405
|
}
|
|
1389
|
-
_context13.prev =
|
|
1390
|
-
_context13.next =
|
|
1406
|
+
_context13.prev = 32;
|
|
1407
|
+
_context13.next = 35;
|
|
1391
1408
|
return this.drainQueuedServerOrderChanges();
|
|
1392
|
-
case
|
|
1393
|
-
_context13.next =
|
|
1409
|
+
case 35:
|
|
1410
|
+
_context13.next = 40;
|
|
1394
1411
|
break;
|
|
1395
|
-
case
|
|
1396
|
-
_context13.prev =
|
|
1397
|
-
_context13.t1 = _context13["catch"](
|
|
1412
|
+
case 37:
|
|
1413
|
+
_context13.prev = 37;
|
|
1414
|
+
_context13.t1 = _context13["catch"](32);
|
|
1398
1415
|
this.logError('drain queued server order changes failed', {
|
|
1399
1416
|
error: _context13.t1 instanceof Error ? _context13.t1.message : String(_context13.t1)
|
|
1400
1417
|
});
|
|
1401
|
-
case 39:
|
|
1402
|
-
return _context13.finish(28);
|
|
1403
1418
|
case 40:
|
|
1419
|
+
return _context13.finish(29);
|
|
1420
|
+
case 41:
|
|
1404
1421
|
case "end":
|
|
1405
1422
|
return _context13.stop();
|
|
1406
1423
|
}
|
|
1407
|
-
}, _callee13, this, [[4,,
|
|
1424
|
+
}, _callee13, this, [[4,, 29, 41], [32, 37]]);
|
|
1408
1425
|
}));
|
|
1409
1426
|
function loadSalesDetail(_x11) {
|
|
1410
1427
|
return _loadSalesDetail.apply(this, arguments);
|
|
@@ -1,49 +0,0 @@
|
|
|
1
|
-
var __create = Object.create;
|
|
2
|
-
var __defProp = Object.defineProperty;
|
|
3
|
-
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
4
|
-
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
5
|
-
var __getProtoOf = Object.getPrototypeOf;
|
|
6
|
-
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
7
|
-
var __export = (target, all) => {
|
|
8
|
-
for (var name in all)
|
|
9
|
-
__defProp(target, name, { get: all[name], enumerable: true });
|
|
10
|
-
};
|
|
11
|
-
var __copyProps = (to, from, except, desc) => {
|
|
12
|
-
if (from && typeof from === "object" || typeof from === "function") {
|
|
13
|
-
for (let key of __getOwnPropNames(from))
|
|
14
|
-
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
15
|
-
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
16
|
-
}
|
|
17
|
-
return to;
|
|
18
|
-
};
|
|
19
|
-
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
|
|
20
|
-
// If the importer is in node compatibility mode or this is not an ESM
|
|
21
|
-
// file that has been converted to a CommonJS file using a Babel-
|
|
22
|
-
// compatible transform (i.e. "__esModule" has not been set), then set
|
|
23
|
-
// "default" to the CommonJS "module.exports" for node compatibility.
|
|
24
|
-
isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
|
|
25
|
-
mod
|
|
26
|
-
));
|
|
27
|
-
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
28
|
-
|
|
29
|
-
// src/model/strategy/adapter/promotion/index.ts
|
|
30
|
-
var promotion_exports = {};
|
|
31
|
-
__export(promotion_exports, {
|
|
32
|
-
BUY_X_GET_Y_FREE_STRATEGY: () => import_examples.BUY_X_GET_Y_FREE_STRATEGY,
|
|
33
|
-
PromotionAdapter: () => import_adapter.PromotionAdapter,
|
|
34
|
-
PromotionEvaluator: () => import_evaluator.PromotionEvaluator,
|
|
35
|
-
X_ITEMS_FOR_Y_PRICE_STRATEGY: () => import_examples.X_ITEMS_FOR_Y_PRICE_STRATEGY,
|
|
36
|
-
default: () => import_adapter2.default
|
|
37
|
-
});
|
|
38
|
-
module.exports = __toCommonJS(promotion_exports);
|
|
39
|
-
var import_evaluator = require("./evaluator");
|
|
40
|
-
var import_adapter = require("./adapter");
|
|
41
|
-
var import_adapter2 = __toESM(require("./adapter"));
|
|
42
|
-
var import_examples = require("./examples");
|
|
43
|
-
// Annotate the CommonJS export names for ESM import in node:
|
|
44
|
-
0 && (module.exports = {
|
|
45
|
-
BUY_X_GET_Y_FREE_STRATEGY,
|
|
46
|
-
PromotionAdapter,
|
|
47
|
-
PromotionEvaluator,
|
|
48
|
-
X_ITEMS_FOR_Y_PRICE_STRATEGY
|
|
49
|
-
});
|
package/lib/server/index.js
CHANGED
|
@@ -3197,11 +3197,8 @@ var Server = class {
|
|
|
3197
3197
|
}
|
|
3198
3198
|
});
|
|
3199
3199
|
this.logInfo("processSuccessfulLocalPayment: BaseSales 初始化完成", recoveryContext);
|
|
3200
|
-
await baseSales.
|
|
3201
|
-
|
|
3202
|
-
preloadedSalesDetail: order
|
|
3203
|
-
});
|
|
3204
|
-
this.logInfo("processSuccessfulLocalPayment: 本地订单 hydrate 完成", recoveryContext);
|
|
3200
|
+
await baseSales.replaceTempOrder(order);
|
|
3201
|
+
this.logInfo("processSuccessfulLocalPayment: 本地订单 tempOrder 恢复完成", recoveryContext);
|
|
3205
3202
|
this.logInfo("processSuccessfulLocalPayment: 开始更新支付项并提交", {
|
|
3206
3203
|
...recoveryContext,
|
|
3207
3204
|
incoming_payment_update: params.paymentUpdate
|
|
@@ -4843,6 +4840,10 @@ var Server = class {
|
|
|
4843
4840
|
const rawList = this.order.getOrders();
|
|
4844
4841
|
this.logInfo("computeOrderQueryResult: 本地订单数量", { rawCount: rawList.length });
|
|
4845
4842
|
const result = (0, import_filterOrders.filterOrders)(rawList, data);
|
|
4843
|
+
result.list.forEach((order) => {
|
|
4844
|
+
var _a;
|
|
4845
|
+
order.payments = (_a = order.payments) == null ? void 0 : _a.filter((payment) => !(0, import_payment_utils.isPendingOrderPayment)(payment));
|
|
4846
|
+
});
|
|
4846
4847
|
this.logInfo("computeOrderQueryResult: 过滤结果", {
|
|
4847
4848
|
rawCount: rawList.length,
|
|
4848
4849
|
filteredCount: result.count,
|
|
@@ -309,6 +309,18 @@ function mergeSalesDetailRecordWithTempOrder(currentTempOrder, loadedRecord, str
|
|
|
309
309
|
(0, import_orderCollectionIdentity.applyOrderCollectionUidRemaps)(mergedRecord, uidRemaps)
|
|
310
310
|
);
|
|
311
311
|
}
|
|
312
|
+
function filterPendingPaymentsFromLoadedSalesDetail(sourceRecord) {
|
|
313
|
+
if (!sourceRecord || typeof sourceRecord !== "object")
|
|
314
|
+
return sourceRecord;
|
|
315
|
+
const record = { ...sourceRecord };
|
|
316
|
+
if (Array.isArray(sourceRecord.payments)) {
|
|
317
|
+
record.payments = sourceRecord.payments.filter((payment) => !(0, import_payment_utils.isPendingOrderPayment)(payment));
|
|
318
|
+
}
|
|
319
|
+
if (Array.isArray(sourceRecord.payment)) {
|
|
320
|
+
record.payment = sourceRecord.payment.filter((payment) => !(0, import_payment_utils.isPendingOrderPayment)(payment));
|
|
321
|
+
}
|
|
322
|
+
return record;
|
|
323
|
+
}
|
|
312
324
|
var BaseSalesImpl = class extends import_BaseModule.BaseModule {
|
|
313
325
|
constructor(name, version) {
|
|
314
326
|
super(name, version);
|
|
@@ -994,13 +1006,16 @@ var BaseSalesImpl = class extends import_BaseModule.BaseModule {
|
|
|
994
1006
|
const message = loadedRecord && (loadedRecord.message || loadedRecord.msg) || `加载销售详情失败: ${lookup}`;
|
|
995
1007
|
throw new Error(message);
|
|
996
1008
|
}
|
|
997
|
-
const remoteRecord =
|
|
1009
|
+
const remoteRecord = filterPendingPaymentsFromLoadedSalesDetail(
|
|
1010
|
+
preloadedSalesDetail ?? loadedRecord.data
|
|
1011
|
+
);
|
|
998
1012
|
const currentTempOrder = params.merge ? this.store.order.getTempOrder() : null;
|
|
999
|
-
const
|
|
1013
|
+
const mergedRecord = params.merge ? mergeSalesDetailRecordWithTempOrder(
|
|
1000
1014
|
currentTempOrder,
|
|
1001
1015
|
remoteRecord,
|
|
1002
1016
|
"preserve-local"
|
|
1003
1017
|
) : remoteRecord;
|
|
1018
|
+
const record = filterPendingPaymentsFromLoadedSalesDetail(mergedRecord);
|
|
1004
1019
|
return await this.hydrateLatestLoadedSalesDetail(record, loadSequence);
|
|
1005
1020
|
} finally {
|
|
1006
1021
|
this.salesDetailLoadInFlightCount = Math.max(
|