@pisell/pisellos 0.0.567 → 0.0.568
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/core/index.js +6 -9
- package/dist/model/strategy/adapter/walletPass/evaluator.js +0 -2
- package/dist/model/strategy/adapter/walletPass/example.js +3 -26
- package/dist/model/strategy/adapter/walletPass/utils.js +0 -3
- package/dist/model/strategy/strategy-example.js +5 -19
- package/dist/modules/Cart/index.js +0 -3
- package/dist/modules/Cart/utils/cartProduct.js +0 -1
- package/dist/modules/Date/index.js +1 -5
- package/dist/modules/Discount/index.js +1 -4
- package/dist/modules/OpenData/index.js +0 -2
- package/dist/modules/Order/index.d.ts +1 -1
- package/dist/modules/Order/index.js +14 -41
- package/dist/modules/Payment/index.js +142 -270
- package/dist/modules/Payment/walletpass.js +4 -5
- package/dist/modules/Rules/index.js +0 -7
- package/dist/modules/Schedule/utils.js +0 -1
- package/dist/modules/Step/index.js +0 -1
- package/dist/plugins/request.js +1 -4
- package/dist/plugins/window.js +2 -6
- package/dist/server/index.js +88 -121
- package/dist/server/modules/menu/index.js +32 -41
- package/dist/server/modules/products/index.js +29 -49
- package/dist/server/modules/quotation/index.js +29 -38
- package/dist/server/modules/resource/index.js +3 -4
- package/dist/server/modules/schedule/index.js +32 -40
- package/dist/server/utils/product.js +0 -1
- package/dist/solution/BookingByStep/index.d.ts +1 -1
- package/dist/solution/BookingByStep/index.js +7 -59
- package/dist/solution/BookingByStep/utils/capacity.js +1 -11
- package/dist/solution/BookingByStep/utils/resources.js +1 -3
- package/dist/solution/BookingByStep/utils/timeslots.js +2 -43
- package/dist/solution/BookingTicket/index.d.ts +1 -1
- package/dist/solution/BookingTicket/index.js +5 -7
- package/dist/solution/BookingTicket/utils/scan/handleScan.js +25 -31
- package/dist/solution/BookingTicket/utils/scan/index.js +6 -10
- package/dist/solution/BuyTickets/index.js +9 -12
- package/dist/solution/Checkout/index.js +177 -246
- package/dist/solution/Checkout/utils/index.js +4 -16
- package/dist/solution/RegisterAndLogin/index.js +30 -76
- package/dist/solution/ScanOrder/index.js +50 -60
- package/dist/solution/ShopDiscount/index.js +2 -7
- package/dist/solution/VenueBooking/index.d.ts +5 -0
- package/dist/solution/VenueBooking/index.js +364 -327
- package/dist/utils/task.js +15 -18
- package/dist/utils/watch.js +0 -1
- package/lib/apis/picoding.js +2 -0
- package/lib/core/index.js +130 -131
- package/lib/effects/index.js +46 -57
- package/lib/index.js +92 -53
- package/lib/model/index.js +14 -21
- package/lib/model/strategy/adapter/dataVariant/adapter.js +38 -50
- package/lib/model/strategy/adapter/dataVariant/evaluator.js +162 -236
- package/lib/model/strategy/adapter/dataVariant/examples.js +229 -237
- package/lib/model/strategy/adapter/dataVariant/index.js +39 -34
- package/lib/model/strategy/adapter/dataVariant/type.js +57 -28
- package/lib/model/strategy/adapter/index.js +100 -64
- package/lib/model/strategy/adapter/itemRule/adapter.js +156 -144
- package/lib/model/strategy/adapter/itemRule/evaluator.js +36 -48
- package/lib/model/strategy/adapter/itemRule/examples.js +295 -225
- package/lib/model/strategy/adapter/itemRule/index.js +83 -57
- package/lib/model/strategy/adapter/itemRule/type.js +97 -36
- package/lib/model/strategy/adapter/promotion/adapter.js +84 -63
- package/lib/model/strategy/adapter/promotion/evaluator.js +381 -231
- package/lib/model/strategy/adapter/promotion/examples.js +139 -159
- package/lib/model/strategy/adapter/promotion/index.js +1 -49
- package/lib/model/strategy/adapter/promotion/type.js +199 -35
- package/lib/model/strategy/adapter/type.js +4 -16
- package/lib/model/strategy/adapter/walletPass/evaluator.js +180 -152
- package/lib/model/strategy/adapter/walletPass/example.js +217 -190
- package/lib/model/strategy/adapter/walletPass/index.js +75 -51
- package/lib/model/strategy/adapter/walletPass/locales.js +36 -58
- package/lib/model/strategy/adapter/walletPass/type.js +4 -16
- package/lib/model/strategy/adapter/walletPass/utils.js +652 -402
- package/lib/model/strategy/engine.js +270 -168
- package/lib/model/strategy/index.js +49 -34
- package/lib/model/strategy/strategy-example.js +243 -239
- package/lib/model/strategy/type.js +100 -40
- package/lib/modules/Account/index.js +39 -53
- package/lib/modules/Account/types.js +20 -33
- package/lib/modules/AccountList/index.js +116 -154
- package/lib/modules/AccountList/types.js +30 -31
- package/lib/modules/AccountList/utils.js +18 -30
- package/lib/modules/BaseModule.js +22 -45
- package/lib/modules/Cart/index.js +170 -124
- package/lib/modules/Cart/types.js +46 -51
- package/lib/modules/Cart/utils/cartAccount.js +40 -39
- package/lib/modules/Cart/utils/cartDate.js +56 -61
- package/lib/modules/Cart/utils/cartDiscount.js +28 -33
- package/lib/modules/Cart/utils/cartNote.js +27 -32
- package/lib/modules/Cart/utils/cartProduct.js +306 -241
- package/lib/modules/Cart/utils/cartRelationForms.js +29 -35
- package/lib/modules/Cart/utils/cartResource.js +72 -78
- package/lib/modules/Cart/utils/changePrice.js +26 -62
- package/lib/modules/Cart/utils/index.js +106 -48
- package/lib/modules/Customer/constants.js +13 -34
- package/lib/modules/Customer/index.js +216 -153
- package/lib/modules/Customer/types.js +38 -35
- package/lib/modules/Date/index.js +116 -115
- package/lib/modules/Date/types.js +16 -28
- package/lib/modules/Date/utils.js +174 -123
- package/lib/modules/Discount/index.js +117 -113
- package/lib/modules/Discount/types.js +9 -31
- package/lib/modules/Guests/index.js +30 -56
- package/lib/modules/Guests/types.js +23 -33
- package/lib/modules/Holder/index.js +209 -189
- package/lib/modules/Holder/types.js +4 -16
- package/lib/modules/Holder/utils.js +20 -49
- package/lib/modules/OpenData/index.js +63 -74
- package/lib/modules/OpenData/types.js +4 -16
- package/lib/modules/OpenData/utils.js +44 -78
- package/lib/modules/Order/index.d.ts +1 -1
- package/lib/modules/Order/index.js +332 -320
- package/lib/modules/Order/types.js +24 -33
- package/lib/modules/Order/utils.js +350 -284
- package/lib/modules/Payment/cash.js +20 -33
- package/lib/modules/Payment/cashRecommendationAlgorithm.js +145 -76
- package/lib/modules/Payment/eftpos.js +16 -30
- package/lib/modules/Payment/index.js +566 -432
- package/lib/modules/Payment/mx51.js +1 -0
- package/lib/modules/Payment/types.js +216 -107
- package/lib/modules/Payment/utils.js +50 -47
- package/lib/modules/Payment/walletpass.js +221 -203
- package/lib/modules/Product/index.js +51 -46
- package/lib/modules/Product/types.js +4 -16
- package/lib/modules/Product/utils.js +32 -33
- package/lib/modules/ProductList/index.js +111 -110
- package/lib/modules/ProductList/types.js +9 -31
- package/lib/modules/Quotation/index.js +60 -82
- package/lib/modules/Quotation/types.js +4 -16
- package/lib/modules/Resource/index.js +27 -59
- package/lib/modules/Resource/types.js +22 -32
- package/lib/modules/Resource/utils.js +30 -38
- package/lib/modules/Rules/index.js +1172 -872
- package/lib/modules/Rules/types.js +17 -40
- package/lib/modules/SalesSummary/index.js +59 -68
- package/lib/modules/SalesSummary/types.js +4 -16
- package/lib/modules/SalesSummary/utils.js +176 -193
- package/lib/modules/ScanOrderLogger/index.js +59 -79
- package/lib/modules/ScanOrderLogger/providers/feishu.js +54 -78
- package/lib/modules/ScanOrderLogger/providers/grafana.js +13 -36
- package/lib/modules/ScanOrderLogger/types.js +4 -16
- package/lib/modules/Schedule/getDateIsInSchedule.js +334 -167
- package/lib/modules/Schedule/index.js +97 -107
- package/lib/modules/Schedule/type.js +4 -16
- package/lib/modules/Schedule/types.js +4 -16
- package/lib/modules/Schedule/utils.js +433 -291
- package/lib/modules/Step/index.js +40 -52
- package/lib/modules/Step/tyeps.js +4 -16
- package/lib/modules/Summary/index.js +66 -70
- package/lib/modules/Summary/types.js +4 -16
- package/lib/modules/Summary/utils.js +782 -429
- package/lib/modules/index.js +212 -57
- package/lib/plugins/app.js +4 -16
- package/lib/plugins/index.js +36 -25
- package/lib/plugins/request.js +137 -126
- package/lib/plugins/shopStore.js +4 -16
- package/lib/plugins/user.js +4 -16
- package/lib/plugins/window.js +171 -179
- package/lib/server/index.js +882 -623
- package/lib/server/modules/index.js +85 -59
- package/lib/server/modules/menu/index.js +146 -122
- package/lib/server/modules/menu/types.js +18 -31
- package/lib/server/modules/order/index.js +195 -231
- package/lib/server/modules/order/types.js +107 -32
- package/lib/server/modules/order/utils/filterBookings.js +174 -140
- package/lib/server/modules/order/utils/filterOrders.js +89 -60
- package/lib/server/modules/products/index.js +430 -335
- package/lib/server/modules/products/types.js +41 -34
- package/lib/server/modules/quotation/index.js +76 -77
- package/lib/server/modules/quotation/types.js +21 -31
- package/lib/server/modules/resource/index.js +216 -187
- package/lib/server/modules/resource/types.js +42 -33
- package/lib/server/modules/schedule/index.js +134 -119
- package/lib/server/modules/schedule/types.js +14 -21
- package/lib/server/modules/schedule/utils.js +334 -163
- package/lib/server/types.js +4 -16
- package/lib/server/utils/index.js +25 -23
- package/lib/server/utils/product.js +196 -139
- package/lib/server/utils/schedule.js +34 -41
- package/lib/server/utils/time.js +40 -49
- package/lib/solution/BookingByStep/index.d.ts +1 -1
- package/lib/solution/BookingByStep/index.js +1530 -1343
- package/lib/solution/BookingByStep/types.js +40 -99
- package/lib/solution/BookingByStep/utils/capacity.js +192 -160
- package/lib/solution/BookingByStep/utils/products.js +42 -52
- package/lib/solution/BookingByStep/utils/resources.js +527 -330
- package/lib/solution/BookingByStep/utils/stock.js +65 -44
- package/lib/solution/BookingByStep/utils/timeslots.js +129 -131
- package/lib/solution/BookingTicket/index.d.ts +1 -1
- package/lib/solution/BookingTicket/index.js +147 -122
- package/lib/solution/BookingTicket/types.js +38 -64
- package/lib/solution/BookingTicket/utils/scan/cloudSearch.js +64 -80
- package/lib/solution/BookingTicket/utils/scan/handleScan.js +82 -80
- package/lib/solution/BookingTicket/utils/scan/index.js +90 -94
- package/lib/solution/BookingTicket/utils/scan/scanCache.js +90 -43
- package/lib/solution/BuyTickets/index.js +67 -70
- package/lib/solution/BuyTickets/types.js +22 -38
- package/lib/solution/Checkout/index.js +1451 -1158
- package/lib/solution/Checkout/types.js +91 -61
- package/lib/solution/Checkout/utils/index.js +227 -158
- package/lib/solution/PlaceOrder/index.js +55 -0
- package/lib/solution/RegisterAndLogin/config.js +493 -460
- package/lib/solution/RegisterAndLogin/index.js +633 -630
- package/lib/solution/RegisterAndLogin/types.js +189 -76
- package/lib/solution/RegisterAndLogin/utils.js +183 -125
- package/lib/solution/Sales/index.js +218 -200
- package/lib/solution/Sales/types.js +27 -33
- package/lib/solution/ScanOrder/index.js +803 -840
- package/lib/solution/ScanOrder/types.js +34 -34
- package/lib/solution/ScanOrder/utils.js +372 -331
- package/lib/solution/ShopDiscount/index.js +230 -236
- package/lib/solution/ShopDiscount/types.js +15 -37
- package/lib/solution/ShopDiscount/utils.js +309 -172
- package/lib/solution/VenueBooking/index.d.ts +5 -0
- package/lib/solution/VenueBooking/index.js +886 -929
- package/lib/solution/VenueBooking/types.js +20 -40
- package/lib/solution/VenueBooking/utils/dateSummary.js +22 -54
- package/lib/solution/VenueBooking/utils/resource.js +31 -54
- package/lib/solution/VenueBooking/utils/slotMerge.js +88 -106
- package/lib/solution/VenueBooking/utils/smartPricing.js +112 -100
- package/lib/solution/VenueBooking/utils/timeSlot.js +133 -132
- package/lib/solution/VenueBooking/utils.js +130 -67
- package/lib/solution/index.js +102 -37
- package/lib/store/createStore.js +32 -29
- package/lib/types/index.js +4 -16
- package/lib/utils/task.js +36 -36
- package/lib/utils/watch.js +81 -47
- package/package.json +2 -1
|
@@ -1,59 +1,46 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
var __export = (target, all) => {
|
|
6
|
-
for (var name in all)
|
|
7
|
-
__defProp(target, name, { get: all[name], enumerable: true });
|
|
8
|
-
};
|
|
9
|
-
var __copyProps = (to, from, except, desc) => {
|
|
10
|
-
if (from && typeof from === "object" || typeof from === "function") {
|
|
11
|
-
for (let key of __getOwnPropNames(from))
|
|
12
|
-
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
13
|
-
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
14
|
-
}
|
|
15
|
-
return to;
|
|
16
|
-
};
|
|
17
|
-
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
18
|
-
|
|
19
|
-
// src/modules/Payment/walletpass.ts
|
|
20
|
-
var walletpass_exports = {};
|
|
21
|
-
__export(walletpass_exports, {
|
|
22
|
-
WalletPassPaymentImpl: () => WalletPassPaymentImpl
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
23
5
|
});
|
|
24
|
-
|
|
25
|
-
var
|
|
26
|
-
var
|
|
27
|
-
|
|
6
|
+
exports.WalletPassPaymentImpl = void 0;
|
|
7
|
+
var _types = require("./types");
|
|
8
|
+
var _utils = require("./utils");
|
|
9
|
+
/**
|
|
10
|
+
* 钱包支付实现
|
|
11
|
+
*/
|
|
12
|
+
class WalletPassPaymentImpl {
|
|
13
|
+
walletRecommendList = [];
|
|
14
|
+
userIdentificationCodes = [];
|
|
15
|
+
searchResults = [];
|
|
16
|
+
walletParams = null;
|
|
17
|
+
walletInitData = null;
|
|
28
18
|
constructor(paymentModule) {
|
|
29
19
|
this.paymentModule = paymentModule;
|
|
30
|
-
this.walletRecommendList = [];
|
|
31
|
-
this.userIdentificationCodes = [];
|
|
32
|
-
this.searchResults = [];
|
|
33
|
-
this.walletParams = null;
|
|
34
|
-
this.walletInitData = null;
|
|
35
20
|
}
|
|
21
|
+
|
|
36
22
|
/**
|
|
37
23
|
* 发送事件的辅助方法
|
|
38
24
|
* 支持使用WalletPassHooks或PaymentHooks
|
|
39
25
|
*/
|
|
40
26
|
emitEvent(hook, data) {
|
|
41
27
|
try {
|
|
42
|
-
|
|
28
|
+
// 提取事件名称,去掉模块前缀
|
|
29
|
+
const eventName = hook.split(':')[1] || hook.replace(/^[A-Z][a-z]+/, '').replace(/^On/, '').toLowerCase();
|
|
43
30
|
const fullEventName = `${this.paymentModule.name}:${eventName}`;
|
|
44
31
|
this.paymentModule.core.effects.emit(fullEventName, data);
|
|
45
32
|
} catch (error) {
|
|
46
|
-
this.paymentModule.logError(
|
|
47
|
-
hook
|
|
33
|
+
this.paymentModule.logError('[WalletPass] 发送事件失败', error, {
|
|
34
|
+
hook: hook
|
|
48
35
|
});
|
|
49
36
|
}
|
|
50
37
|
}
|
|
38
|
+
|
|
51
39
|
/**
|
|
52
40
|
* 生成钱包API默认参数
|
|
53
41
|
* 根据业务数据生成标准的钱包API参数,并存储在模块中
|
|
54
42
|
*/
|
|
55
43
|
generateWalletParams(businessData) {
|
|
56
|
-
var _a, _b;
|
|
57
44
|
const {
|
|
58
45
|
customer_id,
|
|
59
46
|
holder,
|
|
@@ -63,32 +50,36 @@ var WalletPassPaymentImpl = class {
|
|
|
63
50
|
payment_order_id,
|
|
64
51
|
is_price_include_tax
|
|
65
52
|
} = businessData;
|
|
53
|
+
|
|
54
|
+
// 转换金额为数字类型
|
|
66
55
|
const totalAmount = Number(amountInfo.totalAmount);
|
|
67
56
|
const subTotal = Number(amountInfo.subTotal);
|
|
68
57
|
const walletParams = {
|
|
69
58
|
is_price_include_tax,
|
|
70
|
-
sale_channel:
|
|
59
|
+
sale_channel: 'pos',
|
|
71
60
|
customer_id: customer_id || 0,
|
|
72
61
|
// 提供默认值,确保类型为 number
|
|
73
|
-
holder_id:
|
|
62
|
+
holder_id: holder?.form_record?.[0] || undefined,
|
|
74
63
|
order_expect_amount: totalAmount,
|
|
75
64
|
// 订单小计金额
|
|
76
65
|
order_product_amount: subTotal,
|
|
77
66
|
// 订单待支付金额
|
|
78
|
-
order_wait_pay_amount: order_wait_pay_amount || (
|
|
67
|
+
order_wait_pay_amount: order_wait_pay_amount || (amountInfo?.isDeposit ? Number(amountInfo?.depositAmount) : totalAmount),
|
|
79
68
|
// order_behavior_count_customer_id: 1,
|
|
80
69
|
products,
|
|
81
70
|
prepare_payments: [],
|
|
82
71
|
payment_order_id
|
|
83
72
|
};
|
|
73
|
+
|
|
74
|
+
// 存储生成的参数到模块中
|
|
84
75
|
this.walletParams = walletParams;
|
|
85
|
-
this.paymentModule.logInfo(
|
|
76
|
+
this.paymentModule.logInfo('[WalletPass] 钱包默认参数已生成并存储', {
|
|
86
77
|
customer_id: walletParams.customer_id,
|
|
87
78
|
holder_id: walletParams.holder_id,
|
|
88
79
|
order_expect_amount: walletParams.order_expect_amount,
|
|
89
80
|
order_product_amount: walletParams.order_product_amount,
|
|
90
81
|
order_wait_pay_amount: walletParams.order_wait_pay_amount,
|
|
91
|
-
products_count:
|
|
82
|
+
products_count: walletParams.products?.length || 0
|
|
92
83
|
});
|
|
93
84
|
this.walletInitData = {
|
|
94
85
|
transformList: [],
|
|
@@ -97,6 +88,7 @@ var WalletPassPaymentImpl = class {
|
|
|
97
88
|
};
|
|
98
89
|
return walletParams;
|
|
99
90
|
}
|
|
91
|
+
|
|
100
92
|
/**
|
|
101
93
|
* 获取已存储的钱包参数
|
|
102
94
|
* 返回之前生成并存储的钱包参数
|
|
@@ -104,23 +96,24 @@ var WalletPassPaymentImpl = class {
|
|
|
104
96
|
getStoredWalletParams() {
|
|
105
97
|
return this.walletParams;
|
|
106
98
|
}
|
|
99
|
+
|
|
107
100
|
/**
|
|
108
101
|
* 清理已存储的钱包参数
|
|
109
102
|
* 清除之前存储的钱包参数
|
|
110
103
|
*/
|
|
111
104
|
clearStoredWalletParams() {
|
|
112
105
|
this.walletParams = null;
|
|
113
|
-
this.paymentModule.logInfo(
|
|
106
|
+
this.paymentModule.logInfo('[WalletPass] 已存储的钱包参数已清理');
|
|
114
107
|
}
|
|
108
|
+
|
|
115
109
|
/**
|
|
116
110
|
* 从业务数据初始化钱包数据
|
|
117
111
|
* 内部生成参数,然后调用标准的初始化流程
|
|
118
112
|
*/
|
|
119
113
|
async initializeWalletDataFromBusinessAsync(businessData) {
|
|
120
|
-
var _a, _b, _c, _d, _e, _f, _g, _h;
|
|
121
114
|
const startTime = Date.now();
|
|
122
115
|
const walletParams = this.generateWalletParams(businessData);
|
|
123
|
-
if (Number(
|
|
116
|
+
if (Number(businessData?.amountInfo?.totalAmount || 0) < 0 || Number(businessData?.amountInfo?.subTotal || 0) < 0) {
|
|
124
117
|
return {
|
|
125
118
|
walletRecommendList: [],
|
|
126
119
|
userIdentificationCodes: [],
|
|
@@ -129,28 +122,36 @@ var WalletPassPaymentImpl = class {
|
|
|
129
122
|
products: []
|
|
130
123
|
};
|
|
131
124
|
}
|
|
132
|
-
if ([1, 0].includes(
|
|
125
|
+
if ([1, 0].includes(walletParams?.customer_id || 0)) {
|
|
133
126
|
return {
|
|
134
127
|
walletRecommendList: [],
|
|
135
128
|
userIdentificationCodes: []
|
|
136
129
|
};
|
|
137
130
|
}
|
|
138
|
-
|
|
131
|
+
|
|
132
|
+
// 发送初始化开始事件
|
|
133
|
+
this.emitEvent(_types.WalletPassHooks.OnWalletInitializationStarted, {
|
|
139
134
|
businessData,
|
|
140
135
|
startTime
|
|
141
136
|
});
|
|
142
|
-
this.paymentModule.logInfo(
|
|
137
|
+
this.paymentModule.logInfo('[WalletPass] 开始从业务数据初始化钱包数据', {
|
|
143
138
|
customer_id: businessData.customer_id,
|
|
144
|
-
totalAmount:
|
|
145
|
-
subTotal:
|
|
139
|
+
totalAmount: businessData.amountInfo?.totalAmount,
|
|
140
|
+
subTotal: businessData.amountInfo?.subTotal,
|
|
146
141
|
order_wait_pay_amount: businessData.order_wait_pay_amount,
|
|
147
|
-
products_count:
|
|
142
|
+
products_count: businessData.products?.length || 0
|
|
148
143
|
});
|
|
149
144
|
try {
|
|
145
|
+
// 生成钱包API参数
|
|
146
|
+
// const walletParams = this.generateWalletParams(businessData);
|
|
147
|
+
|
|
148
|
+
// 调用标准的初始化流程
|
|
150
149
|
const result = await this.initializeWalletDataAsync(walletParams);
|
|
151
150
|
const endTime = Date.now();
|
|
152
151
|
const duration = endTime - startTime;
|
|
153
|
-
|
|
152
|
+
|
|
153
|
+
// 发送初始化完成事件
|
|
154
|
+
this.emitEvent(_types.WalletPassHooks.OnWalletInitializationCompleted, {
|
|
154
155
|
businessData,
|
|
155
156
|
result,
|
|
156
157
|
startTime,
|
|
@@ -159,52 +160,50 @@ var WalletPassPaymentImpl = class {
|
|
|
159
160
|
});
|
|
160
161
|
this.paymentModule.logInfo(`[WalletPass] 从业务数据初始化钱包数据成功`, {
|
|
161
162
|
duration: `${duration}ms`,
|
|
162
|
-
walletRecommendList_count:
|
|
163
|
-
userIdentificationCodes_count:
|
|
163
|
+
walletRecommendList_count: result.walletRecommendList?.length || 0,
|
|
164
|
+
userIdentificationCodes_count: result.userIdentificationCodes?.length || 0
|
|
164
165
|
});
|
|
165
166
|
return result;
|
|
166
167
|
} catch (error) {
|
|
167
168
|
const endTime = Date.now();
|
|
168
169
|
const duration = endTime - startTime;
|
|
169
|
-
|
|
170
|
+
|
|
171
|
+
// 发送初始化失败事件
|
|
172
|
+
this.emitEvent(_types.WalletPassHooks.OnWalletInitializationFailed, {
|
|
170
173
|
businessData,
|
|
171
|
-
error,
|
|
174
|
+
error: error,
|
|
172
175
|
startTime,
|
|
173
176
|
endTime,
|
|
174
177
|
duration
|
|
175
178
|
});
|
|
176
|
-
this.paymentModule.logError(
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
customer_id: businessData.customer_id,
|
|
182
|
-
totalAmount: (_h = businessData.amountInfo) == null ? void 0 : _h.totalAmount
|
|
183
|
-
}
|
|
184
|
-
);
|
|
179
|
+
this.paymentModule.logError(`[WalletPass] 从业务数据初始化钱包数据失败`, error, {
|
|
180
|
+
duration: `${duration}ms`,
|
|
181
|
+
customer_id: businessData.customer_id,
|
|
182
|
+
totalAmount: businessData.amountInfo?.totalAmount
|
|
183
|
+
});
|
|
185
184
|
throw error;
|
|
186
185
|
}
|
|
187
186
|
}
|
|
187
|
+
|
|
188
188
|
/**
|
|
189
189
|
* 获取订单基础详情
|
|
190
190
|
*/
|
|
191
191
|
async getOrderBasicDetailAsync(orderId) {
|
|
192
192
|
try {
|
|
193
|
-
const response = await this.paymentModule.request.get(
|
|
194
|
-
|
|
195
|
-
);
|
|
196
|
-
return (response == null ? void 0 : response.data) || {};
|
|
193
|
+
const response = await this.paymentModule.request.get(`/order/order/${orderId}/basic-detail`);
|
|
194
|
+
return response?.data || {};
|
|
197
195
|
} catch (error) {
|
|
198
196
|
throw error;
|
|
199
197
|
}
|
|
200
198
|
}
|
|
199
|
+
|
|
201
200
|
/**
|
|
202
201
|
* 初始化钱包数据
|
|
203
202
|
* 先获取推荐列表,再获取用户识别码列表(顺序执行)
|
|
204
203
|
*/
|
|
205
204
|
async initializeWalletDataAsync(baseParams) {
|
|
206
|
-
var _a, _b;
|
|
207
205
|
try {
|
|
206
|
+
// 格式化用户识别码列表参数
|
|
208
207
|
const identificationParams = {
|
|
209
208
|
...baseParams,
|
|
210
209
|
available: 2,
|
|
@@ -212,11 +211,10 @@ var WalletPassPaymentImpl = class {
|
|
|
212
211
|
other_exact_codes: [],
|
|
213
212
|
filter_prepare_wallet_pass: 1
|
|
214
213
|
};
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
const walletPassEvaluator = (_b = (_a = this.paymentModule.window) == null ? void 0 : _a.getWalletPassEvaluator) == null ? void 0 : _b.call(_a);
|
|
214
|
+
|
|
215
|
+
// 并行获取用户识别码列表和订单详情
|
|
216
|
+
const [allList, orderBasicDetail] = await Promise.all([this.getUserIdentificationCodeListAsync(identificationParams), baseParams.payment_order_id ? this.getOrderBasicDetailAsync(baseParams.payment_order_id) : Promise.resolve(null)]);
|
|
217
|
+
const walletPassEvaluator = this.paymentModule.window?.getWalletPassEvaluator?.();
|
|
220
218
|
if (!walletPassEvaluator) {
|
|
221
219
|
return {
|
|
222
220
|
walletRecommendList: [],
|
|
@@ -226,29 +224,40 @@ var WalletPassPaymentImpl = class {
|
|
|
226
224
|
products: []
|
|
227
225
|
};
|
|
228
226
|
}
|
|
229
|
-
const products =
|
|
230
|
-
const res = walletPassEvaluator
|
|
227
|
+
const products = orderBasicDetail?.detail || baseParams.products;
|
|
228
|
+
const res = walletPassEvaluator?.getRecommendedVouchers({
|
|
231
229
|
orderTotalAmount: baseParams.order_wait_pay_amount,
|
|
232
|
-
products,
|
|
230
|
+
products: products,
|
|
233
231
|
vouchers: allList
|
|
234
232
|
});
|
|
235
|
-
const {
|
|
236
|
-
|
|
237
|
-
this.walletRecommendList = recommended;
|
|
238
|
-
this.walletInitData = {
|
|
233
|
+
const {
|
|
234
|
+
recommended,
|
|
239
235
|
transformList,
|
|
240
236
|
noApplicableVoucher,
|
|
237
|
+
recommendedAmount
|
|
238
|
+
} = res;
|
|
239
|
+
this.walletRecommendList = recommended;
|
|
240
|
+
|
|
241
|
+
// 存储初始化数据到内存中,供 useWalletPass 使用
|
|
242
|
+
this.walletInitData = {
|
|
243
|
+
transformList: transformList,
|
|
244
|
+
noApplicableVoucher: noApplicableVoucher,
|
|
241
245
|
products: products || []
|
|
242
246
|
};
|
|
247
|
+
|
|
248
|
+
// // 再获取用户识别码列表
|
|
249
|
+
// const userIdentificationCodes =
|
|
250
|
+
// await this.getUserIdentificationCodeListAsync(identificationParams);
|
|
251
|
+
|
|
243
252
|
return {
|
|
244
253
|
walletRecommendList: recommended,
|
|
245
254
|
userIdentificationCodes: allList,
|
|
246
|
-
transformList,
|
|
247
|
-
noApplicableVoucher,
|
|
255
|
+
transformList: transformList,
|
|
256
|
+
noApplicableVoucher: noApplicableVoucher,
|
|
248
257
|
products: products || []
|
|
249
258
|
};
|
|
250
259
|
} catch (error) {
|
|
251
|
-
this.paymentModule.logError(
|
|
260
|
+
this.paymentModule.logError('[WalletPass] 初始化钱包数据失败', error, {
|
|
252
261
|
customer_id: baseParams.customer_id,
|
|
253
262
|
order_expect_amount: baseParams.order_expect_amount
|
|
254
263
|
});
|
|
@@ -256,26 +265,24 @@ var WalletPassPaymentImpl = class {
|
|
|
256
265
|
}
|
|
257
266
|
}
|
|
258
267
|
async getWalletPassRecommendListAsync(params) {
|
|
259
|
-
var _a;
|
|
260
268
|
try {
|
|
261
|
-
this.paymentModule.logInfo(
|
|
269
|
+
this.paymentModule.logInfo('[WalletPass] 开始获取钱包推荐列表', {
|
|
262
270
|
customer_id: params.customer_id,
|
|
263
271
|
order_expect_amount: params.order_expect_amount,
|
|
264
272
|
sale_channel: params.sale_channel,
|
|
265
|
-
payment_order_id:
|
|
273
|
+
payment_order_id: this.walletParams?.payment_order_id
|
|
266
274
|
});
|
|
267
|
-
const response = await this.paymentModule.request.post(
|
|
268
|
-
"/machinecode/prepare/deduction/recommend",
|
|
269
|
-
params
|
|
270
|
-
// 将 params 作为请求体数据
|
|
275
|
+
const response = await this.paymentModule.request.post('/machinecode/prepare/deduction/recommend', params // 将 params 作为请求体数据
|
|
271
276
|
);
|
|
272
|
-
this.walletRecommendList =
|
|
273
|
-
|
|
277
|
+
this.walletRecommendList = response?.data || [];
|
|
278
|
+
|
|
279
|
+
// 发送钱包推荐列表更新事件(使用专用的WalletPassHooks)
|
|
280
|
+
this.emitEvent(_types.WalletPassHooks.OnWalletRecommendListUpdated, {
|
|
274
281
|
walletRecommendList: this.walletRecommendList
|
|
275
282
|
});
|
|
276
|
-
this.paymentModule.logInfo(
|
|
283
|
+
this.paymentModule.logInfo('[WalletPass] 钱包推荐列表已更新', {
|
|
277
284
|
count: this.walletRecommendList.length,
|
|
278
|
-
items: this.walletRecommendList.map(
|
|
285
|
+
items: this.walletRecommendList.map(item => ({
|
|
279
286
|
voucher_id: item.voucher_id,
|
|
280
287
|
name: item.name,
|
|
281
288
|
amount: item.amount,
|
|
@@ -284,43 +291,43 @@ var WalletPassPaymentImpl = class {
|
|
|
284
291
|
});
|
|
285
292
|
return this.walletRecommendList;
|
|
286
293
|
} catch (error) {
|
|
287
|
-
this.paymentModule.logError(
|
|
294
|
+
this.paymentModule.logError('[WalletPass] 获取钱包推荐列表失败', error, {
|
|
288
295
|
customer_id: params.customer_id,
|
|
289
296
|
order_expect_amount: params.order_expect_amount,
|
|
290
297
|
sale_channel: params.sale_channel
|
|
291
298
|
});
|
|
299
|
+
// throw error;
|
|
292
300
|
return [];
|
|
293
301
|
}
|
|
294
302
|
}
|
|
295
303
|
formatWalletPassList2PreparePayments(list) {
|
|
296
|
-
return (0,
|
|
304
|
+
return (0, _utils.formatWalletPassList2PreparePayments)(list);
|
|
297
305
|
}
|
|
298
306
|
async getUserIdentificationCodeListAsync(params) {
|
|
299
|
-
var _a, _b;
|
|
300
307
|
try {
|
|
301
308
|
const newParams = {
|
|
302
309
|
...this.walletParams,
|
|
303
310
|
...params
|
|
304
311
|
};
|
|
305
|
-
this.paymentModule.logInfo(
|
|
312
|
+
this.paymentModule.logInfo('[WalletPass] 开始获取用户识别码列表', {
|
|
306
313
|
customer_id: newParams.customer_id,
|
|
307
314
|
available: newParams.available,
|
|
308
|
-
prepare_payments_count:
|
|
315
|
+
prepare_payments_count: newParams.prepare_payments?.length || 0,
|
|
309
316
|
filter_prepare_wallet_pass: newParams.filter_prepare_wallet_pass,
|
|
310
|
-
payment_order_id:
|
|
317
|
+
payment_order_id: this.walletParams?.payment_order_id
|
|
311
318
|
});
|
|
312
|
-
const response = await this.paymentModule.request.post(
|
|
313
|
-
|
|
314
|
-
|
|
315
|
-
);
|
|
316
|
-
const sortedData = (0, import_utils.sortUserIdentificationCodeList)((response == null ? void 0 : response.data) || []);
|
|
319
|
+
const response = await this.paymentModule.request.post('/machinecode/prepare/deduction', newParams);
|
|
320
|
+
// 对获取到的数据进行排序,将错误码为 500100、500200、500300 的项目排到最后
|
|
321
|
+
const sortedData = (0, _utils.sortUserIdentificationCodeList)(response?.data || []);
|
|
317
322
|
this.userIdentificationCodes = sortedData;
|
|
318
|
-
|
|
323
|
+
|
|
324
|
+
// 发送用户识别码列表更新事件(使用专用的WalletPassHooks)
|
|
325
|
+
this.emitEvent(_types.WalletPassHooks.OnUserIdentificationCodesUpdated, {
|
|
319
326
|
userIdentificationCodes: this.userIdentificationCodes
|
|
320
327
|
});
|
|
321
|
-
this.paymentModule.logInfo(
|
|
328
|
+
this.paymentModule.logInfo('[WalletPass] 用户识别码列表已更新', {
|
|
322
329
|
count: this.userIdentificationCodes.length,
|
|
323
|
-
sorted_items: this.userIdentificationCodes.slice(0, 5).map(
|
|
330
|
+
sorted_items: this.userIdentificationCodes.slice(0, 5).map(item => ({
|
|
324
331
|
code: item.code,
|
|
325
332
|
error_code: item.error_code,
|
|
326
333
|
error_msg: item.error_msg
|
|
@@ -328,17 +335,14 @@ var WalletPassPaymentImpl = class {
|
|
|
328
335
|
});
|
|
329
336
|
return this.userIdentificationCodes;
|
|
330
337
|
} catch (error) {
|
|
331
|
-
this.paymentModule.logError(
|
|
332
|
-
|
|
333
|
-
|
|
334
|
-
|
|
335
|
-
customer_id: params.customer_id,
|
|
336
|
-
available: params.available
|
|
337
|
-
}
|
|
338
|
-
);
|
|
338
|
+
this.paymentModule.logError('[WalletPass] 获取用户识别码列表失败', error, {
|
|
339
|
+
customer_id: params.customer_id,
|
|
340
|
+
available: params.available
|
|
341
|
+
});
|
|
339
342
|
return [];
|
|
340
343
|
}
|
|
341
344
|
}
|
|
345
|
+
|
|
342
346
|
/**
|
|
343
347
|
* 搜索识别码信息
|
|
344
348
|
* 通过识别码搜索相关的钱包通行证信息
|
|
@@ -346,109 +350,115 @@ var WalletPassPaymentImpl = class {
|
|
|
346
350
|
* 特殊逻辑:当识别码长度为9位且前3位为"000"时,调用 /wallet/detail/search 接口
|
|
347
351
|
*/
|
|
348
352
|
async searchIdentificationCodeAsync(params, config = {}) {
|
|
349
|
-
var _a;
|
|
350
353
|
try {
|
|
351
|
-
const {
|
|
352
|
-
|
|
353
|
-
|
|
354
|
+
const {
|
|
355
|
+
code
|
|
356
|
+
} = params;
|
|
357
|
+
this.paymentModule.logInfo('[WalletPass] 开始搜索识别码', {
|
|
358
|
+
code: code,
|
|
354
359
|
code_length: code.length,
|
|
355
360
|
noCache: config.noCache || false
|
|
356
361
|
});
|
|
357
|
-
|
|
362
|
+
|
|
363
|
+
// 检查识别码是否为9位且前3位为"000"
|
|
364
|
+
const isWalletCode = code.length === 9 && code.startsWith('000');
|
|
365
|
+
// 测试环境先使用 WL
|
|
366
|
+
// const isWalletCode = code.startsWith('WL');
|
|
367
|
+
|
|
358
368
|
if (isWalletCode) {
|
|
369
|
+
// 钱包识别码直接调用专门接口,不缓存,直接返回
|
|
359
370
|
const walletDetailParams = {
|
|
360
|
-
code,
|
|
371
|
+
code: code,
|
|
361
372
|
with_customer: 1,
|
|
362
|
-
with: [
|
|
373
|
+
with: ['wallet']
|
|
363
374
|
};
|
|
364
|
-
this.paymentModule.logInfo(
|
|
365
|
-
code,
|
|
375
|
+
this.paymentModule.logInfo('[WalletPass] 搜索钱包识别码', {
|
|
376
|
+
code: code,
|
|
366
377
|
with_customer: walletDetailParams.with_customer,
|
|
367
378
|
with: walletDetailParams.with
|
|
368
379
|
});
|
|
369
|
-
const
|
|
370
|
-
|
|
371
|
-
|
|
372
|
-
|
|
373
|
-
|
|
374
|
-
|
|
375
|
-
code,
|
|
376
|
-
results_count: searchResults2.length,
|
|
377
|
-
type: "walletCode"
|
|
380
|
+
const response = await this.paymentModule.request.post('/wallet/detail/search', walletDetailParams);
|
|
381
|
+
const searchResults = response?.data || [];
|
|
382
|
+
this.paymentModule.logInfo('[WalletPass] 钱包识别码搜索完成', {
|
|
383
|
+
code: code,
|
|
384
|
+
results_count: searchResults.length,
|
|
385
|
+
type: 'walletCode'
|
|
378
386
|
});
|
|
379
387
|
return {
|
|
380
|
-
type:
|
|
381
|
-
data:
|
|
388
|
+
type: 'walletCode',
|
|
389
|
+
data: searchResults
|
|
382
390
|
};
|
|
383
391
|
}
|
|
392
|
+
|
|
393
|
+
// 合并钱包参数和搜索参数
|
|
384
394
|
const baseWalletParams = this.walletParams;
|
|
395
|
+
|
|
396
|
+
// 构建完整的搜索参数,包含钱包扣款推荐的所有参数
|
|
385
397
|
const searchParams = {
|
|
386
398
|
// 基础钱包参数
|
|
387
|
-
sale_channel: params.sale_channel ||
|
|
388
|
-
customer_id: params.customer_id ||
|
|
389
|
-
order_expect_amount: params.order_expect_amount ||
|
|
390
|
-
order_product_amount: params.order_product_amount ||
|
|
391
|
-
order_wait_pay_amount: params.order_wait_pay_amount ||
|
|
392
|
-
order_behavior_count_customer_id: params.order_behavior_count_customer_id ||
|
|
393
|
-
products: params.products ||
|
|
394
|
-
prepare_payments: params.prepare_payments ||
|
|
399
|
+
sale_channel: params.sale_channel || baseWalletParams?.sale_channel || 'pos',
|
|
400
|
+
customer_id: params.customer_id || baseWalletParams?.customer_id,
|
|
401
|
+
order_expect_amount: params.order_expect_amount || baseWalletParams?.order_expect_amount,
|
|
402
|
+
order_product_amount: params.order_product_amount || baseWalletParams?.order_product_amount,
|
|
403
|
+
order_wait_pay_amount: params.order_wait_pay_amount || baseWalletParams?.order_wait_pay_amount,
|
|
404
|
+
order_behavior_count_customer_id: params.order_behavior_count_customer_id || baseWalletParams?.order_behavior_count_customer_id || params.customer_id || baseWalletParams?.customer_id,
|
|
405
|
+
products: params.products || baseWalletParams?.products,
|
|
406
|
+
prepare_payments: params.prepare_payments || baseWalletParams?.prepare_payments,
|
|
395
407
|
multiple: 1,
|
|
396
408
|
// 搜索特有参数
|
|
397
409
|
code: params.code,
|
|
398
|
-
payment_order_id: baseWalletParams
|
|
410
|
+
payment_order_id: baseWalletParams?.payment_order_id
|
|
399
411
|
};
|
|
400
|
-
this.paymentModule.logInfo(
|
|
412
|
+
this.paymentModule.logInfo('[WalletPass] 搜索普通识别码', {
|
|
401
413
|
code: searchParams.code,
|
|
402
414
|
customer_id: searchParams.customer_id,
|
|
403
415
|
order_expect_amount: searchParams.order_expect_amount,
|
|
404
416
|
multiple: searchParams.multiple,
|
|
405
|
-
payment_order_id: baseWalletParams
|
|
417
|
+
payment_order_id: baseWalletParams?.payment_order_id
|
|
406
418
|
});
|
|
407
419
|
let response;
|
|
408
|
-
if (!searchParams.products || (
|
|
420
|
+
if (!searchParams.products || (searchParams.products || [])?.length === 0) {
|
|
409
421
|
response = {
|
|
410
422
|
data: []
|
|
411
423
|
};
|
|
412
424
|
} else {
|
|
413
|
-
response = await this.paymentModule.request.post(
|
|
414
|
-
"/machinecode/prepare/deduction/search",
|
|
415
|
-
searchParams
|
|
416
|
-
);
|
|
425
|
+
response = await this.paymentModule.request.post('/machinecode/prepare/deduction/search', searchParams);
|
|
417
426
|
}
|
|
418
|
-
const searchResults =
|
|
427
|
+
const searchResults = response?.data || [];
|
|
419
428
|
if (config.noCache) {
|
|
420
429
|
return {
|
|
421
|
-
type:
|
|
430
|
+
type: 'normalCode',
|
|
422
431
|
data: searchResults
|
|
423
432
|
};
|
|
424
433
|
}
|
|
434
|
+
|
|
435
|
+
// 将搜索结果存储到缓存数组中
|
|
425
436
|
if (searchResults.length > 0) {
|
|
426
|
-
|
|
427
|
-
|
|
428
|
-
);
|
|
429
|
-
const newResults = searchResults.filter(
|
|
430
|
-
(item) => !existingCodes.has(item.code)
|
|
431
|
-
);
|
|
437
|
+
// 避免重复存储相同的识别码
|
|
438
|
+
const existingCodes = new Set(this.searchResults.map(item => item.code));
|
|
439
|
+
const newResults = searchResults.filter(item => !existingCodes.has(item.code));
|
|
432
440
|
this.searchResults.push(...newResults);
|
|
433
441
|
}
|
|
434
|
-
|
|
442
|
+
|
|
443
|
+
// 通过事件暴露当前搜索结果和缓存结果
|
|
444
|
+
this.emitEvent(_types.WalletPassHooks.OnSearchIdentificationCodeCompleted, {
|
|
435
445
|
searchCode: params.code,
|
|
436
446
|
currentSearchResults: searchResults,
|
|
437
447
|
cachedSearchResults: [...this.searchResults],
|
|
438
448
|
searchParams: params
|
|
439
449
|
});
|
|
440
|
-
this.paymentModule.logInfo(
|
|
450
|
+
this.paymentModule.logInfo('[WalletPass] 普通识别码搜索完成', {
|
|
441
451
|
code: params.code,
|
|
442
452
|
results_count: searchResults.length,
|
|
443
453
|
cached_results_count: this.searchResults.length,
|
|
444
|
-
type:
|
|
454
|
+
type: 'normalCode'
|
|
445
455
|
});
|
|
446
456
|
return {
|
|
447
|
-
type:
|
|
457
|
+
type: 'normalCode',
|
|
448
458
|
data: searchResults
|
|
449
459
|
};
|
|
450
460
|
} catch (error) {
|
|
451
|
-
this.paymentModule.logError(
|
|
461
|
+
this.paymentModule.logError('[WalletPass] 搜索识别码信息失败', error, {
|
|
452
462
|
code: params.code,
|
|
453
463
|
customer_id: params.customer_id,
|
|
454
464
|
order_expect_amount: params.order_expect_amount
|
|
@@ -457,19 +467,19 @@ var WalletPassPaymentImpl = class {
|
|
|
457
467
|
}
|
|
458
468
|
}
|
|
459
469
|
async processWalletPayment(amount, orderUuid, voucherId) {
|
|
460
|
-
this.paymentModule.logInfo(
|
|
461
|
-
amount,
|
|
462
|
-
orderUuid,
|
|
463
|
-
voucherId: voucherId ||
|
|
470
|
+
this.paymentModule.logInfo('[WalletPass] 开始处理钱包支付', {
|
|
471
|
+
amount: amount,
|
|
472
|
+
orderUuid: orderUuid,
|
|
473
|
+
voucherId: voucherId || 'none'
|
|
464
474
|
});
|
|
465
475
|
const walletMethod = await this.paymentModule.getWalletPaymentMethod();
|
|
466
476
|
if (!walletMethod) {
|
|
467
|
-
this.paymentModule.logError(
|
|
468
|
-
amount,
|
|
469
|
-
orderUuid,
|
|
470
|
-
voucherId
|
|
477
|
+
this.paymentModule.logError('[WalletPass] 钱包支付方式未找到', null, {
|
|
478
|
+
amount: amount,
|
|
479
|
+
orderUuid: orderUuid,
|
|
480
|
+
voucherId: voucherId
|
|
471
481
|
});
|
|
472
|
-
throw new Error(
|
|
482
|
+
throw new Error('钱包支付方式未找到');
|
|
473
483
|
}
|
|
474
484
|
const paymentItem = {
|
|
475
485
|
amount: amount.toString(),
|
|
@@ -477,83 +487,98 @@ var WalletPassPaymentImpl = class {
|
|
|
477
487
|
custom_payment_id: walletMethod.id,
|
|
478
488
|
name: walletMethod.name,
|
|
479
489
|
type: walletMethod.type,
|
|
480
|
-
voucher_id: voucherId ||
|
|
490
|
+
voucher_id: voucherId || ''
|
|
481
491
|
};
|
|
482
492
|
await this.paymentModule.addPaymentItemAsync(orderUuid, paymentItem);
|
|
483
|
-
this.paymentModule.logInfo(
|
|
484
|
-
amount,
|
|
485
|
-
orderUuid,
|
|
486
|
-
voucherId: voucherId ||
|
|
493
|
+
this.paymentModule.logInfo('[WalletPass] 钱包支付处理完成', {
|
|
494
|
+
amount: amount,
|
|
495
|
+
orderUuid: orderUuid,
|
|
496
|
+
voucherId: voucherId || 'none',
|
|
487
497
|
payment_method: walletMethod.name
|
|
488
498
|
});
|
|
489
499
|
}
|
|
490
500
|
async getWalletBalance(voucherId) {
|
|
501
|
+
// 获取钱包余额的逻辑
|
|
491
502
|
return 0;
|
|
492
503
|
}
|
|
504
|
+
|
|
493
505
|
/**
|
|
494
506
|
* 获取缓存的钱包推荐列表
|
|
495
507
|
*/
|
|
496
508
|
getWalletRecommendList() {
|
|
497
509
|
return this.walletRecommendList;
|
|
498
510
|
}
|
|
511
|
+
|
|
499
512
|
/**
|
|
500
513
|
* 获取缓存的用户识别码列表
|
|
501
514
|
*/
|
|
502
515
|
getUserIdentificationCodes() {
|
|
503
516
|
return this.userIdentificationCodes;
|
|
504
517
|
}
|
|
518
|
+
|
|
505
519
|
/**
|
|
506
520
|
* 清除钱包推荐列表
|
|
507
521
|
*/
|
|
508
522
|
clearWalletRecommendList() {
|
|
509
523
|
this.walletRecommendList = [];
|
|
510
|
-
|
|
511
|
-
|
|
524
|
+
|
|
525
|
+
// 发送钱包推荐列表清除事件
|
|
526
|
+
this.emitEvent(_types.WalletPassHooks.OnWalletRecommendListCleared, {
|
|
527
|
+
clearedTypes: ['walletRecommendList']
|
|
512
528
|
});
|
|
513
|
-
this.paymentModule.logInfo(
|
|
529
|
+
this.paymentModule.logInfo('[WalletPass] 钱包推荐列表已清除');
|
|
514
530
|
}
|
|
531
|
+
|
|
515
532
|
/**
|
|
516
533
|
* 清除用户识别码列表
|
|
517
534
|
*/
|
|
518
535
|
clearUserIdentificationCodes() {
|
|
519
536
|
this.userIdentificationCodes = [];
|
|
520
|
-
|
|
521
|
-
|
|
537
|
+
|
|
538
|
+
// 发送用户识别码列表清除事件
|
|
539
|
+
this.emitEvent(_types.WalletPassHooks.OnUserIdentificationCodesCleared, {
|
|
540
|
+
clearedTypes: ['userIdentificationCodes']
|
|
522
541
|
});
|
|
523
|
-
this.paymentModule.logInfo(
|
|
542
|
+
this.paymentModule.logInfo('[WalletPass] 用户识别码列表已清除');
|
|
524
543
|
}
|
|
544
|
+
|
|
525
545
|
/**
|
|
526
546
|
* 获取缓存的搜索结果列表
|
|
527
547
|
*/
|
|
528
548
|
getSearchResults() {
|
|
529
549
|
return this.searchResults;
|
|
530
550
|
}
|
|
551
|
+
|
|
531
552
|
/**
|
|
532
553
|
* 根据识别码查找搜索结果
|
|
533
554
|
*/
|
|
534
555
|
findSearchResultByCode(code) {
|
|
535
|
-
return this.searchResults.find(
|
|
556
|
+
return this.searchResults.find(item => item.code === code);
|
|
536
557
|
}
|
|
558
|
+
|
|
537
559
|
/**
|
|
538
560
|
* 清除搜索结果缓存
|
|
539
561
|
*/
|
|
540
562
|
clearSearchResults() {
|
|
541
563
|
this.searchResults = [];
|
|
542
|
-
this.paymentModule.logInfo(
|
|
564
|
+
this.paymentModule.logInfo('[WalletPass] 搜索结果缓存已清除');
|
|
543
565
|
}
|
|
566
|
+
|
|
544
567
|
/**
|
|
545
568
|
* 获取存储的钱包初始化数据
|
|
546
569
|
*/
|
|
547
570
|
getStoredWalletInitData() {
|
|
548
571
|
return this.walletInitData;
|
|
549
572
|
}
|
|
573
|
+
|
|
550
574
|
/**
|
|
551
575
|
* 清除存储的钱包初始化数据
|
|
552
576
|
*/
|
|
553
577
|
clearStoredWalletInitData() {
|
|
554
578
|
this.walletInitData = null;
|
|
555
|
-
this.paymentModule.logInfo(
|
|
579
|
+
this.paymentModule.logInfo('[WalletPass] 钱包初始化数据已清除');
|
|
556
580
|
}
|
|
581
|
+
|
|
557
582
|
/**
|
|
558
583
|
* 清除所有缓存数据
|
|
559
584
|
*/
|
|
@@ -563,21 +588,14 @@ var WalletPassPaymentImpl = class {
|
|
|
563
588
|
this.searchResults = [];
|
|
564
589
|
this.walletParams = null;
|
|
565
590
|
this.walletInitData = null;
|
|
566
|
-
|
|
567
|
-
|
|
591
|
+
|
|
592
|
+
// 发送所有缓存清除事件
|
|
593
|
+
this.emitEvent(_types.WalletPassHooks.OnWalletCacheCleared, {
|
|
594
|
+
clearedTypes: ['all']
|
|
568
595
|
});
|
|
569
|
-
this.paymentModule.logInfo(
|
|
570
|
-
cleared_types: [
|
|
571
|
-
"walletRecommendList",
|
|
572
|
-
"userIdentificationCodes",
|
|
573
|
-
"searchResults",
|
|
574
|
-
"walletParams",
|
|
575
|
-
"walletInitData"
|
|
576
|
-
]
|
|
596
|
+
this.paymentModule.logInfo('[WalletPass] 所有缓存数据已清除', {
|
|
597
|
+
cleared_types: ['walletRecommendList', 'userIdentificationCodes', 'searchResults', 'walletParams', 'walletInitData']
|
|
577
598
|
});
|
|
578
599
|
}
|
|
579
|
-
}
|
|
580
|
-
|
|
581
|
-
0 && (module.exports = {
|
|
582
|
-
WalletPassPaymentImpl
|
|
583
|
-
});
|
|
600
|
+
}
|
|
601
|
+
exports.WalletPassPaymentImpl = WalletPassPaymentImpl;
|