-
Notifications
You must be signed in to change notification settings - Fork 0
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
VEGA-2743 allow attorney details correction #283
base: main
Are you sure you want to change the base?
Conversation
583fd16
to
0e2c8ee
Compare
0e2c8ee
to
a9d61fa
Compare
lambda/update/correction.go
Outdated
Prefix("/address", func(p *parse.Parser) []shared.FieldError { | ||
return p. | ||
Field("/line1", &data.AttorneyAddress.Line1, parse.Optional()). | ||
Field("/line2", &data.AttorneyAddress.Line2, parse.Optional()). | ||
Field("/line3", &data.AttorneyAddress.Line3, parse.Optional()). | ||
Field("/town", &data.AttorneyAddress.Town, parse.Optional()). | ||
Field("/postcode", &data.AttorneyAddress.Postcode, parse.Optional()). | ||
Field("/country", &data.AttorneyAddress.Country, parse.Validate(func() []shared.FieldError { | ||
return validate.Country("", data.AttorneyAddress.Country) | ||
}), parse.Optional()). |
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.
you could extract the address bit like:
func validateAddress(address *shared.Address) func(p *parse.Parser) []shared.FieldError {
return func(p *parse.Parser) []shared.FieldError {
return p.
Field("/line1", &address.Line1, parse.Optional()).
Field("/line2", &address.Line2, parse.Optional()).
Field("/line3", &address.Line3, parse.Optional()).
Field("/town", &address.Town, parse.Optional()).
Field("/postcode", &address.Postcode, parse.Optional()).
Field("/country", &address.Country, parse.Validate(func() []shared.FieldError {
return validate.Country("", address.Country)
}), parse.Optional()).
Consumed()
}
}
// validateAddress(&data.DonorAddress)
// validateAddress(&data.AttorneyAddress)
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.
you could also use a similar technique to extract the /donor
and /attorney
handling if you wanted
lambda/update/correction.go
Outdated
type Correction struct { | ||
DonorFirstNames string | ||
DonorLastName string | ||
DonorOtherNames string | ||
DonorDob shared.Date | ||
DonorAddress shared.Address | ||
DonorEmail string | ||
LPASignedAt time.Time | ||
DonorFirstNames string | ||
DonorLastName string | ||
DonorOtherNames string | ||
DonorDob shared.Date | ||
DonorAddress shared.Address | ||
DonorEmail string | ||
LPASignedAt time.Time | ||
Index *int | ||
AttorneyFirstNames string | ||
AttorneyLastName string | ||
AttorneyDob shared.Date | ||
AttorneyAddress shared.Address | ||
AttorneyEmail string | ||
AttorneyMobile string | ||
AttorneySignedAt time.Time | ||
} |
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.
maybe this would be neater, if it is going to grow, as
type Correction struct {
Donor DonorCorrection
LPASignedAt time.time
Attorney AttorneyCorrection
// or if you can only have one of these pointers, then you can nil check to see which type it is?
}
type DonorCorrection struct { /* ... */ }
type AttorneyCorrection struct { /* ... */ }
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.
then you'd also have the option of adding (c DonorCorrection/AttorneyCorrection) Apply(lpa *shared.Lpa) []shared.FieldError
methods to break that up
Quality Gate passedIssues Measures |
Purpose
Updates the correction event to allow for attorney details to also be corrected
Fixes (VEGA-2743)
Approach
Implementation just adds to the current correction method