@pisell/pisellos 2.1.54 → 2.1.59

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.
Files changed (95) hide show
  1. package/dist/index.d.ts +0 -1
  2. package/dist/index.js +0 -1
  3. package/dist/modules/Cart/types.d.ts +0 -2
  4. package/dist/modules/Cart/utils/cartProduct.js +0 -11
  5. package/dist/modules/Discount/types.d.ts +2 -15
  6. package/dist/modules/Payment/index.d.ts +1 -2
  7. package/dist/modules/Payment/index.js +7 -10
  8. package/dist/modules/Payment/utils.js +0 -3
  9. package/dist/modules/Payment/walletpass.d.ts +0 -23
  10. package/dist/modules/Payment/walletpass.js +95 -191
  11. package/dist/modules/Rules/index.d.ts +5 -8
  12. package/dist/modules/Rules/index.js +31 -154
  13. package/dist/modules/Rules/types.d.ts +1 -1
  14. package/dist/modules/Summary/types.d.ts +0 -2
  15. package/dist/modules/Summary/utils.d.ts +0 -6
  16. package/dist/modules/Summary/utils.js +0 -21
  17. package/dist/plugins/window.d.ts +0 -2
  18. package/dist/solution/BookingByStep/index.d.ts +1 -2
  19. package/dist/solution/Checkout/index.js +0 -2
  20. package/dist/solution/ShopDiscount/index.d.ts +4 -1
  21. package/dist/solution/ShopDiscount/index.js +11 -12
  22. package/dist/solution/ShopDiscount/types.d.ts +4 -1
  23. package/dist/solution/ShopDiscount/utils.js +28 -29
  24. package/lib/index.d.ts +0 -1
  25. package/lib/index.js +1 -3
  26. package/lib/modules/Cart/types.d.ts +0 -2
  27. package/lib/modules/Cart/utils/cartProduct.js +0 -9
  28. package/lib/modules/Discount/types.d.ts +2 -15
  29. package/lib/modules/Payment/index.d.ts +1 -2
  30. package/lib/modules/Payment/index.js +0 -1
  31. package/lib/modules/Payment/utils.js +0 -3
  32. package/lib/modules/Payment/walletpass.d.ts +0 -23
  33. package/lib/modules/Payment/walletpass.js +17 -94
  34. package/lib/modules/Rules/index.d.ts +5 -8
  35. package/lib/modules/Rules/index.js +197 -372
  36. package/lib/modules/Rules/types.d.ts +1 -1
  37. package/lib/modules/Summary/types.d.ts +0 -2
  38. package/lib/modules/Summary/utils.d.ts +0 -6
  39. package/lib/modules/Summary/utils.js +0 -15
  40. package/lib/plugins/window.d.ts +0 -2
  41. package/lib/solution/BookingByStep/index.d.ts +1 -2
  42. package/lib/solution/Checkout/index.js +0 -2
  43. package/lib/solution/ShopDiscount/index.d.ts +4 -1
  44. package/lib/solution/ShopDiscount/index.js +9 -8
  45. package/lib/solution/ShopDiscount/types.d.ts +4 -1
  46. package/lib/solution/ShopDiscount/utils.js +18 -13
  47. package/package.json +1 -1
  48. package/dist/model/index.d.ts +0 -1
  49. package/dist/model/index.js +0 -1
  50. package/dist/model/strategy/adapter/index.d.ts +0 -3
  51. package/dist/model/strategy/adapter/index.js +0 -4
  52. package/dist/model/strategy/adapter/type.d.ts +0 -28
  53. package/dist/model/strategy/adapter/type.js +0 -1
  54. package/dist/model/strategy/adapter/walletPass/evaluator.d.ts +0 -84
  55. package/dist/model/strategy/adapter/walletPass/evaluator.js +0 -496
  56. package/dist/model/strategy/adapter/walletPass/example.d.ts +0 -4
  57. package/dist/model/strategy/adapter/walletPass/example.js +0 -258
  58. package/dist/model/strategy/adapter/walletPass/index.d.ts +0 -32
  59. package/dist/model/strategy/adapter/walletPass/index.js +0 -182
  60. package/dist/model/strategy/adapter/walletPass/locales.d.ts +0 -1
  61. package/dist/model/strategy/adapter/walletPass/locales.js +0 -23
  62. package/dist/model/strategy/adapter/walletPass/type.d.ts +0 -163
  63. package/dist/model/strategy/adapter/walletPass/type.js +0 -1
  64. package/dist/model/strategy/adapter/walletPass/utils.d.ts +0 -50
  65. package/dist/model/strategy/adapter/walletPass/utils.js +0 -965
  66. package/dist/model/strategy/index.d.ts +0 -94
  67. package/dist/model/strategy/index.js +0 -551
  68. package/dist/model/strategy/strategy-example.d.ts +0 -5
  69. package/dist/model/strategy/strategy-example.js +0 -331
  70. package/dist/model/strategy/type.d.ts +0 -228
  71. package/dist/model/strategy/type.js +0 -94
  72. package/lib/model/index.d.ts +0 -1
  73. package/lib/model/index.js +0 -23
  74. package/lib/model/strategy/adapter/index.d.ts +0 -3
  75. package/lib/model/strategy/adapter/index.js +0 -45
  76. package/lib/model/strategy/adapter/type.d.ts +0 -28
  77. package/lib/model/strategy/adapter/type.js +0 -17
  78. package/lib/model/strategy/adapter/walletPass/evaluator.d.ts +0 -84
  79. package/lib/model/strategy/adapter/walletPass/evaluator.js +0 -420
  80. package/lib/model/strategy/adapter/walletPass/example.d.ts +0 -4
  81. package/lib/model/strategy/adapter/walletPass/example.js +0 -207
  82. package/lib/model/strategy/adapter/walletPass/index.d.ts +0 -32
  83. package/lib/model/strategy/adapter/walletPass/index.js +0 -142
  84. package/lib/model/strategy/adapter/walletPass/locales.d.ts +0 -1
  85. package/lib/model/strategy/adapter/walletPass/locales.js +0 -51
  86. package/lib/model/strategy/adapter/walletPass/type.d.ts +0 -163
  87. package/lib/model/strategy/adapter/walletPass/type.js +0 -17
  88. package/lib/model/strategy/adapter/walletPass/utils.d.ts +0 -50
  89. package/lib/model/strategy/adapter/walletPass/utils.js +0 -660
  90. package/lib/model/strategy/index.d.ts +0 -94
  91. package/lib/model/strategy/index.js +0 -413
  92. package/lib/model/strategy/strategy-example.d.ts +0 -5
  93. package/lib/model/strategy/strategy-example.js +0 -318
  94. package/lib/model/strategy/type.d.ts +0 -228
  95. package/lib/model/strategy/type.js +0 -44
