@pisell/pisellos 2.3.226 → 2.3.228
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/Customer/types.d.ts +0 -4
- package/dist/modules/Order/index.d.ts +2 -0
- package/dist/modules/Order/index.js +82 -125
- package/dist/modules/Order/types.d.ts +0 -2
- package/dist/modules/Order/utils.js +0 -2
- package/dist/modules/Product/index.d.ts +1 -1
- package/dist/modules/Rules/index.js +1 -1
- package/dist/modules/Rules/types.d.ts +2 -0
- package/dist/modules/Summary/utils.d.ts +1 -1
- package/dist/solution/BaseSales/index.js +0 -3
- package/dist/solution/BookingByStep/index.d.ts +2 -2
- package/dist/solution/BookingTicket/utils/redeemArrival.d.ts +14 -14
- package/dist/solution/Checkout/index.js +69 -104
- package/dist/solution/Checkout/types.d.ts +0 -1
- package/dist/solution/ScanOrder/additionalOrderPayload.d.ts +40 -0
- package/dist/solution/ScanOrder/additionalOrderPayload.js +52 -0
- package/dist/solution/ScanOrder/index.js +13 -19
- package/dist/solution/UnifiedBookingSales/draftDiscounts.d.ts +8 -0
- package/dist/solution/UnifiedBookingSales/draftDiscounts.js +101 -0
- package/dist/solution/UnifiedBookingSales/index.d.ts +7 -0
- package/dist/solution/UnifiedBookingSales/index.js +1253 -1072
- package/dist/solution/UnifiedBookingSales/types.d.ts +5 -0
- package/dist/solution/VenueBooking/index.js +490 -522
- package/lib/model/strategy/adapter/promotion/index.js +46 -1
- package/lib/modules/Customer/types.d.ts +0 -4
- package/lib/modules/Order/index.d.ts +2 -0
- package/lib/modules/Order/index.js +9 -46
- package/lib/modules/Order/types.d.ts +0 -2
- package/lib/modules/Order/utils.js +1 -5
- package/lib/modules/Product/index.d.ts +1 -1
- package/lib/modules/Rules/index.js +1 -1
- package/lib/modules/Rules/types.d.ts +2 -0
- package/lib/modules/Summary/utils.d.ts +1 -1
- package/lib/solution/BaseSales/index.js +0 -3
- package/lib/solution/BookingByStep/index.d.ts +2 -2
- package/lib/solution/BookingTicket/utils/redeemArrival.d.ts +14 -14
- package/lib/solution/Checkout/index.js +0 -21
- package/lib/solution/Checkout/types.d.ts +0 -1
- package/lib/solution/ScanOrder/additionalOrderPayload.d.ts +40 -0
- package/lib/solution/ScanOrder/additionalOrderPayload.js +50 -0
- package/lib/solution/ScanOrder/index.js +5 -9
- package/lib/solution/UnifiedBookingSales/draftDiscounts.d.ts +8 -0
- package/lib/solution/UnifiedBookingSales/draftDiscounts.js +36 -0
- package/lib/solution/UnifiedBookingSales/index.d.ts +7 -0
- package/lib/solution/UnifiedBookingSales/index.js +78 -0
- package/lib/solution/UnifiedBookingSales/types.d.ts +5 -0
- package/lib/solution/VenueBooking/index.js +1 -6
- package/package.json +1 -1
- package/dist/modules/Order/utils/bookingUuid.d.ts +0 -4
- package/dist/modules/Order/utils/bookingUuid.js +0 -24
- package/lib/modules/Order/utils/bookingUuid.d.ts +0 -4
- package/lib/modules/Order/utils/bookingUuid.js +0 -25
|
@@ -25,28 +25,23 @@ export declare function buildArrivalCheckoutQuery(order: OrderTempOrder, summary
|
|
|
25
25
|
notes?: import("../../../modules/Order/types").SalesNote[] | undefined;
|
|
26
26
|
summary?: import("../../../modules/Order/types").OrderSummary | undefined;
|
|
27
27
|
small_ticket_data_flag?: number | undefined;
|
|
28
|
-
status: string;
|
|
29
28
|
metadata: Record<string, any>;
|
|
30
|
-
business_code?: string | undefined;
|
|
31
|
-
customer_id: number | null;
|
|
32
|
-
type: string;
|
|
33
|
-
holder: Record<string, any> | null;
|
|
34
|
-
email: string;
|
|
35
|
-
phone: string;
|
|
36
29
|
note: string;
|
|
37
|
-
relation_forms: any[];
|
|
38
|
-
holder_relations?: import("../../../modules/Order/types").OrderHolderRelation[] | undefined;
|
|
39
|
-
country_calling_code: string;
|
|
40
|
-
contacts_info: Record<string, any> | null;
|
|
41
30
|
order_id: number | null;
|
|
42
|
-
external_sale_number: string;
|
|
43
31
|
order_number: string | null;
|
|
44
32
|
shop_order_number: string | null;
|
|
45
33
|
shop_full_order_number: string | null;
|
|
34
|
+
type: string;
|
|
35
|
+
business_code?: string | undefined;
|
|
46
36
|
sales_channel: string;
|
|
47
37
|
order_sales_channel: string;
|
|
38
|
+
status: string;
|
|
48
39
|
shipping_status: string;
|
|
40
|
+
customer_id: number | null;
|
|
49
41
|
customer_name: string;
|
|
42
|
+
country_calling_code: string;
|
|
43
|
+
phone: string;
|
|
44
|
+
email: string;
|
|
50
45
|
is_price_include_tax: number;
|
|
51
46
|
tax_title: string;
|
|
52
47
|
tax_country_code: string;
|
|
@@ -63,10 +58,15 @@ export declare function buildArrivalCheckoutQuery(order: OrderTempOrder, summary
|
|
|
63
58
|
schedule_date: string;
|
|
64
59
|
bookings: any[];
|
|
65
60
|
payments: any[];
|
|
66
|
-
order_meta_list?: import("../../../modules/Order/types").OrderMetaList | undefined;
|
|
67
|
-
refunds?: any[] | undefined;
|
|
68
61
|
surcharges: any[];
|
|
62
|
+
relation_forms: any[];
|
|
69
63
|
contacts: any[];
|
|
64
|
+
contacts_info: Record<string, any> | null;
|
|
65
|
+
holder: Record<string, any> | null;
|
|
66
|
+
external_sale_number: string;
|
|
67
|
+
holder_relations?: import("../../../modules/Order/types").OrderHolderRelation[] | undefined;
|
|
68
|
+
refunds?: any[] | undefined;
|
|
69
|
+
order_meta_list?: import("../../../modules/Order/types").OrderMetaList | undefined;
|
|
70
70
|
};
|
|
71
71
|
export declare function describeChangedBookings(before: OrderTempOrder['bookings'], after: OrderTempOrder['bookings']): {
|
|
72
72
|
schedule_event_id: any;
|
|
@@ -31,8 +31,6 @@ function _toPrimitive(t, r) { if ("object" != _typeof(t) || !t) return t; var e
|
|
|
31
31
|
import { BaseModule } from "../../modules/BaseModule";
|
|
32
32
|
import Decimal from 'decimal.js';
|
|
33
33
|
import { OrderModule } from "../../modules/Order";
|
|
34
|
-
import { assignBookingUuid } from "../../modules/Order/utils/bookingUuid";
|
|
35
|
-
import { getOrderCollectionUid } from "../../modules/Order/utils/orderCollectionIdentity";
|
|
36
34
|
import { PaymentModule } from "../../modules/Payment";
|
|
37
35
|
import { CheckoutErrorType } from "./types";
|
|
38
36
|
import { PaymentStatus, PaymentHooks } from "../../modules/Payment/types";
|
|
@@ -607,7 +605,7 @@ export var CheckoutImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
607
605
|
value: (function () {
|
|
608
606
|
var _createLocalOrderAsync = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee9(params) {
|
|
609
607
|
var _params$orderData, _params$orderData2, _params$orderData3, _params$orderData4, _params$orderData5, _params$cartSummary;
|
|
610
|
-
var _params$totalInfo, _params$totalInfo2, _params$totalInfo3, _params$totalInfo4,
|
|
608
|
+
var _params$totalInfo, _params$totalInfo2, _params$totalInfo3, _params$totalInfo4, validation, localOrderId, amountInfo, customerInfo, isNeedDeposit, paymentOrder, updateAmountStartTime, updateAmountDuration;
|
|
611
609
|
return _regeneratorRuntime().wrap(function _callee9$(_context9) {
|
|
612
610
|
while (1) switch (_context9.prev = _context9.next) {
|
|
613
611
|
case 0:
|
|
@@ -647,7 +645,6 @@ export var CheckoutImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
647
645
|
params.orderData.tax_fee = (_params$totalInfo4 = params.totalInfo) === null || _params$totalInfo4 === void 0 || (_params$totalInfo4 = _params$totalInfo4.total) === null || _params$totalInfo4 === void 0 ? void 0 : _params$totalInfo4.tax;
|
|
648
646
|
|
|
649
647
|
// 保存原始订单数据和小计数据到状态中
|
|
650
|
-
(_params$orderData$boo = params.orderData.bookings) === null || _params$orderData$boo === void 0 || _params$orderData$boo.forEach(assignBookingUuid);
|
|
651
648
|
this.store.localOrderData = params.orderData;
|
|
652
649
|
this.store.cartSummary = params.cartSummary;
|
|
653
650
|
|
|
@@ -664,7 +661,7 @@ export var CheckoutImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
664
661
|
|
|
665
662
|
// 计算是否需要支付定金,如果需要默认切换到定金模式,以及记录定金总金额,并把当前默认待付金额调整为定金总金额
|
|
666
663
|
isNeedDeposit = this.checkIsNeedDepositAsync(params.orderData.bookings, params.orderData.relation_products); // 创建支付订单对象
|
|
667
|
-
_context9.next =
|
|
664
|
+
_context9.next = 21;
|
|
668
665
|
return this.payment.createPaymentOrderAsync({
|
|
669
666
|
order_id: localOrderId,
|
|
670
667
|
total_amount: amountInfo.totalAmount,
|
|
@@ -681,7 +678,7 @@ export var CheckoutImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
681
678
|
amount_breakdown: amountInfo
|
|
682
679
|
}
|
|
683
680
|
});
|
|
684
|
-
case
|
|
681
|
+
case 21:
|
|
685
682
|
paymentOrder = _context9.sent;
|
|
686
683
|
this.store.currentOrder = paymentOrder;
|
|
687
684
|
|
|
@@ -698,9 +695,9 @@ export var CheckoutImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
698
695
|
// 自动设置 stateAmount 为剩余未支付金额
|
|
699
696
|
// 🚀 性能监控:记录 updateStateAmountToRemaining 操作耗时
|
|
700
697
|
updateAmountStartTime = Date.now();
|
|
701
|
-
_context9.next =
|
|
698
|
+
_context9.next = 27;
|
|
702
699
|
return this.updateStateAmountToRemaining(false);
|
|
703
|
-
case
|
|
700
|
+
case 27:
|
|
704
701
|
updateAmountDuration = Date.now() - updateAmountStartTime;
|
|
705
702
|
this.logInfo('updateStateAmountToRemaining operation completed', {
|
|
706
703
|
operation: 'updateStateAmountToRemaining',
|
|
@@ -719,23 +716,23 @@ export var CheckoutImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
719
716
|
});
|
|
720
717
|
this.initWalletData();
|
|
721
718
|
return _context9.abrupt("return", paymentOrder);
|
|
722
|
-
case
|
|
723
|
-
_context9.prev =
|
|
719
|
+
case 34:
|
|
720
|
+
_context9.prev = 34;
|
|
724
721
|
_context9.t0 = _context9["catch"](1);
|
|
725
|
-
_context9.next =
|
|
722
|
+
_context9.next = 38;
|
|
726
723
|
return this.handleError(_context9.t0, CheckoutErrorType.OrderCreationFailed);
|
|
727
|
-
case
|
|
724
|
+
case 38:
|
|
728
725
|
this.logError('本地订单创建失败:', _context9.t0);
|
|
729
726
|
this.core.effects.emit("".concat(this.name, ":onOrderCreationFailed"), {
|
|
730
727
|
error: this.store.lastError,
|
|
731
728
|
timestamp: Date.now()
|
|
732
729
|
});
|
|
733
730
|
throw _context9.t0;
|
|
734
|
-
case
|
|
731
|
+
case 41:
|
|
735
732
|
case "end":
|
|
736
733
|
return _context9.stop();
|
|
737
734
|
}
|
|
738
|
-
}, _callee9, this, [[1,
|
|
735
|
+
}, _callee9, this, [[1, 34]]);
|
|
739
736
|
}));
|
|
740
737
|
function createLocalOrderAsync(_x11) {
|
|
741
738
|
return _createLocalOrderAsync.apply(this, arguments);
|
|
@@ -753,8 +750,8 @@ export var CheckoutImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
753
750
|
key: "updateLocalOrderAsync",
|
|
754
751
|
value: (function () {
|
|
755
752
|
var _updateLocalOrderAsync = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee10(params) {
|
|
756
|
-
var _params$orderData6, _params$orderData7, _params$cartSummary2, _params$totalInfo5, _params$totalInfo6, _params$totalInfo7, _params$totalInfo8,
|
|
757
|
-
var validation, amountInfo, customerInfo, allOrders, existingOrder,
|
|
753
|
+
var _params$orderData6, _params$orderData7, _params$cartSummary2, _params$totalInfo5, _params$totalInfo6, _params$totalInfo7, _params$totalInfo8, _this$store$currentOr9, _this$store$currentOr10;
|
|
754
|
+
var validation, amountInfo, customerInfo, allOrders, existingOrder, _updated$payment2, _existingOrder$paymen, _updated$payment, currentTime, formattedExistPayments, _isNeedDeposit, _updated, syncedPayments, _syncedAmount, _totalAmount, _remainingExpectAmount, _depositDiffAmount, totalAmount, activePayments, paidAmount, remaining, _isNeedDeposit2, updated, syncedAmount, remainingExpectAmount, depositDiffAmount, isNeedDeposit, created, _syncedPayments, _syncedAmount2;
|
|
758
755
|
return _regeneratorRuntime().wrap(function _callee10$(_context10) {
|
|
759
756
|
while (1) switch (_context10.prev = _context10.next) {
|
|
760
757
|
case 0:
|
|
@@ -806,45 +803,13 @@ export var CheckoutImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
806
803
|
allOrders = _context10.sent;
|
|
807
804
|
existingOrder = allOrders.find(function (o) {
|
|
808
805
|
return String(o.id) === String(params.orderId) || String(o.order_id) === String(params.orderId);
|
|
809
|
-
});
|
|
810
|
-
previousBookings = existingOrder === null || existingOrder === void 0 || (_existingOrder$order_ = existingOrder.order_info) === null || _existingOrder$order_ === void 0 || (_existingOrder$order_ = _existingOrder$order_.original_order_data) === null || _existingOrder$order_ === void 0 ? void 0 : _existingOrder$order_.bookings;
|
|
811
|
-
previousUuids = new Map();
|
|
812
|
-
if (Array.isArray(previousBookings)) {
|
|
813
|
-
_iterator = _createForOfIteratorHelper(previousBookings);
|
|
814
|
-
try {
|
|
815
|
-
for (_iterator.s(); !(_step = _iterator.n()).done;) {
|
|
816
|
-
booking = _step.value;
|
|
817
|
-
uid = getOrderCollectionUid('booking', booking);
|
|
818
|
-
if (uid && booking.uuid !== undefined) previousUuids.set(uid, booking.uuid);
|
|
819
|
-
}
|
|
820
|
-
} catch (err) {
|
|
821
|
-
_iterator.e(err);
|
|
822
|
-
} finally {
|
|
823
|
-
_iterator.f();
|
|
824
|
-
}
|
|
825
|
-
}
|
|
826
|
-
_iterator2 = _createForOfIteratorHelper(params.orderData.bookings || []);
|
|
827
|
-
try {
|
|
828
|
-
for (_iterator2.s(); !(_step2 = _iterator2.n()).done;) {
|
|
829
|
-
_booking = _step2.value;
|
|
830
|
-
_uid = getOrderCollectionUid('booking', _booking);
|
|
831
|
-
if (_uid && previousUuids.has(_uid)) {
|
|
832
|
-
(_booking$uuid = _booking.uuid) !== null && _booking$uuid !== void 0 ? _booking$uuid : _booking.uuid = previousUuids.get(_uid);
|
|
833
|
-
previousUuids.delete(_uid);
|
|
834
|
-
}
|
|
835
|
-
assignBookingUuid(_booking);
|
|
836
|
-
}
|
|
837
|
-
} catch (err) {
|
|
838
|
-
_iterator2.e(err);
|
|
839
|
-
} finally {
|
|
840
|
-
_iterator2.f();
|
|
841
|
-
}
|
|
806
|
+
});
|
|
842
807
|
if (!existingOrder) {
|
|
843
|
-
_context10.next =
|
|
808
|
+
_context10.next = 72;
|
|
844
809
|
break;
|
|
845
810
|
}
|
|
846
811
|
if (!(params.existPayment && params.existPayment.length > 0)) {
|
|
847
|
-
_context10.next =
|
|
812
|
+
_context10.next = 48;
|
|
848
813
|
break;
|
|
849
814
|
}
|
|
850
815
|
this.logInfo('检测到云端支付项,将替换本地订单的支付项列表', {
|
|
@@ -868,7 +833,7 @@ export var CheckoutImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
868
833
|
});
|
|
869
834
|
}); // 计算是否需要支付定金
|
|
870
835
|
_isNeedDeposit = this.checkIsNeedDepositAsync(params.orderData.bookings, params.orderData.relation_products); // 更新订单,替换支付项列表
|
|
871
|
-
_context10.next =
|
|
836
|
+
_context10.next = 29;
|
|
872
837
|
return this.payment.updateOrderAsync(existingOrder.uuid, {
|
|
873
838
|
total_amount: amountInfo.totalAmount,
|
|
874
839
|
is_deposit: _isNeedDeposit.hasDeposit ? 1 : 0,
|
|
@@ -886,21 +851,21 @@ export var CheckoutImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
886
851
|
amount_breakdown: amountInfo
|
|
887
852
|
}
|
|
888
853
|
});
|
|
889
|
-
case
|
|
890
|
-
_context10.next =
|
|
854
|
+
case 29:
|
|
855
|
+
_context10.next = 31;
|
|
891
856
|
return this.payment.getPaymentOrderByUuidAsync(existingOrder.uuid);
|
|
892
|
-
case
|
|
857
|
+
case 31:
|
|
893
858
|
_updated = _context10.sent;
|
|
894
859
|
if (_updated) {
|
|
895
|
-
_context10.next =
|
|
860
|
+
_context10.next = 34;
|
|
896
861
|
break;
|
|
897
862
|
}
|
|
898
863
|
throw createCheckoutError(CheckoutErrorType.UnknownError, '订单更新失败');
|
|
899
|
-
case
|
|
864
|
+
case 34:
|
|
900
865
|
this.store.currentOrder = _updated;
|
|
901
|
-
_context10.next =
|
|
866
|
+
_context10.next = 37;
|
|
902
867
|
return this.updateStateAmountToRemaining(false);
|
|
903
|
-
case
|
|
868
|
+
case 37:
|
|
904
869
|
this.logInfo('本地订单更新成功(已替换云端支付项):', {
|
|
905
870
|
orderId: params.orderId,
|
|
906
871
|
uuid: _updated.uuid,
|
|
@@ -911,12 +876,12 @@ export var CheckoutImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
911
876
|
});
|
|
912
877
|
|
|
913
878
|
// 事件通知
|
|
914
|
-
_context10.next =
|
|
879
|
+
_context10.next = 40;
|
|
915
880
|
return this.core.effects.emit("".concat(this.name, ":onOrderCreated"), {
|
|
916
881
|
order: _updated,
|
|
917
882
|
timestamp: Date.now()
|
|
918
883
|
});
|
|
919
|
-
case
|
|
884
|
+
case 40:
|
|
920
885
|
// 计算已同步的支付金额
|
|
921
886
|
syncedPayments = _updated.payment.filter(function (p) {
|
|
922
887
|
return p.isSynced && p.status !== 'voided';
|
|
@@ -936,7 +901,7 @@ export var CheckoutImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
936
901
|
order_wait_pay_amount: Number(_depositDiffAmount) > 0 ? Number(_depositDiffAmount) : Number(_remainingExpectAmount)
|
|
937
902
|
});
|
|
938
903
|
return _context10.abrupt("return", _updated);
|
|
939
|
-
case
|
|
904
|
+
case 48:
|
|
940
905
|
// 原有逻辑:保留现有支付项
|
|
941
906
|
totalAmount = new Decimal(amountInfo.totalAmount || '0');
|
|
942
907
|
activePayments = (existingOrder.payment || []).filter(function (p) {
|
|
@@ -949,7 +914,7 @@ export var CheckoutImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
949
914
|
}, new Decimal(0));
|
|
950
915
|
remaining = Decimal.max(0, totalAmount.minus(paidAmount)).toFixed(2); // 计算是否需要支付定金,如果需要默认切换到定金模式,以及记录定金总金额,并把当前默认待付金额调整为定金总金额
|
|
951
916
|
_isNeedDeposit2 = this.checkIsNeedDepositAsync(params.orderData.bookings, params.orderData.relation_products); // 更新到支付模块(使用 uuid,不修改 payment 列表)
|
|
952
|
-
_context10.next =
|
|
917
|
+
_context10.next = 55;
|
|
953
918
|
return this.payment.updateOrderAsync(existingOrder.uuid, {
|
|
954
919
|
total_amount: amountInfo.totalAmount,
|
|
955
920
|
is_deposit: _isNeedDeposit2.hasDeposit ? 1 : 0,
|
|
@@ -966,21 +931,21 @@ export var CheckoutImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
966
931
|
amount_breakdown: amountInfo
|
|
967
932
|
}
|
|
968
933
|
});
|
|
969
|
-
case
|
|
970
|
-
_context10.next =
|
|
934
|
+
case 55:
|
|
935
|
+
_context10.next = 57;
|
|
971
936
|
return this.payment.getPaymentOrderByUuidAsync(existingOrder.uuid);
|
|
972
|
-
case
|
|
937
|
+
case 57:
|
|
973
938
|
updated = _context10.sent;
|
|
974
939
|
if (updated) {
|
|
975
|
-
_context10.next =
|
|
940
|
+
_context10.next = 60;
|
|
976
941
|
break;
|
|
977
942
|
}
|
|
978
943
|
throw createCheckoutError(CheckoutErrorType.UnknownError, '订单更新失败');
|
|
979
|
-
case
|
|
944
|
+
case 60:
|
|
980
945
|
this.store.currentOrder = updated;
|
|
981
|
-
_context10.next =
|
|
946
|
+
_context10.next = 63;
|
|
982
947
|
return this.updateStateAmountToRemaining(false);
|
|
983
|
-
case
|
|
948
|
+
case 63:
|
|
984
949
|
this.logInfo('本地订单更新成功(保留支付项):', {
|
|
985
950
|
orderId: params.orderId,
|
|
986
951
|
uuid: updated.uuid,
|
|
@@ -990,12 +955,12 @@ export var CheckoutImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
990
955
|
});
|
|
991
956
|
|
|
992
957
|
// 事件通知(复用创建事件,便于上层监听刷新)
|
|
993
|
-
_context10.next =
|
|
958
|
+
_context10.next = 66;
|
|
994
959
|
return this.core.effects.emit("".concat(this.name, ":onOrderCreated"), {
|
|
995
960
|
order: updated,
|
|
996
961
|
timestamp: Date.now()
|
|
997
962
|
});
|
|
998
|
-
case
|
|
963
|
+
case 66:
|
|
999
964
|
// 需要减去已经同步给后端的支付过的钱
|
|
1000
965
|
syncedAmount = activePayments.reduce(function (sum, p) {
|
|
1001
966
|
var amt = new Decimal(p.amount || '0');
|
|
@@ -1011,10 +976,10 @@ export var CheckoutImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
1011
976
|
order_wait_pay_amount: Number(depositDiffAmount) > 0 ? Number(depositDiffAmount) : Number(remainingExpectAmount)
|
|
1012
977
|
});
|
|
1013
978
|
return _context10.abrupt("return", updated);
|
|
1014
|
-
case
|
|
979
|
+
case 72:
|
|
1015
980
|
// 计算是否需要支付定金,如果需要默认切换到定金模式,以及记录定金总金额,并把当前默认待付金额调整为定金总金额
|
|
1016
981
|
isNeedDeposit = this.checkIsNeedDepositAsync(params.orderData.bookings, params.orderData.relation_products); // 没找到现有订单时,回退为创建逻辑(用于异常兜底)
|
|
1017
|
-
_context10.next =
|
|
982
|
+
_context10.next = 75;
|
|
1018
983
|
return this.payment.createPaymentOrderAsync({
|
|
1019
984
|
order_id: String(params.orderId),
|
|
1020
985
|
total_amount: amountInfo.totalAmount,
|
|
@@ -1033,7 +998,7 @@ export var CheckoutImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
1033
998
|
amount_breakdown: amountInfo
|
|
1034
999
|
}
|
|
1035
1000
|
});
|
|
1036
|
-
case
|
|
1001
|
+
case 75:
|
|
1037
1002
|
created = _context10.sent;
|
|
1038
1003
|
this.store.currentOrder = created;
|
|
1039
1004
|
|
|
@@ -1069,7 +1034,7 @@ export var CheckoutImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
1069
1034
|
this.initWalletData();
|
|
1070
1035
|
}
|
|
1071
1036
|
return _context10.abrupt("return", created);
|
|
1072
|
-
case
|
|
1037
|
+
case 79:
|
|
1073
1038
|
case "end":
|
|
1074
1039
|
return _context10.stop();
|
|
1075
1040
|
}
|
|
@@ -2856,7 +2821,7 @@ export var CheckoutImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
2856
2821
|
key: "cleanupExpiredOrdersAsync",
|
|
2857
2822
|
value: (function () {
|
|
2858
2823
|
var _cleanupExpiredOrdersAsync = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee30() {
|
|
2859
|
-
var cleanupConfig, isCleanupEnabled, retentionDays, maxOrdersToDelete, allOrders, thresholdDate, deletedCount, ordersToDelete,
|
|
2824
|
+
var cleanupConfig, isCleanupEnabled, retentionDays, maxOrdersToDelete, allOrders, thresholdDate, deletedCount, ordersToDelete, _iterator, _step, order, _order$order_info, _order$order_info2, isSynced, orderCreatedAt, actualOrdersToDelete, _iterator2, _step2, orderInfo, summary, errorMessage;
|
|
2860
2825
|
return _regeneratorRuntime().wrap(function _callee30$(_context30) {
|
|
2861
2826
|
while (1) switch (_context30.prev = _context30.next) {
|
|
2862
2827
|
case 0:
|
|
@@ -2886,15 +2851,15 @@ export var CheckoutImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
2886
2851
|
thresholdDate.setDate(thresholdDate.getDate() - retentionDays);
|
|
2887
2852
|
deletedCount = 0;
|
|
2888
2853
|
ordersToDelete = [];
|
|
2889
|
-
|
|
2854
|
+
_iterator = _createForOfIteratorHelper(allOrders);
|
|
2890
2855
|
_context30.prev = 17;
|
|
2891
|
-
|
|
2856
|
+
_iterator.s();
|
|
2892
2857
|
case 19:
|
|
2893
|
-
if ((
|
|
2858
|
+
if ((_step = _iterator.n()).done) {
|
|
2894
2859
|
_context30.next = 38;
|
|
2895
2860
|
break;
|
|
2896
2861
|
}
|
|
2897
|
-
order =
|
|
2862
|
+
order = _step.value;
|
|
2898
2863
|
_context30.prev = 21;
|
|
2899
2864
|
// 检查订单是否已同步(订单ID不是虚拟ID)
|
|
2900
2865
|
isSynced = order.order_id && !isVirtualOrderId(order.order_id);
|
|
@@ -2946,10 +2911,10 @@ export var CheckoutImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
2946
2911
|
case 40:
|
|
2947
2912
|
_context30.prev = 40;
|
|
2948
2913
|
_context30.t1 = _context30["catch"](17);
|
|
2949
|
-
|
|
2914
|
+
_iterator.e(_context30.t1);
|
|
2950
2915
|
case 43:
|
|
2951
2916
|
_context30.prev = 43;
|
|
2952
|
-
|
|
2917
|
+
_iterator.f();
|
|
2953
2918
|
return _context30.finish(43);
|
|
2954
2919
|
case 46:
|
|
2955
2920
|
// 按创建时间排序(最老的先删除)并限制删除数量
|
|
@@ -2957,15 +2922,15 @@ export var CheckoutImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
2957
2922
|
return new Date(a.createdAt).getTime() - new Date(b.createdAt).getTime();
|
|
2958
2923
|
});
|
|
2959
2924
|
actualOrdersToDelete = ordersToDelete.slice(0, maxOrdersToDelete); // 删除符合条件的订单
|
|
2960
|
-
|
|
2925
|
+
_iterator2 = _createForOfIteratorHelper(actualOrdersToDelete);
|
|
2961
2926
|
_context30.prev = 49;
|
|
2962
|
-
|
|
2927
|
+
_iterator2.s();
|
|
2963
2928
|
case 51:
|
|
2964
|
-
if ((
|
|
2929
|
+
if ((_step2 = _iterator2.n()).done) {
|
|
2965
2930
|
_context30.next = 64;
|
|
2966
2931
|
break;
|
|
2967
2932
|
}
|
|
2968
|
-
orderInfo =
|
|
2933
|
+
orderInfo = _step2.value;
|
|
2969
2934
|
_context30.prev = 53;
|
|
2970
2935
|
_context30.next = 56;
|
|
2971
2936
|
return this.payment.deletePaymentOrderAsync(orderInfo.uuid);
|
|
@@ -2986,10 +2951,10 @@ export var CheckoutImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
2986
2951
|
case 66:
|
|
2987
2952
|
_context30.prev = 66;
|
|
2988
2953
|
_context30.t3 = _context30["catch"](49);
|
|
2989
|
-
|
|
2954
|
+
_iterator2.e(_context30.t3);
|
|
2990
2955
|
case 69:
|
|
2991
2956
|
_context30.prev = 69;
|
|
2992
|
-
|
|
2957
|
+
_iterator2.f();
|
|
2993
2958
|
return _context30.finish(69);
|
|
2994
2959
|
case 72:
|
|
2995
2960
|
summary = {
|
|
@@ -3854,7 +3819,7 @@ export var CheckoutImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
3854
3819
|
_checkoutResponse4,
|
|
3855
3820
|
_checkoutResponse5,
|
|
3856
3821
|
_checkoutResponse9;
|
|
3857
|
-
var orderUuid, paymentOrder, localOrderData, paymentItems, processedPaymentItems, finalDepositAmount, manualDepositAmount, manualDepositValue, orderPaymentStatus, totalPaidAmount, orderParams, currentOrderId, isUpdateOperation, startTime, checkoutResponse, submitSuccess, submitError, _checkoutResponse, _checkoutResponse2, _checkoutResponse3, responseStatus, isSuccessResponse, _checkoutResponse6, errorMessage, realOrderId, _checkoutResponse7, extractedOrderId, _checkoutResponse8, syncedPaymentUuids,
|
|
3822
|
+
var orderUuid, paymentOrder, localOrderData, paymentItems, processedPaymentItems, finalDepositAmount, manualDepositAmount, manualDepositValue, orderPaymentStatus, totalPaidAmount, orderParams, currentOrderId, isUpdateOperation, startTime, checkoutResponse, submitSuccess, submitError, _checkoutResponse, _checkoutResponse2, _checkoutResponse3, responseStatus, isSuccessResponse, _checkoutResponse6, errorMessage, realOrderId, _checkoutResponse7, extractedOrderId, _checkoutResponse8, syncedPaymentUuids, _iterator3, _step3, paymentUuid, latestPaymentStatus;
|
|
3858
3823
|
return _regeneratorRuntime().wrap(function _callee40$(_context40) {
|
|
3859
3824
|
while (1) switch (_context40.prev = _context40.next) {
|
|
3860
3825
|
case 0:
|
|
@@ -4093,15 +4058,15 @@ export var CheckoutImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
4093
4058
|
}).map(function (item) {
|
|
4094
4059
|
return item.uuid;
|
|
4095
4060
|
}).filter(Boolean);
|
|
4096
|
-
|
|
4061
|
+
_iterator3 = _createForOfIteratorHelper(syncedPaymentUuids);
|
|
4097
4062
|
_context40.prev = 69;
|
|
4098
|
-
|
|
4063
|
+
_iterator3.s();
|
|
4099
4064
|
case 71:
|
|
4100
|
-
if ((
|
|
4065
|
+
if ((_step3 = _iterator3.n()).done) {
|
|
4101
4066
|
_context40.next = 77;
|
|
4102
4067
|
break;
|
|
4103
4068
|
}
|
|
4104
|
-
paymentUuid =
|
|
4069
|
+
paymentUuid = _step3.value;
|
|
4105
4070
|
_context40.next = 75;
|
|
4106
4071
|
return this.payment.updatePaymentAsync(orderUuid, paymentUuid, {
|
|
4107
4072
|
isSynced: true,
|
|
@@ -4116,10 +4081,10 @@ export var CheckoutImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
4116
4081
|
case 79:
|
|
4117
4082
|
_context40.prev = 79;
|
|
4118
4083
|
_context40.t1 = _context40["catch"](69);
|
|
4119
|
-
|
|
4084
|
+
_iterator3.e(_context40.t1);
|
|
4120
4085
|
case 82:
|
|
4121
4086
|
_context40.prev = 82;
|
|
4122
|
-
|
|
4087
|
+
_iterator3.f();
|
|
4123
4088
|
return _context40.finish(82);
|
|
4124
4089
|
case 85:
|
|
4125
4090
|
latestPaymentStatus = ((_checkoutResponse9 = checkoutResponse) === null || _checkoutResponse9 === void 0 || (_checkoutResponse9 = _checkoutResponse9.data) === null || _checkoutResponse9 === void 0 ? void 0 : _checkoutResponse9.payment_status) || orderPaymentStatus;
|
|
@@ -4213,8 +4178,8 @@ export var CheckoutImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
4213
4178
|
updatedOrder,
|
|
4214
4179
|
beforeManualUpdate,
|
|
4215
4180
|
syncedPaymentUuids,
|
|
4216
|
-
|
|
4217
|
-
|
|
4181
|
+
_iterator4,
|
|
4182
|
+
_step4,
|
|
4218
4183
|
paymentUuid,
|
|
4219
4184
|
result,
|
|
4220
4185
|
currentInFlight,
|
|
@@ -4619,15 +4584,15 @@ export var CheckoutImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
4619
4584
|
}).map(function (item) {
|
|
4620
4585
|
return item.uuid;
|
|
4621
4586
|
}).filter(Boolean);
|
|
4622
|
-
|
|
4587
|
+
_iterator4 = _createForOfIteratorHelper(syncedPaymentUuids);
|
|
4623
4588
|
_context41.prev = 112;
|
|
4624
|
-
|
|
4589
|
+
_iterator4.s();
|
|
4625
4590
|
case 114:
|
|
4626
|
-
if ((
|
|
4591
|
+
if ((_step4 = _iterator4.n()).done) {
|
|
4627
4592
|
_context41.next = 120;
|
|
4628
4593
|
break;
|
|
4629
4594
|
}
|
|
4630
|
-
paymentUuid =
|
|
4595
|
+
paymentUuid = _step4.value;
|
|
4631
4596
|
_context41.next = 118;
|
|
4632
4597
|
return this.payment.updatePaymentAsync(this.store.currentOrder.uuid, paymentUuid, {
|
|
4633
4598
|
isSynced: true,
|
|
@@ -4642,10 +4607,10 @@ export var CheckoutImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
4642
4607
|
case 122:
|
|
4643
4608
|
_context41.prev = 122;
|
|
4644
4609
|
_context41.t3 = _context41["catch"](112);
|
|
4645
|
-
|
|
4610
|
+
_iterator4.e(_context41.t3);
|
|
4646
4611
|
case 125:
|
|
4647
4612
|
_context41.prev = 125;
|
|
4648
|
-
|
|
4613
|
+
_iterator4.f();
|
|
4649
4614
|
return _context41.finish(125);
|
|
4650
4615
|
case 128:
|
|
4651
4616
|
_context41.next = 133;
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
import type { OrderSubmitProduct } from '../../modules/Order/types';
|
|
2
|
+
interface ScanOrderMoreOption {
|
|
3
|
+
product_option_item_id: number;
|
|
4
|
+
option_group_id: number;
|
|
5
|
+
num: number;
|
|
6
|
+
price: string | number;
|
|
7
|
+
}
|
|
8
|
+
interface ScanOrderMoreBundle {
|
|
9
|
+
id: number;
|
|
10
|
+
group_id: number;
|
|
11
|
+
bundle_product_id: number;
|
|
12
|
+
_bundle_product_id: number;
|
|
13
|
+
bundle_variant_id: number;
|
|
14
|
+
num: number;
|
|
15
|
+
price: string | number;
|
|
16
|
+
price_type: string;
|
|
17
|
+
price_type_ext: string;
|
|
18
|
+
extension_id: number;
|
|
19
|
+
extension_type: string;
|
|
20
|
+
option: ScanOrderMoreOption[];
|
|
21
|
+
}
|
|
22
|
+
export interface ScanOrderMoreProduct {
|
|
23
|
+
product_id: number | null;
|
|
24
|
+
product_variant_id: number;
|
|
25
|
+
num: number;
|
|
26
|
+
note: string;
|
|
27
|
+
key: string;
|
|
28
|
+
rowKey: string;
|
|
29
|
+
unique: string;
|
|
30
|
+
session: null;
|
|
31
|
+
option: ScanOrderMoreOption[];
|
|
32
|
+
bundle: ScanOrderMoreBundle[];
|
|
33
|
+
}
|
|
34
|
+
export interface ScanOrderMorePayload {
|
|
35
|
+
products: ScanOrderMoreProduct[];
|
|
36
|
+
request_unique_idempotency_token?: string;
|
|
37
|
+
}
|
|
38
|
+
/** The add-on PUT still consumes V1 selections, while checkout consumes V2 products. */
|
|
39
|
+
export declare function formatScanOrderMoreProducts(products: readonly OrderSubmitProduct[]): ScanOrderMoreProduct[];
|
|
40
|
+
export {};
|
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
function formatOptions() {
|
|
2
|
+
var options = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : [];
|
|
3
|
+
return options.map(function (option) {
|
|
4
|
+
var _option$option_group_, _option$num, _ref, _option$add_price;
|
|
5
|
+
return {
|
|
6
|
+
product_option_item_id: (_option$option_group_ = option.option_group_item_id) !== null && _option$option_group_ !== void 0 ? _option$option_group_ : option.product_option_item_id,
|
|
7
|
+
option_group_id: option.option_group_id,
|
|
8
|
+
num: (_option$num = option.num) !== null && _option$num !== void 0 ? _option$num : 1,
|
|
9
|
+
price: (_ref = (_option$add_price = option.add_price) !== null && _option$add_price !== void 0 ? _option$add_price : option.price) !== null && _ref !== void 0 ? _ref : 0
|
|
10
|
+
};
|
|
11
|
+
});
|
|
12
|
+
}
|
|
13
|
+
|
|
14
|
+
/** The add-on PUT still consumes V1 selections, while checkout consumes V2 products. */
|
|
15
|
+
export function formatScanOrderMoreProducts(products) {
|
|
16
|
+
return products.map(function (product, index) {
|
|
17
|
+
var _product$metadata, _product$note, _product$product_sku;
|
|
18
|
+
// Canonical cart rows already have a UID. Keep old UID-less snapshots stable
|
|
19
|
+
// within the same request without merging distinct rows of the same SKU.
|
|
20
|
+
var lineKey = String(((_product$metadata = product.metadata) === null || _product$metadata === void 0 ? void 0 : _product$metadata.unique_identification_number) || "scan-order-more:".concat(product.product_id, ":").concat(product.product_variant_id, ":").concat(index));
|
|
21
|
+
return {
|
|
22
|
+
product_id: product.product_id,
|
|
23
|
+
product_variant_id: product.product_variant_id,
|
|
24
|
+
num: product.product_quantity,
|
|
25
|
+
note: String((_product$note = product.note) !== null && _product$note !== void 0 ? _product$note : ''),
|
|
26
|
+
key: lineKey,
|
|
27
|
+
rowKey: lineKey,
|
|
28
|
+
unique: lineKey,
|
|
29
|
+
session: null,
|
|
30
|
+
option: formatOptions((_product$product_sku = product.product_sku) === null || _product$product_sku === void 0 ? void 0 : _product$product_sku.option),
|
|
31
|
+
bundle: (product.product_bundle || []).map(function (bundle) {
|
|
32
|
+
var _bundle$bundle_varian, _ref2, _bundle$num, _bundle$price, _bundle$price_type, _bundle$price_type_ex, _bundle$extension_id, _bundle$extension_typ;
|
|
33
|
+
return {
|
|
34
|
+
id: bundle.bundle_id,
|
|
35
|
+
group_id: bundle.bundle_group_id,
|
|
36
|
+
// V1 calls the selection/map ID bundle_product_id; the actual child
|
|
37
|
+
// product ID is stored separately as _bundle_product_id.
|
|
38
|
+
bundle_product_id: bundle.bundle_id,
|
|
39
|
+
_bundle_product_id: bundle.bundle_product_id,
|
|
40
|
+
bundle_variant_id: (_bundle$bundle_varian = bundle.bundle_variant_id) !== null && _bundle$bundle_varian !== void 0 ? _bundle$bundle_varian : 0,
|
|
41
|
+
num: (_ref2 = (_bundle$num = bundle.num) !== null && _bundle$num !== void 0 ? _bundle$num : bundle.quantity) !== null && _ref2 !== void 0 ? _ref2 : 1,
|
|
42
|
+
price: (_bundle$price = bundle.price) !== null && _bundle$price !== void 0 ? _bundle$price : 0,
|
|
43
|
+
price_type: (_bundle$price_type = bundle.price_type) !== null && _bundle$price_type !== void 0 ? _bundle$price_type : '',
|
|
44
|
+
price_type_ext: (_bundle$price_type_ex = bundle.price_type_ext) !== null && _bundle$price_type_ex !== void 0 ? _bundle$price_type_ex : '',
|
|
45
|
+
extension_id: (_bundle$extension_id = bundle.extension_id) !== null && _bundle$extension_id !== void 0 ? _bundle$extension_id : 0,
|
|
46
|
+
extension_type: (_bundle$extension_typ = bundle.extension_type) !== null && _bundle$extension_typ !== void 0 ? _bundle$extension_typ : 'normal',
|
|
47
|
+
option: formatOptions(bundle.option)
|
|
48
|
+
};
|
|
49
|
+
})
|
|
50
|
+
};
|
|
51
|
+
});
|
|
52
|
+
}
|