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
3 changes: 1 addition & 2 deletions Gemfile
Original file line number Diff line number Diff line change
Expand Up @@ -26,8 +26,7 @@ gem 'http_accept_language'
gem 'identity-doc-auth', github: '18F/identity-doc-auth', branch: 'v0.5.0'
gem 'identity-hostdata', github: '18F/identity-hostdata', tag: 'v2.0.0'
gem 'identity-logging', github: '18F/identity-logging', tag: 'v0.1.0'
require File.join(__dir__, 'lib', 'lambda_jobs', 'git_ref.rb')
gem 'identity-idp-functions', github: '18F/identity-idp-functions', ref: LambdaJobs::GIT_REF
gem 'identity-idp-functions', github: '18F/identity-idp-functions', ref:'d9241bdfea85a76c170e456a89'
gem 'identity-telephony', github: '18f/identity-telephony', tag: 'v0.1.12'
gem 'identity_validations', github: '18F/identity-validations', branch: 'main'
gem 'json-jwt', '>= 1.11.0'
Expand Down
2 changes: 1 addition & 1 deletion Gemfile.lock
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ GIT
GIT
remote: https://github.com/18F/identity-idp-functions.git
revision: d9241bdfea85a76c170e456a89ec6601549f4c4a
ref: d9241bdfea85a76c170e456a89ec6601549f4c4a
ref: d9241bdfea85a76c170e456a89
specs:
identity-idp-functions (0.15.2)
aamva (>= 4.0.0)
Expand Down
135 changes: 32 additions & 103 deletions app/services/idv/agent.rb
Original file line number Diff line number Diff line change
Expand Up @@ -10,11 +10,11 @@ def proof_resolution(document_capture_session, should_proof_state_id:, trace_id:
document_capture_session.result_id,
)

if FeatureManagement.ruby_workers_enabled?
encrypted_arguments = Encryption::Encryptors::SessionEncryptor.new.encrypt(
{ applicant_pii: @applicant }.to_json,
)
encrypted_arguments = Encryption::Encryptors::SessionEncryptor.new.encrypt(
{ applicant_pii: @applicant }.to_json,
)

