@@ -11,7 +11,6 @@ import withLocalize, {withLocalizePropTypes} from '../../components/withLocalize
11
11
import Navigation from '../../libs/Navigation/Navigation' ;
12
12
import styles from '../../styles/styles' ;
13
13
import Text from '../../components/Text' ;
14
- import * as BankAccounts from '../../libs/actions/BankAccounts' ;
15
14
import CONST from '../../CONST' ;
16
15
import compose from '../../libs/compose' ;
17
16
import ONYXKEYS from '../../ONYXKEYS' ;
@@ -28,6 +27,7 @@ import FormHelper from '../../libs/FormHelper';
28
27
import walletAdditionalDetailsDraftPropTypes from './walletAdditionalDetailsDraftPropTypes' ;
29
28
import withCurrentUserPersonalDetails , { withCurrentUserPersonalDetailsPropTypes , withCurrentUserPersonalDetailsDefaultProps } from '../../components/withCurrentUserPersonalDetails' ;
30
29
import * as PersonalDetails from '../../libs/actions/PersonalDetails' ;
30
+ import OfflineIndicator from '../../components/OfflineIndicator' ;
31
31
32
32
const propTypes = {
33
33
...withLocalizePropTypes ,
@@ -36,13 +36,13 @@ const propTypes = {
36
36
/** Stores additional information about the additional details step e.g. loading state and errors with fields */
37
37
walletAdditionalDetails : PropTypes . shape ( {
38
38
/** Are we waiting for a response? */
39
- loading : PropTypes . bool ,
39
+ isLoading : PropTypes . bool ,
40
40
41
41
/** Which field needs attention? */
42
42
errorFields : PropTypes . objectOf ( PropTypes . bool ) ,
43
43
44
44
/** Any additional error message to show */
45
- additionalErrorMessage : PropTypes . string ,
45
+ errors : PropTypes . objectOf ( PropTypes . string ) ,
46
46
47
47
/** Questions returned by Idology */
48
48
questions : PropTypes . arrayOf ( PropTypes . shape ( {
@@ -54,8 +54,8 @@ const propTypes = {
54
54
/** ExpectID ID number related to those questions */
55
55
idNumber : PropTypes . string ,
56
56
57
- /** If we should ask for the full SSN (when LexisNexis failed retrieving the first 5 from the last 4) */
58
- shouldAskForFullSSN : PropTypes . bool ,
57
+ /** Error code to determine additional behavior */
58
+ errorCode : PropTypes . string ,
59
59
} ) ,
60
60
61
61
/** Stores the personal details typed by the user */
@@ -65,11 +65,11 @@ const propTypes = {
65
65
const defaultProps = {
66
66
walletAdditionalDetails : {
67
67
errorFields : { } ,
68
- loading : false ,
69
- additionalErrorMessage : '' ,
68
+ isLoading : false ,
69
+ errors : { } ,
70
70
questions : [ ] ,
71
71
idNumber : '' ,
72
- shouldAskForFullSSN : false ,
72
+ errorCode : '' ,
73
73
} ,
74
74
walletAdditionalDetailsDraft : {
75
75
legalFirstName : '' ,
@@ -187,7 +187,7 @@ class AdditionalDetailsStep extends React.Component {
187
187
errors . phoneNumber = true ;
188
188
}
189
189
190
- if ( this . props . walletAdditionalDetails . shouldAskForFullSSN ) {
190
+ if ( this . props . walletAdditionalDetails . errorCode === CONST . WALLET . ERROR . SSN ) {
191
191
if ( ! ValidationUtils . isValidSSNFullNine ( this . props . walletAdditionalDetailsDraft . ssn ) ) {
192
192
errors . ssnFull9 = true ;
193
193
}
@@ -211,13 +211,11 @@ class AdditionalDetailsStep extends React.Component {
211
211
if ( ! this . validate ( ) ) {
212
212
return ;
213
213
}
214
-
215
- BankAccounts . activateWallet ( CONST . WALLET . STEP . ADDITIONAL_DETAILS , {
216
- personalDetails : {
217
- ...this . props . walletAdditionalDetailsDraft ,
218
- phoneNumber : LoginUtils . getPhoneNumberWithoutUSCountryCodeAndSpecialChars ( this . props . walletAdditionalDetailsDraft . phoneNumber ) ,
219
- } ,
220
- } ) ;
214
+ const personalDetails = {
215
+ ...this . props . walletAdditionalDetailsDraft ,
216
+ phoneNumber : LoginUtils . getPhoneNumberWithoutUSCountryCodeAndSpecialChars ( this . props . walletAdditionalDetailsDraft . phoneNumber ) ,
217
+ } ;
218
+ Wallet . updatePersonalDetails ( personalDetails ) ;
221
219
}
222
220
223
221
/**
@@ -267,10 +265,12 @@ class AdditionalDetailsStep extends React.Component {
267
265
) ;
268
266
}
269
267
268
+ const errors = lodashGet ( this . props , 'walletAdditionalDetails.errors' , { } ) ;
270
269
const isErrorVisible = _ . size ( this . getErrors ( ) ) > 0
271
- || lodashGet ( this . props , 'walletAdditionalDetails.additionalErrorMessage' , '' ) . length > 0 ;
272
- const shouldAskForFullSSN = this . props . walletAdditionalDetails . shouldAskForFullSSN ;
270
+ || ! _ . isEmpty ( errors ) ;
271
+ const shouldAskForFullSSN = this . props . walletAdditionalDetails . errorCode === CONST . WALLET . ERROR . SSN ;
273
272
const { firstName, lastName} = PersonalDetails . extractFirstAndLastNameFromAvailableDetails ( this . props . currentUserPersonalDetails ) ;
273
+ const errorMessage = _ . isEmpty ( errors ) ? '' : _ . last ( _ . values ( errors ) ) ;
274
274
275
275
return (
276
276
< ScreenWrapper style = { [ styles . flex1 ] } keyboardAvoidingViewBehavior = "height" >
@@ -386,10 +386,11 @@ class AdditionalDetailsStep extends React.Component {
386
386
onFixTheErrorsLinkPressed = { ( ) => {
387
387
this . form . scrollTo ( { y : 0 , animated : true } ) ;
388
388
} }
389
- message = { this . props . walletAdditionalDetails . additionalErrorMessage }
390
- isLoading = { this . props . walletAdditionalDetails . loading }
389
+ message = { errorMessage }
390
+ isLoading = { this . props . walletAdditionalDetails . isLoading }
391
391
buttonText = { this . props . translate ( 'common.saveAndContinue' ) }
392
392
/>
393
+ < OfflineIndicator containerStyles = { [ styles . mh5 , styles . mb3 ] } />
393
394
</ FormScrollView >
394
395
</ View >
395
396
</ ScreenWrapper >
0 commit comments