-
Notifications
You must be signed in to change notification settings - Fork 3k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Business Info Page #30924
Business Info Page #30924
Changes from all commits
4f13317
d493d3a
82e383c
942d549
cfd4ace
36e10e6
ce24ca8
316040a
92b0ae2
de9b598
098e60c
427ab33
8152cd4
4a29bc9
e229faa
0a33668
72cc6f1
dff94a5
8d579c5
72546e5
8fa9a25
3b668bc
749e6a0
d4a6cc4
eafe68b
2b2f4a2
8197628
87f077c
1140b43
5fd108e
d6bd017
218c487
4fe37bb
75fae66
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -1387,6 +1387,37 @@ export default { | |
letsDoubleCheck: 'Revisemos que todo esté bien', | ||
byAddingThisBankAccount: 'Agregando esta cuenta bancaria, confirmas que as leído, entendido y aceptado', | ||
}, | ||
businessInfoStep: { | ||
businessInfo: 'Información de Negocio', | ||
enterTheNameOfYourBusiness: 'Introduzca el nombre de su negocio.', | ||
businessName: 'Nombre del Negocio', | ||
enterYourCompanysTaxIdNumber: 'Introduzca el número de identificación fiscal.', | ||
taxIDNumber: 'Número de identificación fiscal', | ||
taxIDNumberPlaceholder: '9 dígitos', | ||
enterYourCompanysWebsite: 'Introduzca el sitio web de su compañia.', | ||
companyWebsite: 'Sitio web de la compañia', | ||
enterYourCompanysPhoneNumber: 'Introduzca el número de teléfono de su compañia.', | ||
enterYourCompanysAddress: 'Introduzca el la dirección de su compañia.', | ||
selectYourCompanysType: 'Seleccione el tipo de compañia.', | ||
companyType: 'Tipo de compañia', | ||
incorporationType: { | ||
LLC: 'SRL', | ||
CORPORATION: 'Corporación', | ||
PARTNERSHIP: 'Asociación', | ||
COOPERATIVE: 'Cooperativa', | ||
SOLE_PROPRIETORSHIP: 'Empresa unipersonal', | ||
OTHER: 'Otros', | ||
}, | ||
selectYourCompanysIncorporationDate: 'Seleccione la fecha de constitución de su empresa.', | ||
incorporationDate: 'Fecha de constitución', | ||
incorporationDatePlaceholder: 'Fecha de inicio (yyyy-mm-dd)', | ||
incorporationState: 'Estado de constitución', | ||
pleaseSelectTheStateYourCompanyWasIncorporatedIn: 'Seleccione el estado en el que se constituyó su empresa.', | ||
letsDoubleCheck: 'Verifiquemos que todo esté correcto', | ||
companyAddress: 'Dirección de la empresa', | ||
listOfRestrictedBusinesses: 'lista de negocios restringidos', | ||
confirmCompanyIsNot: 'Confirmo que esta empresa no está en la', | ||
}, | ||
Comment on lines
+1391
to
+1420
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Can you confirm the verification of these in slack? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. as with the other parts of this flow, given time constraints, it's been said that we will have a final check towards the end of the work on it, accepted as non blocking by Vit here |
||
validationStep: { | ||
headerTitle: 'Validar cuenta bancaria', | ||
buttonText: 'Finalizar configuración', | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,152 @@ | ||
import {parsePhoneNumber} from 'awesome-phonenumber'; | ||
import lodashGet from 'lodash/get'; | ||
import PropTypes from 'prop-types'; | ||
import React, {useCallback, useMemo} from 'react'; | ||
import {View} from 'react-native'; | ||
import {withOnyx} from 'react-native-onyx'; | ||
import _ from 'underscore'; | ||
import HeaderWithBackButton from '@components/HeaderWithBackButton'; | ||
import InteractiveStepSubHeader from '@components/InteractiveStepSubHeader'; | ||
import ScreenWrapper from '@components/ScreenWrapper'; | ||
import useLocalize from '@hooks/useLocalize'; | ||
import useSubStep from '@hooks/useSubStep'; | ||
import Navigation from '@libs/Navigation/Navigation'; | ||
import reimbursementAccountDraftPropTypes from '@pages/ReimbursementAccount/ReimbursementAccountDraftPropTypes'; | ||
import {reimbursementAccountPropTypes} from '@pages/ReimbursementAccount/reimbursementAccountPropTypes'; | ||
import * as ReimbursementAccountProps from '@pages/ReimbursementAccount/reimbursementAccountPropTypes'; | ||
import getDefaultStateForField from '@pages/ReimbursementAccount/utils/getDefaultStateForField'; | ||
import getInitialSubstepForBusinessInfo from '@pages/ReimbursementAccount/utils/getInitialSubstepForBusinessInfo'; | ||
import getSubstepValues from '@pages/ReimbursementAccount/utils/getSubstepValues'; | ||
import styles from '@styles/styles'; | ||
import * as BankAccounts from '@userActions/BankAccounts'; | ||
import CONST from '@src/CONST'; | ||
import ONYXKEYS from '@src/ONYXKEYS'; | ||
import ROUTES from '@src/ROUTES'; | ||
import AddressBusiness from './substeps/AddressBusiness'; | ||
import ConfirmationBusiness from './substeps/ConfirmationBusiness'; | ||
import IncorporationDateBusiness from './substeps/IncorporationDateBusiness'; | ||
import IncorporationStateBusiness from './substeps/IncorporationStateBusiness'; | ||
import NameBusiness from './substeps/NameBusiness'; | ||
import PhoneNumberBusiness from './substeps/PhoneNumberBusiness'; | ||
import TaxIdBusiness from './substeps/TaxIdBusiness'; | ||
import TypeBusiness from './substeps/TypeBusiness'; | ||
import WebsiteBusiness from './substeps/WebsiteBusiness'; | ||
|
||
const propTypes = { | ||
/** Reimbursement account from ONYX */ | ||
reimbursementAccount: reimbursementAccountPropTypes, | ||
|
||
/** The draft values of the bank account being setup */ | ||
reimbursementAccountDraft: reimbursementAccountDraftPropTypes, | ||
|
||
/* The workspace policyID */ | ||
policyID: PropTypes.string, | ||
}; | ||
|
||
const defaultProps = { | ||
reimbursementAccount: ReimbursementAccountProps.reimbursementAccountDefaultProps, | ||
reimbursementAccountDraft: {}, | ||
policyID: '', | ||
}; | ||
|
||
const STEPS_HEADER_HEIGHT = 40; | ||
// TODO Will most likely come from different place | ||
Swor71 marked this conversation as resolved.
Show resolved
Hide resolved
|
||
const STEP_NAMES = ['1', '2', '3', '4', '5']; | ||
|
||
const bodyContent = [ | ||
NameBusiness, | ||
TaxIdBusiness, | ||
WebsiteBusiness, | ||
PhoneNumberBusiness, | ||
AddressBusiness, | ||
TypeBusiness, | ||
IncorporationDateBusiness, | ||
IncorporationStateBusiness, | ||
ConfirmationBusiness, | ||
]; | ||
|
||
const businessInfoStepKeys = CONST.BANK_ACCOUNT.BUSINESS_INFO_STEP.INPUT_KEY; | ||
|
||
function BusinessInfo({reimbursementAccount, reimbursementAccountDraft, policyID}) { | ||
const {translate} = useLocalize(); | ||
|
||
/** | ||
* @param {Array} fieldNames | ||
* | ||
* @returns {*} | ||
*/ | ||
const getBankAccountFields = useCallback( | ||
(fieldNames) => ({ | ||
..._.pick(lodashGet(reimbursementAccount, 'achData'), ...fieldNames), | ||
..._.pick(reimbursementAccountDraft, ...fieldNames), | ||
}), | ||
[reimbursementAccount, reimbursementAccountDraft], | ||
); | ||
|
||
const values = useMemo(() => getSubstepValues(businessInfoStepKeys, reimbursementAccountDraft, reimbursementAccount), [reimbursementAccount, reimbursementAccountDraft]); | ||
|
||
const submit = useCallback(() => { | ||
const payload = { | ||
bankAccountID: getDefaultStateForField({reimbursementAccount, fieldName: 'bankAccountID', defaultValue: 0}), | ||
...values, | ||
...getBankAccountFields(['routingNumber', 'accountNumber', 'bankName', 'plaidAccountID', 'plaidAccessToken', 'isSavings']), | ||
companyTaxID: values.companyTaxID.replace(CONST.REGEX.NON_NUMERIC, ''), | ||
companyPhone: parsePhoneNumber(values.companyPhone, {regionCode: CONST.COUNTRY.US}).number.significant, | ||
Comment on lines
+89
to
+94
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. {BZ Checklist} this might have caused #50103, RC:
This was fixed in #50715 |
||
}; | ||
|
||
BankAccounts.updateCompanyInformationForBankAccount(payload, policyID); | ||
}, [reimbursementAccount, values, getBankAccountFields, policyID]); | ||
|
||
const startFrom = useMemo(() => getInitialSubstepForBusinessInfo(values), [values]); | ||
|
||
const {componentToRender: SubStep, isEditing, screenIndex, nextScreen, prevScreen, moveTo} = useSubStep({bodyContent, startFrom, onFinished: submit}); | ||
|
||
const handleBackButtonPress = () => { | ||
if (screenIndex === 0) { | ||
Navigation.goBack(ROUTES.HOME); | ||
} else { | ||
prevScreen(); | ||
} | ||
}; | ||
|
||
return ( | ||
<ScreenWrapper | ||
testID={BusinessInfo.displayName} | ||
includeSafeAreaPaddingBottom={false} | ||
shouldEnablePickerAvoiding={false} | ||
shouldEnableMaxHeight | ||
> | ||
<HeaderWithBackButton | ||
title={translate('businessInfoStep.businessInfo')} | ||
guidesCallTaskID={CONST.GUIDES_CALL_TASK_IDS.WORKSPACE_BANK_ACCOUNT} | ||
onBackButtonPress={handleBackButtonPress} | ||
/> | ||
<View style={[styles.ph5, styles.mv3, {height: STEPS_HEADER_HEIGHT}]}> | ||
<InteractiveStepSubHeader | ||
onStepSelected={() => {}} | ||
// TODO Will be replaced with proper values | ||
startStep={2} | ||
stepNames={STEP_NAMES} | ||
/> | ||
</View> | ||
<SubStep | ||
isEditing={isEditing} | ||
onNext={nextScreen} | ||
onMove={moveTo} | ||
/> | ||
</ScreenWrapper> | ||
); | ||
} | ||
|
||
BusinessInfo.propTypes = propTypes; | ||
BusinessInfo.defaultProps = defaultProps; | ||
BusinessInfo.displayName = 'BusinessInfo'; | ||
|
||
export default withOnyx({ | ||
reimbursementAccount: { | ||
key: ONYXKEYS.REIMBURSEMENT_ACCOUNT, | ||
}, | ||
reimbursementAccountDraft: { | ||
key: ONYXKEYS.REIMBURSEMENT_ACCOUNT_DRAFT, | ||
}, | ||
})(BusinessInfo); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why is this not companyWebsite?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I see that has been used before, can we fix it here?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@mountiny hm where did you find
companyWebsite
as the key? I've moved what was there in the CompanyStep component to the new components and their respective keys:https://github.com/Expensify/App/pull/30924/files#diff-40ada854d0b6039d4db7da6cede12f7be0cf7d113cc16c8cbc638af4bd0121d4L81
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
unless you meant the translation, which is here https://github.com/Expensify/App/pull/30924/files#diff-2a9066512656fa29b1565e362127de5cc11ba95b28f143a9db26f76dc3750785R1379
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Discussed we can do that later