Skip to content

Commit

Permalink
Resolving pr comments removing unneeded code
Browse files Browse the repository at this point in the history
  • Loading branch information
AShukla-GSA committed Nov 25, 2024
1 parent f676230 commit 215f44a
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 19 deletions.
2 changes: 1 addition & 1 deletion app/controllers/socure_webhook_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ def fetch_results
if IdentityConfig.store.ruby_workers_idv_enabled
SocureDocvResultsJob.perform_later(document_capture_session_uuid: dcs.uuid)
else
SocureDocvResultsJob.perform_now(document_capture_session_uuid: dcs.uuid)
SocureDocvResultsJob.perform_now(document_capture_session_uuid: dcs.uuid, async: false)
end
end

Expand Down
18 changes: 5 additions & 13 deletions app/jobs/socure_docv_results_job.rb
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,9 @@ class SocureDocvResultsJob < ApplicationJob
attr_reader :document_capture_session_uuid, :async

# @param [String] document_capture_session_uuid
def perform(document_capture_session_uuid:)
def perform(document_capture_session_uuid:, async: true)
@document_capture_session_uuid = document_capture_session_uuid
@async = IdentityConfig.store.ruby_workers_idv_enabled
@async = async

raise "DocumentCaptureSession not found: #{document_capture_session_uuid}" unless
document_capture_session
Expand Down Expand Up @@ -37,25 +37,17 @@ def log_verification_request(docv_result_response:, vendor_request_time_in_ms:)
return if docv_result_response.nil?

analytics.idv_socure_verification_data_requested(
**filtered_verification_data(docv_result_response).merge(
**docv_result_response.to_h.merge(
docv_transaction_token: document_capture_session.socure_docv_transaction_token,
submit_attempts: rate_limiter&.attempts,
remaining_submit_attempts: rate_limiter&.remaining_count,
vendor_request_time_in_ms:,
async:,
).compact,
).except(:attention_with_barcode, :selfie_live, :selfie_quality_good,
:selfie_status).compact,
)
end

def filtered_verification_data(docv_result_response)
hash = docv_result_response.to_h
hash.delete(:attention_with_barcode)
hash.delete(:selfie_live)
hash.delete(:selfie_quality_good)
hash.delete(:selfie_status)
hash
end

def socure_document_verification_result
DocAuth::Socure::Requests::DocvResultRequest.new(
document_capture_session_uuid:,
Expand Down
9 changes: 4 additions & 5 deletions spec/jobs/socure_docv_results_job_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,9 @@
subject(:perform) do
job.perform(document_capture_session_uuid: document_capture_session_uuid)
end
subject(:perform_now) do
job.perform(document_capture_session_uuid: document_capture_session_uuid, async: false)
end

let(:socure_response_body) do
# ID+ v3.0 API Predictive Document Verification response
Expand Down Expand Up @@ -110,8 +113,6 @@
end

it 'expect fake analytics to have logged idv_socure_verification_data_requested' do
allow(IdentityConfig.store).to receive(:ruby_workers_idv_enabled).
and_return(true)
perform
expect(fake_analytics).to have_logged_event(
:idv_socure_verification_data_requested,
Expand All @@ -122,9 +123,7 @@
end

it 'expect log with perform_now to have async eq false' do
allow(IdentityConfig.store).to receive(:ruby_workers_idv_enabled).
and_return(false)
perform
perform_now
expect(fake_analytics).to have_logged_event(
:idv_socure_verification_data_requested,
hash_including(
Expand Down

0 comments on commit 215f44a

Please sign in to comment.