@pisell/pisellos 2.1.112 → 2.1.113
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/index.d.ts +0 -1
- package/dist/index.js +0 -1
- package/dist/modules/Cart/types.d.ts +0 -2
- package/dist/modules/Cart/utils/cartProduct.js +24 -56
- package/dist/modules/Discount/types.d.ts +0 -18
- package/dist/modules/Payment/index.d.ts +1 -2
- package/dist/modules/Payment/index.js +7 -10
- package/dist/modules/Payment/utils.js +0 -3
- package/dist/modules/Payment/walletpass.d.ts +0 -23
- package/dist/modules/Payment/walletpass.js +95 -191
- package/dist/modules/Product/index.d.ts +1 -1
- package/dist/modules/Rules/index.d.ts +5 -9
- package/dist/modules/Rules/index.js +152 -664
- package/dist/modules/Rules/types.d.ts +0 -2
- package/dist/modules/Summary/types.d.ts +0 -2
- package/dist/modules/Summary/utils.d.ts +0 -6
- package/dist/modules/Summary/utils.js +0 -21
- package/dist/plugins/window.d.ts +0 -2
- package/dist/solution/BookingByStep/index.d.ts +0 -1
- package/dist/solution/BookingByStep/index.js +50 -48
- package/dist/solution/Checkout/index.js +0 -2
- package/dist/solution/ShopDiscount/index.d.ts +0 -1
- package/dist/solution/ShopDiscount/index.js +7 -23
- package/dist/solution/ShopDiscount/types.d.ts +0 -1
- package/dist/solution/ShopDiscount/types.js +1 -2
- package/dist/solution/ShopDiscount/utils.js +12 -26
- package/lib/index.d.ts +0 -1
- package/lib/index.js +1 -3
- package/lib/modules/Cart/types.d.ts +0 -2
- package/lib/modules/Cart/utils/cartProduct.js +11 -39
- package/lib/modules/Discount/types.d.ts +0 -18
- package/lib/modules/Payment/index.d.ts +1 -2
- package/lib/modules/Payment/index.js +0 -1
- package/lib/modules/Payment/utils.js +0 -3
- package/lib/modules/Payment/walletpass.d.ts +0 -23
- package/lib/modules/Payment/walletpass.js +17 -94
- package/lib/modules/Product/index.d.ts +1 -1
- package/lib/modules/Rules/index.d.ts +5 -9
- package/lib/modules/Rules/index.js +284 -779
- package/lib/modules/Rules/types.d.ts +0 -2
- package/lib/modules/Summary/types.d.ts +0 -2
- package/lib/modules/Summary/utils.d.ts +0 -6
- package/lib/modules/Summary/utils.js +0 -15
- package/lib/plugins/window.d.ts +0 -2
- package/lib/solution/BookingByStep/index.d.ts +0 -1
- package/lib/solution/BookingByStep/index.js +12 -13
- package/lib/solution/Checkout/index.js +0 -2
- package/lib/solution/ShopDiscount/index.d.ts +0 -1
- package/lib/solution/ShopDiscount/index.js +8 -22
- package/lib/solution/ShopDiscount/types.d.ts +0 -1
- package/lib/solution/ShopDiscount/utils.js +6 -10
- package/package.json +1 -1
- package/dist/model/index.d.ts +0 -1
- package/dist/model/index.js +0 -1
- package/dist/model/strategy/adapter/index.d.ts +0 -3
- package/dist/model/strategy/adapter/index.js +0 -4
- package/dist/model/strategy/adapter/type.d.ts +0 -28
- package/dist/model/strategy/adapter/type.js +0 -1
- package/dist/model/strategy/adapter/walletPass/evaluator.d.ts +0 -84
- package/dist/model/strategy/adapter/walletPass/evaluator.js +0 -499
- package/dist/model/strategy/adapter/walletPass/example.d.ts +0 -4
- package/dist/model/strategy/adapter/walletPass/example.js +0 -258
- package/dist/model/strategy/adapter/walletPass/index.d.ts +0 -32
- package/dist/model/strategy/adapter/walletPass/index.js +0 -182
- package/dist/model/strategy/adapter/walletPass/locales.d.ts +0 -1
- package/dist/model/strategy/adapter/walletPass/locales.js +0 -26
- package/dist/model/strategy/adapter/walletPass/type.d.ts +0 -187
- package/dist/model/strategy/adapter/walletPass/type.js +0 -1
- package/dist/model/strategy/adapter/walletPass/utils.d.ts +0 -50
- package/dist/model/strategy/adapter/walletPass/utils.js +0 -1104
- package/dist/model/strategy/index.d.ts +0 -94
- package/dist/model/strategy/index.js +0 -551
- package/dist/model/strategy/strategy-example.d.ts +0 -5
- package/dist/model/strategy/strategy-example.js +0 -331
- package/dist/model/strategy/type.d.ts +0 -228
- package/dist/model/strategy/type.js +0 -94
- package/lib/model/index.d.ts +0 -1
- package/lib/model/index.js +0 -23
- package/lib/model/strategy/adapter/index.d.ts +0 -3
- package/lib/model/strategy/adapter/index.js +0 -45
- package/lib/model/strategy/adapter/type.d.ts +0 -28
- package/lib/model/strategy/adapter/type.js +0 -17
- package/lib/model/strategy/adapter/walletPass/evaluator.d.ts +0 -84
- package/lib/model/strategy/adapter/walletPass/evaluator.js +0 -423
- package/lib/model/strategy/adapter/walletPass/example.d.ts +0 -4
- package/lib/model/strategy/adapter/walletPass/example.js +0 -207
- package/lib/model/strategy/adapter/walletPass/index.d.ts +0 -32
- package/lib/model/strategy/adapter/walletPass/index.js +0 -142
- package/lib/model/strategy/adapter/walletPass/locales.d.ts +0 -1
- package/lib/model/strategy/adapter/walletPass/locales.js +0 -54
- package/lib/model/strategy/adapter/walletPass/type.d.ts +0 -187
- package/lib/model/strategy/adapter/walletPass/type.js +0 -17
- package/lib/model/strategy/adapter/walletPass/utils.d.ts +0 -50
- package/lib/model/strategy/adapter/walletPass/utils.js +0 -791
- package/lib/model/strategy/index.d.ts +0 -94
- package/lib/model/strategy/index.js +0 -413
- package/lib/model/strategy/strategy-example.d.ts +0 -5
- package/lib/model/strategy/strategy-example.js +0 -318
- package/lib/model/strategy/type.d.ts +0 -228
- package/lib/model/strategy/type.js +0 -44
|
@@ -46,18 +46,6 @@ var import_decimal = __toESM(require("decimal.js"));
|
|
|
46
46
|
var import_utils = require("../../Product/utils");
|
|
47
47
|
var import_utils2 = require("../../../solution/ShopDiscount/utils");
|
|
48
48
|
var import_utils3 = require("../../Summary/utils");
|
|
49
|
-
var toDiscountPayload = (discountItem) => {
|
|
50
|
-
var _a, _b;
|
|
51
|
-
return {
|
|
52
|
-
amount: discountItem.amount,
|
|
53
|
-
tag: discountItem.type,
|
|
54
|
-
par_value: (_a = discountItem.discount) == null ? void 0 : _a.percent,
|
|
55
|
-
config: discountItem.config,
|
|
56
|
-
metadata: {
|
|
57
|
-
discount_card_type: (_b = discountItem == null ? void 0 : discountItem.discount) == null ? void 0 : _b.discount_card_type
|
|
58
|
-
}
|
|
59
|
-
};
|
|
60
|
-
};
|
|
61
49
|
var handleVariantProduct = (product) => {
|
|
62
50
|
var _a;
|
|
63
51
|
if (product == null ? void 0 : product.product_variant_id) {
|
|
@@ -102,14 +90,6 @@ var formatProductToCartItem = (params) => {
|
|
|
102
90
|
num,
|
|
103
91
|
discounts
|
|
104
92
|
});
|
|
105
|
-
const origin_total = getProductTotalPrice({
|
|
106
|
-
product: cartItem._productInit || cartItem._productOrigin,
|
|
107
|
-
bundle,
|
|
108
|
-
options,
|
|
109
|
-
num,
|
|
110
|
-
discounts: []
|
|
111
|
-
});
|
|
112
|
-
cartItem.summaryOriginTotal = (origin_total || 0) * (num || 1);
|
|
113
93
|
cartItem.image = product == null ? void 0 : product.cover;
|
|
114
94
|
cartItem.like_status = "common";
|
|
115
95
|
cartItem.duration = product == null ? void 0 : product.duration;
|
|
@@ -204,24 +184,17 @@ var formatProductToCartItemOrigin = (params) => {
|
|
|
204
184
|
var getProductTotalPrice = (params) => {
|
|
205
185
|
const { product, bundle, options, discounts } = params;
|
|
206
186
|
let price = Number(product.price);
|
|
207
|
-
const optionRows = (options == null ? void 0 : options.map((currentValue) => ({
|
|
208
|
-
unit: Number(currentValue.price ?? currentValue.add_price ?? 0),
|
|
209
|
-
num: Number(currentValue.num ?? currentValue.quantity ?? 1)
|
|
210
|
-
}))) ?? [];
|
|
211
187
|
if (discounts == null ? void 0 : discounts.length) {
|
|
212
188
|
discounts.forEach((currentValue) => {
|
|
213
189
|
var _a;
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
...row,
|
|
221
|
-
unit: (0, import_utils2.getDiscountAmount)(payload, row.unit, row.unit)
|
|
222
|
-
};
|
|
190
|
+
price = (0, import_utils2.getDiscountAmount)({
|
|
191
|
+
amount: currentValue.amount,
|
|
192
|
+
tag: currentValue.type,
|
|
193
|
+
par_value: currentValue.discount.percent,
|
|
194
|
+
metadata: {
|
|
195
|
+
discount_card_type: (_a = currentValue == null ? void 0 : currentValue.discount) == null ? void 0 : _a.discount_card_type
|
|
223
196
|
}
|
|
224
|
-
}
|
|
197
|
+
}, price, price);
|
|
225
198
|
});
|
|
226
199
|
}
|
|
227
200
|
if (bundle == null ? void 0 : bundle.length) {
|
|
@@ -229,11 +202,10 @@ var getProductTotalPrice = (params) => {
|
|
|
229
202
|
return accumulator + Number(currentValue.price) * Number(currentValue.num);
|
|
230
203
|
}, price);
|
|
231
204
|
}
|
|
232
|
-
if (
|
|
233
|
-
price =
|
|
234
|
-
|
|
235
|
-
|
|
236
|
-
);
|
|
205
|
+
if (options == null ? void 0 : options.length) {
|
|
206
|
+
price = options.reduce((accumulator, currentValue) => {
|
|
207
|
+
return accumulator + Number(currentValue.price) * Number(currentValue.num);
|
|
208
|
+
}, price);
|
|
237
209
|
}
|
|
238
210
|
return Math.max(0, price);
|
|
239
211
|
};
|
|
@@ -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;
|
|
@@ -83,7 +81,6 @@ export interface Discount {
|
|
|
83
81
|
balance: string;
|
|
84
82
|
format_title: Formattitle;
|
|
85
83
|
metadata?: {
|
|
86
|
-
num?: number;
|
|
87
84
|
discount_card_type?: 'fixed_amount' | 'percent';
|
|
88
85
|
custom_product_bundle_map_id?: string;
|
|
89
86
|
validity_type?: "custom_schedule_validity" | "fixed_validity";
|
|
@@ -108,21 +105,6 @@ export interface Discount {
|
|
|
108
105
|
isSelected?: boolean;
|
|
109
106
|
isAvailable?: boolean;
|
|
110
107
|
isUsed?: boolean;
|
|
111
|
-
config?: {
|
|
112
|
-
isAvailable?: boolean;
|
|
113
|
-
/** 最大抵扣金额 */
|
|
114
|
-
maxDeductionAmount?: number;
|
|
115
|
-
/** 每单最多使用张数 */
|
|
116
|
-
maxUsagePerOrder?: number;
|
|
117
|
-
/** 是否抵扣税费与附加费 */
|
|
118
|
-
deductTaxAndFee?: boolean;
|
|
119
|
-
/** 适用粒度(多商品共用) */
|
|
120
|
-
allowCrossProduct?: boolean;
|
|
121
|
-
/** 可用商品数量上限 */
|
|
122
|
-
applicableProductLimit?: number;
|
|
123
|
-
/** 是否抵扣单规格价格 (Option Price) */
|
|
124
|
-
deductOptionPrice?: boolean;
|
|
125
|
-
};
|
|
126
108
|
applicableProductIds?: number[];
|
|
127
109
|
applicableProductDetails: ApplicableProductDetails[];
|
|
128
110
|
appliedProductDetails: ApplicableProductDetails[];
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { Module, PisellCore, ModuleOptions } from '../../types';
|
|
2
|
-
import { RequestPlugin
|
|
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
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
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
|
|
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
|
|
231
|
-
userIdentificationCodes
|
|
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
|
-
|
|
319
|
-
|
|
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
|
};
|
|
@@ -49,5 +49,5 @@ export declare class Product extends BaseModule implements Module {
|
|
|
49
49
|
getCategories(): ProductCategory[];
|
|
50
50
|
setOtherParams(key: string, value: any): void;
|
|
51
51
|
getOtherParams(): any;
|
|
52
|
-
getProductType(): "
|
|
52
|
+
getProductType(): "normal" | "duration" | "session";
|
|
53
53
|
}
|
|
@@ -1,28 +1,25 @@
|
|
|
1
1
|
import { Module, PisellCore, ModuleOptions } from '../../types';
|
|
2
2
|
import { BaseModule } from '../BaseModule';
|
|
3
3
|
import { Rules, RulesModuleAPI, DiscountResult, UnavailableReason } from './types';
|
|
4
|
-
import { Discount } from
|
|
5
|
-
import {
|
|
4
|
+
import { Discount } from "../Discount/types";
|
|
5
|
+
import { SetDiscountSelectedParams } from '../../solution/ShopDiscount/types';
|
|
6
6
|
export declare class RulesModule extends BaseModule implements Module, RulesModuleAPI {
|
|
7
7
|
protected defaultName: string;
|
|
8
8
|
protected defaultVersion: string;
|
|
9
9
|
private store;
|
|
10
|
-
window: WindowPlugin;
|
|
11
10
|
private hooks;
|
|
12
11
|
constructor(name?: string, version?: string);
|
|
13
12
|
initialize(core: PisellCore, options?: ModuleOptions): Promise<void>;
|
|
14
13
|
setRulesList(rulesList: Rules[]): Promise<void>;
|
|
15
14
|
getRulesList(): Rules[];
|
|
16
15
|
private checkHolderMatch;
|
|
17
|
-
|
|
18
|
-
isDiscountListAvailable({ oldDiscountList, newDiscountList, productList, orderTotalAmount, holders, isFormSubject, }: {
|
|
16
|
+
isDiscountListAvailable({ oldDiscountList, newDiscountList, productList, holders, isFormSubject, }: {
|
|
19
17
|
oldDiscountList: Discount[];
|
|
20
18
|
newDiscountList: Discount[];
|
|
21
19
|
productList: any[];
|
|
22
20
|
holders: {
|
|
23
21
|
form_record_id: number;
|
|
24
22
|
}[];
|
|
25
|
-
orderTotalAmount: number;
|
|
26
23
|
isFormSubject: boolean;
|
|
27
24
|
}): {
|
|
28
25
|
isAvailable: boolean;
|
|
@@ -32,18 +29,17 @@ export declare class RulesModule extends BaseModule implements Module, RulesModu
|
|
|
32
29
|
};
|
|
33
30
|
filterDiscountListByType(discountList: Discount[], type: string): Discount[];
|
|
34
31
|
private getUnavailableReason;
|
|
35
|
-
calcDiscount({ discountList, productList, holders, isFormSubject,
|
|
32
|
+
calcDiscount({ discountList, productList, holders, isFormSubject, }: {
|
|
36
33
|
discountList: Discount[];
|
|
37
34
|
productList: any[];
|
|
38
35
|
holders: {
|
|
39
36
|
form_record_id: number;
|
|
40
37
|
}[];
|
|
41
38
|
isFormSubject: boolean;
|
|
42
|
-
orderTotalAmount: number;
|
|
43
39
|
}, options?: {
|
|
44
40
|
isSelected?: boolean;
|
|
45
41
|
discountId?: number;
|
|
46
|
-
selectedList?:
|
|
42
|
+
selectedList?: SetDiscountSelectedParams[];
|
|
47
43
|
scan?: boolean;
|
|
48
44
|
}): DiscountResult;
|
|
49
45
|
/**
|