@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.
Files changed (226) hide show
  1. package/dist/core/index.d.ts +2 -0
  2. package/dist/core/index.js +7 -0
  3. package/dist/model/strategy/adapter/promotion/adapter.d.ts +4 -0
  4. package/dist/model/strategy/adapter/promotion/adapter.js +23 -0
  5. package/dist/model/strategy/adapter/promotion/evaluator.d.ts +17 -0
  6. package/dist/model/strategy/adapter/promotion/evaluator.js +279 -6
  7. package/dist/model/strategy/adapter/promotion/examples.d.ts +86 -0
  8. package/dist/model/strategy/adapter/promotion/examples.js +99 -0
  9. package/dist/model/strategy/adapter/promotion/index.d.ts +1 -1
  10. package/dist/model/strategy/adapter/promotion/index.js +9 -0
  11. package/dist/model/strategy/adapter/promotion/type.d.ts +90 -2
  12. package/dist/model/strategy/adapter/promotion/type.js +45 -0
  13. package/dist/modules/BookingContext/utils/buildCacheItemFromOrderLine.js +5 -3
  14. package/dist/modules/BookingContext/utils/buildNormalProductCacheItemFromOrderLine.js +6 -3
  15. package/dist/modules/Discount/index.d.ts +0 -1
  16. package/dist/modules/Discount/index.js +11 -40
  17. package/dist/modules/Discount/types.d.ts +0 -1
  18. package/dist/modules/OpenData/index.d.ts +2 -0
  19. package/dist/modules/OpenData/index.js +10 -2
  20. package/dist/modules/Order/index.d.ts +29 -12
  21. package/dist/modules/Order/index.js +750 -509
  22. package/dist/modules/Order/payment-utils.d.ts +26 -0
  23. package/dist/modules/Order/payment-utils.js +225 -0
  24. package/dist/modules/Order/types.d.ts +33 -10
  25. package/dist/modules/Order/utils/orderCollectionIdentity.js +7 -2
  26. package/dist/modules/Order/utils.d.ts +0 -10
  27. package/dist/modules/Order/utils.js +13 -41
  28. package/dist/modules/Payment/index.d.ts +2 -0
  29. package/dist/modules/Payment/index.js +79 -50
  30. package/dist/modules/Payment/types.d.ts +99 -28
  31. package/dist/modules/Payment/types.js +20 -3
  32. package/dist/modules/Payment/walletpass.d.ts +25 -1
  33. package/dist/modules/Payment/walletpass.js +707 -157
  34. package/dist/modules/Product/types.d.ts +0 -1
  35. package/dist/modules/ProductList/index.js +14 -33
  36. package/dist/modules/Quotation/index.d.ts +1 -1
  37. package/dist/modules/Quotation/index.js +2 -2
  38. package/dist/modules/Rules/index.d.ts +1 -0
  39. package/dist/modules/Rules/index.js +89 -96
  40. package/dist/modules/SalesSummary/index.js +13 -12
  41. package/dist/modules/ScanOrderLogger/index.d.ts +0 -2
  42. package/dist/modules/ScanOrderLogger/index.js +2 -15
  43. package/dist/modules/ScanOrderLogger/providers/feishu.js +27 -45
  44. package/dist/modules/ScanOrderLogger/types.d.ts +0 -1
  45. package/dist/modules/Schedule/index.d.ts +1 -3
  46. package/dist/modules/Schedule/index.js +16 -21
  47. package/dist/modules/Summary/utils.js +13 -38
  48. package/dist/modules/index.d.ts +0 -2
  49. package/dist/modules/index.js +1 -3
  50. package/dist/plugins/window.d.ts +0 -1
  51. package/dist/server/index.d.ts +16 -14
  52. package/dist/server/index.js +1925 -1143
  53. package/dist/server/modules/order/index.d.ts +54 -4
  54. package/dist/server/modules/order/index.js +1600 -700
  55. package/dist/server/modules/order/types.d.ts +11 -3
  56. package/dist/server/modules/order/types.js +1 -1
  57. package/dist/solution/BaseSales/index.d.ts +109 -20
  58. package/dist/solution/BaseSales/index.js +1800 -480
  59. package/dist/solution/BaseSales/types.d.ts +52 -0
  60. package/dist/solution/BaseSales/types.js +2 -1
  61. package/dist/solution/BaseSales/utils/cartPromotion.d.ts +3 -1
  62. package/dist/solution/BaseSales/utils/cartPromotion.js +90 -31
  63. package/dist/solution/BaseSales/utils/parseSalesResponse.d.ts +6 -1
  64. package/dist/solution/BookingByStep/index.d.ts +2 -17
  65. package/dist/solution/BookingByStep/index.js +215 -294
  66. package/dist/solution/BookingByStep/types.d.ts +1 -2
  67. package/dist/solution/BookingByStep/types.js +1 -3
  68. package/dist/solution/BookingByStep/utils/capacity.js +1 -17
  69. package/dist/solution/BookingByStep/utils/timeslots.d.ts +1 -3
  70. package/dist/solution/BookingByStep/utils/timeslots.js +12 -19
  71. package/dist/solution/BookingTicket/index.d.ts +7 -3
  72. package/dist/solution/BookingTicket/index.js +132 -49
  73. package/dist/solution/BookingTicket/utils/addProductDecision.js +6 -0
  74. package/dist/solution/BookingTicket/utils/scan/applyGlobalScan.d.ts +8 -0
  75. package/dist/solution/BookingTicket/utils/scan/applyGlobalScan.js +172 -82
  76. package/dist/solution/BookingTicket/utils/weighingProductSku.d.ts +5 -0
  77. package/dist/solution/BookingTicket/utils/weighingProductSku.js +45 -0
  78. package/dist/solution/Sales/index.d.ts +1 -0
  79. package/dist/solution/Sales/index.js +10 -2
  80. package/dist/solution/ScanOrder/index.d.ts +14 -26
  81. package/dist/solution/ScanOrder/index.js +756 -1148
  82. package/dist/solution/ScanOrder/types.d.ts +1 -21
  83. package/dist/solution/ScanOrder/utils.d.ts +0 -8
  84. package/dist/solution/ScanOrder/utils.js +25 -66
  85. package/dist/solution/ShopDiscount/index.d.ts +0 -1
  86. package/dist/solution/ShopDiscount/index.js +87 -125
  87. package/dist/solution/VenueBooking/index.d.ts +11 -39
  88. package/dist/solution/VenueBooking/index.js +860 -1176
  89. package/dist/solution/VenueBooking/types.d.ts +0 -3
  90. package/dist/solution/VenueBooking/utils/resource.js +0 -1
  91. package/dist/solution/VenueBooking/utils/slotMerge.d.ts +4 -4
  92. package/dist/solution/VenueBooking/utils/slotMerge.js +5 -10
  93. package/dist/solution/index.d.ts +0 -1
  94. package/dist/solution/index.js +1 -2
  95. package/dist/types/index.d.ts +1 -1
  96. package/dist/utils/payment-number.d.ts +9 -0
  97. package/dist/utils/payment-number.js +69 -0
  98. package/lib/core/index.d.ts +2 -0
  99. package/lib/core/index.js +4 -0
  100. package/lib/model/strategy/adapter/promotion/adapter.d.ts +4 -0
  101. package/lib/model/strategy/adapter/promotion/adapter.js +20 -0
  102. package/lib/model/strategy/adapter/promotion/evaluator.d.ts +17 -0
  103. package/lib/model/strategy/adapter/promotion/evaluator.js +235 -0
  104. package/lib/model/strategy/adapter/promotion/examples.d.ts +86 -0
  105. package/lib/model/strategy/adapter/promotion/examples.js +91 -0
  106. package/lib/model/strategy/adapter/promotion/index.d.ts +1 -1
  107. package/lib/model/strategy/adapter/promotion/index.js +51 -0
  108. package/lib/model/strategy/adapter/promotion/type.d.ts +90 -2
  109. package/lib/model/strategy/adapter/promotion/type.js +2 -0
  110. package/lib/modules/BookingContext/utils/buildCacheItemFromOrderLine.js +2 -1
  111. package/lib/modules/BookingContext/utils/buildNormalProductCacheItemFromOrderLine.js +2 -1
  112. package/lib/modules/Discount/index.d.ts +0 -1
  113. package/lib/modules/Discount/index.js +0 -9
  114. package/lib/modules/Discount/types.d.ts +0 -1
  115. package/lib/modules/OpenData/index.d.ts +2 -0
  116. package/lib/modules/OpenData/index.js +6 -1
  117. package/lib/modules/Order/index.d.ts +29 -12
  118. package/lib/modules/Order/index.js +196 -86
  119. package/lib/modules/Order/payment-utils.d.ts +26 -0
  120. package/lib/modules/Order/payment-utils.js +224 -0
  121. package/lib/modules/Order/types.d.ts +33 -10
  122. package/lib/modules/Order/utils/orderCollectionIdentity.js +3 -0
  123. package/lib/modules/Order/utils.d.ts +0 -10
  124. package/lib/modules/Order/utils.js +16 -40
  125. package/lib/modules/Payment/index.d.ts +2 -0
  126. package/lib/modules/Payment/index.js +34 -13
  127. package/lib/modules/Payment/types.d.ts +99 -28
  128. package/lib/modules/Payment/types.js +4 -3
  129. package/lib/modules/Payment/walletpass.d.ts +25 -1
  130. package/lib/modules/Payment/walletpass.js +470 -21
  131. package/lib/modules/Product/types.d.ts +0 -1
  132. package/lib/modules/ProductList/index.js +31 -40
  133. package/lib/modules/Quotation/index.d.ts +1 -1
  134. package/lib/modules/Quotation/index.js +2 -2
  135. package/lib/modules/Rules/index.d.ts +1 -0
  136. package/lib/modules/Rules/index.js +47 -40
  137. package/lib/modules/SalesSummary/index.js +7 -6
  138. package/lib/modules/ScanOrderLogger/index.d.ts +0 -2
  139. package/lib/modules/ScanOrderLogger/index.js +1 -13
  140. package/lib/modules/ScanOrderLogger/providers/feishu.js +6 -15
  141. package/lib/modules/ScanOrderLogger/types.d.ts +0 -1
  142. package/lib/modules/Schedule/index.d.ts +1 -3
  143. package/lib/modules/Schedule/index.js +8 -10
  144. package/lib/modules/Summary/utils.js +1 -21
  145. package/lib/modules/index.d.ts +0 -2
  146. package/lib/modules/index.js +1 -5
  147. package/lib/plugins/window.d.ts +0 -1
  148. package/lib/server/index.d.ts +16 -14
  149. package/lib/server/index.js +675 -83
  150. package/lib/server/modules/order/index.d.ts +54 -4
  151. package/lib/server/modules/order/index.js +679 -66
  152. package/lib/server/modules/order/types.d.ts +11 -3
  153. package/lib/solution/BaseSales/index.d.ts +109 -20
  154. package/lib/solution/BaseSales/index.js +883 -70
  155. package/lib/solution/BaseSales/types.d.ts +52 -0
  156. package/lib/solution/BaseSales/types.js +2 -1
  157. package/lib/solution/BaseSales/utils/cartPromotion.d.ts +3 -1
  158. package/lib/solution/BaseSales/utils/cartPromotion.js +63 -12
  159. package/lib/solution/BaseSales/utils/parseSalesResponse.d.ts +6 -1
  160. package/lib/solution/BookingByStep/index.d.ts +2 -17
  161. package/lib/solution/BookingByStep/index.js +18 -60
  162. package/lib/solution/BookingByStep/types.d.ts +1 -2
  163. package/lib/solution/BookingByStep/types.js +0 -5
  164. package/lib/solution/BookingByStep/utils/capacity.js +1 -20
  165. package/lib/solution/BookingByStep/utils/timeslots.d.ts +1 -3
  166. package/lib/solution/BookingByStep/utils/timeslots.js +11 -19
  167. package/lib/solution/BookingTicket/index.d.ts +7 -3
  168. package/lib/solution/BookingTicket/index.js +62 -9
  169. package/lib/solution/BookingTicket/utils/addProductDecision.js +4 -0
  170. package/lib/solution/BookingTicket/utils/scan/applyGlobalScan.d.ts +8 -0
  171. package/lib/solution/BookingTicket/utils/scan/applyGlobalScan.js +36 -4
  172. package/lib/solution/BookingTicket/utils/weighingProductSku.d.ts +5 -0
  173. package/lib/solution/BookingTicket/utils/weighingProductSku.js +63 -0
  174. package/lib/solution/Sales/index.d.ts +1 -0
  175. package/lib/solution/Sales/index.js +5 -3
  176. package/lib/solution/ScanOrder/index.d.ts +14 -26
  177. package/lib/solution/ScanOrder/index.js +190 -449
  178. package/lib/solution/ScanOrder/types.d.ts +1 -21
  179. package/lib/solution/ScanOrder/utils.d.ts +0 -8
  180. package/lib/solution/ScanOrder/utils.js +0 -31
  181. package/lib/solution/ShopDiscount/index.d.ts +0 -1
  182. package/lib/solution/ShopDiscount/index.js +0 -14
  183. package/lib/solution/VenueBooking/index.d.ts +11 -39
  184. package/lib/solution/VenueBooking/index.js +123 -328
  185. package/lib/solution/VenueBooking/types.d.ts +0 -3
  186. package/lib/solution/VenueBooking/utils/resource.js +0 -1
  187. package/lib/solution/VenueBooking/utils/slotMerge.d.ts +4 -4
  188. package/lib/solution/VenueBooking/utils/slotMerge.js +4 -6
  189. package/lib/solution/index.d.ts +0 -1
  190. package/lib/solution/index.js +1 -3
  191. package/lib/types/index.d.ts +1 -1
  192. package/lib/utils/payment-number.d.ts +9 -0
  193. package/lib/utils/payment-number.js +64 -0
  194. package/package.json +1 -1
  195. package/dist/modules/Holder/index.d.ts +0 -48
  196. package/dist/modules/Holder/index.js +0 -640
  197. package/dist/modules/Holder/types.d.ts +0 -123
  198. package/dist/modules/Holder/types.js +0 -1
  199. package/dist/modules/Holder/utils.d.ts +0 -13
  200. package/dist/modules/Holder/utils.js +0 -34
  201. package/dist/modules/ResourcePlanner/index.d.ts +0 -24
  202. package/dist/modules/ResourcePlanner/index.js +0 -181
  203. package/dist/modules/ResourcePlanner/planner.d.ts +0 -14
  204. package/dist/modules/ResourcePlanner/planner.js +0 -1069
  205. package/dist/modules/ResourcePlanner/types.d.ts +0 -227
  206. package/dist/modules/ResourcePlanner/types.js +0 -1
  207. package/dist/solution/UnifiedBookingSales/index.d.ts +0 -183
  208. package/dist/solution/UnifiedBookingSales/index.js +0 -1871
  209. package/dist/solution/UnifiedBookingSales/types.d.ts +0 -143
  210. package/dist/solution/UnifiedBookingSales/types.js +0 -11
  211. package/lib/modules/Holder/index.d.ts +0 -48
  212. package/lib/modules/Holder/index.js +0 -402
  213. package/lib/modules/Holder/types.d.ts +0 -123
  214. package/lib/modules/Holder/types.js +0 -17
  215. package/lib/modules/Holder/utils.d.ts +0 -13
  216. package/lib/modules/Holder/utils.js +0 -71
  217. package/lib/modules/ResourcePlanner/index.d.ts +0 -24
  218. package/lib/modules/ResourcePlanner/index.js +0 -148
  219. package/lib/modules/ResourcePlanner/planner.d.ts +0 -14
  220. package/lib/modules/ResourcePlanner/planner.js +0 -933
  221. package/lib/modules/ResourcePlanner/types.d.ts +0 -227
  222. package/lib/modules/ResourcePlanner/types.js +0 -17
  223. package/lib/solution/UnifiedBookingSales/index.d.ts +0 -183
  224. package/lib/solution/UnifiedBookingSales/index.js +0 -1076
  225. package/lib/solution/UnifiedBookingSales/types.d.ts +0 -143
  226. package/lib/solution/UnifiedBookingSales/types.js +0 -33
