@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
|
@@ -32,6 +32,7 @@ const require_index$11 = require("./components/SearchAndClientModule/index.js");
|
|
|
32
32
|
const require_voucherPayment = require("./utils/voucherPayment.js");
|
|
33
33
|
const require_usePaymentModalBaseSales = require("./hooks/usePaymentModalBaseSales.js");
|
|
34
34
|
const require_useCustomerGuard = require("./hooks/useCustomerGuard.js");
|
|
35
|
+
const require_useCheckoutPaymentScanActivity = require("./hooks/useCheckoutPaymentScanActivity.js");
|
|
35
36
|
let react = require("react");
|
|
36
37
|
react = require_runtime.__toESM(react);
|
|
37
38
|
let antd = require("antd");
|
|
@@ -471,6 +472,8 @@ const PaymentContent = (0, react.forwardRef)(({ cartData, orderInfo, isModalOpen
|
|
|
471
472
|
const [paymentOptionsTitle, setPaymentOptionsTitle] = (0, react.useState)(_pisell_utils.locales.getText("cards.and.digitals") || "Cards & Digitals");
|
|
472
473
|
require_OsKeyContext.useOsKey();
|
|
473
474
|
const paymentChannel = (0, react.useMemo)(() => String((getData === null || getData === void 0 ? void 0 : getData("channel")) || "pos").trim().toLowerCase(), [getData]);
|
|
475
|
+
const paymentScanActivity = require_useCheckoutPaymentScanActivity.default(paymentChannel === "kiosk");
|
|
476
|
+
const activeKioskPaymentActivityRef = (0, react.useRef)();
|
|
474
477
|
const paymentOptionList = (0, react.useMemo)(() => {
|
|
475
478
|
return paymentMethods.filter((item) => {
|
|
476
479
|
var _item$channel_applica;
|
|
@@ -531,6 +534,98 @@ const PaymentContent = (0, react.forwardRef)(({ cartData, orderInfo, isModalOpen
|
|
|
531
534
|
const isPriceAdjustEnabled = (config === null || config === void 0 ? void 0 : config.enablePriceAdjust) !== false;
|
|
532
535
|
const [priceAdjustProductExpectAmount, setPriceAdjustProductExpectAmount] = (0, react.useState)();
|
|
533
536
|
const logger = require_usePaymentLogger.default();
|
|
537
|
+
const notifyScanBlockedByPayment = (0, ahooks.useMemoizedFn)(() => {
|
|
538
|
+
var _Toast$info;
|
|
539
|
+
Toast === null || Toast === void 0 || (_Toast$info = Toast.info) === null || _Toast$info === void 0 || _Toast$info.call(Toast, _pisell_utils.locales.getText("pisell2.checkout.scan-blocked-by-payment"));
|
|
540
|
+
});
|
|
541
|
+
const notifyPaymentBlockedByScan = (0, ahooks.useMemoizedFn)(() => {
|
|
542
|
+
var _Toast$info2;
|
|
543
|
+
Toast === null || Toast === void 0 || (_Toast$info2 = Toast.info) === null || _Toast$info2 === void 0 || _Toast$info2.call(Toast, _pisell_utils.locales.getText("pisell2.checkout.payment-blocked-by-scan"));
|
|
544
|
+
});
|
|
545
|
+
const beginKioskScanActivity = (0, ahooks.useMemoizedFn)(() => {
|
|
546
|
+
if (paymentScanActivity.getIsPaymentProcessing() || syncingLock) {
|
|
547
|
+
notifyScanBlockedByPayment();
|
|
548
|
+
return null;
|
|
549
|
+
}
|
|
550
|
+
if (paymentScanActivity.getIsScanProcessing()) {
|
|
551
|
+
var _Toast$info3;
|
|
552
|
+
Toast === null || Toast === void 0 || (_Toast$info3 = Toast.info) === null || _Toast$info3 === void 0 || _Toast$info3.call(Toast, _pisell_utils.locales.getText("pisell2.checkout.wallet-scan-processing"));
|
|
553
|
+
return null;
|
|
554
|
+
}
|
|
555
|
+
return paymentScanActivity.tryBeginScan();
|
|
556
|
+
});
|
|
557
|
+
const finishActiveKioskPaymentActivity = (0, ahooks.useMemoizedFn)((reason, expectedSourcePrefix) => {
|
|
558
|
+
var _logger$addLog;
|
|
559
|
+
const activity = activeKioskPaymentActivityRef.current;
|
|
560
|
+
if (!activity) return;
|
|
561
|
+
if (expectedSourcePrefix && !activity.source.startsWith(expectedSourcePrefix)) return;
|
|
562
|
+
if (activity.deferRelease) return;
|
|
563
|
+
activity.release();
|
|
564
|
+
logger === null || logger === void 0 || (_logger$addLog = logger.addLog) === null || _logger$addLog === void 0 || _logger$addLog.call(logger, {
|
|
565
|
+
type: "info",
|
|
566
|
+
title: "Kiosk checkout payment activity finished",
|
|
567
|
+
metadata: {
|
|
568
|
+
reason,
|
|
569
|
+
source: activity.source
|
|
570
|
+
}
|
|
571
|
+
});
|
|
572
|
+
});
|
|
573
|
+
const beginKioskPaymentActivity = (0, ahooks.useMemoizedFn)((source) => {
|
|
574
|
+
var _logger$addLog2;
|
|
575
|
+
if (paymentChannel !== "kiosk") {
|
|
576
|
+
const release = (() => void 0);
|
|
577
|
+
release.isActive = () => true;
|
|
578
|
+
return release;
|
|
579
|
+
}
|
|
580
|
+
if (paymentScanActivity.getIsScanProcessing()) {
|
|
581
|
+
notifyPaymentBlockedByScan();
|
|
582
|
+
return null;
|
|
583
|
+
}
|
|
584
|
+
if (paymentScanActivity.getIsPaymentProcessing()) {
|
|
585
|
+
var _Toast$info4;
|
|
586
|
+
Toast === null || Toast === void 0 || (_Toast$info4 = Toast.info) === null || _Toast$info4 === void 0 || _Toast$info4.call(Toast, _pisell_utils.locales.getText("payment.processing"));
|
|
587
|
+
return null;
|
|
588
|
+
}
|
|
589
|
+
if (syncingLock) {
|
|
590
|
+
var _Toast$info5;
|
|
591
|
+
Toast === null || Toast === void 0 || (_Toast$info5 = Toast.info) === null || _Toast$info5 === void 0 || _Toast$info5.call(Toast, _pisell_utils.locales.getText("payment.processing"));
|
|
592
|
+
return null;
|
|
593
|
+
}
|
|
594
|
+
const releaseActivity = paymentScanActivity.tryBeginPayment();
|
|
595
|
+
if (!releaseActivity) return null;
|
|
596
|
+
let released = false;
|
|
597
|
+
const release = (() => {
|
|
598
|
+
var _activeKioskPaymentAc;
|
|
599
|
+
if (released) return;
|
|
600
|
+
const activeActivity = activeKioskPaymentActivityRef.current;
|
|
601
|
+
if ((activeActivity === null || activeActivity === void 0 ? void 0 : activeActivity.release) === release && activeActivity.deferRelease) return;
|
|
602
|
+
released = true;
|
|
603
|
+
if (((_activeKioskPaymentAc = activeKioskPaymentActivityRef.current) === null || _activeKioskPaymentAc === void 0 ? void 0 : _activeKioskPaymentAc.release) === release) activeKioskPaymentActivityRef.current = void 0;
|
|
604
|
+
releaseActivity();
|
|
605
|
+
if (source.startsWith("payment:")) {
|
|
606
|
+
var _getApp, _getApp$getPlugin, _getApp$getPlugin$res;
|
|
607
|
+
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);
|
|
608
|
+
}
|
|
609
|
+
});
|
|
610
|
+
release.isActive = () => {
|
|
611
|
+
var _activeKioskPaymentAc2;
|
|
612
|
+
return !released && ((_activeKioskPaymentAc2 = activeKioskPaymentActivityRef.current) === null || _activeKioskPaymentAc2 === void 0 ? void 0 : _activeKioskPaymentAc2.release) === release;
|
|
613
|
+
};
|
|
614
|
+
activeKioskPaymentActivityRef.current = {
|
|
615
|
+
release,
|
|
616
|
+
source
|
|
617
|
+
};
|
|
618
|
+
logger === null || logger === void 0 || (_logger$addLog2 = logger.addLog) === null || _logger$addLog2 === void 0 || _logger$addLog2.call(logger, {
|
|
619
|
+
type: "info",
|
|
620
|
+
title: "Kiosk checkout payment activity started",
|
|
621
|
+
metadata: { source }
|
|
622
|
+
});
|
|
623
|
+
return release;
|
|
624
|
+
});
|
|
625
|
+
(0, react.useEffect)(() => {
|
|
626
|
+
if (!isModalOpen) finishActiveKioskPaymentActivity("modal-closed");
|
|
627
|
+
}, [isModalOpen]);
|
|
628
|
+
(0, react.useEffect)(() => () => finishActiveKioskPaymentActivity("component-unmounted"), []);
|
|
534
629
|
const currency = getData("shop_currency_code") || "USD";
|
|
535
630
|
const open_deposit = getData("bookingv2_deposit") || 0;
|
|
536
631
|
const currentBaseSales = baseSales;
|
|
@@ -730,14 +825,14 @@ const PaymentContent = (0, react.forwardRef)(({ cartData, orderInfo, isModalOpen
|
|
|
730
825
|
const payments = params.forceUseParamsPayment && Array.isArray(params.payments) ? params.payments : yield readBaseSalesPaymentItems(params.payments);
|
|
731
826
|
const submitResult = (_params$syncResult6 = params.syncResult) === null || _params$syncResult6 === void 0 ? void 0 : _params$syncResult6.submitResult;
|
|
732
827
|
if (isBaseSalesSubmitRejected(submitResult)) {
|
|
733
|
-
var _logger$
|
|
828
|
+
var _logger$addLog4, _Toast$error2;
|
|
734
829
|
const backendResponse = getNormalizedBaseSalesSubmitResponse(submitResult);
|
|
735
830
|
const message = getBaseSalesSubmitErrorMessage(backendResponse) || _pisell_utils.locales.getText("pisell2.checkout.order-sync-failed");
|
|
736
831
|
console.error(`[PaymentModal] Sales checkout backend rejected: ${message}`, createBaseSalesSubmitErrorDebug(submitResult, payments));
|
|
737
832
|
require_PaymentResultToastV2Provider.closePaymentResultToastV2();
|
|
738
833
|
if ((config === null || config === void 0 ? void 0 : config.keepOpenOnSyncFailure) === true) {
|
|
739
|
-
var _logger$
|
|
740
|
-
logger === null || logger === void 0 || (_logger$
|
|
834
|
+
var _logger$addLog3, _Toast$error;
|
|
835
|
+
logger === null || logger === void 0 || (_logger$addLog3 = logger.addLog) === null || _logger$addLog3 === void 0 || _logger$addLog3.call(logger, {
|
|
741
836
|
type: "error",
|
|
742
837
|
title: "BaseSales payment sync rejected; waiting for kiosk retry",
|
|
743
838
|
metadata: {
|
|
@@ -761,7 +856,7 @@ const PaymentContent = (0, react.forwardRef)(({ cartData, orderInfo, isModalOpen
|
|
|
761
856
|
(_currentBaseSales$del = currentBaseSales.deleteOrderPayment) === null || _currentBaseSales$del === void 0 || _currentBaseSales$del.call(currentBaseSales, params.rollbackPaymentIdentity);
|
|
762
857
|
setPaymentItems(yield readBaseSalesPaymentItems());
|
|
763
858
|
}
|
|
764
|
-
logger === null || logger === void 0 || (_logger$
|
|
859
|
+
logger === null || logger === void 0 || (_logger$addLog4 = logger.addLog) === null || _logger$addLog4 === void 0 || _logger$addLog4.call(logger, {
|
|
765
860
|
type: "error",
|
|
766
861
|
title: "BaseSales payment sync rejected by backend",
|
|
767
862
|
metadata: {
|
|
@@ -836,28 +931,42 @@ const PaymentContent = (0, react.forwardRef)(({ cartData, orderInfo, isModalOpen
|
|
|
836
931
|
app,
|
|
837
932
|
handler: function() {
|
|
838
933
|
var _ref15 = require_asyncToGenerator._asyncToGenerator(function* (command) {
|
|
934
|
+
if (command.command === "authorization_close") {
|
|
935
|
+
finishActiveKioskPaymentActivity("authorization-closed", "authorization:");
|
|
936
|
+
return;
|
|
937
|
+
}
|
|
839
938
|
if (command.command !== "payment_result") return;
|
|
840
939
|
const params = command.params;
|
|
841
|
-
|
|
842
|
-
if (
|
|
843
|
-
|
|
844
|
-
|
|
845
|
-
|
|
846
|
-
if (
|
|
847
|
-
|
|
848
|
-
syncResult: params.syncResult
|
|
940
|
+
const authorizationActivity = activeKioskPaymentActivityRef.current;
|
|
941
|
+
if (authorizationActivity === null || authorizationActivity === void 0 ? void 0 : authorizationActivity.source.startsWith("authorization:")) authorizationActivity.deferRelease = true;
|
|
942
|
+
try {
|
|
943
|
+
if ((params === null || params === void 0 ? void 0 : params.status) === "cancelled") return;
|
|
944
|
+
const payments = Array.isArray(params === null || params === void 0 ? void 0 : params.payments) ? params.payments : [];
|
|
945
|
+
if (params === null || params === void 0 ? void 0 : params.ok) {
|
|
946
|
+
var _params$syncResult9, _params$syncResult10, _params$syncResult11;
|
|
947
|
+
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;
|
|
948
|
+
yield handleBaseSalesPaymentSyncSuccess({
|
|
949
|
+
syncResult: params.syncResult,
|
|
950
|
+
payments,
|
|
951
|
+
changeGivenAmount: getPaymentChangeGivenAmount(payments),
|
|
952
|
+
forceUseParamsPayment: true,
|
|
953
|
+
orderTotalAmount: params === null || params === void 0 || (_params$syncResult11 = params.syncResult) === null || _params$syncResult11 === void 0 ? void 0 : _params$syncResult11.orderExpectedAmount
|
|
954
|
+
});
|
|
955
|
+
return;
|
|
956
|
+
}
|
|
957
|
+
yield handleBaseSalesPaymentSyncFailure({
|
|
958
|
+
error: (params === null || params === void 0 ? void 0 : params.error) || new Error(_pisell_utils.locales.getText("pisell2.checkout.order-sync-failed")),
|
|
849
959
|
payments,
|
|
850
|
-
changeGivenAmount: getPaymentChangeGivenAmount(payments)
|
|
851
|
-
forceUseParamsPayment: true,
|
|
852
|
-
orderTotalAmount: params === null || params === void 0 || (_params$syncResult11 = params.syncResult) === null || _params$syncResult11 === void 0 ? void 0 : _params$syncResult11.orderExpectedAmount
|
|
960
|
+
changeGivenAmount: getPaymentChangeGivenAmount(payments)
|
|
853
961
|
});
|
|
854
|
-
|
|
962
|
+
} finally {
|
|
963
|
+
if (authorizationActivity && activeKioskPaymentActivityRef.current === authorizationActivity) authorizationActivity.deferRelease = false;
|
|
964
|
+
try {
|
|
965
|
+
globalApp.runFunction("closeAuthorization");
|
|
966
|
+
} finally {
|
|
967
|
+
finishActiveKioskPaymentActivity("payment-result", "authorization:");
|
|
968
|
+
}
|
|
855
969
|
}
|
|
856
|
-
yield handleBaseSalesPaymentSyncFailure({
|
|
857
|
-
error: (params === null || params === void 0 ? void 0 : params.error) || new Error(_pisell_utils.locales.getText("pisell2.checkout.order-sync-failed")),
|
|
858
|
-
payments,
|
|
859
|
-
changeGivenAmount: getPaymentChangeGivenAmount(payments)
|
|
860
|
-
});
|
|
861
970
|
});
|
|
862
971
|
return function handler(_x22) {
|
|
863
972
|
return _ref15.apply(this, arguments);
|
|
@@ -899,16 +1008,16 @@ const PaymentContent = (0, react.forwardRef)(({ cartData, orderInfo, isModalOpen
|
|
|
899
1008
|
}());
|
|
900
1009
|
const handleBaseSalesPaymentSyncFailure = (0, ahooks.useMemoizedFn)(function() {
|
|
901
1010
|
var _ref18 = require_asyncToGenerator._asyncToGenerator(function* (params) {
|
|
902
|
-
var _logger$
|
|
1011
|
+
var _logger$addLog7, _params$error5, _params$error6, _Toast$error4, _params$error7;
|
|
903
1012
|
const payments = yield readBaseSalesPaymentItems(params.payments);
|
|
904
1013
|
const backendErrorResponse = getNormalizedBaseSalesSubmitResponse(extractBackendErrorResponse(params.error));
|
|
905
1014
|
const isBackendRejected = !!backendErrorResponse;
|
|
906
1015
|
const isDeferredNetworkSync = !backendErrorResponse && isNetworkOrTimeoutError(params.error);
|
|
907
1016
|
const message = isBackendRejected ? getBaseSalesSubmitErrorMessage(backendErrorResponse) || _pisell_utils.locales.getText("pisell2.checkout.order-sync-failed") : params.error instanceof Error ? params.error.message : String(params.error);
|
|
908
1017
|
if ((config === null || config === void 0 ? void 0 : config.keepOpenOnSyncFailure) === true) {
|
|
909
|
-
var _logger$
|
|
1018
|
+
var _logger$addLog5, _params$error, _params$error2, _Toast$error3, _params$error3;
|
|
910
1019
|
require_PaymentResultToastV2Provider.closePaymentResultToastV2();
|
|
911
|
-
logger === null || logger === void 0 || (_logger$
|
|
1020
|
+
logger === null || logger === void 0 || (_logger$addLog5 = logger.addLog) === null || _logger$addLog5 === void 0 || _logger$addLog5.call(logger, {
|
|
912
1021
|
type: "error",
|
|
913
1022
|
title: "BaseSales payment sync failed; waiting for kiosk retry",
|
|
914
1023
|
metadata: {
|
|
@@ -933,7 +1042,7 @@ const PaymentContent = (0, react.forwardRef)(({ cartData, orderInfo, isModalOpen
|
|
|
933
1042
|
require_PaymentResultToastV2Provider.closePaymentResultToastV2();
|
|
934
1043
|
} else console.error("[PaymentModal] Sales checkout submit failed", params.error);
|
|
935
1044
|
if (isDeferredNetworkSync) {
|
|
936
|
-
var _logger$
|
|
1045
|
+
var _logger$addLog6, _params$error4, _Toast$info6, _params$changeGivenAm3;
|
|
937
1046
|
const deferredMessage = _pisell_utils.locales.getText("pisell2.checkout.order-saved-sync-later");
|
|
938
1047
|
const nextOrderInfo = getBaseSalesOrderInfo(currentBaseSales);
|
|
939
1048
|
if (nextOrderInfo) {
|
|
@@ -944,7 +1053,7 @@ const PaymentContent = (0, react.forwardRef)(({ cartData, orderInfo, isModalOpen
|
|
|
944
1053
|
}
|
|
945
1054
|
const nextPayments = yield readBaseSalesPaymentItems(payments);
|
|
946
1055
|
setPaymentItems(nextPayments);
|
|
947
|
-
logger === null || logger === void 0 || (_logger$
|
|
1056
|
+
logger === null || logger === void 0 || (_logger$addLog6 = logger.addLog) === null || _logger$addLog6 === void 0 || _logger$addLog6.call(logger, {
|
|
948
1057
|
type: "info",
|
|
949
1058
|
title: "BaseSales payment saved locally, backend sync deferred",
|
|
950
1059
|
metadata: {
|
|
@@ -953,7 +1062,7 @@ const PaymentContent = (0, react.forwardRef)(({ cartData, orderInfo, isModalOpen
|
|
|
953
1062
|
payments: nextPayments
|
|
954
1063
|
}
|
|
955
1064
|
});
|
|
956
|
-
Toast === null || Toast === void 0 || (_Toast$
|
|
1065
|
+
Toast === null || Toast === void 0 || (_Toast$info6 = Toast.info) === null || _Toast$info6 === void 0 || _Toast$info6.call(Toast, deferredMessage);
|
|
957
1066
|
const syncResult = {
|
|
958
1067
|
isFullyPaid: true,
|
|
959
1068
|
submitResult: {
|
|
@@ -979,7 +1088,7 @@ const PaymentContent = (0, react.forwardRef)(({ cartData, orderInfo, isModalOpen
|
|
|
979
1088
|
(_currentBaseSales$del2 = currentBaseSales.deleteOrderPayment) === null || _currentBaseSales$del2 === void 0 || _currentBaseSales$del2.call(currentBaseSales, params.rollbackPaymentIdentity);
|
|
980
1089
|
setPaymentItems(yield readBaseSalesPaymentItems());
|
|
981
1090
|
}
|
|
982
|
-
logger === null || logger === void 0 || (_logger$
|
|
1091
|
+
logger === null || logger === void 0 || (_logger$addLog7 = logger.addLog) === null || _logger$addLog7 === void 0 || _logger$addLog7.call(logger, {
|
|
983
1092
|
type: "error",
|
|
984
1093
|
title: "BaseSales payment sync failed",
|
|
985
1094
|
metadata: {
|
|
@@ -1240,7 +1349,7 @@ const PaymentContent = (0, react.forwardRef)(({ cartData, orderInfo, isModalOpen
|
|
|
1240
1349
|
draftResult
|
|
1241
1350
|
};
|
|
1242
1351
|
} catch (error) {
|
|
1243
|
-
var _logger$
|
|
1352
|
+
var _logger$addLog8, _Toast$hide5, _Toast$error7;
|
|
1244
1353
|
if (paymentAdded) try {
|
|
1245
1354
|
if (paymentNumber) yield deletePendingEftposPayment(paymentNumber, { persistDraft: false });
|
|
1246
1355
|
else if (typeof (currentBaseSales === null || currentBaseSales === void 0 ? void 0 : currentBaseSales.setOrderPayments) === "function") {
|
|
@@ -1251,7 +1360,7 @@ const PaymentContent = (0, react.forwardRef)(({ cartData, orderInfo, isModalOpen
|
|
|
1251
1360
|
console.error("Failed to rollback pending EFTPOS payment:", rollbackError);
|
|
1252
1361
|
}
|
|
1253
1362
|
const message = error instanceof Error ? error.message : String(error);
|
|
1254
|
-
logger === null || logger === void 0 || (_logger$
|
|
1363
|
+
logger === null || logger === void 0 || (_logger$addLog8 = logger.addLog) === null || _logger$addLog8 === void 0 || _logger$addLog8.call(logger, {
|
|
1255
1364
|
type: "error",
|
|
1256
1365
|
title: "EFTPOS pending payment draft failed",
|
|
1257
1366
|
metadata: {
|
|
@@ -1298,9 +1407,9 @@ const PaymentContent = (0, react.forwardRef)(({ cartData, orderInfo, isModalOpen
|
|
|
1298
1407
|
};
|
|
1299
1408
|
}());
|
|
1300
1409
|
const handleEftposUpdateError = (0, ahooks.useMemoizedFn)((error, paymentNumber) => {
|
|
1301
|
-
var _logger$
|
|
1410
|
+
var _logger$addLog9, _Toast$error8;
|
|
1302
1411
|
const message = error instanceof Error ? error.message : String(error);
|
|
1303
|
-
logger === null || logger === void 0 || (_logger$
|
|
1412
|
+
logger === null || logger === void 0 || (_logger$addLog9 = logger.addLog) === null || _logger$addLog9 === void 0 || _logger$addLog9.call(logger, {
|
|
1304
1413
|
type: "error",
|
|
1305
1414
|
title: "EFTPOS payment update failed",
|
|
1306
1415
|
metadata: {
|
|
@@ -1312,6 +1421,8 @@ const PaymentContent = (0, react.forwardRef)(({ cartData, orderInfo, isModalOpen
|
|
|
1312
1421
|
});
|
|
1313
1422
|
const handleAddCashPayment = function() {
|
|
1314
1423
|
var _ref25 = require_asyncToGenerator._asyncToGenerator(function* (result) {
|
|
1424
|
+
const finishPaymentActivity = beginKioskPaymentActivity("cash");
|
|
1425
|
+
if (!finishPaymentActivity) return;
|
|
1315
1426
|
try {
|
|
1316
1427
|
var _interaction$utils, _interaction$utils$po, _result$actual_paid_a;
|
|
1317
1428
|
if (!canAddOrderPayment(result.amount)) return;
|
|
@@ -1347,9 +1458,9 @@ const PaymentContent = (0, react.forwardRef)(({ cartData, orderInfo, isModalOpen
|
|
|
1347
1458
|
}
|
|
1348
1459
|
});
|
|
1349
1460
|
} catch (error) {
|
|
1350
|
-
var _logger$
|
|
1461
|
+
var _logger$addLog10, _Toast$error9;
|
|
1351
1462
|
const message = error instanceof Error ? error.message : String(error);
|
|
1352
|
-
logger === null || logger === void 0 || (_logger$
|
|
1463
|
+
logger === null || logger === void 0 || (_logger$addLog10 = logger.addLog) === null || _logger$addLog10 === void 0 || _logger$addLog10.call(logger, {
|
|
1353
1464
|
type: "error",
|
|
1354
1465
|
title: "Cash payment failed",
|
|
1355
1466
|
metadata: {
|
|
@@ -1358,6 +1469,8 @@ const PaymentContent = (0, react.forwardRef)(({ cartData, orderInfo, isModalOpen
|
|
|
1358
1469
|
}
|
|
1359
1470
|
});
|
|
1360
1471
|
Toast === null || Toast === void 0 || (_Toast$error9 = Toast.error) === null || _Toast$error9 === void 0 || _Toast$error9.call(Toast, message);
|
|
1472
|
+
} finally {
|
|
1473
|
+
finishPaymentActivity();
|
|
1361
1474
|
}
|
|
1362
1475
|
});
|
|
1363
1476
|
return function handleAddCashPayment(_x32) {
|
|
@@ -1375,319 +1488,347 @@ const PaymentContent = (0, react.forwardRef)(({ cartData, orderInfo, isModalOpen
|
|
|
1375
1488
|
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");
|
|
1376
1489
|
const onPaymentOptionClick = function() {
|
|
1377
1490
|
var _ref29 = require_asyncToGenerator._asyncToGenerator(function* (method) {
|
|
1378
|
-
var _method$totalAmount;
|
|
1379
1491
|
if (syncingLock) return;
|
|
1380
|
-
|
|
1381
|
-
|
|
1382
|
-
|
|
1383
|
-
const
|
|
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
|
-
|
|
1413
|
-
|
|
1414
|
-
|
|
1415
|
-
console.log("eftpos_pay_result>>>>>>", status, data, msg);
|
|
1416
|
-
screenProtector && (screenProtector === null || screenProtector === void 0 || (_screenProtector$resu = screenProtector.resumeIdleTimer) === null || _screenProtector$resu === void 0 || _screenProtector$resu.call(screenProtector));
|
|
1417
|
-
if ((data === null || data === void 0 ? void 0 : data.action) === "cancel_order") {
|
|
1418
|
-
onPaymentCancel(true);
|
|
1419
|
-
return;
|
|
1420
|
-
}
|
|
1421
|
-
if (status !== "success") return;
|
|
1422
|
-
const payResultParams = {
|
|
1423
|
-
amount: Number(data === null || data === void 0 ? void 0 : data.amount),
|
|
1492
|
+
const finishPaymentActivity = beginKioskPaymentActivity(`payment:${(method === null || method === void 0 ? void 0 : method.code) || "unknown"}`);
|
|
1493
|
+
if (!finishPaymentActivity) return;
|
|
1494
|
+
let paymentActivityHandedOff = false;
|
|
1495
|
+
const releaseAfterPaymentCallback = (callback) => require_asyncToGenerator._asyncToGenerator(function* (...args) {
|
|
1496
|
+
try {
|
|
1497
|
+
return yield callback(...args);
|
|
1498
|
+
} finally {
|
|
1499
|
+
finishPaymentActivity();
|
|
1500
|
+
}
|
|
1501
|
+
});
|
|
1502
|
+
try {
|
|
1503
|
+
var _method$totalAmount;
|
|
1504
|
+
const { id, code, name, type } = method || {};
|
|
1505
|
+
const finalAmount = (_method$totalAmount = method.totalAmount) !== null && _method$totalAmount !== void 0 ? _method$totalAmount : effectiveCustomAmount;
|
|
1506
|
+
if (screenProtector) screenProtector === null || screenProtector === void 0 || screenProtector.pauseIdleTimer();
|
|
1507
|
+
const isSciPayment = require_constants.SCI_PAYMENT_CODES.includes(code || "");
|
|
1508
|
+
const isSpiPayment = require_constants.SPI_PAYMENT_CODES.includes(code || "");
|
|
1509
|
+
if (isSciPayment || isSpiPayment) {
|
|
1510
|
+
var _context$appHelper$ut3, _context$appHelper$ut4, _context$appHelper, _context$appHelper$is, _currentBaseSales$get9, _getBaseSalesSubmitDa, _app$storage2, _app$storage2$getStor;
|
|
1511
|
+
const payType = isSpiPayment ? "mx51" : "eftpos";
|
|
1512
|
+
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);
|
|
1513
|
+
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));
|
|
1514
|
+
const piPaymentProvider = require_constants.resolvePiPaymentProvider((method === null || method === void 0 ? void 0 : method.code) || "", usePiPayment);
|
|
1515
|
+
const shouldUsePiPayment = !!piPaymentProvider;
|
|
1516
|
+
if (!shouldUsePiPayment && isSpiPayment) {
|
|
1517
|
+
var _currentBaseSales$get7;
|
|
1518
|
+
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;
|
|
1519
|
+
const paymentRuntime = paymentMethodRuntimeRef.current;
|
|
1520
|
+
if (!paymentRuntime) return;
|
|
1521
|
+
paymentActivityHandedOff = yield paymentRuntime.onPay(payType, {
|
|
1522
|
+
isActive: finishPaymentActivity.isActive,
|
|
1523
|
+
source: "normal",
|
|
1524
|
+
data: {
|
|
1525
|
+
payMethod: {
|
|
1526
|
+
id,
|
|
1424
1527
|
code,
|
|
1425
|
-
custom_payment_id: id,
|
|
1426
1528
|
name,
|
|
1427
|
-
|
|
1428
|
-
|
|
1429
|
-
|
|
1430
|
-
|
|
1431
|
-
|
|
1432
|
-
|
|
1433
|
-
|
|
1434
|
-
|
|
1529
|
+
type
|
|
1530
|
+
},
|
|
1531
|
+
params: {
|
|
1532
|
+
orderId,
|
|
1533
|
+
symbol: getData("shop_symbol"),
|
|
1534
|
+
amount: finalAmount,
|
|
1535
|
+
surcharge: processSurcharge(method.surcharge)
|
|
1536
|
+
},
|
|
1537
|
+
mode: "pay"
|
|
1538
|
+
},
|
|
1539
|
+
callback: releaseAfterPaymentCallback(function() {
|
|
1540
|
+
var _ref26 = require_asyncToGenerator._asyncToGenerator(function* ({ status, data, msg }) {
|
|
1541
|
+
var _screenProtector$resu;
|
|
1542
|
+
console.log("eftpos_pay_result>>>>>>", status, data, msg);
|
|
1543
|
+
screenProtector && (screenProtector === null || screenProtector === void 0 || (_screenProtector$resu = screenProtector.resumeIdleTimer) === null || _screenProtector$resu === void 0 || _screenProtector$resu.call(screenProtector));
|
|
1544
|
+
if ((data === null || data === void 0 ? void 0 : data.action) === "cancel_order") {
|
|
1545
|
+
onPaymentCancel(true);
|
|
1546
|
+
return;
|
|
1547
|
+
}
|
|
1548
|
+
if (status !== "success") return;
|
|
1549
|
+
const payResultParams = {
|
|
1550
|
+
amount: Number(data === null || data === void 0 ? void 0 : data.amount),
|
|
1551
|
+
code,
|
|
1552
|
+
custom_payment_id: id,
|
|
1553
|
+
name,
|
|
1554
|
+
custom_payment_type: type,
|
|
1555
|
+
voucher_id: "",
|
|
1556
|
+
service_charge: {},
|
|
1557
|
+
metadata: { unique_payment_number: data === null || data === void 0 ? void 0 : data.uniquePaymentNumber }
|
|
1558
|
+
};
|
|
1559
|
+
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 = {
|
|
1560
|
+
amount: (data === null || data === void 0 ? void 0 : data.surcharge) || "0",
|
|
1561
|
+
percentage: "0"
|
|
1562
|
+
};
|
|
1563
|
+
else payResultParams.service_charge = {
|
|
1564
|
+
amount: (method === null || method === void 0 ? void 0 : method.fixed) || "0",
|
|
1565
|
+
percentage: (method === null || method === void 0 ? void 0 : method.percentage) || "0"
|
|
1566
|
+
};
|
|
1567
|
+
if (!canAddOrderPayment(payResultParams.amount)) return;
|
|
1568
|
+
setIsChangePaymentNotIncludeVoucher === null || setIsChangePaymentNotIncludeVoucher === void 0 || setIsChangePaymentNotIncludeVoucher(true);
|
|
1569
|
+
yield addBaseSalesOrderPayment(currentBaseSales, payResultParams);
|
|
1570
|
+
});
|
|
1571
|
+
return function(_x33) {
|
|
1572
|
+
return _ref26.apply(this, arguments);
|
|
1435
1573
|
};
|
|
1436
|
-
|
|
1437
|
-
|
|
1438
|
-
|
|
1574
|
+
}())
|
|
1575
|
+
});
|
|
1576
|
+
return;
|
|
1577
|
+
}
|
|
1578
|
+
if (!shouldUsePiPayment) {
|
|
1579
|
+
var _app$storage, _app$storage$getStora, _currentBaseSales$get8;
|
|
1580
|
+
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")) || "{}");
|
|
1581
|
+
console.log("_account", _account);
|
|
1582
|
+
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;
|
|
1583
|
+
if (!orderId || typeof orderId === "string" && orderId.startsWith("LOCAL_")) {
|
|
1584
|
+
var _Toast$loading3;
|
|
1585
|
+
Toast === null || Toast === void 0 || (_Toast$loading3 = Toast.loading) === null || _Toast$loading3 === void 0 || _Toast$loading3.call(Toast, "", 0);
|
|
1586
|
+
let submitResult;
|
|
1587
|
+
try {
|
|
1588
|
+
submitResult = yield submitBaseSalesOrderAsync(currentBaseSales);
|
|
1589
|
+
} catch (error) {
|
|
1590
|
+
Toast === null || Toast === void 0 || Toast.error(error instanceof Error ? error.message : _pisell_utils.locales.getText("pisell2.checkout.order-status-abnormal-restart-app") || "当前订单状态异常,请重启 APP 后再试");
|
|
1591
|
+
return;
|
|
1592
|
+
}
|
|
1593
|
+
if (!(submitResult === null || submitResult === void 0 ? void 0 : submitResult.success) || isBaseSalesSubmitRejected(submitResult === null || submitResult === void 0 ? void 0 : submitResult.response)) {
|
|
1594
|
+
Toast === null || Toast === void 0 || Toast.error(getBaseSalesSubmitErrorMessage(submitResult === null || submitResult === void 0 ? void 0 : submitResult.response) || _pisell_utils.locales.getText("pisell2.checkout.order-status-abnormal-restart-app") || "当前订单状态异常,请重启 APP 后再试");
|
|
1595
|
+
return;
|
|
1596
|
+
}
|
|
1597
|
+
orderId = getBaseSalesSubmitOrderId(submitResult === null || submitResult === void 0 ? void 0 : submitResult.response);
|
|
1598
|
+
if (!orderId) {
|
|
1599
|
+
Toast === null || Toast === void 0 || Toast.error(_pisell_utils.locales.getText("pisell2.checkout.order-status-abnormal-restart-app") || "当前订单状态异常,请重启 APP 后再试");
|
|
1600
|
+
return;
|
|
1601
|
+
}
|
|
1602
|
+
}
|
|
1603
|
+
Toast === null || Toast === void 0 || Toast.hide();
|
|
1604
|
+
const paymentRuntime = paymentMethodRuntimeRef.current;
|
|
1605
|
+
if (!paymentRuntime) return;
|
|
1606
|
+
paymentActivityHandedOff = yield paymentRuntime.onPay(payType, {
|
|
1607
|
+
isActive: finishPaymentActivity.isActive,
|
|
1608
|
+
source: "normal",
|
|
1609
|
+
data: {
|
|
1610
|
+
payMethod: {
|
|
1611
|
+
id,
|
|
1612
|
+
code,
|
|
1613
|
+
name,
|
|
1614
|
+
type
|
|
1615
|
+
},
|
|
1616
|
+
params: {
|
|
1617
|
+
orderId,
|
|
1618
|
+
symbol: getData("shop_symbol"),
|
|
1619
|
+
amount: finalAmount,
|
|
1620
|
+
surcharge: processSurcharge(method.surcharge),
|
|
1621
|
+
operator_id: _account === null || _account === void 0 ? void 0 : _account.id,
|
|
1622
|
+
operator_type: "shop",
|
|
1623
|
+
platform: paymentChannel || "pos"
|
|
1624
|
+
},
|
|
1625
|
+
mode: "pay"
|
|
1626
|
+
},
|
|
1627
|
+
callback: releaseAfterPaymentCallback(function() {
|
|
1628
|
+
var _ref27 = require_asyncToGenerator._asyncToGenerator(function* ({ status, data, msg }) {
|
|
1629
|
+
var _screenProtector$resu2;
|
|
1630
|
+
console.log("eftpos_pay_result>>>>>>", status, data, msg);
|
|
1631
|
+
screenProtector && (screenProtector === null || screenProtector === void 0 || (_screenProtector$resu2 = screenProtector.resumeIdleTimer) === null || _screenProtector$resu2 === void 0 || _screenProtector$resu2.call(screenProtector));
|
|
1632
|
+
if (status !== "success") return;
|
|
1633
|
+
const payResultParams = {
|
|
1634
|
+
amount: finalAmount,
|
|
1635
|
+
code,
|
|
1636
|
+
custom_payment_id: id,
|
|
1637
|
+
name,
|
|
1638
|
+
custom_payment_type: type,
|
|
1639
|
+
voucher_id: "",
|
|
1640
|
+
service_charge: {
|
|
1641
|
+
percentage: data === null || data === void 0 ? void 0 : data.surPercentRate,
|
|
1642
|
+
amount: data === null || data === void 0 ? void 0 : data.surMoney
|
|
1643
|
+
},
|
|
1644
|
+
metadata: {
|
|
1645
|
+
unique_payment_number: data === null || data === void 0 ? void 0 : data.uniquePaymentNumber,
|
|
1646
|
+
manual_marking_flag: data === null || data === void 0 ? void 0 : data.manual_marking_flag
|
|
1647
|
+
}
|
|
1648
|
+
};
|
|
1649
|
+
if (!canAddOrderPayment(payResultParams.amount)) return;
|
|
1650
|
+
setIsChangePaymentNotIncludeVoucher === null || setIsChangePaymentNotIncludeVoucher === void 0 || setIsChangePaymentNotIncludeVoucher(true);
|
|
1651
|
+
yield addBaseSalesOrderPayment(currentBaseSales, payResultParams);
|
|
1652
|
+
});
|
|
1653
|
+
return function(_x34) {
|
|
1654
|
+
return _ref27.apply(this, arguments);
|
|
1439
1655
|
};
|
|
1440
|
-
|
|
1441
|
-
|
|
1442
|
-
|
|
1443
|
-
|
|
1444
|
-
|
|
1445
|
-
|
|
1446
|
-
|
|
1447
|
-
|
|
1656
|
+
}())
|
|
1657
|
+
});
|
|
1658
|
+
return;
|
|
1659
|
+
}
|
|
1660
|
+
logger === null || logger === void 0 || logger.addLog({
|
|
1661
|
+
type: "info",
|
|
1662
|
+
title: "addPendingEftposPayment_start",
|
|
1663
|
+
metadata: { timestamp: Date.now() }
|
|
1448
1664
|
});
|
|
1449
|
-
|
|
1450
|
-
|
|
1451
|
-
|
|
1452
|
-
|
|
1453
|
-
const _account = JSON.parse((_app === null || _app === void 0 || (_app$
|
|
1665
|
+
const pendingPayment = yield addPendingEftposPayment(method, finalAmount);
|
|
1666
|
+
if (!pendingPayment) return;
|
|
1667
|
+
const { paymentNumber, draftResult } = pendingPayment;
|
|
1668
|
+
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);
|
|
1669
|
+
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")) || "{}");
|
|
1454
1670
|
console.log("_account", _account);
|
|
1455
|
-
let
|
|
1456
|
-
if (!
|
|
1457
|
-
|
|
1458
|
-
|
|
1459
|
-
let submitResult;
|
|
1460
|
-
try {
|
|
1461
|
-
submitResult = yield submitBaseSalesOrderAsync(currentBaseSales);
|
|
1462
|
-
} catch (error) {
|
|
1463
|
-
Toast === null || Toast === void 0 || Toast.error(error instanceof Error ? error.message : _pisell_utils.locales.getText("pisell2.checkout.order-status-abnormal-restart-app") || "当前订单状态异常,请重启 APP 后再试");
|
|
1464
|
-
return;
|
|
1465
|
-
}
|
|
1466
|
-
if (!(submitResult === null || submitResult === void 0 ? void 0 : submitResult.success) || isBaseSalesSubmitRejected(submitResult === null || submitResult === void 0 ? void 0 : submitResult.response)) {
|
|
1467
|
-
Toast === null || Toast === void 0 || Toast.error(getBaseSalesSubmitErrorMessage(submitResult === null || submitResult === void 0 ? void 0 : submitResult.response) || _pisell_utils.locales.getText("pisell2.checkout.order-status-abnormal-restart-app") || "当前订单状态异常,请重启 APP 后再试");
|
|
1468
|
-
return;
|
|
1469
|
-
}
|
|
1470
|
-
orderId = getBaseSalesSubmitOrderId(submitResult === null || submitResult === void 0 ? void 0 : submitResult.response);
|
|
1471
|
-
if (!orderId) {
|
|
1472
|
-
Toast === null || Toast === void 0 || Toast.error(_pisell_utils.locales.getText("pisell2.checkout.order-status-abnormal-restart-app") || "当前订单状态异常,请重启 APP 后再试");
|
|
1473
|
-
return;
|
|
1474
|
-
}
|
|
1671
|
+
let shouldPreservePendingEftpos = false;
|
|
1672
|
+
if (!localSalesId || !paymentMethodRuntimeRef.current) {
|
|
1673
|
+
yield deletePendingEftposPayment(paymentNumber);
|
|
1674
|
+
return;
|
|
1475
1675
|
}
|
|
1476
|
-
|
|
1477
|
-
|
|
1478
|
-
|
|
1479
|
-
|
|
1676
|
+
if (!finishPaymentActivity.isActive()) {
|
|
1677
|
+
yield deletePendingEftposPayment(paymentNumber);
|
|
1678
|
+
return;
|
|
1679
|
+
}
|
|
1680
|
+
logger === null || logger === void 0 || logger.addLog({
|
|
1681
|
+
type: "info",
|
|
1682
|
+
title: "addPendingEftposPayment_end",
|
|
1683
|
+
metadata: { timestamp: Date.now() }
|
|
1684
|
+
});
|
|
1685
|
+
if (paymentMethodRuntimeRef.current.openPi(require_objectSpread2._objectSpread2(require_objectSpread2._objectSpread2({
|
|
1686
|
+
provider: piPaymentProvider,
|
|
1687
|
+
mode: "pay",
|
|
1688
|
+
amount: finalAmount,
|
|
1689
|
+
salesId: String(localSalesId),
|
|
1690
|
+
paymentNumber,
|
|
1691
|
+
currency: getData("shop_symbol"),
|
|
1692
|
+
deviceNumber: cardReaderDeviceNumber,
|
|
1693
|
+
metadata: {
|
|
1480
1694
|
payMethod: {
|
|
1481
1695
|
id,
|
|
1482
1696
|
code,
|
|
1483
1697
|
name,
|
|
1484
1698
|
type
|
|
1485
1699
|
},
|
|
1486
|
-
|
|
1487
|
-
|
|
1488
|
-
symbol: getData("shop_symbol"),
|
|
1489
|
-
amount: finalAmount,
|
|
1490
|
-
surcharge: processSurcharge(method.surcharge),
|
|
1491
|
-
operator_id: _account === null || _account === void 0 ? void 0 : _account.id,
|
|
1492
|
-
operator_type: "shop",
|
|
1493
|
-
platform: paymentChannel || "pos"
|
|
1494
|
-
},
|
|
1495
|
-
mode: "pay"
|
|
1700
|
+
symbol: getData("shop_symbol"),
|
|
1701
|
+
payment_number: paymentNumber
|
|
1496
1702
|
},
|
|
1497
|
-
|
|
1498
|
-
|
|
1499
|
-
|
|
1500
|
-
|
|
1501
|
-
|
|
1502
|
-
|
|
1503
|
-
|
|
1504
|
-
|
|
1505
|
-
|
|
1506
|
-
|
|
1507
|
-
|
|
1508
|
-
|
|
1509
|
-
|
|
1510
|
-
|
|
1511
|
-
|
|
1512
|
-
|
|
1513
|
-
|
|
1514
|
-
|
|
1515
|
-
|
|
1516
|
-
|
|
1703
|
+
operator: {
|
|
1704
|
+
id: _account === null || _account === void 0 ? void 0 : _account.id,
|
|
1705
|
+
type: "shop"
|
|
1706
|
+
}
|
|
1707
|
+
}, paymentChannel === "kiosk" ? { slots: { failed: /* @__PURE__ */ react.default.createElement(antd.Button, {
|
|
1708
|
+
block: true,
|
|
1709
|
+
type: "primary",
|
|
1710
|
+
className: "pi-payment-action-button",
|
|
1711
|
+
onClick: () => onPaymentCancel(true, false, "start-new-order"),
|
|
1712
|
+
style: { marginTop: "10px" }
|
|
1713
|
+
}, _pisell_utils.locales.getText("order.start-new-order")) } } : {}), {}, {
|
|
1714
|
+
platform: paymentChannel || "pos",
|
|
1715
|
+
usageScene: paymentChannel === "kiosk" ? "user" : "merchant",
|
|
1716
|
+
onChange: function() {
|
|
1717
|
+
var _ref28 = require_asyncToGenerator._asyncToGenerator(function* (event) {
|
|
1718
|
+
const isTerminalEvent = event.type === "success" || event.type === "closed" || event.type === "printOnTimeout";
|
|
1719
|
+
console.log("pi_payment_eftpos_event>>>>>>", event);
|
|
1720
|
+
try {
|
|
1721
|
+
const eventTransactionNumber = event.transactionNumber;
|
|
1722
|
+
if (eventTransactionNumber) shouldPreservePendingEftpos = true;
|
|
1723
|
+
if (event.type === "processing") {
|
|
1724
|
+
var _screenProtector$paus;
|
|
1725
|
+
screenProtector && (screenProtector === null || screenProtector === void 0 || (_screenProtector$paus = screenProtector.pauseIdleTimer) === null || _screenProtector$paus === void 0 || _screenProtector$paus.call(screenProtector));
|
|
1517
1726
|
}
|
|
1518
|
-
|
|
1519
|
-
if (!canAddOrderPayment(payResultParams.amount)) return;
|
|
1520
|
-
setIsChangePaymentNotIncludeVoucher === null || setIsChangePaymentNotIncludeVoucher === void 0 || setIsChangePaymentNotIncludeVoucher(true);
|
|
1521
|
-
yield addBaseSalesOrderPayment(currentBaseSales, payResultParams);
|
|
1522
|
-
});
|
|
1523
|
-
return function callback(_x34) {
|
|
1524
|
-
return _ref27.apply(this, arguments);
|
|
1525
|
-
};
|
|
1526
|
-
}()
|
|
1527
|
-
});
|
|
1528
|
-
return;
|
|
1529
|
-
}
|
|
1530
|
-
logger === null || logger === void 0 || logger.addLog({
|
|
1531
|
-
type: "info",
|
|
1532
|
-
title: "addPendingEftposPayment_start",
|
|
1533
|
-
metadata: { timestamp: Date.now() }
|
|
1534
|
-
});
|
|
1535
|
-
const pendingPayment = yield addPendingEftposPayment(method, finalAmount);
|
|
1536
|
-
if (!pendingPayment) return;
|
|
1537
|
-
const { paymentNumber, draftResult } = pendingPayment;
|
|
1538
|
-
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);
|
|
1539
|
-
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")) || "{}");
|
|
1540
|
-
console.log("_account", _account);
|
|
1541
|
-
let shouldPreservePendingEftpos = false;
|
|
1542
|
-
if (!localSalesId || !paymentMethodRuntimeRef.current) {
|
|
1543
|
-
yield deletePendingEftposPayment(paymentNumber);
|
|
1544
|
-
return;
|
|
1545
|
-
}
|
|
1546
|
-
logger === null || logger === void 0 || logger.addLog({
|
|
1547
|
-
type: "info",
|
|
1548
|
-
title: "addPendingEftposPayment_end",
|
|
1549
|
-
metadata: { timestamp: Date.now() }
|
|
1550
|
-
});
|
|
1551
|
-
if (!paymentMethodRuntimeRef.current.openPi(require_objectSpread2._objectSpread2(require_objectSpread2._objectSpread2({
|
|
1552
|
-
provider: piPaymentProvider,
|
|
1553
|
-
mode: "pay",
|
|
1554
|
-
amount: finalAmount,
|
|
1555
|
-
salesId: String(localSalesId),
|
|
1556
|
-
paymentNumber,
|
|
1557
|
-
currency: getData("shop_symbol"),
|
|
1558
|
-
deviceNumber: cardReaderDeviceNumber,
|
|
1559
|
-
metadata: {
|
|
1560
|
-
payMethod: {
|
|
1561
|
-
id,
|
|
1562
|
-
code,
|
|
1563
|
-
name,
|
|
1564
|
-
type
|
|
1565
|
-
},
|
|
1566
|
-
symbol: getData("shop_symbol"),
|
|
1567
|
-
payment_number: paymentNumber
|
|
1568
|
-
},
|
|
1569
|
-
operator: {
|
|
1570
|
-
id: _account === null || _account === void 0 ? void 0 : _account.id,
|
|
1571
|
-
type: "shop"
|
|
1572
|
-
}
|
|
1573
|
-
}, paymentChannel === "kiosk" ? { slots: { failed: /* @__PURE__ */ react.default.createElement(antd.Button, {
|
|
1574
|
-
block: true,
|
|
1575
|
-
type: "primary",
|
|
1576
|
-
className: "pi-payment-action-button",
|
|
1577
|
-
onClick: () => onPaymentCancel(true, false, "start-new-order"),
|
|
1578
|
-
style: { marginTop: "10px" }
|
|
1579
|
-
}, _pisell_utils.locales.getText("order.start-new-order")) } } : {}), {}, {
|
|
1580
|
-
platform: paymentChannel || "pos",
|
|
1581
|
-
usageScene: paymentChannel === "kiosk" ? "user" : "merchant",
|
|
1582
|
-
onChange: function() {
|
|
1583
|
-
var _ref28 = require_asyncToGenerator._asyncToGenerator(function* (event) {
|
|
1584
|
-
console.log("pi_payment_eftpos_event>>>>>>", event);
|
|
1585
|
-
try {
|
|
1586
|
-
const eventTransactionNumber = event.transactionNumber;
|
|
1587
|
-
if (eventTransactionNumber) shouldPreservePendingEftpos = true;
|
|
1588
|
-
if (event.type === "processing") {
|
|
1589
|
-
var _screenProtector$paus;
|
|
1590
|
-
screenProtector && (screenProtector === null || screenProtector === void 0 || (_screenProtector$paus = screenProtector.pauseIdleTimer) === null || _screenProtector$paus === void 0 || _screenProtector$paus.call(screenProtector));
|
|
1591
|
-
}
|
|
1592
|
-
if (event.type === "printOnTimeout") {
|
|
1593
|
-
var _logger$addLog9;
|
|
1594
|
-
yield submitBaseSalesOrder(currentBaseSales, { confirmPendingVoucherPayments: true });
|
|
1595
|
-
if (!(currentBaseSales === null || currentBaseSales === void 0 ? void 0 : currentBaseSales.printLocalOrderReceipt)) return;
|
|
1596
|
-
logger === null || logger === void 0 || (_logger$addLog9 = logger.addLog) === null || _logger$addLog9 === void 0 || _logger$addLog9.call(logger, {
|
|
1597
|
-
type: "info",
|
|
1598
|
-
title: "eftpos支付异常,请求本地打印小票"
|
|
1599
|
-
});
|
|
1600
|
-
try {
|
|
1601
|
-
var _logger$addLog10;
|
|
1602
|
-
const res = yield currentBaseSales.printLocalOrderReceipt();
|
|
1603
|
-
logger === null || logger === void 0 || (_logger$addLog10 = logger.addLog) === null || _logger$addLog10 === void 0 || _logger$addLog10.call(logger, {
|
|
1604
|
-
type: "info",
|
|
1605
|
-
title: "eftpos支付异常,请求本地打印小票结果",
|
|
1606
|
-
metadata: { res }
|
|
1607
|
-
});
|
|
1608
|
-
} catch (error) {
|
|
1727
|
+
if (event.type === "printOnTimeout") {
|
|
1609
1728
|
var _logger$addLog11;
|
|
1610
|
-
|
|
1729
|
+
yield submitBaseSalesOrder(currentBaseSales, { confirmPendingVoucherPayments: true });
|
|
1730
|
+
if (!(currentBaseSales === null || currentBaseSales === void 0 ? void 0 : currentBaseSales.printLocalOrderReceipt)) return;
|
|
1611
1731
|
logger === null || logger === void 0 || (_logger$addLog11 = logger.addLog) === null || _logger$addLog11 === void 0 || _logger$addLog11.call(logger, {
|
|
1612
|
-
type: "
|
|
1613
|
-
title: "eftpos
|
|
1614
|
-
metadata: { error: error instanceof Error ? error.message : String(error) }
|
|
1732
|
+
type: "info",
|
|
1733
|
+
title: "eftpos支付异常,请求本地打印小票"
|
|
1615
1734
|
});
|
|
1735
|
+
try {
|
|
1736
|
+
var _logger$addLog12;
|
|
1737
|
+
const res = yield currentBaseSales.printLocalOrderReceipt();
|
|
1738
|
+
logger === null || logger === void 0 || (_logger$addLog12 = logger.addLog) === null || _logger$addLog12 === void 0 || _logger$addLog12.call(logger, {
|
|
1739
|
+
type: "info",
|
|
1740
|
+
title: "eftpos支付异常,请求本地打印小票结果",
|
|
1741
|
+
metadata: { res }
|
|
1742
|
+
});
|
|
1743
|
+
} catch (error) {
|
|
1744
|
+
var _logger$addLog13;
|
|
1745
|
+
console.error("handleButtonClick_print-receipt_error>>>>", error);
|
|
1746
|
+
logger === null || logger === void 0 || (_logger$addLog13 = logger.addLog) === null || _logger$addLog13 === void 0 || _logger$addLog13.call(logger, {
|
|
1747
|
+
type: "error",
|
|
1748
|
+
title: "eftpos支付异常,请求本地打印小票失败",
|
|
1749
|
+
metadata: { error: error instanceof Error ? error.message : String(error) }
|
|
1750
|
+
});
|
|
1751
|
+
}
|
|
1752
|
+
onPaymentCancel(true);
|
|
1753
|
+
_app.history.replace("/home");
|
|
1616
1754
|
}
|
|
1617
|
-
|
|
1618
|
-
|
|
1619
|
-
|
|
1620
|
-
|
|
1621
|
-
|
|
1622
|
-
|
|
1623
|
-
|
|
1624
|
-
|
|
1625
|
-
|
|
1626
|
-
|
|
1627
|
-
|
|
1628
|
-
|
|
1629
|
-
|
|
1630
|
-
|
|
1631
|
-
|
|
1632
|
-
|
|
1633
|
-
|
|
1634
|
-
|
|
1635
|
-
|
|
1636
|
-
|
|
1637
|
-
|
|
1638
|
-
manual_marking_flag: event.manuallyConfirmed ? 1 : void 0,
|
|
1639
|
-
card_reader_snapshot: event.readerSnapshot
|
|
1755
|
+
if (event.type === "success" || event.type === "failed") {
|
|
1756
|
+
var _screenProtector$resu3, _event$surcharge, _event$surcharge2;
|
|
1757
|
+
screenProtector && (screenProtector === null || screenProtector === void 0 || (_screenProtector$resu3 = screenProtector.resumeIdleTimer) === null || _screenProtector$resu3 === void 0 || _screenProtector$resu3.call(screenProtector));
|
|
1758
|
+
shouldPreservePendingEftpos = true;
|
|
1759
|
+
if (event.type !== "success") return;
|
|
1760
|
+
const paymentAmount = event.amount || finalAmount;
|
|
1761
|
+
const serviceCharge = {
|
|
1762
|
+
percentage: ((_event$surcharge = event.surcharge) === null || _event$surcharge === void 0 ? void 0 : _event$surcharge.ratePercent) ? new decimal_js.default(event.surcharge.ratePercent).div(100).toString() : void 0,
|
|
1763
|
+
amount: (_event$surcharge2 = event.surcharge) === null || _event$surcharge2 === void 0 ? void 0 : _event$surcharge2.fixedAmount
|
|
1764
|
+
};
|
|
1765
|
+
yield updateEftposPayment({
|
|
1766
|
+
paymentNumber,
|
|
1767
|
+
transactionNumber: eventTransactionNumber,
|
|
1768
|
+
updates: {
|
|
1769
|
+
amount: paymentAmount,
|
|
1770
|
+
service_charge: serviceCharge,
|
|
1771
|
+
service_fee: calculateEftposServiceFee(paymentAmount, serviceCharge),
|
|
1772
|
+
metadata: {
|
|
1773
|
+
manual_marking_flag: event.manuallyConfirmed ? 1 : void 0,
|
|
1774
|
+
card_reader_snapshot: event.readerSnapshot
|
|
1775
|
+
}
|
|
1640
1776
|
}
|
|
1641
|
-
}
|
|
1642
|
-
|
|
1643
|
-
|
|
1644
|
-
|
|
1645
|
-
|
|
1646
|
-
|
|
1647
|
-
|
|
1648
|
-
|
|
1777
|
+
});
|
|
1778
|
+
return;
|
|
1779
|
+
}
|
|
1780
|
+
if (event.type === "closed" && !shouldPreservePendingEftpos) {
|
|
1781
|
+
var _screenProtector$resu4;
|
|
1782
|
+
screenProtector && (screenProtector === null || screenProtector === void 0 || (_screenProtector$resu4 = screenProtector.resumeIdleTimer) === null || _screenProtector$resu4 === void 0 || _screenProtector$resu4.call(screenProtector));
|
|
1783
|
+
yield deletePendingEftposPayment(paymentNumber);
|
|
1784
|
+
}
|
|
1785
|
+
} catch (error) {
|
|
1786
|
+
handleEftposUpdateError(error, paymentNumber);
|
|
1787
|
+
} finally {
|
|
1788
|
+
if (isTerminalEvent) finishPaymentActivity();
|
|
1649
1789
|
}
|
|
1650
|
-
}
|
|
1651
|
-
|
|
1652
|
-
|
|
1790
|
+
});
|
|
1791
|
+
return function onChange(_x35) {
|
|
1792
|
+
return _ref28.apply(this, arguments);
|
|
1793
|
+
};
|
|
1794
|
+
}()
|
|
1795
|
+
}))) paymentActivityHandedOff = true;
|
|
1796
|
+
else yield deletePendingEftposPayment(paymentNumber);
|
|
1797
|
+
} else {
|
|
1798
|
+
var _metadata, _screenProtector$resu5;
|
|
1799
|
+
let service_charge = null;
|
|
1800
|
+
if ((method === null || method === void 0 ? void 0 : method.fixed) || (method === null || method === void 0 ? void 0 : method.percentage)) service_charge = {
|
|
1801
|
+
amount: (method === null || method === void 0 ? void 0 : method.fixed) || "0",
|
|
1802
|
+
percentage: (method === null || method === void 0 ? void 0 : method.percentage) || "0"
|
|
1803
|
+
};
|
|
1804
|
+
if (!canAddOrderPayment(finalAmount)) return;
|
|
1805
|
+
if (method.type === "custom" && ((_metadata = method.metadata) === null || _metadata === void 0 ? void 0 : _metadata.order_open_cash_drawer)) {
|
|
1806
|
+
var _interaction$utils2, _interaction$utils2$p;
|
|
1807
|
+
logger === null || logger === void 0 || logger.addLog({
|
|
1808
|
+
type: "info",
|
|
1809
|
+
title: "open_till",
|
|
1810
|
+
metadata: {}
|
|
1653
1811
|
});
|
|
1654
|
-
|
|
1655
|
-
|
|
1656
|
-
|
|
1657
|
-
|
|
1658
|
-
|
|
1659
|
-
|
|
1660
|
-
|
|
1661
|
-
|
|
1662
|
-
|
|
1663
|
-
|
|
1664
|
-
|
|
1665
|
-
|
|
1666
|
-
|
|
1667
|
-
|
|
1668
|
-
|
|
1669
|
-
logger === null || logger === void 0 || logger.addLog({
|
|
1670
|
-
type: "info",
|
|
1671
|
-
title: "open_till",
|
|
1672
|
-
metadata: {}
|
|
1673
|
-
});
|
|
1674
|
-
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, {
|
|
1675
|
-
module: "till",
|
|
1676
|
-
key: "open_till",
|
|
1677
|
-
data: { type: "cash" }
|
|
1812
|
+
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, {
|
|
1813
|
+
module: "till",
|
|
1814
|
+
key: "open_till",
|
|
1815
|
+
data: { type: "cash" }
|
|
1816
|
+
});
|
|
1817
|
+
}
|
|
1818
|
+
setIsChangePaymentNotIncludeVoucher === null || setIsChangePaymentNotIncludeVoucher === void 0 || setIsChangePaymentNotIncludeVoucher(true);
|
|
1819
|
+
yield addBaseSalesOrderPayment(currentBaseSales, {
|
|
1820
|
+
amount: finalAmount,
|
|
1821
|
+
code: method.code,
|
|
1822
|
+
custom_payment_id: method.id,
|
|
1823
|
+
name: method.name,
|
|
1824
|
+
custom_payment_type: method.type,
|
|
1825
|
+
voucher_id: 0,
|
|
1826
|
+
service_charge
|
|
1678
1827
|
});
|
|
1828
|
+
screenProtector && (screenProtector === null || screenProtector === void 0 || (_screenProtector$resu5 = screenProtector.resumeIdleTimer) === null || _screenProtector$resu5 === void 0 || _screenProtector$resu5.call(screenProtector));
|
|
1679
1829
|
}
|
|
1680
|
-
|
|
1681
|
-
|
|
1682
|
-
amount: finalAmount,
|
|
1683
|
-
code: method.code,
|
|
1684
|
-
custom_payment_id: method.id,
|
|
1685
|
-
name: method.name,
|
|
1686
|
-
custom_payment_type: method.type,
|
|
1687
|
-
voucher_id: 0,
|
|
1688
|
-
service_charge
|
|
1689
|
-
});
|
|
1690
|
-
screenProtector && (screenProtector === null || screenProtector === void 0 || (_screenProtector$resu5 = screenProtector.resumeIdleTimer) === null || _screenProtector$resu5 === void 0 || _screenProtector$resu5.call(screenProtector));
|
|
1830
|
+
} finally {
|
|
1831
|
+
if (!paymentActivityHandedOff) finishPaymentActivity();
|
|
1691
1832
|
}
|
|
1692
1833
|
});
|
|
1693
1834
|
return function onPaymentOptionClick(_x36) {
|
|
@@ -1816,13 +1957,16 @@ const PaymentContent = (0, react.forwardRef)(({ cartData, orderInfo, isModalOpen
|
|
|
1816
1957
|
const [confirmLoading, setConfirmLoading] = (0, react.useState)(false);
|
|
1817
1958
|
const handleWalletPassConfirmPay = function() {
|
|
1818
1959
|
var _ref34 = require_asyncToGenerator._asyncToGenerator(function* (action) {
|
|
1960
|
+
if (action === "cancel") return;
|
|
1961
|
+
const finishPaymentActivity = beginKioskPaymentActivity("wallet-confirm");
|
|
1962
|
+
if (!finishPaymentActivity) return;
|
|
1819
1963
|
let confirmPendingVoucherPayments = true;
|
|
1820
|
-
if (action === "save-without-deduct") {
|
|
1821
|
-
confirmPendingVoucherPayments = false;
|
|
1822
|
-
yield clearPendingWalletPassPaymentsForMode();
|
|
1823
|
-
} else if (action === "cancel") return;
|
|
1824
1964
|
setConfirmLoading(true);
|
|
1825
1965
|
try {
|
|
1966
|
+
if (action === "save-without-deduct") {
|
|
1967
|
+
confirmPendingVoucherPayments = false;
|
|
1968
|
+
yield clearPendingWalletPassPaymentsForMode();
|
|
1969
|
+
}
|
|
1826
1970
|
const result = confirmPendingVoucherPayments ? yield confirmBaseSalesWalletPayment(currentBaseSales) : yield submitBaseSalesOrder(currentBaseSales, { confirmPendingVoucherPayments: false });
|
|
1827
1971
|
if (result.success) yield cacheSubmittedOrderResult(result);
|
|
1828
1972
|
yield showSuccessToast === null || showSuccessToast === void 0 ? void 0 : showSuccessToast(require_objectSpread2._objectSpread2({}, result));
|
|
@@ -1842,6 +1986,7 @@ const PaymentContent = (0, react.forwardRef)(({ cartData, orderInfo, isModalOpen
|
|
|
1842
1986
|
console.error("Failed to submit base sales order:", error);
|
|
1843
1987
|
} finally {
|
|
1844
1988
|
setConfirmLoading(false);
|
|
1989
|
+
finishPaymentActivity();
|
|
1845
1990
|
}
|
|
1846
1991
|
});
|
|
1847
1992
|
return function handleWalletPassConfirmPay(_x41) {
|
|
@@ -1885,13 +2030,21 @@ const PaymentContent = (0, react.forwardRef)(({ cartData, orderInfo, isModalOpen
|
|
|
1885
2030
|
};
|
|
1886
2031
|
const shouldShowCashPayment = moduleConfig.showCashPayment && showCashPayment;
|
|
1887
2032
|
const paymentOptionsColumnCount = (_config$paymentOption = config === null || config === void 0 ? void 0 : config.paymentOptionsColumnCount) !== null && _config$paymentOption !== void 0 ? _config$paymentOption : shouldShowCashPayment ? 1 : 2;
|
|
1888
|
-
const
|
|
1889
|
-
|
|
1890
|
-
|
|
2033
|
+
const isKioskCheckoutActivityLocked = paymentChannel === "kiosk" && (syncingLock || paymentScanActivity.isScanProcessing || paymentScanActivity.isPaymentProcessing);
|
|
2034
|
+
const handleSearch = (0, ahooks.useMemoizedFn)(function() {
|
|
2035
|
+
var _ref37 = require_asyncToGenerator._asyncToGenerator(function* (keyword) {
|
|
2036
|
+
if (!walletPassRef.current) return void 0;
|
|
2037
|
+
if (paymentChannel !== "kiosk") return walletPassRef.current.handleSearchIdentificationCode(keyword);
|
|
2038
|
+
return walletPassRef.current.handleSearchIdentificationCode(keyword, { waitForApply: true });
|
|
2039
|
+
});
|
|
2040
|
+
return function(_x43) {
|
|
2041
|
+
return _ref37.apply(this, arguments);
|
|
2042
|
+
};
|
|
2043
|
+
}());
|
|
1891
2044
|
(0, react.useEffect)(() => {
|
|
1892
2045
|
let isCancelled = false;
|
|
1893
2046
|
(function() {
|
|
1894
|
-
var
|
|
2047
|
+
var _ref39 = require_asyncToGenerator._asyncToGenerator(function* () {
|
|
1895
2048
|
var _currentBaseSales$get14, _amountSnapshot$summa;
|
|
1896
2049
|
if (!currentBaseSales) {
|
|
1897
2050
|
setPriceAdjustProductExpectAmount(void 0);
|
|
@@ -1900,16 +2053,16 @@ const PaymentContent = (0, react.forwardRef)(({ cartData, orderInfo, isModalOpen
|
|
|
1900
2053
|
const amountSnapshot = (_currentBaseSales$get14 = currentBaseSales.getOrderAmountSnapshot) === null || _currentBaseSales$get14 === void 0 ? void 0 : _currentBaseSales$get14.call(currentBaseSales);
|
|
1901
2054
|
let productExpectAmount = amountSnapshot === null || amountSnapshot === void 0 || (_amountSnapshot$summa = amountSnapshot.summary) === null || _amountSnapshot$summa === void 0 ? void 0 : _amountSnapshot$summa.product_expect_amount;
|
|
1902
2055
|
try {
|
|
1903
|
-
var _currentBaseSales$get15,
|
|
2056
|
+
var _currentBaseSales$get15, _ref38, _summary$product_expe, _summary$summary;
|
|
1904
2057
|
const summary = yield (_currentBaseSales$get15 = currentBaseSales.getSummary) === null || _currentBaseSales$get15 === void 0 ? void 0 : _currentBaseSales$get15.call(currentBaseSales);
|
|
1905
|
-
productExpectAmount = (
|
|
2058
|
+
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;
|
|
1906
2059
|
} catch (error) {
|
|
1907
2060
|
console.error("Failed to read BaseSales summary:", error);
|
|
1908
2061
|
}
|
|
1909
2062
|
if (!isCancelled) setPriceAdjustProductExpectAmount(productExpectAmount);
|
|
1910
2063
|
});
|
|
1911
2064
|
return function readProductExpectAmount() {
|
|
1912
|
-
return
|
|
2065
|
+
return _ref39.apply(this, arguments);
|
|
1913
2066
|
};
|
|
1914
2067
|
})()();
|
|
1915
2068
|
return () => {
|
|
@@ -1922,8 +2075,8 @@ const PaymentContent = (0, react.forwardRef)(({ cartData, orderInfo, isModalOpen
|
|
|
1922
2075
|
balanceDueTotalAmount
|
|
1923
2076
|
]);
|
|
1924
2077
|
const priceAdjustOriginalAmount = (0, react.useMemo)(() => {
|
|
1925
|
-
var
|
|
1926
|
-
return Number((
|
|
2078
|
+
var _ref40, _ref41;
|
|
2079
|
+
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);
|
|
1927
2080
|
}, [
|
|
1928
2081
|
priceAdjustProductExpectAmount,
|
|
1929
2082
|
currentTotalPrice,
|
|
@@ -1933,7 +2086,7 @@ const PaymentContent = (0, react.forwardRef)(({ cartData, orderInfo, isModalOpen
|
|
|
1933
2086
|
return new decimal_js.default(priceAdjustOriginalAmount).minus(shopDiscount || 0).toNumber();
|
|
1934
2087
|
}, [shopDiscount, priceAdjustOriginalAmount]);
|
|
1935
2088
|
const handleSelectWalletChange = (0, ahooks.useMemoizedFn)(function() {
|
|
1936
|
-
var
|
|
2089
|
+
var _ref42 = require_asyncToGenerator._asyncToGenerator(function* (select) {
|
|
1937
2090
|
if (walletPassMode === "shared") {
|
|
1938
2091
|
var _currentBaseSales$get16;
|
|
1939
2092
|
setPaymentItems((currentBaseSales === null || currentBaseSales === void 0 || (_currentBaseSales$get16 = currentBaseSales.getOrderPayments) === null || _currentBaseSales$get16 === void 0 ? void 0 : _currentBaseSales$get16.call(currentBaseSales)) || []);
|
|
@@ -1989,8 +2142,8 @@ const PaymentContent = (0, react.forwardRef)(({ cartData, orderInfo, isModalOpen
|
|
|
1989
2142
|
}
|
|
1990
2143
|
});
|
|
1991
2144
|
if (typeof (currentBaseSales === null || currentBaseSales === void 0 ? void 0 : currentBaseSales.updateVoucherOrderPaymentsAsync) !== "function" && typeof (currentBaseSales === null || currentBaseSales === void 0 ? void 0 : currentBaseSales.updateVoucherOrderPayments) !== "function") {
|
|
1992
|
-
var _logger$
|
|
1993
|
-
logger === null || logger === void 0 || (_logger$
|
|
2145
|
+
var _logger$addLog14;
|
|
2146
|
+
logger === null || logger === void 0 || (_logger$addLog14 = logger.addLog) === null || _logger$addLog14 === void 0 || _logger$addLog14.call(logger, {
|
|
1994
2147
|
type: "error",
|
|
1995
2148
|
title: "BaseSales updateVoucherOrderPayments is not available",
|
|
1996
2149
|
metadata: {
|
|
@@ -2006,8 +2159,8 @@ const PaymentContent = (0, react.forwardRef)(({ cartData, orderInfo, isModalOpen
|
|
|
2006
2159
|
if (walletPassRef.current) setWalletPassData(walletPassRef.current.getWalletPassData(select));
|
|
2007
2160
|
}
|
|
2008
2161
|
});
|
|
2009
|
-
return function(
|
|
2010
|
-
return
|
|
2162
|
+
return function(_x44) {
|
|
2163
|
+
return _ref42.apply(this, arguments);
|
|
2011
2164
|
};
|
|
2012
2165
|
}());
|
|
2013
2166
|
const handleWalletDiscountChange = (0, ahooks.useMemoizedFn)((detail) => {
|
|
@@ -2024,7 +2177,7 @@ const PaymentContent = (0, react.forwardRef)(({ cartData, orderInfo, isModalOpen
|
|
|
2024
2177
|
}
|
|
2025
2178
|
});
|
|
2026
2179
|
const handlePriceAdjustConfirm = function() {
|
|
2027
|
-
var
|
|
2180
|
+
var _ref43 = require_asyncToGenerator._asyncToGenerator(function* (discountAmount) {
|
|
2028
2181
|
if (!isPriceAdjustEnabled) {
|
|
2029
2182
|
setShowPriceAdjustModal(false);
|
|
2030
2183
|
return;
|
|
@@ -2048,12 +2201,12 @@ const PaymentContent = (0, react.forwardRef)(({ cartData, orderInfo, isModalOpen
|
|
|
2048
2201
|
}
|
|
2049
2202
|
setShowPriceAdjustModal(false);
|
|
2050
2203
|
});
|
|
2051
|
-
return function handlePriceAdjustConfirm(
|
|
2052
|
-
return
|
|
2204
|
+
return function handlePriceAdjustConfirm(_x45) {
|
|
2205
|
+
return _ref43.apply(this, arguments);
|
|
2053
2206
|
};
|
|
2054
2207
|
}();
|
|
2055
2208
|
const handleButtonClick = function() {
|
|
2056
|
-
var
|
|
2209
|
+
var _ref44 = require_asyncToGenerator._asyncToGenerator(function* (key) {
|
|
2057
2210
|
console.log("handleButtonClick", key);
|
|
2058
2211
|
switch (key) {
|
|
2059
2212
|
case "order-note":
|
|
@@ -2066,24 +2219,24 @@ const PaymentContent = (0, react.forwardRef)(({ cartData, orderInfo, isModalOpen
|
|
|
2066
2219
|
setShowSplitPaymentKeyboard(true);
|
|
2067
2220
|
break;
|
|
2068
2221
|
case "print-receipt":
|
|
2069
|
-
var _logger$
|
|
2222
|
+
var _logger$addLog15;
|
|
2070
2223
|
if (!(currentBaseSales === null || currentBaseSales === void 0 ? void 0 : currentBaseSales.printLocalOrderReceipt)) return;
|
|
2071
|
-
logger === null || logger === void 0 || (_logger$
|
|
2224
|
+
logger === null || logger === void 0 || (_logger$addLog15 = logger.addLog) === null || _logger$addLog15 === void 0 || _logger$addLog15.call(logger, {
|
|
2072
2225
|
type: "info",
|
|
2073
2226
|
title: "支付弹窗请求本地打印小票"
|
|
2074
2227
|
});
|
|
2075
2228
|
try {
|
|
2076
|
-
var _logger$
|
|
2229
|
+
var _logger$addLog16;
|
|
2077
2230
|
const res = yield currentBaseSales.printLocalOrderReceipt();
|
|
2078
|
-
logger === null || logger === void 0 || (_logger$
|
|
2231
|
+
logger === null || logger === void 0 || (_logger$addLog16 = logger.addLog) === null || _logger$addLog16 === void 0 || _logger$addLog16.call(logger, {
|
|
2079
2232
|
type: "info",
|
|
2080
2233
|
title: "支付弹窗请求本地打印小票结果",
|
|
2081
2234
|
metadata: { res }
|
|
2082
2235
|
});
|
|
2083
2236
|
} catch (error) {
|
|
2084
|
-
var _logger$
|
|
2237
|
+
var _logger$addLog17;
|
|
2085
2238
|
console.error("handleButtonClick_print-receipt_error>>>>", error);
|
|
2086
|
-
logger === null || logger === void 0 || (_logger$
|
|
2239
|
+
logger === null || logger === void 0 || (_logger$addLog17 = logger.addLog) === null || _logger$addLog17 === void 0 || _logger$addLog17.call(logger, {
|
|
2087
2240
|
type: "error",
|
|
2088
2241
|
title: "支付弹窗请求本地打印小票失败",
|
|
2089
2242
|
metadata: { error: error instanceof Error ? error.message : String(error) }
|
|
@@ -2114,8 +2267,8 @@ const PaymentContent = (0, react.forwardRef)(({ cartData, orderInfo, isModalOpen
|
|
|
2114
2267
|
break;
|
|
2115
2268
|
}
|
|
2116
2269
|
});
|
|
2117
|
-
return function handleButtonClick(
|
|
2118
|
-
return
|
|
2270
|
+
return function handleButtonClick(_x46) {
|
|
2271
|
+
return _ref44.apply(this, arguments);
|
|
2119
2272
|
};
|
|
2120
2273
|
}();
|
|
2121
2274
|
(0, react.useImperativeHandle)(ref, () => ({
|
|
@@ -2141,7 +2294,7 @@ const PaymentContent = (0, react.forwardRef)(({ cartData, orderInfo, isModalOpen
|
|
|
2141
2294
|
};
|
|
2142
2295
|
};
|
|
2143
2296
|
const handleSendCustomerPaymentLink = function() {
|
|
2144
|
-
var
|
|
2297
|
+
var _ref45 = require_asyncToGenerator._asyncToGenerator(function* (data) {
|
|
2145
2298
|
var _currentBaseSales$get20, _Toast$loading4, _currentBaseSales$get23, _Toast$hide6;
|
|
2146
2299
|
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;
|
|
2147
2300
|
const order = getBaseSalesOrderInfo(currentBaseSales);
|
|
@@ -2180,8 +2333,8 @@ const PaymentContent = (0, react.forwardRef)(({ cartData, orderInfo, isModalOpen
|
|
|
2180
2333
|
}, 1e3);
|
|
2181
2334
|
} else Toast === null || Toast === void 0 || Toast.error(res.message || _pisell_utils.locales.getText("pisell2.checkout.send-payment-link.error"));
|
|
2182
2335
|
});
|
|
2183
|
-
return function handleSendCustomerPaymentLink(
|
|
2184
|
-
return
|
|
2336
|
+
return function handleSendCustomerPaymentLink(_x47) {
|
|
2337
|
+
return _ref45.apply(this, arguments);
|
|
2185
2338
|
};
|
|
2186
2339
|
}();
|
|
2187
2340
|
const handleClientChange = (0, react.useCallback)((nextClient) => {
|
|
@@ -2224,12 +2377,12 @@ const PaymentContent = (0, react.forwardRef)(({ cartData, orderInfo, isModalOpen
|
|
|
2224
2377
|
customerGuard.isCustomerChangeLocked
|
|
2225
2378
|
]);
|
|
2226
2379
|
const roundingFunction = (0, react.useCallback)(function() {
|
|
2227
|
-
var
|
|
2380
|
+
var _ref46 = require_asyncToGenerator._asyncToGenerator(function* (amount) {
|
|
2228
2381
|
var _currentBaseSales$rou;
|
|
2229
2382
|
return yield currentBaseSales === null || currentBaseSales === void 0 || (_currentBaseSales$rou = currentBaseSales.roundAmount) === null || _currentBaseSales$rou === void 0 ? void 0 : _currentBaseSales$rou.call(currentBaseSales, { amount });
|
|
2230
2383
|
});
|
|
2231
|
-
return function(
|
|
2232
|
-
return
|
|
2384
|
+
return function(_x48) {
|
|
2385
|
+
return _ref46.apply(this, arguments);
|
|
2233
2386
|
};
|
|
2234
2387
|
}(), [currentBaseSales]);
|
|
2235
2388
|
const handleModalClick = (0, react.useCallback)((event) => {
|
|
@@ -2239,13 +2392,13 @@ const PaymentContent = (0, react.forwardRef)(({ cartData, orderInfo, isModalOpen
|
|
|
2239
2392
|
padding: "12px 16px",
|
|
2240
2393
|
border: "1px solid #d0d5dd",
|
|
2241
2394
|
borderRadius: 8
|
|
2242
|
-
} }, (moduleConfig.showCustomerModule || moduleConfig.showCustomerSelect) && /* @__PURE__ */ react.default.createElement(require_index$11.default, require_objectSpread2._objectSpread2({
|
|
2395
|
+
} }, (moduleConfig.showCustomerModule || moduleConfig.showCustomerSelect) && /* @__PURE__ */ react.default.createElement(require_index$11.default, require_objectSpread2._objectSpread2(require_objectSpread2._objectSpread2({
|
|
2243
2396
|
onClientChange: handleClientChange,
|
|
2244
2397
|
clientInfo: displayClient,
|
|
2245
2398
|
onSearch: handleSearch,
|
|
2246
2399
|
baseSales: currentBaseSales,
|
|
2247
2400
|
showCustomerSelect: moduleConfig.showCustomerSelect
|
|
2248
|
-
}, searchAndClientProps)), moduleConfig.showWalletPass && /* @__PURE__ */ react.default.createElement(require_index$8.default, {
|
|
2401
|
+
}, searchAndClientProps), {}, { beginScanActivity: paymentChannel === "kiosk" ? beginKioskScanActivity : void 0 })), moduleConfig.showWalletPass && /* @__PURE__ */ react.default.createElement(require_index$8.default, {
|
|
2249
2402
|
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,
|
|
2250
2403
|
customAmount: balanceDueAmount,
|
|
2251
2404
|
orderInfo: orderInfo || void 0,
|
|
@@ -2276,13 +2429,19 @@ const PaymentContent = (0, react.forwardRef)(({ cartData, orderInfo, isModalOpen
|
|
|
2276
2429
|
shouldUseNormalPayment: hasNonDepositOrderPayment,
|
|
2277
2430
|
enablePriceAdjust: isPriceAdjustEnabled,
|
|
2278
2431
|
showPaymentType: (config === null || config === void 0 ? void 0 : config.showPaymentType) !== false
|
|
2279
|
-
}), /* @__PURE__ */ react.default.createElement("div", { className: shouldShowCashPayment ? "payment-grid-layout" : "payment-flex-layout" }, shouldShowCashPayment && /* @__PURE__ */ react.default.createElement("div", {
|
|
2280
|
-
|
|
2281
|
-
|
|
2282
|
-
|
|
2432
|
+
}), /* @__PURE__ */ react.default.createElement("div", { className: shouldShowCashPayment ? "payment-grid-layout" : "payment-flex-layout" }, shouldShowCashPayment && /* @__PURE__ */ react.default.createElement("div", {
|
|
2433
|
+
"aria-disabled": isKioskCheckoutActivityLocked,
|
|
2434
|
+
style: require_objectSpread2._objectSpread2(require_objectSpread2._objectSpread2({}, shouldShowCashPayment ? {
|
|
2435
|
+
gridColumn: "1",
|
|
2436
|
+
gridRow: (paymentOptionList === null || paymentOptionList === void 0 ? void 0 : paymentOptionList.length) === 1 ? "span 2" : "1"
|
|
2437
|
+
} : {}), isKioskCheckoutActivityLocked ? {
|
|
2438
|
+
opacity: .6,
|
|
2439
|
+
pointerEvents: "none"
|
|
2440
|
+
} : {})
|
|
2441
|
+
}, /* @__PURE__ */ react.default.createElement(require_index$4.default, {
|
|
2283
2442
|
disabled: isOrderFree,
|
|
2284
2443
|
isModalOpen,
|
|
2285
|
-
syncingLock,
|
|
2444
|
+
syncingLock: syncingLock || isKioskCheckoutActivityLocked,
|
|
2286
2445
|
amountSymbol: getData("shop_symbol"),
|
|
2287
2446
|
orderInfo: orderInfo || void 0,
|
|
2288
2447
|
onPaymentComplete: handleAddCashPayment,
|
|
@@ -2305,7 +2464,7 @@ const PaymentContent = (0, react.forwardRef)(({ cartData, orderInfo, isModalOpen
|
|
|
2305
2464
|
paymentMethods,
|
|
2306
2465
|
customAmount: effectiveCustomAmount,
|
|
2307
2466
|
title: paymentOptionsTitle,
|
|
2308
|
-
disabled: isOrderFree,
|
|
2467
|
+
disabled: isOrderFree || isKioskCheckoutActivityLocked,
|
|
2309
2468
|
showCashPayment: shouldShowCashPayment,
|
|
2310
2469
|
channel: paymentChannel,
|
|
2311
2470
|
columnCount: paymentOptionsColumnCount,
|
|
@@ -2313,6 +2472,7 @@ const PaymentContent = (0, react.forwardRef)(({ cartData, orderInfo, isModalOpen
|
|
|
2313
2472
|
directCustomPayment: (config === null || config === void 0 ? void 0 : config.directCustomPayment) === true,
|
|
2314
2473
|
isModalOpen,
|
|
2315
2474
|
paymentMethodsReady,
|
|
2475
|
+
beginKioskPaymentActivity,
|
|
2316
2476
|
currentBaseSales,
|
|
2317
2477
|
autoTriggerSinglePaymentOption: (config === null || config === void 0 ? void 0 : config.autoTriggerSinglePaymentOption) === true
|
|
2318
2478
|
})), moduleConfig.showAdditionalModule && /* @__PURE__ */ react.default.createElement("div", {
|
|
@@ -2417,8 +2577,8 @@ const PaymentModal = ({ open, baseSales, baseSalesModuleName, walletPassMode = "
|
|
|
2417
2577
|
const cardReaderFetchPromiseRef = (0, react.useRef)(null);
|
|
2418
2578
|
const [totalAmount, setTotalAmount] = (0, react.useState)(0);
|
|
2419
2579
|
const displayTotalAmount = (0, react.useMemo)(() => {
|
|
2420
|
-
var
|
|
2421
|
-
return Number((
|
|
2580
|
+
var _ref47, _orderInfo$totalAmoun;
|
|
2581
|
+
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);
|
|
2422
2582
|
}, [orderInfo === null || orderInfo === void 0 ? void 0 : orderInfo.totalAmount, totalAmount]);
|
|
2423
2583
|
const [actualShowCashPayment, setActualShowCashPayment] = (0, react.useState)(true);
|
|
2424
2584
|
const [windowHeight, setWindowHeight] = (0, react.useState)(0);
|
|
@@ -2452,7 +2612,7 @@ const PaymentModal = ({ open, baseSales, baseSalesModuleName, walletPassMode = "
|
|
|
2452
2612
|
Toast
|
|
2453
2613
|
]);
|
|
2454
2614
|
const handleRetry = function() {
|
|
2455
|
-
var
|
|
2615
|
+
var _ref48 = require_asyncToGenerator._asyncToGenerator(function* () {
|
|
2456
2616
|
if (isRetryingPaymentSync) return;
|
|
2457
2617
|
setIsRetryingPaymentSync(true);
|
|
2458
2618
|
try {
|
|
@@ -2465,7 +2625,7 @@ const PaymentModal = ({ open, baseSales, baseSalesModuleName, walletPassMode = "
|
|
|
2465
2625
|
}
|
|
2466
2626
|
});
|
|
2467
2627
|
return function handleRetry() {
|
|
2468
|
-
return
|
|
2628
|
+
return _ref48.apply(this, arguments);
|
|
2469
2629
|
};
|
|
2470
2630
|
}();
|
|
2471
2631
|
(0, react.useEffect)(() => {
|
|
@@ -2483,7 +2643,7 @@ const PaymentModal = ({ open, baseSales, baseSalesModuleName, walletPassMode = "
|
|
|
2483
2643
|
(0, react.useEffect)(() => {
|
|
2484
2644
|
var _interaction$utils4;
|
|
2485
2645
|
const initTillButtonData = function() {
|
|
2486
|
-
var
|
|
2646
|
+
var _ref49 = require_asyncToGenerator._asyncToGenerator(function* () {
|
|
2487
2647
|
console.log("准备获取tillButton数据");
|
|
2488
2648
|
try {
|
|
2489
2649
|
var _interaction$utils3, _interaction$utils3$a;
|
|
@@ -2501,7 +2661,7 @@ const PaymentModal = ({ open, baseSales, baseSalesModuleName, walletPassMode = "
|
|
|
2501
2661
|
}
|
|
2502
2662
|
});
|
|
2503
2663
|
return function initTillButtonData() {
|
|
2504
|
-
return
|
|
2664
|
+
return _ref49.apply(this, arguments);
|
|
2505
2665
|
};
|
|
2506
2666
|
}();
|
|
2507
2667
|
if (interaction === null || interaction === void 0 || (_interaction$utils4 = interaction.utils) === null || _interaction$utils4 === void 0 ? void 0 : _interaction$utils4.asyncDataManager) initTillButtonData();
|
|
@@ -2556,7 +2716,7 @@ const PaymentModal = ({ open, baseSales, baseSalesModuleName, walletPassMode = "
|
|
|
2556
2716
|
const [orderNote, setOrderNote] = (0, react.useState)("");
|
|
2557
2717
|
const [noteModalSource, setNoteModalSource] = (0, react.useState)("payment-content");
|
|
2558
2718
|
const handleNoteConfirm = function() {
|
|
2559
|
-
var
|
|
2719
|
+
var _ref50 = require_asyncToGenerator._asyncToGenerator(function* (noteValue) {
|
|
2560
2720
|
if (noteModalSource === "payment-result-toast") {
|
|
2561
2721
|
var _baseSalesModule$getO;
|
|
2562
2722
|
const baseSalesModule = currentBaseSales;
|
|
@@ -2589,12 +2749,12 @@ const PaymentModal = ({ open, baseSales, baseSalesModuleName, walletPassMode = "
|
|
|
2589
2749
|
setNoteModalOpen(false);
|
|
2590
2750
|
setNoteModalSource("payment-content");
|
|
2591
2751
|
});
|
|
2592
|
-
return function handleNoteConfirm(
|
|
2593
|
-
return
|
|
2752
|
+
return function handleNoteConfirm(_x49) {
|
|
2753
|
+
return _ref50.apply(this, arguments);
|
|
2594
2754
|
};
|
|
2595
2755
|
}();
|
|
2596
2756
|
const handleNoteDelete = function() {
|
|
2597
|
-
var
|
|
2757
|
+
var _ref51 = require_asyncToGenerator._asyncToGenerator(function* () {
|
|
2598
2758
|
try {
|
|
2599
2759
|
const baseSalesModule = currentBaseSales;
|
|
2600
2760
|
if (baseSalesModule) {
|
|
@@ -2612,7 +2772,7 @@ const PaymentModal = ({ open, baseSales, baseSalesModuleName, walletPassMode = "
|
|
|
2612
2772
|
setNoteModalSource("payment-content");
|
|
2613
2773
|
});
|
|
2614
2774
|
return function handleNoteDelete() {
|
|
2615
|
-
return
|
|
2775
|
+
return _ref51.apply(this, arguments);
|
|
2616
2776
|
};
|
|
2617
2777
|
}();
|
|
2618
2778
|
const handleNoteCancel = () => {
|
|
@@ -2685,7 +2845,7 @@ const PaymentModal = ({ open, baseSales, baseSalesModuleName, walletPassMode = "
|
|
|
2685
2845
|
});
|
|
2686
2846
|
};
|
|
2687
2847
|
const handlePaymentCancel = function() {
|
|
2688
|
-
var
|
|
2848
|
+
var _ref52 = require_asyncToGenerator._asyncToGenerator(function* (reset, forceCloseWhenSyncing, reason) {
|
|
2689
2849
|
var _paymentContentRef$cu3, _paymentContentRef$cu4, _baseSalesModule$getO2;
|
|
2690
2850
|
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;
|
|
2691
2851
|
console.log("Payment cancelled, syncingLock:", isSyncingLocked);
|
|
@@ -2717,8 +2877,8 @@ const PaymentModal = ({ open, baseSales, baseSalesModuleName, walletPassMode = "
|
|
|
2717
2877
|
paymentResult: currentPaymentResultRef.current
|
|
2718
2878
|
}, startNewOrderEvent ? { event: startNewOrderEvent } : {}));
|
|
2719
2879
|
});
|
|
2720
|
-
return function handlePaymentCancel(
|
|
2721
|
-
return
|
|
2880
|
+
return function handlePaymentCancel(_x50, _x51, _x52) {
|
|
2881
|
+
return _ref52.apply(this, arguments);
|
|
2722
2882
|
};
|
|
2723
2883
|
}();
|
|
2724
2884
|
const handleBackClose = (0, ahooks.useMemoizedFn)(require_asyncToGenerator._asyncToGenerator(function* () {
|
|
@@ -2764,7 +2924,7 @@ const PaymentModal = ({ open, baseSales, baseSalesModuleName, walletPassMode = "
|
|
|
2764
2924
|
});
|
|
2765
2925
|
}));
|
|
2766
2926
|
(function() {
|
|
2767
|
-
var
|
|
2927
|
+
var _ref53 = require_asyncToGenerator._asyncToGenerator(function* (closeModal = false) {
|
|
2768
2928
|
var _baseSalesModule$getO3, _baseSalesModule$getO4;
|
|
2769
2929
|
const baseSalesModule = currentBaseSales;
|
|
2770
2930
|
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;
|
|
@@ -2784,7 +2944,7 @@ const PaymentModal = ({ open, baseSales, baseSalesModuleName, walletPassMode = "
|
|
|
2784
2944
|
}, closeModal);
|
|
2785
2945
|
});
|
|
2786
2946
|
return function handleSetEditCartMode() {
|
|
2787
|
-
return
|
|
2947
|
+
return _ref53.apply(this, arguments);
|
|
2788
2948
|
};
|
|
2789
2949
|
})();
|
|
2790
2950
|
const CustomHeader = () => /* @__PURE__ */ react.default.createElement("div", { className: "payment-modal-custom-header" }, /* @__PURE__ */ react.default.createElement("div", { className: "header__left" }, /* @__PURE__ */ react.default.createElement(antd.Button, {
|
|
@@ -2809,7 +2969,7 @@ const PaymentModal = ({ open, baseSales, baseSalesModuleName, walletPassMode = "
|
|
|
2809
2969
|
const unsubscribeRef = (0, react.useRef)(void 0);
|
|
2810
2970
|
(0, react.useEffect)(() => {
|
|
2811
2971
|
(function() {
|
|
2812
|
-
var
|
|
2972
|
+
var _ref54 = require_asyncToGenerator._asyncToGenerator(function* () {
|
|
2813
2973
|
try {
|
|
2814
2974
|
const baseSalesModule = currentBaseSales;
|
|
2815
2975
|
if (baseSalesModule) {
|
|
@@ -2867,7 +3027,7 @@ const PaymentModal = ({ open, baseSales, baseSalesModuleName, walletPassMode = "
|
|
|
2867
3027
|
}
|
|
2868
3028
|
});
|
|
2869
3029
|
return function initCheckoutData() {
|
|
2870
|
-
return
|
|
3030
|
+
return _ref54.apply(this, arguments);
|
|
2871
3031
|
};
|
|
2872
3032
|
})()();
|
|
2873
3033
|
}, []);
|
|
@@ -2902,7 +3062,7 @@ const PaymentModal = ({ open, baseSales, baseSalesModuleName, walletPassMode = "
|
|
|
2902
3062
|
require_PaymentResultToastV2Provider.closePaymentResultToastV2();
|
|
2903
3063
|
};
|
|
2904
3064
|
const handleDetailsClick = function() {
|
|
2905
|
-
var
|
|
3065
|
+
var _ref55 = require_asyncToGenerator._asyncToGenerator(function* () {
|
|
2906
3066
|
var _context$appHelper4, _context$appHelper4$a;
|
|
2907
3067
|
setTimeout(() => {
|
|
2908
3068
|
closeResultToast();
|
|
@@ -2917,25 +3077,25 @@ const PaymentModal = ({ open, baseSales, baseSalesModuleName, walletPassMode = "
|
|
|
2917
3077
|
});
|
|
2918
3078
|
});
|
|
2919
3079
|
return function handleDetailsClick() {
|
|
2920
|
-
return
|
|
3080
|
+
return _ref55.apply(this, arguments);
|
|
2921
3081
|
};
|
|
2922
3082
|
}();
|
|
2923
3083
|
const handlePrintReceiptClick = function() {
|
|
2924
|
-
var
|
|
2925
|
-
var _logger$
|
|
3084
|
+
var _ref56 = require_asyncToGenerator._asyncToGenerator(function* () {
|
|
3085
|
+
var _logger$addLog18;
|
|
2926
3086
|
setTimeout(() => {
|
|
2927
3087
|
closeResultToast();
|
|
2928
3088
|
}, 0);
|
|
2929
3089
|
const baseSalesModule = currentBaseSales;
|
|
2930
3090
|
if (!(baseSalesModule === null || baseSalesModule === void 0 ? void 0 : baseSalesModule.printLocalOrderReceipt)) return;
|
|
2931
|
-
(_logger$
|
|
3091
|
+
(_logger$addLog18 = logger.addLog) === null || _logger$addLog18 === void 0 || _logger$addLog18.call(logger, {
|
|
2932
3092
|
type: "info",
|
|
2933
3093
|
title: "支付结果弹窗请求本地打印小票"
|
|
2934
3094
|
});
|
|
2935
3095
|
try {
|
|
2936
|
-
var _logger$
|
|
3096
|
+
var _logger$addLog19;
|
|
2937
3097
|
const res = yield baseSalesModule.printLocalOrderReceipt(orderId);
|
|
2938
|
-
(_logger$
|
|
3098
|
+
(_logger$addLog19 = logger.addLog) === null || _logger$addLog19 === void 0 || _logger$addLog19.call(logger, {
|
|
2939
3099
|
type: "info",
|
|
2940
3100
|
title: "支付结果弹窗请求本地打印小票结果",
|
|
2941
3101
|
metadata: { res }
|
|
@@ -2946,7 +3106,7 @@ const PaymentModal = ({ open, baseSales, baseSalesModuleName, walletPassMode = "
|
|
|
2946
3106
|
}
|
|
2947
3107
|
});
|
|
2948
3108
|
return function handlePrintReceiptClick() {
|
|
2949
|
-
return
|
|
3109
|
+
return _ref56.apply(this, arguments);
|
|
2950
3110
|
};
|
|
2951
3111
|
}();
|
|
2952
3112
|
const handleRetryClick = () => {
|