@pisell/private-materials 6.8.23 → 6.8.25

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.
@@ -680,9 +680,10 @@ var Footer = function Footer(props) {
680
680
  setCheckoutLoading(false);
681
681
  setPaymentCallback(function () {
682
682
  return function (paymentResult) {
683
+ var _paymentResult$respon;
683
684
  console.log('Payment result:', paymentResult);
684
685
  setIsPaymentModalOpen(false);
685
- if ((paymentResult === null || paymentResult === void 0 ? void 0 : paymentResult.status) === 'success') {
686
+ if ((paymentResult === null || paymentResult === void 0 ? void 0 : paymentResult.status) === 'success' || (paymentResult === null || paymentResult === void 0 || (_paymentResult$respon = paymentResult.response) === null || _paymentResult$respon === void 0 || (_paymentResult$respon = _paymentResult$respon.data) === null || _paymentResult$respon === void 0 ? void 0 : _paymentResult$respon.payment_status) === 'paid') {
686
687
  var _window5;
687
688
  console.log('Payment completed successfully');
688
689
  (_window5 = window) === null || _window5 === void 0 || (_window5 = _window5.shopApi) === null || _window5 === void 0 || (_window5 = _window5.bookingTicket) === null || _window5 === void 0 || _window5.clearAllCart();
@@ -2219,17 +2219,6 @@ var PaymentModal = function PaymentModal(_ref18) {
2219
2219
  autoCloseConfig.maskClosable = false;
2220
2220
  }
2221
2221
 
2222
- // 根据支付状态展示不同的 toast
2223
- _context22.next = 32;
2224
- return displayPaymentResultToast({
2225
- paymentStatus: paymentStatus,
2226
- orderTotalAmount: _orderInfo3.isDeposit ? _orderInfo3.depositAmount : orderTotalAmount,
2227
- gapAmount: paymentStatus === 'partially_paid' ? gapAmount : currentChangeGivenAmount,
2228
- failureReason: failureReason,
2229
- autoCloseConfig: autoCloseConfig,
2230
- actionButtons: generateActionButtons(paymentStatus, enabledAutoPrint)
2231
- }, paymentResultToastConfig);
2232
- case 32:
2233
2222
  // 当支付状态为 paid 时,关闭 paymentModal
2234
2223
  if (paymentStatus === 'paid') {
2235
2224
  handleModalClose();
@@ -2245,6 +2234,17 @@ var PaymentModal = function PaymentModal(_ref18) {
2245
2234
  }
2246
2235
  });
2247
2236
  handlePaymentComplete(paymentResult);
2237
+ // 根据支付状态展示不同的 toast
2238
+ _context22.next = 35;
2239
+ return displayPaymentResultToast({
2240
+ paymentStatus: paymentStatus,
2241
+ orderTotalAmount: _orderInfo3.isDeposit ? _orderInfo3.depositAmount : orderTotalAmount,
2242
+ gapAmount: paymentStatus === 'partially_paid' ? gapAmount : currentChangeGivenAmount,
2243
+ failureReason: failureReason,
2244
+ autoCloseConfig: autoCloseConfig,
2245
+ actionButtons: generateActionButtons(paymentStatus, enabledAutoPrint)
2246
+ }, paymentResultToastConfig);
2247
+ case 35:
2248
2248
  _context22.next = 38;
2249
2249
  break;
2250
2250
  case 37:
@@ -500,18 +500,18 @@ var Footer = (props) => {
500
500
  setIsPaymentModalOpen(true);
501
501
  setCheckoutLoading(false);
502
502
  setPaymentCallback(() => (paymentResult) => {
503
- var _a3, _b3, _c3, _d2, _e2, _f2;
503
+ var _a3, _b3, _c3, _d2, _e2, _f2, _g2, _h2;
504
504
  console.log("Payment result:", paymentResult);
505
505
  setIsPaymentModalOpen(false);
506
- if ((paymentResult == null ? void 0 : paymentResult.status) === "success") {
506
+ if ((paymentResult == null ? void 0 : paymentResult.status) === "success" || ((_b3 = (_a3 = paymentResult == null ? void 0 : paymentResult.response) == null ? void 0 : _a3.data) == null ? void 0 : _b3.payment_status) === "paid") {
507
507
  console.log("Payment completed successfully");
508
- (_b3 = (_a3 = window == null ? void 0 : window.shopApi) == null ? void 0 : _a3.bookingTicket) == null ? void 0 : _b3.clearAllCart();
508
+ (_d2 = (_c3 = window == null ? void 0 : window.shopApi) == null ? void 0 : _c3.bookingTicket) == null ? void 0 : _d2.clearAllCart();
509
509
  setPaymentModalData(null);
510
510
  setPaymentCallback(null);
511
511
  } else if ((paymentResult == null ? void 0 : paymentResult.status) === "cancelled") {
512
512
  console.log("Payment cancelled");
513
513
  if (res == null ? void 0 : res.order_id) {
514
- (_d2 = (_c3 = window == null ? void 0 : window.shopApi) == null ? void 0 : _c3.booking) == null ? void 0 : _d2.voidBooking(res.order_id);
514
+ (_f2 = (_e2 = window == null ? void 0 : window.shopApi) == null ? void 0 : _e2.booking) == null ? void 0 : _f2.voidBooking(res.order_id);
515
515
  }
516
516
  setPaymentModalData(null);
517
517
  setPaymentCallback(null);
@@ -519,7 +519,7 @@ var Footer = (props) => {
519
519
  console.log("Payment status:", paymentResult == null ? void 0 : paymentResult.status);
520
520
  setPaymentModalData(null);
521
521
  setPaymentCallback(null);
522
- (_f2 = (_e2 = window == null ? void 0 : window.shopApi) == null ? void 0 : _e2.bookingTicket) == null ? void 0 : _f2.clearAllCart();
522
+ (_h2 = (_g2 = window == null ? void 0 : window.shopApi) == null ? void 0 : _g2.bookingTicket) == null ? void 0 : _h2.clearAllCart();
523
523
  }
524
524
  });
525
525
  } else {
@@ -1566,17 +1566,6 @@ var PaymentModal = ({
1566
1566
  autoCloseConfig.autoCloseDelay = 0;
1567
1567
  autoCloseConfig.maskClosable = false;
1568
1568
  }
1569
- await (0, import_PaymentResultToastUtils.displayPaymentResultToast)(
1570
- {
1571
- paymentStatus,
1572
- orderTotalAmount: orderInfo3.isDeposit ? orderInfo3.depositAmount : orderTotalAmount,
1573
- gapAmount: paymentStatus === "partially_paid" ? gapAmount : currentChangeGivenAmount,
1574
- failureReason,
1575
- autoCloseConfig,
1576
- actionButtons: generateActionButtons(paymentStatus, enabledAutoPrint)
1577
- },
1578
- paymentResultToastConfig
1579
- );
1580
1569
  if (paymentStatus === "paid") {
1581
1570
  handleModalClose();
1582
1571
  }
@@ -1590,6 +1579,17 @@ var PaymentModal = ({
1590
1579
  }
1591
1580
  };
1592
1581
  handlePaymentComplete(paymentResult);
1582
+ await (0, import_PaymentResultToastUtils.displayPaymentResultToast)(
1583
+ {
1584
+ paymentStatus,
1585
+ orderTotalAmount: orderInfo3.isDeposit ? orderInfo3.depositAmount : orderTotalAmount,
1586
+ gapAmount: paymentStatus === "partially_paid" ? gapAmount : currentChangeGivenAmount,
1587
+ failureReason,
1588
+ autoCloseConfig,
1589
+ actionButtons: generateActionButtons(paymentStatus, enabledAutoPrint)
1590
+ },
1591
+ paymentResultToastConfig
1592
+ );
1593
1593
  } else {
1594
1594
  handlePaymentComplete(data2);
1595
1595
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@pisell/private-materials",
3
- "version": "6.8.23",
3
+ "version": "6.8.25",
4
4
  "main": "./lib/index.js",
5
5
  "module": "./es/index.js",
6
6
  "types": "./lib/index.d.ts",