wallet ok

This commit is contained in:
Brice Zele 2020-05-06 12:04:26 +01:00
parent a06dcff31a
commit 7d5c4a105e
16 changed files with 821 additions and 777 deletions

File diff suppressed because one or more lines are too long

View File

@ -41,6 +41,7 @@
"DEPOSIT_DESCRIPTION": "Make a deposit", "DEPOSIT_DESCRIPTION": "Make a deposit",
"DEPOSIT": "Deposit", "DEPOSIT": "Deposit",
"CONFIRM_DEPOSIT": "Confirm deposit", "CONFIRM_DEPOSIT": "Confirm deposit",
"CONFIRM_WITHDRAWAL": "Confirm withdrawal",
"CARD_NUMBER_LABEL": "Card number", "CARD_NUMBER_LABEL": "Card number",
"CARD_EXPIRY_LABEL": "Expiry.", "CARD_EXPIRY_LABEL": "Expiry.",
"CARD_CVC_LABEL": "CVC/CCV", "CARD_CVC_LABEL": "CVC/CCV",
@ -60,7 +61,7 @@
"CONFIRM_TRANSFER_COMMISSION": "Confirm commission transfer", "CONFIRM_TRANSFER_COMMISSION": "Confirm commission transfer",
"CREATION_DATE": "Creation date", "CREATION_DATE": "Creation date",
"PRINCIPAL_ACCOUNT_TITLE": "Principal account", "PRINCIPAL_ACCOUNT_TITLE": "Principal account",
"NO_WALLET_ACTIVED": "PNo wallet is activated for your account", "NO_WALLET_ACTIVED": "No wallet is activated for your account",
"TRANSFER_TO_PRINCIPAL_ACCOUNT": "Transfer commissions", "TRANSFER_TO_PRINCIPAL_ACCOUNT": "Transfer commissions",
"PRINCIPAL": "Principal", "PRINCIPAL": "Principal",
"ENTER_YOUR_CARD_ID": "Please enter your bank card ID", "ENTER_YOUR_CARD_ID": "Please enter your bank card ID",
@ -112,6 +113,7 @@
"COUNTRY_CHOICE": "Choose a country", "COUNTRY_CHOICE": "Choose a country",
"LAST_STEP": "Last step", "LAST_STEP": "Last step",
"ACTIVE_ACCOUNT": "Activate the account !", "ACTIVE_ACCOUNT": "Activate the account !",
"ACTIVE_USER": "Active",
"LAST_STEP_TEXT": "Activate your account using the verification code that was sent to you on your e-mail address and on your phone number", "LAST_STEP_TEXT": "Activate your account using the verification code that was sent to you on your e-mail address and on your phone number",
"NETWORK_CHOICE": "Choix du réseau", "NETWORK_CHOICE": "Choix du réseau",
"CHOICE_NETWORK_TEXT": "Define a network to display", "CHOICE_NETWORK_TEXT": "Define a network to display",
@ -141,6 +143,7 @@
"ERROR_FILTER": "Error occurred during the filter", "ERROR_FILTER": "Error occurred during the filter",
"ERROR_LABLE": "Erreur", "ERROR_LABLE": "Erreur",
"ERROR_TRANSFER_COMMISSION": "Commissions transfer error", "ERROR_TRANSFER_COMMISSION": "Commissions transfer error",
"TRANSFER_COMMISSION_IMPOSSIBLE": "Commissions transfer impossible",
"ERROR_FILTER_TEXT": "Problem encountered while filtering.", "ERROR_FILTER_TEXT": "Problem encountered while filtering.",
"ERROR_TREATMENT_DEMAND": "Request processing error", "ERROR_TREATMENT_DEMAND": "Request processing error",
"REFUSER_DEMANDE": "Reject the request", "REFUSER_DEMANDE": "Reject the request",
@ -200,6 +203,7 @@
"ADD_SUCCESS_TEXT": "The number has been added to the network successfully", "ADD_SUCCESS_TEXT": "The number has been added to the network successfully",
"MEMBER_CODE": "Member Code", "MEMBER_CODE": "Member Code",
"MEMBER_INFO": "Member Information", "MEMBER_INFO": "Member Information",
"NO_MEMBERS": "No registered members",
"DEMAND_INFO": "Information on the request", "DEMAND_INFO": "Information on the request",
"ACCOUNT_NOT_ACTIVE": "Your account is not activated", "ACCOUNT_NOT_ACTIVE": "Your account is not activated",
"ENTER_VALIDATION_CODE": "Enter the validation code that was sent to you.", "ENTER_VALIDATION_CODE": "Enter the validation code that was sent to you.",
@ -271,6 +275,7 @@
"MAKE_REQUEST": "Make a request", "MAKE_REQUEST": "Make a request",
"DATE_WRONG": "The end date can not be earlier than the start date", "DATE_WRONG": "The end date can not be earlier than the start date",
"LOADING_DOTS": "Loading...", "LOADING_DOTS": "Loading...",
"LOADING_PROGRESS": "Loading",
"LOADING": "Loading", "LOADING": "Loading",
"EMPTY_LIST_REQUEST": "No request", "EMPTY_LIST_REQUEST": "No request",
"MEMBER_LIST": "List of members", "MEMBER_LIST": "List of members",

View File

