| 
									
										
										
										
											2020-04-28 09:22:36 +00:00
										 |  |  | import LottieView from 'lottie-react-native'; | 
					
						
							| 
									
										
										
										
											2020-06-18 05:38:10 +00:00
										 |  |  | import 'moment/locale/en-au'; | 
					
						
							|  |  |  | import 'moment/locale/en-ca'; | 
					
						
							|  |  |  | import 'moment/locale/en-ie'; | 
					
						
							|  |  |  | import 'moment/locale/en-il'; | 
					
						
							|  |  |  | import 'moment/locale/en-nz'; | 
					
						
							|  |  |  | import 'moment/locale/es-us'; | 
					
						
							|  |  |  | import 'moment/locale/fr'; | 
					
						
							|  |  |  | import React, { Component } from 'react'; | 
					
						
							|  |  |  | import { Alert, Dimensions, ScrollView, StatusBar, StyleSheet, Text, View } from 'react-native'; | 
					
						
							|  |  |  | import { CreditCardInput } from "react-native-credit-card-input"; | 
					
						
							|  |  |  | import Dialog from "react-native-dialog"; | 
					
						
							|  |  |  | import I18n from 'react-native-i18n'; | 
					
						
							|  |  |  | import { Appbar, Provider } from 'react-native-paper'; | 
					
						
							|  |  |  | import { responsiveHeight, responsiveWidth } from 'react-native-responsive-dimensions'; | 
					
						
							|  |  |  | import { ProgressDialog } from 'react-native-simple-dialogs'; | 
					
						
							|  |  |  | import { connect } from 'react-redux'; | 
					
						
							|  |  |  | import { bindActionCreators } from 'redux'; | 
					
						
							| 
									
										
										
										
											2020-04-24 15:11:08 +00:00
										 |  |  | import CustomButton from '../../components/CustomButton'; | 
					
						
							| 
									
										
										
										
											2020-04-28 09:22:36 +00:00
										 |  |  | import OutlineTextInput from '../../components/OutlineTextInput'; | 
					
						
							| 
									
										
										
										
											2020-06-18 05:38:10 +00:00
										 |  |  | import style from '../../components/TextInput/styles'; | 
					
						
							| 
									
										
										
										
											2020-04-24 15:11:08 +00:00
										 |  |  | import { Color } from '../../config/Color'; | 
					
						
							| 
									
										
										
										
											2020-06-18 05:38:10 +00:00
										 |  |  | import { Typography } from '../../config/typography'; | 
					
						
							| 
									
										
										
										
											2020-04-24 15:11:08 +00:00
										 |  |  | import { IlinkEmitter } from "../../utils/events"; | 
					
						
							| 
									
										
										
										
											2020-05-03 09:16:24 +00:00
										 |  |  | import { depositAction, depositActionReset } from '../../webservice/DepositApi'; | 
					
						
							| 
									
										
										
										
											2020-06-18 05:38:10 +00:00
										 |  |  | import { getWalletCommissionAmount, resetWalletListDetailReducer, walletCommissionAmountReset } from '../../webservice/WalletApi'; | 
					
						
							| 
									
										
										
										
											2020-05-01 22:36:24 +00:00
										 |  |  | //import Dialog, { DialogContent, DialogTitle, DialogFooter, DialogButton } from 'react-native-popup-dialog';
 | 
					
						
							| 
									
										
										
										
											2020-04-24 15:11:08 +00:00
										 |  |  | let moment = require('moment-timezone'); | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2020-04-28 09:22:36 +00:00
										 |  |  | const CONTAINER_WIDTH = Dimensions.get("window").width; | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2020-04-24 15:11:08 +00:00
										 |  |  | class WalletRetrait extends Component { | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2020-04-28 09:22:36 +00:00
										 |  |  | 
 | 
					
						
							|  |  |  |      static navigatorStyle = { | 
					
						
							|  |  |  |           navBarBackgroundColor: Color.accentLightColor, | 
					
						
							|  |  |  |           statusBarColor: Color.accentColor, | 
					
						
							|  |  |  |           navBarTextColor: '#FFFFFF', | 
					
						
							|  |  |  |           navBarButtonColor: '#FFFFFF', | 
					
						
							|  |  |  |      }; | 
					
						
							|  |  |  |      static navigationOptions = ({ navigation }) => { | 
					
						
							|  |  |  |           return { | 
					
						
							| 
									
										
										
										
											2020-06-18 05:38:10 +00:00
										 |  |  |                header: null, | 
					
						
							|  |  |  |                headerMode: 'none', | 
					
						
							|  |  |  |                headerTitle: null, | 
					
						
							| 
									
										
										
										
											2020-04-28 09:22:36 +00:00
										 |  |  |           } | 
					
						
							|  |  |  |      }; | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2020-04-24 15:11:08 +00:00
										 |  |  |      constructor(props) { | 
					
						
							|  |  |  |           super(props); | 
					
						
							|  |  |  |           this.state = { | 
					
						
							| 
									
										
										
										
											2020-04-28 09:22:36 +00:00
										 |  |  |                type: "debit", | 
					
						
							| 
									
										
										
										
											2020-05-19 07:57:56 +00:00
										 |  |  |                montant: '', | 
					
						
							| 
									
										
										
										
											2020-04-28 09:22:36 +00:00
										 |  |  |                numCarte: 0, | 
					
						
							|  |  |  |                cvv: 0, | 
					
						
							|  |  |  |                expiration_date: '', | 
					
						
							|  |  |  |                creditCardInput: {}, | 
					
						
							|  |  |  |                comptePrincipal: this.props.navigation.state.params.wallet.balance_princ, | 
					
						
							|  |  |  |                id: this.props.navigation.state.params.wallet.id, | 
					
						
							|  |  |  |                isModalConfirmVisible: false, | 
					
						
							|  |  |  |                isDataSubmit: false, | 
					
						
							|  |  |  |                isSubmitClick: false, | 
					
						
							|  |  |  |                displayCardError: false | 
					
						
							| 
									
										
										
										
											2020-04-24 15:11:08 +00:00
										 |  |  |           }; | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2020-05-03 09:16:24 +00:00
										 |  |  |           this.props.walletCommissionAmountReset(); | 
					
						
							|  |  |  |           this.props.depositActionReset(); | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2020-04-28 09:22:36 +00:00
										 |  |  |           console.log("Wallet Params", this.props.navigation.state.params.wallet); | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2020-04-24 15:11:08 +00:00
										 |  |  |           IlinkEmitter.on("langueChange", this.updateLangue.bind(this)); | 
					
						
							|  |  |  |      } | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2020-05-03 09:16:24 +00:00
										 |  |  |      componentWillReceiveProps(nextProps) { | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |           if (nextProps.resultGetCommission != null) { | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |                if (typeof nextProps.resultGetCommission.response !== 'undefined') { | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |                     if (!nextProps.loadingGetCommission) | 
					
						
							|  |  |  |                          this.setState({ | 
					
						
							|  |  |  |                               isModalConfirmVisible: true | 
					
						
							|  |  |  |                          }); | 
					
						
							|  |  |  |                } | 
					
						
							|  |  |  |           } | 
					
						
							|  |  |  |      } | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2020-04-24 15:11:08 +00:00
										 |  |  |      updateLangue() { | 
					
						
							|  |  |  |           this.props.navigation.setParams({ name: I18n.t('WALLET') }) | 
					
						
							|  |  |  |           this.forceUpdate() | 
					
						
							|  |  |  |      } | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2020-04-28 09:22:36 +00:00
										 |  |  |      onCreditCardChange = (form) => { | 
					
						
							|  |  |  |           this.setState({ | 
					
						
							|  |  |  |                creditCardInput: form, | 
					
						
							|  |  |  |                displayCardError: false | 
					
						
							|  |  |  |           }); | 
					
						
							|  |  |  |      } | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |      isNormalInteger = (str) => { | 
					
						
							|  |  |  |           if (/[ `!@#$%^&*()_+\-=\[\]{};':"\\|,.<>\/?~]/.test(str)) | 
					
						
							|  |  |  |                return false; | 
					
						
							|  |  |  |           else | 
					
						
							|  |  |  |                return true; | 
					
						
							|  |  |  |      } | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |      isMontantValid = () => { | 
					
						
							|  |  |  |           const { montant } = this.state; | 
					
						
							|  |  |  |           if ((parseInt(montant) == 0 || montant < 0)) | 
					
						
							|  |  |  |                return { | 
					
						
							|  |  |  |                     errorMessage: I18n.t('ENTER_AMOUNT_SUPERIOR_ZEROR'), | 
					
						
							|  |  |  |                     isValid: false | 
					
						
							|  |  |  |                }; | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |           else if (!this.isNormalInteger(montant)) | 
					
						
							|  |  |  |                return { | 
					
						
							|  |  |  |                     errorMessage: I18n.t('ENTER_VALID_AMOUNT'), | 
					
						
							|  |  |  |                     isValid: false | 
					
						
							|  |  |  |                }; | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2020-05-03 09:16:24 +00:00
										 |  |  |           /*  | 
					
						
							|  |  |  |                     else if (montant > parseInt(this.state.comptePrincipal)) | 
					
						
							|  |  |  |                          return { | 
					
						
							|  |  |  |                               errorMessage: I18n.t('AMOUNT_SUPERIOR_TO_PRINCIPAL_ACCOUNT'), | 
					
						
							|  |  |  |                               isValid: false | 
					
						
							|  |  |  |                          }; */ | 
					
						
							| 
									
										
										
										
											2020-04-28 09:22:36 +00:00
										 |  |  | 
 | 
					
						
							|  |  |  |           else | 
					
						
							|  |  |  |                return { | 
					
						
							|  |  |  |                     errorMessage: '', | 
					
						
							|  |  |  |                     isValid: true | 
					
						
							|  |  |  |                }; | 
					
						
							|  |  |  |      } | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |      isCreditCardValid = () => { | 
					
						
							|  |  |  |           const { creditCardInput } = this.state; | 
					
						
							|  |  |  |           const errorMessage = []; | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |           if (typeof creditCardInput.status !== 'undefined') { | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |                if (creditCardInput.status.cvc === 'incomplete') | 
					
						
							|  |  |  |                     errorMessage.push(I18n.t('CVC_CARD_ERROR')); | 
					
						
							|  |  |  |                if (creditCardInput.status.expiry === 'incomplete') | 
					
						
							|  |  |  |                     errorMessage.push(I18n.t('EXPIRY_CARD_ERROR')); | 
					
						
							|  |  |  |                if (creditCardInput.status.number === 'incomplete') | 
					
						
							|  |  |  |                     errorMessage.push(I18n.t('CARD_NUMBER_ERROR')); | 
					
						
							|  |  |  |           } | 
					
						
							|  |  |  |           else | 
					
						
							|  |  |  |                errorMessage.push(I18n.t('THIS_FIELD_IS_REQUIRED')) | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |           return errorMessage; | 
					
						
							|  |  |  |      } | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2020-05-03 09:16:24 +00:00
										 |  |  |      commissionsLoading = () => { | 
					
						
							|  |  |  |           return ( | 
					
						
							|  |  |  |                <ProgressDialog | 
					
						
							|  |  |  |                     visible={this.props.loadingGetCommission} | 
					
						
							|  |  |  |                     title={I18n.t('LOADING')} | 
					
						
							|  |  |  |                     message={I18n.t('LOADING_INFO')} | 
					
						
							|  |  |  |                /> | 
					
						
							|  |  |  |           ) | 
					
						
							| 
									
										
										
										
											2020-04-28 09:22:36 +00:00
										 |  |  |      } | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2020-05-03 09:16:24 +00:00
										 |  |  |      modalConfirmTransaction = (data) => { | 
					
						
							|  |  |  |           const commission = data.response.commission; | 
					
						
							|  |  |  |           const montant_calcule = data.response.montant_calcule; | 
					
						
							| 
									
										
										
										
											2020-04-28 09:22:36 +00:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2020-05-03 09:16:24 +00:00
										 |  |  |           console.log("DATA SEND TO CONFIRM DIALOG", data); | 
					
						
							| 
									
										
										
										
											2020-04-24 15:11:08 +00:00
										 |  |  |           return ( | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2020-05-01 22:36:24 +00:00
										 |  |  |                <Dialog.Container useNativeDriver={true} visible={this.state.isModalConfirmVisible}> | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2020-05-06 11:04:26 +00:00
										 |  |  |                     <Dialog.Title>{I18n.t('CONFIRM_WITHDRAWAL')}</Dialog.Title> | 
					
						
							| 
									
										
										
										
											2020-05-01 22:36:24 +00:00
										 |  |  | 
 | 
					
						
							|  |  |  |                     <View> | 
					
						
							| 
									
										
										
										
											2020-04-28 09:22:36 +00:00
										 |  |  | 
 | 
					
						
							|  |  |  |                          <View style={[styles.blockView, { borderBottomColor: Color.borderColor }]}> | 
					
						
							|  |  |  |                               <View style={{ flexDirection: 'row', marginTop: 10 }}> | 
					
						
							|  |  |  |                                    <View style={{ flex: 1 }}> | 
					
						
							|  |  |  |                                         <Text style={[style.body2]}>{I18n.t('AMOUNT')}</Text> | 
					
						
							|  |  |  |                                    </View> | 
					
						
							|  |  |  |                                    <View style={{ flex: 1, alignItems: 'flex-end' }}> | 
					
						
							|  |  |  |                                         <Text style={[Typography.caption1, Color.grayColor]}>{this.state.montant}</Text> | 
					
						
							|  |  |  |                                    </View> | 
					
						
							|  |  |  |                               </View> | 
					
						
							|  |  |  |                               <View style={{ flexDirection: 'row', marginTop: 10 }}> | 
					
						
							|  |  |  |                                    <View style={{ flex: 1 }}> | 
					
						
							|  |  |  |                                         <Text tyle={[Typography.body2]}>{I18n.t('COMMISSION_FEES')}</Text> | 
					
						
							|  |  |  |                                    </View> | 
					
						
							|  |  |  |                                    <View style={{ flex: 1, alignItems: 'flex-end' }}> | 
					
						
							| 
									
										
										
										
											2020-05-03 09:16:24 +00:00
										 |  |  |                                         <Text style={[Typography.caption1, Color.grayColor]}>{commission}</Text> | 
					
						
							| 
									
										
										
										
											2020-04-28 09:22:36 +00:00
										 |  |  |                                    </View> | 
					
						
							|  |  |  |                               </View> | 
					
						
							|  |  |  |                          </View> | 
					
						
							|  |  |  |                          <View style={{ paddingVertical: 10 }}> | 
					
						
							|  |  |  |                               <View style={{ flexDirection: 'row', marginTop: 10 }}> | 
					
						
							|  |  |  |                                    <View style={{ flex: 1 }}> | 
					
						
							|  |  |  |                                         <Text tyle={[Typography.body2]}>{I18n.t('TOTAL')}</Text> | 
					
						
							|  |  |  |                                    </View> | 
					
						
							|  |  |  |                                    <View style={{ flex: 1, alignItems: 'flex-end' }}> | 
					
						
							| 
									
										
										
										
											2020-05-03 09:16:24 +00:00
										 |  |  |                                         <Text style={[Typography.caption1, Color.grayColor]}>{montant_calcule}</Text> | 
					
						
							| 
									
										
										
										
											2020-04-28 09:22:36 +00:00
										 |  |  |                                    </View> | 
					
						
							|  |  |  |                               </View> | 
					
						
							| 
									
										
										
										
											2020-04-24 15:11:08 +00:00
										 |  |  |                          </View> | 
					
						
							| 
									
										
										
										
											2020-05-01 22:36:24 +00:00
										 |  |  |                     </View> | 
					
						
							| 
									
										
										
										
											2020-04-24 15:11:08 +00:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2020-05-01 22:36:24 +00:00
										 |  |  |                     <Dialog.Button bold={true} label={I18n.t('CANCEL_LABEL')} onPress={() => { | 
					
						
							|  |  |  |                          this.setState({ | 
					
						
							|  |  |  |                               isModalConfirmVisible: false | 
					
						
							|  |  |  |                          }); | 
					
						
							|  |  |  |                     }} /> | 
					
						
							|  |  |  |                     <Dialog.Button bold={true} label={I18n.t('SUBMIT_LABEL')} onPress={() => { | 
					
						
							|  |  |  |                          this.setState({ | 
					
						
							|  |  |  |                               isModalConfirmVisible: false, | 
					
						
							|  |  |  |                               isDataSubmit: true | 
					
						
							|  |  |  |                          }); | 
					
						
							| 
									
										
										
										
											2020-05-03 09:16:24 +00:00
										 |  |  |                          this.props.walletCommissionAmountReset(); | 
					
						
							| 
									
										
										
										
											2020-05-01 22:36:24 +00:00
										 |  |  |                          this.props.depositAction({ | 
					
						
							| 
									
										
										
										
											2020-05-25 15:41:02 +00:00
										 |  |  |                               numCarte: this.state.creditCardInput.values.number.replace(/\s/g, ''), | 
					
						
							| 
									
										
										
										
											2020-05-01 22:36:24 +00:00
										 |  |  |                               cvv: this.state.creditCardInput.values.cvc, | 
					
						
							|  |  |  |                               expiration_date: this.state.creditCardInput.values.expiry, | 
					
						
							|  |  |  |                               type: "debit", | 
					
						
							|  |  |  |                               montant: this.state.montant, | 
					
						
							|  |  |  |                               id_wallet: this.state.id | 
					
						
							|  |  |  |                          }); | 
					
						
							|  |  |  |                     }} /> | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |                </Dialog.Container> | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2020-05-03 09:16:24 +00:00
										 |  |  |           ); | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2020-04-28 09:22:36 +00:00
										 |  |  |      } | 
					
						
							| 
									
										
										
										
											2020-04-24 15:11:08 +00:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2020-04-28 09:22:36 +00:00
										 |  |  |      onSubmitDeposit = () => { | 
					
						
							|  |  |  |           const { creditCardInput } = this.state; | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2020-05-19 07:57:56 +00:00
										 |  |  |           if (this.isMontantValid().isValid && creditCardInput.valid && this.state.montant.length > 0) { | 
					
						
							| 
									
										
										
										
											2020-04-29 09:45:44 +00:00
										 |  |  | 
 | 
					
						
							|  |  |  |                console.log("Is Montant Valid", this.isMontantValid.isValid); | 
					
						
							|  |  |  |                console.log("creditCardInput Valid", creditCardInput.valid); | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2020-04-28 09:22:36 +00:00
										 |  |  |                this.setState({ | 
					
						
							|  |  |  |                     numCarte: parseInt((creditCardInput.values.number).replace(/ /g, ' ')), | 
					
						
							|  |  |  |                     cvv: creditCardInput.values.cvc, | 
					
						
							| 
									
										
										
										
											2020-05-03 09:16:24 +00:00
										 |  |  |                     expiration_date: creditCardInput.values.expiry | 
					
						
							|  |  |  |                }); | 
					
						
							|  |  |  |                this.props.getWalletCommissionAmount({ | 
					
						
							|  |  |  |                     type: "debit", | 
					
						
							|  |  |  |                     montant: this.state.montant, | 
					
						
							|  |  |  |                     id_wallet: this.state.id | 
					
						
							| 
									
										
										
										
											2020-04-28 09:22:36 +00:00
										 |  |  |                }); | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |                //this.props.depositAction(this.state);
 | 
					
						
							|  |  |  |           } | 
					
						
							|  |  |  |           else if (!creditCardInput.valid) { | 
					
						
							|  |  |  |                this.setState({ | 
					
						
							|  |  |  |                     displayCardError: true | 
					
						
							|  |  |  |                }) | 
					
						
							|  |  |  |           } | 
					
						
							|  |  |  |           this.setState({ isSubmitClick: true }) | 
					
						
							|  |  |  |      } | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2020-05-03 09:16:24 +00:00
										 |  |  |      renderDialogGetCommissionResponse = () => { | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |           const { errorGetCommission } = this.props; | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |           if (errorGetCommission !== null) { | 
					
						
							|  |  |  |                if (typeof errorGetCommission.data !== 'undefined') { | 
					
						
							|  |  |  |                     Alert.alert( | 
					
						
							|  |  |  |                          I18n.t("ERROR_LABLE"), | 
					
						
							|  |  |  |                          errorGetCommission.data.error, | 
					
						
							|  |  |  |                          [ | 
					
						
							|  |  |  |                               { | 
					
						
							|  |  |  |                                    text: I18n.t("OK"), onPress: () => { | 
					
						
							|  |  |  |                                         //this.props.resetCommissionReducer();
 | 
					
						
							|  |  |  |                                    } | 
					
						
							|  |  |  |                               } | 
					
						
							|  |  |  |                          ], | 
					
						
							|  |  |  |                          { cancelable: false } | 
					
						
							|  |  |  |                     ) | 
					
						
							|  |  |  |                } | 
					
						
							|  |  |  |           } | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |      } | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2020-04-28 09:22:36 +00:00
										 |  |  |      isHasError = () => { | 
					
						
							|  |  |  |           const { error, result } = this.props; | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |           if (this.state.isDataSubmit) { | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |                if (error !== null) { | 
					
						
							|  |  |  |                     if (typeof error.data !== 'undefined') { | 
					
						
							|  |  |  |                          Alert.alert( | 
					
						
							|  |  |  |                               I18n.t("ERROR_LABEL"), | 
					
						
							|  |  |  |                               error.data.error, | 
					
						
							|  |  |  |                               [ | 
					
						
							|  |  |  |                                    { | 
					
						
							|  |  |  |                                         text: I18n.t("OK"), onPress: () => { } | 
					
						
							|  |  |  |                                    } | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |                               ], | 
					
						
							|  |  |  |                               { cancelable: false } | 
					
						
							|  |  |  |                          ); | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |                          this.props.navigation.state.params.onGoBack(); | 
					
						
							|  |  |  |                          this.props.navigation.pop(); | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |                     } | 
					
						
							|  |  |  |                     return null; | 
					
						
							|  |  |  |                } | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |                else if (result !== null) { | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |                     setTimeout(() => { | 
					
						
							|  |  |  |                          this.props.navigation.state.params.onGoBack(); | 
					
						
							|  |  |  |                          this.props.navigation.pop(); | 
					
						
							|  |  |  |                     }, 1500); | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |                     return <View | 
					
						
							|  |  |  |                          style={{ position: "absolute", zIndex: 1, backgroundColor: "#00000050", width: responsiveWidth(100), height: responsiveHeight(100), flex: 1, justifyContent: 'center', alignItems: 'center' }}> | 
					
						
							|  |  |  |                          <LottieView | 
					
						
							|  |  |  |                               style={styles.lottie} | 
					
						
							|  |  |  |                               source={require("../../datas/json/success.json")} | 
					
						
							|  |  |  |                               autoPlay | 
					
						
							|  |  |  |                               loop | 
					
						
							|  |  |  |                          /> | 
					
						
							| 
									
										
										
										
											2020-04-24 15:11:08 +00:00
										 |  |  | 
 | 
					
						
							|  |  |  |                     </View> | 
					
						
							| 
									
										
										
										
											2020-04-28 09:22:36 +00:00
										 |  |  | 
 | 
					
						
							|  |  |  |                } | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |                else | 
					
						
							|  |  |  |                     return null; | 
					
						
							|  |  |  |           } | 
					
						
							|  |  |  |      } | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |      render() { | 
					
						
							| 
									
										
										
										
											2020-05-25 15:41:02 +00:00
										 |  |  |           console.log("STATE", this.state); | 
					
						
							| 
									
										
										
										
											2020-05-03 09:16:24 +00:00
										 |  |  |           const { error, resultGetCommission } = this.props; | 
					
						
							| 
									
										
										
										
											2020-04-28 09:22:36 +00:00
										 |  |  |           return ( | 
					
						
							| 
									
										
										
										
											2020-06-18 05:38:10 +00:00
										 |  |  |                <Provider> | 
					
						
							|  |  |  |                     <View style={{ flex: 1 }}> | 
					
						
							| 
									
										
										
										
											2020-04-28 09:22:36 +00:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2020-06-18 05:38:10 +00:00
										 |  |  |                          <StatusBar | 
					
						
							|  |  |  |                               backgroundColor={Color.primaryDarkColor} | 
					
						
							|  |  |  |                               barStyle="light-content" | 
					
						
							|  |  |  |                               translucent={false} | 
					
						
							|  |  |  |                          /> | 
					
						
							| 
									
										
										
										
											2020-04-28 09:22:36 +00:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2020-06-18 05:38:10 +00:00
										 |  |  |                          <Appbar.Header dark={true} style={{ backgroundColor: Color.primaryColor }}> | 
					
						
							|  |  |  |                               <Appbar.BackAction | 
					
						
							|  |  |  |                                    onPress={() => { this.props.navigation.pop() }} | 
					
						
							| 
									
										
										
										
											2020-04-28 09:22:36 +00:00
										 |  |  |                               /> | 
					
						
							| 
									
										
										
										
											2020-06-18 05:38:10 +00:00
										 |  |  |                               <Appbar.Content | 
					
						
							|  |  |  |                                    title={I18n.t('MAKE_WITHDRAWAL')} | 
					
						
							|  |  |  |                               /> | 
					
						
							|  |  |  |                          </Appbar.Header> | 
					
						
							|  |  |  |                          <View style={[styles.container]}> | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2020-04-28 09:22:36 +00:00
										 |  |  |                               { | 
					
						
							| 
									
										
										
										
											2020-06-18 05:38:10 +00:00
										 |  |  |                                    (resultGetCommission !== null) && | 
					
						
							|  |  |  |                                    (typeof resultGetCommission.response !== 'undefined') && | 
					
						
							|  |  |  |                                    this.modalConfirmTransaction(resultGetCommission) | 
					
						
							| 
									
										
										
										
											2020-04-28 09:22:36 +00:00
										 |  |  |                               } | 
					
						
							| 
									
										
										
										
											2020-06-18 05:38:10 +00:00
										 |  |  |                               {this.isHasError()} | 
					
						
							|  |  |  |                               {this.commissionsLoading()} | 
					
						
							|  |  |  |                               {this.state.isSubmitClick && this.renderDialogGetCommissionResponse()} | 
					
						
							|  |  |  |                               <ScrollView style={{ padding: 20 }}> | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |                                    <View style={{ marginTop: 10 }}> | 
					
						
							|  |  |  |                                         <CreditCardInput | 
					
						
							|  |  |  |                                              validColor={this.state.creditCardInput.valid ? 'green' : ''} | 
					
						
							|  |  |  |                                              invalidColor={!this.state.creditCardInput.valid ? 'red' : ''} | 
					
						
							|  |  |  |                                              onChange={this.onCreditCardChange} | 
					
						
							|  |  |  |                                              labels={{ | 
					
						
							|  |  |  |                                                   number: I18n.t('CARD_NUMBER_LABEL'), | 
					
						
							|  |  |  |                                                   expiry: I18n.t('CARD_EXPIRY_LABEL'), | 
					
						
							|  |  |  |                                                   cvc: I18n.t('CARD_CVC_LABEL'), | 
					
						
							|  |  |  |                                              }} /> | 
					
						
							|  |  |  |                                         { | 
					
						
							|  |  |  |                                              (this.state.displayCardError) && | 
					
						
							|  |  |  |                                              this.isCreditCardValid().map((item) => ( | 
					
						
							|  |  |  |                                                   <Text style={{ color: 'red', marginLeft: 15 }}>{item}</Text> | 
					
						
							|  |  |  |                                              )) | 
					
						
							|  |  |  |                                         } | 
					
						
							|  |  |  |                                    </View> | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |                                    <View style={{ margin: 20 }}> | 
					
						
							|  |  |  |                                         <OutlineTextInput | 
					
						
							|  |  |  |                                              borderBottomColor={!this.isMontantValid.isValid ? 'black' : 'red'} | 
					
						
							|  |  |  |                                              value={this.state.montant} | 
					
						
							|  |  |  |                                              keyboardType="numeric" | 
					
						
							|  |  |  |                                              label={I18n.t('AMOUNT_LABEL')} | 
					
						
							|  |  |  |                                              style={{ marginTop: 10 }} | 
					
						
							|  |  |  |                                              placeholder={I18n.t('AMOUNT_LABEL')} | 
					
						
							|  |  |  |                                              onChangeText={(montant) => { | 
					
						
							|  |  |  |                                                   this.setState({ montant }); | 
					
						
							|  |  |  |                                                   this.isMontantValid(); | 
					
						
							|  |  |  |                                              }} | 
					
						
							|  |  |  |                                         /> | 
					
						
							|  |  |  |                                         { | 
					
						
							|  |  |  |                                              (!this.isMontantValid().isValid) && | 
					
						
							|  |  |  |                                              <Text style={{ color: 'red', marginTop: 2 }}>{this.isMontantValid().errorMessage}</Text> | 
					
						
							|  |  |  |                                         } | 
					
						
							|  |  |  |                                         { | 
					
						
							|  |  |  |                                              (this.state.isSubmitClick && this.state.montant.length === 0) && | 
					
						
							|  |  |  |                                              <Text style={{ color: 'red', marginTop: 2 }}>{I18n.t('PLEASE_ENTER_THE_AMOUNT')}</Text> | 
					
						
							|  |  |  |                                         } | 
					
						
							|  |  |  |                                         <Text></Text> | 
					
						
							|  |  |  |                                    </View> | 
					
						
							| 
									
										
										
										
											2020-04-28 09:22:36 +00:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2020-06-18 05:38:10 +00:00
										 |  |  |                                    <View style={{ margin: 10 }}> | 
					
						
							|  |  |  |                                         <CustomButton loading={this.props.loading} outline onPress={() => this.onSubmitDeposit()}> | 
					
						
							|  |  |  |                                              {I18n.t('VALIDATE')} | 
					
						
							|  |  |  |                                         </CustomButton> | 
					
						
							|  |  |  |                                    </View> | 
					
						
							|  |  |  |                               </ScrollView> | 
					
						
							| 
									
										
										
										
											2020-04-28 09:22:36 +00:00
										 |  |  |                          </View> | 
					
						
							| 
									
										
										
										
											2020-06-18 05:38:10 +00:00
										 |  |  |                     </View> | 
					
						
							|  |  |  |                </Provider> | 
					
						
							| 
									
										
										
										
											2020-04-24 15:11:08 +00:00
										 |  |  |           ) | 
					
						
							|  |  |  |      } | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | } | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | const mapStateToProps = state => ({ | 
					
						
							| 
									
										
										
										
											2020-04-28 09:22:36 +00:00
										 |  |  |      loading: state.depositReducer.loading, | 
					
						
							|  |  |  |      result: state.depositReducer.result, | 
					
						
							| 
									
										
										
										
											2020-05-03 09:16:24 +00:00
										 |  |  |      error: state.depositReducer.error, | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |      loadingGetCommission: state.walletGetCommission.loadingGetCommission, | 
					
						
							|  |  |  |      resultGetCommission: state.walletGetCommission.resultGetCommission, | 
					
						
							|  |  |  |      errorGetCommission: state.walletGetCommission.errorGetCommission, | 
					
						
							| 
									
										
										
										
											2020-04-24 15:11:08 +00:00
										 |  |  | }); | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | const mapDispatchToProps = dispatch => bindActionCreators({ | 
					
						
							| 
									
										
										
										
											2020-05-03 09:16:24 +00:00
										 |  |  |      depositAction: depositAction, | 
					
						
							|  |  |  |      getWalletCommissionAmount: getWalletCommissionAmount, | 
					
						
							|  |  |  |      walletCommissionAmountReset: walletCommissionAmountReset, | 
					
						
							|  |  |  |      resetWalletListDetailReducer: resetWalletListDetailReducer, | 
					
						
							|  |  |  |      depositActionReset | 
					
						
							| 
									
										
										
										
											2020-04-24 15:11:08 +00:00
										 |  |  | }, dispatch); | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | export default connect(mapStateToProps, mapDispatchToProps)(WalletRetrait); | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | const styles = StyleSheet.create({ | 
					
						
							|  |  |  |      container: { | 
					
						
							|  |  |  |           flex: 1, | 
					
						
							|  |  |  |           backgroundColor: Color.containerBackgroundColor | 
					
						
							|  |  |  |      }, | 
					
						
							|  |  |  |      checkDefault: { | 
					
						
							|  |  |  |           flexDirection: "row", | 
					
						
							|  |  |  |           justifyContent: "space-between", | 
					
						
							|  |  |  |           alignItems: "center", | 
					
						
							|  |  |  |           borderBottomWidth: 1, | 
					
						
							|  |  |  |           paddingVertical: 15, | 
					
						
							|  |  |  |           marginTop: 10 | 
					
						
							|  |  |  |      }, | 
					
						
							| 
									
										
										
										
											2020-04-28 09:22:36 +00:00
										 |  |  |      contentButtonBottom: { | 
					
						
							|  |  |  |           borderTopWidth: 1, | 
					
						
							|  |  |  |           paddingVertical: 10, | 
					
						
							|  |  |  |           paddingHorizontal: 20, | 
					
						
							|  |  |  |           flexDirection: "row", | 
					
						
							|  |  |  |           justifyContent: "space-between", | 
					
						
							|  |  |  |           alignItems: "center" | 
					
						
							|  |  |  |      }, | 
					
						
							|  |  |  |      blockView: { | 
					
						
							|  |  |  |           paddingVertical: 10, | 
					
						
							|  |  |  |           borderBottomWidth: 1 | 
					
						
							|  |  |  |      }, | 
					
						
							|  |  |  |      lottie: { | 
					
						
							|  |  |  |           width: 248, | 
					
						
							|  |  |  |           height: 248 | 
					
						
							|  |  |  |      }, | 
					
						
							| 
									
										
										
										
											2020-04-24 15:11:08 +00:00
										 |  |  | }); |