Skip to content
Closed
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
9 changes: 8 additions & 1 deletion app/services/doc_auth/response.rb
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,9 @@ def initialize(
extra: {},
pii_from_doc: {},
attention_with_barcode: false,
doc_type_supported: true
doc_type_supported: true,
# This is a stub to get data paths in place. Replace this as soon as possible.
selfie_check_performed: false
)
@success = success
@errors = errors.to_h
Expand All @@ -23,6 +25,7 @@ def initialize(
@pii_from_doc = pii_from_doc
@attention_with_barcode = attention_with_barcode
@doc_type_supported = doc_type_supported
@selfie_check_performed = selfie_check_performed
end

def merge(other)
Expand Down Expand Up @@ -71,5 +74,9 @@ def network_error?
return false unless @errors
return !!@errors&.with_indifferent_access&.dig(:network)
end

def selfie_check_performed?
@selfie_check_performed
end
end
end
29 changes: 29 additions & 0 deletions spec/services/doc_auth/response_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
let(:exception) { nil }
let(:pii_from_doc) { {} }
let(:attention_with_barcode) { false }

subject(:response) do
described_class.new(
success: success,
Expand All @@ -22,6 +23,7 @@
let(:other_exception) { nil }
let(:other_pii_from_doc) { {} }
let(:other_attention_with_barcode) { false }

let(:other) do
described_class.new(
success: other_success,
Expand Down Expand Up @@ -156,4 +158,31 @@
expect(response.doc_type_supported?).to eq(true)
end
end

# LG-11942
# The following is for the stubbed selfie check value. Replace with
# the real tests when selfie implementation gets to that point.
describe 'selfie_check_performed?' do
before do
allow(IdentityConfig.store).
to receive(:doc_auth_selfie_capture_enabled).
and_return(selfies_enabled)
Comment on lines +167 to +169
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.

Will also need to set sp[:biometric_comparison_required] here to go with the above code change.

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.

Same comment as above; I think this is too much for the stub.

end

context 'when selfie checks are enabled' do
let(:selfies_enabled) { true }

it 'returns true by default' do
expect(response.selfie_check_performed?).to be(true)
end
end

context 'when selfie checks are disabled' do
let(:selfies_enabled) { false }

it 'returns false by default' do
expect(response.selfie_check_performed?).to be(false)
end
end
end
end