Skip to content
Merged
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
62 changes: 33 additions & 29 deletions app/services/proofing/aamva/request/templates/verify.xml.erb
Original file line number Diff line number Diff line change
@@ -1,37 +1,41 @@
<soap:Envelope xmlns:soap="http://www.w3.org/2003/05/soap-envelope" xmlns:ns="http://aamva.org/dldv/wsdl/2.1" xmlns:ns1="http://aamva.org/niem/extensions/1.0" xmlns:ns2="http://niem.gov/niem/niem-core/2.0">
<soap:Envelope
xmlns:soap="http://www.w3.org/2003/05/soap-envelope"
xmlns:dldv="http://aamva.org/dldv/wsdl/2.1"
xmlns:aa="http://aamva.org/niem/extensions/1.0"
xmlns:nc="http://niem.gov/niem/niem-core/2.0">
<soap:Header xmlns:wsa="http://www.w3.org/2005/08/addressing">
<wsa:Action>http://aamva.org/dldv/wsdl/2.1/IDLDVService21/VerifyDriverLicenseData</wsa:Action>
</soap:Header>
<soap:Body>
<ns:VerifyDriverLicenseData>
<ns:token>
<dldv:VerifyDriverLicenseData>
<dldv:token>
<%= auth_token %>
</ns:token>
<ns:verifyDriverLicenseDataRequest>
<ns1:ControlData>
<ns1:MessageAddress>
<ns1:TransactionLocatorId>
</dldv:token>
<dldv:verifyDriverLicenseDataRequest>
<aa:ControlData>
<aa:MessageAddress>
<aa:TransactionLocatorId>
<%= transaction_locator_id %>
</ns1:TransactionLocatorId>
<ns1:MessageOriginatorId>GSA</ns1:MessageOriginatorId>
<ns1:MessageDestinationId></ns1:MessageDestinationId>
</ns1:MessageAddress>
</ns1:ControlData>
<ns2:DriverLicenseIdentification>
<ns2:IdentificationID xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:type="ns2:PersonNameTextType"></ns2:IdentificationID>
</ns2:DriverLicenseIdentification>
<ns1:PersonBirthDate></ns1:PersonBirthDate>
<ns2:PersonName>
<ns2:PersonGivenName></ns2:PersonGivenName>
<ns2:PersonSurName></ns2:PersonSurName>
</ns2:PersonName>
<ns1:Address>
<ns2:AddressDeliveryPointText></ns2:AddressDeliveryPointText>
<ns2:LocationCityName></ns2:LocationCityName>
<ns2:LocationStateUsPostalServiceCode></ns2:LocationStateUsPostalServiceCode>
<ns2:LocationPostalCode></ns2:LocationPostalCode>
</ns1:Address>
</ns:verifyDriverLicenseDataRequest>
</ns:VerifyDriverLicenseData>
</aa:TransactionLocatorId>
<aa:MessageOriginatorId>GSA</aa:MessageOriginatorId>
<aa:MessageDestinationId></aa:MessageDestinationId>
</aa:MessageAddress>
</aa:ControlData>
<nc:DriverLicenseIdentification>
<nc:IdentificationID xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:type="nc:PersonNameTextType"></nc:IdentificationID>
</nc:DriverLicenseIdentification>
<aa:PersonBirthDate></aa:PersonBirthDate>
<nc:PersonName>
<nc:PersonGivenName></nc:PersonGivenName>
<nc:PersonSurName></nc:PersonSurName>
</nc:PersonName>
<aa:Address>
<nc:AddressDeliveryPointText></nc:AddressDeliveryPointText>
<nc:LocationCityName></nc:LocationCityName>
<nc:LocationStateUsPostalServiceCode></nc:LocationStateUsPostalServiceCode>
<nc:LocationPostalCode></nc:LocationPostalCode>
</aa:Address>
</dldv:verifyDriverLicenseDataRequest>
</dldv:VerifyDriverLicenseData>
</soap:Body>
</soap:Envelope>
30 changes: 15 additions & 15 deletions app/services/proofing/aamva/request/verification_request.rb
Original file line number Diff line number Diff line change
Expand Up @@ -64,24 +64,24 @@ def add_user_provided_data_to_body
end

add_optional_element(
'ns2:AddressDeliveryPointText',
'nc:AddressDeliveryPointText',
value: applicant.address2,
document:,
after: '//ns1:Address/ns2:AddressDeliveryPointText',
after: '//aa:Address/nc:AddressDeliveryPointText',
)

