@pisell/pisellos 2.3.123 → 2.3.125

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.
@@ -4882,7 +4882,7 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
4882
4882
  key: "initWalletData",
4883
4883
  value: function () {
4884
4884
  var _initWalletData = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee43(params) {
4885
- var _snapshot$identity;
4885
+ var _this$store$order$mer, _this$store$order15, _snapshot$identity;
4886
4886
  var snapshot, walletBusinessData, result;
4887
4887
  return _regeneratorRuntime().wrap(function _callee43$(_context43) {
4888
4888
  while (1) switch (_context43.prev = _context43.next) {
@@ -4917,7 +4917,11 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
4917
4917
  return this.store.payment.wallet.initializeWalletDataFromBusinessAsync(walletBusinessData);
4918
4918
  case 10:
4919
4919
  result = _context43.sent;
4920
- _context43.next = 13;
4920
+ (_this$store$order$mer = (_this$store$order15 = this.store.order).mergePointCardSnapshotCodes) === null || _this$store$order$mer === void 0 || _this$store$order$mer.call(_this$store$order15, result.userIdentificationCodes, {
4921
+ customerId: walletBusinessData.customer_id,
4922
+ orderIdentity: snapshot === null || snapshot === void 0 ? void 0 : snapshot.identity
4923
+ });
4924
+ _context43.next = 14;
4921
4925
  return this.core.effects.emit("".concat(this.name, ":onWalletDataInitialized"), {
4922
4926
  orderId: snapshot === null || snapshot === void 0 || (_snapshot$identity = snapshot.identity) === null || _snapshot$identity === void 0 ? void 0 : _snapshot$identity.orderId,
4923
4927
  customerId: walletBusinessData.customer_id,
@@ -4928,9 +4932,9 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
4928
4932
  },
4929
4933
  timestamp: Date.now()
4930
4934
  });
4931
- case 13:
4932
- return _context43.abrupt("return", result);
4933
4935
  case 14:
4936
+ return _context43.abrupt("return", result);
4937
+ case 15:
4934
4938
  case "end":
4935
4939
  return _context43.stop();
4936
4940
  }
@@ -4944,8 +4948,8 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
4944
4948
  }, {
4945
4949
  key: "getCommittedWalletAssets",
4946
4950
  value: function getCommittedWalletAssets() {
4947
- var _this$store$order15, _this$store$order15$g;
4948
- var payments = ((_this$store$order15 = this.store.order) === null || _this$store$order15 === void 0 || (_this$store$order15$g = _this$store$order15.getOrderPayments) === null || _this$store$order15$g === void 0 ? void 0 : _this$store$order15$g.call(_this$store$order15)) || [];
4951
+ var _this$store$order16, _this$store$order16$g;
4952
+ var payments = ((_this$store$order16 = this.store.order) === null || _this$store$order16 === void 0 || (_this$store$order16$g = _this$store$order16.getOrderPayments) === null || _this$store$order16$g === void 0 ? void 0 : _this$store$order16$g.call(_this$store$order16)) || [];
4949
4953
  var committed = payments.filter(function (payment) {
4950
4954
  var voucherId = payment === null || payment === void 0 ? void 0 : payment.voucher_id;
4951
4955
  if (voucherId === undefined || voucherId === null || voucherId === 0) {
@@ -5123,6 +5127,7 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
5123
5127
  key: "importWalletAssetsSnapshot",
5124
5128
  value: (function () {
5125
5129
  var _importWalletAssetsSnapshot = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee46(snapshot) {
5130
+ var _this$store$order17, _this$store$order17$m;
5126
5131
  var state;
5127
5132
  return _regeneratorRuntime().wrap(function _callee46$(_context46) {
5128
5133
  while (1) switch (_context46.prev = _context46.next) {
@@ -5134,11 +5139,12 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
5134
5139
  throw new Error('payment 模块未初始化');
5135
5140
  case 2:
5136
5141
  state = this.store.payment.wallet.importWalletAssetsSnapshot(snapshot);
5137
- _context46.next = 5;
5142
+ (_this$store$order17 = this.store.order) === null || _this$store$order17 === void 0 || (_this$store$order17$m = _this$store$order17.mergePointCardSnapshotCodes) === null || _this$store$order17$m === void 0 || _this$store$order17$m.call(_this$store$order17, state.items);
5143
+ _context46.next = 6;
5138
5144
  return this.syncSelectedWalletAssets(state);
5139
- case 5:
5140
- return _context46.abrupt("return", this.publishWalletAssetsState(state));
5141
5145
  case 6:
5146
+ return _context46.abrupt("return", this.publishWalletAssetsState(state));
5147
+ case 7:
5142
5148
  case "end":
5143
5149
  return _context46.stop();
5144
5150
  }
@@ -5157,8 +5163,8 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
5157
5163
  key: "refreshWalletAssets",
5158
5164
  value: (function () {
5159
5165
  var _refreshWalletAssets = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee47(params) {
5160
- var _previousState$custom, _businessData$custome;
5161
- var refreshSequence, wallet, businessData, emptyState, previousState, hasPreviousWalletContext, customerChanged, clearedState, refreshTask, state, committed;
5166
+ var _this$store$order$get6, _previousState$custom, _businessData$custome;
5167
+ var refreshSequence, wallet, businessData, emptyState, pointCardSnapshotMergeContext, previousState, hasPreviousWalletContext, customerChanged, clearedState, refreshTask, state, _this$store$order$mer2, _this$store$order18, _wallet$getUserIdenti, committed;
5162
5168
  return _regeneratorRuntime().wrap(function _callee47$(_context47) {
5163
5169
  while (1) switch (_context47.prev = _context47.next) {
5164
5170
  case 0:
@@ -5188,45 +5194,50 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
5188
5194
  });
5189
5195
  return _context47.abrupt("return", this.publishWalletAssetsState(emptyState));
5190
5196
  case 12:
5197
+ pointCardSnapshotMergeContext = {
5198
+ customerId: businessData.customer_id,
5199
+ orderIdentity: (_this$store$order$get6 = this.store.order.getOrderSnapshot()) === null || _this$store$order$get6 === void 0 ? void 0 : _this$store$order$get6.identity
5200
+ };
5191
5201
  previousState = wallet.getWalletAssetsState();
5192
5202
  hasPreviousWalletContext = previousState.status !== 'idle' || previousState.items.length > 0 || previousState.selectedIds.length > 0 || previousState.customerId !== undefined;
5193
5203
  customerChanged = hasPreviousWalletContext && String((_previousState$custom = previousState.customerId) !== null && _previousState$custom !== void 0 ? _previousState$custom : '') !== String((_businessData$custome = businessData.customer_id) !== null && _businessData$custome !== void 0 ? _businessData$custome : '');
5194
5204
  if (!customerChanged) {
5195
- _context47.next = 20;
5205
+ _context47.next = 21;
5196
5206
  break;
5197
5207
  }
5198
5208
  clearedState = wallet.clearWalletAssetSelection();
5199
5209
  this.updateVoucherOrderPayments([], {
5200
5210
  status: 'payment_pending'
5201
5211
  });
5202
- _context47.next = 20;
5212
+ _context47.next = 21;
5203
5213
  return this.publishWalletAssetsState(clearedState);
5204
- case 20:
5214
+ case 21:
5205
5215
  refreshTask = wallet.refreshWalletAssetsFromBusinessAsync(businessData, {
5206
5216
  preserveSelection: (params === null || params === void 0 ? void 0 : params.preserveSelection) !== false && !customerChanged
5207
5217
  });
5208
- _context47.next = 23;
5218
+ _context47.next = 24;
5209
5219
  return this.publishWalletAssetsState(wallet.getWalletAssetsState());
5210
- case 23:
5211
- _context47.next = 25;
5220
+ case 24:
5221
+ _context47.next = 26;
5212
5222
  return refreshTask;
5213
- case 25:
5223
+ case 26:
5214
5224
  state = _context47.sent;
5215
5225
  if (!(refreshSequence !== this.walletAssetsRefreshSequence)) {
5216
- _context47.next = 28;
5226
+ _context47.next = 29;
5217
5227
  break;
5218
5228
  }
5219
5229
  return _context47.abrupt("return", wallet.getWalletAssetsState());
5220
- case 28:
5230
+ case 29:
5221
5231
  if (state.status !== 'error') {
5222
5232
  committed = this.getCommittedWalletAssets();
5223
5233
  state = wallet.setCommittedWalletAssets(committed.ids, committed.assets);
5234
+ (_this$store$order$mer2 = (_this$store$order18 = this.store.order).mergePointCardSnapshotCodes) === null || _this$store$order$mer2 === void 0 || _this$store$order$mer2.call(_this$store$order18, ((_wallet$getUserIdenti = wallet.getUserIdentificationCodes) === null || _wallet$getUserIdenti === void 0 ? void 0 : _wallet$getUserIdenti.call(wallet)) || [], pointCardSnapshotMergeContext);
5224
5235
  }
5225
- _context47.next = 31;
5236
+ _context47.next = 32;
5226
5237
  return this.syncSelectedWalletAssets(state);
5227
- case 31:
5228
- return _context47.abrupt("return", this.publishWalletAssetsState(state));
5229
5238
  case 32:
5239
+ return _context47.abrupt("return", this.publishWalletAssetsState(state));
5240
+ case 33:
5230
5241
  case "end":
5231
5242
  return _context47.stop();
5232
5243
  }
@@ -5385,11 +5396,11 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
5385
5396
  }, {
5386
5397
  key: "updateOrderCustomer",
5387
5398
  value: function updateOrderCustomer(customer) {
5388
- var _this$store$order$get6, _this$store$order16, _this$store$order$get7, _this$store$order17;
5399
+ var _this$store$order$get7, _this$store$order19, _this$store$order$get8, _this$store$order20;
5389
5400
  if (!this.store.order) throw new Error('order 模块未初始化');
5390
- var previousCustomerId = this.resolveDiscountConfigCustomerId((_this$store$order$get6 = (_this$store$order16 = this.store.order).getTempOrder) === null || _this$store$order$get6 === void 0 ? void 0 : _this$store$order$get6.call(_this$store$order16));
5401
+ var previousCustomerId = this.resolveDiscountConfigCustomerId((_this$store$order$get7 = (_this$store$order19 = this.store.order).getTempOrder) === null || _this$store$order$get7 === void 0 ? void 0 : _this$store$order$get7.call(_this$store$order19));
5391
5402
  var result = this.store.order.updateTempOrderCustomer(customer);
5392
- var nextCustomerId = this.resolveDiscountConfigCustomerId((_this$store$order$get7 = (_this$store$order17 = this.store.order).getTempOrder) === null || _this$store$order$get7 === void 0 ? void 0 : _this$store$order$get7.call(_this$store$order17));
5403
+ var nextCustomerId = this.resolveDiscountConfigCustomerId((_this$store$order$get8 = (_this$store$order20 = this.store.order).getTempOrder) === null || _this$store$order$get8 === void 0 ? void 0 : _this$store$order$get8.call(_this$store$order20));
5393
5404
  if (String(previousCustomerId) !== String(nextCustomerId)) {
5394
5405
  this.discountConfigCacheKey = null;
5395
5406
  this.hasManualDiscountSelection = false;
@@ -5458,8 +5469,8 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
5458
5469
  }, {
5459
5470
  key: "getPendingWalletPaymentAmount",
5460
5471
  value: function getPendingWalletPaymentAmount() {
5461
- var _this$store$order18, _this$store$order18$g;
5462
- var payments = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : ((_this$store$order18 = this.store.order) === null || _this$store$order18 === void 0 || (_this$store$order18$g = _this$store$order18.getOrderPayments) === null || _this$store$order18$g === void 0 ? void 0 : _this$store$order18$g.call(_this$store$order18)) || [];
5472
+ var _this$store$order21, _this$store$order21$g;
5473
+ var payments = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : ((_this$store$order21 = this.store.order) === null || _this$store$order21 === void 0 || (_this$store$order21$g = _this$store$order21.getOrderPayments) === null || _this$store$order21$g === void 0 ? void 0 : _this$store$order21$g.call(_this$store$order21)) || [];
5463
5474
  return payments.reduce(function (total, payment) {
5464
5475
  if ((payment === null || payment === void 0 ? void 0 : payment.status) !== 'payment_pending' || (payment === null || payment === void 0 ? void 0 : payment.voucher_id) === undefined || Number(payment.voucher_id) === 0) {
5465
5476
  return total;
@@ -5477,7 +5488,7 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
5477
5488
  key: "getCashPaymentConfig",
5478
5489
  value: (function () {
5479
5490
  var _getCashPaymentConfig = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee53() {
5480
- var _this$store$order19, _this$store$order19$g, _this$store$order20, _this$store$order20$g, _this$otherParams34;
5491
+ var _this$store$order22, _this$store$order22$g, _this$store$order23, _this$store$order23$g, _this$otherParams34;
5481
5492
  var paymentMethods, paymentMethod, amountSnapshot, pendingWalletAmount, amountDue, currency, recommendedAmounts;
5482
5493
  return _regeneratorRuntime().wrap(function _callee53$(_context53) {
5483
5494
  while (1) switch (_context53.prev = _context53.next) {
@@ -5500,10 +5511,10 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
5500
5511
  paymentMethods = _context53.sent;
5501
5512
  paymentMethod = this.findCashPaymentMethod(paymentMethods);
5502
5513
  case 9:
5503
- amountSnapshot = (_this$store$order19 = this.store.order) === null || _this$store$order19 === void 0 || (_this$store$order19$g = _this$store$order19.getOrderAmountSnapshot) === null || _this$store$order19$g === void 0 ? void 0 : _this$store$order19$g.call(_this$store$order19);
5514
+ amountSnapshot = (_this$store$order22 = this.store.order) === null || _this$store$order22 === void 0 || (_this$store$order22$g = _this$store$order22.getOrderAmountSnapshot) === null || _this$store$order22$g === void 0 ? void 0 : _this$store$order22$g.call(_this$store$order22);
5504
5515
  pendingWalletAmount = this.getPendingWalletPaymentAmount();
5505
5516
  amountDue = Decimal.max(new Decimal((amountSnapshot === null || amountSnapshot === void 0 ? void 0 : amountSnapshot.amountGap) || 0).minus(pendingWalletAmount), 0).toDecimalPlaces(2).toNumber();
5506
- currency = ((_this$store$order20 = this.store.order) === null || _this$store$order20 === void 0 || (_this$store$order20$g = _this$store$order20.getTempOrder) === null || _this$store$order20$g === void 0 || (_this$store$order20$g = _this$store$order20$g.call(_this$store$order20)) === null || _this$store$order20$g === void 0 ? void 0 : _this$store$order20$g.currency_code) || ((_this$otherParams34 = this.otherParams) === null || _this$otherParams34 === void 0 ? void 0 : _this$otherParams34.currency) || 'USD';
5517
+ currency = ((_this$store$order23 = this.store.order) === null || _this$store$order23 === void 0 || (_this$store$order23$g = _this$store$order23.getTempOrder) === null || _this$store$order23$g === void 0 || (_this$store$order23$g = _this$store$order23$g.call(_this$store$order23)) === null || _this$store$order23$g === void 0 ? void 0 : _this$store$order23$g.currency_code) || ((_this$otherParams34 = this.otherParams) === null || _this$otherParams34 === void 0 ? void 0 : _this$otherParams34.currency) || 'USD';
5507
5518
  recommendedAmounts = amountDue > 0 ? this.store.payment.cash.getRecommendedAmount(amountDue, currency) : [];
5508
5519
  return _context53.abrupt("return", {
5509
5520
  available: Boolean(paymentMethod && amountDue > 0),
@@ -5533,8 +5544,8 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
5533
5544
  key: "confirmWalletPayment",
5534
5545
  value: (function () {
5535
5546
  var _confirmWalletPayment = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee54() {
5536
- var _this$store$order$get8, _this$store$order21, _this$store$order$get10, _this$store$order$get11, _this$store$order23;
5537
- var beforePayments, pendingWalletAmount, amountSnapshot, _this$store$order$get9, _this$store$order22, _submitResult, _latestAmountSnapshot, effectiveAmountDue, beforePaymentStatus, submitResult, restoredTempOrder, committed, walletState, latestAmountSnapshot;
5547
+ var _this$store$order$get9, _this$store$order24, _this$store$order$get11, _this$store$order$get12, _this$store$order26;
5548
+ var beforePayments, pendingWalletAmount, amountSnapshot, _this$store$order$get10, _this$store$order25, _submitResult, _latestAmountSnapshot, effectiveAmountDue, beforePaymentStatus, submitResult, restoredTempOrder, committed, walletState, latestAmountSnapshot;
5538
5549
  return _regeneratorRuntime().wrap(function _callee54$(_context54) {
5539
5550
  while (1) switch (_context54.prev = _context54.next) {
5540
5551
  case 0:
@@ -5546,7 +5557,7 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
5546
5557
  case 2:
5547
5558
  beforePayments = cloneDeep(this.store.order.getOrderPayments());
5548
5559
  pendingWalletAmount = this.getPendingWalletPaymentAmount(beforePayments);
5549
- amountSnapshot = (_this$store$order$get8 = (_this$store$order21 = this.store.order).getOrderAmountSnapshot) === null || _this$store$order$get8 === void 0 ? void 0 : _this$store$order$get8.call(_this$store$order21);
5560
+ amountSnapshot = (_this$store$order$get9 = (_this$store$order24 = this.store.order).getOrderAmountSnapshot) === null || _this$store$order$get9 === void 0 ? void 0 : _this$store$order$get9.call(_this$store$order24);
5550
5561
  if (!pendingWalletAmount.lte(0)) {
5551
5562
  _context54.next = 14;
5552
5563
  break;
@@ -5566,7 +5577,7 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
5566
5577
  }
5567
5578
  throw new Error(getSalesSubmitErrorMessage(_submitResult, '订单提交失败'));
5568
5579
  case 12:
5569
- _latestAmountSnapshot = (_this$store$order$get9 = (_this$store$order22 = this.store.order).getOrderAmountSnapshot) === null || _this$store$order$get9 === void 0 ? void 0 : _this$store$order$get9.call(_this$store$order22);
5580
+ _latestAmountSnapshot = (_this$store$order$get10 = (_this$store$order25 = this.store.order).getOrderAmountSnapshot) === null || _this$store$order$get10 === void 0 ? void 0 : _this$store$order$get10.call(_this$store$order25);
5570
5581
  return _context54.abrupt("return", {
5571
5582
  submitResult: _submitResult,
5572
5583
  payments: this.store.order.getOrderPayments(),
@@ -5580,7 +5591,7 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
5580
5591
  }
5581
5592
  throw new Error('Wallet 支付尚未覆盖全部待支付金额');
5582
5593
  case 17:
5583
- beforePaymentStatus = (_this$store$order$get10 = this.store.order.getTempOrder()) === null || _this$store$order$get10 === void 0 ? void 0 : _this$store$order$get10.payment_status;
5594
+ beforePaymentStatus = (_this$store$order$get11 = this.store.order.getTempOrder()) === null || _this$store$order$get11 === void 0 ? void 0 : _this$store$order$get11.payment_status;
5584
5595
  _context54.prev = 18;
5585
5596
  _context54.next = 21;
5586
5597
  return this.submitSalesOrder({
@@ -5632,7 +5643,7 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
5632
5643
  error: _context54.t1 instanceof Error ? _context54.t1.message : String(_context54.t1)
5633
5644
  });
5634
5645
  case 45:
5635
- latestAmountSnapshot = (_this$store$order$get11 = (_this$store$order23 = this.store.order).getOrderAmountSnapshot) === null || _this$store$order$get11 === void 0 ? void 0 : _this$store$order$get11.call(_this$store$order23);
5646
+ latestAmountSnapshot = (_this$store$order$get12 = (_this$store$order26 = this.store.order).getOrderAmountSnapshot) === null || _this$store$order$get12 === void 0 ? void 0 : _this$store$order$get12.call(_this$store$order26);
5636
5647
  return _context54.abrupt("return", {
5637
5648
  submitResult: submitResult,
5638
5649
  payments: this.store.order.getOrderPayments(),
@@ -5658,7 +5669,7 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
5658
5669
  key: "payCash",
5659
5670
  value: (function () {
5660
5671
  var _payCash = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee55(params) {
5661
- var _this$store$order$get12, _params$actualPaidAmo, _this$otherParams35, _this$window, _this$window$postMess;
5672
+ var _this$store$order$get13, _params$actualPaidAmo, _this$otherParams35, _this$window, _this$window$postMess;
5662
5673
  var amount, config, paymentMethod, roundingAmount, effectivePaymentAmount, beforePayments, beforePaymentStatus, uniquePaymentNumber, paymentTimestamp, actualPaidAmount, changeAmount, shopWalletPassId, payments, payment, syncResult, committed, walletState, restoredTempOrder;
5663
5674
  return _regeneratorRuntime().wrap(function _callee55$(_context55) {
5664
5675
  while (1) switch (_context55.prev = _context55.next) {
@@ -5702,7 +5713,7 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
5702
5713
  throw new Error('现金支付金额超过当前待支付金额');
5703
5714
  case 17:
5704
5715
  beforePayments = cloneDeep(this.store.order.getOrderPayments());
5705
- beforePaymentStatus = (_this$store$order$get12 = this.store.order.getTempOrder()) === null || _this$store$order$get12 === void 0 ? void 0 : _this$store$order$get12.payment_status;
5716
+ beforePaymentStatus = (_this$store$order$get13 = this.store.order.getTempOrder()) === null || _this$store$order$get13 === void 0 ? void 0 : _this$store$order$get13.payment_status;
5706
5717
  uniquePaymentNumber = createUuidV4();
5707
5718
  paymentTimestamp = dayjs().format('YYYY-MM-DD HH:mm:ss');
5708
5719
  actualPaidAmount = Number((_params$actualPaidAmo = params.actualPaidAmount) !== null && _params$actualPaidAmo !== void 0 ? _params$actualPaidAmo : amount);
@@ -5813,7 +5824,7 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
5813
5824
  key: "commitPaymentMethodPayment",
5814
5825
  value: (function () {
5815
5826
  var _commitPaymentMethodPayment = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee56(params) {
5816
- var _this$store$order$get13, _this$store$order24, _this$store$order$get14, _params$metadata, _params$originAmount;
5827
+ var _this$store$order$get14, _this$store$order27, _this$store$order$get15, _params$metadata, _params$originAmount;
5817
5828
  var amount, paymentMethods, findPaymentMethod, paymentMethod, amountSnapshot, pendingWalletAmount, amountDue, beforePayments, beforePaymentStatus, paymentTimestamp, metadata, serviceCharge, serviceFee, payments, payment, syncResult, committed, walletState, restoredTempOrder;
5818
5829
  return _regeneratorRuntime().wrap(function _callee56$(_context56) {
5819
5830
  while (1) switch (_context56.prev = _context56.next) {
@@ -5857,7 +5868,7 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
5857
5868
  }
5858
5869
  throw new Error("\u672A\u627E\u5230\u53EF\u7528\u7684\u652F\u4ED8\u65B9\u5F0F\uFF1A".concat(params.paymentMethodCode || params.paymentMethodId || ''));
5859
5870
  case 15:
5860
- amountSnapshot = (_this$store$order$get13 = (_this$store$order24 = this.store.order).getOrderAmountSnapshot) === null || _this$store$order$get13 === void 0 ? void 0 : _this$store$order$get13.call(_this$store$order24);
5871
+ amountSnapshot = (_this$store$order$get14 = (_this$store$order27 = this.store.order).getOrderAmountSnapshot) === null || _this$store$order$get14 === void 0 ? void 0 : _this$store$order$get14.call(_this$store$order27);
5861
5872
  pendingWalletAmount = this.getPendingWalletPaymentAmount();
5862
5873
  amountDue = Decimal.max(new Decimal((amountSnapshot === null || amountSnapshot === void 0 ? void 0 : amountSnapshot.amountGap) || 0).minus(pendingWalletAmount), 0);
5863
5874
  if (!amountDue.lte(0)) {
@@ -5873,7 +5884,7 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
5873
5884
  throw new Error('支付金额超过当前待支付金额');
5874
5885
  case 22:
5875
5886
  beforePayments = cloneDeep(this.store.order.getOrderPayments());
5876
- beforePaymentStatus = (_this$store$order$get14 = this.store.order.getTempOrder()) === null || _this$store$order$get14 === void 0 ? void 0 : _this$store$order$get14.payment_status;
5887
+ beforePaymentStatus = (_this$store$order$get15 = this.store.order.getTempOrder()) === null || _this$store$order$get15 === void 0 ? void 0 : _this$store$order$get15.payment_status;
5877
5888
  paymentTimestamp = dayjs().format('YYYY-MM-DD HH:mm:ss');
5878
5889
  metadata = _objectSpread(_objectSpread({}, params.metadata || {}), {}, {
5879
5890
  unique_payment_number: ((_params$metadata = params.metadata) === null || _params$metadata === void 0 ? void 0 : _params$metadata.unique_payment_number) || createUuidV4()
@@ -6658,16 +6669,16 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
6658
6669
  }, {
6659
6670
  key: "getUnfulfilledPromotions",
6660
6671
  value: function getUnfulfilledPromotions() {
6661
- var _this$store$order25;
6662
- return ((_this$store$order25 = this.store.order) === null || _this$store$order25 === void 0 ? void 0 : _this$store$order25.getUnfulfilledPromotions()) || [];
6672
+ var _this$store$order28;
6673
+ return ((_this$store$order28 = this.store.order) === null || _this$store$order28 === void 0 ? void 0 : _this$store$order28.getUnfulfilledPromotions()) || [];
6663
6674
  }
6664
6675
 
6665
6676
  /** 最近一次促销计算输出的赠品操作 diff。 */
6666
6677
  }, {
6667
6678
  key: "getLastGiftActions",
6668
6679
  value: function getLastGiftActions() {
6669
- var _this$store$order26;
6670
- return ((_this$store$order26 = this.store.order) === null || _this$store$order26 === void 0 ? void 0 : _this$store$order26.getLastGiftActions()) || null;
6680
+ var _this$store$order29;
6681
+ return ((_this$store$order29 = this.store.order) === null || _this$store$order29 === void 0 ? void 0 : _this$store$order29.getLastGiftActions()) || null;
6671
6682
  }
6672
6683
 
6673
6684
  // 获取商品列表
@@ -326,7 +326,7 @@ export declare class BookingByStepImpl extends BaseModule implements Module {
326
326
  date: string;
327
327
  status: string;
328
328
  week: string;
329
- weekNum: 0 | 1 | 2 | 5 | 4 | 3 | 6;
329
+ weekNum: 0 | 1 | 5 | 2 | 4 | 3 | 6;
330
330
  }[]>;
331
331
  submitTimeSlot(timeSlots: TimeSliceItem): void;
332
332
  private getScheduleDataByIds;
@@ -1,46 +1 @@
1
- "use strict";
2
-
3
- Object.defineProperty(exports, "__esModule", {
4
- value: true
5
- });
6
- Object.defineProperty(exports, "BUY_X_GET_Y_FREE_STRATEGY", {
7
- enumerable: true,
8
- get: function () {
9
- return _examples.BUY_X_GET_Y_FREE_STRATEGY;
10
- }
11
- });
12
- Object.defineProperty(exports, "ITEM_REWARD_STRATEGY", {
13
- enumerable: true,
14
- get: function () {
15
- return _examples.ITEM_REWARD_STRATEGY;
16
- }
17
- });
18
- Object.defineProperty(exports, "PromotionAdapter", {
19
- enumerable: true,
20
- get: function () {
21
- return _adapter.PromotionAdapter;
22
- }
23
- });
24
- Object.defineProperty(exports, "PromotionEvaluator", {
25
- enumerable: true,
26
- get: function () {
27
- return _evaluator.PromotionEvaluator;
28
- }
29
- });
30
- Object.defineProperty(exports, "X_ITEMS_FOR_Y_PRICE_STRATEGY", {
31
- enumerable: true,
32
- get: function () {
33
- return _examples.X_ITEMS_FOR_Y_PRICE_STRATEGY;
34
- }
35
- });
36
- Object.defineProperty(exports, "default", {
37
- enumerable: true,
38
- get: function () {
39
- return _adapter.default;
40
- }
41
- });
42
- var _evaluator = require("./evaluator");
43
- var _adapter = _interopRequireWildcard(require("./adapter"));
44
- var _examples = require("./examples");
45
- function _getRequireWildcardCache(e) { if ("function" != typeof WeakMap) return null; var r = new WeakMap(), t = new WeakMap(); return (_getRequireWildcardCache = function (e) { return e ? t : r; })(e); }
46
- function _interopRequireWildcard(e, r) { if (!r && e && e.__esModule) return e; if (null === e || "object" != typeof e && "function" != typeof e) return { default: e }; var t = _getRequireWildcardCache(r); if (t && t.has(e)) return t.get(e); var n = { __proto__: null }, a = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var u in e) if ("default" !== u && Object.prototype.hasOwnProperty.call(e, u)) { var i = a ? Object.getOwnPropertyDescriptor(e, u) : null; i && (i.get || i.set) ? Object.defineProperty(n, u, i) : n[u] = e[u]; } return n.default = e, t && t.set(e, n), n; }
1
+ "use strict";
@@ -3,7 +3,7 @@ import { BaseModule } from '../BaseModule';
3
3
  import { OrderModuleAPI, CommitOrderParams, UpdateOrderBookingParams, UpdateOrderProductParams, UpdateOrderProductQuantityParams, CancelOrderParams, ChangeBookingStatusParams, CheckoutOrderParams } from './types';
4
4
  import { CartItem } from '../Cart/types';
5
5
  import { type SubmitPayloadEnhancer } from './utils';
6
- import type { OrderAmountSnapshot, AddProductBookingInput, AddProductToOrderOptions, OrderIdentitySnapshot, OrderPaymentSource, OrderSnapshot, OrderSyncState, SyncPaymentsToOrderParams, SyncPaymentsToOrderResult, SubmitSalesOrderParams, OrderProduct, OrderProductIdentity, OrderSummary, OrderTempOrder, OrderPaymentData, OrderPaymentUpdateOptions, OrderPaymentUpdateResult, SendCustomerPayLinkParams, UpdateTempOrderCustomerInput, OrderCustomerPatch, OrderCustomerView, ReplaceTempOrderOptions, OrderPromotionEvaluator, OrderGiftSelectResolver, OrderUnfulfilledPromotion, OrderLastGiftActions, RemoveProductsFromOrderOptions, SalesNote, SalesNotesMutationSnapshot, SetSalesNoteInput, PickupReferenceMode, ShopServiceData, ShopServiceType } from './types';
6
+ import type { OrderAmountSnapshot, AddProductBookingInput, AddProductToOrderOptions, OrderIdentitySnapshot, OrderPaymentSource, OrderSnapshot, OrderSyncState, SyncPaymentsToOrderParams, SyncPaymentsToOrderResult, SubmitSalesOrderParams, OrderProduct, OrderProductIdentity, OrderSummary, OrderTempOrder, OrderPaymentData, OrderPaymentUpdateOptions, OrderPaymentUpdateResult, SendCustomerPayLinkParams, UpdateTempOrderCustomerInput, OrderCustomerPatch, OrderCustomerView, ReplaceTempOrderOptions, OrderPromotionEvaluator, OrderGiftSelectResolver, OrderUnfulfilledPromotion, OrderLastGiftActions, RemoveProductsFromOrderOptions, SalesNote, SalesNotesMutationSnapshot, SetSalesNoteInput, PickupReferenceMode, PointCardSnapshotMergeContext, PointCardSnapshotItem, ShopServiceData, ShopServiceType } from './types';
7
7
  import type { ICustomer } from '../AccountList/types';
8
8
  import type { Discount } from '../Discount/types';
9
9
  import { UnavailableReason } from '../Rules/types';
@@ -22,6 +22,8 @@ export declare class OrderModule extends BaseModule implements Module, OrderModu
22
22
  private sessionStorageRestoreRecord;
23
23
  /** 只允许当前订单最新的 prepare/config 请求回写客户资产态。 */
24
24
  private customerWalletPrepareConfigEpoch;
25
+ /** Payment 可能早于 prepare/config 返回;先按实例 ID 暂存卡号等待 Snapshot。 */
26
+ private pointCardSnapshotCodeCandidates;
25
27
  private salesSummaryModuleName;
26
28
  private rulesHooksOverride?;
27
29
  private moduleHooksOverride?;
@@ -187,7 +189,16 @@ export declare class OrderModule extends BaseModule implements Module, OrderModu
187
189
  private clearTempOrderCustomerWalletSnapshots;
188
190
  private clearCustomerWalletState;
189
191
  private clearCustomerWalletRuntimeState;
192
+ private rememberPointCardSnapshotCodeCandidates;
193
+ private getRememberedPointCardSnapshotCodeCandidates;
194
+ private getPointCardSnapshotOrderIdentityKey;
195
+ private isPointCardSnapshotMergeContextCurrent;
190
196
  private writeCustomerWalletSnapshotsFromPrepareConfig;
197
+ /**
198
+ * 将 Payment WalletPass 返回的实例 code 回填到当前订单 Snapshot。
199
+ * 这里只按资产 ID 补空值,不新增卡、不覆盖 prepare/config 冻结的余额。
200
+ */
201
+ mergePointCardSnapshotCodes(walletPassList: unknown, context?: PointCardSnapshotMergeContext): PointCardSnapshotItem[];
191
202
  private createExternalSaleNumber;
192
203
  private ensureExternalSaleNumber;
193
204
  private ensureRequestUniqueIdempotencyToken;
@@ -88,6 +88,8 @@ class OrderModule extends _BaseModule.BaseModule {
88
88
  sessionStorageRestoreRecord = null;
89
89
  /** 只允许当前订单最新的 prepare/config 请求回写客户资产态。 */
90
90
  customerWalletPrepareConfigEpoch = 0;
91
+ /** Payment 可能早于 prepare/config 返回;先按实例 ID 暂存卡号等待 Snapshot。 */
92
+ pointCardSnapshotCodeCandidates = new Map();
91
93
  salesSummaryModuleName;
92
94
  rulesHooksOverride;
93
95
  moduleHooksOverride;
@@ -1041,17 +1043,55 @@ class OrderModule extends _BaseModule.BaseModule {
1041
1043
  }
1042
1044
  clearCustomerWalletRuntimeState() {
1043
1045
  this.customerWalletPrepareConfigEpoch += 1;
1046
+ this.pointCardSnapshotCodeCandidates.clear();
1044
1047
  this.store.availableWalletIds = [];
1045
1048
  this.store.virtualCurrencyList = [];
1046
1049
  }
1050
+ rememberPointCardSnapshotCodeCandidates(value) {
1051
+ (0, _utils.collectPointCardSnapshotCodeCandidates)(value).forEach(({
1052
+ id,
1053
+ code
1054
+ }) => {
1055
+ if (!this.pointCardSnapshotCodeCandidates.has(id)) {
1056
+ this.pointCardSnapshotCodeCandidates.set(id, code);
1057
+ }
1058
+ });
1059
+ }
1060
+ getRememberedPointCardSnapshotCodeCandidates() {
1061
+ return [...this.pointCardSnapshotCodeCandidates].map(([id, code]) => ({
1062
+ id,
1063
+ code
1064
+ }));
1065
+ }
1066
+ getPointCardSnapshotOrderIdentityKey(identity) {
1067
+ if (identity?.externalSaleNumber) {
1068
+ return `external:${identity.externalSaleNumber}`;
1069
+ }
1070
+ if (identity?.orderId !== undefined && identity.orderId !== null) {
1071
+ return `order:${identity.orderId}`;
1072
+ }
1073
+ if (identity?.localId) return `local:${identity.localId}`;
1074
+ if (identity?.orderNumber) return `number:${identity.orderNumber}`;
1075
+ return '';
1076
+ }
1077
+ isPointCardSnapshotMergeContextCurrent(context) {
1078
+ if (!context) return true;
1079
+ if (context.customerId !== undefined && String(context.customerId ?? '') !== String(this.store.tempOrder?.customer_id ?? '')) {
1080
+ return false;
1081
+ }
1082
+ const expectedOrderKey = this.getPointCardSnapshotOrderIdentityKey(context.orderIdentity);
1083
+ return !expectedOrderKey || expectedOrderKey === this.getPointCardSnapshotOrderIdentityKey(this.getOrderIdentity());
1084
+ }
1047
1085
  writeCustomerWalletSnapshotsFromPrepareConfig(params) {
1048
1086
  const tempOrder = this.store.tempOrder;
1049
1087
  if (!tempOrder) return;
1050
1088
  if (String(tempOrder.customer_id ?? '') !== String(params.customerId)) return;
1089
+ const currentOrderMetaList = (0, _utils.normalizeOrderMetaList)(tempOrder.order_meta_list);
1051
1090
  const virtualCurrencyList = Array.isArray(params.virtualCurrencyList) ? params.virtualCurrencyList : [];
1091
+ const snapshotsWithExistingCodes = (0, _utils.mergePointCardSnapshotCodes)(params.availableWalletPassList, currentOrderMetaList?.point_cards_snapshot);
1052
1092
  tempOrder.order_meta_list = {
1053
- ...((0, _utils.normalizeOrderMetaList)(tempOrder.order_meta_list) || {}),
1054
- point_cards_snapshot: (0, _utils.buildPointCardSnapshotFromWalletPassList)(params.availableWalletPassList),
1093
+ ...(currentOrderMetaList || {}),
1094
+ point_cards_snapshot: (0, _utils.mergePointCardSnapshotCodes)(snapshotsWithExistingCodes, this.getRememberedPointCardSnapshotCodeCandidates()),
1055
1095
  virtual_currency_snapshot: (0, _utils.buildVirtualCurrencySnapshotFromList)(virtualCurrencyList)
1056
1096
  };
1057
1097
  this.store.availableWalletIds = [...params.availableWalletIds];
@@ -1059,6 +1099,31 @@ class OrderModule extends _BaseModule.BaseModule {
1059
1099
  this.persistTempOrder();
1060
1100
  this.saveDraftInBackground();
1061
1101
  }
1102
+
1103
+ /**
1104
+ * 将 Payment WalletPass 返回的实例 code 回填到当前订单 Snapshot。
1105
+ * 这里只按资产 ID 补空值,不新增卡、不覆盖 prepare/config 冻结的余额。
1106
+ */
1107
+ mergePointCardSnapshotCodes(walletPassList, context) {
1108
+ const tempOrder = this.store.tempOrder;
1109
+ const currentOrderMetaList = (0, _utils.normalizeOrderMetaList)(tempOrder?.order_meta_list);
1110
+ const currentSnapshots = currentOrderMetaList?.point_cards_snapshot || [];
1111
+ if (!tempOrder || !this.isPointCardSnapshotMergeContextCurrent(context)) {
1112
+ return currentSnapshots;
1113
+ }
1114
+ this.rememberPointCardSnapshotCodeCandidates(walletPassList);
1115
+ if (!currentSnapshots.length) return currentSnapshots;
1116
+ const nextSnapshots = (0, _utils.mergePointCardSnapshotCodes)(currentSnapshots, this.getRememberedPointCardSnapshotCodeCandidates());
1117
+ const hasChanged = nextSnapshots.some((snapshot, index) => snapshot.code !== currentSnapshots[index]?.code);
1118
+ if (!hasChanged) return currentSnapshots;
1119
+ tempOrder.order_meta_list = {
1120
+ ...(currentOrderMetaList || {}),
1121
+ point_cards_snapshot: nextSnapshots
1122
+ };
1123
+ this.persistTempOrder();
1124
+ this.saveDraftInBackground();
1125
+ return nextSnapshots;
1126
+ }
1062
1127
  createExternalSaleNumber() {
1063
1128
  const timestamp = (0, _dayjs.default)().format('YYYYMMDDHHmmssSSS');
1064
1129
  const random6 = String(Math.floor(Math.random() * 1000000)).padStart(6, '0');
@@ -204,6 +204,10 @@ export interface PointCardSnapshotItem {
204
204
  par_value: string;
205
205
  used_par_value: string;
206
206
  }
207
+ export interface PointCardSnapshotMergeContext {
208
+ customerId?: number | string | null;
209
+ orderIdentity?: OrderIdentitySnapshot | null;
210
+ }
207
211
  export interface VirtualCurrencySnapshotItem {
208
212
  id: number | string;
209
213
  tag: 'virtual_currency';
@@ -976,6 +980,7 @@ export interface OrderModuleAPI {
976
980
  getDiscountList: () => Discount[];
977
981
  getAvailableWalletIds: () => number[];
978
982
  getCustomerWalletPrepareConfigEpoch: () => number;
983
+ mergePointCardSnapshotCodes: (walletPassList: unknown, context?: PointCardSnapshotMergeContext) => PointCardSnapshotItem[];
979
984
  applyDiscount: () => void;
980
985
  /**
981
986
  * 注入促销评估器。
@@ -18,6 +18,16 @@ export interface OrderProductsDepositSummary {
18
18
  import type { WindowPlugin } from '../../plugins';
19
19
  export declare function normalizePointCardSnapshotItem(value: unknown): PointCardSnapshotItem | null;
20
20
  export declare function buildPointCardSnapshotFromWalletPassList(value: unknown): PointCardSnapshotItem[];
21
+ export declare function collectPointCardSnapshotCodeCandidates(value: unknown): Array<{
22
+ id: string;
23
+ code: string;
24
+ }>;
25
+ /**
26
+ * Payment 的 WalletPass 列表包含实例 code,而 prepare/config 通常只提供
27
+ * 卡名称和余额。按实例 ID 仅补齐 Snapshot 缺失的 code,避免后到的运行态
28
+ * 数据覆盖下单时已经冻结的卡名称和余额。
29
+ */
30
+ export declare function mergePointCardSnapshotCodes(snapshotsValue: unknown, walletPassesValue: unknown): PointCardSnapshotItem[];
21
31
  export declare function normalizeVirtualCurrencySnapshotItem(value: unknown): VirtualCurrencySnapshotItem | null;
22
32
  export declare function buildVirtualCurrencySnapshotFromList(value: unknown): VirtualCurrencySnapshotItem[];
23
33
  export declare function normalizeOrderMetaList(value: unknown): OrderMetaList | undefined;
@@ -14,6 +14,7 @@ exports.buildSubmitPayload = buildSubmitPayload;
14
14
  exports.buildVirtualCurrencySnapshotFromList = buildVirtualCurrencySnapshotFromList;
15
15
  exports.calculateOrderProductsDeposit = calculateOrderProductsDeposit;
16
16
  exports.clearTempOrderHolderAssignments = clearTempOrderHolderAssignments;
17
+ exports.collectPointCardSnapshotCodeCandidates = collectPointCardSnapshotCodeCandidates;
17
18
  exports.composeLinePrice = composeLinePrice;
18
19
  exports.createDefaultOrderRulesHooks = createDefaultOrderRulesHooks;
19
20
  exports.createDefaultTempOrder = createDefaultTempOrder;
@@ -66,6 +67,7 @@ Object.defineProperty(exports, "mergeManualProductDiscountIntoList", {
66
67
  }
67
68
  });
68
69
  exports.mergeOrderProductDisplayFields = mergeOrderProductDisplayFields;
70
+ exports.mergePointCardSnapshotCodes = mergePointCardSnapshotCodes;
69
71
  exports.mergeRelationForms = void 0;
70
72
  exports.normalizeBookingIsAll = normalizeBookingIsAll;
71
73
  exports.normalizeBookingSubType = normalizeBookingSubType;
@@ -177,6 +179,46 @@ function buildPointCardSnapshotFromWalletPassList(value) {
177
179
  return result;
178
180
  }, []);
179
181
  }
182
+ function collectPointCardSnapshotCodeCandidates(value) {
183
+ if (!Array.isArray(value)) return [];
184
+ const codeById = new Map();
185
+ value.forEach(item => {
186
+ if (!isPlainObject(item)) return;
187
+ const id = normalizeSnapshotScalar(item.id ?? item.voucher_id);
188
+ const code = normalizeSnapshotScalar(item.code);
189
+ if (id === undefined || code === undefined) return;
190
+ const identity = String(id).trim();
191
+ const normalizedCode = String(code).trim();
192
+ if (!identity || !normalizedCode || codeById.has(identity)) return;
193
+ codeById.set(identity, normalizedCode);
194
+ });
195
+ return [...codeById].map(([id, code]) => ({
196
+ id,
197
+ code
198
+ }));
199
+ }
200
+
201
+ /**
202
+ * Payment 的 WalletPass 列表包含实例 code,而 prepare/config 通常只提供
203
+ * 卡名称和余额。按实例 ID 仅补齐 Snapshot 缺失的 code,避免后到的运行态
204
+ * 数据覆盖下单时已经冻结的卡名称和余额。
205
+ */
206
+ function mergePointCardSnapshotCodes(snapshotsValue, walletPassesValue) {
207
+ const snapshots = buildPointCardSnapshotFromWalletPassList(snapshotsValue);
208
+ if (!snapshots.length || !Array.isArray(walletPassesValue)) return snapshots;
209
+ const codeById = new Map(collectPointCardSnapshotCodeCandidates(walletPassesValue).map(({
210
+ id,
211
+ code
212
+ }) => [id, code]));
213
+ return snapshots.map(snapshot => {
214
+ if (snapshot.code) return snapshot;
215
+ const code = codeById.get(String(snapshot.id).trim());
216
+ return code ? {
217
+ ...snapshot,
218
+ code
219
+ } : snapshot;
220
+ });
221
+ }
180
222
  function normalizeSnapshotNameMap(value) {
181
223
  if (typeof value === 'string' || typeof value === 'number') {
182
224
  const normalizedText = String(value).trim();
@@ -3078,6 +3078,10 @@ class BaseSalesImpl extends _BaseModule.BaseModule {
3078
3078
  };
3079
3079
  }
3080
3080
  const result = await this.store.payment.wallet.initializeWalletDataFromBusinessAsync(walletBusinessData);
3081
+ this.store.order.mergePointCardSnapshotCodes?.(result.userIdentificationCodes, {
3082
+ customerId: walletBusinessData.customer_id,
3083
+ orderIdentity: snapshot?.identity
3084
+ });
3081
3085
  await this.core.effects.emit(`${this.name}:onWalletDataInitialized`, {
3082
3086
  orderId: snapshot?.identity?.orderId,
3083
3087
  customerId: walletBusinessData.customer_id,
@@ -3204,6 +3208,7 @@ class BaseSalesImpl extends _BaseModule.BaseModule {
3204
3208
  async importWalletAssetsSnapshot(snapshot) {
3205
3209
  if (!this.store.payment) throw new Error('payment 模块未初始化');
3206
3210
  const state = this.store.payment.wallet.importWalletAssetsSnapshot(snapshot);
3211
+ this.store.order?.mergePointCardSnapshotCodes?.(state.items);
3207
3212
  await this.syncSelectedWalletAssets(state);
3208
3213
  return this.publishWalletAssetsState(state);
3209
3214
  }
@@ -3225,6 +3230,10 @@ class BaseSalesImpl extends _BaseModule.BaseModule {
3225
3230
  });
3226
3231
  return this.publishWalletAssetsState(emptyState);
3227
3232
  }
3233
+ const pointCardSnapshotMergeContext = {
3234
+ customerId: businessData.customer_id,
3235
+ orderIdentity: this.store.order.getOrderSnapshot()?.identity
3236
+ };
3228
3237
  const previousState = wallet.getWalletAssetsState();
3229
3238
  const hasPreviousWalletContext = previousState.status !== 'idle' || previousState.items.length > 0 || previousState.selectedIds.length > 0 || previousState.customerId !== undefined;
3230
3239
  const customerChanged = hasPreviousWalletContext && String(previousState.customerId ?? '') !== String(businessData.customer_id ?? '');
@@ -3246,6 +3255,7 @@ class BaseSalesImpl extends _BaseModule.BaseModule {
3246
3255
  if (state.status !== 'error') {
3247
3256
  const committed = this.getCommittedWalletAssets();
3248
3257
  state = wallet.setCommittedWalletAssets(committed.ids, committed.assets);
3258
+ this.store.order.mergePointCardSnapshotCodes?.(wallet.getUserIdentificationCodes?.() || [], pointCardSnapshotMergeContext);
3249
3259
  }
3250
3260
  await this.syncSelectedWalletAssets(state);
3251
3261
  return this.publishWalletAssetsState(state);