@pisell/pisellos 0.0.230 → 0.0.232
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/Order/index.d.ts +13 -2
- package/dist/modules/Order/index.js +93 -1
- package/dist/modules/Order/types.d.ts +45 -0
- package/dist/modules/Order/types.js +8 -0
- package/dist/modules/Payment/cash.d.ts +8 -0
- package/dist/modules/Payment/cash.js +20 -1
- package/dist/modules/Payment/cashRecommendationAlgorithm.d.ts +22 -0
- package/dist/modules/Payment/cashRecommendationAlgorithm.js +423 -0
- package/dist/modules/Payment/eftpos.js +1 -1
- package/dist/modules/Payment/index.d.ts +34 -124
- package/dist/modules/Payment/index.js +662 -1280
- package/dist/modules/Payment/mx51.d.ts +0 -0
- package/dist/modules/Payment/mx51.js +0 -0
- package/dist/modules/Payment/types.d.ts +323 -45
- package/dist/modules/Payment/types.js +101 -2
- package/dist/modules/Payment/utils.d.ts +17 -0
- package/dist/modules/Payment/utils.js +62 -0
- package/dist/modules/Payment/walletpass.d.ts +96 -0
- package/dist/modules/Payment/walletpass.js +492 -0
- package/dist/modules/Schedule/index.d.ts +9 -0
- package/dist/modules/Schedule/index.js +60 -0
- package/dist/solution/Checkout/index.d.ts +254 -2
- package/dist/solution/Checkout/index.js +2472 -320
- package/dist/solution/Checkout/types.d.ts +207 -6
- package/dist/solution/Checkout/types.js +5 -0
- package/lib/modules/Order/index.d.ts +13 -2
- package/lib/modules/Order/index.js +65 -1
- package/lib/modules/Order/types.d.ts +45 -0
- package/lib/modules/Payment/cash.d.ts +8 -0
- package/lib/modules/Payment/cash.js +14 -1
- package/lib/modules/Payment/cashRecommendationAlgorithm.d.ts +22 -0
- package/lib/modules/Payment/cashRecommendationAlgorithm.js +342 -0
- package/lib/modules/Payment/eftpos.js +1 -1
- package/lib/modules/Payment/index.d.ts +34 -124
- package/lib/modules/Payment/index.js +232 -533
- package/lib/modules/Payment/mx51.d.ts +0 -0
- package/lib/modules/Payment/mx51.js +0 -0
- package/lib/modules/Payment/types.d.ts +323 -45
- package/lib/modules/Payment/types.js +37 -2
- package/lib/modules/Payment/utils.d.ts +17 -0
- package/lib/modules/Payment/utils.js +67 -0
- package/lib/modules/Payment/walletpass.d.ts +96 -0
- package/lib/modules/Payment/walletpass.js +304 -0
- package/lib/modules/Schedule/index.d.ts +9 -0
- package/lib/modules/Schedule/index.js +36 -0
- package/lib/solution/Checkout/index.d.ts +254 -2
- package/lib/solution/Checkout/index.js +1361 -39
- package/lib/solution/Checkout/types.d.ts +207 -6
- package/lib/solution/Checkout/types.js +5 -0
- package/package.json +1 -1
- package/dist/modules/Payment/wallet.d.ts +0 -11
- package/dist/modules/Payment/wallet.js +0 -78
- package/lib/modules/Payment/wallet.d.ts +0 -11
- package/lib/modules/Payment/wallet.js +0 -51
|
File without changes
|
|
File without changes
|
|
@@ -31,6 +31,32 @@ export declare enum TaskRunStatus {
|
|
|
31
31
|
Success = "success",
|
|
32
32
|
Failed = "failed"
|
|
33
33
|
}
|
|
34
|
+
/**
|
|
35
|
+
* 舍入规则枚举
|
|
36
|
+
*/
|
|
37
|
+
export declare enum RoundingRule {
|
|
38
|
+
/** 标准舍入(中点向上) */
|
|
39
|
+
Standard = "standard",
|
|
40
|
+
/** 标准舍入(中点向下) */
|
|
41
|
+
StandardDown = "standard_down",
|
|
42
|
+
/** 总是向上舍入 */
|
|
43
|
+
AlwaysUp = "always_up",
|
|
44
|
+
/** 总是向下舍入 */
|
|
45
|
+
AlwaysDown = "always_down"
|
|
46
|
+
}
|
|
47
|
+
/**
|
|
48
|
+
* 舍入间隔枚举
|
|
49
|
+
*/
|
|
50
|
+
export declare enum RoundingInterval {
|
|
51
|
+
/** 0.05 间隔 */
|
|
52
|
+
Interval005 = 0.05,
|
|
53
|
+
/** 0.1 间隔 */
|
|
54
|
+
Interval01 = 0.1,
|
|
55
|
+
/** 0.5 间隔 */
|
|
56
|
+
Interval05 = 0.5,
|
|
57
|
+
/** 1 间隔 */
|
|
58
|
+
Interval1 = 1
|
|
59
|
+
}
|
|
34
60
|
/**
|
|
35
61
|
* 支付方式信息
|
|
36
62
|
*/
|
|
@@ -79,18 +105,13 @@ export interface PaymentItem {
|
|
|
79
105
|
rounding_amount?: string;
|
|
80
106
|
/** 三方支付手续费 */
|
|
81
107
|
service_charge?: {
|
|
82
|
-
percentage
|
|
83
|
-
amount
|
|
84
|
-
};
|
|
85
|
-
/** 该支付项是否已经同步给后端服务器(只有网络请求成功后才为true) */
|
|
86
|
-
isSynced?: boolean;
|
|
87
|
-
/** 同步错误信息(业务错误时记录错误信息,用于区分"未同步"和"同步失败") */
|
|
88
|
-
syncError?: {
|
|
89
|
-
error: string;
|
|
90
|
-
errorCode?: string;
|
|
91
|
-
statusCode?: number;
|
|
92
|
-
timestamp: number;
|
|
108
|
+
percentage?: string;
|
|
109
|
+
amount?: string;
|
|
93
110
|
};
|
|
111
|
+
/** 支付项状态 */
|
|
112
|
+
status?: 'active' | 'voided';
|
|
113
|
+
/** 原始金额(用于记录撤销前的金额) */
|
|
114
|
+
origin_amount?: string;
|
|
94
115
|
}
|
|
95
116
|
/**
|
|
96
117
|
* 订单信息
|
|
@@ -179,6 +200,11 @@ export interface PaymentItemInput {
|
|
|
179
200
|
type: string;
|
|
180
201
|
/** 代金券、充值卡、积分卡等wallet pass id */
|
|
181
202
|
voucher_id?: string;
|
|
203
|
+
/** 三方支付手续费 */
|
|
204
|
+
service_charge?: {
|
|
205
|
+
percentage?: string;
|
|
206
|
+
amount?: string;
|
|
207
|
+
};
|
|
182
208
|
}
|
|
183
209
|
/**
|
|
184
210
|
* 推送支付项参数
|
|
@@ -258,7 +284,45 @@ export interface EftposPayment {
|
|
|
258
284
|
/**
|
|
259
285
|
* 钱包支付接口
|
|
260
286
|
*/
|
|
261
|
-
export interface
|
|
287
|
+
export interface WalletPassPayment {
|
|
288
|
+
/** 生成钱包API默认参数 */
|
|
289
|
+
generateWalletParams: (businessData: WalletInitBusinessData) => WalletDeductionRecommendParams;
|
|
290
|
+
/** 获取已存储的钱包参数 */
|
|
291
|
+
getStoredWalletParams: () => WalletDeductionRecommendParams | null;
|
|
292
|
+
/** 清理已存储的钱包参数 */
|
|
293
|
+
clearStoredWalletParams: () => void;
|
|
294
|
+
/** 初始化钱包数据(从业务数据开始,内部生成参数) */
|
|
295
|
+
initializeWalletDataFromBusinessAsync: (businessData: WalletInitBusinessData) => Promise<{
|
|
296
|
+
walletRecommendList: WalletRecommendItem[];
|
|
297
|
+
userIdentificationCodes: UserIdentificationCodeItem[];
|
|
298
|
+
}>;
|
|
299
|
+
/** 初始化钱包数据(先获取推荐列表,再获取用户识别码列表) */
|
|
300
|
+
initializeWalletDataAsync: (baseParams: WalletDeductionRecommendParams) => Promise<{
|
|
301
|
+
walletRecommendList: WalletRecommendItem[];
|
|
302
|
+
userIdentificationCodes: UserIdentificationCodeItem[];
|
|
303
|
+
}>;
|
|
304
|
+
/** 获取钱包推荐扣款列表(异步获取并缓存) */
|
|
305
|
+
getWalletPassRecommendListAsync: (params: WalletDeductionRecommendParams) => Promise<WalletRecommendItem[]>;
|
|
306
|
+
/** 查询用户识别码列表(异步获取并缓存) */
|
|
307
|
+
getUserIdentificationCodeListAsync: (params: UserIdentificationCodeParams) => Promise<UserIdentificationCodeItem[]>;
|
|
308
|
+
/** 搜索识别码信息 */
|
|
309
|
+
searchIdentificationCodeAsync: (params: SearchIdentificationCodeParams) => Promise<SearchIdentificationCodeItem[]>;
|
|
310
|
+
/** 获取缓存的搜索结果列表 */
|
|
311
|
+
getSearchResults: () => SearchIdentificationCodeItem[];
|
|
312
|
+
/** 根据识别码查找搜索结果 */
|
|
313
|
+
findSearchResultByCode: (code: string) => SearchIdentificationCodeItem | undefined;
|
|
314
|
+
/** 获取缓存的钱包推荐列表 */
|
|
315
|
+
getWalletRecommendList: () => WalletRecommendItem[];
|
|
316
|
+
/** 获取缓存的用户识别码列表 */
|
|
317
|
+
getUserIdentificationCodes: () => UserIdentificationCodeItem[];
|
|
318
|
+
/** 清除钱包推荐列表 */
|
|
319
|
+
clearWalletRecommendList: () => void;
|
|
320
|
+
/** 清除用户识别码列表 */
|
|
321
|
+
clearUserIdentificationCodes: () => void;
|
|
322
|
+
/** 清除搜索结果缓存 */
|
|
323
|
+
clearSearchResults: () => void;
|
|
324
|
+
/** 清除所有缓存数据 */
|
|
325
|
+
clearAllCache: () => void;
|
|
262
326
|
/** 处理钱包支付 */
|
|
263
327
|
processWalletPayment: (amount: number, orderUuid: string, voucherId?: string) => Promise<void>;
|
|
264
328
|
/** 获取钱包余额 */
|
|
@@ -273,7 +337,7 @@ export interface PaymentModuleAPI {
|
|
|
273
337
|
/** Eftpos支付相关方法 */
|
|
274
338
|
eftpos: EftposPayment;
|
|
275
339
|
/** 钱包支付相关方法 */
|
|
276
|
-
wallet:
|
|
340
|
+
wallet: WalletPassPayment;
|
|
277
341
|
/** 获取支付方式列表 */
|
|
278
342
|
getPayMethodListAsync: () => Promise<PaymentMethod[]>;
|
|
279
343
|
/** 创建支付订单(仅保存支付相关信息) */
|
|
@@ -285,47 +349,35 @@ export interface PaymentModuleAPI {
|
|
|
285
349
|
/** 删除支付订单 */
|
|
286
350
|
deletePaymentOrderAsync: (orderUuid: string) => Promise<void>;
|
|
287
351
|
/** 获取支付项 */
|
|
288
|
-
getPaymentItemsAsync: (orderUuid: string) => Promise<PaymentItem[]>;
|
|
352
|
+
getPaymentItemsAsync: (orderUuid: string, includeVoided?: boolean) => Promise<PaymentItem[]>;
|
|
353
|
+
/** 获取所有支付项(包括已撤销的) */
|
|
354
|
+
getAllPaymentItemsAsync: (orderUuid: string) => Promise<PaymentItem[]>;
|
|
289
355
|
/** 为某个订单添加支付项 */
|
|
290
356
|
addPaymentItemAsync: (orderUuid: string, paymentItem: PaymentItemInput) => Promise<void>;
|
|
291
357
|
/** 删除支付项 */
|
|
292
|
-
|
|
358
|
+
deletePaymentAsync: (orderUuid: string, paymentUuid: string) => Promise<void>;
|
|
293
359
|
/** 更新支付项 */
|
|
294
|
-
|
|
360
|
+
updatePaymentAsync: (orderUuid: string, paymentUuid: string, params: PaymentUpdateFields) => Promise<void>;
|
|
361
|
+
/** 批量更新代金券类支付项(覆盖更新) */
|
|
362
|
+
updateVoucherPaymentItemsAsync: (orderUuid: string, voucherPaymentItems: PaymentItemInput[]) => Promise<void>;
|
|
295
363
|
/** 获取订单剩余待付金额 */
|
|
296
|
-
|
|
364
|
+
getRemainingOrderAmountAsync: (orderUuid: string) => Promise<number>;
|
|
297
365
|
/** 获取订单剩余待付金额(基于用户输入的金额) */
|
|
298
|
-
|
|
366
|
+
getRemainingOrderAmountWithInputAsync: (inputAmount: string | number, orderUuid: string) => Promise<number>;
|
|
367
|
+
/**
|
|
368
|
+
* 智能金额舍入
|
|
369
|
+
* @param originalAmount 原始金额
|
|
370
|
+
* @param interval 舍入间隔 (0.05, 0.1, 0.5, 1)
|
|
371
|
+
* @param rule 舍入规则 (standard, standard_down, always_up, always_down)
|
|
372
|
+
* @returns 舍入后的金额
|
|
373
|
+
*/
|
|
374
|
+
roundAmountAsync: (originalAmount: number | string, interval: RoundingInterval | number, rule: RoundingRule | string) => Promise<string>;
|
|
299
375
|
/** 提交支付 */
|
|
300
|
-
|
|
376
|
+
submitPayAsync: (orderUuid?: string) => Promise<{
|
|
301
377
|
status: 'success' | 'failed';
|
|
302
378
|
}>;
|
|
303
379
|
/** 获取部分支付的订单 */
|
|
304
380
|
getPartiallyPaidOrdersAsync: () => Promise<PaymentOrder[]>;
|
|
305
|
-
/** 获取未同步到服务器的订单 */
|
|
306
|
-
getUnsyncedOrdersAsync: () => Promise<PaymentOrder[]>;
|
|
307
|
-
/** 检测未同步的订单并重新加入任务队列 */
|
|
308
|
-
recheckAndRequeueUnsyncedOrders: () => Promise<number>;
|
|
309
|
-
/** 手动执行支付同步队列 */
|
|
310
|
-
runPaymentSyncQueue: () => Promise<void>;
|
|
311
|
-
/** @deprecated 使用 createPaymentOrderAsync 替代 */
|
|
312
|
-
pushOrderAsync: (params: PushOrderParams) => Promise<PaymentOrder>;
|
|
313
|
-
/** @deprecated 使用 getPaymentItemsAsync 替代 */
|
|
314
|
-
getPaymentAsync: (orderUuid: string) => Promise<PaymentItem[]>;
|
|
315
|
-
/** @deprecated 使用 addPaymentItemAsync 替代 */
|
|
316
|
-
pushPaymentAsync: (orderUuid: string, paymentItem: PaymentItemInput) => Promise<void>;
|
|
317
|
-
/** @deprecated 使用 deletePaymentItemAsync 替代 */
|
|
318
|
-
deletePaymentAsync: (orderUuid: string, paymentUuid: string) => Promise<void>;
|
|
319
|
-
/** @deprecated 使用 updatePaymentItemAsync 替代 */
|
|
320
|
-
updatePaymentAsync: (orderUuid: string, paymentUuid: string, params: PaymentUpdateFields) => Promise<void>;
|
|
321
|
-
/** @deprecated 使用 submitPaymentAsync 替代 */
|
|
322
|
-
submitPayAsync: (orderUuid?: string) => Promise<{
|
|
323
|
-
status: 'success' | 'failed';
|
|
324
|
-
}>;
|
|
325
|
-
/** @deprecated 使用 getRemainingAmountAsync 替代 */
|
|
326
|
-
getRemainingOrderAmountAsync: (orderUuid: string) => Promise<number>;
|
|
327
|
-
/** @deprecated 使用 getRemainingAmountWithInputAsync 替代 */
|
|
328
|
-
getRemainingOrderAmountWithInputAsync: (inputAmount: string | number, orderUuid: string) => Promise<number>;
|
|
329
381
|
}
|
|
330
382
|
/**
|
|
331
383
|
* 订单变化事件数据
|
|
@@ -380,7 +432,52 @@ export interface OnPaymentSyncSuccessEventData {
|
|
|
380
432
|
timestamp: number;
|
|
381
433
|
}
|
|
382
434
|
/**
|
|
383
|
-
*
|
|
435
|
+
* 钱包推荐列表更新事件数据
|
|
436
|
+
*/
|
|
437
|
+
export interface OnWalletRecommendListUpdatedEventData {
|
|
438
|
+
/** 新的钱包推荐列表 */
|
|
439
|
+
walletRecommendList: WalletRecommendItem[];
|
|
440
|
+
}
|
|
441
|
+
/**
|
|
442
|
+
* 用户识别码列表更新事件数据
|
|
443
|
+
*/
|
|
444
|
+
export interface OnUserIdentificationCodesUpdatedEventData {
|
|
445
|
+
/** 新的用户识别码列表 */
|
|
446
|
+
userIdentificationCodes: UserIdentificationCodeItem[];
|
|
447
|
+
}
|
|
448
|
+
/**
|
|
449
|
+
* 钱包缓存清除事件数据
|
|
450
|
+
*/
|
|
451
|
+
export interface OnWalletCacheClearedEventData {
|
|
452
|
+
/** 清除的数据类型 */
|
|
453
|
+
clearedTypes: ('walletRecommendList' | 'userIdentificationCodes' | 'all')[];
|
|
454
|
+
}
|
|
455
|
+
/**
|
|
456
|
+
* 搜索识别码完成事件数据
|
|
457
|
+
*/
|
|
458
|
+
export interface OnSearchIdentificationCodeCompletedEventData {
|
|
459
|
+
/** 当前搜索的识别码 */
|
|
460
|
+
searchCode: string;
|
|
461
|
+
/** 当前搜索返回的结果 */
|
|
462
|
+
currentSearchResults: SearchIdentificationCodeItem[];
|
|
463
|
+
/** 缓存中的所有搜索结果 */
|
|
464
|
+
cachedSearchResults: SearchIdentificationCodeItem[];
|
|
465
|
+
/** 搜索参数 */
|
|
466
|
+
searchParams: SearchIdentificationCodeParams;
|
|
467
|
+
}
|
|
468
|
+
/**
|
|
469
|
+
* 钱包支付事件枚举
|
|
470
|
+
*/
|
|
471
|
+
export declare enum WalletPassHooks {
|
|
472
|
+
OnWalletRecommendListUpdated = "wallet:onWalletRecommendListUpdated",
|
|
473
|
+
OnWalletRecommendListCleared = "wallet:onWalletRecommendListCleared",
|
|
474
|
+
OnUserIdentificationCodesUpdated = "wallet:onUserIdentificationCodesUpdated",
|
|
475
|
+
OnUserIdentificationCodesCleared = "wallet:onUserIdentificationCodesCleared",
|
|
476
|
+
OnWalletCacheCleared = "wallet:onWalletCacheCleared",
|
|
477
|
+
OnSearchIdentificationCodeCompleted = "wallet:onSearchIdentificationCodeCompleted"
|
|
478
|
+
}
|
|
479
|
+
/**
|
|
480
|
+
* 支付钩子事件(统一接口)
|
|
384
481
|
*/
|
|
385
482
|
export declare enum PaymentHooks {
|
|
386
483
|
OnPaymentMethodsLoaded = "payment:onPaymentMethodsLoaded",
|
|
@@ -395,5 +492,186 @@ export declare enum PaymentHooks {
|
|
|
395
492
|
OnPaymentSubmitted = "payment:onPaymentSubmitted",
|
|
396
493
|
OnOrderAmountChanged = "payment:onOrderAmountChanged",
|
|
397
494
|
OnPaymentSyncError = "payment:onPaymentSyncError",
|
|
398
|
-
OnPaymentSyncSuccess = "payment:onPaymentSyncSuccess"
|
|
495
|
+
OnPaymentSyncSuccess = "payment:onPaymentSyncSuccess",
|
|
496
|
+
OnWalletRecommendListUpdated = "wallet:onWalletRecommendListUpdated",
|
|
497
|
+
OnWalletRecommendListCleared = "wallet:onWalletRecommendListCleared",
|
|
498
|
+
OnUserIdentificationCodesUpdated = "wallet:onUserIdentificationCodesUpdated",
|
|
499
|
+
OnUserIdentificationCodesCleared = "wallet:onUserIdentificationCodesCleared",
|
|
500
|
+
OnWalletCacheCleared = "wallet:onWalletCacheCleared",
|
|
501
|
+
OnSearchIdentificationCodeCompleted = "wallet:onSearchIdentificationCodeCompleted"
|
|
502
|
+
}
|
|
503
|
+
/**
|
|
504
|
+
* 钱包推荐扣款请求参数
|
|
505
|
+
*/
|
|
506
|
+
export interface WalletDeductionRecommendParams {
|
|
507
|
+
/** 销售渠道 */
|
|
508
|
+
sale_channel: string;
|
|
509
|
+
/** 前端设置只想要的字段 */
|
|
510
|
+
expect_columns?: string[];
|
|
511
|
+
/** 客户id */
|
|
512
|
+
customer_id?: number;
|
|
513
|
+
/** 订单总计金额 */
|
|
514
|
+
order_expect_amount: number;
|
|
515
|
+
/** 订单小计金额 */
|
|
516
|
+
order_product_amount: number;
|
|
517
|
+
/** 订单待支付金额 */
|
|
518
|
+
order_wait_pay_amount: number;
|
|
519
|
+
/** 统计计数用户id */
|
|
520
|
+
order_behavior_count_customer_id: number;
|
|
521
|
+
/** 已选商品 */
|
|
522
|
+
products: {
|
|
523
|
+
/** 商品id */
|
|
524
|
+
product_id: number;
|
|
525
|
+
/** 商品variant_id */
|
|
526
|
+
product_variant_id: string;
|
|
527
|
+
/** 商品数量 */
|
|
528
|
+
quantity: number;
|
|
529
|
+
/** 商品使用了所有优惠后的最终价格 */
|
|
530
|
+
selling_price: number;
|
|
531
|
+
}[];
|
|
532
|
+
/** 预备支付 */
|
|
533
|
+
prepare_payments?: {
|
|
534
|
+
voucher_id: number;
|
|
535
|
+
amount: number;
|
|
536
|
+
tag: string;
|
|
537
|
+
}[];
|
|
538
|
+
}
|
|
539
|
+
/**
|
|
540
|
+
* 钱包初始化业务数据接口
|
|
541
|
+
* 用于生成钱包API参数的必要业务信息
|
|
542
|
+
*/
|
|
543
|
+
export interface WalletInitBusinessData {
|
|
544
|
+
/** 客户ID(可选) */
|
|
545
|
+
customer_id?: number;
|
|
546
|
+
/** 金额信息 */
|
|
547
|
+
amountInfo: {
|
|
548
|
+
totalAmount: string;
|
|
549
|
+
subTotal: string;
|
|
550
|
+
};
|
|
551
|
+
/** 商品列表 */
|
|
552
|
+
products: {
|
|
553
|
+
product_id: number;
|
|
554
|
+
product_variant_id: string;
|
|
555
|
+
quantity: number;
|
|
556
|
+
selling_price: number;
|
|
557
|
+
}[];
|
|
558
|
+
}
|
|
559
|
+
/**
|
|
560
|
+
* 查询用户识别码列表请求参数
|
|
561
|
+
*/
|
|
562
|
+
export interface UserIdentificationCodeParams extends WalletDeductionRecommendParams {
|
|
563
|
+
/** 是否可用 */
|
|
564
|
+
available?: 0 | 1 | 2;
|
|
565
|
+
/** 其他精确码 */
|
|
566
|
+
other_exact_codes?: string[];
|
|
567
|
+
/** 过滤预备钱包通行证 */
|
|
568
|
+
filter_prepare_wallet_pass?: 0 | 1;
|
|
569
|
+
/** 预备支付 */
|
|
570
|
+
prepare_payments?: {
|
|
571
|
+
voucher_id: number;
|
|
572
|
+
amount: number;
|
|
573
|
+
tag: string;
|
|
574
|
+
}[];
|
|
575
|
+
}
|
|
576
|
+
/**
|
|
577
|
+
* 钱包推荐扣款响应数据
|
|
578
|
+
*/
|
|
579
|
+
export interface WalletDeductionRecommendResponse {
|
|
580
|
+
/** 响应状态码 */
|
|
581
|
+
code?: number;
|
|
582
|
+
/** 响应消息 */
|
|
583
|
+
message?: string;
|
|
584
|
+
/** 响应数据 */
|
|
585
|
+
data?: WalletRecommendItem[];
|
|
586
|
+
}
|
|
587
|
+
/**
|
|
588
|
+
* 用户识别码列表响应数据
|
|
589
|
+
*/
|
|
590
|
+
export interface UserIdentificationCodeResponse {
|
|
591
|
+
/** 响应状态码 */
|
|
592
|
+
code?: number;
|
|
593
|
+
/** 响应消息 */
|
|
594
|
+
message?: string;
|
|
595
|
+
/** 响应数据 */
|
|
596
|
+
data?: UserIdentificationCodeItem[];
|
|
597
|
+
}
|
|
598
|
+
/**
|
|
599
|
+
* 用户识别码项目
|
|
600
|
+
*/
|
|
601
|
+
export interface UserIdentificationCodeItem {
|
|
602
|
+
/** 识别码ID */
|
|
603
|
+
id: number;
|
|
604
|
+
/** 识别码 */
|
|
605
|
+
code: string;
|
|
606
|
+
/** 识别码名称 */
|
|
607
|
+
name: string;
|
|
608
|
+
/** 识别码类型 */
|
|
609
|
+
type: string;
|
|
610
|
+
/** 是否可用 */
|
|
611
|
+
available: boolean;
|
|
612
|
+
/** 余额信息 */
|
|
613
|
+
balance?: number;
|
|
614
|
+
/** 有效期 */
|
|
615
|
+
expires_at?: string;
|
|
616
|
+
/** 其他扩展字段 */
|
|
617
|
+
[key: string]: any;
|
|
618
|
+
}
|
|
619
|
+
/**
|
|
620
|
+
* 搜索识别码请求参数
|
|
621
|
+
* 基于 WalletDeductionRecommendParams 并增加 code 字段
|
|
622
|
+
*/
|
|
623
|
+
export interface SearchIdentificationCodeParams extends WalletDeductionRecommendParams {
|
|
624
|
+
/** 识别码 */
|
|
625
|
+
code: string;
|
|
626
|
+
}
|
|
627
|
+
/**
|
|
628
|
+
* 搜索识别码响应数据
|
|
629
|
+
*/
|
|
630
|
+
export interface SearchIdentificationCodeResponse {
|
|
631
|
+
/** 响应状态码 */
|
|
632
|
+
code?: number;
|
|
633
|
+
/** 响应消息 */
|
|
634
|
+
message?: string;
|
|
635
|
+
/** 响应数据 */
|
|
636
|
+
data?: SearchIdentificationCodeItem[];
|
|
637
|
+
}
|
|
638
|
+
/**
|
|
639
|
+
* 搜索识别码项目
|
|
640
|
+
*/
|
|
641
|
+
export interface SearchIdentificationCodeItem {
|
|
642
|
+
/** 识别码ID */
|
|
643
|
+
id: number;
|
|
644
|
+
/** 识别码 */
|
|
645
|
+
code: string;
|
|
646
|
+
/** 识别码名称 */
|
|
647
|
+
name: string;
|
|
648
|
+
/** 识别码类型 */
|
|
649
|
+
type: string;
|
|
650
|
+
/** 标签 */
|
|
651
|
+
tag?: string;
|
|
652
|
+
/** 是否可用 */
|
|
653
|
+
available: boolean;
|
|
654
|
+
/** 余额信息 */
|
|
655
|
+
balance?: number;
|
|
656
|
+
/** 有效期 */
|
|
657
|
+
expires_at?: string;
|
|
658
|
+
}
|
|
659
|
+
/**
|
|
660
|
+
* 钱包推荐项目
|
|
661
|
+
*/
|
|
662
|
+
export interface WalletRecommendItem {
|
|
663
|
+
/** 推荐项目ID */
|
|
664
|
+
id: number;
|
|
665
|
+
/** 推荐项目名称 */
|
|
666
|
+
name: string;
|
|
667
|
+
/** 推荐金额 */
|
|
668
|
+
amount: number;
|
|
669
|
+
/** 项目类型 */
|
|
670
|
+
type: string;
|
|
671
|
+
/** 是否可用 */
|
|
672
|
+
available: boolean;
|
|
673
|
+
/** 优先级 */
|
|
674
|
+
priority?: number;
|
|
675
|
+
/** 其他扩展字段 */
|
|
676
|
+
[key: string]: any;
|
|
399
677
|
}
|
|
@@ -34,6 +34,28 @@ export var TaskRunStatus = /*#__PURE__*/function (TaskRunStatus) {
|
|
|
34
34
|
return TaskRunStatus;
|
|
35
35
|
}({});
|
|
36
36
|
|
|
37
|
+
/**
|
|
38
|
+
* 舍入规则枚举
|
|
39
|
+
*/
|
|
40
|
+
export var RoundingRule = /*#__PURE__*/function (RoundingRule) {
|
|
41
|
+
RoundingRule["Standard"] = "standard";
|
|
42
|
+
RoundingRule["StandardDown"] = "standard_down";
|
|
43
|
+
RoundingRule["AlwaysUp"] = "always_up";
|
|
44
|
+
RoundingRule["AlwaysDown"] = "always_down";
|
|
45
|
+
return RoundingRule;
|
|
46
|
+
}({});
|
|
47
|
+
|
|
48
|
+
/**
|
|
49
|
+
* 舍入间隔枚举
|
|
50
|
+
*/
|
|
51
|
+
export var RoundingInterval = /*#__PURE__*/function (RoundingInterval) {
|
|
52
|
+
RoundingInterval[RoundingInterval["Interval005"] = 0.05] = "Interval005";
|
|
53
|
+
RoundingInterval[RoundingInterval["Interval01"] = 0.1] = "Interval01";
|
|
54
|
+
RoundingInterval[RoundingInterval["Interval05"] = 0.5] = "Interval05";
|
|
55
|
+
RoundingInterval[RoundingInterval["Interval1"] = 1] = "Interval1";
|
|
56
|
+
return RoundingInterval;
|
|
57
|
+
}({});
|
|
58
|
+
|
|
37
59
|
/**
|
|
38
60
|
* 支付方式信息
|
|
39
61
|
*/
|
|
@@ -115,7 +137,36 @@ export var TaskRunStatus = /*#__PURE__*/function (TaskRunStatus) {
|
|
|
115
137
|
*/
|
|
116
138
|
|
|
117
139
|
/**
|
|
118
|
-
*
|
|
140
|
+
* 钱包推荐列表更新事件数据
|
|
141
|
+
*/
|
|
142
|
+
|
|
143
|
+
/**
|
|
144
|
+
* 用户识别码列表更新事件数据
|
|
145
|
+
*/
|
|
146
|
+
|
|
147
|
+
/**
|
|
148
|
+
* 钱包缓存清除事件数据
|
|
149
|
+
*/
|
|
150
|
+
|
|
151
|
+
/**
|
|
152
|
+
* 搜索识别码完成事件数据
|
|
153
|
+
*/
|
|
154
|
+
|
|
155
|
+
/**
|
|
156
|
+
* 钱包支付事件枚举
|
|
157
|
+
*/
|
|
158
|
+
export var WalletPassHooks = /*#__PURE__*/function (WalletPassHooks) {
|
|
159
|
+
WalletPassHooks["OnWalletRecommendListUpdated"] = "wallet:onWalletRecommendListUpdated";
|
|
160
|
+
WalletPassHooks["OnWalletRecommendListCleared"] = "wallet:onWalletRecommendListCleared";
|
|
161
|
+
WalletPassHooks["OnUserIdentificationCodesUpdated"] = "wallet:onUserIdentificationCodesUpdated";
|
|
162
|
+
WalletPassHooks["OnUserIdentificationCodesCleared"] = "wallet:onUserIdentificationCodesCleared";
|
|
163
|
+
WalletPassHooks["OnWalletCacheCleared"] = "wallet:onWalletCacheCleared";
|
|
164
|
+
WalletPassHooks["OnSearchIdentificationCodeCompleted"] = "wallet:onSearchIdentificationCodeCompleted";
|
|
165
|
+
return WalletPassHooks;
|
|
166
|
+
}({});
|
|
167
|
+
|
|
168
|
+
/**
|
|
169
|
+
* 支付钩子事件(统一接口)
|
|
119
170
|
*/
|
|
120
171
|
export var PaymentHooks = /*#__PURE__*/function (PaymentHooks) {
|
|
121
172
|
PaymentHooks["OnPaymentMethodsLoaded"] = "payment:onPaymentMethodsLoaded";
|
|
@@ -131,5 +182,53 @@ export var PaymentHooks = /*#__PURE__*/function (PaymentHooks) {
|
|
|
131
182
|
PaymentHooks["OnOrderAmountChanged"] = "payment:onOrderAmountChanged";
|
|
132
183
|
PaymentHooks["OnPaymentSyncError"] = "payment:onPaymentSyncError";
|
|
133
184
|
PaymentHooks["OnPaymentSyncSuccess"] = "payment:onPaymentSyncSuccess";
|
|
185
|
+
PaymentHooks["OnWalletRecommendListUpdated"] = "wallet:onWalletRecommendListUpdated";
|
|
186
|
+
PaymentHooks["OnWalletRecommendListCleared"] = "wallet:onWalletRecommendListCleared";
|
|
187
|
+
PaymentHooks["OnUserIdentificationCodesUpdated"] = "wallet:onUserIdentificationCodesUpdated";
|
|
188
|
+
PaymentHooks["OnUserIdentificationCodesCleared"] = "wallet:onUserIdentificationCodesCleared";
|
|
189
|
+
PaymentHooks["OnWalletCacheCleared"] = "wallet:onWalletCacheCleared";
|
|
190
|
+
PaymentHooks["OnSearchIdentificationCodeCompleted"] = "wallet:onSearchIdentificationCodeCompleted";
|
|
134
191
|
return PaymentHooks;
|
|
135
|
-
}({});
|
|
192
|
+
}({});
|
|
193
|
+
|
|
194
|
+
/**
|
|
195
|
+
* 钱包推荐扣款请求参数
|
|
196
|
+
*/
|
|
197
|
+
|
|
198
|
+
/**
|
|
199
|
+
* 钱包初始化业务数据接口
|
|
200
|
+
* 用于生成钱包API参数的必要业务信息
|
|
201
|
+
*/
|
|
202
|
+
|
|
203
|
+
/**
|
|
204
|
+
* 查询用户识别码列表请求参数
|
|
205
|
+
*/
|
|
206
|
+
|
|
207
|
+
/**
|
|
208
|
+
* 钱包推荐扣款响应数据
|
|
209
|
+
*/
|
|
210
|
+
|
|
211
|
+
/**
|
|
212
|
+
* 用户识别码列表响应数据
|
|
213
|
+
*/
|
|
214
|
+
|
|
215
|
+
/**
|
|
216
|
+
* 用户识别码项目
|
|
217
|
+
*/
|
|
218
|
+
|
|
219
|
+
/**
|
|
220
|
+
* 搜索识别码请求参数
|
|
221
|
+
* 基于 WalletDeductionRecommendParams 并增加 code 字段
|
|
222
|
+
*/
|
|
223
|
+
|
|
224
|
+
/**
|
|
225
|
+
* 搜索识别码响应数据
|
|
226
|
+
*/
|
|
227
|
+
|
|
228
|
+
/**
|
|
229
|
+
* 搜索识别码项目
|
|
230
|
+
*/
|
|
231
|
+
|
|
232
|
+
/**
|
|
233
|
+
* 钱包推荐项目
|
|
234
|
+
*/
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
export declare const getAvailableMaxAmount: (data: Record<string, any>) => any;
|
|
2
|
+
/**
|
|
3
|
+
* 将walletPass列表数据转换为prepare_payments需要的数据格式
|
|
4
|
+
* @param list
|
|
5
|
+
*/
|
|
6
|
+
export declare const formatWalletPassList2PreparePayments: (list?: any[]) => {
|
|
7
|
+
voucher_id: any;
|
|
8
|
+
amount: number;
|
|
9
|
+
tag: any;
|
|
10
|
+
}[];
|
|
11
|
+
/**
|
|
12
|
+
* 对用户识别码列表进行排序
|
|
13
|
+
* 排序规则:正常数据 -> unified_available_status===1 -> 500601/500602 -> unified_available_status===0
|
|
14
|
+
* @param list 用户识别码列表
|
|
15
|
+
* @returns 排序后的列表
|
|
16
|
+
*/
|
|
17
|
+
export declare const sortUserIdentificationCodeList: (list: any[]) => any[];
|
|
@@ -0,0 +1,62 @@
|
|
|
1
|
+
// 获取walletPass可用最大金额
|
|
2
|
+
export var getAvailableMaxAmount = function getAvailableMaxAmount(data) {
|
|
3
|
+
return data.tag !== 'point_card' ? data.available_max_amount : data === null || data === void 0 ? void 0 : data.recommended_usage_amount;
|
|
4
|
+
};
|
|
5
|
+
|
|
6
|
+
/**
|
|
7
|
+
* 将walletPass列表数据转换为prepare_payments需要的数据格式
|
|
8
|
+
* @param list
|
|
9
|
+
*/
|
|
10
|
+
export var formatWalletPassList2PreparePayments = function formatWalletPassList2PreparePayments(list) {
|
|
11
|
+
return (list || []).map(function (item) {
|
|
12
|
+
return {
|
|
13
|
+
voucher_id: item.id || 0,
|
|
14
|
+
amount: Number(getAvailableMaxAmount(item)) || 0,
|
|
15
|
+
tag: item.tag || ''
|
|
16
|
+
};
|
|
17
|
+
});
|
|
18
|
+
};
|
|
19
|
+
|
|
20
|
+
/**
|
|
21
|
+
* 对用户识别码列表进行排序
|
|
22
|
+
* 排序规则:正常数据 -> unified_available_status===1 -> 500601/500602 -> unified_available_status===0
|
|
23
|
+
* @param list 用户识别码列表
|
|
24
|
+
* @returns 排序后的列表
|
|
25
|
+
*/
|
|
26
|
+
export var sortUserIdentificationCodeList = function sortUserIdentificationCodeList(list) {
|
|
27
|
+
if (!Array.isArray(list) || list.length === 0) {
|
|
28
|
+
return list;
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
// 定义中等优先级错误码
|
|
32
|
+
var middlePriorityErrorCodes = ['500601', '500602'];
|
|
33
|
+
return list.sort(function (a, b) {
|
|
34
|
+
// 确定每个项目的优先级
|
|
35
|
+
// 0: 正常数据(没有特定错误码且available_status不是1或0)
|
|
36
|
+
// 1: unified_available_status === 1
|
|
37
|
+
// 2: 中等优先级错误码(500601、500602) 此订单内不可用 订单没有剩余金额
|
|
38
|
+
// 3: unified_available_status === 0(最后)
|
|
39
|
+
var getPriority = function getPriority(item) {
|
|
40
|
+
var _item$unified_error_c;
|
|
41
|
+
var errorCode = (_item$unified_error_c = item.unified_error_code) === null || _item$unified_error_c === void 0 ? void 0 : _item$unified_error_c.toString();
|
|
42
|
+
var availableStatus = item.unified_available_status;
|
|
43
|
+
|
|
44
|
+
// 中等优先级错误码
|
|
45
|
+
if (errorCode && middlePriorityErrorCodes.includes(errorCode)) return 2;
|
|
46
|
+
|
|
47
|
+
// unified_available_status === 0 最后
|
|
48
|
+
if (availableStatus === 0) return 3;
|
|
49
|
+
|
|
50
|
+
// unified_available_status === 1
|
|
51
|
+
if (availableStatus === 1) return 1;
|
|
52
|
+
|
|
53
|
+
// 正常数据
|
|
54
|
+
return 0;
|
|
55
|
+
};
|
|
56
|
+
var aPriority = getPriority(a);
|
|
57
|
+
var bPriority = getPriority(b);
|
|
58
|
+
|
|
59
|
+
// 按优先级排序,优先级相同则保持原有顺序
|
|
60
|
+
return aPriority - bPriority;
|
|
61
|
+
});
|
|
62
|
+
};
|