-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathWebsiteDefaultUPIScreen.js
33 lines (33 loc) · 1.44 KB
/
WebsiteDefaultUPIScreen.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
import React from 'react';
import { Linking } from 'react-native';
import { WebView } from 'react-native-webview';
const WebsiteDefaultUpiPaymentScreen = ({}) => {
const checkIsUPIIntentLink = (link) => {
// eslint-disable-next-line eqeqeq
if (link != undefined &&
(link.startsWith('upi://pay')
|| link.startsWith('tez://') || link.startsWith('gpay://')
|| link.startsWith('paytmmp://')
|| link.startsWith('phonepe://'))) {
return true;
}
return false;
};
return (React.createElement(WebView, { source: { uri: 'https://internal.prodint.cashfree.com/checkout?pt=session_gtWonxb3Ar1da2aDwulXbrQu6PVufNjZ6GASzzFWdut_f466GAe9M8ELVHuuqMrvyC8pCtoMzCvF2N8JsmaqYzGmoZBV3wsPBtBQr6ONLFgXcY39mVBAzecpayment' }, style: { flex: 1 }, onShouldStartLoadWithRequest: event => {
console.log('Current URL Loading', event.url);
if (checkIsUPIIntentLink(event.url)) {
Linking.canOpenURL(event.url).then(supported => {
if (supported) {
console.log('able to open');
Linking.openURL(event.url);
}
else {
console.log('Not able to open');
}
});
return false;
}
return true;
} }));
};
export default WebsiteDefaultUpiPaymentScreen;