@pisell/pisellos 2.3.43 → 2.3.44
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/model/strategy/adapter/promotion/index.js +9 -0
- package/dist/modules/Order/index.d.ts +2 -1
- package/dist/modules/Order/index.js +73 -28
- package/dist/modules/Order/types.d.ts +2 -0
- package/dist/modules/Payment/walletpass.d.ts +10 -3
- package/dist/modules/Payment/walletpass.js +425 -282
- package/dist/modules/Rules/index.d.ts +2 -0
- package/dist/modules/Rules/index.js +61 -57
- package/dist/solution/BaseSales/index.js +6 -3
- package/dist/solution/BaseSales/types.d.ts +3 -1
- package/dist/solution/BaseSales/utils/transformBaseProductToOrderProduct.js +6 -3
- package/dist/solution/BookingTicket/index.d.ts +1 -1
- package/dist/solution/BookingTicket/index.js +6 -3
- package/dist/solution/BookingTicket/types.d.ts +1 -0
- package/dist/solution/BookingTicket/utils/scan/applyGlobalScan.js +3 -3
- package/dist/solution/VenueBooking/index.d.ts +1 -0
- package/lib/model/strategy/adapter/promotion/index.js +51 -0
- package/lib/modules/Order/index.d.ts +2 -1
- package/lib/modules/Order/index.js +46 -7
- package/lib/modules/Order/types.d.ts +2 -0
- package/lib/modules/Payment/walletpass.d.ts +10 -3
- package/lib/modules/Payment/walletpass.js +218 -56
- package/lib/modules/Rules/index.d.ts +2 -0
- package/lib/modules/Rules/index.js +8 -3
- package/lib/solution/BaseSales/index.js +1 -0
- package/lib/solution/BaseSales/types.d.ts +3 -1
- package/lib/solution/BaseSales/utils/transformBaseProductToOrderProduct.js +3 -2
- package/lib/solution/BookingTicket/index.d.ts +1 -1
- package/lib/solution/BookingTicket/index.js +1 -0
- package/lib/solution/BookingTicket/types.d.ts +1 -0
- package/lib/solution/BookingTicket/utils/scan/applyGlobalScan.js +2 -2
- package/lib/solution/VenueBooking/index.d.ts +1 -0
- package/package.json +1 -1
|
@@ -34,6 +34,11 @@ function getWalletAssetKey(assetOrId) {
|
|
|
34
34
|
var id = assetOrId && _typeof(assetOrId) === 'object' ? getWalletAssetId(assetOrId) : assetOrId;
|
|
35
35
|
return id === undefined || id === null ? '' : String(id);
|
|
36
36
|
}
|
|
37
|
+
function matchesWalletAssetCode(asset, normalizedCode) {
|
|
38
|
+
return [asset === null || asset === void 0 ? void 0 : asset.code, asset === null || asset === void 0 ? void 0 : asset.encoded].some(function (identifier) {
|
|
39
|
+
return String(identifier !== null && identifier !== void 0 ? identifier : '').trim() === normalizedCode;
|
|
40
|
+
});
|
|
41
|
+
}
|
|
37
42
|
function isWalletAssetAvailable(asset) {
|
|
38
43
|
if (!asset) return false;
|
|
39
44
|
if (asset.unified_available_status !== undefined && Number(asset.unified_available_status) !== 1) {
|
|
@@ -147,13 +152,17 @@ export var WalletPassPaymentImpl = /*#__PURE__*/function () {
|
|
|
147
152
|
var committedKeys = new Set(this.walletAssetsState.committedIds.map(function (id) {
|
|
148
153
|
return String(id);
|
|
149
154
|
}));
|
|
150
|
-
var
|
|
155
|
+
var itemsByKey = new Map(items.map(function (item) {
|
|
156
|
+
return [getWalletAssetKey(item), item];
|
|
157
|
+
}));
|
|
158
|
+
var requested = requestedIds.map(function (id) {
|
|
151
159
|
return String(id);
|
|
152
160
|
}).filter(function (id) {
|
|
153
161
|
return !committedKeys.has(id);
|
|
154
|
-
}))
|
|
155
|
-
|
|
156
|
-
|
|
162
|
+
}).map(function (id) {
|
|
163
|
+
return itemsByKey.get(id);
|
|
164
|
+
}).filter(function (item) {
|
|
165
|
+
return item && isWalletAssetAvailable(item);
|
|
157
166
|
});
|
|
158
167
|
var nextItems = items;
|
|
159
168
|
var selectedItems = requested;
|
|
@@ -200,110 +209,52 @@ export var WalletPassPaymentImpl = /*#__PURE__*/function () {
|
|
|
200
209
|
});
|
|
201
210
|
}
|
|
202
211
|
|
|
212
|
+
/** 获取当前缓存中所有支付类 Wallet 资产的扫码 code。 */
|
|
213
|
+
}, {
|
|
214
|
+
key: "getSearchedWalletAssetCodes",
|
|
215
|
+
value: function getSearchedWalletAssetCodes() {
|
|
216
|
+
var cachedAssets = this.searchResults.filter(isWalletPaymentAsset);
|
|
217
|
+
var seenCodes = new Set();
|
|
218
|
+
return cachedAssets.map(function (item) {
|
|
219
|
+
return String((item === null || item === void 0 ? void 0 : item.code) || '').trim();
|
|
220
|
+
}).filter(function (code) {
|
|
221
|
+
var normalizedCode = code.toUpperCase();
|
|
222
|
+
if (!normalizedCode || seenCodes.has(normalizedCode)) return false;
|
|
223
|
+
seenCodes.add(normalizedCode);
|
|
224
|
+
return true;
|
|
225
|
+
});
|
|
226
|
+
}
|
|
227
|
+
|
|
203
228
|
/**
|
|
204
|
-
*
|
|
205
|
-
*
|
|
229
|
+
* 用订单重算接口返回的数据更新扫码 Wallet 缓存。
|
|
230
|
+
* 接口暂时缺失某个扫码 code 时继续保留旧值,避免列表闪空。
|
|
206
231
|
*/
|
|
207
232
|
}, {
|
|
208
|
-
key: "
|
|
209
|
-
value:
|
|
210
|
-
var
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
return _regeneratorRuntime().wrap(function _callee2$(_context2) {
|
|
214
|
-
while (1) switch (_context2.prev = _context2.next) {
|
|
215
|
-
case 0:
|
|
216
|
-
cachedAssets = this.searchResults.filter(isWalletPaymentAsset);
|
|
217
|
-
searchCodes = _toConsumableArray(new Set(cachedAssets.map(function (item) {
|
|
218
|
-
return String((item === null || item === void 0 ? void 0 : item.code) || '').trim();
|
|
219
|
-
}).filter(Boolean)));
|
|
220
|
-
if (!(searchCodes.length === 0)) {
|
|
221
|
-
_context2.next = 4;
|
|
222
|
-
break;
|
|
223
|
-
}
|
|
224
|
-
return _context2.abrupt("return", cachedAssets);
|
|
225
|
-
case 4:
|
|
226
|
-
preparePayments = this.formatWalletPassList2PreparePayments(this.walletAssetsState.selectedItems);
|
|
227
|
-
_context2.next = 7;
|
|
228
|
-
return Promise.all(searchCodes.map( /*#__PURE__*/function () {
|
|
229
|
-
var _ref9 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee(searchCode) {
|
|
230
|
-
var result;
|
|
231
|
-
return _regeneratorRuntime().wrap(function _callee$(_context) {
|
|
232
|
-
while (1) switch (_context.prev = _context.next) {
|
|
233
|
-
case 0:
|
|
234
|
-
_context.prev = 0;
|
|
235
|
-
_context.next = 3;
|
|
236
|
-
return _this.searchIdentificationCodeAsync(_objectSpread(_objectSpread({}, _this.walletParams || {}), {}, {
|
|
237
|
-
code: searchCode,
|
|
238
|
-
prepare_payments: preparePayments
|
|
239
|
-
}), {
|
|
240
|
-
noCache: true
|
|
241
|
-
});
|
|
242
|
-
case 3:
|
|
243
|
-
result = _context.sent;
|
|
244
|
-
return _context.abrupt("return", {
|
|
245
|
-
searchCode: searchCode,
|
|
246
|
-
items: result.type === 'normalCode' ? result.data.filter(isWalletPaymentAsset) : []
|
|
247
|
-
});
|
|
248
|
-
case 7:
|
|
249
|
-
_context.prev = 7;
|
|
250
|
-
_context.t0 = _context["catch"](0);
|
|
251
|
-
_this.paymentModule.logWarning('[WalletPass] 重验扫码 Wallet 资产失败,保留旧结果', {
|
|
252
|
-
code: searchCode,
|
|
253
|
-
error: _context.t0 instanceof Error ? _context.t0.message : String(_context.t0)
|
|
254
|
-
});
|
|
255
|
-
return _context.abrupt("return", {
|
|
256
|
-
searchCode: searchCode,
|
|
257
|
-
items: []
|
|
258
|
-
});
|
|
259
|
-
case 11:
|
|
260
|
-
case "end":
|
|
261
|
-
return _context.stop();
|
|
262
|
-
}
|
|
263
|
-
}, _callee, null, [[0, 7]]);
|
|
264
|
-
}));
|
|
265
|
-
return function (_x2) {
|
|
266
|
-
return _ref9.apply(this, arguments);
|
|
267
|
-
};
|
|
268
|
-
}()));
|
|
269
|
-
case 7:
|
|
270
|
-
refreshedGroups = _context2.sent;
|
|
271
|
-
if (!(requestSequence !== this.walletAssetsRequestSequence)) {
|
|
272
|
-
_context2.next = 10;
|
|
273
|
-
break;
|
|
274
|
-
}
|
|
275
|
-
return _context2.abrupt("return", cachedAssets);
|
|
276
|
-
case 10:
|
|
277
|
-
replacedCodes = new Set(refreshedGroups.filter(function (group) {
|
|
278
|
-
return group.items.length > 0;
|
|
279
|
-
}).map(function (group) {
|
|
280
|
-
return group.searchCode.toUpperCase();
|
|
281
|
-
}));
|
|
282
|
-
refreshedAssets = refreshedGroups.flatMap(function (group) {
|
|
283
|
-
return group.items;
|
|
284
|
-
});
|
|
285
|
-
if (refreshedAssets.length > 0) {
|
|
286
|
-
this.searchResults = [].concat(_toConsumableArray(this.searchResults.filter(function (item) {
|
|
287
|
-
return !replacedCodes.has(String((item === null || item === void 0 ? void 0 : item.code) || '').trim().toUpperCase());
|
|
288
|
-
})), _toConsumableArray(refreshedAssets));
|
|
289
|
-
}
|
|
290
|
-
return _context2.abrupt("return", mergeWalletAssets(cachedAssets, refreshedAssets));
|
|
291
|
-
case 14:
|
|
292
|
-
case "end":
|
|
293
|
-
return _context2.stop();
|
|
294
|
-
}
|
|
295
|
-
}, _callee2, this);
|
|
233
|
+
key: "syncSearchedWalletAssets",
|
|
234
|
+
value: function syncSearchedWalletAssets(refreshedCandidates) {
|
|
235
|
+
var cachedAssets = this.searchResults.filter(isWalletPaymentAsset);
|
|
236
|
+
var searchedCodeKeys = new Set(this.getSearchedWalletAssetCodes().map(function (code) {
|
|
237
|
+
return code.toUpperCase();
|
|
296
238
|
}));
|
|
297
|
-
|
|
298
|
-
|
|
239
|
+
if (searchedCodeKeys.size === 0) return cachedAssets;
|
|
240
|
+
var refreshedAssets = refreshedCandidates.filter(function (item) {
|
|
241
|
+
return isWalletPaymentAsset(item) && searchedCodeKeys.has(String((item === null || item === void 0 ? void 0 : item.code) || '').trim().toUpperCase());
|
|
242
|
+
});
|
|
243
|
+
if (refreshedAssets.length > 0) {
|
|
244
|
+
var replacedCodes = new Set(refreshedAssets.map(function (item) {
|
|
245
|
+
return String((item === null || item === void 0 ? void 0 : item.code) || '').trim().toUpperCase();
|
|
246
|
+
}));
|
|
247
|
+
this.searchResults = [].concat(_toConsumableArray(this.searchResults.filter(function (item) {
|
|
248
|
+
return !replacedCodes.has(String((item === null || item === void 0 ? void 0 : item.code) || '').trim().toUpperCase());
|
|
249
|
+
})), _toConsumableArray(refreshedAssets));
|
|
299
250
|
}
|
|
300
|
-
return
|
|
301
|
-
}
|
|
251
|
+
return mergeWalletAssets(cachedAssets, refreshedAssets);
|
|
252
|
+
}
|
|
253
|
+
|
|
302
254
|
/**
|
|
303
255
|
* 生成钱包API默认参数
|
|
304
256
|
* 根据业务数据生成标准的钱包API参数,并存储在模块中
|
|
305
257
|
*/
|
|
306
|
-
)
|
|
307
258
|
}, {
|
|
308
259
|
key: "generateWalletParams",
|
|
309
260
|
value: function generateWalletParams(businessData) {
|
|
@@ -382,19 +333,19 @@ export var WalletPassPaymentImpl = /*#__PURE__*/function () {
|
|
|
382
333
|
}, {
|
|
383
334
|
key: "initializeWalletDataFromBusinessAsync",
|
|
384
335
|
value: (function () {
|
|
385
|
-
var _initializeWalletDataFromBusinessAsync = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
|
336
|
+
var _initializeWalletDataFromBusinessAsync = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee(businessData) {
|
|
386
337
|
var _businessData$amountI, _businessData$amountI2, _businessData$amountI3, _businessData$amountI4, _businessData$product;
|
|
387
338
|
var startTime, walletParams, _result$walletRecomme, _result$userIdentific, result, endTime, duration, _businessData$amountI5, _endTime, _duration;
|
|
388
|
-
return _regeneratorRuntime().wrap(function
|
|
389
|
-
while (1) switch (
|
|
339
|
+
return _regeneratorRuntime().wrap(function _callee$(_context) {
|
|
340
|
+
while (1) switch (_context.prev = _context.next) {
|
|
390
341
|
case 0:
|
|
391
342
|
startTime = Date.now();
|
|
392
343
|
walletParams = this.generateWalletParams(businessData);
|
|
393
344
|
if (!(Number((businessData === null || businessData === void 0 || (_businessData$amountI = businessData.amountInfo) === null || _businessData$amountI === void 0 ? void 0 : _businessData$amountI.totalAmount) || 0) < 0 || Number((businessData === null || businessData === void 0 || (_businessData$amountI2 = businessData.amountInfo) === null || _businessData$amountI2 === void 0 ? void 0 : _businessData$amountI2.subTotal) || 0) < 0)) {
|
|
394
|
-
|
|
345
|
+
_context.next = 4;
|
|
395
346
|
break;
|
|
396
347
|
}
|
|
397
|
-
return
|
|
348
|
+
return _context.abrupt("return", {
|
|
398
349
|
walletRecommendList: [],
|
|
399
350
|
userIdentificationCodes: [],
|
|
400
351
|
transformList: [],
|
|
@@ -403,10 +354,10 @@ export var WalletPassPaymentImpl = /*#__PURE__*/function () {
|
|
|
403
354
|
});
|
|
404
355
|
case 4:
|
|
405
356
|
if (![1, 0].includes((walletParams === null || walletParams === void 0 ? void 0 : walletParams.customer_id) || 0)) {
|
|
406
|
-
|
|
357
|
+
_context.next = 6;
|
|
407
358
|
break;
|
|
408
359
|
}
|
|
409
|
-
return
|
|
360
|
+
return _context.abrupt("return", {
|
|
410
361
|
walletRecommendList: [],
|
|
411
362
|
userIdentificationCodes: []
|
|
412
363
|
});
|
|
@@ -423,11 +374,11 @@ export var WalletPassPaymentImpl = /*#__PURE__*/function () {
|
|
|
423
374
|
order_wait_pay_amount: businessData.order_wait_pay_amount,
|
|
424
375
|
products_count: ((_businessData$product = businessData.products) === null || _businessData$product === void 0 ? void 0 : _businessData$product.length) || 0
|
|
425
376
|
});
|
|
426
|
-
|
|
427
|
-
|
|
377
|
+
_context.prev = 8;
|
|
378
|
+
_context.next = 11;
|
|
428
379
|
return this.initializeWalletDataAsync(walletParams);
|
|
429
380
|
case 11:
|
|
430
|
-
result =
|
|
381
|
+
result = _context.sent;
|
|
431
382
|
endTime = Date.now();
|
|
432
383
|
duration = endTime - startTime; // 发送初始化完成事件
|
|
433
384
|
this.emitEvent(WalletPassHooks.OnWalletInitializationCompleted, {
|
|
@@ -442,32 +393,32 @@ export var WalletPassPaymentImpl = /*#__PURE__*/function () {
|
|
|
442
393
|
walletRecommendList_count: ((_result$walletRecomme = result.walletRecommendList) === null || _result$walletRecomme === void 0 ? void 0 : _result$walletRecomme.length) || 0,
|
|
443
394
|
userIdentificationCodes_count: ((_result$userIdentific = result.userIdentificationCodes) === null || _result$userIdentific === void 0 ? void 0 : _result$userIdentific.length) || 0
|
|
444
395
|
});
|
|
445
|
-
return
|
|
396
|
+
return _context.abrupt("return", result);
|
|
446
397
|
case 19:
|
|
447
|
-
|
|
448
|
-
|
|
398
|
+
_context.prev = 19;
|
|
399
|
+
_context.t0 = _context["catch"](8);
|
|
449
400
|
_endTime = Date.now();
|
|
450
401
|
_duration = _endTime - startTime; // 发送初始化失败事件
|
|
451
402
|
this.emitEvent(WalletPassHooks.OnWalletInitializationFailed, {
|
|
452
403
|
businessData: businessData,
|
|
453
|
-
error:
|
|
404
|
+
error: _context.t0,
|
|
454
405
|
startTime: startTime,
|
|
455
406
|
endTime: _endTime,
|
|
456
407
|
duration: _duration
|
|
457
408
|
});
|
|
458
|
-
this.paymentModule.logError("[WalletPass] \u4ECE\u4E1A\u52A1\u6570\u636E\u521D\u59CB\u5316\u94B1\u5305\u6570\u636E\u5931\u8D25",
|
|
409
|
+
this.paymentModule.logError("[WalletPass] \u4ECE\u4E1A\u52A1\u6570\u636E\u521D\u59CB\u5316\u94B1\u5305\u6570\u636E\u5931\u8D25", _context.t0, {
|
|
459
410
|
duration: "".concat(_duration, "ms"),
|
|
460
411
|
customer_id: businessData.customer_id,
|
|
461
412
|
totalAmount: (_businessData$amountI5 = businessData.amountInfo) === null || _businessData$amountI5 === void 0 ? void 0 : _businessData$amountI5.totalAmount
|
|
462
413
|
});
|
|
463
|
-
throw
|
|
414
|
+
throw _context.t0;
|
|
464
415
|
case 26:
|
|
465
416
|
case "end":
|
|
466
|
-
return
|
|
417
|
+
return _context.stop();
|
|
467
418
|
}
|
|
468
|
-
},
|
|
419
|
+
}, _callee, this, [[8, 19]]);
|
|
469
420
|
}));
|
|
470
|
-
function initializeWalletDataFromBusinessAsync(
|
|
421
|
+
function initializeWalletDataFromBusinessAsync(_x) {
|
|
471
422
|
return _initializeWalletDataFromBusinessAsync.apply(this, arguments);
|
|
472
423
|
}
|
|
473
424
|
return initializeWalletDataFromBusinessAsync;
|
|
@@ -479,28 +430,28 @@ export var WalletPassPaymentImpl = /*#__PURE__*/function () {
|
|
|
479
430
|
}, {
|
|
480
431
|
key: "getOrderBasicDetailAsync",
|
|
481
432
|
value: (function () {
|
|
482
|
-
var _getOrderBasicDetailAsync = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
|
433
|
+
var _getOrderBasicDetailAsync = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee2(orderId) {
|
|
483
434
|
var response;
|
|
484
|
-
return _regeneratorRuntime().wrap(function
|
|
485
|
-
while (1) switch (
|
|
435
|
+
return _regeneratorRuntime().wrap(function _callee2$(_context2) {
|
|
436
|
+
while (1) switch (_context2.prev = _context2.next) {
|
|
486
437
|
case 0:
|
|
487
|
-
|
|
488
|
-
|
|
438
|
+
_context2.prev = 0;
|
|
439
|
+
_context2.next = 3;
|
|
489
440
|
return this.paymentModule.request.get("/order/order/".concat(orderId, "/basic-detail"));
|
|
490
441
|
case 3:
|
|
491
|
-
response =
|
|
492
|
-
return
|
|
442
|
+
response = _context2.sent;
|
|
443
|
+
return _context2.abrupt("return", (response === null || response === void 0 ? void 0 : response.data) || {});
|
|
493
444
|
case 7:
|
|
494
|
-
|
|
495
|
-
|
|
496
|
-
throw
|
|
445
|
+
_context2.prev = 7;
|
|
446
|
+
_context2.t0 = _context2["catch"](0);
|
|
447
|
+
throw _context2.t0;
|
|
497
448
|
case 10:
|
|
498
449
|
case "end":
|
|
499
|
-
return
|
|
450
|
+
return _context2.stop();
|
|
500
451
|
}
|
|
501
|
-
},
|
|
452
|
+
}, _callee2, this, [[0, 7]]);
|
|
502
453
|
}));
|
|
503
|
-
function getOrderBasicDetailAsync(
|
|
454
|
+
function getOrderBasicDetailAsync(_x2) {
|
|
504
455
|
return _getOrderBasicDetailAsync.apply(this, arguments);
|
|
505
456
|
}
|
|
506
457
|
return getOrderBasicDetailAsync;
|
|
@@ -513,12 +464,12 @@ export var WalletPassPaymentImpl = /*#__PURE__*/function () {
|
|
|
513
464
|
}, {
|
|
514
465
|
key: "initializeWalletDataAsync",
|
|
515
466
|
value: (function () {
|
|
516
|
-
var _initializeWalletDataAsync = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
|
467
|
+
var _initializeWalletDataAsync = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee3(baseParams) {
|
|
517
468
|
var _this$paymentModule$w3, _this$paymentModule$w4, identificationParams, _yield$Promise$all, _yield$Promise$all2, allList, orderBasicDetail, walletPassEvaluator, products, res, recommended, transformList, noApplicableVoucher, recommendedAmount;
|
|
518
|
-
return _regeneratorRuntime().wrap(function
|
|
519
|
-
while (1) switch (
|
|
469
|
+
return _regeneratorRuntime().wrap(function _callee3$(_context3) {
|
|
470
|
+
while (1) switch (_context3.prev = _context3.next) {
|
|
520
471
|
case 0:
|
|
521
|
-
|
|
472
|
+
_context3.prev = 0;
|
|
522
473
|
// 格式化用户识别码列表参数
|
|
523
474
|
identificationParams = _objectSpread(_objectSpread({}, baseParams), {}, {
|
|
524
475
|
available: 2,
|
|
@@ -526,19 +477,19 @@ export var WalletPassPaymentImpl = /*#__PURE__*/function () {
|
|
|
526
477
|
other_exact_codes: [],
|
|
527
478
|
filter_prepare_wallet_pass: 1
|
|
528
479
|
}); // 并行获取用户识别码列表和订单详情
|
|
529
|
-
|
|
480
|
+
_context3.next = 4;
|
|
530
481
|
return Promise.all([this.getUserIdentificationCodeListAsync(identificationParams), baseParams.payment_order_id && typeof baseParams.payment_order_id === 'string' && !baseParams.payment_order_id.startsWith('LOCAL_') ? this.getOrderBasicDetailAsync(baseParams.payment_order_id) : Promise.resolve(null)]);
|
|
531
482
|
case 4:
|
|
532
|
-
_yield$Promise$all =
|
|
483
|
+
_yield$Promise$all = _context3.sent;
|
|
533
484
|
_yield$Promise$all2 = _slicedToArray(_yield$Promise$all, 2);
|
|
534
485
|
allList = _yield$Promise$all2[0];
|
|
535
486
|
orderBasicDetail = _yield$Promise$all2[1];
|
|
536
487
|
walletPassEvaluator = (_this$paymentModule$w3 = this.paymentModule.window) === null || _this$paymentModule$w3 === void 0 || (_this$paymentModule$w4 = _this$paymentModule$w3.getWalletPassEvaluator) === null || _this$paymentModule$w4 === void 0 ? void 0 : _this$paymentModule$w4.call(_this$paymentModule$w3);
|
|
537
488
|
if (walletPassEvaluator) {
|
|
538
|
-
|
|
489
|
+
_context3.next = 11;
|
|
539
490
|
break;
|
|
540
491
|
}
|
|
541
|
-
return
|
|
492
|
+
return _context3.abrupt("return", {
|
|
542
493
|
walletRecommendList: [],
|
|
543
494
|
userIdentificationCodes: [],
|
|
544
495
|
transformList: [],
|
|
@@ -566,7 +517,7 @@ export var WalletPassPaymentImpl = /*#__PURE__*/function () {
|
|
|
566
517
|
// // 再获取用户识别码列表
|
|
567
518
|
// const userIdentificationCodes =
|
|
568
519
|
// await this.getUserIdentificationCodeListAsync(identificationParams);
|
|
569
|
-
return
|
|
520
|
+
return _context3.abrupt("return", {
|
|
570
521
|
walletRecommendList: recommended,
|
|
571
522
|
userIdentificationCodes: allList,
|
|
572
523
|
transformList: transformList,
|
|
@@ -574,33 +525,132 @@ export var WalletPassPaymentImpl = /*#__PURE__*/function () {
|
|
|
574
525
|
products: products || []
|
|
575
526
|
});
|
|
576
527
|
case 20:
|
|
577
|
-
|
|
578
|
-
|
|
579
|
-
this.paymentModule.logError('[WalletPass] 初始化钱包数据失败',
|
|
528
|
+
_context3.prev = 20;
|
|
529
|
+
_context3.t0 = _context3["catch"](0);
|
|
530
|
+
this.paymentModule.logError('[WalletPass] 初始化钱包数据失败', _context3.t0, {
|
|
580
531
|
customer_id: baseParams.customer_id,
|
|
581
532
|
order_expect_amount: baseParams.order_expect_amount
|
|
582
533
|
});
|
|
583
|
-
throw
|
|
534
|
+
throw _context3.t0;
|
|
584
535
|
case 24:
|
|
585
536
|
case "end":
|
|
586
|
-
return
|
|
537
|
+
return _context3.stop();
|
|
587
538
|
}
|
|
588
|
-
},
|
|
539
|
+
}, _callee3, this, [[0, 20]]);
|
|
589
540
|
}));
|
|
590
|
-
function initializeWalletDataAsync(
|
|
541
|
+
function initializeWalletDataAsync(_x3) {
|
|
591
542
|
return _initializeWalletDataAsync.apply(this, arguments);
|
|
592
543
|
}
|
|
593
544
|
return initializeWalletDataAsync;
|
|
545
|
+
}()
|
|
546
|
+
/**
|
|
547
|
+
* 商品或订单金额变化后,使用聚合接口一次重算已选与剩余 WalletPass。
|
|
548
|
+
* Walk-In 不发送 customer_id;会员才携带真实 customer_id。
|
|
549
|
+
*/
|
|
550
|
+
)
|
|
551
|
+
}, {
|
|
552
|
+
key: "aggregateRecalculateWalletAssetsAsync",
|
|
553
|
+
value: (function () {
|
|
554
|
+
var _aggregateRecalculateWalletAssetsAsync = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee4(businessData, selectedIds) {
|
|
555
|
+
var _this$paymentModule$w5, _this$paymentModule$w6;
|
|
556
|
+
var walletParams, customerId, requestParams, response, responseData, hasAggregateLists, recalculateList, customerWalletPassList, allList, walletPassEvaluator, evaluated, returnedSelectedKeys, authoritativeSelectedIds;
|
|
557
|
+
return _regeneratorRuntime().wrap(function _callee4$(_context4) {
|
|
558
|
+
while (1) switch (_context4.prev = _context4.next) {
|
|
559
|
+
case 0:
|
|
560
|
+
walletParams = this.generateWalletParams(businessData);
|
|
561
|
+
customerId = Number(walletParams.customer_id || 0);
|
|
562
|
+
requestParams = {
|
|
563
|
+
ids: selectedIds.map(function (id) {
|
|
564
|
+
return String(id);
|
|
565
|
+
}),
|
|
566
|
+
exact_codes: this.getSearchedWalletAssetCodes(),
|
|
567
|
+
order_product_amount: walletParams.order_product_amount,
|
|
568
|
+
order_expect_amount: walletParams.order_expect_amount,
|
|
569
|
+
order_wait_pay_amount: walletParams.order_wait_pay_amount,
|
|
570
|
+
products: walletParams.products,
|
|
571
|
+
available: 2,
|
|
572
|
+
filter_prepare_wallet_pass: 1,
|
|
573
|
+
sale_channel: walletParams.sale_channel || 'pos'
|
|
574
|
+
};
|
|
575
|
+
if (customerId > 1) {
|
|
576
|
+
requestParams.customer_id = customerId;
|
|
577
|
+
}
|
|
578
|
+
_context4.next = 6;
|
|
579
|
+
return this.paymentModule.request.post('/machinecode/prepare/deduction/aggregate-recalculate', requestParams);
|
|
580
|
+
case 6:
|
|
581
|
+
response = _context4.sent;
|
|
582
|
+
responseData = response === null || response === void 0 ? void 0 : response.data;
|
|
583
|
+
hasAggregateLists = responseData && (Object.prototype.hasOwnProperty.call(responseData, 'recalculate_list') || Object.prototype.hasOwnProperty.call(responseData, 'customer_wallet_pass_list'));
|
|
584
|
+
if (hasAggregateLists) {
|
|
585
|
+
_context4.next = 11;
|
|
586
|
+
break;
|
|
587
|
+
}
|
|
588
|
+
throw new Error('WalletPass aggregate response is missing list data');
|
|
589
|
+
case 11:
|
|
590
|
+
recalculateList = Array.isArray(responseData === null || responseData === void 0 ? void 0 : responseData.recalculate_list) ? responseData.recalculate_list : [];
|
|
591
|
+
customerWalletPassList = Array.isArray(responseData === null || responseData === void 0 ? void 0 : responseData.customer_wallet_pass_list) ? responseData.customer_wallet_pass_list : [];
|
|
592
|
+
allList = mergeWalletAssets(recalculateList, customerWalletPassList);
|
|
593
|
+
walletPassEvaluator = (_this$paymentModule$w5 = this.paymentModule.window) === null || _this$paymentModule$w5 === void 0 || (_this$paymentModule$w6 = _this$paymentModule$w5.getWalletPassEvaluator) === null || _this$paymentModule$w6 === void 0 ? void 0 : _this$paymentModule$w6.call(_this$paymentModule$w5);
|
|
594
|
+
evaluated = walletPassEvaluator !== null && walletPassEvaluator !== void 0 && walletPassEvaluator.getRecommendedVouchers ? walletPassEvaluator.getRecommendedVouchers({
|
|
595
|
+
orderTotalAmount: walletParams.order_wait_pay_amount,
|
|
596
|
+
products: walletParams.products,
|
|
597
|
+
vouchers: allList
|
|
598
|
+
}) : {
|
|
599
|
+
recommended: [],
|
|
600
|
+
transformList: allList.filter(isWalletAssetAvailable),
|
|
601
|
+
noApplicableVoucher: allList.filter(function (item) {
|
|
602
|
+
return !isWalletAssetAvailable(item);
|
|
603
|
+
})
|
|
604
|
+
};
|
|
605
|
+
returnedSelectedKeys = new Set(recalculateList.filter(isWalletAssetAvailable).map(function (item) {
|
|
606
|
+
return getWalletAssetKey(item);
|
|
607
|
+
}));
|
|
608
|
+
authoritativeSelectedIds = selectedIds.filter(function (id) {
|
|
609
|
+
return returnedSelectedKeys.has(String(id));
|
|
610
|
+
});
|
|
611
|
+
this.walletRecommendList = evaluated.recommended || [];
|
|
612
|
+
this.userIdentificationCodes = allList;
|
|
613
|
+
this.emitEvent(WalletPassHooks.OnUserIdentificationCodesUpdated, {
|
|
614
|
+
userIdentificationCodes: this.userIdentificationCodes
|
|
615
|
+
});
|
|
616
|
+
this.walletInitData = {
|
|
617
|
+
transformList: evaluated.transformList || [],
|
|
618
|
+
noApplicableVoucher: evaluated.noApplicableVoucher || [],
|
|
619
|
+
products: walletParams.products || []
|
|
620
|
+
};
|
|
621
|
+
this.paymentModule.logInfo('[WalletPass] 聚合重算 WalletPass 完成', {
|
|
622
|
+
selected_count: recalculateList.length,
|
|
623
|
+
remaining_count: customerWalletPassList.length,
|
|
624
|
+
searched_codes_count: requestParams.exact_codes.length
|
|
625
|
+
});
|
|
626
|
+
return _context4.abrupt("return", {
|
|
627
|
+
walletRecommendList: this.walletRecommendList,
|
|
628
|
+
userIdentificationCodes: this.userIdentificationCodes,
|
|
629
|
+
transformList: evaluated.transformList || [],
|
|
630
|
+
noApplicableVoucher: evaluated.noApplicableVoucher || [],
|
|
631
|
+
products: walletParams.products || [],
|
|
632
|
+
authoritativeSelectedIds: authoritativeSelectedIds
|
|
633
|
+
});
|
|
634
|
+
case 24:
|
|
635
|
+
case "end":
|
|
636
|
+
return _context4.stop();
|
|
637
|
+
}
|
|
638
|
+
}, _callee4, this);
|
|
639
|
+
}));
|
|
640
|
+
function aggregateRecalculateWalletAssetsAsync(_x4, _x5) {
|
|
641
|
+
return _aggregateRecalculateWalletAssetsAsync.apply(this, arguments);
|
|
642
|
+
}
|
|
643
|
+
return aggregateRecalculateWalletAssetsAsync;
|
|
594
644
|
}())
|
|
595
645
|
}, {
|
|
596
646
|
key: "getWalletPassRecommendListAsync",
|
|
597
647
|
value: function () {
|
|
598
|
-
var _getWalletPassRecommendListAsync = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
|
648
|
+
var _getWalletPassRecommendListAsync = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee5(params) {
|
|
599
649
|
var _this$walletParams, response;
|
|
600
|
-
return _regeneratorRuntime().wrap(function
|
|
601
|
-
while (1) switch (
|
|
650
|
+
return _regeneratorRuntime().wrap(function _callee5$(_context5) {
|
|
651
|
+
while (1) switch (_context5.prev = _context5.next) {
|
|
602
652
|
case 0:
|
|
603
|
-
|
|
653
|
+
_context5.prev = 0;
|
|
604
654
|
this.paymentModule.logInfo('[WalletPass] 开始获取钱包推荐列表', {
|
|
605
655
|
customer_id: params.customer_id,
|
|
606
656
|
order_expect_amount: params.order_expect_amount,
|
|
@@ -610,11 +660,11 @@ export var WalletPassPaymentImpl = /*#__PURE__*/function () {
|
|
|
610
660
|
if (typeof params.payment_order_id === 'string' && params.payment_order_id.startsWith('LOCAL_')) {
|
|
611
661
|
params.payment_order_id = undefined;
|
|
612
662
|
}
|
|
613
|
-
|
|
663
|
+
_context5.next = 5;
|
|
614
664
|
return this.paymentModule.request.post('/machinecode/prepare/deduction/recommend', params // 将 params 作为请求体数据
|
|
615
665
|
);
|
|
616
666
|
case 5:
|
|
617
|
-
response =
|
|
667
|
+
response = _context5.sent;
|
|
618
668
|
this.walletRecommendList = (response === null || response === void 0 ? void 0 : response.data) || [];
|
|
619
669
|
|
|
620
670
|
// 发送钱包推荐列表更新事件(使用专用的WalletPassHooks)
|
|
@@ -632,22 +682,22 @@ export var WalletPassPaymentImpl = /*#__PURE__*/function () {
|
|
|
632
682
|
};
|
|
633
683
|
})
|
|
634
684
|
});
|
|
635
|
-
return
|
|
685
|
+
return _context5.abrupt("return", this.walletRecommendList);
|
|
636
686
|
case 12:
|
|
637
|
-
|
|
638
|
-
|
|
639
|
-
this.paymentModule.logError('[WalletPass] 获取钱包推荐列表失败',
|
|
687
|
+
_context5.prev = 12;
|
|
688
|
+
_context5.t0 = _context5["catch"](0);
|
|
689
|
+
this.paymentModule.logError('[WalletPass] 获取钱包推荐列表失败', _context5.t0, {
|
|
640
690
|
customer_id: params.customer_id,
|
|
641
691
|
order_expect_amount: params.order_expect_amount,
|
|
642
692
|
sale_channel: params.sale_channel
|
|
643
693
|
});
|
|
644
694
|
// throw error;
|
|
645
|
-
return
|
|
695
|
+
return _context5.abrupt("return", []);
|
|
646
696
|
case 16:
|
|
647
697
|
case "end":
|
|
648
|
-
return
|
|
698
|
+
return _context5.stop();
|
|
649
699
|
}
|
|
650
|
-
},
|
|
700
|
+
}, _callee5, this, [[0, 12]]);
|
|
651
701
|
}));
|
|
652
702
|
function getWalletPassRecommendListAsync(_x6) {
|
|
653
703
|
return _getWalletPassRecommendListAsync.apply(this, arguments);
|
|
@@ -662,19 +712,19 @@ export var WalletPassPaymentImpl = /*#__PURE__*/function () {
|
|
|
662
712
|
}, {
|
|
663
713
|
key: "getUserIdentificationCodeListAsync",
|
|
664
714
|
value: function () {
|
|
665
|
-
var _getUserIdentificationCodeListAsync = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
|
715
|
+
var _getUserIdentificationCodeListAsync = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee6(params) {
|
|
666
716
|
var _newParams$products, _newParams$prepare_pa, _this$walletParams2, newParams, response, sortedData;
|
|
667
|
-
return _regeneratorRuntime().wrap(function
|
|
668
|
-
while (1) switch (
|
|
717
|
+
return _regeneratorRuntime().wrap(function _callee6$(_context6) {
|
|
718
|
+
while (1) switch (_context6.prev = _context6.next) {
|
|
669
719
|
case 0:
|
|
670
|
-
|
|
720
|
+
_context6.prev = 0;
|
|
671
721
|
newParams = _objectSpread(_objectSpread({}, this.walletParams), params);
|
|
672
722
|
if ((_newParams$products = newParams.products) !== null && _newParams$products !== void 0 && _newParams$products.length) {
|
|
673
|
-
|
|
723
|
+
_context6.next = 5;
|
|
674
724
|
break;
|
|
675
725
|
}
|
|
676
726
|
this.paymentModule.logInfo('[WalletPass] 商品列表为空,跳过获取用户识别码列表');
|
|
677
|
-
return
|
|
727
|
+
return _context6.abrupt("return", []);
|
|
678
728
|
case 5:
|
|
679
729
|
if (typeof newParams.payment_order_id === 'string' && newParams.payment_order_id.startsWith('LOCAL_')) {
|
|
680
730
|
newParams.payment_order_id = undefined;
|
|
@@ -686,10 +736,10 @@ export var WalletPassPaymentImpl = /*#__PURE__*/function () {
|
|
|
686
736
|
filter_prepare_wallet_pass: newParams.filter_prepare_wallet_pass,
|
|
687
737
|
payment_order_id: (_this$walletParams2 = this.walletParams) === null || _this$walletParams2 === void 0 ? void 0 : _this$walletParams2.payment_order_id
|
|
688
738
|
});
|
|
689
|
-
|
|
739
|
+
_context6.next = 9;
|
|
690
740
|
return this.paymentModule.request.post('/machinecode/prepare/deduction', newParams);
|
|
691
741
|
case 9:
|
|
692
|
-
response =
|
|
742
|
+
response = _context6.sent;
|
|
693
743
|
// 对获取到的数据进行排序,将错误码为 500100、500200、500300 的项目排到最后
|
|
694
744
|
sortedData = sortUserIdentificationCodeList((response === null || response === void 0 ? void 0 : response.data) || []);
|
|
695
745
|
this.userIdentificationCodes = sortedData;
|
|
@@ -708,20 +758,20 @@ export var WalletPassPaymentImpl = /*#__PURE__*/function () {
|
|
|
708
758
|
};
|
|
709
759
|
})
|
|
710
760
|
});
|
|
711
|
-
return
|
|
761
|
+
return _context6.abrupt("return", this.userIdentificationCodes);
|
|
712
762
|
case 17:
|
|
713
|
-
|
|
714
|
-
|
|
715
|
-
this.paymentModule.logError('[WalletPass] 获取用户识别码列表失败',
|
|
763
|
+
_context6.prev = 17;
|
|
764
|
+
_context6.t0 = _context6["catch"](0);
|
|
765
|
+
this.paymentModule.logError('[WalletPass] 获取用户识别码列表失败', _context6.t0, {
|
|
716
766
|
customer_id: params.customer_id,
|
|
717
767
|
available: params.available
|
|
718
768
|
});
|
|
719
|
-
return
|
|
769
|
+
return _context6.abrupt("return", []);
|
|
720
770
|
case 21:
|
|
721
771
|
case "end":
|
|
722
|
-
return
|
|
772
|
+
return _context6.stop();
|
|
723
773
|
}
|
|
724
|
-
},
|
|
774
|
+
}, _callee6, this, [[0, 17]]);
|
|
725
775
|
}));
|
|
726
776
|
function getUserIdentificationCodeListAsync(_x7) {
|
|
727
777
|
return _getUserIdentificationCodeListAsync.apply(this, arguments);
|
|
@@ -737,20 +787,20 @@ export var WalletPassPaymentImpl = /*#__PURE__*/function () {
|
|
|
737
787
|
}, {
|
|
738
788
|
key: "searchIdentificationCodeAsync",
|
|
739
789
|
value: (function () {
|
|
740
|
-
var _searchIdentificationCodeAsync = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
|
790
|
+
var _searchIdentificationCodeAsync = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee7(params) {
|
|
741
791
|
var config,
|
|
742
|
-
|
|
792
|
+
_ref9,
|
|
743
793
|
_params$sale_channel,
|
|
744
794
|
_params$customer_id,
|
|
745
795
|
_params$order_expect_,
|
|
746
796
|
_params$order_product,
|
|
747
797
|
_params$order_wait_pa,
|
|
798
|
+
_ref10,
|
|
748
799
|
_ref11,
|
|
749
|
-
_ref12,
|
|
750
800
|
_params$order_behavio,
|
|
751
|
-
|
|
801
|
+
_ref12,
|
|
752
802
|
_params$products,
|
|
753
|
-
|
|
803
|
+
_ref13,
|
|
754
804
|
_params$prepare_payme,
|
|
755
805
|
code,
|
|
756
806
|
isWalletCode,
|
|
@@ -764,12 +814,12 @@ export var WalletPassPaymentImpl = /*#__PURE__*/function () {
|
|
|
764
814
|
_this$searchResults,
|
|
765
815
|
existingCodes,
|
|
766
816
|
newResults,
|
|
767
|
-
|
|
768
|
-
return _regeneratorRuntime().wrap(function
|
|
769
|
-
while (1) switch (
|
|
817
|
+
_args7 = arguments;
|
|
818
|
+
return _regeneratorRuntime().wrap(function _callee7$(_context7) {
|
|
819
|
+
while (1) switch (_context7.prev = _context7.next) {
|
|
770
820
|
case 0:
|
|
771
|
-
config =
|
|
772
|
-
|
|
821
|
+
config = _args7.length > 1 && _args7[1] !== undefined ? _args7[1] : {};
|
|
822
|
+
_context7.prev = 1;
|
|
773
823
|
code = params.code;
|
|
774
824
|
this.paymentModule.logInfo('[WalletPass] 开始搜索识别码', {
|
|
775
825
|
code: code,
|
|
@@ -780,7 +830,7 @@ export var WalletPassPaymentImpl = /*#__PURE__*/function () {
|
|
|
780
830
|
// 新钱包规则
|
|
781
831
|
isWalletCode = code.startsWith('WL') || code.startsWith('200') && code.length === 10;
|
|
782
832
|
if (!isWalletCode) {
|
|
783
|
-
|
|
833
|
+
_context7.next = 14;
|
|
784
834
|
break;
|
|
785
835
|
}
|
|
786
836
|
// 钱包识别码直接调用专门接口,不缓存,直接返回
|
|
@@ -794,17 +844,17 @@ export var WalletPassPaymentImpl = /*#__PURE__*/function () {
|
|
|
794
844
|
with_customer: walletDetailParams.with_customer,
|
|
795
845
|
with: walletDetailParams.with
|
|
796
846
|
});
|
|
797
|
-
|
|
847
|
+
_context7.next = 10;
|
|
798
848
|
return this.paymentModule.request.post('/wallet/detail/search', walletDetailParams);
|
|
799
849
|
case 10:
|
|
800
|
-
_response =
|
|
850
|
+
_response = _context7.sent;
|
|
801
851
|
_searchResults = (_response === null || _response === void 0 ? void 0 : _response.data) || [];
|
|
802
852
|
this.paymentModule.logInfo('[WalletPass] 钱包识别码搜索完成', {
|
|
803
853
|
code: code,
|
|
804
854
|
results_count: _searchResults.length,
|
|
805
855
|
type: 'walletCode'
|
|
806
856
|
});
|
|
807
|
-
return
|
|
857
|
+
return _context7.abrupt("return", {
|
|
808
858
|
type: 'walletCode',
|
|
809
859
|
data: _searchResults
|
|
810
860
|
});
|
|
@@ -813,14 +863,14 @@ export var WalletPassPaymentImpl = /*#__PURE__*/function () {
|
|
|
813
863
|
baseWalletParams = this.walletParams; // 构建完整的搜索参数,包含钱包扣款推荐的所有参数
|
|
814
864
|
searchParams = {
|
|
815
865
|
// 基础钱包参数
|
|
816
|
-
sale_channel: (
|
|
866
|
+
sale_channel: (_ref9 = (_params$sale_channel = params.sale_channel) !== null && _params$sale_channel !== void 0 ? _params$sale_channel : baseWalletParams === null || baseWalletParams === void 0 ? void 0 : baseWalletParams.sale_channel) !== null && _ref9 !== void 0 ? _ref9 : 'pos',
|
|
817
867
|
customer_id: (_params$customer_id = params.customer_id) !== null && _params$customer_id !== void 0 ? _params$customer_id : baseWalletParams === null || baseWalletParams === void 0 ? void 0 : baseWalletParams.customer_id,
|
|
818
868
|
order_expect_amount: (_params$order_expect_ = params.order_expect_amount) !== null && _params$order_expect_ !== void 0 ? _params$order_expect_ : baseWalletParams === null || baseWalletParams === void 0 ? void 0 : baseWalletParams.order_expect_amount,
|
|
819
869
|
order_product_amount: (_params$order_product = params.order_product_amount) !== null && _params$order_product !== void 0 ? _params$order_product : baseWalletParams === null || baseWalletParams === void 0 ? void 0 : baseWalletParams.order_product_amount,
|
|
820
870
|
order_wait_pay_amount: (_params$order_wait_pa = params.order_wait_pay_amount) !== null && _params$order_wait_pa !== void 0 ? _params$order_wait_pa : baseWalletParams === null || baseWalletParams === void 0 ? void 0 : baseWalletParams.order_wait_pay_amount,
|
|
821
|
-
order_behavior_count_customer_id: (
|
|
822
|
-
products: (
|
|
823
|
-
prepare_payments: (
|
|
871
|
+
order_behavior_count_customer_id: (_ref10 = (_ref11 = (_params$order_behavio = params.order_behavior_count_customer_id) !== null && _params$order_behavio !== void 0 ? _params$order_behavio : baseWalletParams === null || baseWalletParams === void 0 ? void 0 : baseWalletParams.order_behavior_count_customer_id) !== null && _ref11 !== void 0 ? _ref11 : params.customer_id) !== null && _ref10 !== void 0 ? _ref10 : baseWalletParams === null || baseWalletParams === void 0 ? void 0 : baseWalletParams.customer_id,
|
|
872
|
+
products: (_ref12 = (_params$products = params.products) !== null && _params$products !== void 0 ? _params$products : baseWalletParams === null || baseWalletParams === void 0 ? void 0 : baseWalletParams.products) !== null && _ref12 !== void 0 ? _ref12 : [],
|
|
873
|
+
prepare_payments: (_ref13 = (_params$prepare_payme = params.prepare_payments) !== null && _params$prepare_payme !== void 0 ? _params$prepare_payme : baseWalletParams === null || baseWalletParams === void 0 ? void 0 : baseWalletParams.prepare_payments) !== null && _ref13 !== void 0 ? _ref13 : [],
|
|
824
874
|
multiple: 1,
|
|
825
875
|
// 搜索特有参数
|
|
826
876
|
code: params.code,
|
|
@@ -836,16 +886,16 @@ export var WalletPassPaymentImpl = /*#__PURE__*/function () {
|
|
|
836
886
|
if (typeof searchParams.payment_order_id === 'string' && searchParams.payment_order_id.startsWith('LOCAL_')) {
|
|
837
887
|
searchParams.payment_order_id = undefined;
|
|
838
888
|
}
|
|
839
|
-
|
|
889
|
+
_context7.next = 20;
|
|
840
890
|
return this.paymentModule.request.post('/machinecode/prepare/deduction/search', searchParams);
|
|
841
891
|
case 20:
|
|
842
|
-
response =
|
|
892
|
+
response = _context7.sent;
|
|
843
893
|
searchResults = (response === null || response === void 0 ? void 0 : response.data) || [];
|
|
844
894
|
if (!config.noCache) {
|
|
845
|
-
|
|
895
|
+
_context7.next = 24;
|
|
846
896
|
break;
|
|
847
897
|
}
|
|
848
|
-
return
|
|
898
|
+
return _context7.abrupt("return", {
|
|
849
899
|
type: 'normalCode',
|
|
850
900
|
data: searchResults
|
|
851
901
|
});
|
|
@@ -875,24 +925,24 @@ export var WalletPassPaymentImpl = /*#__PURE__*/function () {
|
|
|
875
925
|
cached_results_count: this.searchResults.length,
|
|
876
926
|
type: 'normalCode'
|
|
877
927
|
});
|
|
878
|
-
return
|
|
928
|
+
return _context7.abrupt("return", {
|
|
879
929
|
type: 'normalCode',
|
|
880
930
|
data: searchResults
|
|
881
931
|
});
|
|
882
932
|
case 30:
|
|
883
|
-
|
|
884
|
-
|
|
885
|
-
this.paymentModule.logError('[WalletPass] 搜索识别码信息失败',
|
|
933
|
+
_context7.prev = 30;
|
|
934
|
+
_context7.t0 = _context7["catch"](1);
|
|
935
|
+
this.paymentModule.logError('[WalletPass] 搜索识别码信息失败', _context7.t0, {
|
|
886
936
|
code: params.code,
|
|
887
937
|
customer_id: params.customer_id,
|
|
888
938
|
order_expect_amount: params.order_expect_amount
|
|
889
939
|
});
|
|
890
|
-
throw
|
|
940
|
+
throw _context7.t0;
|
|
891
941
|
case 34:
|
|
892
942
|
case "end":
|
|
893
|
-
return
|
|
943
|
+
return _context7.stop();
|
|
894
944
|
}
|
|
895
|
-
},
|
|
945
|
+
}, _callee7, this, [[1, 30]]);
|
|
896
946
|
}));
|
|
897
947
|
function searchIdentificationCodeAsync(_x8) {
|
|
898
948
|
return _searchIdentificationCodeAsync.apply(this, arguments);
|
|
@@ -909,7 +959,8 @@ export var WalletPassPaymentImpl = /*#__PURE__*/function () {
|
|
|
909
959
|
}, {
|
|
910
960
|
key: "refreshWalletAssetsFromBusinessAsync",
|
|
911
961
|
value: (function () {
|
|
912
|
-
var _refreshWalletAssetsFromBusinessAsync = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
|
962
|
+
var _refreshWalletAssetsFromBusinessAsync = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee8(businessData) {
|
|
963
|
+
var _businessData$product2;
|
|
913
964
|
var options,
|
|
914
965
|
requestSequence,
|
|
915
966
|
nextCustomerId,
|
|
@@ -920,17 +971,24 @@ export var WalletPassPaymentImpl = /*#__PURE__*/function () {
|
|
|
920
971
|
committedItems,
|
|
921
972
|
selectedIds,
|
|
922
973
|
selectionSources,
|
|
974
|
+
restoredSearchedAssets,
|
|
975
|
+
searchedWalletAssetCodes,
|
|
976
|
+
useAggregateRecalculate,
|
|
977
|
+
aggregateResult,
|
|
923
978
|
result,
|
|
979
|
+
authoritativeSelectedIds,
|
|
980
|
+
returnedAggregateKeys,
|
|
981
|
+
missingSelectedKeys,
|
|
924
982
|
searchedWalletAssets,
|
|
925
983
|
recommendedKeys,
|
|
926
984
|
items,
|
|
927
985
|
latestSelectedIds,
|
|
928
986
|
latestSelectionSources,
|
|
929
|
-
|
|
930
|
-
return _regeneratorRuntime().wrap(function
|
|
931
|
-
while (1) switch (
|
|
987
|
+
_args8 = arguments;
|
|
988
|
+
return _regeneratorRuntime().wrap(function _callee8$(_context8) {
|
|
989
|
+
while (1) switch (_context8.prev = _context8.next) {
|
|
932
990
|
case 0:
|
|
933
|
-
options =
|
|
991
|
+
options = _args8.length > 1 && _args8[1] !== undefined ? _args8[1] : {};
|
|
934
992
|
requestSequence = ++this.walletAssetsRequestSequence;
|
|
935
993
|
nextCustomerId = businessData.customer_id;
|
|
936
994
|
previousCustomerId = this.walletAssetsState.customerId;
|
|
@@ -946,7 +1004,47 @@ export var WalletPassPaymentImpl = /*#__PURE__*/function () {
|
|
|
946
1004
|
return committedKeys.has(getWalletAssetKey(item));
|
|
947
1005
|
});
|
|
948
1006
|
selectedIds = preserveSelection ? _toConsumableArray(this.walletAssetsState.selectedIds) : [];
|
|
949
|
-
selectionSources = preserveSelection ? _objectSpread({}, this.walletAssetsState.selectionSources) : {};
|
|
1007
|
+
selectionSources = preserveSelection ? _objectSpread({}, this.walletAssetsState.selectionSources) : {}; // aggregate-recalculate 不接受空商品列表。
|
|
1008
|
+
// 清空购物车时保留扫码资产供后续加购恢复,但必须取消当前选择。
|
|
1009
|
+
if ((_businessData$product2 = businessData.products) !== null && _businessData$product2 !== void 0 && _businessData$product2.length) {
|
|
1010
|
+
_context8.next = 20;
|
|
1011
|
+
break;
|
|
1012
|
+
}
|
|
1013
|
+
this.generateWalletParams(businessData);
|
|
1014
|
+
restoredSearchedAssets = this.searchResults.filter(isWalletPaymentAsset).map(function (item) {
|
|
1015
|
+
return _objectSpread(_objectSpread({}, item), {}, {
|
|
1016
|
+
actualDeduction: 0,
|
|
1017
|
+
deductionDetails: [],
|
|
1018
|
+
_available_max_amount: 0,
|
|
1019
|
+
_unified_available_status: 0,
|
|
1020
|
+
_wallet_asset_recommended: false
|
|
1021
|
+
});
|
|
1022
|
+
});
|
|
1023
|
+
this.walletRecommendList = [];
|
|
1024
|
+
this.userIdentificationCodes = [];
|
|
1025
|
+
this.walletInitData = {
|
|
1026
|
+
transformList: [],
|
|
1027
|
+
noApplicableVoucher: restoredSearchedAssets,
|
|
1028
|
+
products: []
|
|
1029
|
+
};
|
|
1030
|
+
this.walletAssetsCalculationContext = {
|
|
1031
|
+
orderTotalAmount: 0,
|
|
1032
|
+
products: []
|
|
1033
|
+
};
|
|
1034
|
+
this.emitEvent(WalletPassHooks.OnUserIdentificationCodesUpdated, {
|
|
1035
|
+
userIdentificationCodes: []
|
|
1036
|
+
});
|
|
1037
|
+
return _context8.abrupt("return", this.publishWalletAssetsState({
|
|
1038
|
+
status: 'ready',
|
|
1039
|
+
customerId: nextCustomerId,
|
|
1040
|
+
items: mergeWalletAssets(restoredSearchedAssets, committedItems),
|
|
1041
|
+
selectedIds: [],
|
|
1042
|
+
selectedItems: [],
|
|
1043
|
+
selectionSources: {},
|
|
1044
|
+
totalSelectedAmount: 0,
|
|
1045
|
+
error: null
|
|
1046
|
+
}));
|
|
1047
|
+
case 20:
|
|
950
1048
|
this.publishWalletAssetsState({
|
|
951
1049
|
status: 'loading',
|
|
952
1050
|
customerId: nextCustomerId,
|
|
@@ -957,62 +1055,93 @@ export var WalletPassPaymentImpl = /*#__PURE__*/function () {
|
|
|
957
1055
|
totalSelectedAmount: preserveSelection ? this.walletAssetsState.totalSelectedAmount : 0,
|
|
958
1056
|
error: null
|
|
959
1057
|
});
|
|
960
|
-
|
|
961
|
-
|
|
1058
|
+
_context8.prev = 21;
|
|
1059
|
+
searchedWalletAssetCodes = preserveSelection ? this.getSearchedWalletAssetCodes() : [];
|
|
1060
|
+
useAggregateRecalculate = preserveSelection && (selectedIds.length > 0 || searchedWalletAssetCodes.length > 0);
|
|
1061
|
+
if (!useAggregateRecalculate) {
|
|
1062
|
+
_context8.next = 30;
|
|
1063
|
+
break;
|
|
1064
|
+
}
|
|
1065
|
+
_context8.next = 27;
|
|
1066
|
+
return this.aggregateRecalculateWalletAssetsAsync(businessData, selectedIds);
|
|
1067
|
+
case 27:
|
|
1068
|
+
_context8.t0 = _context8.sent;
|
|
1069
|
+
_context8.next = 31;
|
|
1070
|
+
break;
|
|
1071
|
+
case 30:
|
|
1072
|
+
_context8.t0 = null;
|
|
1073
|
+
case 31:
|
|
1074
|
+
aggregateResult = _context8.t0;
|
|
1075
|
+
_context8.t1 = aggregateResult;
|
|
1076
|
+
if (_context8.t1) {
|
|
1077
|
+
_context8.next = 37;
|
|
1078
|
+
break;
|
|
1079
|
+
}
|
|
1080
|
+
_context8.next = 36;
|
|
962
1081
|
return this.initializeWalletDataFromBusinessAsync(businessData);
|
|
963
|
-
case
|
|
964
|
-
|
|
1082
|
+
case 36:
|
|
1083
|
+
_context8.t1 = _context8.sent;
|
|
1084
|
+
case 37:
|
|
1085
|
+
result = _context8.t1;
|
|
965
1086
|
if (!(requestSequence !== this.walletAssetsRequestSequence)) {
|
|
966
|
-
|
|
1087
|
+
_context8.next = 40;
|
|
967
1088
|
break;
|
|
968
1089
|
}
|
|
969
|
-
return
|
|
970
|
-
case
|
|
1090
|
+
return _context8.abrupt("return", this.getWalletAssetsState());
|
|
1091
|
+
case 40:
|
|
971
1092
|
this.walletAssetsCalculationContext = {
|
|
972
1093
|
orderTotalAmount: Number(businessData.order_wait_pay_amount || 0),
|
|
973
1094
|
products: result.products || businessData.products || []
|
|
974
1095
|
};
|
|
975
|
-
|
|
976
|
-
|
|
977
|
-
|
|
1096
|
+
authoritativeSelectedIds = (aggregateResult === null || aggregateResult === void 0 ? void 0 : aggregateResult.authoritativeSelectedIds) || selectedIds;
|
|
1097
|
+
if (aggregateResult) {
|
|
1098
|
+
returnedAggregateKeys = new Set([].concat(_toConsumableArray(result.transformList || []), _toConsumableArray(result.noApplicableVoucher || [])).map(function (item) {
|
|
1099
|
+
return getWalletAssetKey(item);
|
|
1100
|
+
}));
|
|
1101
|
+
missingSelectedKeys = new Set(selectedIds.map(function (id) {
|
|
1102
|
+
return String(id);
|
|
1103
|
+
}).filter(function (id) {
|
|
1104
|
+
return !returnedAggregateKeys.has(id);
|
|
1105
|
+
}));
|
|
1106
|
+
if (missingSelectedKeys.size > 0) {
|
|
1107
|
+
this.searchResults = this.searchResults.filter(function (item) {
|
|
1108
|
+
return !missingSelectedKeys.has(getWalletAssetKey(item));
|
|
1109
|
+
});
|
|
1110
|
+
}
|
|
978
1111
|
}
|
|
979
|
-
|
|
980
|
-
return this.revalidateSearchedWalletAssets(requestSequence);
|
|
981
|
-
case 22:
|
|
982
|
-
_context9.t0 = _context9.sent;
|
|
983
|
-
_context9.next = 26;
|
|
984
|
-
break;
|
|
985
|
-
case 25:
|
|
986
|
-
_context9.t0 = [];
|
|
987
|
-
case 26:
|
|
988
|
-
searchedWalletAssets = _context9.t0;
|
|
1112
|
+
searchedWalletAssets = preserveSelection ? this.syncSearchedWalletAssets([].concat(_toConsumableArray(result.transformList || []), _toConsumableArray(result.noApplicableVoucher || []))) : [];
|
|
989
1113
|
if (!(requestSequence !== this.walletAssetsRequestSequence)) {
|
|
990
|
-
|
|
1114
|
+
_context8.next = 46;
|
|
991
1115
|
break;
|
|
992
1116
|
}
|
|
993
|
-
return
|
|
994
|
-
case
|
|
1117
|
+
return _context8.abrupt("return", this.getWalletAssetsState());
|
|
1118
|
+
case 46:
|
|
995
1119
|
recommendedKeys = new Set((result.walletRecommendList || []).map(function (asset) {
|
|
996
1120
|
return getWalletAssetKey(asset);
|
|
997
1121
|
}));
|
|
998
|
-
items = mergeWalletAssets(preserveSelection ? this.walletAssetsState.selectedItems : [], searchedWalletAssets, result.transformList || [], result.noApplicableVoucher || []).map(function (asset) {
|
|
1122
|
+
items = mergeWalletAssets(preserveSelection && !aggregateResult ? this.walletAssetsState.selectedItems : [], searchedWalletAssets, result.transformList || [], result.noApplicableVoucher || []).map(function (asset) {
|
|
999
1123
|
return _objectSpread(_objectSpread({}, asset), {}, {
|
|
1000
1124
|
_wallet_asset_recommended: recommendedKeys.has(getWalletAssetKey(asset))
|
|
1001
1125
|
});
|
|
1002
1126
|
});
|
|
1003
|
-
latestSelectedIds = preserveSelection ?
|
|
1127
|
+
latestSelectedIds = preserveSelection ? authoritativeSelectedIds : [];
|
|
1004
1128
|
latestSelectionSources = preserveSelection ? _objectSpread({}, this.walletAssetsState.selectionSources) : {};
|
|
1005
|
-
return
|
|
1006
|
-
case
|
|
1007
|
-
|
|
1008
|
-
|
|
1129
|
+
return _context8.abrupt("return", this.recalculateWalletAssets(items, latestSelectedIds, latestSelectionSources));
|
|
1130
|
+
case 53:
|
|
1131
|
+
_context8.prev = 53;
|
|
1132
|
+
_context8.t2 = _context8["catch"](21);
|
|
1009
1133
|
if (!(requestSequence !== this.walletAssetsRequestSequence)) {
|
|
1010
|
-
|
|
1134
|
+
_context8.next = 57;
|
|
1011
1135
|
break;
|
|
1012
1136
|
}
|
|
1013
|
-
return
|
|
1014
|
-
case
|
|
1015
|
-
|
|
1137
|
+
return _context8.abrupt("return", this.getWalletAssetsState());
|
|
1138
|
+
case 57:
|
|
1139
|
+
this.paymentModule.logError('[WalletPass] 刷新共享钱包资产失败,保留刷新前状态', _context8.t2, {
|
|
1140
|
+
customer_id: businessData.customer_id,
|
|
1141
|
+
selected_ids: selectedIds,
|
|
1142
|
+
searched_codes: this.getSearchedWalletAssetCodes()
|
|
1143
|
+
});
|
|
1144
|
+
return _context8.abrupt("return", this.publishWalletAssetsState({
|
|
1016
1145
|
status: 'error',
|
|
1017
1146
|
items: preserveSelection ? this.walletAssetsState.items : committedItems,
|
|
1018
1147
|
selectedIds: preserveSelection ? this.walletAssetsState.selectedIds : [],
|
|
@@ -1020,13 +1149,13 @@ export var WalletPassPaymentImpl = /*#__PURE__*/function () {
|
|
|
1020
1149
|
selectionSources: preserveSelection ? this.walletAssetsState.selectionSources : {},
|
|
1021
1150
|
totalSelectedAmount: preserveSelection ? this.walletAssetsState.totalSelectedAmount : 0,
|
|
1022
1151
|
customerId: nextCustomerId,
|
|
1023
|
-
error:
|
|
1152
|
+
error: _context8.t2 instanceof Error ? _context8.t2.message : String(_context8.t2)
|
|
1024
1153
|
}));
|
|
1025
|
-
case
|
|
1154
|
+
case 59:
|
|
1026
1155
|
case "end":
|
|
1027
|
-
return
|
|
1156
|
+
return _context8.stop();
|
|
1028
1157
|
}
|
|
1029
|
-
},
|
|
1158
|
+
}, _callee8, this, [[21, 53]]);
|
|
1030
1159
|
}));
|
|
1031
1160
|
function refreshWalletAssetsFromBusinessAsync(_x9) {
|
|
1032
1161
|
return _refreshWalletAssetsFromBusinessAsync.apply(this, arguments);
|
|
@@ -1105,45 +1234,59 @@ export var WalletPassPaymentImpl = /*#__PURE__*/function () {
|
|
|
1105
1234
|
}, {
|
|
1106
1235
|
key: "scanWalletAssetAsync",
|
|
1107
1236
|
value: function () {
|
|
1108
|
-
var _scanWalletAssetAsync = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
|
1109
|
-
var normalizedCode, result, paymentAssets, asset, items, assetId, selected;
|
|
1110
|
-
return _regeneratorRuntime().wrap(function
|
|
1111
|
-
while (1) switch (
|
|
1237
|
+
var _scanWalletAssetAsync = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee9(code) {
|
|
1238
|
+
var normalizedCode, selectedAsset, result, paymentAssets, asset, items, assetId, selected;
|
|
1239
|
+
return _regeneratorRuntime().wrap(function _callee9$(_context9) {
|
|
1240
|
+
while (1) switch (_context9.prev = _context9.next) {
|
|
1112
1241
|
case 0:
|
|
1113
1242
|
normalizedCode = String(code || '').trim();
|
|
1114
1243
|
if (normalizedCode) {
|
|
1115
|
-
|
|
1244
|
+
_context9.next = 3;
|
|
1116
1245
|
break;
|
|
1117
1246
|
}
|
|
1118
|
-
return
|
|
1247
|
+
return _context9.abrupt("return", {
|
|
1119
1248
|
type: 'normalCode',
|
|
1120
1249
|
selected: false,
|
|
1121
1250
|
state: this.getWalletAssetsState()
|
|
1122
1251
|
});
|
|
1123
1252
|
case 3:
|
|
1253
|
+
selectedAsset = this.walletAssetsState.selectedItems.find(function (asset) {
|
|
1254
|
+
return matchesWalletAssetCode(asset, normalizedCode);
|
|
1255
|
+
});
|
|
1256
|
+
if (!selectedAsset) {
|
|
1257
|
+
_context9.next = 6;
|
|
1258
|
+
break;
|
|
1259
|
+
}
|
|
1260
|
+
return _context9.abrupt("return", {
|
|
1261
|
+
type: 'normalCode',
|
|
1262
|
+
asset: selectedAsset,
|
|
1263
|
+
selected: true,
|
|
1264
|
+
state: this.getWalletAssetsState()
|
|
1265
|
+
});
|
|
1266
|
+
case 6:
|
|
1124
1267
|
this.walletAssetsRequestSequence += 1;
|
|
1125
|
-
|
|
1268
|
+
_context9.next = 9;
|
|
1126
1269
|
return this.searchIdentificationCodeAsync(_objectSpread(_objectSpread({}, this.walletParams || {}), {}, {
|
|
1127
1270
|
code: normalizedCode,
|
|
1128
1271
|
prepare_payments: this.formatWalletPassList2PreparePayments(this.walletAssetsState.selectedItems)
|
|
1129
1272
|
}));
|
|
1130
|
-
case
|
|
1131
|
-
result =
|
|
1273
|
+
case 9:
|
|
1274
|
+
result = _context9.sent;
|
|
1132
1275
|
paymentAssets = result.data.filter(isWalletPaymentAsset);
|
|
1133
1276
|
asset = paymentAssets.find(function (item) {
|
|
1134
1277
|
return String((item === null || item === void 0 ? void 0 : item.code) || '') === normalizedCode;
|
|
1135
1278
|
}) || paymentAssets[0];
|
|
1136
1279
|
if (!(!asset || result.type === 'walletCode')) {
|
|
1137
|
-
|
|
1280
|
+
_context9.next = 14;
|
|
1138
1281
|
break;
|
|
1139
1282
|
}
|
|
1140
|
-
return
|
|
1283
|
+
return _context9.abrupt("return", {
|
|
1141
1284
|
type: result.type,
|
|
1142
1285
|
asset: asset,
|
|
1143
1286
|
selected: false,
|
|
1144
1287
|
state: this.getWalletAssetsState()
|
|
1145
1288
|
});
|
|
1146
|
-
case
|
|
1289
|
+
case 14:
|
|
1147
1290
|
items = mergeWalletAssets(this.walletAssetsState.items, [asset]);
|
|
1148
1291
|
this.recalculateWalletAssets(items, this.walletAssetsState.selectedIds, this.walletAssetsState.selectionSources);
|
|
1149
1292
|
assetId = getWalletAssetId(asset);
|
|
@@ -1151,7 +1294,7 @@ export var WalletPassPaymentImpl = /*#__PURE__*/function () {
|
|
|
1151
1294
|
selected: true,
|
|
1152
1295
|
source: 'scan'
|
|
1153
1296
|
}) : this.getWalletAssetsState();
|
|
1154
|
-
return
|
|
1297
|
+
return _context9.abrupt("return", {
|
|
1155
1298
|
type: result.type,
|
|
1156
1299
|
asset: asset,
|
|
1157
1300
|
selected: assetId !== undefined && selected.selectedIds.some(function (id) {
|
|
@@ -1159,11 +1302,11 @@ export var WalletPassPaymentImpl = /*#__PURE__*/function () {
|
|
|
1159
1302
|
}),
|
|
1160
1303
|
state: selected
|
|
1161
1304
|
});
|
|
1162
|
-
case
|
|
1305
|
+
case 19:
|
|
1163
1306
|
case "end":
|
|
1164
|
-
return
|
|
1307
|
+
return _context9.stop();
|
|
1165
1308
|
}
|
|
1166
|
-
},
|
|
1309
|
+
}, _callee9, this);
|
|
1167
1310
|
}));
|
|
1168
1311
|
function scanWalletAssetAsync(_x10) {
|
|
1169
1312
|
return _scanWalletAssetAsync.apply(this, arguments);
|
|
@@ -1185,10 +1328,10 @@ export var WalletPassPaymentImpl = /*#__PURE__*/function () {
|
|
|
1185
1328
|
var selectedIds = this.walletAssetsState.selectedIds.filter(function (id) {
|
|
1186
1329
|
return !committedKeys.has(String(id));
|
|
1187
1330
|
});
|
|
1188
|
-
var selectionSources = Object.entries(this.walletAssetsState.selectionSources).reduce(function (result,
|
|
1189
|
-
var
|
|
1190
|
-
key =
|
|
1191
|
-
source =
|
|
1331
|
+
var selectionSources = Object.entries(this.walletAssetsState.selectionSources).reduce(function (result, _ref14) {
|
|
1332
|
+
var _ref15 = _slicedToArray(_ref14, 2),
|
|
1333
|
+
key = _ref15[0],
|
|
1334
|
+
source = _ref15[1];
|
|
1192
1335
|
if (!committedKeys.has(key)) result[key] = source;
|
|
1193
1336
|
return result;
|
|
1194
1337
|
}, {});
|
|
@@ -1201,22 +1344,22 @@ export var WalletPassPaymentImpl = /*#__PURE__*/function () {
|
|
|
1201
1344
|
}, {
|
|
1202
1345
|
key: "processWalletPayment",
|
|
1203
1346
|
value: function () {
|
|
1204
|
-
var _processWalletPayment = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
|
1347
|
+
var _processWalletPayment = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee10(amount, orderUuid, voucherId) {
|
|
1205
1348
|
var walletMethod, paymentItem;
|
|
1206
|
-
return _regeneratorRuntime().wrap(function
|
|
1207
|
-
while (1) switch (
|
|
1349
|
+
return _regeneratorRuntime().wrap(function _callee10$(_context10) {
|
|
1350
|
+
while (1) switch (_context10.prev = _context10.next) {
|
|
1208
1351
|
case 0:
|
|
1209
1352
|
this.paymentModule.logInfo('[WalletPass] 开始处理钱包支付', {
|
|
1210
1353
|
amount: amount,
|
|
1211
1354
|
orderUuid: orderUuid,
|
|
1212
1355
|
voucherId: voucherId || 'none'
|
|
1213
1356
|
});
|
|
1214
|
-
|
|
1357
|
+
_context10.next = 3;
|
|
1215
1358
|
return this.paymentModule.getWalletPaymentMethod();
|
|
1216
1359
|
case 3:
|
|
1217
|
-
walletMethod =
|
|
1360
|
+
walletMethod = _context10.sent;
|
|
1218
1361
|
if (walletMethod) {
|
|
1219
|
-
|
|
1362
|
+
_context10.next = 7;
|
|
1220
1363
|
break;
|
|
1221
1364
|
}
|
|
1222
1365
|
this.paymentModule.logError('[WalletPass] 钱包支付方式未找到', null, {
|
|
@@ -1234,7 +1377,7 @@ export var WalletPassPaymentImpl = /*#__PURE__*/function () {
|
|
|
1234
1377
|
type: walletMethod.type,
|
|
1235
1378
|
voucher_id: voucherId || ''
|
|
1236
1379
|
};
|
|
1237
|
-
|
|
1380
|
+
_context10.next = 10;
|
|
1238
1381
|
return this.paymentModule.addPaymentItemAsync(orderUuid, paymentItem);
|
|
1239
1382
|
case 10:
|
|
1240
1383
|
this.paymentModule.logInfo('[WalletPass] 钱包支付处理完成', {
|
|
@@ -1245,9 +1388,9 @@ export var WalletPassPaymentImpl = /*#__PURE__*/function () {
|
|
|
1245
1388
|
});
|
|
1246
1389
|
case 11:
|
|
1247
1390
|
case "end":
|
|
1248
|
-
return
|
|
1391
|
+
return _context10.stop();
|
|
1249
1392
|
}
|
|
1250
|
-
},
|
|
1393
|
+
}, _callee10, this);
|
|
1251
1394
|
}));
|
|
1252
1395
|
function processWalletPayment(_x11, _x12, _x13) {
|
|
1253
1396
|
return _processWalletPayment.apply(this, arguments);
|
|
@@ -1257,16 +1400,16 @@ export var WalletPassPaymentImpl = /*#__PURE__*/function () {
|
|
|
1257
1400
|
}, {
|
|
1258
1401
|
key: "getWalletBalance",
|
|
1259
1402
|
value: function () {
|
|
1260
|
-
var _getWalletBalance = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
|
1261
|
-
return _regeneratorRuntime().wrap(function
|
|
1262
|
-
while (1) switch (
|
|
1403
|
+
var _getWalletBalance = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee11(voucherId) {
|
|
1404
|
+
return _regeneratorRuntime().wrap(function _callee11$(_context11) {
|
|
1405
|
+
while (1) switch (_context11.prev = _context11.next) {
|
|
1263
1406
|
case 0:
|
|
1264
|
-
return
|
|
1407
|
+
return _context11.abrupt("return", 0);
|
|
1265
1408
|
case 1:
|
|
1266
1409
|
case "end":
|
|
1267
|
-
return
|
|
1410
|
+
return _context11.stop();
|
|
1268
1411
|
}
|
|
1269
|
-
},
|
|
1412
|
+
}, _callee11);
|
|
1270
1413
|
}));
|
|
1271
1414
|
function getWalletBalance(_x14) {
|
|
1272
1415
|
return _getWalletBalance.apply(this, arguments);
|