diff --git a/app/services/doc_auth/response.rb b/app/services/doc_auth/response.rb index fc49164abb3..c66c1af149f 100644 --- a/app/services/doc_auth/response.rb +++ b/app/services/doc_auth/response.rb @@ -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 @@ -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) @@ -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 diff --git a/spec/services/doc_auth/response_spec.rb b/spec/services/doc_auth/response_spec.rb index f26601807a0..0f77cabfcaa 100644 --- a/spec/services/doc_auth/response_spec.rb +++ b/spec/services/doc_auth/response_spec.rb @@ -6,6 +6,7 @@ let(:exception) { nil } let(:pii_from_doc) { {} } let(:attention_with_barcode) { false } + subject(:response) do described_class.new( success: success, @@ -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, @@ -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) + 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