Skip to content
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

LG-14988 Send additional attributes to AAMVA #11565

Open
wants to merge 2 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
22 changes: 22 additions & 0 deletions app/services/proofing/aamva/applicant.rb
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,13 @@ module Aamva
:uuid,
:first_name,
:last_name,
:middle_name,
:name_suffix,
:dob,
:height,
:sex,
:weight,
:eye_color,
:state_id_data,
:address1,
:address2,
Expand All @@ -32,7 +38,13 @@ def self.from_proofer_applicant(applicant)
uuid: applicant[:uuid],
first_name: applicant[:first_name],
last_name: applicant[:last_name],
middle_name: applicant[:middle_name],
name_suffix: applicant[:name_suffix],
dob: format_dob(applicant[:dob]),
sex: applicant[:sex],
height: format_height(applicant[:height]),
weight: applicant[:weight],
eye_color: applicant[:eye_color],
state_id_data: format_state_id_data(applicant),
address1: applicant[:address1],
address2: applicant[:address2],
Expand Down Expand Up @@ -70,6 +82,16 @@ def self.from_proofer_applicant(applicant)
state_id_expiration: applicant[:state_id_expiration],
)
end

private_class_method def self.format_height(height)
return if height.nil?

# From the AAMVA DLDV guide regarding formatting the height:
#
# The height is provided in feet-inches (i.e. 5 foot 10 inches is presented as "510").
#
[(height / 12).to_s, (height % 12).to_s].join('')
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Do we need to zero-pad inches? E.g., if someone is 61" tall, are they 51 or 501?

end
end.freeze
end
end
57 changes: 57 additions & 0 deletions app/services/proofing/aamva/request/verification_request.rb
Original file line number Diff line number Diff line change
Expand Up @@ -63,6 +63,45 @@ def add_user_provided_data_to_body
REXML::XPath.first(document, xpath).add_text(data)
end

if IdentityConfig.store.aamva_send_middle_name
add_optional_element(
'nc:PersonMiddleName',
value: applicant.middle_name,
document:,
inside: '//nc:PersonName',
)
end

add_optional_element(
'nc:PersonNameSuffixText',
value: applicant.name_suffix,
document:,
inside: '//nc:PersonName',
)

add_optional_element(
'aa:PersonHeightMeasure',
value: applicant.height,
document:,
inside: '//dldv:verifyDriverLicenseDataRequest',
)

add_optional_element(
'aa:PersonWeightMeasure',
value: applicant.weight,
document:,
inside: '//dldv:verifyDriverLicenseDataRequest',
)

add_optional_element(
'aa:PersonEyeColorCode',
value: applicant.eye_color,
document:,
inside: '//dldv:verifyDriverLicenseDataRequest',
)

add_sex_code(applicant.sex, document)

