@pisell/pisellos 0.0.280 → 0.0.281

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.
@@ -1049,7 +1049,7 @@ export var CheckoutImpl = /*#__PURE__*/function (_BaseModule) {
1049
1049
  key: "addPaymentItemAsync",
1050
1050
  value: (function () {
1051
1051
  var _addPaymentItemAsync = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee15(paymentItem) {
1052
- var orderPaymentType, processedPaymentItem, metadata, paymentItemWithType, remainingAmount, _paymentItem$type, _paymentItem$code, isEftposPayment, syncResult;
1052
+ var orderPaymentType, processedPaymentItem, metadata, paymentItemWithType, remainingAmount, _paymentItem$type, _paymentItem$code, isEftposPayment, _isCashPayment, isCustomePayment, syncResult;
1053
1053
  return _regeneratorRuntime().wrap(function _callee15$(_context15) {
1054
1054
  while (1) switch (_context15.prev = _context15.next) {
1055
1055
  case 0:
@@ -1090,44 +1090,46 @@ export var CheckoutImpl = /*#__PURE__*/function (_BaseModule) {
1090
1090
  case 17:
1091
1091
  remainingAmount = _context15.sent;
1092
1092
  if (!(Number(remainingAmount) > 0)) {
1093
- _context15.next = 36;
1093
+ _context15.next = 38;
1094
1094
  break;
1095
1095
  }
1096
1096
  this.logInfo('订单金额还有待付的,同步 EFTPOS 支付');
1097
1097
  // 检查是否是 EFTPOS 支付,如果是则立即同步订单
1098
1098
  isEftposPayment = ((_paymentItem$type = paymentItem.type) === null || _paymentItem$type === void 0 ? void 0 : _paymentItem$type.toLowerCase()) === 'eftpos' || ((_paymentItem$code = paymentItem.code) === null || _paymentItem$code === void 0 ? void 0 : _paymentItem$code.toUpperCase().includes('EFTPOS'));
1099
+ _isCashPayment = paymentItem.code === 'CASHMANUAL';
1100
+ isCustomePayment = paymentItem.type === 'custom';
1099
1101
  this.logInfo('EFTPOS 支付检查:', {
1100
1102
  paymentCode: paymentItem.code,
1101
1103
  paymentType: paymentItem.type,
1102
1104
  isEftposPayment: isEftposPayment,
1103
1105
  currentOrderSynced: this.store.isOrderSynced
1104
1106
  });
1105
- if (!isEftposPayment) {
1106
- _context15.next = 36;
1107
+ if (!(isEftposPayment || _isCashPayment || isCustomePayment)) {
1108
+ _context15.next = 38;
1107
1109
  break;
1108
1110
  }
1109
1111
  this.logInfo('检测到 EFTPOS 支付,立即同步订单到后端...');
1110
- _context15.prev = 24;
1111
- _context15.next = 27;
1112
+ _context15.prev = 26;
1113
+ _context15.next = 29;
1112
1114
  return this.syncOrderToBackendWithReturn(true);
1113
- case 27:
1115
+ case 29:
1114
1116
  syncResult = _context15.sent;
1115
1117
  this.logInfo('EFTPOS 支付后订单同步完成 (已标记为手动同步):', {
1116
1118
  orderId: syncResult.orderId,
1117
1119
  isOrderSynced: this.store.isOrderSynced,
1118
1120
  backendResponse: syncResult.response
1119
1121
  });
1120
- _context15.next = 36;
1122
+ _context15.next = 38;
1121
1123
  break;
1122
- case 31:
1123
- _context15.prev = 31;
1124
- _context15.t0 = _context15["catch"](24);
1124
+ case 33:
1125
+ _context15.prev = 33;
1126
+ _context15.t0 = _context15["catch"](26);
1125
1127
  this.logError('EFTPOS 支付后订单同步失败:', _context15.t0);
1126
1128
  // 不抛出错误,避免影响支付流程,但记录错误
1127
- _context15.next = 36;
1128
- 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);
1129
- case 36:
1130
1129
  _context15.next = 38;
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);
1131
+ case 38:
1132
+ _context15.next = 40;
1131
1133
  return this.core.effects.emit(CheckoutHooks.OnPaymentItemAdded, {
1132
1134
  orderUuid: this.store.currentOrder.uuid,
1133
1135
  paymentMethodCode: paymentItem.code,
@@ -1135,22 +1137,22 @@ export var CheckoutImpl = /*#__PURE__*/function (_BaseModule) {
1135
1137
  amount: String(paymentItem.amount),
1136
1138
  timestamp: Date.now()
1137
1139
  });
1138
- case 38:
1139
- _context15.next = 46;
1140
- break;
1141
1140
  case 40:
1142
- _context15.prev = 40;
1141
+ _context15.next = 48;
1142
+ break;
1143
+ case 42:
1144
+ _context15.prev = 42;
1143
1145
  _context15.t1 = _context15["catch"](1);
1144
1146
  this.logError('添加支付项失败:', _context15.t1);
1145
- _context15.next = 45;
1147
+ _context15.next = 47;
1146
1148
  return this.handleError(_context15.t1, CheckoutErrorType.PaymentFailed);
1147
- case 45:
1149
+ case 47:
1148
1150
  throw _context15.t1;
1149
- case 46:
1151
+ case 48:
1150
1152
  case "end":
1151
1153
  return _context15.stop();
1152
1154
  }
1153
- }, _callee15, this, [[1, 40], [24, 31]]);
1155
+ }, _callee15, this, [[1, 42], [26, 33]]);
1154
1156
  }));
1155
1157
  function addPaymentItemAsync(_x14) {
1156
1158
  return _addPaymentItemAsync.apply(this, arguments);
@@ -659,13 +659,15 @@ var CheckoutImpl = class extends import_BaseModule.BaseModule {
659
659
  if (Number(remainingAmount) > 0) {
660
660
  this.logInfo("订单金额还有待付的,同步 EFTPOS 支付");
661
661
  const isEftposPayment = ((_a = paymentItem.type) == null ? void 0 : _a.toLowerCase()) === "eftpos" || ((_b = paymentItem.code) == null ? void 0 : _b.toUpperCase().includes("EFTPOS"));
662
+ const isCashPayment2 = paymentItem.code === "CASHMANUAL";
663
+ const isCustomePayment = paymentItem.type === "custom";
662
664
  this.logInfo("EFTPOS 支付检查:", {
663
665
  paymentCode: paymentItem.code,
664
666
  paymentType: paymentItem.type,
665
667
  isEftposPayment,
666
668
  currentOrderSynced: this.store.isOrderSynced
667
669
  });
668
- if (isEftposPayment) {
670
+ if (isEftposPayment || isCashPayment2 || isCustomePayment) {
669
671
  this.logInfo("检测到 EFTPOS 支付,立即同步订单到后端...");
670
672
  try {
671
673
  const syncResult = await this.syncOrderToBackendWithReturn(true);
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "private": false,
3
3
  "name": "@pisell/pisellos",
4
- "version": "0.0.280",
4
+ "version": "0.0.281",
5
5
  "description": "一个可扩展的前端模块化SDK框架,支持插件系统",
6
6
  "main": "dist/index.js",
7
7
  "types": "dist/index.d.ts",