Skip to content

Commit

Permalink
LG-13671: ProofingComponents to store real vendor used to verify docu…
Browse files Browse the repository at this point in the history
…ment PII

**Why**

* Prior to this change, we always stored 'aamva' as in a user's
  proofing_components.source_check column regardless of whether a call
  to AAMVA was made or not. Accuracy is good and storing the actual
  "vendor_name" will align our analytics across our events.

**How**

* Instead of hard-coding `vendor_name` in
  `proofing_components.source_check`, we dig into the result object
  (as produced by the `ResultAdjudicator`) for the actual vendor_name.
  This value should always be present even though we don't have any
  validators for it.

* This makes testing a little messier, but cleaning up the various vendor
  names in our specs should be done in future work. For now, a new constant with the
  potential `source_check` names has been added
  (`Idv::Constants::Vendors::SOURCE_CHECK`).

* No new specs have been added as the functionality, but one end-to-end
  feature test has been updated to check the vendor name is in the
  expected list.

changelog: Internal, Analytics, Store correct vendor name in ProofingComponents
  • Loading branch information
lmgeorge committed Nov 12, 2024
1 parent ed38d8a commit 83f1022
Show file tree
Hide file tree
Showing 4 changed files with 20 additions and 6 deletions.
12 changes: 9 additions & 3 deletions app/controllers/concerns/idv/verify_info_concern.rb
Original file line number Diff line number Diff line change
Expand Up @@ -237,16 +237,22 @@ def summarize_result_and_rate_limit(summary_result)
resolution_rate_limiter.increment! if proofing_results_exception.blank?

if summary_result.success?
add_proofing_components
add_proofing_components(summary_result)
else
idv_failure(summary_result)
end
end

def add_proofing_components
def add_proofing_components(summary_result)
ProofingComponent.create_or_find_by(user: current_user).update(
resolution_check: Idp::Constants::Vendors::LEXIS_NEXIS,
source_check: Idp::Constants::Vendors::AAMVA,
source_check: summary_result.extra.dig(
:proofing_results,
:context,
:stages,
:state_id,
:vendor_name,
),
)
end

Expand Down
7 changes: 5 additions & 2 deletions app/services/idv/proofing_components.rb
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,11 @@ def document_type
end

def source_check
Idp::Constants::Vendors::AAMVA if idv_session.verify_info_step_complete?
if idv_session.resolution_successful
Idp::Constants::Vendors::AAMVA
elsif idv_session.resolution_successful == false
Idp::Constants::Vendors::AAMVA_UNSUPPORTED_JURISDICTION
end
end

def resolution_check
Expand Down Expand Up @@ -67,7 +71,6 @@ def to_h
address_check:,
threatmetrix:,
threatmetrix_review_status:,

}.compact
end

Expand Down
3 changes: 3 additions & 0 deletions lib/idp/constants.rb
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,9 @@ module Vendors
MOCK = 'mock'
USPS = 'usps'
AAMVA = 'aamva'
AAMVA_UNSUPPORTED_JURISDICTION = 'UnsupportedJurisdiction'
STATE_ID_MOCK = 'StateIdMock'
SOURCE_CHECK = [AAMVA, AAMVA_UNSUPPORTED_JURISDICTION, MOCK, STATE_ID_MOCK].freeze
end

# US State and Territory codes are
Expand Down
4 changes: 3 additions & 1 deletion spec/features/idv/end_to_end_idv_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -268,7 +268,9 @@ def validate_verify_info_page
def validate_verify_info_submit(user)
expect(page).to have_content(t('doc_auth.forms.doc_success'))
expect(user.proofing_component.resolution_check).to eq(Idp::Constants::Vendors::LEXIS_NEXIS)
expect(user.proofing_component.source_check).to eq(Idp::Constants::Vendors::AAMVA)
expect(user.proofing_component.source_check).to satisfy do |v|
Idp::Constants::Vendors::SOURCE_CHECK.include?(v)
end
end

def validate_phone_page
Expand Down

0 comments on commit 83f1022

Please sign in to comment.