EnvoieWalletToWalletUser ok

This commit is contained in:
Brice Zele 2020-06-23 11:28:52 +01:00
parent 2c6f4052da
commit 2da67a1dfd
16 changed files with 258 additions and 45 deletions

4
App.js
View File

@ -55,6 +55,7 @@ import CreateIdentificationUser from './screens/identification/CreateIdentificat
import OperateurOptionSelect from './screens/wallet/OperateurOptionSelect';
import PaiementFacture from './screens/wallet/PaiementFacture';
import EnvoieWalletToWalletUser from './screens/wallet/user/EnvoieWalletToWalletUser';
import EnvoieWalletToCashUser from './screens/wallet/user/EnvoieWalletToCash';
const instructions = Platform.select({
ios: 'Press Cmd+R to reload,\n' + 'Cmd+D or shake for dev menu',
@ -98,7 +99,8 @@ const AppStack = createDrawerNavigator({
operateurOptionSelect: OperateurOptionSelect,
operateurOptionSelect: OperateurOptionSelect,
paiementFacture: PaiementFacture,
envoieWalletToWalletUser: EnvoieWalletToWalletUser
envoieWalletToWalletUser: EnvoieWalletToWalletUser,
envoieWalletToCashUser: EnvoieWalletToCashUser
})
}, { contentComponent: OptionsMenu, headerMode: 'none', contentOptions: { activeTintColor: theme.accent } })

View File

@ -0,0 +1,19 @@
import { ENVOIE_WALLET_TO_WALLET_USER_PENDING, ENVOIE_WALLET_TO_WALLET_USER_SUCCESS, ENVOIE_WALLET_TO_WALLET_USER_ERROR, ENVOIE_WALLET_TO_WALLET_USER_RESET } from "../types/EnvoieUserType";
export const fetchEnvoieUserWalletToWalletPending = () => ({
type: ENVOIE_WALLET_TO_WALLET_USER_PENDING
});
export const fetchEnvoieUserWalletToWalletSuccess = (res) => ({
type: ENVOIE_WALLET_TO_WALLET_USER_SUCCESS,
result: res,
});
export const fetchEnvoieUserWalletToWalletError = (error) => ({
type: ENVOIE_WALLET_TO_WALLET_USER_ERROR,
result: error
});
export const fetchEnvoieUserWalletToWalletReset = (error) => ({
type: ENVOIE_WALLET_TO_WALLET_USER_RESET
});

View File

@ -0,0 +1,33 @@
import { ENVOIE_WALLET_TO_WALLET_USER_PENDING, ENVOIE_WALLET_TO_WALLET_USER_SUCCESS, ENVOIE_WALLET_TO_WALLET_USER_ERROR, ENVOIE_WALLET_TO_WALLET_USER_RESET } from "../types/EnvoieUserType";
const initialState = {
loading: false,
result: null,
error: null
};
export default (state = initialState, action) => {
switch (action.type) {
case ENVOIE_WALLET_TO_WALLET_USER_PENDING: return {
...state,
loading: true
}
case ENVOIE_WALLET_TO_WALLET_USER_SUCCESS: return {
...state,
loading: false,
result: action.result.data,
error: null
}
case ENVOIE_WALLET_TO_WALLET_USER_ERROR: return {
...state,
loading: false,
result: null,
error: action.result
}
case ENVOIE_WALLET_TO_WALLET_USER_RESET: return initialState;
default: {
return state;
}
}
};

View File

