@pisell/pisellos 2.2.41 → 2.2.42
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.
|
@@ -1800,7 +1800,7 @@ export var CheckoutImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
1800
1800
|
case 6:
|
|
1801
1801
|
paymentItems = _context18.sent;
|
|
1802
1802
|
if (!(!voucherPaymentItems || (voucherPaymentItems === null || voucherPaymentItems === void 0 ? void 0 : voucherPaymentItems.length) === 0)) {
|
|
1803
|
-
_context18.next =
|
|
1803
|
+
_context18.next = 13;
|
|
1804
1804
|
break;
|
|
1805
1805
|
}
|
|
1806
1806
|
savedVoucherPaymentItems = (paymentItems === null || paymentItems === void 0 ? void 0 : paymentItems.filter(function (item) {
|
|
@@ -1811,22 +1811,23 @@ export var CheckoutImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
1811
1811
|
savedVoucherPaymentItems: savedVoucherPaymentItems
|
|
1812
1812
|
});
|
|
1813
1813
|
if (!((savedVoucherPaymentItems === null || savedVoucherPaymentItems === void 0 ? void 0 : savedVoucherPaymentItems.length) === 0)) {
|
|
1814
|
-
_context18.next =
|
|
1814
|
+
_context18.next = 13;
|
|
1815
1815
|
break;
|
|
1816
1816
|
}
|
|
1817
|
+
this.updateStateAmountToRemaining(false);
|
|
1817
1818
|
return _context18.abrupt("return");
|
|
1818
|
-
case
|
|
1819
|
+
case 13:
|
|
1819
1820
|
allPaymentItemsSynced = paymentItems.every(function (item) {
|
|
1820
1821
|
return item.isSynced;
|
|
1821
1822
|
});
|
|
1822
|
-
_context18.next =
|
|
1823
|
+
_context18.next = 16;
|
|
1823
1824
|
return this.calculateRemainingAmountAsync();
|
|
1824
|
-
case
|
|
1825
|
+
case 16:
|
|
1825
1826
|
remainingAmount = _context18.sent;
|
|
1826
1827
|
remainingValue = new Decimal(remainingAmount);
|
|
1827
1828
|
isOrderSynced = this.store.isOrderSynced;
|
|
1828
1829
|
if (!(remainingValue.lte(0) && isOrderSynced && voucherPaymentItems.length === 0 && allPaymentItemsSynced)) {
|
|
1829
|
-
_context18.next =
|
|
1830
|
+
_context18.next = 22;
|
|
1830
1831
|
break;
|
|
1831
1832
|
}
|
|
1832
1833
|
this.logInfo('订单已同步且支付完成,跳过清空代金券操作避免重复同步:', {
|
|
@@ -1838,7 +1839,7 @@ export var CheckoutImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
1838
1839
|
reason: 'Order synced and payment completed, skip clear vouchers to avoid duplicate sync'
|
|
1839
1840
|
});
|
|
1840
1841
|
return _context18.abrupt("return");
|
|
1841
|
-
case
|
|
1842
|
+
case 22:
|
|
1842
1843
|
this.logInfo('开始批量更新代金券支付项:', {
|
|
1843
1844
|
voucherPaymentItems: voucherPaymentItems
|
|
1844
1845
|
});
|
|
@@ -1860,18 +1861,18 @@ export var CheckoutImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
1860
1861
|
metadata: metadata
|
|
1861
1862
|
});
|
|
1862
1863
|
}); // 调用 Payment 模块的批量更新方法
|
|
1863
|
-
_context18.next =
|
|
1864
|
+
_context18.next = 27;
|
|
1864
1865
|
return this.payment.updateVoucherPaymentItemsAsync(this.store.currentOrder.uuid, voucherPaymentItemsWithType);
|
|
1865
|
-
case
|
|
1866
|
+
case 27:
|
|
1866
1867
|
// 🚀 清除计算缓存,确保获取最新数据
|
|
1867
1868
|
this.clearCalculationCache();
|
|
1868
1869
|
|
|
1869
1870
|
// 重新从Payment模块获取最新的订单数据,确保支付项同步
|
|
1870
1871
|
currentOrderId = this.store.currentOrder.order_id; // 保存当前的订单ID
|
|
1871
1872
|
isCurrentOrderReal = currentOrderId && !isVirtualOrderId(currentOrderId);
|
|
1872
|
-
_context18.next =
|
|
1873
|
+
_context18.next = 32;
|
|
1873
1874
|
return this.payment.getPaymentOrderByUuidAsync(this.store.currentOrder.uuid);
|
|
1874
|
-
case
|
|
1875
|
+
case 32:
|
|
1875
1876
|
updatedOrder = _context18.sent;
|
|
1876
1877
|
if (updatedOrder) {
|
|
1877
1878
|
// 如果当前订单ID是真实ID,但获取到的订单ID是虚拟ID,需要保护真实ID
|
|
@@ -1886,10 +1887,10 @@ export var CheckoutImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
1886
1887
|
}
|
|
1887
1888
|
|
|
1888
1889
|
// 更新 stateAmount 为剩余未支付金额
|
|
1889
|
-
_context18.next =
|
|
1890
|
+
_context18.next = 36;
|
|
1890
1891
|
return this.updateStateAmountToRemaining(false);
|
|
1891
|
-
case
|
|
1892
|
-
_context18.next =
|
|
1892
|
+
case 36:
|
|
1893
|
+
_context18.next = 38;
|
|
1893
1894
|
return this.core.effects.emit("".concat(this.name, ":onPaymentStarted"), {
|
|
1894
1895
|
orderUuid: this.store.currentOrder.uuid,
|
|
1895
1896
|
paymentMethodCode: 'VOUCHER_BATCH',
|
|
@@ -1898,23 +1899,23 @@ export var CheckoutImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
1898
1899
|
}, 0).toFixed(2),
|
|
1899
1900
|
timestamp: Date.now()
|
|
1900
1901
|
});
|
|
1901
|
-
case
|
|
1902
|
+
case 38:
|
|
1902
1903
|
this.logInfo('代金券支付项批量更新成功');
|
|
1903
|
-
_context18.next =
|
|
1904
|
+
_context18.next = 47;
|
|
1904
1905
|
break;
|
|
1905
|
-
case
|
|
1906
|
-
_context18.prev =
|
|
1906
|
+
case 41:
|
|
1907
|
+
_context18.prev = 41;
|
|
1907
1908
|
_context18.t0 = _context18["catch"](0);
|
|
1908
1909
|
this.logError('[Checkout] 批量更新代金券支付项失败:', _context18.t0);
|
|
1909
|
-
_context18.next =
|
|
1910
|
+
_context18.next = 46;
|
|
1910
1911
|
return this.handleError(_context18.t0, CheckoutErrorType.PaymentFailed);
|
|
1911
|
-
case 45:
|
|
1912
|
-
throw _context18.t0;
|
|
1913
1912
|
case 46:
|
|
1913
|
+
throw _context18.t0;
|
|
1914
|
+
case 47:
|
|
1914
1915
|
case "end":
|
|
1915
1916
|
return _context18.stop();
|
|
1916
1917
|
}
|
|
1917
|
-
}, _callee18, this, [[0,
|
|
1918
|
+
}, _callee18, this, [[0, 41]]);
|
|
1918
1919
|
}));
|
|
1919
1920
|
function updateVoucherPaymentItemsAsync(_x18) {
|
|
1920
1921
|
return _updateVoucherPaymentItemsAsync.apply(this, arguments);
|
|
@@ -1212,8 +1212,10 @@ var CheckoutImpl = class extends import_BaseModule.BaseModule {
|
|
|
1212
1212
|
voucherPaymentItems,
|
|
1213
1213
|
savedVoucherPaymentItems
|
|
1214
1214
|
});
|
|
1215
|
-
if ((savedVoucherPaymentItems == null ? void 0 : savedVoucherPaymentItems.length) === 0)
|
|
1215
|
+
if ((savedVoucherPaymentItems == null ? void 0 : savedVoucherPaymentItems.length) === 0) {
|
|
1216
|
+
this.updateStateAmountToRemaining(false);
|
|
1216
1217
|
return;
|
|
1218
|
+
}
|
|
1217
1219
|
}
|
|
1218
1220
|
const allPaymentItemsSynced = paymentItems.every((item) => item.isSynced);
|
|
1219
1221
|
const remainingAmount = await this.calculateRemainingAmountAsync();
|