@pisell/pisellos 0.0.247 → 0.0.248

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.
@@ -1750,9 +1750,16 @@ export var PaymentModule = /*#__PURE__*/function (_BaseModule) {
1750
1750
  if (payment.status === 'voided') {
1751
1751
  return sum;
1752
1752
  }
1753
- return sum.plus(payment.amount);
1753
+
1754
+ // 计算有效支付金额:支付金额 + 抹零金额的绝对值
1755
+ // 当 rounding_amount 为负数时,表示抹掉的金额,按绝对值计算有效支付
1756
+ // 例如:amount=15, rounding_amount=-0.2,有效支付=15.2(抹掉0.2元零头)
1757
+ var paymentAmount = new Decimal(payment.amount || 0);
1758
+ var roundingAmount = new Decimal(payment.rounding_amount || 0);
1759
+ var effectiveAmount = paymentAmount.plus(roundingAmount.abs());
1760
+ return sum.plus(effectiveAmount);
1754
1761
  } catch (error) {
1755
- console.warn("[PaymentModule] \u65E0\u6548\u7684\u652F\u4ED8\u91D1\u989D: ".concat(payment.amount, "\uFF0C\u8DF3\u8FC7\u8BA1\u7B97"));
1762
+ 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"));
1756
1763
  return sum;
1757
1764
  }
1758
1765
  }, new Decimal(0));
@@ -1761,14 +1768,25 @@ export var PaymentModule = /*#__PURE__*/function (_BaseModule) {
1761
1768
  console.log("[PaymentModule] \u91CD\u65B0\u8BA1\u7B97\u8BA2\u5355\u91D1\u989D:", {
1762
1769
  orderUuid: order.uuid,
1763
1770
  totalAmount: order.total_amount,
1764
- paidAmount: paidAmount.toFixed(2),
1771
+ effectivePaidAmount: paidAmount.toFixed(2),
1765
1772
  remainingAmount: order.expect_amount,
1766
1773
  activePayments: order.payment.filter(function (p) {
1767
1774
  return p.status !== 'voided';
1768
1775
  }).length,
1769
1776
  voidedPayments: order.payment.filter(function (p) {
1770
1777
  return p.status === 'voided';
1771
- }).length
1778
+ }).length,
1779
+ paymentDetails: order.payment.filter(function (p) {
1780
+ return p.status !== 'voided';
1781
+ }).map(function (p) {
1782
+ return {
1783
+ code: p.code,
1784
+ amount: p.amount,
1785
+ rounding_amount: p.rounding_amount || '0.00',
1786
+ effective_amount: new Decimal(p.amount || 0).plus(new Decimal(p.rounding_amount || 0).abs()).toFixed(2)
1787
+ };
1788
+ }),
1789
+ 说明: '有效支付金额包含抹零计算(amount + |rounding_amount|)'
1772
1790
  });
1773
1791
  }
1774
1792
 
@@ -222,6 +222,15 @@ export interface PaymentItemInput {
222
222
  rounding_amount?: string;
223
223
  /** 订单支付类型 */
224
224
  order_payment_type?: 'normal' | 'deposit';
225
+ /** 扩展参数字段 */
226
+ metadata?: {
227
+ /** 钱箱 ID */
228
+ shop_wallet_pass_id?: string;
229
+ /** 唯一支付号 */
230
+ unique_payment_number?: string;
231
+ /** rounding规则 */
232
+ rounding_rule?: any;
233
+ };
225
234
  }