@ -16,6 +16,7 @@ import walletReducer from "./WalletReducer";
import walletHistoryReducer from "./WalletTransactionHistoryReducer";
import walletTransferCommissionReducer from "./WalletTransferCommission";
import CountryByDialCodeReducer from "./CountryByDialCodeReducer";
import EnvoieUserWalletToWalletReducer from "./EnvoieUserWalletToWalletReducer";
const persistConfig = {
key: 'root',
@ -40,7 +41,8 @@ const rootReducer = persistCombineReducers(persistConfig, {
validateIdentificationReducer: ValidateIdentificationReducer,
payCountryNetworkReducer: PayCountryNetworkReducer,
activeCountryListReducer: ActiveCountryListReducer,
countryByDialCode: CountryByDialCodeReducer
countryByDialCode: CountryByDialCodeReducer,
envoieUserWalletToWalletReducer: EnvoieUserWalletToWalletReducer
});

View File

@ -38,5 +38,6 @@
"validateIdentification": "validateIdentification",
"operateurOptionSelect": "operateurOptionSelect",
"paiementFacture": "paiementFacture",
"envoieWalletToWalletUser": "envoieWalletToWalletUser"
"envoieWalletToWalletUser": "envoieWalletToWalletUser",
"envoieWalletToCashUser": "envoieWalletToCashUser"
}

View File

