@pisell/pisellos 2.2.54 → 2.2.56

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.
@@ -332,7 +332,7 @@ export var PaymentModule = /*#__PURE__*/function (_BaseModule) {
332
332
  // 1. 筛选 status === 1 && disable === 0的数据
333
333
  // 2. 检查列表里是否有 code=WALLET_PASS的数据,如果没有,则列表里如果有 PRODUCTVOUCHER 、 GIFTCARD 、 POINTCARD 则删除他们
334
334
  // 如果有 code = WALLET_PASS的数据,则列表里PRODUCTVOUCHER 、 GIFTCARD 、 POINTCARD 的channel_application 指向 WALLET_PASS 的 channel_application
335
- payMethods.filter(function (method) {
335
+ payMethods = payMethods.filter(function (method) {
336
336
  return method.status === 1 && method.disable === 0;
337
337
  });
338
338
  walletPassMethod = payMethods.find(function (method) {
@@ -442,8 +442,7 @@ export var PaymentModule = /*#__PURE__*/function (_BaseModule) {
442
442
  return this.core.effects.emit("".concat(this.name, ":onPaymentMethodsLoaded"), payMethods);
443
443
  case 46:
444
444
  this.logInfo('getPayMethodListAsync completed successfully', {
445
- methodCount: payMethods.length,
446
- hasCache: cachedMethods.length > 0
445
+ payMethods: payMethods
447
446
  });
448
447
  return _context4.abrupt("return", payMethods);
449
448
  case 50:
@@ -2018,9 +2017,6 @@ export var PaymentModule = /*#__PURE__*/function (_BaseModule) {
2018
2017
  var roundingAmount = new Decimal(payment.rounding_amount || 0);
2019
2018
  // 如果当前支付项有服务费,还需要减去服务费
2020
2019
  var effectiveAmount = paymentAmount.plus(roundingAmount.isNegative() ? roundingAmount.abs() : 0);
2021
- if (payment.service_fee) {
2022
- effectiveAmount = effectiveAmount.minus(new Decimal(payment.service_fee));
2023
- }
2024
2020
  return sum.plus(effectiveAmount);
2025
2021
  } catch (error) {
2026
2022
  console.warn("[PaymentModule] \u65E0\u6548\u7684\u652F\u4ED8\u91D1\u989D: amount=".concat(payment.amount, ", rounding_amount=").concat(payment.rounding_amount, "\uFF0C\u8DF3\u8FC7\u8BA1\u7B97"));
@@ -144,8 +144,6 @@ export interface PaymentItem {
144
144
  created_at?: string;
145
145
  /** 支付项更新时间 (格式: YYYY-MM-DD HH:mm:ss) */
146
146
  updated_at?: string;
147
- /** 三方支付手续费,正常来说只有编辑订单后端会给 */
148
- service_fee?: string;
149
147
  }
150
148
  /**
151
149
  * 订单信息
@@ -894,9 +894,6 @@ export var CheckoutImpl = /*#__PURE__*/function (_BaseModule) {
894
894
  _syncedAmount = syncedPayments.reduce(function (sum, p) {
895
895
  var amt = new Decimal(p.amount || '0');
896
896
  var rounding = new Decimal(Number(p.rounding_amount) > 0 ? 0 : p.rounding_amount || '0').abs();
897
- if (p.service_fee) {
898
- amt = amt.minus(new Decimal(p.service_fee));
899
- }
900
897
  return sum.plus(amt).plus(rounding);
901
898
  }, new Decimal(0));
902
899
  _totalAmount = new Decimal(amountInfo.totalAmount || '0');
@@ -3138,9 +3135,6 @@ export var CheckoutImpl = /*#__PURE__*/function (_BaseModule) {
3138
3135
  // 当 rounding_amount 为负数时,表示抹掉的金额,应该按绝对值加到实际支付中
3139
3136
  // 例如:amount=15, rounding_amount=-0.2,实际相当于支付了15.2(抹掉了0.2元的零头)
3140
3137
  var effectiveAmount = amount.add(roundingAmount.isNegative() ? roundingAmount.abs() : 0);
3141
- if (payment.service_fee) {
3142
- effectiveAmount = effectiveAmount.minus(new Decimal(payment.service_fee));
3143
- }
3144
3138
  return sum.add(effectiveAmount);
3145
3139
  }, new Decimal(0));
3146
3140
  return paidAmount.toFixed(2);
@@ -204,7 +204,7 @@ var PaymentModule = class extends import_BaseModule.BaseModule {
204
204
  });
205
205
  }
206
206
  async filterPayMethods(payMethods) {
207
- payMethods.filter((method) => method.status === 1 && method.disable === 0);
207
+ payMethods = payMethods.filter((method) => method.status === 1 && method.disable === 0);
208
208
  const walletPassMethod = payMethods.find((method) => method.code === "WALLET_PASS");
209
209
  if (walletPassMethod) {
210
210
  payMethods.forEach((method) => {
@@ -249,8 +249,7 @@ var PaymentModule = class extends import_BaseModule.BaseModule {
249
249
  payMethods
250
250
  );
251
251
  this.logInfo("getPayMethodListAsync completed successfully", {
252
- methodCount: payMethods.length,
253
- hasCache: cachedMethods.length > 0
252
+ payMethods
254
253
  });
255
254
  return payMethods;
256
255
  } catch (error) {
@@ -1030,10 +1029,7 @@ var PaymentModule = class extends import_BaseModule.BaseModule {
1030
1029
  }
1031
1030
  const paymentAmount = new import_decimal.Decimal(payment.amount || 0);
1032
1031
  const roundingAmount = new import_decimal.Decimal(payment.rounding_amount || 0);
1033
- let effectiveAmount = paymentAmount.plus(roundingAmount.isNegative() ? roundingAmount.abs() : 0);
1034
- if (payment.service_fee) {
1035
- effectiveAmount = effectiveAmount.minus(new import_decimal.Decimal(payment.service_fee));
1036
- }
1032
+ const effectiveAmount = paymentAmount.plus(roundingAmount.isNegative() ? roundingAmount.abs() : 0);
1037
1033
  return sum.plus(effectiveAmount);
1038
1034
  } catch (error) {
1039
1035
  console.warn(`[PaymentModule] 无效的支付金额: amount=${payment.amount}, rounding_amount=${payment.rounding_amount},跳过计算`);
@@ -144,8 +144,6 @@ export interface PaymentItem {
144
144
  created_at?: string;
145
145
  /** 支付项更新时间 (格式: YYYY-MM-DD HH:mm:ss) */
146
146
  updated_at?: string;
147
- /** 三方支付手续费,正常来说只有编辑订单后端会给 */
148
- service_fee?: string;
149
147
  }
150
148
  /**
151
149
  * 订单信息
@@ -608,9 +608,6 @@ var CheckoutImpl = class extends import_BaseModule.BaseModule {
608
608
  const syncedAmount2 = syncedPayments.reduce((sum, p) => {
609
609
  let amt = new import_decimal.default(p.amount || "0");
610
610
  const rounding = new import_decimal.default(Number(p.rounding_amount) > 0 ? 0 : p.rounding_amount || "0").abs();
611
- if (p.service_fee) {
612
- amt = amt.minus(new import_decimal.default(p.service_fee));
613
- }
614
611
  return sum.plus(amt).plus(rounding);
615
612
  }, new import_decimal.default(0));
616
613
  const totalAmount2 = new import_decimal.default(amountInfo.totalAmount || "0");
@@ -2034,10 +2031,7 @@ var CheckoutImpl = class extends import_BaseModule.BaseModule {
2034
2031
  const paidAmount = payments.filter((payment) => payment.status !== "voided").reduce((sum, payment) => {
2035
2032
  const amount = new import_decimal.default(payment.amount || "0");
2036
2033
  const roundingAmount = new import_decimal.default(payment.rounding_amount || "0");
2037
- let effectiveAmount = amount.add(roundingAmount.isNegative() ? roundingAmount.abs() : 0);
2038
- if (payment.service_fee) {
2039
- effectiveAmount = effectiveAmount.minus(new import_decimal.default(payment.service_fee));
2040
- }
2034
+ const effectiveAmount = amount.add(roundingAmount.isNegative() ? roundingAmount.abs() : 0);
2041
2035
  return sum.add(effectiveAmount);
2042
2036
  }, new import_decimal.default(0));
2043
2037
  return paidAmount.toFixed(2);
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "private": false,
3
3
  "name": "@pisell/pisellos",
4
- "version": "2.2.54",
4
+ "version": "2.2.56",
5
5
  "description": "一个可扩展的前端模块化SDK框架,支持插件系统",
6
6
  "main": "dist/index.js",
7
7
  "types": "dist/index.d.ts",