226
235
  /**
227
236
  * 推送支付项参数
@@ -314,7 +314,7 @@ export declare class BookingByStepImpl extends BaseModule implements Module {
314
314
  }[];
315
315
  setOtherData(key: string, value: any): void;
316
316
  getOtherData(key: string): any;
317
- getProductTypeById(id: number): Promise<"duration" | "session" | "normal">;
317
+ getProductTypeById(id: number): Promise<"normal" | "duration" | "session">;
318
318
  /**
319
319
  * 提供给 UI 的方法,减轻 UI 层的计算压力,UI 层只需要传递 cartItemId 和 resourceCode 即返回对应的 renderList
320
320
  *
@@ -1660,7 +1660,7 @@ export var CheckoutImpl = /*#__PURE__*/function (_BaseModule) {
1660
1660
  key: "addPaymentItemAsync",
1661
1661
  value: (function () {
1662
1662
  var _addPaymentItemAsync = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee25(paymentItem) {
1663
- var _paymentItem$type, _paymentItem$code, orderPaymentType, paymentItemWithType, isEftposPayment;
1663
+ var _paymentItem$type, _paymentItem$code, orderPaymentType, metadata, paymentItemWithType, isEftposPayment;
1664
1664
  return _regeneratorRuntime().wrap(function _callee25$(_context25) {
1665
1665
  while (1) switch (_context25.prev = _context25.next) {
1666
1666
  case 0:
@@ -1672,9 +1672,14 @@ export var CheckoutImpl = /*#__PURE__*/function (_BaseModule) {
1672
1672
  throw createCheckoutError(CheckoutErrorType.ValidationFailed, '未找到当前订单,无法添加支付项');
1673
1673
  case 3:
1674
1674
  // 根据当前订单的定金状态设置订单支付类型
1675
- orderPaymentType = this.store.currentOrder.is_deposit === 1 ? 'deposit' : 'normal'; // 设置支付项的订单支付类型
1675
+ orderPaymentType = this.store.currentOrder.is_deposit === 1 ? 'deposit' : 'normal'; // 从 otherParams 获取 metadata 字段
1676
+ metadata = _objectSpread(_objectSpread({}, paymentItem.metadata), {}, {
1677
+ rounding_rule: this.otherParams.order_rounding_setting,
1678
+ shop_wallet_pass_id: this.otherParams.shop_wallet_pass_id
1679
+ }); // 设置支付项的订单支付类型和 metadata
1676
1680
  paymentItemWithType = _objectSpread(_objectSpread({}, paymentItem), {}, {
1677
- order_payment_type: orderPaymentType
1681
+ order_payment_type: orderPaymentType,
1682
+ metadata: metadata
1678
1683
  });
1679
1684
  console.log('[Checkout] 为当前订单添加支付项:', {
1680
1685
  orderUuid: this.store.currentOrder.uuid,
@@ -1686,16 +1691,17 @@ export var CheckoutImpl = /*#__PURE__*/function (_BaseModule) {
1686
1691
  service_charge: paymentItemWithType.service_charge,
1687
1692
  rounding_amount: paymentItemWithType.rounding_amount,
1688
1693
  voucher_id: paymentItemWithType.voucher_id,
1689
- order_payment_type: paymentItemWithType.order_payment_type
1694
+ order_payment_type: paymentItemWithType.order_payment_type,
1695
+ metadata: paymentItemWithType.metadata
1690
1696
  },
1691
1697
  orderDepositStatus: this.store.currentOrder.is_deposit,
1692
1698
  calculatedOrderPaymentType: orderPaymentType
1693
1699
  });
1694
1700
 
1695
1701
  // 添加支付项到订单
1696
- _context25.next = 8;
1702
+ _context25.next = 9;
1697
1703
  return this.payment.addPaymentItemAsync(this.store.currentOrder.uuid, paymentItemWithType);
1698
- case 8:
1704
+ case 9:
1699
1705
  console.log('[Checkout] 支付项添加成功');
1700
1706
 
1701
1707
  // 检查是否是 EFTPOS 支付,如果是则立即同步订单
@@ -1707,54 +1713,54 @@ export var CheckoutImpl = /*#__PURE__*/function (_BaseModule) {
1707
1713
  currentOrderSynced: this.store.isOrderSynced
1708
1714
  });
1709
1715
  if (!isEftposPayment) {
1710
- _context25.next = 24;
1716
+ _context25.next = 25;
1711
1717
  break;
1712
1718
  }
1713
1719
  console.log('[Checkout] 检测到 EFTPOS 支付,立即同步订单到后端...');
1714
- _context25.prev = 13;
1715
- _context25.next = 16;
1720
+ _context25.prev = 14;
1721
+ _context25.next = 17;
1716
1722
  return this.syncOrderToBackendWithReturn(true);
1717
- case 16:
1723
+ case 17:
1718
1724
  console.log('[Checkout] EFTPOS 支付后订单同步完成 (已标记为手动同步):', {
1719
1725
  订单ID: this.store.currentOrder.order_id,
1720
1726
  是否已同步: this.store.isOrderSynced
1721
1727
  });
1722
- _context25.next = 24;
1728
+ _context25.next = 25;
1723
1729
  break;
1724
- case 19:
1725
- _context25.prev = 19;
1726
- _context25.t0 = _context25["catch"](13);
1730
+ case 20:
1731
+ _context25.prev = 20;
1732
+ _context25.t0 = _context25["catch"](14);
1727
1733
  console.error('[Checkout] EFTPOS 支付后订单同步失败:', _context25.t0);
1728
1734
  // 不抛出错误,避免影响支付流程,但记录错误
1729
- _context25.next = 24;
1735
+ _context25.next = 25;
1730
1736
  return this.handleError(new Error("EFTPOS \u652F\u4ED8\u540E\u8BA2\u5355\u540C\u6B65\u5931\u8D25: ".concat(_context25.t0 instanceof Error ? _context25.t0.message : String(_context25.t0))), CheckoutErrorType.OrderCreationFailed);
1731
- case 24:
1732
- _context25.next = 26;
1737
+ case 25:
1738
+ _context25.next = 27;
1733
1739
  return this.updateStateAmountToRemaining();
1734
- case 26:
1735
- _context25.next = 28;
1740
+ case 27:
1741
+ _context25.next = 29;
1736
1742
  return this.core.effects.emit(CheckoutHooks.OnPaymentStarted, {
1737
1743
  orderUuid: this.store.currentOrder.uuid,
1738
1744
  paymentMethodCode: paymentItem.code,
1739
1745
  amount: String(paymentItem.amount),
1740
1746
  timestamp: Date.now()
1741
1747
  });
1742
- case 28:
1743
- _context25.next = 36;
1748
+ case 29:
1749
+ _context25.next = 37;
1744
1750
  break;
1745
- case 30:
1746
- _context25.prev = 30;
1751
+ case 31:
1752
+ _context25.prev = 31;
1747
1753
  _context25.t1 = _context25["catch"](0);
1748
1754
  console.error('[Checkout] 添加支付项失败:', _context25.t1);
1749
- _context25.next = 35;
1755
+ _context25.next = 36;
1750
1756
  return this.handleError(_context25.t1, CheckoutErrorType.PaymentFailed);
1751
- case 35:
1752
- throw _context25.t1;
1753
1757
  case 36:
1758
+ throw _context25.t1;
1759
+ case 37:
1754
1760
  case "end":
1755
1761
  return _context25.stop();
1756
1762
  }
1757
- }, _callee25, this, [[0, 30], [13, 19]]);
1763
+ }, _callee25, this, [[0, 31], [14, 20]]);
1758
1764
  }));
