Commit e1170e14 by Nguyễn Thị Thúy

merge func_smart_otp

parents e2d99add 7c6e90a3
......@@ -102,5 +102,7 @@
<false/>
<key>NSFaceIDUsageDescription</key>
<string>Enabling Face ID allows you quick and secure access to your account.</string>
<key>NSFaceIDUsageDescription</key>
<string>Enabling Face ID allows you quick and secure access to your account.</string>
</dict>
</plist>
......@@ -24,6 +24,7 @@
"async": "^3.2.0",
"axios": "^0.21.1",
"dateformat": "^4.5.1",
"jsencrypt": "^3.2.0",
"lodash": "^4.17.20",
"moment": "^2.29.1",
"react": "16.11.0",
......
......@@ -15,6 +15,22 @@ import AsyncStorage from '@react-native-community/async-storage';
import {DETAILNEW, TABNAVIGATOR, AUTHEN} from '../routers/ScreenNames';
import R from '../assets/R';
import {isTablet} from 'react-native-device-info';
import {RSA_KEY, MY_RSA_KEY} from './constants';
import JSEncrypt from 'jsencrypt';
export const encryptRSAString = (val) => {
var encrypt = new JSEncrypt();
encrypt.setPublicKey(RSA_KEY.publicKey);
var encrypted = encrypt.encrypt(val);
return encrypted;
};
export const decryptRSAString = (val) => {
var decrypt = new JSEncrypt();
decrypt.setPrivateKey(MY_RSA_KEY.privateKey);
var uncrypted = decrypt.decrypt(val);
return uncrypted;
};
export const logout = (navigation) => {
AsyncStorage.clear();
......
......@@ -10,4 +10,81 @@ export const RadioBuySaleEN = [
export const OTP_TYPE = {
CUSTOMER_REQUEST_DEPOSIT: 'CUSTOMER_REQUEST_DEPOSIT',
REQUEST_WITHDRAW: 'REQUEST_WITHDRAW',
}
};
export const RSA_KEY = {
privateKey: `-----BEGIN RSA PRIVATE KEY-----
MIIEpQIBAAKCAQEAriPaOfp9zSDIsde2OJPU3GKlV2EXqhEGxnmO6NHnz3SCJiTA
cTMIbckGKYsmsPoZyAmdP4irA+zMUA16vixXc1+R4whR1qVcXRQ2ZL/QOAtlgBUu
9rF3/+dexv3PW/2Di1uBdGn7khj3Mrs1PKWY9FEtb+NdgTF61RKWnhE6ktoKgukI
1XN5Xvt+5QqwOp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7LFoSt3Qk5On6yU0YexzrayHUs3C+zx1nhnPSXCRdyyIkg1ivyxnIx7vcPNFn10
6dIhENRJZCw+5WPqFkIGHbJQThoADP/T4avs5LjYtmLWrY/e9ZKwJyC714gLNZZi
qnfOsSUJAoGAX9CAHHCz/X3GJ+HGYm5mu3ks2hCw9umJZkabpKxnWWhpgPrqysHF
wkSh32IW6zQqgN/H7Q2sndqb5NM88rHowxPyIL1sSnmpXPNmjUhjxP74stu0EcSM
KYdYznyvql2HvuWSfOHzOdbA2umFaL09lNSDBdGiaK4ji8oleyhlWPU=
-----END RSA PRIVATE KEY-----`,
publicKey: `-----BEGIN PUBLIC KEY-----
MIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEAriPaOfp9zSDIsde2OJPU
3GKlV2EXqhEGxnmO6NHnz3SCJiTAcTMIbckGKYsmsPoZyAmdP4irA+zMUA16vixX
c1+R4whR1qVcXRQ2ZL/QOAtlgBUu9rF3/+dexv3PW/2Di1uBdGn7khj3Mrs1PKWY
9FEtb+NdgTF61RKWnhE6ktoKgukI1XN5Xvt+5QqwOpPnDcByWyrw7J5N8Jc9bsP+
GC7SzURE00nuw1uazrBvVpgcgyiAyHj3SFJIF89MZYuulJxi9GYjv6ov3kcW5o14
kNPExNEgPtlTVyoe1qub/xknSm12GOTd5V8yvjgJ8ipjHxC7CvEEhG7AT5sJ/3pO
ywIDAQAB
-----END PUBLIC KEY-----`,
};
export const MY_RSA_KEY = {
privateKey: `-----BEGIN RSA PRIVATE KEY-----
MIIEogIBAAKCAQBof1CpRwpsn3Nk6a831N2wc9S7Vx0hKUeiXX8yOYjBptFIEuJl
ssff7B6rRLKj/7oYKAzpXtNrNC4qqkReRLOjFQ4/gvln2h6eFRleZS0jAyYh8ukN
+yMIyT8c0YJb4jjzAjwQ7T62t8SyIVHKiMRQ0bZJAeXGvrx1t8Jwj0H+M5tu/gdt
5yvj+lMqRxxyl56WCFER3sKo/eB5dj+in31cKSdU2VW+xjXQM1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ql5pNQhSHHzqqgbjafAAgeJjK
YNPJkqnv3prCb75w1FtLbC+wXShdtarMBMehiZRGFxZnkfS6xYH4qDDXe+k3HVZI
HyECgYEAlRxGofeb/68W1XEK1rDtFtMHaQCTaKLb+vcLy/1FaHUtnFao4N393Ho8
KCJPQ/nJpO/Jz0ukvH5PKif0E3b6yaFrt94eqI7ezfxnjzJpEbh2Q8DeIRvpNWgC
lKn8Fz6kDKkofF7T5y98BqgnRSihewuhvgNM4yS6e9cU1cXesjs=
-----END RSA PRIVATE KEY-----
\ No newline at end of file
-----BEGIN PUBLIC KEY-----
MIIBITANBgkqhkiG9w0BAQEFAAOCAQ4AMIIBCQKCAQBof1CpRwpsn3Nk6a831N2w
c9S7Vx0hKUeiXX8yOYjBptFIEuJlssff7B6rRLKj/7oYKAzpXtNrNC4qqkReRLOj
FQ4/gvln2h6eFRleZS0jAyYh8ukN+yMIyT8c0YJb4jjzAjwQ7T62t8SyIVHKiMRQ
0bZJAeXGvrx1t8Jwj0H+M5tu/gdt5yvj+lMqRxxyl56WCFER3sKo/eB5dj+in31c
KSdU2VW+xjXQM1jcL3k7KTfnhpq2rIkbeYUs3qAoZ4Xn+6w1ZSf8Y2GONpnrOnQt
1uF/A5ZNV3IHgwa/Y4jxF+KHcvlvAyyOiDTVZAqn2/+JC+3z219OZCNet+VTmozz
AgMBAAE=
-----END PUBLIC KEY-----
\ No newline at end of file
import React, {useEffect, useRef} from 'react';
import {View} from 'react-native';
import {Alert, View} from 'react-native';
import {connect} from 'react-redux';
import StackNavigation from './routers/StackNavigation';
......@@ -10,12 +10,14 @@ import NoInternetComponent from './components/NoInternet';
import DropdownAlert from 'react-native-dropdownalert';
import DeviceInfo from 'react-native-device-info';
import R from './assets/R';
import {WIDTHXD, HEIGHTXD} from './Config/Functions';
import {WIDTHXD, HEIGHTXD, decryptRSAString} from './Config/Functions';
import DropdownManager from './components/DropdownAlert/DropdownManager';
import AsyncStorage from '@react-native-community/async-storage';
import KEY from './assets/AsynStorage';
import I18n, {setLocation} from './helper/i18/i18n';
import {changeLanguage} from './actions/language';
import {RSA_KEY, MY_RSA_KEY} from './Config/constants';
import JSEncrypt from 'jsencrypt';
enableScreens();
......@@ -25,6 +27,7 @@ const RootView = (props) => {
dropDownAlertRef.current,
dropDownAlertLongTimeRef.current,
);
setInitLanguage();
}, []);
......@@ -35,6 +38,7 @@ const RootView = (props) => {
if (laguage) props.changeLanguage(laguage);
setLocation(I18n, laguage);
};
return (
<>
<View style={{flex: 1}}>
......
......@@ -90,7 +90,8 @@ const FeePro = (props) => {
return (
<View>
<Text style={styles.txtTitle}> {title}</Text>
{title ? <Text style={styles.txtTitle}> {title}</Text> : null}
<View style={styles.wrap}>
{listItem.map((e) => (
<View key={e.id + 'a'} style={styles.item}>
......
......@@ -129,11 +129,14 @@ const PacketCQG = (props) => {
};
const getData = async () => {
const res = await getListPacketCQG({});
console.log(res);
if ((res.data.code = 200 && res.data.data)) {
setFee(res.data.data.fee);
setFeeConnect(res.data.data.fee_connect);
setFeeNonPro(res.data.data.fee_pro);
setFeePro(res.data.data.fee_non_pro);
if (res.data.data.fee) setFee(res.data.data.fee);
if (res.data.data.fee_connect) setFeeConnect(res.data.data.fee_connect);
if (res.data.data.fee_pro) setFeeNonPro(res.data.data.fee_pro);
if (res.data.data.fee_non_pro) setFeePro(res.data.data.fee_non_pro);
if (res.data.data.fee_operating)
setOperrating(res.data.data.fee_operating);
if (res.data.package_register.length > 0) {
......@@ -159,26 +162,31 @@ const PacketCQG = (props) => {
<View style={styles.container}>
<AppText i18nKey={'Note_cqg'} />
<ContainerTop fee={fee} />
{feeOperating.data.length > 0 ? (
<WrapNomarl
onRemovePacket={onRemovePacket}
onChoosePacket={onChoosePacket}
data={feeOperating}
listRegister={listRegister}
/>
) : null}
{feeConnect.data.length > 0 ? (
<WrapNomarl
onRemovePacket={onRemovePacket}
onChoosePacket={onChoosePacket}
data={feeConnect}
listRegister={listRegister}
/>
) : null}
{feeNonPro.data.length > 0 ? (
<WrapNomarl
onRemovePacket={onRemovePacket}
onChoosePacket={onChoosePacket}
data={feeNonPro}
listRegister={listRegister}
/>
) : null}
<FeePro
onRemovePacket={onRemovePacket}
......
......@@ -44,7 +44,8 @@ const ContainerTop = (props) => {
return (
<View>
<Text style={styles.txtTitle}> {title}</Text>
{title ? <Text style={styles.txtTitle}> {title}</Text> : null}
<View style={styles.wrap}>
{listItem.map((e) => (
<View key={e.id + 'a'} style={styles.item}>
......
......@@ -54,6 +54,17 @@ const MethodPayView = (props) => {
<View style={{flex: 1}}>
<HeaderBack title={'SelectPaymentMethod'} />
<View style={{flex: 1}}>
{data.length == 0 ? (
<View
style={{justifyContent: 'center', alignItems: 'center', flex: 1}}>
<AppText
i18nKey={'NoData'}
style={{
fontSize: 18,
fontWeight: 'bold',
}}></AppText>
</View>
) : (
<FlatList
keyExtractor={(item) => item.id}
showsVerticalScrollIndicator={false}
......@@ -63,8 +74,11 @@ const MethodPayView = (props) => {
justifyContent: 'space-between',
}}
data={data}
renderItem={({item}) => <Item userId={props.user.uid} item={item} />}
renderItem={({item}) => (
<Item userId={props.user.uid} item={item} />
)}
/>
)}
</View>
</View>
);
......
......@@ -16,12 +16,23 @@ import R from '../../../assets/R';
import HeaderBack from '../../../components/Header/HeaderBack';
import TextMulti from '../../../components/Input/TextMulti';
import {useNavigation} from '@react-navigation/native';
import {checkFormatArray, getFontXD, HEIGHTXD, toPriceVnd, WIDTHXD} from '../../../Config/Functions';
import {
checkFormatArray,
getFontXD,
HEIGHTXD,
toPriceVnd,
WIDTHXD,
} from '../../../Config/Functions';
import {connect} from 'react-redux';
import {hideLoading, showLoading} from '../../../actions/loadingAction';
import TextMoney from '../../../components/Input/InputMoney';
import I18n from '../../../helper/i18/i18n';
import {ENTER_PASSWORD_SMART_OTP, SETTINGOTP, SMARTOTP} from '../../../routers/ScreenNames';
import {
ENTER_PASSWORD_SMART_OTP,
SETTINGOTP,
SMARTOTP,
CHANGESMARTOTP,
} from '../../../routers/ScreenNames';
import {showAlert, TYPE} from '../../../components/DropdownAlert';
import {confirmAlert} from '../../../components/Aleart';
......@@ -42,13 +53,16 @@ const WalletDeposit = (props) => {
confirmAlert(
`${I18n.t('YouHaveNotSettingSmartOTP')}`,
() => {
navigate.navigate(SETTINGOTP, {
navigate.navigate(CHANGESMARTOTP, {
TYPE: 'CREATE_SMART_OTP',
old_password: null,
isFromTransaction: true,
setupSmartOTPSuccess: () => {
navigate.goBack()
navigate.goBack()
navigate.goBack();
navigate.goBack();
navigate.navigate(ENTER_PASSWORD_SMART_OTP, {
onGoToSmartOTP: (pinCode, otp) => onGoToSmartOTP(pinCode, otp),
onGoToSmartOTP: (pinCode, otp) =>
onGoToSmartOTP(pinCode, otp),
});
DeviceEventEmitter.emit('reloadUserInfo');
},
......@@ -86,7 +100,7 @@ const WalletDeposit = (props) => {
keyboardVerticalOffset={-50}>
<TouchableWithoutFeedback onPress={Keyboard.dismiss}>
<View style={{flex: 1}}>
<HeaderBack title={'InvestmentDeposit'}/>
<HeaderBack title={'InvestmentDeposit'} />
<ScrollView showsVerticalScrollIndicator={false}>
<View style={styles.container}>
<View style={styles.wrapTop}>
......@@ -99,7 +113,7 @@ const WalletDeposit = (props) => {
: 0}{' '}
</Text>
</View>
<View style={{width: 1, backgroundColor: '#DBDBDB'}}/>
<View style={{width: 1, backgroundColor: '#DBDBDB'}} />
<View style={styles.itemTop}>
<Text style={styles.txtTitle}>CQG</Text>
<Text style={styles.txtMoney}>
......
......@@ -9,7 +9,8 @@ import {
TouchableWithoutFeedback,
Keyboard,
KeyboardAvoidingView,
ScrollView, DeviceEventEmitter,
ScrollView,
DeviceEventEmitter,
} from 'react-native';
import R from '../../../assets/R';
import HeaderBack from '../../../components/Header/HeaderBack';
......@@ -31,7 +32,9 @@ import {saveUserToRedux} from '../../../actions/users';
import {confirmAlert} from '../../../components/Aleart';
import {
ADDMETHODPAY,
ENTER_PASSWORD_SMART_OTP, SETTINGOTP,
ENTER_PASSWORD_SMART_OTP,
SETTINGOTP,
CHANGESMARTOTP,
} from '../../../routers/ScreenNames';
import TextMoney from '../../../components/Input/InputMoney';
import I18n from '../../../helper/i18/i18n';
......@@ -118,13 +121,16 @@ const WalletWithdraw = (props) => {
confirmAlert(
`${I18n.t('YouHaveNotSettingSmartOTP')}`,
() => {
navigate.navigate(SETTINGOTP, {
navigate.navigate(CHANGESMARTOTP, {
TYPE: 'CREATE_SMART_OTP',
old_password: null,
isFromTransaction: true,
setupSmartOTPSuccess: () => {
navigate.goBack()
navigate.goBack()
navigate.goBack();
navigate.goBack();
navigate.navigate(ENTER_PASSWORD_SMART_OTP, {
onGoToSmartOTP: (pinCode, otp) => onGoToSmartOTP(pinCode, otp),
onGoToSmartOTP: (pinCode, otp) =>
onGoToSmartOTP(pinCode, otp),
});
DeviceEventEmitter.emit('reloadUserInfo');
},
......@@ -334,5 +340,5 @@ const mapStateToProps = (state) => {
export default connect(mapStateToProps, {
showLoading,
hideLoading,
saveUserToRedux
saveUserToRedux,
})(WalletWithdraw);
......@@ -18,7 +18,7 @@ import {
FORGOTPASSWORD,
CONFIRMEMAIL,
} from '../../routers/ScreenNames';
import {checkFormatArray} from '../../Config/Functions';
import {checkFormatArray, encryptRSAString} from '../../Config/Functions';
import {loginApi} from '../../apis/Functions/users';
import KEY from '../../assets/AsynStorage';
import AsyncStorage from '@react-native-community/async-storage';
......@@ -29,14 +29,11 @@ import messaging from '@react-native-firebase/messaging';
import I18n from '../../helper/i18/i18n';
import AppText from '../../components/AppText';
import {showAlert, TYPE} from '../../components/DropdownAlert';
import EntypoIcon from 'react-native-vector-icons/Entypo';
import Icon from 'react-native-vector-icons/MaterialCommunityIcons';
import TouchID from 'react-native-touch-id';
import {call} from 'redux-saga/effects';
import KeychainService from '../../services/keychainService';
import * as Keychain from 'react-native-keychain';
const Login = (props) => {
const {navigation} = props;
......@@ -49,7 +46,6 @@ const Login = (props) => {
color: '#e00606', // Android,
fallbackLabel: '', // iOS (if empty, then label is hidden)
};
const getTokenDevice = async () => {
let fcmToken = await AsyncStorage.getItem(KEY.FIREBASE);
......@@ -73,45 +69,41 @@ const Login = (props) => {
if (account) {
onSubmitLogin(account.email, account.pass);
} else {
getCredentialInfo()
}
};
const getCredentialInfo = async () => {
try {
// Retrieve the credentials
const credentials = await Keychain.getGenericPassword();
if (credentials) {
console.log(
'Credentials successfully loaded for user ' + credentials
'Credentials successfully loaded for user ', credentials,
);
} else {
console.log('No credentials stored');
}
} catch (error) {
console.log("Keychain couldn't be accessed!", error);
}
console.log('Keychain couldn\'t be accessed!', error);
}
};
function* authorize() {
let isFingerPrintAuthenticated = yield call(KeychainService.getCredentials);
}
const onSubmitLogin = async (email, pass) => {
const titles = [
I18n.t('Username').toLowerCase(),
I18n.t('Password').toLowerCase(),
];
const index = checkFormatArray([email, pass]);
if (index === true) {
let firebase = await AsyncStorage.getItem(KEY.FIREBASE);
firebase = await AsyncStorage.getItem(KEY.FIREBASE);
props.showLoading();
const res = await loginApi({
email,
password: pass,
password: encryptRSAString(pass),
platform: Platform.OS,
device_token: firebase,
account_type: 'CUSTOMER',
});
props.hideLoading();
if (res.data) {
if (res.data.code == 200 && res.data.data) {
......@@ -142,29 +134,6 @@ const Login = (props) => {
);
}
};
const clickFingerprintHandler = () => {
TouchID.isSupported()
.then(authenticate => {
console.log(authenticate);
pressHandler();
})
.catch(error => {
showAlert(TYPE.WARN, I18n.t('Notification'), 'TouchID not supported');
});
};
const pressHandler = () => {
TouchID.authenticate('to demo this react-native component', optionalConfigObject)
.then(success => {
console.log(success);
onSubmitLogin('thuynt@dcv.vn', '123456');
showAlert(TYPE.WARN, I18n.t('Notification'), 'success');
})
.catch(error => {
console.log(error);
showAlert(TYPE.WARN, I18n.t('Notification'), 'Authentication Failed');
});
};
return (
<View
......@@ -190,7 +159,7 @@ const Login = (props) => {
<TouchableOpacity
onPress={() => navigate.navigate(CONFIRMEMAIL)}
style={styles.forgotView}>
<AppText i18nKey={'ForgotPassword'} style={styles.txtTitle}/>
<AppText i18nKey={'ForgotPassword'} style={styles.txtTitle} />
</TouchableOpacity>
<View
......@@ -201,37 +170,21 @@ const Login = (props) => {
<TouchableOpacity
onPress={() => onSubmitLogin(email, pass)}
style={styles.wrapLogin}>
<AppText i18nKey={'Login'} style={styles.txtLogin}/>
<Image source={R.images.iconRight1} style={styles.imgIcon}/>
</TouchableOpacity>
<View style={{flexDirection: 'row', marginTop: WIDTHXD(50)}}>
<TouchableOpacity
onPress={() => {
clickFingerprintHandler();
}}>
<EntypoIcon name={'fingerprint'} size={WIDTHXD(80)} color={R.colors.main}/>
</TouchableOpacity>
<View style={{width: WIDTHXD(80)}}/>
<TouchableOpacity
onPress={() => {
// navigation.navigate('REGISTOR');
}}>
<Icon name={'face-recognition'} size={WIDTHXD(80)} color={R.colors.main}/>
<AppText i18nKey={'Login'} style={styles.txtLogin} />
<Image source={R.images.iconRight1} style={styles.imgIcon} />
</TouchableOpacity>
</View>
<View style={styles.row}>
<AppText i18nKey={'Have_account'} style={styles.txtTitle}/>
<AppText i18nKey={'Have_account'} style={styles.txtTitle} />
<TouchableOpacity
onPress={() => {
navigation.navigate('REGISTOR');
}}>
<AppText i18nKey={'Register'} style={styles.txtRegistor}/>
<AppText i18nKey={'Register'} style={styles.txtRegistor} />
</TouchableOpacity>
</View>
</View>
<View style={{height: 100}}/>
<View style={{height: 100}} />
</View>
);
};
......
......@@ -20,6 +20,7 @@ import I18n from '../../helper/i18/i18n';
import {showLoading, hideLoading} from '../../actions/loadingAction';
import {connect} from 'react-redux';
import {showAlert, TYPE} from '../../components/DropdownAlert';
import {encryptRSAString} from '../../Config/Functions';
const NewPassword = (props) => {
const [password, setPassword] = useState('');
......@@ -36,8 +37,8 @@ const NewPassword = (props) => {
const res = await forgotPasswordApi({
receiver_name: email,
otp,
password,
password_confirmation: cfPassword,
password: encryptRSAString(password),
password_confirmation: encryptRSAString(cfPassword),
platform: Platform.OS,
});
props.hideLoading();
......
......@@ -16,7 +16,13 @@ import {
useBlurOnFulfill,
useClearByFocusCell,
} from 'react-native-confirmation-code-field';
import {getFontXD, HEIGHTXD, WIDTHXD} from '../../Config/Functions';
import {
getFontXD,
HEIGHTXD,
WIDTHXD,
encryptRSAString,
decryptRSAString,
} from '../../Config/Functions';
import R from '../../assets/R';
import {NEWPASSWORD} from '../../routers/ScreenNames';
import {verifyOTPApi, registorApi, getOTPApi} from '../../apis/Functions/users';
......@@ -52,7 +58,7 @@ const ConfirmOTP = (propsa) => {
const res = await verifyOTPApi({
platform: Platform.OS,
receiver_name: propsa.route.params.email,
otp: value,
otp: encryptRSAString(value),
type: 'CUSTOMER_VERIFY',
});
......@@ -68,18 +74,18 @@ const ConfirmOTP = (propsa) => {
if (sponsor_id) {
res = await registorApi({
email,
password,
password: encryptRSAString(password),
platform: Platform.OS,
password_confirmation,
password_confirmation: encryptRSAString(password_confirmation),
sponsor_id,
phone,
});
} else {
res = await registorApi({
email,
password,
password: encryptRSAString(password),
platform: Platform.OS,
password_confirmation,
password_confirmation: encryptRSAString(password_confirmation),
phone,
});
}
......
......@@ -51,10 +51,13 @@ const Home = (props) => {
useEffect(() => {
getData();
initSocket();
let reloadUserInfoListener = DeviceEventEmitter.addListener('reloadUserInfo', (e) => {
let reloadUserInfoListener = DeviceEventEmitter.addListener(
'reloadUserInfo',
(e) => {
console.log('run in to reloadUserInfo');
onRefresh();
});
},
);
return () => {
reloadUserInfoListener.remove();
};
......
......@@ -7,7 +7,7 @@ import {WIDTHXD} from '../../Config/Functions';
import Icon from 'react-native-vector-icons/Entypo';
import {useNavigation} from '@react-navigation/native';
import {ADDMETHODPAY} from '../../routers/ScreenNames';
import AppText from '../../components/AppText';
const MethodPayView = (props) => {
const navigate = useNavigation();
......@@ -17,7 +17,17 @@ const MethodPayView = (props) => {
<View style={{flex: 1}}>
<HeaderBack title={'PaymentSetting'} />
<View style={{flex: 1}}>
{listMethod.length > 0 ? (
{listMethod.length == 0 ? (
<View
style={{justifyContent: 'center', alignItems: 'center', flex: 1}}>
<AppText
i18nKey={'NoData'}
style={{
fontSize: 18,
fontWeight: 'bold',
}}></AppText>
</View>
) : (
<FlatList
keyExtractor={(item) => item.method}
showsVerticalScrollIndicator={false}
......@@ -27,7 +37,7 @@ const MethodPayView = (props) => {
data={listMethod}
renderItem={({item}) => <Item item={item} />}
/>
) : null}
)}
<TouchableOpacity
onPress={() => navigate.navigate(ADDMETHODPAY)}
......
......@@ -33,13 +33,29 @@ const EnterPasswordSmartOTP = (props) => {
setFourNumber(number.toString());
}
};
console.log('Pros pass', props.route.params);
const onCheckPINSmartOTPPin = async () => {
let pinCode = `${firstNumber}${secondsNumber}${thirdNumber}${fourNumber}`;
setFirstNumber(null);
setSecondsNumber(null);
setThirdNumber(null);
setFourNumber(null);
if (props.route.params.isFromTransaction) {
navigation.navigate(CONFIRMCHANGESMARTOTP, {
pre_otp: pinCode,
old_password: props.route.params.old_password,
isFromTransaction: props.route.params.isFromTransaction,
TYPE: props.route.params.TYPE,
setupSmartOTPSuccess: props.route.params.setupSmartOTPSuccess,
});
} else {
navigation.navigate(CONFIRMCHANGESMARTOTP, {
pre_otp: pinCode,
old_password: props.route.params.old_password,
TYPE: props.route.params.TYPE,
});
}
};
const onDeletePress = () => {
if (fourNumber) {
......
import React, {useState, useEffect} from 'react';
import ConfirmSmartOTPView from './ConfirmSmartOTPView';
import {updateOTPApiSmart} from '../../../apis/Functions/users';
import {
updateOTPApiSmart,
getOTPApiSmartOTP,
} from '../../../apis/Functions/users';
import {showAlert, TYPE} from '../../../components/DropdownAlert';
import {connect} from 'react-redux';
import {hideLoading, showLoading} from '../../../actions/loadingAction';
import I18n from '../../../helper/i18/i18n';
import {SMARTOTPCONFIG, TABNAVIGATOR} from '../../../routers/ScreenNames';
import {
SMARTOTPCONFIG,
TABNAVIGATOR,
CONFIRMCREATEOTP,
} from '../../../routers/ScreenNames';
import {useNavigation} from '@react-navigation/native';
import {encryptRSAString} from '../../../Config/Functions';
const ConfirmChangeSmartOTP = (props) => {
const [firstNumber, setFirstNumber] = useState(null);
......@@ -31,14 +39,18 @@ const ConfirmChangeSmartOTP = (props) => {
}
};
console.log('Pros pass', props.route.params);
const onCheckPINSmartOTPPin = async () => {
let pinCode = `${firstNumber}${secondsNumber}${thirdNumber}${fourNumber}`;
if (props.route.params.TYPE == 'CHANGE_SMART_OTP') {
props.showLoading();
const res = await updateOTPApiSmart({
platform: Platform.OS,
password: props.route.params.pre_otp,
password_confirmation: pinCode,
old_password: props.route.params.old_password,
password: encryptRSAString(props.route.params.pre_otp),
password_confirmation: encryptRSAString(pinCode),
old_password: encryptRSAString(props.route.params.old_password),
});
props.hideLoading();
if (res.data.code == 200) {
......@@ -47,10 +59,7 @@ const ConfirmChangeSmartOTP = (props) => {
setSecondsNumber(null);
setThirdNumber(null);
setFourNumber(null);
navigation.reset({
index: 1,
routes: [{name: TABNAVIGATOR}, {name: SMARTOTPCONFIG}],
});
navigation.navigate(SMARTOTPCONFIG);
} else {
showAlert(TYPE.ERROR, I18n.t('Notification'), res.data.message);
setFirstNumber(null);
......@@ -58,6 +67,37 @@ const ConfirmChangeSmartOTP = (props) => {
setThirdNumber(null);
setFourNumber(null);
}
} else {
props.showLoading();
const res = await getOTPApiSmartOTP({
platform: Platform.OS,
otp_by: props.user.email,
otp_password: '1234',
type: 'CREATE_OTP_PASSWORD',
});
props.hideLoading();
if (res.data.code == 200) {
showAlert(TYPE.SUCCESS, I18n.t('Notification'), res.data.message);
if (props.route.params.isFromTransaction) {
navigation.navigate(CONFIRMCREATEOTP, {
password: props.route.params.pre_otp,
password_confirmation: pinCode,
isFromTransaction: props.route.params.isFromTransaction,
setupSmartOTPSuccess: props.route.params.setupSmartOTPSuccess,
});
} else {
navigation.navigate(CONFIRMCREATEOTP, {
password: props.route.params.pre_otp,
password_confirmation: pinCode,
});
}
} else {
showAlert(TYPE.ERROR, I18n.t('Notification'), res.data.message);
}
}
};
const onDeletePress = () => {
if (fourNumber) {
......
import React, {Component, useEffect, useState} from 'react';
import {
View,
Text,
TextInput,
StyleSheet,
TouchableOpacity,
Platform,
Alert,
} from 'react-native';
import HeaderBack from '../../../components/Header/HeaderBack';
import {
CodeField,
Cursor,
useBlurOnFulfill,
useClearByFocusCell,
} from 'react-native-confirmation-code-field';
import {
getFontXD,
HEIGHTXD,
WIDTHXD,
encryptRSAString,
} from '../../../Config/Functions';
import R from '../../../assets/R';
import {NEWPASSWORD, TABNAVIGATOR} from '../../../routers/ScreenNames';
import {
verifyOTPApi,
verifyStoreOTPApiSmart,
getOTPApiSmartOTP,
} from '../../../apis/Functions/users';
import {useNavigation} from '@react-navigation/native';
import I18n from '../../../helper/i18/i18n';
import AppText from '../../../components/AppText';
import {showLoading, hideLoading} from '../../../actions/loadingAction';
import {connect} from 'react-redux';
import {showAlert, TYPE} from '../../../components/DropdownAlert';
import CountDown from '../../../components/CountDown';
import {getOTPApi} from '../../../apis/Functions/users';
const CELL_COUNT = 4;
const ConfirmOTP = (propsa) => {
const [value, setValue] = useState('');
const [isReset, setReset] = useState(false);
const navigate = useNavigation();
const ref = useBlurOnFulfill({value, cellCount: CELL_COUNT});
const [props, getCellOnLayoutHandler] = useClearByFocusCell({
value,
setValue,
});
const getOTP = async () => {
propsa.showLoading();
const res = await getOTPApiSmartOTP({
platform: Platform.OS,
otp_by: propsa.user.email,
otp_password: '1234',
type: 'CREATE_OTP_PASSWORD',
});
propsa.hideLoading();
if (res.data.code == 200) {
setReset(!isReset);
showAlert(TYPE.SUCCESS, I18n.t('Notification'), res.data.message);
} else {
showAlert(TYPE.ERROR, I18n.t('Notification'), res.data.message);
}
};
const confirm = async () => {
console.log(propsa.route.params);
if (!value) {
showAlert(TYPE.WARN, I18n.t('Notification'), I18n.t('EnterOTPRequest'));
} else if (value.length != 4) {
showAlert(TYPE.WARN, I18n.t('Notification'), I18n.t('OTPInvalid'));
} else {
propsa.showLoading();
const res = await verifyStoreOTPApiSmart({
platform: Platform.OS,
password: encryptRSAString(propsa.route.params.password),
password_confirmation: encryptRSAString(
propsa.route.params.password_confirmation,
),
otp: value,
type: 'CREATE_OTP_PASSWORD',
});
propsa.hideLoading();
if (res.data.code == 200) {
showAlert(TYPE.SUCCESS, I18n.t('Notification'), res.data.message);
if (propsa.route.params.isFromTransaction) {
propsa.route.params.setupSmartOTPSuccess();
} else {
navigate.navigate(TABNAVIGATOR);
}
} else {
showAlert(TYPE.ERROR, I18n.t('Notification'), res.data.message);
}
}
};
return (
<View style={{flex: 1}}>
<HeaderBack title={'VerifyOTP'} />
<View style={styles.container}>
<View style={{height: 20}} />
<View style={styles.wrap}>
<AppText i18nKey={'Verify_code'} style={styles.txtTitle} />
<View style={styles.containerCode}>
<CodeField
ref={ref}
{...props}
value={value}
onChangeText={setValue}
cellCount={CELL_COUNT}
rootStyle={styles.codeFieldRoot}
keyboardType="number-pad"
textContentType="oneTimeCode"
renderCell={({index, symbol, isFocused}) => (
<View
onLayout={getCellOnLayoutHandler(index)}
key={index}
style={[styles.cellRoot, isFocused && styles.focusCell]}>
<Text style={styles.cellText}>
{symbol || (isFocused ? <Cursor /> : null)}
</Text>
</View>
)}
/>
</View>
</View>
</View>
<View style={styles.footer}>
<TouchableOpacity onPress={confirm} style={styles.btn}>
<AppText i18nKey={'Continue'} style={styles.txtBtn} />
</TouchableOpacity>
<TouchableOpacity style={styles.wrapFooter} onPress={getOTP}>
<Text style={styles.txtNote}>{I18n.t('OTPValidFiveMinute')}</Text>
<AppText i18nKey={'Re_send'} style={styles.txtSend} />
</TouchableOpacity>
<CountDown isReset={isReset} />
</View>
</View>
);
};
const styles = StyleSheet.create({
container: {
flex: 1,
justifyContent: 'center',
alignItems: 'center',
paddingVertical: 20,
},
footer: {
height: 200,
justifyContent: 'center',
alignItems: 'center',
},
wrap: {
flex: 1,
paddingTop: 30,
alignItems: 'center',
width: '100%',
paddingHorizontal: 50,
},
containerCode: {
height: 50,
width: '100%',
marginTop: 30,
},
codeFieldRoot: {
marginTop: 20,
},
focusCell: {
borderColor: '#000',
},
cellRoot: {
width: 40,
height: 40,
justifyContent: 'center',
alignItems: 'center',
borderBottomColor: '#ccc',
borderBottomWidth: 1,
},
cellText: {
color: '#000',
fontSize: 36,
textAlign: 'center',
},
focusCell: {
borderBottomColor: '#007AFF',
borderBottomWidth: 2,
},
txtTitle: {
fontSize: getFontXD(52),
color: '#979797',
},
btn: {
width: WIDTHXD(521),
height: HEIGHTXD(120),
borderRadius: 15,
backgroundColor: '#1C6AF6',
justifyContent: 'center',
alignItems: 'center',
},
txtBtn: {
color: R.colors.white,
fontSize: getFontXD(52),
textTransform: 'uppercase',
},
txtSend: {
fontSize: getFontXD(42),
color: '#1C6AF6',
},
wrapFooter: {
marginTop: 30,
flexDirection: 'row',
alignItems: 'center',
},
txtNote: {
color: '#A2A2A2',
fontSize: getFontXD(42),
fontStyle: 'italic',
},
});
const mapStateToProps = (state) => {
return {user: state.userReducer};
};
export default connect(mapStateToProps, {showLoading, hideLoading})(ConfirmOTP);
import React from 'react';
import {StyleSheet, Text, TouchableOpacity, View} from 'react-native';
import HeaderBack from '../../../components/Header/HeaderBack';
import {getFontXD, HEIGHTXD, WIDTHXD} from '../../../Config/Functions';
import I18n from '../../../helper/i18/i18n';
import R from '../../../assets/R';
import Icon from 'react-native-vector-icons/FontAwesome5';
const ChangeSmartOTPView = (props) => {
return (
<View style={{flex: 1, colorBackground: R.colors.white}}>
<HeaderBack title={'OTP'} />
<Text style={[styles.textNormal, {marginTop: HEIGHTXD(40)}]}>
{I18n.t('EnterOTPRequest')}
</Text>
<View style={[styles.rowNumber]}>
<View
style={[
styles.indicator,
{
backgroundColor: props.firstNumber
? R.colors.main
: R.colors.white,
},
]}
/>
<View
style={[
styles.indicator,
{
backgroundColor: props.secondsNumber
? R.colors.main
: R.colors.white,
},
]}
/>
<View
style={[
styles.indicator,
{
backgroundColor: props.thirdNumber
? R.colors.main
: R.colors.white,
},
]}
/>
<View
style={[
styles.indicator,
{
backgroundColor: props.fourNumber
? R.colors.main
: R.colors.white,
},
]}
/>
</View>
<View style={[styles.rowNumber, {marginTop: HEIGHTXD(80)}]}>
<TouchableOpacity
onPress={() => {
props.onNumberPress(1);
}}
style={styles.btnNumber}>
<Text style={styles.textNumber}>1</Text>
</TouchableOpacity>
<TouchableOpacity
onPress={() => {
props.onNumberPress(2);
}}
style={[styles.btnNumber, {marginLeft: WIDTHXD(40)}]}>
<Text style={styles.textNumber}>2</Text>
</TouchableOpacity>
<TouchableOpacity
onPress={() => {
props.onNumberPress(3);
}}
style={[styles.btnNumber, {marginLeft: WIDTHXD(40)}]}>
<Text style={styles.textNumber}>3</Text>
</TouchableOpacity>
</View>
<View style={styles.rowNumber}>
<TouchableOpacity
onPress={() => {
props.onNumberPress(4);
}}
style={styles.btnNumber}>
<Text style={styles.textNumber}>4</Text>
</TouchableOpacity>
<TouchableOpacity
onPress={() => {
props.onNumberPress(5);
}}
style={[styles.btnNumber, {marginLeft: WIDTHXD(40)}]}>
<Text style={styles.textNumber}>5</Text>
</TouchableOpacity>
<TouchableOpacity
onPress={() => {
props.onNumberPress(6);
}}
style={[styles.btnNumber, {marginLeft: WIDTHXD(40)}]}>
<Text style={styles.textNumber}>6</Text>
</TouchableOpacity>
</View>
<View style={styles.rowNumber}>
<TouchableOpacity
onPress={() => {
props.onNumberPress(7);
}}
style={styles.btnNumber}>
<Text style={styles.textNumber}>7</Text>
</TouchableOpacity>
<TouchableOpacity
onPress={() => {
props.onNumberPress(8);
}}
style={[styles.btnNumber, {marginLeft: WIDTHXD(40)}]}>
<Text style={styles.textNumber}>8</Text>
</TouchableOpacity>
<TouchableOpacity
onPress={() => {
props.onNumberPress(9);
}}
style={[styles.btnNumber, {marginLeft: WIDTHXD(40)}]}>
<Text style={styles.textNumber}>9</Text>
</TouchableOpacity>
</View>
<View style={styles.rowNumber}>
<TouchableOpacity
onPress={() => {
props.onNumberPress(0);
}}
style={[styles.btnNumber, {marginLeft: WIDTHXD(300)}]}>
<Text style={styles.textNumber}>0</Text>
</TouchableOpacity>
<TouchableOpacity
onPress={() => {
props.onDeletePress();
}}
style={{
width: HEIGHTXD(260),
height: HEIGHTXD(260),
marginLeft: WIDTHXD(40),
justifyContent: 'center',
alignItems: 'center',
}}>
<Icon name={'backspace'} size={HEIGHTXD(80)} color={'#8E8C8C'} />
</TouchableOpacity>
</View>
</View>
);
};
export default ChangeSmartOTPView;
const styles = StyleSheet.create({
btnSend: {
height: HEIGHTXD(80),
justifyContent: 'center',
alignItems: 'center',
},
rowNumber: {
flexDirection: 'row',
justifyContent: 'center',
marginTop: HEIGHTXD(40),
},
btnNumber: {
height: HEIGHTXD(260),
width: HEIGHTXD(260),
justifyContent: 'center',
alignItems: 'center',
borderWidth: 0.3,
borderColor: R.colors.gray6,
borderRadius: HEIGHTXD(130),
},
indicator: {
height: HEIGHTXD(50),
width: HEIGHTXD(50),
borderWidth: 0.3,
borderColor: R.colors.gray6,
borderRadius: HEIGHTXD(35),
marginHorizontal: WIDTHXD(20),
},
textNormal: {
fontSize: getFontXD(39),
color: R.colors.black,
textAlign: 'center',
},
textNumber: {
fontSize: getFontXD(90),
color: R.colors.black,
textAlign: 'center',
},
txtSend: {
fontSize: getFontXD(42),
color: R.colors.main,
},
});
import React, {useState} from 'react';
import {
View,
Text,
StyleSheet,
TouchableOpacity,
Platform,
} from 'react-native';
import {View, Text, StyleSheet, TouchableOpacity, Platform} from 'react-native';
import HeaderBack from '../../components/Header/HeaderBack';
import {
......@@ -29,7 +23,7 @@ import {
verifyStoreOTPApiSmart,
getOTPApiSmartOTP,
} from '../../apis/Functions/users';
import {encryptRSAString} from '../../Config/Functions';
const CELL_COUNT = 4;
......@@ -70,8 +64,10 @@ const ConfirmOTPSmart = (propsa) => {
propsa.showLoading();
const res = await verifyStoreOTPApiSmart({
platform: Platform.OS,
password: propsa.route.params.password,
password_confirmation: propsa.route.params.password_confirmation,
password: encryptRSAString(propsa.route.params.password),
password_confirmation: encryptRSAString(
propsa.route.params.password_confirmation,
),
otp: value,
type: 'CREATE_OTP_PASSWORD',
});
......
......@@ -8,6 +8,7 @@ import {hideLoading, showLoading} from '../../actions/loadingAction';
import {OTP_TYPE} from '../../Config/constants';
import {useNavigation} from '@react-navigation/native';
import {RESET_SMART_OTP, CHANGESMARTOTP} from '../../routers/ScreenNames';
import {decryptRSAString, encryptRSAString} from '../../Config/Functions';
const EnterPasswordSmartOTP = (props) => {
const navigation = useNavigation();
......@@ -38,21 +39,24 @@ const EnterPasswordSmartOTP = (props) => {
if (props.route.params.type == 'CHANGE_SMART_OTP') {
const res = await verifyOTPApiSmart({
platform: Platform.OS,
otp_password: pinCode,
otp_password: encryptRSAString(pinCode),
type: 'VERIFY_OTP_PASSWORD',
});
if (res.data.code == 200) {
navigation.navigate(CHANGESMARTOTP, {old_password: pinCode});
clearPIN()
navigation.navigate(CHANGESMARTOTP, {
old_password: encryptRSAString(pinCode),
TYPE: 'CHANGE_SMART_OTP',
});
clearPIN();
} else {
showAlert(TYPE.ERROR, I18n.t('Notification'), res.data.message);
clearPIN()
clearPIN();
}
} else {
const res = await getOTPApiSmartOTP({
platform: Platform.OS,
otp_by: props.user.email,
otp_password: pinCode,
otp_password: encryptRSAString(pinCode),
type:
props.route.params.type == 'DEPOSIT'
? OTP_TYPE.CUSTOMER_REQUEST_DEPOSIT
......@@ -60,10 +64,13 @@ const EnterPasswordSmartOTP = (props) => {
});
if (res.data.code == 200) {
props.route.params.onGoToSmartOTP(pinCode, res.data.data.otp);
props.route.params.onGoToSmartOTP(
pinCode,
decryptRSAString(res.data.data.otp),
);
} else {
showAlert(TYPE.ERROR, I18n.t('Notification'), res.data.message);
clearPIN()
clearPIN();
}
}
props.hideLoading();
......@@ -73,7 +80,7 @@ const EnterPasswordSmartOTP = (props) => {
setSecondsNumber(null);
setThirdNumber(null);
setFourNumber(null);
}
};
const onDeletePress = () => {
if (fourNumber) {
setFourNumber(null);
......
......@@ -11,7 +11,7 @@ import {connect} from 'react-redux';
import {hideLoading, showLoading} from '../../actions/loadingAction';
import {OTP_TYPE} from '../../Config/constants';
import {useNavigation} from '@react-navigation/native';
import {encryptRSAString, decryptRSAString} from '../../Config/Functions';
const SmartOTP = (props) => {
const [value, setValue] = useState(props.route.params.otp);
......@@ -31,8 +31,11 @@ const SmartOTP = (props) => {
let res1 = await verifyOTPApi({
platform: Platform.OS,
receiver_name: props.user.email,
otp: value,
type: props.route.params.type == 'DEPOSIT' ? OTP_TYPE.CUSTOMER_REQUEST_DEPOSIT : OTP_TYPE.REQUEST_WITHDRAW,
otp: encryptRSAString(value),
type:
props.route.params.type == 'DEPOSIT'
? OTP_TYPE.CUSTOMER_REQUEST_DEPOSIT
: OTP_TYPE.REQUEST_WITHDRAW,
});
if (res1.data.code == 200) {
......@@ -80,11 +83,14 @@ const SmartOTP = (props) => {
const res = await getOTPApiSmartOTP({
platform: Platform.OS,
otp_by: props.user.email,
otp_password: props.route.params.pinCode,
type: props.route.params.type == 'DEPOSIT' ? OTP_TYPE.CUSTOMER_REQUEST_DEPOSIT : OTP_TYPE.REQUEST_WITHDRAW,
otp_password: encryptRSAString(props.route.params.pinCode),
type:
props.route.params.type == 'DEPOSIT'
? OTP_TYPE.CUSTOMER_REQUEST_DEPOSIT
: OTP_TYPE.REQUEST_WITHDRAW,
});
if (res.data.code == 200) {
setValue(res.data.data.otp);
setValue(decryptRSAString(res.data.data.otp));
setReset(!isReset);
} else {
showAlert(TYPE.ERROR, I18n.t('Notification'), res.data.message);
......@@ -96,14 +102,17 @@ const SmartOTP = (props) => {
setProgress(count > 0 ? count / 300 : 0);
};
return <SmartOTPView
return (
<SmartOTPView
value={value}
progress={progress}
confirm={confirm}
isReset={isReset}
getNewOTP={getNewOTP}
updateProgress={updateProgress}
setValue={setValue}/>;
setValue={setValue}
/>
);
};
const mapStateToProps = (state) => {
return {
......
......@@ -38,10 +38,9 @@ const VersionChecker = (props) => {
platform: Platform.OS,
});
if ((res.data.code = 200 && res.data.data)) {
console.log(res);
if (
res.data.data[0].version_name !== verCurrent ||
res.data.data[0].build.toString() !== DeviceInfo.getBuildNumber
res.data.data[0].build.toString() !== DeviceInfo.getBuildNumber()
) {
setVersion(res.data.data[0].version_name);
setVisible(true);
......
......@@ -16,7 +16,12 @@ import {
useBlurOnFulfill,
useClearByFocusCell,
} from 'react-native-confirmation-code-field';
import {getFontXD, HEIGHTXD, WIDTHXD} from '../../Config/Functions';
import {
getFontXD,
HEIGHTXD,
WIDTHXD,
encryptRSAString,
} from '../../Config/Functions';
import R from '../../assets/R';
import {TABNAVIGATOR} from '../../routers/ScreenNames';
import {verifyOTPApi} from '../../apis/Functions/users';
......@@ -68,8 +73,10 @@ const ConfirmOTPSmart = (propsa) => {
propsa.showLoading();
const res = await verifyStoreOTPApiSmart({
platform: Platform.OS,
password: propsa.route.params.password,
password_confirmation: propsa.route.params.password_confirmation,
password: encryptRSAString(propsa.route.params.password),
password_confirmation: encryptRSAString(
propsa.route.params.password_confirmation,
),
otp: value,
type: 'FORGOT_PASSWORD',
});
......
......@@ -65,20 +65,10 @@ export async function PostLogin(url, json) {
console.log('post data mobile', myRequest);
return await axios(myRequest)
.then((response) => {
if (response.data?.code === 401) {
logout();
return;
} else {
return response;
}
})
.then((response) => {
if (response.data?.code === 401) {
logout();
return;
} else {
return response;
}
})
.catch((error) => {
console.log(error);
......
export const root = 'http://services.dcvinvest.com/';
export default {
urllogin: root + 'api/auth/customer-login',
urllogin: root + 'api/v2/auth/customer-login',
urlRegistor: root + 'api/auth/customer-register',
urlGetListMethod: root + 'api/v1/payments/get-list-deposit-method',
urlGetOTP: root + 'api/auth/customer-get-otp',
......
......@@ -308,7 +308,7 @@ export default {
SettingOTP: 'Setting Smart OTP',
SettingGeneral: 'Setting general',
ChangeSmartOTP: 'Change smart OTP',
ChangeSmartOTP: 'Smart OTP',
Rules: 'Rules',
FAQs: 'FAQs',
......@@ -327,4 +327,5 @@ export default {
ForgotSmartOTP: 'Forgot Smart OTP',
WarnMaxReqestWithdraw: 'Invalid withdrawal amount',
YouHaveNotSettingSmartOTP: 'You have not installed Smart OTP',
OTP: 'Enter OTP',
};
......@@ -311,7 +311,7 @@ export default {
EnterSmartOTPPINNEW: 'Vui lòng nhập mã PIN Smart OTP mới',
AddSmartOTP: 'Thêm Smart OTP',
ChangeSmartOTP: 'Đổi mã PIN Smart OTP',
ChangeSmartOTP: 'Mã PIN Smart OTP',
Rules: 'Điều khoản và điều kiện',
FAQs: 'FAQs',
......@@ -324,4 +324,5 @@ export default {
ResetSmartOTP2: ' bấm phím 3 để gặp nhân viên hỗ trợ kỹ thuật.',
ForgotSmartOTP: 'Quên Smart OTP',
YouHaveNotSettingSmartOTP: 'Bạn chưa cài đặt Smart OTP',
OTP: 'Nhập OTP',
};
......@@ -93,3 +93,5 @@ export const CONFIRMCHANGESMARTOTP = 'CONFIRMCHANGESMARTOTP';
export const RULESSMARTOTP = 'RULESSMARTOTP';
export const FAQSSMARTOTP = 'FAQSSMARTOTP';
export const CONFIRMCREATEOTP = 'CONFIRMCREATEOTP';
......@@ -67,6 +67,7 @@ import ConfirmChangeSmartOTP from '../Screens/SmartOTP/ChangeSmartOTP/ConfirmCha
import FAQs from '../Screens/SmartOTP/WebView/FAQs';
import RulesSmartOTP from '../Screens/SmartOTP/WebView/RulesSmartOTP';
import ConfirmCreate from '../Screens/SmartOTP/ConfirmCreate/ConfirmCreate';
import * as ScreenName from './ScreenNames';
......@@ -86,9 +87,14 @@ function MyStack(props) {
headerMode={'none'}
initialRouteName={ScreenName.AUTHEN}>
<Stack.Screen
name={ScreenName.CONFIRMCREATEOTP}
component={ConfirmCreate}
/>
<Stack.Screen
name={ScreenName.CACULATEDDEPOSIT}
component={CaculatedDeposit}
/>
<Stack.Screen
name={ScreenName.CONFIRMOTPSMART}
component={ConfirmOTPSmart}
......@@ -172,8 +178,14 @@ function MyStack(props) {
<Stack.Screen name={ScreenName.NEWPASSWORD} component={NewPassWord} />
<Stack.Screen name={ScreenName.PRODUCTDETAIL} component={ProductDetail} />
<Stack.Screen name={ScreenName.SMARTOTP} component={SmartOTP} />
<Stack.Screen name={ScreenName.ENTER_PASSWORD_SMART_OTP} component={EnterPasswordSmartOTP} />
<Stack.Screen name={ScreenName.RESET_SMART_OTP} component={ResetSmartOTP} />
<Stack.Screen
name={ScreenName.ENTER_PASSWORD_SMART_OTP}
component={EnterPasswordSmartOTP}
/>
<Stack.Screen
name={ScreenName.RESET_SMART_OTP}
component={ResetSmartOTP}
/>
<Stack.Screen name={ScreenName.FAQSSMARTOTP} component={FAQs} />
<Stack.Screen name={ScreenName.RULESSMARTOTP} component={RulesSmartOTP} />
......
......@@ -21,6 +21,7 @@ import {
AccountVerification,
PACKETCQG,
SETTINGOTP,
CHANGESMARTOTP,
} from '../routers/ScreenNames';
import I18n, {setLocation} from '../helper/i18/i18n';
import {changeLanguage} from '../actions/language';
......@@ -110,7 +111,10 @@ const TabNavigator = (props) => {
? 'Bạn có muốn cài đặt Smart OTP?'
: 'Do you want setting Smart OTP?',
() => {
navigate.navigate(SETTINGOTP);
navigate.navigate(CHANGESMARTOTP, {
TYPE: 'CREATE_SMART_OTP',
old_password: null,
});
},
);
} else if (props.user.status == 3 && !props.user.contract_code) {
......
......@@ -5205,6 +5205,11 @@ jsdom@^16.4.0:
ws "^7.2.3"
xml-name-validator "^3.0.0"
jsencrypt@^3.2.0:
version "3.2.0"
resolved "https://registry.yarnpkg.com/jsencrypt/-/jsencrypt-3.2.0.tgz#09242aabf1984165dcd7698fe6ed163be77c05f8"
integrity sha512-Y/WBrCYRP1A2I1OEXxqurO+W3AC5uXhiArprpYQ0Y8/1Dc3NaiINAyCLx7HzXGwN7xvW3s5xpeOTdwD7lD1SQQ==
jsesc@^2.5.1:
version "2.5.2"
resolved "https://registry.yarnpkg.com/jsesc/-/jsesc-2.5.2.tgz"
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment