Skip to content

Commit

Permalink
Backed out removing the #failure method.
Browse files Browse the repository at this point in the history
  • Loading branch information
jmax-gsa committed Dec 4, 2024
1 parent 8acfc9b commit a28c718
Showing 1 changed file with 11 additions and 8 deletions.
19 changes: 11 additions & 8 deletions app/controllers/concerns/idv/document_capture_concern.rb
Original file line number Diff line number Diff line change
Expand Up @@ -12,24 +12,27 @@ def handle_stored_result(user: current_user, store_in_session: true)
flash[:success] = t('doc_auth.headings.capture_complete')
successful_response
else
FormResponse.new(
{
success: false,
errors: error_hash(message),
extra: { stored_result_present: stored_result.present? },
},
)
extra = { stored_result_present: stored_result.present? }
failure(nil, extra)
end
end

def successful_response
FormResponse.new(success: true)
end

# copied from Flow::Failure module
def failure(message = nil, extra = nil)
form_response_params = { success: false }
form_response_params[:errors] = error_hash(message)
form_response_params[:extra] = extra unless extra.nil?
FormResponse.new(**form_response_params)
end

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

Expand Down

0 comments on commit a28c718

Please sign in to comment.