1759
1765
  function addPaymentItemAsync(_x16) {
1760
1766
  return _addPaymentItemAsync.apply(this, arguments);
@@ -1889,6 +1895,7 @@ export var CheckoutImpl = /*#__PURE__*/function (_BaseModule) {
1889
1895
  key: "updateVoucherPaymentItemsAsync",
1890
1896
  value: (function () {
1891
1897
  var _updateVoucherPaymentItemsAsync = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee27(voucherPaymentItems) {
1898
+ var _this3 = this;
1892
1899
  var orderPaymentType, voucherPaymentItemsWithType, currentOrderId, isCurrentOrderReal, updatedOrder, voucherItems;
1893
1900
  return _regeneratorRuntime().wrap(function _callee27$(_context27) {
1894
1901
  while (1) switch (_context27.prev = _context27.next) {
@@ -1907,13 +1914,20 @@ export var CheckoutImpl = /*#__PURE__*/function (_BaseModule) {
1907
1914
  });
1908
1915
 
1909
1916
  // 根据当前订单的定金状态设置订单支付类型
1910
- orderPaymentType = this.store.currentOrder.is_deposit === 1 ? 'deposit' : 'normal'; // 验证所有支付项都包含 voucher_id,并设置 order_payment_type
1917
+ orderPaymentType = this.store.currentOrder.is_deposit === 1 ? 'deposit' : 'normal'; // 验证所有支付项都包含 voucher_id,并设置 order_payment_type 和 metadata
1911
1918
  voucherPaymentItemsWithType = voucherPaymentItems.map(function (item) {
1912
1919
  if (!item.voucher_id) {
1913
1920
  throw createCheckoutError(CheckoutErrorType.ValidationFailed, "\u4EE3\u91D1\u5238\u652F\u4ED8\u9879\u7F3A\u5C11 voucher_id: ".concat(JSON.stringify(item)));
1914
1921
  }
1922
+
1923
+ // 从 otherParams 获取 metadata 字段
1924
+ var metadata = _objectSpread(_objectSpread({}, item.metadata), {}, {
1925
+ rounding_rule: _this3.otherParams.order_rounding_setting,
1926
+ shop_wallet_pass_id: _this3.otherParams.shop_wallet_pass_id
1927
+ });
1915
1928
  return _objectSpread(_objectSpread({}, item), {}, {
1916
- order_payment_type: orderPaymentType
1929
+ order_payment_type: orderPaymentType,
1930
+ metadata: metadata
1917
1931
  });
1918
1932
  });
1919
1933
  console.log('[Checkout] 代金券支付项订单支付类型设置:', {
@@ -3240,7 +3254,8 @@ export var CheckoutImpl = /*#__PURE__*/function (_BaseModule) {
3240
3254
  uuid: p.uuid,
3241
3255
  amount: p.amount,
3242
3256
  code: p.code,
3243
- status: p.status
3257
+ status: p.status,
3258
+ rounding_amount: p.rounding_amount
3244
3259
  };
3245
3260
  })
3246
3261
  });
@@ -3249,8 +3264,19 @@ export var CheckoutImpl = /*#__PURE__*/function (_BaseModule) {
3249
3264
  }) // 只计算未撤销的支付项
3250
3265
  .reduce(function (sum, payment) {
3251
3266
  var amount = parseFloat(payment.amount || '0');
3252
- console.log("[Checkout] \u8BA1\u7B97\u652F\u4ED8\u9879: ".concat(payment.code, " = ").concat(amount));
3253
- return sum + amount;
3267
+ var roundingAmount = parseFloat(payment.rounding_amount || '0');
3268
+
3269
+ // 计算实际支付有效金额:
3270
+ // 当 rounding_amount 为负数时,表示抹掉的金额,应该按绝对值加到实际支付中
3271
+ // 例如:amount=15, rounding_amount=-0.2,实际相当于支付了15.2(抹掉了0.2元的零头)
3272
+ var effectiveAmount = amount + Math.abs(roundingAmount);
3273
+ console.log("[Checkout] \u8BA1\u7B97\u652F\u4ED8\u9879: ".concat(payment.code), {
3274
+ 原始金额: amount,
3275
+ 抹零金额: roundingAmount,
3276
+ 有效金额: effectiveAmount,
3277
+ 说明: roundingAmount !== 0 ? "\u62B9\u96F6\u91D1\u989D ".concat(roundingAmount, " \u5143\uFF0C\u6709\u6548\u652F\u4ED8\u589E\u52A0 ").concat(Math.abs(roundingAmount), " \u5143") : '无抹零'
3278
+ });
3279
+ return sum + effectiveAmount;
3254
3280
  }, 0);
3255
3281
  result = paidAmount.toFixed(2);
3256
3282
  console.log('[Checkout] calculatePaidAmountAsync: 计算结果 =', result);
@@ -3304,7 +3330,8 @@ export var CheckoutImpl = /*#__PURE__*/function (_BaseModule) {
3304
3330
  totalAmount: totalAmount.toFixed(2),
3305
3331
  paidAmount: paidAmount.toFixed(2),
3306
3332
  calculatedRemaining: remainingAmount.toFixed(2),
3307
- finalResult: result
3333
+ finalResult: result,
3334
+ 说明: '已支付金额包含抹零计算(amount + |rounding_amount|)'
3308
3335
  });
3309
3336
  return _context43.abrupt("return", result);
3310
3337
  case 13:
@@ -3537,6 +3564,8 @@ export var CheckoutImpl = /*#__PURE__*/function (_BaseModule) {
3537
3564
  uuid: p.uuid,
3538
3565
  code: p.code,
3539
3566
  amount: p.amount,
3567
+ rounding_amount: p.rounding_amount,
3568
+ effective_amount: (parseFloat(p.amount || '0') + Math.abs(parseFloat(p.rounding_amount || '0'))).toFixed(2),
3540
3569
  voucher_id: p.voucher_id,
3541
3570
  status: p.status
3542
3571
  };
@@ -3759,7 +3788,8 @@ export var CheckoutImpl = /*#__PURE__*/function (_BaseModule) {
3759
3788
  amount: p.amount,
3760
3789
  uniquePaymentNumber: (_p$metadata = p.metadata) === null || _p$metadata === void 0 ? void 0 : _p$metadata.unique_payment_number,
3761
3790
  voucherId: p.voucher_id,
3762
- orderPaymentType: p.order_payment_type
3791
+ orderPaymentType: p.order_payment_type,
3792
+ metadata: p.metadata
3763
3793
  };
3764
3794
  })
3765
3795
  });
