@pisell/pisellos 0.0.283 → 0.0.284

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.
@@ -1080,25 +1080,17 @@ export var CheckoutImpl = /*#__PURE__*/function (_BaseModule) {
1080
1080
  return this.payment.addPaymentItemAsync(this.store.currentOrder.uuid, paymentItemWithType);
1081
1081
  case 12:
1082
1082
  this.logInfo('支付项添加成功');
1083
- // 触发支付项添加事件(可以复用支付开始事件)
1084
- this.core.effects.emit(CheckoutHooks.OnPaymentItemAdded, {
1085
- orderUuid: this.store.currentOrder.uuid,
1086
- paymentMethodCode: paymentItem.code,
1087
- paymentMethodName: paymentItem.name,
1088
- amount: String(paymentItem.amount),
1089
- timestamp: Date.now()
1090
- });
1091
1083
 
1092
1084
  // 支付项添加后,更新 stateAmount 为剩余未支付金额
1093
- _context15.next = 16;
1085
+ _context15.next = 15;
1094
1086
  return this.updateStateAmountToRemaining();
1095
- case 16:
1096
- _context15.next = 18;
1087
+ case 15:
1088
+ _context15.next = 17;
1097
1089
  return this.calculateRemainingAmountAsync();
1098
- case 18:
1090
+ case 17:
1099
1091
  remainingAmount = _context15.sent;
1100
1092
  if (!(Number(remainingAmount) > 0)) {
1101
- _context15.next = 39;
1093
+ _context15.next = 38;
1102
1094
  break;
1103
1095
  }
1104
1096
  this.logInfo('订单金额还有待付的,同步 EFTPOS 支付');
@@ -1113,30 +1105,38 @@ export var CheckoutImpl = /*#__PURE__*/function (_BaseModule) {
1113
1105
  currentOrderSynced: this.store.isOrderSynced
1114
1106
  });
1115
1107
  if (!(isEftposPayment || _isCashPayment || isCustomePayment)) {
1116
- _context15.next = 39;
1108
+ _context15.next = 38;
1117
1109
  break;
1118
1110
  }
1119
1111
  this.logInfo('检测到 EFTPOS 支付,立即同步订单到后端...');
1120
- _context15.prev = 27;
1121
- _context15.next = 30;
1112
+ _context15.prev = 26;
1113
+ _context15.next = 29;
1122
1114
  return this.syncOrderToBackendWithReturn(true);
1123
- case 30:
1115
+ case 29:
1124
1116
  syncResult = _context15.sent;
1125
1117
  this.logInfo('EFTPOS 支付后订单同步完成 (已标记为手动同步):', {
1126
1118
  orderId: syncResult.orderId,
1127
1119
  isOrderSynced: this.store.isOrderSynced,
1128
1120
  backendResponse: syncResult.response
1129
1121
  });
1130
- _context15.next = 39;
1122
+ _context15.next = 38;
1131
1123
  break;
1132
- case 34:
1133
- _context15.prev = 34;
1134
- _context15.t0 = _context15["catch"](27);
1124
+ case 33:
1125
+ _context15.prev = 33;
1126
+ _context15.t0 = _context15["catch"](26);
1135
1127
  this.logError('EFTPOS 支付后订单同步失败:', _context15.t0);
1136
1128
  // 不抛出错误,避免影响支付流程,但记录错误
1137
- _context15.next = 39;
1129
+ _context15.next = 38;
1138
1130
  return this.handleError(new Error("EFTPOS \u652F\u4ED8\u540E\u8BA2\u5355\u540C\u6B65\u5931\u8D25: ".concat(_context15.t0 instanceof Error ? _context15.t0.message : String(_context15.t0))), CheckoutErrorType.OrderCreationFailed);
1139
- case 39:
1131
+ case 38:
1132
+ // 触发支付项添加事件(可以复用支付开始事件)
1133
+ this.core.effects.emit(CheckoutHooks.OnPaymentItemAdded, {
1134
+ orderUuid: this.store.currentOrder.uuid,
1135
+ paymentMethodCode: paymentItem.code,
1136
+ paymentMethodName: paymentItem.name,
1137
+ amount: String(paymentItem.amount),
1138
+ timestamp: Date.now()
1139
+ });
1140
1140
  _context15.next = 47;
1141
1141
  break;
1142
1142
  case 41:
@@ -1151,7 +1151,7 @@ export var CheckoutImpl = /*#__PURE__*/function (_BaseModule) {
1151
1151
  case "end":
1152
1152
  return _context15.stop();
1153
1153
  }
1154
- }, _callee15, this, [[1, 41], [27, 34]]);
1154
+ }, _callee15, this, [[1, 41], [26, 33]]);
1155
1155
  }));
1156
1156
  function addPaymentItemAsync(_x14) {
1157
1157
  return _addPaymentItemAsync.apply(this, arguments);
@@ -654,13 +654,6 @@ var CheckoutImpl = class extends import_BaseModule.BaseModule {
654
654
  paymentItemWithType
655
655
  );
656
656
  this.logInfo("支付项添加成功");
657
- this.core.effects.emit(import_types.CheckoutHooks.OnPaymentItemAdded, {
658
- orderUuid: this.store.currentOrder.uuid,
659
- paymentMethodCode: paymentItem.code,
660
- paymentMethodName: paymentItem.name,
661
- amount: String(paymentItem.amount),
662
- timestamp: Date.now()
663
- });
664
657
  await this.updateStateAmountToRemaining();
665
658
  const remainingAmount = await this.calculateRemainingAmountAsync();
666
659
  if (Number(remainingAmount) > 0) {
@@ -694,6 +687,13 @@ var CheckoutImpl = class extends import_BaseModule.BaseModule {
694
687
  }
695
688
  }
696
689
  }
690
+ this.core.effects.emit(import_types.CheckoutHooks.OnPaymentItemAdded, {
691
+ orderUuid: this.store.currentOrder.uuid,
692
+ paymentMethodCode: paymentItem.code,
693
+ paymentMethodName: paymentItem.name,
694
+ amount: String(paymentItem.amount),
695
+ timestamp: Date.now()
696
+ });
697
697
  } catch (error) {
698
698
  this.logError("添加支付项失败:", error);
699
699
  await this.handleError(error, import_types.CheckoutErrorType.PaymentFailed);
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "private": false,
3
3
  "name": "@pisell/pisellos",
4
- "version": "0.0.283",
4
+ "version": "0.0.284",
5
5
  "description": "一个可扩展的前端模块化SDK框架,支持插件系统",
6
6
  "main": "dist/index.js",
7
7
  "types": "dist/index.d.ts",