-
Notifications
You must be signed in to change notification settings - Fork 2
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
feat: add vat number #2764
feat: add vat number #2764
Changes from all commits
ea99526
5d563d8
ed97fdd
f2cd963
7f13d65
6d44fca
12649af
d726f9d
1c4de50
f7b92b4
4284aac
d4f358b
adbfb60
52e3aeb
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 |
---|---|---|
|
@@ -51,6 +51,11 @@ export const legalAddressValidation = yup.object().shape({ | |
.trim() | ||
.matches(NAME_REGEX, NAME_REGEX_FAIL_MESSAGE) | ||
.required(), | ||
vat_id: yup | ||
.string() | ||
.label("VAT ID") | ||
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. Should we add min/max limits to the field here? 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. What do you mean by min/max limits like the character limit? 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. Added in 52e3aeb. |
||
.max(30) | ||
.trim(), | ||
city: yup | ||
.string() | ||
.label("City") | ||
|
@@ -127,15 +132,19 @@ type LegalAddressProps = { | |
setFieldValue: Function, | ||
setFieldTouched: Function, | ||
values: Object, | ||
includePassword: boolean | ||
includePassword: boolean, | ||
isVatEnabled: boolean, | ||
enableVatID: Function | ||
} | ||
|
||
export const LegalAddressFields = ({ | ||
countries, | ||
setFieldValue, | ||
setFieldTouched, | ||
values, | ||
includePassword | ||
includePassword, | ||
isVatEnabled, | ||
enableVatID | ||
}: LegalAddressProps) => ( | ||
<React.Fragment> | ||
<div className="form-group"> | ||
|
@@ -176,6 +185,23 @@ export const LegalAddressFields = ({ | |
/> | ||
<ErrorMessage name="name" component={FormError} /> | ||
</div> | ||
{isVatEnabled ? ( | ||
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. We should write a test for this as well? 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. These are just the fields used in RegisterDetailsPage and EditProfilePage. We handled tests for this in the respective pages i.e. RegisterDetailsPage and EditProfilePage. 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. Also, we do not have any existing tests for ProfileFormFields.js. I assume all of the tests are meant to be added for the pages themselves. |
||
<div className="form-group"> | ||
<label htmlFor="legal_address.vat_id" className="font-weight-bold"> | ||
VAT ID | ||
</label> | ||
<Field type="text" name="legal_address.vat_id" className="form-control" /> | ||
<ErrorMessage name="legal_address.vat_id" component={FormError} /> | ||
</div> | ||
) : ( | ||
<button | ||
type="button" | ||
className="add-vat-id" | ||
onClick={enableVatID} | ||
> | ||
Add VAT ID | ||
</button> | ||
)} | ||
{includePassword ? ( | ||
<div className="form-group"> | ||
<label htmlFor="password" className="font-weight-bold"> | ||
|
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.
Should we place it behind the tax display feat flag?
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 don't think this is related to the taxes feature as it was an extra thing required to avoid some manual work. @cachob What are your thoughts on this?
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.
This is a separate issue from country taxes. A learner may be required to enter a VAT number (by the employer for example) but the country itself may not require a learner's tax