Skip to content

Commit

Permalink
[13658] Fix MDT birthdate formatting issue (#4921)
Browse files Browse the repository at this point in the history
* fix birthdate formatting issue

* updated test to test for birth date validation
  • Loading branch information
voidspooks authored Sep 18, 2020
1 parent 8cdb038 commit 0579c76
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 4 deletions.
6 changes: 5 additions & 1 deletion lib/mdot/client.rb
Original file line number Diff line number Diff line change
Expand Up @@ -74,11 +74,15 @@ def headers
VA_VETERAN_MIDDLE_NAME: @user.middle_name,
VA_VETERAN_LAST_NAME: @user.last_name,
VA_VETERAN_ID: @user.ssn.last(4),
VA_VETERAN_BIRTH_DATE: @user.birth_date,
VA_VETERAN_BIRTH_DATE: format_birthdate(@user.birth_date),
VA_ICN: @user.icn
}
end

def format_birthdate(date)
Date.parse(date).strftime('%Y-%m-%d')
end

def submission_headers
{
VAAPIKEY: MDOT::Token.find(@user.uuid).token
Expand Down
8 changes: 6 additions & 2 deletions spec/lib/mdot/client_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
first_name: 'Greg',
last_name: 'Anderson',
middle_name: 'A',
birth_date: '1991-04-05',
birth_date: '19910405',
ssn: '000550237'
}
end
Expand All @@ -22,7 +22,11 @@
describe '#get_supplies' do
context 'with a valid supplies response' do
it 'returns an array of supplies' do
VCR.use_cassette('mdot/get_supplies_200') do
VCR.use_cassette(
'mdot/get_supplies_200',
match_requests_on: %i[method uri headers],
erb: { icn: user.icn }
) do
response = subject.get_supplies
expect(response).to be_ok
expect(response).to be_an MDOT::Response
Expand Down
4 changes: 3 additions & 1 deletion spec/support/vcr_cassettes/mdot/get_supplies_200.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,14 +15,16 @@ http_interactions:
- Vets.gov Agent
Va-Veteran-First-Name:
- Greg
Va-Veteran-Middle-Name:
- A
Va-Veteran-Last-Name:
- Anderson
Va-Veteran-Id:
- '0237'
Va-Veteran-Birth-Date:
- '1991-04-05'
Va-Icn:
- 11263043841512898
- '<%= icn %>'
Accept-Encoding:
- gzip;q=1.0,deflate;q=0.6,identity;q=0.3
response:
Expand Down

0 comments on commit 0579c76

Please sign in to comment.