add_optional_element(
'nc:AddressDeliveryPointText',
value: applicant.address2,
Expand Down Expand Up @@ -114,6 +153,24 @@ def add_state_id_type(id_type, document)
end
end

def add_sex_code(sex_value, document)
sex_code = case sex_value
when 'male'
1
when 'female'
2
end
n1zyy marked this conversation as resolved.
Show resolved Hide resolved

if sex_code
add_optional_element(
'aa:PersonSexCode',
value: sex_code,
document:,
inside: '//dldv:verifyDriverLicenseDataRequest',
)
end
end

def add_optional_element(name, value:, document:, inside: nil, after: nil)
return if value.blank?

Expand Down
6 changes: 6 additions & 0 deletions app/services/proofing/aamva/response/verification_response.rb
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,14 @@ class VerificationResponse
'DriverLicenseNumberMatchIndicator' => :state_id_number,
'DocumentCategoryMatchIndicator' => :state_id_type,
'PersonBirthDateMatchIndicator' => :dob,
'PersonHeightMatchIndicator' => :height,
'PersonSexCodeMatchIndicator' => :sex,
'PersonWeightMatchIndicator' => :weight,
'PersonEyeColorMatchIndicator' => :eye_color,
'PersonLastNameExactMatchIndicator' => :last_name,
'PersonFirstNameExactMatchIndicator' => :first_name,
'PersonMiddleNameExactMatchIndicator' => :middle_name,
'PersonNameSuffixMatchIndicator' => :name_suffix,
'AddressLine1MatchIndicator' => :address1,
'AddressLine2MatchIndicator' => :address2,
'AddressCityMatchIndicator' => :city,
Expand Down
2 changes: 2 additions & 0 deletions config/application.yml.default
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ aamva_cert_enabled: true
aamva_private_key: ''
aamva_public_key: ''
aamva_send_id_type: true
aamva_send_middle_name: true
aamva_supported_jurisdictions: '["AL","AR","AZ","CO","CT","DC","DE","FL","GA","HI","IA","ID","IL","IN","KS","KY","MA","MD","ME","MI","MO","MS","MT","NC","ND","NE","NJ","NM","NV","OH","OR","PA","RI","SC","SD","TN","TX","VA","VT","WA","WI","WV","WY"]'
aamva_verification_request_timeout: 5.0
aamva_verification_url: https://example.org:12345/verification/url
Expand Down Expand Up @@ -502,6 +503,7 @@ development:
production:
aamva_auth_url: 'https://authentication-cert.aamva.org/Authentication/Authenticate.svc'
aamva_send_id_type: false
aamva_send_middle_name: false
aamva_verification_url: 'https://verificationservices-cert.aamva.org:18449/dldv/2.1/online'
available_locales: 'en,es,fr'
disable_email_sending: false
Expand Down
1 change: 1 addition & 0 deletions lib/identity_config.rb
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,7 @@ def self.store
config.add(:aamva_private_key, type: :string)
config.add(:aamva_public_key, type: :string)
config.add(:aamva_send_id_type, type: :boolean)
config.add(:aamva_send_middle_name, type: :boolean)
config.add(:aamva_supported_jurisdictions, type: :json)
config.add(:aamva_verification_request_timeout, type: :float)
config.add(:aamva_verification_url)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,16 +11,24 @@
<DriverLicenseIssueDateMatchIndicator>true</DriverLicenseIssueDateMatchIndicator>
<DriverLicenseExpirationDateMatchIndicator>true</DriverLicenseExpirationDateMatchIndicator>
<PersonBirthDateMatchIndicator>true</PersonBirthDateMatchIndicator>
<PersonSexCodeMatchIndicator>true</PersonSexCodeMatchIndicator>
<PersonHeightMatchIndicator>true</PersonHeightMatchIndicator>
<PersonWeightMatchIndicator>true</PersonWeightMatchIndicator>
<PersonEyeColorMatchIndicator>true</PersonEyeColorMatchIndicator>
<PersonLastNameExactMatchIndicator>true</PersonLastNameExactMatchIndicator>
<PersonLastNameFuzzyPrimaryMatchIndicator>true</PersonLastNameFuzzyPrimaryMatchIndicator>
<PersonLastNameFuzzyAlternateMatchIndicator>true</PersonLastNameFuzzyAlternateMatchIndicator>
<PersonFirstNameExactMatchIndicator>true</PersonFirstNameExactMatchIndicator>
<PersonFirstNameFuzzyPrimaryMatchIndicator>true</PersonFirstNameFuzzyPrimaryMatchIndicator>
<PersonFirstNameFuzzyAlternateMatchIndicator>true</PersonFirstNameFuzzyAlternateMatchIndicator>
<PersonMiddleNameExactMatchIndicator>true</PersonMiddleNameExactMatchIndicator>
<PersonMiddleNameFuzzyPrimaryMatchIndicator>true</PersonMiddleNameFuzzyPrimaryMatchIndicator>
<PersonMiddleNameFuzzyAlternateMatchIndicator>true</PersonMiddleNameFuzzyAlternateMatchIndicator>
<PersonNameSuffixMatchIndicator>true</PersonNameSuffixMatchIndicator>
<DocumentCategoryMatchIndicator>true</DocumentCategoryMatchIndicator>
<AddressLine1MatchIndicator>true</AddressLine1MatchIndicator>
<AddressLine2MatchIndicator>true</AddressLine2MatchIndicator>
<AddressCityMatchIndicator>true</AddressCityMatchIndicator>
<AddressStateCodeMatchIndicator>true</AddressStateCodeMatchIndicator>
<AddressZIP5MatchIndicator>true</AddressZIP5MatchIndicator>
</dldv:VerifyDriverLicenseDataResponse>
</dldv:VerifyDriverLicenseDataResponse>
Original file line number Diff line number Diff line change
Expand Up @@ -20,8 +20,14 @@
<DriverLicenseExpirationDateMatchIndicator xmlns="http://aamva.org/niem/extensions/1.0">true</DriverLicenseExpirationDateMatchIndicator>
<DocumentCategoryMatchIndicator xmlns="http://aamva.org/niem/extensions/1.0">true</DocumentCategoryMatchIndicator>
<PersonBirthDateMatchIndicator xmlns="http://aamva.org/niem/extensions/1.0">true</PersonBirthDateMatchIndicator>
<PersonSexCodeMatchIndicator xmlns="http://aamva.org/niem/extensions/1.0">true</PersonSexCodeMatchIndicator>
<PersonHeightMatchIndicator xmlns="http://aamva.org/niem/extensions/1.0">true</PersonHeightMatchIndicator>
<PersonWeightMatchIndicator xmlns="http://aamva.org/niem/extensions/1.0">true</PersonWeightMatchIndicator>
<PersonEyeColorMatchIndicator xmlns="http://aamva.org/niem/extensions/1.0">true</PersonEyeColorMatchIndicator>
<PersonLastNameExactMatchIndicator xmlns="http://aamva.org/niem/extensions/1.0">true</PersonLastNameExactMatchIndicator>
<PersonFirstNameExactMatchIndicator xmlns="http://aamva.org/niem/extensions/1.0">true</PersonFirstNameExactMatchIndicator>
<PersonMiddleNameExactMatchIndicator xmlns="http://aamva.org/niem/extensions/1.0">true</PersonMiddleNameExactMatchIndicator>
<PersonNameSuffixMatchIndicator xmlns="http://aamva.org/niem/extensions/1.0">true</PersonNameSuffixMatchIndicator>
<AddressLine1MatchIndicator xmlns="http://aamva.org/niem/extensions/1.0">true</AddressLine1MatchIndicator>
<AddressLine2MatchIndicator xmlns="http://aamva.org/niem/extensions/1.0">true</AddressLine2MatchIndicator>
<AddressCityMatchIndicator xmlns="http://aamva.org/niem/extensions/1.0">true</AddressCityMatchIndicator>
Expand All @@ -30,4 +36,4 @@
</VerifyDriverLicenseDataResult>
</VerifyDriverLicenseDataResponse>
</s:Body>
</s:Envelope>
</s:Envelope>
27 changes: 24 additions & 3 deletions spec/jobs/resolution_proofing_job_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -121,9 +121,16 @@
state_id_expiration
state_id_issued
state_id_number
state_id_type dob
state_id_type
dob
last_name
first_name
middle_name
name_suffix
height
sex
weight
eye_color
],
)

Expand Down Expand Up @@ -213,9 +220,16 @@
state_id_expiration
state_id_issued
state_id_number
state_id_type dob
state_id_type
dob
last_name
first_name
middle_name
name_suffix
height
sex
weight
eye_color
],
)
end
Expand Down Expand Up @@ -446,9 +460,16 @@
state_id_expiration
state_id_issued
state_id_number
state_id_type dob
state_id_type
dob
last_name
first_name
middle_name
name_suffix
height
sex
weight
eye_color
],
)

Expand Down
8 changes: 8 additions & 0 deletions spec/services/proofing/aamva/applicant_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -64,4 +64,12 @@

expect(aamva_applicant[:dob]).to eq('')
end

it 'should format the height' do
proofer_applicant[:height] = 73
aamva_applicant = Proofing::Aamva::Applicant.from_proofer_applicant(proofer_applicant)

# This is intended to describe 6'1"
expect(aamva_applicant[:height]).to eq('61')
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Oh, provided this matches what AAMVA says, this answers my first question about padding.

end
end
Loading