Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
50 commits
Select commit Hold shift + click to select a range
82084ae
Push for CI run
jmax-gsa Jan 12, 2023
293d27f
Checkpoint; about to remove ddp mock proofer
jmax-gsa Jan 13, 2023
e2c4db4
More code removed.
jmax-gsa Jan 13, 2023
c650024
Resolve style issues
kbighorse Jan 17, 2023
13112ee
Merge branch 'main' into LG-8257-modify-ddp-proofer-to-not-use-proofi…
kbighorse Jan 17, 2023
dced44a
Merge branch 'main' into LG-8257-modify-ddp-proofer-to-not-use-proofi…
kbighorse Jan 19, 2023
72394c0
Merge branch 'main' into LG-8257-modify-ddp-proofer-to-not-use-proofi…
kbighorse Jan 19, 2023
a3f92a1
Merge branch 'main' into LG-8257-modify-ddp-proofer-to-not-use-proofi…
kbighorse Jan 19, 2023
7f77e72
Merge branch 'main' into LG-8257-modify-ddp-proofer-to-not-use-proofi…
kbighorse Jan 20, 2023
ba397db
Reformat request made context
kbighorse Jan 20, 2023
d738cf8
Get back to a passing state
kbighorse Jan 20, 2023
bc50bfb
Replace inconsistent method
kbighorse Jan 20, 2023
4f6f7eb
Remove inconsistent return
kbighorse Jan 20, 2023
43114dd
Make AAMVA response consistent
kbighorse Jan 20, 2023
1388fc1
Use subject, described_class, and result consistently
kbighorse Jan 21, 2023
ef26fb3
Make spec code more consistent
kbighorse Jan 23, 2023
434eb62
Merge branch 'main' into LG-8257-modify-ddp-proofer-to-not-use-proofi…
kbighorse Jan 23, 2023
93fb324
Merge branch 'main' into LG-8257-modify-ddp-proofer-to-not-use-proofi…
kbighorse Jan 24, 2023
6ad40e4
Restore ruby version
kbighorse Jan 24, 2023
885e305
Mark unsupported methods and tests
kbighorse Jan 25, 2023
91a0b74
Mark unsupported tests and methods
kbighorse Jan 25, 2023
7c5f895
Merge branch 'main' into LG-8257-modify-ddp-proofer-to-not-use-proofi…
kbighorse Jan 25, 2023
7b52dad
Consolidate tests
kbighorse Jan 25, 2023
a44e1e7
Improve style
kbighorse Jan 25, 2023
31010f9
Restore timed_out? for resolution job
kbighorse Jan 25, 2023
5a9ec15
Use AAMVA result class
kbighorse Jan 25, 2023
7599f1f
Merge branch 'main' into LG-8257-modify-ddp-proofer-to-not-use-proofi…
kbighorse Jan 25, 2023
598722f
Satisfy resolution proofing job spec for now
kbighorse Jan 25, 2023
a39495e
Restore passing state
kbighorse Jan 26, 2023
b2410a2
Use resolution result for resolution proofer
kbighorse Jan 26, 2023
f2b754f
Define default values in resolution result constructor
kbighorse Jan 26, 2023
75fa3fe
Merge branch 'main' into LG-8257-modify-ddp-proofer-to-not-use-proofi…
kbighorse Jan 26, 2023
2903b0d
Merge branch 'main' into LG-8257-modify-ddp-proofer-to-not-use-proofi…
kbighorse Jan 26, 2023
dee29e0
Define shared lexis nexis config class
kbighorse Jan 26, 2023
13f9838
Replace one more config reference
kbighorse Jan 26, 2023
d3da395
Remove result assignment that examples override
kbighorse Jan 26, 2023
ab334e7
Align method call with block name
kbighorse Jan 26, 2023
027cb1c
Unify result classes
kbighorse Jan 27, 2023
f5200ff
Rename Result to DdpResult
kbighorse Jan 27, 2023
1b80aa3
Improve style
kbighorse Jan 27, 2023
8d76b5e
Merge branch 'main' into LG-8257-modify-ddp-proofer-to-not-use-proofi…
kbighorse Jan 27, 2023
fa2fef6
Build result like other proofers
kbighorse Jan 27, 2023
d5f542e
Remove untested methods
kbighorse Jan 27, 2023
3eff124
Restore result spec tests and failed? result method
kbighorse Jan 28, 2023
81dff18
Merge branch 'main' into LG-8257-modify-ddp-proofer-to-not-use-proofi…
kbighorse Jan 30, 2023
a86ea11
Merge branch 'main' into LG-8257-modify-ddp-proofer-to-not-use-proofi…
kbighorse Jan 31, 2023
26ed33c
Restore mock classes
kbighorse Jan 31, 2023
f55082e
Add trailing newline
kbighorse Jan 31, 2023
837d49b
Merge branch 'main' into LG-8257-modify-ddp-proofer-to-not-use-proofi…
kbighorse Feb 1, 2023
4441c65
Target RDP proofer in specs
kbighorse Feb 1, 2023
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: 2 additions & 2 deletions app/services/proofing/aamva/proofer.rb
Original file line number Diff line number Diff line change
Expand Up @@ -29,12 +29,12 @@ def initialize(config)
def proof(applicant)
aamva_applicant =
Aamva::Applicant.from_proofer_applicant(OpenStruct.new(applicant))
verification_response = Aamva::VerificationClient.new(
response = Aamva::VerificationClient.new(
config,
).send_verification_request(
applicant: aamva_applicant,
)
build_result_from_response(verification_response)
build_result_from_response(response)
rescue => exception
NewRelic::Agent.notice_error(exception)
Proofing::StateIdResult.new(
Expand Down
9 changes: 7 additions & 2 deletions app/services/proofing/address_result.rb
Original file line number Diff line number Diff line change
@@ -1,7 +1,12 @@
module Proofing
class AddressResult
attr :success, :errors, :exception, :vendor_name, :transaction_id, :reference,
:vendor_workflow
attr_reader :success,
:errors,
:exception,
:vendor_name,
:transaction_id,
:reference,
:vendor_workflow

def initialize(
success:,
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,11 @@
module Proofing
class Result
class DdpResult
attr_reader :exception
attr_accessor :context, :transaction_id, :reference, :review_status, :response_body
attr_accessor :context,
:transaction_id,
:reference,
:review_status,
:response_body

def initialize(
errors: {},
Expand All @@ -26,10 +30,6 @@ def add_error(key = :base, error)
end
# rubocop:enable Style/OptionalArguments

def attributes_requiring_additional_verification
[]
end

def errors
@errors.transform_values(&:to_a)
end
Expand All @@ -46,10 +46,6 @@ def failed?
!exception? && errors?
end

def failed_result_can_pass_with_additional_verification?
false
end

def success?
!exception? && !errors?
end
Expand Down
24 changes: 24 additions & 0 deletions app/services/proofing/lexis_nexis/config.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
module Proofing
module LexisNexis
Config = RedactedStruct.new(
:instant_verify_workflow,
:phone_finder_workflow,
:account_id,
:base_url,
:username,
:password,
:request_mode,
:request_timeout,
:org_id,
:api_key,
keyword_init: true,
allowed_members: [
:instant_verify_workflow,
:phone_finder_workflow,
:base_url,
:request_mode,
:request_timeout,
],
)
end
end
40 changes: 9 additions & 31 deletions app/services/proofing/lexis_nexis/ddp/proofer.rb
Original file line number Diff line number Diff line change
Expand Up @@ -30,57 +30,35 @@ def stage
end
end

Config = RedactedStruct.new(
:instant_verify_workflow,
:phone_finder_workflow,
:account_id,
:base_url,
:username,
:password,
:request_mode,
:request_timeout,
:org_id,
:api_key,
keyword_init: true,
allowed_members: [
:instant_verify_workflow,
:phone_finder_workflow,
:base_url,
:request_mode,
:request_timeout,
],
)

attr_reader :config

def initialize(attrs)
@config = Config.new(attrs)
end

def send_verification_request(applicant)
VerificationRequest.new(config: config, applicant: applicant).send
end

def proof(applicant)
response = send_verification_request(applicant)
process_response(response)
response = VerificationRequest.new(config: config, applicant: applicant).send
build_result_from_response(response)
rescue => exception
NewRelic::Agent.notice_error(exception)
Proofing::Result.new(exception: exception)
Proofing::DdpResult.new(exception: exception)
end

private

def process_response(response)
result = Proofing::Result.new
body = response.response_body
def build_result_from_response(verification_response)
result = Proofing::DdpResult.new
body = verification_response.response_body

result.response_body = body
result.transaction_id = body['request_id']
request_result = body['request_result']
review_status = body['review_status']

result.review_status = review_status
result.add_error(:request_result, request_result) unless request_result == 'success'
result.add_error(:review_status, review_status) unless review_status == 'pass'

result
end
end
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ class Proofer
attr_reader :config

def initialize(config)
@config = LexisNexis::Ddp::Proofer::Config.new(config)
@config = LexisNexis::Config.new(config)
end

def proof(applicant)
Expand Down
4 changes: 2 additions & 2 deletions app/services/proofing/lexis_nexis/phone_finder/proofer.rb
Original file line number Diff line number Diff line change
Expand Up @@ -5,12 +5,12 @@ class Proofer
attr_reader :config

def initialize(config)
@config = LexisNexis::Ddp::Proofer::Config.new(config)
@config = LexisNexis::Config.new(config)
end

def proof(applicant)
response = VerificationRequest.new(config: config, applicant: applicant).send
return build_result_from_response(response)
build_result_from_response(response)
rescue => exception
NewRelic::Agent.notice_error(exception)
AddressResult.new(
Expand Down
2 changes: 1 addition & 1 deletion app/services/proofing/mock/ddp_mock_client.rb
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ def stage
TRANSACTION_ID = 'ddp-mock-transaction-id-123'

def proof(applicant)
result = Proofing::Result.new
result = Proofing::DdpResult.new
result.transaction_id = TRANSACTION_ID

response_body = File.read(
Expand Down
27 changes: 17 additions & 10 deletions app/services/proofing/resolution_result.rb
Original file line number Diff line number Diff line change
@@ -1,15 +1,22 @@
module Proofing
class ResolutionResult
attr_reader :success, :errors, :exception, :vendor_name, :transaction_id, :verified_attributes,
attr_reader :errors,
:exception,
:success,
:vendor_name,
:transaction_id,
:verified_attributes,
:failed_result_can_pass_with_additional_verification,
:attributes_requiring_additional_verification,
:reference, :vendor_workflow, :drivers_license_check_info
:reference,
:vendor_workflow,
:drivers_license_check_info

def initialize(
success:,
errors:,
exception:,
vendor_name:,
success: nil,
errors: {},
exception: nil,
vendor_name: nil,
transaction_id: '',
reference: '',
failed_result_can_pass_with_additional_verification: false,
Expand Down Expand Up @@ -39,10 +46,6 @@ def timed_out?
exception.is_a?(Proofing::TimeoutError)
end

def failed_result_can_pass_with_additional_verification?
failed_result_can_pass_with_additional_verification
end

def to_h
{
success: success?,
Expand All @@ -58,5 +61,9 @@ def to_h
drivers_license_check_info: drivers_license_check_info,
}
end

def failed_result_can_pass_with_additional_verification?
failed_result_can_pass_with_additional_verification
end
end
end
15 changes: 10 additions & 5 deletions app/services/proofing/state_id_result.rb
Original file line number Diff line number Diff line change
@@ -1,12 +1,17 @@
module Proofing
class StateIdResult
attr_reader :success, :errors, :exception, :vendor_name, :transaction_id, :verified_attributes
attr_reader :errors,
:exception,
:success,
:vendor_name,
:transaction_id,
:verified_attributes

def initialize(
success:,
errors:,
exception:,
vendor_name:,
success: nil,
errors: {},
exception: nil,
vendor_name: nil,
transaction_id: '',
verified_attributes: []
)
Expand Down
12 changes: 6 additions & 6 deletions spec/jobs/resolution_proofing_job_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -320,9 +320,9 @@
context 'with a successful response from the proofer' do
before do
expect(resolution_proofer).to receive(:proof).
and_return(Proofing::Result.new)
and_return(Proofing::ResolutionResult.new)
expect(state_id_proofer).to receive(:proof).
and_return(Proofing::Result.new)
and_return(Proofing::StateIdResult.new)
Proofing::Mock::DeviceProfilingBackend.new.record_profiling_result(
session_id: threatmetrix_session_id,
result: 'pass',
Expand Down Expand Up @@ -355,7 +355,7 @@
end

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

before do
expect(ddp_proofer).to receive(:proof).and_return(ddp_result)
Expand All @@ -381,9 +381,9 @@
context 'does call state id with an unsuccessful response from the proofer' do
it 'posts back to the callback url' do
expect(resolution_proofer).to receive(:proof).
and_return(Proofing::Result.new(exception: 'error'))
and_return(Proofing::ResolutionResult.new(exception: 'error'))
expect(state_id_proofer).to receive(:proof).
and_return(Proofing::Result.new)
and_return(Proofing::StateIdResult.new)

perform
end
Expand All @@ -394,7 +394,7 @@

it 'does not call state_id proof if resolution proof is successful' do
expect(resolution_proofer).to receive(:proof).
and_return(Proofing::Result.new)
and_return(Proofing::ResolutionResult.new)

expect(state_id_proofer).not_to receive(:proof)
perform
Expand Down
6 changes: 4 additions & 2 deletions spec/services/idv/steps/verify_wait_step_show_spec.rb
Original file line number Diff line number Diff line change
@@ -1,13 +1,15 @@
require 'rails_helper'

describe Idv::Steps::VerifyWaitStepShow do
TRANSACTION_ID = 'ddp-mock-transaction-id-123'

include Rails.application.routes.url_helpers

let(:user) { build(:user) }
let(:issuer) { 'test_issuer' }
let(:service_provider) { build(:service_provider, issuer: issuer) }
let(:resolution_transaction_id) { Proofing::Mock::ResolutionMockClient::TRANSACTION_ID }
let(:threatmetrix_transaction_id) { Proofing::Mock::DdpMockClient::TRANSACTION_ID }
let(:resolution_transaction_id) { TRANSACTION_ID }
let(:threatmetrix_transaction_id) { TRANSACTION_ID }

let(:request) { FakeRequest.new }

Expand Down
6 changes: 5 additions & 1 deletion spec/services/proofing/aamva/proofing_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -5,13 +5,15 @@
let(:aamva_applicant) do
Aamva::Applicant.from_proofer_applicant(OpenStruct.new(state_id_data))
end

let(:state_id_data) do
{
state_id_number: '1234567890',
state_id_jurisdiction: 'VA',
state_id_type: 'drivers_license',
}
end

let(:verification_results) do
{
state_id_number: true,
Expand All @@ -25,7 +27,9 @@
}
end

subject { described_class.new(AamvaFixtures.example_config.to_h) }
subject do
described_class.new(AamvaFixtures.example_config.to_h)
end

let(:verification_response) { AamvaFixtures.verification_response }

Expand Down
Loading