@ -525,6 +525,7 @@ class CreateIdentification extends Component {
<Fumi iconClass={FontAwesomeIcon} iconName={'phone'}
label={I18n.t('PHONE')}
iconColor={'#f95a25'}
keyboardType='phone-pad'
value={this.state.numeroTelephone === null ? this.state.indicatif : this.state.numeroTelephone}
iconSize={20}
onChangeText={(numeroTelephone) => {

View File

@ -529,6 +529,7 @@ class ValidateIdentification extends Component {
<Fumi iconClass={FontAwesomeIcon} iconName={'phone'}
label={`${I18n.t('PHONE_NUMBER')}`}
iconColor={'#f95a25'}
keyboardType='phone-pad'
value={this.state.numeroTelephone === null ? this.state.indicatif : this.state.numeroTelephone}
iconSize={20}
onChangeText={(numeroTelephone) => {

View File

@ -253,7 +253,8 @@ export default class OptionsMenu extends Component {
_renderItem = (item) => {
if (item === "creditrequest" || item === 'historyItemDetails' || item === 'filter' || item === 'networks' || item === 'walletDetail' || item === 'walletDetailUser'
|| 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') {
return null
} else {
const color = this.state.currentId === item.id ? theme.accent : "grey"

View File

@ -86,7 +86,7 @@ class WalletDetailUser extends Component {
if (user) {
if (user !== undefined) {
this.setState({ user });
this.props.getUserIdentificationAction(user.id);
this.props.getUserIdentificationAction(user.phone);
}
}
});
@ -387,6 +387,7 @@ class WalletDetailUser extends Component {
<View style={[styles.containerTouch]}>
<TouchableOpacity style={styles.contain}
onPress={() => {
if (this.state.isIdentifiedValidated) {
this.props.navigation.push(route.walletOptionSelect, {
optionSelect: optionDepotUserScreen,
lottie: {
@ -394,6 +395,10 @@ class WalletDetailUser extends Component {
loop: false
}
})
} else if (this.state.isIdentified)
displayToast(I18n.t('NOT_IDENTIFIED'))
else
displayToast(I18n.t('NOT_VALIDATED'));
}}
activeOpacity={0.9}>
<Icon name='arrow-bottom-right'
@ -423,6 +428,7 @@ class WalletDetailUser extends Component {
<TouchableOpacity style={styles.contain}
onPress={() => {
if (this.state.isIdentifiedValidated) {
this.props.navigation.push(route.walletOptionSelect, {
optionSelect: optionRetraitUserScreen,
lottie: {
@ -430,6 +436,10 @@ class WalletDetailUser extends Component {
loop: true
}
})
} else if (this.state.isIdentified)
displayToast(I18n.t('NOT_IDENTIFIED'))
else
displayToast(I18n.t('NOT_VALIDATED'));
}}
activeOpacity={0.9}>
@ -462,7 +472,14 @@ class WalletDetailUser extends Component {
<View style={[styles.containerTouch]}>
<TouchableOpacity style={styles.contain}
onPress={() => { }}
onPress={() => {
if (this.state.isIdentifiedValidated) {
} else if (this.state.isIdentified)
displayToast(I18n.t('NOT_IDENTIFIED'))
else
displayToast(I18n.t('NOT_VALIDATED'));
}}
activeOpacity={0.9}>
<Icon name='cash-multiple'
@ -490,7 +507,14 @@ class WalletDetailUser extends Component {
<View style={[styles.containerTouch]}>
<TouchableOpacity style={styles.contain}
onPress={() => { }}
onPress={() => {
if (this.state.isIdentifiedValidated) {
} else if (this.state.isIdentified)
displayToast(I18n.t('NOT_IDENTIFIED'))
else
displayToast(I18n.t('NOT_VALIDATED'));
}}
activeOpacity={0.9}>
<Icon name='heart-multiple'
color={Color.primaryColor}
@ -522,6 +546,8 @@ class WalletDetailUser extends Component {
<TouchableOpacity style={styles.contain}
onPress={() => {
if (this.state.isIdentifiedValidated) {
this.props.navigation.push(route.walletOptionSelect, {
optionSelect: optionPaiementFacture,
onGoBack: () => this.refresh(),
@ -530,6 +556,11 @@ class WalletDetailUser extends Component {
loop: true
}
})
} else if (this.state.isIdentified)
displayToast(I18n.t('NOT_IDENTIFIED'))
else
displayToast(I18n.t('NOT_VALIDATED'));
}} activeOpacity={0.9}>
<Icon name='file-document'

View File

@ -36,7 +36,7 @@ class EnvoieWalletToCashUser extends Component {
static navigationOptions = () => {
return {
drawerLabel: () => null,
headerTitle: I18n.t('DEPOSIT_WALLET_TO_WALLET'),
headerTitle: I18n.t('DEPOSIT_TO_CASH'),
headerTintColor: 'white',
headerStyle: {
backgroundColor: Color.primaryColor,
@ -46,7 +46,7 @@ class EnvoieWalletToCashUser extends Component {
headerTitleStyle: {
color: "white"
},
title: I18n.t('DEPOSIT_WALLET_TO_WALLET')
title: I18n.t('DEPOSIT_TO_CASH')
}
};

View File

@ -2,10 +2,10 @@ import Button from 'apsl-react-native-button';
import isEqual from 'lodash/isEqual';
import isNil from 'lodash/isNil';
import React, { Component } from 'react';
import { Keyboard, PermissionsAndroid, ProgressBarAndroid, ScrollView, StyleSheet, Text, View, Platform, Alert } from 'react-native';
import { Alert, PermissionsAndroid, Platform, ScrollView, StyleSheet, Text } from 'react-native';
import * as Animatable from 'react-native-animatable';
import Geolocation from 'react-native-geolocation-service';
import I18n from 'react-native-i18n';
import { MaterialDialog } from "react-native-material-dialog";
import { Dropdown } from 'react-native-material-dropdown';
import { responsiveHeight, responsiveWidth } from 'react-native-responsive-dimensions';
import { ProgressDialog } from 'react-native-simple-dialogs';
@ -13,12 +13,13 @@ 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 Geolocation from 'react-native-geolocation-service';
import { identityPieces, paysDestinationData, walletActifData, typeIdIDestinataire, isIlinkWorldWallet } from '../../../utils/UtilsFunction';
import { Color } from '../../../config/Color';
import { identityPieces, isIlinkWorldWallet, typeIdIDestinataire, isNormalInteger } from '../../../utils/UtilsFunction';
import { readUser } from '../../../webservice/AuthApi';
import { getActiveCountryAction, getActiveCountryByDialCodeAction, getActiveCountryByDialCodeReset, getActiveCountryReset, getPayCountryNetworkAction, getPayCountryNetworkReset } from '../../../webservice/CountryApi';
import { readUser, getTownInformationName, getListCountriesActive } from '../../../webservice/AuthApi';
import { envoieUserWalletToWalletAction, envoieUserWalletToWalletReset } from '../../../webservice/EnvoieUserApi';
import { getPositionInformation } from '../../../webservice/MapService';
import { store } from "../../../redux/store";
let theme = require('../../../utils/theme.json');
let route = require('../../../route.json');
const GEOLOCATION_OPTIONS = { enableHighAccuracy: true, timeout: 20000, maximumAge: 1000, useSignificantChanges: true };
@ -71,12 +72,14 @@ class EnvoieWalletToWalletUser extends Component {
modalVisible: true,
hasLoadActiveCountryList: true,
hasLoadActivePayCountryNetworkList: true,
triggerSubmitClick: false
triggerSubmitClick: false,
wallet: store.getState().walletDetailReducer.result.response
};
this.props.getActiveCountryReset();
this.props.getActiveCountryByDialCodeReset();
this.props.getPayCountryNetworkReset();
this.props.envoieUserWalletToWalletReset();
}
@ -200,6 +203,47 @@ class EnvoieWalletToWalletUser extends Component {
}
}
renderEnvoieWalletToWalletResponse = () => {
const { resultEnvoieWalletToWallet, errorEnvoieWalletToWallet } = this.props;
if (errorEnvoieWalletToWallet !== null) {
if (typeof errorEnvoieWalletToWallet.data !== 'undefined') {
Alert.alert(
I18n.t("ERROR_TRANSFER"),
errorEnvoieWalletToWallet.data.error,
[
{
text: I18n.t("OK"), onPress: () => {
this.props.envoieUserWalletToWalletReset();
}
}
],
{ cancelable: false }
)
}
}
if (resultEnvoieWalletToWallet !== null) {
if (resultEnvoieWalletToWallet.response !== null) {
Alert.alert(
I18n.t("SUCCESS_TRANSFER"),
I18n.t("WALLET_TO_WALLET_SUCCESS_TRANSFER"),
[
{
text: I18n.t("OK"), onPress: () => {
this.props.envoieUserWalletToWalletReset();
this.props.navigation.pop();
}
}
],
{ cancelable: false }
)
}
}
}
showErrorDialog() {
Alert.alert("Une erreur est survenue", "Impossible de récuperer des informations du pays verifier que votre gps est activé," +
"et que vous êtes connecté à internet puis ressayer", [{
@ -339,7 +383,7 @@ class EnvoieWalletToWalletUser extends Component {
isValid: false
};
else if (!this.isNormalInteger(montant))
else if (!isNormalInteger(montant))
return {
errorMessage: I18n.t('ENTER_VALID_AMOUNT'),
isValid: false
@ -374,12 +418,27 @@ class EnvoieWalletToWalletUser extends Component {
this.numeroIdentiteAnim.shake(800);
else if (this.ckeckIfFieldIsOK(numeroTelephoneOrWalletCode))
this.numeroTelephoneAnim.shake(800);
else if (this.ckeckIfFieldIsOK(montant) || this.isMontantValid().isValid)
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
this.props.envoieUserWalletToWalletAction({
type: 1,
id_wallet_user: this.state.wallet.id,
id_network: this.state.wallet.idNetwork,
init_country: (this.state.paysDestination.filter(element => element.code_country === this.state.shortCountry))[0].id,
final_country: (this.state.paysDestination.filter(element => element.name === this.state.paysDestinationSelect))[0].id,
id_destinataire: this.state.numeroTelephoneOrWalletCode,
type_document_destinataire: this.state.identityPiecesName,
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.setState({
triggerSubmitClick: true
@ -390,7 +449,7 @@ class EnvoieWalletToWalletUser extends Component {
renderLoader = () => {
return (
<ProgressDialog
visible={this.props.loadingCountryByDialCode || this.props.loadingActiveCountryList || this.props.loadingPayCountryNetwork}
visible={this.state.modalVisible || this.props.loadingEnvoieWalletToWallet || this.props.loadingCountryByDialCode || this.props.loadingActiveCountryList || this.props.loadingCountryByDialCode}
title={I18n.t('LOADING')}
message={I18n.t('LOADING_INFO')}
/>
@ -401,11 +460,10 @@ class EnvoieWalletToWalletUser extends Component {
console.log("STATE", this.state);
return (
<>
{(this.state.modalVisible || this.props.loadingCountryByDialCode || this.props.loadingActiveCountryList || this.props.loadingCountryByDialCode) && this.renderLoader()}
{(this.state.modalVisible || this.props.loadingEnvoieWalletToWallet || this.props.loadingCountryByDialCode || this.props.loadingActiveCountryList || this.props.loadingCountryByDialCode) && this.renderLoader()}
{this.state.hasLoadActiveCountryList && this.renderGetActionCountryList()}
{this.state.hasLoadActivePayCountryNetworkList && this.renderGetPayCountryNetworkResponse()}
{this.state.triggerSubmitClick && this.renderEnvoieWalletToWalletResponse()}
{this.state.triggerNextClick && this.renderGetNumberResponse()} */}
<ScrollView style={styles.container}>
<Text style={styles.subbigtitle}>{I18n.t('ENVOIE_WALLET_TO_WALLET')}</Text>
@ -529,6 +587,7 @@ class EnvoieWalletToWalletUser extends Component {
<Fumi iconClass={FontAwesomeIcon} iconName={isEqual(this.state.typeIdDestinataireSelect, I18n.t('PHONE')) ? 'phone' : 'lock'}
label={isEqual(this.state.typeIdDestinataireSelect, I18n.t('PHONE')) ? I18n.t('PHONE') : I18n.t('CODE_WALLET')}
iconColor={'#f95a25'}
keyboardType={isEqual(this.state.typeIdDestinataireSelect, I18n.t('PHONE')) ? 'phone-pad' : 'default'}
iconSize={20}
value={this.state.numeroTelephoneOrWalletCode}
onChangeText={(numeroTelephoneOrWalletCode) => {
@ -543,6 +602,7 @@ class EnvoieWalletToWalletUser extends Component {
<Fumi iconClass={FontAwesomeIcon} iconName={'money'}
label={I18n.t('AMOUNT')}
iconColor={'#f95a25'}
keyboardType='numeric'
iconSize={20}
value={this.state.montant}
onChangeText={(montant) => {
@ -558,6 +618,7 @@ class EnvoieWalletToWalletUser extends Component {
label={I18n.t('PASSWORD')}
iconColor={'#f95a25'}
iconSize={20}
secureTextEntry={true}
value={this.state.password}
onChangeText={(password) => {
this.setState({ password })
@ -590,6 +651,10 @@ const maptStateToProps = state => ({
loadingPayCountryNetwork: state.payCountryNetworkReducer.loading,
resultPayCountryNetwork: state.payCountryNetworkReducer.result,
errorPayCountryNetwork: state.payCountryNetworkReducer.error,
loadingEnvoieWalletToWallet: state.envoieUserWalletToWalletReducer.loading,
resultEnvoieWalletToWallet: state.envoieUserWalletToWalletReducer.result,
errorEnvoieWalletToWallet: state.envoieUserWalletToWalletReducer.error,
});
const mapDispatchToProps = dispatch => bindActionCreators({
@ -600,7 +665,10 @@ const mapDispatchToProps = dispatch => bindActionCreators({
getPayCountryNetworkReset,
getActiveCountryAction,
getActiveCountryReset
getActiveCountryReset,
envoieUserWalletToWalletAction,
envoieUserWalletToWalletReset
}, dispatch);

View File

@ -256,7 +256,7 @@ export const optionDepotUserScreen = {
title: I18n.t('DEPOSIT_WALLET_TO_WALLET'),
},
{
screen: route.walletDepot,
screen: route.envoieWalletToCashUser,
icon: 'cash-refund',
title: I18n.t('DEPOSIT_TO_CASH'),
},

View File

@ -41,6 +41,9 @@
"MAKE_DEPOSIT": "Make a deposit",
"MAKE_WITHDRAWAL": "Make withdrawal",
"DEPOSIT_DESCRIPTION": "Make a deposit",
"ERROR_TRANSFER": "Transfer error",
"SUCCESS_TRANSFER": "Transfer done",
"WALLET_TO_WALLET_SUCCESS_TRANSFER": "Wallet to wallet transfer successfully completed",
"DEPOSIT": "Deposit",
"CONFIRM_DEPOSIT": "Confirm deposit",
"CONFIRM_WITHDRAWAL": "Confirm withdrawal",
@ -308,6 +311,7 @@
"ACCOUNT_INFO": "My Account Information",
"ALREADY_IDENTIFIED": "You are already identified",
"NOT_IDENTIFIED": "This number exists, its identification is not yet entered",
"NOT_VALIDATED": "Your identicaiton is not yet validated",
"ALREADY_VALIDATED": "The identification of this client has already been validated",
"IDENTIFICATION": " Identification",
"CREATION_IDENTIFICATION": "Creation",

View File

@ -67,6 +67,9 @@
"CHOOSE_OPTION": "Veuillez sélectionner une option",
"CHOOSE_OPERATOR": "Veuillez sélectionner un opérateur",
"DEPOSIT_DESCRIPTION": "Effectuer un dépôt",
"ERROR_TRANSFER": "Erreur de transfert",
"SUCCESS_TRANSFER": "Transfert effectué",
"WALLET_TO_WALLET_SUCCESS_TRANSFER": "Transfert de wallet à wallet effectué avec succès",
"WITHDRAWAL": "Retrait",
"WITHDRAWAL_IN_CASH": "Retrait en cash",
"WITHDRAWAL_WALLET_TO_CASH": "Retrait wallet vers cash",
@ -311,6 +314,7 @@
"ACCOUNT_INFO": " Information sur mon compte",
"ALREADY_IDENTIFIED": "Vous êtes déjà identifié",
"NOT_IDENTIFIED": "Ce numéro existe, son identification n'est pas encore saisi",
"NOT_VALIDATED": "Votre identicaiton n'est pas encore validé",
"ALREADY_VALIDATED": "L'identification de ce client a déjà été validée",
"IDENTIFICATION": " Identification",
"CREATION_IDENTIFICATION": "Création",

View File

@ -0,0 +1,44 @@
import axios from "axios";
import I18n from 'react-native-i18n';
import { store } from "../redux/store";
import { envoieUserWalletToWallet } from "./IlinkConstants";
import { fetchEnvoieUserWalletToWalletPending, fetchEnvoieUserWalletToWalletSuccess, fetchEnvoieUserWalletToWalletError, fetchEnvoieUserWalletToWalletReset } from "../redux/actions/EnvoieUserType";
export const envoieUserWalletToWalletAction = (data) => {
const auth = store.getState().authKeyReducer;
const authKey = auth !== null ? `${auth.authKey.token_type} ${auth.authKey.access_token}` : '';
return dispatch => {
dispatch(fetchEnvoieUserWalletToWalletPending());
axios({
url: `${envoieUserWalletToWallet}`,
method: 'GET',
data,
headers: {
'Authorization': authKey,
'X-Localization': I18n.currentLocale()
}
})
.then(response => {
console.log(response);
dispatch(fetchEnvoieUserWalletToWalletSuccess(response));
})
.catch(error => {
if (error.response)
dispatch(fetchEnvoieUserWalletToWalletError(error.response));
else if (error.request)
dispatch(fetchEnvoieUserWalletToWalletError(error.request))
else
dispatch(fetchEnvoieUserWalletToWalletError(error.message))
});
}
}
export const envoieUserWalletToWalletReset = () => {
return dispatch => {
dispatch(fetchEnvoieUserWalletToWalletReset());
}
}

View File

@ -44,6 +44,8 @@ export const getUserIdentifiedInformationUrl = testBaseUrl + '/walletService/ide
export const activeCountryUrl = testBaseUrl + '/walletService/countries';
export const payCountryNetworkUrl = testBaseUrl + '/walletService/paying_networks';
export const envoieUserWalletToWallet = testBaseUrl + '/walletService/transactions/ilink';
export const authKeyUrl = testBaseUrl + '/oauth/token';
export const videoUrl = "https://www.youtube.com/watch?v=wwGPDPsSLWY";
export const MARKER_URL = baseUrl + "/interacted/LocationAction.php";