Commit 7d089f9a by Giang Tran

update otp

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