@ -39,6 +39,7 @@
"WALLET": "Wallet", "WALLET": "Wallet",
"DEPOSIT": "Dépôt", "DEPOSIT": "Dépôt",
"CONFIRM_DEPOSIT": "Confirmer le dépôt", "CONFIRM_DEPOSIT": "Confirmer le dépôt",
"CONFIRM_WITHDRAWAL": "Confirmer le retrait",
"ENTER_VALID_AMOUNT": "Entrer un montant valide", "ENTER_VALID_AMOUNT": "Entrer un montant valide",
"ENTER_AMOUNT_SUPERIOR_ZEROR": "Entrer un montant supérieur à zero", "ENTER_AMOUNT_SUPERIOR_ZEROR": "Entrer un montant supérieur à zero",
"AMOUNT_SUPERIOR_TO_PRINCIPAL_ACCOUNT": "Montant supérieur à celui du compte principal de l'agent", "AMOUNT_SUPERIOR_TO_PRINCIPAL_ACCOUNT": "Montant supérieur à celui du compte principal de l'agent",
@ -115,6 +116,7 @@
"COUNTRY_CHOICE": "Choisissez un pays", "COUNTRY_CHOICE": "Choisissez un pays",
"LAST_STEP": "Derniere étape", "LAST_STEP": "Derniere étape",
"ACTIVE_ACCOUNT": "Activez le compte !", "ACTIVE_ACCOUNT": "Activez le compte !",
"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",
"NETWORK_CHOICE": "Choix du réseau", "NETWORK_CHOICE": "Choix du réseau",
"CHOICE_NETWORK_TEXT": "Definir un réseau à afficher", "CHOICE_NETWORK_TEXT": "Definir un réseau à afficher",
@ -144,6 +146,7 @@
"ERROR_FILTER": "Erreur survenue lors du filtre", "ERROR_FILTER": "Erreur survenue lors du filtre",
"ERROR_LABLE": "Erreur", "ERROR_LABLE": "Erreur",
"ERROR_TRANSFER_COMMISSION": "Erreur de transfert des commissions", "ERROR_TRANSFER_COMMISSION": "Erreur de transfert des commissions",
"TRANSFER_COMMISSION_IMPOSSIBLE": "Transfert des commissions impossible",
"ERROR_FILTER_TEXT": "Probleme rencontré lors du filtrage.", "ERROR_FILTER_TEXT": "Probleme rencontré lors du filtrage.",
"ERROR_TREATMENT_DEMAND": "Erreur de traitement de la demande", "ERROR_TREATMENT_DEMAND": "Erreur de traitement de la demande",
"REFUSER_DEMANDE": "Refuser la demande", "REFUSER_DEMANDE": "Refuser la demande",
@ -201,6 +204,7 @@
"MEMBER_CODE": "Code membre", "MEMBER_CODE": "Code membre",
"MEMBER_INFO": "Information du membre", "MEMBER_INFO": "Information du membre",
"DEMAND_INFO": "Information sur la demande", "DEMAND_INFO": "Information sur la demande",
"NO_MEMBERS": "Aucun membre enregistré",
"ACCOUNT_NOT_ACTIVE": "Votre compte n'est pas activé", "ACCOUNT_NOT_ACTIVE": "Votre compte n'est pas activé",
"ENTER_VALIDATION_CODE": "Saisissez le code de validation qui vous a été envoyé.", "ENTER_VALIDATION_CODE": "Saisissez le code de validation qui vous a été envoyé.",
"ENTER_VALIDATION_CODE1": "Saisissez le code de validation.", "ENTER_VALIDATION_CODE1": "Saisissez le code de validation.",

View File

@ -15,6 +15,7 @@ import 'moment/locale/en-ca'
import 'moment/locale/en-ie' import 'moment/locale/en-ie'
import 'moment/locale/en-il' import 'moment/locale/en-il'
import 'moment/locale/en-nz' import 'moment/locale/en-nz'
import 'moment/locale/en-gb'
import DeviceInfo from 'react-native-device-info' import DeviceInfo from 'react-native-device-info'
import { Color } from '../../config/Color'; import { Color } from '../../config/Color';
@ -53,8 +54,8 @@ export class HistoryItem extends React.Component {
var today = new Date(); var today = new Date();
var l = this.props.selfData.date_creation; var l = this.props.selfData.date_creation;
let t = this.props.selfData.status; let t = this.props.selfData.status;
let currentLocale = (DeviceInfo.getDeviceLocale().includes("fr") ? "fr" : DeviceInfo.getDeviceLocale()); this.currentLocale = DeviceInfo.getDeviceLocale().includes("fr") ? "fr" : "en-gb";
moment.locale(currentLocale); moment.locale(this.currentLocale);
var re = moment.tz(this.props.selfData.date_creation, 'Etc/GMT+0').format(); var re = moment.tz(this.props.selfData.date_creation, 'Etc/GMT+0').format();
re = moment(re) re = moment(re)
return { return {

View File

@ -240,6 +240,8 @@ class HistoryItemDetails extends Component {
this.displayToast(resultTreatDemand.response); this.displayToast(resultTreatDemand.response);
this.props.navigation.goBack(); this.props.navigation.goBack();
this.props.navigation.state.params.onGoBack(); this.props.navigation.state.params.onGoBack();
this.props.creditCancelResetReducer();
this.props.creditDemandResetReducer();
} }
} }
@ -250,6 +252,8 @@ class HistoryItemDetails extends Component {
this.displayToast(resultCancelDemand.response); this.displayToast(resultCancelDemand.response);
this.props.navigation.goBack(); this.props.navigation.goBack();
this.props.navigation.state.params.onGoBack(); this.props.navigation.state.params.onGoBack();
this.props.creditCancelResetReducer();
this.props.creditDemandResetReducer();
} }
} }

View File