@@ -34,37 +34,22 @@ export var isAllNormalProduct = function isAllNormalProduct(items) {
34
34
  * @returns
35
35
  */
36
36
  export var getDiscountAmount = function getDiscountAmount(discount, total, price) {
37
- var discountedPrice = 0;
38
-
37
+ var _discount$metadata;
39
38
  // 商品券
40
39
  if (discount.tag === 'good_pass') {
41
- discountedPrice = new Decimal(price).minus(new Decimal(price || 0)).toNumber();
42
- } else {
43
- var _discount$metadata;
44
- // 判断是否是固定金额
45
- var isFixedAmount = (discount === null || discount === void 0 || (_discount$metadata = discount.metadata) === null || _discount$metadata === void 0 ? void 0 : _discount$metadata.discount_card_type) === 'fixed_amount';
46
-
47
- // 固定金额 小于0时返回0
48
- if (isFixedAmount) {
49
- discountedPrice = Math.max(new Decimal(price).minus(new Decimal(discount.par_value || 0)).toNumber(), 0);
50
- } else {
51
- // 百分比:根据折扣卡金额计算
52
- discountedPrice = new Decimal(100).minus(discount.par_value || 0).div(100).mul(new Decimal(price)).toNumber();
53
- }
40
+ return new Decimal(price).minus(new Decimal(price || 0)).toNumber();
54
41
  }
55
42
 
56
- /*
57
- // 🔥 如果有 maxDeductionAmount 限制,确保折扣金额不超过限制
58
- if (discount.config?.maxDeductionAmount) {
59
- const actualDiscountAmount = new Decimal(price).minus(discountedPrice).toNumber();
60
- if (actualDiscountAmount > discount.config.maxDeductionAmount) {
61
- // 折扣金额超过限制,重新计算折扣后价格
62
- discountedPrice = new Decimal(price).minus(discount.config.maxDeductionAmount).toNumber();
63
- }
64
- }
65
- */
43
+ // 判断是否是固定金额
44
+ var isFixedAmount = (discount === null || discount === void 0 || (_discount$metadata = discount.metadata) === null || _discount$metadata === void 0 ? void 0 : _discount$metadata.discount_card_type) === 'fixed_amount';
45
+
46
+ // 固定金额 小于0时返回0
47
+ if (isFixedAmount) {
48
+ return Math.max(new Decimal(price).minus(new Decimal(discount.par_value || 0)).toNumber(), 0);
49
+ }
66
50
 
67
- return discountedPrice;
51
+ // 百分比:根据折扣卡金额计算
52
+ return new Decimal(100).minus(discount.par_value || 0).div(100).mul(new Decimal(price)).toNumber();
68
53
  };
69
54
  export var getDiscountListAmountTotal = function getDiscountListAmountTotal(discount) {
70
55
  return discount.reduce(function (acc, cur) {
@@ -457,10 +442,24 @@ export var filterDiscountListByBookingTime = function filterDiscountListByBookin
457
442
  return discountList;
458
443
  }
459
444
  return discountList.filter(function (discount) {
460
- var _discount$metadata2, _discount$metadata3, _discount$custom_sche;
461
- if (!(discount !== null && discount !== void 0 && (_discount$metadata2 = discount.metadata) !== null && _discount$metadata2 !== void 0 && _discount$metadata2.validity_type) || (discount === null || discount === void 0 || (_discount$metadata3 = discount.metadata) === null || _discount$metadata3 === void 0 ? void 0 : _discount$metadata3.validity_type) === "fixed_validity") {
445
+ var _discount$metadata2;
446
+ if ((discount === null || discount === void 0 || (_discount$metadata2 = discount.metadata) === null || _discount$metadata2 === void 0 ? void 0 : _discount$metadata2.validity_type) === "custom_schedule_validity") {
447
+ var _discount$custom_sche;
448
+ return getDateIsInSchedule(bookingTime, ((_discount$custom_sche = discount.custom_schedule_snapshot) === null || _discount$custom_sche === void 0 ? void 0 : _discount$custom_sche.data) || []);
449
+ }
450
+ try {
451
+ var isHasStart = !!discount.start_date && !!discount.start_time;
452
+ var startDate = dayjs("".concat(discount.start_date, " ").concat(discount.start_time));
453
+ var bookingTimeDayjs = dayjs(bookingTime);
454
+
455
+ // 判断预约时间是否在开始时间之后
456
+ var isAfterStart = isHasStart ? bookingTimeDayjs.isSameOrAfter(startDate) : true;
457
+
458
+ // 判断预约时间是否在过期时间之前(expire_time 为空时为长期有效)
459
+ var isBeforeExpire = discount.expire_time ? bookingTimeDayjs.isSameOrBefore(dayjs(discount.expire_time)) : true;
460
+ return isAfterStart && isBeforeExpire;
461
+ } catch (error) {
462
462
  return true;
463
463
  }
464
- return getDateIsInSchedule(bookingTime, ((_discount$custom_sche = discount.custom_schedule_snapshot) === null || _discount$custom_sche === void 0 ? void 0 : _discount$custom_sche.data) || []);
465
464
  });
466
465
  };
package/lib/index.d.ts CHANGED
@@ -6,7 +6,6 @@ export * from './types';
6
6
  export * from './modules';
7
7
  export * from './plugins';
8
8
  export * from './solution';
9
- export * from './model';
10
9
  export { PisellOSCore } from './core';
11
10
  import PisellOSCore from './core';
12
11
  export default PisellOSCore;
package/lib/index.js CHANGED
@@ -38,7 +38,6 @@ __reExport(src_exports, require("./types"), module.exports);
38
38
  __reExport(src_exports, require("./modules"), module.exports);
39
39
  __reExport(src_exports, require("./plugins"), module.exports);
40
40
  __reExport(src_exports, require("./solution"), module.exports);
41
- __reExport(src_exports, require("./model"), module.exports);
42
41
  var import_core = require("./core");
43
42
  var import_core2 = __toESM(require("./core"));
44
43
  var src_default = import_core2.default;
@@ -48,6 +47,5 @@ var src_default = import_core2.default;
48
47
  ...require("./types"),
49
48
  ...require("./modules"),
50
49
  ...require("./plugins"),
51
- ...require("./solution"),
52
- ...require("./model")
50
+ ...require("./solution")
53
51
  });
@@ -75,8 +75,6 @@ export interface CartItem {
75
75
  summaryTotal?: number | string;
76
76
  /** 商品原价总价,排除原始价格为0的场景 */
77
77
  origin_total?: number | string;
78
- /** 基于 origin_total 乘以 商品数量的价格 */
79
- summaryOriginTotal?: number | string;
80
78
  /** 商品数量 */
81
79
  num?: number;
82
80
  /** 商品图片 */
@@ -88,14 +88,6 @@ var formatProductToCartItem = (params) => {
88
88
  num,
89
89
  discounts
90
90
  });
91
- const origin_total = getProductTotalPrice({
92
- product: cartItem._productInit || cartItem._productOrigin,
93
- bundle,
94
- options,
95
- num,
96
- discounts: []
97
- });
98
- cartItem.summaryOriginTotal = (origin_total || 0) * (num || 1);
99
91
  cartItem.image = product == null ? void 0 : product.cover;
100
92
  cartItem.like_status = "common";
101
93
  cartItem.duration = product == null ? void 0 : product.duration;
@@ -186,7 +178,6 @@ var getProductTotalPrice = (params) => {
186
178
  price = (0, import_utils2.getDiscountAmount)({
187
179
  tag: currentValue.type,
188
180
  par_value: currentValue.discount.percent,
189
- config: currentValue.config,
190
181
  metadata: {
191
182
  discount_card_type: (_a = currentValue == null ? void 0 : currentValue.discount) == null ? void 0 : _a.discount_card_type
192
183
  }
@@ -25,8 +25,6 @@ interface Limitedrelationproductdata {
25
25
  product_ids: number[];
26
26
  product_collection_id: number[];
27
27
  package_sub_item_usage_rules?: PackageSubItemUsageRules;
28
- filter: 0 | 1;
29
- exclude_product_ids: number[];
30
28
  }
31
29
  interface ApplicableProductDetails {
32
30
  amount: string;
@@ -98,19 +96,6 @@ export interface Discount {
98
96
  isSelected?: boolean;
99
97
  isAvailable?: boolean;
100
98
  isUsed?: boolean;
101
- config?: {
102
- isAvailable?: boolean;
103
- /** 最大抵扣金额 */
104
- maxDeductionAmount?: number;
105
- /** 每单最多使用张数 */
106
- maxUsagePerOrder?: number;
107
- /** 是否抵扣税费与附加费 */
108
- deductTaxAndFee?: boolean;
109
- /** 适用粒度(多商品共用) */
110
- allowCrossProduct?: boolean;
111
- /** 可用商品数量上限 */
112
- applicableProductLimit?: number;
113
- };
114
99
  applicableProductIds?: number[];
115
100
  applicableProductDetails: ApplicableProductDetails[];
116
101
  appliedProductDetails: ApplicableProductDetails[];
@@ -126,6 +111,8 @@ export interface Discount {
126
111
  data: any[];
127
112
  };
128
113
  num?: number;
114
+ start_date?: string;
115
+ start_time?: string;
129
116
  }
130
117
  export interface DiscountState {
131
118
  discountList: Discount[];
@@ -1,5 +1,5 @@
1
1
  import { Module, PisellCore, ModuleOptions } from '../../types';
2
- import { RequestPlugin, WindowPlugin } from '../../plugins';
2
+ import { RequestPlugin } from '../../plugins';
3
3
  import { BaseModule } from '../BaseModule';
4
4
  import { PaymentModuleAPI, PaymentMethod, PaymentOrder, PaymentItem, PaymentItemInput, PaymentUpdateFields, PushOrderParams, CashPayment, EftposPayment, WalletPassPayment, RoundingRule, RoundingInterval, RoundingResult } from './types';
5
5
  export * from './types';
@@ -21,7 +21,6 @@ export declare class PaymentModule extends BaseModule implements Module, Payment
21
21
  request: RequestPlugin;
22
22
  private app;
23
23
  private store;
24
- window: WindowPlugin;
25
24
  private dbManager;
26
25
  private logger;
27
26
  protected otherParams: any;
@@ -70,7 +70,6 @@ var PaymentModule = class extends import_BaseModule.BaseModule {
70
70
  this.otherParams = options.otherParams || {};
71
71
  this.request = core.getPlugin("request");
72
72
  const appPlugin = core.getPlugin("app");
73
- this.window = core.getPlugin("window");
74
73
  if (!this.request) {
75
74
  throw new Error("支付模块需要 request 插件支持");
76
75
  }
@@ -25,9 +25,6 @@ __export(utils_exports, {
25
25
  });
26
26
  module.exports = __toCommonJS(utils_exports);
27
27
  var getAvailableMaxAmount = (data) => {
28
- if (typeof data._available_max_amount === "number") {
29
- return data._available_max_amount;
30
- }
31
28
  return data.tag !== "point_card" ? data.available_max_amount : data == null ? void 0 : data.recommended_usage_amount;
32
29
  };
33
30
  var formatWalletPassList2PreparePayments = (list) => {
@@ -9,7 +9,6 @@ export declare class WalletPassPaymentImpl implements WalletPassPayment {
9
9
  private userIdentificationCodes;
10
10
  private searchResults;
11
11
  private walletParams;
12
- private walletInitData;
13
12
  constructor(paymentModule: PaymentModule);
14
13
  /**
15
14
  * 发送事件的辅助方法
@@ -38,14 +37,7 @@ export declare class WalletPassPaymentImpl implements WalletPassPayment {
38
37
  initializeWalletDataFromBusinessAsync(businessData: WalletInitBusinessData): Promise<{
39
38
  walletRecommendList: WalletRecommendItem[];
40
39
  userIdentificationCodes: UserIdentificationCodeItem[];
41
- transformList: any[];
42
- noApplicableVoucher: any[];
43
- products: any[];
44
40
  }>;
45
- /**
46
- * 获取订单基础详情
47
- */
48
- getOrderBasicDetailAsync(orderId: string): Promise<any>;
49
41
  /**
50
42
  * 初始化钱包数据
51
43
  * 先获取推荐列表,再获取用户识别码列表(顺序执行)
@@ -53,9 +45,6 @@ export declare class WalletPassPaymentImpl implements WalletPassPayment {
53
45
  initializeWalletDataAsync(baseParams: WalletDeductionRecommendParams): Promise<{
54
46
  walletRecommendList: WalletRecommendItem[];
55
47
  userIdentificationCodes: UserIdentificationCodeItem[];
56
- transformList: any[];
57
- noApplicableVoucher: any[];
58
- products: any[];
59
48
  }>;
60
49
  getWalletPassRecommendListAsync(params: WalletDeductionRecommendParams): Promise<WalletRecommendItem[]>;
61
50
  formatWalletPassList2PreparePayments(list: WalletRecommendItem[]): {
@@ -103,18 +92,6 @@ export declare class WalletPassPaymentImpl implements WalletPassPayment {
103
92
  * 清除搜索结果缓存
104
93
  */
105
94
  clearSearchResults(): void;
106
- /**
107
- * 获取存储的钱包初始化数据
108
- */
109
- getStoredWalletInitData(): {
110
- transformList: any[];
111
- noApplicableVoucher: any[];
112
- products: any[];
113
- } | null;
114
- /**
115
- * 清除存储的钱包初始化数据
116
- */
117
- clearStoredWalletInitData(): void;
118
95
  /**
119
96
  * 清除所有缓存数据
120
97
  */
@@ -31,7 +31,6 @@ var WalletPassPaymentImpl = class {
31
31
  this.userIdentificationCodes = [];
32
32
  this.searchResults = [];
33
33
  this.walletParams = null;
34
- this.walletInitData = null;
35
34
  }
36
35
  /**
37
36
  * 发送事件的辅助方法
@@ -43,9 +42,7 @@ var WalletPassPaymentImpl = class {
43
42
  const fullEventName = `${this.paymentModule.name}:${eventName}`;
44
43
  this.paymentModule.core.effects.emit(fullEventName, data);
45
44
  } catch (error) {
46
- this.paymentModule.logError("[WalletPass] 发送事件失败", error, {
47
- hook
48
- });
45
+ this.paymentModule.logError("[WalletPass] 发送事件失败", error, { hook });
49
46
  }
50
47
  }
51
48
  /**
@@ -115,10 +112,7 @@ var WalletPassPaymentImpl = class {
115
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) {
116
113
  return {
117
114
  walletRecommendList: [],
118
- userIdentificationCodes: [],
119
- transformList: [],
120
- noApplicableVoucher: [],
121
- products: []
115
+ userIdentificationCodes: []
122
116
  };
123
117
  }
124
118
  this.emitEvent(import_types.WalletPassHooks.OnWalletInitializationStarted, {
@@ -159,28 +153,11 @@ var WalletPassPaymentImpl = class {
159
153
  endTime,
160
154
  duration
161
155
  });
162
- this.paymentModule.logError(
163
- `[WalletPass] 从业务数据初始化钱包数据失败`,
164
- error,
165
- {
166
- duration: `${duration}ms`,
167
- customer_id: businessData.customer_id,
168
- totalAmount: (_h = businessData.amountInfo) == null ? void 0 : _h.totalAmount
169
- }
170
- );
171
- throw error;
172
- }
173
- }
174
- /**
175
- * 获取订单基础详情
176
- */
177
- async getOrderBasicDetailAsync(orderId) {
178
- try {
179
- const response = await this.paymentModule.request.get(
180
- `/order/order/${orderId}/basic-detail`
181
- );
182
- return (response == null ? void 0 : response.data) || {};
183
- } catch (error) {
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
+ });
184
161
  throw error;
185
162
  }
186
163
  }
@@ -189,49 +166,19 @@ var WalletPassPaymentImpl = class {
189
166
  * 先获取推荐列表,再获取用户识别码列表(顺序执行)
190
167
  */
191
168
  async initializeWalletDataAsync(baseParams) {
192
- var _a, _b;
193
169
  try {
170
+ const walletRecommendList = await this.getWalletPassRecommendListAsync(baseParams);
194
171
  const identificationParams = {
195
172
  ...baseParams,
196
173
  available: 2,
197
- prepare_payments: [],
174
+ prepare_payments: this.formatWalletPassList2PreparePayments(walletRecommendList),
198
175
  other_exact_codes: [],
199
176
  filter_prepare_wallet_pass: 1
200
177
  };
201
- const [allList, orderBasicDetail] = await Promise.all([
202
- this.getUserIdentificationCodeListAsync(identificationParams),
203
- baseParams.payment_order_id ? this.getOrderBasicDetailAsync(baseParams.payment_order_id) : Promise.resolve(null)
204
- ]);
205
- const walletPassEvaluator = (_b = (_a = this.paymentModule.window) == null ? void 0 : _a.getWalletPassEvaluator) == null ? void 0 : _b.call(_a);
206
- if (!walletPassEvaluator) {
207
- return {
208
- walletRecommendList: [],
209
- userIdentificationCodes: [],
210
- transformList: [],
211
- noApplicableVoucher: [],
212
- products: []
213
- };
214
- }
215
- const products = (orderBasicDetail == null ? void 0 : orderBasicDetail.detail) || baseParams.products;
216
- const res = walletPassEvaluator == null ? void 0 : walletPassEvaluator.getRecommendedVouchers({
217
- orderTotalAmount: baseParams.order_wait_pay_amount,
218
- products,
219
- vouchers: allList
220
- });
221
- const { recommended, transformList, noApplicableVoucher, recommendedAmount } = res;
222
- console.log(res, "resres12");
223
- this.walletRecommendList = recommended;
224
- this.walletInitData = {
225
- transformList,
226
- noApplicableVoucher,
227
- products: products || []
228
- };
178
+ const userIdentificationCodes = await this.getUserIdentificationCodeListAsync(identificationParams);
229
179
  return {
230
- walletRecommendList: recommended,
231
- userIdentificationCodes: allList,
232
- transformList,
233
- noApplicableVoucher,
234
- products: products || []
180
+ walletRecommendList,
181
+ userIdentificationCodes
235
182
  };
236
183
  } catch (error) {
237
184
  this.paymentModule.logError("[WalletPass] 初始化钱包数据失败", error, {
@@ -314,14 +261,10 @@ var WalletPassPaymentImpl = class {
314
261
  });
315
262
  return this.userIdentificationCodes;
316
263
  } catch (error) {
317
- this.paymentModule.logError(
318
- "[WalletPass] 获取用户识别码列表失败",
319
- error,
320
- {
321
- customer_id: params.customer_id,
322
- available: params.available
323
- }
324
- );
264
+ this.paymentModule.logError("[WalletPass] 获取用户识别码列表失败", error, {
265
+ customer_id: params.customer_id,
266
+ available: params.available
267
+ });
325
268
  return [];
326
269
  }
327
270
  }
@@ -519,19 +462,6 @@ var WalletPassPaymentImpl = class {
519
462
  this.searchResults = [];
520
463
  this.paymentModule.logInfo("[WalletPass] 搜索结果缓存已清除");
521
464
  }
522
- /**
523
- * 获取存储的钱包初始化数据
524
- */
525
- getStoredWalletInitData() {
526
- return this.walletInitData;
527
- }
528
- /**
529
- * 清除存储的钱包初始化数据
530
- */
531
- clearStoredWalletInitData() {
532
- this.walletInitData = null;
533
- this.paymentModule.logInfo("[WalletPass] 钱包初始化数据已清除");
534
- }
535
465
  /**
536
466
  * 清除所有缓存数据
537
467
  */
@@ -540,18 +470,11 @@ var WalletPassPaymentImpl = class {
540
470
  this.userIdentificationCodes = [];
541
471
  this.searchResults = [];
542
472
  this.walletParams = null;
543
- this.walletInitData = null;
544
473
  this.emitEvent(import_types.WalletPassHooks.OnWalletCacheCleared, {
545
474
  clearedTypes: ["all"]
546
475
  });
547
476
  this.paymentModule.logInfo("[WalletPass] 所有缓存数据已清除", {
548
- cleared_types: [
549
- "walletRecommendList",
550
- "userIdentificationCodes",
551
- "searchResults",
552
- "walletParams",
553
- "walletInitData"
554
- ]
477
+ cleared_types: ["walletRecommendList", "userIdentificationCodes", "searchResults", "walletParams"]
555
478
  });
556
479
  }
557
480
  };
@@ -1,41 +1,38 @@
1
1
  import { Module, PisellCore, ModuleOptions } from '../../types';
2
2
  import { BaseModule } from '../BaseModule';
3
3
  import { Rules, RulesModuleAPI, DiscountResult } from './types';
4
- import { Discount } from '../Discount/types';
4
+ import { Discount } from "../Discount/types";
5
5
  import { SetDiscountSelectedParams } from '../../solution/ShopDiscount/types';
6
- import { WindowPlugin } from '../../plugins';
7
6
  export declare class RulesModule extends BaseModule implements Module, RulesModuleAPI {
8
7
  protected defaultName: string;
9
8
  protected defaultVersion: string;
10
9
  private store;
11
- window: WindowPlugin;
12
10
  private hooks;
13
11
  constructor(name?: string, version?: string);
14
12
  initialize(core: PisellCore, options?: ModuleOptions): Promise<void>;
15
13
  setRulesList(rulesList: Rules[]): Promise<void>;
16
14
  getRulesList(): Rules[];
17
- getWalletPassEvaluator(): import("../..").WalletPassEvaluator | undefined;
18
15
  private checkHolderMatch;
19
- isDiscountListAvailable({ oldDiscountList, newDiscountList, productList, holders, orderTotalAmount, }: {
16
+ isDiscountListAvailable({ oldDiscountList, newDiscountList, productList, holders, isFormSubject, }: {
20
17
  oldDiscountList: Discount[];
21
18
  newDiscountList: Discount[];
22
19
  productList: any[];
23
20
  holders: {
24
21
  form_record_id: number;
25
22
  }[];
26
- orderTotalAmount: number;
23
+ isFormSubject: boolean;
27
24
  }): {
28
25
  isAvailable: boolean;
29
26
  discountList: Discount[];
30
27
  productList: any[];
31
28
  };
32
- calcDiscount({ discountList, productList, holders, orderTotalAmount }: {
29
+ calcDiscount({ discountList, productList, holders, isFormSubject, }: {
33
30
  discountList: Discount[];
34
31
  productList: any[];
35
32
  holders: {
36
33
  form_record_id: number;
37
34
  }[];
38
- orderTotalAmount: number;
35
+ isFormSubject: boolean;
39
36
  }, options?: {
40
37
  isSelected?: boolean;
41
38
  discountId?: number;