@pisell/pisellos 2.3.29 → 2.3.30
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/model/strategy/adapter/index.d.ts +0 -4
- package/dist/model/strategy/adapter/index.js +1 -5
- package/dist/model/strategy/adapter/promotion/index.js +9 -0
- package/dist/modules/Discount/index.d.ts +2 -5
- package/dist/modules/Discount/index.js +7 -30
- package/dist/modules/Discount/types.d.ts +0 -4
- package/dist/modules/Order/index.d.ts +28 -10
- package/dist/modules/Order/index.js +747 -498
- package/dist/modules/Order/payment-utils.d.ts +23 -0
- package/dist/modules/Order/payment-utils.js +203 -0
- package/dist/modules/Order/types.d.ts +33 -3
- package/dist/modules/Order/utils.js +4 -4
- package/dist/modules/Payment/index.d.ts +2 -0
- package/dist/modules/Payment/index.js +78 -49
- package/dist/modules/Payment/types.d.ts +26 -24
- package/dist/modules/Payment/types.js +2 -0
- package/dist/modules/Product/index.d.ts +1 -1
- package/dist/modules/Product/types.d.ts +0 -22
- package/dist/modules/ProductList/index.d.ts +1 -1
- package/dist/modules/ProductList/index.js +2 -4
- package/dist/modules/ProductList/types.d.ts +0 -2
- package/dist/server/index.d.ts +14 -50
- package/dist/server/index.js +1975 -1395
- package/dist/server/modules/order/index.d.ts +40 -3
- package/dist/server/modules/order/index.js +1200 -501
- package/dist/server/modules/order/types.d.ts +11 -3
- package/dist/server/modules/order/types.js +1 -1
- package/dist/server/modules/products/index.d.ts +7 -26
- package/dist/server/modules/products/index.js +76 -167
- package/dist/server/modules/products/types.d.ts +0 -14
- package/dist/solution/BaseSales/index.d.ts +33 -5
- package/dist/solution/BaseSales/index.js +622 -345
- package/dist/solution/BaseSales/utils/parseSalesResponse.d.ts +6 -1
- package/dist/solution/BookingByStep/index.d.ts +1 -1
- package/dist/solution/BookingTicket/index.d.ts +1 -1
- package/dist/solution/BookingTicket/index.js +2 -1
- package/dist/solution/BookingTicket/types.d.ts +0 -2
- package/dist/solution/ShopDiscount/index.js +14 -15
- package/dist/utils/payment-number.d.ts +9 -0
- package/dist/utils/payment-number.js +69 -0
- package/lib/model/strategy/adapter/index.d.ts +0 -4
- package/lib/model/strategy/adapter/index.js +2 -13
- package/lib/modules/Discount/index.d.ts +2 -5
- package/lib/modules/Discount/index.js +3 -23
- package/lib/modules/Discount/types.d.ts +0 -4
- package/lib/modules/Order/index.d.ts +28 -10
- package/lib/modules/Order/index.js +181 -73
- package/lib/modules/Order/payment-utils.d.ts +23 -0
- package/lib/modules/Order/payment-utils.js +193 -0
- package/lib/modules/Order/types.d.ts +33 -3
- package/lib/modules/Order/utils.js +2 -3
- package/lib/modules/Payment/index.d.ts +2 -0
- package/lib/modules/Payment/index.js +33 -12
- package/lib/modules/Payment/types.d.ts +26 -24
- package/lib/modules/Product/index.d.ts +1 -1
- package/lib/modules/Product/types.d.ts +0 -22
- package/lib/modules/ProductList/index.d.ts +1 -1
- package/lib/modules/ProductList/index.js +2 -4
- package/lib/modules/ProductList/types.d.ts +0 -2
- package/lib/server/index.d.ts +14 -50
- package/lib/server/index.js +633 -214
- package/lib/server/modules/order/index.d.ts +40 -3
- package/lib/server/modules/order/index.js +434 -31
- package/lib/server/modules/order/types.d.ts +11 -3
- package/lib/server/modules/products/index.d.ts +7 -26
- package/lib/server/modules/products/index.js +35 -114
- package/lib/server/modules/products/types.d.ts +0 -14
- package/lib/solution/BaseSales/index.d.ts +33 -5
- package/lib/solution/BaseSales/index.js +170 -19
- package/lib/solution/BaseSales/utils/parseSalesResponse.d.ts +6 -1
- package/lib/solution/BookingByStep/index.d.ts +1 -1
- package/lib/solution/BookingTicket/index.d.ts +1 -1
- package/lib/solution/BookingTicket/index.js +2 -1
- package/lib/solution/BookingTicket/types.d.ts +0 -2
- package/lib/solution/ShopDiscount/index.js +1 -2
- package/lib/utils/payment-number.d.ts +9 -0
- package/lib/utils/payment-number.js +64 -0
- package/package.json +1 -1
- package/dist/model/strategy/adapter/dataVariant/adapter.d.ts +0 -50
- package/dist/model/strategy/adapter/dataVariant/adapter.js +0 -167
- package/dist/model/strategy/adapter/dataVariant/evaluator.d.ts +0 -89
- package/dist/model/strategy/adapter/dataVariant/evaluator.js +0 -780
- package/dist/model/strategy/adapter/dataVariant/examples.d.ts +0 -39
- package/dist/model/strategy/adapter/dataVariant/examples.js +0 -277
- package/dist/model/strategy/adapter/dataVariant/index.d.ts +0 -4
- package/dist/model/strategy/adapter/dataVariant/index.js +0 -4
- package/dist/model/strategy/adapter/dataVariant/type.d.ts +0 -148
- package/dist/model/strategy/adapter/dataVariant/type.js +0 -54
- package/lib/model/strategy/adapter/dataVariant/adapter.d.ts +0 -50
- package/lib/model/strategy/adapter/dataVariant/adapter.js +0 -149
- package/lib/model/strategy/adapter/dataVariant/evaluator.d.ts +0 -89
- package/lib/model/strategy/adapter/dataVariant/evaluator.js +0 -583
- package/lib/model/strategy/adapter/dataVariant/examples.d.ts +0 -39
- package/lib/model/strategy/adapter/dataVariant/examples.js +0 -293
- package/lib/model/strategy/adapter/dataVariant/index.d.ts +0 -4
- package/lib/model/strategy/adapter/dataVariant/index.js +0 -38
- package/lib/model/strategy/adapter/dataVariant/type.d.ts +0 -148
- package/lib/model/strategy/adapter/dataVariant/type.js +0 -31
|
@@ -27,6 +27,9 @@ import { CashPaymentImpl } from "./cash";
|
|
|
27
27
|
import { EftposPaymentImpl } from "./eftpos";
|
|
28
28
|
import { WalletPassPaymentImpl } from "./walletpass";
|
|
29
29
|
import { Decimal } from 'decimal.js';
|
|
30
|
+
import { ensureOrderPaymentNumber } from "../Order/payment-utils";
|
|
31
|
+
import { createUuidV4 } from "../Order/utils";
|
|
32
|
+
import { resolvePaymentNumberDevicePrefix } from "../../utils/payment-number";
|
|
30
33
|
export * from "./types";
|
|
31
34
|
export { generateRequestUniqueId };
|
|
32
35
|
|
|
@@ -102,6 +105,7 @@ export var PaymentModule = /*#__PURE__*/function (_BaseModule) {
|
|
|
102
105
|
_defineProperty(_assertThisInitialized(_this), "request", void 0);
|
|
103
106
|
_defineProperty(_assertThisInitialized(_this), "app", void 0);
|
|
104
107
|
// App instance
|
|
108
|
+
_defineProperty(_assertThisInitialized(_this), "appPlugin", void 0);
|
|
105
109
|
_defineProperty(_assertThisInitialized(_this), "store", void 0);
|
|
106
110
|
_defineProperty(_assertThisInitialized(_this), "window", void 0);
|
|
107
111
|
// WindowPlugin 实例
|
|
@@ -168,7 +172,6 @@ export var PaymentModule = /*#__PURE__*/function (_BaseModule) {
|
|
|
168
172
|
key: "initialize",
|
|
169
173
|
value: function () {
|
|
170
174
|
var _initialize = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee(core, options) {
|
|
171
|
-
var appPlugin;
|
|
172
175
|
return _regeneratorRuntime().wrap(function _callee$(_context) {
|
|
173
176
|
while (1) switch (_context.prev = _context.next) {
|
|
174
177
|
case 0:
|
|
@@ -178,7 +181,7 @@ export var PaymentModule = /*#__PURE__*/function (_BaseModule) {
|
|
|
178
181
|
|
|
179
182
|
// 获取依赖的插件
|
|
180
183
|
this.request = core.getPlugin('request');
|
|
181
|
-
appPlugin = core.getPlugin('app');
|
|
184
|
+
this.appPlugin = core.getPlugin('app');
|
|
182
185
|
this.window = core.getPlugin('window');
|
|
183
186
|
if (this.request) {
|
|
184
187
|
_context.next = 8;
|
|
@@ -186,13 +189,13 @@ export var PaymentModule = /*#__PURE__*/function (_BaseModule) {
|
|
|
186
189
|
}
|
|
187
190
|
throw new Error('支付模块需要 request 插件支持');
|
|
188
191
|
case 8:
|
|
189
|
-
if (appPlugin) {
|
|
192
|
+
if (this.appPlugin) {
|
|
190
193
|
_context.next = 10;
|
|
191
194
|
break;
|
|
192
195
|
}
|
|
193
196
|
throw new Error('支付模块需要 app 插件支持');
|
|
194
197
|
case 10:
|
|
195
|
-
this.app = appPlugin.getApp();
|
|
198
|
+
this.app = this.appPlugin.getApp();
|
|
196
199
|
this.dbManager = this.app.dbManager;
|
|
197
200
|
this.logger = this.app.logger;
|
|
198
201
|
|
|
@@ -228,6 +231,15 @@ export var PaymentModule = /*#__PURE__*/function (_BaseModule) {
|
|
|
228
231
|
value: function updateOtherParams(params) {
|
|
229
232
|
this.otherParams = params || {};
|
|
230
233
|
}
|
|
234
|
+
}, {
|
|
235
|
+
key: "getPaymentNumberAppData",
|
|
236
|
+
value: function getPaymentNumberAppData(key) {
|
|
237
|
+
var _this$appPlugin, _this$appPlugin$getDa, _this$app, _this$app$getStore, _this$app$getStore$ca, _this$app$getStore$ca2;
|
|
238
|
+
var getData = (_this$appPlugin = this.appPlugin) === null || _this$appPlugin === void 0 || (_this$appPlugin$getDa = _this$appPlugin.getData) === null || _this$appPlugin$getDa === void 0 ? void 0 : _this$appPlugin$getDa.call(_this$appPlugin);
|
|
239
|
+
if (typeof getData === 'function') return getData(key);
|
|
240
|
+
var coreData = (_this$app = this.app) === null || _this$app === void 0 || (_this$app = _this$app.models) === null || _this$app === void 0 || (_this$app$getStore = _this$app.getStore) === null || _this$app$getStore === void 0 || (_this$app$getStore$ca = (_this$app$getStore$ca2 = _this$app$getStore.call(_this$app)).getDataByModel) === null || _this$app$getStore$ca === void 0 ? void 0 : _this$app$getStore$ca.call(_this$app$getStore$ca2, 'core', 'core');
|
|
241
|
+
return coreData === null || coreData === void 0 ? void 0 : coreData[key];
|
|
242
|
+
}
|
|
231
243
|
|
|
232
244
|
/**
|
|
233
245
|
* 记录信息日志
|
|
@@ -884,7 +896,8 @@ export var PaymentModule = /*#__PURE__*/function (_BaseModule) {
|
|
|
884
896
|
key: "addPaymentItemAsync",
|
|
885
897
|
value: (function () {
|
|
886
898
|
var _addPaymentItemAsync = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee12(orderUuid, paymentItem) {
|
|
887
|
-
var
|
|
899
|
+
var _this5 = this;
|
|
900
|
+
var _paymentItem$metadata, _newPaymentItem$metad, _newPaymentItem$metad2, _newPaymentItem$metad3, order, expectAmount, paidDepositAmount, expectedDepositAmount, warningMessage, paymentUuid, currentTime, hasPaymentNumber, paymentNumberDevicePrefix, paymentNumber, newPaymentItem;
|
|
888
901
|
return _regeneratorRuntime().wrap(function _callee12$(_context12) {
|
|
889
902
|
while (1) switch (_context12.prev = _context12.next) {
|
|
890
903
|
case 0:
|
|
@@ -940,14 +953,29 @@ export var PaymentModule = /*#__PURE__*/function (_BaseModule) {
|
|
|
940
953
|
});
|
|
941
954
|
throw new Error(warningMessage);
|
|
942
955
|
case 17:
|
|
943
|
-
|
|
944
|
-
paymentUuid = paymentItem.metadata.unique_payment_number;
|
|
945
|
-
} else {
|
|
946
|
-
paymentUuid = getUniqueId('payment_');
|
|
947
|
-
}
|
|
956
|
+
paymentUuid = paymentItem.uuid || ((_paymentItem$metadata = paymentItem.metadata) === null || _paymentItem$metadata === void 0 ? void 0 : _paymentItem$metadata.unique_payment_number) || getUniqueId('payment_');
|
|
948
957
|
currentTime = formatDateTime(new Date());
|
|
958
|
+
hasPaymentNumber = String(paymentItem.payment_number || '').trim() !== '';
|
|
959
|
+
if (!hasPaymentNumber) {
|
|
960
|
+
_context12.next = 24;
|
|
961
|
+
break;
|
|
962
|
+
}
|
|
963
|
+
_context12.t0 = 'LOCAL';
|
|
964
|
+
_context12.next = 27;
|
|
965
|
+
break;
|
|
966
|
+
case 24:
|
|
967
|
+
_context12.next = 26;
|
|
968
|
+
return resolvePaymentNumberDevicePrefix(function (key) {
|
|
969
|
+
return _this5.getPaymentNumberAppData(key);
|
|
970
|
+
});
|
|
971
|
+
case 26:
|
|
972
|
+
_context12.t0 = _context12.sent;
|
|
973
|
+
case 27:
|
|
974
|
+
paymentNumberDevicePrefix = _context12.t0;
|
|
975
|
+
paymentNumber = ensureOrderPaymentNumber(paymentItem, paymentNumberDevicePrefix, createUuidV4).payment_number;
|
|
949
976
|
newPaymentItem = {
|
|
950
977
|
uuid: paymentUuid,
|
|
978
|
+
payment_number: paymentNumber,
|
|
951
979
|
custom_payment_id: normalizeCustomPaymentId(paymentItem),
|
|
952
980
|
name: paymentItem.name,
|
|
953
981
|
code: paymentItem.code,
|
|
@@ -966,10 +994,7 @@ export var PaymentModule = /*#__PURE__*/function (_BaseModule) {
|
|
|
966
994
|
// 创建时间
|
|
967
995
|
updated_at: currentTime,
|
|
968
996
|
// 更新时间
|
|
969
|
-
metadata: _objectSpread(
|
|
970
|
-
// 保留传入的所有 metadata 字段
|
|
971
|
-
unique_payment_number: paymentUuid // 设置唯一支付号为支付项的 uuid
|
|
972
|
-
})
|
|
997
|
+
metadata: _objectSpread({}, paymentItem.metadata)
|
|
973
998
|
};
|
|
974
999
|
order.payment.push(newPaymentItem);
|
|
975
1000
|
this.recalculateOrderAmount(order);
|
|
@@ -977,9 +1002,9 @@ export var PaymentModule = /*#__PURE__*/function (_BaseModule) {
|
|
|
977
1002
|
orderUuid: orderUuid,
|
|
978
1003
|
order: order
|
|
979
1004
|
});
|
|
980
|
-
_context12.next =
|
|
1005
|
+
_context12.next = 35;
|
|
981
1006
|
return this.dbManager.update('order', order, true);
|
|
982
|
-
case
|
|
1007
|
+
case 35:
|
|
983
1008
|
this.logInfo('更新订单支付项完成', {
|
|
984
1009
|
orderUuid: orderUuid
|
|
985
1010
|
});
|
|
@@ -1000,22 +1025,22 @@ export var PaymentModule = /*#__PURE__*/function (_BaseModule) {
|
|
|
1000
1025
|
actualPaidAmount: (_newPaymentItem$metad2 = newPaymentItem.metadata) === null || _newPaymentItem$metad2 === void 0 ? void 0 : _newPaymentItem$metad2.actual_paid_amount,
|
|
1001
1026
|
changeGivenAmount: (_newPaymentItem$metad3 = newPaymentItem.metadata) === null || _newPaymentItem$metad3 === void 0 ? void 0 : _newPaymentItem$metad3.change_given_amount
|
|
1002
1027
|
});
|
|
1003
|
-
_context12.next =
|
|
1028
|
+
_context12.next = 45;
|
|
1004
1029
|
break;
|
|
1005
|
-
case
|
|
1006
|
-
_context12.prev =
|
|
1007
|
-
_context12.
|
|
1008
|
-
console.error('[PaymentModule] 添加支付项失败', _context12.
|
|
1009
|
-
this.logError('addPaymentItemAsync failed', _context12.
|
|
1030
|
+
case 40:
|
|
1031
|
+
_context12.prev = 40;
|
|
1032
|
+
_context12.t1 = _context12["catch"](1);
|
|
1033
|
+
console.error('[PaymentModule] 添加支付项失败', _context12.t1);
|
|
1034
|
+
this.logError('addPaymentItemAsync failed', _context12.t1, {
|
|
1010
1035
|
orderUuid: orderUuid,
|
|
1011
1036
|
paymentItem: paymentItem
|
|
1012
1037
|
});
|
|
1013
|
-
throw _context12.
|
|
1014
|
-
case
|
|
1038
|
+
throw _context12.t1;
|
|
1039
|
+
case 45:
|
|
1015
1040
|
case "end":
|
|
1016
1041
|
return _context12.stop();
|
|
1017
1042
|
}
|
|
1018
|
-
}, _callee12, this, [[1,
|
|
1043
|
+
}, _callee12, this, [[1, 40]]);
|
|
1019
1044
|
}));
|
|
1020
1045
|
function addPaymentItemAsync(_x13, _x14) {
|
|
1021
1046
|
return _addPaymentItemAsync.apply(this, arguments);
|
|
@@ -1135,17 +1160,17 @@ export var PaymentModule = /*#__PURE__*/function (_BaseModule) {
|
|
|
1135
1160
|
key: "updateVoucherPaymentItemsAsync",
|
|
1136
1161
|
value: (function () {
|
|
1137
1162
|
var _updateVoucherPaymentItemsAsync = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee15(orderUuid, voucherPaymentItems) {
|
|
1138
|
-
var
|
|
1163
|
+
var _this6 = this;
|
|
1139
1164
|
return _regeneratorRuntime().wrap(function _callee15$(_context15) {
|
|
1140
1165
|
while (1) switch (_context15.prev = _context15.next) {
|
|
1141
1166
|
case 0:
|
|
1142
1167
|
return _context15.abrupt("return", this.runVoucherUpdateLocked(orderUuid, /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee14() {
|
|
1143
|
-
var
|
|
1168
|
+
var _this6$normalizeVouch, normalizedVoucherItems, originalCount, normalizedCount, order, existingVoucherItems, _iterator2, _step2, voucherItem, orderAfterDelete, existingActiveVoucherKeys, _iterator3, _step3, _voucherItem, orderPaymentType, key, updatedOrder;
|
|
1144
1169
|
return _regeneratorRuntime().wrap(function _callee14$(_context14) {
|
|
1145
1170
|
while (1) switch (_context14.prev = _context14.next) {
|
|
1146
1171
|
case 0:
|
|
1147
|
-
|
|
1148
|
-
|
|
1172
|
+
_this6$normalizeVouch = _this6.normalizeVoucherPaymentItems(voucherPaymentItems), normalizedVoucherItems = _this6$normalizeVouch.items, originalCount = _this6$normalizeVouch.originalCount, normalizedCount = _this6$normalizeVouch.normalizedCount;
|
|
1173
|
+
_this6.logInfo('Starting updateVoucherPaymentItemsAsync', {
|
|
1149
1174
|
orderUuid: orderUuid,
|
|
1150
1175
|
originalVoucherCount: originalCount,
|
|
1151
1176
|
normalizedVoucherCount: normalizedCount,
|
|
@@ -1167,7 +1192,7 @@ export var PaymentModule = /*#__PURE__*/function (_BaseModule) {
|
|
|
1167
1192
|
}
|
|
1168
1193
|
_context14.prev = 3;
|
|
1169
1194
|
_context14.next = 6;
|
|
1170
|
-
return
|
|
1195
|
+
return _this6.getPaymentOrderByUuidAsync(orderUuid);
|
|
1171
1196
|
case 6:
|
|
1172
1197
|
order = _context14.sent;
|
|
1173
1198
|
if (order) {
|
|
@@ -1207,7 +1232,7 @@ export var PaymentModule = /*#__PURE__*/function (_BaseModule) {
|
|
|
1207
1232
|
voucherItem = _step2.value;
|
|
1208
1233
|
console.log("[PaymentModule] \u5220\u9664\u73B0\u6709\u4EE3\u91D1\u5238\u652F\u4ED8\u9879: ".concat(voucherItem.uuid));
|
|
1209
1234
|
_context14.next = 19;
|
|
1210
|
-
return
|
|
1235
|
+
return _this6.deletePaymentAsync(orderUuid, voucherItem.uuid);
|
|
1211
1236
|
case 19:
|
|
1212
1237
|
_context14.next = 14;
|
|
1213
1238
|
break;
|
|
@@ -1224,7 +1249,7 @@ export var PaymentModule = /*#__PURE__*/function (_BaseModule) {
|
|
|
1224
1249
|
return _context14.finish(26);
|
|
1225
1250
|
case 29:
|
|
1226
1251
|
_context14.next = 31;
|
|
1227
|
-
return
|
|
1252
|
+
return _this6.getPaymentOrderByUuidAsync(orderUuid);
|
|
1228
1253
|
case 31:
|
|
1229
1254
|
orderAfterDelete = _context14.sent;
|
|
1230
1255
|
if (orderAfterDelete) {
|
|
@@ -1271,7 +1296,7 @@ export var PaymentModule = /*#__PURE__*/function (_BaseModule) {
|
|
|
1271
1296
|
order_payment_type: orderPaymentType
|
|
1272
1297
|
}));
|
|
1273
1298
|
_context14.next = 49;
|
|
1274
|
-
return
|
|
1299
|
+
return _this6.addPaymentItemAsync(orderUuid, _voucherItem);
|
|
1275
1300
|
case 49:
|
|
1276
1301
|
existingActiveVoucherKeys.add(key);
|
|
1277
1302
|
case 50:
|
|
@@ -1290,17 +1315,17 @@ export var PaymentModule = /*#__PURE__*/function (_BaseModule) {
|
|
|
1290
1315
|
return _context14.finish(57);
|
|
1291
1316
|
case 60:
|
|
1292
1317
|
_context14.next = 62;
|
|
1293
|
-
return
|
|
1318
|
+
return _this6.getPaymentOrderByUuidAsync(orderUuid);
|
|
1294
1319
|
case 62:
|
|
1295
1320
|
updatedOrder = _context14.sent;
|
|
1296
1321
|
_context14.next = 65;
|
|
1297
|
-
return
|
|
1322
|
+
return _this6.core.effects.emit("".concat(_this6.name, ":onPaymentAdded"), {
|
|
1298
1323
|
orderUuid: orderUuid,
|
|
1299
1324
|
order: updatedOrder,
|
|
1300
1325
|
payment: null // 批量操作不提供单个支付项
|
|
1301
1326
|
});
|
|
1302
1327
|
case 65:
|
|
1303
|
-
|
|
1328
|
+
_this6.logInfo('updateVoucherPaymentItemsAsync completed successfully', {
|
|
1304
1329
|
orderUuid: orderUuid,
|
|
1305
1330
|
removedVoucherCount: existingVoucherItems.length,
|
|
1306
1331
|
addedVoucherCount: normalizedVoucherItems.length,
|
|
@@ -1312,7 +1337,7 @@ export var PaymentModule = /*#__PURE__*/function (_BaseModule) {
|
|
|
1312
1337
|
_context14.prev = 68;
|
|
1313
1338
|
_context14.t2 = _context14["catch"](3);
|
|
1314
1339
|
console.error('[PaymentModule] 批量更新代金券支付项失败:', _context14.t2);
|
|
1315
|
-
|
|
1340
|
+
_this6.logError('updateVoucherPaymentItemsAsync failed', _context14.t2, {
|
|
1316
1341
|
orderUuid: orderUuid,
|
|
1317
1342
|
voucherPaymentItems: voucherPaymentItems
|
|
1318
1343
|
});
|
|
@@ -1361,7 +1386,7 @@ export var PaymentModule = /*#__PURE__*/function (_BaseModule) {
|
|
|
1361
1386
|
return payment.uuid === paymentUuid;
|
|
1362
1387
|
});
|
|
1363
1388
|
if (!paymentItem) {
|
|
1364
|
-
_context16.next =
|
|
1389
|
+
_context16.next = 19;
|
|
1365
1390
|
break;
|
|
1366
1391
|
}
|
|
1367
1392
|
// 如果更新参数中包含 amount,先格式化
|
|
@@ -1369,40 +1394,43 @@ export var PaymentModule = /*#__PURE__*/function (_BaseModule) {
|
|
|
1369
1394
|
if ('amount' in formattedParams && formattedParams.amount !== undefined) {
|
|
1370
1395
|
formattedParams.amount = formatAmount(formattedParams.amount);
|
|
1371
1396
|
}
|
|
1397
|
+
if (formattedParams.metadata && _typeof(formattedParams.metadata) === 'object') {
|
|
1398
|
+
formattedParams.metadata = _objectSpread(_objectSpread({}, paymentItem.metadata || {}), formattedParams.metadata);
|
|
1399
|
+
}
|
|
1372
1400
|
Object.assign(paymentItem, formattedParams);
|
|
1373
1401
|
|
|
1374
1402
|
// 重新计算待付金额
|
|
1375
1403
|
this.recalculateOrderAmount(order);
|
|
1376
1404
|
|
|
1377
1405
|
// 更新到 IndexDB
|
|
1378
|
-
_context16.next =
|
|
1406
|
+
_context16.next = 15;
|
|
1379
1407
|
return this.dbManager.update('order', order);
|
|
1380
|
-
case
|
|
1381
|
-
_context16.next =
|
|
1408
|
+
case 15:
|
|
1409
|
+
_context16.next = 17;
|
|
1382
1410
|
return this.core.effects.emit("".concat(this.name, ":onPaymentUpdated"), {
|
|
1383
1411
|
order: order,
|
|
1384
1412
|
paymentItem: paymentItem
|
|
1385
1413
|
});
|
|
1386
|
-
case
|
|
1387
|
-
_context16.next =
|
|
1414
|
+
case 17:
|
|
1415
|
+
_context16.next = 19;
|
|
1388
1416
|
return this.core.effects.emit("".concat(this.name, ":onOrderChanged"), {
|
|
1389
1417
|
action: 'payment_update',
|
|
1390
1418
|
order: order,
|
|
1391
1419
|
paymentItem: paymentItem
|
|
1392
1420
|
});
|
|
1393
|
-
case
|
|
1394
|
-
_context16.next =
|
|
1421
|
+
case 19:
|
|
1422
|
+
_context16.next = 25;
|
|
1395
1423
|
break;
|
|
1396
|
-
case
|
|
1397
|
-
_context16.prev =
|
|
1424
|
+
case 21:
|
|
1425
|
+
_context16.prev = 21;
|
|
1398
1426
|
_context16.t0 = _context16["catch"](0);
|
|
1399
1427
|
console.error('[PaymentModule] 更新支付项失败', _context16.t0);
|
|
1400
1428
|
throw _context16.t0;
|
|
1401
|
-
case
|
|
1429
|
+
case 25:
|
|
1402
1430
|
case "end":
|
|
1403
1431
|
return _context16.stop();
|
|
1404
1432
|
}
|
|
1405
|
-
}, _callee16, this, [[0,
|
|
1433
|
+
}, _callee16, this, [[0, 21]]);
|
|
1406
1434
|
}));
|
|
1407
1435
|
function updatePaymentAsync(_x19, _x20, _x21) {
|
|
1408
1436
|
return _updatePaymentAsync.apply(this, arguments);
|
|
@@ -1518,6 +1546,7 @@ export var PaymentModule = /*#__PURE__*/function (_BaseModule) {
|
|
|
1518
1546
|
payments: order.payment.map(function (payment) {
|
|
1519
1547
|
return {
|
|
1520
1548
|
uuid: payment.uuid,
|
|
1549
|
+
payment_number: payment.payment_number,
|
|
1521
1550
|
amount: payment.amount,
|
|
1522
1551
|
code: payment.code,
|
|
1523
1552
|
custom_payment_id: payment.custom_payment_id,
|
|
@@ -87,12 +87,30 @@ export interface PaymentMethod {
|
|
|
87
87
|
/** 其他配置信息 */
|
|
88
88
|
[key: string]: any;
|
|
89
89
|
}
|
|
90
|
+
/** 支付项扩展元数据 */
|
|
91
|
+
export interface PaymentItemMetadata {
|
|
92
|
+
/** 钱箱 ID */
|
|
93
|
+
shop_wallet_pass_id?: string;
|
|
94
|
+
/** 三方支付交易流水号 */
|
|
95
|
+
unique_payment_number?: string;
|
|
96
|
+
/** 刷卡机设备快照;PaymentModule 不解析内部字段 */
|
|
97
|
+
card_reader_snapshot?: Record<string, unknown>;
|
|
98
|
+
/** rounding 规则 */
|
|
99
|
+
rounding_rule?: any;
|
|
100
|
+
/** 实付金额(现金支付时的实际给出金额) */
|
|
101
|
+
actual_paid_amount?: number;
|
|
102
|
+
/** 找零金额(现金支付时的找零金额) */
|
|
103
|
+
change_given_amount?: number;
|
|
104
|
+
[key: string]: unknown;
|
|
105
|
+
}
|
|
90
106
|
/**
|
|
91
107
|
* 支付项
|
|
92
108
|
*/
|
|
93
109
|
export interface PaymentItem {
|
|
94
110
|
/** 当前支付项的唯一 ID */
|
|
95
111
|
uuid: string;
|
|
112
|
+
/** 支付项稳定唯一号 */
|
|
113
|
+
payment_number?: string;
|
|
96
114
|
/** 当前支付方式付出去多少钱 */
|
|
97
115
|
amount: string;
|
|
98
116
|
/** 支付类型,跟支付列表上对应的支付方式保持一致 */
|
|
@@ -110,18 +128,7 @@ export interface PaymentItem {
|
|
|
110
128
|
/** Wallet Pass 本次使用值 */
|
|
111
129
|
wallet_pass_use_value?: string | number | null;
|
|
112
130
|
/** 拓展参数字段 */
|
|
113
|
-
metadata?:
|
|
114
|
-
/** 钱箱 ID */
|
|
115
|
-
shop_wallet_pass_id?: string;
|
|
116
|
-
/** 唯一支付号 */
|
|
117
|
-
unique_payment_number?: string;
|
|
118
|
-
/** rouding规则 */
|
|
119
|
-
rounding_rule?: any;
|
|
120
|
-
/** 实付金额(现金支付时的实际给出金额) */
|
|
121
|
-
actual_paid_amount?: number;
|
|
122
|
-
/** 找零金额(现金支付时的找零金额) */
|
|
123
|
-
change_given_amount?: number;
|
|
124
|
-
};
|
|
131
|
+
metadata?: PaymentItemMetadata;
|
|
125
132
|
/** rouding金额 */
|
|
126
133
|
rounding_amount?: string;
|
|
127
134
|
/** 三方支付手续费 */
|
|
@@ -228,6 +235,10 @@ export interface UpdateOrderParams {
|
|
|
228
235
|
* 支付项输入类型(允许 amount 为数字)
|
|
229
236
|
*/
|
|
230
237
|
export interface PaymentItemInput {
|
|
238
|
+
/** 调用方已有的支付项运行态 UUID;存在时复用为 payment_number 的唯一号段 */
|
|
239
|
+
uuid?: string;
|
|
240
|
+
/** 支付项稳定唯一号 */
|
|
241
|
+
payment_number?: string;
|
|
231
242
|
/** 当前支付方式付出去多少钱 */
|
|
232
243
|
amount: string | number;
|
|
233
244
|
/** 支付类型,跟支付列表上对应的支付方式保持一致 */
|
|
@@ -256,18 +267,7 @@ export interface PaymentItemInput {
|
|
|
256
267
|
/** 订单支付类型 */
|
|
257
268
|
order_payment_type?: 'normal' | 'deposit';
|
|
258
269
|
/** 扩展参数字段 */
|
|
259
|
-
metadata?:
|
|
260
|
-
/** 钱箱 ID */
|
|
261
|
-
shop_wallet_pass_id?: string;
|
|
262
|
-
/** 唯一支付号 */
|
|
263
|
-
unique_payment_number?: string;
|
|
264
|
-
/** rounding规则 */
|
|
265
|
-
rounding_rule?: any;
|
|
266
|
-
/** 实付金额(现金支付时的实际给出金额) */
|
|
267
|
-
actual_paid_amount?: number;
|
|
268
|
-
/** 找零金额(现金支付时的找零金额) */
|
|
269
|
-
change_given_amount?: number;
|
|
270
|
-
};
|
|
270
|
+
metadata?: PaymentItemMetadata;
|
|
271
271
|
/** 支付项创建时间 (格式: YYYY-MM-DD HH:mm:ss, 可选,不传则自动生成) */
|
|
272
272
|
created_at?: string;
|
|
273
273
|
/** 支付项更新时间 (格式: YYYY-MM-DD HH:mm:ss, 可选,不传则自动生成) */
|
|
@@ -302,6 +302,8 @@ export interface PaymentUpdateFields {
|
|
|
302
302
|
voucher_id?: string;
|
|
303
303
|
/** 该支付项是否已经同步给后端服务器(只有网络请求成功后才为true) */
|
|
304
304
|
isSynced?: boolean;
|
|
305
|
+
/** 支付项扩展元数据;更新时与原 metadata 浅合并 */
|
|
306
|
+
metadata?: PaymentItemMetadata;
|
|
305
307
|
/** 同步错误信息(业务错误时记录错误信息,用于区分"未同步"和"同步失败") */
|
|
306
308
|
syncError?: {
|
|
307
309
|
error: string;
|
|
@@ -49,5 +49,5 @@ export declare class Product extends BaseModule implements Module {
|
|
|
49
49
|
getCategories(): ProductCategory[];
|
|
50
50
|
setOtherParams(key: string, value: any): void;
|
|
51
51
|
getOtherParams(): any;
|
|
52
|
-
getProductType(): "
|
|
52
|
+
getProductType(): "duration" | "session" | "normal";
|
|
53
53
|
}
|
|
@@ -9,26 +9,6 @@ export interface ProductCollection {
|
|
|
9
9
|
/** 商品集合封面 */
|
|
10
10
|
cover: string;
|
|
11
11
|
}
|
|
12
|
-
/**
|
|
13
|
-
* 商品 Data Variant 记录,结构与后端 data_variant 表对齐。
|
|
14
|
-
*/
|
|
15
|
-
export interface ProductDataVariant {
|
|
16
|
-
/** 变体记录 id */
|
|
17
|
-
id: number;
|
|
18
|
-
/** 店铺 id */
|
|
19
|
-
shop_id: number;
|
|
20
|
-
/** 所属模块,商品场景固定为 product */
|
|
21
|
-
module: string;
|
|
22
|
-
/** 模块数据 id,商品场景对应 product.id */
|
|
23
|
-
module_data_id: number;
|
|
24
|
-
/** 关联 data_variant_rule.id */
|
|
25
|
-
data_variant_rule_id: number;
|
|
26
|
-
/** 命中策略后覆盖到商品上的字段 */
|
|
27
|
-
data: Record<string, any>;
|
|
28
|
-
created_at: string | null;
|
|
29
|
-
updated_at: string | null;
|
|
30
|
-
deleted_at: string | null;
|
|
31
|
-
}
|
|
32
12
|
/**
|
|
33
13
|
* 商品基本信息接口
|
|
34
14
|
*/
|
|
@@ -234,8 +214,6 @@ export interface ProductData {
|
|
|
234
214
|
bundle_group_count: number;
|
|
235
215
|
/** 选项组数量 */
|
|
236
216
|
option_group_count: number;
|
|
237
|
-
/** 智能定价变体列表,/product/query with dataVariants 返回 */
|
|
238
|
-
data_variants?: ProductDataVariant[];
|
|
239
217
|
/** 服务时长 */
|
|
240
218
|
service_times?: any;
|
|
241
219
|
}
|
|
@@ -26,7 +26,7 @@ export declare class ProductList extends BaseModule implements Module {
|
|
|
26
26
|
* const products = await productList.getAddTimeProducts({ schedule_date: '2026-06-16' });
|
|
27
27
|
*/
|
|
28
28
|
getAddTimeProducts(params?: ProductListLoadProductsParams): Promise<any>;
|
|
29
|
-
loadProducts({ category_ids, product_ids, collection, menu_list_ids, customer_id: paramsCustomerId, with_count, schedule_datetime, schedule_date, cacheId, with_schedule, extension_type, status,
|
|
29
|
+
loadProducts({ category_ids, product_ids, collection, menu_list_ids, customer_id: paramsCustomerId, with_count, schedule_datetime, schedule_date, cacheId, with_schedule, extension_type, status, }?: ProductListLoadProductsParams, options?: {
|
|
30
30
|
callback?: (result: any) => void;
|
|
31
31
|
subscriberId?: string;
|
|
32
32
|
}): Promise<any>;
|
|
@@ -152,7 +152,6 @@ export var ProductList = /*#__PURE__*/function (_BaseModule) {
|
|
|
152
152
|
extension_type,
|
|
153
153
|
_ref$status,
|
|
154
154
|
status,
|
|
155
|
-
strategy_context,
|
|
156
155
|
options,
|
|
157
156
|
userPlugin,
|
|
158
157
|
customer_id,
|
|
@@ -163,7 +162,7 @@ export var ProductList = /*#__PURE__*/function (_BaseModule) {
|
|
|
163
162
|
return _regeneratorRuntime().wrap(function _callee4$(_context4) {
|
|
164
163
|
while (1) switch (_context4.prev = _context4.next) {
|
|
165
164
|
case 0:
|
|
166
|
-
_ref = _args4.length > 0 && _args4[0] !== undefined ? _args4[0] : {}, _ref$category_ids = _ref.category_ids, category_ids = _ref$category_ids === void 0 ? [] : _ref$category_ids, _ref$product_ids = _ref.product_ids, product_ids = _ref$product_ids === void 0 ? [] : _ref$product_ids, _ref$collection = _ref.collection, collection = _ref$collection === void 0 ? [] : _ref$collection, _ref$menu_list_ids = _ref.menu_list_ids, menu_list_ids = _ref$menu_list_ids === void 0 ? [] : _ref$menu_list_ids, paramsCustomerId = _ref.customer_id, _ref$with_count = _ref.with_count, with_count = _ref$with_count === void 0 ? [] : _ref$with_count, schedule_datetime = _ref.schedule_datetime, schedule_date = _ref.schedule_date, cacheId = _ref.cacheId, with_schedule = _ref.with_schedule, extension_type = _ref.extension_type, _ref$status = _ref.status, status = _ref$status === void 0 ? 'published' : _ref$status
|
|
165
|
+
_ref = _args4.length > 0 && _args4[0] !== undefined ? _args4[0] : {}, _ref$category_ids = _ref.category_ids, category_ids = _ref$category_ids === void 0 ? [] : _ref$category_ids, _ref$product_ids = _ref.product_ids, product_ids = _ref$product_ids === void 0 ? [] : _ref$product_ids, _ref$collection = _ref.collection, collection = _ref$collection === void 0 ? [] : _ref$collection, _ref$menu_list_ids = _ref.menu_list_ids, menu_list_ids = _ref$menu_list_ids === void 0 ? [] : _ref$menu_list_ids, paramsCustomerId = _ref.customer_id, _ref$with_count = _ref.with_count, with_count = _ref$with_count === void 0 ? [] : _ref$with_count, schedule_datetime = _ref.schedule_datetime, schedule_date = _ref.schedule_date, cacheId = _ref.cacheId, with_schedule = _ref.with_schedule, extension_type = _ref.extension_type, _ref$status = _ref.status, status = _ref$status === void 0 ? 'published' : _ref$status;
|
|
167
166
|
options = _args4.length > 1 ? _args4[1] : undefined;
|
|
168
167
|
// // 如果 schedule_ids 为空,则需要尝试从 schedule 模块里获取
|
|
169
168
|
// if (!schedule_ids?.length) {
|
|
@@ -207,8 +206,7 @@ export var ProductList = /*#__PURE__*/function (_BaseModule) {
|
|
|
207
206
|
is_eject: 1,
|
|
208
207
|
with_schedule: with_schedule,
|
|
209
208
|
schedule_datetime: schedule_datetime,
|
|
210
|
-
extension_type: extension_type
|
|
211
|
-
strategy_context: strategy_context
|
|
209
|
+
extension_type: extension_type
|
|
212
210
|
}, {
|
|
213
211
|
osServer: true,
|
|
214
212
|
callback: options === null || options === void 0 ? void 0 : options.callback,
|
|
@@ -12,8 +12,6 @@ export interface ProductListLoadProductsParams {
|
|
|
12
12
|
with_schedule?: number;
|
|
13
13
|
extension_type?: string[];
|
|
14
14
|
status?: string;
|
|
15
|
-
/** 智能定价条件上下文,仅影响策略命中,不参与商品集合筛选 */
|
|
16
|
-
strategy_context?: Record<string, any>;
|
|
17
15
|
}
|
|
18
16
|
export interface ProductListData {
|
|
19
17
|
list: ProductData[];
|
package/dist/server/index.d.ts
CHANGED
|
@@ -47,8 +47,6 @@ declare class Server {
|
|
|
47
47
|
private prefixRouterGet;
|
|
48
48
|
router: Router;
|
|
49
49
|
private productQuerySubscribers;
|
|
50
|
-
/** subscriberId → 智能定价变价时间点定时器句柄(与 subscriber 分离存储,便于 clear) */
|
|
51
|
-
private productQueryScheduleTimers;
|
|
52
50
|
private orderQuerySubscribers;
|
|
53
51
|
private bookingQuerySubscribers;
|
|
54
52
|
private bookingRemoteQuerySubscribers;
|
|
@@ -57,6 +55,7 @@ declare class Server {
|
|
|
57
55
|
private readonly BOOKING_REMOTE_CACHE_MAX_ENTRIES;
|
|
58
56
|
private salesSearchSubscribers;
|
|
59
57
|
private deviceTaskActionsRegistered;
|
|
58
|
+
private localPaymentUpdateQueues;
|
|
60
59
|
private floorPlanQuerySubscribers;
|
|
61
60
|
private moduleRegistry;
|
|
62
61
|
constructor(core: PisellCore);
|
|
@@ -212,48 +211,6 @@ declare class Server {
|
|
|
212
211
|
* 根据 subscriberId 移除商品查询订阅者
|
|
213
212
|
*/
|
|
214
213
|
removeProductQuerySubscriber(subscriberId?: string): void;
|
|
215
|
-
/**
|
|
216
|
-
* 构建商品 query 响应 data 段,附带智能定价 schedule_time_points 元数据。
|
|
217
|
-
*/
|
|
218
|
-
private buildProductQueryResultPayload;
|
|
219
|
-
/**
|
|
220
|
-
* 是否启用商品 query 订阅的 schedule 时间点定时重算。
|
|
221
|
-
* strategy_context.enable_schedule_reload === false 时关闭。
|
|
222
|
-
*/
|
|
223
|
-
private shouldScheduleProductQueryReload;
|
|
224
|
-
/**
|
|
225
|
-
* 清除指定 subscriber 的全部 schedule 定时器,防止重复 query 或 unsubscribe 后泄漏。
|
|
226
|
-
*/
|
|
227
|
-
private clearSubscriberScheduleTimers;
|
|
228
|
-
/**
|
|
229
|
-
* 从 productQueryScheduleTimers 移除已触发的 timer 引用。
|
|
230
|
-
*/
|
|
231
|
-
private removeScheduleTimerRef;
|
|
232
|
-
/**
|
|
233
|
-
* 计算 schedule 变价时间点到当前时刻的延迟(ms)。已过期返回 -1。
|
|
234
|
-
*/
|
|
235
|
-
private computeScheduleTimePointDelayMs;
|
|
236
|
-
/**
|
|
237
|
-
* 定时重算前刷新 subscriber schedule 上下文:使用执行瞬间时间,禁止沿用首次 query 的 schedule_datetime。
|
|
238
|
-
*/
|
|
239
|
-
private refreshSubscriberScheduleAtExecution;
|
|
240
|
-
/**
|
|
241
|
-
* 为 subscriber 注册智能定价 scheduleTimePoints 定时重算。
|
|
242
|
-
* 必须先 clearSubscriberScheduleTimers,再调用本方法。
|
|
243
|
-
*/
|
|
244
|
-
private scheduleSubscriberTimePointReloads;
|
|
245
|
-
/**
|
|
246
|
-
* schedule 变价时间点定时器触发:刷新 schedule_datetime 后重算并 callback。
|
|
247
|
-
*/
|
|
248
|
-
private onScheduleTimePointTimerFire;
|
|
249
|
-
/**
|
|
250
|
-
* 对单个商品 query 订阅者重算并推送(定时路径;不新建 schedule timer)。
|
|
251
|
-
*/
|
|
252
|
-
private recomputeAndNotifySubscriber;
|
|
253
|
-
/**
|
|
254
|
-
* query 完成后为 subscriber 同步 schedule 定时器(先 clear 再 schedule)。
|
|
255
|
-
*/
|
|
256
|
-
private syncProductQueryScheduleTimers;
|
|
257
214
|
/**
|
|
258
215
|
* 处理商品查询请求
|
|
259
216
|
* 存储订阅者信息,便于数据变更时推送最新结果
|
|
@@ -453,6 +410,18 @@ declare class Server {
|
|
|
453
410
|
*/
|
|
454
411
|
private handleUpdateLocalOrder;
|
|
455
412
|
private handleOrderSalesCheckout;
|
|
413
|
+
private handleOrderSalesDraft;
|
|
414
|
+
private createLocalPaymentOperationId;
|
|
415
|
+
private buildLocalPaymentOrderLogContext;
|
|
416
|
+
private isValidLocalPaymentDecimal;
|
|
417
|
+
private getInvalidLocalPaymentSurchargeFields;
|
|
418
|
+
private buildLocalPaymentSurchargeUpdate;
|
|
419
|
+
private handleGetLocalPayment;
|
|
420
|
+
private handleUpdateLocalPayment;
|
|
421
|
+
private runLocalPaymentUpdateInQueue;
|
|
422
|
+
private processLocalPaymentUpdate;
|
|
423
|
+
private processSuccessfulLocalPayment;
|
|
424
|
+
private sanitizeLocalRecoveryOrder;
|
|
456
425
|
private handleOrderCheckout;
|
|
457
426
|
private getDeviceTaskPlugin;
|
|
458
427
|
private getIdGeneratorPlugin;
|
|
@@ -480,6 +449,7 @@ declare class Server {
|
|
|
480
449
|
private syncMachinecodeRedeemStatusToLocalOrder;
|
|
481
450
|
private handleOrderCheckoutSubmit;
|
|
482
451
|
private handleSyncCheckoutSubmit;
|
|
452
|
+
private handleOrderDraftSubmit;
|
|
483
453
|
private handlePendingSyncCheckoutOrder;
|
|
484
454
|
private buildPendingSyncCheckoutOrder;
|
|
485
455
|
private shouldBuildSmallTicketData;
|
|
@@ -614,12 +584,6 @@ declare class Server {
|
|
|
614
584
|
* @param options.changedIds 变更的商品 IDs,用于增量更新价格缓存
|
|
615
585
|
*/
|
|
616
586
|
private computeProductQueryResult;
|
|
617
|
-
/**
|
|
618
|
-
* 构建商品格式化上下文。
|
|
619
|
-
*
|
|
620
|
-
* 智能定价条件使用全量 menuList/scheduleList;Product Query 顶层参数只保留筛选商品集合所需字段。
|
|
621
|
-
*/
|
|
622
|
-
private buildProductFormatterContext;
|
|
623
587
|
/**
|
|
624
588
|
* 数据变更后,遍历所有订阅者重新计算查询结果并通过 callback 推送
|
|
625
589
|
* 由 ProductsModule 的 onProductsSyncCompleted 事件触发
|