@pisell/pisellos 2.2.54 → 2.2.55
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.
|
@@ -2018,9 +2018,6 @@ export var PaymentModule = /*#__PURE__*/function (_BaseModule) {
|
|
|
2018
2018
|
var roundingAmount = new Decimal(payment.rounding_amount || 0);
|
|
2019
2019
|
// 如果当前支付项有服务费,还需要减去服务费
|
|
2020
2020
|
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
2021
|
return sum.plus(effectiveAmount);
|
|
2025
2022
|
} catch (error) {
|
|
2026
2023
|
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"));
|
|
@@ -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);
|
|
@@ -1030,10 +1030,7 @@ var PaymentModule = class extends import_BaseModule.BaseModule {
|
|
|
1030
1030
|
}
|
|
1031
1031
|
const paymentAmount = new import_decimal.Decimal(payment.amount || 0);
|
|
1032
1032
|
const roundingAmount = new import_decimal.Decimal(payment.rounding_amount || 0);
|
|
1033
|
-
|
|
1034
|
-
if (payment.service_fee) {
|
|
1035
|
-
effectiveAmount = effectiveAmount.minus(new import_decimal.Decimal(payment.service_fee));
|
|
1036
|
-
}
|
|
1033
|
+
const effectiveAmount = paymentAmount.plus(roundingAmount.isNegative() ? roundingAmount.abs() : 0);
|
|
1037
1034
|
return sum.plus(effectiveAmount);
|
|
1038
1035
|
} catch (error) {
|
|
1039
1036
|
console.warn(`[PaymentModule] 无效的支付金额: amount=${payment.amount}, rounding_amount=${payment.rounding_amount},跳过计算`);
|
|
@@ -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
|
-
|
|
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);
|