@pisell/private-materials 6.12.157 → 6.12.158
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/build/lowcode/assets-daily.json +11 -11
- package/build/lowcode/assets-dev.json +2 -2
- package/build/lowcode/assets-prod.json +11 -11
- package/build/lowcode/meta.js +1 -1
- package/build/lowcode/preview.js +1 -1
- package/build/lowcode/render/default/view.js +6 -6
- package/build/lowcode/view.js +6 -6
- package/es/components/checkout/PaymentModal.js +552 -392
- package/es/components/checkout/components/PaymentOptionsModule/PaymentMethodItem.js +16 -8
- package/es/components/checkout/components/PaymentOptionsModule/index.js +2 -1
- package/es/components/checkout/components/SearchAndClientModule/index.js +12 -4
- package/es/components/checkout/hooks/useCheckoutPaymentScanActivity.js +80 -0
- package/es/components/checkout/hooks/useSharedWalletPass.js +54 -7
- package/es/components/checkout/hooks/useWalletPass.js +45 -7
- package/es/components/checkout/locales.js +15 -0
- package/es/components/checkout/paymentRuntime/PaymentMethodRuntime.js +35 -6
- package/es/components/pay/toB/components/EFTPOS/index.js +44 -7
- package/es/components/pay/toB/components/MX51/index.js +11 -1
- package/es/components/pay/toB/paymentMethods/index.js +31 -17
- package/es/plus/salesSdk/demo/hosts/legacyOpenProductDetail.js +1 -7
- package/lib/components/checkout/PaymentModal.js +552 -392
- package/lib/components/checkout/components/PaymentOptionsModule/PaymentMethodItem.js +16 -8
- package/lib/components/checkout/components/PaymentOptionsModule/index.js +2 -1
- package/lib/components/checkout/components/SearchAndClientModule/index.js +12 -4
- package/lib/components/checkout/hooks/useCheckoutPaymentScanActivity.js +81 -0
- package/lib/components/checkout/hooks/useSharedWalletPass.js +54 -7
- package/lib/components/checkout/hooks/useWalletPass.js +45 -7
- package/lib/components/checkout/locales.js +15 -0
- package/lib/components/checkout/paymentRuntime/PaymentMethodRuntime.js +35 -6
- package/lib/components/pay/toB/components/EFTPOS/index.js +44 -7
- package/lib/components/pay/toB/components/MX51/index.js +11 -1
- package/lib/components/pay/toB/paymentMethods/index.js +31 -17
- package/lib/plus/salesSdk/demo/hosts/legacyOpenProductDetail.js +1 -7
- package/package.json +3 -3
|
@@ -31,6 +31,7 @@ import SearchAndClientModule_default from "./components/SearchAndClientModule/in
|
|
|
31
31
|
import { findVoucherPaymentByIdAndStatus } from "./utils/voucherPayment.js";
|
|
32
32
|
import { usePaymentModalBaseSales } from "./hooks/usePaymentModalBaseSales.js";
|
|
33
33
|
import { useCustomerGuard } from "./hooks/useCustomerGuard.js";
|
|
34
|
+
import useCheckoutPaymentScanActivity from "./hooks/useCheckoutPaymentScanActivity.js";
|
|
34
35
|
import React, { forwardRef, useCallback, useEffect, useImperativeHandle, useMemo, useRef, useState } from "react";
|
|
35
36
|
import { Button } from "antd";
|
|
36
37
|
import { formatAmount, locales } from "@pisell/utils";
|
|
@@ -468,6 +469,8 @@ const PaymentContent = forwardRef(({ cartData, orderInfo, isModalOpen, onPayment
|
|
|
468
469
|
const [paymentOptionsTitle, setPaymentOptionsTitle] = useState(locales.getText("cards.and.digitals") || "Cards & Digitals");
|
|
469
470
|
useOsKey();
|
|
470
471
|
const paymentChannel = useMemo(() => String((getData === null || getData === void 0 ? void 0 : getData("channel")) || "pos").trim().toLowerCase(), [getData]);
|
|
472
|
+
const paymentScanActivity = useCheckoutPaymentScanActivity(paymentChannel === "kiosk");
|
|
473
|
+
const activeKioskPaymentActivityRef = useRef();
|
|
471
474
|
const paymentOptionList = useMemo(() => {
|
|
472
475
|
return paymentMethods.filter((item) => {
|
|
473
476
|
var _item$channel_applica;
|
|
@@ -528,6 +531,98 @@ const PaymentContent = forwardRef(({ cartData, orderInfo, isModalOpen, onPayment
|
|
|
528
531
|
const isPriceAdjustEnabled = (config === null || config === void 0 ? void 0 : config.enablePriceAdjust) !== false;
|
|
529
532
|
const [priceAdjustProductExpectAmount, setPriceAdjustProductExpectAmount] = useState();
|
|
530
533
|
const logger = usePaymentLogger();
|
|
534
|
+
const notifyScanBlockedByPayment = useMemoizedFn(() => {
|
|
535
|
+
var _Toast$info;
|
|
536
|
+
Toast === null || Toast === void 0 || (_Toast$info = Toast.info) === null || _Toast$info === void 0 || _Toast$info.call(Toast, locales.getText("pisell2.checkout.scan-blocked-by-payment"));
|
|
537
|
+
});
|
|
538
|
+
const notifyPaymentBlockedByScan = useMemoizedFn(() => {
|
|
539
|
+
var _Toast$info2;
|
|
540
|
+
Toast === null || Toast === void 0 || (_Toast$info2 = Toast.info) === null || _Toast$info2 === void 0 || _Toast$info2.call(Toast, locales.getText("pisell2.checkout.payment-blocked-by-scan"));
|
|
541
|
+
});
|
|
542
|
+
const beginKioskScanActivity = useMemoizedFn(() => {
|
|
543
|
+
if (paymentScanActivity.getIsPaymentProcessing() || syncingLock) {
|
|
544
|
+
notifyScanBlockedByPayment();
|
|
545
|
+
return null;
|
|
546
|
+
}
|
|
547
|
+
if (paymentScanActivity.getIsScanProcessing()) {
|
|
548
|
+
var _Toast$info3;
|
|
549
|
+
Toast === null || Toast === void 0 || (_Toast$info3 = Toast.info) === null || _Toast$info3 === void 0 || _Toast$info3.call(Toast, locales.getText("pisell2.checkout.wallet-scan-processing"));
|
|
550
|
+
return null;
|
|
551
|
+
}
|
|
552
|
+
return paymentScanActivity.tryBeginScan();
|
|
553
|
+
});
|
|
554
|
+
const finishActiveKioskPaymentActivity = useMemoizedFn((reason, expectedSourcePrefix) => {
|
|
555
|
+
var _logger$addLog;
|
|
556
|
+
const activity = activeKioskPaymentActivityRef.current;
|
|
557
|
+
if (!activity) return;
|
|
558
|
+
if (expectedSourcePrefix && !activity.source.startsWith(expectedSourcePrefix)) return;
|
|
559
|
+
if (activity.deferRelease) return;
|
|
560
|
+
activity.release();
|
|
561
|
+
logger === null || logger === void 0 || (_logger$addLog = logger.addLog) === null || _logger$addLog === void 0 || _logger$addLog.call(logger, {
|
|
562
|
+
type: "info",
|
|
563
|
+
title: "Kiosk checkout payment activity finished",
|
|
564
|
+
metadata: {
|
|
565
|
+
reason,
|
|
566
|
+
source: activity.source
|
|
567
|
+
}
|
|
568
|
+
});
|
|
569
|
+
});
|
|
570
|
+
const beginKioskPaymentActivity = useMemoizedFn((source) => {
|
|
571
|
+
var _logger$addLog2;
|
|
572
|
+
if (paymentChannel !== "kiosk") {
|
|
573
|
+
const release = (() => void 0);
|
|
574
|
+
release.isActive = () => true;
|
|
575
|
+
return release;
|
|
576
|
+
}
|
|
577
|
+
if (paymentScanActivity.getIsScanProcessing()) {
|
|
578
|
+
notifyPaymentBlockedByScan();
|
|
579
|
+
return null;
|
|
580
|
+
}
|
|
581
|
+
if (paymentScanActivity.getIsPaymentProcessing()) {
|
|
582
|
+
var _Toast$info4;
|
|
583
|
+
Toast === null || Toast === void 0 || (_Toast$info4 = Toast.info) === null || _Toast$info4 === void 0 || _Toast$info4.call(Toast, locales.getText("payment.processing"));
|
|
584
|
+
return null;
|
|
585
|
+
}
|
|
586
|
+
if (syncingLock) {
|
|
587
|
+
var _Toast$info5;
|
|
588
|
+
Toast === null || Toast === void 0 || (_Toast$info5 = Toast.info) === null || _Toast$info5 === void 0 || _Toast$info5.call(Toast, locales.getText("payment.processing"));
|
|
589
|
+
return null;
|
|
590
|
+
}
|
|
591
|
+
const releaseActivity = paymentScanActivity.tryBeginPayment();
|
|
592
|
+
if (!releaseActivity) return null;
|
|
593
|
+
let released = false;
|
|
594
|
+
const release = (() => {
|
|
595
|
+
var _activeKioskPaymentAc;
|
|
596
|
+
if (released) return;
|
|
597
|
+
const activeActivity = activeKioskPaymentActivityRef.current;
|
|
598
|
+
if ((activeActivity === null || activeActivity === void 0 ? void 0 : activeActivity.release) === release && activeActivity.deferRelease) return;
|
|
599
|
+
released = true;
|
|
600
|
+
if (((_activeKioskPaymentAc = activeKioskPaymentActivityRef.current) === null || _activeKioskPaymentAc === void 0 ? void 0 : _activeKioskPaymentAc.release) === release) activeKioskPaymentActivityRef.current = void 0;
|
|
601
|
+
releaseActivity();
|
|
602
|
+
if (source.startsWith("payment:")) {
|
|
603
|
+
var _getApp, _getApp$getPlugin, _getApp$getPlugin$res;
|
|
604
|
+
getApp === null || getApp === void 0 || (_getApp = getApp()) === null || _getApp === void 0 || (_getApp$getPlugin = _getApp.getPlugin) === null || _getApp$getPlugin === void 0 || (_getApp$getPlugin = _getApp$getPlugin.call(_getApp, "screenProtector")) === null || _getApp$getPlugin === void 0 || (_getApp$getPlugin$res = _getApp$getPlugin.resumeIdleTimer) === null || _getApp$getPlugin$res === void 0 || _getApp$getPlugin$res.call(_getApp$getPlugin);
|
|
605
|
+
}
|
|
606
|
+
});
|
|
607
|
+
release.isActive = () => {
|
|
608
|
+
var _activeKioskPaymentAc2;
|
|
609
|
+
return !released && ((_activeKioskPaymentAc2 = activeKioskPaymentActivityRef.current) === null || _activeKioskPaymentAc2 === void 0 ? void 0 : _activeKioskPaymentAc2.release) === release;
|
|
610
|
+
};
|
|
611
|
+
activeKioskPaymentActivityRef.current = {
|
|
612
|
+
release,
|
|
613
|
+
source
|
|
614
|
+
};
|
|
615
|
+
logger === null || logger === void 0 || (_logger$addLog2 = logger.addLog) === null || _logger$addLog2 === void 0 || _logger$addLog2.call(logger, {
|
|
616
|
+
type: "info",
|
|
617
|
+
title: "Kiosk checkout payment activity started",
|
|
618
|
+
metadata: { source }
|
|
619
|
+
});
|
|
620
|
+
return release;
|
|
621
|
+
});
|
|
622
|
+
useEffect(() => {
|
|
623
|
+
if (!isModalOpen) finishActiveKioskPaymentActivity("modal-closed");
|
|
624
|
+
}, [isModalOpen]);
|
|
625
|
+
useEffect(() => () => finishActiveKioskPaymentActivity("component-unmounted"), []);
|
|
531
626
|
const currency = getData("shop_currency_code") || "USD";
|
|
532
627
|
const open_deposit = getData("bookingv2_deposit") || 0;
|
|
533
628
|
const currentBaseSales = baseSales;
|
|
@@ -727,14 +822,14 @@ const PaymentContent = forwardRef(({ cartData, orderInfo, isModalOpen, onPayment
|
|
|
727
822
|
const payments = params.forceUseParamsPayment && Array.isArray(params.payments) ? params.payments : yield readBaseSalesPaymentItems(params.payments);
|
|
728
823
|
const submitResult = (_params$syncResult6 = params.syncResult) === null || _params$syncResult6 === void 0 ? void 0 : _params$syncResult6.submitResult;
|
|
729
824
|
if (isBaseSalesSubmitRejected(submitResult)) {
|
|
730
|
-
var _logger$
|
|
825
|
+
var _logger$addLog4, _Toast$error2;
|
|
731
826
|
const backendResponse = getNormalizedBaseSalesSubmitResponse(submitResult);
|
|
732
827
|
const message = getBaseSalesSubmitErrorMessage(backendResponse) || locales.getText("pisell2.checkout.order-sync-failed");
|
|
733
828
|
console.error(`[PaymentModal] Sales checkout backend rejected: ${message}`, createBaseSalesSubmitErrorDebug(submitResult, payments));
|
|
734
829
|
closePaymentResultToastV2();
|
|
735
830
|
if ((config === null || config === void 0 ? void 0 : config.keepOpenOnSyncFailure) === true) {
|
|
736
|
-
var _logger$
|
|
737
|
-
logger === null || logger === void 0 || (_logger$
|
|
831
|
+
var _logger$addLog3, _Toast$error;
|
|
832
|
+
logger === null || logger === void 0 || (_logger$addLog3 = logger.addLog) === null || _logger$addLog3 === void 0 || _logger$addLog3.call(logger, {
|
|
738
833
|
type: "error",
|
|
739
834
|
title: "BaseSales payment sync rejected; waiting for kiosk retry",
|
|
740
835
|
metadata: {
|
|
@@ -758,7 +853,7 @@ const PaymentContent = forwardRef(({ cartData, orderInfo, isModalOpen, onPayment
|
|
|
758
853
|
(_currentBaseSales$del = currentBaseSales.deleteOrderPayment) === null || _currentBaseSales$del === void 0 || _currentBaseSales$del.call(currentBaseSales, params.rollbackPaymentIdentity);
|
|
759
854
|
setPaymentItems(yield readBaseSalesPaymentItems());
|
|
760
855
|
}
|
|
761
|
-
logger === null || logger === void 0 || (_logger$
|
|
856
|
+
logger === null || logger === void 0 || (_logger$addLog4 = logger.addLog) === null || _logger$addLog4 === void 0 || _logger$addLog4.call(logger, {
|
|
762
857
|
type: "error",
|
|
763
858
|
title: "BaseSales payment sync rejected by backend",
|
|
764
859
|
metadata: {
|
|
@@ -833,28 +928,42 @@ const PaymentContent = forwardRef(({ cartData, orderInfo, isModalOpen, onPayment
|
|
|
833
928
|
app,
|
|
834
929
|
handler: function() {
|
|
835
930
|
var _ref15 = _asyncToGenerator(function* (command) {
|
|
931
|
+
if (command.command === "authorization_close") {
|
|
932
|
+
finishActiveKioskPaymentActivity("authorization-closed", "authorization:");
|
|
933
|
+
return;
|
|
934
|
+
}
|
|
836
935
|
if (command.command !== "payment_result") return;
|
|
837
936
|
const params = command.params;
|
|
838
|
-
|
|
839
|
-
if (
|
|
840
|
-
|
|
841
|
-
|
|
842
|
-
|
|
843
|
-
if (
|
|
844
|
-
|
|
845
|
-
syncResult: params.syncResult
|
|
937
|
+
const authorizationActivity = activeKioskPaymentActivityRef.current;
|
|
938
|
+
if (authorizationActivity === null || authorizationActivity === void 0 ? void 0 : authorizationActivity.source.startsWith("authorization:")) authorizationActivity.deferRelease = true;
|
|
939
|
+
try {
|
|
940
|
+
if ((params === null || params === void 0 ? void 0 : params.status) === "cancelled") return;
|
|
941
|
+
const payments = Array.isArray(params === null || params === void 0 ? void 0 : params.payments) ? params.payments : [];
|
|
942
|
+
if (params === null || params === void 0 ? void 0 : params.ok) {
|
|
943
|
+
var _params$syncResult9, _params$syncResult10, _params$syncResult11;
|
|
944
|
+
if ((params === null || params === void 0 || (_params$syncResult9 = params.syncResult) === null || _params$syncResult9 === void 0 ? void 0 : _params$syncResult9.isDepositFullyPaid) && !(params === null || params === void 0 || (_params$syncResult10 = params.syncResult) === null || _params$syncResult10 === void 0 ? void 0 : _params$syncResult10.isOrderFullyPaid)) return;
|
|
945
|
+
yield handleBaseSalesPaymentSyncSuccess({
|
|
946
|
+
syncResult: params.syncResult,
|
|
947
|
+
payments,
|
|
948
|
+
changeGivenAmount: getPaymentChangeGivenAmount(payments),
|
|
949
|
+
forceUseParamsPayment: true,
|
|
950
|
+
orderTotalAmount: params === null || params === void 0 || (_params$syncResult11 = params.syncResult) === null || _params$syncResult11 === void 0 ? void 0 : _params$syncResult11.orderExpectedAmount
|
|
951
|
+
});
|
|
952
|
+
return;
|
|
953
|
+
}
|
|
954
|
+
yield handleBaseSalesPaymentSyncFailure({
|
|
955
|
+
error: (params === null || params === void 0 ? void 0 : params.error) || new Error(locales.getText("pisell2.checkout.order-sync-failed")),
|
|
846
956
|
payments,
|
|
847
|
-
changeGivenAmount: getPaymentChangeGivenAmount(payments)
|
|
848
|
-
forceUseParamsPayment: true,
|
|
849
|
-
orderTotalAmount: params === null || params === void 0 || (_params$syncResult11 = params.syncResult) === null || _params$syncResult11 === void 0 ? void 0 : _params$syncResult11.orderExpectedAmount
|
|
957
|
+
changeGivenAmount: getPaymentChangeGivenAmount(payments)
|
|
850
958
|
});
|
|
851
|
-
|
|
959
|
+
} finally {
|
|
960
|
+
if (authorizationActivity && activeKioskPaymentActivityRef.current === authorizationActivity) authorizationActivity.deferRelease = false;
|
|
961
|
+
try {
|
|
962
|
+
globalApp.runFunction("closeAuthorization");
|
|
963
|
+
} finally {
|
|
964
|
+
finishActiveKioskPaymentActivity("payment-result", "authorization:");
|
|
965
|
+
}
|
|
852
966
|
}
|
|
853
|
-
yield handleBaseSalesPaymentSyncFailure({
|
|
854
|
-
error: (params === null || params === void 0 ? void 0 : params.error) || new Error(locales.getText("pisell2.checkout.order-sync-failed")),
|
|
855
|
-
payments,
|
|
856
|
-
changeGivenAmount: getPaymentChangeGivenAmount(payments)
|
|
857
|
-
});
|
|
858
967
|
});
|
|
859
968
|
return function handler(_x22) {
|
|
860
969
|
return _ref15.apply(this, arguments);
|
|
@@ -896,16 +1005,16 @@ const PaymentContent = forwardRef(({ cartData, orderInfo, isModalOpen, onPayment
|
|
|
896
1005
|
}());
|
|
897
1006
|
const handleBaseSalesPaymentSyncFailure = useMemoizedFn(function() {
|
|
898
1007
|
var _ref18 = _asyncToGenerator(function* (params) {
|
|
899
|
-
var _logger$
|
|
1008
|
+
var _logger$addLog7, _params$error5, _params$error6, _Toast$error4, _params$error7;
|
|
900
1009
|
const payments = yield readBaseSalesPaymentItems(params.payments);
|
|
901
1010
|
const backendErrorResponse = getNormalizedBaseSalesSubmitResponse(extractBackendErrorResponse(params.error));
|
|
902
1011
|
const isBackendRejected = !!backendErrorResponse;
|
|
903
1012
|
const isDeferredNetworkSync = !backendErrorResponse && isNetworkOrTimeoutError(params.error);
|
|
904
1013
|
const message = isBackendRejected ? getBaseSalesSubmitErrorMessage(backendErrorResponse) || locales.getText("pisell2.checkout.order-sync-failed") : params.error instanceof Error ? params.error.message : String(params.error);
|
|
905
1014
|
if ((config === null || config === void 0 ? void 0 : config.keepOpenOnSyncFailure) === true) {
|
|
906
|
-
var _logger$
|
|
1015
|
+
var _logger$addLog5, _params$error, _params$error2, _Toast$error3, _params$error3;
|
|
907
1016
|
closePaymentResultToastV2();
|
|
908
|
-
logger === null || logger === void 0 || (_logger$
|
|
1017
|
+
logger === null || logger === void 0 || (_logger$addLog5 = logger.addLog) === null || _logger$addLog5 === void 0 || _logger$addLog5.call(logger, {
|
|
909
1018
|
type: "error",
|
|
910
1019
|
title: "BaseSales payment sync failed; waiting for kiosk retry",
|
|
911
1020
|
metadata: {
|
|
@@ -930,7 +1039,7 @@ const PaymentContent = forwardRef(({ cartData, orderInfo, isModalOpen, onPayment
|
|
|
930
1039
|
closePaymentResultToastV2();
|
|
931
1040
|
} else console.error("[PaymentModal] Sales checkout submit failed", params.error);
|
|
932
1041
|
if (isDeferredNetworkSync) {
|
|
933
|
-
var _logger$
|
|
1042
|
+
var _logger$addLog6, _params$error4, _Toast$info6, _params$changeGivenAm3;
|
|
934
1043
|
const deferredMessage = locales.getText("pisell2.checkout.order-saved-sync-later");
|
|
935
1044
|
const nextOrderInfo = getBaseSalesOrderInfo(currentBaseSales);
|
|
936
1045
|
if (nextOrderInfo) {
|
|
@@ -941,7 +1050,7 @@ const PaymentContent = forwardRef(({ cartData, orderInfo, isModalOpen, onPayment
|
|
|
941
1050
|
}
|
|
942
1051
|
const nextPayments = yield readBaseSalesPaymentItems(payments);
|
|
943
1052
|
setPaymentItems(nextPayments);
|
|
944
|
-
logger === null || logger === void 0 || (_logger$
|
|
1053
|
+
logger === null || logger === void 0 || (_logger$addLog6 = logger.addLog) === null || _logger$addLog6 === void 0 || _logger$addLog6.call(logger, {
|
|
945
1054
|
type: "info",
|
|
946
1055
|
title: "BaseSales payment saved locally, backend sync deferred",
|
|
947
1056
|
metadata: {
|
|
@@ -950,7 +1059,7 @@ const PaymentContent = forwardRef(({ cartData, orderInfo, isModalOpen, onPayment
|
|
|
950
1059
|
payments: nextPayments
|
|
951
1060
|
}
|
|
952
1061
|
});
|
|
953
|
-
Toast === null || Toast === void 0 || (_Toast$
|
|
1062
|
+
Toast === null || Toast === void 0 || (_Toast$info6 = Toast.info) === null || _Toast$info6 === void 0 || _Toast$info6.call(Toast, deferredMessage);
|
|
954
1063
|
const syncResult = {
|
|
955
1064
|
isFullyPaid: true,
|
|
956
1065
|
submitResult: {
|
|
@@ -976,7 +1085,7 @@ const PaymentContent = forwardRef(({ cartData, orderInfo, isModalOpen, onPayment
|
|
|
976
1085
|
(_currentBaseSales$del2 = currentBaseSales.deleteOrderPayment) === null || _currentBaseSales$del2 === void 0 || _currentBaseSales$del2.call(currentBaseSales, params.rollbackPaymentIdentity);
|
|
977
1086
|
setPaymentItems(yield readBaseSalesPaymentItems());
|
|
978
1087
|
}
|
|
979
|
-
logger === null || logger === void 0 || (_logger$
|
|
1088
|
+
logger === null || logger === void 0 || (_logger$addLog7 = logger.addLog) === null || _logger$addLog7 === void 0 || _logger$addLog7.call(logger, {
|
|
980
1089
|
type: "error",
|
|
981
1090
|
title: "BaseSales payment sync failed",
|
|
982
1091
|
metadata: {
|
|
@@ -1237,7 +1346,7 @@ const PaymentContent = forwardRef(({ cartData, orderInfo, isModalOpen, onPayment
|
|
|
1237
1346
|
draftResult
|
|
1238
1347
|
};
|
|
1239
1348
|
} catch (error) {
|
|
1240
|
-
var _logger$
|
|
1349
|
+
var _logger$addLog8, _Toast$hide5, _Toast$error7;
|
|
1241
1350
|
if (paymentAdded) try {
|
|
1242
1351
|
if (paymentNumber) yield deletePendingEftposPayment(paymentNumber, { persistDraft: false });
|
|
1243
1352
|
else if (typeof (currentBaseSales === null || currentBaseSales === void 0 ? void 0 : currentBaseSales.setOrderPayments) === "function") {
|
|
@@ -1248,7 +1357,7 @@ const PaymentContent = forwardRef(({ cartData, orderInfo, isModalOpen, onPayment
|
|
|
1248
1357
|
console.error("Failed to rollback pending EFTPOS payment:", rollbackError);
|
|
1249
1358
|
}
|
|
1250
1359
|
const message = error instanceof Error ? error.message : String(error);
|
|
1251
|
-
logger === null || logger === void 0 || (_logger$
|
|
1360
|
+
logger === null || logger === void 0 || (_logger$addLog8 = logger.addLog) === null || _logger$addLog8 === void 0 || _logger$addLog8.call(logger, {
|
|
1252
1361
|
type: "error",
|
|
1253
1362
|
title: "EFTPOS pending payment draft failed",
|
|
1254
1363
|
metadata: {
|
|
@@ -1295,9 +1404,9 @@ const PaymentContent = forwardRef(({ cartData, orderInfo, isModalOpen, onPayment
|
|
|
1295
1404
|
};
|
|
1296
1405
|
}());
|
|
1297
1406
|
const handleEftposUpdateError = useMemoizedFn((error, paymentNumber) => {
|
|
1298
|
-
var _logger$
|
|
1407
|
+
var _logger$addLog9, _Toast$error8;
|
|
1299
1408
|
const message = error instanceof Error ? error.message : String(error);
|
|
1300
|
-
logger === null || logger === void 0 || (_logger$
|
|
1409
|
+
logger === null || logger === void 0 || (_logger$addLog9 = logger.addLog) === null || _logger$addLog9 === void 0 || _logger$addLog9.call(logger, {
|
|
1301
1410
|
type: "error",
|
|
1302
1411
|
title: "EFTPOS payment update failed",
|
|
1303
1412
|
metadata: {
|
|
@@ -1309,6 +1418,8 @@ const PaymentContent = forwardRef(({ cartData, orderInfo, isModalOpen, onPayment
|
|
|
1309
1418
|
});
|
|
1310
1419
|
const handleAddCashPayment = function() {
|
|
1311
1420
|
var _ref25 = _asyncToGenerator(function* (result) {
|
|
1421
|
+
const finishPaymentActivity = beginKioskPaymentActivity("cash");
|
|
1422
|
+
if (!finishPaymentActivity) return;
|
|
1312
1423
|
try {
|
|
1313
1424
|
var _interaction$utils, _interaction$utils$po, _result$actual_paid_a;
|
|
1314
1425
|
if (!canAddOrderPayment(result.amount)) return;
|
|
@@ -1344,9 +1455,9 @@ const PaymentContent = forwardRef(({ cartData, orderInfo, isModalOpen, onPayment
|
|
|
1344
1455
|
}
|
|
1345
1456
|
});
|
|
1346
1457
|
} catch (error) {
|
|
1347
|
-
var _logger$
|
|
1458
|
+
var _logger$addLog10, _Toast$error9;
|
|
1348
1459
|
const message = error instanceof Error ? error.message : String(error);
|
|
1349
|
-
logger === null || logger === void 0 || (_logger$
|
|
1460
|
+
logger === null || logger === void 0 || (_logger$addLog10 = logger.addLog) === null || _logger$addLog10 === void 0 || _logger$addLog10.call(logger, {
|
|
1350
1461
|
type: "error",
|
|
1351
1462
|
title: "Cash payment failed",
|
|
1352
1463
|
metadata: {
|
|
@@ -1355,6 +1466,8 @@ const PaymentContent = forwardRef(({ cartData, orderInfo, isModalOpen, onPayment
|
|
|
1355
1466
|
}
|
|
1356
1467
|
});
|
|
1357
1468
|
Toast === null || Toast === void 0 || (_Toast$error9 = Toast.error) === null || _Toast$error9 === void 0 || _Toast$error9.call(Toast, message);
|
|
1469
|
+
} finally {
|
|
1470
|
+
finishPaymentActivity();
|
|
1358
1471
|
}
|
|
1359
1472
|
});
|
|
1360
1473
|
return function handleAddCashPayment(_x32) {
|
|
@@ -1372,319 +1485,347 @@ const PaymentContent = forwardRef(({ cartData, orderInfo, isModalOpen, onPayment
|
|
|
1372
1485
|
const screenProtector = ((_context$appHelper$ut = context.appHelper.utils) === null || _context$appHelper$ut === void 0 || (_context$appHelper$ut2 = _context$appHelper$ut.getApp) === null || _context$appHelper$ut2 === void 0 ? void 0 : _context$appHelper$ut2.call(_context$appHelper$ut)).getPlugin("screenProtector");
|
|
1373
1486
|
const onPaymentOptionClick = function() {
|
|
1374
1487
|
var _ref29 = _asyncToGenerator(function* (method) {
|
|
1375
|
-
var _method$totalAmount;
|
|
1376
1488
|
if (syncingLock) return;
|
|
1377
|
-
|
|
1378
|
-
|
|
1379
|
-
|
|
1380
|
-
const
|
|
1381
|
-
|
|
1382
|
-
|
|
1383
|
-
|
|
1384
|
-
|
|
1385
|
-
|
|
1386
|
-
|
|
1387
|
-
|
|
1388
|
-
|
|
1389
|
-
|
|
1390
|
-
|
|
1391
|
-
|
|
1392
|
-
|
|
1393
|
-
|
|
1394
|
-
|
|
1395
|
-
|
|
1396
|
-
|
|
1397
|
-
|
|
1398
|
-
|
|
1399
|
-
|
|
1400
|
-
|
|
1401
|
-
|
|
1402
|
-
|
|
1403
|
-
|
|
1404
|
-
|
|
1405
|
-
|
|
1406
|
-
|
|
1407
|
-
|
|
1408
|
-
|
|
1409
|
-
|
|
1410
|
-
|
|
1411
|
-
|
|
1412
|
-
console.log("eftpos_pay_result>>>>>>", status, data, msg);
|
|
1413
|
-
screenProtector && (screenProtector === null || screenProtector === void 0 || (_screenProtector$resu = screenProtector.resumeIdleTimer) === null || _screenProtector$resu === void 0 || _screenProtector$resu.call(screenProtector));
|
|
1414
|
-
if ((data === null || data === void 0 ? void 0 : data.action) === "cancel_order") {
|
|
1415
|
-
onPaymentCancel(true);
|
|
1416
|
-
return;
|
|
1417
|
-
}
|
|
1418
|
-
if (status !== "success") return;
|
|
1419
|
-
const payResultParams = {
|
|
1420
|
-
amount: Number(data === null || data === void 0 ? void 0 : data.amount),
|
|
1489
|
+
const finishPaymentActivity = beginKioskPaymentActivity(`payment:${(method === null || method === void 0 ? void 0 : method.code) || "unknown"}`);
|
|
1490
|
+
if (!finishPaymentActivity) return;
|
|
1491
|
+
let paymentActivityHandedOff = false;
|
|
1492
|
+
const releaseAfterPaymentCallback = (callback) => _asyncToGenerator(function* (...args) {
|
|
1493
|
+
try {
|
|
1494
|
+
return yield callback(...args);
|
|
1495
|
+
} finally {
|
|
1496
|
+
finishPaymentActivity();
|
|
1497
|
+
}
|
|
1498
|
+
});
|
|
1499
|
+
try {
|
|
1500
|
+
var _method$totalAmount;
|
|
1501
|
+
const { id, code, name, type } = method || {};
|
|
1502
|
+
const finalAmount = (_method$totalAmount = method.totalAmount) !== null && _method$totalAmount !== void 0 ? _method$totalAmount : effectiveCustomAmount;
|
|
1503
|
+
if (screenProtector) screenProtector === null || screenProtector === void 0 || screenProtector.pauseIdleTimer();
|
|
1504
|
+
const isSciPayment = SCI_PAYMENT_CODES.includes(code || "");
|
|
1505
|
+
const isSpiPayment = SPI_PAYMENT_CODES.includes(code || "");
|
|
1506
|
+
if (isSciPayment || isSpiPayment) {
|
|
1507
|
+
var _context$appHelper$ut3, _context$appHelper$ut4, _context$appHelper, _context$appHelper$is, _currentBaseSales$get9, _getBaseSalesSubmitDa, _app$storage2, _app$storage2$getStor;
|
|
1508
|
+
const payType = isSpiPayment ? "mx51" : "eftpos";
|
|
1509
|
+
const _app = (_context$appHelper$ut3 = context.appHelper.utils) === null || _context$appHelper$ut3 === void 0 || (_context$appHelper$ut4 = _context$appHelper$ut3.getApp) === null || _context$appHelper$ut4 === void 0 ? void 0 : _context$appHelper$ut4.call(_context$appHelper$ut3);
|
|
1510
|
+
const usePiPayment = !!(context === null || context === void 0 || (_context$appHelper = context.appHelper) === null || _context$appHelper === void 0 || (_context$appHelper = _context$appHelper.utils) === null || _context$appHelper === void 0 || (_context$appHelper = _context$appHelper.businessUtils) === null || _context$appHelper === void 0 || (_context$appHelper$is = _context$appHelper.isPiPaymentEnabled) === null || _context$appHelper$is === void 0 ? void 0 : _context$appHelper$is.call(_context$appHelper));
|
|
1511
|
+
const piPaymentProvider = resolvePiPaymentProvider((method === null || method === void 0 ? void 0 : method.code) || "", usePiPayment);
|
|
1512
|
+
const shouldUsePiPayment = !!piPaymentProvider;
|
|
1513
|
+
if (!shouldUsePiPayment && isSpiPayment) {
|
|
1514
|
+
var _currentBaseSales$get7;
|
|
1515
|
+
const orderId = currentBaseSales === null || currentBaseSales === void 0 || (_currentBaseSales$get7 = currentBaseSales.getOrderIdentity) === null || _currentBaseSales$get7 === void 0 || (_currentBaseSales$get7 = _currentBaseSales$get7.call(currentBaseSales)) === null || _currentBaseSales$get7 === void 0 ? void 0 : _currentBaseSales$get7.orderId;
|
|
1516
|
+
const paymentRuntime = paymentMethodRuntimeRef.current;
|
|
1517
|
+
if (!paymentRuntime) return;
|
|
1518
|
+
paymentActivityHandedOff = yield paymentRuntime.onPay(payType, {
|
|
1519
|
+
isActive: finishPaymentActivity.isActive,
|
|
1520
|
+
source: "normal",
|
|
1521
|
+
data: {
|
|
1522
|
+
payMethod: {
|
|
1523
|
+
id,
|
|
1421
1524
|
code,
|
|
1422
|
-
custom_payment_id: id,
|
|
1423
1525
|
name,
|
|
1424
|
-
|
|
1425
|
-
|
|
1426
|
-
|
|
1427
|
-
|
|
1428
|
-
|
|
1429
|
-
|
|
1430
|
-
|
|
1431
|
-
|
|
1526
|
+
type
|
|
1527
|
+
},
|
|
1528
|
+
params: {
|
|
1529
|
+
orderId,
|
|
1530
|
+
symbol: getData("shop_symbol"),
|
|
1531
|
+
amount: finalAmount,
|
|
1532
|
+
surcharge: processSurcharge(method.surcharge)
|
|
1533
|
+
},
|
|
1534
|
+
mode: "pay"
|
|
1535
|
+
},
|
|
1536
|
+
callback: releaseAfterPaymentCallback(function() {
|
|
1537
|
+
var _ref26 = _asyncToGenerator(function* ({ status, data, msg }) {
|
|
1538
|
+
var _screenProtector$resu;
|
|
1539
|
+
console.log("eftpos_pay_result>>>>>>", status, data, msg);
|
|
1540
|
+
screenProtector && (screenProtector === null || screenProtector === void 0 || (_screenProtector$resu = screenProtector.resumeIdleTimer) === null || _screenProtector$resu === void 0 || _screenProtector$resu.call(screenProtector));
|
|
1541
|
+
if ((data === null || data === void 0 ? void 0 : data.action) === "cancel_order") {
|
|
1542
|
+
onPaymentCancel(true);
|
|
1543
|
+
return;
|
|
1544
|
+
}
|
|
1545
|
+
if (status !== "success") return;
|
|
1546
|
+
const payResultParams = {
|
|
1547
|
+
amount: Number(data === null || data === void 0 ? void 0 : data.amount),
|
|
1548
|
+
code,
|
|
1549
|
+
custom_payment_id: id,
|
|
1550
|
+
name,
|
|
1551
|
+
custom_payment_type: type,
|
|
1552
|
+
voucher_id: "",
|
|
1553
|
+
service_charge: {},
|
|
1554
|
+
metadata: { unique_payment_number: data === null || data === void 0 ? void 0 : data.uniquePaymentNumber }
|
|
1555
|
+
};
|
|
1556
|
+
if (Number((data === null || data === void 0 ? void 0 : data.surcharge) || 0) !== Number((method === null || method === void 0 ? void 0 : method.surcharge) || 0)) payResultParams.service_charge = {
|
|
1557
|
+
amount: (data === null || data === void 0 ? void 0 : data.surcharge) || "0",
|
|
1558
|
+
percentage: "0"
|
|
1559
|
+
};
|
|
1560
|
+
else payResultParams.service_charge = {
|
|
1561
|
+
amount: (method === null || method === void 0 ? void 0 : method.fixed) || "0",
|
|
1562
|
+
percentage: (method === null || method === void 0 ? void 0 : method.percentage) || "0"
|
|
1563
|
+
};
|
|
1564
|
+
if (!canAddOrderPayment(payResultParams.amount)) return;
|
|
1565
|
+
setIsChangePaymentNotIncludeVoucher === null || setIsChangePaymentNotIncludeVoucher === void 0 || setIsChangePaymentNotIncludeVoucher(true);
|
|
1566
|
+
yield addBaseSalesOrderPayment(currentBaseSales, payResultParams);
|
|
1567
|
+
});
|
|
1568
|
+
return function(_x33) {
|
|
1569
|
+
return _ref26.apply(this, arguments);
|
|
1432
1570
|
};
|
|
1433
|
-
|
|
1434
|
-
|
|
1435
|
-
|
|
1571
|
+
}())
|
|
1572
|
+
});
|
|
1573
|
+
return;
|
|
1574
|
+
}
|
|
1575
|
+
if (!shouldUsePiPayment) {
|
|
1576
|
+
var _app$storage, _app$storage$getStora, _currentBaseSales$get8;
|
|
1577
|
+
const _account = JSON.parse((_app === null || _app === void 0 || (_app$storage = _app.storage) === null || _app$storage === void 0 || (_app$storage$getStora = _app$storage.getStorage) === null || _app$storage$getStora === void 0 ? void 0 : _app$storage$getStora.call(_app$storage, "account")) || "{}");
|
|
1578
|
+
console.log("_account", _account);
|
|
1579
|
+
let orderId = currentBaseSales === null || currentBaseSales === void 0 || (_currentBaseSales$get8 = currentBaseSales.getOrderIdentity) === null || _currentBaseSales$get8 === void 0 || (_currentBaseSales$get8 = _currentBaseSales$get8.call(currentBaseSales)) === null || _currentBaseSales$get8 === void 0 ? void 0 : _currentBaseSales$get8.orderId;
|
|
1580
|
+
if (!orderId || typeof orderId === "string" && orderId.startsWith("LOCAL_")) {
|
|
1581
|
+
var _Toast$loading3;
|
|
1582
|
+
Toast === null || Toast === void 0 || (_Toast$loading3 = Toast.loading) === null || _Toast$loading3 === void 0 || _Toast$loading3.call(Toast, "", 0);
|
|
1583
|
+
let submitResult;
|
|
1584
|
+
try {
|
|
1585
|
+
submitResult = yield submitBaseSalesOrderAsync(currentBaseSales);
|
|
1586
|
+
} catch (error) {
|
|
1587
|
+
Toast === null || Toast === void 0 || Toast.error(error instanceof Error ? error.message : locales.getText("pisell2.checkout.order-status-abnormal-restart-app") || "当前订单状态异常,请重启 APP 后再试");
|
|
1588
|
+
return;
|
|
1589
|
+
}
|
|
1590
|
+
if (!(submitResult === null || submitResult === void 0 ? void 0 : submitResult.success) || isBaseSalesSubmitRejected(submitResult === null || submitResult === void 0 ? void 0 : submitResult.response)) {
|
|
1591
|
+
Toast === null || Toast === void 0 || Toast.error(getBaseSalesSubmitErrorMessage(submitResult === null || submitResult === void 0 ? void 0 : submitResult.response) || locales.getText("pisell2.checkout.order-status-abnormal-restart-app") || "当前订单状态异常,请重启 APP 后再试");
|
|
1592
|
+
return;
|
|
1593
|
+
}
|
|
1594
|
+
orderId = getBaseSalesSubmitOrderId(submitResult === null || submitResult === void 0 ? void 0 : submitResult.response);
|
|
1595
|
+
if (!orderId) {
|
|
1596
|
+
Toast === null || Toast === void 0 || Toast.error(locales.getText("pisell2.checkout.order-status-abnormal-restart-app") || "当前订单状态异常,请重启 APP 后再试");
|
|
1597
|
+
return;
|
|
1598
|
+
}
|
|
1599
|
+
}
|
|
1600
|
+
Toast === null || Toast === void 0 || Toast.hide();
|
|
1601
|
+
const paymentRuntime = paymentMethodRuntimeRef.current;
|
|
1602
|
+
if (!paymentRuntime) return;
|
|
1603
|
+
paymentActivityHandedOff = yield paymentRuntime.onPay(payType, {
|
|
1604
|
+
isActive: finishPaymentActivity.isActive,
|
|
1605
|
+
source: "normal",
|
|
1606
|
+
data: {
|
|
1607
|
+
payMethod: {
|
|
1608
|
+
id,
|
|
1609
|
+
code,
|
|
1610
|
+
name,
|
|
1611
|
+
type
|
|
1612
|
+
},
|
|
1613
|
+
params: {
|
|
1614
|
+
orderId,
|
|
1615
|
+
symbol: getData("shop_symbol"),
|
|
1616
|
+
amount: finalAmount,
|
|
1617
|
+
surcharge: processSurcharge(method.surcharge),
|
|
1618
|
+
operator_id: _account === null || _account === void 0 ? void 0 : _account.id,
|
|
1619
|
+
operator_type: "shop",
|
|
1620
|
+
platform: paymentChannel || "pos"
|
|
1621
|
+
},
|
|
1622
|
+
mode: "pay"
|
|
1623
|
+
},
|
|
1624
|
+
callback: releaseAfterPaymentCallback(function() {
|
|
1625
|
+
var _ref27 = _asyncToGenerator(function* ({ status, data, msg }) {
|
|
1626
|
+
var _screenProtector$resu2;
|
|
1627
|
+
console.log("eftpos_pay_result>>>>>>", status, data, msg);
|
|
1628
|
+
screenProtector && (screenProtector === null || screenProtector === void 0 || (_screenProtector$resu2 = screenProtector.resumeIdleTimer) === null || _screenProtector$resu2 === void 0 || _screenProtector$resu2.call(screenProtector));
|
|
1629
|
+
if (status !== "success") return;
|
|
1630
|
+
const payResultParams = {
|
|
1631
|
+
amount: finalAmount,
|
|
1632
|
+
code,
|
|
1633
|
+
custom_payment_id: id,
|
|
1634
|
+
name,
|
|
1635
|
+
custom_payment_type: type,
|
|
1636
|
+
voucher_id: "",
|
|
1637
|
+
service_charge: {
|
|
1638
|
+
percentage: data === null || data === void 0 ? void 0 : data.surPercentRate,
|
|
1639
|
+
amount: data === null || data === void 0 ? void 0 : data.surMoney
|
|
1640
|
+
},
|
|
1641
|
+
metadata: {
|
|
1642
|
+
unique_payment_number: data === null || data === void 0 ? void 0 : data.uniquePaymentNumber,
|
|
1643
|
+
manual_marking_flag: data === null || data === void 0 ? void 0 : data.manual_marking_flag
|
|
1644
|
+
}
|
|
1645
|
+
};
|
|
1646
|
+
if (!canAddOrderPayment(payResultParams.amount)) return;
|
|
1647
|
+
setIsChangePaymentNotIncludeVoucher === null || setIsChangePaymentNotIncludeVoucher === void 0 || setIsChangePaymentNotIncludeVoucher(true);
|
|
1648
|
+
yield addBaseSalesOrderPayment(currentBaseSales, payResultParams);
|
|
1649
|
+
});
|
|
1650
|
+
return function(_x34) {
|
|
1651
|
+
return _ref27.apply(this, arguments);
|
|
1436
1652
|
};
|
|
1437
|
-
|
|
1438
|
-
|
|
1439
|
-
|
|
1440
|
-
|
|
1441
|
-
|
|
1442
|
-
|
|
1443
|
-
|
|
1444
|
-
|
|
1653
|
+
}())
|
|
1654
|
+
});
|
|
1655
|
+
return;
|
|
1656
|
+
}
|
|
1657
|
+
logger === null || logger === void 0 || logger.addLog({
|
|
1658
|
+
type: "info",
|
|
1659
|
+
title: "addPendingEftposPayment_start",
|
|
1660
|
+
metadata: { timestamp: Date.now() }
|
|
1445
1661
|
});
|
|
1446
|
-
|
|
1447
|
-
|
|
1448
|
-
|
|
1449
|
-
|
|
1450
|
-
const _account = JSON.parse((_app === null || _app === void 0 || (_app$
|
|
1662
|
+
const pendingPayment = yield addPendingEftposPayment(method, finalAmount);
|
|
1663
|
+
if (!pendingPayment) return;
|
|
1664
|
+
const { paymentNumber, draftResult } = pendingPayment;
|
|
1665
|
+
const localSalesId = (currentBaseSales === null || currentBaseSales === void 0 || (_currentBaseSales$get9 = currentBaseSales.getOrderIdentity) === null || _currentBaseSales$get9 === void 0 || (_currentBaseSales$get9 = _currentBaseSales$get9.call(currentBaseSales)) === null || _currentBaseSales$get9 === void 0 ? void 0 : _currentBaseSales$get9.externalSaleNumber) || ((_getBaseSalesSubmitDa = getBaseSalesSubmitData(draftResult)) === null || _getBaseSalesSubmitDa === void 0 ? void 0 : _getBaseSalesSubmitDa.external_sale_number);
|
|
1666
|
+
const _account = JSON.parse((_app === null || _app === void 0 || (_app$storage2 = _app.storage) === null || _app$storage2 === void 0 || (_app$storage2$getStor = _app$storage2.getStorage) === null || _app$storage2$getStor === void 0 ? void 0 : _app$storage2$getStor.call(_app$storage2, "account")) || "{}");
|
|
1451
1667
|
console.log("_account", _account);
|
|
1452
|
-
let
|
|
1453
|
-
if (!
|
|
1454
|
-
|
|
1455
|
-
|
|
1456
|
-
let submitResult;
|
|
1457
|
-
try {
|
|
1458
|
-
submitResult = yield submitBaseSalesOrderAsync(currentBaseSales);
|
|
1459
|
-
} catch (error) {
|
|
1460
|
-
Toast === null || Toast === void 0 || Toast.error(error instanceof Error ? error.message : locales.getText("pisell2.checkout.order-status-abnormal-restart-app") || "当前订单状态异常,请重启 APP 后再试");
|
|
1461
|
-
return;
|
|
1462
|
-
}
|
|
1463
|
-
if (!(submitResult === null || submitResult === void 0 ? void 0 : submitResult.success) || isBaseSalesSubmitRejected(submitResult === null || submitResult === void 0 ? void 0 : submitResult.response)) {
|
|
1464
|
-
Toast === null || Toast === void 0 || Toast.error(getBaseSalesSubmitErrorMessage(submitResult === null || submitResult === void 0 ? void 0 : submitResult.response) || locales.getText("pisell2.checkout.order-status-abnormal-restart-app") || "当前订单状态异常,请重启 APP 后再试");
|
|
1465
|
-
return;
|
|
1466
|
-
}
|
|
1467
|
-
orderId = getBaseSalesSubmitOrderId(submitResult === null || submitResult === void 0 ? void 0 : submitResult.response);
|
|
1468
|
-
if (!orderId) {
|
|
1469
|
-
Toast === null || Toast === void 0 || Toast.error(locales.getText("pisell2.checkout.order-status-abnormal-restart-app") || "当前订单状态异常,请重启 APP 后再试");
|
|
1470
|
-
return;
|
|
1471
|
-
}
|
|
1668
|
+
let shouldPreservePendingEftpos = false;
|
|
1669
|
+
if (!localSalesId || !paymentMethodRuntimeRef.current) {
|
|
1670
|
+
yield deletePendingEftposPayment(paymentNumber);
|
|
1671
|
+
return;
|
|
1472
1672
|
}
|
|
1473
|
-
|
|
1474
|
-
|
|
1475
|
-
|
|
1476
|
-
|
|
1673
|
+
if (!finishPaymentActivity.isActive()) {
|
|
1674
|
+
yield deletePendingEftposPayment(paymentNumber);
|
|
1675
|
+
return;
|
|
1676
|
+
}
|
|
1677
|
+
logger === null || logger === void 0 || logger.addLog({
|
|
1678
|
+
type: "info",
|
|
1679
|
+
title: "addPendingEftposPayment_end",
|
|
1680
|
+
metadata: { timestamp: Date.now() }
|
|
1681
|
+
});
|
|
1682
|
+
if (paymentMethodRuntimeRef.current.openPi(_objectSpread2(_objectSpread2({
|
|
1683
|
+
provider: piPaymentProvider,
|
|
1684
|
+
mode: "pay",
|
|
1685
|
+
amount: finalAmount,
|
|
1686
|
+
salesId: String(localSalesId),
|
|
1687
|
+
paymentNumber,
|
|
1688
|
+
currency: getData("shop_symbol"),
|
|
1689
|
+
deviceNumber: cardReaderDeviceNumber,
|
|
1690
|
+
metadata: {
|
|
1477
1691
|
payMethod: {
|
|
1478
1692
|
id,
|
|
1479
1693
|
code,
|
|
1480
1694
|
name,
|
|
1481
1695
|
type
|
|
1482
1696
|
},
|
|
1483
|
-
|
|
1484
|
-
|
|
1485
|
-
symbol: getData("shop_symbol"),
|
|
1486
|
-
amount: finalAmount,
|
|
1487
|
-
surcharge: processSurcharge(method.surcharge),
|
|
1488
|
-
operator_id: _account === null || _account === void 0 ? void 0 : _account.id,
|
|
1489
|
-
operator_type: "shop",
|
|
1490
|
-
platform: paymentChannel || "pos"
|
|
1491
|
-
},
|
|
1492
|
-
mode: "pay"
|
|
1697
|
+
symbol: getData("shop_symbol"),
|
|
1698
|
+
payment_number: paymentNumber
|
|
1493
1699
|
},
|
|
1494
|
-
|
|
1495
|
-
|
|
1496
|
-
|
|
1497
|
-
|
|
1498
|
-
|
|
1499
|
-
|
|
1500
|
-
|
|
1501
|
-
|
|
1502
|
-
|
|
1503
|
-
|
|
1504
|
-
|
|
1505
|
-
|
|
1506
|
-
|
|
1507
|
-
|
|
1508
|
-
|
|
1509
|
-
|
|
1510
|
-
|
|
1511
|
-
|
|
1512
|
-
|
|
1513
|
-
|
|
1700
|
+
operator: {
|
|
1701
|
+
id: _account === null || _account === void 0 ? void 0 : _account.id,
|
|
1702
|
+
type: "shop"
|
|
1703
|
+
}
|
|
1704
|
+
}, paymentChannel === "kiosk" ? { slots: { failed: /* @__PURE__ */ React.createElement(Button, {
|
|
1705
|
+
block: true,
|
|
1706
|
+
type: "primary",
|
|
1707
|
+
className: "pi-payment-action-button",
|
|
1708
|
+
onClick: () => onPaymentCancel(true, false, "start-new-order"),
|
|
1709
|
+
style: { marginTop: "10px" }
|
|
1710
|
+
}, locales.getText("order.start-new-order")) } } : {}), {}, {
|
|
1711
|
+
platform: paymentChannel || "pos",
|
|
1712
|
+
usageScene: paymentChannel === "kiosk" ? "user" : "merchant",
|
|
1713
|
+
onChange: function() {
|
|
1714
|
+
var _ref28 = _asyncToGenerator(function* (event) {
|
|
1715
|
+
const isTerminalEvent = event.type === "success" || event.type === "closed" || event.type === "printOnTimeout";
|
|
1716
|
+
console.log("pi_payment_eftpos_event>>>>>>", event);
|
|
1717
|
+
try {
|
|
1718
|
+
const eventTransactionNumber = event.transactionNumber;
|
|
1719
|
+
if (eventTransactionNumber) shouldPreservePendingEftpos = true;
|
|
1720
|
+
if (event.type === "processing") {
|
|
1721
|
+
var _screenProtector$paus;
|
|
1722
|
+
screenProtector && (screenProtector === null || screenProtector === void 0 || (_screenProtector$paus = screenProtector.pauseIdleTimer) === null || _screenProtector$paus === void 0 || _screenProtector$paus.call(screenProtector));
|
|
1514
1723
|
}
|
|
1515
|
-
|
|
1516
|
-
if (!canAddOrderPayment(payResultParams.amount)) return;
|
|
1517
|
-
setIsChangePaymentNotIncludeVoucher === null || setIsChangePaymentNotIncludeVoucher === void 0 || setIsChangePaymentNotIncludeVoucher(true);
|
|
1518
|
-
yield addBaseSalesOrderPayment(currentBaseSales, payResultParams);
|
|
1519
|
-
});
|
|
1520
|
-
return function callback(_x34) {
|
|
1521
|
-
return _ref27.apply(this, arguments);
|
|
1522
|
-
};
|
|
1523
|
-
}()
|
|
1524
|
-
});
|
|
1525
|
-
return;
|
|
1526
|
-
}
|
|
1527
|
-
logger === null || logger === void 0 || logger.addLog({
|
|
1528
|
-
type: "info",
|
|
1529
|
-
title: "addPendingEftposPayment_start",
|
|
1530
|
-
metadata: { timestamp: Date.now() }
|
|
1531
|
-
});
|
|
1532
|
-
const pendingPayment = yield addPendingEftposPayment(method, finalAmount);
|
|
1533
|
-
if (!pendingPayment) return;
|
|
1534
|
-
const { paymentNumber, draftResult } = pendingPayment;
|
|
1535
|
-
const localSalesId = (currentBaseSales === null || currentBaseSales === void 0 || (_currentBaseSales$get9 = currentBaseSales.getOrderIdentity) === null || _currentBaseSales$get9 === void 0 || (_currentBaseSales$get9 = _currentBaseSales$get9.call(currentBaseSales)) === null || _currentBaseSales$get9 === void 0 ? void 0 : _currentBaseSales$get9.externalSaleNumber) || ((_getBaseSalesSubmitDa = getBaseSalesSubmitData(draftResult)) === null || _getBaseSalesSubmitDa === void 0 ? void 0 : _getBaseSalesSubmitDa.external_sale_number);
|
|
1536
|
-
const _account = JSON.parse((_app === null || _app === void 0 || (_app$storage2 = _app.storage) === null || _app$storage2 === void 0 || (_app$storage2$getStor = _app$storage2.getStorage) === null || _app$storage2$getStor === void 0 ? void 0 : _app$storage2$getStor.call(_app$storage2, "account")) || "{}");
|
|
1537
|
-
console.log("_account", _account);
|
|
1538
|
-
let shouldPreservePendingEftpos = false;
|
|
1539
|
-
if (!localSalesId || !paymentMethodRuntimeRef.current) {
|
|
1540
|
-
yield deletePendingEftposPayment(paymentNumber);
|
|
1541
|
-
return;
|
|
1542
|
-
}
|
|
1543
|
-
logger === null || logger === void 0 || logger.addLog({
|
|
1544
|
-
type: "info",
|
|
1545
|
-
title: "addPendingEftposPayment_end",
|
|
1546
|
-
metadata: { timestamp: Date.now() }
|
|
1547
|
-
});
|
|
1548
|
-
if (!paymentMethodRuntimeRef.current.openPi(_objectSpread2(_objectSpread2({
|
|
1549
|
-
provider: piPaymentProvider,
|
|
1550
|
-
mode: "pay",
|
|
1551
|
-
amount: finalAmount,
|
|
1552
|
-
salesId: String(localSalesId),
|
|
1553
|
-
paymentNumber,
|
|
1554
|
-
currency: getData("shop_symbol"),
|
|
1555
|
-
deviceNumber: cardReaderDeviceNumber,
|
|
1556
|
-
metadata: {
|
|
1557
|
-
payMethod: {
|
|
1558
|
-
id,
|
|
1559
|
-
code,
|
|
1560
|
-
name,
|
|
1561
|
-
type
|
|
1562
|
-
},
|
|
1563
|
-
symbol: getData("shop_symbol"),
|
|
1564
|
-
payment_number: paymentNumber
|
|
1565
|
-
},
|
|
1566
|
-
operator: {
|
|
1567
|
-
id: _account === null || _account === void 0 ? void 0 : _account.id,
|
|
1568
|
-
type: "shop"
|
|
1569
|
-
}
|
|
1570
|
-
}, paymentChannel === "kiosk" ? { slots: { failed: /* @__PURE__ */ React.createElement(Button, {
|
|
1571
|
-
block: true,
|
|
1572
|
-
type: "primary",
|
|
1573
|
-
className: "pi-payment-action-button",
|
|
1574
|
-
onClick: () => onPaymentCancel(true, false, "start-new-order"),
|
|
1575
|
-
style: { marginTop: "10px" }
|
|
1576
|
-
}, locales.getText("order.start-new-order")) } } : {}), {}, {
|
|
1577
|
-
platform: paymentChannel || "pos",
|
|
1578
|
-
usageScene: paymentChannel === "kiosk" ? "user" : "merchant",
|
|
1579
|
-
onChange: function() {
|
|
1580
|
-
var _ref28 = _asyncToGenerator(function* (event) {
|
|
1581
|
-
console.log("pi_payment_eftpos_event>>>>>>", event);
|
|
1582
|
-
try {
|
|
1583
|
-
const eventTransactionNumber = event.transactionNumber;
|
|
1584
|
-
if (eventTransactionNumber) shouldPreservePendingEftpos = true;
|
|
1585
|
-
if (event.type === "processing") {
|
|
1586
|
-
var _screenProtector$paus;
|
|
1587
|
-
screenProtector && (screenProtector === null || screenProtector === void 0 || (_screenProtector$paus = screenProtector.pauseIdleTimer) === null || _screenProtector$paus === void 0 || _screenProtector$paus.call(screenProtector));
|
|
1588
|
-
}
|
|
1589
|
-
if (event.type === "printOnTimeout") {
|
|
1590
|
-
var _logger$addLog9;
|
|
1591
|
-
yield submitBaseSalesOrder(currentBaseSales, { confirmPendingVoucherPayments: true });
|
|
1592
|
-
if (!(currentBaseSales === null || currentBaseSales === void 0 ? void 0 : currentBaseSales.printLocalOrderReceipt)) return;
|
|
1593
|
-
logger === null || logger === void 0 || (_logger$addLog9 = logger.addLog) === null || _logger$addLog9 === void 0 || _logger$addLog9.call(logger, {
|
|
1594
|
-
type: "info",
|
|
1595
|
-
title: "eftpos支付异常,请求本地打印小票"
|
|
1596
|
-
});
|
|
1597
|
-
try {
|
|
1598
|
-
var _logger$addLog10;
|
|
1599
|
-
const res = yield currentBaseSales.printLocalOrderReceipt();
|
|
1600
|
-
logger === null || logger === void 0 || (_logger$addLog10 = logger.addLog) === null || _logger$addLog10 === void 0 || _logger$addLog10.call(logger, {
|
|
1601
|
-
type: "info",
|
|
1602
|
-
title: "eftpos支付异常,请求本地打印小票结果",
|
|
1603
|
-
metadata: { res }
|
|
1604
|
-
});
|
|
1605
|
-
} catch (error) {
|
|
1724
|
+
if (event.type === "printOnTimeout") {
|
|
1606
1725
|
var _logger$addLog11;
|
|
1607
|
-
|
|
1726
|
+
yield submitBaseSalesOrder(currentBaseSales, { confirmPendingVoucherPayments: true });
|
|
1727
|
+
if (!(currentBaseSales === null || currentBaseSales === void 0 ? void 0 : currentBaseSales.printLocalOrderReceipt)) return;
|
|
1608
1728
|
logger === null || logger === void 0 || (_logger$addLog11 = logger.addLog) === null || _logger$addLog11 === void 0 || _logger$addLog11.call(logger, {
|
|
1609
|
-
type: "
|
|
1610
|
-
title: "eftpos
|
|
1611
|
-
metadata: { error: error instanceof Error ? error.message : String(error) }
|
|
1729
|
+
type: "info",
|
|
1730
|
+
title: "eftpos支付异常,请求本地打印小票"
|
|
1612
1731
|
});
|
|
1732
|
+
try {
|
|
1733
|
+
var _logger$addLog12;
|
|
1734
|
+
const res = yield currentBaseSales.printLocalOrderReceipt();
|
|
1735
|
+
logger === null || logger === void 0 || (_logger$addLog12 = logger.addLog) === null || _logger$addLog12 === void 0 || _logger$addLog12.call(logger, {
|
|
1736
|
+
type: "info",
|
|
1737
|
+
title: "eftpos支付异常,请求本地打印小票结果",
|
|
1738
|
+
metadata: { res }
|
|
1739
|
+
});
|
|
1740
|
+
} catch (error) {
|
|
1741
|
+
var _logger$addLog13;
|
|
1742
|
+
console.error("handleButtonClick_print-receipt_error>>>>", error);
|
|
1743
|
+
logger === null || logger === void 0 || (_logger$addLog13 = logger.addLog) === null || _logger$addLog13 === void 0 || _logger$addLog13.call(logger, {
|
|
1744
|
+
type: "error",
|
|
1745
|
+
title: "eftpos支付异常,请求本地打印小票失败",
|
|
1746
|
+
metadata: { error: error instanceof Error ? error.message : String(error) }
|
|
1747
|
+
});
|
|
1748
|
+
}
|
|
1749
|
+
onPaymentCancel(true);
|
|
1750
|
+
_app.history.replace("/home");
|
|
1613
1751
|
}
|
|
1614
|
-
|
|
1615
|
-
|
|
1616
|
-
|
|
1617
|
-
|
|
1618
|
-
|
|
1619
|
-
|
|
1620
|
-
|
|
1621
|
-
|
|
1622
|
-
|
|
1623
|
-
|
|
1624
|
-
|
|
1625
|
-
|
|
1626
|
-
|
|
1627
|
-
|
|
1628
|
-
|
|
1629
|
-
|
|
1630
|
-
|
|
1631
|
-
|
|
1632
|
-
|
|
1633
|
-
|
|
1634
|
-
|
|
1635
|
-
manual_marking_flag: event.manuallyConfirmed ? 1 : void 0,
|
|
1636
|
-
card_reader_snapshot: event.readerSnapshot
|
|
1752
|
+
if (event.type === "success" || event.type === "failed") {
|
|
1753
|
+
var _screenProtector$resu3, _event$surcharge, _event$surcharge2;
|
|
1754
|
+
screenProtector && (screenProtector === null || screenProtector === void 0 || (_screenProtector$resu3 = screenProtector.resumeIdleTimer) === null || _screenProtector$resu3 === void 0 || _screenProtector$resu3.call(screenProtector));
|
|
1755
|
+
shouldPreservePendingEftpos = true;
|
|
1756
|
+
if (event.type !== "success") return;
|
|
1757
|
+
const paymentAmount = event.amount || finalAmount;
|
|
1758
|
+
const serviceCharge = {
|
|
1759
|
+
percentage: ((_event$surcharge = event.surcharge) === null || _event$surcharge === void 0 ? void 0 : _event$surcharge.ratePercent) ? new Decimal(event.surcharge.ratePercent).div(100).toString() : void 0,
|
|
1760
|
+
amount: (_event$surcharge2 = event.surcharge) === null || _event$surcharge2 === void 0 ? void 0 : _event$surcharge2.fixedAmount
|
|
1761
|
+
};
|
|
1762
|
+
yield updateEftposPayment({
|
|
1763
|
+
paymentNumber,
|
|
1764
|
+
transactionNumber: eventTransactionNumber,
|
|
1765
|
+
updates: {
|
|
1766
|
+
amount: paymentAmount,
|
|
1767
|
+
service_charge: serviceCharge,
|
|
1768
|
+
service_fee: calculateEftposServiceFee(paymentAmount, serviceCharge),
|
|
1769
|
+
metadata: {
|
|
1770
|
+
manual_marking_flag: event.manuallyConfirmed ? 1 : void 0,
|
|
1771
|
+
card_reader_snapshot: event.readerSnapshot
|
|
1772
|
+
}
|
|
1637
1773
|
}
|
|
1638
|
-
}
|
|
1639
|
-
|
|
1640
|
-
|
|
1641
|
-
|
|
1642
|
-
|
|
1643
|
-
|
|
1644
|
-
|
|
1645
|
-
|
|
1774
|
+
});
|
|
1775
|
+
return;
|
|
1776
|
+
}
|
|
1777
|
+
if (event.type === "closed" && !shouldPreservePendingEftpos) {
|
|
1778
|
+
var _screenProtector$resu4;
|
|
1779
|
+
screenProtector && (screenProtector === null || screenProtector === void 0 || (_screenProtector$resu4 = screenProtector.resumeIdleTimer) === null || _screenProtector$resu4 === void 0 || _screenProtector$resu4.call(screenProtector));
|
|
1780
|
+
yield deletePendingEftposPayment(paymentNumber);
|
|
1781
|
+
}
|
|
1782
|
+
} catch (error) {
|
|
1783
|
+
handleEftposUpdateError(error, paymentNumber);
|
|
1784
|
+
} finally {
|
|
1785
|
+
if (isTerminalEvent) finishPaymentActivity();
|
|
1646
1786
|
}
|
|
1647
|
-
}
|
|
1648
|
-
|
|
1649
|
-
|
|
1787
|
+
});
|
|
1788
|
+
return function onChange(_x35) {
|
|
1789
|
+
return _ref28.apply(this, arguments);
|
|
1790
|
+
};
|
|
1791
|
+
}()
|
|
1792
|
+
}))) paymentActivityHandedOff = true;
|
|
1793
|
+
else yield deletePendingEftposPayment(paymentNumber);
|
|
1794
|
+
} else {
|
|
1795
|
+
var _metadata, _screenProtector$resu5;
|
|
1796
|
+
let service_charge = null;
|
|
1797
|
+
if ((method === null || method === void 0 ? void 0 : method.fixed) || (method === null || method === void 0 ? void 0 : method.percentage)) service_charge = {
|
|
1798
|
+
amount: (method === null || method === void 0 ? void 0 : method.fixed) || "0",
|
|
1799
|
+
percentage: (method === null || method === void 0 ? void 0 : method.percentage) || "0"
|
|
1800
|
+
};
|
|
1801
|
+
if (!canAddOrderPayment(finalAmount)) return;
|
|
1802
|
+
if (method.type === "custom" && ((_metadata = method.metadata) === null || _metadata === void 0 ? void 0 : _metadata.order_open_cash_drawer)) {
|
|
1803
|
+
var _interaction$utils2, _interaction$utils2$p;
|
|
1804
|
+
logger === null || logger === void 0 || logger.addLog({
|
|
1805
|
+
type: "info",
|
|
1806
|
+
title: "open_till",
|
|
1807
|
+
metadata: {}
|
|
1650
1808
|
});
|
|
1651
|
-
|
|
1652
|
-
|
|
1653
|
-
|
|
1654
|
-
|
|
1655
|
-
|
|
1656
|
-
|
|
1657
|
-
|
|
1658
|
-
|
|
1659
|
-
|
|
1660
|
-
|
|
1661
|
-
|
|
1662
|
-
|
|
1663
|
-
|
|
1664
|
-
|
|
1665
|
-
|
|
1666
|
-
logger === null || logger === void 0 || logger.addLog({
|
|
1667
|
-
type: "info",
|
|
1668
|
-
title: "open_till",
|
|
1669
|
-
metadata: {}
|
|
1670
|
-
});
|
|
1671
|
-
interaction === null || interaction === void 0 || (_interaction$utils2 = interaction.utils) === null || _interaction$utils2 === void 0 || (_interaction$utils2$p = _interaction$utils2.postMessageToApp) === null || _interaction$utils2$p === void 0 || _interaction$utils2$p.call(_interaction$utils2, {
|
|
1672
|
-
module: "till",
|
|
1673
|
-
key: "open_till",
|
|
1674
|
-
data: { type: "cash" }
|
|
1809
|
+
interaction === null || interaction === void 0 || (_interaction$utils2 = interaction.utils) === null || _interaction$utils2 === void 0 || (_interaction$utils2$p = _interaction$utils2.postMessageToApp) === null || _interaction$utils2$p === void 0 || _interaction$utils2$p.call(_interaction$utils2, {
|
|
1810
|
+
module: "till",
|
|
1811
|
+
key: "open_till",
|
|
1812
|
+
data: { type: "cash" }
|
|
1813
|
+
});
|
|
1814
|
+
}
|
|
1815
|
+
setIsChangePaymentNotIncludeVoucher === null || setIsChangePaymentNotIncludeVoucher === void 0 || setIsChangePaymentNotIncludeVoucher(true);
|
|
1816
|
+
yield addBaseSalesOrderPayment(currentBaseSales, {
|
|
1817
|
+
amount: finalAmount,
|
|
1818
|
+
code: method.code,
|
|
1819
|
+
custom_payment_id: method.id,
|
|
1820
|
+
name: method.name,
|
|
1821
|
+
custom_payment_type: method.type,
|
|
1822
|
+
voucher_id: 0,
|
|
1823
|
+
service_charge
|
|
1675
1824
|
});
|
|
1825
|
+
screenProtector && (screenProtector === null || screenProtector === void 0 || (_screenProtector$resu5 = screenProtector.resumeIdleTimer) === null || _screenProtector$resu5 === void 0 || _screenProtector$resu5.call(screenProtector));
|
|
1676
1826
|
}
|
|
1677
|
-
|
|
1678
|
-
|
|
1679
|
-
amount: finalAmount,
|
|
1680
|
-
code: method.code,
|
|
1681
|
-
custom_payment_id: method.id,
|
|
1682
|
-
name: method.name,
|
|
1683
|
-
custom_payment_type: method.type,
|
|
1684
|
-
voucher_id: 0,
|
|
1685
|
-
service_charge
|
|
1686
|
-
});
|
|
1687
|
-
screenProtector && (screenProtector === null || screenProtector === void 0 || (_screenProtector$resu5 = screenProtector.resumeIdleTimer) === null || _screenProtector$resu5 === void 0 || _screenProtector$resu5.call(screenProtector));
|
|
1827
|
+
} finally {
|
|
1828
|
+
if (!paymentActivityHandedOff) finishPaymentActivity();
|
|
1688
1829
|
}
|
|
1689
1830
|
});
|
|
1690
1831
|
return function onPaymentOptionClick(_x36) {
|
|
@@ -1813,13 +1954,16 @@ const PaymentContent = forwardRef(({ cartData, orderInfo, isModalOpen, onPayment
|
|
|
1813
1954
|
const [confirmLoading, setConfirmLoading] = useState(false);
|
|
1814
1955
|
const handleWalletPassConfirmPay = function() {
|
|
1815
1956
|
var _ref34 = _asyncToGenerator(function* (action) {
|
|
1957
|
+
if (action === "cancel") return;
|
|
1958
|
+
const finishPaymentActivity = beginKioskPaymentActivity("wallet-confirm");
|
|
1959
|
+
if (!finishPaymentActivity) return;
|
|
1816
1960
|
let confirmPendingVoucherPayments = true;
|
|
1817
|
-
if (action === "save-without-deduct") {
|
|
1818
|
-
confirmPendingVoucherPayments = false;
|
|
1819
|
-
yield clearPendingWalletPassPaymentsForMode();
|
|
1820
|
-
} else if (action === "cancel") return;
|
|
1821
1961
|
setConfirmLoading(true);
|
|
1822
1962
|
try {
|
|
1963
|
+
if (action === "save-without-deduct") {
|
|
1964
|
+
confirmPendingVoucherPayments = false;
|
|
1965
|
+
yield clearPendingWalletPassPaymentsForMode();
|
|
1966
|
+
}
|
|
1823
1967
|
const result = confirmPendingVoucherPayments ? yield confirmBaseSalesWalletPayment(currentBaseSales) : yield submitBaseSalesOrder(currentBaseSales, { confirmPendingVoucherPayments: false });
|
|
1824
1968
|
if (result.success) yield cacheSubmittedOrderResult(result);
|
|
1825
1969
|
yield showSuccessToast === null || showSuccessToast === void 0 ? void 0 : showSuccessToast(_objectSpread2({}, result));
|
|
@@ -1839,6 +1983,7 @@ const PaymentContent = forwardRef(({ cartData, orderInfo, isModalOpen, onPayment
|
|
|
1839
1983
|
console.error("Failed to submit base sales order:", error);
|
|
1840
1984
|
} finally {
|
|
1841
1985
|
setConfirmLoading(false);
|
|
1986
|
+
finishPaymentActivity();
|
|
1842
1987
|
}
|
|
1843
1988
|
});
|
|
1844
1989
|
return function handleWalletPassConfirmPay(_x41) {
|
|
@@ -1882,13 +2027,21 @@ const PaymentContent = forwardRef(({ cartData, orderInfo, isModalOpen, onPayment
|
|
|
1882
2027
|
};
|
|
1883
2028
|
const shouldShowCashPayment = moduleConfig.showCashPayment && showCashPayment;
|
|
1884
2029
|
const paymentOptionsColumnCount = (_config$paymentOption = config === null || config === void 0 ? void 0 : config.paymentOptionsColumnCount) !== null && _config$paymentOption !== void 0 ? _config$paymentOption : shouldShowCashPayment ? 1 : 2;
|
|
1885
|
-
const
|
|
1886
|
-
|
|
1887
|
-
|
|
2030
|
+
const isKioskCheckoutActivityLocked = paymentChannel === "kiosk" && (syncingLock || paymentScanActivity.isScanProcessing || paymentScanActivity.isPaymentProcessing);
|
|
2031
|
+
const handleSearch = useMemoizedFn(function() {
|
|
2032
|
+
var _ref37 = _asyncToGenerator(function* (keyword) {
|
|
2033
|
+
if (!walletPassRef.current) return void 0;
|
|
2034
|
+
if (paymentChannel !== "kiosk") return walletPassRef.current.handleSearchIdentificationCode(keyword);
|
|
2035
|
+
return walletPassRef.current.handleSearchIdentificationCode(keyword, { waitForApply: true });
|
|
2036
|
+
});
|
|
2037
|
+
return function(_x43) {
|
|
2038
|
+
return _ref37.apply(this, arguments);
|
|
2039
|
+
};
|
|
2040
|
+
}());
|
|
1888
2041
|
useEffect(() => {
|
|
1889
2042
|
let isCancelled = false;
|
|
1890
2043
|
(function() {
|
|
1891
|
-
var
|
|
2044
|
+
var _ref39 = _asyncToGenerator(function* () {
|
|
1892
2045
|
var _currentBaseSales$get14, _amountSnapshot$summa;
|
|
1893
2046
|
if (!currentBaseSales) {
|
|
1894
2047
|
setPriceAdjustProductExpectAmount(void 0);
|
|
@@ -1897,16 +2050,16 @@ const PaymentContent = forwardRef(({ cartData, orderInfo, isModalOpen, onPayment
|
|
|
1897
2050
|
const amountSnapshot = (_currentBaseSales$get14 = currentBaseSales.getOrderAmountSnapshot) === null || _currentBaseSales$get14 === void 0 ? void 0 : _currentBaseSales$get14.call(currentBaseSales);
|
|
1898
2051
|
let productExpectAmount = amountSnapshot === null || amountSnapshot === void 0 || (_amountSnapshot$summa = amountSnapshot.summary) === null || _amountSnapshot$summa === void 0 ? void 0 : _amountSnapshot$summa.product_expect_amount;
|
|
1899
2052
|
try {
|
|
1900
|
-
var _currentBaseSales$get15,
|
|
2053
|
+
var _currentBaseSales$get15, _ref38, _summary$product_expe, _summary$summary;
|
|
1901
2054
|
const summary = yield (_currentBaseSales$get15 = currentBaseSales.getSummary) === null || _currentBaseSales$get15 === void 0 ? void 0 : _currentBaseSales$get15.call(currentBaseSales);
|
|
1902
|
-
productExpectAmount = (
|
|
2055
|
+
productExpectAmount = (_ref38 = (_summary$product_expe = summary === null || summary === void 0 ? void 0 : summary.product_expect_amount) !== null && _summary$product_expe !== void 0 ? _summary$product_expe : summary === null || summary === void 0 || (_summary$summary = summary.summary) === null || _summary$summary === void 0 ? void 0 : _summary$summary.product_expect_amount) !== null && _ref38 !== void 0 ? _ref38 : productExpectAmount;
|
|
1903
2056
|
} catch (error) {
|
|
1904
2057
|
console.error("Failed to read BaseSales summary:", error);
|
|
1905
2058
|
}
|
|
1906
2059
|
if (!isCancelled) setPriceAdjustProductExpectAmount(productExpectAmount);
|
|
1907
2060
|
});
|
|
1908
2061
|
return function readProductExpectAmount() {
|
|
1909
|
-
return
|
|
2062
|
+
return _ref39.apply(this, arguments);
|
|
1910
2063
|
};
|
|
1911
2064
|
})()();
|
|
1912
2065
|
return () => {
|
|
@@ -1919,8 +2072,8 @@ const PaymentContent = forwardRef(({ cartData, orderInfo, isModalOpen, onPayment
|
|
|
1919
2072
|
balanceDueTotalAmount
|
|
1920
2073
|
]);
|
|
1921
2074
|
const priceAdjustOriginalAmount = useMemo(() => {
|
|
1922
|
-
var
|
|
1923
|
-
return Number((
|
|
2075
|
+
var _ref40, _ref41;
|
|
2076
|
+
return Number((_ref40 = (_ref41 = priceAdjustProductExpectAmount !== null && priceAdjustProductExpectAmount !== void 0 ? priceAdjustProductExpectAmount : currentTotalPrice) !== null && _ref41 !== void 0 ? _ref41 : orderInfo === null || orderInfo === void 0 ? void 0 : orderInfo.totalAmount) !== null && _ref40 !== void 0 ? _ref40 : 0);
|
|
1924
2077
|
}, [
|
|
1925
2078
|
priceAdjustProductExpectAmount,
|
|
1926
2079
|
currentTotalPrice,
|
|
@@ -1930,7 +2083,7 @@ const PaymentContent = forwardRef(({ cartData, orderInfo, isModalOpen, onPayment
|
|
|
1930
2083
|
return new Decimal(priceAdjustOriginalAmount).minus(shopDiscount || 0).toNumber();
|
|
1931
2084
|
}, [shopDiscount, priceAdjustOriginalAmount]);
|
|
1932
2085
|
const handleSelectWalletChange = useMemoizedFn(function() {
|
|
1933
|
-
var
|
|
2086
|
+
var _ref42 = _asyncToGenerator(function* (select) {
|
|
1934
2087
|
if (walletPassMode === "shared") {
|
|
1935
2088
|
var _currentBaseSales$get16;
|
|
1936
2089
|
setPaymentItems((currentBaseSales === null || currentBaseSales === void 0 || (_currentBaseSales$get16 = currentBaseSales.getOrderPayments) === null || _currentBaseSales$get16 === void 0 ? void 0 : _currentBaseSales$get16.call(currentBaseSales)) || []);
|
|
@@ -1986,8 +2139,8 @@ const PaymentContent = forwardRef(({ cartData, orderInfo, isModalOpen, onPayment
|
|
|
1986
2139
|
}
|
|
1987
2140
|
});
|
|
1988
2141
|
if (typeof (currentBaseSales === null || currentBaseSales === void 0 ? void 0 : currentBaseSales.updateVoucherOrderPaymentsAsync) !== "function" && typeof (currentBaseSales === null || currentBaseSales === void 0 ? void 0 : currentBaseSales.updateVoucherOrderPayments) !== "function") {
|
|
1989
|
-
var _logger$
|
|
1990
|
-
logger === null || logger === void 0 || (_logger$
|
|
2142
|
+
var _logger$addLog14;
|
|
2143
|
+
logger === null || logger === void 0 || (_logger$addLog14 = logger.addLog) === null || _logger$addLog14 === void 0 || _logger$addLog14.call(logger, {
|
|
1991
2144
|
type: "error",
|
|
1992
2145
|
title: "BaseSales updateVoucherOrderPayments is not available",
|
|
1993
2146
|
metadata: {
|
|
@@ -2003,8 +2156,8 @@ const PaymentContent = forwardRef(({ cartData, orderInfo, isModalOpen, onPayment
|
|
|
2003
2156
|
if (walletPassRef.current) setWalletPassData(walletPassRef.current.getWalletPassData(select));
|
|
2004
2157
|
}
|
|
2005
2158
|
});
|
|
2006
|
-
return function(
|
|
2007
|
-
return
|
|
2159
|
+
return function(_x44) {
|
|
2160
|
+
return _ref42.apply(this, arguments);
|
|
2008
2161
|
};
|
|
2009
2162
|
}());
|
|
2010
2163
|
const handleWalletDiscountChange = useMemoizedFn((detail) => {
|
|
@@ -2021,7 +2174,7 @@ const PaymentContent = forwardRef(({ cartData, orderInfo, isModalOpen, onPayment
|
|
|
2021
2174
|
}
|
|
2022
2175
|
});
|
|
2023
2176
|
const handlePriceAdjustConfirm = function() {
|
|
2024
|
-
var
|
|
2177
|
+
var _ref43 = _asyncToGenerator(function* (discountAmount) {
|
|
2025
2178
|
if (!isPriceAdjustEnabled) {
|
|
2026
2179
|
setShowPriceAdjustModal(false);
|
|
2027
2180
|
return;
|
|
@@ -2045,12 +2198,12 @@ const PaymentContent = forwardRef(({ cartData, orderInfo, isModalOpen, onPayment
|
|
|
2045
2198
|
}
|
|
2046
2199
|
setShowPriceAdjustModal(false);
|
|
2047
2200
|
});
|
|
2048
|
-
return function handlePriceAdjustConfirm(
|
|
2049
|
-
return
|
|
2201
|
+
return function handlePriceAdjustConfirm(_x45) {
|
|
2202
|
+
return _ref43.apply(this, arguments);
|
|
2050
2203
|
};
|
|
2051
2204
|
}();
|
|
2052
2205
|
const handleButtonClick = function() {
|
|
2053
|
-
var
|
|
2206
|
+
var _ref44 = _asyncToGenerator(function* (key) {
|
|
2054
2207
|
console.log("handleButtonClick", key);
|
|
2055
2208
|
switch (key) {
|
|
2056
2209
|
case "order-note":
|
|
@@ -2063,24 +2216,24 @@ const PaymentContent = forwardRef(({ cartData, orderInfo, isModalOpen, onPayment
|
|
|
2063
2216
|
setShowSplitPaymentKeyboard(true);
|
|
2064
2217
|
break;
|
|
2065
2218
|
case "print-receipt":
|
|
2066
|
-
var _logger$
|
|
2219
|
+
var _logger$addLog15;
|
|
2067
2220
|
if (!(currentBaseSales === null || currentBaseSales === void 0 ? void 0 : currentBaseSales.printLocalOrderReceipt)) return;
|
|
2068
|
-
logger === null || logger === void 0 || (_logger$
|
|
2221
|
+
logger === null || logger === void 0 || (_logger$addLog15 = logger.addLog) === null || _logger$addLog15 === void 0 || _logger$addLog15.call(logger, {
|
|
2069
2222
|
type: "info",
|
|
2070
2223
|
title: "支付弹窗请求本地打印小票"
|
|
2071
2224
|
});
|
|
2072
2225
|
try {
|
|
2073
|
-
var _logger$
|
|
2226
|
+
var _logger$addLog16;
|
|
2074
2227
|
const res = yield currentBaseSales.printLocalOrderReceipt();
|
|
2075
|
-
logger === null || logger === void 0 || (_logger$
|
|
2228
|
+
logger === null || logger === void 0 || (_logger$addLog16 = logger.addLog) === null || _logger$addLog16 === void 0 || _logger$addLog16.call(logger, {
|
|
2076
2229
|
type: "info",
|
|
2077
2230
|
title: "支付弹窗请求本地打印小票结果",
|
|
2078
2231
|
metadata: { res }
|
|
2079
2232
|
});
|
|
2080
2233
|
} catch (error) {
|
|
2081
|
-
var _logger$
|
|
2234
|
+
var _logger$addLog17;
|
|
2082
2235
|
console.error("handleButtonClick_print-receipt_error>>>>", error);
|
|
2083
|
-
logger === null || logger === void 0 || (_logger$
|
|
2236
|
+
logger === null || logger === void 0 || (_logger$addLog17 = logger.addLog) === null || _logger$addLog17 === void 0 || _logger$addLog17.call(logger, {
|
|
2084
2237
|
type: "error",
|
|
2085
2238
|
title: "支付弹窗请求本地打印小票失败",
|
|
2086
2239
|
metadata: { error: error instanceof Error ? error.message : String(error) }
|
|
@@ -2111,8 +2264,8 @@ const PaymentContent = forwardRef(({ cartData, orderInfo, isModalOpen, onPayment
|
|
|
2111
2264
|
break;
|
|
2112
2265
|
}
|
|
2113
2266
|
});
|
|
2114
|
-
return function handleButtonClick(
|
|
2115
|
-
return
|
|
2267
|
+
return function handleButtonClick(_x46) {
|
|
2268
|
+
return _ref44.apply(this, arguments);
|
|
2116
2269
|
};
|
|
2117
2270
|
}();
|
|
2118
2271
|
useImperativeHandle(ref, () => ({
|
|
@@ -2138,7 +2291,7 @@ const PaymentContent = forwardRef(({ cartData, orderInfo, isModalOpen, onPayment
|
|
|
2138
2291
|
};
|
|
2139
2292
|
};
|
|
2140
2293
|
const handleSendCustomerPaymentLink = function() {
|
|
2141
|
-
var
|
|
2294
|
+
var _ref45 = _asyncToGenerator(function* (data) {
|
|
2142
2295
|
var _currentBaseSales$get20, _Toast$loading4, _currentBaseSales$get23, _Toast$hide6;
|
|
2143
2296
|
let orderId = currentBaseSales === null || currentBaseSales === void 0 || (_currentBaseSales$get20 = currentBaseSales.getOrderIdentity) === null || _currentBaseSales$get20 === void 0 || (_currentBaseSales$get20 = _currentBaseSales$get20.call(currentBaseSales)) === null || _currentBaseSales$get20 === void 0 ? void 0 : _currentBaseSales$get20.orderId;
|
|
2144
2297
|
const order = getBaseSalesOrderInfo(currentBaseSales);
|
|
@@ -2177,8 +2330,8 @@ const PaymentContent = forwardRef(({ cartData, orderInfo, isModalOpen, onPayment
|
|
|
2177
2330
|
}, 1e3);
|
|
2178
2331
|
} else Toast === null || Toast === void 0 || Toast.error(res.message || locales.getText("pisell2.checkout.send-payment-link.error"));
|
|
2179
2332
|
});
|
|
2180
|
-
return function handleSendCustomerPaymentLink(
|
|
2181
|
-
return
|
|
2333
|
+
return function handleSendCustomerPaymentLink(_x47) {
|
|
2334
|
+
return _ref45.apply(this, arguments);
|
|
2182
2335
|
};
|
|
2183
2336
|
}();
|
|
2184
2337
|
const handleClientChange = useCallback((nextClient) => {
|
|
@@ -2221,12 +2374,12 @@ const PaymentContent = forwardRef(({ cartData, orderInfo, isModalOpen, onPayment
|
|
|
2221
2374
|
customerGuard.isCustomerChangeLocked
|
|
2222
2375
|
]);
|
|
2223
2376
|
const roundingFunction = useCallback(function() {
|
|
2224
|
-
var
|
|
2377
|
+
var _ref46 = _asyncToGenerator(function* (amount) {
|
|
2225
2378
|
var _currentBaseSales$rou;
|
|
2226
2379
|
return yield currentBaseSales === null || currentBaseSales === void 0 || (_currentBaseSales$rou = currentBaseSales.roundAmount) === null || _currentBaseSales$rou === void 0 ? void 0 : _currentBaseSales$rou.call(currentBaseSales, { amount });
|
|
2227
2380
|
});
|
|
2228
|
-
return function(
|
|
2229
|
-
return
|
|
2381
|
+
return function(_x48) {
|
|
2382
|
+
return _ref46.apply(this, arguments);
|
|
2230
2383
|
};
|
|
2231
2384
|
}(), [currentBaseSales]);
|
|
2232
2385
|
const handleModalClick = useCallback((event) => {
|
|
@@ -2236,13 +2389,13 @@ const PaymentContent = forwardRef(({ cartData, orderInfo, isModalOpen, onPayment
|
|
|
2236
2389
|
padding: "12px 16px",
|
|
2237
2390
|
border: "1px solid #d0d5dd",
|
|
2238
2391
|
borderRadius: 8
|
|
2239
|
-
} }, (moduleConfig.showCustomerModule || moduleConfig.showCustomerSelect) && /* @__PURE__ */ React.createElement(SearchAndClientModule_default, _objectSpread2({
|
|
2392
|
+
} }, (moduleConfig.showCustomerModule || moduleConfig.showCustomerSelect) && /* @__PURE__ */ React.createElement(SearchAndClientModule_default, _objectSpread2(_objectSpread2({
|
|
2240
2393
|
onClientChange: handleClientChange,
|
|
2241
2394
|
clientInfo: displayClient,
|
|
2242
2395
|
onSearch: handleSearch,
|
|
2243
2396
|
baseSales: currentBaseSales,
|
|
2244
2397
|
showCustomerSelect: moduleConfig.showCustomerSelect
|
|
2245
|
-
}, searchAndClientProps)), moduleConfig.showWalletPass && /* @__PURE__ */ React.createElement(WalletPassModule_default, {
|
|
2398
|
+
}, searchAndClientProps), {}, { beginScanActivity: paymentChannel === "kiosk" ? beginKioskScanActivity : void 0 })), moduleConfig.showWalletPass && /* @__PURE__ */ React.createElement(WalletPassModule_default, {
|
|
2246
2399
|
clientId: (_displayClient$id2 = displayClient === null || displayClient === void 0 ? void 0 : displayClient.id) !== null && _displayClient$id2 !== void 0 ? _displayClient$id2 : displayClient === null || displayClient === void 0 ? void 0 : displayClient.customer_id,
|
|
2247
2400
|
customAmount: balanceDueAmount,
|
|
2248
2401
|
orderInfo: orderInfo || void 0,
|
|
@@ -2273,13 +2426,19 @@ const PaymentContent = forwardRef(({ cartData, orderInfo, isModalOpen, onPayment
|
|
|
2273
2426
|
shouldUseNormalPayment: hasNonDepositOrderPayment,
|
|
2274
2427
|
enablePriceAdjust: isPriceAdjustEnabled,
|
|
2275
2428
|
showPaymentType: (config === null || config === void 0 ? void 0 : config.showPaymentType) !== false
|
|
2276
|
-
}), /* @__PURE__ */ React.createElement("div", { className: shouldShowCashPayment ? "payment-grid-layout" : "payment-flex-layout" }, shouldShowCashPayment && /* @__PURE__ */ React.createElement("div", {
|
|
2277
|
-
|
|
2278
|
-
|
|
2279
|
-
|
|
2429
|
+
}), /* @__PURE__ */ React.createElement("div", { className: shouldShowCashPayment ? "payment-grid-layout" : "payment-flex-layout" }, shouldShowCashPayment && /* @__PURE__ */ React.createElement("div", {
|
|
2430
|
+
"aria-disabled": isKioskCheckoutActivityLocked,
|
|
2431
|
+
style: _objectSpread2(_objectSpread2({}, shouldShowCashPayment ? {
|
|
2432
|
+
gridColumn: "1",
|
|
2433
|
+
gridRow: (paymentOptionList === null || paymentOptionList === void 0 ? void 0 : paymentOptionList.length) === 1 ? "span 2" : "1"
|
|
2434
|
+
} : {}), isKioskCheckoutActivityLocked ? {
|
|
2435
|
+
opacity: .6,
|
|
2436
|
+
pointerEvents: "none"
|
|
2437
|
+
} : {})
|
|
2438
|
+
}, /* @__PURE__ */ React.createElement(CashPaymentModule_default, {
|
|
2280
2439
|
disabled: isOrderFree,
|
|
2281
2440
|
isModalOpen,
|
|
2282
|
-
syncingLock,
|
|
2441
|
+
syncingLock: syncingLock || isKioskCheckoutActivityLocked,
|
|
2283
2442
|
amountSymbol: getData("shop_symbol"),
|
|
2284
2443
|
orderInfo: orderInfo || void 0,
|
|
2285
2444
|
onPaymentComplete: handleAddCashPayment,
|
|
@@ -2302,7 +2461,7 @@ const PaymentContent = forwardRef(({ cartData, orderInfo, isModalOpen, onPayment
|
|
|
2302
2461
|
paymentMethods,
|
|
2303
2462
|
customAmount: effectiveCustomAmount,
|
|
2304
2463
|
title: paymentOptionsTitle,
|
|
2305
|
-
disabled: isOrderFree,
|
|
2464
|
+
disabled: isOrderFree || isKioskCheckoutActivityLocked,
|
|
2306
2465
|
showCashPayment: shouldShowCashPayment,
|
|
2307
2466
|
channel: paymentChannel,
|
|
2308
2467
|
columnCount: paymentOptionsColumnCount,
|
|
@@ -2310,6 +2469,7 @@ const PaymentContent = forwardRef(({ cartData, orderInfo, isModalOpen, onPayment
|
|
|
2310
2469
|
directCustomPayment: (config === null || config === void 0 ? void 0 : config.directCustomPayment) === true,
|
|
2311
2470
|
isModalOpen,
|
|
2312
2471
|
paymentMethodsReady,
|
|
2472
|
+
beginKioskPaymentActivity,
|
|
2313
2473
|
currentBaseSales,
|
|
2314
2474
|
autoTriggerSinglePaymentOption: (config === null || config === void 0 ? void 0 : config.autoTriggerSinglePaymentOption) === true
|
|
2315
2475
|
})), moduleConfig.showAdditionalModule && /* @__PURE__ */ React.createElement("div", {
|
|
@@ -2414,8 +2574,8 @@ const PaymentModal = ({ open, baseSales, baseSalesModuleName, walletPassMode = "
|
|
|
2414
2574
|
const cardReaderFetchPromiseRef = useRef(null);
|
|
2415
2575
|
const [totalAmount, setTotalAmount] = useState(0);
|
|
2416
2576
|
const displayTotalAmount = useMemo(() => {
|
|
2417
|
-
var
|
|
2418
|
-
return Number((
|
|
2577
|
+
var _ref47, _orderInfo$totalAmoun;
|
|
2578
|
+
return Number((_ref47 = (_orderInfo$totalAmoun = orderInfo === null || orderInfo === void 0 ? void 0 : orderInfo.totalAmount) !== null && _orderInfo$totalAmoun !== void 0 ? _orderInfo$totalAmoun : totalAmount) !== null && _ref47 !== void 0 ? _ref47 : 0);
|
|
2419
2579
|
}, [orderInfo === null || orderInfo === void 0 ? void 0 : orderInfo.totalAmount, totalAmount]);
|
|
2420
2580
|
const [actualShowCashPayment, setActualShowCashPayment] = useState(true);
|
|
2421
2581
|
const [windowHeight, setWindowHeight] = useState(0);
|
|
@@ -2449,7 +2609,7 @@ const PaymentModal = ({ open, baseSales, baseSalesModuleName, walletPassMode = "
|
|
|
2449
2609
|
Toast
|
|
2450
2610
|
]);
|
|
2451
2611
|
const handleRetry = function() {
|
|
2452
|
-
var
|
|
2612
|
+
var _ref48 = _asyncToGenerator(function* () {
|
|
2453
2613
|
if (isRetryingPaymentSync) return;
|
|
2454
2614
|
setIsRetryingPaymentSync(true);
|
|
2455
2615
|
try {
|
|
@@ -2462,7 +2622,7 @@ const PaymentModal = ({ open, baseSales, baseSalesModuleName, walletPassMode = "
|
|
|
2462
2622
|
}
|
|
2463
2623
|
});
|
|
2464
2624
|
return function handleRetry() {
|
|
2465
|
-
return
|
|
2625
|
+
return _ref48.apply(this, arguments);
|
|
2466
2626
|
};
|
|
2467
2627
|
}();
|
|
2468
2628
|
useEffect(() => {
|
|
@@ -2480,7 +2640,7 @@ const PaymentModal = ({ open, baseSales, baseSalesModuleName, walletPassMode = "
|
|
|
2480
2640
|
useEffect(() => {
|
|
2481
2641
|
var _interaction$utils4;
|
|
2482
2642
|
const initTillButtonData = function() {
|
|
2483
|
-
var
|
|
2643
|
+
var _ref49 = _asyncToGenerator(function* () {
|
|
2484
2644
|
console.log("准备获取tillButton数据");
|
|
2485
2645
|
try {
|
|
2486
2646
|
var _interaction$utils3, _interaction$utils3$a;
|
|
@@ -2498,7 +2658,7 @@ const PaymentModal = ({ open, baseSales, baseSalesModuleName, walletPassMode = "
|
|
|
2498
2658
|
}
|
|
2499
2659
|
});
|
|
2500
2660
|
return function initTillButtonData() {
|
|
2501
|
-
return
|
|
2661
|
+
return _ref49.apply(this, arguments);
|
|
2502
2662
|
};
|
|
2503
2663
|
}();
|
|
2504
2664
|
if (interaction === null || interaction === void 0 || (_interaction$utils4 = interaction.utils) === null || _interaction$utils4 === void 0 ? void 0 : _interaction$utils4.asyncDataManager) initTillButtonData();
|
|
@@ -2553,7 +2713,7 @@ const PaymentModal = ({ open, baseSales, baseSalesModuleName, walletPassMode = "
|
|
|
2553
2713
|
const [orderNote, setOrderNote] = useState("");
|
|
2554
2714
|
const [noteModalSource, setNoteModalSource] = useState("payment-content");
|
|
2555
2715
|
const handleNoteConfirm = function() {
|
|
2556
|
-
var
|
|
2716
|
+
var _ref50 = _asyncToGenerator(function* (noteValue) {
|
|
2557
2717
|
if (noteModalSource === "payment-result-toast") {
|
|
2558
2718
|
var _baseSalesModule$getO;
|
|
2559
2719
|
const baseSalesModule = currentBaseSales;
|
|
@@ -2586,12 +2746,12 @@ const PaymentModal = ({ open, baseSales, baseSalesModuleName, walletPassMode = "
|
|
|
2586
2746
|
setNoteModalOpen(false);
|
|
2587
2747
|
setNoteModalSource("payment-content");
|
|
2588
2748
|
});
|
|
2589
|
-
return function handleNoteConfirm(
|
|
2590
|
-
return
|
|
2749
|
+
return function handleNoteConfirm(_x49) {
|
|
2750
|
+
return _ref50.apply(this, arguments);
|
|
2591
2751
|
};
|
|
2592
2752
|
}();
|
|
2593
2753
|
const handleNoteDelete = function() {
|
|
2594
|
-
var
|
|
2754
|
+
var _ref51 = _asyncToGenerator(function* () {
|
|
2595
2755
|
try {
|
|
2596
2756
|
const baseSalesModule = currentBaseSales;
|
|
2597
2757
|
if (baseSalesModule) {
|
|
@@ -2609,7 +2769,7 @@ const PaymentModal = ({ open, baseSales, baseSalesModuleName, walletPassMode = "
|
|
|
2609
2769
|
setNoteModalSource("payment-content");
|
|
2610
2770
|
});
|
|
2611
2771
|
return function handleNoteDelete() {
|
|
2612
|
-
return
|
|
2772
|
+
return _ref51.apply(this, arguments);
|
|
2613
2773
|
};
|
|
2614
2774
|
}();
|
|
2615
2775
|
const handleNoteCancel = () => {
|
|
@@ -2682,7 +2842,7 @@ const PaymentModal = ({ open, baseSales, baseSalesModuleName, walletPassMode = "
|
|
|
2682
2842
|
});
|
|
2683
2843
|
};
|
|
2684
2844
|
const handlePaymentCancel = function() {
|
|
2685
|
-
var
|
|
2845
|
+
var _ref52 = _asyncToGenerator(function* (reset, forceCloseWhenSyncing, reason) {
|
|
2686
2846
|
var _paymentContentRef$cu3, _paymentContentRef$cu4, _baseSalesModule$getO2;
|
|
2687
2847
|
const isSyncingLocked = ((_paymentContentRef$cu3 = paymentContentRef.current) === null || _paymentContentRef$cu3 === void 0 || (_paymentContentRef$cu4 = _paymentContentRef$cu3.getSyncingLock) === null || _paymentContentRef$cu4 === void 0 ? void 0 : _paymentContentRef$cu4.call(_paymentContentRef$cu3)) || false;
|
|
2688
2848
|
console.log("Payment cancelled, syncingLock:", isSyncingLocked);
|
|
@@ -2714,8 +2874,8 @@ const PaymentModal = ({ open, baseSales, baseSalesModuleName, walletPassMode = "
|
|
|
2714
2874
|
paymentResult: currentPaymentResultRef.current
|
|
2715
2875
|
}, startNewOrderEvent ? { event: startNewOrderEvent } : {}));
|
|
2716
2876
|
});
|
|
2717
|
-
return function handlePaymentCancel(
|
|
2718
|
-
return
|
|
2877
|
+
return function handlePaymentCancel(_x50, _x51, _x52) {
|
|
2878
|
+
return _ref52.apply(this, arguments);
|
|
2719
2879
|
};
|
|
2720
2880
|
}();
|
|
2721
2881
|
const handleBackClose = useMemoizedFn(_asyncToGenerator(function* () {
|
|
@@ -2761,7 +2921,7 @@ const PaymentModal = ({ open, baseSales, baseSalesModuleName, walletPassMode = "
|
|
|
2761
2921
|
});
|
|
2762
2922
|
}));
|
|
2763
2923
|
(function() {
|
|
2764
|
-
var
|
|
2924
|
+
var _ref53 = _asyncToGenerator(function* (closeModal = false) {
|
|
2765
2925
|
var _baseSalesModule$getO3, _baseSalesModule$getO4;
|
|
2766
2926
|
const baseSalesModule = currentBaseSales;
|
|
2767
2927
|
const orderId = baseSalesModule === null || baseSalesModule === void 0 || (_baseSalesModule$getO3 = baseSalesModule.getOrderIdentity) === null || _baseSalesModule$getO3 === void 0 || (_baseSalesModule$getO3 = _baseSalesModule$getO3.call(baseSalesModule)) === null || _baseSalesModule$getO3 === void 0 ? void 0 : _baseSalesModule$getO3.orderId;
|
|
@@ -2781,7 +2941,7 @@ const PaymentModal = ({ open, baseSales, baseSalesModuleName, walletPassMode = "
|
|
|
2781
2941
|
}, closeModal);
|
|
2782
2942
|
});
|
|
2783
2943
|
return function handleSetEditCartMode() {
|
|
2784
|
-
return
|
|
2944
|
+
return _ref53.apply(this, arguments);
|
|
2785
2945
|
};
|
|
2786
2946
|
})();
|
|
2787
2947
|
const CustomHeader = () => /* @__PURE__ */ React.createElement("div", { className: "payment-modal-custom-header" }, /* @__PURE__ */ React.createElement("div", { className: "header__left" }, /* @__PURE__ */ React.createElement(Button, {
|
|
@@ -2806,7 +2966,7 @@ const PaymentModal = ({ open, baseSales, baseSalesModuleName, walletPassMode = "
|
|
|
2806
2966
|
const unsubscribeRef = useRef(void 0);
|
|
2807
2967
|
useEffect(() => {
|
|
2808
2968
|
(function() {
|
|
2809
|
-
var
|
|
2969
|
+
var _ref54 = _asyncToGenerator(function* () {
|
|
2810
2970
|
try {
|
|
2811
2971
|
const baseSalesModule = currentBaseSales;
|
|
2812
2972
|
if (baseSalesModule) {
|
|
@@ -2864,7 +3024,7 @@ const PaymentModal = ({ open, baseSales, baseSalesModuleName, walletPassMode = "
|
|
|
2864
3024
|
}
|
|
2865
3025
|
});
|
|
2866
3026
|
return function initCheckoutData() {
|
|
2867
|
-
return
|
|
3027
|
+
return _ref54.apply(this, arguments);
|
|
2868
3028
|
};
|
|
2869
3029
|
})()();
|
|
2870
3030
|
}, []);
|
|
@@ -2899,7 +3059,7 @@ const PaymentModal = ({ open, baseSales, baseSalesModuleName, walletPassMode = "
|
|
|
2899
3059
|
closePaymentResultToastV2();
|
|
2900
3060
|
};
|
|
2901
3061
|
const handleDetailsClick = function() {
|
|
2902
|
-
var
|
|
3062
|
+
var _ref55 = _asyncToGenerator(function* () {
|
|
2903
3063
|
var _context$appHelper4, _context$appHelper4$a;
|
|
2904
3064
|
setTimeout(() => {
|
|
2905
3065
|
closeResultToast();
|
|
@@ -2914,25 +3074,25 @@ const PaymentModal = ({ open, baseSales, baseSalesModuleName, walletPassMode = "
|
|
|
2914
3074
|
});
|
|
2915
3075
|
});
|
|
2916
3076
|
return function handleDetailsClick() {
|
|
2917
|
-
return
|
|
3077
|
+
return _ref55.apply(this, arguments);
|
|
2918
3078
|
};
|
|
2919
3079
|
}();
|
|
2920
3080
|
const handlePrintReceiptClick = function() {
|
|
2921
|
-
var
|
|
2922
|
-
var _logger$
|
|
3081
|
+
var _ref56 = _asyncToGenerator(function* () {
|
|
3082
|
+
var _logger$addLog18;
|
|
2923
3083
|
setTimeout(() => {
|
|
2924
3084
|
closeResultToast();
|
|
2925
3085
|
}, 0);
|
|
2926
3086
|
const baseSalesModule = currentBaseSales;
|
|
2927
3087
|
if (!(baseSalesModule === null || baseSalesModule === void 0 ? void 0 : baseSalesModule.printLocalOrderReceipt)) return;
|
|
2928
|
-
(_logger$
|
|
3088
|
+
(_logger$addLog18 = logger.addLog) === null || _logger$addLog18 === void 0 || _logger$addLog18.call(logger, {
|
|
2929
3089
|
type: "info",
|
|
2930
3090
|
title: "支付结果弹窗请求本地打印小票"
|
|
2931
3091
|
});
|
|
2932
3092
|
try {
|
|
2933
|
-
var _logger$
|
|
3093
|
+
var _logger$addLog19;
|
|
2934
3094
|
const res = yield baseSalesModule.printLocalOrderReceipt(orderId);
|
|
2935
|
-
(_logger$
|
|
3095
|
+
(_logger$addLog19 = logger.addLog) === null || _logger$addLog19 === void 0 || _logger$addLog19.call(logger, {
|
|
2936
3096
|
type: "info",
|
|
2937
3097
|
title: "支付结果弹窗请求本地打印小票结果",
|
|
2938
3098
|
metadata: { res }
|
|
@@ -2943,7 +3103,7 @@ const PaymentModal = ({ open, baseSales, baseSalesModuleName, walletPassMode = "
|
|
|
2943
3103
|
}
|
|
2944
3104
|
});
|
|
2945
3105
|
return function handlePrintReceiptClick() {
|
|
2946
|
-
return
|
|
3106
|
+
return _ref56.apply(this, arguments);
|
|
2947
3107
|
};
|
|
2948
3108
|
}();
|
|
2949
3109
|
const handleRetryClick = () => {
|