@pisell/pisellos 2.2.63 → 2.2.64
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.
|
@@ -466,24 +466,24 @@ export var CheckoutImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
466
466
|
key: "initWalletData",
|
|
467
467
|
value: function () {
|
|
468
468
|
var _initWalletData = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee8(params) {
|
|
469
|
-
var _this$store$currentOr3, _this$store$currentCu, _this$store$currentOr4, _this$store$currentOr5, _this$store$currentOr6, _this$store$currentOr8;
|
|
470
|
-
var amountInfo, walletBusinessData, _this$store$currentOr7;
|
|
469
|
+
var _this$store$currentOr3, _this$store$currentCu, _this$store$currentOr4, _this$store$currentOr5, _this$store$currentOr6, _this$store$currentOr8, amountInfo, walletBusinessData, _this$store$currentOr7;
|
|
471
470
|
return _regeneratorRuntime().wrap(function _callee8$(_context8) {
|
|
472
471
|
while (1) switch (_context8.prev = _context8.next) {
|
|
473
472
|
case 0:
|
|
474
473
|
this.logInfo('initWalletData called', {
|
|
475
474
|
params: params
|
|
476
475
|
});
|
|
476
|
+
_context8.prev = 1;
|
|
477
477
|
amountInfo = (_this$store$currentOr3 = this.store.currentOrder) === null || _this$store$currentOr3 === void 0 || (_this$store$currentOr3 = _this$store$currentOr3.order_info) === null || _this$store$currentOr3 === void 0 ? void 0 : _this$store$currentOr3.amount_breakdown;
|
|
478
478
|
if (amountInfo) {
|
|
479
|
-
_context8.next =
|
|
479
|
+
_context8.next = 6;
|
|
480
480
|
break;
|
|
481
481
|
}
|
|
482
482
|
this.logInfo('initWalletData amountInfo not found', {
|
|
483
483
|
params: params
|
|
484
484
|
});
|
|
485
485
|
return _context8.abrupt("return");
|
|
486
|
-
case
|
|
486
|
+
case 6:
|
|
487
487
|
// 准备钱包初始化的业务数据
|
|
488
488
|
walletBusinessData = _objectSpread({
|
|
489
489
|
customer_id: (_this$store$currentCu = this.store.currentCustomer) !== null && _this$store$currentCu !== void 0 && _this$store$currentCu.customer_id ? Number(this.store.currentCustomer.customer_id) : undefined,
|
|
@@ -503,25 +503,25 @@ export var CheckoutImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
503
503
|
this.logInfo('开始拉取:initializeWalletDataFromBusinessAsync', {
|
|
504
504
|
walletBusinessData: walletBusinessData
|
|
505
505
|
});
|
|
506
|
-
_context8.next =
|
|
506
|
+
_context8.next = 11;
|
|
507
507
|
return this.payment.wallet.initializeWalletDataFromBusinessAsync(walletBusinessData);
|
|
508
|
-
case
|
|
508
|
+
case 11:
|
|
509
509
|
this.logInfo('调用结束:initializeWalletDataFromBusinessAsync', {
|
|
510
510
|
walletBusinessData: walletBusinessData
|
|
511
511
|
});
|
|
512
512
|
|
|
513
513
|
// 因为上面是接口 这里最好检查一下还有没有 currentOrder 了,如果没有,则不触发事件
|
|
514
514
|
if (this.store.currentOrder) {
|
|
515
|
-
_context8.next =
|
|
515
|
+
_context8.next = 14;
|
|
516
516
|
break;
|
|
517
517
|
}
|
|
518
518
|
return _context8.abrupt("return");
|
|
519
|
-
case
|
|
519
|
+
case 14:
|
|
520
520
|
this.logInfo('initWalletData currentOrder found', {
|
|
521
521
|
currentOrder: this.store.currentOrder
|
|
522
522
|
});
|
|
523
523
|
// 触发钱包数据初始化完成事件
|
|
524
|
-
_context8.next =
|
|
524
|
+
_context8.next = 17;
|
|
525
525
|
return this.core.effects.emit("".concat(this.name, ":onWalletDataInitialized"), {
|
|
526
526
|
orderUuid: (_this$store$currentOr8 = this.store.currentOrder) === null || _this$store$currentOr8 === void 0 ? void 0 : _this$store$currentOr8.uuid,
|
|
527
527
|
customerId: walletBusinessData.customer_id,
|
|
@@ -532,11 +532,21 @@ export var CheckoutImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
532
532
|
},
|
|
533
533
|
timestamp: Date.now()
|
|
534
534
|
});
|
|
535
|
-
case
|
|
535
|
+
case 17:
|
|
536
|
+
_context8.next = 23;
|
|
537
|
+
break;
|
|
538
|
+
case 19:
|
|
539
|
+
_context8.prev = 19;
|
|
540
|
+
_context8.t0 = _context8["catch"](1);
|
|
541
|
+
this.logError('initWalletData error', {
|
|
542
|
+
error: _context8.t0 instanceof Error ? _context8.t0.message : String(_context8.t0)
|
|
543
|
+
});
|
|
544
|
+
throw _context8.t0;
|
|
545
|
+
case 23:
|
|
536
546
|
case "end":
|
|
537
547
|
return _context8.stop();
|
|
538
548
|
}
|
|
539
|
-
}, _callee8, this);
|
|
549
|
+
}, _callee8, this, [[1, 19]]);
|
|
540
550
|
}));
|
|
541
551
|
function initWalletData(_x10) {
|
|
542
552
|
return _initWalletData.apply(this, arguments);
|
|
@@ -291,55 +291,62 @@ var CheckoutImpl = class extends import_BaseModule.BaseModule {
|
|
|
291
291
|
this.logInfo("initWalletData called", {
|
|
292
292
|
params
|
|
293
293
|
});
|
|
294
|
-
|
|
295
|
-
|
|
296
|
-
|
|
297
|
-
|
|
294
|
+
try {
|
|
295
|
+
const amountInfo = (_b = (_a = this.store.currentOrder) == null ? void 0 : _a.order_info) == null ? void 0 : _b.amount_breakdown;
|
|
296
|
+
if (!amountInfo) {
|
|
297
|
+
this.logInfo("initWalletData amountInfo not found", {
|
|
298
|
+
params
|
|
299
|
+
});
|
|
300
|
+
return;
|
|
301
|
+
}
|
|
302
|
+
const walletBusinessData = {
|
|
303
|
+
customer_id: ((_c = this.store.currentCustomer) == null ? void 0 : _c.customer_id) ? Number(this.store.currentCustomer.customer_id) : void 0,
|
|
304
|
+
holder: (_f = (_e = (_d = this.store.currentOrder) == null ? void 0 : _d.order_info) == null ? void 0 : _e.original_order_data) == null ? void 0 : _f.holder,
|
|
305
|
+
amountInfo: {
|
|
306
|
+
totalAmount: amountInfo.totalAmount,
|
|
307
|
+
subTotal: amountInfo.subTotal,
|
|
308
|
+
depositAmount: (_g = this.store.currentOrder) == null ? void 0 : _g.deposit_amount,
|
|
309
|
+
isDeposit: (_h = this.store.currentOrder) == null ? void 0 : _h.is_deposit
|
|
310
|
+
},
|
|
311
|
+
products: this.getProductListByOrder(),
|
|
312
|
+
is_price_include_tax: this.otherParams.is_price_include_tax,
|
|
313
|
+
// core 有
|
|
314
|
+
...params
|
|
315
|
+
};
|
|
316
|
+
if (this.store.isOrderSynced) {
|
|
317
|
+
walletBusinessData.payment_order_id = (_i = this.store.currentOrder) == null ? void 0 : _i.order_id;
|
|
318
|
+
}
|
|
319
|
+
this.logInfo("开始拉取:initializeWalletDataFromBusinessAsync", {
|
|
320
|
+
walletBusinessData
|
|
298
321
|
});
|
|
299
|
-
|
|
300
|
-
|
|
301
|
-
|
|
302
|
-
|
|
303
|
-
|
|
304
|
-
|
|
305
|
-
|
|
306
|
-
|
|
307
|
-
|
|
308
|
-
|
|
309
|
-
|
|
310
|
-
|
|
311
|
-
|
|
312
|
-
|
|
313
|
-
|
|
314
|
-
|
|
315
|
-
|
|
316
|
-
|
|
317
|
-
|
|
318
|
-
|
|
319
|
-
|
|
320
|
-
|
|
321
|
-
|
|
322
|
-
|
|
323
|
-
|
|
324
|
-
|
|
325
|
-
|
|
326
|
-
});
|
|
327
|
-
if (!this.store.currentOrder) {
|
|
328
|
-
return;
|
|
322
|
+
await this.payment.wallet.initializeWalletDataFromBusinessAsync(
|
|
323
|
+
walletBusinessData
|
|
324
|
+
);
|
|
325
|
+
this.logInfo("调用结束:initializeWalletDataFromBusinessAsync", {
|
|
326
|
+
walletBusinessData
|
|
327
|
+
});
|
|
328
|
+
if (!this.store.currentOrder) {
|
|
329
|
+
return;
|
|
330
|
+
}
|
|
331
|
+
this.logInfo("initWalletData currentOrder found", {
|
|
332
|
+
currentOrder: this.store.currentOrder
|
|
333
|
+
});
|
|
334
|
+
await this.core.effects.emit(`${this.name}:onWalletDataInitialized`, {
|
|
335
|
+
orderUuid: (_j = this.store.currentOrder) == null ? void 0 : _j.uuid,
|
|
336
|
+
customerId: walletBusinessData.customer_id,
|
|
337
|
+
walletBusinessData: {
|
|
338
|
+
customer_id: walletBusinessData.customer_id,
|
|
339
|
+
amountInfo: walletBusinessData.amountInfo,
|
|
340
|
+
order_wait_pay_amount: params == null ? void 0 : params.order_wait_pay_amount
|
|
341
|
+
},
|
|
342
|
+
timestamp: Date.now()
|
|
343
|
+
});
|
|
344
|
+
} catch (error) {
|
|
345
|
+
this.logError("initWalletData error", {
|
|
346
|
+
error: error instanceof Error ? error.message : String(error)
|
|
347
|
+
});
|
|
348
|
+
throw error;
|
|
329
349
|
}
|
|
330
|
-
this.logInfo("initWalletData currentOrder found", {
|
|
331
|
-
currentOrder: this.store.currentOrder
|
|
332
|
-
});
|
|
333
|
-
await this.core.effects.emit(`${this.name}:onWalletDataInitialized`, {
|
|
334
|
-
orderUuid: (_j = this.store.currentOrder) == null ? void 0 : _j.uuid,
|
|
335
|
-
customerId: walletBusinessData.customer_id,
|
|
336
|
-
walletBusinessData: {
|
|
337
|
-
customer_id: walletBusinessData.customer_id,
|
|
338
|
-
amountInfo: walletBusinessData.amountInfo,
|
|
339
|
-
order_wait_pay_amount: params == null ? void 0 : params.order_wait_pay_amount
|
|
340
|
-
},
|
|
341
|
-
timestamp: Date.now()
|
|
342
|
-
});
|
|
343
350
|
}
|
|
344
351
|
checkIsNeedDepositAsync(bookings, relationProducts) {
|
|
345
352
|
const summaryDeposit = {
|