-
Notifications
You must be signed in to change notification settings - Fork 66
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
API 24828 v2 526 address validation #12795
Conversation
begin | ||
return if Date.parse(date) < Time.zone.now | ||
rescue | ||
raise ::Common::Exceptions::InvalidFieldValue.new('changeOfAddress.dates.beginningDate', date) |
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 like having this line duplicated, but like the idea of not returning a 500 if you pass "2012-11-31". Also, is changeOfAddress.dates.
OK to have for the field name?
raise ::Common::Exceptions::InvalidFieldValue.new('changeOfAddress.dates.beginningDate', date) | ||
end | ||
|
||
def validate_form_526_change_of_address_ending_date! |
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 presume if the endingDate is provided, the beginningDate also will be and that the endingDate should never be before the beginningDate; is that a valid/OK assumption?
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.
Sounds reasonable; didn't see anything specific in the Schema Planning spreadsheet about these fields. I did notice that v1 validation on beginningDate included the following--not sure if you think it's wise to add this check as well?
if Date.parse(change_of_address['beginningDate']) > Time.zone.now
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.
Disregard that, you've already got a check for that.
end | ||
|
||
context 'when no mailing address data is found' do | ||
it 'responds with bad request' do |
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 this be updated to 'responds with a 422'?
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.
let's start leaving notes on these once we've made a decision. Or simply resolving the conversation if we went with the suggestions / comments. Assuming since this PR had previous approval, we're good to approve it, but be good to get in that habit. 👍
raise ::Common::Exceptions::InvalidFieldValue.new('changeOfAddress.dates.beginningDate', date) | ||
end | ||
|
||
def validate_form_526_change_of_address_ending_date! |
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.
Sounds reasonable; didn't see anything specific in the Schema Planning spreadsheet about these fields. I did notice that v1 validation on beginningDate included the following--not sure if you think it's wise to add this check as well?
if Date.parse(change_of_address['beginningDate']) > Time.zone.now
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.
Looks good to me.
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.
Tested locally with Postman. Looks good to me.
* Validate Change Of Address * Fix typo * Fix tests --------- Co-authored-by: Austin Covrig <austin.covrig@oddball.io>
Summary
Related issue(s)
Testing done
rspec
What areas of the site does it impact?
V2 526 submission (and validate)
Acceptance criteria
Requested Feedback
Is it OK to validate beginningDate < endingDate?