add_optional_element(
'ns2:DriverLicenseIssueDate',
'aa:DriverLicenseIssueDate',
value: applicant.state_id_data.state_id_issued,
document:,
inside: '//ns:verifyDriverLicenseDataRequest',
inside: '//dldv:verifyDriverLicenseDataRequest',
)

add_optional_element(
'ns2:DriverLicenseExpirationDate',
'aa:DriverLicenseExpirationDate',
value: applicant.state_id_data.state_id_expiration,
document:,
inside: '//ns:verifyDriverLicenseDataRequest',
inside: '//dldv:verifyDriverLicenseDataRequest',
)

@body = document.to_s
Expand Down Expand Up @@ -142,15 +142,15 @@ def transaction_locator_id

def user_provided_data_map
{
'//ns2:IdentificationID' => state_id_number,
'//ns1:MessageDestinationId' => message_destination_id,
'//ns2:PersonGivenName' => applicant.first_name,
'//ns2:PersonSurName' => applicant.last_name,
'//ns1:PersonBirthDate' => applicant.dob,
'//ns2:AddressDeliveryPointText' => applicant.address1,
'//ns2:LocationCityName' => applicant.city,
'//ns2:LocationStateUsPostalServiceCode' => applicant.state,
'//ns2:LocationPostalCode' => applicant.zipcode,
'//nc:IdentificationID' => state_id_number,
'//aa:MessageDestinationId' => message_destination_id,
'//nc:PersonGivenName' => applicant.first_name,
'//nc:PersonSurName' => applicant.last_name,
'//aa:PersonBirthDate' => applicant.dob,
'//nc:AddressDeliveryPointText' => applicant.address1,
'//nc:LocationCityName' => applicant.city,
'//nc:LocationStateUsPostalServiceCode' => applicant.state,
'//nc:LocationPostalCode' => applicant.zipcode,
}
end

Expand Down
58 changes: 29 additions & 29 deletions spec/fixtures/proofing/aamva/requests/verification_request.xml
Original file line number Diff line number Diff line change
@@ -1,37 +1,37 @@
<soap:Envelope xmlns:ns='http://aamva.org/dldv/wsdl/2.1' xmlns:ns1='http://aamva.org/niem/extensions/1.0' xmlns:ns2='http://niem.gov/niem/niem-core/2.0' xmlns:soap='http://www.w3.org/2003/05/soap-envelope'>
<soap:Envelope xmlns:aa='http://aamva.org/niem/extensions/1.0' xmlns:dldv='http://aamva.org/dldv/wsdl/2.1' xmlns:nc='http://niem.gov/niem/niem-core/2.0' xmlns:soap='http://www.w3.org/2003/05/soap-envelope'>
<soap:Header xmlns:wsa='http://www.w3.org/2005/08/addressing'>
<wsa:Action>http://aamva.org/dldv/wsdl/2.1/IDLDVService21/VerifyDriverLicenseData</wsa:Action>
</soap:Header>
<soap:Body>
<ns:VerifyDriverLicenseData>
<ns:token>
<dldv:VerifyDriverLicenseData>
<dldv:token>
KEYKEYKEY
</ns:token>
<ns:verifyDriverLicenseDataRequest>
<ns1:ControlData>
<ns1:MessageAddress>
<ns1:TransactionLocatorId>
</dldv:token>
<dldv:verifyDriverLicenseDataRequest>
<aa:ControlData>
<aa:MessageAddress>
<aa:TransactionLocatorId>
1234-abcd-efgh
</ns1:TransactionLocatorId>
<ns1:MessageOriginatorId>GSA</ns1:MessageOriginatorId>
<ns1:MessageDestinationId>CA</ns1:MessageDestinationId>
</ns1:MessageAddress>
</ns1:ControlData>
<ns2:DriverLicenseIdentification>
<ns2:IdentificationID xsi:type='ns2:PersonNameTextType' xmlns:xsi='http://www.w3.org/2001/XMLSchema-instance'>123456789</ns2:IdentificationID>
</ns2:DriverLicenseIdentification>
<ns1:PersonBirthDate>1942-10-29</ns1:PersonBirthDate>
<ns2:PersonName>
<ns2:PersonGivenName>Testy</ns2:PersonGivenName>
<ns2:PersonSurName>McTesterson</ns2:PersonSurName>
</ns2:PersonName>
<ns1:Address>
<ns2:AddressDeliveryPointText>123 Sunnyside way</ns2:AddressDeliveryPointText>
<ns2:LocationCityName>Sterling</ns2:LocationCityName>
<ns2:LocationStateUsPostalServiceCode>VA</ns2:LocationStateUsPostalServiceCode>
<ns2:LocationPostalCode>20176</ns2:LocationPostalCode>
</ns1:Address>
</ns:verifyDriverLicenseDataRequest>
</ns:VerifyDriverLicenseData>
</aa:TransactionLocatorId>
<aa:MessageOriginatorId>GSA</aa:MessageOriginatorId>
<aa:MessageDestinationId>CA</aa:MessageDestinationId>
</aa:MessageAddress>
</aa:ControlData>
<nc:DriverLicenseIdentification>
<nc:IdentificationID xsi:type='nc:PersonNameTextType' xmlns:xsi='http://www.w3.org/2001/XMLSchema-instance'>123456789</nc:IdentificationID>
</nc:DriverLicenseIdentification>
<aa:PersonBirthDate>1942-10-29</aa:PersonBirthDate>
<nc:PersonName>
<nc:PersonGivenName>Testy</nc:PersonGivenName>
<nc:PersonSurName>McTesterson</nc:PersonSurName>
</nc:PersonName>
<aa:Address>
<nc:AddressDeliveryPointText>123 Sunnyside way</nc:AddressDeliveryPointText>
<nc:LocationCityName>Sterling</nc:LocationCityName>
<nc:LocationStateUsPostalServiceCode>VA</nc:LocationStateUsPostalServiceCode>
<nc:LocationPostalCode>20176</nc:LocationPostalCode>
</aa:Address>
</dldv:verifyDriverLicenseDataRequest>
</dldv:VerifyDriverLicenseData>
</soap:Body>
</soap:Envelope>
2 changes: 1 addition & 1 deletion spec/lib/aamva_test_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@