if FeatureManagement.ruby_workers_enabled?
ResolutionProofingJob.perform_later(
encrypted_arguments: encrypted_arguments,
callback_url: callback_url,
Expand All @@ -24,40 +24,14 @@ def proof_resolution(document_capture_session, should_proof_state_id:, trace_id:
result_id: document_capture_session.result_id,
)
else
LambdaJobs::Runner.new(
job_class: Idv::Proofer.resolution_job_class,
in_process_config: {
aamva_config: {
auth_request_timeout: AppConfig.env.aamva_auth_request_timeout,
auth_url: AppConfig.env.aamva_auth_url,
cert_enabled: AppConfig.env.aamva_cert_enabled,
private_key: AppConfig.env.aamva_private_key,
public_key: AppConfig.env.aamva_public_key,
verification_request_timeout: AppConfig.env.aamva_verification_request_timeout,
verification_url: AppConfig.env.aamva_verification_url,
Comment on lines -31 to -37
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.

we still need to pass these configs in, inside the job classes now right?

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.

nevermind, I didn't realize we had copied these there already

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.

yep, all good. we'll want to test in staging to make sure the credentials make it appropriately and everything though

},
lexisnexis_config: {
instant_verify_workflow: AppConfig.env.lexisnexis_instant_verify_workflow,
account_id: AppConfig.env.lexisnexis_account_id,
base_url: AppConfig.env.lexisnexis_base_url,
username: AppConfig.env.lexisnexis_username,
password: AppConfig.env.lexisnexis_password,
request_mode: AppConfig.env.lexisnexis_request_mode,
request_timeout: AppConfig.env.lexisnexis_timeout,
},
},
args: {
applicant_pii: @applicant,
callback_url: callback_url,
should_proof_state_id: should_proof_state_id,
dob_year_only: AppConfig.env.proofing_send_partial_dob == 'true',
trace_id: trace_id,
},
).run do |idv_result|
document_capture_session.store_proofing_result(idv_result[:resolution_result])

nil
end
ResolutionProofingJob.perform_now(
encrypted_arguments: encrypted_arguments,
callback_url: callback_url,
should_proof_state_id: should_proof_state_id,
dob_year_only: AppConfig.env.proofing_send_partial_dob == 'true',
trace_id: trace_id,
result_id: document_capture_session.result_id,
)
end
end

Expand All @@ -66,37 +40,24 @@ def proof_address(document_capture_session, trace_id:)
callback_url = Rails.application.routes.url_helpers.address_proof_result_url(
document_capture_session.result_id,
)
encrypted_arguments = Encryption::Encryptors::SessionEncryptor.new.encrypt(
{ applicant_pii: @applicant }.to_json,
)

if FeatureManagement.ruby_workers_enabled?
encrypted_arguments = Encryption::Encryptors::SessionEncryptor.new.encrypt(
{ applicant_pii: @applicant }.to_json,
)
AddressProofingJob.perform_later(
encrypted_arguments: encrypted_arguments,
callback_url: callback_url,
result_id: document_capture_session.result_id,
trace_id: trace_id,
)
else
LambdaJobs::Runner.new(
job_class: Idv::Proofer.address_job_class,
args: { applicant_pii: @applicant, callback_url: callback_url, trace_id: trace_id },
in_process_config: {
lexisnexis_config: {
phone_finder_workflow: AppConfig.env.lexisnexis_phone_finder_workflow,
account_id: AppConfig.env.lexisnexis_account_id,
base_url: AppConfig.env.lexisnexis_base_url,
username: AppConfig.env.lexisnexis_username,
password: AppConfig.env.lexisnexis_password,
request_mode: AppConfig.env.lexisnexis_request_mode,
request_timeout: AppConfig.env.lexisnexis_timeout,
},
},
).run do |idv_result|
document_capture_session.store_proofing_result(idv_result[:address_result])

nil
end
AddressProofingJob.perform_now(
encrypted_arguments: encrypted_arguments,
callback_url: callback_url,
result_id: document_capture_session.result_id,
trace_id: trace_id,
)
end
end

Expand All @@ -105,11 +66,11 @@ def proof_document(document_capture_session, liveness_checking_enabled:, trace_i
result_id: document_capture_session.result_id,
)

if FeatureManagement.ruby_workers_enabled?
encrypted_arguments = Encryption::Encryptors::SessionEncryptor.new.encrypt(
{ document_arguments: @applicant }.to_json,
)
encrypted_arguments = Encryption::Encryptors::SessionEncryptor.new.encrypt(
{ document_arguments: @applicant }.to_json,
)

if FeatureManagement.ruby_workers_enabled?
DocumentProofingJob.perform_later(
encrypted_arguments: encrypted_arguments,
liveness_checking_enabled: liveness_checking_enabled,
Expand All @@ -118,46 +79,14 @@ def proof_document(document_capture_session, liveness_checking_enabled:, trace_i
trace_id: trace_id,
)
else
LambdaJobs::Runner.new(
job_class: Idv::Proofer.document_job_class,
args: {
encryption_key: @applicant[:encryption_key],
front_image_iv: @applicant[:front_image_iv],
back_image_iv: @applicant[:back_image_iv],
selfie_image_iv: @applicant[:selfie_image_iv],
front_image_url: @applicant[:front_image_url],
back_image_url: @applicant[:back_image_url],
selfie_image_url: @applicant[:selfie_image_url],
liveness_checking_enabled: liveness_checking_enabled,
callback_url: callback_url,
trace_id: trace_id,
},
).run do |doc_auth_result|
document_result = doc_auth_result.to_h.fetch(:document_result, {})
dcs = DocumentCaptureSession.new(result_id: document_capture_session.result_id)
dcs.store_doc_auth_result(
result: document_result.except(:pii_from_doc),
pii: document_result[:pii_from_doc],
)

nil
end
DocumentProofingJob.perform_now(
encrypted_arguments: encrypted_arguments,
liveness_checking_enabled: liveness_checking_enabled,
result_id: document_capture_session.result_id,
callback_url: callback_url,
trace_id: trace_id,
)
end
end

private

def init_results
{
errors: {},
messages: [],
context: {
stages: [],
},
exception: nil,
success: false,
timed_out: false,
}
end
end
end
45 changes: 0 additions & 45 deletions app/services/lambda_jobs/runner.rb

This file was deleted.

5 changes: 0 additions & 5 deletions lib/lambda_jobs/git_ref.rb

This file was deleted.

12 changes: 7 additions & 5 deletions spec/features/idv/doc_auth/document_capture_step_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -271,11 +271,8 @@

context 'when using async uploads', :js do
before do
allow(LambdaJobs::Runner).to receive(:new).
with(hash_including(job_class: Idv::Proofer.document_job_class)).
allow(DocumentProofingJob).to receive(:perform_later).
and_call_original
allow(AppConfig.env).to receive(:ruby_workers_enabled).
and_return('false')
end

it 'proceeds to the next page with valid info' do
Expand Down Expand Up @@ -309,7 +306,12 @@
click_on 'Submit'

expect(page).to have_current_path(next_step, wait: 20)
expect(LambdaJobs::Runner).to have_received(:new) do |args:, **|
expect(DocumentProofingJob).to have_received(:perform_later) do |encrypted_arguments:, **|
args = JSON.parse(
Encryption::Encryptors::SessionEncryptor.new.decrypt(encrypted_arguments),
symbolize_names: true,
)[:document_arguments]

original = File.read('app/assets/images/logo.png')

encryption_helper = IdentityIdpFunctions::EncryptionHelper.new
Expand Down
18 changes: 0 additions & 18 deletions spec/services/idv/agent_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -51,24 +51,6 @@
transaction_id: IdentityIdpFunctions::StateIdMockClient::TRANSACTION_ID,
)
end

context 'proofing partial date of birth' do
before do
allow(AppConfig.env).to receive(:proofing_send_partial_dob).and_return('true')
allow(AppConfig.env).to receive(:ruby_workers_enabled).
and_return('false')
end

it 'passes dob_year_only to the proofing function' do
expect(LambdaJobs::Runner).to receive(:new).
with(hash_including(args: hash_including(dob_year_only: true))).
and_call_original

agent.proof_resolution(
document_capture_session, should_proof_state_id: true, trace_id: trace_id
)
end
end
end

context 'proofing state_id disabled' do
Expand Down
5 changes: 0 additions & 5 deletions spec/services/lambda_jobs/git_ref_spec.rb

This file was deleted.

Loading