Deposit cash to other wallet agent
This commit is contained in:
parent
0829ddb1af
commit
fc331462d9
11
App.js
11
App.js
|
@ -62,6 +62,10 @@ import EnvoieWalletToBankUser from './screens/wallet/user/EnvoieWalletToBankUser
|
||||||
import RetraitWalletVersCashUser from './screens/wallet/user/RetraitWalletVersCashUser';
|
import RetraitWalletVersCashUser from './screens/wallet/user/RetraitWalletVersCashUser';
|
||||||
import RetraitCarteVersCashUser from './screens/wallet/user/RetraitCarteVersCashUser';
|
import RetraitCarteVersCashUser from './screens/wallet/user/RetraitCarteVersCashUser';
|
||||||
import RetraitCarteVersWalletUser from './screens/wallet/user/RetraitCarteVersWalletUser';
|
import RetraitCarteVersWalletUser from './screens/wallet/user/RetraitCarteVersWalletUser';
|
||||||
|
import RetraitEnCashAgent from './screens/wallet/agent/RetraitEnCashAgent';
|
||||||
|
import RetraitCarteVersCashAgent from './screens/wallet/agent/RetraitCarteVersCashAgent';
|
||||||
|
import EnvoieCashVersWalletAgent from './screens/wallet/agent/EnvoieCashVersWalletAgent';
|
||||||
|
import EnvoieCashVersAutreWalletAgent from './screens/wallet/agent/EnvoieCashVersAutreWalletAgent';
|
||||||
|
|
||||||
const instructions = Platform.select({
|
const instructions = Platform.select({
|
||||||
ios: 'Press Cmd+R to reload,\n' + 'Cmd+D or shake for dev menu',
|
ios: 'Press Cmd+R to reload,\n' + 'Cmd+D or shake for dev menu',
|
||||||
|
@ -167,7 +171,12 @@ const AppAgentStack = createDrawerNavigator({
|
||||||
walletRetrait: WalletRetrait,
|
walletRetrait: WalletRetrait,
|
||||||
walletOptionSelect: WalletOptionSelect,
|
walletOptionSelect: WalletOptionSelect,
|
||||||
operateurOptionSelect: OperateurOptionSelect,
|
operateurOptionSelect: OperateurOptionSelect,
|
||||||
paiementFacture: PaiementFacture
|
paiementFacture: PaiementFacture,
|
||||||
|
retraitEnCashAgent: RetraitEnCashAgent,
|
||||||
|
retraitCarteVersCashAgent: RetraitCarteVersCashAgent,
|
||||||
|
envoieCashVersWalletAgent: EnvoieCashVersWalletAgent,
|
||||||
|
envoieCashVersAutreWalletAgent: EnvoieCashVersAutreWalletAgent
|
||||||
|
|
||||||
})
|
})
|
||||||
}, {
|
}, {
|
||||||
contentComponent: OptionsMenu,
|
contentComponent: OptionsMenu,
|
||||||
|
|
File diff suppressed because one or more lines are too long
|
@ -42,5 +42,8 @@
|
||||||
"envoieWalletToCashUser": "envoieWalletToCashUser",
|
"envoieWalletToCashUser": "envoieWalletToCashUser",
|
||||||
"envoieWalletToCardUser": "envoieWalletToCardUser",
|
"envoieWalletToCardUser": "envoieWalletToCardUser",
|
||||||
"linkCard": "linkCard",
|
"linkCard": "linkCard",
|
||||||
"envoieWalletToBankUser": "envoieWalletToBankUser"
|
"envoieWalletToBankUser": "envoieWalletToBankUser",
|
||||||
|
"retraitWalletVersCashUser": "retraitWalletVersCashUser",
|
||||||
|
"retraitCarteVersCashUser": "retraitCarteVersCashUser",
|
||||||
|
"retraitCarteVersWalletUser": "retraitCarteVersWalletUser"
|
||||||
}
|
}
|
||||||
|
|
|
@ -71,8 +71,11 @@
|
||||||
"LINK_CARD": "Link my card",
|
"LINK_CARD": "Link my card",
|
||||||
"WITHDRAWAL_IN_CASH": "Withdrawal in cash",
|
"WITHDRAWAL_IN_CASH": "Withdrawal in cash",
|
||||||
"WITHDRAWAL_WALLET_TO_CASH": "Withdrawal wallet to cash",
|
"WITHDRAWAL_WALLET_TO_CASH": "Withdrawal wallet to cash",
|
||||||
|
"WITHDRAWAL_WALLET_TO_CASH_DESCRIPTION": "Withdrawal money from wallet to cash",
|
||||||
"WITHDRAWAL_CARD_TO_WALLET": "Withdrawal card to wallet",
|
"WITHDRAWAL_CARD_TO_WALLET": "Withdrawal card to wallet",
|
||||||
|
"WITHDRAWAL_CARD_TO_WALLET_DESCRIPTION": "Withdrawal money from your card to your wallet",
|
||||||
"WITHDRAWAL_CARD_TO_CASH": "Withdrawal card to cash",
|
"WITHDRAWAL_CARD_TO_CASH": "Withdrawal card to cash",
|
||||||
|
"WITHDRAWAL_CARD_TO_CASH_DESCRIPTION": "Withdrawal money from card to cash",
|
||||||
"DEPOSIT_CASH_TO_WALLET": "Cash to wallet",
|
"DEPOSIT_CASH_TO_WALLET": "Cash to wallet",
|
||||||
"DEPOSIT_CASH_TO_OTHER_WALLET": "Cash to another wallet",
|
"DEPOSIT_CASH_TO_OTHER_WALLET": "Cash to another wallet",
|
||||||
"DEPOSIT_CASH_TO_VISA": "Cash to visa card",
|
"DEPOSIT_CASH_TO_VISA": "Cash to visa card",
|
||||||
|
|
|
@ -76,8 +76,11 @@
|
||||||
"LINK_CARD": "Lier ma carte",
|
"LINK_CARD": "Lier ma carte",
|
||||||
"WITHDRAWAL_IN_CASH": "Retrait en cash",
|
"WITHDRAWAL_IN_CASH": "Retrait en cash",
|
||||||
"WITHDRAWAL_WALLET_TO_CASH": "Retrait de votre wallet vers cash",
|
"WITHDRAWAL_WALLET_TO_CASH": "Retrait de votre wallet vers cash",
|
||||||
|
"WITHDRAWAL_WALLET_TO_CASH_DESCRIPTION": "Retirer de l'argent de votre Wallet vers cash",
|
||||||
"WITHDRAWAL_CARD_TO_WALLET": "Retrait de votre carte vers wallet",
|
"WITHDRAWAL_CARD_TO_WALLET": "Retrait de votre carte vers wallet",
|
||||||
|
"WITHDRAWAL_CARD_TO_WALLET_DESCRIPTION": "Retrait d'argent de votre carte vers wallet",
|
||||||
"WITHDRAWAL_CARD_TO_CASH": "Retrait de votre carte vers cash",
|
"WITHDRAWAL_CARD_TO_CASH": "Retrait de votre carte vers cash",
|
||||||
|
"WITHDRAWAL_CARD_TO_CASH_DESCRIPTION": "Retrait de l'argent de votre carte vers cash",
|
||||||
"DEPOSIT_CASH_TO_WALLET": "Cash vers wallet",
|
"DEPOSIT_CASH_TO_WALLET": "Cash vers wallet",
|
||||||
"DEPOSIT_CASH_TO_OTHER_WALLET": "Cash vers autre wallet",
|
"DEPOSIT_CASH_TO_OTHER_WALLET": "Cash vers autre wallet",
|
||||||
"DEPOSIT_CASH_TO_VISA": "Cash vers carte visa",
|
"DEPOSIT_CASH_TO_VISA": "Cash vers carte visa",
|
||||||
|
|
|
@ -0,0 +1,19 @@
|
||||||
|
import { RETRAIT_CASH_AGENT_ID_VERIFICATION_PENDING, RETRAIT_CASH_AGENT_ID_VERIFICATION_SUCCESS, RETRAIT_CASH_AGENT_ID_VERIFICATION_ERROR, RETRAIT_CASH_AGENT_ID_VERIFICATION_RESET } from "../types/EnvoieAgentType";
|
||||||
|
|
||||||
|
export const fetchRetraitCashAgentIdVerificationPending = () => ({
|
||||||
|
type: RETRAIT_CASH_AGENT_ID_VERIFICATION_PENDING
|
||||||
|
});
|
||||||
|
|
||||||
|
export const fetchRetraitCashAgentIdVerificationSuccess = (res) => ({
|
||||||
|
type: RETRAIT_CASH_AGENT_ID_VERIFICATION_SUCCESS,
|
||||||
|
result: res,
|
||||||
|
});
|
||||||
|
|
||||||
|
export const fetchRetraitCashAgentIdVerificationError = (error) => ({
|
||||||
|
type: RETRAIT_CASH_AGENT_ID_VERIFICATION_ERROR,
|
||||||
|
result: error
|
||||||
|
});
|
||||||
|
|
||||||
|
export const fetchRetraitCashAgentIdVerificationReset = () => ({
|
||||||
|
type: RETRAIT_CASH_AGENT_ID_VERIFICATION_RESET
|
||||||
|
});
|
|
@ -0,0 +1,33 @@
|
||||||
|
import { RETRAIT_CASH_AGENT_ID_VERIFICATION_PENDING, RETRAIT_CASH_AGENT_ID_VERIFICATION_SUCCESS, RETRAIT_CASH_AGENT_ID_VERIFICATION_ERROR, RETRAIT_CASH_AGENT_ID_VERIFICATION_RESET } from "../types/EnvoieAgentType";
|
||||||
|
|
||||||
|
const initialState = {
|
||||||
|
loading: false,
|
||||||
|
result: null,
|
||||||
|
error: null
|
||||||
|
};
|
||||||
|
|
||||||
|
export default (state = initialState, action) => {
|
||||||
|
switch (action.type) {
|
||||||
|
case RETRAIT_CASH_AGENT_ID_VERIFICATION_PENDING: return {
|
||||||
|
...state,
|
||||||
|
loading: true
|
||||||
|
}
|
||||||
|
case RETRAIT_CASH_AGENT_ID_VERIFICATION_SUCCESS: return {
|
||||||
|
...state,
|
||||||
|
loading: false,
|
||||||
|
result: action.result.data,
|
||||||
|
error: null
|
||||||
|
}
|
||||||
|
case RETRAIT_CASH_AGENT_ID_VERIFICATION_ERROR: return {
|
||||||
|
...state,
|
||||||
|
loading: false,
|
||||||
|
result: null,
|
||||||
|
error: action.result
|
||||||
|
}
|
||||||
|
case RETRAIT_CASH_AGENT_ID_VERIFICATION_RESET: return initialState;
|
||||||
|
|
||||||
|
default: {
|
||||||
|
return state;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
};
|
|
@ -23,6 +23,7 @@ import EnvoieUserWalletToCashGetCommissionReducer from "./EnvoieUserWalletToCash
|
||||||
import EnvoieUserWalletToCardReducer from "./EnvoieUserWalletToCardReducer";
|
import EnvoieUserWalletToCardReducer from "./EnvoieUserWalletToCardReducer";
|
||||||
import EnvoieUserWalletToCardGetCommissionReducer from "./EnvoieUserWalletToCardGetCommissionReducer";
|
import EnvoieUserWalletToCardGetCommissionReducer from "./EnvoieUserWalletToCardGetCommissionReducer";
|
||||||
import LinkCardReducer from "./LinkCardReducer";
|
import LinkCardReducer from "./LinkCardReducer";
|
||||||
|
import RetraitCashAgentIdVerificationReducer from "./RetraitCashAgentIdVerificationReducer";
|
||||||
|
|
||||||
const persistConfig = {
|
const persistConfig = {
|
||||||
key: 'root',
|
key: 'root',
|
||||||
|
@ -55,7 +56,8 @@ const rootReducer = persistCombineReducers(persistConfig, {
|
||||||
envoieUserWalletToCashGetCommissionReducer: EnvoieUserWalletToCashGetCommissionReducer,
|
envoieUserWalletToCashGetCommissionReducer: EnvoieUserWalletToCashGetCommissionReducer,
|
||||||
envoieUserWalletToCardReducer: EnvoieUserWalletToCardReducer,
|
envoieUserWalletToCardReducer: EnvoieUserWalletToCardReducer,
|
||||||
envoieUserWalletToCardGetCommissionReducer: EnvoieUserWalletToCardGetCommissionReducer,
|
envoieUserWalletToCardGetCommissionReducer: EnvoieUserWalletToCardGetCommissionReducer,
|
||||||
linkCardReduder: LinkCardReducer
|
linkCardReduder: LinkCardReducer,
|
||||||
|
retraitCashAgentIdVerificationReducer: RetraitCashAgentIdVerificationReducer
|
||||||
});
|
});
|
||||||
|
|
||||||
export default rootReducer;
|
export default rootReducer;
|
|
@ -0,0 +1,4 @@
|
||||||
|
export const RETRAIT_CASH_AGENT_ID_VERIFICATION_PENDING = 'RETRAIT_CASH_AGENT_ID_VERIFICATION_PENDING';
|
||||||
|
export const RETRAIT_CASH_AGENT_ID_VERIFICATION_SUCCESS = 'RETRAIT_CASH_AGENT_ID_VERIFICATION_SUCCESS';
|
||||||
|
export const RETRAIT_CASH_AGENT_ID_VERIFICATION_ERROR = 'RETRAIT_CASH_AGENT_ID_VERIFICATION_ERROR';
|
||||||
|
export const RETRAIT_CASH_AGENT_ID_VERIFICATION_RESET = 'RETRAIT_CASH_AGENT_ID_VERIFICATION_RESET';
|
|
@ -45,5 +45,9 @@
|
||||||
"envoieWalletToBankUser": "envoieWalletToBankUser",
|
"envoieWalletToBankUser": "envoieWalletToBankUser",
|
||||||
"retraitWalletVersCashUser": "retraitWalletVersCashUser",
|
"retraitWalletVersCashUser": "retraitWalletVersCashUser",
|
||||||
"retraitCarteVersCashUser": "retraitCarteVersCashUser",
|
"retraitCarteVersCashUser": "retraitCarteVersCashUser",
|
||||||
"retraitCarteVersWalletUser": "retraitCarteVersWalletUser"
|
"retraitCarteVersWalletUser": "retraitCarteVersWalletUser",
|
||||||
|
"retraitEnCashAgent": "retraitEnCashAgent",
|
||||||
|
"retraitCarteVersCashAgent": "retraitCarteVersCashAgent",
|
||||||
|
"envoieCashVersWalletAgent": "envoieCashVersWalletAgent",
|
||||||
|
"envoieCashVersAutreWalletAgent": "envoieCashVersAutreWalletAgent"
|
||||||
}
|
}
|
||||||
|
|
|
@ -1390,7 +1390,7 @@ class Home extends BaseScreen {
|
||||||
translucent={true}
|
translucent={true}
|
||||||
/>
|
/>
|
||||||
{/* Start here to comment */}
|
{/* Start here to comment */}
|
||||||
{
|
{/* {
|
||||||
(this.state.loadingDialog || this.props.loading) ?
|
(this.state.loadingDialog || this.props.loading) ?
|
||||||
<View
|
<View
|
||||||
style={{ position: "absolute", zIndex: 1, backgroundColor: "#00000050", width: this.state.loadingDialog ? responsiveWidth(100) : 0, height: this.state.loadingDialog ? responsiveHeight(100) : 0, flex: 1, justifyContent: 'center', alignItems: 'center' }}
|
style={{ position: "absolute", zIndex: 1, backgroundColor: "#00000050", width: this.state.loadingDialog ? responsiveWidth(100) : 0, height: this.state.loadingDialog ? responsiveHeight(100) : 0, flex: 1, justifyContent: 'center', alignItems: 'center' }}
|
||||||
|
@ -1426,7 +1426,7 @@ class Home extends BaseScreen {
|
||||||
this.setState({ showProgress: false })
|
this.setState({ showProgress: false })
|
||||||
Alert.alert(I18n.t("PROBLEM_OCCUR"), I18n.t("PROBLEM_OCCUR_DIRECTION"), [{ text: "Ok", onPress: () => { } }])
|
Alert.alert(I18n.t("PROBLEM_OCCUR"), I18n.t("PROBLEM_OCCUR_DIRECTION"), [{ text: "Ok", onPress: () => { } }])
|
||||||
}}
|
}}
|
||||||
/>
|
/> */}
|
||||||
{this.makeCardSearch()}
|
{this.makeCardSearch()}
|
||||||
{this.makeSlidingUp()}
|
{this.makeSlidingUp()}
|
||||||
{this.makeDialogLoader()}
|
{this.makeDialogLoader()}
|
||||||
|
|
|
@ -255,7 +255,8 @@ export default class OptionsMenu extends Component {
|
||||||
|| item === 'walletDepot' || item === 'walletRetrait' || item === 'createIdentification' || item === 'walletOptionSelect' || item === 'validateIdentification'
|
|| item === 'walletDepot' || item === 'walletRetrait' || item === 'createIdentification' || item === 'walletOptionSelect' || item === 'validateIdentification'
|
||||||
|| item === 'createIdentificationUser' || item === 'operateurOptionSelect' || item === 'paiementFacture' || item === 'envoieWalletToWalletUser'
|
|| item === 'createIdentificationUser' || item === 'operateurOptionSelect' || item === 'paiementFacture' || item === 'envoieWalletToWalletUser'
|
||||||
|| item === 'envoieWalletToCashUser' || item === 'linkCard' || item === 'envoieWalletToCardUser' || item === 'envoieWalletToBankUser' || item === 'retraitWalletVersCashUser'
|
|| item === 'envoieWalletToCashUser' || item === 'linkCard' || item === 'envoieWalletToCardUser' || item === 'envoieWalletToBankUser' || item === 'retraitWalletVersCashUser'
|
||||||
|| item === 'retraitCarteVersWalletUser') {
|
|| item === 'retraitCarteVersWalletUser' || item === 'retraitEnCashAgent' || item === 'retraitCarteVersCashAgent' || item === 'envoieCashVersWalletAgent'
|
||||||
|
|| item === 'envoieCashVersAutreWalletAgent') {
|
||||||
return null
|
return null
|
||||||
} else {
|
} else {
|
||||||
const color = this.state.currentId === item.id ? theme.accent : "grey"
|
const color = this.state.currentId === item.id ? theme.accent : "grey"
|
||||||
|
|
|
@ -0,0 +1,777 @@
|
||||||
|
import Button from 'apsl-react-native-button';
|
||||||
|
import isEqual from 'lodash/isEqual';
|
||||||
|
import isNil from 'lodash/isNil';
|
||||||
|
import React, { Component } from 'react';
|
||||||
|
import { Alert, ScrollView, StyleSheet, Text, View } from 'react-native';
|
||||||
|
import * as Animatable from 'react-native-animatable';
|
||||||
|
import I18n from 'react-native-i18n';
|
||||||
|
import Dialog from "react-native-dialog";
|
||||||
|
import { Dropdown } from 'react-native-material-dropdown';
|
||||||
|
import { responsiveHeight, responsiveWidth } from 'react-native-responsive-dimensions';
|
||||||
|
import { ProgressDialog } from 'react-native-simple-dialogs';
|
||||||
|
import { Fumi } from 'react-native-textinput-effects';
|
||||||
|
import FontAwesomeIcon from 'react-native-vector-icons/FontAwesome';
|
||||||
|
import { connect } from 'react-redux';
|
||||||
|
import { bindActionCreators } from 'redux';
|
||||||
|
import { Color } from '../../../config/Color';
|
||||||
|
import { store } from "../../../redux/store";
|
||||||
|
import { identityPieces, isIlinkWorldWallet, isNormalInteger, typeIdIDestinataire, thousandsSeparators } from '../../../utils/UtilsFunction';
|
||||||
|
import { readUser } from '../../../webservice/AuthApi';
|
||||||
|
import { getActiveCountryAction, getActiveCountryByDialCodeAction, getActiveCountryByDialCodeReset, getActiveCountryReset, getPayCountryNetworkAction, getPayCountryNetworkReset } from '../../../webservice/CountryApi';
|
||||||
|
import { Typography, FontWeight } from '../../../config/typography';
|
||||||
|
import thousands from 'thousands';
|
||||||
|
import { IlinkEmitter } from '../../../utils/events';
|
||||||
|
let theme = require('../../../utils/theme.json');
|
||||||
|
let route = require('../../../route.json');
|
||||||
|
|
||||||
|
|
||||||
|
class EnvoieCashVersAutreWalletAgent extends Component {
|
||||||
|
static navigatorStyle = {
|
||||||
|
navBarBackgroundColor: Color.primaryColor,
|
||||||
|
statusBarColor: Color.primaryDarkColor,
|
||||||
|
navBarTextColor: '#FFFFFF',
|
||||||
|
navBarButtonColor: '#FFFFFF'
|
||||||
|
|
||||||
|
};
|
||||||
|
|
||||||
|
static navigationOptions = () => {
|
||||||
|
return {
|
||||||
|
drawerLabel: () => null,
|
||||||
|
headerTitle: I18n.t('DEPOSIT_CASH_TO_OTHER_WALLET'),
|
||||||
|
headerTintColor: 'white',
|
||||||
|
headerStyle: {
|
||||||
|
backgroundColor: Color.primaryColor,
|
||||||
|
marginTop: 0,
|
||||||
|
color: 'white'
|
||||||
|
},
|
||||||
|
headerTitleStyle: {
|
||||||
|
color: "white"
|
||||||
|
},
|
||||||
|
title: I18n.t('DEPOSIT_CASH_TO_OTHER_WALLET')
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
constructor(props) {
|
||||||
|
super(props);
|
||||||
|
this.state = {
|
||||||
|
identityPieces: identityPieces(),
|
||||||
|
identityPiecesName: (identityPieces()[0]).name,
|
||||||
|
paysDestination: [],
|
||||||
|
paysDestinationSelect: null,
|
||||||
|
walletActifs: [],
|
||||||
|
walletActifSelect: null,
|
||||||
|
noms: null,
|
||||||
|
prenoms: null,
|
||||||
|
numeroTelephone: null,
|
||||||
|
numeroIdentite: null,
|
||||||
|
montant: null,
|
||||||
|
password: null,
|
||||||
|
loading: false,
|
||||||
|
user: null,
|
||||||
|
modalVisible: true,
|
||||||
|
hasLoadActiveCountryList: true,
|
||||||
|
hasLoadActivePayCountryNetworkList: true,
|
||||||
|
triggerSubmitClick: false,
|
||||||
|
isDataSubmit: false,
|
||||||
|
isModalConfirmVisible: false,
|
||||||
|
wallet: store.getState().walletDetailReducer.result.response
|
||||||
|
};
|
||||||
|
|
||||||
|
this.props.getActiveCountryReset();
|
||||||
|
this.props.getActiveCountryByDialCodeReset();
|
||||||
|
this.props.getPayCountryNetworkReset();
|
||||||
|
this.props.envoieUserWalletToCashReset();
|
||||||
|
this.props.getCommissionUserWalletToCashReset();
|
||||||
|
|
||||||
|
this.props.getActiveCountryAction();
|
||||||
|
console.log("ENVOIE WALLET PROPS", this.props);
|
||||||
|
}
|
||||||
|
|
||||||
|
componentDidMount() {
|
||||||
|
|
||||||
|
readUser().then((user) => {
|
||||||
|
if (user) {
|
||||||
|
if (user !== undefined) {
|
||||||
|
this.setState({ user });
|
||||||
|
}
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
componentWillReceiveProps(nextProps) {
|
||||||
|
|
||||||
|
if (nextProps.resultEnvoieWalletToCashGetCommission != null) {
|
||||||
|
|
||||||
|
if (typeof nextProps.resultEnvoieWalletToCashGetCommission.response !== 'undefined') {
|
||||||
|
|
||||||
|
if (!nextProps.loadingEnvoieWalletToCashGetCommission)
|
||||||
|
this.setState({
|
||||||
|
isModalConfirmVisible: true
|
||||||
|
});
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
renderGetActionCountryList = () => {
|
||||||
|
|
||||||
|
const { resultActiveCountryList, errorActiveCountryList } = this.props;
|
||||||
|
if (resultActiveCountryList !== null) {
|
||||||
|
if (typeof resultActiveCountryList.response !== 'undefined') {
|
||||||
|
|
||||||
|
this.setState({
|
||||||
|
hasLoadActiveCountryList: false,
|
||||||
|
paysDestination: resultActiveCountryList.response,
|
||||||
|
paysDestinationSelect: resultActiveCountryList.response[0].name,
|
||||||
|
});
|
||||||
|
if (this.state.hasLoadActivePayCountryNetworkList)
|
||||||
|
this.props.getPayCountryNetworkAction({ id_wallet_user: this.state.wallet.id, id_country: resultActiveCountryList.response[0].id });
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (errorActiveCountryList !== null) {
|
||||||
|
if (typeof errorActiveCountryList.data !== 'undefined') {
|
||||||
|
Alert.alert(
|
||||||
|
I18n.t('ERROR_LABEL'),
|
||||||
|
errorActiveCountryList.data.error,
|
||||||
|
[
|
||||||
|
{
|
||||||
|
text: I18n.t("OK"), onPress: () => {
|
||||||
|
this.props.getActiveCountryReset();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
],
|
||||||
|
{ cancelable: false }
|
||||||
|
)
|
||||||
|
} else {
|
||||||
|
Alert.alert(
|
||||||
|
I18n.t('ERROR_LABEL'),
|
||||||
|
JSON.stringify(errorActiveCountryList),
|
||||||
|
[
|
||||||
|
{
|
||||||
|
text: I18n.t("OK"), onPress: () => {
|
||||||
|
this.props.getActiveCountryReset();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
],
|
||||||
|
{ cancelable: false }
|
||||||
|
)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
renderGetPayCountryNetworkResponse = () => {
|
||||||
|
const { resultPayCountryNetwork, errorPayCountryNetwork } = this.props;
|
||||||
|
if (resultPayCountryNetwork !== null) {
|
||||||
|
if (typeof resultPayCountryNetwork.response !== 'undefined') {
|
||||||
|
if (resultPayCountryNetwork.response.length > 0) {
|
||||||
|
this.setState({
|
||||||
|
hasLoadActivePayCountryNetworkList: false,
|
||||||
|
walletActifs: resultPayCountryNetwork.response,
|
||||||
|
walletActifSelect: resultPayCountryNetwork.response[0].name,
|
||||||
|
modalVisible: false
|
||||||
|
});
|
||||||
|
}
|
||||||
|
else if (resultPayCountryNetwork.response.length === 0) {
|
||||||
|
this.setState({
|
||||||
|
walletActifs: [],
|
||||||
|
walletActifSelect: '',
|
||||||
|
modalVisible: false,
|
||||||
|
hasLoadActivePayCountryNetworkList: false,
|
||||||
|
});
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (errorPayCountryNetwork !== null) {
|
||||||
|
if (typeof errorPayCountryNetwork.data !== 'undefined') {
|
||||||
|
Alert.alert(
|
||||||
|
I18n.t('ERROR_LABEL'),
|
||||||
|
errorPayCountryNetwork.data.error,
|
||||||
|
[
|
||||||
|
{
|
||||||
|
text: I18n.t("OK"), onPress: () => {
|
||||||
|
this.props.getPayCountryNetworkReset();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
],
|
||||||
|
{ cancelable: false }
|
||||||
|
)
|
||||||
|
} else {
|
||||||
|
Alert.alert(
|
||||||
|
I18n.t('ERROR_LABEL'),
|
||||||
|
JSON.stringify(errorPayCountryNetwork),
|
||||||
|
[
|
||||||
|
{
|
||||||
|
text: I18n.t("OK"), onPress: () => {
|
||||||
|
this.props.getPayCountryNetworkReset();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
],
|
||||||
|
{ cancelable: false }
|
||||||
|
)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
renderEnvoieWalletToWalletResponse = () => {
|
||||||
|
|
||||||
|
const { resultEnvoieWalletToCash, errorEnvoieWalletToCash } = this.props;
|
||||||
|
|
||||||
|
if (errorEnvoieWalletToCash !== null) {
|
||||||
|
if (typeof errorEnvoieWalletToCash.data !== 'undefined') {
|
||||||
|
Alert.alert(
|
||||||
|
I18n.t("ERROR_TRANSFER"),
|
||||||
|
errorEnvoieWalletToCash.data.error,
|
||||||
|
[
|
||||||
|
{
|
||||||
|
text: I18n.t("OK"), onPress: () => {
|
||||||
|
this.props.envoieUserWalletToCashReset();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
],
|
||||||
|
{ cancelable: false }
|
||||||
|
)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (resultEnvoieWalletToCash !== null) {
|
||||||
|
if (resultEnvoieWalletToCash.response !== null) {
|
||||||
|
Alert.alert(
|
||||||
|
I18n.t("SUCCESS_TRANSFER"),
|
||||||
|
resultEnvoieWalletToCash.response,
|
||||||
|
[
|
||||||
|
{
|
||||||
|
text: I18n.t("OK"), onPress: () => {
|
||||||
|
this.props.envoieUserWalletToCashReset();
|
||||||
|
IlinkEmitter.emit("refreshWallet");
|
||||||
|
this.props.navigation.pop();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
],
|
||||||
|
{ cancelable: false }
|
||||||
|
)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
renderDialogGetCommissionResponse = () => {
|
||||||
|
|
||||||
|
const { errorEnvoieWalletToCashGetCommission } = this.props;
|
||||||
|
|
||||||
|
if (errorEnvoieWalletToCashGetCommission !== null) {
|
||||||
|
if (typeof errorEnvoieWalletToCashGetCommission.data !== 'undefined') {
|
||||||
|
Alert.alert(
|
||||||
|
I18n.t("ERROR_LABLE"),
|
||||||
|
errorEnvoieWalletToCashGetCommission.data.error,
|
||||||
|
[
|
||||||
|
{
|
||||||
|
text: I18n.t("OK"), onPress: () => {
|
||||||
|
this.props.getCommissionUserWalletToCashReset();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
],
|
||||||
|
{ cancelable: false }
|
||||||
|
)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
ckeckIfFieldIsOK(champ) {
|
||||||
|
return (isNil(champ) || isEqual(champ.length, 0));
|
||||||
|
}
|
||||||
|
|
||||||
|
isMontantValid = () => {
|
||||||
|
const { montant } = this.state;
|
||||||
|
if ((parseInt(isEqual(montant, 0)) || montant < 0))
|
||||||
|
return {
|
||||||
|
errorMessage: I18n.t('ENTER_AMOUNT_SUPERIOR_ZEROR'),
|
||||||
|
isValid: false
|
||||||
|
};
|
||||||
|
|
||||||
|
else if (!isNormalInteger(montant))
|
||||||
|
return {
|
||||||
|
errorMessage: I18n.t('ENTER_VALID_AMOUNT'),
|
||||||
|
isValid: false
|
||||||
|
};
|
||||||
|
|
||||||
|
|
||||||
|
else if (montant > parseInt(this.state.comptePrincipal))
|
||||||
|
return {
|
||||||
|
errorMessage: I18n.t('AMOUNT_SUPERIOR_TO_PRINCIPAL_ACCOUNT'),
|
||||||
|
isValid: false
|
||||||
|
};
|
||||||
|
|
||||||
|
else
|
||||||
|
return {
|
||||||
|
errorMessage: '',
|
||||||
|
isValid: true
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
|
modalConfirmTransaction = (data) => {
|
||||||
|
const commission = data.response.frais;
|
||||||
|
const montant_net_final = data.response.montant_net_final;
|
||||||
|
const montant_net_init = data.response.montant_net_init;
|
||||||
|
const destinataire = data.response.destinataire;
|
||||||
|
|
||||||
|
console.log("DATA SEND TO CONFIRM DIALOG", data);
|
||||||
|
return (
|
||||||
|
|
||||||
|
<Dialog.Container useNativeDriver={true} visible={this.state.isModalConfirmVisible}>
|
||||||
|
|
||||||
|
<Dialog.Title>{I18n.t('TRANSACTION_DETAIL')}</Dialog.Title>
|
||||||
|
|
||||||
|
<View>
|
||||||
|
|
||||||
|
<View style={[styles.blockView, { borderBottomColor: Color.borderColor }]}>
|
||||||
|
<View style={{ flexDirection: 'row', marginTop: 10 }}>
|
||||||
|
<View style={{ flex: 1 }}>
|
||||||
|
<Text style={[styles.body2]}>{I18n.t('DESTINATAIRE')}</Text>
|
||||||
|
</View>
|
||||||
|
<View style={{ flex: 1, alignItems: 'flex-end' }}>
|
||||||
|
<Text style={[Typography.caption1, Color.grayColor]}>{destinataire}</Text>
|
||||||
|
</View>
|
||||||
|
</View>
|
||||||
|
<View style={{ flexDirection: 'row', marginTop: 10 }}>
|
||||||
|
<View style={{ flex: 1 }}>
|
||||||
|
<Text style={[styles.body2]}>{I18n.t('AMOUNT')}</Text>
|
||||||
|
</View>
|
||||||
|
<View style={{ flex: 1, alignItems: 'flex-end' }}>
|
||||||
|
<Text style={[Typography.caption1, Color.grayColor]}>{`${thousands(this.state.montant, ' ')} ${this.state.wallet.currency_code}`}</Text>
|
||||||
|
</View>
|
||||||
|
</View>
|
||||||
|
<View style={{ flexDirection: 'row', marginTop: 10 }}>
|
||||||
|
<View style={{ flex: 1 }}>
|
||||||
|
<Text tyle={[Typography.body2]}>{I18n.t('FEES_AND_TAXES')}</Text>
|
||||||
|
</View>
|
||||||
|
<View style={{ flex: 1, alignItems: 'flex-end' }}>
|
||||||
|
<Text style={[Typography.caption1, Color.grayColor]}>{`${thousands(commission, ' ')} ${this.state.wallet.currency_code}`}</Text>
|
||||||
|
</View>
|
||||||
|
</View>
|
||||||
|
</View>
|
||||||
|
<View style={{ paddingVertical: 10 }}>
|
||||||
|
<View style={{ flexDirection: 'row', marginTop: 10 }}>
|
||||||
|
<View style={{ flex: 1 }}>
|
||||||
|
<Text tyle={[Typography.body2, FontWeight.bold]}>{I18n.t('NET_AMOUNT')}:</Text>
|
||||||
|
</View>
|
||||||
|
<View style={{ flex: 1, alignItems: 'flex-end' }}>
|
||||||
|
<Text style={[Typography.caption1, Color.grayColor]}></Text>
|
||||||
|
</View>
|
||||||
|
</View>
|
||||||
|
<View style={{ flexDirection: 'row', marginTop: 10 }}>
|
||||||
|
<View style={{ flex: 1 }}>
|
||||||
|
<Text tyle={[Typography.body2]}>{I18n.t('INIT_COUNTRY')}</Text>
|
||||||
|
</View>
|
||||||
|
<View style={{ flex: 1, alignItems: 'flex-end' }}>
|
||||||
|
<Text style={[Typography.caption1, Color.grayColor]}>{`${thousands(montant_net_init, ' ')} ${this.state.wallet.currency_code}`}</Text>
|
||||||
|
</View>
|
||||||
|
</View>
|
||||||
|
<View style={{ flexDirection: 'row', marginTop: 10 }}>
|
||||||
|
<View style={{ flex: 1 }}>
|
||||||
|
<Text tyle={[Typography.body2]}>{I18n.t('FINAL_COUNTRY')}</Text>
|
||||||
|
</View>
|
||||||
|
<View style={{ flex: 1, alignItems: 'flex-end' }}>
|
||||||
|
<Text style={[Typography.caption1, Color.grayColor]}>{montant_net_final}</Text>
|
||||||
|
</View>
|
||||||
|
</View>
|
||||||
|
</View>
|
||||||
|
</View>
|
||||||
|
|
||||||
|
<Dialog.Button bold={true} label={I18n.t('CANCEL_LABEL')} onPress={() => {
|
||||||
|
this.setState({
|
||||||
|
isModalConfirmVisible: false
|
||||||
|
});
|
||||||
|
}} />
|
||||||
|
<Dialog.Button bold={true} label={I18n.t('SUBMIT_LABEL')} onPress={() => {
|
||||||
|
this.setState({
|
||||||
|
isModalConfirmVisible: false,
|
||||||
|
isDataSubmit: true
|
||||||
|
});
|
||||||
|
this.props.envoieUserWalletToCashAction({
|
||||||
|
type: 3,
|
||||||
|
id_wallet_user: this.state.wallet.id,
|
||||||
|
final_country: (this.state.paysDestination.filter(element => element.name === this.state.paysDestinationSelect))[0].id,
|
||||||
|
id_destinataire: this.state.numeroTelephone,
|
||||||
|
type_document_destinataire: this.state.identityPiecesName,
|
||||||
|
nom_destinataire: this.state.noms,
|
||||||
|
prenom_destinataire: this.state.prenoms,
|
||||||
|
id_document_destinataire: this.state.numeroIdentite,
|
||||||
|
network_destinataire: (this.state.walletActifs.filter(element => element.name === this.state.walletActifSelect))[0].id,
|
||||||
|
montant: this.state.montant,
|
||||||
|
password: this.state.password
|
||||||
|
});
|
||||||
|
this.props.getCommissionUserWalletToCashReset();
|
||||||
|
}} />
|
||||||
|
|
||||||
|
</Dialog.Container>
|
||||||
|
|
||||||
|
);
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
onSubmitSendWalletToWallet = () => {
|
||||||
|
const { identityPiecesName, noms, prenoms, paysDestinationSelect, numeroIdentite, walletActifSelect, typeIdDestinataireSelect, numeroTelephone, montant, password } = this.state;
|
||||||
|
|
||||||
|
if (this.ckeckIfFieldIsOK(identityPiecesName))
|
||||||
|
this.identityPiecesAnim.shake(800);
|
||||||
|
else if (this.ckeckIfFieldIsOK(paysDestinationSelect))
|
||||||
|
this.paysDestinationAnim.shake(800);
|
||||||
|
else if (this.ckeckIfFieldIsOK(walletActifSelect))
|
||||||
|
this.walletActifAnim.shake(800);
|
||||||
|
else if (this.ckeckIfFieldIsOK(noms))
|
||||||
|
this.firstnameAnim.shake(800);
|
||||||
|
else if (this.ckeckIfFieldIsOK(prenoms))
|
||||||
|
this.lastnameAnim.shake(800);
|
||||||
|
else if (this.ckeckIfFieldIsOK(numeroIdentite))
|
||||||
|
this.numeroIdentiteAnim.shake(800);
|
||||||
|
else if (this.ckeckIfFieldIsOK(numeroTelephone))
|
||||||
|
this.numeroTelephoneAnim.shake(800);
|
||||||
|
else if (this.ckeckIfFieldIsOK(montant) || !this.isMontantValid().isValid) {
|
||||||
|
console.log("IS MONTANT VALID", this.isMontantValid())
|
||||||
|
this.montantAnim.shake(800);
|
||||||
|
}
|
||||||
|
else if (this.ckeckIfFieldIsOK(password))
|
||||||
|
this.passwordAnim.shake(800);
|
||||||
|
else {
|
||||||
|
|
||||||
|
this.props.getCommissionUserWalletToCashAction({
|
||||||
|
type: 3,
|
||||||
|
id_wallet_user: this.state.wallet.id,
|
||||||
|
final_country: (this.state.paysDestination.filter(element => element.name === this.state.paysDestinationSelect))[0].id,
|
||||||
|
montant: this.state.montant,
|
||||||
|
});
|
||||||
|
|
||||||
|
}
|
||||||
|
this.setState({
|
||||||
|
triggerSubmitClick: true
|
||||||
|
})
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
renderLoader = () => {
|
||||||
|
return (
|
||||||
|
<ProgressDialog
|
||||||
|
visible={this.state.modalVisible || this.props.loadingEnvoieWalletToCashGetCommission || this.props.loadingEnvoieWalletToCash || this.props.loadingCountryByDialCode || this.props.loadingActiveCountryList || this.props.loadingCountryByDialCode}
|
||||||
|
title={I18n.t('LOADING')}
|
||||||
|
message={I18n.t('LOADING_INFO')}
|
||||||
|
/>
|
||||||
|
)
|
||||||
|
}
|
||||||
|
|
||||||
|
render() {
|
||||||
|
console.log("STATE", this.state);
|
||||||
|
const { resultEnvoieWalletToCashGetCommission } = this.props;
|
||||||
|
return (
|
||||||
|
<>
|
||||||
|
{(this.state.modalVisible || this.props.loadingEnvoieWalletToCashGetCommission || this.props.loadingEnvoieWalletToCash || this.props.loadingCountryByDialCode || this.props.loadingActiveCountryList || this.props.loadingCountryByDialCode) && this.renderLoader()}
|
||||||
|
{this.state.hasLoadActiveCountryList && this.renderGetActionCountryList()}
|
||||||
|
{this.state.hasLoadActivePayCountryNetworkList && this.renderGetPayCountryNetworkResponse()}
|
||||||
|
{this.state.isDataSubmit && this.renderEnvoieWalletToWalletResponse()}
|
||||||
|
{this.state.triggerSubmitClick && this.renderDialogGetCommissionResponse()}
|
||||||
|
{
|
||||||
|
(resultEnvoieWalletToCashGetCommission !== null) &&
|
||||||
|
(typeof resultEnvoieWalletToCashGetCommission.response !== 'undefined') &&
|
||||||
|
this.modalConfirmTransaction(resultEnvoieWalletToCashGetCommission)
|
||||||
|
}
|
||||||
|
<ScrollView style={styles.container}>
|
||||||
|
|
||||||
|
<Text style={styles.subbigtitle}>{I18n.t('ENVOIE_WALLET_TO_CASH')}</Text>
|
||||||
|
|
||||||
|
<Animatable.View ref={(comp) => { this.paysDestinationAnim = comp }}
|
||||||
|
style={{
|
||||||
|
width: responsiveWidth(90),
|
||||||
|
height: 60,
|
||||||
|
marginTop: 20,
|
||||||
|
alignSelf: 'center',
|
||||||
|
borderRadius: 10,
|
||||||
|
paddingLeft: 20,
|
||||||
|
paddingRight: 20,
|
||||||
|
backgroundColor: 'white'
|
||||||
|
}}>
|
||||||
|
<Dropdown
|
||||||
|
label={I18n.t('PAYS_DESTINATION')}
|
||||||
|
data={this.state.paysDestination}
|
||||||
|
useNativeDriver={true}
|
||||||
|
value={this.state.paysDestinationSelect === null ? '' : this.state.paysDestinationSelect}
|
||||||
|
onChangeText={(value, index, data) => {
|
||||||
|
this.props.getPayCountryNetworkReset();
|
||||||
|
|
||||||
|
let countrySelect = data.filter(element => element.name === value);
|
||||||
|
this.setState({ paysDestinationSelect: value, hasLoadActivePayCountryNetworkList: true }, () => {
|
||||||
|
this.props.getPayCountryNetworkAction({ id_wallet_user: this.state.wallet.id, id_country: countrySelect[0].id });
|
||||||
|
});
|
||||||
|
this.props.getCommissionUserWalletToCashReset();
|
||||||
|
}}
|
||||||
|
valueExtractor={(value) => { return value.name }}
|
||||||
|
labelExtractor={(value) => { return value.name }}
|
||||||
|
/>
|
||||||
|
</Animatable.View>
|
||||||
|
|
||||||
|
<Animatable.View ref={(comp) => { this.walletActifAnim = comp }}
|
||||||
|
style={{
|
||||||
|
width: responsiveWidth(90),
|
||||||
|
height: 60,
|
||||||
|
marginTop: 20,
|
||||||
|
alignSelf: 'center',
|
||||||
|
borderRadius: 10,
|
||||||
|
paddingLeft: 20,
|
||||||
|
paddingRight: 20,
|
||||||
|
backgroundColor: 'white'
|
||||||
|
}}>
|
||||||
|
<Dropdown
|
||||||
|
label={I18n.t('ACTIVE_WALLET')}
|
||||||
|
data={this.state.walletActifs}
|
||||||
|
useNativeDriver={true}
|
||||||
|
value={isNil(this.state.walletActifSelect) ? '' : this.state.walletActifSelect}
|
||||||
|
onChangeText={(value, index, data) => {
|
||||||
|
this.setState({
|
||||||
|
walletActifSelect: value,
|
||||||
|
});
|
||||||
|
|
||||||
|
}}
|
||||||
|
valueExtractor={(value) => { return value.name }}
|
||||||
|
labelExtractor={(value) => { return value.name }}
|
||||||
|
/>
|
||||||
|
</Animatable.View>
|
||||||
|
|
||||||
|
<Animatable.View ref={(comp) => { this.firstnameAnim = comp }}>
|
||||||
|
<Fumi iconClass={FontAwesomeIcon} iconName={'user'}
|
||||||
|
label={`${I18n.t('NAME')}`}
|
||||||
|
iconColor={'#f95a25'}
|
||||||
|
iconSize={20}
|
||||||
|
value={this.state.noms}
|
||||||
|
onChangeText={(noms) => {
|
||||||
|
this.setState({ noms })
|
||||||
|
}}
|
||||||
|
style={styles.input}
|
||||||
|
>
|
||||||
|
</Fumi>
|
||||||
|
</Animatable.View>
|
||||||
|
|
||||||
|
<Animatable.View ref={(comp) => { this.lastnameAnim = comp }}>
|
||||||
|
<Fumi iconClass={FontAwesomeIcon} iconName={'user-circle-o'}
|
||||||
|
label={`${I18n.t('FIRSTNAME')}`}
|
||||||
|
iconColor={'#f95a25'}
|
||||||
|
iconSize={20}
|
||||||
|
value={this.state.prenoms}
|
||||||
|
onChangeText={(prenoms) => {
|
||||||
|
this.setState({ prenoms })
|
||||||
|
}}
|
||||||
|
style={styles.input}
|
||||||
|
>
|
||||||
|
</Fumi>
|
||||||
|
</Animatable.View>
|
||||||
|
|
||||||
|
<Animatable.View ref={(comp) => { this.numeroTelephoneAnim = comp }}>
|
||||||
|
<Fumi iconClass={FontAwesomeIcon} iconName={isEqual(this.state.typeIdDestinataireSelect, I18n.t('PHONE')) ? 'phone' : 'lock'}
|
||||||
|
label={I18n.t('PHONE')}
|
||||||
|
iconColor={'#f95a25'}
|
||||||
|
keyboardType='phone-pad'
|
||||||
|
iconSize={20}
|
||||||
|
value={this.state.numeroTelephone}
|
||||||
|
onChangeText={(numeroTelephone) => {
|
||||||
|
this.setState({ numeroTelephone })
|
||||||
|
}}
|
||||||
|
style={styles.input}
|
||||||
|
>
|
||||||
|
</Fumi>
|
||||||
|
</Animatable.View>
|
||||||
|
|
||||||
|
<Animatable.View ref={(comp) => { this.identityPiecesAnim = comp }}
|
||||||
|
style={{
|
||||||
|
width: responsiveWidth(90),
|
||||||
|
height: 60,
|
||||||
|
marginTop: 20,
|
||||||
|
alignSelf: 'center',
|
||||||
|
borderRadius: 10,
|
||||||
|
paddingLeft: 20,
|
||||||
|
paddingRight: 20,
|
||||||
|
backgroundColor: 'white'
|
||||||
|
}}>
|
||||||
|
<Dropdown
|
||||||
|
label={I18n.t('PIECE_IDENTITE')}
|
||||||
|
data={this.state.identityPieces}
|
||||||
|
useNativeDriver={true}
|
||||||
|
value={this.state.identityPiecesName}
|
||||||
|
onChangeText={(value, index, data) => {
|
||||||
|
this.setState({ identityPiecesName: value });
|
||||||
|
}}
|
||||||
|
valueExtractor={(value) => { return value.name }}
|
||||||
|
labelExtractor={(value) => { return value.name }}
|
||||||
|
/>
|
||||||
|
</Animatable.View>
|
||||||
|
|
||||||
|
<Animatable.View ref={(comp) => { this.numeroIdentiteAnim = comp }}>
|
||||||
|
<Fumi iconClass={FontAwesomeIcon} iconName={'address-card'}
|
||||||
|
label={`${I18n.t('NUMERO_IDENTITE')}`}
|
||||||
|
iconColor={'#f95a25'}
|
||||||
|
iconSize={20}
|
||||||
|
onChangeText={(numeroIdentite) => {
|
||||||
|
this.setState({ numeroIdentite })
|
||||||
|
}}
|
||||||
|
style={styles.input}
|
||||||
|
>
|
||||||
|
</Fumi>
|
||||||
|
</Animatable.View>
|
||||||
|
|
||||||
|
<Animatable.View ref={(comp) => { this.montantAnim = comp }}>
|
||||||
|
<Fumi iconClass={FontAwesomeIcon} iconName={'money'}
|
||||||
|
label={I18n.t('AMOUNT')}
|
||||||
|
iconColor={'#f95a25'}
|
||||||
|
keyboardType='numeric'
|
||||||
|
iconSize={20}
|
||||||
|
value={this.state.montant}
|
||||||
|
onChangeText={(montant) => {
|
||||||
|
this.setState({ montant })
|
||||||
|
}}
|
||||||
|
style={styles.input}
|
||||||
|
>
|
||||||
|
</Fumi>
|
||||||
|
<View style={{
|
||||||
|
position: 'absolute',
|
||||||
|
left: responsiveWidth(82),
|
||||||
|
top: 35,
|
||||||
|
flexDirection: 'row'
|
||||||
|
}}>
|
||||||
|
<View
|
||||||
|
style={{
|
||||||
|
width: 1,
|
||||||
|
borderLeftColor: '#f0f0f0',
|
||||||
|
height: 40,
|
||||||
|
left: -8,
|
||||||
|
top: -10,
|
||||||
|
borderLeftWidth: 1,
|
||||||
|
|
||||||
|
}}
|
||||||
|
/>
|
||||||
|
<Text style={[Typography.body1, FontWeight.bold]}>{this.state.wallet.currency_code}</Text>
|
||||||
|
</View>
|
||||||
|
</Animatable.View>
|
||||||
|
|
||||||
|
<Animatable.View ref={(comp) => { this.passwordAnim = comp }}>
|
||||||
|
<Fumi iconClass={FontAwesomeIcon} iconName={'lock'}
|
||||||
|
label={I18n.t('PASSWORD')}
|
||||||
|
iconColor={'#f95a25'}
|
||||||
|
iconSize={20}
|
||||||
|
secureTextEntry={true}
|
||||||
|
value={this.state.password}
|
||||||
|
onChangeText={(password) => {
|
||||||
|
this.setState({ password })
|
||||||
|
}}
|
||||||
|
style={styles.input}
|
||||||
|
>
|
||||||
|
</Fumi>
|
||||||
|
</Animatable.View>
|
||||||
|
|
||||||
|
<Button style={styles.btnvalide}
|
||||||
|
textStyle={styles.textbtnvalide}
|
||||||
|
isLoading={this.state.isLoging}
|
||||||
|
onPress={() => { this.onSubmitSendWalletToWallet() }}>
|
||||||
|
{I18n.t('SUBMIT_LABEL')}</Button>
|
||||||
|
</ScrollView>
|
||||||
|
</>
|
||||||
|
)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
const maptStateToProps = state => ({
|
||||||
|
loadingCountryByDialCode: state.countryByDialCode.loading,
|
||||||
|
resultCountryByDialCode: state.countryByDialCode.result,
|
||||||
|
errorCountryByDialCode: state.countryByDialCode.error,
|
||||||
|
|
||||||
|
loadingActiveCountryList: state.activeCountryListReducer.loading,
|
||||||
|
resultActiveCountryList: state.activeCountryListReducer.result,
|
||||||
|
errorActiveCountryList: state.activeCountryListReducer.error,
|
||||||
|
|
||||||
|
loadingPayCountryNetwork: state.payCountryNetworkReducer.loading,
|
||||||
|
resultPayCountryNetwork: state.payCountryNetworkReducer.result,
|
||||||
|
errorPayCountryNetwork: state.payCountryNetworkReducer.error,
|
||||||
|
|
||||||
|
loadingEnvoieWalletToCash: state.envoieUserWalletToCashReducer.loading,
|
||||||
|
resultEnvoieWalletToCash: state.envoieUserWalletToCashReducer.result,
|
||||||
|
errorEnvoieWalletToCash: state.envoieUserWalletToCashReducer.error,
|
||||||
|
|
||||||
|
loadingEnvoieWalletToCashGetCommission: state.envoieUserWalletToCashGetCommissionReducer.loading,
|
||||||
|
resultEnvoieWalletToCashGetCommission: state.envoieUserWalletToCashGetCommissionReducer.result,
|
||||||
|
errorEnvoieWalletToCashGetCommission: state.envoieUserWalletToCashGetCommissionReducer.error,
|
||||||
|
});
|
||||||
|
|
||||||
|
const mapDispatchToProps = dispatch => bindActionCreators({
|
||||||
|
getActiveCountryByDialCodeAction,
|
||||||
|
getActiveCountryByDialCodeReset,
|
||||||
|
|
||||||
|
getPayCountryNetworkAction,
|
||||||
|
getPayCountryNetworkReset,
|
||||||
|
|
||||||
|
getActiveCountryAction,
|
||||||
|
getActiveCountryReset,
|
||||||
|
|
||||||
|
envoieUserWalletToCashAction,
|
||||||
|
envoieUserWalletToCashReset,
|
||||||
|
|
||||||
|
getCommissionUserWalletToCashAction,
|
||||||
|
getCommissionUserWalletToCashReset
|
||||||
|
|
||||||
|
}, dispatch);
|
||||||
|
|
||||||
|
export default connect(maptStateToProps, mapDispatchToProps)(EnvoieCashVersAutreWalletAgent);
|
||||||
|
|
||||||
|
const styles = StyleSheet.create({
|
||||||
|
container: {
|
||||||
|
flex: 1,
|
||||||
|
backgroundColor: Color.primaryDarkColor,
|
||||||
|
},
|
||||||
|
textbtnvalide: {
|
||||||
|
color: 'white',
|
||||||
|
fontWeight: 'bold'
|
||||||
|
},
|
||||||
|
bigtitle: {
|
||||||
|
color: 'white',
|
||||||
|
fontSize: 20,
|
||||||
|
flex: 1,
|
||||||
|
fontWeight: 'bold',
|
||||||
|
textAlign: 'center',
|
||||||
|
margin: 20,
|
||||||
|
},
|
||||||
|
blockView: {
|
||||||
|
paddingVertical: 10,
|
||||||
|
borderBottomWidth: 1
|
||||||
|
},
|
||||||
|
subbigtitle: {
|
||||||
|
color: 'white',
|
||||||
|
fontSize: 17,
|
||||||
|
textAlign: 'center',
|
||||||
|
margin: 5,
|
||||||
|
},
|
||||||
|
btnvalide: {
|
||||||
|
marginTop: 20,
|
||||||
|
marginLeft: 20,
|
||||||
|
marginRight: 20,
|
||||||
|
borderColor: 'transparent',
|
||||||
|
backgroundColor: Color.accentLightColor,
|
||||||
|
height: 52
|
||||||
|
},
|
||||||
|
btnSubmit: {
|
||||||
|
marginTop: 20,
|
||||||
|
borderColor: 'transparent',
|
||||||
|
backgroundColor: Color.accentLightColor,
|
||||||
|
height: 52,
|
||||||
|
width: "30%",
|
||||||
|
marginLeft: 20,
|
||||||
|
marginRight: 20,
|
||||||
|
},
|
||||||
|
input: {
|
||||||
|
height: 60,
|
||||||
|
marginTop: responsiveHeight(2),
|
||||||
|
marginLeft: responsiveWidth(5),
|
||||||
|
marginRight: responsiveWidth(5),
|
||||||
|
borderRadius: 5,
|
||||||
|
}
|
||||||
|
});
|
|
@ -0,0 +1,466 @@
|
||||||
|
import Button from 'apsl-react-native-button';
|
||||||
|
import isEqual from 'lodash/isEqual';
|
||||||
|
import isNil from 'lodash/isNil';
|
||||||
|
import React, { Component } from 'react';
|
||||||
|
import { Alert, ScrollView, StyleSheet, Text, View } from 'react-native';
|
||||||
|
import * as Animatable from 'react-native-animatable';
|
||||||
|
import Dialog from "react-native-dialog";
|
||||||
|
import I18n from 'react-native-i18n';
|
||||||
|
import { responsiveHeight, responsiveWidth } from 'react-native-responsive-dimensions';
|
||||||
|
import { ProgressDialog } from 'react-native-simple-dialogs';
|
||||||
|
import FontAwesomeIcon from 'react-native-vector-icons/FontAwesome';
|
||||||
|
import { Fumi } from 'react-native-textinput-effects';
|
||||||
|
import { connect } from 'react-redux';
|
||||||
|
import { bindActionCreators } from 'redux';
|
||||||
|
import thousands from 'thousands';
|
||||||
|
import { Color } from '../../../config/Color';
|
||||||
|
import { FontWeight, Typography } from '../../../config/typography';
|
||||||
|
import { store } from "../../../redux/store";
|
||||||
|
import { IlinkEmitter } from '../../../utils/events';
|
||||||
|
import { readUser } from '../../../webservice/AuthApi';
|
||||||
|
import { envoieUserWalletToCardAction, envoieUserWalletToCardReset, getCommissionUserWalletToCardAction, getCommissionUserWalletToCardReset } from '../../../webservice/EnvoieUserApi';
|
||||||
|
import { isNormalInteger } from '../../../utils/UtilsFunction';
|
||||||
|
let theme = require('../../../utils/theme.json');
|
||||||
|
let route = require('../../../route.json');
|
||||||
|
|
||||||
|
|
||||||
|
class EnvoieCashVersWalletAgent extends Component {
|
||||||
|
|
||||||
|
static navigatorStyle = {
|
||||||
|
navBarBackgroundColor: Color.primaryColor,
|
||||||
|
statusBarColor: Color.primaryDarkColor,
|
||||||
|
navBarTextColor: '#FFFFFF',
|
||||||
|
navBarButtonColor: '#FFFFFF'
|
||||||
|
|
||||||
|
};
|
||||||
|
|
||||||
|
static navigationOptions = () => {
|
||||||
|
return {
|
||||||
|
drawerLabel: () => null,
|
||||||
|
headerTitle: I18n.t('DEPOSIT_CASH_TO_WALLET'),
|
||||||
|
headerTintColor: 'white',
|
||||||
|
headerStyle: {
|
||||||
|
backgroundColor: Color.primaryColor,
|
||||||
|
marginTop: 0,
|
||||||
|
color: 'white'
|
||||||
|
},
|
||||||
|
headerTitleStyle: {
|
||||||
|
color: "white"
|
||||||
|
},
|
||||||
|
title: I18n.t('DEPOSIT_CASH_TO_WALLET')
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
constructor(props) {
|
||||||
|
super(props);
|
||||||
|
this.state = {
|
||||||
|
montant: null,
|
||||||
|
password: null,
|
||||||
|
userCode: null,
|
||||||
|
loading: false,
|
||||||
|
user: null,
|
||||||
|
triggerSubmitClick: false,
|
||||||
|
isSubmitClick: false,
|
||||||
|
isDataSubmit: false,
|
||||||
|
isModalConfirmVisible: false,
|
||||||
|
wallet: store.getState().walletDetailReducer.result.response
|
||||||
|
};
|
||||||
|
|
||||||
|
this.props.envoieUserWalletToCardReset();
|
||||||
|
this.props.getCommissionUserWalletToCardReset();
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
componentDidMount() {
|
||||||
|
|
||||||
|
readUser().then((user) => {
|
||||||
|
if (user) {
|
||||||
|
if (user !== undefined) {
|
||||||
|
this.setState({ user });
|
||||||
|
}
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
componentWillReceiveProps(nextProps) {
|
||||||
|
|
||||||
|
console.log('PROPS', nextProps)
|
||||||
|
|
||||||
|
if (nextProps.resultEnvoieWalletToCardGetCommission != null) {
|
||||||
|
|
||||||
|
if (typeof nextProps.resultEnvoieWalletToCardGetCommission.response !== 'undefined') {
|
||||||
|
|
||||||
|
if (!nextProps.loadingEnvoieWalletToCardGetCommission)
|
||||||
|
this.setState({
|
||||||
|
isModalConfirmVisible: true
|
||||||
|
});
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
renderEnvoieWalletToWalletResponse = () => {
|
||||||
|
|
||||||
|
const { resultEnvoieWalletToCard, errorEnvoieWalletToCard } = this.props;
|
||||||
|
|
||||||
|
if (errorEnvoieWalletToCard !== null) {
|
||||||
|
if (typeof errorEnvoieWalletToCard.data !== 'undefined') {
|
||||||
|
Alert.alert(
|
||||||
|
I18n.t("ERROR_TRANSFER"),
|
||||||
|
errorEnvoieWalletToCard.data.error,
|
||||||
|
[
|
||||||
|
{
|
||||||
|
text: I18n.t("OK"), onPress: () => {
|
||||||
|
this.props.envoieUserWalletToCardReset();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
],
|
||||||
|
{ cancelable: false }
|
||||||
|
)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (resultEnvoieWalletToCard !== null) {
|
||||||
|
if (resultEnvoieWalletToCard.response !== null) {
|
||||||
|
Alert.alert(
|
||||||
|
I18n.t("SUCCESS_TRANSFER"),
|
||||||
|
resultEnvoieWalletToCard.response,
|
||||||
|
[
|
||||||
|
{
|
||||||
|
text: I18n.t("OK"), onPress: () => {
|
||||||
|
this.props.envoieUserWalletToCardReset();
|
||||||
|
IlinkEmitter.emit("refreshWallet");
|
||||||
|
this.props.navigation.pop();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
],
|
||||||
|
{ cancelable: false }
|
||||||
|
)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
renderDialogGetCommissionResponse = () => {
|
||||||
|
|
||||||
|
const { errorEnvoieWalletToCardGetCommission } = this.props;
|
||||||
|
|
||||||
|
if (errorEnvoieWalletToCardGetCommission !== null) {
|
||||||
|
if (typeof errorEnvoieWalletToCardGetCommission.data !== 'undefined') {
|
||||||
|
Alert.alert(
|
||||||
|
I18n.t("ERROR_LABLE"),
|
||||||
|
errorEnvoieWalletToCardGetCommission.data.error,
|
||||||
|
[
|
||||||
|
{
|
||||||
|
text: I18n.t("OK"), onPress: () => {
|
||||||
|
this.props.getCommissionUserWalletToCardReset();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
],
|
||||||
|
{ cancelable: false }
|
||||||
|
)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
updateLangue() {
|
||||||
|
this.props.navigation.setParams({ name: I18n.t('DEPOSIT_TO_CARD') })
|
||||||
|
this.forceUpdate()
|
||||||
|
}
|
||||||
|
|
||||||
|
modalConfirmTransaction = (data) => {
|
||||||
|
|
||||||
|
const frais = data.response.frais;
|
||||||
|
const montant_net = data.response.montant_net_init;
|
||||||
|
|
||||||
|
return (
|
||||||
|
|
||||||
|
<Dialog.Container useNativeDriver={true} visible={this.state.isModalConfirmVisible}>
|
||||||
|
|
||||||
|
<Dialog.Title>{I18n.t('TRANSACTION_DETAIL')}</Dialog.Title>
|
||||||
|
|
||||||
|
<View>
|
||||||
|
|
||||||
|
<View style={[styles.blockView, { borderBottomColor: Color.borderColor }]}>
|
||||||
|
<View style={{ flexDirection: 'row', marginTop: 10 }}>
|
||||||
|
<View style={{ flex: 1 }}>
|
||||||
|
<Text style={[styles.body2]}>{I18n.t('AMOUNT')}</Text>
|
||||||
|
</View>
|
||||||
|
<View style={{ flex: 1, alignItems: 'flex-end' }}>
|
||||||
|
<Text style={[Typography.caption1, Color.grayColor]}>{`${thousands(this.state.montant, ' ')} ${this.state.wallet.currency_code}`}</Text>
|
||||||
|
</View>
|
||||||
|
</View>
|
||||||
|
<View style={{ flexDirection: 'row', marginTop: 10 }}>
|
||||||
|
<View style={{ flex: 1 }}>
|
||||||
|
<Text tyle={[Typography.body2]}>{I18n.t('FEES_AND_TAXES')}</Text>
|
||||||
|
</View>
|
||||||
|
<View style={{ flex: 1, alignItems: 'flex-end' }}>
|
||||||
|
<Text style={[Typography.caption1, Color.grayColor]}>{`${thousands(frais, ' ')} ${this.state.wallet.currency_code}`}</Text>
|
||||||
|
</View>
|
||||||
|
</View>
|
||||||
|
</View>
|
||||||
|
<View style={{ paddingVertical: 10 }}>
|
||||||
|
<View style={{ flexDirection: 'row', marginTop: 10 }}>
|
||||||
|
<View style={{ flex: 1 }}>
|
||||||
|
<Text tyle={[Typography.body2, FontWeight.bold]}>{I18n.t('NET_AMOUNT')}:</Text>
|
||||||
|
</View>
|
||||||
|
<View style={{ flex: 1, alignItems: 'flex-end' }}>
|
||||||
|
<Text style={[Typography.caption1, Color.grayColor]}>{`${thousands(montant_net, ' ')} ${this.state.wallet.currency_code}`}</Text>
|
||||||
|
</View>
|
||||||
|
</View>
|
||||||
|
</View>
|
||||||
|
</View>
|
||||||
|
|
||||||
|
<Dialog.Button bold={true} label={I18n.t('CANCEL_LABEL')} onPress={() => {
|
||||||
|
this.setState({
|
||||||
|
isModalConfirmVisible: false
|
||||||
|
});
|
||||||
|
}} />
|
||||||
|
<Dialog.Button bold={true} label={I18n.t('SUBMIT_LABEL')} onPress={() => {
|
||||||
|
this.setState({
|
||||||
|
isModalConfirmVisible: false,
|
||||||
|
isDataSubmit: true
|
||||||
|
});
|
||||||
|
this.props.envoieUserWalletToCardAction({
|
||||||
|
type: 14,
|
||||||
|
user_code: this.state.userCode,
|
||||||
|
id_wallet_agent: this.state.wallet.id,
|
||||||
|
montant: this.state.montant,
|
||||||
|
password: this.state.password
|
||||||
|
});
|
||||||
|
this.props.getCommissionUserWalletToCardReset();
|
||||||
|
}} />
|
||||||
|
|
||||||
|
</Dialog.Container>
|
||||||
|
|
||||||
|
);
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
ckeckIfFieldIsOK(champ) {
|
||||||
|
return (isNil(champ) || isEqual(champ.length, 0));
|
||||||
|
}
|
||||||
|
|
||||||
|
isMontantValid = () => {
|
||||||
|
const { montant } = this.state;
|
||||||
|
if ((parseInt(isEqual(montant, 0)) || montant < 0))
|
||||||
|
return {
|
||||||
|
errorMessage: I18n.t('ENTER_AMOUNT_SUPERIOR_ZEROR'),
|
||||||
|
isValid: false
|
||||||
|
};
|
||||||
|
|
||||||
|
else if (!isNormalInteger(montant))
|
||||||
|
return {
|
||||||
|
errorMessage: I18n.t('ENTER_VALID_AMOUNT'),
|
||||||
|
isValid: false
|
||||||
|
};
|
||||||
|
|
||||||
|
else
|
||||||
|
return {
|
||||||
|
errorMessage: '',
|
||||||
|
isValid: true
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
|
onSubmitSendWalletToCard = () => {
|
||||||
|
const { userCode, montant, password } = this.state;
|
||||||
|
|
||||||
|
if (this.ckeckIfFieldIsOK(userCode))
|
||||||
|
this.userCodeAnim.shake(800);
|
||||||
|
else if (this.ckeckIfFieldIsOK(montant) || !this.isMontantValid().isValid) {
|
||||||
|
this.montantAnim.shake(800);
|
||||||
|
}
|
||||||
|
else if (this.ckeckIfFieldIsOK(password))
|
||||||
|
this.passwordAnim.shake(800);
|
||||||
|
else {
|
||||||
|
|
||||||
|
this.props.getCommissionUserWalletToCardAction({
|
||||||
|
type: 14,
|
||||||
|
user_code: userCode,
|
||||||
|
id_wallet_agent: this.state.wallet.id,
|
||||||
|
montant: this.state.montant,
|
||||||
|
});
|
||||||
|
|
||||||
|
}
|
||||||
|
this.setState({
|
||||||
|
triggerSubmitClick: true
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
renderLoader = () => {
|
||||||
|
return (
|
||||||
|
<ProgressDialog
|
||||||
|
visible={this.props.loadingEnvoieWalletToCard || this.props.loadingEnvoieWalletToCardGetCommission}
|
||||||
|
title={I18n.t('LOADING')}
|
||||||
|
message={I18n.t('LOADING_INFO')}
|
||||||
|
/>
|
||||||
|
)
|
||||||
|
}
|
||||||
|
|
||||||
|
render() {
|
||||||
|
const { resultEnvoieWalletToCardGetCommission } = this.props;
|
||||||
|
return (
|
||||||
|
<>
|
||||||
|
{(this.props.loadingEnvoieWalletToCard || this.props.loadingEnvoieWalletToCardGetCommission) && this.renderLoader()}
|
||||||
|
{this.state.isDataSubmit && this.renderEnvoieWalletToWalletResponse()}
|
||||||
|
{this.state.triggerSubmitClick && this.renderDialogGetCommissionResponse()}
|
||||||
|
{
|
||||||
|
(resultEnvoieWalletToCardGetCommission !== null) &&
|
||||||
|
(typeof resultEnvoieWalletToCardGetCommission.response !== 'undefined') &&
|
||||||
|
this.modalConfirmTransaction(resultEnvoieWalletToCardGetCommission)
|
||||||
|
}
|
||||||
|
<ScrollView style={styles.container}>
|
||||||
|
|
||||||
|
<Text style={styles.subbigtitle}>{I18n.t('DEPOSIT_CASH_TO_OTHER_WALLET')}</Text>
|
||||||
|
|
||||||
|
<Animatable.View ref={(comp) => { this.userCodeAnim = comp }}>
|
||||||
|
<Fumi iconClass={FontAwesomeIcon} iconName={'user-secret'}
|
||||||
|
label={I18n.t('MEMBER_CODE')}
|
||||||
|
iconColor={'#f95a25'}
|
||||||
|
iconSize={20}
|
||||||
|
value={this.state.userCode}
|
||||||
|
onChangeText={(userCode) => {
|
||||||
|
this.setState({ userCode })
|
||||||
|
}}
|
||||||
|
style={styles.input}
|
||||||
|
>
|
||||||
|
</Fumi>
|
||||||
|
</Animatable.View>
|
||||||
|
|
||||||
|
<Animatable.View ref={(comp) => { this.montantAnim = comp }}>
|
||||||
|
<Fumi iconClass={FontAwesomeIcon} iconName={'money'}
|
||||||
|
label={I18n.t('AMOUNT')}
|
||||||
|
iconColor={'#f95a25'}
|
||||||
|
keyboardType='numeric'
|
||||||
|
iconSize={20}
|
||||||
|
value={this.state.montant}
|
||||||
|
onChangeText={(montant) => {
|
||||||
|
this.setState({ montant })
|
||||||
|
}}
|
||||||
|
style={styles.input}
|
||||||
|
>
|
||||||
|
</Fumi>
|
||||||
|
<View style={{
|
||||||
|
position: 'absolute',
|
||||||
|
left: responsiveWidth(82),
|
||||||
|
top: 35,
|
||||||
|
flexDirection: 'row'
|
||||||
|
}}>
|
||||||
|
<View
|
||||||
|
style={{
|
||||||
|
width: 1,
|
||||||
|
borderLeftColor: '#f0f0f0',
|
||||||
|
height: 40,
|
||||||
|
left: -8,
|
||||||
|
top: -10,
|
||||||
|
borderLeftWidth: 1,
|
||||||
|
|
||||||
|
}}
|
||||||
|
/>
|
||||||
|
<Text style={[Typography.body1, FontWeight.bold]}>{this.state.wallet.currency_code}</Text>
|
||||||
|
</View>
|
||||||
|
</Animatable.View>
|
||||||
|
|
||||||
|
<Animatable.View ref={(comp) => { this.passwordAnim = comp }}>
|
||||||
|
<Fumi iconClass={FontAwesomeIcon} iconName={'lock'}
|
||||||
|
label={I18n.t('PASSWORD')}
|
||||||
|
iconColor={'#f95a25'}
|
||||||
|
iconSize={20}
|
||||||
|
secureTextEntry={true}
|
||||||
|
value={this.state.password}
|
||||||
|
onChangeText={(password) => {
|
||||||
|
this.setState({ password })
|
||||||
|
}}
|
||||||
|
style={styles.input}
|
||||||
|
>
|
||||||
|
</Fumi>
|
||||||
|
</Animatable.View>
|
||||||
|
|
||||||
|
<Button style={styles.btnvalide}
|
||||||
|
textStyle={styles.textbtnvalide}
|
||||||
|
onPress={() => { this.onSubmitSendWalletToCard() }}>
|
||||||
|
{I18n.t('SUBMIT_LABEL')}</Button>
|
||||||
|
</ScrollView>
|
||||||
|
</>
|
||||||
|
)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
const maptStateToProps = state => ({
|
||||||
|
|
||||||
|
loadingEnvoieWalletToCard: state.envoieUserWalletToCardReducer.loading,
|
||||||
|
resultEnvoieWalletToCard: state.envoieUserWalletToCardReducer.result,
|
||||||
|
errorEnvoieWalletToCard: state.envoieUserWalletToCardReducer.error,
|
||||||
|
|
||||||
|
loadingEnvoieWalletToCardGetCommission: state.envoieUserWalletToCardGetCommissionReducer.loading,
|
||||||
|
resultEnvoieWalletToCardGetCommission: state.envoieUserWalletToCardGetCommissionReducer.result,
|
||||||
|
errorEnvoieWalletToCardGetCommission: state.envoieUserWalletToCardGetCommissionReducer.error,
|
||||||
|
});
|
||||||
|
|
||||||
|
const mapDispatchToProps = dispatch => bindActionCreators({
|
||||||
|
|
||||||
|
envoieUserWalletToCardAction,
|
||||||
|
envoieUserWalletToCardReset,
|
||||||
|
|
||||||
|
getCommissionUserWalletToCardAction,
|
||||||
|
getCommissionUserWalletToCardReset
|
||||||
|
|
||||||
|
}, dispatch);
|
||||||
|
|
||||||
|
export default connect(maptStateToProps, mapDispatchToProps)(EnvoieCashVersWalletAgent);
|
||||||
|
|
||||||
|
const styles = StyleSheet.create({
|
||||||
|
container: {
|
||||||
|
flex: 1,
|
||||||
|
backgroundColor: Color.primaryDarkColor,
|
||||||
|
},
|
||||||
|
textbtnvalide: {
|
||||||
|
color: 'white',
|
||||||
|
fontWeight: 'bold'
|
||||||
|
},
|
||||||
|
bigtitle: {
|
||||||
|
color: 'white',
|
||||||
|
fontSize: 20,
|
||||||
|
flex: 1,
|
||||||
|
fontWeight: 'bold',
|
||||||
|
textAlign: 'center',
|
||||||
|
margin: 20,
|
||||||
|
},
|
||||||
|
blockView: {
|
||||||
|
paddingVertical: 10,
|
||||||
|
borderBottomWidth: 1
|
||||||
|
},
|
||||||
|
subbigtitle: {
|
||||||
|
color: 'white',
|
||||||
|
fontSize: 17,
|
||||||
|
textAlign: 'center',
|
||||||
|
margin: 5,
|
||||||
|
},
|
||||||
|
btnvalide: {
|
||||||
|
marginTop: 20,
|
||||||
|
marginLeft: 20,
|
||||||
|
marginRight: 20,
|
||||||
|
borderColor: 'transparent',
|
||||||
|
backgroundColor: Color.accentLightColor,
|
||||||
|
height: 52
|
||||||
|
},
|
||||||
|
btnSubmit: {
|
||||||
|
marginTop: 20,
|
||||||
|
borderColor: 'transparent',
|
||||||
|
backgroundColor: Color.accentLightColor,
|
||||||
|
height: 52,
|
||||||
|
width: "30%",
|
||||||
|
marginLeft: 20,
|
||||||
|
marginRight: 20,
|
||||||
|
},
|
||||||
|
input: {
|
||||||
|
height: 60,
|
||||||
|
marginTop: responsiveHeight(2),
|
||||||
|
marginLeft: responsiveWidth(5),
|
||||||
|
marginRight: responsiveWidth(5),
|
||||||
|
borderRadius: 5,
|
||||||
|
}
|
||||||
|
});
|
|
@ -0,0 +1,540 @@
|
||||||
|
import Button from 'apsl-react-native-button';
|
||||||
|
import isEqual from 'lodash/isEqual';
|
||||||
|
import isNil from 'lodash/isNil';
|
||||||
|
import React, { Component } from 'react';
|
||||||
|
import { Alert, ScrollView, StyleSheet, Text, View } from 'react-native';
|
||||||
|
import * as Animatable from 'react-native-animatable';
|
||||||
|
import Dialog from "react-native-dialog";
|
||||||
|
import I18n from 'react-native-i18n';
|
||||||
|
import { responsiveHeight, responsiveWidth } from 'react-native-responsive-dimensions';
|
||||||
|
import { ProgressDialog } from 'react-native-simple-dialogs';
|
||||||
|
import FontAwesomeIcon from 'react-native-vector-icons/FontAwesome';
|
||||||
|
import { Fumi } from 'react-native-textinput-effects';
|
||||||
|
import { connect } from 'react-redux';
|
||||||
|
import { bindActionCreators } from 'redux';
|
||||||
|
import thousands from 'thousands';
|
||||||
|
import { Color } from '../../../config/Color';
|
||||||
|
import { FontWeight, Typography } from '../../../config/typography';
|
||||||
|
import { store } from "../../../redux/store";
|
||||||
|
import { IlinkEmitter } from '../../../utils/events';
|
||||||
|
import { LiteCreditCardInput } from "react-native-credit-card-input";
|
||||||
|
import { readUser } from '../../../webservice/AuthApi';
|
||||||
|
import { envoieUserWalletToCardAction, envoieUserWalletToCardReset, getCommissionUserWalletToCardAction, getCommissionUserWalletToCardReset } from '../../../webservice/EnvoieUserApi';
|
||||||
|
import { isNormalInteger } from '../../../utils/UtilsFunction';
|
||||||
|
let theme = require('../../../utils/theme.json');
|
||||||
|
let route = require('../../../route.json');
|
||||||
|
|
||||||
|
|
||||||
|
class RetraitCarteVersCashAgent extends Component {
|
||||||
|
|
||||||
|
static navigatorStyle = {
|
||||||
|
navBarBackgroundColor: Color.primaryColor,
|
||||||
|
statusBarColor: Color.primaryDarkColor,
|
||||||
|
navBarTextColor: '#FFFFFF',
|
||||||
|
navBarButtonColor: '#FFFFFF'
|
||||||
|
|
||||||
|
};
|
||||||
|
|
||||||
|
static navigationOptions = () => {
|
||||||
|
return {
|
||||||
|
drawerLabel: () => null,
|
||||||
|
headerTitle: I18n.t('WITHDRAWAL_CARD_TO_CASH'),
|
||||||
|
headerTintColor: 'white',
|
||||||
|
headerStyle: {
|
||||||
|
backgroundColor: Color.primaryColor,
|
||||||
|
marginTop: 0,
|
||||||
|
color: 'white'
|
||||||
|
},
|
||||||
|
headerTitleStyle: {
|
||||||
|
color: "white"
|
||||||
|
},
|
||||||
|
title: I18n.t('WITHDRAWAL_CARD_TO_CASH')
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
constructor(props) {
|
||||||
|
super(props);
|
||||||
|
this.state = {
|
||||||
|
montant: null,
|
||||||
|
password: null,
|
||||||
|
montant: '',
|
||||||
|
numeroSerie: '',
|
||||||
|
numCarte: 0,
|
||||||
|
cvv: 0,
|
||||||
|
expiration_date: '',
|
||||||
|
creditCardInput: {},
|
||||||
|
displayCardError: false,
|
||||||
|
loading: false,
|
||||||
|
user: null,
|
||||||
|
triggerSubmitClick: false,
|
||||||
|
isSubmitClick: false,
|
||||||
|
isDataSubmit: false,
|
||||||
|
isModalConfirmVisible: false,
|
||||||
|
wallet: store.getState().walletDetailReducer.result.response
|
||||||
|
};
|
||||||
|
|
||||||
|
this.props.envoieUserWalletToCardReset();
|
||||||
|
this.props.getCommissionUserWalletToCardReset();
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
componentDidMount() {
|
||||||
|
|
||||||
|
readUser().then((user) => {
|
||||||
|
if (user) {
|
||||||
|
if (user !== undefined) {
|
||||||
|
this.setState({ user });
|
||||||
|
}
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
componentWillReceiveProps(nextProps) {
|
||||||
|
|
||||||
|
console.log('PROPS', nextProps)
|
||||||
|
|
||||||
|
if (nextProps.resultEnvoieWalletToCardGetCommission != null) {
|
||||||
|
|
||||||
|
if (typeof nextProps.resultEnvoieWalletToCardGetCommission.response !== 'undefined') {
|
||||||
|
|
||||||
|
if (!nextProps.loadingEnvoieWalletToCardGetCommission)
|
||||||
|
this.setState({
|
||||||
|
isModalConfirmVisible: true
|
||||||
|
});
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
isCreditCardValid = () => {
|
||||||
|
const { creditCardInput } = this.state;
|
||||||
|
const errorMessage = [];
|
||||||
|
|
||||||
|
if (typeof creditCardInput.status !== 'undefined') {
|
||||||
|
|
||||||
|
if (creditCardInput.status.cvc === 'incomplete')
|
||||||
|
errorMessage.push(I18n.t('CVC_CARD_ERROR'));
|
||||||
|
if (creditCardInput.status.expiry === 'incomplete')
|
||||||
|
errorMessage.push(I18n.t('EXPIRY_CARD_ERROR'));
|
||||||
|
if (creditCardInput.status.number === 'incomplete')
|
||||||
|
errorMessage.push(I18n.t('CARD_NUMBER_ERROR'));
|
||||||
|
}
|
||||||
|
else
|
||||||
|
errorMessage.push(I18n.t('THIS_FIELD_IS_REQUIRED'))
|
||||||
|
|
||||||
|
return errorMessage;
|
||||||
|
}
|
||||||
|
|
||||||
|
onCreditCardChange = (form) => {
|
||||||
|
this.setState({
|
||||||
|
creditCardInput: form,
|
||||||
|
displayCardError: false
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
renderEnvoieWalletToWalletResponse = () => {
|
||||||
|
|
||||||
|
const { resultEnvoieWalletToCard, errorEnvoieWalletToCard } = this.props;
|
||||||
|
|
||||||
|
if (errorEnvoieWalletToCard !== null) {
|
||||||
|
if (typeof errorEnvoieWalletToCard.data !== 'undefined') {
|
||||||
|
Alert.alert(
|
||||||
|
I18n.t("WITHDRAWAL_ERROR"),
|
||||||
|
errorEnvoieWalletToCard.data.error,
|
||||||
|
[
|
||||||
|
{
|
||||||
|
text: I18n.t("OK"), onPress: () => {
|
||||||
|
this.props.envoieUserWalletToCardReset();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
],
|
||||||
|
{ cancelable: false }
|
||||||
|
)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (resultEnvoieWalletToCard !== null) {
|
||||||
|
if (resultEnvoieWalletToCard.response !== null) {
|
||||||
|
Alert.alert(
|
||||||
|
I18n.t("WITHDRAWAL_SUCCESS"),
|
||||||
|
resultEnvoieWalletToCard.response,
|
||||||
|
[
|
||||||
|
{
|
||||||
|
text: I18n.t("OK"), onPress: () => {
|
||||||
|
this.props.envoieUserWalletToCardReset();
|
||||||
|
IlinkEmitter.emit("refreshWallet");
|
||||||
|
this.props.navigation.pop();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
],
|
||||||
|
{ cancelable: false }
|
||||||
|
)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
renderDialogGetCommissionResponse = () => {
|
||||||
|
|
||||||
|
const { errorEnvoieWalletToCardGetCommission } = this.props;
|
||||||
|
|
||||||
|
if (errorEnvoieWalletToCardGetCommission !== null) {
|
||||||
|
if (typeof errorEnvoieWalletToCardGetCommission.data !== 'undefined') {
|
||||||
|
Alert.alert(
|
||||||
|
I18n.t("ERROR_LABLE"),
|
||||||
|
errorEnvoieWalletToCardGetCommission.data.error,
|
||||||
|
[
|
||||||
|
{
|
||||||
|
text: I18n.t("OK"), onPress: () => {
|
||||||
|
this.props.getCommissionUserWalletToCardReset();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
],
|
||||||
|
{ cancelable: false }
|
||||||
|
)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
updateLangue() {
|
||||||
|
this.props.navigation.setParams({ name: I18n.t('WITHDRAWAL_WALLET_TO_CASH') })
|
||||||
|
this.forceUpdate()
|
||||||
|
}
|
||||||
|
|
||||||
|
modalConfirmTransaction = (data) => {
|
||||||
|
|
||||||
|
const frais = data.response.frais;
|
||||||
|
const montant_net = data.response.montant_net;
|
||||||
|
|
||||||
|
return (
|
||||||
|
|
||||||
|
<Dialog.Container useNativeDriver={true} visible={this.state.isModalConfirmVisible}>
|
||||||
|
|
||||||
|
<Dialog.Title>{I18n.t('TRANSACTION_DETAIL')}</Dialog.Title>
|
||||||
|
|
||||||
|
<View>
|
||||||
|
|
||||||
|
<View style={[styles.blockView, { borderBottomColor: Color.borderColor }]}>
|
||||||
|
<View style={{ flexDirection: 'row', marginTop: 10 }}>
|
||||||
|
<View style={{ flex: 1 }}>
|
||||||
|
<Text style={[styles.body2]}>{I18n.t('AMOUNT')}</Text>
|
||||||
|
</View>
|
||||||
|
<View style={{ flex: 1, alignItems: 'flex-end' }}>
|
||||||
|
<Text style={[Typography.caption1, Color.grayColor]}>{`${thousands(this.state.montant, ' ')} ${this.state.wallet.currency_code}`}</Text>
|
||||||
|
</View>
|
||||||
|
</View>
|
||||||
|
<View style={{ flexDirection: 'row', marginTop: 10 }}>
|
||||||
|
<View style={{ flex: 1 }}>
|
||||||
|
<Text tyle={[Typography.body2]}>{I18n.t('FEES_AND_TAXES')}</Text>
|
||||||
|
</View>
|
||||||
|
<View style={{ flex: 1, alignItems: 'flex-end' }}>
|
||||||
|
<Text style={[Typography.caption1, Color.grayColor]}>{`${thousands(frais, ' ')} ${this.state.wallet.currency_code}`}</Text>
|
||||||
|
</View>
|
||||||
|
</View>
|
||||||
|
</View>
|
||||||
|
<View style={{ paddingVertical: 10 }}>
|
||||||
|
<View style={{ flexDirection: 'row', marginTop: 10 }}>
|
||||||
|
<View style={{ flex: 1 }}>
|
||||||
|
<Text tyle={[Typography.body2, FontWeight.bold]}>{I18n.t('NET_AMOUNT')}:</Text>
|
||||||
|
</View>
|
||||||
|
<View style={{ flex: 1, alignItems: 'flex-end' }}>
|
||||||
|
<Text style={[Typography.caption1, Color.grayColor]}>{`${thousands(montant_net, ' ')} ${this.state.wallet.currency_code}`}</Text>
|
||||||
|
</View>
|
||||||
|
</View>
|
||||||
|
</View>
|
||||||
|
</View>
|
||||||
|
|
||||||
|
<Dialog.Button bold={true} label={I18n.t('CANCEL_LABEL')} onPress={() => {
|
||||||
|
this.setState({
|
||||||
|
isModalConfirmVisible: false
|
||||||
|
});
|
||||||
|
}} />
|
||||||
|
<Dialog.Button bold={true} label={I18n.t('SUBMIT_LABEL')} onPress={() => {
|
||||||
|
this.setState({
|
||||||
|
isModalConfirmVisible: false,
|
||||||
|
isDataSubmit: true
|
||||||
|
});
|
||||||
|
this.props.envoieUserWalletToCardAction({
|
||||||
|
type: 13,
|
||||||
|
numCarte: this.state.creditCardInput.values.number.replace(/\s/g, ''),
|
||||||
|
cvv: this.state.creditCardInput.values.cvc,
|
||||||
|
expiration_date: this.state.creditCardInput.values.expiry,
|
||||||
|
id_wallet_user: this.state.wallet.id,
|
||||||
|
montant: this.state.montant,
|
||||||
|
password: this.state.password
|
||||||
|
});
|
||||||
|
this.props.getCommissionUserWalletToCardReset();
|
||||||
|
}} />
|
||||||
|
|
||||||
|
</Dialog.Container>
|
||||||
|
|
||||||
|
);
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
ckeckIfFieldIsOK(champ) {
|
||||||
|
return (isNil(champ) || isEqual(champ.length, 0));
|
||||||
|
}
|
||||||
|
|
||||||
|
isMontantValid = () => {
|
||||||
|
const { montant } = this.state;
|
||||||
|
if ((parseInt(isEqual(montant, 0)) || montant < 0))
|
||||||
|
return {
|
||||||
|
errorMessage: I18n.t('ENTER_AMOUNT_SUPERIOR_ZEROR'),
|
||||||
|
isValid: false
|
||||||
|
};
|
||||||
|
|
||||||
|
else if (!isNormalInteger(montant))
|
||||||
|
return {
|
||||||
|
errorMessage: I18n.t('ENTER_VALID_AMOUNT'),
|
||||||
|
isValid: false
|
||||||
|
};
|
||||||
|
|
||||||
|
else
|
||||||
|
return {
|
||||||
|
errorMessage: '',
|
||||||
|
isValid: true
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
|
onSubmitSendWalletToCard = () => {
|
||||||
|
const { creditCardInput, montant, password } = this.state;
|
||||||
|
|
||||||
|
if (!creditCardInput.valid)
|
||||||
|
this.codeCVVAnim.shake(800);
|
||||||
|
else if (this.ckeckIfFieldIsOK(montant) || !this.isMontantValid().isValid) {
|
||||||
|
this.montantAnim.shake(800);
|
||||||
|
}
|
||||||
|
else if (this.ckeckIfFieldIsOK(password))
|
||||||
|
this.passwordAnim.shake(800);
|
||||||
|
else {
|
||||||
|
|
||||||
|
this.props.getCommissionUserWalletToCardAction({
|
||||||
|
type: 13,
|
||||||
|
id_wallet_agent: this.state.wallet.id,
|
||||||
|
montant: this.state.montant,
|
||||||
|
});
|
||||||
|
|
||||||
|
}
|
||||||
|
this.setState({
|
||||||
|
triggerSubmitClick: true,
|
||||||
|
numCarte: parseInt((creditCardInput.values.number).replace(/ /g, ' ')),
|
||||||
|
cvv: creditCardInput.values.cvc,
|
||||||
|
expiration_date: creditCardInput.values.expiry
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
renderLoader = () => {
|
||||||
|
return (
|
||||||
|
<ProgressDialog
|
||||||
|
visible={this.props.loadingEnvoieWalletToCard || this.props.loadingEnvoieWalletToCardGetCommission}
|
||||||
|
title={I18n.t('LOADING')}
|
||||||
|
message={I18n.t('LOADING_INFO')}
|
||||||
|
/>
|
||||||
|
)
|
||||||
|
}
|
||||||
|
|
||||||
|
render() {
|
||||||
|
const { resultEnvoieWalletToCardGetCommission } = this.props;
|
||||||
|
return (
|
||||||
|
<>
|
||||||
|
{(this.props.loadingEnvoieWalletToCard || this.props.loadingEnvoieWalletToCardGetCommission) && this.renderLoader()}
|
||||||
|
{this.state.isDataSubmit && this.renderEnvoieWalletToWalletResponse()}
|
||||||
|
{this.state.triggerSubmitClick && this.renderDialogGetCommissionResponse()}
|
||||||
|
{
|
||||||
|
(resultEnvoieWalletToCardGetCommission !== null) &&
|
||||||
|
(typeof resultEnvoieWalletToCardGetCommission.response !== 'undefined') &&
|
||||||
|
this.modalConfirmTransaction(resultEnvoieWalletToCardGetCommission)
|
||||||
|
}
|
||||||
|
<ScrollView style={styles.container}>
|
||||||
|
|
||||||
|
<Text style={styles.subbigtitle}>{I18n.t('WITHDRAWAL_CARD_TO_CASH_DESCRIPTION')}</Text>
|
||||||
|
|
||||||
|
<Animatable.View ref={(comp) => { this.codeCVVAnim = comp }}>
|
||||||
|
<View style={{
|
||||||
|
overflow: 'hidden',
|
||||||
|
paddingTop: 16,
|
||||||
|
backgroundColor: 'white',
|
||||||
|
marginTop: responsiveHeight(2),
|
||||||
|
marginLeft: responsiveWidth(5),
|
||||||
|
marginRight: responsiveWidth(5),
|
||||||
|
borderRadius: 5,
|
||||||
|
}}>
|
||||||
|
<LiteCreditCardInput
|
||||||
|
inputStyle={{
|
||||||
|
flex: 1,
|
||||||
|
color: 'black',
|
||||||
|
fontSize: 18,
|
||||||
|
padding: 7,
|
||||||
|
paddingLeft: 0,
|
||||||
|
}}
|
||||||
|
validColor={this.state.creditCardInput.valid ? 'green' : ''}
|
||||||
|
invalidColor={!this.state.creditCardInput.valid ? 'red' : ''}
|
||||||
|
onChange={this.onCreditCardChange}
|
||||||
|
labels={{
|
||||||
|
number: I18n.t('CARD_NUMBER_LABEL'),
|
||||||
|
expiry: I18n.t('CARD_EXPIRY_LABEL'),
|
||||||
|
cvc: I18n.t('CARD_CVC_LABEL'),
|
||||||
|
}} />
|
||||||
|
{
|
||||||
|
(this.state.displayCardError) &&
|
||||||
|
this.isCreditCardValid().map((item) => (
|
||||||
|
<Text style={{ color: 'red', marginLeft: 15 }}>{item}</Text>
|
||||||
|
))
|
||||||
|
}
|
||||||
|
</View>
|
||||||
|
|
||||||
|
{/* <Fumi iconClass={FontAwesomeIcon} iconName={'credit-card'}
|
||||||
|
label={I18n.t('CARD_CVC_LABEL')}
|
||||||
|
iconColor={'#f95a25'}
|
||||||
|
keyboardType='numeric'
|
||||||
|
iconSize={20}
|
||||||
|
value={this.state.codeCVV}
|
||||||
|
onChangeText={(codeCVV) => {
|
||||||
|
if (codeCVV.length > 3) {
|
||||||
|
this.setState({ codeCVV: this.state.codeCVV.substring(0, 3) })
|
||||||
|
}
|
||||||
|
else
|
||||||
|
this.setState({ codeCVV })
|
||||||
|
}}
|
||||||
|
style={styles.input}
|
||||||
|
>
|
||||||
|
</Fumi> */}
|
||||||
|
</Animatable.View>
|
||||||
|
|
||||||
|
<Animatable.View ref={(comp) => { this.montantAnim = comp }}>
|
||||||
|
<Fumi iconClass={FontAwesomeIcon} iconName={'money'}
|
||||||
|
label={I18n.t('AMOUNT')}
|
||||||
|
iconColor={'#f95a25'}
|
||||||
|
keyboardType='numeric'
|
||||||
|
iconSize={20}
|
||||||
|
value={this.state.montant}
|
||||||
|
onChangeText={(montant) => {
|
||||||
|
this.setState({ montant })
|
||||||
|
}}
|
||||||
|
style={styles.input}
|
||||||
|
>
|
||||||
|
</Fumi>
|
||||||
|
<View style={{
|
||||||
|
position: 'absolute',
|
||||||
|
left: responsiveWidth(82),
|
||||||
|
top: 35,
|
||||||
|
flexDirection: 'row'
|
||||||
|
}}>
|
||||||
|
<View
|
||||||
|
style={{
|
||||||
|
width: 1,
|
||||||
|
borderLeftColor: '#f0f0f0',
|
||||||
|
height: 40,
|
||||||
|
left: -8,
|
||||||
|
top: -10,
|
||||||
|
borderLeftWidth: 1,
|
||||||
|
|
||||||
|
}}
|
||||||
|
/>
|
||||||
|
<Text style={[Typography.body1, FontWeight.bold]}>{this.state.wallet.currency_code}</Text>
|
||||||
|
</View>
|
||||||
|
</Animatable.View>
|
||||||
|
|
||||||
|
<Animatable.View ref={(comp) => { this.passwordAnim = comp }}>
|
||||||
|
<Fumi iconClass={FontAwesomeIcon} iconName={'lock'}
|
||||||
|
label={I18n.t('PASSWORD')}
|
||||||
|
iconColor={'#f95a25'}
|
||||||
|
iconSize={20}
|
||||||
|
secureTextEntry={true}
|
||||||
|
value={this.state.password}
|
||||||
|
onChangeText={(password) => {
|
||||||
|
this.setState({ password })
|
||||||
|
}}
|
||||||
|
style={styles.input}
|
||||||
|
>
|
||||||
|
</Fumi>
|
||||||
|
</Animatable.View>
|
||||||
|
|
||||||
|
<Button style={styles.btnvalide}
|
||||||
|
textStyle={styles.textbtnvalide}
|
||||||
|
onPress={() => { this.onSubmitSendWalletToCard() }}>
|
||||||
|
{I18n.t('SUBMIT_LABEL')}</Button>
|
||||||
|
</ScrollView>
|
||||||
|
</>
|
||||||
|
)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
const maptStateToProps = state => ({
|
||||||
|
|
||||||
|
loadingEnvoieWalletToCard: state.envoieUserWalletToCardReducer.loading,
|
||||||
|
resultEnvoieWalletToCard: state.envoieUserWalletToCardReducer.result,
|
||||||
|
errorEnvoieWalletToCard: state.envoieUserWalletToCardReducer.error,
|
||||||
|
|
||||||
|
loadingEnvoieWalletToCardGetCommission: state.envoieUserWalletToCardGetCommissionReducer.loading,
|
||||||
|
resultEnvoieWalletToCardGetCommission: state.envoieUserWalletToCardGetCommissionReducer.result,
|
||||||
|
errorEnvoieWalletToCardGetCommission: state.envoieUserWalletToCardGetCommissionReducer.error,
|
||||||
|
});
|
||||||
|
|
||||||
|
const mapDispatchToProps = dispatch => bindActionCreators({
|
||||||
|
|
||||||
|
envoieUserWalletToCardAction,
|
||||||
|
envoieUserWalletToCardReset,
|
||||||
|
|
||||||
|
getCommissionUserWalletToCardAction,
|
||||||
|
getCommissionUserWalletToCardReset
|
||||||
|
|
||||||
|
}, dispatch);
|
||||||
|
|
||||||
|
export default connect(maptStateToProps, mapDispatchToProps)(RetraitCarteVersCashAgent);
|
||||||
|
|
||||||
|
const styles = StyleSheet.create({
|
||||||
|
container: {
|
||||||
|
flex: 1,
|
||||||
|
backgroundColor: Color.primaryDarkColor,
|
||||||
|
},
|
||||||
|
textbtnvalide: {
|
||||||
|
color: 'white',
|
||||||
|
fontWeight: 'bold'
|
||||||
|
},
|
||||||
|
bigtitle: {
|
||||||
|
color: 'white',
|
||||||
|
fontSize: 20,
|
||||||
|
flex: 1,
|
||||||
|
fontWeight: 'bold',
|
||||||
|
textAlign: 'center',
|
||||||
|
margin: 20,
|
||||||
|
},
|
||||||
|
blockView: {
|
||||||
|
paddingVertical: 10,
|
||||||
|
borderBottomWidth: 1
|
||||||
|
},
|
||||||
|
subbigtitle: {
|
||||||
|
color: 'white',
|
||||||
|
fontSize: 17,
|
||||||
|
textAlign: 'center',
|
||||||
|
margin: 5,
|
||||||
|
},
|
||||||
|
btnvalide: {
|
||||||
|
marginTop: 20,
|
||||||
|
marginLeft: 20,
|
||||||
|
marginRight: 20,
|
||||||
|
borderColor: 'transparent',
|
||||||
|
backgroundColor: Color.accentLightColor,
|
||||||
|
height: 52
|
||||||
|
},
|
||||||
|
btnSubmit: {
|
||||||
|
marginTop: 20,
|
||||||
|
borderColor: 'transparent',
|
||||||
|
backgroundColor: Color.accentLightColor,
|
||||||
|
height: 52,
|
||||||
|
width: "30%",
|
||||||
|
marginLeft: 20,
|
||||||
|
marginRight: 20,
|
||||||
|
},
|
||||||
|
input: {
|
||||||
|
height: 60,
|
||||||
|
marginTop: responsiveHeight(2),
|
||||||
|
marginLeft: responsiveWidth(5),
|
||||||
|
marginRight: responsiveWidth(5),
|
||||||
|
borderRadius: 5,
|
||||||
|
}
|
||||||
|
});
|
|
@ -0,0 +1,523 @@
|
||||||
|
import Button from 'apsl-react-native-button';
|
||||||
|
import isEqual from 'lodash/isEqual';
|
||||||
|
import isNil from 'lodash/isNil';
|
||||||
|
import React, { Component } from 'react';
|
||||||
|
import { Alert, ScrollView, StyleSheet, Text, View } from 'react-native';
|
||||||
|
import * as Animatable from 'react-native-animatable';
|
||||||
|
import I18n from 'react-native-i18n';
|
||||||
|
import Dialog from "react-native-dialog";
|
||||||
|
import { Dropdown } from 'react-native-material-dropdown';
|
||||||
|
import { responsiveHeight, responsiveWidth } from 'react-native-responsive-dimensions';
|
||||||
|
import { ProgressDialog } from 'react-native-simple-dialogs';
|
||||||
|
import { Fumi } from 'react-native-textinput-effects';
|
||||||
|
import FontAwesomeIcon from 'react-native-vector-icons/FontAwesome';
|
||||||
|
import { connect } from 'react-redux';
|
||||||
|
import { bindActionCreators } from 'redux';
|
||||||
|
import { Color } from '../../../config/Color';
|
||||||
|
import { store } from "../../../redux/store";
|
||||||
|
import { identityPieces, isIlinkWorldWallet, isNormalInteger, typeIdIDestinataire, thousandsSeparators } from '../../../utils/UtilsFunction';
|
||||||
|
import { readUser } from '../../../webservice/AuthApi';
|
||||||
|
import { checkIdTransactionAction, checkIdTransactionReset } from '../../../webservice/agent/RetraitCarteVersCashAgentApi';
|
||||||
|
import { envoieUserWalletToCardAction, envoieUserWalletToCardReset } from '../../../webservice/EnvoieUserApi';
|
||||||
|
import { Typography, FontWeight } from '../../../config/typography';
|
||||||
|
import thousands from 'thousands';
|
||||||
|
import { IlinkEmitter } from '../../../utils/events';
|
||||||
|
let theme = require('../../../utils/theme.json');
|
||||||
|
let route = require('../../../route.json');
|
||||||
|
|
||||||
|
|
||||||
|
class RetraitEnCashAgent extends Component {
|
||||||
|
static navigatorStyle = {
|
||||||
|
navBarBackgroundColor: Color.primaryColor,
|
||||||
|
statusBarColor: Color.primaryDarkColor,
|
||||||
|
navBarTextColor: '#FFFFFF',
|
||||||
|
navBarButtonColor: '#FFFFFF'
|
||||||
|
|
||||||
|
};
|
||||||
|
|
||||||
|
static navigationOptions = () => {
|
||||||
|
return {
|
||||||
|
drawerLabel: () => null,
|
||||||
|
headerTitle: I18n.t('WITHDRAWAL_IN_CASH'),
|
||||||
|
headerTintColor: 'white',
|
||||||
|
headerStyle: {
|
||||||
|
backgroundColor: Color.primaryColor,
|
||||||
|
marginTop: 0,
|
||||||
|
color: 'white'
|
||||||
|
},
|
||||||
|
headerTitleStyle: {
|
||||||
|
color: "white"
|
||||||
|
},
|
||||||
|
title: I18n.t('WITHDRAWAL_IN_CASH')
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
constructor(props) {
|
||||||
|
super(props);
|
||||||
|
this.state = {
|
||||||
|
identityPieces: identityPieces(),
|
||||||
|
type_document_destinataire: (identityPieces()[0]).name,
|
||||||
|
idTransaction: null,
|
||||||
|
nom_destinataire: null,
|
||||||
|
prenom_destinataire: null,
|
||||||
|
numeroIdentite: null,
|
||||||
|
montant: null,
|
||||||
|
password: null,
|
||||||
|
loading: false,
|
||||||
|
codeRetrait: null,
|
||||||
|
user: null,
|
||||||
|
triggerSubmitClick: false,
|
||||||
|
triggerNextClick: false,
|
||||||
|
displayFirstStep: true,
|
||||||
|
displaySecondStep: false,
|
||||||
|
wallet: store.getState().walletDetailReducer.result.response
|
||||||
|
};
|
||||||
|
|
||||||
|
this.props.checkIdTransactionReset();
|
||||||
|
this.props.envoieUserWalletToCardReset();
|
||||||
|
}
|
||||||
|
|
||||||
|
componentDidMount() {
|
||||||
|
|
||||||
|
readUser().then((user) => {
|
||||||
|
if (user) {
|
||||||
|
if (user !== undefined) {
|
||||||
|
this.setState({ user });
|
||||||
|
}
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
ckeckIfFieldIsOK(champ) {
|
||||||
|
return (isNil(champ) || isEqual(champ.length, 0));
|
||||||
|
}
|
||||||
|
|
||||||
|
isMontantValid = () => {
|
||||||
|
const { montant } = this.state;
|
||||||
|
if ((parseInt(isEqual(montant, 0)) || montant < 0))
|
||||||
|
return {
|
||||||
|
errorMessage: I18n.t('ENTER_AMOUNT_SUPERIOR_ZEROR'),
|
||||||
|
isValid: false
|
||||||
|
};
|
||||||
|
|
||||||
|
else if (!isNormalInteger(montant))
|
||||||
|
return {
|
||||||
|
errorMessage: I18n.t('ENTER_VALID_AMOUNT'),
|
||||||
|
isValid: false
|
||||||
|
};
|
||||||
|
|
||||||
|
|
||||||
|
else if (montant > parseInt(this.state.comptePrincipal))
|
||||||
|
return {
|
||||||
|
errorMessage: I18n.t('AMOUNT_SUPERIOR_TO_PRINCIPAL_ACCOUNT'),
|
||||||
|
isValid: false
|
||||||
|
};
|
||||||
|
|
||||||
|
else
|
||||||
|
return {
|
||||||
|
errorMessage: '',
|
||||||
|
isValid: true
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
|
onSubmitRetraitCash = () => {
|
||||||
|
const { codeRetrait, montant, password } = this.state;
|
||||||
|
|
||||||
|
if (this.ckeckIfFieldIsOK(montant) || !this.isMontantValid().isValid)
|
||||||
|
this.montantAnim.shake(800);
|
||||||
|
else if (this.ckeckIfFieldIsOK(codeRetrait))
|
||||||
|
this.codeRetraitAnim.shake(800);
|
||||||
|
else if (this.ckeckIfFieldIsOK(password))
|
||||||
|
this.passwordAnim.shake(800);
|
||||||
|
else {
|
||||||
|
|
||||||
|
this.props.envoieUserWalletToCardAction({
|
||||||
|
type: 12,
|
||||||
|
id_wallet_agent: this.state.wallet.id,
|
||||||
|
id_transaction: this.state.idTransaction,
|
||||||
|
code_retrait: this.state.codeRetrait,
|
||||||
|
montant: this.state.montant,
|
||||||
|
password: this.state.password
|
||||||
|
});
|
||||||
|
}
|
||||||
|
this.setState({
|
||||||
|
|
||||||
|
});
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
onSubmitNextStep = () => {
|
||||||
|
|
||||||
|
const { idTransaction } = this.state;
|
||||||
|
this.props.checkIdTransactionReset();
|
||||||
|
if (this.ckeckIfFieldIsOK(idTransaction))
|
||||||
|
this.idTransactionAnim.shake(800);
|
||||||
|
else {
|
||||||
|
this.props.checkIdTransactionAction({
|
||||||
|
id_transaction: idTransaction,
|
||||||
|
id_wallet_agent: this.state.wallet.id
|
||||||
|
});
|
||||||
|
this.setState({ triggerNextClick: true });
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
renderRetraitEnCashAgentResponse = () => {
|
||||||
|
const { resultEnvoieWalletToCard, errorEnvoieWalletToCard } = this.props;
|
||||||
|
|
||||||
|
if (errorEnvoieWalletToCard !== null) {
|
||||||
|
if (typeof errorEnvoieWalletToCard.data !== 'undefined') {
|
||||||
|
Alert.alert(
|
||||||
|
I18n.t("WITHDRAWAL_ERROR"),
|
||||||
|
errorEnvoieWalletToCard.data.error,
|
||||||
|
[
|
||||||
|
{
|
||||||
|
text: I18n.t("OK"), onPress: () => {
|
||||||
|
this.props.envoieUserWalletToCardReset();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
],
|
||||||
|
{ cancelable: false }
|
||||||
|
)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (resultEnvoieWalletToCard !== null) {
|
||||||
|
if (resultEnvoieWalletToCard.response !== null) {
|
||||||
|
Alert.alert(
|
||||||
|
I18n.t("SUCCESS_TRANSFER"),
|
||||||
|
resultEnvoieWalletToCard.response,
|
||||||
|
[
|
||||||
|
{
|
||||||
|
text: I18n.t("OK"), onPress: () => {
|
||||||
|
this.props.envoieUserWalletToCardReset();
|
||||||
|
IlinkEmitter.emit("refreshWallet");
|
||||||
|
this.props.navigation.pop();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
],
|
||||||
|
{ cancelable: false }
|
||||||
|
)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
renderTransactionIdVerification = () => {
|
||||||
|
|
||||||
|
const { resultIdRetraitEnCash, errorIdRetraitEnCash } = this.props;
|
||||||
|
|
||||||
|
console.log("PROPS", this.props);
|
||||||
|
|
||||||
|
if (resultIdRetraitEnCash !== null) {
|
||||||
|
console.log("resultIdVerification", resultIdRetraitEnCash);
|
||||||
|
if (resultIdRetraitEnCash.status === 200) {
|
||||||
|
this.setState({
|
||||||
|
id_document_destinataire: resultIdRetraitEnCash.response.id_document_destinataire,
|
||||||
|
nom_destinataire: resultIdRetraitEnCash.response.nom_destinataire,
|
||||||
|
prenom_destinataire: resultIdRetraitEnCash.response.prenom_destinataire,
|
||||||
|
type_document_destinataire: resultIdRetraitEnCash.response.type_document_destinataire,
|
||||||
|
displayFirstStep: !this.state.displayFirstStep,
|
||||||
|
displaySecondStep: !this.state.displaySecondStep,
|
||||||
|
});
|
||||||
|
this.props.checkIdTransactionReset();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (errorIdRetraitEnCash !== null) {
|
||||||
|
if (typeof errorIdRetraitEnCash.data !== 'undefined') {
|
||||||
|
Alert.alert(
|
||||||
|
I18n.t('ERROR_LABLE'),
|
||||||
|
errorIdRetraitEnCash.data.error,
|
||||||
|
[
|
||||||
|
{
|
||||||
|
text: I18n.t("OK"), onPress: () => {
|
||||||
|
this.props.checkIdTransactionReset();
|
||||||
|
this.setState({ triggerNextClick: false })
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
],
|
||||||
|
{ cancelable: false }
|
||||||
|
)
|
||||||
|
} else {
|
||||||
|
Alert.alert(
|
||||||
|
I18n.t('ERROR_LABLE'),
|
||||||
|
JSON.stringify(errorIdRetraitEnCash),
|
||||||
|
[
|
||||||
|
{
|
||||||
|
text: I18n.t("OK"), onPress: () => {
|
||||||
|
this.props.checkIdTransactionReset();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
],
|
||||||
|
{ cancelable: false }
|
||||||
|
)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
renderLoader = () => {
|
||||||
|
return (
|
||||||
|
<ProgressDialog
|
||||||
|
visible={this.props.loadingIdRetraitEnCash || this.props.loadingEnvoieWalletToCard}
|
||||||
|
title={I18n.t('LOADING')}
|
||||||
|
message={I18n.t('LOADING_INFO')}
|
||||||
|
/>
|
||||||
|
)
|
||||||
|
}
|
||||||
|
|
||||||
|
render() {
|
||||||
|
console.log("STATE", this.state);
|
||||||
|
return (
|
||||||
|
<>
|
||||||
|
{(this.props.loadingIdRetraitEnCash || this.props.loadingEnvoieWalletToCard) && this.renderLoader()}
|
||||||
|
{this.state.triggerNextClick && this.renderTransactionIdVerification()}
|
||||||
|
{this.state.triggerSubmitClick && this.renderRetraitEnCashAgentResponse()}
|
||||||
|
|
||||||
|
<ScrollView style={styles.container}>
|
||||||
|
|
||||||
|
{this.state.displayFirstStep &&
|
||||||
|
<>
|
||||||
|
|
||||||
|
<Text style={styles.subbigtitle}>{I18n.t('ENVOIE_WALLET_TO_CASH')}</Text>
|
||||||
|
|
||||||
|
<Animatable.View ref={(comp) => { this.idTransactionAnim = comp }}>
|
||||||
|
<Fumi iconClass={FontAwesomeIcon} iconName={'barcode'}
|
||||||
|
label={`${I18n.t('ID_TRANSACTION')}`}
|
||||||
|
iconColor={'#f95a25'}
|
||||||
|
iconSize={20}
|
||||||
|
onChangeText={(idTransaction) => {
|
||||||
|
this.setState({ idTransaction })
|
||||||
|
}}
|
||||||
|
style={styles.input}
|
||||||
|
>
|
||||||
|
</Fumi>
|
||||||
|
</Animatable.View>
|
||||||
|
|
||||||
|
<Button style={styles.btnvalide}
|
||||||
|
textStyle={styles.textbtnvalide}
|
||||||
|
isLoading={this.state.isLoging}
|
||||||
|
onPress={() => { this.onSubmitNextStep() }}>
|
||||||
|
{I18n.t('NEXT')}</Button>
|
||||||
|
|
||||||
|
</>
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
{this.state.displaySecondStep &&
|
||||||
|
<>
|
||||||
|
|
||||||
|
<Animatable.View ref={(comp) => { this.firstnameAnim = comp }}>
|
||||||
|
<Fumi iconClass={FontAwesomeIcon} iconName={'user'}
|
||||||
|
label={`${I18n.t('NAME')}`}
|
||||||
|
iconColor={'#f95a25'}
|
||||||
|
iconSize={20}
|
||||||
|
editable={false}
|
||||||
|
value={this.state.nom_destinataire}
|
||||||
|
style={styles.input}
|
||||||
|
>
|
||||||
|
</Fumi>
|
||||||
|
</Animatable.View>
|
||||||
|
|
||||||
|
<Animatable.View ref={(comp) => { this.lastnameAnim = comp }}>
|
||||||
|
<Fumi iconClass={FontAwesomeIcon} iconName={'user-circle-o'}
|
||||||
|
label={`${I18n.t('FIRSTNAME')}`}
|
||||||
|
iconColor={'#f95a25'}
|
||||||
|
iconSize={20}
|
||||||
|
editable={false}
|
||||||
|
value={this.state.prenom_destinataire}
|
||||||
|
style={styles.input}
|
||||||
|
>
|
||||||
|
</Fumi>
|
||||||
|
</Animatable.View>
|
||||||
|
|
||||||
|
<Animatable.View ref={(comp) => { this.identityPiecesAnim = comp }}
|
||||||
|
style={{
|
||||||
|
width: responsiveWidth(90),
|
||||||
|
height: 60,
|
||||||
|
marginTop: 20,
|
||||||
|
alignSelf: 'center',
|
||||||
|
borderRadius: 10,
|
||||||
|
paddingLeft: 20,
|
||||||
|
paddingRight: 20,
|
||||||
|
backgroundColor: 'white'
|
||||||
|
}}>
|
||||||
|
<Dropdown
|
||||||
|
label={I18n.t('PIECE_IDENTITE')}
|
||||||
|
data={this.state.identityPieces}
|
||||||
|
useNativeDriver={true}
|
||||||
|
disabled={false}
|
||||||
|
value={this.state.type_document_destinataire}
|
||||||
|
valueExtractor={(value) => { return value.name }}
|
||||||
|
labelExtractor={(value) => { return value.name }}
|
||||||
|
/>
|
||||||
|
</Animatable.View>
|
||||||
|
|
||||||
|
<Animatable.View ref={(comp) => { this.codeUtilisateurAnim = comp }}>
|
||||||
|
<Fumi iconClass={FontAwesomeIcon} iconName={'address-card'}
|
||||||
|
label={`${I18n.t('NUMERO_IDENTITE')}`}
|
||||||
|
iconColor={'#f95a25'}
|
||||||
|
iconSize={20}
|
||||||
|
editable={false}
|
||||||
|
value={this.state.id_document_destinataire}
|
||||||
|
style={styles.input}
|
||||||
|
>
|
||||||
|
</Fumi>
|
||||||
|
</Animatable.View>
|
||||||
|
|
||||||
|
<Animatable.View ref={(comp) => { this.codeRetraitAnim = comp }}>
|
||||||
|
<Fumi iconClass={FontAwesomeIcon} iconName={'lock'}
|
||||||
|
value={this.state.codeRetrait}
|
||||||
|
label={`${I18n.t('CODE_RETRAIT')}`}
|
||||||
|
iconColor={'#f95a25'}
|
||||||
|
iconSize={20}
|
||||||
|
onChangeText={(codeRetrait) => {
|
||||||
|
this.setState({ codeRetrait })
|
||||||
|
}}
|
||||||
|
style={styles.input}
|
||||||
|
>
|
||||||
|
</Fumi>
|
||||||
|
</Animatable.View>
|
||||||
|
|
||||||
|
|
||||||
|
<Animatable.View ref={(comp) => { this.montantAnim = comp }}>
|
||||||
|
<Fumi iconClass={FontAwesomeIcon} iconName={'money'}
|
||||||
|
label={I18n.t('AMOUNT')}
|
||||||
|
iconColor={'#f95a25'}
|
||||||
|
keyboardType='numeric'
|
||||||
|
iconSize={20}
|
||||||
|
value={this.state.montant}
|
||||||
|
onChangeText={(montant) => {
|
||||||
|
this.setState({ montant })
|
||||||
|
}}
|
||||||
|
style={styles.input}
|
||||||
|
>
|
||||||
|
</Fumi>
|
||||||
|
<View style={{
|
||||||
|
position: 'absolute',
|
||||||
|
left: responsiveWidth(82),
|
||||||
|
top: 35,
|
||||||
|
flexDirection: 'row'
|
||||||
|
}}>
|
||||||
|
<View
|
||||||
|
style={{
|
||||||
|
width: 1,
|
||||||
|
borderLeftColor: '#f0f0f0',
|
||||||
|
height: 40,
|
||||||
|
left: -8,
|
||||||
|
top: -10,
|
||||||
|
borderLeftWidth: 1,
|
||||||
|
|
||||||
|
}}
|
||||||
|
/>
|
||||||
|
<Text style={[Typography.body1, FontWeight.bold]}>{this.state.wallet.currency_code}</Text>
|
||||||
|
</View>
|
||||||
|
</Animatable.View>
|
||||||
|
|
||||||
|
<Animatable.View ref={(comp) => { this.passwordAnim = comp }}>
|
||||||
|
<Fumi iconClass={FontAwesomeIcon} iconName={'lock'}
|
||||||
|
label={I18n.t('PASSWORD')}
|
||||||
|
iconColor={'#f95a25'}
|
||||||
|
iconSize={20}
|
||||||
|
secureTextEntry={true}
|
||||||
|
value={this.state.password}
|
||||||
|
onChangeText={(password) => {
|
||||||
|
this.setState({ password })
|
||||||
|
}}
|
||||||
|
style={styles.input}
|
||||||
|
>
|
||||||
|
</Fumi>
|
||||||
|
</Animatable.View>
|
||||||
|
|
||||||
|
<Button style={styles.btnvalide}
|
||||||
|
textStyle={styles.textbtnvalide}
|
||||||
|
isLoading={this.state.isLoging}
|
||||||
|
onPress={() => { this.onSubmitRetraitCash() }}>
|
||||||
|
{I18n.t('SUBMIT_LABEL')}</Button>
|
||||||
|
|
||||||
|
</>
|
||||||
|
}
|
||||||
|
|
||||||
|
</ScrollView>
|
||||||
|
</>
|
||||||
|
)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
const maptStateToProps = state => ({
|
||||||
|
loadingIdRetraitEnCash: state.retraitCashAgentIdVerificationReducer.loading,
|
||||||
|
resultIdRetraitEnCash: state.retraitCashAgentIdVerificationReducer.result,
|
||||||
|
errorIdRetraitEnCash: state.retraitCashAgentIdVerificationReducer.error,
|
||||||
|
|
||||||
|
|
||||||
|
loadingEnvoieWalletToCard: state.envoieUserWalletToCardReducer.loading,
|
||||||
|
resultEnvoieWalletToCard: state.envoieUserWalletToCardReducer.result,
|
||||||
|
errorEnvoieWalletToCard: state.envoieUserWalletToCardReducer.error,
|
||||||
|
|
||||||
|
});
|
||||||
|
|
||||||
|
const mapDispatchToProps = dispatch => bindActionCreators({
|
||||||
|
checkIdTransactionAction,
|
||||||
|
checkIdTransactionReset,
|
||||||
|
|
||||||
|
envoieUserWalletToCardAction,
|
||||||
|
envoieUserWalletToCardReset
|
||||||
|
|
||||||
|
}, dispatch);
|
||||||
|
|
||||||
|
export default connect(maptStateToProps, mapDispatchToProps)(RetraitEnCashAgent);
|
||||||
|
|
||||||
|
const styles = StyleSheet.create({
|
||||||
|
container: {
|
||||||
|
flex: 1,
|
||||||
|
backgroundColor: Color.primaryDarkColor,
|
||||||
|
},
|
||||||
|
textbtnvalide: {
|
||||||
|
color: 'white',
|
||||||
|
fontWeight: 'bold'
|
||||||
|
},
|
||||||
|
bigtitle: {
|
||||||
|
color: 'white',
|
||||||
|
fontSize: 20,
|
||||||
|
flex: 1,
|
||||||
|
fontWeight: 'bold',
|
||||||
|
textAlign: 'center',
|
||||||
|
margin: 20,
|
||||||
|
},
|
||||||
|
blockView: {
|
||||||
|
paddingVertical: 10,
|
||||||
|
borderBottomWidth: 1
|
||||||
|
},
|
||||||
|
subbigtitle: {
|
||||||
|
color: 'white',
|
||||||
|
fontSize: 17,
|
||||||
|
textAlign: 'center',
|
||||||
|
margin: 5,
|
||||||
|
},
|
||||||
|
btnvalide: {
|
||||||
|
marginTop: 20,
|
||||||
|
marginLeft: 20,
|
||||||
|
marginRight: 20,
|
||||||
|
borderColor: 'transparent',
|
||||||
|
backgroundColor: Color.accentLightColor,
|
||||||
|
height: 52
|
||||||
|
},
|
||||||
|
btnSubmit: {
|
||||||
|
marginTop: 20,
|
||||||
|
borderColor: 'transparent',
|
||||||
|
backgroundColor: Color.accentLightColor,
|
||||||
|
height: 52,
|
||||||
|
width: "30%",
|
||||||
|
marginLeft: 20,
|
||||||
|
marginRight: 20,
|
||||||
|
},
|
||||||
|
input: {
|
||||||
|
height: 60,
|
||||||
|
marginTop: responsiveHeight(2),
|
||||||
|
marginLeft: responsiveWidth(5),
|
||||||
|
marginRight: responsiveWidth(5),
|
||||||
|
borderRadius: 5,
|
||||||
|
}
|
||||||
|
});
|
|
@ -106,7 +106,7 @@ class RetraitCarteVersCashUser extends Component {
|
||||||
if (errorEnvoieWalletToCard !== null) {
|
if (errorEnvoieWalletToCard !== null) {
|
||||||
if (typeof errorEnvoieWalletToCard.data !== 'undefined') {
|
if (typeof errorEnvoieWalletToCard.data !== 'undefined') {
|
||||||
Alert.alert(
|
Alert.alert(
|
||||||
I18n.t("ERROR_TRANSFER"),
|
I18n.t("WITHDRAWAL_ERROR"),
|
||||||
errorEnvoieWalletToCard.data.error,
|
errorEnvoieWalletToCard.data.error,
|
||||||
[
|
[
|
||||||
{
|
{
|
||||||
|
@ -123,7 +123,7 @@ class RetraitCarteVersCashUser extends Component {
|
||||||
if (resultEnvoieWalletToCard !== null) {
|
if (resultEnvoieWalletToCard !== null) {
|
||||||
if (resultEnvoieWalletToCard.response !== null) {
|
if (resultEnvoieWalletToCard.response !== null) {
|
||||||
Alert.alert(
|
Alert.alert(
|
||||||
I18n.t("SUCCESS_TRANSFER"),
|
I18n.t("WITHDRAWAL_SUCCESS"),
|
||||||
resultEnvoieWalletToCard.response,
|
resultEnvoieWalletToCard.response,
|
||||||
[
|
[
|
||||||
{
|
{
|
||||||
|
@ -276,7 +276,7 @@ class RetraitCarteVersCashUser extends Component {
|
||||||
else {
|
else {
|
||||||
|
|
||||||
this.props.getCommissionUserWalletToCardAction({
|
this.props.getCommissionUserWalletToCardAction({
|
||||||
type: 10,
|
type: 11,
|
||||||
id_wallet_user: this.state.wallet.id,
|
id_wallet_user: this.state.wallet.id,
|
||||||
montant: this.state.montant,
|
montant: this.state.montant,
|
||||||
});
|
});
|
||||||
|
|
|
@ -106,7 +106,7 @@ class RetraitCarteVersWalletUser extends Component {
|
||||||
if (errorEnvoieWalletToCard !== null) {
|
if (errorEnvoieWalletToCard !== null) {
|
||||||
if (typeof errorEnvoieWalletToCard.data !== 'undefined') {
|
if (typeof errorEnvoieWalletToCard.data !== 'undefined') {
|
||||||
Alert.alert(
|
Alert.alert(
|
||||||
I18n.t("ERROR_TRANSFER"),
|
I18n.t("WITHDRAWAL_ERROR"),
|
||||||
errorEnvoieWalletToCard.data.error,
|
errorEnvoieWalletToCard.data.error,
|
||||||
[
|
[
|
||||||
{
|
{
|
||||||
|
@ -123,7 +123,7 @@ class RetraitCarteVersWalletUser extends Component {
|
||||||
if (resultEnvoieWalletToCard !== null) {
|
if (resultEnvoieWalletToCard !== null) {
|
||||||
if (resultEnvoieWalletToCard.response !== null) {
|
if (resultEnvoieWalletToCard.response !== null) {
|
||||||
Alert.alert(
|
Alert.alert(
|
||||||
I18n.t("SUCCESS_TRANSFER"),
|
I18n.t("WITHDRAWAL_SUCCESS"),
|
||||||
resultEnvoieWalletToCard.response,
|
resultEnvoieWalletToCard.response,
|
||||||
[
|
[
|
||||||
{
|
{
|
||||||
|
|
|
@ -106,7 +106,7 @@ class RetraitWalletVersCashUser extends Component {
|
||||||
if (errorEnvoieWalletToCard !== null) {
|
if (errorEnvoieWalletToCard !== null) {
|
||||||
if (typeof errorEnvoieWalletToCard.data !== 'undefined') {
|
if (typeof errorEnvoieWalletToCard.data !== 'undefined') {
|
||||||
Alert.alert(
|
Alert.alert(
|
||||||
I18n.t("ERROR_TRANSFER"),
|
I18n.t("WITHDRAWAL_ERROR"),
|
||||||
errorEnvoieWalletToCard.data.error,
|
errorEnvoieWalletToCard.data.error,
|
||||||
[
|
[
|
||||||
{
|
{
|
||||||
|
@ -123,7 +123,7 @@ class RetraitWalletVersCashUser extends Component {
|
||||||
if (resultEnvoieWalletToCard !== null) {
|
if (resultEnvoieWalletToCard !== null) {
|
||||||
if (resultEnvoieWalletToCard.response !== null) {
|
if (resultEnvoieWalletToCard.response !== null) {
|
||||||
Alert.alert(
|
Alert.alert(
|
||||||
I18n.t("SUCCESS_TRANSFER"),
|
I18n.t("WITHDRAWAL_SUCCESS"),
|
||||||
resultEnvoieWalletToCard.response,
|
resultEnvoieWalletToCard.response,
|
||||||
[
|
[
|
||||||
{
|
{
|
||||||
|
|
|
@ -187,12 +187,12 @@ export const optionDepotScreen = {
|
||||||
subTitle: I18n.t('CHOOSE_OPTION'),
|
subTitle: I18n.t('CHOOSE_OPTION'),
|
||||||
options: [
|
options: [
|
||||||
{
|
{
|
||||||
screen: route.walletDepot,
|
screen: route.envoieCashVersWalletAgent,
|
||||||
icon: 'wallet',
|
icon: 'wallet',
|
||||||
title: I18n.t('DEPOSIT_CASH_TO_WALLET'),
|
title: I18n.t('DEPOSIT_CASH_TO_WALLET'),
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
screen: route.walletDepot,
|
screen: route.envoieCashVersAutreWalletAgent,
|
||||||
icon: 'cash-refund',
|
icon: 'cash-refund',
|
||||||
title: I18n.t('DEPOSIT_CASH_TO_OTHER_WALLET'),
|
title: I18n.t('DEPOSIT_CASH_TO_OTHER_WALLET'),
|
||||||
},
|
},
|
||||||
|
@ -215,10 +215,15 @@ export const optionRetraitScreen = {
|
||||||
subTitle: I18n.t('CHOOSE_OPTION'),
|
subTitle: I18n.t('CHOOSE_OPTION'),
|
||||||
options: [
|
options: [
|
||||||
{
|
{
|
||||||
screen: route.walletRetrait,
|
screen: route.retraitEnCashAgent,
|
||||||
icon: 'cash',
|
icon: 'cash',
|
||||||
title: I18n.t('WITHDRAWAL_IN_CASH'),
|
title: I18n.t('WITHDRAWAL_IN_CASH'),
|
||||||
},
|
},
|
||||||
|
{
|
||||||
|
screen: route.retraitCarteVersCashAgent,
|
||||||
|
icon: 'credit-card',
|
||||||
|
title: I18n.t('WITHDRAWAL_CARD_TO_CASH'),
|
||||||
|
},
|
||||||
]
|
]
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -282,7 +287,7 @@ export const optionRetraitUserScreen = {
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
screen: route.retraitCarteVersWalletUser,
|
screen: route.retraitCarteVersWalletUser,
|
||||||
icon: 'card',
|
icon: 'credit-card',
|
||||||
title: I18n.t('WITHDRAWAL_CARD_TO_WALLET'),
|
title: I18n.t('WITHDRAWAL_CARD_TO_WALLET'),
|
||||||
},
|
},
|
||||||
]
|
]
|
||||||
|
|
|
@ -43,6 +43,8 @@
|
||||||
"DEPOSIT_DESCRIPTION": "Make a deposit",
|
"DEPOSIT_DESCRIPTION": "Make a deposit",
|
||||||
"ERROR_TRANSFER": "Transfer error",
|
"ERROR_TRANSFER": "Transfer error",
|
||||||
"SUCCESS_TRANSFER": "Transfer done",
|
"SUCCESS_TRANSFER": "Transfer done",
|
||||||
|
"WITHDRAWAL_SUCCESS": "Withdrawal done",
|
||||||
|
"WITHDRAWAL_ERROR": "Withdrawal error",
|
||||||
"WALLET_TO_WALLET_SUCCESS_TRANSFER": "Wallet to wallet transfer successfully completed",
|
"WALLET_TO_WALLET_SUCCESS_TRANSFER": "Wallet to wallet transfer successfully completed",
|
||||||
"DEPOSIT": "Deposit",
|
"DEPOSIT": "Deposit",
|
||||||
"ENVOIE_ARGENT": "Send money",
|
"ENVOIE_ARGENT": "Send money",
|
||||||
|
@ -95,6 +97,7 @@
|
||||||
"FINAL_COUNTRY": "Arrival country",
|
"FINAL_COUNTRY": "Arrival country",
|
||||||
"NET_AMOUNT": "Net amount",
|
"NET_AMOUNT": "Net amount",
|
||||||
"CODE_WALLET": "Wallet Code",
|
"CODE_WALLET": "Wallet Code",
|
||||||
|
"CODE_RETRAIT": "Withdrawal code",
|
||||||
"ACTIVE_WALLET": "Active wallet",
|
"ACTIVE_WALLET": "Active wallet",
|
||||||
"TYPE_IDENTIFIANT": "ID type",
|
"TYPE_IDENTIFIANT": "ID type",
|
||||||
"PAYS_DESTINATION": "Destination country",
|
"PAYS_DESTINATION": "Destination country",
|
||||||
|
|
|
@ -71,6 +71,8 @@
|
||||||
"DEPOSIT_DESCRIPTION": "Effectuer un dépôt",
|
"DEPOSIT_DESCRIPTION": "Effectuer un dépôt",
|
||||||
"ERROR_TRANSFER": "Erreur de transfert",
|
"ERROR_TRANSFER": "Erreur de transfert",
|
||||||
"SUCCESS_TRANSFER": "Transfert effectué",
|
"SUCCESS_TRANSFER": "Transfert effectué",
|
||||||
|
"WITHDRAWAL_SUCCESS": "Retrait effectué",
|
||||||
|
"WITHDRAWAL_ERROR": "Erreur de retrait",
|
||||||
"WALLET_TO_WALLET_SUCCESS_TRANSFER": "Transfert de wallet à wallet effectué avec succès",
|
"WALLET_TO_WALLET_SUCCESS_TRANSFER": "Transfert de wallet à wallet effectué avec succès",
|
||||||
"WITHDRAWAL": "Retrait",
|
"WITHDRAWAL": "Retrait",
|
||||||
"LINK_CARD": "Lier ma carte",
|
"LINK_CARD": "Lier ma carte",
|
||||||
|
@ -100,6 +102,7 @@
|
||||||
"FINAL_COUNTRY": "Pays d'arrivée",
|
"FINAL_COUNTRY": "Pays d'arrivée",
|
||||||
"NET_AMOUNT": "Montant net",
|
"NET_AMOUNT": "Montant net",
|
||||||
"CODE_WALLET": "Code Wallet",
|
"CODE_WALLET": "Code Wallet",
|
||||||
|
"CODE_RETRAIT": "Code Retrait",
|
||||||
"TYPE_IDENTIFIANT": "Type d'identifiant",
|
"TYPE_IDENTIFIANT": "Type d'identifiant",
|
||||||
"PAYS_DESTINATION": "Pays destination",
|
"PAYS_DESTINATION": "Pays destination",
|
||||||
"ACTIVE_WALLET": "Wallet actif",
|
"ACTIVE_WALLET": "Wallet actif",
|
||||||
|
@ -185,6 +188,7 @@
|
||||||
"IDENTITY_NUMBER": "N° de la pièce",
|
"IDENTITY_NUMBER": "N° de la pièce",
|
||||||
"IDENTITY_PIECE_EXPIRY_DATE": "Date d'expiration",
|
"IDENTITY_PIECE_EXPIRY_DATE": "Date d'expiration",
|
||||||
"LAST_STEP": "Derniere étape",
|
"LAST_STEP": "Derniere étape",
|
||||||
|
"ID_TRANSACTION": "Identifiant de la transactin",
|
||||||
"ACTIVE_ACCOUNT": "Activez le compte !",
|
"ACTIVE_ACCOUNT": "Activez le compte !",
|
||||||
"ACTIVE_USER": "Activer",
|
"ACTIVE_USER": "Activer",
|
||||||
"LAST_STEP_TEXT": "Activez votre compte à l'aide du code de validation qui vous a été envoyé sur votre adresse e-mail et sur votre numero de téléphone",
|
"LAST_STEP_TEXT": "Activez votre compte à l'aide du code de validation qui vous a été envoyé sur votre adresse e-mail et sur votre numero de téléphone",
|
||||||
|
|
|
@ -3,7 +3,7 @@ import axios from "axios";
|
||||||
import I18n from 'react-native-i18n';
|
import I18n from 'react-native-i18n';
|
||||||
import { store } from "../redux/store";
|
import { store } from "../redux/store";
|
||||||
import { envoieUserWalletToWallet, envoieCommissionUrl } from "./IlinkConstants";
|
import { envoieUserWalletToWallet, envoieCommissionUrl } from "./IlinkConstants";
|
||||||
import { fetchEnvoieUserWalletToWalletPending, fetchEnvoieUserWalletToWalletSuccess, fetchEnvoieUserWalletToWalletError, fetchEnvoieUserWalletToWalletReset, fetchEnvoieUserWalletToWalleGetCommissiontPending, fetchEnvoieUserWalletToWalleGetCommissiontReset, fetchEnvoieUserWalletToWalletGetCommissionSuccess, fetchEnvoieUserWalletToWalletGetCommissionError, fetchEnvoieUserWalletToCashPending, fetchEnvoieUserWalletToCashSuccess, fetchEnvoieUserWalletToCashError, fetchEnvoieUserWalletToCashReset, fetchEnvoieUserWalletToCashGetCommissiontPending, fetchEnvoieUserWalletToCashGetCommissiontReset, fetchEnvoieUserWalletToCashGetCommissionError, fetchEnvoieUserWalletToCashGetCommissionSuccess, fetchEnvoieUserWalletToCardPending, fetchEnvoieUserWalletToCardSuccess, fetchEnvoieUserWalletToCardError, fetchEnvoieUserWalletToCardReset, fetchEnvoieUserWalletToCardGetCommissiontPending, fetchEnvoieUserWalletToCardGetCommissionSuccess, fetchEnvoieUserWalletToCardGetCommissiontReset } from "../redux/actions/EnvoieUserType";
|
import { fetchEnvoieUserWalletToWalletPending, fetchEnvoieUserWalletToWalletSuccess, fetchEnvoieUserWalletToWalletError, fetchEnvoieUserWalletToCardGetCommissionError, fetchEnvoieUserWalletToWalletReset, fetchEnvoieUserWalletToWalleGetCommissiontPending, fetchEnvoieUserWalletToWalleGetCommissiontReset, fetchEnvoieUserWalletToWalletGetCommissionSuccess, fetchEnvoieUserWalletToWalletGetCommissionError, fetchEnvoieUserWalletToCashPending, fetchEnvoieUserWalletToCashSuccess, fetchEnvoieUserWalletToCashError, fetchEnvoieUserWalletToCashReset, fetchEnvoieUserWalletToCashGetCommissiontPending, fetchEnvoieUserWalletToCashGetCommissiontReset, fetchEnvoieUserWalletToCashGetCommissionError, fetchEnvoieUserWalletToCashGetCommissionSuccess, fetchEnvoieUserWalletToCardPending, fetchEnvoieUserWalletToCardSuccess, fetchEnvoieUserWalletToCardError, fetchEnvoieUserWalletToCardReset, fetchEnvoieUserWalletToCardGetCommissiontPending, fetchEnvoieUserWalletToCardGetCommissionSuccess, fetchEnvoieUserWalletToCardGetCommissiontReset } from "../redux/actions/EnvoieUserType";
|
||||||
|
|
||||||
export const envoieUserWalletToWalletAction = (data) => {
|
export const envoieUserWalletToWalletAction = (data) => {
|
||||||
|
|
||||||
|
|
|
@ -46,6 +46,7 @@ export const payCountryNetworkUrl = testBaseUrl + '/walletService/paying_network
|
||||||
|
|
||||||
export const envoieUserWalletToWallet = testBaseUrl + '/walletService/transactions/ilink';
|
export const envoieUserWalletToWallet = testBaseUrl + '/walletService/transactions/ilink';
|
||||||
export const envoieCommissionUrl = testBaseUrl + '/walletService/transactions/ilink/commission';
|
export const envoieCommissionUrl = testBaseUrl + '/walletService/transactions/ilink/commission';
|
||||||
|
export const idVerificationUrl = testBaseUrl + '/walletService/transactions/ilink/check_retraits';
|
||||||
|
|
||||||
export const linkCardUrl = testBaseUrl + '/walletService/identifications/rattach_card';
|
export const linkCardUrl = testBaseUrl + '/walletService/identifications/rattach_card';
|
||||||
|
|
||||||
|
|
|
@ -0,0 +1,44 @@
|
||||||
|
|
||||||
|
import axios from "axios";
|
||||||
|
import I18n from 'react-native-i18n';
|
||||||
|
import { store } from "../../redux/store";
|
||||||
|
import { idVerificationUrl } from "../IlinkConstants";
|
||||||
|
import { fetchRetraitCashAgentIdVerificationPending, fetchRetraitCashAgentIdVerificationSuccess, fetchRetraitCashAgentIdVerificationError, fetchRetraitCashAgentIdVerificationReset } from "../../redux/actions/EnvoieAgentAction";
|
||||||
|
|
||||||
|
export const checkIdTransactionAction = (data) => {
|
||||||
|
|
||||||
|
const auth = store.getState().authKeyReducer;
|
||||||
|
const authKey = auth !== null ? `${auth.authKey.token_type} ${auth.authKey.access_token}` : '';
|
||||||
|
|
||||||
|
return dispatch => {
|
||||||
|
dispatch(fetchRetraitCashAgentIdVerificationPending());
|
||||||
|
|
||||||
|
axios({
|
||||||
|
url: `${idVerificationUrl}`,
|
||||||
|
method: 'POST',
|
||||||
|
data,
|
||||||
|
headers: {
|
||||||
|
'Authorization': authKey,
|
||||||
|
'X-Localization': I18n.currentLocale()
|
||||||
|
}
|
||||||
|
})
|
||||||
|
.then(response => {
|
||||||
|
console.log(response);
|
||||||
|
dispatch(fetchRetraitCashAgentIdVerificationSuccess(response));
|
||||||
|
})
|
||||||
|
.catch(error => {
|
||||||
|
if (error.response)
|
||||||
|
dispatch(fetchRetraitCashAgentIdVerificationError(error.response));
|
||||||
|
else if (error.request)
|
||||||
|
dispatch(fetchRetraitCashAgentIdVerificationError(error.request))
|
||||||
|
else
|
||||||
|
dispatch(fetchRetraitCashAgentIdVerificationError(error.message))
|
||||||
|
});
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
export const checkIdTransactionReset = () => {
|
||||||
|
return dispatch => {
|
||||||
|
dispatch(fetchRetraitCashAgentIdVerificationReset());
|
||||||
|
}
|
||||||
|
}
|
Loading…
Reference in New Issue