expect(WebMock).to(
have_requested(:post, verification_url).with do |req|
expect(Nokogiri::XML(req.body).at_xpath('//ns1:MessageDestinationId').text).
expect(Nokogiri::XML(req.body).at_xpath('//aa:MessageDestinationId').text).
to eq('P6'), 'it sends a request with the designated fake state'
end,
)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,10 @@
applicant.address2 = 'Apt 1'

document = REXML::Document.new(subject.body)
address_node = REXML::XPath.first(document, '//ns:verifyDriverLicenseDataRequest/ns1:Address')
address_node = REXML::XPath.first(
document,
'//dldv:verifyDriverLicenseDataRequest/aa:Address',
)

address_node_element_names = address_node.elements.map(&:name)
address_node_element_values = address_node.elements.map(&:text)
Expand Down Expand Up @@ -75,14 +78,14 @@
it 'includes issue date if present' do
applicant.state_id_data.state_id_issued = '2024-05-06'
expect(subject.body).to include(
'<ns2:DriverLicenseIssueDate>2024-05-06</ns2:DriverLicenseIssueDate>',
'<aa:DriverLicenseIssueDate>2024-05-06</aa:DriverLicenseIssueDate>',
)
end

it 'includes expiration date if present' do
applicant.state_id_data.state_id_expiration = '2030-01-02'
expect(subject.body).to include(
'<ns2:DriverLicenseExpirationDate>2030-01-02</ns2:DriverLicenseExpirationDate>',
'<aa:DriverLicenseExpirationDate>2030-01-02</aa:DriverLicenseExpirationDate>',
)
end
end
Expand Down Expand Up @@ -156,7 +159,7 @@
let(:state_id_jurisdiction) { 'SC' }
let(:rendered_state_id_number) do
body = REXML::Document.new(subject.body)
REXML::XPath.first(body, '//ns2:IdentificationID')&.text
REXML::XPath.first(body, '//nc:IdentificationID')&.text
end

context 'id is greater than 8 digits' do
Expand Down
2 changes: 1 addition & 1 deletion spec/services/proofing/aamva/verification_client_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@
verification_stub = stub_request(:post, AamvaFixtures.example_config.verification_url).
to_return(body: AamvaFixtures.verification_response, status: 200).
with do |request|
xml_text_at_path(request.body, '//ns:token').gsub(/\s/, '') == 'ThisIsTheToken'
xml_text_at_path(request.body, '//dldv:token').gsub(/\s/, '') == 'ThisIsTheToken'
end

verification_client.send_verification_request(
Expand Down