diff --git a/app/services/doc_auth/lexis_nexis/requests/true_id_request.rb b/app/services/doc_auth/lexis_nexis/requests/true_id_request.rb index 01762f35d18..31a37282838 100644 --- a/app/services/doc_auth/lexis_nexis/requests/true_id_request.rb +++ b/app/services/doc_auth/lexis_nexis/requests/true_id_request.rb @@ -32,8 +32,8 @@ def body Back: encode(back_image), Selfie: (encode(selfie_image) if include_liveness?), DocumentType: 'DriversLicense', - }, - }.compact + }.compact, + } settings.merge(document).to_json end diff --git a/spec/services/doc_auth/lexis_nexis/requests/true_id_request_spec.rb b/spec/services/doc_auth/lexis_nexis/requests/true_id_request_spec.rb index e2b235bb97e..33abcc154b1 100644 --- a/spec/services/doc_auth/lexis_nexis/requests/true_id_request_spec.rb +++ b/spec/services/doc_auth/lexis_nexis/requests/true_id_request_spec.rb @@ -89,6 +89,12 @@ let(:workflow) { 'test_workflow' } let(:image_source) { DocAuth::ImageSources::ACUANT_SDK } it_behaves_like 'a successful request' + + it 'does not include a nil selfie in the request body sent to TrueID' do + body_as_json = subject.send(:body) + body_as_hash = JSON.parse(body_as_json) + expect(body_as_hash['Document']).not_to have_key('Selfie') + end end context 'with unknown image source' do let(:workflow) { 'test_workflow_cropping' }