Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

LG-14010 minor review comments #11595

Merged
merged 3 commits into from
Dec 18, 2024
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
17 changes: 6 additions & 11 deletions app/controllers/concerns/idv/document_capture_concern.rb
Original file line number Diff line number Diff line change
Expand Up @@ -24,21 +24,16 @@ def successful_response
# copied from Flow::Failure module
def failure(message = nil, extra = nil)
form_response_params = { success: false }
form_response_params[:errors] = make_error_hash(message)
form_response_params[:errors] = error_hash(message)
form_response_params[:extra] = extra unless extra.nil?
FormResponse.new(**form_response_params)
end

def make_error_hash(message)
Rails.logger.info("make_error_hash: stored_result: #{stored_result.inspect}")

error_hash = { message: message || I18n.t('doc_auth.errors.general.network_error') }

if stored_result&.errors&.has_key?(:socure)
error_hash[:socure] = stored_result.errors[:socure]
end

error_hash
def error_hash(message)
{
message: message || I18n.t('doc_auth.errors.general.network_error'),
socure: stored_result&.errors&.dig(:socure),
}
end

def extract_pii_from_doc(user, store_in_session: false)
Expand Down
9 changes: 6 additions & 3 deletions app/presenters/socure_error_presenter.rb
Original file line number Diff line number Diff line change
Expand Up @@ -151,16 +151,19 @@ def heading_string_for(error_code)

def error_string_for(error_code)
if error_code == :network
t('doc_auth.errors.general.new_network_error')
elsif remapped_error(error_code) == 'underage' # special handling because it says 'Login.gov'
return t('doc_auth.errors.general.new_network_error')
end

remapped_error_code = remapped_error(error_code)
if remapped_error_code == 'underage' # special handling because it says 'Login.gov'
I18n.t('doc_auth.errors.underage', app_name: APP_NAME)
else
# i18n-tasks-use t('doc_auth.errors.unreadable_id')
# i18n-tasks-use t('doc_auth.errors.unaccepted_id_type')
# i18n-tasks-use t('doc_auth.errors.expired_id')
# i18n-tasks-use t('doc_auth.errors.low_resolution')
# i18n-tasks-use t('doc_auth.errors.id_not_found')
I18n.t("doc_auth.errors.#{remapped_error(error_code)}")
I18n.t("doc_auth.errors.#{remapped_error_code}")
end
end
end
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,6 @@ class DocvResultResponse < DocAuth::Response
def initialize(http_response:,
biometric_comparison_required: false)
@http_response = http_response

@biometric_comparison_required = biometric_comparison_required
@pii_from_doc = read_pii

Expand Down
6 changes: 4 additions & 2 deletions spec/controllers/idv/link_sent_controller_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -223,8 +223,10 @@

before do
expect(FormResponse).to receive(:new).with(
{ success: false,
errors: { message: error_message } },
{
success: false,
errors: hash_including(message: error_message),
},
)
end

Expand Down