Rattacher compte bancaire

This commit is contained in:
Brice Zele 2020-12-05 14:26:44 +01:00
parent 67d72b36ec
commit 066201cb5e
23 changed files with 801 additions and 83 deletions

4
App.js
View File

@ -82,6 +82,7 @@ import EpargnerArgentUser from './screens/nano-credit/EpargnerArgentUser';
import CasserEpargneUser from './screens/nano-credit/CasserEpargneUser';
import {IlinkEmitter} from './utils/events';
import EnvoieWalletToBankAgent from "./screens/wallet/agent/EnvoieWalletToBankAgent";
import ReattachAccountUser from "./screens/wallet/user/ReattachAccountUser";
const instructions = Platform.select({
@ -124,7 +125,6 @@ const AppStack = createDrawerNavigator({
walletDetailUser: WalletDetailUser,
walletOptionSelect: WalletOptionSelect,
operateurOptionSelect: OperateurOptionSelect,
operateurOptionSelect: OperateurOptionSelect,
paiementFacture: PaiementFacture,
envoieWalletToWalletUser: EnvoieWalletToWalletUser,
envoieWalletToCashUser: EnvoieWalletToCashUser,
@ -134,6 +134,7 @@ const AppStack = createDrawerNavigator({
retraitCarteVersCashUser: RetraitCarteVersCashUser,
retraitCarteVersWalletUser: RetraitCarteVersWalletUser,
linkCard: LinkCard,
reattachAccountUser: ReattachAccountUser,
epargnerArgentUser: EpargnerArgentUser,
createGroupNanoCredit: CreateGroupNanoCredit,
groupNanoCredit: {
@ -216,7 +217,6 @@ const AppAgentStack = createDrawerNavigator({
screen: createBottomTabNavigator({myDemand: MyHistory}, {
headerMode: "none",
header: null,
headerTitle: null,
headerTitle: I18n.t('CREDIT_MANAGE'),
tabBarOptions: {
labelStyle: {

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

View File

@ -1,4 +1,8 @@
import {
GET_BANK_FOR_ILINK_ERROR,
GET_BANK_FOR_ILINK_PENDING,
GET_BANK_FOR_ILINK_RESET,
GET_BANK_FOR_ILINK_SUCCESS,
GET_OPERATOR_LIST_ERROR,
GET_OPERATOR_LIST_PENDING,
GET_OPERATOR_LIST_RESET,
@ -11,6 +15,10 @@ import {
PAY_BILL_PENDING,
PAY_BILL_RESET,
PAY_BILL_SUCCESS,
REATTACH_ACCOUNT_ERROR,
REATTACH_ACCOUNT_PENDING,
REATTACH_ACCOUNT_RESET,
REATTACH_ACCOUNT_SUCCESS,
WALLET_GET_COMMISSION_ERROR,
WALLET_GET_COMMISSION_PENDING,
WALLET_GET_COMMISSION_RESET,
@ -162,20 +170,52 @@ export const fetchWalleGetCommissionError = (error) => ({
export const fetchLinkCardPending = () => ({
type: LINK_CARD_PENDING
});
export const fetchLinkCardReset = () => ({
type: LINK_CARD_RESET
});
export const fetchLinkCardSuccess = (res) => ({
type: LINK_CARD_SUCCESS,
result: res,
});
export const fetchLinkCardError = (error) => ({
type: LINK_CARD_ERROR,
result: error
});
/**
* ---------------------------------------------------
*/
export const fetchGetBankIlinkPending = () => ({
type: GET_BANK_FOR_ILINK_PENDING
});
export const fetchGetBankIlinkReset = () => ({
type: GET_BANK_FOR_ILINK_RESET
});
export const fetchGetBankIlinkSuccess = (res) => ({
type: GET_BANK_FOR_ILINK_SUCCESS,
result: res,
});
export const fetchGetBankIlinkError = (error) => ({
type: GET_BANK_FOR_ILINK_ERROR
,
result: error
});
/**
* ---------------------------------------------------
*/
export const fetchReattachAccountPending = () => ({
type: REATTACH_ACCOUNT_PENDING
});
export const fetchReattachAccountReset = () => ({
type: REATTACH_ACCOUNT_RESET
});
export const fetchReattachAccountSuccess = (res) => ({
type: REATTACH_ACCOUNT_SUCCESS,
result: res,
});
export const fetchReattachAccountError = (error) => ({
type: REATTACH_ACCOUNT_ERROR,
result: error
});
/* export const fetchWalletGetRetraitCommissionPending = () => ({
type: WALLET_GET_RETREAIT_COMMISSION_PENDING

View File

@ -0,0 +1,42 @@
import {
GET_BANK_FOR_ILINK_ERROR,
GET_BANK_FOR_ILINK_PENDING,
GET_BANK_FOR_ILINK_RESET,
GET_BANK_FOR_ILINK_SUCCESS
} from "../types/WalletType";
const initialState = {
loading: false,
result: null,
error: null
};
export default (state = initialState, action) => {
switch (action.type) {
case GET_BANK_FOR_ILINK_PENDING:
return {
...state,
loading: true
}
case GET_BANK_FOR_ILINK_SUCCESS:
return {
...state,
loading: false,
result: action.result.data,
error: null
}
case GET_BANK_FOR_ILINK_ERROR:
return {
...state,
loading: false,
result: null,
error: action.result
}
case GET_BANK_FOR_ILINK_RESET:
return initialState;
default: {
return state;
}
}
};

View File

@ -0,0 +1,42 @@
import {
REATTACH_ACCOUNT_ERROR,
REATTACH_ACCOUNT_PENDING,
REATTACH_ACCOUNT_RESET,
REATTACH_ACCOUNT_SUCCESS
} from "../types/WalletType";
const initialState = {
loading: false,
result: null,
error: null
};
export default (state = initialState, action) => {
switch (action.type) {
case REATTACH_ACCOUNT_PENDING:
return {
...state,
loading: true
}
case REATTACH_ACCOUNT_SUCCESS:
return {
...state,
loading: false,
result: action.result.data,
error: null
}
case REATTACH_ACCOUNT_ERROR:
return {
...state,
loading: false,
result: null,
error: action.result
}
case REATTACH_ACCOUNT_RESET:
return initialState;
default: {
return state;
}
}
};

View File

@ -48,6 +48,8 @@ import GetEpargneInProgressReducer from "./GetEpargneInProgressReducer";
import GetNanoCreditUserHistoryInProgressReducer from "./GetNanoCreditUserHistoryInProgressReducer";
import GetListOperatorReducer from "./GetListOperatorReducer";
import PayBillReducer from "./PayBillReducer";
import GetIlinkBankReducer from "./GetIlinkBankReducer";
import ReattachAccountReducer from "./ReattachAccountReducer";
const persistConfig = {
key: 'root',
@ -105,6 +107,8 @@ const rootReducer = persistCombineReducers(persistConfig, {
getNanoCreditUserHistoryInProgressReducer: GetNanoCreditUserHistoryInProgressReducer,
getListOperatorReducer: GetListOperatorReducer,
payBillReducer: PayBillReducer,
getIlinkBankReducer: GetIlinkBankReducer,
reattachAccountReducer: ReattachAccountReducer
});
export default rootReducer;

View File

@ -38,6 +38,16 @@ export const LINK_CARD_SUCCESS = 'LINK_CARD_SUCCESS';
export const LINK_CARD_ERROR = 'LINK_CARD_ERROR';
export const LINK_CARD_RESET = 'LINK_CARD_RESET';
export const REATTACH_ACCOUNT_PENDING = 'REATTACH_ACCOUNT_PENDING';
export const REATTACH_ACCOUNT_SUCCESS = 'REATTACH_ACCOUNT_SUCCESS';
export const REATTACH_ACCOUNT_ERROR = 'REATTACH_ACCOUNT_ERROR';
export const REATTACH_ACCOUNT_RESET = 'REATTACH_ACCOUNT_RESET';
export const GET_BANK_FOR_ILINK_PENDING = 'GET_BANK_FOR_ILINK_PENDING';
export const GET_BANK_FOR_ILINK_SUCCESS = 'GET_BANK_FOR_ILINK_SUCCESS';
export const GET_BANK_FOR_ILINK_ERROR = 'GET_BANK_FOR_ILINK_ERROR';
export const GET_BANK_FOR_ILINK_RESET = 'GET_BANK_FOR_ILINK_RESET';
export const GET_OPERATOR_LIST_PENDING = 'GET_OPERATOR_LIST_PENDING';
export const GET_OPERATOR_LIST_SUCCESS = 'GET_OPERATOR_LIST_SUCCESS';
export const GET_OPERATOR_LIST_ERROR = 'GET_OPERATOR_LIST_ERROR';

View File

@ -63,5 +63,6 @@
"refundNanoCreditUser": "refundNanoCreditUser",
"cautionNanoCreditAgent": "cautionNanoCreditAgent",
"epargnerArgentUser": "epargnerArgentUser",
"casserEpargneUser": "casserEpargneUser"
"casserEpargneUser": "casserEpargneUser",
"reattachAccountUser": "reattachAccountUser"
}

View File

@ -1653,7 +1653,7 @@ class Home extends BaseScreen {
translucent={true}
/>
{/* Start here to comment */}
{/*{
{
(this.state.loadingDialog || this.props.loading) ?
<View
style={{
@ -1705,7 +1705,7 @@ class Home extends BaseScreen {
}
}])
}}
/>*/}
/>
{this.makeCardSearch()}
{this.makeSlidingUp()}
{this.makeDialogLoader()}

View File

@ -369,7 +369,7 @@ class CasserEpargneUser extends Component {
this.setState({displayModalHistory: true, historyItemDetail: item})
}} style={[styles.contentService, {borderBottomColor: Color.primaryColor}]}>
{
Object.keys(omit(item, ['id', 'id_epargne', 'montant_retire', 'date_demande', 'date_fin', 'date_remboursement_prevu', 'date_validation', 'date_cassation', 'date_remboursement', 'id_demande', 'duree_mois', 'taxe', '', 'date_fin', 'date_cassation', 'id_user', 'id_network', 'user', 'partiellement_rembourse', 'user_phone', 'interet', 'date_remboursement_prevu', 'date_remboursement', 'id_wallet_agent', 'retrait_cash', 'codeParrain', 'agent', 'montant_rembourse', ''])).map((element, i) => (
Object.keys(omit(item, ['id', 'id_epargne', 'montant_retire', 'type', 'date_demande', 'date_fin', 'date_remboursement_prevu', 'date_validation', 'date_cassation', 'date_remboursement', 'id_demande', 'duree_mois', 'taxe', 'date_fin', 'date_cassation', 'id_user', 'id_network', 'user', 'partiellement_rembourse', 'user_phone', 'interet', 'date_remboursement_prevu', 'date_remboursement', 'id_wallet_agent', 'retrait_cash', 'codeParrain', 'agent', 'montant_rembourse', ''])).map((element, i) => (
<View style={{alignItems: 'center'}} key={i}>
<Text style={[Typography.overline, Color.grayColor], {marginTop: 4}}>

View File

@ -352,10 +352,10 @@ class EpargnerArgentUser extends Component {
this.setState({durationSelect: value});
}}
valueExtractor={(value) => {
return I18n.t(value.value)
return (value.value)
}}
labelExtractor={(value) => {
return I18n.t(value.value)
return (value.value)
}}
/>
</Animatable.View>

View File

@ -405,7 +405,7 @@ class RefundNanoCreditUser extends Component {
this.setState({displayModalHistory: true, historyItemDetail: item})
}} style={[styles.contentService, {borderBottomColor: Color.primaryColor}]}>
{
Object.keys(omit(item, ['id', 'id_demande', 'agent', 'retrait_cash', 'date_remboursement_prevu', 'taxe', 'date_validation', 'duree_mois', 'interet', 'montant_rembourse', 'partiellement_rembourse',])).map((element, i) => (
Object.keys(omit(item, ['id', 'id_demande', 'type_caution', 'agent', 'retrait_cash', 'date_remboursement_prevu', 'taxe', 'date_validation', 'duree_mois', 'interet', 'montant_rembourse', 'partiellement_rembourse',])).map((element, i) => (
<View style={{alignItems: 'center'}} key={i}>
<Text style={[Typography.overline, Color.grayColor], {marginTop: 4}}>

View File

@ -271,7 +271,7 @@ export default class OptionsMenu extends Component {
|| item === 'envoieCashVersAutreWalletAgent' || item === 'retraitCarteVersCashUser' || item === 'envoiCashVersCashAgent' || item === 'envoieCashVersCashAgent'
|| item === 'envoieCashVersCarteAgent' || item === 'modifyIdentificationUser' || item === 'createGroupNanoCredit' || item === 'groupNanoCredit' || item === 'demandeValidationGroupe'
|| item === 'adhererGroupNanoCredit' || item === 'myNanoCreditGroup' || item === 'askNanoCredit' || item === 'refundNanoCreditUser' || item === 'cautionNanoCreditAgent'
|| item === 'epargnerArgentUser' || item === 'askNanoCredit' || item === 'casserEpargneUser' || item === 'envoieWalletToBankAgent') {
|| item === 'epargnerArgentUser' || item === 'askNanoCredit' || item === 'casserEpargneUser' || item === 'envoieWalletToBankAgent' || item === 'reattachAccountUser') {
return null
} else {
const color = this.state.currentId === item.id ? theme.accent : "grey"

View File

@ -59,7 +59,6 @@ import {
} from '../../webservice/WalletTransactionHistoryApi';
import {resetCommissionReducer, transferCommissionAction} from '../../webservice/WalletTransferCommission';
import {readUser} from '../../webservice/AuthApi';
import {store} from "../../redux/store";
let moment = require('moment-timezone');
const thousands = require('thousands');
@ -110,42 +109,51 @@ class WalletDetail extends Component {
this.currentLocale = I18n.locale.includes("fr") ? "fr" : "en-gb";
moment.locale(this.currentLocale);
if (this.isHomeRootView) {
let agentId = this.props.navigation.state.params.agentId;
this.props.getWalletDetailActivated(agentId, true);
this.props.getHyperSuperTransactionHistoryReset();
} else {
this.props.getWalletDetailActivated(this.props.navigation.state.params.wallet.id, false);
if (isIlinkWorldWallet(this.props.navigation.state.params.wallet.type))
this.props.getWalletTransactionHistory(this.props.navigation.state.params.wallet.id, true);
else
this.props.getWalletTransactionHistory(this.props.navigation.state.params.wallet.id, false);
}
readUser().then((user) => {
if (user !== null && user !== undefined) {
if (user.category !== undefined) {
switch (user.category) {
case "super":
this.props.getHyperSuperTransactionHistoryAction(user.code_membre, false);
break;
case "hyper":
this.props.getHyperSuperTransactionHistoryAction(user.network_id, true);
break;
if (user) {
if (user !== undefined) {
if (user.category !== undefined) {
if (user.category === "super" || user.category === "hyper") {
let agentId = this.props.navigation.state.params.agentId;
this.props.getWalletDetailActivated(agentId, true);
this.props.getHyperSuperTransactionHistoryReset();
}
if (user.category === "geolocated") {
this.props.getWalletDetailActivated(this.props.navigation.state.params.wallet.id, false);
if (isIlinkWorldWallet(this.props.navigation.state.params.wallet.type))
this.props.getWalletTransactionHistory(this.props.navigation.state.params.wallet.id, true);
else
this.props.getWalletTransactionHistory(this.props.navigation.state.params.wallet.id, false);
}
}
this.setState({});
}
}
});
/* if (this.isHomeRootView) {
let agentId = this.props.navigation.state.params.agentId;
this.props.getWalletDetailActivated(agentId, true);
this.props.getHyperSuperTransactionHistoryReset();
} else {
this.props.getWalletDetailActivated(this.props.navigation.state.params.wallet.id, false);
if (isIlinkWorldWallet(this.props.navigation.state.params.wallet.type))
this.props.getWalletTransactionHistory(this.props.navigation.state.params.wallet.id, true);
else
this.props.getWalletTransactionHistory(this.props.navigation.state.params.wallet.id, false);
}*/
this.getWalletDetail();
this.willFocus = this.props.navigation.addListener(
'willFocus',
payload => {
const {result} = this.props;
console.log("will focus");
console.warn("will focus detail");
this.getWalletDetail();
this.setState({
wallet: {currency_code: ''}
}, ()=>{
}, () => {
if (result !== null) {
if (typeof result.response !== 'undefined') {
const wallet = result.response[0];
@ -175,6 +183,29 @@ class WalletDetail extends Component {
}
getWalletDetail = () => {
readUser().then((user) => {
if (user) {
if (user !== undefined) {
if (user.category !== undefined) {
if (user.category === "super" || user.category === "hyper") {
let agentId = this.props.navigation.state.params.agentId;
this.props.getWalletDetailActivated(agentId, true);
this.props.getHyperSuperTransactionHistoryReset();
}
if (user.category === "geolocated") {
this.props.getWalletDetailActivated(this.props.navigation.state.params.wallet.id, false);
if (isIlinkWorldWallet(this.props.navigation.state.params.wallet.type))
this.props.getWalletTransactionHistory(this.props.navigation.state.params.wallet.id, true);
else
this.props.getWalletTransactionHistory(this.props.navigation.state.params.wallet.id, false);
}
}
}
}
});
};
/*
static options(passProps) {
return {
@ -1348,7 +1379,7 @@ class WalletDetail extends Component {
<Text
style={[Typography.overline, Color.grayColor], {paddingVertical: 5}}
numberOfLines={5}>
{I18n.t('DEPOSIT_DESCRIPTION')}
{/*I18n.t('DEPOSIT_DESCRIPTION')*/}
</Text>
</View>
@ -1396,7 +1427,7 @@ class WalletDetail extends Component {
<Text
style={[Typography.overline, Color.grayColor], {paddingVertical: 5}}
numberOfLines={5}>
{I18n.t('WITHDRAWAL_DESCRIPTION')}
{/*I18n.t('WITHDRAWAL_DESCRIPTION')*/}
</Text>
</View>

View File

@ -48,6 +48,7 @@ import {
isEmptyObject,
optionDepotUserScreen,
optionIdentificationUserScreen,
optionLinkAccountUserScreen,
optionNanoCreditScreen,
optionPaiementFacture,
optionRetraitUserScreen,
@ -102,34 +103,16 @@ class WalletDetailUser extends Component {
this.props.depositActionReset();
this.props.resetWalletListDetailReducer();
this.props.getWalletDetailActivated(this.props.navigation.state.params.userId, null);
this.props.getUserIdentificationResetAction();
console.warn("Wallet User Props", this.props);
readUser().then((user) => {
console.log("WIIL FOCUS CALL 1");
if (user) {
if (user !== undefined) {
this.setState({user});
this.props.getUserIdentificationAction(user.phone);
this.props.getWalletTransactionHistoryUser(user.id);
}
}
});
this.getWalletDetail();
this.willFocus = this.props.navigation.addListener(
'willFocus',
payload => {
console.log("WIIL FOCUS CALL 2");
readUser().then((user) => {
if (user) {
if (user !== undefined) {
this.setState({user});
this.props.getWalletTransactionHistoryUser(user.id);
}
}
});
this.getWalletDetail();
});
}
static navigatorStyle = {
@ -159,6 +142,19 @@ class WalletDetailUser extends Component {
}
};
getWalletDetail = () => {
this.props.getWalletDetailActivated(this.props.navigation.state.params.userId, null);
readUser().then((user) => {
if (user) {
if (user !== undefined) {
this.setState({user});
this.props.getUserIdentificationAction(user.phone);
this.props.getWalletTransactionHistoryUser(user.id);
}
}
});
};
componentDidMount() {
const {result, resultUserIdentification, errorUserIdentification} = this.props;
@ -298,12 +294,22 @@ class WalletDetailUser extends Component {
}}
primary
onPress={() => {
this.props.navigation.push(route.linkCard);
this.props.navigation.push(route.walletOptionSelect, {
optionSelect: optionLinkAccountUserScreen,
lottie: {
source: require("./../../datas/json/link_card.json"),
loop: true
},
isIdentified: this.props.resultUserIdentification.response.isIdentified
});
}}>
&nbsp;{I18n.t('LINK_CARD')}
&nbsp;{I18n.t('LINK_CARD_REATTACH')}
</Tag>
<Tag icon={<Icon name='update' size={20} color={Color.whiteColor}/>} primary
style={{width: 110, borderTopLeftRadius: 0, borderBottomLeftRadius: 0,}}>
style={{width: 110, borderTopLeftRadius: 0, borderBottomLeftRadius: 0,}}
onPress={() => {
this._scrollView.scrollToEnd();
}}>
&nbsp;&nbsp;{I18n.t('HISTORY')}
</Tag>

View File

@ -45,6 +45,9 @@ import Dialog from "react-native-dialog";
import {connect} from 'react-redux';
import {bindActionCreators} from 'redux';
import {responsiveWidth} from 'react-native-responsive-dimensions';
import {getWalletDetailActivated} from "../../webservice/WalletApi";
import {getWalletTransactionHistoryUser} from "../../webservice/WalletTransactionHistoryApi";
import {getUserIdentificationAction} from "../../webservice/IdentificationApi";
const route = require('./../../route.json');
let slugify = require('slugify');
@ -99,6 +102,10 @@ class WalletOptionSelect extends Component {
if (user.category === undefined) {
this.props.getNanoCreditAccountAction(user.id);
this.props.getNanoCreditUserHistoryAction(user.id, true);
//refresh wallet
this.props.getWalletDetailActivated(user.id, null);
this.props.getUserIdentificationAction(user.phone);
this.props.getWalletTransactionHistoryUser(user.id);
} else {
if (user.category === 'geolocated')
this.props.getNanoCreditUserHistoryAction(this.state.wallet.id, false);
@ -152,6 +159,7 @@ class WalletOptionSelect extends Component {
}
redirectToRoute = (optionsParam) => {
console.warn("Wallet Select Props", optionsParam);
if (optionsParam.hasOwnProperty('hasSubMenu')) {
@ -172,7 +180,6 @@ class WalletOptionSelect extends Component {
this.props.navigation.push(optionsParam.subMenuOption[buttonIndex].screen);
},
);
console.log(this.props);
} else {
switch (this.state.type) {
case 'FACTURE':
@ -215,9 +222,8 @@ class WalletOptionSelect extends Component {
onGoBack: () => this.props.navigation.state.params.onGoBack(),
});
break;
default:
this.props.navigation.push(optionsParam.screen)
this.props.navigation.push(optionsParam.screen);
break;
}
}
@ -272,7 +278,9 @@ class WalletOptionSelect extends Component {
displayToast(I18n.t('NOT_YET_IDENTIFY'));
else
this.redirectToRoute(options);
}
} else
this.redirectToRoute(options);
} else
this.redirectToRoute(options);
@ -1026,7 +1034,11 @@ const mapDispatchToProps = dispatch => bindActionCreators({
getNanoCreditAccountReset,
getNanoCreditUserHistoryAction,
getNanoCreditUserHistoryReset
getNanoCreditUserHistoryReset,
getWalletDetailActivated,
getUserIdentificationAction,
getWalletTransactionHistoryUser
}, dispatch);
export default connect(mapStateToProps, mapDispatchToProps)(connectActionSheet(WalletOptionSelect));

View File

@ -0,0 +1,419 @@
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 {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 {FontWeight, Typography} from '../../../config/typography';
import {store} from "../../../redux/store";
import {readUser} from '../../../webservice/AuthApi';
import {isNormalInteger} from '../../../utils/UtilsFunction';
import {askNanoCreditAction, getNanoCreditDemandDurationAction} from '../../../webservice/NanoCreditApi';
import {Dropdown} from 'react-native-material-dropdown';
import {
getIlinkBankAction,
getIlinkBankReset,
reattachAccountAction,
reattachAccountReset
} from "../../../webservice/WalletApi";
let theme = require('../../../utils/theme.json');
let route = require('../../../route.json');
class ReattachAccountUser extends Component {
static navigatorStyle = {
navBarBackgroundColor: Color.primaryColor,
statusBarColor: Color.primaryDarkColor,
navBarTextColor: '#FFFFFF',
navBarButtonColor: '#FFFFFF'
};
static navigationOptions = () => {
return {
drawerLabel: () => null,
headerTitle: I18n.t('REATTACH_CARD'),
headerTintColor: 'white',
headerStyle: {
backgroundColor: Color.primaryColor,
marginTop: 0,
color: 'white'
},
headerTitleStyle: {
color: "white"
},
title: I18n.t('REATTACH_CARD')
}
};
constructor(props) {
super(props);
this.state = {
codeGroupe: null,
codeSponsor: null,
nomGroupe: null,
user: null,
iban: null,
bankToSend: null,
ilinkBanks: [],
bankSelect: null,
triggerSubmitClick: false,
hasLoadBank: false,
modalVisible: false,
isSubmitClick: false,
isDataSubmit: false,
isModalConfirmVisible: false,
wallet: store.getState().walletDetailReducer.result.response
};
this.props.getIlinkBankReset();
this.props.getIlinkBankAction(this.state.wallet.id_wallet_network);
}
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
};
}
renderIlinkBankList = () => {
const {resultGetBank, errorGetBank} = this.props;
if (resultGetBank !== null) {
if (typeof resultGetBank.response !== 'undefined') {
if (resultGetBank.response.length > 0) {
this.setState({
hasLoadBank: true,
ilinkBanks: resultGetBank.response,
bankSelect: resultGetBank.response[0].bank_name + " - " + resultGetBank.response[0].bank_address,
bankToSend: resultGetBank.response[0],
modalVisible: false
});
} else if (resultGetBank.response.length === 0) {
this.setState({
hasLoadBank: true,
ilinkBanks: [],
bankSelect: '',
bankToSend: null,
modalVisible: false
});
}
}
}
if (errorGetBank !== null) {
if (typeof errorGetBank.data !== 'undefined') {
Alert.alert(
I18n.t('ERROR_LABEL'),
errorGetBank.data.error,
[
{
text: I18n.t("OK"), onPress: () => {
this.props.getIlinkBankReset();
}
}
],
{cancelable: false}
)
} else {
Alert.alert(
I18n.t('ERROR_LABEL'),
JSON.stringify(errorGetBank),
[
{
text: I18n.t("OK"), onPress: () => {
this.props.getIlinkBankReset();
}
}
],
{cancelable: false}
)
}
}
}
renderReattachAccountResponse = () => {
const {result, error} = this.props;
if (error !== null) {
if (typeof error.data !== 'undefined') {
Alert.alert(
I18n.t("ERROR_LABLE"),
error.data.error,
[
{
text: I18n.t("OK"), onPress: () => {
this.props.reattachAccountReset();
}
}
],
{cancelable: false}
)
}
}
if (result !== null) {
if (result.response !== null) {
Alert.alert(
I18n.t("DEMAND_SEND"),
result.response,
[
{
text: I18n.t("OK"), onPress: () => {
this.props.reattachAccountReset();
//IlinkEmitter.emit("treatNanoGroupDemand");
this.props.navigation.pop();
}
}
],
{cancelable: false}
)
}
}
}
updateLangue() {
this.props.navigation.setParams({name: I18n.t('DEPOSIT_TO_CARD')})
this.forceUpdate()
}
onSubmitSendWalletToCard = () => {
const {iban, bankSelect} = this.state;
if (this.ckeckIfFieldIsOK(bankSelect))
this.listBankAnim.shake(800);
else if (this.ckeckIfFieldIsOK(iban))
this.ibanAnim.shake(800);
else {
console.warn("Code Iban", this.state.iban);
console.warn("Bank", this.state.bankToSend);
this.props.reattachAccountAction({
iban: this.state.iban,
id_bank: this.state.bankToSend.id_bank,
id_wallet_network: this.state.wallet.id_wallet_network,
id_user: this.state.user.id
});
}
this.setState({
isDataSubmit: true
});
}
renderLoader = () => {
return (
<ProgressDialog
visible={this.props.loading || this.props.loadingGetBank}
title={I18n.t('LOADING')}
message={I18n.t('LOADING_INFO')}
/>
)
}
render() {
console.log(this.state);
return (
<>
{(this.props.loading || this.props.loadingGetBank) && this.renderLoader()}
{this.state.isDataSubmit && this.renderReattachAccountResponse()}
{!this.state.hasLoadBank && this.renderIlinkBankList()}
<ScrollView style={styles.container}>
<Text style={styles.subbigtitle}>{I18n.t('FILL_INFORMATION')}</Text>
<Animatable.View ref={(comp) => {
this.listBankAnim = comp
}}
style={{
width: responsiveWidth(90),
height: 60,
marginTop: 20,
alignSelf: 'center',
borderRadius: 10,
paddingLeft: 20,
paddingRight: 20,
backgroundColor: 'white'
}}>
<Dropdown
label={I18n.t('BANK_LIST')}
data={this.state.ilinkBanks}
useNativeDriver={true}
value={this.state.bankSelect !== null ? this.state.bankSelect : ''}
onChangeText={(value, index, data) => {
console.log(value);
this.setState({
bankSelect: value.bank_name + " - " + value.bank_address,
bankToSend: value
});
}}
valueExtractor={(value) => {
return value
}}
labelExtractor={(value) => {
return value.bank_name + " - " + value.bank_address
}}
/>
</Animatable.View>
<Animatable.View ref={(comp) => {
this.ibanAnim = comp
}}>
<Fumi iconClass={FontAwesomeIcon} iconName={'id-card'}
label={I18n.t('CODE_IBAN')}
iconColor={'#f95a25'}
iconSize={20}
value={this.state.iban}
onChangeText={(iban) => {
this.setState({iban})
}}
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 => ({
loadingGetBank: state.getIlinkBankReducer.loading,
resultGetBank: state.getIlinkBankReducer.result,
errorGetBank: state.getIlinkBankReducer.error,
loading: state.reattachAccountReducer.loading,
result: state.reattachAccountReducer.result,
error: state.reattachAccountReducer.error,
});
const mapDispatchToProps = dispatch => bindActionCreators({
getIlinkBankAction,
getIlinkBankReset,
reattachAccountAction,
reattachAccountReset,
askNanoCreditAction,
getNanoCreditDemandDurationAction,
}, dispatch);
export default connect(maptStateToProps, mapDispatchToProps)(ReattachAccountUser);
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,
}
});

View File

@ -225,10 +225,10 @@ export const transactionHistoryIlinkLabel = () => {
}
export const nanoCreditHistoryLabel = () => {
return [
{
icon: 'arrow-expand',
label: 'HISTORY_TYPE'
},
/* {
icon: 'arrow-expand',
label: 'HISTORY_TYPE'
},*/
{
icon: 'inbox-arrow-up',
label: 'ETAT'
@ -405,7 +405,7 @@ export const optionDepotUserScreen = {
subScreenOption: optionWalletToBank
},
]
}
};
export const optionIdentificationScreen = {
type: 'IDENTIFICATION',
@ -423,7 +423,7 @@ export const optionIdentificationScreen = {
title: 'VALIDATE_IDENTIFICATION_DESCRIPTION',
},
]
}
};
export const optionIdentificationUserScreen = {
type: 'IDENTIFICATION',
@ -441,7 +441,25 @@ export const optionIdentificationUserScreen = {
title: 'MODIFY_IDENTIFICATION',
},
]
}
};
export const optionLinkAccountUserScreen = {
type: 'LINK_CARD',
title: 'LINK_CARD_REATTACH',
subTitle: 'CHOOSE_OPTION',
options: [
{
screen: route.linkCard,
icon: 'link',
title: 'LINK_CARD',
},
{
screen: route.reattachAccountUser,
icon: 'card',
title: 'REATTACH_CARD',
},
]
};
export const optionNanoCreditScreen = {
type: 'NANO_CREDIT',

View File

@ -36,6 +36,7 @@
"MY_ACCOUNT": "My account",
"WALLET": "Wallet",
"NO_BANK_AVAILABLE": "No bank available",
"BANK_LIST": "Bank list",
"NO_OPERATOR_AVAILABLE": "No operator available",
"ENTER_VALID_AMOUNT": "Enter a valid amount",
"ENTER_AMOUNT_SUPERIOR_ZEROR": "Enter amount superior to zero",
@ -86,6 +87,8 @@
"DESTINATAIRE": "Recipient",
"WITHDRAWAL": "Withdrawal",
"LINK_CARD": "Link my card",
"LINK_CARD_REATTACH": "Link | Reattach",
"REATTACH_CARD": "Reattach my account",
"HISTORY_SAVINGS": "Savings history",
"HISTORY_CREDIT": "Credit history",
"TRANSFER_IN_ACCOUNT": "Transfer in account",

View File

@ -39,6 +39,7 @@
"DESTINATAIRE": "Destinataire",
"ERROR_LABEL": "Erreur",
"NO_BANK_AVAILABLE": "Aucune banque disponible",
"BANK_LIST": "Liste des banques",
"NO_OPERATOR_AVAILABLE": "Aucun opérateur disponible",
"DEPOSIT_SUCCESS": "Dépôt effectué avec succès",
"SUCCESS": "Succès",
@ -92,6 +93,8 @@
"WALLET_TO_WALLET_SUCCESS_TRANSFER": "Transfert de wallet à wallet effectué avec succès",
"WITHDRAWAL": "Retrait",
"LINK_CARD": "Lier ma carte",
"LINK_CARD_REATTACH": "Lier | Rattacher",
"REATTACH_CARD": "Rattacher mon compte",
"HISTORY_SAVINGS": "Historique des épargnes",
"HISTORY_CREDIT": "Historique des crédits",
"TRANSFER_IN_ACCOUNT": "Transfert dans le compte",
@ -180,7 +183,7 @@
"SAVE_MONEY": "Epargner de l'argent",
"SAVE_MONEY_TYPE": "Type d'épargne",
"REFUND_DONE": "Remboursement effectué",
"CAUTION_CREDIT": "Cautionner une demande de crédit",
"CAUTION_CREDIT": "Cautionner une demande",
"CAUTIONNEMENT_DONE": "Cautionnement effectué",
"ID_DEMAND": "Identifiant de la demande",
"ID_SAVINGS": "Identifiant de l'épargne",

View File

@ -74,6 +74,8 @@ export const getBankUrl = testBaseUrl + '/walletService/wallets/users/operators/
export const getHistoryNanoPendingCreditUrl = testBaseUrl + '/walletService/groups/nanoCredit/demands_in_progress';
export const getHistoryEpargnePendingUrl = testBaseUrl + '/walletService/groups/nanoCredit/savings/demands_in_progress';
export const getOperatorListUrl = testBaseUrl + '/walletService/wallets/users/operators';
export const getIlinkBankListUrl = testBaseUrl + '/walletService/wallets/users/banks_for_link';
export const linkBankAccountUrl = testBaseUrl + '/walletService/wallets/users/link_bank_account';
export const payBillUrl = testBaseUrl + '/walletService/transactions/ilink';
export const authKeyUrl = testBaseUrl + '/oauth/token';

View File

@ -1,6 +1,8 @@
import {
commissionAmount,
getIlinkBankListUrl,
getOperatorListUrl,
linkBankAccountUrl,
linkCardUrl,
payBillUrl,
walletActionUrl,
@ -8,6 +10,10 @@ import {
walletUserSimpleActionUrl
} from "./IlinkConstants";
import {
fetchGetBankIlinkError,
fetchGetBankIlinkPending,
fetchGetBankIlinkReset,
fetchGetBankIlinkSuccess,
fetchGetListOperatorError,
fetchGetListOperatorPending,
fetchGetListOperatorReset,
@ -20,6 +26,10 @@ import {
fetchPayBillPending,
fetchPayBillReset,
fetchPayBillSuccess,
fetchReattachAccountError,
fetchReattachAccountPending,
fetchReattachAccountReset,
fetchReattachAccountSuccess,
fetchWalleGetCommissionError,
fetchWalletGetCommissionPending,
fetchWalletGetCommissionSuccess,
@ -188,12 +198,12 @@ export const linkCardAction = (data, userID) => {
dispatch(fetchLinkCardError(error.message))
});
}
}
};
export const linkCardReset = () => {
return dispatch => {
dispatch(fetchLinkCardReset());
}
}
};
export const getOperatorListAction = (typeOperator, idNetworkWallet) => {
@ -262,9 +272,83 @@ export const payBillAction = (data) => {
dispatch(fetchPayBillError(error.message))
});
}
}
};
export const payBillReset = () => {
return dispatch => {
dispatch(fetchPayBillReset());
}
}
};
export const getIlinkBankAction = (idWalletNetwork) => {
const auth = store.getState().authKeyReducer;
const authKey = auth !== null ? `${auth.authKey.token_type} ${auth.authKey.access_token}` : '';
return dispatch => {
dispatch(fetchGetBankIlinkPending());
axios({
url: `${getIlinkBankListUrl}/${idWalletNetwork}`,
method: 'GET',
headers: {
'Authorization': authKey,
'X-Localization': I18n.currentLocale()
}
})
.then(response => {
console.log(response);
dispatch(fetchGetBankIlinkSuccess(response));
})
.catch(error => {
if (error.response)
dispatch(fetchGetBankIlinkError(error.response));
else if (error.request)
dispatch(fetchGetBankIlinkError(error.request))
else
dispatch(fetchGetBankIlinkError(error.message))
});
}
};
export const getIlinkBankReset = () => {
return dispatch => {
dispatch(fetchGetBankIlinkReset());
}
};
export const reattachAccountAction = (data) => {
const auth = store.getState().authKeyReducer;
const authKey = auth !== null ? `${auth.authKey.token_type} ${auth.authKey.access_token}` : '';
return dispatch => {
dispatch(fetchReattachAccountPending());
axios({
url: `${linkBankAccountUrl}`,
data,
method: 'POST',
headers: {
'Authorization': authKey,
'X-Localization': I18n.currentLocale()
}
})
.then(response => {
console.log(response);
dispatch(fetchReattachAccountSuccess(response));
})
.catch(error => {
if (error.response)
dispatch(fetchReattachAccountError(error.response));
else if (error.request)
dispatch(fetchReattachAccountError(error.request))
else
dispatch(fetchReattachAccountError(error.message))
});
}
};
export const reattachAccountReset = () => {
return dispatch => {
dispatch(fetchReattachAccountReset());
}
};