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 {bindActionCreators} from "redux";
import {getBankListAction, getBankListReset} from "../../webservice/BankApi"; import {getBankListAction, getBankListReset} from "../../webservice/BankApi";
import {getOperatorListAction, getOperatorListReset} from "../../webservice/WalletApi"; import {getOperatorListAction, getOperatorListReset} from "../../webservice/WalletApi";
import {store} from "../../redux/store";
const route = require('../../route.json'); const route = require('../../route.json');
let slugify = require('slugify'); let slugify = require('slugify');
@ -33,7 +34,8 @@ class SouscrireAssuranceUser extends Component {
IlinkEmitter.on("langueChange", this.updateLangue.bind(this)); IlinkEmitter.on("langueChange", this.updateLangue.bind(this));
this.state = { 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 PROPS", this.props);
console.log("OPERATEUR OPTION STATE", this.state); 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 network_agent_id: this.props.result.response.network_agent_id
}); });
}}> }}>
{I18n.t('SUBMIT_LABEL')} {I18n.t('SUBMIT_LABEL')}l
</Button> </Button>
</ScrollView> </ScrollView>
: :

View File

@ -1,6 +1,7 @@
import React, {Component} from 'react'; import React, {Component} from 'react';
import { import {
ActivityIndicator, ActivityIndicator,
Alert,
Animated, Animated,
Platform, Platform,
ProgressBarAndroid, ProgressBarAndroid,
@ -21,7 +22,12 @@ import Tag from '../../components/Tag';
import {IlinkEmitter} from "../../utils/events"; import {IlinkEmitter} from "../../utils/events";
import {Typography} from '../../config/typography'; import {Typography} from '../../config/typography';
import {responsiveWidth,} from 'react-native-responsive-dimensions'; 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 {depositActionReset} from '../../webservice/DepositApi';
import { import {
getWalletTransactionHistoryReset, getWalletTransactionHistoryReset,
@ -58,6 +64,10 @@ import {
} from '../../utils/UtilsFunction'; } from '../../utils/UtilsFunction';
import {readUser} from '../../webservice/AuthApi'; import {readUser} from '../../webservice/AuthApi';
import LottieView from "lottie-react-native"; 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'); let moment = require('moment-timezone');
@ -85,7 +95,8 @@ class WalletDetailUser extends Component {
historyItemDetail: null, historyItemDetail: null,
isIdentified: false, isIdentified: false,
isIdentifiedValidated: false, isIdentifiedValidated: false,
password: '',
isLogged: false
}; };
slugify.extend({'+': 'plus'}); slugify.extend({'+': 'plus'});
@ -105,6 +116,7 @@ class WalletDetailUser extends Component {
this.props.getWalletTransactionHistoryReset(); this.props.getWalletTransactionHistoryReset();
this.props.depositActionReset(); this.props.depositActionReset();
this.props.resetWalletListDetailReducer(); this.props.resetWalletListDetailReducer();
this.props.passwordValidationReset();
this.props.getUserIdentificationResetAction(); this.props.getUserIdentificationResetAction();
console.warn("Wallet User Props", this.props); 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) { shouldComponentUpdate(nextProps, nextState) {
if (this.state.triggerTransferCommission !== nextState.triggerTransferCommission) { if (this.state.triggerTransferCommission !== nextState.triggerTransferCommission) {
@ -1010,7 +1060,37 @@ class WalletDetailUser extends Component {
<Text style={Typography.body1}>{I18n.t('NO_WALLET_ACTIVED')}</Text> <Text style={Typography.body1}>{I18n.t('NO_WALLET_ACTIVED')}</Text>
</View> </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>
<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.renderDetailWallet(this.props.result.response)
: this.props.error !== null && : this.props.error !== null &&
this.props.error.data !== null && this.props.error.data !== null &&
@ -1045,6 +1125,10 @@ const mapStateToProps = state => ({
loadingUserIdentification: state.getUserIdentificationReducer.loading, loadingUserIdentification: state.getUserIdentificationReducer.loading,
resultUserIdentification: state.getUserIdentificationReducer.result, resultUserIdentification: state.getUserIdentificationReducer.result,
errorUserIdentification: state.getUserIdentificationReducer.error, errorUserIdentification: state.getUserIdentificationReducer.error,
loadingPasswordValidation: state.passwordValidationReducer.loading,
resultPasswordValidation: state.passwordValidationReducer.result,
errorPasswordValidation: state.passwordValidationReducer.error,
}); });
const mapDispatchToProps = dispatch => bindActionCreators({ const mapDispatchToProps = dispatch => bindActionCreators({
@ -1056,7 +1140,9 @@ const mapDispatchToProps = dispatch => bindActionCreators({
getWalletTransactionHistoryReset, getWalletTransactionHistoryReset,
depositActionReset, depositActionReset,
getUserIdentificationAction, getUserIdentificationAction,
getUserIdentificationResetAction getUserIdentificationResetAction,
passwordValidationAction,
passwordValidationReset,
}, dispatch); }, dispatch);
export default connect(mapStateToProps, mapDispatchToProps)(WalletDetailUser); export default connect(mapStateToProps, mapDispatchToProps)(WalletDetailUser);

View File

@ -521,7 +521,8 @@ const ExecuterPrescriptionScreen = ({
const ExecuterPrescriptionSchema = Yup.object().shape({ const ExecuterPrescriptionSchema = Yup.object().shape({
numero_assure: Yup.string() numero_assure: Yup.string()
.required(I18n.t('THIS_FIELD_IS_REQUIRED')), .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() practitioner_lastname: Yup.string()
.required(I18n.t('THIS_FIELD_IS_REQUIRED')), .required(I18n.t('THIS_FIELD_IS_REQUIRED')),
practitioner_firstname: Yup.string() practitioner_firstname: Yup.string()

View File

@ -531,7 +531,8 @@ const ModifierExecutionPrescriptionScreen = ({
const ExecuterPrescriptionSchema = Yup.object().shape({ const ExecuterPrescriptionSchema = Yup.object().shape({
numero_assure: Yup.string() numero_assure: Yup.string()
.required(I18n.t('THIS_FIELD_IS_REQUIRED')), .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() practitioner_lastname: Yup.string()
.required(I18n.t('THIS_FIELD_IS_REQUIRED')), .required(I18n.t('THIS_FIELD_IS_REQUIRED')),
practitioner_firstname: Yup.string() practitioner_firstname: Yup.string()

View File

@ -598,7 +598,8 @@ const ModifierFeuilleSoinScreen = ({
const ModifierFeuilleSoinSchema = Yup.object().shape({ const ModifierFeuilleSoinSchema = Yup.object().shape({
numero_assure: Yup.string() numero_assure: Yup.string()
.required(I18n.t('THIS_FIELD_IS_REQUIRED')), .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() practitioner_lastname: Yup.string()
.required(I18n.t('THIS_FIELD_IS_REQUIRED')), .required(I18n.t('THIS_FIELD_IS_REQUIRED')),
practitioner_firstname: Yup.string() practitioner_firstname: Yup.string()

View File

@ -679,7 +679,8 @@ const SaisirFeuilleSoinScreen = ({
const SaisirFeuilleSoinSchema = Yup.object().shape({ const SaisirFeuilleSoinSchema = Yup.object().shape({
numero_assure: Yup.string() numero_assure: Yup.string()
.required(I18n.t('THIS_FIELD_IS_REQUIRED')), .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() practitioner_lastname: Yup.string()
.required(I18n.t('THIS_FIELD_IS_REQUIRED')), .required(I18n.t('THIS_FIELD_IS_REQUIRED')),
practitioner_firstname: Yup.string() practitioner_firstname: Yup.string()

View File

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

View File

@ -36,7 +36,6 @@ import {responsiveWidth} from "react-native-responsive-dimensions";
import SwitchSelector from "react-native-switch-selector"; import SwitchSelector from "react-native-switch-selector";
import MaterialCommunityIcons from "react-native-vector-icons/MaterialCommunityIcons"; import MaterialCommunityIcons from "react-native-vector-icons/MaterialCommunityIcons";
import { import {
fetchActivePaySubscriptionReset,
fetchAddBeneficiaryToSubscription, fetchAddBeneficiaryToSubscription,
fetchAddBeneficiaryToSubscriptionReset, fetchAddBeneficiaryToSubscriptionReset,
fetchGetInsurancePrimeAmount, fetchGetInsurancePrimeAmount,
@ -66,6 +65,7 @@ import {
import {Dropdown} from "react-native-material-dropdown"; import {Dropdown} from "react-native-material-dropdown";
import Icon from "react-native-vector-icons/FontAwesome5"; import Icon from "react-native-vector-icons/FontAwesome5";
import {store} from "../../../redux/store";
let moment = require('moment-timezone'); let moment = require('moment-timezone');
@ -262,6 +262,7 @@ const AddBeneficiaryScreen = ({
const [affiliation, setAffliliation] = useState('CHILD'); const [affiliation, setAffliliation] = useState('CHILD');
const [subscription, setSubscription] = useState(null); const [subscription, setSubscription] = useState(null);
const [subscriptions, setSubscriptions] = useState([]); 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 [currentYearMinusAgeLimit, setCurrentYearMinusAgeLimit] = useState(new Date(((new Date()).getFullYear() - 5), 0, 1));
let subscriptionRef = null; let subscriptionRef = null;
@ -439,8 +440,8 @@ const AddBeneficiaryScreen = ({
}, [uploadInsuranceImages]); }, [uploadInsuranceImages]);
const RegisterSchema = Yup.object().shape({ const RegisterSchema = Yup.object().shape({
password: Yup.string() password: wallet.password_validation === "MAX" ? Yup.string()
.required(I18n.t('THIS_FIELD_IS_REQUIRED')) .required(I18n.t('THIS_FIELD_IS_REQUIRED')) : Yup.string()
}); });
const AddBeneficiarySchema = Yup.object().shape({ const AddBeneficiarySchema = Yup.object().shape({
@ -982,6 +983,8 @@ const AddBeneficiaryScreen = ({
/> />
</Animatable.View> </Animatable.View>
{
wallet.password_validation === "MAX" &&
<PasswordInput <PasswordInput
style={{marginTop: 10}} style={{marginTop: 10}}
onChangeText={handleChange('password')} onChangeText={handleChange('password')}
@ -994,6 +997,7 @@ const AddBeneficiaryScreen = ({
touched={touched.password} touched={touched.password}
error={errors.password} error={errors.password}
/> />
}
<View <View

View File

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

View File

@ -465,8 +465,8 @@ const InsuranceSubscriptionScreen = ({
}, [uploadInsuranceImages]); }, [uploadInsuranceImages]);
const RegisterSchema = Yup.object().shape({ const RegisterSchema = Yup.object().shape({
password: Yup.string() password: wallet.password_validation === "MAX" ? Yup.string()
.required(I18n.t('THIS_FIELD_IS_REQUIRED')) .required(I18n.t('THIS_FIELD_IS_REQUIRED')) : Yup.string()
}); });
const AddBeneficiarySchema = Yup.object().shape({ const AddBeneficiarySchema = Yup.object().shape({
@ -1269,6 +1269,8 @@ const InsuranceSubscriptionScreen = ({
</View>*/ </View>*/
} }
{
wallet.password_validation === "MAX" &&
<PasswordInput <PasswordInput
style={{marginTop: 10}} style={{marginTop: 10}}
onChangeText={handleChange('password')} onChangeText={handleChange('password')}
@ -1281,6 +1283,7 @@ const InsuranceSubscriptionScreen = ({
touched={touched.password} touched={touched.password}
error={errors.password} error={errors.password}
/> />
}
<View <View

View File

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

View File

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