@@ -866,9 +866,12 @@ var PaymentModule = class extends import_BaseModule.BaseModule {
866
866
  if (payment.status === "voided") {
867
867
  return sum;
868
868
  }
869
- return sum.plus(payment.amount);
869
+ const paymentAmount = new import_decimal.Decimal(payment.amount || 0);
870
+ const roundingAmount = new import_decimal.Decimal(payment.rounding_amount || 0);
871
+ const effectiveAmount = paymentAmount.plus(roundingAmount.abs());
872
+ return sum.plus(effectiveAmount);
870
873
  } catch (error) {
871
- console.warn(`[PaymentModule] 无效的支付金额: ${payment.amount},跳过计算`);
874
+ console.warn(`[PaymentModule] 无效的支付金额: amount=${payment.amount}, rounding_amount=${payment.rounding_amount},跳过计算`);
872
875
  return sum;
873
876
  }
874
877
  },
@@ -879,10 +882,17 @@ var PaymentModule = class extends import_BaseModule.BaseModule {
879
882
  console.log(`[PaymentModule] 重新计算订单金额:`, {
880
883
  orderUuid: order.uuid,
881
884
  totalAmount: order.total_amount,
882
- paidAmount: paidAmount.toFixed(2),
885
+ effectivePaidAmount: paidAmount.toFixed(2),
883
886
  remainingAmount: order.expect_amount,
884
887
  activePayments: order.payment.filter((p) => p.status !== "voided").length,
885
- voidedPayments: order.payment.filter((p) => p.status === "voided").length
888
+ voidedPayments: order.payment.filter((p) => p.status === "voided").length,
889
+ paymentDetails: order.payment.filter((p) => p.status !== "voided").map((p) => ({
890
+ code: p.code,
891
+ amount: p.amount,
892
+ rounding_amount: p.rounding_amount || "0.00",
893
+ effective_amount: new import_decimal.Decimal(p.amount || 0).plus(new import_decimal.Decimal(p.rounding_amount || 0).abs()).toFixed(2)
894
+ })),
895
+ 说明: "有效支付金额包含抹零计算(amount + |rounding_amount|)"
886
896
  });
887
897
  }
