@pisell/pisellos 2.1.24 → 2.1.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.
|
@@ -841,7 +841,7 @@ export var CheckoutImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
841
841
|
|
|
842
842
|
// 订单ID替换后更新 stateAmount
|
|
843
843
|
_context12.next = 15;
|
|
844
|
-
return this.updateStateAmountToRemaining();
|
|
844
|
+
return this.updateStateAmountToRemaining(false);
|
|
845
845
|
case 15:
|
|
846
846
|
return _context12.abrupt("return", updatedOrder);
|
|
847
847
|
case 18:
|
|
@@ -1129,30 +1129,29 @@ export var CheckoutImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
1129
1129
|
_context15.next = 38;
|
|
1130
1130
|
return this.handleError(new Error("EFTPOS \u652F\u4ED8\u540E\u8BA2\u5355\u540C\u6B65\u5931\u8D25: ".concat(_context15.t0 instanceof Error ? _context15.t0.message : String(_context15.t0))), CheckoutErrorType.OrderCreationFailed);
|
|
1131
1131
|
case 38:
|
|
1132
|
-
|
|
1133
|
-
|
|
1132
|
+
// 触发支付项添加事件(可以复用支付开始事件)
|
|
1133
|
+
this.core.effects.emit(CheckoutHooks.OnPaymentItemAdded, {
|
|
1134
1134
|
orderUuid: this.store.currentOrder.uuid,
|
|
1135
1135
|
paymentMethodCode: paymentItem.code,
|
|
1136
1136
|
paymentMethodName: paymentItem.name,
|
|
1137
1137
|
amount: String(paymentItem.amount),
|
|
1138
1138
|
timestamp: Date.now()
|
|
1139
1139
|
});
|
|
1140
|
-
|
|
1141
|
-
_context15.next = 48;
|
|
1140
|
+
_context15.next = 47;
|
|
1142
1141
|
break;
|
|
1143
|
-
case
|
|
1144
|
-
_context15.prev =
|
|
1142
|
+
case 41:
|
|
1143
|
+
_context15.prev = 41;
|
|
1145
1144
|
_context15.t1 = _context15["catch"](1);
|
|
1146
1145
|
this.logError('添加支付项失败:', _context15.t1);
|
|
1147
|
-
_context15.next =
|
|
1146
|
+
_context15.next = 46;
|
|
1148
1147
|
return this.handleError(_context15.t1, CheckoutErrorType.PaymentFailed);
|
|
1149
|
-
case
|
|
1148
|
+
case 46:
|
|
1150
1149
|
throw _context15.t1;
|
|
1151
|
-
case
|
|
1150
|
+
case 47:
|
|
1152
1151
|
case "end":
|
|
1153
1152
|
return _context15.stop();
|
|
1154
1153
|
}
|
|
1155
|
-
}, _callee15, this, [[1,
|
|
1154
|
+
}, _callee15, this, [[1, 41], [26, 33]]);
|
|
1156
1155
|
}));
|
|
1157
1156
|
function addPaymentItemAsync(_x14) {
|
|
1158
1157
|
return _addPaymentItemAsync.apply(this, arguments);
|
|
@@ -1362,7 +1361,7 @@ export var CheckoutImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
1362
1361
|
|
|
1363
1362
|
// 更新 stateAmount 为剩余未支付金额
|
|
1364
1363
|
_context17.next = 24;
|
|
1365
|
-
return this.updateStateAmountToRemaining();
|
|
1364
|
+
return this.updateStateAmountToRemaining(false);
|
|
1366
1365
|
case 24:
|
|
1367
1366
|
_context17.next = 26;
|
|
1368
1367
|
return this.core.effects.emit(CheckoutHooks.OnPaymentStarted, {
|
|
@@ -2669,14 +2668,18 @@ export var CheckoutImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
2669
2668
|
key: "updateStateAmountToRemaining",
|
|
2670
2669
|
value: (function () {
|
|
2671
2670
|
var _updateStateAmountToRemaining = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee33() {
|
|
2672
|
-
var
|
|
2671
|
+
var checkOrder,
|
|
2672
|
+
remainingAmount,
|
|
2673
|
+
currentStateAmount,
|
|
2674
|
+
_args33 = arguments;
|
|
2673
2675
|
return _regeneratorRuntime().wrap(function _callee33$(_context33) {
|
|
2674
2676
|
while (1) switch (_context33.prev = _context33.next) {
|
|
2675
2677
|
case 0:
|
|
2676
|
-
|
|
2677
|
-
_context33.
|
|
2678
|
+
checkOrder = _args33.length > 0 && _args33[0] !== undefined ? _args33[0] : true;
|
|
2679
|
+
_context33.prev = 1;
|
|
2680
|
+
_context33.next = 4;
|
|
2678
2681
|
return this.calculateRemainingAmountAsync();
|
|
2679
|
-
case
|
|
2682
|
+
case 4:
|
|
2680
2683
|
remainingAmount = _context33.sent;
|
|
2681
2684
|
currentStateAmount = this.store.stateAmount; // 只有当剩余金额与当前 stateAmount 不同时才更新
|
|
2682
2685
|
if (remainingAmount !== currentStateAmount) {
|
|
@@ -2700,23 +2703,27 @@ export var CheckoutImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
2700
2703
|
}
|
|
2701
2704
|
|
|
2702
2705
|
// 同步更新系统内部的 balanceDueAmount
|
|
2703
|
-
_context33.next =
|
|
2706
|
+
_context33.next = 9;
|
|
2704
2707
|
return this.updateBalanceDueAmount();
|
|
2705
|
-
case
|
|
2706
|
-
|
|
2708
|
+
case 9:
|
|
2709
|
+
if (!checkOrder) {
|
|
2710
|
+
_context33.next = 12;
|
|
2711
|
+
break;
|
|
2712
|
+
}
|
|
2713
|
+
_context33.next = 12;
|
|
2707
2714
|
return this.checkOrderPaymentCompletion();
|
|
2708
|
-
case 10:
|
|
2709
|
-
_context33.next = 15;
|
|
2710
|
-
break;
|
|
2711
2715
|
case 12:
|
|
2712
|
-
_context33.
|
|
2713
|
-
|
|
2716
|
+
_context33.next = 17;
|
|
2717
|
+
break;
|
|
2718
|
+
case 14:
|
|
2719
|
+
_context33.prev = 14;
|
|
2720
|
+
_context33.t0 = _context33["catch"](1);
|
|
2714
2721
|
this.logError('更新 stateAmount 为剩余金额失败:', _context33.t0);
|
|
2715
|
-
case
|
|
2722
|
+
case 17:
|
|
2716
2723
|
case "end":
|
|
2717
2724
|
return _context33.stop();
|
|
2718
2725
|
}
|
|
2719
|
-
}, _callee33, this, [[
|
|
2726
|
+
}, _callee33, this, [[1, 14]]);
|
|
2720
2727
|
}));
|
|
2721
2728
|
function updateStateAmountToRemaining() {
|
|
2722
2729
|
return _updateStateAmountToRemaining.apply(this, arguments);
|
|
@@ -504,7 +504,7 @@ var CheckoutImpl = class extends import_BaseModule.BaseModule {
|
|
|
504
504
|
newOrderId: updatedOrder.id
|
|
505
505
|
});
|
|
506
506
|
this.store.isOrderSynced = true;
|
|
507
|
-
await this.updateStateAmountToRemaining();
|
|
507
|
+
await this.updateStateAmountToRemaining(false);
|
|
508
508
|
}
|
|
509
509
|
return updatedOrder;
|
|
510
510
|
} catch (error) {
|
|
@@ -687,7 +687,7 @@ var CheckoutImpl = class extends import_BaseModule.BaseModule {
|
|
|
687
687
|
}
|
|
688
688
|
}
|
|
689
689
|
}
|
|
690
|
-
|
|
690
|
+
this.core.effects.emit(import_types.CheckoutHooks.OnPaymentItemAdded, {
|
|
691
691
|
orderUuid: this.store.currentOrder.uuid,
|
|
692
692
|
paymentMethodCode: paymentItem.code,
|
|
693
693
|
paymentMethodName: paymentItem.name,
|
|
@@ -852,7 +852,7 @@ var CheckoutImpl = class extends import_BaseModule.BaseModule {
|
|
|
852
852
|
}
|
|
853
853
|
this.store.currentOrder = updatedOrder;
|
|
854
854
|
}
|
|
855
|
-
await this.updateStateAmountToRemaining();
|
|
855
|
+
await this.updateStateAmountToRemaining(false);
|
|
856
856
|
await this.core.effects.emit(import_types.CheckoutHooks.OnPaymentStarted, {
|
|
857
857
|
orderUuid: this.store.currentOrder.uuid,
|
|
858
858
|
paymentMethodCode: "VOUCHER_BATCH",
|
|
@@ -1640,7 +1640,7 @@ var CheckoutImpl = class extends import_BaseModule.BaseModule {
|
|
|
1640
1640
|
/**
|
|
1641
1641
|
* 更新 stateAmount 为当前剩余未支付金额
|
|
1642
1642
|
*/
|
|
1643
|
-
async updateStateAmountToRemaining() {
|
|
1643
|
+
async updateStateAmountToRemaining(checkOrder = true) {
|
|
1644
1644
|
try {
|
|
1645
1645
|
const remainingAmount = await this.calculateRemainingAmountAsync();
|
|
1646
1646
|
const currentStateAmount = this.store.stateAmount;
|
|
@@ -1662,7 +1662,9 @@ var CheckoutImpl = class extends import_BaseModule.BaseModule {
|
|
|
1662
1662
|
});
|
|
1663
1663
|
}
|
|
1664
1664
|
await this.updateBalanceDueAmount();
|
|
1665
|
-
|
|
1665
|
+
if (checkOrder) {
|
|
1666
|
+
await this.checkOrderPaymentCompletion();
|
|
1667
|
+
}
|
|
1666
1668
|
} catch (error) {
|
|
1667
1669
|
this.logError("更新 stateAmount 为剩余金额失败:", error);
|
|
1668
1670
|
}
|