From a95339a81b1d8092a09f8da68d8ec2b7aec45db4 Mon Sep 17 00:00:00 2001 From: Brice Zele Date: Tue, 2 Jun 2020 10:05:50 +0100 Subject: [PATCH] wallet user ok --- App.js | 7 +- package.json | 2 +- route.json | 69 ++-- screens/home/Home.js | 15 +- screens/optionMenu/OptionsMenu.js | 3 +- screens/wallet/WalletDetail.js | 52 ++- screens/wallet/WalletDetailUser.js | 537 ++++++++++++++------------- screens/wallet/WalletOptionSelect.js | 134 +++++++ utils/UtilsFunction.js | 95 +++++ utils/i18n/en.json | 13 + utils/i18n/fr.json | 13 + webservice/IlinkConstants.js | 1 + webservice/WalletApi.js | 17 +- 13 files changed, 630 insertions(+), 328 deletions(-) create mode 100644 screens/wallet/WalletOptionSelect.js diff --git a/App.js b/App.js index 56be0084..aebf92bf 100644 --- a/App.js +++ b/App.js @@ -49,6 +49,7 @@ import WalletDepot from './screens/wallet/WalletDepot'; import WalletRetrait from './screens/wallet/WalletRetrait'; import CreateIdentification from './screens/identification/createIdentification'; import WalletDetailUser from './screens/wallet/WalletDetailUser'; +import WalletOptionSelect from './screens/wallet/WalletOptionSelect'; const instructions = Platform.select({ ios: 'Press Cmd+R to reload,\n' + 'Cmd+D or shake for dev menu', @@ -86,7 +87,8 @@ const AppStack = createDrawerNavigator({ notificationview: Notifications, configuration: Configurations, about: About, - walletDetailUser: WalletDetailUser + walletDetailUser: WalletDetailUser, + walletOptionSelect: WalletOptionSelect }) }, { contentComponent: OptionsMenu, headerMode: 'none', contentOptions: { activeTintColor: theme.accent } }) @@ -137,7 +139,8 @@ const AppAgentStack = createDrawerNavigator({ about: About, walletDetail: WalletDetail, walletDepot: WalletDepot, - walletRetrait: WalletRetrait + walletRetrait: WalletRetrait, + walletOptionSelect: WalletOptionSelect }) }, { contentComponent: OptionsMenu, diff --git a/package.json b/package.json index 50fc9c68..a7d89d6d 100644 --- a/package.json +++ b/package.json @@ -9,7 +9,7 @@ "release-build": "react-native bundle --platform android --dev false --entry-file index.js --bundle-output android/app/src/main/assets/index.android.bundle --assets-dest android/app/build/intermediates/res/merged/release/ && rm -rf android/app/src/main/res/drawable-* && rm -rf android/app/src/main/res/raw/* && cd android && ./gradlew assembleRelease && cd .. && adb install android/app/build/outputs/apk/release/app-release.apk", "debug-build": "react-native bundle --platform android --dev false --entry-file index.js --bundle-output android/app/src/main/assets/index.android.bundle --assets-dest android/app/src/main/res/ && cd android && ./gradlew assembleDebug && cd .. && adb install android/app/build/outputs/apk/debug/app-debug.apk", "start-emulator": "emulator -avd Nexus_5X_API_R -dns-server 8.8.8.8", - "start-emulator-pixel": "emulator -avd Pixel_2_API_29_1 -dns-server 8.8.8.8", + "start-emulator-pixel": "emulator -avd Pixel_2_API_29 -dns-server 8.8.8.8", "run-debug": "cd android && ./gradlew clean && cd .. && react-native run-android", "run-release": "cd android && ./gradlew clean && cd .. && react-native run-android --variant=release" }, diff --git a/route.json b/route.json index 4acd69fb..5ddeff02 100644 --- a/route.json +++ b/route.json @@ -1,35 +1,36 @@ { - "discover": "ILink", - "stackRoot": "stackcenter", - "historiques": "Historique", - "options": "menu", - "drawer": "drawer", - "credrequester": "creditrequest", - "login": "Login", - "first": "Home", - "typeaccountcreate": "typeaccountcreate", - "simpleusercreate": "simpleusercreate", - "splashscreen": "spashscreen", - "useraccount": "useraccount", - "configurations": "configuration", - "notification": "notification", - "modalhistoryfilter": "filterhistory", - "superviseurgroup": "superviseurgroup", - "historyItemDetails": "historyItemDetails", - "forgotpass": "forgottenpass", - "confirmcode": "confirmcode", - "creationstep2": "step2", - "help": "help", - "modaloading": "modaloading", - "activateaccount": "activateaccout", - "addNetwork": "addNetwork", - "notificationView": "notificationview", - "generateNetwork": "generateNetwork", - "helpmenu": "helpMenu", - "updateinfo": "updateinformation", - "intersticielAds": "intersticielAds", - "walletDetail": "walletDetail", - "walletDepot": "walletDepot", - "walletRetrait": "walletRetrait", - "walletSelect": "walletSelect" -} \ No newline at end of file + "discover": "ILink", + "stackRoot": "stackcenter", + "historiques": "Historique", + "options": "menu", + "drawer": "drawer", + "credrequester": "creditrequest", + "login": "Login", + "first": "Home", + "typeaccountcreate": "typeaccountcreate", + "simpleusercreate": "simpleusercreate", + "splashscreen": "spashscreen", + "useraccount": "useraccount", + "configurations": "configuration", + "notification": "notification", + "modalhistoryfilter": "filterhistory", + "superviseurgroup": "superviseurgroup", + "historyItemDetails": "historyItemDetails", + "forgotpass": "forgottenpass", + "confirmcode": "confirmcode", + "creationstep2": "step2", + "help": "help", + "modaloading": "modaloading", + "activateaccount": "activateaccout", + "addNetwork": "addNetwork", + "notificationView": "notificationview", + "generateNetwork": "generateNetwork", + "helpmenu": "helpMenu", + "updateinfo": "updateinformation", + "intersticielAds": "intersticielAds", + "walletDetail": "walletDetail", + "walletDepot": "walletDepot", + "walletRetrait": "walletRetrait", + "walletSelect": "walletSelect", + "walletOptionSelect": "walletOptionSelect" +} diff --git a/screens/home/Home.js b/screens/home/Home.js index c8a8ce8e..7fd84ecd 100644 --- a/screens/home/Home.js +++ b/screens/home/Home.js @@ -177,6 +177,7 @@ class Home extends BaseScreen { }); */ readUser().then((user) => { + console.log("USER", user); if (user) { if (user !== undefined) { if (user.phone !== undefined) @@ -1388,13 +1389,14 @@ class Home extends BaseScreen { barStyle="light-content" translucent={true} /> - {(this.state.loadingDialog || this.props.loading) ? - - {I18n.t("LOADING_DOTS")} - : null + > + {I18n.t("LOADING_DOTS")} + : null } { } }]) }} /> + */} {this.makeCardSearch()} {this.makeSlidingUp()} {this.makeDialogLoader()} diff --git a/screens/optionMenu/OptionsMenu.js b/screens/optionMenu/OptionsMenu.js index 4b06c725..b63ba4c3 100644 --- a/screens/optionMenu/OptionsMenu.js +++ b/screens/optionMenu/OptionsMenu.js @@ -251,7 +251,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') { + if (item === "creditrequest" || item === 'historyItemDetails' || item === 'filter' || item === 'networks' || item === 'walletDetail' || item === 'walletDetailUser' + || item === 'walletDepot' || item === 'walletRetrait' || item === 'createIdentification' || item === 'walletOptionSelect') { return null } else { const color = this.state.currentId === item.id ? theme.accent : "grey" diff --git a/screens/wallet/WalletDetail.js b/screens/wallet/WalletDetail.js index d0a41333..8303df09 100644 --- a/screens/wallet/WalletDetail.js +++ b/screens/wallet/WalletDetail.js @@ -10,7 +10,6 @@ import CustomButton from '../../components/CustomButton'; import { Color } from '../../config/Color'; import Tag from '../../components/Tag'; import { IlinkEmitter } from "../../utils/events"; -import { CreditCardInput } from "react-native-credit-card-input"; import { Typography, FontWeight } from '../../config/typography'; import { responsiveHeight, responsiveWidth, } from 'react-native-responsive-dimensions'; import { getWalletDetailActivated, resetWalletListDetailReducer } from '../../webservice/WalletApi'; @@ -18,7 +17,7 @@ import { depositActionReset } from '../../webservice/DepositApi'; import { getWalletTransactionHistory, getWalletTransactionHistoryReset } from '../../webservice/WalletTransactionHistoryApi'; import { transferCommissionAction } from '../../webservice/WalletTransferCommission'; import { resetCommissionReducer } from '../../webservice/WalletTransferCommission'; -import Dialog, { DialogContent, DialogTitle, DialogFooter, DialogButton } from 'react-native-popup-dialog'; +import isEqual from 'lodash/isEqual'; import { baseUrl } from '../../webservice/IlinkConstants'; let moment = require('moment-timezone'); import 'moment/locale/fr' @@ -31,7 +30,7 @@ import 'moment/locale/en-nz' import 'moment/locale/en-gb' import { connect } from 'react-redux'; import { bindActionCreators } from 'redux'; -import { thousandsSeparators, isEmptyObject } from '../../utils/UtilsFunction'; +import { thousandsSeparators, isEmptyObject, isIlinkWorldWallet, optionDepotScreen, optionRetraitScreen } from '../../utils/UtilsFunction'; import DeviceInfo from 'react-native-device-info' let route = require('./../../route.json'); @@ -464,7 +463,7 @@ class WalletDetail extends Component { ); renderDetailWallet = (wallet) => { - console.log("WALLET SEND", wallet); + console.log("WALLET NAME SLUGIFY", slugify(wallet.network)); return ( !isEmptyObject(wallet) ? @@ -526,10 +525,20 @@ class WalletDetail extends Component { this.props.navigation.push(route.walletDepot, { - wallet, - onGoBack: () => this.refresh(), - })} + onPress={() => { + if (isIlinkWorldWallet(wallet.network)) { + this.props.navigation.push(route.walletOptionSelect, { + optionSelect: optionDepotScreen, + wallet, + onGoBack: () => this.refresh(), + }) + } else { + this.props.navigation.push(route.walletDepot, { + wallet, + onGoBack: () => this.refresh(), + }) + } + }} activeOpacity={0.9}> this.props.navigation.push(route.walletRetrait, { - wallet, - onGoBack: () => this.refresh(), - })} + onPress={() => { + if (isIlinkWorldWallet(wallet.network)) { + this.props.navigation.push(route.walletOptionSelect, { + optionSelect: optionRetraitScreen, + wallet, + onGoBack: () => this.refresh(), + }) + } else { + this.props.navigation.push(route.walletRetrait, { + wallet, + onGoBack: () => this.refresh(), + }) + } + } + } activeOpacity={0.9}> - {wallet.network.toLowerCase().includes('ilink') && + {isIlinkWorldWallet(wallet.network) && <> { this.props.navigation.push(route.createIdentification) }} + onPress={() => { this.props.navigation.push(route.walletOptionSelect) }} activeOpacity={0.9}> { }} + onPress={() => { this.props.navigation.push(route.walletOptionSelect) }} activeOpacity={0.9}> { this.props.navigation.push(route.createIdentification) }} + onPress={() => { this.props.navigation.push(route.walletOptionSelect) }} activeOpacity={0.9}> { - const { result } = this.props; - console.log("STATE NAVIGATION PARAMS REFRESH", this.props.navigation.state); - if (!this.isHomeRootView) { - const { wallet } = this.props.navigation.state.params; - this.props.getWalletDetailActivated(wallet.id, false); - this.props.getWalletTransactionHistory(wallet.id); - this.setState({ - isTriggerRefresh: true - }); - - /* if (typeof this.props.navigation.state.params.onRefreshDetail !== 'undefined') - this.props.navigation.state.params.onRefreshDetail(); */ - - } - - else { - let agentId = this.props.navigation.state.params.agentId; - this.props.getWalletDetailActivated(agentId, true); - } + let agentId = this.props.navigation.state.params.userId; + this.props.getWalletDetailActivated(agentId, null); + //this.props.getWalletDetailActivated(agentId, null); } - renderHeader = () => ( + + renderHeader = (wallet) => ( {I18n.t('COUNTRY')} - Gabon + Pays - UBA FS iLink + {wallet.network} {I18n.t('CREATION_IDENTIFICATION_CLIENT')} @@ -275,7 +227,7 @@ class WalletDetailUser extends Component { {I18n.t('CREATION_DATE')} - Il y'a deux jours + {this.getCreationDateToHumanFormat(wallet.createdAt)} ); @@ -323,7 +275,7 @@ class WalletDetailUser extends Component { {I18n.t('PRINCIPAL_ACCOUNT_TITLE')} - 0 + {thousandsSeparators(wallet.balance)} @@ -346,213 +298,221 @@ class WalletDetailUser extends Component { {I18n.t('NUMERO_COMPTE')} - 123456789 + {wallet.user_code} ); - renderDetailWallet = () => { + renderDetailWallet = (wallet) => { return ( + !isEmptyObject(wallet) ? + (<> + {this.state.triggerTransferCommission && this.renderDialogTransferCommissionResponse()} - (<> - {this.state.triggerTransferCommission && this.renderDialogTransferCommissionResponse()} + - + - - - { this.setState({ scrollHeaderY: event.nativeEvent.contentOffset.y }); } })}> - + ], + { listener: (event) => { this.setState({ scrollHeaderY: event.nativeEvent.contentOffset.y }); } })}> + - {this.renderHeader()} + {this.renderHeader(wallet)} - + - {this.renderAccountDetail()} + {this.renderAccountDetail(wallet)} - <> - - - {I18n.t('TRANSACTIONS')} - - - - - - - { }} - activeOpacity={0.9}> - - - - - - - {I18n.t('DEPOSIT')} - - - - - - {I18n.t('DEPOSIT_DESCRIPTION')} - - - - - + <> + + + {I18n.t('TRANSACTIONS')} + - + - { this.props.navigation.push(route.createIdentification) }} - activeOpacity={0.9}> + + { + this.props.navigation.push(route.walletOptionSelect, { + optionSelect: optionDepotUserScreen + }) + }} + activeOpacity={0.9}> + - + - + + + {I18n.t('DEPOSIT')} + + + + + + {I18n.t('DEPOSIT_DESCRIPTION')} + + - - - {I18n.t('WITHDRAWAL')} - + + + + + + { + this.props.navigation.push(route.walletOptionSelect, { + optionSelect: optionRetraitUserScreen + }) + }} + activeOpacity={0.9}> + + + + + + + + {I18n.t('WITHDRAWAL')} + + + + + + {I18n.t('WITHDRAWAL_DESCRIPTION')} + + - - - {I18n.t('WITHDRAWAL_DESCRIPTION')} - - - - - - - - - - - - { this.props.navigation.push(route.createIdentification) }} - activeOpacity={0.9}> - - - - - - - - {I18n.t('NANO_CREDIT')} - - - - - - {I18n.t('WITHDRAWAL_DESCRIPTION')} - - - - - + + - - { }} - activeOpacity={0.9}> - + - + + + { this.props.navigation.push(route.createIdentification) }} + activeOpacity={0.9}> + + + + + + + + {I18n.t('NANO_CREDIT')} + + + + + + {I18n.t('WITHDRAWAL_DESCRIPTION')} + + - - - {I18n.t('NANO_SANTE')} - + + + + + { }} + activeOpacity={0.9}> + + + + + + + {I18n.t('NANO_SANTE')} + + + + + + {I18n.t('VALIDATE_IDENTIFICATION_DESCRIPTION')} + + - - - {I18n.t('VALIDATE_IDENTIFICATION_DESCRIPTION')} - - - - - - - - - - - - { this.props.navigation.push(route.createIdentification) }} - activeOpacity={0.9}> - - - - - - - - {I18n.t('PAIEMENT_FACTURE')} - - - - - - - - - - + + - + - {/* + + { this.props.navigation.push(route.createIdentification) }} + activeOpacity={0.9}> + + + + + + + + {I18n.t('PAIEMENT_FACTURE')} + + + + + + + + + + + + + + + {/* { this.props.navigation.push(route.createIdentification) }} activeOpacity={0.9}> @@ -576,22 +536,29 @@ class WalletDetailUser extends Component { - */} + + */} + - - + + + {this.renderHistoryTransaction()} + - {this.renderHistoryTransaction()} - - - - - - ) + + + ) + : + ( + + {I18n.t('NO_WALLET_ACTIVED')} + + ) ) + } renderHistoryTransactionItem = (item) => { @@ -632,10 +599,26 @@ class WalletDetailUser extends Component { return ( <> - - {I18n.t('TRANSACTION_HISTORY')} - + + {[ + { key: '1', name: 'wifi' }, + { key: '2', name: 'coffee' }, + { key: '3', name: 'bath' }, + { key: '4', name: 'car' }, + { key: '5', name: 'paw' }, + ].map((item, index) => ( + + + + {item.name} + + + ))} + @@ -675,8 +658,23 @@ class WalletDetailUser extends Component { translucent={true} /> { - this.renderDetailWallet() + ((this.props.loading || this.props.loadingTransferCommission) ? + this.renderLoader() : + ( + this.props.result !== null ? + Array.isArray(this.props.result.response) && (this.props.result.response.length) === 0 ? + + + {I18n.t('NO_WALLET_ACTIVED')} + + : + + this.renderDetailWallet(this.props.result.response) + : + null + ) + ) } @@ -729,6 +727,17 @@ const styles = StyleSheet.create({ height: 250, position: 'absolute', }, + contentService: { + paddingVertical: 10, + borderBottomWidth: 0.5, + flexDirection: 'row', + flexWrap: 'wrap', + justifyContent: 'space-between', + }, + blockView: { + paddingVertical: 10, + borderBottomWidth: 0.5, + }, containField: { padding: 10, marginBottom: 20, diff --git a/screens/wallet/WalletOptionSelect.js b/screens/wallet/WalletOptionSelect.js new file mode 100644 index 00000000..7cf6a1a5 --- /dev/null +++ b/screens/wallet/WalletOptionSelect.js @@ -0,0 +1,134 @@ +import React, { Component } from 'react'; +import { StyleSheet, View, Image, StatusBar, Alert, FlatList, TouchableOpacity, ActivityIndicator, Platform, ProgressBarAndroid, Text } from 'react-native'; +import Icon from 'react-native-vector-icons/MaterialCommunityIcons'; +const route = require('./../../route.json'); +let slugify = require('slugify'); +import I18n from 'react-native-i18n' +import * as Utils from '../../utils/DeviceUtils'; +import { Images } from '../../config/Images'; +import { Color } from '../../config/Color'; +import { baseUrl } from '../../webservice/IlinkConstants'; +import { IlinkEmitter } from "../../utils/events"; +import { Provider, Appbar } from 'react-native-paper'; +import { readUser } from '../../webservice/AuthApi'; +import { FontWeight, Typography } from '../../config/typography'; + +export default class WalletOptionSelect extends Component { + + constructor(props) { + super(props); + IlinkEmitter.on("langueChange", this.updateLangue.bind(this)); + this.state = { + options: this.props.navigation.state.params.optionSelect.options, + title: this.props.navigation.state.params.optionSelect.title, + subTitle: this.props.navigation.state.params.optionSelect.subTitle, + hasWallet: this.props.navigation.state.params.hasOwnProperty('wallet') + } + + } + + static navigationOptions = ({ navigation }) => ({ + header: null, + headerMode: 'none', + headerTitle: null, + activeColor: '#f0edf6', + inactiveColor: '#3e2465', + barStyle: { backgroundColor: '#694fad' }, + + drawerLabel: I18n.t('CREDIT_MANAGE'), + drawerIcon: ({ tintColor }) => ( + ) + }); + + updateLangue() { + this.props.navigation.setParams({ name: I18n.t('WALLET') }) + this.forceUpdate(); + } + + render() { + return ( + + + + + + + { this.props.navigation.pop() }} + /> + + + + + index.toString()} + renderItem={({ item, index }) => ( + { + if (this.state.hasWallet) { + this.props.navigation.push(item.screen, { + wallet: this.props.navigation.state.params.wallet, + onGoBack: () => this.props.navigation.state.params.onGoBack() + }) + } else { + this.props.navigation.push(item.screen) + } + + }}> + + + {item.title} + + + + )} + /> + + + + + ); + } +} + + +const styles = StyleSheet.create({ + container: { + flex: 1, + backgroundColor: Color.containerBackgroundColor, + }, + item: { + paddingVertical: 15, + borderBottomWidth: 1, + flexDirection: "row", + justifyContent: "space-between", + alignItems: "center" + } +}); \ No newline at end of file diff --git a/utils/UtilsFunction.js b/utils/UtilsFunction.js index 7c73d9f2..a01172cf 100644 --- a/utils/UtilsFunction.js +++ b/utils/UtilsFunction.js @@ -1,4 +1,7 @@ import I18n from 'react-native-i18n'; +import isEqual from 'lodash/isEqual'; +let slugify = require('slugify'); +let route = require('./../route.json'); export const thousandsSeparators = (num) => { var num_parts = num.toString().split("."); @@ -41,4 +44,96 @@ export const isEmptyObject = (obj) => { } return JSON.stringify(obj) === JSON.stringify({}); +} + +export const isIlinkWorldWallet = (walletName) => { + return isEqual(slugify(walletName).toLowerCase(), 'ilink-world'); +} + +export const optionDepotScreen = { + title: I18n.t('DEPOSIT'), + subTitle: I18n.t('CHOOSE_OPTION'), + options: [ + { + screen: route.walletDepot, + icon: 'wallet', + title: I18n.t('DEPOSIT_CASH_TO_WALLET'), + }, + { + screen: route.walletDepot, + icon: 'cash-refund', + title: I18n.t('DEPOSIT_CASH_TO_OTHER_WALLET'), + }, + { + screen: route.walletDepot, + icon: 'credit-card', + title: I18n.t('DEPOSIT_CASH_TO_VISA'), + }, + { + screen: route.walletDepot, + icon: 'bank-transfer-in', + title: I18n.t('DEPOSIT_CASH_TO_BANK'), + }, + ] +} + +export const optionRetraitScreen = { + title: I18n.t('WITHDRAWAL'), + subTitle: I18n.t('CHOOSE_OPTION'), + options: [ + { + screen: route.walletRetrait, + icon: 'cash', + title: I18n.t('WITHDRAWAL_IN_CASH'), + }, + ] +} + +export const optionRetraitUserScreen = { + title: I18n.t('WITHDRAWAL'), + subTitle: I18n.t('CHOOSE_OPTION'), + options: [ + { + screen: route.walletDepot, + icon: 'wallet', + title: I18n.t('WITHDRAWAL_WALLET_TO_CASH'), + }, + { + screen: route.walletRetrait, + icon: 'credit-card-refund', + title: I18n.t('WITHDRAWAL_CARD_TO_CASH'), + }, + { + screen: route.walletRetrait, + icon: 'card', + title: I18n.t('WITHDRAWAL_CARD_TO_WALLET'), + }, + ] +} + +export const optionDepotUserScreen = { + title: I18n.t('DEPOSIT'), + subTitle: I18n.t('CHOOSE_OPTION'), + options: [ + { + screen: route.walletDepot, + icon: 'wallet', + title: I18n.t('DEPOSIT_WALLET_TO_WALLET'), + }, + { + screen: route.walletDepot, + icon: 'cash-refund', + title: I18n.t('DEPOSIT_TO_CASH'), + }, + { + screen: route.walletDepot, + icon: 'credit-card', + title: I18n.t('DEPOSIT_TO_CARD'), + }, + { + screen: route.walletDepot, + icon: 'bank-transfer-in', + title: I18n.t('DEPOSIT_TO_BANK'), + }, + ] } \ No newline at end of file diff --git a/utils/i18n/en.json b/utils/i18n/en.json index 3ae3049a..252c5b17 100644 --- a/utils/i18n/en.json +++ b/utils/i18n/en.json @@ -50,10 +50,23 @@ "CVC_CARD_ERROR": "CVC card error format", "THIS_FIELD_IS_REQUIRED": "This field is required", "PLEASE_ENTER_THE_AMOUNT": "Please enter the amount", + "CHOOSE_OPTION": "Please choose an option", "EXPIRY_CARD_ERROR": "Date incorrect", "CARD_NUMBER_ERROR": "Card number incorrect", "AMOUNT_LABEL": "Amount", "WITHDRAWAL": "Withdrawal", + "WITHDRAWAL_IN_CASH": "Withdrawal in cash", + "WITHDRAWAL_WALLET_TO_CASH": "Withdrawal wallet to cash", + "WITHDRAWAL_CARD_TO_WALLET": "Withdrawal card to wallet", + "WITHDRAWAL_CARD_TO_CASH": "Withdrawal card to cash", + "DEPOSIT_CASH_TO_WALLET": "Cash to wallet", + "DEPOSIT_CASH_TO_OTHER_WALLET": "Cash to another wallet", + "DEPOSIT_CASH_TO_VISA": "Cash to visa card", + "DEPOSIT_CASH_TO_BANK": "Cash to bank", + "DEPOSIT_WALLET_TO_WALLET": "Wallet to wallet", + "DEPOSIT_TO_CASH": "Deposit to cash", + "DEPOSIT_TO_CARD": "Deposit to card", + "DEPOSIT_TO_BANK": "Deposit to bank", "NANO_CREDIT": "Nano credit", "NANO_SANTE": "Nano health", "PAIEMENT_FACTURE": "Bill payment", diff --git a/utils/i18n/fr.json b/utils/i18n/fr.json index 5a0e2583..96a2c5f6 100644 --- a/utils/i18n/fr.json +++ b/utils/i18n/fr.json @@ -56,8 +56,21 @@ "CARD_NUMBER_ERROR": "Numéro de carte incorrect", "THIS_FIELD_IS_REQUIRED": "Ce champ est requis", "PLEASE_ENTER_THE_AMOUNT": "Veuillez renseigne le montant", + "CHOOSE_OPTION": "Veuillez sélectionner une option", "DEPOSIT_DESCRIPTION": "Effectuer un dépôt", "WITHDRAWAL": "Retrait", + "WITHDRAWAL_IN_CASH": "Retrait en cash", + "WITHDRAWAL_WALLET_TO_CASH": "Retrait wallet vers cash", + "WITHDRAWAL_CARD_TO_WALLET": "Retrait carte vers wallet", + "WITHDRAWAL_CARD_TO_CASH": "Retrait carte vers cash", + "DEPOSIT_CASH_TO_WALLET": "Cash vers wallet", + "DEPOSIT_CASH_TO_OTHER_WALLET": "Cash vers autre wallet", + "DEPOSIT_CASH_TO_VISA": "Cash vers carte visa", + "DEPOSIT_CASH_TO_BANK": "Cash vers banque", + "DEPOSIT_WALLET_TO_WALLET": "Wallet vers wallet", + "DEPOSIT_TO_CASH": "Dépôt vers cash", + "DEPOSIT_TO_CARD": "Dépôt vers carte", + "DEPOSIT_TO_BANK": "Dépôt vers banque", "NANO_CREDIT": "Nano crédit", "NANO_SANTE": "Nano santé", "PAIEMENT_FACTURE": "Paiement de facture", diff --git a/webservice/IlinkConstants.js b/webservice/IlinkConstants.js index 3a340391..5af277b0 100644 --- a/webservice/IlinkConstants.js +++ b/webservice/IlinkConstants.js @@ -25,6 +25,7 @@ export const configActionUrl = baseUrl + '/interacted/ConfigAction.php'; export const logoutActionUrl = testBaseUrl + '/logout'; export const walletActionUrl = testBaseUrl + '/walletService/wallets'; +export const walletUserSimpleActionUrl = testBaseUrl + '/walletService/wallets/users'; export const walletDetailUrl = testBaseUrl + '/walletService/wallets'; export const creditTreatDemand = testBaseUrl + '/walletService/credits/treatDemand'; export const creditCancelDemand = testBaseUrl + '/walletService/credits/cancelDemand'; diff --git a/webservice/WalletApi.js b/webservice/WalletApi.js index 994e5995..08f7b1d1 100644 --- a/webservice/WalletApi.js +++ b/webservice/WalletApi.js @@ -1,5 +1,5 @@ -import { walletActionUrl, commissionAmount, walletDetailUrl } from "./IlinkConstants"; +import { walletActionUrl, commissionAmount, walletDetailUrl, walletUserSimpleActionUrl } from "./IlinkConstants"; import { fetchWalletListPending, fetchWalletListSuccess, fetchWalletListError, fetchWalletListReset, fetchWalletListDetailPending, fetchWalletListDetailSuccess, fetchWalletListDetailError, fetchWalletListDetailReset, fetchWalletGetCommissionPending, fetchWalletGetCommissionSuccess, fetchWalleGetCommissionError, walletGetCommissionReset } from "../redux/actions/WalletActions"; import { store } from "../redux/store"; import axios from "axios"; @@ -47,7 +47,16 @@ export const getWalletDetailActivated = (id, isAgentCall) => { const auth = store.getState().authKeyReducer; const authKey = auth !== null ? `${auth.authKey.token_type} ${auth.authKey.access_token}` : ''; - const url = isAgentCall ? `${walletActionUrl}/${id}/activated` : `${walletDetailUrl}/${id}`; + + console.log("isAgentCall", isAgentCall); + let url = null; + if (isAgentCall === null) + url = `${walletUserSimpleActionUrl}/${id}`; + else if (isAgentCall === false) + url = `${walletDetailUrl}/${id}`; + else + url = `${walletActionUrl}/${id}/activated`; + return dispatch => { dispatch(fetchWalletListDetailPending()); @@ -60,11 +69,11 @@ export const getWalletDetailActivated = (id, isAgentCall) => { } }) .then(response => { - console.log(response); + console.log("RESPONSE", response); dispatch(fetchWalletListDetailSuccess(response)); }) .catch(error => { - console.log(error); + console.log("ERROR", error); dispatch(fetchWalletListDetailError(error.message)); if (error.response) dispatch(fetchWalletListDetailError(error.response));