@pisell/pisellos 2.2.49 → 2.2.51
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.
- package/dist/modules/Product/index.d.ts +1 -1
- package/dist/solution/BookingByStep/index.js +0 -1
- package/dist/solution/Checkout/index.js +6 -0
- package/lib/modules/Product/index.d.ts +1 -1
- package/lib/solution/BookingByStep/index.js +0 -1
- package/lib/solution/Checkout/index.js +8 -2
- package/package.json +1 -1
|
@@ -49,5 +49,5 @@ export declare class Product extends BaseModule implements Module {
|
|
|
49
49
|
getCategories(): ProductCategory[];
|
|
50
50
|
setOtherParams(key: string, value: any): void;
|
|
51
51
|
getOtherParams(): any;
|
|
52
|
-
getProductType(): "
|
|
52
|
+
getProductType(): "normal" | "duration" | "session";
|
|
53
53
|
}
|
|
@@ -1161,7 +1161,6 @@ export var BookingByStepImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
1161
1161
|
var productData = _objectSpread(_objectSpread({}, origin), {}, {
|
|
1162
1162
|
product_variant_id: product_variant_id
|
|
1163
1163
|
});
|
|
1164
|
-
debugger;
|
|
1165
1164
|
// 保护,如果进来的是 session 商品,则必须要有 date 和时间片,否则不允许添加
|
|
1166
1165
|
if (isSessionProduct(productData)) {
|
|
1167
1166
|
if (!date || !date.startTime || !date.endTime) {
|
|
@@ -893,6 +893,9 @@ export var CheckoutImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
893
893
|
_syncedAmount = syncedPayments.reduce(function (sum, p) {
|
|
894
894
|
var amt = new Decimal(p.amount || '0');
|
|
895
895
|
var rounding = new Decimal(Number(p.rounding_amount) > 0 ? 0 : p.rounding_amount || '0').abs();
|
|
896
|
+
if (p.service_fee) {
|
|
897
|
+
amt = amt.minus(new Decimal(p.service_fee));
|
|
898
|
+
}
|
|
896
899
|
return sum.plus(amt).plus(rounding);
|
|
897
900
|
}, new Decimal(0));
|
|
898
901
|
_totalAmount = new Decimal(amountInfo.totalAmount || '0');
|
|
@@ -3134,6 +3137,9 @@ export var CheckoutImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
3134
3137
|
// 当 rounding_amount 为负数时,表示抹掉的金额,应该按绝对值加到实际支付中
|
|
3135
3138
|
// 例如:amount=15, rounding_amount=-0.2,实际相当于支付了15.2(抹掉了0.2元的零头)
|
|
3136
3139
|
var effectiveAmount = amount.add(roundingAmount.isNegative() ? roundingAmount.abs() : 0);
|
|
3140
|
+
if (payment.service_fee) {
|
|
3141
|
+
effectiveAmount = effectiveAmount.minus(new Decimal(payment.service_fee));
|
|
3142
|
+
}
|
|
3137
3143
|
return sum.add(effectiveAmount);
|
|
3138
3144
|
}, new Decimal(0));
|
|
3139
3145
|
return paidAmount.toFixed(2);
|
|
@@ -49,5 +49,5 @@ export declare class Product extends BaseModule implements Module {
|
|
|
49
49
|
getCategories(): ProductCategory[];
|
|
50
50
|
setOtherParams(key: string, value: any): void;
|
|
51
51
|
getOtherParams(): any;
|
|
52
|
-
getProductType(): "
|
|
52
|
+
getProductType(): "normal" | "duration" | "session";
|
|
53
53
|
}
|
|
@@ -606,7 +606,6 @@ var BookingByStepImpl = class extends import_BaseModule.BaseModule {
|
|
|
606
606
|
quantity = 1
|
|
607
607
|
} = product || {};
|
|
608
608
|
const productData = { ...origin, product_variant_id };
|
|
609
|
-
debugger;
|
|
610
609
|
if ((0, import_products.isSessionProduct)(productData)) {
|
|
611
610
|
if (!date || !date.startTime || !date.endTime) {
|
|
612
611
|
return { success: false, errorCode: "date_or_time_required" };
|
|
@@ -605,8 +605,11 @@ var CheckoutImpl = class extends import_BaseModule.BaseModule {
|
|
|
605
605
|
});
|
|
606
606
|
const syncedPayments = updated2.payment.filter((p) => p.isSynced && p.status !== "voided");
|
|
607
607
|
const syncedAmount2 = syncedPayments.reduce((sum, p) => {
|
|
608
|
-
|
|
608
|
+
let amt = new import_decimal.default(p.amount || "0");
|
|
609
609
|
const rounding = new import_decimal.default(Number(p.rounding_amount) > 0 ? 0 : p.rounding_amount || "0").abs();
|
|
610
|
+
if (p.service_fee) {
|
|
611
|
+
amt = amt.minus(new import_decimal.default(p.service_fee));
|
|
612
|
+
}
|
|
610
613
|
return sum.plus(amt).plus(rounding);
|
|
611
614
|
}, new import_decimal.default(0));
|
|
612
615
|
const totalAmount2 = new import_decimal.default(amountInfo.totalAmount || "0");
|
|
@@ -2030,7 +2033,10 @@ var CheckoutImpl = class extends import_BaseModule.BaseModule {
|
|
|
2030
2033
|
const paidAmount = payments.filter((payment) => payment.status !== "voided").reduce((sum, payment) => {
|
|
2031
2034
|
const amount = new import_decimal.default(payment.amount || "0");
|
|
2032
2035
|
const roundingAmount = new import_decimal.default(payment.rounding_amount || "0");
|
|
2033
|
-
|
|
2036
|
+
let effectiveAmount = amount.add(roundingAmount.isNegative() ? roundingAmount.abs() : 0);
|
|
2037
|
+
if (payment.service_fee) {
|
|
2038
|
+
effectiveAmount = effectiveAmount.minus(new import_decimal.default(payment.service_fee));
|
|
2039
|
+
}
|
|
2034
2040
|
return sum.add(effectiveAmount);
|
|
2035
2041
|
}, new import_decimal.default(0));
|
|
2036
2042
|
return paidAmount.toFixed(2);
|