Mot de passe wallet utilisateur

This commit is contained in:
Brice Zele 2022-04-24 23:09:59 +01:00
parent f7679e4f14
commit 7287f327d1
13 changed files with 225 additions and 113 deletions

View File

@ -22,6 +22,7 @@ import {connect} from "react-redux";
import {bindActionCreators} from "redux";
import {getBankListAction, getBankListReset} from "../../webservice/BankApi";
import {getOperatorListAction, getOperatorListReset} from "../../webservice/WalletApi";
import {store} from "../../redux/store";
const route = require('../../route.json');
let slugify = require('slugify');
@ -33,7 +34,8 @@ class SouscrireAssuranceUser extends Component {
IlinkEmitter.on("langueChange", this.updateLangue.bind(this));
this.state = {
options: this.props.navigation.state.params.optionSelect
options: this.props.navigation.state.params.optionSelect,
wallet: store.getState().walletDetailReducer.result.response
}
console.log("OPERATEUR OPTION PROPS", this.props);
console.log("OPERATEUR OPTION STATE", this.state);

View File

@ -2165,7 +2165,7 @@ class WalletDetail extends Component {
network_agent_id: this.props.result.response.network_agent_id
});
}}>
{I18n.t('SUBMIT_LABEL')}
{I18n.t('SUBMIT_LABEL')}l
</Button>
</ScrollView>
:

View File

