try to add paiement facture sub screen

This commit is contained in:
Brice Zele 2020-06-17 15:09:27 +01:00
parent 1bec6cc74c
commit 70de834ec0
20 changed files with 662 additions and 244 deletions

7
App.js
View File

@ -52,6 +52,7 @@ import WalletDetailUser from './screens/wallet/WalletDetailUser';
import WalletOptionSelect from './screens/wallet/WalletOptionSelect';
import ValidateIdentification from './screens/identification/validateIdentification';
import CreateIdentificationUser from './screens/identification/CreateIdentificationUser';
import PaiementOptionSelect from './screens/wallet/PaiementOptionSelect';
const instructions = Platform.select({
ios: 'Press Cmd+R to reload,\n' + 'Cmd+D or shake for dev menu',
@ -91,7 +92,8 @@ const AppStack = createDrawerNavigator({
configuration: Configurations,
about: About,
walletDetailUser: WalletDetailUser,
walletOptionSelect: WalletOptionSelect
walletOptionSelect: WalletOptionSelect,
paiementOptionSelect: PaiementOptionSelect
})
}, { contentComponent: OptionsMenu, headerMode: 'none', contentOptions: { activeTintColor: theme.accent } })
@ -144,7 +146,8 @@ const AppAgentStack = createDrawerNavigator({
walletDetail: WalletDetail,
walletDepot: WalletDepot,
walletRetrait: WalletRetrait,
walletOptionSelect: WalletOptionSelect
walletOptionSelect: WalletOptionSelect,
paiementOptionSelect: PaiementOptionSelect
})
}, {
contentComponent: OptionsMenu,

File diff suppressed because one or more lines are too long

View File

@ -35,5 +35,6 @@
"walletOptionSelect": "walletOptionSelect",
"createIdentification": "createIdentification",
"createIdentificationUser": "createIdentificationUser",
"validateIdentification": "validateIdentification"
"validateIdentification": "validateIdentification",
"paiementOptionSelect": "paiementOptionSelect"
}

View File

@ -294,6 +294,7 @@
"FREE": "Available",
"SAVED": "Registered",
"ACCOUNT_INFO": "My Account Information",
"ALREADY_IDENTIFIED": "You are already identified",
"IDENTIFICATION": " Identification",
"CREATION_IDENTIFICATION": "Creation",
"CREATION_IDENTIFICATION_DESCRIPTION": "Identify a client",

View File

@ -297,6 +297,7 @@
"FREE": "disponibles",
"SAVED": "enregistrés",
"ACCOUNT_INFO": " Information sur mon compte",
"ALREADY_IDENTIFIED": "Vous êtes déjà identifié",
"IDENTIFICATION": " Identification",
"CREATION_IDENTIFICATION": "Création",
"CREATION_IDENTIFICATION_CLIENT": "M'identifier",

View File