@ -43,19 +43,22 @@ export default class HistoryRequester extends Component {
constructor(props) { constructor(props) {
super(props); super(props);
this.state = this.initState(); this.state = this.initState();
this.updateState() this.updateState();
} }
componentDidDisappear() { componentDidDisappear() {
BackHandler.removeEventListener('hardwareBackPress', this.backPressed); BackHandler.removeEventListener('hardwareBackPress', this.backPressed);
this.props.navigation.state.params.onGoBack();
} }
componentDidAppear() { componentDidAppear() {
BackHandler.addEventListener('hardwareBackPress', this.backPressed); BackHandler.addEventListener('hardwareBackPress', this.backPressed);
} }
componentWillUnmount() {
this.props.navigation.state.params.onGoBack();
}
handleViewRef = ref => this.numberView = ref; handleViewRef = ref => this.numberView = ref;
handleMontantRef = ref => this.montantView = ref; handleMontantRef = ref => this.montantView = ref;
initState() { initState() {

View File

@ -25,7 +25,14 @@ import { readUser } from "../../webservice/AuthApi";
import Calendar from 'react-native-calendario'; import Calendar from 'react-native-calendario';
let route = require('./../../route.json') let route = require('./../../route.json')
import 'moment'; import 'moment';
import 'moment/locale/fr'; import 'moment/locale/fr'
import 'moment/locale/es-us'
import 'moment/locale/en-au'
import 'moment/locale/en-ca'
import 'moment/locale/en-ie'
import 'moment/locale/en-il'
import 'moment/locale/en-nz'
import 'moment/locale/en-gb'
import moment from 'moment-timezone'; import moment from 'moment-timezone';
let theme = require('./../../utils/theme.json') let theme = require('./../../utils/theme.json')
import { primary, primaryDark, accent, purpleLight, primaryLight } from './../../utils/theme.json'; import { primary, primaryDark, accent, purpleLight, primaryLight } from './../../utils/theme.json';
@ -39,6 +46,7 @@ import { Header } from "react-native-elements";
import { withNavigationFocus } from "react-navigation"; import { withNavigationFocus } from "react-navigation";
import IconWithBadge from "../IconWithBadge"; import IconWithBadge from "../IconWithBadge";
import { Appbar, Paragraph, Menu, Divider, Provider } from 'react-native-paper'; import { Appbar, Paragraph, Menu, Divider, Provider } from 'react-native-paper';
import DeviceInfo from 'react-native-device-info'
class MyHistory extends React.Component { class MyHistory extends React.Component {
static navigatorStyle = { static navigatorStyle = {
@ -83,7 +91,8 @@ class MyHistory extends React.Component {
}); });
this.navigation = this.props.navigation this.navigation = this.props.navigation
this.currentLocale = DeviceInfo.getDeviceLocale().includes("fr") ? "fr" : "en-gb";
moment.locale(this.currentLocale);
}; };

View File

@ -1373,7 +1373,7 @@ class Home extends BaseScreen {
barStyle="light-content" barStyle="light-content"
translucent={true} translucent={true}
/> />
{this.state.loadingDialog ? {(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' }}

View File

@ -28,10 +28,11 @@ import 'moment/locale/en-ca'
import 'moment/locale/en-ie' import 'moment/locale/en-ie'
import 'moment/locale/en-il' import 'moment/locale/en-il'
import 'moment/locale/en-nz' import 'moment/locale/en-nz'
import 'moment/locale/en-gb'
import { connect } from 'react-redux'; import { connect } from 'react-redux';
import { bindActionCreators } from 'redux'; import { bindActionCreators } from 'redux';
import DeviceInfo from 'react-native-device-info'
import { thousandsSeparators } from '../../utils/UtilsFunction'; import { thousandsSeparators } from '../../utils/UtilsFunction';
import DeviceInfo from 'react-native-device-info'
let route = require('./../../route.json'); let route = require('./../../route.json');
let slugify = require('slugify'); let slugify = require('slugify');
@ -52,13 +53,15 @@ class WalletDetail extends Component {
wallet: null, wallet: null,
triggerTransferCommission: false, triggerTransferCommission: false,
loading: false, loading: false,
isTriggerRefresh: false isTriggerRefresh: false,
scrollHeaderY: 0
}; };
this.renderContent = null; this.renderContent = null;
slugify.extend({ '+': 'plus' }); slugify.extend({ '+': 'plus' });
this.scrollY = new Animated.Value(0); this.scrollY = new Animated.Value(0);
this.scrollHeaderY = new Animated.Value(0);
this.deltaY = new Animated.Value(0); this.deltaY = new Animated.Value(0);
this.bgBannerY = new Animated.Value(0); this.bgBannerY = new Animated.Value(0);
@ -72,74 +75,82 @@ class WalletDetail extends Component {
this.props.depositActionReset(); this.props.depositActionReset();
this.props.resetWalletListDetailReducer(); this.props.resetWalletListDetailReducer();
this.currentLocale = (DeviceInfo.getDeviceLocale().includes("fr") ? "fr" : DeviceInfo.getDeviceLocale()); this.currentLocale = DeviceInfo.getDeviceLocale().includes("fr") ? "fr" : "en-gb";
moment.locale(this.currentLocale); moment.locale(this.currentLocale);
if (this.isHomeRootView) { if (this.isHomeRootView) {
let agentId = this.props.navigation.state.params.agentId; let agentId = this.props.navigation.state.params.agentId;
this.props.getWalletDetailActivated(agentId); this.props.getWalletDetailActivated(agentId, true);
} }
else { else {
this.props.getWalletDetailActivated(this.props.navigation.state.params.wallet.id, false);
this.props.getWalletTransactionHistory(this.props.navigation.state.params.wallet.id); this.props.getWalletTransactionHistory(this.props.navigation.state.params.wallet.id);
this.state.wallet = this.props.navigation.state.params.wallet;
} }
} }
/*
static options(passProps) {
static options(passProps) { return {
return { topBar: {
topBar: { drawBehind: false,
drawBehind: false, visible: true,
visible: true, animate: true,
animate: true, buttonColor: 'white',
buttonColor: 'white', background: {
background: { color: 'white',
color: 'white', },
rightButtons: []
}, },
rightButtons: [] backButton: {
}, visible: true,
backButton: { color: "white"
visible: true, },
color: "white" buttonColor: "white",
}, background: {
buttonColor: "white", color: Color.primaryDarkColor
background: { },
color: Color.primaryDarkColor statusBar: {
}, drawBehind: false,
statusBar: { visible: true,
drawBehind: false, }
visible: true, };
} }
}; */
} static navigatorStyle = {
navBarBackgroundColor: Color.primaryColor,
statusBarColor: Color.primaryDarkColor,
navBarTextColor: '#FFFFFF',
navBarButtonColor: '#FFFFFF'
static navigationOptions = ({ navigation }) => { };
static navigationOptions = () => {
return { return {
//title: I18n.t('WALLET'), //title: I18n.t('WALLET'),
//title: this.isHomeRootView ? I18n.t('WALLET') : ((typeof this.props.navigation.state.params !== 'undefined') && this.props.navigation.state.params.wallet.network), //title: this.isHomeRootView ? I18n.t('WALLET') : ((typeof this.props.navigation.state.params !== 'undefined') && this.props.navigation.state.params.wallet.network),
drawerLabel: () => null,
headerTitle: I18n.t('WALLET'),
headerTintColor: 'white',
headerStyle: { headerStyle: {
backgroundColor: Color.primaryColor, backgroundColor: Color.primaryColor,
paddingTop: 10 marginTop: 23,
color: 'white'
}, },
headerTitleStyle: { headerTitleStyle: {
color: "white" color: "white"
} },
title: I18n.t('WALLET')
} }
}; };
componentDidMount() { componentDidMount() {
const { result } = this.props; const { result } = this.props;
if (result !== null) {
if (this.isHomeRootView) { if (typeof result.response !== 'undefined') {
if (result !== null) { const wallet = result.response[0];
if (typeof result.response !== 'undefined') { this.setState({
const wallet = result.response[0]; wallet: wallet,
this.setState({ isTriggerRefresh: false
wallet: wallet, })
isTriggerRefresh: false
})
}
} }
} }
/*else { /*else {
@ -169,17 +180,17 @@ class WalletDetail extends Component {
} }
} }
componentWillReceiveProps(nextProps) { /* componentWillReceiveProps(nextProps) {
if (nextProps.loading || nextProps.loadingTransferCommission) if (nextProps.loading || nextProps.loadingTransferCommission)
this.setState({ this.setState({
loading: true loading: true
}) })
else else
this.setState({ this.setState({
loading: false loading: false
}) })
} } */
isEmptyObject = (obj) => { isEmptyObject = (obj) => {
for (let prop in obj) { for (let prop in obj) {
@ -224,36 +235,34 @@ class WalletDetail extends Component {
}); });
} }
bgBannerY = () => { bgHeaderTranslateY = () => {
return this.scrollY.interpolate({ return this.scrollY.interpolate({
inputRange: [0, 100], inputRange: [0, 150],
outputRange: [150, 0], outputRange: [-5, 0],
extrapolate: 'clamp', extrapolate: 'clamp',
}); });
} }
refresh = () => { refresh = () => {
const { result } = this.props; const { result } = this.props;
console.log("STATE NAVIGATION PARAMS REFRESH", this.props.navigation.state); console.log("STATE NAVIGATION PARAMS REFRESH", this.props.navigation.state);
if (!this.isHomeRootView) { if (!this.isHomeRootView) {
const { wallet } = this.props.navigation.state.params; const { wallet } = this.props.navigation.state.params;
this.props.getWalletDetailActivated(wallet.agentId); this.props.getWalletDetailActivated(wallet.id, false);
this.props.getWalletTransactionHistory(wallet.id);
this.setState({ this.setState({
isTriggerRefresh: true isTriggerRefresh: true
}); });
if (typeof this.props.navigation.state.params.onRefreshDetail !== 'undefined') /* if (typeof this.props.navigation.state.params.onRefreshDetail !== 'undefined')
this.props.navigation.state.params.onRefreshDetail(); this.props.navigation.state.params.onRefreshDetail(); */
} }
else { else {
const wallet = Array.isArray(result.response) && result.response[0];
let agentId = this.props.navigation.state.params.agentId; let agentId = this.props.navigation.state.params.agentId;
this.props.getWalletDetailActivated(agentId); this.props.getWalletDetailActivated(agentId, true);
this.props.getWalletTransactionHistory(wallet.id);
} }
} }
@ -299,7 +308,6 @@ class WalletDetail extends Component {
zIndex: 11, zIndex: 11,
shadowColor: Color.borderColor, shadowColor: Color.borderColor,
borderColor: Color.borderColor, borderColor: Color.borderColor,
} }
]}> ]}>
<View style={[styles.contentLeftItem]}> <View style={[styles.contentLeftItem]}>
@ -343,11 +351,9 @@ class WalletDetail extends Component {
if (result !== null) { if (result !== null) {
if (typeof result.response !== 'undefined') { if (typeof result.response !== 'undefined') {
const wallet = Array.isArray(result.response) ? result.response[0] : result.response.filter((item) => item.id === this.state.wallet.id) if (parseInt(result.response.balance_com) === 0) {
if (parseInt(wallet.balance_com) === 0) {
Alert.alert( Alert.alert(
I18n.t("ERROR_TRANSFER_COMMISSION"), I18n.t("TRANSFER_COMMISSION_IMPOSSIBLE"),
I18n.t("COMMISSION_TRANSFER_ERROR_EMPTY"), I18n.t("COMMISSION_TRANSFER_ERROR_EMPTY"),
[ [
{ {
@ -365,24 +371,24 @@ class WalletDetail extends Component {
} }
else { /* else {
if (parseInt(this.state.wallet.balance_com) === 0) { if (parseInt(this.state.wallet.balance_com) === 0) {
Alert.alert( Alert.alert(
I18n.t("ERROR_TRANSFER_COMMISSION"), I18n.t("ERROR_TRANSFER_COMMISSION"),
I18n.t("COMMISSION_TRANSFER_ERROR_EMPTY"), I18n.t("COMMISSION_TRANSFER_ERROR_EMPTY"),
[ [
{ {
text: I18n.t("OK"), onPress: () => { text: I18n.t("OK"), onPress: () => {
this.props.resetCommissionReducer(); this.props.resetCommissionReducer();
} }
} }
], ],
{ cancelable: false } { cancelable: false }
) )
} }
else else
this.renderDialogConfirmTransferCommission() this.renderDialogConfirmTransferCommission()
} } */
}}> }}>
{I18n.t('TRANSFER_TO_PRINCIPAL_ACCOUNT')} {I18n.t('TRANSFER_TO_PRINCIPAL_ACCOUNT')}
</Tag> </Tag>
@ -468,21 +474,19 @@ class WalletDetail extends Component {
</View> </View>
); );
renderDetailWallet = (walletParam) => { renderDetailWallet = (wallet) => {
console.log("WALLET SEND", wallet);
const wallet = Array.isArray(walletParam) ? walletParam[0] : walletParam;
return ( return (
!this.isEmptyObject(wallet) ? !this.isEmptyObject(wallet) ?
(<> (<>
{this.state.triggerTransferCommission && this.renderDialogTransferCommissionResponse()} {this.state.triggerTransferCommission && this.renderDialogTransferCommissionResponse()}
{this.state.loading ? {/* {this.state.loading ?
<View <View
style={{ position: "absolute", zIndex: 1, backgroundColor: "#00000050", width: this.state.loading ? responsiveWidth(100) : 0, height: this.state.loading ? responsiveHeight(100) : 0, flex: 1, justifyContent: 'center', alignItems: 'center' }}> style={{ position: "absolute", zIndex: 1, backgroundColor: "#00000050", width: this.state.loading ? responsiveWidth(100) : 0, height: this.state.loading ? responsiveHeight(100) : 0, flex: 1, justifyContent: 'center', alignItems: 'center' }}>
<Text style={{ fontSize: 20, color: 'white', fontWeight: 'bold' }}>{I18n.t("LOADING_DOTS")}</Text> <Text style={{ fontSize: 20, color: 'white', fontWeight: 'bold' }}>{I18n.t("LOADING_DOTS")}</Text>
</View> : null </View> : null
} } */}
<View <View
style={styles.container}> style={styles.container}>
@ -492,7 +496,7 @@ class WalletDetail extends Component {
width: "100%", width: "100%",
zIndex: 1, zIndex: 1,
backgroundColor: Color.primaryColor, backgroundColor: Color.primaryColor,
height: 150 height: 140 - this.state.scrollHeaderY,
}} /> }} />
<ScrollView style={{ <ScrollView style={{
@ -508,7 +512,8 @@ class WalletDetail extends Component {
contentOffset: { y: this.scrollY }, contentOffset: { y: this.scrollY },
}, },
}, },
])}> ],
{ listener: (event) => { this.setState({ scrollHeaderY: event.nativeEvent.contentOffset.y }); } })}>
<View style={{ marginTop: 80, }}> <View style={{ marginTop: 80, }}>
{this.renderHeader(wallet)} {this.renderHeader(wallet)}
@ -733,7 +738,15 @@ class WalletDetail extends Component {
}, },
{ {
text: I18n.t("YES"), onPress: () => { text: I18n.t("YES"), onPress: () => {
this.props.transferCommissionAction(this.state.wallet.id); const { result } = this.props;
if (result !== null) {
if (typeof result.response !== 'undefined') {
this.props.transferCommissionAction(result.response.id);
}
}/*
else
this.props.transferCommissionAction(this.state.wallet.id); */
this.setState({ this.setState({
triggerTransferCommission: true triggerTransferCommission: true
}); });
@ -785,46 +798,38 @@ class WalletDetail extends Component {
} }
} }
getWalletParam = () => {
const { result } = this.props;
const isHomeRootView = this.props.navigation.state.params.hasOwnProperty('agentId');
if (!isHomeRootView)
return this.props.navigation.state.params.wallet;
else
return this.props.response.filter((item) => item.id === this.state.wallet.id);
}
render() { render() {
const isHomeRootView = this.props.navigation.state.params.hasOwnProperty('agentId'); const isHomeRootView = this.isHomeRootView;
console.log("WALLET DETAILS PROPS", this.props); /*console.log("WALLET DETAILS PROPS", this.props);
/*console.log("isHomeRootView", isHomeRootView); console.log("isHomeRootView", isHomeRootView);
console.log("this.props.loading || this.props.loadingTransferCommission", this.props.loading || this.props.loadingTransferCommission); */ console.log("this.props.loading || this.props.loadingTransferCommission", this.props.loading || this.props.loadingTransferCommission);
console.log(this.state.scrollHeaderY);*/
return ( return (
<> <>
<StatusBar
backgroundColor={Color.primaryDarkColor}
barStyle="light-content"
translucent={true}
/>
{ {
!isHomeRootView ? ( ((this.props.loading || this.props.loadingTransferCommission) ?
this.renderLoader() :
(
this.props.result !== null ?
(this.props.loading || this.props.loadingTransferCommission) ? Array.isArray(this.props.result.response) && (this.props.result.response.length) === 0 ?
this.renderDetailWallet(this.getWalletParam()) : ( <View style={{ flex: 1, justifyContent: 'center', alignItems: 'center' }}>
((this.props.result !== null)) ? <Text style={Typography.body1}>{I18n.t('NO_WALLET_ACTIVED')}</Text>
</View>
:
this.renderDetailWallet(this.props.result.response.filter((item) => item.id === this.state.wallet.id)) : this.renderDetailWallet(this.props.result.response)
:
this.renderDetailWallet(this.props.navigation.state.params.wallet) null
)
) :
((this.props.loading || this.props.loadingTransferCommission) ?
this.renderLoader() :
(
this.props.result !== null &&
this.renderDetailWallet(this.props.result.response)
)
) )
)
} }

View File

@ -174,7 +174,7 @@ class WalletRetrait extends Component {
<Dialog.Container useNativeDriver={true} visible={this.state.isModalConfirmVisible}> <Dialog.Container useNativeDriver={true} visible={this.state.isModalConfirmVisible}>
<Dialog.Title>{I18n.t('CONFIRM_DEPOSIT')}</Dialog.Title> <Dialog.Title>{I18n.t('CONFIRM_WITHDRAWAL')}</Dialog.Title>
<View> <View>

View File

@ -61,18 +61,18 @@ class WalletSelect extends Component {
} }
refresh() { /* refresh() {
readUser().then((user) => { readUser().then((user) => {
if (user) { if (user) {
if (user !== undefined) { if (user !== undefined) {
if (user.phone !== undefined) { if (user.phone !== undefined) {
this.props.getWalletActivated(user.agentId); this.props.getWalletActivated(user.agentId);
this.setState({ agentId: user.agentId }); this.setState({ agentId: user.agentId });
}
} }
} }
} });
}); } */
}
updateLangue() { updateLangue() {
this.props.navigation.setParams({ name: I18n.t('WALLET') }) this.props.navigation.setParams({ name: I18n.t('WALLET') })
@ -110,8 +110,8 @@ class WalletSelect extends Component {
key={item.id} key={item.id}
style={[styles.paymentItem, { borderBottomColor: Color.borderColor }]} style={[styles.paymentItem, { borderBottomColor: Color.borderColor }]}
onPress={() => this.props.navigation.navigate('walletDetail', { onPress={() => this.props.navigation.navigate('walletDetail', {
wallet: itemToSend, wallet: itemToSend,/*
onRefreshDetail: () => this.refresh() onRefreshDetail: () => this.refresh() */
})}> })}>
<View style={{ flexDirection: 'row', alignItems: 'center' }}> <View style={{ flexDirection: 'row', alignItems: 'center' }}>
<View style={styles.iconContent}> <View style={styles.iconContent}>

View File

@ -41,6 +41,7 @@
"DEPOSIT_DESCRIPTION": "Make a deposit", "DEPOSIT_DESCRIPTION": "Make a deposit",
"DEPOSIT": "Deposit", "DEPOSIT": "Deposit",
"CONFIRM_DEPOSIT": "Confirm deposit", "CONFIRM_DEPOSIT": "Confirm deposit",
"CONFIRM_WITHDRAWAL": "Confirm withdrawal",
"CARD_NUMBER_LABEL": "Card number", "CARD_NUMBER_LABEL": "Card number",
"CARD_EXPIRY_LABEL": "Expiry.", "CARD_EXPIRY_LABEL": "Expiry.",
"CARD_CVC_LABEL": "CVC/CCV", "CARD_CVC_LABEL": "CVC/CCV",
@ -60,7 +61,7 @@
"CONFIRM_TRANSFER_COMMISSION": "Confirm commission transfer", "CONFIRM_TRANSFER_COMMISSION": "Confirm commission transfer",
"CREATION_DATE": "Creation date", "CREATION_DATE": "Creation date",
"PRINCIPAL_ACCOUNT_TITLE": "Principal account", "PRINCIPAL_ACCOUNT_TITLE": "Principal account",
"NO_WALLET_ACTIVED": "PNo wallet is activated for your account", "NO_WALLET_ACTIVED": "No wallet is activated for your account",
"TRANSFER_TO_PRINCIPAL_ACCOUNT": "Transfer commissions", "TRANSFER_TO_PRINCIPAL_ACCOUNT": "Transfer commissions",
"PRINCIPAL": "Principal", "PRINCIPAL": "Principal",
"ENTER_YOUR_CARD_ID": "Please enter your bank card ID", "ENTER_YOUR_CARD_ID": "Please enter your bank card ID",
@ -112,6 +113,7 @@
"COUNTRY_CHOICE": "Choose a country", "COUNTRY_CHOICE": "Choose a country",
"LAST_STEP": "Last step", "LAST_STEP": "Last step",
"ACTIVE_ACCOUNT": "Activate the account !", "ACTIVE_ACCOUNT": "Activate the account !",
"ACTIVE_USER": "Active",
"LAST_STEP_TEXT": "Activate your account using the verification code that was sent to you on your e-mail address and on your phone number", "LAST_STEP_TEXT": "Activate your account using the verification code that was sent to you on your e-mail address and on your phone number",
"NETWORK_CHOICE": "Choix du réseau", "NETWORK_CHOICE": "Choix du réseau",
"CHOICE_NETWORK_TEXT": "Define a network to display", "CHOICE_NETWORK_TEXT": "Define a network to display",
@ -141,6 +143,7 @@
"ERROR_FILTER": "Error occurred during the filter", "ERROR_FILTER": "Error occurred during the filter",
"ERROR_LABLE": "Erreur", "ERROR_LABLE": "Erreur",
"ERROR_TRANSFER_COMMISSION": "Commissions transfer error", "ERROR_TRANSFER_COMMISSION": "Commissions transfer error",
"TRANSFER_COMMISSION_IMPOSSIBLE": "Commissions transfer impossible",
"ERROR_FILTER_TEXT": "Problem encountered while filtering.", "ERROR_FILTER_TEXT": "Problem encountered while filtering.",
"ERROR_TREATMENT_DEMAND": "Request processing error", "ERROR_TREATMENT_DEMAND": "Request processing error",
"REFUSER_DEMANDE": "Reject the request", "REFUSER_DEMANDE": "Reject the request",
@ -200,6 +203,7 @@
"ADD_SUCCESS_TEXT": "The number has been added to the network successfully", "ADD_SUCCESS_TEXT": "The number has been added to the network successfully",
"MEMBER_CODE": "Member Code", "MEMBER_CODE": "Member Code",
"MEMBER_INFO": "Member Information", "MEMBER_INFO": "Member Information",
"NO_MEMBERS": "No registered members",
"DEMAND_INFO": "Information on the request", "DEMAND_INFO": "Information on the request",
"ACCOUNT_NOT_ACTIVE": "Your account is not activated", "ACCOUNT_NOT_ACTIVE": "Your account is not activated",
"ENTER_VALIDATION_CODE": "Enter the validation code that was sent to you.", "ENTER_VALIDATION_CODE": "Enter the validation code that was sent to you.",
@ -271,6 +275,7 @@
"MAKE_REQUEST": "Make a request", "MAKE_REQUEST": "Make a request",
"DATE_WRONG": "The end date can not be earlier than the start date", "DATE_WRONG": "The end date can not be earlier than the start date",
"LOADING_DOTS": "Loading...", "LOADING_DOTS": "Loading...",
"LOADING_PROGRESS": "Loading",
"LOADING": "Loading", "LOADING": "Loading",
"EMPTY_LIST_REQUEST": "No request", "EMPTY_LIST_REQUEST": "No request",
"MEMBER_LIST": "List of members", "MEMBER_LIST": "List of members",

View File

@ -39,6 +39,7 @@
"WALLET": "Wallet", "WALLET": "Wallet",
"DEPOSIT": "Dépôt", "DEPOSIT": "Dépôt",
"CONFIRM_DEPOSIT": "Confirmer le dépôt", "CONFIRM_DEPOSIT": "Confirmer le dépôt",
"CONFIRM_WITHDRAWAL": "Confirmer le retrait",
"ENTER_VALID_AMOUNT": "Entrer un montant valide", "ENTER_VALID_AMOUNT": "Entrer un montant valide",
"ENTER_AMOUNT_SUPERIOR_ZEROR": "Entrer un montant supérieur à zero", "ENTER_AMOUNT_SUPERIOR_ZEROR": "Entrer un montant supérieur à zero",
"AMOUNT_SUPERIOR_TO_PRINCIPAL_ACCOUNT": "Montant supérieur à celui du compte principal de l'agent", "AMOUNT_SUPERIOR_TO_PRINCIPAL_ACCOUNT": "Montant supérieur à celui du compte principal de l'agent",
@ -115,6 +116,7 @@
"COUNTRY_CHOICE": "Choisissez un pays", "COUNTRY_CHOICE": "Choisissez un pays",
"LAST_STEP": "Derniere étape", "LAST_STEP": "Derniere étape",
"ACTIVE_ACCOUNT": "Activez le compte !", "ACTIVE_ACCOUNT": "Activez le compte !",
"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",
"NETWORK_CHOICE": "Choix du réseau", "NETWORK_CHOICE": "Choix du réseau",
"CHOICE_NETWORK_TEXT": "Definir un réseau à afficher", "CHOICE_NETWORK_TEXT": "Definir un réseau à afficher",
@ -144,6 +146,7 @@
"ERROR_FILTER": "Erreur survenue lors du filtre", "ERROR_FILTER": "Erreur survenue lors du filtre",
"ERROR_LABLE": "Erreur", "ERROR_LABLE": "Erreur",
"ERROR_TRANSFER_COMMISSION": "Erreur de transfert des commissions", "ERROR_TRANSFER_COMMISSION": "Erreur de transfert des commissions",
"TRANSFER_COMMISSION_IMPOSSIBLE": "Transfert des commissions impossible",
"ERROR_FILTER_TEXT": "Probleme rencontré lors du filtrage.", "ERROR_FILTER_TEXT": "Probleme rencontré lors du filtrage.",
"ERROR_TREATMENT_DEMAND": "Erreur de traitement de la demande", "ERROR_TREATMENT_DEMAND": "Erreur de traitement de la demande",
"REFUSER_DEMANDE": "Refuser la demande", "REFUSER_DEMANDE": "Refuser la demande",
@ -201,6 +204,7 @@
"MEMBER_CODE": "Code membre", "MEMBER_CODE": "Code membre",
"MEMBER_INFO": "Information du membre", "MEMBER_INFO": "Information du membre",
"DEMAND_INFO": "Information sur la demande", "DEMAND_INFO": "Information sur la demande",
"NO_MEMBERS": "Aucun membre enregistré",
"ACCOUNT_NOT_ACTIVE": "Votre compte n'est pas activé", "ACCOUNT_NOT_ACTIVE": "Votre compte n'est pas activé",
"ENTER_VALIDATION_CODE": "Saisissez le code de validation qui vous a été envoyé.", "ENTER_VALIDATION_CODE": "Saisissez le code de validation qui vous a été envoyé.",
"ENTER_VALIDATION_CODE1": "Saisissez le code de validation.", "ENTER_VALIDATION_CODE1": "Saisissez le code de validation.",

View File

@ -19,6 +19,7 @@ export const locationActionUrl = baseUrl + '/interacted/LocationAction.php';
export const demandeActionUrl = baseUrl + '/interacted/DemandeAction.php'; export const demandeActionUrl = baseUrl + '/interacted/DemandeAction.php';
export const configActionUrl = baseUrl + '/interacted/ConfigAction.php'; export const configActionUrl = baseUrl + '/interacted/ConfigAction.php';
export const walletActionUrl = testBaseUrl + '/walletService/wallets'; export const walletActionUrl = testBaseUrl + '/walletService/wallets';
export const walletDetailUrl = testBaseUrl + '/walletService/wallets';
export const creditTreatDemand = testBaseUrl + '/walletService/credits/treatDemand'; export const creditTreatDemand = testBaseUrl + '/walletService/credits/treatDemand';
export const creditCancelDemand = testBaseUrl + '/walletService/credits/cancelDemand'; export const creditCancelDemand = testBaseUrl + '/walletService/credits/cancelDemand';
export const commissionAmount = testBaseUrl + '/walletService/transactions/commission'; export const commissionAmount = testBaseUrl + '/walletService/transactions/commission';

View File

@ -1,54 +1,55 @@
import React, { Component } from 'react'; import React, { Component } from 'react';
import {readUser} from './AuthApi' import { readUser } from './AuthApi'
var DBEvents=require('react-native-db-models').DBEvents; var DBEvents = require('react-native-db-models').DBEvents;
var db=require('./persistences/db.js'); var db = require('./persistences/db.js');
import I18n from 'react-native-i18n' import I18n from 'react-native-i18n'
import {isDebugMode,adhesionUrl,locationActionUrl,memberActionUrl,networkActionUrl,demandeActionUrl} from "./IlinkConstants" import { isDebugMode, adhesionUrl, locationActionUrl, memberActionUrl, networkActionUrl, demandeActionUrl } from "./IlinkConstants"
var serializeJSON = function(data) { var serializeJSON = function (data) {
return Object.keys(data).map(function (keyName) { return Object.keys(data).map(function (keyName) {
return encodeURIComponent(keyName) + '=' + encodeURIComponent(data[keyName]) return encodeURIComponent(keyName) + '=' + encodeURIComponent(data[keyName])
}).join('&'); }).join('&');
} }
export const listAllMembers=async ()=> { export const listAllMembers = async () => {
const user=await readUser() const user = await readUser()
if(user!==null){ if (user !== null) {
let la= I18n.currentLocale() let la = I18n.currentLocale()
let data={"tag":"member", let data = {
"id":user['member_code'], "tag": "member",
"id": user.code_membre,
la, la,
"test":isDebugMode, "test": isDebugMode,
"codeparrain":user.code_membre "codeparrain": user.code_membre
,"type":'all_geolocated'}; , "type": 'all_geolocated'
};
console.log("DATA to SEND", data);
const response = await fetch(memberActionUrl, {
const response=await fetch(memberActionUrl,{ method: 'POST',
method: 'POST', headers: {
headers: {
Accept: 'application/json', Accept: 'application/json',
'Content-Type': 'application/json', 'Content-Type': 'application/json',
}, },
body: JSON.stringify(data), body: JSON.stringify(data),
}) })
let responseText="" let responseText = ""
try{ try {
responseText=await response.text() responseText = await response.text()
return JSON.parse(responseText) return JSON.parse(responseText)
}catch(e){ } catch (e) {
console.log(e) console.log(e)
console.log("error when liste member",responseText) console.log("error when liste member", responseText)
let er={ let er = {
error:-3, error: -3,
content:e, content: e,
text:responseText text: responseText
} }
return er; return er;
} }
}
return null
} }
return null
}

View File

@ -1,5 +1,5 @@
import { walletActionUrl, commissionAmount } from "./IlinkConstants"; import { walletActionUrl, commissionAmount, walletDetailUrl } from "./IlinkConstants";
import { fetchWalletListPending, fetchWalletListSuccess, fetchWalletListError, fetchWalletListReset, fetchWalletListDetailPending, fetchWalletListDetailSuccess, fetchWalletListDetailError, fetchWalletListDetailReset, fetchWalletGetCommissionPending, fetchWalletGetCommissionSuccess, fetchWalleGetCommissionError, walletGetCommissionReset } from "../redux/actions/WalletActions"; import { fetchWalletListPending, fetchWalletListSuccess, fetchWalletListError, fetchWalletListReset, fetchWalletListDetailPending, fetchWalletListDetailSuccess, fetchWalletListDetailError, fetchWalletListDetailReset, fetchWalletGetCommissionPending, fetchWalletGetCommissionSuccess, fetchWalleGetCommissionError, walletGetCommissionReset } from "../redux/actions/WalletActions";
import { store } from "../redux/store"; import { store } from "../redux/store";
import axios from "axios"; import axios from "axios";
@ -41,16 +41,17 @@ export const resetWalletListReducer = () => {
} }
} }
export const getWalletDetailActivated = (userID) => { export const getWalletDetailActivated = (id, isAgentCall) => {
const auth = store.getState().authKeyReducer; const auth = store.getState().authKeyReducer;
const authKey = auth !== null ? `${auth.authKey.token_type} ${auth.authKey.access_token}` : ''; const authKey = auth !== null ? `${auth.authKey.token_type} ${auth.authKey.access_token}` : '';
const url = isAgentCall ? `${walletActionUrl}/${id}/activated` : `${walletDetailUrl}/${id}`;
return dispatch => { return dispatch => {
dispatch(fetchWalletListDetailPending()); dispatch(fetchWalletListDetailPending());
axios({ axios({
url: `${walletActionUrl}/${userID}/activated`, url,
method: 'GET', method: 'GET',
headers: { headers: {
'Authorization': authKey 'Authorization': authKey