@ -1,6 +1,7 @@
import React, {Component} from 'react';
import {
ActivityIndicator,
Alert,
Animated,
Platform,
ProgressBarAndroid,
@ -21,7 +22,12 @@ import Tag from '../../components/Tag';
import {IlinkEmitter} from "../../utils/events";
import {Typography} from '../../config/typography';
import {responsiveWidth,} from 'react-native-responsive-dimensions';
import {getWalletDetailActivated, resetWalletListDetailReducer} from '../../webservice/WalletApi';
import {
getWalletDetailActivated,
passwordValidationAction,
passwordValidationReset,
resetWalletListDetailReducer
} from '../../webservice/WalletApi';
import {depositActionReset} from '../../webservice/DepositApi';
import {
getWalletTransactionHistoryReset,
@ -58,6 +64,10 @@ import {
} from '../../utils/UtilsFunction';
import {readUser} from '../../webservice/AuthApi';
import LottieView from "lottie-react-native";
import * as Animatable from "react-native-animatable";
import {Fumi} from "react-native-textinput-effects";
import FontAwesomeIcon from "react-native-vector-icons/FontAwesome";
import Button from "../../components/Button";
let moment = require('moment-timezone');
@ -85,7 +95,8 @@ class WalletDetailUser extends Component {
historyItemDetail: null,
isIdentified: false,
isIdentifiedValidated: false,
password: '',
isLogged: false
};
slugify.extend({'+': 'plus'});
@ -105,6 +116,7 @@ class WalletDetailUser extends Component {
this.props.getWalletTransactionHistoryReset();
this.props.depositActionReset();
this.props.resetWalletListDetailReducer();
this.props.passwordValidationReset();
this.props.getUserIdentificationResetAction();
console.warn("Wallet User Props", this.props);
@ -184,6 +196,44 @@ class WalletDetailUser extends Component {
}
componentWillReceiveProps(nextProps) {
if (nextProps.resultPasswordValidation !== null) {
if (nextProps.resultPasswordValidation.status === 200) {
this.setState({
isLogged: true
});
this.props.passwordValidationReset();
}
}
if (nextProps.errorPasswordValidation !== null) {
console.log(nextProps.errorPasswordValidation);
Alert.alert(
I18n.t("ERROR_LABEL"),
'' + nextProps.errorPasswordValidation,
[
{
text: I18n.t("OK"), onPress: () => {
this.props.passwordValidationReset();
}
}
],
{cancelable: false}
);
this.setState({
isLogged: false
});
}
/* if (nextProps.loading || nextProps.loadingTransferCommission)
this.setState({
loading: true
})
else
this.setState({
loading: false
})*/
}
shouldComponentUpdate(nextProps, nextState) {
if (this.state.triggerTransferCommission !== nextState.triggerTransferCommission) {
@ -1010,8 +1060,38 @@ class WalletDetailUser extends Component {
<Text style={Typography.body1}>{I18n.t('NO_WALLET_ACTIVED')}</Text>
</View>
:
this.props.result.response.password_validation === "MIN" && !this.state.isLogged ?
<ScrollView style={{flex: 1, padding: 20}}>
<Animatable.View ref={(comp) => {
this.codeAgentAnim = comp
}}>
<Fumi iconClass={FontAwesomeIcon}
label={I18n.t('PASSWORD')}
iconColor={'#f95a25'}
iconSize={20}
secureTextEntry
iconName="lock"
value={this.state.password}
onChangeText={(password) => {
this.setState({password});
}}
style={styles.input} />
</Animatable.View>
this.renderDetailWallet(this.props.result.response)
<Button
loading={this.props.loadingPasswordValidation}
onPress={() => {
this.props.passwordValidationAction({
password: this.state.password,
user_id: this.props.navigation.state.params.agentId,
network_agent_id: this.props.result.response.network_agent_id
});
}}>
{I18n.t('SUBMIT_LABEL')}
</Button>
</ScrollView>
:
this.renderDetailWallet(this.props.result.response)
: this.props.error !== null &&
this.props.error.data !== null &&
<View style={{flex: 1, justifyContent: 'center', alignItems: 'center'}}>
@ -1045,6 +1125,10 @@ const mapStateToProps = state => ({
loadingUserIdentification: state.getUserIdentificationReducer.loading,
resultUserIdentification: state.getUserIdentificationReducer.result,
errorUserIdentification: state.getUserIdentificationReducer.error,
loadingPasswordValidation: state.passwordValidationReducer.loading,
resultPasswordValidation: state.passwordValidationReducer.result,
errorPasswordValidation: state.passwordValidationReducer.error,
});
const mapDispatchToProps = dispatch => bindActionCreators({
@ -1056,7 +1140,9 @@ const mapDispatchToProps = dispatch => bindActionCreators({
getWalletTransactionHistoryReset,
depositActionReset,
getUserIdentificationAction,
getUserIdentificationResetAction
getUserIdentificationResetAction,
passwordValidationAction,
passwordValidationReset,
}, dispatch);
export default connect(mapStateToProps, mapDispatchToProps)(WalletDetailUser);

View File

@ -521,7 +521,8 @@ const ExecuterPrescriptionScreen = ({
const ExecuterPrescriptionSchema = Yup.object().shape({
numero_assure: Yup.string()
.required(I18n.t('THIS_FIELD_IS_REQUIRED')),
password: Yup.string(),
password: wallet.password_validation === "MAX" ? Yup.string()
.required(I18n.t('THIS_FIELD_IS_REQUIRED')) : Yup.string(),
practitioner_lastname: Yup.string()
.required(I18n.t('THIS_FIELD_IS_REQUIRED')),
practitioner_firstname: Yup.string()

View File

@ -531,7 +531,8 @@ const ModifierExecutionPrescriptionScreen = ({
const ExecuterPrescriptionSchema = Yup.object().shape({
numero_assure: Yup.string()
.required(I18n.t('THIS_FIELD_IS_REQUIRED')),
password: Yup.string(),
password: wallet.password_validation === "MAX" ? Yup.string()
.required(I18n.t('THIS_FIELD_IS_REQUIRED')) : Yup.string(),
practitioner_lastname: Yup.string()
.required(I18n.t('THIS_FIELD_IS_REQUIRED')),
practitioner_firstname: Yup.string()

View File

@ -598,7 +598,8 @@ const ModifierFeuilleSoinScreen = ({
const ModifierFeuilleSoinSchema = Yup.object().shape({
numero_assure: Yup.string()
.required(I18n.t('THIS_FIELD_IS_REQUIRED')),
password: Yup.string(),
password: wallet.password_validation === "MAX" ? Yup.string()
.required(I18n.t('THIS_FIELD_IS_REQUIRED')) : Yup.string(),
practitioner_lastname: Yup.string()
.required(I18n.t('THIS_FIELD_IS_REQUIRED')),
practitioner_firstname: Yup.string()

View File

@ -679,7 +679,8 @@ const SaisirFeuilleSoinScreen = ({
const SaisirFeuilleSoinSchema = Yup.object().shape({
numero_assure: Yup.string()
.required(I18n.t('THIS_FIELD_IS_REQUIRED')),
password: Yup.string(),
password: wallet.password_validation === "MAX" ? Yup.string()
.required(I18n.t('THIS_FIELD_IS_REQUIRED')) : Yup.string(),
practitioner_lastname: Yup.string()
.required(I18n.t('THIS_FIELD_IS_REQUIRED')),
practitioner_firstname: Yup.string()

View File

@ -31,6 +31,7 @@ import {createStructuredSelector} from "reselect";
import {selectActivatePaySubscription, selectSubscriptionList} from "../../../redux/insurance/insurance.selector";
import {Dropdown} from "react-native-material-dropdown";
import {store} from "../../../redux/store";
let moment = require('moment-timezone');
@ -190,6 +191,7 @@ const ActivateBuySubscriptionScreen = ({
let dropDownAlertRef: any = null;
let subscriptionRef = null;
let amountPerMonthRef = null;
const [wallet] = useState(store.getState().walletDetailReducer.result.response);
useEffect(() => {
readUser().then((user) => {
@ -278,8 +280,8 @@ const ActivateBuySubscriptionScreen = ({
}, [activatePaySubscription]);
const RegisterSchema = Yup.object().shape({
password: Yup.string()
.required(I18n.t('THIS_FIELD_IS_REQUIRED'))
password: wallet.password_validation === "MAX" ? Yup.string()
.required(I18n.t('THIS_FIELD_IS_REQUIRED')) : Yup.string()
});
return (
@ -363,18 +365,21 @@ const ActivateBuySubscriptionScreen = ({
/>
</Animatable.View>
<PasswordInput
style={{marginTop: 10}}
onChangeText={handleChange('password')}
placeholder={I18n.t('PASSWORD')}
secureTextEntry
icon={<FontAwesome name="lock" size={20}/>}
value={values.password}
onBlur={handleBlur('password')}
success={touched.password && !errors.password}
touched={touched.password}
error={errors.password}
/>
{
wallet.password_validation === "MAX" &&
<PasswordInput
style={{marginTop: 10}}
onChangeText={handleChange('password')}
placeholder={I18n.t('PASSWORD')}
secureTextEntry
icon={<FontAwesome name="lock" size={20}/>}
value={values.password}
onBlur={handleBlur('password')}
success={touched.password && !errors.password}
touched={touched.password}
error={errors.password}
/>
}
<Button
style={{marginTop: 20}}

View File

@ -36,7 +36,6 @@ import {responsiveWidth} from "react-native-responsive-dimensions";
import SwitchSelector from "react-native-switch-selector";
import MaterialCommunityIcons from "react-native-vector-icons/MaterialCommunityIcons";
import {
fetchActivePaySubscriptionReset,
fetchAddBeneficiaryToSubscription,
fetchAddBeneficiaryToSubscriptionReset,
fetchGetInsurancePrimeAmount,
@ -66,6 +65,7 @@ import {
import {Dropdown} from "react-native-material-dropdown";
import Icon from "react-native-vector-icons/FontAwesome5";
import {store} from "../../../redux/store";
let moment = require('moment-timezone');
@ -262,6 +262,7 @@ const AddBeneficiaryScreen = ({
const [affiliation, setAffliliation] = useState('CHILD');
const [subscription, setSubscription] = useState(null);
const [subscriptions, setSubscriptions] = useState([]);
const [wallet] = useState(store.getState().walletDetailReducer.result.response);
let [currentYearMinusAgeLimit, setCurrentYearMinusAgeLimit] = useState(new Date(((new Date()).getFullYear() - 5), 0, 1));
let subscriptionRef = null;
@ -439,8 +440,8 @@ const AddBeneficiaryScreen = ({
}, [uploadInsuranceImages]);
const RegisterSchema = Yup.object().shape({
password: Yup.string()
.required(I18n.t('THIS_FIELD_IS_REQUIRED'))
password: wallet.password_validation === "MAX" ? Yup.string()
.required(I18n.t('THIS_FIELD_IS_REQUIRED')) : Yup.string()
});
const AddBeneficiarySchema = Yup.object().shape({
@ -982,18 +983,21 @@ const AddBeneficiaryScreen = ({
/>
</Animatable.View>
<PasswordInput
style={{marginTop: 10}}
onChangeText={handleChange('password')}
placeholder={I18n.t('PASSWORD')}
secureTextEntry
icon={<FontAwesome name="lock" size={20}/>}
value={values.password}
onBlur={handleBlur('password')}
success={touched.password && !errors.password}
touched={touched.password}
error={errors.password}
/>
{
wallet.password_validation === "MAX" &&
<PasswordInput
style={{marginTop: 10}}
onChangeText={handleChange('password')}
placeholder={I18n.t('PASSWORD')}
secureTextEntry
icon={<FontAwesome name="lock" size={20}/>}
value={values.password}
onBlur={handleBlur('password')}
success={touched.password && !errors.password}
touched={touched.password}
error={errors.password}
/>
}
<View

View File

@ -53,6 +53,7 @@ import {
import {Dropdown} from "react-native-material-dropdown";
import Icon from "react-native-vector-icons/FontAwesome5";
import {store} from "../../../redux/store";
let moment = require('moment-timezone');
@ -209,6 +210,7 @@ const DeleteBeneficiaryScreen = ({
const [insurance, setInsurance] = useState(null);
const [password, setPassword] = useState(null);
const dispatch = useDispatch();
const [wallet] = useState(store.getState().walletDetailReducer.result.response);
const [modalViewBeneficiariesVisible, setModalViewBeneficiariesVisible] = useState(false);
const [subscription, setSubscription] = useState(null);
@ -307,8 +309,8 @@ const DeleteBeneficiaryScreen = ({
const RegisterSchema = Yup.object().shape({
password: Yup.string()
.required(I18n.t('THIS_FIELD_IS_REQUIRED'))
password: wallet.password_validation === "MAX" ? Yup.string()
.required(I18n.t('THIS_FIELD_IS_REQUIRED')) : Yup.string()
});
const renderModalViewBeneficiaries = () => {
@ -483,18 +485,21 @@ const DeleteBeneficiaryScreen = ({
/>
</Animatable.View>
<PasswordInput
style={{marginTop: 10}}
onChangeText={handleChange('password')}
placeholder={I18n.t('PASSWORD')}
secureTextEntry
icon={<FontAwesome name="lock" size={20}/>}
value={values.password}
onBlur={handleBlur('password')}
success={touched.password && !errors.password}
touched={touched.password}
error={errors.password}
/>
{
wallet.password_validation === "MAX" &&
<PasswordInput
style={{marginTop: 10}}
onChangeText={handleChange('password')}
placeholder={I18n.t('PASSWORD')}
secureTextEntry
icon={<FontAwesome name="lock" size={20}/>}
value={values.password}
onBlur={handleBlur('password')}
success={touched.password && !errors.password}
touched={touched.password}
error={errors.password}
/>
}
<Button
style={{marginTop: 20}}

View File

@ -465,8 +465,8 @@ const InsuranceSubscriptionScreen = ({
}, [uploadInsuranceImages]);
const RegisterSchema = Yup.object().shape({
password: Yup.string()
.required(I18n.t('THIS_FIELD_IS_REQUIRED'))
password: wallet.password_validation === "MAX" ? Yup.string()
.required(I18n.t('THIS_FIELD_IS_REQUIRED')) : Yup.string()
});
const AddBeneficiarySchema = Yup.object().shape({
@ -1269,18 +1269,21 @@ const InsuranceSubscriptionScreen = ({
</View>*/
}
<PasswordInput
style={{marginTop: 10}}
onChangeText={handleChange('password')}
placeholder={I18n.t('PASSWORD')}
secureTextEntry
icon={<FontAwesome name="lock" size={20}/>}
value={values.password}
onBlur={handleBlur('password')}
success={touched.password && !errors.password}
touched={touched.password}
error={errors.password}
/>
{
wallet.password_validation === "MAX" &&
<PasswordInput
style={{marginTop: 10}}
onChangeText={handleChange('password')}
placeholder={I18n.t('PASSWORD')}
secureTextEntry
icon={<FontAwesome name="lock" size={20}/>}
value={values.password}
onBlur={handleBlur('password')}
success={touched.password && !errors.password}
touched={touched.password}
error={errors.password}
/>
}
<View

View File

@ -12,25 +12,21 @@ import Button from "../../../components/Button";
import FontAwesome from "react-native-vector-icons/FontAwesome";
import {responsiveWidth} from "react-native-responsive-dimensions";
import {
fetchStopSubscription,
fetchStopSubscriptionReset,
fetchGetSubscriptionList,
fetchGetSubscriptionListReset,
fetchGetListInsuranceReset,
fetchGetListInsuranceWithBeneficiaries,
fetchRenewSubscription, fetchUploadInsuranceReset
fetchGetSubscriptionList,
fetchGetSubscriptionListReset,
fetchRenewSubscription,
fetchStopSubscriptionReset
} from "../../../redux/insurance/insurance.actions";
import DropdownAlert from "react-native-dropdownalert";
import {readUser} from "../../../webservice/AuthApi";
import * as Animatable from 'react-native-animatable';
import {createStructuredSelector} from "reselect";
import {
selectInsuranceList,
selectStopSubscription,
selectSubscriptionList
} from "../../../redux/insurance/insurance.selector";
import {selectInsuranceList, selectStopSubscription} from "../../../redux/insurance/insurance.selector";
import {Dropdown} from "react-native-material-dropdown";
import {store} from "../../../redux/store";
let moment = require('moment-timezone');
@ -186,6 +182,7 @@ const RenewAssuranceScreen = ({
const [password, setPassword] = useState(null);
const [subscriptions, setSubscriptions] = useState([]);
const [subscription, setSubscription] = useState(null);
const [wallet] = useState(store.getState().walletDetailReducer.result.response);
const dispatch = useDispatch();
let dropDownAlertRef: any = null;
@ -281,8 +278,8 @@ const RenewAssuranceScreen = ({
}, [stopSubscription]);
const RegisterSchema = Yup.object().shape({
password: Yup.string()
.required(I18n.t('THIS_FIELD_IS_REQUIRED'))
password: wallet.password_validation === "MAX" ? Yup.string()
.required(I18n.t('THIS_FIELD_IS_REQUIRED')) : Yup.string()
});
return (
@ -366,18 +363,21 @@ const RenewAssuranceScreen = ({
/>
</Animatable.View>
<PasswordInput
style={{marginTop: 10}}
onChangeText={handleChange('password')}
placeholder={I18n.t('PASSWORD')}
secureTextEntry
icon={<FontAwesome name="lock" size={20}/>}
value={values.password}
onBlur={handleBlur('password')}
success={touched.password && !errors.password}
touched={touched.password}
error={errors.password}
/>
{
wallet.password_validation === "MAX" &&
<PasswordInput
style={{marginTop: 10}}
onChangeText={handleChange('password')}
placeholder={I18n.t('PASSWORD')}
secureTextEntry
icon={<FontAwesome name="lock" size={20}/>}
value={values.password}
onBlur={handleBlur('password')}
success={touched.password && !errors.password}
touched={touched.password}
error={errors.password}
/>
}
<Button
style={{marginTop: 20}}

View File

@ -12,22 +12,21 @@ import Button from "../../../components/Button";
import FontAwesome from "react-native-vector-icons/FontAwesome";
import {responsiveWidth} from "react-native-responsive-dimensions";
import {
fetchStopSubscription,
fetchStopSubscriptionReset,
fetchGetListInsuranceReset,
fetchGetListInsuranceWithBeneficiaries,
fetchGetSubscriptionList,
fetchGetSubscriptionListReset, fetchGetListInsuranceReset, fetchGetListInsuranceWithBeneficiaries
fetchGetSubscriptionListReset,
fetchStopSubscription,
fetchStopSubscriptionReset
} from "../../../redux/insurance/insurance.actions";
import DropdownAlert from "react-native-dropdownalert";
import {readUser} from "../../../webservice/AuthApi";
import * as Animatable from 'react-native-animatable';
import {createStructuredSelector} from "reselect";
import {
selectInsuranceList,
selectStopSubscription,
selectSubscriptionList
} from "../../../redux/insurance/insurance.selector";
import {selectInsuranceList, selectStopSubscription} from "../../../redux/insurance/insurance.selector";
import {Dropdown} from "react-native-material-dropdown";
import {store} from "../../../redux/store";
let moment = require('moment-timezone');
@ -183,6 +182,7 @@ const StopSubscriptionScreen = ({
const [password, setPassword] = useState(null);
const [subscriptions, setSubscriptions] = useState([]);
const [subscription, setSubscription] = useState(null);
const [wallet] = useState(store.getState().walletDetailReducer.result.response);
const dispatch = useDispatch();
let dropDownAlertRef: any = null;
@ -278,8 +278,8 @@ const StopSubscriptionScreen = ({
}, [stopSubscription]);
const RegisterSchema = Yup.object().shape({
password: Yup.string()
.required(I18n.t('THIS_FIELD_IS_REQUIRED'))
password: wallet.password_validation === "MAX" ? Yup.string()
.required(I18n.t('THIS_FIELD_IS_REQUIRED')) : Yup.string()
});
return (
@ -363,18 +363,21 @@ const StopSubscriptionScreen = ({
/>
</Animatable.View>
<PasswordInput
style={{marginTop: 10}}
onChangeText={handleChange('password')}
placeholder={I18n.t('PASSWORD')}
secureTextEntry
icon={<FontAwesome name="lock" size={20}/>}
value={values.password}
onBlur={handleBlur('password')}
success={touched.password && !errors.password}
touched={touched.password}
error={errors.password}
/>
{
wallet.password_validation === "MAX" &&
<PasswordInput
style={{marginTop: 10}}
onChangeText={handleChange('password')}
placeholder={I18n.t('PASSWORD')}
secureTextEntry
icon={<FontAwesome name="lock" size={20}/>}
value={values.password}
onBlur={handleBlur('password')}
success={touched.password && !errors.password}
touched={touched.password}
error={errors.password}
/>
}
<Button
style={{marginTop: 20}}