@ -1,4 +1,4 @@
import { CREATE_IDENTIFICATION_PENDING, CREATE_IDENTIFICATION_SUCCESS, CREATE_IDENTIFICATION_ERROR, CREATE_IDENTIFICATION_RESET, GET_NUMBER_DETAIL_PENDING, GET_NUMBER_DETAIL_SUCCESS, GET_NUMBER_DETAIL_ERROR, GET_NUMBER_DETAIL_RESET } from "../types/IdentificationType";
import { CREATE_IDENTIFICATION_PENDING, CREATE_IDENTIFICATION_SUCCESS, CREATE_IDENTIFICATION_ERROR, CREATE_IDENTIFICATION_RESET, GET_NUMBER_DETAIL_PENDING, GET_NUMBER_DETAIL_SUCCESS, GET_NUMBER_DETAIL_ERROR, GET_NUMBER_DETAIL_RESET, GET_USER_IDENTIFICATION_PENDING, GET_USER_IDENTIFICATION_SUCCESS, GET_USER_IDENTIFICATION_ERROR, GET_USER_IDENTIFICATION_RESET } from "../types/IdentificationType";
export const fetchCreateIdentificationPending = () => ({
type: CREATE_IDENTIFICATION_PENDING
@ -35,3 +35,21 @@ export const fetchGetNumberInformationError = (error) => ({
export const fetchGetNumberInformationReset = () => ({
type: GET_NUMBER_DETAIL_RESET
});
export const fetchUserIdentificationPending = () => ({
type: GET_USER_IDENTIFICATION_PENDING
});
export const fetchUserIdentificationSuccess = (res) => ({
type: GET_USER_IDENTIFICATION_SUCCESS,
result: res,
});
export const fetchUserIdentificationError = (error) => ({
type: GET_USER_IDENTIFICATION_ERROR,
result: error
});
export const fetchUserIdentificationReset = () => ({
type: GET_USER_IDENTIFICATION_RESET
});

View File

@ -0,0 +1,33 @@
import { GET_USER_IDENTIFICATION_PENDING, GET_USER_IDENTIFICATION_SUCCESS, GET_USER_IDENTIFICATION_ERROR, GET_USER_IDENTIFICATION_RESET } from "../types/IdentificationType";
const initialState = {
loading: false,
result: null,
error: null
};
export default (state = initialState, action) => {
switch (action.type) {
case GET_USER_IDENTIFICATION_PENDING: return {
...state,
loading: true
}
case GET_USER_IDENTIFICATION_SUCCESS: return {
...state,
loading: false,
result: action.result.data,
error: null
}
case GET_USER_IDENTIFICATION_ERROR: return {
...state,
loading: false,
result: null,
error: action.result
}
case GET_USER_IDENTIFICATION_RESET: return initialState;
default: {
return state;
}
}
};

View File

@ -12,6 +12,7 @@ import CreateIdentificationReducer from "./IdentificationReducer";
import GetNumberInformation from "./GetNumberInformation";
import { persistCombineReducers } from "redux-persist";
import { AsyncStorage } from "react-native";
import GetUserIdentificationReducer from "./GetUserIdentificationReducer";
const persistConfig = {
key: 'root',
@ -31,7 +32,8 @@ const rootReducer = persistCombineReducers(persistConfig, {
creditCancelDemandReducer: creditCancelDemandReducer,
walletGetCommission: WalletGetCommissionReducer,
createIdentificationReducer: CreateIdentificationReducer,
getNumberInformationReducer: GetNumberInformation
getNumberInformationReducer: GetNumberInformation,
getUserIdentificationReducer: GetUserIdentificationReducer
});
export default rootReducer;

View File

@ -7,3 +7,8 @@ export const GET_NUMBER_DETAIL_PENDING = 'GET_NUMBER_DETAIL_PENDING';
export const GET_NUMBER_DETAIL_SUCCESS = 'GET_NUMBER_DETAIL_SUCCESS';
export const GET_NUMBER_DETAIL_ERROR = 'GET_NUMBER_DETAIL_ERROR';
export const GET_NUMBER_DETAIL_RESET = 'GET_NUMBER_DETAIL_RESET';
export const GET_USER_IDENTIFICATION_PENDING = 'GET_USER_IDENTIFICATION_PENDING';
export const GET_USER_IDENTIFICATION_SUCCESS = 'GET_USER_IDENTIFICATION_SUCCESS';
export const GET_USER_IDENTIFICATION_ERROR = 'GET_USER_IDENTIFICATION_ERROR';
export const GET_USER_IDENTIFICATION_RESET = 'GET_USER_IDENTIFICATION_RESET';

View File

@ -35,5 +35,6 @@
"walletOptionSelect": "walletOptionSelect",
"createIdentification": "createIdentification",
"createIdentificationUser": "createIdentificationUser",
"validateIdentification": "validateIdentification"
"validateIdentification": "validateIdentification",
"paiementOptionSelect": "paiementOptionSelect"
}

View File

@ -1390,7 +1390,7 @@ class Home extends BaseScreen {
translucent={true}
/>
{/* Start here to comment */}
{
{/* {
(this.state.loadingDialog || this.props.loading) ?
<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' }}
@ -1426,7 +1426,7 @@ class Home extends BaseScreen {
this.setState({ showProgress: false })
Alert.alert(I18n.t("PROBLEM_OCCUR"), I18n.t("PROBLEM_OCCUR_DIRECTION"), [{ text: "Ok", onPress: () => { } }])
}}
/>
/> */}
{this.makeCardSearch()}
{this.makeSlidingUp()}
{this.makeDialogLoader()}

View File

@ -253,7 +253,7 @@ export default class OptionsMenu extends Component {
_renderItem = (item) => {
if (item === "creditrequest" || item === 'historyItemDetails' || item === 'filter' || item === 'networks' || item === 'walletDetail' || item === 'walletDetailUser'
|| item === 'walletDepot' || item === 'walletRetrait' || item === 'createIdentification' || item === 'walletOptionSelect' || item === 'validateIdentification'
|| item === 'createIdentificationUser') {
|| item === 'createIdentificationUser' || item === 'paiementOptionSelect') {
return null
} else {
const color = this.state.currentId === item.id ? theme.accent : "grey"

View File

@ -0,0 +1,207 @@
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';
import LottieView from 'lottie-react-native';
import { isIlinkWorldWallet, optionDepotScreen } from '../../utils/UtilsFunction';
import chunk from 'lodash/chunk';
import { ScrollView } from 'react-native-gesture-handler';
export default class PaiementOptionSelect extends Component {
constructor(props) {
super(props);
IlinkEmitter.on("langueChange", this.updateLangue.bind(this));
/* this.state = {
options: this.props.navigation.state.params.optionSelect
} */
}
updateLangue() {
this.props.navigation.setParams({ name: I18n.t('WALLET') })
this.forceUpdate();
}
static navigationOptions = ({ navigation }) => ({
header: null,
headerMode: 'none',
headerTitle: null,
activeColor: '#f0edf6',
inactiveColor: '#3e2465',
barStyle: { backgroundColor: '#694fad' },
drawerLabel: I18n.t('CREDIT_MANAGE'),
drawerIcon: ({ tintColor }) => (
<Icon
name={'credit-card'}
size={24}
/>)
});
renderItem = (item) => {
return (
<TouchableOpacity
key={item.id}
style={[styles.paymentItem, { borderBottomColor: Color.borderColor }]}
onPress={() => {
}}>
<View style={{ flexDirection: 'row', alignItems: 'center' }}>
<View style={styles.iconContent}>
<Image style={{ width: 48, height: 48 }} source={{ uri: item.icon }} />
</View>
<View>
<Text style={Typography.body1}>{item.title}</Text>
<Text style={Typography.footnote}>{item.title}</Text>
</View>
</View>
</TouchableOpacity>
)
}
renderList = () => {
const { optionSelect } = this.props;
return (
<ScrollView style={{ flex: 1, padding: 20 }}>
{
options.map((item) => (
this.renderItem(item)
))
}
</ScrollView>
);
}
render() {
console.log("PAIEMENT FACTURE PROPS", this.props);
console.log("PAIEMENT FACTURE GET PARAMS", this.props.navigation.getParam('optionSelect'));
return (
<Provider>
<View style={{ flex: 1 }}>
<StatusBar
backgroundColor={Color.primaryDarkColor}
barStyle="light-content"
translucent={false}
/>
<Appbar.Header dark={true} style={{ backgroundColor: Color.primaryColor }}>
<Appbar.BackAction
onPress={() => { this.props.navigation.pop() }}
/>
<Appbar.Content
title="Paiement facture"
subtitle="Veuillez sélectionner une option"
/>
</Appbar.Header>
<View style={styles.container}>
{/* {
this.renderList()
} */}
</View>
</View>
</Provider>
);
}
}
const styles = StyleSheet.create({
container: {
flex: 1,
backgroundColor: Color.containerBackgroundColor,
paddingHorizontal: 20,
},
paymentItem: {
flexDirection: "row",
alignItems: "center",
justifyContent: "space-between",
borderBottomWidth: 1,
paddingVertical: 5,
width: "100%",
marginBottom: 15
},
iconContent: {
width: 60,
marginRight: 10,
alignItems: "center"
},
item: {
paddingVertical: 15,
borderBottomWidth: 1,
flexDirection: "row",
justifyContent: "space-between",
alignItems: "center"
},
lottie: {
width: 540,
height: 240
},
checkDefault: {
flexDirection: "row",
justifyContent: "space-between",
alignItems: "center",
borderBottomWidth: 1,
paddingVertical: 10,
marginTop: 5
},
transactionContainer: {
flexDirection: 'row',
paddingTop: 10,
},
containerTouch: {
flex: 1,
flexDirection: 'row',
alignItems: 'center',
shadowColor: Color.borderColor,
borderColor: Color.borderColor,
borderWidth: 0.5,
shadowOffset: { width: 1.5, height: 1.5 },
shadowOpacity: 1.0,
elevation: 5,
borderRadius: 10,
backgroundColor: Color.cardBackgroundColor
},
contain: {
flexDirection: 'row',
justifyContent: 'space-between',
},
imageBanner: {
marginTop: 15,
marginLeft: 5,
width: Utils.scaleWithPixel(30),
height: Utils.scaleWithPixel(30)
},
content: {
height: Utils.scaleWithPixel(60),
paddingHorizontal: 10,
justifyContent: 'space-between',
alignItems: 'flex-start',
flex: 1,
},
contentTitle: {
paddingTop: 12,
}
});

View File

@ -16,6 +16,7 @@ import { responsiveHeight, responsiveWidth, } from 'react-native-responsive-dime
import { getWalletDetailActivated, resetWalletListDetailReducer } from '../../webservice/WalletApi';
import { depositActionReset } from '../../webservice/DepositApi';
import { getWalletTransactionHistory, getWalletTransactionHistoryReset } from '../../webservice/WalletTransactionHistoryApi';
import { getUserIdentificationAction, getUserIdentificationResetAction } from '../../webservice/IdentificationApi';
import { transferCommissionAction } from '../../webservice/WalletTransferCommission';
import { resetCommissionReducer } from '../../webservice/WalletTransferCommission';
import Dialog, { DialogContent, DialogTitle, DialogFooter, DialogButton } from 'react-native-popup-dialog';
@ -32,8 +33,9 @@ import 'moment/locale/en-nz'
import 'moment/locale/en-gb'
import { connect } from 'react-redux';
import { bindActionCreators } from 'redux';
import { thousandsSeparators, isEmptyObject, transactionHistoryUser, optionDepotUserScreen, optionRetraitUserScreen, transactionHistoryLabel, optionPaiementFacture } from '../../utils/UtilsFunction';
import { thousandsSeparators, isEmptyObject, transactionHistoryUser, optionDepotUserScreen, optionRetraitUserScreen, transactionHistoryLabel, optionPaiementFacture, displayToast } from '../../utils/UtilsFunction';
import DeviceInfo from 'react-native-device-info';
import { readUser } from '../../webservice/AuthApi';
const thousands = require('thousands');
let route = require('./../../route.json');
@ -52,7 +54,11 @@ class WalletDetailUser extends Component {
triggerTransferCommission: false,
loading: false,
isTriggerRefresh: false,
scrollHeaderY: 0
scrollHeaderY: 0,
user: null,
isIdentified: false,
isIdentifiedValidated: false,
};
slugify.extend({ '+': 'plus' });
@ -74,6 +80,16 @@ class WalletDetailUser extends Component {
this.props.getWalletDetailActivated(this.props.navigation.state.params.userId, null);
this.props.getWalletTransactionHistory(this.props.navigation.state.params.userId);
this.props.getUserIdentificationResetAction();
readUser().then((user) => {
if (user) {
if (user !== undefined) {
this.setState({ user });
this.props.getUserIdentificationAction(user.id);
}
}
});
}
static navigatorStyle = {
@ -104,8 +120,8 @@ class WalletDetailUser extends Component {
};
componentDidMount() {
const { result, resultUserIdentification, errorUserIdentification } = this.props;
const { result } = this.props;
if (result !== null) {
if (typeof result.response !== 'undefined') {
const wallet = result.response[0];
@ -116,6 +132,16 @@ class WalletDetailUser extends Component {
}
}
if (resultUserIdentification !== null) {
console.log("RESULT NUMBER DETAIL", resultUserIdentification);
if (typeof resultUserIdentification.response !== 'undefined') {
this.setState({
isIdentified: resultUserIdentification.response.isIdentified,
isIdentifiedValidated: resultUserIdentification.response.isIdentifiedValidated,
})
}
}
}
shouldComponentUpdate(nextProps, nextState) {
@ -243,7 +269,6 @@ class WalletDetailUser extends Component {
<>
<ProgressBarAndroid />
<Text>{I18n.t('LOADING_DOTS')}</Text>
</>
) :
<>
@ -534,7 +559,10 @@ class WalletDetailUser extends Component {
<TouchableOpacity style={styles.contain}
onPress={() => {
this.props.navigation.push(route.createIdentificationUser)
if (this.state.isIdentified)
this.props.navigation.push(route.createIdentificationUser)
else
displayToast(I18n.t('ALREADY_IDENTIFIED'))
}}
activeOpacity={0.9}>
@ -547,7 +575,7 @@ class WalletDetailUser extends Component {
<View style={styles.contentTitle}>
<Text style={[Typography.headline, Typography.semibold]}>
{I18n.t('CREATION_IDENTIFICATION_DESCRIPTION')}
{I18n.t('CREATION_IDENTIFICATION_CLIENT')}
</Text>
</View>
@ -691,7 +719,7 @@ class WalletDetailUser extends Component {
translucent={true}
/>
{
((this.props.loading || this.props.loadingTransferCommission) ?
((this.props.loading || this.props.loadingUserIdentification) ?
this.renderLoader() :
(
this.props.result !== null ?
@ -725,9 +753,9 @@ const mapStateToProps = state => ({
resultTransaction: state.walletHistoryReducer.resultTransaction,
errorTransaction: state.walletHistoryReducer.errorTransaction,
loadingTransferCommission: state.walletTransferCommissionReducer.loadingTransferCommission,
resultTransferCommission: state.walletTransferCommissionReducer.resultTransferCommission,
errorTransferCommission: state.walletTransferCommissionReducer.errorTransferCommission,
loadingUserIdentification: state.getUserIdentificationReducer.loading,
resultUserIdentification: state.getUserIdentificationReducer.result,
errorUserIdentification: state.getUserIdentificationReducer.error,
});
const mapDispatchToProps = dispatch => bindActionCreators({
@ -737,7 +765,9 @@ const mapDispatchToProps = dispatch => bindActionCreators({
resetWalletListDetailReducer,
resetCommissionReducer,
getWalletTransactionHistoryReset,
depositActionReset
depositActionReset,
getUserIdentificationAction,
getUserIdentificationResetAction
}, dispatch);
export default connect(mapStateToProps, mapDispatchToProps)(WalletDetailUser);

View File

@ -13,7 +13,7 @@ import { Provider, Appbar } from 'react-native-paper';
import { readUser } from '../../webservice/AuthApi';
import { FontWeight, Typography } from '../../config/typography';
import LottieView from 'lottie-react-native';
import { isIlinkWorldWallet, optionDepotScreen } from '../../utils/UtilsFunction';
import { isIlinkWorldWallet, optionDepotScreen, optionPaiementFactureSubScreen } from '../../utils/UtilsFunction';
import chunk from 'lodash/chunk';
export default class WalletOptionSelect extends Component {
@ -54,7 +54,13 @@ export default class WalletOptionSelect extends Component {
<TouchableOpacity style={styles.contain}
onPress={() => {
this.props.navigation.push(options.screen)
this.props.navigation.setParams({
optionSelect: optionPaiementFactureSubScreen
});
this.props.navigation.push(options.screen, {
optionSelect: optionPaiementFactureSubScreen
});
}}
activeOpacity={0.9}>

View File

@ -1,5 +1,7 @@
import I18n from 'react-native-i18n';
import isEqual from 'lodash/isEqual';
import Toast from 'react-native-root-toast';
import { Color } from '../config/Color';
let slugify = require('slugify');
let route = require('./../route.json');
@ -20,6 +22,44 @@ export const isNormalInteger = (str) => {
return true;
}
export const displayToast = (message) => {
Toast.show(message, {
duration: Toast.durations.SHORT,
position: Toast.positions.BOTTOM,
backgroundColor: Color.primaryColor,
shadow: true,
animation: true,
hideOnPress: true,
delay: 0,
onShow: () => {
// calls on toast\`s appear animation start
},
onShown: () => {
// calls on toast\`s appear animation end.
},
onHide: () => {
// calls on toast\`s hide animation start.
},
onHidden: () => {
// calls on toast\`s hide animation end.
}
});
}
export const isIlinkWorldWallet = (walletName) => {
return isEqual(slugify(walletName).toLowerCase(), 'ilink-world');
}
export const isEmptyObject = (obj) => {
for (let prop in obj) {
if (obj.hasOwnProperty(prop)) {
return false;
}
}
return JSON.stringify(obj) === JSON.stringify({});
}
export const identityPieces = () => {
return [
{
@ -89,20 +129,6 @@ export const transactionHistoryUser = () => {
];
}
export const isEmptyObject = (obj) => {
for (let prop in obj) {
if (obj.hasOwnProperty(prop)) {
return false;
}
}
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'),
@ -213,24 +239,65 @@ export const optionPaiementFacture = {
subTitle: I18n.t('CHOOSE_OPTION'),
options: [
{
screen: route.walletDepot,
icon: 'water',
title: 'Paiement eau'
title: 'Paiement eau/électricité',
screen: route.paiementOptionSelect,
subScreenOption: optionPaiementFactureSubScreen
},
{
screen: route.walletDepot,
icon: 'school',
title: 'Paiement école'
title: 'Paiement école',
screen: route.paiementOptionSelect,
subScreenOption: optionPaiementFactureSubScreen
},
{
screen: route.walletDepot,
icon: 'file-document',
title: 'Paiement électricité'
icon: 'phone-classic',
title: 'Paiement crédit téléphonique',
screen: route.paiementOptionSelect,
subScreenOption: optionPaiementFactureSubScreen
},
{
screen: route.walletDepot,
icon: 'cellphone',
title: 'Paiement crédit téléphonique'
icon: 'television-classic',
title: 'Paiement abonnement TV',
screen: route.paiementOptionSelect,
subScreenOption: optionPaiementFactureSubScreen
},
]
}
export const optionPaiementFactureSubScreen = {
title: I18n.t('PAIEMENT_FACTURE'),
subTitle: I18n.t('CHOOSE_OPTION'),
options: [
{
screen: '',
icon: 'http://test.ilink-app.com:8080/mobilebackend/datas/img/network/ilink-world-logo.png',
title: 'Opérateur 1',
},
{
screen: '',
icon: 'http://test.ilink-app.com:8080/mobilebackend/datas/img/network/ilink-world-logo.png',
title: 'Opérateur 2',
},
{
screen: '',
icon: 'http://test.ilink-app.com:8080/mobilebackend/datas/img/network/ilink-world-logo.png',
title: 'Opérateur 3',
},
{
screen: '',
icon: 'http://test.ilink-app.com:8080/mobilebackend/datas/img/network/ilink-world-logo.png',
title: 'Opérateur 4',
},
{
screen: '',
icon: 'http://test.ilink-app.com:8080/mobilebackend/datas/img/network/ilink-world-logo.png',
title: 'Opérateur 5',
},
{
screen: '',
icon: 'http://test.ilink-app.com:8080/mobilebackend/datas/img/network/ilink-world-logo.png',
title: 'Opérateur 6',
},
]
}

View File

@ -294,6 +294,7 @@
"FREE": "Available",
"SAVED": "Registered",
"ACCOUNT_INFO": "My Account Information",
"ALREADY_IDENTIFIED": "You are already identified",
"IDENTIFICATION": " Identification",
"CREATION_IDENTIFICATION": "Creation",
"CREATION_IDENTIFICATION_DESCRIPTION": "Identify a client",

View File

@ -297,6 +297,7 @@
"FREE": "disponibles",
"SAVED": "enregistrés",
"ACCOUNT_INFO": " Information sur mon compte",
"ALREADY_IDENTIFIED": "Vous êtes déjà identifié",
"IDENTIFICATION": " Identification",
"CREATION_IDENTIFICATION": "Création",
"CREATION_IDENTIFICATION_CLIENT": "M'identifier",

View File

@ -1,9 +1,9 @@
import { createIdentificationUrl, getNumberInformationUrl } from "./IlinkConstants";
import { createIdentificationUrl, getNumberInformationUrl, getUserIdentifiedInformationUrl } from "./IlinkConstants";
import { store } from "../redux/store";
import axios from "axios";
import I18n from 'react-native-i18n'
import { fetchCreateIdentificationReset, fetchCreateIdentificationSuccess, fetchCreateIdentificationError, fetchCreateIdentificationPending, fetchGetNumberInformationPending, fetchGetNumberInformationSuccess, fetchGetNumberInformationError, fetchGetNumberInformationReset } from "../redux/actions/IdentificationAction";
import { fetchCreateIdentificationReset, fetchCreateIdentificationSuccess, fetchCreateIdentificationError, fetchCreateIdentificationPending, fetchGetNumberInformationPending, fetchGetNumberInformationSuccess, fetchGetNumberInformationError, fetchGetNumberInformationReset, fetchUserIdentificationPending, fetchUserIdentificationSuccess, fetchUserIdentificationError, fetchUserIdentificationReset } from "../redux/actions/IdentificationAction";
export const createIndentificationAction = (data) => {
@ -83,3 +83,41 @@ export const getNumberResetAction = () => {
dispatch(fetchGetNumberInformationReset());
}
}
export const getUserIdentificationAction = (userID) => {
const auth = store.getState().authKeyReducer;
const authKey = auth !== null ? `${auth.authKey.token_type} ${auth.authKey.access_token}` : '';
return dispatch => {
dispatch(fetchUserIdentificationPending());
axios({
url: `${getUserIdentifiedInformationUrl}/${userID}`,
method: 'GET',
headers: {
'Authorization': authKey,
'X-Localization': I18n.currentLocale()
},
})
.then(response => {
console.log(response);
dispatch(fetchUserIdentificationSuccess(response));
})
.catch(error => {
console.log(error);
if (error.response)
dispatch(fetchUserIdentificationError(error.response));
else if (error.request)
dispatch(fetchUserIdentificationError(error.request))
else
dispatch(fetchUserIdentificationError(error.message))
});
}
}
export const getUserIdentificationResetAction = () => {
return dispatch => {
dispatch(fetchUserIdentificationReset());
}
}

View File

@ -34,6 +34,7 @@ export const transactionUrl = testBaseUrl + '/walletService/transactions';
export const transferCommission = testBaseUrl + '/walletService/virement';
export const createIdentificationUrl = testBaseUrl + '/walletService/identifications';
export const getNumberInformationUrl = testBaseUrl + '/walletService/identifications/verify';
export const getUserIdentifiedInformationUrl = testBaseUrl + '/walletService/identifications';
export const authKeyUrl = testBaseUrl + '/oauth/token';
export const videoUrl = "https://www.youtube.com/watch?v=wwGPDPsSLWY";
export const MARKER_URL = baseUrl + "/interacted/LocationAction.php";