@pisell/pisellos 3.0.76 → 3.0.78
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 +1 -2
- package/dist/effects/index.d.ts +3 -5
- package/dist/effects/index.js +8 -40
- package/dist/modules/Account/index.js +3 -2
- package/dist/modules/AccountList/index.d.ts +1 -7
- package/dist/modules/AccountList/index.js +14 -81
- package/dist/modules/AccountList/types.d.ts +0 -28
- package/dist/modules/AccountList/types.js +0 -8
- package/dist/modules/BaseModule.d.ts +0 -3
- package/dist/modules/BaseModule.js +0 -15
- package/dist/modules/Cart/index.d.ts +0 -1
- package/dist/modules/Cart/index.js +1 -2
- package/dist/modules/Date/types.d.ts +3 -1
- package/dist/modules/Discount/index.d.ts +0 -1
- package/dist/modules/Discount/index.js +1 -1
- package/dist/modules/Guests/index.js +9 -9
- package/dist/modules/Order/index.d.ts +1 -25
- package/dist/modules/Order/index.js +3 -224
- package/dist/modules/Order/types.d.ts +0 -45
- package/dist/modules/Order/types.js +0 -8
- package/dist/modules/Order/utils.js +1 -1
- package/dist/modules/Payment/index.d.ts +9 -184
- package/dist/modules/Payment/index.js +109 -2084
- package/dist/modules/Payment/types.d.ts +30 -772
- package/dist/modules/Payment/types.js +12 -236
- package/dist/modules/ProductList/index.d.ts +1 -12
- package/dist/modules/ProductList/index.js +6 -29
- package/dist/modules/Resource/index.js +1 -1
- package/dist/modules/Rules/index.d.ts +4 -3
- package/dist/modules/Rules/index.js +121 -78
- package/dist/modules/Rules/types.d.ts +6 -1
- package/dist/modules/Rules/types.js +8 -0
- package/dist/modules/Schedule/index.d.ts +0 -9
- package/dist/modules/Schedule/index.js +0 -77
- package/dist/modules/index.d.ts +0 -1
- package/dist/modules/index.js +0 -1
- package/dist/plugins/window.d.ts +0 -1
- package/dist/solution/BookingByStep/index.d.ts +17 -0
- package/dist/solution/BookingByStep/index.js +525 -190
- package/dist/solution/BookingByStep/utils/products.d.ts +0 -6
- package/dist/solution/BookingByStep/utils/products.js +0 -10
- package/dist/solution/BookingByStep/utils/resources.js +4 -0
- package/dist/solution/BuyTickets/index.js +8 -7
- package/dist/solution/ShopDiscount/index.d.ts +12 -10
- package/dist/solution/ShopDiscount/index.js +64 -110
- package/dist/solution/ShopDiscount/types.d.ts +0 -8
- package/dist/solution/ShopDiscount/utils.js +1 -0
- package/dist/solution/index.d.ts +0 -2
- package/dist/solution/index.js +1 -3
- package/dist/types/index.d.ts +1 -4
- package/lib/core/index.js +1 -1
- package/lib/effects/index.d.ts +3 -5
- package/lib/effects/index.js +1 -17
- package/lib/modules/Account/index.js +3 -2
- package/lib/modules/AccountList/index.d.ts +1 -7
- package/lib/modules/AccountList/index.js +0 -27
- package/lib/modules/AccountList/types.d.ts +0 -28
- package/lib/modules/BaseModule.d.ts +0 -3
- package/lib/modules/BaseModule.js +0 -9
- package/lib/modules/Cart/index.d.ts +0 -1
- package/lib/modules/Cart/index.js +2 -5
- package/lib/modules/Date/types.d.ts +3 -1
- package/lib/modules/Discount/index.d.ts +0 -1
- package/lib/modules/Discount/index.js +1 -1
- package/lib/modules/Guests/index.js +9 -9
- package/lib/modules/Order/index.d.ts +1 -25
- package/lib/modules/Order/index.js +1 -186
- package/lib/modules/Order/types.d.ts +0 -45
- package/lib/modules/Order/utils.js +1 -1
- package/lib/modules/Payment/index.d.ts +9 -184
- package/lib/modules/Payment/index.js +51 -1084
- package/lib/modules/Payment/types.d.ts +30 -772
- package/lib/modules/Payment/types.js +6 -79
- package/lib/modules/ProductList/index.d.ts +1 -12
- package/lib/modules/ProductList/index.js +5 -31
- package/lib/modules/Resource/index.js +1 -1
- package/lib/modules/Rules/index.d.ts +4 -3
- package/lib/modules/Rules/index.js +64 -43
- package/lib/modules/Rules/types.d.ts +6 -1
- package/lib/modules/Rules/types.js +11 -2
- package/lib/modules/Schedule/index.d.ts +0 -9
- package/lib/modules/Schedule/index.js +0 -60
- package/lib/modules/index.d.ts +0 -1
- package/lib/modules/index.js +0 -2
- package/lib/plugins/window.d.ts +0 -1
- package/lib/solution/BookingByStep/index.d.ts +17 -0
- package/lib/solution/BookingByStep/index.js +325 -60
- package/lib/solution/BookingByStep/utils/products.d.ts +0 -6
- package/lib/solution/BookingByStep/utils/products.js +2 -8
- package/lib/solution/BookingByStep/utils/resources.js +4 -1
- package/lib/solution/BuyTickets/index.js +8 -7
- package/lib/solution/ShopDiscount/index.d.ts +12 -10
- package/lib/solution/ShopDiscount/index.js +30 -51
- package/lib/solution/ShopDiscount/types.d.ts +0 -8
- package/lib/solution/index.d.ts +0 -2
- package/lib/solution/index.js +1 -5
- package/lib/types/index.d.ts +1 -4
- package/package.json +1 -3
- package/dist/modules/Customer/constants.d.ts +0 -7
- package/dist/modules/Customer/constants.js +0 -12
- package/dist/modules/Customer/index.d.ts +0 -122
- package/dist/modules/Customer/index.js +0 -696
- package/dist/modules/Customer/types.d.ts +0 -146
- package/dist/modules/Customer/types.js +0 -41
- package/dist/modules/Payment/cash.d.ts +0 -19
- package/dist/modules/Payment/cash.js +0 -97
- package/dist/modules/Payment/cashRecommendationAlgorithm.d.ts +0 -22
- package/dist/modules/Payment/cashRecommendationAlgorithm.js +0 -423
- package/dist/modules/Payment/eftpos.d.ts +0 -11
- package/dist/modules/Payment/eftpos.js +0 -80
- package/dist/modules/Payment/mx51.d.ts +0 -0
- package/dist/modules/Payment/mx51.js +0 -0
- package/dist/modules/Payment/utils.d.ts +0 -17
- package/dist/modules/Payment/utils.js +0 -62
- package/dist/modules/Payment/walletpass.d.ts +0 -99
- package/dist/modules/Payment/walletpass.js +0 -711
- package/dist/plugins/app-types/app/app.d.ts +0 -83
- package/dist/plugins/app-types/app/const.d.ts +0 -4
- package/dist/plugins/app-types/app/index.d.ts +0 -14
- package/dist/plugins/app-types/applicationManager/application.d.ts +0 -50
- package/dist/plugins/app-types/applicationManager/index.d.ts +0 -13
- package/dist/plugins/app-types/config.d.ts +0 -3
- package/dist/plugins/app-types/cookie/index.d.ts +0 -13
- package/dist/plugins/app-types/data/index.d.ts +0 -8
- package/dist/plugins/app-types/history/config.d.ts +0 -24
- package/dist/plugins/app-types/history/index.d.ts +0 -20
- package/dist/plugins/app-types/history/type.d.ts +0 -2
- package/dist/plugins/app-types/hooks/index.d.ts +0 -12
- package/dist/plugins/app-types/hooks/useDelayedValue/index.d.ts +0 -2
- package/dist/plugins/app-types/hooks/useDispatch/index.d.ts +0 -2
- package/dist/plugins/app-types/hooks/useLowCode/index.d.ts +0 -13
- package/dist/plugins/app-types/hooks/useStore/index.d.ts +0 -6
- package/dist/plugins/app-types/index.d.ts +0 -6
- package/dist/plugins/app-types/indexDB/index.d.ts +0 -178
- package/dist/plugins/app-types/locales/en.d.ts +0 -3
- package/dist/plugins/app-types/locales/index.d.ts +0 -37
- package/dist/plugins/app-types/locales/original.d.ts +0 -3
- package/dist/plugins/app-types/locales/type.d.ts +0 -19
- package/dist/plugins/app-types/locales/zh-CN.d.ts +0 -3
- package/dist/plugins/app-types/locales/zh-HK.d.ts +0 -3
- package/dist/plugins/app-types/logger/feishu.d.ts +0 -11
- package/dist/plugins/app-types/logger/index.d.ts +0 -122
- package/dist/plugins/app-types/menuManager/hooks.d.ts +0 -17
- package/dist/plugins/app-types/menuManager/index.d.ts +0 -28
- package/dist/plugins/app-types/models/global.d.ts +0 -32
- package/dist/plugins/app-types/models/index.d.ts +0 -45
- package/dist/plugins/app-types/models/type.d.ts +0 -2
- package/dist/plugins/app-types/package.json +0 -15
- package/dist/plugins/app-types/plugin/index.d.ts +0 -0
- package/dist/plugins/app-types/pubsub/example.d.ts +0 -5
- package/dist/plugins/app-types/pubsub/index.d.ts +0 -63
- package/dist/plugins/app-types/request/cache.d.ts +0 -46
- package/dist/plugins/app-types/request/cancelToken.d.ts +0 -38
- package/dist/plugins/app-types/request/config.d.ts +0 -3
- package/dist/plugins/app-types/request/constants.d.ts +0 -2
- package/dist/plugins/app-types/request/index.d.ts +0 -24
- package/dist/plugins/app-types/request/pisell2Request.d.ts +0 -6
- package/dist/plugins/app-types/request/type.d.ts +0 -41
- package/dist/plugins/app-types/request/utils.d.ts +0 -46
- package/dist/plugins/app-types/routes/config.d.ts +0 -7
- package/dist/plugins/app-types/routes/index.d.ts +0 -28
- package/dist/plugins/app-types/socket/components/SocketMonitorPage.d.ts +0 -6
- package/dist/plugins/app-types/socket/components/index.d.ts +0 -2
- package/dist/plugins/app-types/socket/constants.d.ts +0 -33
- package/dist/plugins/app-types/socket/events.d.ts +0 -31
- package/dist/plugins/app-types/socket/heartbeat.d.ts +0 -66
- package/dist/plugins/app-types/socket/index.d.ts +0 -61
- package/dist/plugins/app-types/socket/monitor.d.ts +0 -169
- package/dist/plugins/app-types/socket/reconnect.d.ts +0 -61
- package/dist/plugins/app-types/socket/socket.d.ts +0 -129
- package/dist/plugins/app-types/socket/types.d.ts +0 -85
- package/dist/plugins/app-types/storage/index.d.ts +0 -17
- package/dist/plugins/app-types/tasks/index.d.ts +0 -77
- package/dist/plugins/app-types/tasks/type.d.ts +0 -62
- package/dist/plugins/app-types/tasks/useTasks.d.ts +0 -5
- package/dist/plugins/app-types/type.d.ts +0 -2
- package/dist/plugins/app-types/variables/VariablesProvider.d.ts +0 -7
- package/dist/plugins/app-types/variables/config.d.ts +0 -3
- package/dist/plugins/app-types/variables/index.d.ts +0 -6
- package/dist/plugins/app-types/variables/type.d.ts +0 -2
- package/dist/plugins/app-types/website/index.d.ts +0 -6
- package/dist/plugins/app.d.ts +0 -8
- package/dist/plugins/app.js +0 -1
- package/dist/solution/BookingTicket/index.d.ts +0 -184
- package/dist/solution/BookingTicket/index.js +0 -698
- package/dist/solution/BookingTicket/types.d.ts +0 -68
- package/dist/solution/BookingTicket/types.js +0 -43
- package/dist/solution/BookingTicket/utils/scan/cloudSearch.d.ts +0 -22
- package/dist/solution/BookingTicket/utils/scan/cloudSearch.js +0 -159
- package/dist/solution/BookingTicket/utils/scan/handleScan.d.ts +0 -22
- package/dist/solution/BookingTicket/utils/scan/handleScan.js +0 -189
- package/dist/solution/BookingTicket/utils/scan/index.d.ts +0 -85
- package/dist/solution/BookingTicket/utils/scan/index.js +0 -294
- package/dist/solution/BookingTicket/utils/scan/scanCache.d.ts +0 -78
- package/dist/solution/BookingTicket/utils/scan/scanCache.js +0 -305
- package/dist/solution/Checkout/appointmentDemo.json +0 -1
- package/dist/solution/Checkout/index.d.ts +0 -432
- package/dist/solution/Checkout/index.js +0 -4452
- package/dist/solution/Checkout/types.d.ts +0 -727
- package/dist/solution/Checkout/types.js +0 -104
- package/dist/solution/Checkout/utils/index.d.ts +0 -121
- package/dist/solution/Checkout/utils/index.js +0 -511
- package/dist/utils/task.d.ts +0 -40
- package/dist/utils/task.js +0 -171
- package/dist/utils/watch.d.ts +0 -102
- package/dist/utils/watch.js +0 -294
- package/lib/modules/Customer/constants.d.ts +0 -7
- package/lib/modules/Customer/constants.js +0 -39
- package/lib/modules/Customer/index.d.ts +0 -122
- package/lib/modules/Customer/index.js +0 -439
- package/lib/modules/Customer/types.d.ts +0 -146
- package/lib/modules/Customer/types.js +0 -37
- package/lib/modules/Payment/cash.d.ts +0 -19
- package/lib/modules/Payment/cash.js +0 -64
- package/lib/modules/Payment/cashRecommendationAlgorithm.d.ts +0 -22
- package/lib/modules/Payment/cashRecommendationAlgorithm.js +0 -342
- package/lib/modules/Payment/eftpos.d.ts +0 -11
- package/lib/modules/Payment/eftpos.js +0 -51
- package/lib/modules/Payment/mx51.d.ts +0 -0
- package/lib/modules/Payment/mx51.js +0 -0
- package/lib/modules/Payment/utils.d.ts +0 -17
- package/lib/modules/Payment/utils.js +0 -67
- package/lib/modules/Payment/walletpass.d.ts +0 -99
- package/lib/modules/Payment/walletpass.js +0 -484
- package/lib/plugins/app-types/app/app.d.ts +0 -83
- package/lib/plugins/app-types/app/const.d.ts +0 -4
- package/lib/plugins/app-types/app/index.d.ts +0 -14
- package/lib/plugins/app-types/applicationManager/application.d.ts +0 -50
- package/lib/plugins/app-types/applicationManager/index.d.ts +0 -13
- package/lib/plugins/app-types/config.d.ts +0 -3
- package/lib/plugins/app-types/cookie/index.d.ts +0 -13
- package/lib/plugins/app-types/data/index.d.ts +0 -8
- package/lib/plugins/app-types/history/config.d.ts +0 -24
- package/lib/plugins/app-types/history/index.d.ts +0 -20
- package/lib/plugins/app-types/history/type.d.ts +0 -2
- package/lib/plugins/app-types/hooks/index.d.ts +0 -12
- package/lib/plugins/app-types/hooks/useDelayedValue/index.d.ts +0 -2
- package/lib/plugins/app-types/hooks/useDispatch/index.d.ts +0 -2
- package/lib/plugins/app-types/hooks/useLowCode/index.d.ts +0 -13
- package/lib/plugins/app-types/hooks/useStore/index.d.ts +0 -6
- package/lib/plugins/app-types/index.d.ts +0 -6
- package/lib/plugins/app-types/indexDB/index.d.ts +0 -178
- package/lib/plugins/app-types/locales/en.d.ts +0 -3
- package/lib/plugins/app-types/locales/index.d.ts +0 -37
- package/lib/plugins/app-types/locales/original.d.ts +0 -3
- package/lib/plugins/app-types/locales/type.d.ts +0 -19
- package/lib/plugins/app-types/locales/zh-CN.d.ts +0 -3
- package/lib/plugins/app-types/locales/zh-HK.d.ts +0 -3
- package/lib/plugins/app-types/logger/feishu.d.ts +0 -11
- package/lib/plugins/app-types/logger/index.d.ts +0 -122
- package/lib/plugins/app-types/menuManager/hooks.d.ts +0 -17
- package/lib/plugins/app-types/menuManager/index.d.ts +0 -28
- package/lib/plugins/app-types/models/global.d.ts +0 -32
- package/lib/plugins/app-types/models/index.d.ts +0 -45
- package/lib/plugins/app-types/models/type.d.ts +0 -2
- package/lib/plugins/app-types/package.json +0 -15
- package/lib/plugins/app-types/plugin/index.d.ts +0 -0
- package/lib/plugins/app-types/pubsub/example.d.ts +0 -5
- package/lib/plugins/app-types/pubsub/index.d.ts +0 -63
- package/lib/plugins/app-types/request/cache.d.ts +0 -46
- package/lib/plugins/app-types/request/cancelToken.d.ts +0 -38
- package/lib/plugins/app-types/request/config.d.ts +0 -3
- package/lib/plugins/app-types/request/constants.d.ts +0 -2
- package/lib/plugins/app-types/request/index.d.ts +0 -24
- package/lib/plugins/app-types/request/pisell2Request.d.ts +0 -6
- package/lib/plugins/app-types/request/type.d.ts +0 -41
- package/lib/plugins/app-types/request/utils.d.ts +0 -46
- package/lib/plugins/app-types/routes/config.d.ts +0 -7
- package/lib/plugins/app-types/routes/index.d.ts +0 -28
- package/lib/plugins/app-types/socket/components/SocketMonitorPage.d.ts +0 -6
- package/lib/plugins/app-types/socket/components/index.d.ts +0 -2
- package/lib/plugins/app-types/socket/constants.d.ts +0 -33
- package/lib/plugins/app-types/socket/events.d.ts +0 -31
- package/lib/plugins/app-types/socket/heartbeat.d.ts +0 -66
- package/lib/plugins/app-types/socket/index.d.ts +0 -61
- package/lib/plugins/app-types/socket/monitor.d.ts +0 -169
- package/lib/plugins/app-types/socket/reconnect.d.ts +0 -61
- package/lib/plugins/app-types/socket/socket.d.ts +0 -129
- package/lib/plugins/app-types/socket/types.d.ts +0 -85
- package/lib/plugins/app-types/storage/index.d.ts +0 -17
- package/lib/plugins/app-types/tasks/index.d.ts +0 -77
- package/lib/plugins/app-types/tasks/type.d.ts +0 -62
- package/lib/plugins/app-types/tasks/useTasks.d.ts +0 -5
- package/lib/plugins/app-types/type.d.ts +0 -2
- package/lib/plugins/app-types/variables/VariablesProvider.d.ts +0 -7
- package/lib/plugins/app-types/variables/config.d.ts +0 -3
- package/lib/plugins/app-types/variables/index.d.ts +0 -6
- package/lib/plugins/app-types/variables/type.d.ts +0 -2
- package/lib/plugins/app-types/website/index.d.ts +0 -6
- package/lib/plugins/app.d.ts +0 -8
- package/lib/plugins/app.js +0 -17
- package/lib/solution/BookingTicket/index.d.ts +0 -184
- package/lib/solution/BookingTicket/index.js +0 -426
- package/lib/solution/BookingTicket/types.d.ts +0 -68
- package/lib/solution/BookingTicket/types.js +0 -72
- package/lib/solution/BookingTicket/utils/scan/cloudSearch.d.ts +0 -22
- package/lib/solution/BookingTicket/utils/scan/cloudSearch.js +0 -117
- package/lib/solution/BookingTicket/utils/scan/handleScan.d.ts +0 -22
- package/lib/solution/BookingTicket/utils/scan/handleScan.js +0 -132
- package/lib/solution/BookingTicket/utils/scan/index.d.ts +0 -85
- package/lib/solution/BookingTicket/utils/scan/index.js +0 -216
- package/lib/solution/BookingTicket/utils/scan/scanCache.d.ts +0 -78
- package/lib/solution/BookingTicket/utils/scan/scanCache.js +0 -231
- package/lib/solution/Checkout/appointmentDemo.json +0 -1
- package/lib/solution/Checkout/index.d.ts +0 -432
- package/lib/solution/Checkout/index.js +0 -2776
- package/lib/solution/Checkout/types.d.ts +0 -727
- package/lib/solution/Checkout/types.js +0 -63
- package/lib/solution/Checkout/utils/index.d.ts +0 -121
- package/lib/solution/Checkout/utils/index.js +0 -362
- package/lib/utils/task.d.ts +0 -40
- package/lib/utils/task.js +0 -109
- package/lib/utils/watch.d.ts +0 -102
- package/lib/utils/watch.js +0 -217
|
@@ -1,99 +0,0 @@
|
|
|
1
|
-
import { WalletPassPayment, WalletDeductionRecommendParams, WalletRecommendItem, UserIdentificationCodeParams, UserIdentificationCodeItem, SearchIdentificationCodeParams, SearchIdentificationCodeItem, SearchIdentificationCodeResult, WalletInitBusinessData } from './types';
|
|
2
|
-
import type { PaymentModule } from './index';
|
|
3
|
-
/**
|
|
4
|
-
* 钱包支付实现
|
|
5
|
-
*/
|
|
6
|
-
export declare class WalletPassPaymentImpl implements WalletPassPayment {
|
|
7
|
-
private paymentModule;
|
|
8
|
-
private walletRecommendList;
|
|
9
|
-
private userIdentificationCodes;
|
|
10
|
-
private searchResults;
|
|
11
|
-
private walletParams;
|
|
12
|
-
constructor(paymentModule: PaymentModule);
|
|
13
|
-
/**
|
|
14
|
-
* 发送事件的辅助方法
|
|
15
|
-
* 支持使用WalletPassHooks或PaymentHooks
|
|
16
|
-
*/
|
|
17
|
-
private emitEvent;
|
|
18
|
-
/**
|
|
19
|
-
* 生成钱包API默认参数
|
|
20
|
-
* 根据业务数据生成标准的钱包API参数,并存储在模块中
|
|
21
|
-
*/
|
|
22
|
-
generateWalletParams(businessData: WalletInitBusinessData): WalletDeductionRecommendParams;
|
|
23
|
-
/**
|
|
24
|
-
* 获取已存储的钱包参数
|
|
25
|
-
* 返回之前生成并存储的钱包参数
|
|
26
|
-
*/
|
|
27
|
-
getStoredWalletParams(): WalletDeductionRecommendParams | null;
|
|
28
|
-
/**
|
|
29
|
-
* 清理已存储的钱包参数
|
|
30
|
-
* 清除之前存储的钱包参数
|
|
31
|
-
*/
|
|
32
|
-
clearStoredWalletParams(): void;
|
|
33
|
-
/**
|
|
34
|
-
* 从业务数据初始化钱包数据
|
|
35
|
-
* 内部生成参数,然后调用标准的初始化流程
|
|
36
|
-
*/
|
|
37
|
-
initializeWalletDataFromBusinessAsync(businessData: WalletInitBusinessData): Promise<{
|
|
38
|
-
walletRecommendList: WalletRecommendItem[];
|
|
39
|
-
userIdentificationCodes: UserIdentificationCodeItem[];
|
|
40
|
-
}>;
|
|
41
|
-
/**
|
|
42
|
-
* 初始化钱包数据
|
|
43
|
-
* 先获取推荐列表,再获取用户识别码列表(顺序执行)
|
|
44
|
-
*/
|
|
45
|
-
initializeWalletDataAsync(baseParams: WalletDeductionRecommendParams): Promise<{
|
|
46
|
-
walletRecommendList: WalletRecommendItem[];
|
|
47
|
-
userIdentificationCodes: UserIdentificationCodeItem[];
|
|
48
|
-
}>;
|
|
49
|
-
getWalletPassRecommendListAsync(params: WalletDeductionRecommendParams): Promise<WalletRecommendItem[]>;
|
|
50
|
-
formatWalletPassList2PreparePayments(list: WalletRecommendItem[]): {
|
|
51
|
-
voucher_id: number;
|
|
52
|
-
amount: number;
|
|
53
|
-
tag: string;
|
|
54
|
-
}[];
|
|
55
|
-
getUserIdentificationCodeListAsync(params: UserIdentificationCodeParams): Promise<UserIdentificationCodeItem[]>;
|
|
56
|
-
/**
|
|
57
|
-
* 搜索识别码信息
|
|
58
|
-
* 通过识别码搜索相关的钱包通行证信息
|
|
59
|
-
* 基于 WalletDeductionRecommendParams 参数结构
|
|
60
|
-
* 特殊逻辑:当识别码长度为9位且前3位为"000"时,调用 /wallet/detail/search 接口
|
|
61
|
-
*/
|
|
62
|
-
searchIdentificationCodeAsync(params: SearchIdentificationCodeParams, config?: {
|
|
63
|
-
noCache?: boolean;
|
|
64
|
-
}): Promise<SearchIdentificationCodeResult>;
|
|
65
|
-
processWalletPayment(amount: number, orderUuid: string, voucherId?: string): Promise<void>;
|
|
66
|
-
getWalletBalance(voucherId: string): Promise<number>;
|
|
67
|
-
/**
|
|
68
|
-
* 获取缓存的钱包推荐列表
|
|
69
|
-
*/
|
|
70
|
-
getWalletRecommendList(): WalletRecommendItem[];
|
|
71
|
-
/**
|
|
72
|
-
* 获取缓存的用户识别码列表
|
|
73
|
-
*/
|
|
74
|
-
getUserIdentificationCodes(): UserIdentificationCodeItem[];
|
|
75
|
-
/**
|
|
76
|
-
* 清除钱包推荐列表
|
|
77
|
-
*/
|
|
78
|
-
clearWalletRecommendList(): void;
|
|
79
|
-
/**
|
|
80
|
-
* 清除用户识别码列表
|
|
81
|
-
*/
|
|
82
|
-
clearUserIdentificationCodes(): void;
|
|
83
|
-
/**
|
|
84
|
-
* 获取缓存的搜索结果列表
|
|
85
|
-
*/
|
|
86
|
-
getSearchResults(): SearchIdentificationCodeItem[];
|
|
87
|
-
/**
|
|
88
|
-
* 根据识别码查找搜索结果
|
|
89
|
-
*/
|
|
90
|
-
findSearchResultByCode(code: string): SearchIdentificationCodeItem | undefined;
|
|
91
|
-
/**
|
|
92
|
-
* 清除搜索结果缓存
|
|
93
|
-
*/
|
|
94
|
-
clearSearchResults(): void;
|
|
95
|
-
/**
|
|
96
|
-
* 清除所有缓存数据
|
|
97
|
-
*/
|
|
98
|
-
clearAllCache(): void;
|
|
99
|
-
}
|
|
@@ -1,484 +0,0 @@
|
|
|
1
|
-
var __defProp = Object.defineProperty;
|
|
2
|
-
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
3
|
-
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
4
|
-
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
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
|
|
23
|
-
});
|
|
24
|
-
module.exports = __toCommonJS(walletpass_exports);
|
|
25
|
-
var import_types = require("./types");
|
|
26
|
-
var import_utils = require("./utils");
|
|
27
|
-
var WalletPassPaymentImpl = class {
|
|
28
|
-
constructor(paymentModule) {
|
|
29
|
-
this.paymentModule = paymentModule;
|
|
30
|
-
this.walletRecommendList = [];
|
|
31
|
-
this.userIdentificationCodes = [];
|
|
32
|
-
this.searchResults = [];
|
|
33
|
-
this.walletParams = null;
|
|
34
|
-
}
|
|
35
|
-
/**
|
|
36
|
-
* 发送事件的辅助方法
|
|
37
|
-
* 支持使用WalletPassHooks或PaymentHooks
|
|
38
|
-
*/
|
|
39
|
-
emitEvent(hook, data) {
|
|
40
|
-
try {
|
|
41
|
-
const eventName = hook.split(":")[1] || hook.replace(/^[A-Z][a-z]+/, "").replace(/^On/, "").toLowerCase();
|
|
42
|
-
const fullEventName = `${this.paymentModule.name}:${eventName}`;
|
|
43
|
-
this.paymentModule.core.effects.emit(fullEventName, data);
|
|
44
|
-
} catch (error) {
|
|
45
|
-
this.paymentModule.logError("[WalletPass] 发送事件失败", error, { hook });
|
|
46
|
-
}
|
|
47
|
-
}
|
|
48
|
-
/**
|
|
49
|
-
* 生成钱包API默认参数
|
|
50
|
-
* 根据业务数据生成标准的钱包API参数,并存储在模块中
|
|
51
|
-
*/
|
|
52
|
-
generateWalletParams(businessData) {
|
|
53
|
-
var _a;
|
|
54
|
-
const {
|
|
55
|
-
customer_id,
|
|
56
|
-
amountInfo,
|
|
57
|
-
products,
|
|
58
|
-
order_wait_pay_amount,
|
|
59
|
-
payment_order_id,
|
|
60
|
-
is_price_include_tax
|
|
61
|
-
} = businessData;
|
|
62
|
-
const totalAmount = Number(amountInfo.totalAmount);
|
|
63
|
-
const subTotal = Number(amountInfo.subTotal);
|
|
64
|
-
const walletParams = {
|
|
65
|
-
is_price_include_tax,
|
|
66
|
-
sale_channel: "pos",
|
|
67
|
-
customer_id: customer_id || 0,
|
|
68
|
-
// 提供默认值,确保类型为 number
|
|
69
|
-
order_expect_amount: totalAmount,
|
|
70
|
-
// 订单小计金额
|
|
71
|
-
order_product_amount: subTotal,
|
|
72
|
-
// 订单待支付金额
|
|
73
|
-
order_wait_pay_amount: order_wait_pay_amount || ((amountInfo == null ? void 0 : amountInfo.isDeposit) ? Number(amountInfo == null ? void 0 : amountInfo.depositAmount) : totalAmount),
|
|
74
|
-
// order_behavior_count_customer_id: 1,
|
|
75
|
-
products,
|
|
76
|
-
prepare_payments: [],
|
|
77
|
-
payment_order_id
|
|
78
|
-
};
|
|
79
|
-
this.walletParams = walletParams;
|
|
80
|
-
this.paymentModule.logInfo("[WalletPass] 钱包默认参数已生成并存储", {
|
|
81
|
-
customer_id: walletParams.customer_id,
|
|
82
|
-
order_expect_amount: walletParams.order_expect_amount,
|
|
83
|
-
order_product_amount: walletParams.order_product_amount,
|
|
84
|
-
order_wait_pay_amount: walletParams.order_wait_pay_amount,
|
|
85
|
-
products_count: ((_a = walletParams.products) == null ? void 0 : _a.length) || 0
|
|
86
|
-
});
|
|
87
|
-
return walletParams;
|
|
88
|
-
}
|
|
89
|
-
/**
|
|
90
|
-
* 获取已存储的钱包参数
|
|
91
|
-
* 返回之前生成并存储的钱包参数
|
|
92
|
-
*/
|
|
93
|
-
getStoredWalletParams() {
|
|
94
|
-
return this.walletParams;
|
|
95
|
-
}
|
|
96
|
-
/**
|
|
97
|
-
* 清理已存储的钱包参数
|
|
98
|
-
* 清除之前存储的钱包参数
|
|
99
|
-
*/
|
|
100
|
-
clearStoredWalletParams() {
|
|
101
|
-
this.walletParams = null;
|
|
102
|
-
this.paymentModule.logInfo("[WalletPass] 已存储的钱包参数已清理");
|
|
103
|
-
}
|
|
104
|
-
/**
|
|
105
|
-
* 从业务数据初始化钱包数据
|
|
106
|
-
* 内部生成参数,然后调用标准的初始化流程
|
|
107
|
-
*/
|
|
108
|
-
async initializeWalletDataFromBusinessAsync(businessData) {
|
|
109
|
-
var _a, _b, _c, _d, _e, _f, _g, _h;
|
|
110
|
-
const startTime = Date.now();
|
|
111
|
-
const walletParams = this.generateWalletParams(businessData);
|
|
112
|
-
if (Number(((_a = businessData == null ? void 0 : businessData.amountInfo) == null ? void 0 : _a.totalAmount) || 0) < 0 || Number(((_b = businessData == null ? void 0 : businessData.amountInfo) == null ? void 0 : _b.subTotal) || 0) < 0) {
|
|
113
|
-
return {
|
|
114
|
-
walletRecommendList: [],
|
|
115
|
-
userIdentificationCodes: []
|
|
116
|
-
};
|
|
117
|
-
}
|
|
118
|
-
this.emitEvent(import_types.WalletPassHooks.OnWalletInitializationStarted, {
|
|
119
|
-
businessData,
|
|
120
|
-
startTime
|
|
121
|
-
});
|
|
122
|
-
this.paymentModule.logInfo("[WalletPass] 开始从业务数据初始化钱包数据", {
|
|
123
|
-
customer_id: businessData.customer_id,
|
|
124
|
-
totalAmount: (_c = businessData.amountInfo) == null ? void 0 : _c.totalAmount,
|
|
125
|
-
subTotal: (_d = businessData.amountInfo) == null ? void 0 : _d.subTotal,
|
|
126
|
-
order_wait_pay_amount: businessData.order_wait_pay_amount,
|
|
127
|
-
products_count: ((_e = businessData.products) == null ? void 0 : _e.length) || 0
|
|
128
|
-
});
|
|
129
|
-
try {
|
|
130
|
-
const result = await this.initializeWalletDataAsync(walletParams);
|
|
131
|
-
const endTime = Date.now();
|
|
132
|
-
const duration = endTime - startTime;
|
|
133
|
-
this.emitEvent(import_types.WalletPassHooks.OnWalletInitializationCompleted, {
|
|
134
|
-
businessData,
|
|
135
|
-
result,
|
|
136
|
-
startTime,
|
|
137
|
-
endTime,
|
|
138
|
-
duration
|
|
139
|
-
});
|
|
140
|
-
this.paymentModule.logInfo(`[WalletPass] 从业务数据初始化钱包数据成功`, {
|
|
141
|
-
duration: `${duration}ms`,
|
|
142
|
-
walletRecommendList_count: ((_f = result.walletRecommendList) == null ? void 0 : _f.length) || 0,
|
|
143
|
-
userIdentificationCodes_count: ((_g = result.userIdentificationCodes) == null ? void 0 : _g.length) || 0
|
|
144
|
-
});
|
|
145
|
-
return result;
|
|
146
|
-
} catch (error) {
|
|
147
|
-
const endTime = Date.now();
|
|
148
|
-
const duration = endTime - startTime;
|
|
149
|
-
this.emitEvent(import_types.WalletPassHooks.OnWalletInitializationFailed, {
|
|
150
|
-
businessData,
|
|
151
|
-
error,
|
|
152
|
-
startTime,
|
|
153
|
-
endTime,
|
|
154
|
-
duration
|
|
155
|
-
});
|
|
156
|
-
this.paymentModule.logError(`[WalletPass] 从业务数据初始化钱包数据失败`, error, {
|
|
157
|
-
duration: `${duration}ms`,
|
|
158
|
-
customer_id: businessData.customer_id,
|
|
159
|
-
totalAmount: (_h = businessData.amountInfo) == null ? void 0 : _h.totalAmount
|
|
160
|
-
});
|
|
161
|
-
throw error;
|
|
162
|
-
}
|
|
163
|
-
}
|
|
164
|
-
/**
|
|
165
|
-
* 初始化钱包数据
|
|
166
|
-
* 先获取推荐列表,再获取用户识别码列表(顺序执行)
|
|
167
|
-
*/
|
|
168
|
-
async initializeWalletDataAsync(baseParams) {
|
|
169
|
-
try {
|
|
170
|
-
const walletRecommendList = await this.getWalletPassRecommendListAsync(baseParams);
|
|
171
|
-
const identificationParams = {
|
|
172
|
-
...baseParams,
|
|
173
|
-
available: 2,
|
|
174
|
-
prepare_payments: this.formatWalletPassList2PreparePayments(walletRecommendList),
|
|
175
|
-
other_exact_codes: [],
|
|
176
|
-
filter_prepare_wallet_pass: 1
|
|
177
|
-
};
|
|
178
|
-
const userIdentificationCodes = await this.getUserIdentificationCodeListAsync(identificationParams);
|
|
179
|
-
return {
|
|
180
|
-
walletRecommendList,
|
|
181
|
-
userIdentificationCodes
|
|
182
|
-
};
|
|
183
|
-
} catch (error) {
|
|
184
|
-
this.paymentModule.logError("[WalletPass] 初始化钱包数据失败", error, {
|
|
185
|
-
customer_id: baseParams.customer_id,
|
|
186
|
-
order_expect_amount: baseParams.order_expect_amount
|
|
187
|
-
});
|
|
188
|
-
throw error;
|
|
189
|
-
}
|
|
190
|
-
}
|
|
191
|
-
async getWalletPassRecommendListAsync(params) {
|
|
192
|
-
var _a;
|
|
193
|
-
try {
|
|
194
|
-
this.paymentModule.logInfo("[WalletPass] 开始获取钱包推荐列表", {
|
|
195
|
-
customer_id: params.customer_id,
|
|
196
|
-
order_expect_amount: params.order_expect_amount,
|
|
197
|
-
sale_channel: params.sale_channel,
|
|
198
|
-
payment_order_id: (_a = this.walletParams) == null ? void 0 : _a.payment_order_id
|
|
199
|
-
});
|
|
200
|
-
const response = await this.paymentModule.request.post(
|
|
201
|
-
"/machinecode/prepare/deduction/recommend",
|
|
202
|
-
params
|
|
203
|
-
// 将 params 作为请求体数据
|
|
204
|
-
);
|
|
205
|
-
this.walletRecommendList = (response == null ? void 0 : response.data) || [];
|
|
206
|
-
this.emitEvent(import_types.WalletPassHooks.OnWalletRecommendListUpdated, {
|
|
207
|
-
walletRecommendList: this.walletRecommendList
|
|
208
|
-
});
|
|
209
|
-
this.paymentModule.logInfo("[WalletPass] 钱包推荐列表已更新", {
|
|
210
|
-
count: this.walletRecommendList.length,
|
|
211
|
-
items: this.walletRecommendList.map((item) => ({
|
|
212
|
-
voucher_id: item.voucher_id,
|
|
213
|
-
name: item.name,
|
|
214
|
-
amount: item.amount,
|
|
215
|
-
tag: item.tag
|
|
216
|
-
}))
|
|
217
|
-
});
|
|
218
|
-
return this.walletRecommendList;
|
|
219
|
-
} catch (error) {
|
|
220
|
-
this.paymentModule.logError("[WalletPass] 获取钱包推荐列表失败", error, {
|
|
221
|
-
customer_id: params.customer_id,
|
|
222
|
-
order_expect_amount: params.order_expect_amount,
|
|
223
|
-
sale_channel: params.sale_channel
|
|
224
|
-
});
|
|
225
|
-
return [];
|
|
226
|
-
}
|
|
227
|
-
}
|
|
228
|
-
formatWalletPassList2PreparePayments(list) {
|
|
229
|
-
return (0, import_utils.formatWalletPassList2PreparePayments)(list);
|
|
230
|
-
}
|
|
231
|
-
async getUserIdentificationCodeListAsync(params) {
|
|
232
|
-
var _a, _b;
|
|
233
|
-
try {
|
|
234
|
-
const newParams = {
|
|
235
|
-
...this.walletParams,
|
|
236
|
-
...params
|
|
237
|
-
};
|
|
238
|
-
this.paymentModule.logInfo("[WalletPass] 开始获取用户识别码列表", {
|
|
239
|
-
customer_id: newParams.customer_id,
|
|
240
|
-
available: newParams.available,
|
|
241
|
-
prepare_payments_count: ((_a = newParams.prepare_payments) == null ? void 0 : _a.length) || 0,
|
|
242
|
-
filter_prepare_wallet_pass: newParams.filter_prepare_wallet_pass,
|
|
243
|
-
payment_order_id: (_b = this.walletParams) == null ? void 0 : _b.payment_order_id
|
|
244
|
-
});
|
|
245
|
-
const response = await this.paymentModule.request.post(
|
|
246
|
-
"/machinecode/prepare/deduction",
|
|
247
|
-
newParams
|
|
248
|
-
);
|
|
249
|
-
const sortedData = (0, import_utils.sortUserIdentificationCodeList)((response == null ? void 0 : response.data) || []);
|
|
250
|
-
this.userIdentificationCodes = sortedData;
|
|
251
|
-
this.emitEvent(import_types.WalletPassHooks.OnUserIdentificationCodesUpdated, {
|
|
252
|
-
userIdentificationCodes: this.userIdentificationCodes
|
|
253
|
-
});
|
|
254
|
-
this.paymentModule.logInfo("[WalletPass] 用户识别码列表已更新", {
|
|
255
|
-
count: this.userIdentificationCodes.length,
|
|
256
|
-
sorted_items: this.userIdentificationCodes.slice(0, 5).map((item) => ({
|
|
257
|
-
code: item.code,
|
|
258
|
-
error_code: item.error_code,
|
|
259
|
-
error_msg: item.error_msg
|
|
260
|
-
}))
|
|
261
|
-
});
|
|
262
|
-
return this.userIdentificationCodes;
|
|
263
|
-
} catch (error) {
|
|
264
|
-
this.paymentModule.logError("[WalletPass] 获取用户识别码列表失败", error, {
|
|
265
|
-
customer_id: params.customer_id,
|
|
266
|
-
available: params.available
|
|
267
|
-
});
|
|
268
|
-
return [];
|
|
269
|
-
}
|
|
270
|
-
}
|
|
271
|
-
/**
|
|
272
|
-
* 搜索识别码信息
|
|
273
|
-
* 通过识别码搜索相关的钱包通行证信息
|
|
274
|
-
* 基于 WalletDeductionRecommendParams 参数结构
|
|
275
|
-
* 特殊逻辑:当识别码长度为9位且前3位为"000"时,调用 /wallet/detail/search 接口
|
|
276
|
-
*/
|
|
277
|
-
async searchIdentificationCodeAsync(params, config = {}) {
|
|
278
|
-
try {
|
|
279
|
-
const { code } = params;
|
|
280
|
-
this.paymentModule.logInfo("[WalletPass] 开始搜索识别码", {
|
|
281
|
-
code,
|
|
282
|
-
code_length: code.length,
|
|
283
|
-
noCache: config.noCache || false
|
|
284
|
-
});
|
|
285
|
-
const isWalletCode = code.length === 9 && code.startsWith("000");
|
|
286
|
-
if (isWalletCode) {
|
|
287
|
-
const walletDetailParams = {
|
|
288
|
-
code,
|
|
289
|
-
with_customer: 1,
|
|
290
|
-
with: ["wallet"]
|
|
291
|
-
};
|
|
292
|
-
this.paymentModule.logInfo("[WalletPass] 搜索钱包识别码", {
|
|
293
|
-
code,
|
|
294
|
-
with_customer: walletDetailParams.with_customer,
|
|
295
|
-
with: walletDetailParams.with
|
|
296
|
-
});
|
|
297
|
-
const response2 = await this.paymentModule.request.post(
|
|
298
|
-
"/wallet/detail/search",
|
|
299
|
-
walletDetailParams
|
|
300
|
-
);
|
|
301
|
-
const searchResults2 = (response2 == null ? void 0 : response2.data) || [];
|
|
302
|
-
this.paymentModule.logInfo("[WalletPass] 钱包识别码搜索完成", {
|
|
303
|
-
code,
|
|
304
|
-
results_count: searchResults2.length,
|
|
305
|
-
type: "walletCode"
|
|
306
|
-
});
|
|
307
|
-
return {
|
|
308
|
-
type: "walletCode",
|
|
309
|
-
data: searchResults2
|
|
310
|
-
};
|
|
311
|
-
}
|
|
312
|
-
const baseWalletParams = this.walletParams;
|
|
313
|
-
const searchParams = {
|
|
314
|
-
// 基础钱包参数
|
|
315
|
-
sale_channel: params.sale_channel || (baseWalletParams == null ? void 0 : baseWalletParams.sale_channel) || "pos",
|
|
316
|
-
customer_id: params.customer_id || (baseWalletParams == null ? void 0 : baseWalletParams.customer_id),
|
|
317
|
-
order_expect_amount: params.order_expect_amount || (baseWalletParams == null ? void 0 : baseWalletParams.order_expect_amount),
|
|
318
|
-
order_product_amount: params.order_product_amount || (baseWalletParams == null ? void 0 : baseWalletParams.order_product_amount),
|
|
319
|
-
order_wait_pay_amount: params.order_wait_pay_amount || (baseWalletParams == null ? void 0 : baseWalletParams.order_wait_pay_amount),
|
|
320
|
-
order_behavior_count_customer_id: params.order_behavior_count_customer_id || (baseWalletParams == null ? void 0 : baseWalletParams.order_behavior_count_customer_id),
|
|
321
|
-
products: params.products || (baseWalletParams == null ? void 0 : baseWalletParams.products),
|
|
322
|
-
prepare_payments: params.prepare_payments || (baseWalletParams == null ? void 0 : baseWalletParams.prepare_payments),
|
|
323
|
-
multiple: 1,
|
|
324
|
-
// 搜索特有参数
|
|
325
|
-
code: params.code,
|
|
326
|
-
payment_order_id: baseWalletParams == null ? void 0 : baseWalletParams.payment_order_id
|
|
327
|
-
};
|
|
328
|
-
this.paymentModule.logInfo("[WalletPass] 搜索普通识别码", {
|
|
329
|
-
code: searchParams.code,
|
|
330
|
-
customer_id: searchParams.customer_id,
|
|
331
|
-
order_expect_amount: searchParams.order_expect_amount,
|
|
332
|
-
multiple: searchParams.multiple,
|
|
333
|
-
payment_order_id: baseWalletParams == null ? void 0 : baseWalletParams.payment_order_id
|
|
334
|
-
});
|
|
335
|
-
const response = await this.paymentModule.request.post(
|
|
336
|
-
"/machinecode/prepare/deduction/search",
|
|
337
|
-
searchParams
|
|
338
|
-
);
|
|
339
|
-
const searchResults = (response == null ? void 0 : response.data) || [];
|
|
340
|
-
if (config.noCache) {
|
|
341
|
-
return {
|
|
342
|
-
type: "normalCode",
|
|
343
|
-
data: searchResults
|
|
344
|
-
};
|
|
345
|
-
}
|
|
346
|
-
if (searchResults.length > 0) {
|
|
347
|
-
const existingCodes = new Set(
|
|
348
|
-
this.searchResults.map((item) => item.code)
|
|
349
|
-
);
|
|
350
|
-
const newResults = searchResults.filter(
|
|
351
|
-
(item) => !existingCodes.has(item.code)
|
|
352
|
-
);
|
|
353
|
-
this.searchResults.push(...newResults);
|
|
354
|
-
}
|
|
355
|
-
this.emitEvent(import_types.WalletPassHooks.OnSearchIdentificationCodeCompleted, {
|
|
356
|
-
searchCode: params.code,
|
|
357
|
-
currentSearchResults: searchResults,
|
|
358
|
-
cachedSearchResults: [...this.searchResults],
|
|
359
|
-
searchParams: params
|
|
360
|
-
});
|
|
361
|
-
this.paymentModule.logInfo("[WalletPass] 普通识别码搜索完成", {
|
|
362
|
-
code: params.code,
|
|
363
|
-
results_count: searchResults.length,
|
|
364
|
-
cached_results_count: this.searchResults.length,
|
|
365
|
-
type: "normalCode"
|
|
366
|
-
});
|
|
367
|
-
return {
|
|
368
|
-
type: "normalCode",
|
|
369
|
-
data: searchResults
|
|
370
|
-
};
|
|
371
|
-
} catch (error) {
|
|
372
|
-
this.paymentModule.logError("[WalletPass] 搜索识别码信息失败", error, {
|
|
373
|
-
code: params.code,
|
|
374
|
-
customer_id: params.customer_id,
|
|
375
|
-
order_expect_amount: params.order_expect_amount
|
|
376
|
-
});
|
|
377
|
-
throw error;
|
|
378
|
-
}
|
|
379
|
-
}
|
|
380
|
-
async processWalletPayment(amount, orderUuid, voucherId) {
|
|
381
|
-
this.paymentModule.logInfo("[WalletPass] 开始处理钱包支付", {
|
|
382
|
-
amount,
|
|
383
|
-
orderUuid,
|
|
384
|
-
voucherId: voucherId || "none"
|
|
385
|
-
});
|
|
386
|
-
const walletMethod = await this.paymentModule.getWalletPaymentMethod();
|
|
387
|
-
if (!walletMethod) {
|
|
388
|
-
this.paymentModule.logError("[WalletPass] 钱包支付方式未找到", null, {
|
|
389
|
-
amount,
|
|
390
|
-
orderUuid,
|
|
391
|
-
voucherId
|
|
392
|
-
});
|
|
393
|
-
throw new Error("钱包支付方式未找到");
|
|
394
|
-
}
|
|
395
|
-
const paymentItem = {
|
|
396
|
-
amount: amount.toString(),
|
|
397
|
-
code: walletMethod.code,
|
|
398
|
-
id: walletMethod.id,
|
|
399
|
-
name: walletMethod.name,
|
|
400
|
-
type: walletMethod.type,
|
|
401
|
-
voucher_id: voucherId || ""
|
|
402
|
-
};
|
|
403
|
-
await this.paymentModule.addPaymentItemAsync(orderUuid, paymentItem);
|
|
404
|
-
this.paymentModule.logInfo("[WalletPass] 钱包支付处理完成", {
|
|
405
|
-
amount,
|
|
406
|
-
orderUuid,
|
|
407
|
-
voucherId: voucherId || "none",
|
|
408
|
-
payment_method: walletMethod.name
|
|
409
|
-
});
|
|
410
|
-
}
|
|
411
|
-
async getWalletBalance(voucherId) {
|
|
412
|
-
return 0;
|
|
413
|
-
}
|
|
414
|
-
/**
|
|
415
|
-
* 获取缓存的钱包推荐列表
|
|
416
|
-
*/
|
|
417
|
-
getWalletRecommendList() {
|
|
418
|
-
return this.walletRecommendList;
|
|
419
|
-
}
|
|
420
|
-
/**
|
|
421
|
-
* 获取缓存的用户识别码列表
|
|
422
|
-
*/
|
|
423
|
-
getUserIdentificationCodes() {
|
|
424
|
-
return this.userIdentificationCodes;
|
|
425
|
-
}
|
|
426
|
-
/**
|
|
427
|
-
* 清除钱包推荐列表
|
|
428
|
-
*/
|
|
429
|
-
clearWalletRecommendList() {
|
|
430
|
-
this.walletRecommendList = [];
|
|
431
|
-
this.emitEvent(import_types.WalletPassHooks.OnWalletRecommendListCleared, {
|
|
432
|
-
clearedTypes: ["walletRecommendList"]
|
|
433
|
-
});
|
|
434
|
-
this.paymentModule.logInfo("[WalletPass] 钱包推荐列表已清除");
|
|
435
|
-
}
|
|
436
|
-
/**
|
|
437
|
-
* 清除用户识别码列表
|
|
438
|
-
*/
|
|
439
|
-
clearUserIdentificationCodes() {
|
|
440
|
-
this.userIdentificationCodes = [];
|
|
441
|
-
this.emitEvent(import_types.WalletPassHooks.OnUserIdentificationCodesCleared, {
|
|
442
|
-
clearedTypes: ["userIdentificationCodes"]
|
|
443
|
-
});
|
|
444
|
-
this.paymentModule.logInfo("[WalletPass] 用户识别码列表已清除");
|
|
445
|
-
}
|
|
446
|
-
/**
|
|
447
|
-
* 获取缓存的搜索结果列表
|
|
448
|
-
*/
|
|
449
|
-
getSearchResults() {
|
|
450
|
-
return this.searchResults;
|
|
451
|
-
}
|
|
452
|
-
/**
|
|
453
|
-
* 根据识别码查找搜索结果
|
|
454
|
-
*/
|
|
455
|
-
findSearchResultByCode(code) {
|
|
456
|
-
return this.searchResults.find((item) => item.code === code);
|
|
457
|
-
}
|
|
458
|
-
/**
|
|
459
|
-
* 清除搜索结果缓存
|
|
460
|
-
*/
|
|
461
|
-
clearSearchResults() {
|
|
462
|
-
this.searchResults = [];
|
|
463
|
-
this.paymentModule.logInfo("[WalletPass] 搜索结果缓存已清除");
|
|
464
|
-
}
|
|
465
|
-
/**
|
|
466
|
-
* 清除所有缓存数据
|
|
467
|
-
*/
|
|
468
|
-
clearAllCache() {
|
|
469
|
-
this.walletRecommendList = [];
|
|
470
|
-
this.userIdentificationCodes = [];
|
|
471
|
-
this.searchResults = [];
|
|
472
|
-
this.walletParams = null;
|
|
473
|
-
this.emitEvent(import_types.WalletPassHooks.OnWalletCacheCleared, {
|
|
474
|
-
clearedTypes: ["all"]
|
|
475
|
-
});
|
|
476
|
-
this.paymentModule.logInfo("[WalletPass] 所有缓存数据已清除", {
|
|
477
|
-
cleared_types: ["walletRecommendList", "userIdentificationCodes", "searchResults", "walletParams"]
|
|
478
|
-
});
|
|
479
|
-
}
|
|
480
|
-
};
|
|
481
|
-
// Annotate the CommonJS export names for ESM import in node:
|
|
482
|
-
0 && (module.exports = {
|
|
483
|
-
WalletPassPaymentImpl
|
|
484
|
-
});
|
|
@@ -1,83 +0,0 @@
|
|
|
1
|
-
import { RouterManager } from '../routes';
|
|
2
|
-
import { ApplicationManager } from '../applicationManager';
|
|
3
|
-
import { History, HistoryOptions } from '../history';
|
|
4
|
-
import { Data } from '../data';
|
|
5
|
-
import { Locales, LocalesOptions } from '../locales';
|
|
6
|
-
import { Storage, StorageOptions } from '../storage';
|
|
7
|
-
import { MenuManager } from '../menuManager';
|
|
8
|
-
import LoggerManager, { LoggerOptions } from '../logger';
|
|
9
|
-
import { TasksManager } from '../tasks';
|
|
10
|
-
import IndexDBManager, { DBOptions } from '../indexDB';
|
|
11
|
-
declare global {
|
|
12
|
-
interface Window {
|
|
13
|
-
app: App;
|
|
14
|
-
}
|
|
15
|
-
}
|
|
16
|
-
export interface AppOptions {
|
|
17
|
-
logger?: LoggerOptions;
|
|
18
|
-
db?: DBOptions;
|
|
19
|
-
constants?: any;
|
|
20
|
-
history?: HistoryOptions;
|
|
21
|
-
storage?: StorageOptions;
|
|
22
|
-
locales?: LocalesOptions;
|
|
23
|
-
}
|
|
24
|
-
declare class App {
|
|
25
|
-
private static instance;
|
|
26
|
-
private plugins;
|
|
27
|
-
globalData: any;
|
|
28
|
-
router: RouterManager;
|
|
29
|
-
applicationManager: ApplicationManager;
|
|
30
|
-
history: History;
|
|
31
|
-
data: Data;
|
|
32
|
-
hooks: import("../hooks").HooksExport;
|
|
33
|
-
locales: Locales;
|
|
34
|
-
models: {
|
|
35
|
-
getStore: () => import("../models").Store;
|
|
36
|
-
StoreProvider: typeof import("react-redux").Provider;
|
|
37
|
-
setConfig: (models: any[]) => void;
|
|
38
|
-
};
|
|
39
|
-
request: {
|
|
40
|
-
get: (url: import("../request").RequestWrapperProps["url"], data: import("../request").RequestWrapperProps["data"], config: import("../request").RequestWrapperProps["config"]) => Promise<any>;
|
|
41
|
-
post: (url: import("../request").RequestWrapperProps["url"], data: import("../request").RequestWrapperProps["data"], config: import("../request").RequestWrapperProps["config"]) => Promise<any>;
|
|
42
|
-
put: (url: import("../request").RequestWrapperProps["url"], data: import("../request").RequestWrapperProps["data"], config: import("../request").RequestWrapperProps["config"]) => Promise<any>;
|
|
43
|
-
remove: (url: import("../request").RequestWrapperProps["url"], data: import("../request").RequestWrapperProps["data"], config: import("../request").RequestWrapperProps["config"]) => Promise<any>;
|
|
44
|
-
custom: (url: import("../request").RequestWrapperProps["url"], config: import("../request").RequestWrapperProps["config"]) => Promise<any>;
|
|
45
|
-
setConfig: (newConfig: Partial<import("../request").RequestConfig>) => void;
|
|
46
|
-
getConfig: () => import("../request").RequestConfig;
|
|
47
|
-
};
|
|
48
|
-
storage: Storage;
|
|
49
|
-
menuManager: MenuManager;
|
|
50
|
-
cookie: {
|
|
51
|
-
setCookie: (name: string, value: string, domain?: string) => void;
|
|
52
|
-
getCookie: (name: string) => string | null;
|
|
53
|
-
deleteCookie: (name: string, domain?: string) => void;
|
|
54
|
-
checkCookie: (name: string) => boolean;
|
|
55
|
-
updateCookie: (name: string, value: string, domain?: string) => void;
|
|
56
|
-
};
|
|
57
|
-
website: {
|
|
58
|
-
setTitle: (title: string) => void;
|
|
59
|
-
setIcon: (paramsIcon: string) => void;
|
|
60
|
-
setAppleWebAppTitle: (title: string) => void;
|
|
61
|
-
};
|
|
62
|
-
logger: LoggerManager;
|
|
63
|
-
pubsub: import("../pubsub").PubSub;
|
|
64
|
-
tasksManager: TasksManager;
|
|
65
|
-
dbManager: IndexDBManager | null;
|
|
66
|
-
constants: {
|
|
67
|
-
channel: string;
|
|
68
|
-
[key: string]: string;
|
|
69
|
-
};
|
|
70
|
-
private constructor();
|
|
71
|
-
static getInstance(options?: AppOptions): App;
|
|
72
|
-
setGlobalData(globalData: any): void;
|
|
73
|
-
usePlugin(name: string, plugin: any): void;
|
|
74
|
-
usePlugins(plugins: {
|
|
75
|
-
name: string;
|
|
76
|
-
plugin: any;
|
|
77
|
-
}[]): void;
|
|
78
|
-
getPlugin(name: string): any;
|
|
79
|
-
getGlobalData(): any;
|
|
80
|
-
install(): void;
|
|
81
|
-
unInstall(): void;
|
|
82
|
-
}
|
|
83
|
-
export default App;
|
|
@@ -1,14 +0,0 @@
|
|
|
1
|
-
import React from "react";
|
|
2
|
-
import App, { AppOptions } from "./app";
|
|
3
|
-
type AppContextType = {
|
|
4
|
-
globalData: any;
|
|
5
|
-
setGlobalData: React.Dispatch<React.SetStateAction<any>>;
|
|
6
|
-
app: App;
|
|
7
|
-
};
|
|
8
|
-
export declare const AppProvider: React.FC<{
|
|
9
|
-
children: React.ReactNode;
|
|
10
|
-
options: AppOptions;
|
|
11
|
-
}>;
|
|
12
|
-
export declare const useApp: () => AppContextType;
|
|
13
|
-
export declare const getApp: typeof App.getInstance;
|
|
14
|
-
export default App;
|