@os1-platform/dispatch-mobile 2.1.24 → 2.1.25
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/lib/commonjs/components/executiontasks/collectPayment/CollectPaymentSchema.js +1 -0
- package/lib/commonjs/components/executiontasks/collectPayment/CollectPaymentSchema.js.map +1 -1
- package/lib/commonjs/components/executiontasks/collectPayment/PaymentStyles.js +21 -0
- package/lib/commonjs/components/executiontasks/collectPayment/PaymentStyles.js.map +1 -1
- package/lib/commonjs/components/executiontasks/collectPayment/PaymentUtils.js +17 -1
- package/lib/commonjs/components/executiontasks/collectPayment/PaymentUtils.js.map +1 -1
- package/lib/commonjs/components/executiontasks/collectPayment/components/CompletePayment.js +11 -14
- package/lib/commonjs/components/executiontasks/collectPayment/components/CompletePayment.js.map +1 -1
- package/lib/commonjs/components/executiontasks/collectPayment/components/InitPayment.js.map +1 -1
- package/lib/commonjs/components/executiontasks/collectPayment/components/ProcessPayment.js +183 -36
- package/lib/commonjs/components/executiontasks/collectPayment/components/ProcessPayment.js.map +1 -1
- package/lib/commonjs/components/widgets/ProgressDialog.js +1 -1
- package/lib/commonjs/components/widgets/ProgressDialog.js.map +1 -1
- package/lib/commonjs/components/widgets/SnackBarCustom.js +44 -21
- package/lib/commonjs/components/widgets/SnackBarCustom.js.map +1 -1
- package/lib/commonjs/icons/blurQRCode.png +0 -0
- package/lib/commonjs/ui/screens/CollectPaymentScreen.js +6 -2
- package/lib/commonjs/ui/screens/CollectPaymentScreen.js.map +1 -1
- package/lib/module/components/executiontasks/collectPayment/CollectPaymentSchema.js +2 -0
- package/lib/module/components/executiontasks/collectPayment/CollectPaymentSchema.js.map +1 -1
- package/lib/module/components/executiontasks/collectPayment/PaymentStyles.js +21 -0
- package/lib/module/components/executiontasks/collectPayment/PaymentStyles.js.map +1 -1
- package/lib/module/components/executiontasks/collectPayment/PaymentUtils.js +14 -0
- package/lib/module/components/executiontasks/collectPayment/PaymentUtils.js.map +1 -1
- package/lib/module/components/executiontasks/collectPayment/components/CompletePayment.js +11 -14
- package/lib/module/components/executiontasks/collectPayment/components/CompletePayment.js.map +1 -1
- package/lib/module/components/executiontasks/collectPayment/components/InitPayment.js.map +1 -1
- package/lib/module/components/executiontasks/collectPayment/components/ProcessPayment.js +187 -38
- package/lib/module/components/executiontasks/collectPayment/components/ProcessPayment.js.map +1 -1
- package/lib/module/components/widgets/ProgressDialog.js +1 -1
- package/lib/module/components/widgets/ProgressDialog.js.map +1 -1
- package/lib/module/components/widgets/SnackBarCustom.js +43 -21
- package/lib/module/components/widgets/SnackBarCustom.js.map +1 -1
- package/lib/module/icons/blurQRCode.png +0 -0
- package/lib/module/ui/screens/CollectPaymentScreen.js +6 -2
- package/lib/module/ui/screens/CollectPaymentScreen.js.map +1 -1
- package/lib/typescript/components/executiontasks/collectPayment/CollectPaymentSchema.d.ts +1 -0
- package/lib/typescript/components/executiontasks/collectPayment/PaymentStyles.d.ts +20 -0
- package/lib/typescript/components/executiontasks/collectPayment/PaymentUtils.d.ts +1 -0
- package/lib/typescript/components/widgets/SnackBarCustom.d.ts +2 -1
- package/package.json +2 -2
- package/src/components/executiontasks/collectPayment/CollectPaymentSchema.ts +2 -0
- package/src/components/executiontasks/collectPayment/PaymentStyles.ts +37 -12
- package/src/components/executiontasks/collectPayment/PaymentUtils.ts +17 -0
- package/src/components/executiontasks/collectPayment/components/CompletePayment.tsx +19 -18
- package/src/components/executiontasks/collectPayment/components/InitPayment.tsx +5 -4
- package/src/components/executiontasks/collectPayment/components/ProcessPayment.tsx +268 -91
- package/src/components/widgets/ProgressDialog.tsx +2 -0
- package/src/components/widgets/SnackBarCustom.tsx +59 -19
- package/src/icons/blurQRCode.png +0 -0
- package/src/ui/screens/CollectPaymentScreen.tsx +6 -3
|
@@ -1,8 +1,11 @@
|
|
|
1
1
|
/* eslint-disable @typescript-eslint/no-unused-vars */
|
|
2
2
|
/* eslint-disable react-native/no-inline-styles */
|
|
3
3
|
import {
|
|
4
|
+
AppState,
|
|
5
|
+
AppStateStatus,
|
|
4
6
|
BackHandler,
|
|
5
7
|
Image,
|
|
8
|
+
ImageBackground,
|
|
6
9
|
KeyboardAvoidingView,
|
|
7
10
|
Platform,
|
|
8
11
|
ScrollView,
|
|
@@ -36,12 +39,14 @@ import {
|
|
|
36
39
|
Fonts,
|
|
37
40
|
} from '../../../../styles/executionTasks/CommonStyles';
|
|
38
41
|
import {
|
|
42
|
+
formatExpiryTime,
|
|
39
43
|
getPaymentDataMO,
|
|
40
44
|
getPaymentLink,
|
|
41
45
|
getPaymentType,
|
|
42
46
|
removeSharedPrefPaymentData,
|
|
43
47
|
setSharedPrefPaymentData,
|
|
44
48
|
setSharedPrefPaymentSelection,
|
|
49
|
+
// useQRExpiryTimer,
|
|
45
50
|
} from '../PaymentUtils';
|
|
46
51
|
import {
|
|
47
52
|
ActivityIndicator,
|
|
@@ -90,6 +95,8 @@ import Logger, { LOG_TYPE } from '../../../../utils/Logger';
|
|
|
90
95
|
|
|
91
96
|
const styles = PaymentStyles;
|
|
92
97
|
let storage = Storage.getInstance();
|
|
98
|
+
const DEFAULT_STATUS_BTN_DEFAULT_TIMER = 5; // Default timer value in seconds
|
|
99
|
+
const DEFAULT_MIN_SEC_TO_SHOW_TIMER = 600; // Default timer value in seconds to show expire time (current is 10min )
|
|
93
100
|
|
|
94
101
|
const ProcessPayment = (props: CollectPaymentInput & ProcessPaymentInput) => {
|
|
95
102
|
const paymentConfigContext = useContext(PaymentContext);
|
|
@@ -101,7 +108,7 @@ const ProcessPayment = (props: CollectPaymentInput & ProcessPaymentInput) => {
|
|
|
101
108
|
const timerRef: any = useRef();
|
|
102
109
|
const paymentRefId =
|
|
103
110
|
props.route.params[RouteParams.ROOT_META_DATA].paymentConfig?.paymentRefId;
|
|
104
|
-
|
|
111
|
+
// For back button timer
|
|
105
112
|
const useTimer = (timerDuration: any, onTimerEnd?: () => void) => {
|
|
106
113
|
const [counter, setCounter] = useState(timerDuration);
|
|
107
114
|
const [hasTimerEnded, setHasTimerEnded] = useState(false);
|
|
@@ -124,13 +131,13 @@ const ProcessPayment = (props: CollectPaymentInput & ProcessPaymentInput) => {
|
|
|
124
131
|
}, [counter, hasTimerEnded]);
|
|
125
132
|
|
|
126
133
|
// Function to reset the timer
|
|
127
|
-
const
|
|
134
|
+
const resetModalTimer = () => {
|
|
128
135
|
setCounter(timerDuration);
|
|
129
136
|
setHasTimerEnded(false);
|
|
130
137
|
setBackDisable(true);
|
|
131
138
|
};
|
|
132
139
|
|
|
133
|
-
return { counter,
|
|
140
|
+
return { counter, resetModalTimer };
|
|
134
141
|
};
|
|
135
142
|
|
|
136
143
|
const { counter } = useTimer(
|
|
@@ -518,6 +525,77 @@ const ProcessPayment = (props: CollectPaymentInput & ProcessPaymentInput) => {
|
|
|
518
525
|
};
|
|
519
526
|
export default ProcessPayment;
|
|
520
527
|
|
|
528
|
+
const useQRExpiryTimer = (
|
|
529
|
+
initialTimerValue: number,
|
|
530
|
+
onTimerEnd?: () => void
|
|
531
|
+
) => {
|
|
532
|
+
const [timer, setTimer] = useState(initialTimerValue);
|
|
533
|
+
const timerRef = useRef(null);
|
|
534
|
+
const appState = useRef(AppState.currentState);
|
|
535
|
+
const initialTimeRef = useRef(Date.now());
|
|
536
|
+
|
|
537
|
+
const resetTimer = useCallback(() => {
|
|
538
|
+
initialTimeRef.current = Date.now();
|
|
539
|
+
setTimer(initialTimerValue);
|
|
540
|
+
}, [initialTimerValue]);
|
|
541
|
+
|
|
542
|
+
const updateTimer = useCallback(() => {
|
|
543
|
+
const currentTime = Date.now();
|
|
544
|
+
const elapsedTimeInSeconds = Math.floor((currentTime - initialTimeRef.current) / 1000);
|
|
545
|
+
const remainingTime = Math.max(0, initialTimerValue - elapsedTimeInSeconds);
|
|
546
|
+
|
|
547
|
+
if (remainingTime !== timer) {
|
|
548
|
+
setTimer(remainingTime);
|
|
549
|
+
}
|
|
550
|
+
|
|
551
|
+
if (remainingTime === 0 && onTimerEnd) {
|
|
552
|
+
onTimerEnd();
|
|
553
|
+
}
|
|
554
|
+
}, [initialTimerValue, onTimerEnd, timer]);
|
|
555
|
+
|
|
556
|
+
useEffect(() => {
|
|
557
|
+
resetTimer();
|
|
558
|
+
}, [initialTimerValue, resetTimer]);
|
|
559
|
+
|
|
560
|
+
useEffect(() => {
|
|
561
|
+
// Update the timer immediately on mount
|
|
562
|
+
updateTimer();
|
|
563
|
+
const intervalId = setInterval(updateTimer, 1000);
|
|
564
|
+
return () => clearInterval(intervalId);
|
|
565
|
+
}, [updateTimer]);
|
|
566
|
+
|
|
567
|
+
useEffect(() => {
|
|
568
|
+
const handleAppStateChange = (nextAppState: AppStateStatus) => {
|
|
569
|
+
if (appState.current.match(/inactive|background/) && nextAppState === 'active') {
|
|
570
|
+
// Calculate elapsed time and adjust the initial time reference
|
|
571
|
+
const currentTime = Date.now();
|
|
572
|
+
const elapsedTimeInSeconds = Math.floor((currentTime - initialTimeRef.current) / 1000);
|
|
573
|
+
const newRemainingTime = Math.max(0, initialTimerValue - elapsedTimeInSeconds);
|
|
574
|
+
|
|
575
|
+
// Update initial time ref based on new remaining time
|
|
576
|
+
initialTimeRef.current = currentTime - (initialTimerValue - newRemainingTime) * 1000;
|
|
577
|
+
|
|
578
|
+
// Update the timer
|
|
579
|
+
setTimer(newRemainingTime);
|
|
580
|
+
updateTimer();
|
|
581
|
+
}
|
|
582
|
+
appState.current = nextAppState;
|
|
583
|
+
};
|
|
584
|
+
|
|
585
|
+
const subscription = AppState.addEventListener('change', handleAppStateChange);
|
|
586
|
+
return () => {
|
|
587
|
+
subscription.remove();
|
|
588
|
+
};
|
|
589
|
+
}, [updateTimer, initialTimerValue]);
|
|
590
|
+
|
|
591
|
+
return {
|
|
592
|
+
formattedTime: formatExpiryTime(timer),
|
|
593
|
+
timerValue: timer,
|
|
594
|
+
resetTimer,
|
|
595
|
+
};
|
|
596
|
+
};
|
|
597
|
+
|
|
598
|
+
|
|
521
599
|
const RenderQR = (
|
|
522
600
|
props: CollectPaymentInput &
|
|
523
601
|
ProcessPaymentInput & {
|
|
@@ -526,14 +604,35 @@ const RenderQR = (
|
|
|
526
604
|
setIsRetryEnabled: (showRetryModal: boolean) => void;
|
|
527
605
|
}
|
|
528
606
|
) => {
|
|
607
|
+
const [initialTimer, setInitialTimer] = useState<number>(0); //initial timer to start qr expiry hook
|
|
608
|
+
const [isQRExpired, setIsQRExpired] = useState<boolean>(false);
|
|
609
|
+
const { timerValue, formattedTime, resetTimer } = useQRExpiryTimer(
|
|
610
|
+
initialTimer,
|
|
611
|
+
() => {
|
|
612
|
+
setIsQRExpired(true);
|
|
613
|
+
}
|
|
614
|
+
);
|
|
529
615
|
const paymentConfigContext = useContext(PaymentContext);
|
|
530
616
|
const [qrData, setQrData] = useState<QrResponse | null>(null);
|
|
531
617
|
const [showStatusModal, setStatusModal] = useState(false);
|
|
532
618
|
const [showRetryModal, setRetryModal] = useState(false);
|
|
533
619
|
const [disableStatusBtn, setDisableStatusBtn] = useState(true);
|
|
534
620
|
const [fetchQR, setFetchQR] = useState(true);
|
|
535
|
-
const
|
|
536
|
-
|
|
621
|
+
const [snackBar, setSnackBar] = useState({
|
|
622
|
+
show: false,
|
|
623
|
+
type: SnackBarType.SUCCESS,
|
|
624
|
+
message: '',
|
|
625
|
+
});
|
|
626
|
+
|
|
627
|
+
const onDismissSnackBar = () => {
|
|
628
|
+
setSnackBar({
|
|
629
|
+
show: false,
|
|
630
|
+
message: '',
|
|
631
|
+
type: SnackBarType.SUCCESS,
|
|
632
|
+
});
|
|
633
|
+
};
|
|
634
|
+
const statusTimerRef = useRef<NodeJS.Timeout | null>(null);
|
|
635
|
+
|
|
537
636
|
const paymentConfig =
|
|
538
637
|
props.route.params[RouteParams.ROOT_META_DATA].paymentConfig;
|
|
539
638
|
const paymentRefId = paymentConfig?.paymentRefId;
|
|
@@ -560,6 +659,7 @@ const RenderQR = (
|
|
|
560
659
|
|
|
561
660
|
const fetchQrCode = async () => {
|
|
562
661
|
sendClickEvent('QR_CODE');
|
|
662
|
+
setQrData(null);
|
|
563
663
|
setFetchQR(true);
|
|
564
664
|
let qrParams: QR_REQUEST_BODY = {
|
|
565
665
|
refId: paymentRefId,
|
|
@@ -590,11 +690,15 @@ const RenderQR = (
|
|
|
590
690
|
// },
|
|
591
691
|
// };
|
|
592
692
|
setFetchQR(false);
|
|
593
|
-
const _qrData: QrResponse = paymentResp?.data;
|
|
594
|
-
console.log('_qrData: ', _qrData);
|
|
595
693
|
|
|
694
|
+
const _qrData: QrResponse = paymentResp?.data;
|
|
695
|
+
console.log('_qrData ', _qrData);
|
|
596
696
|
if (_qrData.data.qrCode) {
|
|
597
697
|
setQrData(_qrData);
|
|
698
|
+
if (_qrData?.data?.expiresIn) {
|
|
699
|
+
setInitialTimer(_qrData?.data?.expiresIn);
|
|
700
|
+
resetTimer();
|
|
701
|
+
}
|
|
598
702
|
setRetryModal(false);
|
|
599
703
|
await setSharedPrefPaymentData(
|
|
600
704
|
paymentRefId,
|
|
@@ -648,6 +752,8 @@ const RenderQR = (
|
|
|
648
752
|
console.error('QR Gen: ', JSON.stringify(err?.response?.data || err));
|
|
649
753
|
setFetchQR(false);
|
|
650
754
|
setRetryModal(true);
|
|
755
|
+
} finally {
|
|
756
|
+
setIsQRExpired(false);
|
|
651
757
|
}
|
|
652
758
|
};
|
|
653
759
|
|
|
@@ -655,9 +761,35 @@ const RenderQR = (
|
|
|
655
761
|
fetchQrCode();
|
|
656
762
|
}, []);
|
|
657
763
|
|
|
764
|
+
// re-enabling check status button once its completed checking status after 3 seconds
|
|
765
|
+
// using this useEffect because now 'Timer' hook in check status button has been removed
|
|
766
|
+
useEffect(() => {
|
|
767
|
+
// Clear any existing timeout before setting a new one
|
|
768
|
+
if (statusTimerRef.current) {
|
|
769
|
+
clearTimeout(statusTimerRef.current);
|
|
770
|
+
}
|
|
771
|
+
|
|
772
|
+
// Only set a new timeout if `disableStatusBtn` is true
|
|
773
|
+
if (disableStatusBtn) {
|
|
774
|
+
statusTimerRef.current = setTimeout(() => {
|
|
775
|
+
onDismissSnackBar();
|
|
776
|
+
setDisableStatusBtn(false);
|
|
777
|
+
statusTimerRef.current = null; // Reset the ref after timeout
|
|
778
|
+
}, DEFAULT_STATUS_BTN_DEFAULT_TIMER * 1000);
|
|
779
|
+
}
|
|
780
|
+
|
|
781
|
+
// Clean up the timeout on component unmount
|
|
782
|
+
return () => {
|
|
783
|
+
if (statusTimerRef.current) {
|
|
784
|
+
clearTimeout(statusTimerRef.current);
|
|
785
|
+
}
|
|
786
|
+
};
|
|
787
|
+
}, [disableStatusBtn]);
|
|
788
|
+
|
|
658
789
|
const checkStatus = async () => {
|
|
659
790
|
sendClickEvent('CHECK_STATUS');
|
|
660
791
|
setStatusModal(true);
|
|
792
|
+
|
|
661
793
|
try {
|
|
662
794
|
const paymentResp =
|
|
663
795
|
await paymentConfigContext?.networkInstance.requestGet(
|
|
@@ -747,6 +879,11 @@ const RenderQR = (
|
|
|
747
879
|
}
|
|
748
880
|
setStatusModal(false);
|
|
749
881
|
setDisableStatusBtn(true);
|
|
882
|
+
setSnackBar({
|
|
883
|
+
show: true,
|
|
884
|
+
message: `Payment not confirmed. Check again in ${DEFAULT_STATUS_BTN_DEFAULT_TIMER} sec.`,
|
|
885
|
+
type: SnackBarType.PAYMENT_WARNING,
|
|
886
|
+
});
|
|
750
887
|
} catch (err: any) {
|
|
751
888
|
Logger.getInstance().logEvent(
|
|
752
889
|
'~ checkStatus triggered ',
|
|
@@ -760,22 +897,22 @@ const RenderQR = (
|
|
|
760
897
|
|
|
761
898
|
return (
|
|
762
899
|
<>
|
|
763
|
-
|
|
764
|
-
|
|
765
|
-
|
|
766
|
-
|
|
767
|
-
|
|
768
|
-
|
|
769
|
-
|
|
770
|
-
|
|
771
|
-
|
|
772
|
-
|
|
773
|
-
|
|
774
|
-
|
|
775
|
-
|
|
776
|
-
|
|
777
|
-
|
|
778
|
-
|
|
900
|
+
{showStatusModal ? (
|
|
901
|
+
<ProgressDialog
|
|
902
|
+
customModalContentStyle={{ paddingVertical: 40 }}
|
|
903
|
+
visible={showStatusModal}
|
|
904
|
+
label=""
|
|
905
|
+
labelStyle={{
|
|
906
|
+
fontWeight: '400',
|
|
907
|
+
marginTop: 16,
|
|
908
|
+
fontFamily:
|
|
909
|
+
Platform.OS === 'android'
|
|
910
|
+
? Fonts.IBMPlexSans_400Regular
|
|
911
|
+
: 'IBMPlexSans-Regular',
|
|
912
|
+
color: '#525B7A',
|
|
913
|
+
}}
|
|
914
|
+
/>
|
|
915
|
+
) : fetchQR ? (
|
|
779
916
|
<ProgressDialog
|
|
780
917
|
visible={qrData ? false : true}
|
|
781
918
|
customModalContentStyle={{ paddingVertical: 40 }}
|
|
@@ -836,65 +973,118 @@ const RenderQR = (
|
|
|
836
973
|
<ScrollView style={CommonStyles.mainContainer}>
|
|
837
974
|
<View style={CommonStyles.mainContainer}>
|
|
838
975
|
<View style={{ alignItems: 'center', paddingTop: 25 }}>
|
|
839
|
-
<
|
|
840
|
-
Scan to pay
|
|
841
|
-
</Text>
|
|
842
|
-
<Text
|
|
843
|
-
style={[
|
|
844
|
-
styles.textStyle1,
|
|
845
|
-
{ color: '#3D445C', marginTop: 12 },
|
|
846
|
-
]}
|
|
847
|
-
>
|
|
848
|
-
Total payable amount
|
|
849
|
-
</Text>
|
|
850
|
-
<Text
|
|
851
|
-
style={[
|
|
852
|
-
CommonStyles.titleText,
|
|
853
|
-
{
|
|
854
|
-
paddingBottom: 20,
|
|
855
|
-
fontWeight: 'bold',
|
|
856
|
-
},
|
|
857
|
-
]}
|
|
858
|
-
>
|
|
859
|
-
{paymentConfigContext?.sdkConfig?.etConfig?.currencyCode +
|
|
860
|
-
' ' +
|
|
861
|
-
props.expectedAmount}
|
|
862
|
-
</Text>
|
|
863
|
-
<Image
|
|
976
|
+
<View
|
|
864
977
|
style={{
|
|
865
|
-
|
|
866
|
-
|
|
867
|
-
|
|
868
|
-
}}
|
|
869
|
-
source={{
|
|
870
|
-
uri: qrData?.data.qrCode,
|
|
978
|
+
flexDirection: 'column',
|
|
979
|
+
marginBottom: 24,
|
|
980
|
+
alignItems: 'center',
|
|
871
981
|
}}
|
|
872
|
-
|
|
982
|
+
>
|
|
983
|
+
<Text style={[CommonStyles.titleText, { fontSize: 18 }]}>
|
|
984
|
+
Scan to pay
|
|
985
|
+
</Text>
|
|
986
|
+
<Text
|
|
987
|
+
style={[
|
|
988
|
+
styles.textStyle1,
|
|
989
|
+
{ color: '#3D445C', marginTop: 12 },
|
|
990
|
+
]}
|
|
991
|
+
>
|
|
992
|
+
Total payable amount
|
|
993
|
+
</Text>
|
|
994
|
+
<Text
|
|
995
|
+
style={[
|
|
996
|
+
CommonStyles.titleText,
|
|
997
|
+
{
|
|
998
|
+
fontWeight: 'bold',
|
|
999
|
+
marginTop: 0,
|
|
1000
|
+
},
|
|
1001
|
+
]}
|
|
1002
|
+
>
|
|
1003
|
+
{paymentConfigContext?.sdkConfig?.etConfig?.currencyCode +
|
|
1004
|
+
' ' +
|
|
1005
|
+
props.expectedAmount}
|
|
1006
|
+
</Text>
|
|
1007
|
+
<Text
|
|
1008
|
+
style={[
|
|
1009
|
+
styles.textStyle1,
|
|
1010
|
+
{
|
|
1011
|
+
color: isQRExpired ? '#DC2626' : '#D97706', // Red color for expired, yellow for active
|
|
1012
|
+
marginTop: 12,
|
|
1013
|
+
textAlign: 'center',
|
|
1014
|
+
fontSize: 16,
|
|
1015
|
+
lineHeight: 24,
|
|
1016
|
+
},
|
|
1017
|
+
]}
|
|
1018
|
+
>
|
|
1019
|
+
{isQRExpired
|
|
1020
|
+
? 'QR code expired. Tap to refresh.'
|
|
1021
|
+
: timerValue <= DEFAULT_MIN_SEC_TO_SHOW_TIMER
|
|
1022
|
+
? `QR code expires in ${formattedTime}`
|
|
1023
|
+
: null}
|
|
1024
|
+
</Text>
|
|
1025
|
+
</View>
|
|
1026
|
+
|
|
1027
|
+
<ImageBackground
|
|
1028
|
+
style={styles.qrImage}
|
|
1029
|
+
source={
|
|
1030
|
+
isQRExpired
|
|
1031
|
+
? require('../../../../icons/blurQRCode.png')
|
|
1032
|
+
: {
|
|
1033
|
+
uri: qrData?.data.qrCode, // The actual QR code image
|
|
1034
|
+
}
|
|
1035
|
+
}
|
|
1036
|
+
resizeMode="cover" // Ensures the image fills the container
|
|
1037
|
+
>
|
|
1038
|
+
{isQRExpired && (
|
|
1039
|
+
<View style={styles.overlay}>
|
|
1040
|
+
<Button
|
|
1041
|
+
style={[
|
|
1042
|
+
CommonStyles.nextButton,
|
|
1043
|
+
{
|
|
1044
|
+
marginEnd: 5,
|
|
1045
|
+
marginTop: 5,
|
|
1046
|
+
paddingBottom: 3,
|
|
1047
|
+
},
|
|
1048
|
+
]}
|
|
1049
|
+
labelStyle={{
|
|
1050
|
+
...CommonStyles.nextButtonLabel,
|
|
1051
|
+
fontSize: 14,
|
|
1052
|
+
textTransform: 'none',
|
|
1053
|
+
}}
|
|
1054
|
+
mode={'outlined'}
|
|
1055
|
+
onPress={fetchQrCode}
|
|
1056
|
+
>
|
|
1057
|
+
Refresh QR Code
|
|
1058
|
+
</Button>
|
|
1059
|
+
</View>
|
|
1060
|
+
)}
|
|
1061
|
+
</ImageBackground>
|
|
1062
|
+
{!isQRExpired && (
|
|
873
1063
|
<View style={{ marginTop: 24 }}>
|
|
874
|
-
|
|
875
|
-
|
|
876
|
-
|
|
877
|
-
|
|
878
|
-
|
|
879
|
-
|
|
880
|
-
|
|
881
|
-
ref={timerRef}
|
|
882
|
-
timer={
|
|
883
|
-
paymentConfigContext?.sdkConfig?.etConfig
|
|
884
|
-
?.goBackDisableTimer
|
|
885
|
-
}
|
|
886
|
-
/> */}
|
|
1064
|
+
{!(props?.showGoBackModal || showStatusModal) && (
|
|
1065
|
+
<ActivityIndicator
|
|
1066
|
+
size="small"
|
|
1067
|
+
color="rgba(107, 142, 255, 1)"
|
|
1068
|
+
style={{ marginBottom: 10 }}
|
|
1069
|
+
/>
|
|
1070
|
+
)}
|
|
887
1071
|
<Text style={CommonStyles.subText}>
|
|
888
1072
|
Waiting for the payment confirmation
|
|
889
1073
|
</Text>
|
|
890
1074
|
</View>
|
|
1075
|
+
)}
|
|
891
1076
|
</View>
|
|
892
1077
|
</View>
|
|
893
1078
|
</ScrollView>
|
|
894
|
-
<View style={
|
|
895
|
-
<
|
|
896
|
-
|
|
897
|
-
|
|
1079
|
+
<View style={styles.snackBarContainer}>
|
|
1080
|
+
<SnackBarCustom
|
|
1081
|
+
type={snackBar.type}
|
|
1082
|
+
message={`${snackBar.message}`}
|
|
1083
|
+
visible={snackBar.show}
|
|
1084
|
+
onDismiss={onDismissSnackBar}
|
|
1085
|
+
/>
|
|
1086
|
+
</View>
|
|
1087
|
+
<View style={{ padding: 16, borderWidth: 1, borderColor: '#E0E3EB' }}>
|
|
898
1088
|
<View
|
|
899
1089
|
style={{
|
|
900
1090
|
flexDirection: 'row',
|
|
@@ -904,7 +1094,7 @@ const RenderQR = (
|
|
|
904
1094
|
>
|
|
905
1095
|
<Button
|
|
906
1096
|
style={[
|
|
907
|
-
CommonStyles.
|
|
1097
|
+
CommonStyles.cancelButton,
|
|
908
1098
|
{
|
|
909
1099
|
marginEnd: 5,
|
|
910
1100
|
flex: 1,
|
|
@@ -912,11 +1102,12 @@ const RenderQR = (
|
|
|
912
1102
|
disableStatusBtn
|
|
913
1103
|
? {
|
|
914
1104
|
backgroundColor: '#E0E3EB',
|
|
1105
|
+
borderColor: '#E0E3EB',
|
|
915
1106
|
}
|
|
916
1107
|
: {},
|
|
917
1108
|
]}
|
|
918
1109
|
labelStyle={[
|
|
919
|
-
CommonStyles.
|
|
1110
|
+
CommonStyles.cancelButtonLabel,
|
|
920
1111
|
{ textTransform: 'capitalize' },
|
|
921
1112
|
disableStatusBtn ? { color: '#A3AAC2' } : {},
|
|
922
1113
|
]}
|
|
@@ -924,26 +1115,12 @@ const RenderQR = (
|
|
|
924
1115
|
onPress={checkStatus}
|
|
925
1116
|
disabled={disableStatusBtn}
|
|
926
1117
|
>
|
|
927
|
-
|
|
928
|
-
<>
|
|
929
|
-
{'Check Status ('}
|
|
930
|
-
<Timer
|
|
931
|
-
ref={statusTimerRef}
|
|
932
|
-
singleValue={true}
|
|
933
|
-
timer={5}
|
|
934
|
-
onTimerEnd={() => setDisableStatusBtn(false)}
|
|
935
|
-
/>
|
|
936
|
-
{' sec)'}
|
|
937
|
-
</>
|
|
938
|
-
) : (
|
|
939
|
-
'Check Status'
|
|
940
|
-
)}
|
|
1118
|
+
Check Payment Status
|
|
941
1119
|
</Button>
|
|
942
1120
|
</View>
|
|
943
1121
|
</View>
|
|
944
1122
|
</>
|
|
945
1123
|
)}
|
|
946
|
-
{/* ) : null} */}
|
|
947
1124
|
</>
|
|
948
1125
|
);
|
|
949
1126
|
};
|
|
@@ -1169,7 +1346,7 @@ const PaymentLink = (
|
|
|
1169
1346
|
<ProgressDialog
|
|
1170
1347
|
customModalContentStyle={{ paddingVertical: 40 }}
|
|
1171
1348
|
visible={showStatusModal}
|
|
1172
|
-
label="Please wait while we are checking the
|
|
1349
|
+
label="Please wait while we are checking the status"
|
|
1173
1350
|
labelStyle={{
|
|
1174
1351
|
fontWeight: '400',
|
|
1175
1352
|
fontFamily:
|
|
@@ -1294,7 +1471,7 @@ const PaymentLink = (
|
|
|
1294
1471
|
{' sec)'}
|
|
1295
1472
|
</>
|
|
1296
1473
|
) : (
|
|
1297
|
-
'Check Status'
|
|
1474
|
+
'Check Payment Status'
|
|
1298
1475
|
)}
|
|
1299
1476
|
</Button>
|
|
1300
1477
|
</View>
|
|
@@ -27,11 +27,13 @@ const ProgressDialog = (props: ProgressDialogProps) => {
|
|
|
27
27
|
]}
|
|
28
28
|
>
|
|
29
29
|
<ActivityIndicator size="large" color="rgba(107, 142, 255, 1)" />
|
|
30
|
+
{props.label !== "" && (
|
|
30
31
|
<Text
|
|
31
32
|
style={[styles.label, props.labelStyle ? props.labelStyle : {}]}
|
|
32
33
|
>
|
|
33
34
|
{props.label}
|
|
34
35
|
</Text>
|
|
36
|
+
)}
|
|
35
37
|
</View>
|
|
36
38
|
</View>
|
|
37
39
|
</Modal>
|