Commit 7d089f9a by Giang Tran

update otp

parent 4a87b671
...@@ -46,6 +46,7 @@ const Item = (props) => { ...@@ -46,6 +46,7 @@ const Item = (props) => {
}; };
const Profile = (props) => { const Profile = (props) => {
console.log(props.user);
const renderType = (type) => { const renderType = (type) => {
switch (type) { switch (type) {
case 1: case 1:
...@@ -84,11 +85,11 @@ const Profile = (props) => { ...@@ -84,11 +85,11 @@ const Profile = (props) => {
}}> }}>
<Item <Item
linkImg={props.user.identity_before} linkImg={props.user.identity_before}
title={I18n.t('IdentityCitizenCardBackPhoto')} title={I18n.t('IdentityCitizenCardFrontPhoto')}
/> />
<Item <Item
linkImg={props.user.identity_after} linkImg={props.user.identity_after}
title={I18n.t('IdentityCitizenCardFrontPhoto')} title={I18n.t('IdentityCitizenCardBackPhoto')}
/> />
<Item linkImg={props.user.sign_img} title={I18n.t('SignPhoto')} /> <Item linkImg={props.user.sign_img} title={I18n.t('SignPhoto')} />
</View> </View>
......
...@@ -22,7 +22,7 @@ import {verifyOTPApi, registorApi} from '../../../apis/Functions/users'; ...@@ -22,7 +22,7 @@ import {verifyOTPApi, registorApi} from '../../../apis/Functions/users';
import {useNavigation} from '@react-navigation/native'; import {useNavigation} from '@react-navigation/native';
import I18n from '../../../helper/i18/i18n'; import I18n from '../../../helper/i18/i18n';
import AppText from '../../../components/AppText'; import AppText from '../../../components/AppText';
import {widthDraw, getListWidthDraw} from '../../../apis/Functions/Widthdraw';
import {showLoading, hideLoading} from '../../../actions/loadingAction'; import {showLoading, hideLoading} from '../../../actions/loadingAction';
import {connect} from 'react-redux'; import {connect} from 'react-redux';
import {TABNAVIGATOR} from '../../../routers/ScreenNames'; import {TABNAVIGATOR} from '../../../routers/ScreenNames';
...@@ -39,6 +39,7 @@ const ConfirmOTP = (propsa) => { ...@@ -39,6 +39,7 @@ const ConfirmOTP = (propsa) => {
value, value,
setValue, setValue,
}); });
console.log('Type', propsa.route.params.type);
const confirm = async () => { const confirm = async () => {
if (!value) { if (!value) {
...@@ -47,6 +48,7 @@ const ConfirmOTP = (propsa) => { ...@@ -47,6 +48,7 @@ const ConfirmOTP = (propsa) => {
Alert.alert(I18n.t('Notification'), I18n.t('OTPInvalid')); Alert.alert(I18n.t('Notification'), I18n.t('OTPInvalid'));
} else { } else {
propsa.showLoading(); propsa.showLoading();
const res = await verifyOTPApi({ const res = await verifyOTPApi({
platform: Platform.OS, platform: Platform.OS,
receiver_name: propsa.user.email, receiver_name: propsa.user.email,
...@@ -54,13 +56,28 @@ const ConfirmOTP = (propsa) => { ...@@ -54,13 +56,28 @@ const ConfirmOTP = (propsa) => {
}); });
if (res.data.code == 200) { if (res.data.code == 200) {
const {amount, notes, type} = propsa.route.params; let res;
const res = await walletDeposit({
amount, if (propsa.route.params.type == 'DEPOSIT') {
platform: Platform.OS, const {amount, notes} = propsa.route.params;
notes, res = await walletDeposit({
fee: 0, amount,
}); platform: Platform.OS,
notes,
fee: 0,
});
} else {
const {src, receiving_account, amount, notes} = propsa.route.params;
res = await widthDraw({
src,
receiving_account,
amount,
platform: Platform.OS,
notes,
fee: 0,
});
}
propsa.hideLoading(); propsa.hideLoading();
if (res.data.code == 200) { if (res.data.code == 200) {
setTimeout(() => { setTimeout(() => {
......
...@@ -33,6 +33,8 @@ import {confirmAlert} from '../../../components/Aleart'; ...@@ -33,6 +33,8 @@ import {confirmAlert} from '../../../components/Aleart';
import {ADDMETHODPAY} from '../../../routers/ScreenNames'; import {ADDMETHODPAY} from '../../../routers/ScreenNames';
import TextMoney from '../../../components/Input/InputMoney'; import TextMoney from '../../../components/Input/InputMoney';
import I18n from '../../../helper/i18/i18n'; import I18n from '../../../helper/i18/i18n';
import {getOTPApi} from '../../../apis/Functions/users';
import {OTPWALLET} from '../../../routers/ScreenNames';
var radio_props = [ var radio_props = [
{label: I18n.t('FromWallet'), value: 'WALLET'}, {label: I18n.t('FromWallet'), value: 'WALLET'},
{label: I18n.t('FromCQGAccount'), value: 'INVESTMENT'}, {label: I18n.t('FromCQGAccount'), value: 'INVESTMENT'},
...@@ -86,27 +88,26 @@ const WalletWithdraw = (props) => { ...@@ -86,27 +88,26 @@ const WalletWithdraw = (props) => {
if (index === true) { if (index === true) {
props.showLoading(); props.showLoading();
const res = await widthDraw({ const res = await getOTPApi({
src,
receiving_account: type.id,
amount,
platform: Platform.OS, platform: Platform.OS,
notes, otp_by: props.user.email,
fee: 0,
}); });
props.hideLoading(); props.hideLoading();
if (res.data.code == 200) { if (res.data.code == 200) {
setTimeout(() => { navigate.navigate(OTPWALLET, {
Alert.alert(I18n.t('Notification'), res.data.message); type: 'WITHDRAW',
navigate.goBack(); src,
}, 500); receiving_account: type.id,
amount,
notes,
});
} else { } else {
setTimeout(() => { setTimeout(() => {
Alert.alert(I18n.t('Notification'), res.data.message); Alert.alert(I18n.t('Notification'), res.data.message);
}, 500); }, 500);
} }
props.hideLoading();
} else { } else {
Alert.alert( Alert.alert(
I18n.t('Notification'), I18n.t('Notification'),
......
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