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
4 changes: 3 additions & 1 deletion app/services/proofing/result.rb
Original file line number Diff line number Diff line change
Expand Up @@ -8,13 +8,15 @@ def initialize(
context: {},
exception: nil,
transaction_id: nil,
reference: nil
reference: nil,
response_body: nil
)
@errors = errors
@context = context
@exception = exception
@transaction_id = transaction_id
@reference = reference
@response_body = response_body
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

regretting I named this response_body since it's a hash

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

It's just code, we can always rename it

end

# rubocop:disable Style/OptionalArguments
Expand Down
19 changes: 19 additions & 0 deletions spec/jobs/resolution_proofing_job_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,7 @@
let(:state_id_proofer) do
instance_double(Proofing::Aamva::Proofer, class: Proofing::Aamva::Proofer)
end
let(:ddp_proofer) { Proofing::Mock::DdpMockClient.new }
let(:trace_id) { SecureRandom.uuid }
let(:user) { create(:user, :signed_up) }
let(:threatmetrix_session_id) { SecureRandom.uuid }
Expand Down Expand Up @@ -256,6 +257,7 @@
before do
allow(instance).to receive(:resolution_proofer).and_return(resolution_proofer)
allow(instance).to receive(:state_id_proofer).and_return(state_id_proofer)
allow(instance).to receive(:lexisnexis_ddp_proofer).and_return(ddp_proofer)
allow(IdentityConfig.store).to receive(:lexisnexis_threatmetrix_enabled).
and_return(true)
end
Expand Down Expand Up @@ -292,6 +294,23 @@
expect(proofing_component.threatmetrix).to equal(true)
expect(proofing_component.threatmetrix_review_status).to eq('pass')
end

context 'nil response body from ddp' do
let(:ddp_result) { Proofing::Result.new(response_body: nil) }

before do
expect(ddp_proofer).to receive(:proof).and_return(ddp_result)
end

it 'does not blow up' do
perform

result = document_capture_session.load_proofing_result[:result]

expect(result[:context][:stages][:threatmetrix][:response_body]).
to eq(error: 'TMx response body was empty')
end
end
end

context 'does not call state id with an unsuccessful response from the proofer' do
Expand Down