888
898
  /**
@@ -222,6 +222,15 @@ export interface PaymentItemInput {
222
222
  rounding_amount?: string;
223
223
  /** 订单支付类型 */
224
224
  order_payment_type?: 'normal' | 'deposit';
225
+ /** 扩展参数字段 */
226
+ metadata?: {
227
+ /** 钱箱 ID */
228
+ shop_wallet_pass_id?: string;
229
+ /** 唯一支付号 */
230
+ unique_payment_number?: string;
231
+ /** rounding规则 */
232
+ rounding_rule?: any;
233
+ };
225
234
  }
226
235
  /**
227
236
  * 推送支付项参数
@@ -314,7 +314,7 @@ export declare class BookingByStepImpl extends BaseModule implements Module {
314
314
  }[];
315
315
  setOtherData(key: string, value: any): void;
316
316
  getOtherData(key: string): any;
317
- getProductTypeById(id: number): Promise<"duration" | "session" | "normal">;
317
+ getProductTypeById(id: number): Promise<"normal" | "duration" | "session">;
318
318
  /**
319
319
  * 提供给 UI 的方法,减轻 UI 层的计算压力,UI 层只需要传递 cartItemId 和 resourceCode 即返回对应的 renderList
320
320
  *
@@ -940,9 +940,15 @@ var CheckoutImpl = class extends import_BaseModule.BaseModule {
940
940
  );
941
941
  }
942
942
  const orderPaymentType = this.store.currentOrder.is_deposit === 1 ? "deposit" : "normal";
943
+ const metadata = {
944
+ ...paymentItem.metadata,
945
+ rounding_rule: this.otherParams.order_rounding_setting,
946
+ shop_wallet_pass_id: this.otherParams.shop_wallet_pass_id
947
+ };
943
948
  const paymentItemWithType = {
944
949
  ...paymentItem,
945
- order_payment_type: orderPaymentType
950
+ order_payment_type: orderPaymentType,
951
+ metadata
946
952
  };
947
953
  console.log("[Checkout] 为当前订单添加支付项:", {
948
954
  orderUuid: this.store.currentOrder.uuid,
@@ -954,7 +960,8 @@ var CheckoutImpl = class extends import_BaseModule.BaseModule {
954
960
  service_charge: paymentItemWithType.service_charge,
955
961
  rounding_amount: paymentItemWithType.rounding_amount,
956
962
  voucher_id: paymentItemWithType.voucher_id,
957
- order_payment_type: paymentItemWithType.order_payment_type
963
+ order_payment_type: paymentItemWithType.order_payment_type,
964
+ metadata: paymentItemWithType.metadata
958
965
  },
959
966
  orderDepositStatus: this.store.currentOrder.is_deposit,
960
967
  calculatedOrderPaymentType: orderPaymentType
@@ -1112,9 +1119,15 @@ var CheckoutImpl = class extends import_BaseModule.BaseModule {
1112
1119
  `代金券支付项缺少 voucher_id: ${JSON.stringify(item)}`
1113
1120
  );
1114
1121
  }
1122
+ const metadata = {
1123
+ ...item.metadata,
1124
+ rounding_rule: this.otherParams.order_rounding_setting,
1125
+ shop_wallet_pass_id: this.otherParams.shop_wallet_pass_id
1126
+ };
1115
1127
  return {
1116
1128
  ...item,
1117
- order_payment_type: orderPaymentType
1129
+ order_payment_type: orderPaymentType,
1130
+ metadata
1118
1131
  };
1119
1132
  });
1120
1133
  console.log("[Checkout] 代金券支付项订单支付类型设置:", {
@@ -1984,13 +1997,21 @@ var CheckoutImpl = class extends import_BaseModule.BaseModule {
1984
1997
  uuid: p.uuid,
1985
1998
  amount: p.amount,
1986
1999
  code: p.code,
1987
- status: p.status
2000
+ status: p.status,
2001
+ rounding_amount: p.rounding_amount
1988
2002
  }))
1989
2003
  });
1990
2004
  const paidAmount = payments.filter((payment) => payment.status !== "voided").reduce((sum, payment) => {
1991
2005
  const amount = parseFloat(payment.amount || "0");
1992
- console.log(`[Checkout] 计算支付项: ${payment.code} = ${amount}`);
1993
- return sum + amount;
2006
+ const roundingAmount = parseFloat(payment.rounding_amount || "0");
2007
+ const effectiveAmount = amount + Math.abs(roundingAmount);
2008
+ console.log(`[Checkout] 计算支付项: ${payment.code}`, {
2009
+ 原始金额: amount,
2010
+ 抹零金额: roundingAmount,
2011
+ 有效金额: effectiveAmount,
2012
+ 说明: roundingAmount !== 0 ? `抹零金额 ${roundingAmount} 元,有效支付增加 ${Math.abs(roundingAmount)} 元` : "无抹零"
2013
+ });
2014
+ return sum + effectiveAmount;
1994
2015
  }, 0);
1995
2016
  const result = paidAmount.toFixed(2);
1996
2017
  console.log("[Checkout] calculatePaidAmountAsync: 计算结果 =", result);
@@ -2017,7 +2038,8 @@ var CheckoutImpl = class extends import_BaseModule.BaseModule {
2017
2038
  totalAmount: totalAmount.toFixed(2),
2018
2039
  paidAmount: paidAmount.toFixed(2),
2019
2040
  calculatedRemaining: remainingAmount.toFixed(2),
2020
- finalResult: result
2041
+ finalResult: result,
2042
+ 说明: "已支付金额包含抹零计算(amount + |rounding_amount|)"
2021
2043
  });
2022
2044
  return result;
2023
2045
  }
@@ -2137,6 +2159,8 @@ var CheckoutImpl = class extends import_BaseModule.BaseModule {
2137
2159
  uuid: p.uuid,
2138
2160
  code: p.code,
2139
2161
  amount: p.amount,
2162
+ rounding_amount: p.rounding_amount,
2163
+ effective_amount: (parseFloat(p.amount || "0") + Math.abs(parseFloat(p.rounding_amount || "0"))).toFixed(2),
2140
2164
  voucher_id: p.voucher_id,
2141
2165
  status: p.status
2142
2166
  }))
@@ -2261,7 +2285,8 @@ var CheckoutImpl = class extends import_BaseModule.BaseModule {
2261
2285
  amount: p.amount,
2262
2286
  uniquePaymentNumber: (_a2 = p.metadata) == null ? void 0 : _a2.unique_payment_number,
2263
2287
  voucherId: p.voucher_id,
2264
- orderPaymentType: p.order_payment_type
2288
+ orderPaymentType: p.order_payment_type,
2289
+ metadata: p.metadata
2265
2290
  };
2266
2291
  })
2267
2292
  });
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "private": false,
3
3
  "name": "@pisell/pisellos",
4
- "version": "0.0.247",
4
+ "version": "0.0.248",
5
5
  "description": "一个可扩展的前端模块化SDK框架,支持插件系统",
6
6
  "main": "dist/index.js",
7
7
  "types": "dist/index.d.ts",