@pisell/pisellos 2.3.233 → 2.3.234
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/modules/Order/index.d.ts +9 -8
- package/dist/modules/Order/index.js +273 -255
- package/dist/modules/Order/utils.d.ts +1 -0
- package/dist/modules/Order/utils.js +3 -2
- package/dist/shared/payment/loadPaymentMethods.d.ts +2 -1
- package/dist/shared/payment/loadPaymentMethods.js +13 -12
- package/dist/solution/BaseSales/index.d.ts +3 -0
- package/dist/solution/BaseSales/index.js +445 -402
- package/dist/solution/BookingTicket/index.d.ts +3 -1
- package/dist/solution/BookingTicket/index.js +49 -43
- package/dist/solution/BookingTicket/utils/scan/applyProductVoucherCollectionScan.d.ts +1 -1
- package/dist/solution/BookingTicket/utils/scan/applyProductVoucherCollectionScan.js +69 -13
- package/dist/utils/platform.d.ts +2 -0
- package/dist/utils/platform.js +4 -0
- package/lib/model/strategy/adapter/promotion/index.js +1 -46
- package/lib/modules/Order/index.d.ts +9 -8
- package/lib/modules/Order/index.js +57 -43
- package/lib/modules/Order/utils.d.ts +1 -0
- package/lib/modules/Order/utils.js +2 -1
- package/lib/shared/payment/loadPaymentMethods.d.ts +2 -1
- package/lib/shared/payment/loadPaymentMethods.js +10 -9
- package/lib/solution/BaseSales/index.d.ts +3 -0
- package/lib/solution/BaseSales/index.js +45 -22
- package/lib/solution/BookingTicket/index.d.ts +3 -1
- package/lib/solution/BookingTicket/index.js +4 -1
- package/lib/solution/BookingTicket/utils/scan/applyProductVoucherCollectionScan.d.ts +1 -1
- package/lib/solution/BookingTicket/utils/scan/applyProductVoucherCollectionScan.js +44 -5
- package/lib/utils/platform.d.ts +2 -0
- package/lib/utils/platform.js +5 -0
- package/package.json +1 -1
|
@@ -56,7 +56,7 @@ import { applyOrderCollectionUidRemaps, getOrderCollectionPersistentId, getOrder
|
|
|
56
56
|
import dayjs from 'dayjs';
|
|
57
57
|
export * from "./types";
|
|
58
58
|
import { isProductQueryHandledByOsServer, PRODUCT_QUERY_DATA_VARIANT_RELATIONS, resolveClientDataVariants, tryResolveClientDataVariants } from "../../modules/ProductList/clientDataVariants";
|
|
59
|
-
import { isCustomerUserPlatform,
|
|
59
|
+
import { isCustomerUserPlatform, normalizeRuntimePlatform, resolveTerminalVirtualCurrencyChannel } from "../../utils/platform";
|
|
60
60
|
import { OS_POS_RECEIPT_AUTO_PRINT_PAYMENT_STATUSES_FIELD } from "../../utils/pos-receipt-auto-print";
|
|
61
61
|
import { QuotationModule } from "../../modules/Quotation";
|
|
62
62
|
import { transformBaseProductToOrderProduct as _transformBaseProductToOrderProduct } from "./utils/transformBaseProductToOrderProduct";
|
|
@@ -1020,8 +1020,7 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
1020
1020
|
if (!effects || typeof effects.on !== 'function') return;
|
|
1021
1021
|
this.paymentMethodsChangedUnsubscribe = effects.on(PAYMENT_METHODS_CHANGED_EVENT, /*#__PURE__*/function () {
|
|
1022
1022
|
var _ref11 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee6(payload) {
|
|
1023
|
-
var _this5$
|
|
1024
|
-
var _this5$store$order;
|
|
1023
|
+
var channel, _this5$store$order;
|
|
1025
1024
|
return _regeneratorRuntime().wrap(function _callee6$(_context6) {
|
|
1026
1025
|
while (1) switch (_context6.prev = _context6.next) {
|
|
1027
1026
|
case 0:
|
|
@@ -1031,12 +1030,13 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
1031
1030
|
}
|
|
1032
1031
|
return _context6.abrupt("return");
|
|
1033
1032
|
case 2:
|
|
1034
|
-
|
|
1035
|
-
|
|
1033
|
+
channel = _this5.getTerminalVirtualCurrencyChannel();
|
|
1034
|
+
if (channel) {
|
|
1035
|
+
(_this5$store$order = _this5.store.order) === null || _this5$store$order === void 0 || _this5$store$order.syncTerminalVirtualCurrencyPaymentMethods(channel, payload.newMethods);
|
|
1036
1036
|
}
|
|
1037
|
-
_context6.next =
|
|
1037
|
+
_context6.next = 6;
|
|
1038
1038
|
return _this5.getPaymentMethodsAsync();
|
|
1039
|
-
case
|
|
1039
|
+
case 6:
|
|
1040
1040
|
case "end":
|
|
1041
1041
|
return _context6.stop();
|
|
1042
1042
|
}
|
|
@@ -2406,6 +2406,13 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
2406
2406
|
var _this$otherParams17;
|
|
2407
2407
|
return ((_this$otherParams17 = this.otherParams) === null || _this$otherParams17 === void 0 ? void 0 : _this$otherParams17.enableMultiCurrencySettlement) === true;
|
|
2408
2408
|
}
|
|
2409
|
+
}, {
|
|
2410
|
+
key: "getTerminalVirtualCurrencyChannel",
|
|
2411
|
+
value: function getTerminalVirtualCurrencyChannel() {
|
|
2412
|
+
var _this$otherParams18, _this$otherParams$bus2, _this$otherParams19, _this$otherParams20;
|
|
2413
|
+
if (!this.isMultiCurrencySettlementEnabled()) return undefined;
|
|
2414
|
+
return resolveTerminalVirtualCurrencyChannel((_this$otherParams18 = this.otherParams) === null || _this$otherParams18 === void 0 ? void 0 : _this$otherParams18.platform, (_this$otherParams$bus2 = (_this$otherParams19 = this.otherParams) === null || _this$otherParams19 === void 0 ? void 0 : _this$otherParams19.businessCode) !== null && _this$otherParams$bus2 !== void 0 ? _this$otherParams$bus2 : (_this$otherParams20 = this.otherParams) === null || _this$otherParams20 === void 0 ? void 0 : _this$otherParams20.business_code);
|
|
2415
|
+
}
|
|
2409
2416
|
}, {
|
|
2410
2417
|
key: "isActiveVirtualSettlementOrder",
|
|
2411
2418
|
value: function isActiveVirtualSettlementOrder(tempOrder) {
|
|
@@ -2528,11 +2535,11 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
2528
2535
|
key: "initializeSalesRuntime",
|
|
2529
2536
|
value: function () {
|
|
2530
2537
|
var _initializeSalesRuntime = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee18(core) {
|
|
2531
|
-
var _this$
|
|
2538
|
+
var _this$otherParams21,
|
|
2532
2539
|
_this$appPlugin2,
|
|
2533
2540
|
_this$appPlugin2$getA,
|
|
2534
2541
|
_this17 = this,
|
|
2535
|
-
_this$
|
|
2542
|
+
_this$otherParams22;
|
|
2536
2543
|
var options,
|
|
2537
2544
|
app,
|
|
2538
2545
|
targetCacheData,
|
|
@@ -2548,7 +2555,7 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
2548
2555
|
this.paymentNumberDevicePrefix = null;
|
|
2549
2556
|
// this.store = { ...this.store, ...(options.store as Partial<BaseSalesState>) };
|
|
2550
2557
|
this.otherParams = options.otherParams || {};
|
|
2551
|
-
this.cacheId = (_this$
|
|
2558
|
+
this.cacheId = (_this$otherParams21 = this.otherParams) === null || _this$otherParams21 === void 0 ? void 0 : _this$otherParams21.cacheId;
|
|
2552
2559
|
this.reusedSharedSubModuleNames.clear();
|
|
2553
2560
|
this.window = core.getPlugin('window');
|
|
2554
2561
|
this.request = core.getPlugin('request');
|
|
@@ -2590,7 +2597,7 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
2590
2597
|
_context18.next = 20;
|
|
2591
2598
|
return this.store.schedule.loadAllSchedule();
|
|
2592
2599
|
case 20:
|
|
2593
|
-
if (this.store.order && typeof ((_this$
|
|
2600
|
+
if (this.store.order && typeof ((_this$otherParams22 = this.otherParams) === null || _this$otherParams22 === void 0 ? void 0 : _this$otherParams22.enableTempOrderPersist) === 'boolean') {
|
|
2594
2601
|
this.store.order.setEnableTempOrderPersist(this.otherParams.enableTempOrderPersist);
|
|
2595
2602
|
}
|
|
2596
2603
|
_context18.next = 23;
|
|
@@ -3155,11 +3162,11 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
3155
3162
|
key: "loadContactInfoOpenData",
|
|
3156
3163
|
value: function () {
|
|
3157
3164
|
var _loadContactInfoOpenData = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee26() {
|
|
3158
|
-
var _this$otherParams$ope2, _this$
|
|
3165
|
+
var _this$otherParams$ope2, _this$otherParams23;
|
|
3159
3166
|
return _regeneratorRuntime().wrap(function _callee26$(_context26) {
|
|
3160
3167
|
while (1) switch (_context26.prev = _context26.next) {
|
|
3161
3168
|
case 0:
|
|
3162
|
-
return _context26.abrupt("return", (_this$otherParams$ope2 = (_this$
|
|
3169
|
+
return _context26.abrupt("return", (_this$otherParams$ope2 = (_this$otherParams23 = this.otherParams) === null || _this$otherParams23 === void 0 ? void 0 : _this$otherParams23.openData) !== null && _this$otherParams$ope2 !== void 0 ? _this$otherParams$ope2 : null);
|
|
3163
3170
|
case 1:
|
|
3164
3171
|
case "end":
|
|
3165
3172
|
return _context26.stop();
|
|
@@ -4691,8 +4698,8 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
4691
4698
|
}, {
|
|
4692
4699
|
key: "buildVirtualSettlementSubmitData",
|
|
4693
4700
|
value: function () {
|
|
4694
|
-
var _buildVirtualSettlementSubmitData = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee43(settlement,
|
|
4695
|
-
var tempOrder, currencyProductId, summary, amount, customerId, asset, balance, amountText, paymentNumber, payment, _paymentMethod$custom, paymentMethod;
|
|
4701
|
+
var _buildVirtualSettlementSubmitData = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee43(settlement, terminalPaymentMethod) {
|
|
4702
|
+
var tempOrder, currencyProductId, summary, amount, customerId, asset, balance, amountText, paymentNumber, metadata, payment, _paymentMethod$custom, paymentMethod;
|
|
4696
4703
|
return _regeneratorRuntime().wrap(function _callee43$(_context43) {
|
|
4697
4704
|
while (1) switch (_context43.prev = _context43.next) {
|
|
4698
4705
|
case 0:
|
|
@@ -4712,7 +4719,7 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
4712
4719
|
summary = _context43.sent;
|
|
4713
4720
|
amount = new Decimal((summary === null || summary === void 0 ? void 0 : summary.total_amount) || 0).toDecimalPlaces(2);
|
|
4714
4721
|
customerId = Number((tempOrder === null || tempOrder === void 0 ? void 0 : tempOrder.customer_id) || 0);
|
|
4715
|
-
if (!(
|
|
4722
|
+
if (!(terminalPaymentMethod && amount.gt(0) && !(customerId > 1))) {
|
|
4716
4723
|
_context43.next = 11;
|
|
4717
4724
|
break;
|
|
4718
4725
|
}
|
|
@@ -4756,16 +4763,17 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
4756
4763
|
case 22:
|
|
4757
4764
|
amountText = amount.toFixed(2);
|
|
4758
4765
|
paymentNumber = "LOCAL_".concat(createUuidV4());
|
|
4759
|
-
|
|
4760
|
-
|
|
4766
|
+
metadata = {
|
|
4767
|
+
unique_payment_number: createUuidV4()
|
|
4768
|
+
};
|
|
4769
|
+
if (!(!terminalPaymentMethod && this.store.order.isOnlineStorePlatform())) {
|
|
4770
|
+
_context43.next = 29;
|
|
4761
4771
|
break;
|
|
4762
4772
|
}
|
|
4763
4773
|
payment = {
|
|
4764
4774
|
payment_number: paymentNumber,
|
|
4765
4775
|
amount: amount.toNumber(),
|
|
4766
|
-
metadata:
|
|
4767
|
-
unique_payment_number: createUuidV4()
|
|
4768
|
-
},
|
|
4776
|
+
metadata: metadata,
|
|
4769
4777
|
tag: asset.tag,
|
|
4770
4778
|
voucher_id: asset.id,
|
|
4771
4779
|
wallet_pass_usage_unit: {
|
|
@@ -4774,31 +4782,31 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
4774
4782
|
},
|
|
4775
4783
|
wallet_pass_use_value: amountText
|
|
4776
4784
|
};
|
|
4777
|
-
_context43.next =
|
|
4785
|
+
_context43.next = 40;
|
|
4778
4786
|
break;
|
|
4779
|
-
case
|
|
4780
|
-
if (!(
|
|
4781
|
-
_context43.next =
|
|
4787
|
+
case 29:
|
|
4788
|
+
if (!(terminalPaymentMethod !== null && terminalPaymentMethod !== void 0)) {
|
|
4789
|
+
_context43.next = 33;
|
|
4782
4790
|
break;
|
|
4783
4791
|
}
|
|
4784
|
-
_context43.t0 =
|
|
4785
|
-
_context43.next =
|
|
4792
|
+
_context43.t0 = terminalPaymentMethod;
|
|
4793
|
+
_context43.next = 36;
|
|
4786
4794
|
break;
|
|
4787
|
-
case
|
|
4788
|
-
_context43.next =
|
|
4795
|
+
case 33:
|
|
4796
|
+
_context43.next = 35;
|
|
4789
4797
|
return this.getPaymentMethodsAsync();
|
|
4790
|
-
case
|
|
4798
|
+
case 35:
|
|
4791
4799
|
_context43.t0 = _context43.sent.find(function (method) {
|
|
4792
4800
|
return String(method.code || '').toUpperCase() === 'PRODUCTVOUCHER';
|
|
4793
4801
|
});
|
|
4794
|
-
case
|
|
4802
|
+
case 36:
|
|
4795
4803
|
paymentMethod = _context43.t0;
|
|
4796
4804
|
if (paymentMethod) {
|
|
4797
|
-
_context43.next =
|
|
4805
|
+
_context43.next = 39;
|
|
4798
4806
|
break;
|
|
4799
4807
|
}
|
|
4800
4808
|
throw new Error('PRODUCTVOUCHER payment method is unavailable.');
|
|
4801
|
-
case
|
|
4809
|
+
case 39:
|
|
4802
4810
|
payment = {
|
|
4803
4811
|
payment_number: paymentNumber,
|
|
4804
4812
|
amount: amountText,
|
|
@@ -4815,13 +4823,13 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
4815
4823
|
points: 1
|
|
4816
4824
|
},
|
|
4817
4825
|
wallet_pass_use_value: amountText,
|
|
4818
|
-
metadata:
|
|
4826
|
+
metadata: metadata
|
|
4819
4827
|
};
|
|
4820
|
-
case
|
|
4828
|
+
case 40:
|
|
4821
4829
|
return _context43.abrupt("return", _objectSpread(_objectSpread({}, settlement), {}, {
|
|
4822
4830
|
payments: [payment]
|
|
4823
4831
|
}));
|
|
4824
|
-
case
|
|
4832
|
+
case 41:
|
|
4825
4833
|
case "end":
|
|
4826
4834
|
return _context43.stop();
|
|
4827
4835
|
}
|
|
@@ -4842,14 +4850,13 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
4842
4850
|
key: "submitSalesOrder",
|
|
4843
4851
|
value: (function () {
|
|
4844
4852
|
var _submitSalesOrder = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee44(params) {
|
|
4845
|
-
var
|
|
4846
|
-
_this21 = this,
|
|
4853
|
+
var _this21 = this,
|
|
4847
4854
|
_params$smallTicketDa,
|
|
4848
|
-
_this$otherParams22,
|
|
4849
|
-
_this$otherParams23,
|
|
4850
4855
|
_this$otherParams24,
|
|
4851
|
-
_this$otherParams25
|
|
4852
|
-
|
|
4856
|
+
_this$otherParams25,
|
|
4857
|
+
_this$otherParams26,
|
|
4858
|
+
_this$otherParams27;
|
|
4859
|
+
var isDeferredPayment, checkoutOrder, virtualOrderData, checkoutCustomerId, checkoutSettlementKey, virtualPaymentChannel, terminalPaymentMethod, readCheckoutLines, checkoutLines, assertCheckoutCartUnchanged, virtualPaymentSettlement, submitsTerminalVirtualPayment, virtualSettlement, inferredPaymentStatus, smallTicketDataFlag, virtualSettlementEnhancePayload, configuredEnhancePayload, _enhancePayload, submitParams;
|
|
4853
4860
|
return _regeneratorRuntime().wrap(function _callee44$(_context44) {
|
|
4854
4861
|
while (1) switch (_context44.prev = _context44.next) {
|
|
4855
4862
|
case 0:
|
|
@@ -4876,35 +4883,37 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
4876
4883
|
virtualOrderData = this.buildVirtualSettlementOrderData();
|
|
4877
4884
|
checkoutCustomerId = checkoutOrder === null || checkoutOrder === void 0 ? void 0 : checkoutOrder.customer_id;
|
|
4878
4885
|
checkoutSettlementKey = getTempOrderSettlementKey(checkoutOrder);
|
|
4879
|
-
|
|
4886
|
+
virtualPaymentChannel = virtualOrderData ? this.getTerminalVirtualCurrencyChannel() : undefined;
|
|
4887
|
+
terminalPaymentMethod = virtualPaymentChannel ? this.store.order.getTerminalVirtualCurrencyPaymentMethod(virtualPaymentChannel, virtualPaymentChannel === 'pos' ? this.getPaymentMethods() : undefined) : undefined;
|
|
4880
4888
|
readCheckoutLines = function readCheckoutLines() {
|
|
4881
4889
|
return checkoutOrder === null || checkoutOrder === void 0 ? void 0 : checkoutOrder.products.map(function (product) {
|
|
4882
4890
|
var _product$product_vari3, _product$num2;
|
|
4883
4891
|
return [String(product.product_id), String((_product$product_vari3 = product.product_variant_id) !== null && _product$product_vari3 !== void 0 ? _product$product_vari3 : 0), Number((_product$num2 = product.num) !== null && _product$num2 !== void 0 ? _product$num2 : 1)];
|
|
4884
4892
|
});
|
|
4885
4893
|
};
|
|
4886
|
-
checkoutLines =
|
|
4894
|
+
checkoutLines = terminalPaymentMethod && !isDeferredPayment ? readCheckoutLines() : undefined;
|
|
4887
4895
|
assertCheckoutCartUnchanged = function assertCheckoutCartUnchanged() {
|
|
4888
4896
|
var _this21$store$order;
|
|
4889
|
-
if (
|
|
4897
|
+
if (terminalPaymentMethod && (((_this21$store$order = _this21.store.order) === null || _this21$store$order === void 0 ? void 0 : _this21$store$order.getTempOrder()) !== checkoutOrder || (checkoutOrder === null || checkoutOrder === void 0 ? void 0 : checkoutOrder.customer_id) !== checkoutCustomerId || getTempOrderSettlementKey(checkoutOrder) !== checkoutSettlementKey || checkoutLines && !isEqual(readCheckoutLines(), checkoutLines))) {
|
|
4890
4898
|
throw salesGuardError('The cart changed. Please try again.');
|
|
4891
4899
|
}
|
|
4892
4900
|
};
|
|
4893
4901
|
if (!isDeferredPayment) {
|
|
4894
|
-
_context44.next =
|
|
4902
|
+
_context44.next = 21;
|
|
4895
4903
|
break;
|
|
4896
4904
|
}
|
|
4897
4905
|
_context44.t0 = null;
|
|
4898
|
-
_context44.next =
|
|
4906
|
+
_context44.next = 24;
|
|
4899
4907
|
break;
|
|
4900
|
-
case
|
|
4901
|
-
_context44.next =
|
|
4902
|
-
return this.buildVirtualSettlementSubmitData(virtualOrderData,
|
|
4903
|
-
case 22:
|
|
4904
|
-
_context44.t0 = _context44.sent;
|
|
4908
|
+
case 21:
|
|
4909
|
+
_context44.next = 23;
|
|
4910
|
+
return this.buildVirtualSettlementSubmitData(virtualOrderData, terminalPaymentMethod);
|
|
4905
4911
|
case 23:
|
|
4912
|
+
_context44.t0 = _context44.sent;
|
|
4913
|
+
case 24:
|
|
4906
4914
|
virtualPaymentSettlement = _context44.t0;
|
|
4907
4915
|
assertCheckoutCartUnchanged();
|
|
4916
|
+
submitsTerminalVirtualPayment = Boolean(terminalPaymentMethod && (virtualPaymentSettlement === null || virtualPaymentSettlement === void 0 ? void 0 : virtualPaymentSettlement.payments.length));
|
|
4908
4917
|
virtualSettlement = isDeferredPayment ? virtualOrderData : virtualPaymentSettlement; // this.store.order.persistTempOrder();
|
|
4909
4918
|
inferredPaymentStatus = isDeferredPayment ? undefined : this.getSubmitPaymentStatus(params === null || params === void 0 ? void 0 : params.paymentStatus);
|
|
4910
4919
|
smallTicketDataFlag = (_params$smallTicketDa = params === null || params === void 0 ? void 0 : params.smallTicketDataFlag) !== null && _params$smallTicketDa !== void 0 ? _params$smallTicketDa : this.getDefaultCheckoutSmallTicketDataFlag();
|
|
@@ -4937,10 +4946,10 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
4937
4946
|
} : configuredEnhancePayload;
|
|
4938
4947
|
submitParams = _objectSpread(_objectSpread(_objectSpread(_objectSpread(_objectSpread({
|
|
4939
4948
|
cacheId: this.cacheId,
|
|
4940
|
-
platform: (_this$
|
|
4941
|
-
businessCode: ((_this$
|
|
4942
|
-
channel: this.getSubmitOrderSalesChannel(),
|
|
4943
|
-
type: (_this$
|
|
4949
|
+
platform: virtualPaymentChannel === 'kiosk' ? 'kiosk' : (_this$otherParams24 = this.otherParams) === null || _this$otherParams24 === void 0 ? void 0 : _this$otherParams24.platform,
|
|
4950
|
+
businessCode: ((_this$otherParams25 = this.otherParams) === null || _this$otherParams25 === void 0 ? void 0 : _this$otherParams25.businessCode) || ((_this$otherParams26 = this.otherParams) === null || _this$otherParams26 === void 0 ? void 0 : _this$otherParams26.business_code),
|
|
4951
|
+
channel: virtualPaymentChannel === 'kiosk' ? 'kiosk' : this.getSubmitOrderSalesChannel(),
|
|
4952
|
+
type: (_this$otherParams27 = this.otherParams) === null || _this$otherParams27 === void 0 ? void 0 : _this$otherParams27.type,
|
|
4944
4953
|
request_unique_idempotency_token: this.store.order.generateIdempotencyToken()
|
|
4945
4954
|
}, isDeferredPayment ? {
|
|
4946
4955
|
payments: []
|
|
@@ -4960,20 +4969,29 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
4960
4969
|
enhancePayload: function enhancePayload(payload, ctx) {
|
|
4961
4970
|
var _callerPayload$metada2, _currencySettlementCo2;
|
|
4962
4971
|
var callerPayload = _enhancePayload ? _enhancePayload(payload, ctx) : payload;
|
|
4963
|
-
if (
|
|
4972
|
+
if (terminalPaymentMethod && virtualPaymentSettlement) {
|
|
4964
4973
|
var _callerPayload$summar, _summary$total_amount, _callerPayload$paymen, _payment$amount;
|
|
4965
4974
|
assertCheckoutCartUnchanged();
|
|
4975
|
+
if (virtualPaymentChannel === 'kiosk') {
|
|
4976
|
+
var _this21$store$order2;
|
|
4977
|
+
var currentMethod = (_this21$store$order2 = _this21.store.order) === null || _this21$store$order2 === void 0 ? void 0 : _this21$store$order2.getTerminalVirtualCurrencyPaymentMethod('kiosk');
|
|
4978
|
+
if (_this21.getTerminalVirtualCurrencyChannel() !== 'kiosk' || (currentMethod === null || currentMethod === void 0 ? void 0 : currentMethod.id) !== terminalPaymentMethod.id) {
|
|
4979
|
+
throw salesGuardError('The payment method changed. Please try again.');
|
|
4980
|
+
}
|
|
4981
|
+
}
|
|
4966
4982
|
var summary = (_callerPayload$summar = callerPayload.summary) !== null && _callerPayload$summar !== void 0 ? _callerPayload$summar : payload.summary;
|
|
4967
4983
|
var orderAmount = Decimal.max(0, (_summary$total_amount = summary === null || summary === void 0 ? void 0 : summary.total_amount) !== null && _summary$total_amount !== void 0 ? _summary$total_amount : 0).toDecimalPlaces(2);
|
|
4968
4984
|
var payment = (_callerPayload$paymen = callerPayload.payments) === null || _callerPayload$paymen === void 0 ? void 0 : _callerPayload$paymen.find(function (item) {
|
|
4969
|
-
return item.code ===
|
|
4985
|
+
return item.code === terminalPaymentMethod.code;
|
|
4970
4986
|
});
|
|
4971
4987
|
if (!orderAmount.eq((_payment$amount = payment === null || payment === void 0 ? void 0 : payment.amount) !== null && _payment$amount !== void 0 ? _payment$amount : 0)) {
|
|
4972
4988
|
throw salesGuardError('The cart changed. Please try again.');
|
|
4973
4989
|
}
|
|
4974
4990
|
}
|
|
4975
4991
|
var currencySettlementConfig = ((_callerPayload$metada2 = callerPayload.metadata) === null || _callerPayload$metada2 === void 0 ? void 0 : _callerPayload$metada2.currency_settlement_config) || {};
|
|
4976
|
-
return _objectSpread(_objectSpread({}, callerPayload),
|
|
4992
|
+
return _objectSpread(_objectSpread(_objectSpread({}, callerPayload), submitsTerminalVirtualPayment ? {
|
|
4993
|
+
payment_status: 'paid'
|
|
4994
|
+
} : {}), {}, {
|
|
4977
4995
|
metadata: _objectSpread(_objectSpread({}, callerPayload.metadata || {}), {}, {
|
|
4978
4996
|
currency_settlement_config: _objectSpread(_objectSpread({}, currencySettlementConfig), {}, {
|
|
4979
4997
|
settlement_type: 'virtual_currency',
|
|
@@ -4989,9 +5007,8 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
4989
5007
|
} : _enhancePayload !== undefined ? {
|
|
4990
5008
|
enhancePayload: _enhancePayload
|
|
4991
5009
|
} : {});
|
|
4992
|
-
|
|
4993
|
-
|
|
4994
|
-
case 34:
|
|
5010
|
+
return _context44.abrupt("return", !submitsTerminalVirtualPayment && this.shouldUseCheckoutSyncTask() ? this.store.order.submitTempOrder(submitParams) : this.store.order.submitTempOrderAsync(submitParams));
|
|
5011
|
+
case 35:
|
|
4995
5012
|
case "end":
|
|
4996
5013
|
return _context44.stop();
|
|
4997
5014
|
}
|
|
@@ -5220,7 +5237,7 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
5220
5237
|
key: "saveSalesOrderDraft",
|
|
5221
5238
|
value: function () {
|
|
5222
5239
|
var _saveSalesOrderDraft = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee47(params) {
|
|
5223
|
-
var _params$platform, _this$
|
|
5240
|
+
var _params$platform, _this$otherParams28, _this$otherParams29, _this$otherParams30, _params$channel, _params$type, _this$otherParams31;
|
|
5224
5241
|
return _regeneratorRuntime().wrap(function _callee47$(_context47) {
|
|
5225
5242
|
while (1) switch (_context47.prev = _context47.next) {
|
|
5226
5243
|
case 0:
|
|
@@ -5241,10 +5258,10 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
5241
5258
|
case 5:
|
|
5242
5259
|
return _context47.abrupt("return", this.store.order.saveTempOrderAsDraft(_objectSpread({
|
|
5243
5260
|
cacheId: this.cacheId,
|
|
5244
|
-
platform: (_params$platform = params === null || params === void 0 ? void 0 : params.platform) !== null && _params$platform !== void 0 ? _params$platform : (_this$
|
|
5245
|
-
businessCode: (params === null || params === void 0 ? void 0 : params.businessCode) || ((_this$
|
|
5261
|
+
platform: (_params$platform = params === null || params === void 0 ? void 0 : params.platform) !== null && _params$platform !== void 0 ? _params$platform : (_this$otherParams28 = this.otherParams) === null || _this$otherParams28 === void 0 ? void 0 : _this$otherParams28.platform,
|
|
5262
|
+
businessCode: (params === null || params === void 0 ? void 0 : params.businessCode) || ((_this$otherParams29 = this.otherParams) === null || _this$otherParams29 === void 0 ? void 0 : _this$otherParams29.businessCode) || ((_this$otherParams30 = this.otherParams) === null || _this$otherParams30 === void 0 ? void 0 : _this$otherParams30.business_code),
|
|
5246
5263
|
channel: (_params$channel = params === null || params === void 0 ? void 0 : params.channel) !== null && _params$channel !== void 0 ? _params$channel : this.getSubmitOrderSalesChannel(),
|
|
5247
|
-
type: (_params$type = params === null || params === void 0 ? void 0 : params.type) !== null && _params$type !== void 0 ? _params$type : (_this$
|
|
5264
|
+
type: (_params$type = params === null || params === void 0 ? void 0 : params.type) !== null && _params$type !== void 0 ? _params$type : (_this$otherParams31 = this.otherParams) === null || _this$otherParams31 === void 0 ? void 0 : _this$otherParams31.type
|
|
5248
5265
|
}, (params === null || params === void 0 ? void 0 : params.enhancePayload) !== undefined ? {
|
|
5249
5266
|
enhancePayload: params.enhancePayload
|
|
5250
5267
|
} : {})));
|
|
@@ -5263,7 +5280,7 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
5263
5280
|
key: "submitTempOrderAsync",
|
|
5264
5281
|
value: function () {
|
|
5265
5282
|
var _submitTempOrderAsync = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee48(params) {
|
|
5266
|
-
var _params$smallTicketDa2, _this$
|
|
5283
|
+
var _params$smallTicketDa2, _this$otherParams32, _this$otherParams33, _this$otherParams34, _this$otherParams35;
|
|
5267
5284
|
var inferredPaymentStatus, smallTicketDataFlag, enhancePayload, submitParams;
|
|
5268
5285
|
return _regeneratorRuntime().wrap(function _callee48$(_context48) {
|
|
5269
5286
|
while (1) switch (_context48.prev = _context48.next) {
|
|
@@ -5291,10 +5308,10 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
5291
5308
|
enhancePayload = this.buildSubmitPayloadEnhancerWithOpenDataConfig(params === null || params === void 0 ? void 0 : params.enhancePayload);
|
|
5292
5309
|
submitParams = _objectSpread(_objectSpread(_objectSpread(_objectSpread(_objectSpread({
|
|
5293
5310
|
cacheId: this.cacheId,
|
|
5294
|
-
platform: (_this$
|
|
5295
|
-
businessCode: ((_this$
|
|
5311
|
+
platform: (_this$otherParams32 = this.otherParams) === null || _this$otherParams32 === void 0 ? void 0 : _this$otherParams32.platform,
|
|
5312
|
+
businessCode: ((_this$otherParams33 = this.otherParams) === null || _this$otherParams33 === void 0 ? void 0 : _this$otherParams33.businessCode) || ((_this$otherParams34 = this.otherParams) === null || _this$otherParams34 === void 0 ? void 0 : _this$otherParams34.business_code),
|
|
5296
5313
|
channel: this.getSubmitOrderSalesChannel(),
|
|
5297
|
-
type: (_this$
|
|
5314
|
+
type: (_this$otherParams35 = this.otherParams) === null || _this$otherParams35 === void 0 ? void 0 : _this$otherParams35.type,
|
|
5298
5315
|
request_unique_idempotency_token: this.store.order.generateIdempotencyToken()
|
|
5299
5316
|
}, (params === null || params === void 0 ? void 0 : params.payments) !== undefined ? {
|
|
5300
5317
|
payments: params.payments
|
|
@@ -5326,8 +5343,8 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
5326
5343
|
}, {
|
|
5327
5344
|
key: "shouldUseCheckoutSyncTask",
|
|
5328
5345
|
value: function shouldUseCheckoutSyncTask() {
|
|
5329
|
-
var _this$
|
|
5330
|
-
var configured = (_this$
|
|
5346
|
+
var _this$otherParams36;
|
|
5347
|
+
var configured = (_this$otherParams36 = this.otherParams) === null || _this$otherParams36 === void 0 ? void 0 : _this$otherParams36.checkoutSyncTaskEnabled;
|
|
5331
5348
|
return typeof configured === 'boolean' ? configured : true;
|
|
5332
5349
|
}
|
|
5333
5350
|
|
|
@@ -5341,7 +5358,7 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
5341
5358
|
key: "printLocalOrderReceipt",
|
|
5342
5359
|
value: function () {
|
|
5343
5360
|
var _printLocalOrderReceipt = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee49(lookup) {
|
|
5344
|
-
var _this$
|
|
5361
|
+
var _this$otherParams37, _this$otherParams38, _this$otherParams39, _this$otherParams40;
|
|
5345
5362
|
var hasLookup, lookupPayload, context, payload, invoiceLayoutConfig, invoiceTemplateSettings, printPayload, response, _this$store$order$app, _this$store$order19, _data;
|
|
5346
5363
|
return _regeneratorRuntime().wrap(function _callee49$(_context49) {
|
|
5347
5364
|
while (1) switch (_context49.prev = _context49.next) {
|
|
@@ -5359,10 +5376,10 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
5359
5376
|
external_sale_number: lookup
|
|
5360
5377
|
};
|
|
5361
5378
|
context = {
|
|
5362
|
-
platform: (_this$
|
|
5363
|
-
businessCode: ((_this$
|
|
5379
|
+
platform: (_this$otherParams37 = this.otherParams) === null || _this$otherParams37 === void 0 ? void 0 : _this$otherParams37.platform,
|
|
5380
|
+
businessCode: ((_this$otherParams38 = this.otherParams) === null || _this$otherParams38 === void 0 ? void 0 : _this$otherParams38.businessCode) || ((_this$otherParams39 = this.otherParams) === null || _this$otherParams39 === void 0 ? void 0 : _this$otherParams39.business_code),
|
|
5364
5381
|
channel: this.getSubmitOrderSalesChannel(),
|
|
5365
|
-
type: (_this$
|
|
5382
|
+
type: (_this$otherParams40 = this.otherParams) === null || _this$otherParams40 === void 0 ? void 0 : _this$otherParams40.type
|
|
5366
5383
|
};
|
|
5367
5384
|
payload = hasLookup ? _objectSpread(_objectSpread({}, lookupPayload), {}, {
|
|
5368
5385
|
lookup_order_from_db: 1,
|
|
@@ -5428,7 +5445,7 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
5428
5445
|
key: "syncPaymentsToOrder",
|
|
5429
5446
|
value: function () {
|
|
5430
5447
|
var _syncPaymentsToOrder = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee50(params) {
|
|
5431
|
-
var _ref51, _params$businessCode, _this$
|
|
5448
|
+
var _ref51, _params$businessCode, _this$otherParams41, _this$otherParams42, _params$channel2;
|
|
5432
5449
|
var businessCode, channel, enhancePayload, syncParams, syncState, payments, syncResult, latestPayments, amountSnapshot, orderSnapshot, syncPayload;
|
|
5433
5450
|
return _regeneratorRuntime().wrap(function _callee50$(_context50) {
|
|
5434
5451
|
while (1) switch (_context50.prev = _context50.next) {
|
|
@@ -5439,7 +5456,7 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
5439
5456
|
}
|
|
5440
5457
|
throw new Error('order 模块未初始化');
|
|
5441
5458
|
case 2:
|
|
5442
|
-
businessCode = (_ref51 = (_params$businessCode = params.businessCode) !== null && _params$businessCode !== void 0 ? _params$businessCode : (_this$
|
|
5459
|
+
businessCode = (_ref51 = (_params$businessCode = params.businessCode) !== null && _params$businessCode !== void 0 ? _params$businessCode : (_this$otherParams41 = this.otherParams) === null || _this$otherParams41 === void 0 ? void 0 : _this$otherParams41.businessCode) !== null && _ref51 !== void 0 ? _ref51 : (_this$otherParams42 = this.otherParams) === null || _this$otherParams42 === void 0 ? void 0 : _this$otherParams42.business_code;
|
|
5443
5460
|
channel = (_params$channel2 = params.channel) !== null && _params$channel2 !== void 0 ? _params$channel2 : this.getSubmitOrderSalesChannel();
|
|
5444
5461
|
enhancePayload = this.buildSubmitPayloadEnhancerWithOpenDataConfig(params.enhancePayload);
|
|
5445
5462
|
syncParams = _objectSpread(_objectSpread(_objectSpread(_objectSpread({}, params), {}, {
|
|
@@ -5701,7 +5718,7 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
5701
5718
|
}, {
|
|
5702
5719
|
key: "addOrderPaymentWithDevicePrefix",
|
|
5703
5720
|
value: function addOrderPaymentWithDevicePrefix(payment, devicePrefix) {
|
|
5704
|
-
var _this$
|
|
5721
|
+
var _this$otherParams43,
|
|
5705
5722
|
_paymentRecord$paymen,
|
|
5706
5723
|
_paymentRecord$create,
|
|
5707
5724
|
_ref52,
|
|
@@ -5717,7 +5734,7 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
5717
5734
|
return this.store.order.getOrderPayments();
|
|
5718
5735
|
}
|
|
5719
5736
|
var metadata = paymentRecord.metadata && _typeof(paymentRecord.metadata) === 'object' ? _objectSpread({}, paymentRecord.metadata) : {};
|
|
5720
|
-
var shopWalletPassId = (_this$
|
|
5737
|
+
var shopWalletPassId = (_this$otherParams43 = this.otherParams) === null || _this$otherParams43 === void 0 ? void 0 : _this$otherParams43.shop_wallet_pass_id;
|
|
5721
5738
|
if (shopWalletPassId !== undefined && shopWalletPassId !== null) {
|
|
5722
5739
|
metadata.shop_wallet_pass_id = shopWalletPassId;
|
|
5723
5740
|
}
|
|
@@ -6612,9 +6629,9 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
6612
6629
|
return _toConsumableArray(this.paymentMethodsCache);
|
|
6613
6630
|
}
|
|
6614
6631
|
}, {
|
|
6615
|
-
key: "
|
|
6632
|
+
key: "checkTerminalVirtualCurrencyPaymentMethod",
|
|
6616
6633
|
value: function () {
|
|
6617
|
-
var
|
|
6634
|
+
var _checkTerminalVirtualCurrencyPaymentMethod = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee65(channel) {
|
|
6618
6635
|
return _regeneratorRuntime().wrap(function _callee65$(_context65) {
|
|
6619
6636
|
while (1) switch (_context65.prev = _context65.next) {
|
|
6620
6637
|
case 0:
|
|
@@ -6626,7 +6643,7 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
6626
6643
|
case 2:
|
|
6627
6644
|
_context65.prev = 2;
|
|
6628
6645
|
_context65.next = 5;
|
|
6629
|
-
return this.store.order.
|
|
6646
|
+
return this.store.order.refreshTerminalVirtualCurrencyPaymentMethod(channel);
|
|
6630
6647
|
case 5:
|
|
6631
6648
|
return _context65.abrupt("return", true);
|
|
6632
6649
|
case 8:
|
|
@@ -6639,10 +6656,36 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
6639
6656
|
}
|
|
6640
6657
|
}, _callee65, this, [[2, 8]]);
|
|
6641
6658
|
}));
|
|
6642
|
-
function
|
|
6643
|
-
return
|
|
6659
|
+
function checkTerminalVirtualCurrencyPaymentMethod(_x54) {
|
|
6660
|
+
return _checkTerminalVirtualCurrencyPaymentMethod.apply(this, arguments);
|
|
6661
|
+
}
|
|
6662
|
+
return checkTerminalVirtualCurrencyPaymentMethod;
|
|
6663
|
+
}()
|
|
6664
|
+
}, {
|
|
6665
|
+
key: "hasPosVirtualCurrencyPaymentMethod",
|
|
6666
|
+
value: function hasPosVirtualCurrencyPaymentMethod() {
|
|
6667
|
+
return this.checkTerminalVirtualCurrencyPaymentMethod('pos');
|
|
6668
|
+
}
|
|
6669
|
+
}, {
|
|
6670
|
+
key: "hasTerminalVirtualCurrencyPaymentMethod",
|
|
6671
|
+
value: function () {
|
|
6672
|
+
var _hasTerminalVirtualCurrencyPaymentMethod = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee66() {
|
|
6673
|
+
var channel;
|
|
6674
|
+
return _regeneratorRuntime().wrap(function _callee66$(_context66) {
|
|
6675
|
+
while (1) switch (_context66.prev = _context66.next) {
|
|
6676
|
+
case 0:
|
|
6677
|
+
channel = this.getTerminalVirtualCurrencyChannel();
|
|
6678
|
+
return _context66.abrupt("return", channel ? this.checkTerminalVirtualCurrencyPaymentMethod(channel) : false);
|
|
6679
|
+
case 2:
|
|
6680
|
+
case "end":
|
|
6681
|
+
return _context66.stop();
|
|
6682
|
+
}
|
|
6683
|
+
}, _callee66, this);
|
|
6684
|
+
}));
|
|
6685
|
+
function hasTerminalVirtualCurrencyPaymentMethod() {
|
|
6686
|
+
return _hasTerminalVirtualCurrencyPaymentMethod.apply(this, arguments);
|
|
6644
6687
|
}
|
|
6645
|
-
return
|
|
6688
|
+
return hasTerminalVirtualCurrencyPaymentMethod;
|
|
6646
6689
|
}()
|
|
6647
6690
|
}, {
|
|
6648
6691
|
key: "findCashPaymentMethod",
|
|
@@ -6681,8 +6724,8 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
6681
6724
|
}, {
|
|
6682
6725
|
key: "getCashPaymentConfig",
|
|
6683
6726
|
value: (function () {
|
|
6684
|
-
var _getCashPaymentConfig = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
|
6685
|
-
var _this$store$order30, _this$store$order30$g, _this$store$order31, _this$store$order31$g, _this$
|
|
6727
|
+
var _getCashPaymentConfig = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee67() {
|
|
6728
|
+
var _this$store$order30, _this$store$order30$g, _this$store$order31, _this$store$order31$g, _this$otherParams44;
|
|
6686
6729
|
var options,
|
|
6687
6730
|
paymentMethods,
|
|
6688
6731
|
paymentMethod,
|
|
@@ -6691,13 +6734,13 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
6691
6734
|
amountDue,
|
|
6692
6735
|
currency,
|
|
6693
6736
|
recommendedAmounts,
|
|
6694
|
-
|
|
6695
|
-
return _regeneratorRuntime().wrap(function
|
|
6696
|
-
while (1) switch (
|
|
6737
|
+
_args67 = arguments;
|
|
6738
|
+
return _regeneratorRuntime().wrap(function _callee67$(_context67) {
|
|
6739
|
+
while (1) switch (_context67.prev = _context67.next) {
|
|
6697
6740
|
case 0:
|
|
6698
|
-
options =
|
|
6741
|
+
options = _args67.length > 0 && _args67[0] !== undefined ? _args67[0] : {};
|
|
6699
6742
|
if (this.store.payment) {
|
|
6700
|
-
|
|
6743
|
+
_context67.next = 3;
|
|
6701
6744
|
break;
|
|
6702
6745
|
}
|
|
6703
6746
|
throw new Error('payment 模块未初始化');
|
|
@@ -6705,17 +6748,17 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
6705
6748
|
paymentMethods = this.getPaymentMethods();
|
|
6706
6749
|
paymentMethod = this.findCashPaymentMethod(paymentMethods, options.paymentMethodId);
|
|
6707
6750
|
if (paymentMethod) {
|
|
6708
|
-
|
|
6751
|
+
_context67.next = 10;
|
|
6709
6752
|
break;
|
|
6710
6753
|
}
|
|
6711
|
-
|
|
6754
|
+
_context67.next = 8;
|
|
6712
6755
|
return this.getPaymentMethodsAsync();
|
|
6713
6756
|
case 8:
|
|
6714
|
-
paymentMethods =
|
|
6757
|
+
paymentMethods = _context67.sent;
|
|
6715
6758
|
paymentMethod = this.findCashPaymentMethod(paymentMethods, options.paymentMethodId);
|
|
6716
6759
|
case 10:
|
|
6717
6760
|
if (!(!paymentMethod && options.paymentMethodId !== undefined)) {
|
|
6718
|
-
|
|
6761
|
+
_context67.next = 12;
|
|
6719
6762
|
break;
|
|
6720
6763
|
}
|
|
6721
6764
|
throw new Error("\u672A\u627E\u5230\u53EF\u7528\u7684\u73B0\u91D1\u652F\u4ED8\u65B9\u5F0F\uFF1A".concat(options.paymentMethodId));
|
|
@@ -6723,9 +6766,9 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
6723
6766
|
amountSnapshot = (_this$store$order30 = this.store.order) === null || _this$store$order30 === void 0 || (_this$store$order30$g = _this$store$order30.getOrderAmountSnapshot) === null || _this$store$order30$g === void 0 ? void 0 : _this$store$order30$g.call(_this$store$order30);
|
|
6724
6767
|
pendingWalletAmount = this.getPendingWalletPaymentAmount();
|
|
6725
6768
|
amountDue = Decimal.max(new Decimal((amountSnapshot === null || amountSnapshot === void 0 ? void 0 : amountSnapshot.amountGap) || 0).minus(pendingWalletAmount), 0).toDecimalPlaces(2).toNumber();
|
|
6726
|
-
currency = ((_this$store$order31 = this.store.order) === null || _this$store$order31 === void 0 || (_this$store$order31$g = _this$store$order31.getTempOrder) === null || _this$store$order31$g === void 0 || (_this$store$order31$g = _this$store$order31$g.call(_this$store$order31)) === null || _this$store$order31$g === void 0 ? void 0 : _this$store$order31$g.currency_code) || ((_this$
|
|
6769
|
+
currency = ((_this$store$order31 = this.store.order) === null || _this$store$order31 === void 0 || (_this$store$order31$g = _this$store$order31.getTempOrder) === null || _this$store$order31$g === void 0 || (_this$store$order31$g = _this$store$order31$g.call(_this$store$order31)) === null || _this$store$order31$g === void 0 ? void 0 : _this$store$order31$g.currency_code) || ((_this$otherParams44 = this.otherParams) === null || _this$otherParams44 === void 0 ? void 0 : _this$otherParams44.currency) || 'USD';
|
|
6727
6770
|
recommendedAmounts = amountDue > 0 ? this.store.payment.cash.getRecommendedAmount(amountDue, currency) : [];
|
|
6728
|
-
return
|
|
6771
|
+
return _context67.abrupt("return", {
|
|
6729
6772
|
available: Boolean(paymentMethod && amountDue > 0),
|
|
6730
6773
|
paymentMethod: paymentMethod,
|
|
6731
6774
|
amountDue: amountDue,
|
|
@@ -6733,9 +6776,9 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
6733
6776
|
});
|
|
6734
6777
|
case 18:
|
|
6735
6778
|
case "end":
|
|
6736
|
-
return
|
|
6779
|
+
return _context67.stop();
|
|
6737
6780
|
}
|
|
6738
|
-
},
|
|
6781
|
+
}, _callee67, this);
|
|
6739
6782
|
}));
|
|
6740
6783
|
function getCashPaymentConfig() {
|
|
6741
6784
|
return _getCashPaymentConfig.apply(this, arguments);
|
|
@@ -6752,45 +6795,45 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
6752
6795
|
}, {
|
|
6753
6796
|
key: "confirmWalletPayment",
|
|
6754
6797
|
value: (function () {
|
|
6755
|
-
var _confirmWalletPayment = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
|
6798
|
+
var _confirmWalletPayment = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee68() {
|
|
6756
6799
|
var _this$store$order$get9, _this$store$order32, _this$store$order$get11, _this$store$order$get12, _this$store$order34;
|
|
6757
6800
|
var beforePayments, pendingWalletAmount, amountSnapshot, _this$store$order$get10, _this$store$order33, _submitResult, _latestAmountSnapshot, effectiveAmountDue, beforePaymentStatus, submitResult, restoredTempOrder, committed, walletState, latestAmountSnapshot;
|
|
6758
|
-
return _regeneratorRuntime().wrap(function
|
|
6759
|
-
while (1) switch (
|
|
6801
|
+
return _regeneratorRuntime().wrap(function _callee68$(_context68) {
|
|
6802
|
+
while (1) switch (_context68.prev = _context68.next) {
|
|
6760
6803
|
case 0:
|
|
6761
6804
|
if (this.store.order) {
|
|
6762
|
-
|
|
6805
|
+
_context68.next = 2;
|
|
6763
6806
|
break;
|
|
6764
6807
|
}
|
|
6765
6808
|
throw new Error('order 模块未初始化');
|
|
6766
6809
|
case 2:
|
|
6767
|
-
|
|
6810
|
+
_context68.next = 4;
|
|
6768
6811
|
return this.validateContactInfo();
|
|
6769
6812
|
case 4:
|
|
6770
6813
|
beforePayments = cloneDeep(this.store.order.getOrderPayments());
|
|
6771
6814
|
pendingWalletAmount = this.getPendingWalletPaymentAmount(beforePayments);
|
|
6772
6815
|
amountSnapshot = (_this$store$order$get9 = (_this$store$order32 = this.store.order).getOrderAmountSnapshot) === null || _this$store$order$get9 === void 0 ? void 0 : _this$store$order$get9.call(_this$store$order32);
|
|
6773
6816
|
if (!pendingWalletAmount.lte(0)) {
|
|
6774
|
-
|
|
6817
|
+
_context68.next = 16;
|
|
6775
6818
|
break;
|
|
6776
6819
|
}
|
|
6777
6820
|
this.logWarning('confirmWalletPayment: 未发现待确认 Wallet 支付,跳过 Wallet 确认并按普通订单提交', {
|
|
6778
6821
|
amountGap: amountSnapshot === null || amountSnapshot === void 0 ? void 0 : amountSnapshot.amountGap
|
|
6779
6822
|
});
|
|
6780
|
-
|
|
6823
|
+
_context68.next = 11;
|
|
6781
6824
|
return this.submitSalesOrder({
|
|
6782
6825
|
smallTicketDataFlag: 1
|
|
6783
6826
|
});
|
|
6784
6827
|
case 11:
|
|
6785
|
-
_submitResult =
|
|
6828
|
+
_submitResult = _context68.sent;
|
|
6786
6829
|
if (!isRejectedSalesSubmitResult(_submitResult)) {
|
|
6787
|
-
|
|
6830
|
+
_context68.next = 14;
|
|
6788
6831
|
break;
|
|
6789
6832
|
}
|
|
6790
6833
|
throw new Error(getSalesSubmitErrorMessage(_submitResult, '订单提交失败'));
|
|
6791
6834
|
case 14:
|
|
6792
6835
|
_latestAmountSnapshot = (_this$store$order$get10 = (_this$store$order33 = this.store.order).getOrderAmountSnapshot) === null || _this$store$order$get10 === void 0 ? void 0 : _this$store$order$get10.call(_this$store$order33);
|
|
6793
|
-
return
|
|
6836
|
+
return _context68.abrupt("return", {
|
|
6794
6837
|
submitResult: _submitResult,
|
|
6795
6838
|
payments: this.store.order.getOrderPayments(),
|
|
6796
6839
|
isOrderFullyPaid: new Decimal((_latestAmountSnapshot === null || _latestAmountSnapshot === void 0 ? void 0 : _latestAmountSnapshot.amountGap) || 0).lte(0)
|
|
@@ -6798,74 +6841,74 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
6798
6841
|
case 16:
|
|
6799
6842
|
effectiveAmountDue = Decimal.max(new Decimal((amountSnapshot === null || amountSnapshot === void 0 ? void 0 : amountSnapshot.amountGap) || 0).minus(pendingWalletAmount), 0);
|
|
6800
6843
|
if (!effectiveAmountDue.gt(0.01)) {
|
|
6801
|
-
|
|
6844
|
+
_context68.next = 19;
|
|
6802
6845
|
break;
|
|
6803
6846
|
}
|
|
6804
6847
|
throw new Error('Wallet 支付尚未覆盖全部待支付金额');
|
|
6805
6848
|
case 19:
|
|
6806
6849
|
beforePaymentStatus = (_this$store$order$get11 = this.store.order.getTempOrder()) === null || _this$store$order$get11 === void 0 ? void 0 : _this$store$order$get11.payment_status;
|
|
6807
|
-
|
|
6808
|
-
|
|
6850
|
+
_context68.prev = 20;
|
|
6851
|
+
_context68.next = 23;
|
|
6809
6852
|
return this.submitSalesOrder({
|
|
6810
6853
|
smallTicketDataFlag: 1,
|
|
6811
6854
|
confirmPendingVoucherPayments: true
|
|
6812
6855
|
});
|
|
6813
6856
|
case 23:
|
|
6814
|
-
submitResult =
|
|
6857
|
+
submitResult = _context68.sent;
|
|
6815
6858
|
if (!isRejectedSalesSubmitResult(submitResult)) {
|
|
6816
|
-
|
|
6859
|
+
_context68.next = 26;
|
|
6817
6860
|
break;
|
|
6818
6861
|
}
|
|
6819
6862
|
throw new Error(getSalesSubmitErrorMessage(submitResult, 'Wallet 支付确认失败'));
|
|
6820
6863
|
case 26:
|
|
6821
|
-
|
|
6864
|
+
_context68.next = 36;
|
|
6822
6865
|
break;
|
|
6823
6866
|
case 28:
|
|
6824
|
-
|
|
6825
|
-
|
|
6867
|
+
_context68.prev = 28;
|
|
6868
|
+
_context68.t0 = _context68["catch"](20);
|
|
6826
6869
|
this.store.order.setOrderPayments(beforePayments);
|
|
6827
6870
|
restoredTempOrder = this.store.order.getTempOrder();
|
|
6828
6871
|
if (restoredTempOrder && beforePaymentStatus !== undefined) {
|
|
6829
6872
|
restoredTempOrder.payment_status = beforePaymentStatus;
|
|
6830
6873
|
this.store.order.persistTempOrder();
|
|
6831
6874
|
}
|
|
6832
|
-
|
|
6875
|
+
_context68.next = 35;
|
|
6833
6876
|
return this.store.order.recalculateSummary({
|
|
6834
6877
|
createIfMissing: true
|
|
6835
6878
|
});
|
|
6836
6879
|
case 35:
|
|
6837
|
-
throw
|
|
6880
|
+
throw _context68.t0;
|
|
6838
6881
|
case 36:
|
|
6839
6882
|
if (!this.store.payment) {
|
|
6840
|
-
|
|
6883
|
+
_context68.next = 47;
|
|
6841
6884
|
break;
|
|
6842
6885
|
}
|
|
6843
|
-
|
|
6886
|
+
_context68.prev = 37;
|
|
6844
6887
|
committed = this.getCommittedWalletAssets();
|
|
6845
6888
|
walletState = this.store.payment.wallet.setCommittedWalletAssets(committed.ids, committed.assets);
|
|
6846
|
-
|
|
6889
|
+
_context68.next = 42;
|
|
6847
6890
|
return this.publishWalletAssetsState(walletState, 'local');
|
|
6848
6891
|
case 42:
|
|
6849
|
-
|
|
6892
|
+
_context68.next = 47;
|
|
6850
6893
|
break;
|
|
6851
6894
|
case 44:
|
|
6852
|
-
|
|
6853
|
-
|
|
6895
|
+
_context68.prev = 44;
|
|
6896
|
+
_context68.t1 = _context68["catch"](37);
|
|
6854
6897
|
this.logWarning('confirmWalletPayment: Wallet committed 状态同步失败', {
|
|
6855
|
-
error:
|
|
6898
|
+
error: _context68.t1 instanceof Error ? _context68.t1.message : String(_context68.t1)
|
|
6856
6899
|
});
|
|
6857
6900
|
case 47:
|
|
6858
6901
|
latestAmountSnapshot = (_this$store$order$get12 = (_this$store$order34 = this.store.order).getOrderAmountSnapshot) === null || _this$store$order$get12 === void 0 ? void 0 : _this$store$order$get12.call(_this$store$order34);
|
|
6859
|
-
return
|
|
6902
|
+
return _context68.abrupt("return", {
|
|
6860
6903
|
submitResult: submitResult,
|
|
6861
6904
|
payments: this.store.order.getOrderPayments(),
|
|
6862
6905
|
isOrderFullyPaid: new Decimal((latestAmountSnapshot === null || latestAmountSnapshot === void 0 ? void 0 : latestAmountSnapshot.amountGap) || 0).lte(0)
|
|
6863
6906
|
});
|
|
6864
6907
|
case 49:
|
|
6865
6908
|
case "end":
|
|
6866
|
-
return
|
|
6909
|
+
return _context68.stop();
|
|
6867
6910
|
}
|
|
6868
|
-
},
|
|
6911
|
+
}, _callee68, this, [[20, 28], [37, 44]]);
|
|
6869
6912
|
}));
|
|
6870
6913
|
function confirmWalletPayment() {
|
|
6871
6914
|
return _confirmWalletPayment.apply(this, arguments);
|
|
@@ -6880,56 +6923,56 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
6880
6923
|
}, {
|
|
6881
6924
|
key: "payCash",
|
|
6882
6925
|
value: (function () {
|
|
6883
|
-
var _payCash = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
|
6884
|
-
var _this$store$order$get13, _params$actualPaidAmo, _this$
|
|
6926
|
+
var _payCash = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee69(params) {
|
|
6927
|
+
var _this$store$order$get13, _params$actualPaidAmo, _this$otherParams45, _this$window, _this$window$postMess;
|
|
6885
6928
|
var amount, config, paymentMethod, roundingAmount, effectivePaymentAmount, beforePayments, beforePaymentStatus, uniquePaymentNumber, actualPaidAmount, changeAmount, shopWalletPassId, paymentTimestamp, payments, payment, syncResult, committed, walletState, restoredTempOrder;
|
|
6886
|
-
return _regeneratorRuntime().wrap(function
|
|
6887
|
-
while (1) switch (
|
|
6929
|
+
return _regeneratorRuntime().wrap(function _callee69$(_context69) {
|
|
6930
|
+
while (1) switch (_context69.prev = _context69.next) {
|
|
6888
6931
|
case 0:
|
|
6889
6932
|
if (this.store.order) {
|
|
6890
|
-
|
|
6933
|
+
_context69.next = 2;
|
|
6891
6934
|
break;
|
|
6892
6935
|
}
|
|
6893
6936
|
throw new Error('order 模块未初始化');
|
|
6894
6937
|
case 2:
|
|
6895
|
-
|
|
6938
|
+
_context69.next = 4;
|
|
6896
6939
|
return this.validateContactInfo();
|
|
6897
6940
|
case 4:
|
|
6898
6941
|
amount = Number(params.amount || 0);
|
|
6899
6942
|
if (!(!Number.isFinite(amount) || amount <= 0)) {
|
|
6900
|
-
|
|
6943
|
+
_context69.next = 7;
|
|
6901
6944
|
break;
|
|
6902
6945
|
}
|
|
6903
6946
|
throw new Error('现金支付金额必须大于 0');
|
|
6904
6947
|
case 7:
|
|
6905
6948
|
if (!(params.paymentMethodId === undefined)) {
|
|
6906
|
-
|
|
6949
|
+
_context69.next = 13;
|
|
6907
6950
|
break;
|
|
6908
6951
|
}
|
|
6909
|
-
|
|
6952
|
+
_context69.next = 10;
|
|
6910
6953
|
return this.getCashPaymentConfig();
|
|
6911
6954
|
case 10:
|
|
6912
|
-
|
|
6913
|
-
|
|
6955
|
+
_context69.t0 = _context69.sent;
|
|
6956
|
+
_context69.next = 16;
|
|
6914
6957
|
break;
|
|
6915
6958
|
case 13:
|
|
6916
|
-
|
|
6959
|
+
_context69.next = 15;
|
|
6917
6960
|
return this.getCashPaymentConfig({
|
|
6918
6961
|
paymentMethodId: params.paymentMethodId
|
|
6919
6962
|
});
|
|
6920
6963
|
case 15:
|
|
6921
|
-
|
|
6964
|
+
_context69.t0 = _context69.sent;
|
|
6922
6965
|
case 16:
|
|
6923
|
-
config =
|
|
6966
|
+
config = _context69.t0;
|
|
6924
6967
|
paymentMethod = config.paymentMethod;
|
|
6925
6968
|
if (paymentMethod) {
|
|
6926
|
-
|
|
6969
|
+
_context69.next = 20;
|
|
6927
6970
|
break;
|
|
6928
6971
|
}
|
|
6929
6972
|
throw new Error('未找到可用的 CASHMANUAL 支付方式');
|
|
6930
6973
|
case 20:
|
|
6931
6974
|
if (!(config.amountDue <= 0)) {
|
|
6932
|
-
|
|
6975
|
+
_context69.next = 22;
|
|
6933
6976
|
break;
|
|
6934
6977
|
}
|
|
6935
6978
|
throw new Error('当前订单没有待支付金额');
|
|
@@ -6937,7 +6980,7 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
6937
6980
|
roundingAmount = Number(params.roundingAmount || 0);
|
|
6938
6981
|
effectivePaymentAmount = new Decimal(amount).minus(roundingAmount);
|
|
6939
6982
|
if (!effectivePaymentAmount.gt(new Decimal(config.amountDue).plus(0.01))) {
|
|
6940
|
-
|
|
6983
|
+
_context69.next = 26;
|
|
6941
6984
|
break;
|
|
6942
6985
|
}
|
|
6943
6986
|
throw new Error('现金支付金额超过当前待支付金额');
|
|
@@ -6947,18 +6990,18 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
6947
6990
|
uniquePaymentNumber = createUuidV4();
|
|
6948
6991
|
actualPaidAmount = Number((_params$actualPaidAmo = params.actualPaidAmount) !== null && _params$actualPaidAmo !== void 0 ? _params$actualPaidAmo : amount);
|
|
6949
6992
|
changeAmount = Number(params.changeAmount || 0);
|
|
6950
|
-
shopWalletPassId = (_this$
|
|
6993
|
+
shopWalletPassId = (_this$otherParams45 = this.otherParams) === null || _this$otherParams45 === void 0 ? void 0 : _this$otherParams45.shop_wallet_pass_id;
|
|
6951
6994
|
if (!(!Number.isFinite(actualPaidAmount) || actualPaidAmount + 0.01 < amount)) {
|
|
6952
|
-
|
|
6995
|
+
_context69.next = 34;
|
|
6953
6996
|
break;
|
|
6954
6997
|
}
|
|
6955
6998
|
throw new Error('顾客实收现金不能小于支付金额');
|
|
6956
6999
|
case 34:
|
|
6957
7000
|
if (!this.isPickupTimingEnabled()) {
|
|
6958
|
-
|
|
7001
|
+
_context69.next = 37;
|
|
6959
7002
|
break;
|
|
6960
7003
|
}
|
|
6961
|
-
|
|
7004
|
+
_context69.next = 37;
|
|
6962
7005
|
return this.preparePickupTimingForCheckout({
|
|
6963
7006
|
freeze: true
|
|
6964
7007
|
});
|
|
@@ -6995,8 +7038,8 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
6995
7038
|
var _item$metadata2;
|
|
6996
7039
|
return (item === null || item === void 0 || (_item$metadata2 = item.metadata) === null || _item$metadata2 === void 0 ? void 0 : _item$metadata2.unique_payment_number) === uniquePaymentNumber;
|
|
6997
7040
|
});
|
|
6998
|
-
|
|
6999
|
-
|
|
7041
|
+
_context69.prev = 42;
|
|
7042
|
+
_context69.next = 45;
|
|
7000
7043
|
return this.syncPaymentsToOrder({
|
|
7001
7044
|
payments: payments,
|
|
7002
7045
|
submitWhenPaid: true,
|
|
@@ -7004,50 +7047,50 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
7004
7047
|
confirmPendingVoucherPayments: true
|
|
7005
7048
|
});
|
|
7006
7049
|
case 45:
|
|
7007
|
-
syncResult =
|
|
7050
|
+
syncResult = _context69.sent;
|
|
7008
7051
|
if (!isRejectedSalesSubmitResult(syncResult.submitResult)) {
|
|
7009
|
-
|
|
7052
|
+
_context69.next = 48;
|
|
7010
7053
|
break;
|
|
7011
7054
|
}
|
|
7012
7055
|
throw new Error(getSalesSubmitErrorMessage(syncResult.submitResult, '订单提交失败'));
|
|
7013
7056
|
case 48:
|
|
7014
7057
|
if (!this.store.payment) {
|
|
7015
|
-
|
|
7058
|
+
_context69.next = 53;
|
|
7016
7059
|
break;
|
|
7017
7060
|
}
|
|
7018
7061
|
committed = this.getCommittedWalletAssets();
|
|
7019
7062
|
walletState = this.store.payment.wallet.setCommittedWalletAssets(committed.ids, committed.assets);
|
|
7020
|
-
|
|
7063
|
+
_context69.next = 53;
|
|
7021
7064
|
return this.publishWalletAssetsState(walletState, 'local');
|
|
7022
7065
|
case 53:
|
|
7023
|
-
return
|
|
7066
|
+
return _context69.abrupt("return", {
|
|
7024
7067
|
payment: payment || {},
|
|
7025
7068
|
payments: this.store.order.getOrderPayments(),
|
|
7026
7069
|
syncResult: syncResult,
|
|
7027
7070
|
isOrderFullyPaid: syncResult.isOrderFullyPaid
|
|
7028
7071
|
});
|
|
7029
7072
|
case 56:
|
|
7030
|
-
|
|
7031
|
-
|
|
7073
|
+
_context69.prev = 56;
|
|
7074
|
+
_context69.t1 = _context69["catch"](42);
|
|
7032
7075
|
this.store.order.setOrderPayments(beforePayments);
|
|
7033
7076
|
restoredTempOrder = this.store.order.getTempOrder();
|
|
7034
7077
|
if (restoredTempOrder && beforePaymentStatus !== undefined) {
|
|
7035
7078
|
restoredTempOrder.payment_status = beforePaymentStatus;
|
|
7036
7079
|
this.store.order.persistTempOrder();
|
|
7037
7080
|
}
|
|
7038
|
-
|
|
7081
|
+
_context69.next = 63;
|
|
7039
7082
|
return this.store.order.recalculateSummary({
|
|
7040
7083
|
createIfMissing: true
|
|
7041
7084
|
});
|
|
7042
7085
|
case 63:
|
|
7043
|
-
throw
|
|
7086
|
+
throw _context69.t1;
|
|
7044
7087
|
case 64:
|
|
7045
7088
|
case "end":
|
|
7046
|
-
return
|
|
7089
|
+
return _context69.stop();
|
|
7047
7090
|
}
|
|
7048
|
-
},
|
|
7091
|
+
}, _callee69, this, [[42, 56]]);
|
|
7049
7092
|
}));
|
|
7050
|
-
function payCash(
|
|
7093
|
+
function payCash(_x55) {
|
|
7051
7094
|
return _payCash.apply(this, arguments);
|
|
7052
7095
|
}
|
|
7053
7096
|
return payCash;
|
|
@@ -7063,21 +7106,21 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
7063
7106
|
}, {
|
|
7064
7107
|
key: "commitPaymentMethodPayment",
|
|
7065
7108
|
value: (function () {
|
|
7066
|
-
var _commitPaymentMethodPayment = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
|
7109
|
+
var _commitPaymentMethodPayment = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee70(params) {
|
|
7067
7110
|
var _this$store$order$get14, _this$store$order35, _this$store$order$get15, _params$metadata, _params$originAmount;
|
|
7068
7111
|
var amount, paymentMethods, findPaymentMethod, paymentMethod, amountSnapshot, pendingWalletAmount, amountDue, beforePayments, beforePaymentStatus, paymentTimestamp, metadata, serviceCharge, serviceFee, payments, payment, syncResult, committed, walletState, restoredTempOrder;
|
|
7069
|
-
return _regeneratorRuntime().wrap(function
|
|
7070
|
-
while (1) switch (
|
|
7112
|
+
return _regeneratorRuntime().wrap(function _callee70$(_context70) {
|
|
7113
|
+
while (1) switch (_context70.prev = _context70.next) {
|
|
7071
7114
|
case 0:
|
|
7072
7115
|
if (this.store.order) {
|
|
7073
|
-
|
|
7116
|
+
_context70.next = 2;
|
|
7074
7117
|
break;
|
|
7075
7118
|
}
|
|
7076
7119
|
throw new Error('order 模块未初始化');
|
|
7077
7120
|
case 2:
|
|
7078
7121
|
amount = Number(params.amount || 0);
|
|
7079
7122
|
if (!(!Number.isFinite(amount) || amount <= 0)) {
|
|
7080
|
-
|
|
7123
|
+
_context70.next = 5;
|
|
7081
7124
|
break;
|
|
7082
7125
|
}
|
|
7083
7126
|
throw new Error('支付金额必须大于 0');
|
|
@@ -7093,17 +7136,17 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
7093
7136
|
};
|
|
7094
7137
|
paymentMethod = findPaymentMethod();
|
|
7095
7138
|
if (paymentMethod) {
|
|
7096
|
-
|
|
7139
|
+
_context70.next = 13;
|
|
7097
7140
|
break;
|
|
7098
7141
|
}
|
|
7099
|
-
|
|
7142
|
+
_context70.next = 11;
|
|
7100
7143
|
return this.getPaymentMethodsAsync();
|
|
7101
7144
|
case 11:
|
|
7102
|
-
paymentMethods =
|
|
7145
|
+
paymentMethods = _context70.sent;
|
|
7103
7146
|
paymentMethod = findPaymentMethod();
|
|
7104
7147
|
case 13:
|
|
7105
7148
|
if (paymentMethod) {
|
|
7106
|
-
|
|
7149
|
+
_context70.next = 15;
|
|
7107
7150
|
break;
|
|
7108
7151
|
}
|
|
7109
7152
|
throw new Error("\u672A\u627E\u5230\u53EF\u7528\u7684\u652F\u4ED8\u65B9\u5F0F\uFF1A".concat(params.paymentMethodCode || params.paymentMethodId || ''));
|
|
@@ -7112,13 +7155,13 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
7112
7155
|
pendingWalletAmount = this.getPendingWalletPaymentAmount();
|
|
7113
7156
|
amountDue = Decimal.max(new Decimal((amountSnapshot === null || amountSnapshot === void 0 ? void 0 : amountSnapshot.amountGap) || 0).minus(pendingWalletAmount), 0);
|
|
7114
7157
|
if (!amountDue.lte(0)) {
|
|
7115
|
-
|
|
7158
|
+
_context70.next = 20;
|
|
7116
7159
|
break;
|
|
7117
7160
|
}
|
|
7118
7161
|
throw new Error('当前订单没有待支付金额');
|
|
7119
7162
|
case 20:
|
|
7120
7163
|
if (!new Decimal(amount).gt(amountDue.plus(0.01))) {
|
|
7121
|
-
|
|
7164
|
+
_context70.next = 22;
|
|
7122
7165
|
break;
|
|
7123
7166
|
}
|
|
7124
7167
|
throw new Error('支付金额超过当前待支付金额');
|
|
@@ -7158,8 +7201,8 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
7158
7201
|
var _item$metadata3;
|
|
7159
7202
|
return (item === null || item === void 0 || (_item$metadata3 = item.metadata) === null || _item$metadata3 === void 0 ? void 0 : _item$metadata3.unique_payment_number) === metadata.unique_payment_number;
|
|
7160
7203
|
});
|
|
7161
|
-
|
|
7162
|
-
|
|
7204
|
+
_context70.prev = 31;
|
|
7205
|
+
_context70.next = 34;
|
|
7163
7206
|
return this.syncPaymentsToOrder({
|
|
7164
7207
|
payments: payments,
|
|
7165
7208
|
submitWhenPaid: true,
|
|
@@ -7167,50 +7210,50 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
7167
7210
|
confirmPendingVoucherPayments: true
|
|
7168
7211
|
});
|
|
7169
7212
|
case 34:
|
|
7170
|
-
syncResult =
|
|
7213
|
+
syncResult = _context70.sent;
|
|
7171
7214
|
if (!isRejectedSalesSubmitResult(syncResult.submitResult)) {
|
|
7172
|
-
|
|
7215
|
+
_context70.next = 37;
|
|
7173
7216
|
break;
|
|
7174
7217
|
}
|
|
7175
7218
|
throw new Error(getSalesSubmitErrorMessage(syncResult.submitResult, '订单提交失败'));
|
|
7176
7219
|
case 37:
|
|
7177
7220
|
if (!this.store.payment) {
|
|
7178
|
-
|
|
7221
|
+
_context70.next = 42;
|
|
7179
7222
|
break;
|
|
7180
7223
|
}
|
|
7181
7224
|
committed = this.getCommittedWalletAssets();
|
|
7182
7225
|
walletState = this.store.payment.wallet.setCommittedWalletAssets(committed.ids, committed.assets);
|
|
7183
|
-
|
|
7226
|
+
_context70.next = 42;
|
|
7184
7227
|
return this.publishWalletAssetsState(walletState, 'local');
|
|
7185
7228
|
case 42:
|
|
7186
|
-
return
|
|
7229
|
+
return _context70.abrupt("return", {
|
|
7187
7230
|
payment: payment || {},
|
|
7188
7231
|
payments: this.store.order.getOrderPayments(),
|
|
7189
7232
|
syncResult: syncResult,
|
|
7190
7233
|
isOrderFullyPaid: syncResult.isOrderFullyPaid
|
|
7191
7234
|
});
|
|
7192
7235
|
case 45:
|
|
7193
|
-
|
|
7194
|
-
|
|
7236
|
+
_context70.prev = 45;
|
|
7237
|
+
_context70.t0 = _context70["catch"](31);
|
|
7195
7238
|
this.store.order.setOrderPayments(beforePayments);
|
|
7196
7239
|
restoredTempOrder = this.store.order.getTempOrder();
|
|
7197
7240
|
if (restoredTempOrder && beforePaymentStatus !== undefined) {
|
|
7198
7241
|
restoredTempOrder.payment_status = beforePaymentStatus;
|
|
7199
7242
|
this.store.order.persistTempOrder();
|
|
7200
7243
|
}
|
|
7201
|
-
|
|
7244
|
+
_context70.next = 52;
|
|
7202
7245
|
return this.store.order.recalculateSummary({
|
|
7203
7246
|
createIfMissing: true
|
|
7204
7247
|
});
|
|
7205
7248
|
case 52:
|
|
7206
|
-
throw
|
|
7249
|
+
throw _context70.t0;
|
|
7207
7250
|
case 53:
|
|
7208
7251
|
case "end":
|
|
7209
|
-
return
|
|
7252
|
+
return _context70.stop();
|
|
7210
7253
|
}
|
|
7211
|
-
},
|
|
7254
|
+
}, _callee70, this, [[31, 45]]);
|
|
7212
7255
|
}));
|
|
7213
|
-
function commitPaymentMethodPayment(
|
|
7256
|
+
function commitPaymentMethodPayment(_x56) {
|
|
7214
7257
|
return _commitPaymentMethodPayment.apply(this, arguments);
|
|
7215
7258
|
}
|
|
7216
7259
|
return commitPaymentMethodPayment;
|
|
@@ -7225,40 +7268,40 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
7225
7268
|
}, {
|
|
7226
7269
|
key: "roundAmount",
|
|
7227
7270
|
value: (function () {
|
|
7228
|
-
var _roundAmount = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
|
7271
|
+
var _roundAmount = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee71(params) {
|
|
7229
7272
|
var _cashManualPayment$me, _this$otherParams$ord2, _this$otherParams$ord3;
|
|
7230
7273
|
var amount, cashManualPayment;
|
|
7231
|
-
return _regeneratorRuntime().wrap(function
|
|
7232
|
-
while (1) switch (
|
|
7274
|
+
return _regeneratorRuntime().wrap(function _callee71$(_context71) {
|
|
7275
|
+
while (1) switch (_context71.prev = _context71.next) {
|
|
7233
7276
|
case 0:
|
|
7234
7277
|
amount = params.amount;
|
|
7235
7278
|
cashManualPayment = this.paymentMethodsCache.find(function (paymentMethod) {
|
|
7236
7279
|
return paymentMethod.code === 'CASHMANUAL';
|
|
7237
7280
|
});
|
|
7238
7281
|
if (cashManualPayment !== null && cashManualPayment !== void 0 && (_cashManualPayment$me = cashManualPayment.metadata) !== null && _cashManualPayment$me !== void 0 && _cashManualPayment$me.order_rounding_switch) {
|
|
7239
|
-
|
|
7282
|
+
_context71.next = 4;
|
|
7240
7283
|
break;
|
|
7241
7284
|
}
|
|
7242
|
-
return
|
|
7285
|
+
return _context71.abrupt("return", {
|
|
7243
7286
|
originalAmount: amount.toString(),
|
|
7244
7287
|
roundedAmount: amount.toString(),
|
|
7245
7288
|
roundingDifference: '0.00'
|
|
7246
7289
|
});
|
|
7247
7290
|
case 4:
|
|
7248
7291
|
if (this.payment) {
|
|
7249
|
-
|
|
7292
|
+
_context71.next = 6;
|
|
7250
7293
|
break;
|
|
7251
7294
|
}
|
|
7252
7295
|
throw new Error('payment 模块未初始化');
|
|
7253
7296
|
case 6:
|
|
7254
|
-
return
|
|
7297
|
+
return _context71.abrupt("return", this.payment.roundAmountAsync(amount, (_this$otherParams$ord2 = this.otherParams.order_rounding_setting) === null || _this$otherParams$ord2 === void 0 ? void 0 : _this$otherParams$ord2.interval, (_this$otherParams$ord3 = this.otherParams.order_rounding_setting) === null || _this$otherParams$ord3 === void 0 ? void 0 : _this$otherParams$ord3.type));
|
|
7255
7298
|
case 7:
|
|
7256
7299
|
case "end":
|
|
7257
|
-
return
|
|
7300
|
+
return _context71.stop();
|
|
7258
7301
|
}
|
|
7259
|
-
},
|
|
7302
|
+
}, _callee71, this);
|
|
7260
7303
|
}));
|
|
7261
|
-
function roundAmount(
|
|
7304
|
+
function roundAmount(_x57) {
|
|
7262
7305
|
return _roundAmount.apply(this, arguments);
|
|
7263
7306
|
}
|
|
7264
7307
|
return roundAmount;
|
|
@@ -7273,49 +7316,49 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
7273
7316
|
}, {
|
|
7274
7317
|
key: "sendCustomerPayLink",
|
|
7275
7318
|
value: (function () {
|
|
7276
|
-
var _sendCustomerPayLink = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
|
7319
|
+
var _sendCustomerPayLink = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee72(params) {
|
|
7277
7320
|
var orderIds, _ref56, _ref57, _submitResult$data$or, _submitResult$data, _submitResult$data2, submitResult, orderId;
|
|
7278
|
-
return _regeneratorRuntime().wrap(function
|
|
7279
|
-
while (1) switch (
|
|
7321
|
+
return _regeneratorRuntime().wrap(function _callee72$(_context72) {
|
|
7322
|
+
while (1) switch (_context72.prev = _context72.next) {
|
|
7280
7323
|
case 0:
|
|
7281
7324
|
if (this.store.order) {
|
|
7282
|
-
|
|
7325
|
+
_context72.next = 2;
|
|
7283
7326
|
break;
|
|
7284
7327
|
}
|
|
7285
7328
|
throw new Error('order 模块未初始化');
|
|
7286
7329
|
case 2:
|
|
7287
7330
|
orderIds = params.order_ids || params.orderIds || [];
|
|
7288
7331
|
if (!(!orderIds.length || params.submitBeforeSend)) {
|
|
7289
|
-
|
|
7332
|
+
_context72.next = 11;
|
|
7290
7333
|
break;
|
|
7291
7334
|
}
|
|
7292
|
-
|
|
7335
|
+
_context72.next = 6;
|
|
7293
7336
|
return this.submitSalesOrder({
|
|
7294
7337
|
smallTicketDataFlag: 1
|
|
7295
7338
|
});
|
|
7296
7339
|
case 6:
|
|
7297
|
-
submitResult =
|
|
7340
|
+
submitResult = _context72.sent;
|
|
7298
7341
|
orderId = (_ref56 = (_ref57 = (_submitResult$data$or = submitResult === null || submitResult === void 0 || (_submitResult$data = submitResult.data) === null || _submitResult$data === void 0 ? void 0 : _submitResult$data.order_id) !== null && _submitResult$data$or !== void 0 ? _submitResult$data$or : submitResult === null || submitResult === void 0 ? void 0 : submitResult.order_id) !== null && _ref57 !== void 0 ? _ref57 : submitResult === null || submitResult === void 0 || (_submitResult$data2 = submitResult.data) === null || _submitResult$data2 === void 0 ? void 0 : _submitResult$data2.id) !== null && _ref56 !== void 0 ? _ref56 : submitResult === null || submitResult === void 0 ? void 0 : submitResult.id;
|
|
7299
7342
|
if (orderId) {
|
|
7300
|
-
|
|
7343
|
+
_context72.next = 10;
|
|
7301
7344
|
break;
|
|
7302
7345
|
}
|
|
7303
7346
|
throw new Error('本地订单提交云端失败,无法发送支付链接');
|
|
7304
7347
|
case 10:
|
|
7305
7348
|
orderIds = [orderId];
|
|
7306
7349
|
case 11:
|
|
7307
|
-
return
|
|
7350
|
+
return _context72.abrupt("return", this.store.order.sendCustomerPayLink({
|
|
7308
7351
|
emails: params.emails,
|
|
7309
7352
|
notify_action: params.notify_action,
|
|
7310
7353
|
order_ids: orderIds
|
|
7311
7354
|
}));
|
|
7312
7355
|
case 12:
|
|
7313
7356
|
case "end":
|
|
7314
|
-
return
|
|
7357
|
+
return _context72.stop();
|
|
7315
7358
|
}
|
|
7316
|
-
},
|
|
7359
|
+
}, _callee72, this);
|
|
7317
7360
|
}));
|
|
7318
|
-
function sendCustomerPayLink(
|
|
7361
|
+
function sendCustomerPayLink(_x58) {
|
|
7319
7362
|
return _sendCustomerPayLink.apply(this, arguments);
|
|
7320
7363
|
}
|
|
7321
7364
|
return sendCustomerPayLink;
|
|
@@ -7330,14 +7373,14 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
7330
7373
|
}, {
|
|
7331
7374
|
key: "calculateVenueCatalogProductBookingPrice",
|
|
7332
7375
|
value: (function () {
|
|
7333
|
-
var _calculateVenueCatalogProductBookingPrice = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
|
7376
|
+
var _calculateVenueCatalogProductBookingPrice = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee73(params, source) {
|
|
7334
7377
|
var _params$customer_id;
|
|
7335
7378
|
var customerId, channel, queryPayload, authoritativeProduct;
|
|
7336
|
-
return _regeneratorRuntime().wrap(function
|
|
7337
|
-
while (1) switch (
|
|
7379
|
+
return _regeneratorRuntime().wrap(function _callee73$(_context73) {
|
|
7380
|
+
while (1) switch (_context73.prev = _context73.next) {
|
|
7338
7381
|
case 0:
|
|
7339
7382
|
customerId = (_params$customer_id = params.customer_id) !== null && _params$customer_id !== void 0 ? _params$customer_id : this.getCurrentOrderCustomerId();
|
|
7340
|
-
|
|
7383
|
+
_context73.next = 3;
|
|
7341
7384
|
return this.prepareProductPriceQueryContext(customerId);
|
|
7342
7385
|
case 3:
|
|
7343
7386
|
channel = this.getPriceQueryChannel(params.channel);
|
|
@@ -7354,14 +7397,14 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
7354
7397
|
queryPayload: queryPayload
|
|
7355
7398
|
});
|
|
7356
7399
|
if (authoritativeProduct) {
|
|
7357
|
-
|
|
7400
|
+
_context73.next = 8;
|
|
7358
7401
|
break;
|
|
7359
7402
|
}
|
|
7360
7403
|
throw Object.assign(new Error('Complete product pricing rules are not ready. Please retry.'), {
|
|
7361
7404
|
code: 'VENUE_LOCAL_PRICE_UNAVAILABLE'
|
|
7362
7405
|
});
|
|
7363
7406
|
case 8:
|
|
7364
|
-
return
|
|
7407
|
+
return _context73.abrupt("return", calculateBaseSalesProductBookingPrice(_objectSpread(_objectSpread({}, params), {}, {
|
|
7365
7408
|
channel: channel,
|
|
7366
7409
|
customer_id: customerId,
|
|
7367
7410
|
product: this.mergeProductForPriceQuery(params.product, authoritativeProduct),
|
|
@@ -7370,11 +7413,11 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
7370
7413
|
})));
|
|
7371
7414
|
case 9:
|
|
7372
7415
|
case "end":
|
|
7373
|
-
return
|
|
7416
|
+
return _context73.stop();
|
|
7374
7417
|
}
|
|
7375
|
-
},
|
|
7418
|
+
}, _callee73, this);
|
|
7376
7419
|
}));
|
|
7377
|
-
function calculateVenueCatalogProductBookingPrice(
|
|
7420
|
+
function calculateVenueCatalogProductBookingPrice(_x59, _x60) {
|
|
7378
7421
|
return _calculateVenueCatalogProductBookingPrice.apply(this, arguments);
|
|
7379
7422
|
}
|
|
7380
7423
|
return calculateVenueCatalogProductBookingPrice;
|
|
@@ -7382,25 +7425,25 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
7382
7425
|
}, {
|
|
7383
7426
|
key: "calculateProductBookingPrice",
|
|
7384
7427
|
value: function () {
|
|
7385
|
-
var _calculateProductBookingPrice = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
|
7428
|
+
var _calculateProductBookingPrice = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee74(params) {
|
|
7386
7429
|
var _yield$this$calculate, _yield$this$calculate2, result;
|
|
7387
|
-
return _regeneratorRuntime().wrap(function
|
|
7388
|
-
while (1) switch (
|
|
7430
|
+
return _regeneratorRuntime().wrap(function _callee74$(_context74) {
|
|
7431
|
+
while (1) switch (_context74.prev = _context74.next) {
|
|
7389
7432
|
case 0:
|
|
7390
|
-
|
|
7433
|
+
_context74.next = 2;
|
|
7391
7434
|
return this.calculateProductBookingPrices([params]);
|
|
7392
7435
|
case 2:
|
|
7393
|
-
_yield$this$calculate =
|
|
7436
|
+
_yield$this$calculate = _context74.sent;
|
|
7394
7437
|
_yield$this$calculate2 = _slicedToArray(_yield$this$calculate, 1);
|
|
7395
7438
|
result = _yield$this$calculate2[0];
|
|
7396
|
-
return
|
|
7439
|
+
return _context74.abrupt("return", result);
|
|
7397
7440
|
case 6:
|
|
7398
7441
|
case "end":
|
|
7399
|
-
return
|
|
7442
|
+
return _context74.stop();
|
|
7400
7443
|
}
|
|
7401
|
-
},
|
|
7444
|
+
}, _callee74, this);
|
|
7402
7445
|
}));
|
|
7403
|
-
function calculateProductBookingPrice(
|
|
7446
|
+
function calculateProductBookingPrice(_x61) {
|
|
7404
7447
|
return _calculateProductBookingPrice.apply(this, arguments);
|
|
7405
7448
|
}
|
|
7406
7449
|
return calculateProductBookingPrice;
|
|
@@ -7484,18 +7527,18 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
7484
7527
|
}, {
|
|
7485
7528
|
key: "resolveProductBookingPriceGroups",
|
|
7486
7529
|
value: function () {
|
|
7487
|
-
var _resolveProductBookingPriceGroups = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
|
7530
|
+
var _resolveProductBookingPriceGroups = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee76(paramsList, currentOrderCustomerId) {
|
|
7488
7531
|
var _this25 = this,
|
|
7489
|
-
_this$
|
|
7532
|
+
_this$otherParams46;
|
|
7490
7533
|
var strictDurationPricing,
|
|
7491
7534
|
resolvedChannels,
|
|
7492
7535
|
authoritativeProducts,
|
|
7493
7536
|
groups,
|
|
7494
|
-
|
|
7495
|
-
return _regeneratorRuntime().wrap(function
|
|
7496
|
-
while (1) switch (
|
|
7537
|
+
_args76 = arguments;
|
|
7538
|
+
return _regeneratorRuntime().wrap(function _callee76$(_context76) {
|
|
7539
|
+
while (1) switch (_context76.prev = _context76.next) {
|
|
7497
7540
|
case 0:
|
|
7498
|
-
strictDurationPricing =
|
|
7541
|
+
strictDurationPricing = _args76.length > 2 && _args76[2] !== undefined ? _args76[2] : false;
|
|
7499
7542
|
resolvedChannels = paramsList.map(function (params) {
|
|
7500
7543
|
return _this25.getPriceQueryChannel(params.channel);
|
|
7501
7544
|
});
|
|
@@ -7518,20 +7561,20 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
7518
7561
|
group.indices.push(index);
|
|
7519
7562
|
groups.set(groupKey, group);
|
|
7520
7563
|
});
|
|
7521
|
-
|
|
7564
|
+
_context76.next = 7;
|
|
7522
7565
|
return forEachPriceQueryGroup(Array.from(groups.values()), /*#__PURE__*/function () {
|
|
7523
|
-
var _ref58 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
|
7566
|
+
var _ref58 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee75(group) {
|
|
7524
7567
|
var priceQueries, resolvedProducts;
|
|
7525
|
-
return _regeneratorRuntime().wrap(function
|
|
7526
|
-
while (1) switch (
|
|
7568
|
+
return _regeneratorRuntime().wrap(function _callee75$(_context75) {
|
|
7569
|
+
while (1) switch (_context75.prev = _context75.next) {
|
|
7527
7570
|
case 0:
|
|
7528
|
-
|
|
7571
|
+
_context75.next = 2;
|
|
7529
7572
|
return _this25.prepareProductPriceQueryContext(group.customerId);
|
|
7530
7573
|
case 2:
|
|
7531
7574
|
priceQueries = group.indices.map(function (index) {
|
|
7532
7575
|
return paramsList[index];
|
|
7533
7576
|
});
|
|
7534
|
-
|
|
7577
|
+
_context75.next = 5;
|
|
7535
7578
|
return _this25.resolveProductsForPriceQuery({
|
|
7536
7579
|
priceQueries: priceQueries,
|
|
7537
7580
|
schedule: group.schedule,
|
|
@@ -7540,29 +7583,29 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
7540
7583
|
strictDurationPricing: strictDurationPricing
|
|
7541
7584
|
});
|
|
7542
7585
|
case 5:
|
|
7543
|
-
resolvedProducts =
|
|
7586
|
+
resolvedProducts = _context75.sent;
|
|
7544
7587
|
group.indices.forEach(function (originalIndex, groupIndex) {
|
|
7545
7588
|
authoritativeProducts[originalIndex] = resolvedProducts[groupIndex] || null;
|
|
7546
7589
|
});
|
|
7547
7590
|
case 7:
|
|
7548
7591
|
case "end":
|
|
7549
|
-
return
|
|
7592
|
+
return _context75.stop();
|
|
7550
7593
|
}
|
|
7551
|
-
},
|
|
7594
|
+
}, _callee75);
|
|
7552
7595
|
}));
|
|
7553
|
-
return function (
|
|
7596
|
+
return function (_x64) {
|
|
7554
7597
|
return _ref58.apply(this, arguments);
|
|
7555
7598
|
};
|
|
7556
|
-
}(), normalizeRuntimePlatform((_this$
|
|
7599
|
+
}(), normalizeRuntimePlatform((_this$otherParams46 = this.otherParams) === null || _this$otherParams46 === void 0 ? void 0 : _this$otherParams46.platform) === 'pos' ? 4 : groups.size);
|
|
7557
7600
|
case 7:
|
|
7558
|
-
return
|
|
7601
|
+
return _context76.abrupt("return", authoritativeProducts);
|
|
7559
7602
|
case 8:
|
|
7560
7603
|
case "end":
|
|
7561
|
-
return
|
|
7604
|
+
return _context76.stop();
|
|
7562
7605
|
}
|
|
7563
|
-
},
|
|
7606
|
+
}, _callee76, this);
|
|
7564
7607
|
}));
|
|
7565
|
-
function resolveProductBookingPriceGroups(
|
|
7608
|
+
function resolveProductBookingPriceGroups(_x62, _x63) {
|
|
7566
7609
|
return _resolveProductBookingPriceGroups.apply(this, arguments);
|
|
7567
7610
|
}
|
|
7568
7611
|
return resolveProductBookingPriceGroups;
|
|
@@ -7570,34 +7613,34 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
7570
7613
|
}, {
|
|
7571
7614
|
key: "calculateProductBookingPrices",
|
|
7572
7615
|
value: function () {
|
|
7573
|
-
var _calculateProductBookingPrices = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
|
7574
|
-
var _this$
|
|
7616
|
+
var _calculateProductBookingPrices = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee77(paramsList) {
|
|
7617
|
+
var _this$otherParams47,
|
|
7575
7618
|
_this26 = this;
|
|
7576
7619
|
var useCustomerUserPricing, isPos, quotation, currentOrderCustomerId, resolvedChannels, authoritativeProducts, plans, segmentQueries, segmentQueryIndices, segmentProducts, quotationContexts;
|
|
7577
|
-
return _regeneratorRuntime().wrap(function
|
|
7578
|
-
while (1) switch (
|
|
7620
|
+
return _regeneratorRuntime().wrap(function _callee77$(_context77) {
|
|
7621
|
+
while (1) switch (_context77.prev = _context77.next) {
|
|
7579
7622
|
case 0:
|
|
7580
7623
|
if (paramsList.length) {
|
|
7581
|
-
|
|
7624
|
+
_context77.next = 2;
|
|
7582
7625
|
break;
|
|
7583
7626
|
}
|
|
7584
|
-
return
|
|
7627
|
+
return _context77.abrupt("return", []);
|
|
7585
7628
|
case 2:
|
|
7586
7629
|
useCustomerUserPricing = this.isCustomerUserPriceQuery();
|
|
7587
|
-
isPos = normalizeRuntimePlatform((_this$
|
|
7630
|
+
isPos = normalizeRuntimePlatform((_this$otherParams47 = this.otherParams) === null || _this$otherParams47 === void 0 ? void 0 : _this$otherParams47.platform) === 'pos';
|
|
7588
7631
|
quotation = useCustomerUserPricing ? undefined : this.store.quotation;
|
|
7589
7632
|
currentOrderCustomerId = this.getCurrentOrderCustomerId();
|
|
7590
7633
|
resolvedChannels = paramsList.map(function (params) {
|
|
7591
7634
|
return _this26.getPriceQueryChannel(params.channel);
|
|
7592
7635
|
});
|
|
7593
|
-
|
|
7636
|
+
_context77.next = 9;
|
|
7594
7637
|
return this.resolveProductBookingPriceGroups(paramsList, currentOrderCustomerId);
|
|
7595
7638
|
case 9:
|
|
7596
|
-
authoritativeProducts =
|
|
7639
|
+
authoritativeProducts = _context77.sent;
|
|
7597
7640
|
if (!paramsList.some(function (params, index) {
|
|
7598
7641
|
return params.requireAuthoritativePrice && !authoritativeProducts[index];
|
|
7599
7642
|
})) {
|
|
7600
|
-
|
|
7643
|
+
_context77.next = 12;
|
|
7601
7644
|
break;
|
|
7602
7645
|
}
|
|
7603
7646
|
throw new Error('The current customer product price is unavailable. Please retry before paying.');
|
|
@@ -7631,20 +7674,20 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
7631
7674
|
return queryIndex;
|
|
7632
7675
|
})) || [];
|
|
7633
7676
|
});
|
|
7634
|
-
|
|
7677
|
+
_context77.next = 17;
|
|
7635
7678
|
return this.resolveProductBookingPriceGroups(segmentQueries, currentOrderCustomerId, true);
|
|
7636
7679
|
case 17:
|
|
7637
|
-
segmentProducts =
|
|
7680
|
+
segmentProducts = _context77.sent;
|
|
7638
7681
|
if (!segmentProducts.some(function (product) {
|
|
7639
7682
|
return !product;
|
|
7640
7683
|
})) {
|
|
7641
|
-
|
|
7684
|
+
_context77.next = 20;
|
|
7642
7685
|
break;
|
|
7643
7686
|
}
|
|
7644
7687
|
throw durationPricingUnavailable('An authoritative product is missing for a billing unit.');
|
|
7645
7688
|
case 20:
|
|
7646
7689
|
if (useCustomerUserPricing) {
|
|
7647
|
-
|
|
7690
|
+
_context77.next = 25;
|
|
7648
7691
|
break;
|
|
7649
7692
|
}
|
|
7650
7693
|
quotationContexts = new Map();
|
|
@@ -7659,14 +7702,14 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
7659
7702
|
customer_id: (_params$customer_id3 = params.customer_id) !== null && _params$customer_id3 !== void 0 ? _params$customer_id3 : currentOrderCustomerId
|
|
7660
7703
|
});
|
|
7661
7704
|
});
|
|
7662
|
-
|
|
7705
|
+
_context77.next = 25;
|
|
7663
7706
|
return Promise.all(Array.from(quotationContexts.values()).map(function (context) {
|
|
7664
7707
|
return _this26.loadQuotationForPriceQuery(_objectSpread({
|
|
7665
7708
|
quotation: quotation
|
|
7666
7709
|
}, context));
|
|
7667
7710
|
}));
|
|
7668
7711
|
case 25:
|
|
7669
|
-
return
|
|
7712
|
+
return _context77.abrupt("return", paramsList.map(function (params, index) {
|
|
7670
7713
|
var _params$customer_id4, _authoritativeProduct2, _params$duration;
|
|
7671
7714
|
var productInput = params.product || {};
|
|
7672
7715
|
var authoritativeProduct = authoritativeProducts[index];
|
|
@@ -7718,11 +7761,11 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
7718
7761
|
}));
|
|
7719
7762
|
case 26:
|
|
7720
7763
|
case "end":
|
|
7721
|
-
return
|
|
7764
|
+
return _context77.stop();
|
|
7722
7765
|
}
|
|
7723
|
-
},
|
|
7766
|
+
}, _callee77, this);
|
|
7724
7767
|
}));
|
|
7725
|
-
function calculateProductBookingPrices(
|
|
7768
|
+
function calculateProductBookingPrices(_x65) {
|
|
7726
7769
|
return _calculateProductBookingPrices.apply(this, arguments);
|
|
7727
7770
|
}
|
|
7728
7771
|
return calculateProductBookingPrices;
|
|
@@ -7742,47 +7785,47 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
7742
7785
|
}, {
|
|
7743
7786
|
key: "addProductToOrder",
|
|
7744
7787
|
value: function () {
|
|
7745
|
-
var _addProductToOrder = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
|
7788
|
+
var _addProductToOrder = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee78(product, booking, options) {
|
|
7746
7789
|
var products;
|
|
7747
|
-
return _regeneratorRuntime().wrap(function
|
|
7748
|
-
while (1) switch (
|
|
7790
|
+
return _regeneratorRuntime().wrap(function _callee78$(_context78) {
|
|
7791
|
+
while (1) switch (_context78.prev = _context78.next) {
|
|
7749
7792
|
case 0:
|
|
7750
|
-
|
|
7793
|
+
_context78.prev = 0;
|
|
7751
7794
|
if (this.store.order) {
|
|
7752
|
-
|
|
7795
|
+
_context78.next = 3;
|
|
7753
7796
|
break;
|
|
7754
7797
|
}
|
|
7755
7798
|
throw new Error('order 模块未初始化');
|
|
7756
7799
|
case 3:
|
|
7757
7800
|
if (!(options === undefined)) {
|
|
7758
|
-
|
|
7801
|
+
_context78.next = 9;
|
|
7759
7802
|
break;
|
|
7760
7803
|
}
|
|
7761
|
-
|
|
7804
|
+
_context78.next = 6;
|
|
7762
7805
|
return this.store.order.addProductToOrder(product, booking);
|
|
7763
7806
|
case 6:
|
|
7764
|
-
|
|
7765
|
-
|
|
7807
|
+
_context78.t0 = _context78.sent;
|
|
7808
|
+
_context78.next = 12;
|
|
7766
7809
|
break;
|
|
7767
7810
|
case 9:
|
|
7768
|
-
|
|
7811
|
+
_context78.next = 11;
|
|
7769
7812
|
return this.store.order.addProductToOrder(product, booking, options);
|
|
7770
7813
|
case 11:
|
|
7771
|
-
|
|
7814
|
+
_context78.t0 = _context78.sent;
|
|
7772
7815
|
case 12:
|
|
7773
|
-
products =
|
|
7774
|
-
return
|
|
7816
|
+
products = _context78.t0;
|
|
7817
|
+
return _context78.abrupt("return", products);
|
|
7775
7818
|
case 16:
|
|
7776
|
-
|
|
7777
|
-
|
|
7778
|
-
throw
|
|
7819
|
+
_context78.prev = 16;
|
|
7820
|
+
_context78.t1 = _context78["catch"](0);
|
|
7821
|
+
throw _context78.t1;
|
|
7779
7822
|
case 19:
|
|
7780
7823
|
case "end":
|
|
7781
|
-
return
|
|
7824
|
+
return _context78.stop();
|
|
7782
7825
|
}
|
|
7783
|
-
},
|
|
7826
|
+
}, _callee78, this, [[0, 16]]);
|
|
7784
7827
|
}));
|
|
7785
|
-
function addProductToOrder(
|
|
7828
|
+
function addProductToOrder(_x66, _x67, _x68) {
|
|
7786
7829
|
return _addProductToOrder.apply(this, arguments);
|
|
7787
7830
|
}
|
|
7788
7831
|
return addProductToOrder;
|
|
@@ -7790,34 +7833,34 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
7790
7833
|
}, {
|
|
7791
7834
|
key: "updateOrderProduct",
|
|
7792
7835
|
value: function () {
|
|
7793
|
-
var _updateOrderProduct = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
|
7836
|
+
var _updateOrderProduct = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee79(params) {
|
|
7794
7837
|
var products;
|
|
7795
|
-
return _regeneratorRuntime().wrap(function
|
|
7796
|
-
while (1) switch (
|
|
7838
|
+
return _regeneratorRuntime().wrap(function _callee79$(_context79) {
|
|
7839
|
+
while (1) switch (_context79.prev = _context79.next) {
|
|
7797
7840
|
case 0:
|
|
7798
|
-
|
|
7841
|
+
_context79.prev = 0;
|
|
7799
7842
|
if (this.store.order) {
|
|
7800
|
-
|
|
7843
|
+
_context79.next = 3;
|
|
7801
7844
|
break;
|
|
7802
7845
|
}
|
|
7803
7846
|
throw new Error('order 模块未初始化');
|
|
7804
7847
|
case 3:
|
|
7805
|
-
|
|
7848
|
+
_context79.next = 5;
|
|
7806
7849
|
return this.store.order.updateOrderProduct(params);
|
|
7807
7850
|
case 5:
|
|
7808
|
-
products =
|
|
7809
|
-
return
|
|
7851
|
+
products = _context79.sent;
|
|
7852
|
+
return _context79.abrupt("return", products);
|
|
7810
7853
|
case 9:
|
|
7811
|
-
|
|
7812
|
-
|
|
7813
|
-
throw
|
|
7854
|
+
_context79.prev = 9;
|
|
7855
|
+
_context79.t0 = _context79["catch"](0);
|
|
7856
|
+
throw _context79.t0;
|
|
7814
7857
|
case 12:
|
|
7815
7858
|
case "end":
|
|
7816
|
-
return
|
|
7859
|
+
return _context79.stop();
|
|
7817
7860
|
}
|
|
7818
|
-
},
|
|
7861
|
+
}, _callee79, this, [[0, 9]]);
|
|
7819
7862
|
}));
|
|
7820
|
-
function updateOrderProduct(
|
|
7863
|
+
function updateOrderProduct(_x69) {
|
|
7821
7864
|
return _updateOrderProduct.apply(this, arguments);
|
|
7822
7865
|
}
|
|
7823
7866
|
return updateOrderProduct;
|
|
@@ -7825,34 +7868,34 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
7825
7868
|
}, {
|
|
7826
7869
|
key: "updateOrderProducts",
|
|
7827
7870
|
value: function () {
|
|
7828
|
-
var _updateOrderProducts = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
|
7871
|
+
var _updateOrderProducts = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee80(paramsList, options) {
|
|
7829
7872
|
var products;
|
|
7830
|
-
return _regeneratorRuntime().wrap(function
|
|
7831
|
-
while (1) switch (
|
|
7873
|
+
return _regeneratorRuntime().wrap(function _callee80$(_context80) {
|
|
7874
|
+
while (1) switch (_context80.prev = _context80.next) {
|
|
7832
7875
|
case 0:
|
|
7833
|
-
|
|
7876
|
+
_context80.prev = 0;
|
|
7834
7877
|
if (this.store.order) {
|
|
7835
|
-
|
|
7878
|
+
_context80.next = 3;
|
|
7836
7879
|
break;
|
|
7837
7880
|
}
|
|
7838
7881
|
throw new Error('order 模块未初始化');
|
|
7839
7882
|
case 3:
|
|
7840
|
-
|
|
7883
|
+
_context80.next = 5;
|
|
7841
7884
|
return this.store.order.updateOrderProducts(paramsList, options);
|
|
7842
7885
|
case 5:
|
|
7843
|
-
products =
|
|
7844
|
-
return
|
|
7886
|
+
products = _context80.sent;
|
|
7887
|
+
return _context80.abrupt("return", products);
|
|
7845
7888
|
case 9:
|
|
7846
|
-
|
|
7847
|
-
|
|
7848
|
-
throw
|
|
7889
|
+
_context80.prev = 9;
|
|
7890
|
+
_context80.t0 = _context80["catch"](0);
|
|
7891
|
+
throw _context80.t0;
|
|
7849
7892
|
case 12:
|
|
7850
7893
|
case "end":
|
|
7851
|
-
return
|
|
7894
|
+
return _context80.stop();
|
|
7852
7895
|
}
|
|
7853
|
-
},
|
|
7896
|
+
}, _callee80, this, [[0, 9]]);
|
|
7854
7897
|
}));
|
|
7855
|
-
function updateOrderProducts(
|
|
7898
|
+
function updateOrderProducts(_x70, _x71) {
|
|
7856
7899
|
return _updateOrderProducts.apply(this, arguments);
|
|
7857
7900
|
}
|
|
7858
7901
|
return updateOrderProducts;
|
|
@@ -7860,34 +7903,34 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
7860
7903
|
}, {
|
|
7861
7904
|
key: "updateOrderProductQuantity",
|
|
7862
7905
|
value: function () {
|
|
7863
|
-
var _updateOrderProductQuantity = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
|
7906
|
+
var _updateOrderProductQuantity = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee81(params) {
|
|
7864
7907
|
var products;
|
|
7865
|
-
return _regeneratorRuntime().wrap(function
|
|
7866
|
-
while (1) switch (
|
|
7908
|
+
return _regeneratorRuntime().wrap(function _callee81$(_context81) {
|
|
7909
|
+
while (1) switch (_context81.prev = _context81.next) {
|
|
7867
7910
|
case 0:
|
|
7868
|
-
|
|
7911
|
+
_context81.prev = 0;
|
|
7869
7912
|
if (this.store.order) {
|
|
7870
|
-
|
|
7913
|
+
_context81.next = 3;
|
|
7871
7914
|
break;
|
|
7872
7915
|
}
|
|
7873
7916
|
throw new Error('order 模块未初始化');
|
|
7874
7917
|
case 3:
|
|
7875
|
-
|
|
7918
|
+
_context81.next = 5;
|
|
7876
7919
|
return this.store.order.updateOrderProductQuantity(params);
|
|
7877
7920
|
case 5:
|
|
7878
|
-
products =
|
|
7879
|
-
return
|
|
7921
|
+
products = _context81.sent;
|
|
7922
|
+
return _context81.abrupt("return", products);
|
|
7880
7923
|
case 9:
|
|
7881
|
-
|
|
7882
|
-
|
|
7883
|
-
throw
|
|
7924
|
+
_context81.prev = 9;
|
|
7925
|
+
_context81.t0 = _context81["catch"](0);
|
|
7926
|
+
throw _context81.t0;
|
|
7884
7927
|
case 12:
|
|
7885
7928
|
case "end":
|
|
7886
|
-
return
|
|
7929
|
+
return _context81.stop();
|
|
7887
7930
|
}
|
|
7888
|
-
},
|
|
7931
|
+
}, _callee81, this, [[0, 9]]);
|
|
7889
7932
|
}));
|
|
7890
|
-
function updateOrderProductQuantity(
|
|
7933
|
+
function updateOrderProductQuantity(_x72) {
|
|
7891
7934
|
return _updateOrderProductQuantity.apply(this, arguments);
|
|
7892
7935
|
}
|
|
7893
7936
|
return updateOrderProductQuantity;
|
|
@@ -7910,12 +7953,12 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
7910
7953
|
}, {
|
|
7911
7954
|
key: "setOrderProductLineNote",
|
|
7912
7955
|
value: (function () {
|
|
7913
|
-
var _setOrderProductLineNote = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
|
7956
|
+
var _setOrderProductLineNote = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee82(identity, note) {
|
|
7914
7957
|
var params, products;
|
|
7915
|
-
return _regeneratorRuntime().wrap(function
|
|
7916
|
-
while (1) switch (
|
|
7958
|
+
return _regeneratorRuntime().wrap(function _callee82$(_context82) {
|
|
7959
|
+
while (1) switch (_context82.prev = _context82.next) {
|
|
7917
7960
|
case 0:
|
|
7918
|
-
|
|
7961
|
+
_context82.prev = 0;
|
|
7919
7962
|
params = {
|
|
7920
7963
|
product_id: identity.product_id,
|
|
7921
7964
|
product_variant_id: identity.product_variant_id,
|
|
@@ -7930,22 +7973,22 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
7930
7973
|
params.product_sku = identity.product_sku;
|
|
7931
7974
|
}
|
|
7932
7975
|
if (identity.product_bundle !== undefined) params.product_bundle = identity.product_bundle;
|
|
7933
|
-
|
|
7976
|
+
_context82.next = 7;
|
|
7934
7977
|
return this.updateOrderProduct(params);
|
|
7935
7978
|
case 7:
|
|
7936
|
-
products =
|
|
7937
|
-
return
|
|
7979
|
+
products = _context82.sent;
|
|
7980
|
+
return _context82.abrupt("return", products);
|
|
7938
7981
|
case 11:
|
|
7939
|
-
|
|
7940
|
-
|
|
7941
|
-
throw
|
|
7982
|
+
_context82.prev = 11;
|
|
7983
|
+
_context82.t0 = _context82["catch"](0);
|
|
7984
|
+
throw _context82.t0;
|
|
7942
7985
|
case 14:
|
|
7943
7986
|
case "end":
|
|
7944
|
-
return
|
|
7987
|
+
return _context82.stop();
|
|
7945
7988
|
}
|
|
7946
|
-
},
|
|
7989
|
+
}, _callee82, this, [[0, 11]]);
|
|
7947
7990
|
}));
|
|
7948
|
-
function setOrderProductLineNote(
|
|
7991
|
+
function setOrderProductLineNote(_x73, _x74) {
|
|
7949
7992
|
return _setOrderProductLineNote.apply(this, arguments);
|
|
7950
7993
|
}
|
|
7951
7994
|
return setOrderProductLineNote;
|
|
@@ -7960,45 +8003,45 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
7960
8003
|
}, {
|
|
7961
8004
|
key: "removeProductsFromOrder",
|
|
7962
8005
|
value: (function () {
|
|
7963
|
-
var _removeProductsFromOrder = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
|
7964
|
-
return _regeneratorRuntime().wrap(function
|
|
7965
|
-
while (1) switch (
|
|
8006
|
+
var _removeProductsFromOrder = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee83(identities, options) {
|
|
8007
|
+
return _regeneratorRuntime().wrap(function _callee83$(_context83) {
|
|
8008
|
+
while (1) switch (_context83.prev = _context83.next) {
|
|
7966
8009
|
case 0:
|
|
7967
|
-
|
|
8010
|
+
_context83.prev = 0;
|
|
7968
8011
|
if (this.store.order) {
|
|
7969
|
-
|
|
8012
|
+
_context83.next = 3;
|
|
7970
8013
|
break;
|
|
7971
8014
|
}
|
|
7972
8015
|
throw new Error('order 模块未初始化');
|
|
7973
8016
|
case 3:
|
|
7974
8017
|
if (!(options === undefined)) {
|
|
7975
|
-
|
|
8018
|
+
_context83.next = 9;
|
|
7976
8019
|
break;
|
|
7977
8020
|
}
|
|
7978
|
-
|
|
8021
|
+
_context83.next = 6;
|
|
7979
8022
|
return this.store.order.removeProductsFromOrder(identities);
|
|
7980
8023
|
case 6:
|
|
7981
|
-
|
|
7982
|
-
|
|
8024
|
+
_context83.t0 = _context83.sent;
|
|
8025
|
+
_context83.next = 12;
|
|
7983
8026
|
break;
|
|
7984
8027
|
case 9:
|
|
7985
|
-
|
|
8028
|
+
_context83.next = 11;
|
|
7986
8029
|
return this.store.order.removeProductsFromOrder(identities, options);
|
|
7987
8030
|
case 11:
|
|
7988
|
-
|
|
8031
|
+
_context83.t0 = _context83.sent;
|
|
7989
8032
|
case 12:
|
|
7990
|
-
return
|
|
8033
|
+
return _context83.abrupt("return", _context83.t0);
|
|
7991
8034
|
case 15:
|
|
7992
|
-
|
|
7993
|
-
|
|
7994
|
-
throw
|
|
8035
|
+
_context83.prev = 15;
|
|
8036
|
+
_context83.t1 = _context83["catch"](0);
|
|
8037
|
+
throw _context83.t1;
|
|
7995
8038
|
case 18:
|
|
7996
8039
|
case "end":
|
|
7997
|
-
return
|
|
8040
|
+
return _context83.stop();
|
|
7998
8041
|
}
|
|
7999
|
-
},
|
|
8042
|
+
}, _callee83, this, [[0, 15]]);
|
|
8000
8043
|
}));
|
|
8001
|
-
function removeProductsFromOrder(
|
|
8044
|
+
function removeProductsFromOrder(_x75, _x76) {
|
|
8002
8045
|
return _removeProductsFromOrder.apply(this, arguments);
|
|
8003
8046
|
}
|
|
8004
8047
|
return removeProductsFromOrder;
|
|
@@ -8006,18 +8049,18 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
8006
8049
|
}, {
|
|
8007
8050
|
key: "removeProductFromOrder",
|
|
8008
8051
|
value: function () {
|
|
8009
|
-
var _removeProductFromOrder = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
|
8010
|
-
return _regeneratorRuntime().wrap(function
|
|
8011
|
-
while (1) switch (
|
|
8052
|
+
var _removeProductFromOrder = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee84(identity, options) {
|
|
8053
|
+
return _regeneratorRuntime().wrap(function _callee84$(_context84) {
|
|
8054
|
+
while (1) switch (_context84.prev = _context84.next) {
|
|
8012
8055
|
case 0:
|
|
8013
|
-
return
|
|
8056
|
+
return _context84.abrupt("return", this.removeProductsFromOrder([identity], options));
|
|
8014
8057
|
case 1:
|
|
8015
8058
|
case "end":
|
|
8016
|
-
return
|
|
8059
|
+
return _context84.stop();
|
|
8017
8060
|
}
|
|
8018
|
-
},
|
|
8061
|
+
}, _callee84, this);
|
|
8019
8062
|
}));
|
|
8020
|
-
function removeProductFromOrder(
|
|
8063
|
+
function removeProductFromOrder(_x77, _x78) {
|
|
8021
8064
|
return _removeProductFromOrder.apply(this, arguments);
|
|
8022
8065
|
}
|
|
8023
8066
|
return removeProductFromOrder;
|
|
@@ -8067,23 +8110,23 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
8067
8110
|
}, {
|
|
8068
8111
|
key: "applyPromotion",
|
|
8069
8112
|
value: (function () {
|
|
8070
|
-
var _applyPromotion = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
|
8071
|
-
return _regeneratorRuntime().wrap(function
|
|
8072
|
-
while (1) switch (
|
|
8113
|
+
var _applyPromotion = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee85() {
|
|
8114
|
+
return _regeneratorRuntime().wrap(function _callee85$(_context85) {
|
|
8115
|
+
while (1) switch (_context85.prev = _context85.next) {
|
|
8073
8116
|
case 0:
|
|
8074
8117
|
if (this.store.order) {
|
|
8075
|
-
|
|
8118
|
+
_context85.next = 2;
|
|
8076
8119
|
break;
|
|
8077
8120
|
}
|
|
8078
8121
|
throw new Error('order 模块未初始化');
|
|
8079
8122
|
case 2:
|
|
8080
|
-
|
|
8123
|
+
_context85.next = 4;
|
|
8081
8124
|
return this.store.order.applyPromotion();
|
|
8082
8125
|
case 4:
|
|
8083
8126
|
case "end":
|
|
8084
|
-
return
|
|
8127
|
+
return _context85.stop();
|
|
8085
8128
|
}
|
|
8086
|
-
},
|
|
8129
|
+
}, _callee85, this);
|
|
8087
8130
|
}));
|
|
8088
8131
|
function applyPromotion() {
|
|
8089
8132
|
return _applyPromotion.apply(this, arguments);
|
|
@@ -8110,18 +8153,18 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
8110
8153
|
}, {
|
|
8111
8154
|
key: "getProductList",
|
|
8112
8155
|
value: function () {
|
|
8113
|
-
var _getProductList = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
|
8114
|
-
var _this$
|
|
8156
|
+
var _getProductList = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee86() {
|
|
8157
|
+
var _this$otherParams48;
|
|
8115
8158
|
var menu_list_ids, _this$store$products, res;
|
|
8116
|
-
return _regeneratorRuntime().wrap(function
|
|
8117
|
-
while (1) switch (
|
|
8159
|
+
return _regeneratorRuntime().wrap(function _callee86$(_context86) {
|
|
8160
|
+
while (1) switch (_context86.prev = _context86.next) {
|
|
8118
8161
|
case 0:
|
|
8119
8162
|
// 可以直接通过配置里的 menu 读取
|
|
8120
|
-
menu_list_ids = ((_this$
|
|
8163
|
+
menu_list_ids = ((_this$otherParams48 = this.otherParams) === null || _this$otherParams48 === void 0 || (_this$otherParams48 = _this$otherParams48.dineInConfig) === null || _this$otherParams48 === void 0 ? void 0 : _this$otherParams48['menu.associated_menus'].map(function (n) {
|
|
8121
8164
|
return Number(n.value);
|
|
8122
8165
|
})) || [];
|
|
8123
|
-
|
|
8124
|
-
|
|
8166
|
+
_context86.prev = 1;
|
|
8167
|
+
_context86.next = 4;
|
|
8125
8168
|
return (_this$store$products = this.store.products) === null || _this$store$products === void 0 ? void 0 : _this$store$products.loadProducts({
|
|
8126
8169
|
menu_list_ids: menu_list_ids,
|
|
8127
8170
|
cacheId: this.cacheId,
|
|
@@ -8129,17 +8172,17 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
8129
8172
|
schedule_datetime: dayjs().format('YYYY-MM-DD HH:mm:ss')
|
|
8130
8173
|
});
|
|
8131
8174
|
case 4:
|
|
8132
|
-
res =
|
|
8133
|
-
return
|
|
8175
|
+
res = _context86.sent;
|
|
8176
|
+
return _context86.abrupt("return", res);
|
|
8134
8177
|
case 8:
|
|
8135
|
-
|
|
8136
|
-
|
|
8137
|
-
throw
|
|
8178
|
+
_context86.prev = 8;
|
|
8179
|
+
_context86.t0 = _context86["catch"](1);
|
|
8180
|
+
throw _context86.t0;
|
|
8138
8181
|
case 11:
|
|
8139
8182
|
case "end":
|
|
8140
|
-
return
|
|
8183
|
+
return _context86.stop();
|
|
8141
8184
|
}
|
|
8142
|
-
},
|
|
8185
|
+
}, _callee86, this, [[1, 8]]);
|
|
8143
8186
|
}));
|
|
8144
8187
|
function getProductList() {
|
|
8145
8188
|
return _getProductList.apply(this, arguments);
|
|
@@ -8154,36 +8197,36 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
8154
8197
|
}, {
|
|
8155
8198
|
key: "setOtherParams",
|
|
8156
8199
|
value: function () {
|
|
8157
|
-
var _setOtherParams = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
|
8158
|
-
var _this$
|
|
8200
|
+
var _setOtherParams = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee87(params) {
|
|
8201
|
+
var _this$otherParams49;
|
|
8159
8202
|
var _ref59,
|
|
8160
8203
|
_ref59$cover,
|
|
8161
8204
|
cover,
|
|
8162
8205
|
previousPickupTimingScope,
|
|
8163
|
-
|
|
8164
|
-
return _regeneratorRuntime().wrap(function
|
|
8165
|
-
while (1) switch (
|
|
8206
|
+
_args87 = arguments;
|
|
8207
|
+
return _regeneratorRuntime().wrap(function _callee87$(_context87) {
|
|
8208
|
+
while (1) switch (_context87.prev = _context87.next) {
|
|
8166
8209
|
case 0:
|
|
8167
|
-
_ref59 =
|
|
8210
|
+
_ref59 = _args87.length > 1 && _args87[1] !== undefined ? _args87[1] : {}, _ref59$cover = _ref59.cover, cover = _ref59$cover === void 0 ? false : _ref59$cover;
|
|
8168
8211
|
previousPickupTimingScope = this.getPickupTimingScope();
|
|
8169
8212
|
if (cover) {
|
|
8170
8213
|
this.otherParams = _objectSpread({}, params);
|
|
8171
8214
|
} else {
|
|
8172
8215
|
this.otherParams = _objectSpread(_objectSpread({}, this.otherParams), params);
|
|
8173
8216
|
}
|
|
8174
|
-
this.cacheId = (_this$
|
|
8217
|
+
this.cacheId = (_this$otherParams49 = this.otherParams) === null || _this$otherParams49 === void 0 ? void 0 : _this$otherParams49.cacheId;
|
|
8175
8218
|
if (previousPickupTimingScope !== this.getPickupTimingScope()) this.resetPickupTimingCache();
|
|
8176
|
-
|
|
8219
|
+
_context87.next = 7;
|
|
8177
8220
|
return this.syncOtherParamsToSubModules(params, {
|
|
8178
8221
|
cover: cover
|
|
8179
8222
|
});
|
|
8180
8223
|
case 7:
|
|
8181
8224
|
case "end":
|
|
8182
|
-
return
|
|
8225
|
+
return _context87.stop();
|
|
8183
8226
|
}
|
|
8184
|
-
},
|
|
8227
|
+
}, _callee87, this);
|
|
8185
8228
|
}));
|
|
8186
|
-
function setOtherParams(
|
|
8229
|
+
function setOtherParams(_x79) {
|
|
8187
8230
|
return _setOtherParams.apply(this, arguments);
|
|
8188
8231
|
}
|
|
8189
8232
|
return setOtherParams;
|