@@ -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 _paymentItem$metadata, _newPaymentItem$metad, _newPaymentItem$metad2, _newPaymentItem$metad3, order, expectAmount, paidDepositAmount, expectedDepositAmount, warningMessage, paymentUuid, currentTime, newPaymentItem;
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
- if ((_paymentItem$metadata = paymentItem.metadata) !== null && _paymentItem$metadata !== void 0 && _paymentItem$metadata.unique_payment_number) {
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(_objectSpread({}, paymentItem.metadata), {}, {
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 = 25;
1005
+ _context12.next = 35;
981
1006
  return this.dbManager.update('order', order, true);
982
- case 25:
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 = 35;
1028
+ _context12.next = 45;
1004
1029
  break;
1005
- case 30:
1006
- _context12.prev = 30;
1007
- _context12.t0 = _context12["catch"](1);
1008
- console.error('[PaymentModule] 添加支付项失败', _context12.t0);
1009
- this.logError('addPaymentItemAsync failed', _context12.t0, {
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.t0;
1014
- case 35:
1038
+ throw _context12.t1;
1039
+ case 45:
1015
1040
  case "end":
1016
1041
  return _context12.stop();
1017
1042
  }
1018
- }, _callee12, this, [[1, 30]]);
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 _this5 = this;
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 _this5$normalizeVouch, normalizedVoucherItems, originalCount, normalizedCount, order, existingVoucherItems, _iterator2, _step2, voucherItem, orderAfterDelete, existingActiveVoucherKeys, _iterator3, _step3, _voucherItem, orderPaymentType, key, updatedOrder;
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
- _this5$normalizeVouch = _this5.normalizeVoucherPaymentItems(voucherPaymentItems), normalizedVoucherItems = _this5$normalizeVouch.items, originalCount = _this5$normalizeVouch.originalCount, normalizedCount = _this5$normalizeVouch.normalizedCount;
1148
- _this5.logInfo('Starting updateVoucherPaymentItemsAsync', {
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 _this5.getPaymentOrderByUuidAsync(orderUuid);
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 _this5.deletePaymentAsync(orderUuid, voucherItem.uuid);
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 _this5.getPaymentOrderByUuidAsync(orderUuid);
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 _this5.addPaymentItemAsync(orderUuid, _voucherItem);
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 _this5.getPaymentOrderByUuidAsync(orderUuid);
1318
+ return _this6.getPaymentOrderByUuidAsync(orderUuid);
1294
1319
  case 62:
1295
1320
  updatedOrder = _context14.sent;
1296
1321
  _context14.next = 65;
1297
- return _this5.core.effects.emit("".concat(_this5.name, ":onPaymentAdded"), {
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
- _this5.logInfo('updateVoucherPaymentItemsAsync completed successfully', {
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
- _this5.logError('updateVoucherPaymentItemsAsync failed', _context14.t2, {
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 = 18;
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 = 14;
1406
+ _context16.next = 15;
1379
1407
  return this.dbManager.update('order', order);
1380
- case 14:
1381
- _context16.next = 16;
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 16:
1387
- _context16.next = 18;
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 18:
1394
- _context16.next = 24;
1421
+ case 19:
1422
+ _context16.next = 25;
1395
1423
  break;
1396
- case 20:
1397
- _context16.prev = 20;
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 24:
1429
+ case 25:
1402
1430
  case "end":
1403
1431
  return _context16.stop();
1404
1432
  }
1405
- }, _callee16, this, [[0, 20]]);
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,
@@ -1980,7 +2009,7 @@ export var PaymentModule = /*#__PURE__*/function (_BaseModule) {
1980
2009
  baseValue = amount.div(roundingInterval);
1981
2010
  console.log("[PaymentModule] \u820D\u5165\u8BA1\u7B97 - \u539F\u59CB\u91D1\u989D: ".concat(amount.toString(), ", \u95F4\u9694: ").concat(intervalValue, ", \u57FA\u7840\u503C: ").concat(baseValue.toString(), ", \u89C4\u5219: ").concat(rule));
1982
2011
  _context26.t0 = rule;
1983
- _context26.next = _context26.t0 === RoundingRule.Standard ? 13 : _context26.t0 === 'standard' ? 13 : _context26.t0 === RoundingRule.StandardDown ? 15 : _context26.t0 === 'standard_down' ? 15 : _context26.t0 === RoundingRule.AlwaysUp ? 17 : _context26.t0 === 'always_up' ? 17 : _context26.t0 === RoundingRule.AlwaysDown ? 19 : _context26.t0 === 'always_down' ? 19 : 21;
2012
+ _context26.next = _context26.t0 === RoundingRule.Standard ? 13 : _context26.t0 === 'standard' ? 13 : _context26.t0 === RoundingRule.StandardDown ? 15 : _context26.t0 === 'standard_rounding_midpoint_down' ? 15 : _context26.t0 === RoundingRule.AlwaysUp ? 17 : _context26.t0 === 'always_up' ? 17 : _context26.t0 === RoundingRule.AlwaysDown ? 19 : _context26.t0 === 'always_down' ? 19 : 21;
1984
2013
  break;
1985
2014
  case 13:
1986
2015
  // 标准舍入(中点向上)
@@ -40,11 +40,11 @@ export declare enum RoundingRule {
40
40
  /** 标准舍入(中点向上) */
41
41
  Standard = "standard_rounding",
42
42
  /** 标准舍入(中点向下) */
43
- StandardDown = "standard_down",
43
+ StandardDown = "standard_rounding_midpoint_down",
44
44
  /** 总是向上舍入 */
45
- AlwaysUp = "always_up",
45
+ AlwaysUp = "round_up",
46
46
  /** 总是向下舍入 */
47
- AlwaysDown = "always_down"
47
+ AlwaysDown = "round_down"
48
48
  }
49
49
  /**
50
50
  * 舍入结果
@@ -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;
@@ -338,6 +340,8 @@ export interface CashPayment {
338
340
  processCashPayment: (amount: number, orderUuid: string) => Promise<void>;
339
341
  /** 获取现金余额 */
340
342
  getCashBalance: () => Promise<number>;
343
+ /** 根据币种面额生成现金快捷金额。 */
344
+ getRecommendedAmount: (money: number, currency: string) => number[];
341
345
  }
342
346
  /**
343
347
  * Eftpos支付接口
@@ -363,6 +367,56 @@ export interface WalletStoredInitData {
363
367
  noApplicableVoucher: any[];
364
368
  products: any[];
365
369
  }
370
+ export type WalletAssetId = string | number;
371
+ export type WalletAssetSelectionSource = 'manual' | 'scan';
372
+ export type WalletAssetsStatus = 'idle' | 'loading' | 'ready' | 'error';
373
+ /**
374
+ * 购物车与结账共享的钱包资产状态。
375
+ *
376
+ * 原始券字段完整保留在 items / selectedItems 中,Payment 只补充统一的
377
+ * 可用性、选择和加载状态,不在此层引入 UI ViewModel。
378
+ */
379
+ export interface WalletAssetsState {
380
+ status: WalletAssetsStatus;
381
+ items: any[];
382
+ selectedIds: WalletAssetId[];
383
+ selectedItems: any[];
384
+ committedIds: WalletAssetId[];
385
+ selectionSources: Record<string, WalletAssetSelectionSource>;
386
+ totalSelectedAmount: number;
387
+ customerId?: string | number;
388
+ error: string | null;
389
+ revision: number;
390
+ }
391
+ /**
392
+ * Shared Wallet Assets 的可序列化运行时快照。
393
+ *
394
+ * state 供购物车 / Checkout 直接恢复展示与选择;searchResults 和
395
+ * calculationContext 用于商品变化后继续重验扫码搜索过的 Wallet。
396
+ */
397
+ export interface WalletAssetsSnapshot {
398
+ state: WalletAssetsState;
399
+ searchResults: SearchIdentificationCodeItem[];
400
+ walletParams: WalletDeductionRecommendParams | null;
401
+ calculationContext: {
402
+ orderTotalAmount: number;
403
+ products: any[];
404
+ };
405
+ }
406
+ export interface RefreshWalletAssetsOptions {
407
+ /** 商品/金额变化默认保留并重验选择;客户变化由实现层强制清空。 */
408
+ preserveSelection?: boolean;
409
+ }
410
+ export interface SelectWalletAssetOptions {
411
+ selected: boolean;
412
+ source?: WalletAssetSelectionSource;
413
+ }
414
+ export interface ScanWalletAssetResult {
415
+ type: SearchIdentificationCodeResult['type'];
416
+ asset?: any;
417
+ selected: boolean;
418
+ state: WalletAssetsState;
419
+ }
366
420
  export interface WalletPassPayment {
367
421
  /** 生成钱包API默认参数 */
368
422
  generateWalletParams: (businessData: WalletInitBusinessData) => WalletDeductionRecommendParams;
@@ -414,6 +468,22 @@ export interface WalletPassPayment {
414
468
  processWalletPayment: (amount: number, orderUuid: string, voucherId?: string) => Promise<void>;
415
469
  /** 获取钱包余额 */
416
470
  getWalletBalance: (voucherId: string) => Promise<number>;
471
+ /** 刷新购物车/结账共享的钱包资产,刷新本身不会默认选券。 */
472
+ refreshWalletAssetsFromBusinessAsync: (businessData: WalletInitBusinessData, options?: RefreshWalletAssetsOptions) => Promise<WalletAssetsState>;
473
+ /** 获取共享钱包资产状态快照。 */
474
+ getWalletAssetsState: () => WalletAssetsState;
475
+ /** 导出供 Shared Checkout 跨运行时传递的 Wallet Assets 快照。 */
476
+ exportWalletAssetsSnapshot: () => WalletAssetsSnapshot;
477
+ /** 恢复 Shared Checkout 传回的 Wallet Assets 快照。 */
478
+ importWalletAssetsSnapshot: (snapshot: WalletAssetsSnapshot) => WalletAssetsState;
479
+ /** 设置单张钱包资产的选择状态并重新计算其实际抵扣额。 */
480
+ selectWalletAsset: (assetId: WalletAssetId, options: SelectWalletAssetOptions) => WalletAssetsState;
481
+ /** 精确搜索钱包资产;仅当前券可用时自动选择。 */
482
+ scanWalletAssetAsync: (code: string) => Promise<ScanWalletAssetResult>;
483
+ /** 清空未确认的钱包资产选择。 */
484
+ clearWalletAssetSelection: () => WalletAssetsState;
485
+ /** 同步订单中已经支付、不可撤销的钱包资产。 */
486
+ setCommittedWalletAssets: (committedIds: WalletAssetId[], committedAssets?: any[]) => WalletAssetsState;
417
487
  }
418
488
  /**
419
489
  * 支付模块API接口
@@ -606,7 +676,8 @@ export declare enum WalletPassHooks {
606
676
  OnSearchIdentificationCodeCompleted = "wallet:onSearchIdentificationCodeCompleted",
607
677
  OnWalletInitializationStarted = "wallet:onWalletInitializationStarted",
608
678
  OnWalletInitializationCompleted = "wallet:onWalletInitializationCompleted",
609
- OnWalletInitializationFailed = "wallet:onWalletInitializationFailed"
679
+ OnWalletInitializationFailed = "wallet:onWalletInitializationFailed",
680
+ OnWalletAssetsStateChanged = "wallet:onWalletAssetsStateChanged"
610
681
  }
611
682
  /**
612
683
  * 支付钩子事件(统一接口)
@@ -40,9 +40,9 @@ export var TaskRunStatus = /*#__PURE__*/function (TaskRunStatus) {
40
40
  */
41
41
  export var RoundingRule = /*#__PURE__*/function (RoundingRule) {
42
42
  RoundingRule["Standard"] = "standard_rounding";
43
- RoundingRule["StandardDown"] = "standard_down";
44
- RoundingRule["AlwaysUp"] = "always_up";
45
- RoundingRule["AlwaysDown"] = "always_down";
43
+ RoundingRule["StandardDown"] = "standard_rounding_midpoint_down";
44
+ RoundingRule["AlwaysUp"] = "round_up";
45
+ RoundingRule["AlwaysDown"] = "round_down";
46
46
  return RoundingRule;
47
47
  }({});
48
48
 
@@ -65,6 +65,8 @@ export var RoundingInterval = /*#__PURE__*/function (RoundingInterval) {
65
65
  * 支付方式信息
66
66
  */
67
67
 
68
+ /** 支付项扩展元数据 */
69
+
68
70
  /**
69
71
  * 支付项
70
72
  */
@@ -121,6 +123,20 @@ export var RoundingInterval = /*#__PURE__*/function (RoundingInterval) {
121
123
  * 钱包支付接口
122
124
  */
123
125
 
126
+ /**
127
+ * 购物车与结账共享的钱包资产状态。
128
+ *
129
+ * 原始券字段完整保留在 items / selectedItems 中,Payment 只补充统一的
130
+ * 可用性、选择和加载状态,不在此层引入 UI ViewModel。
131
+ */
132
+
133
+ /**
134
+ * Shared Wallet Assets 的可序列化运行时快照。
135
+ *
136
+ * state 供购物车 / Checkout 直接恢复展示与选择;searchResults 和
137
+ * calculationContext 用于商品变化后继续重验扫码搜索过的 Wallet。
138
+ */
139
+
124
140
  /**
125
141
  * 支付模块API接口
126
142
  */
@@ -182,6 +198,7 @@ export var WalletPassHooks = /*#__PURE__*/function (WalletPassHooks) {
182
198
  WalletPassHooks["OnWalletInitializationStarted"] = "wallet:onWalletInitializationStarted";
183
199
  WalletPassHooks["OnWalletInitializationCompleted"] = "wallet:onWalletInitializationCompleted";
184
200
  WalletPassHooks["OnWalletInitializationFailed"] = "wallet:onWalletInitializationFailed";
201
+ WalletPassHooks["OnWalletAssetsStateChanged"] = "wallet:onWalletAssetsStateChanged";
185
202
  return WalletPassHooks;
186
203
  }({});
187
204
 
@@ -1,4 +1,4 @@
1
- import { WalletPassPayment, WalletDeductionRecommendParams, WalletRecommendItem, UserIdentificationCodeParams, UserIdentificationCodeItem, SearchIdentificationCodeParams, SearchIdentificationCodeItem, SearchIdentificationCodeResult, WalletInitBusinessData } from './types';
1
+ import { WalletPassPayment, WalletDeductionRecommendParams, WalletRecommendItem, UserIdentificationCodeParams, UserIdentificationCodeItem, SearchIdentificationCodeParams, SearchIdentificationCodeItem, SearchIdentificationCodeResult, WalletInitBusinessData, WalletAssetId, WalletAssetsSnapshot, WalletAssetsState, RefreshWalletAssetsOptions, SelectWalletAssetOptions, ScanWalletAssetResult } from './types';
2
2
  import type { PaymentModule } from './index';
3
3
  /**
4
4
  * 钱包支付实现
@@ -10,12 +10,22 @@ export declare class WalletPassPaymentImpl implements WalletPassPayment {
10
10
  private searchResults;
11
11
  private walletParams;
12
12
  private walletInitData;
13
+ private walletAssetsState;
14
+ private walletAssetsRequestSequence;
15
+ private walletAssetsCalculationContext;
13
16
  constructor(paymentModule: PaymentModule);
14
17
  /**
15
18
  * 发送事件的辅助方法
16
19
  * 支持使用WalletPassHooks或PaymentHooks
17
20
  */
18
21
  private emitEvent;
22
+ private publishWalletAssetsState;
23
+ private recalculateWalletAssets;
24
+ /**
25
+ * 使用最新订单参数重验扫码搜索过的支付类 Wallet 资产。
26
+ * 请求失败或暂时无匹配结果时保留旧资产,避免商品变化造成列表闪空。
27
+ */
28
+ private revalidateSearchedWalletAssets;
19
29
  /**
20
30
  * 生成钱包API默认参数
21
31
  * 根据业务数据生成标准的钱包API参数,并存储在模块中
@@ -73,6 +83,20 @@ export declare class WalletPassPaymentImpl implements WalletPassPayment {
73
83
  searchIdentificationCodeAsync(params: SearchIdentificationCodeParams, config?: {
74
84
  noCache?: boolean;
75
85
  }): Promise<SearchIdentificationCodeResult>;
86
+ /**
87
+ * 刷新购物车与结账共享的钱包资产。
88
+ *
89
+ * 与 legacy initializeWalletDataFromBusinessAsync 不同,这里维护选择状态;
90
+ * 推荐结果只作为可用性/金额计算输入,不会自动成为 selectedIds。
91
+ */
92
+ refreshWalletAssetsFromBusinessAsync(businessData: WalletInitBusinessData, options?: RefreshWalletAssetsOptions): Promise<WalletAssetsState>;
93
+ getWalletAssetsState(): WalletAssetsState;
94
+ exportWalletAssetsSnapshot(): WalletAssetsSnapshot;
95
+ importWalletAssetsSnapshot(snapshot: WalletAssetsSnapshot): WalletAssetsState;
96
+ selectWalletAsset(assetId: WalletAssetId, options: SelectWalletAssetOptions): WalletAssetsState;
97
+ scanWalletAssetAsync(code: string): Promise<ScanWalletAssetResult>;
98
+ clearWalletAssetSelection(): WalletAssetsState;
99
+ setCommittedWalletAssets(committedIds: WalletAssetId[], committedAssets?: any[]): WalletAssetsState;
76
100
  processWalletPayment(amount: number, orderUuid: string, voucherId?: string): Promise<void>;
77
101
  getWalletBalance(voucherId: string): Promise<number>;
78
102
  /**