From 82246999d83eefa953fdad54ae9dc6ed66a7fd17 Mon Sep 17 00:00:00 2001 From: Thomas Leese Date: Fri, 5 Jul 2024 11:29:46 +0100 Subject: [PATCH] Add fraud decline reasons This adds the decline reason related to fraud, this will appear on new applications but we'll also need to add it to older ones later. --- app/lib/assessment_factory.rb | 6 +++++ app/lib/failure_reasons.rb | 5 ++++ .../assessment_section_view_object.rb | 6 +++-- config/locales/assessor_interface.en.yml | 3 +++ config/locales/helpers.en.yml | 7 ++++-- config/locales/teacher_interface.en.yml | 1 + spec/lib/assessment_factory_spec.rb | 9 +++++++ .../assessment_section_view_object_spec.rb | 24 +++++++++++++++++-- 8 files changed, 55 insertions(+), 6 deletions(-) diff --git a/app/lib/assessment_factory.rb b/app/lib/assessment_factory.rb index f739b660f..57bdd364e 100644 --- a/app/lib/assessment_factory.rb +++ b/app/lib/assessment_factory.rb @@ -58,6 +58,7 @@ def personal_information_section FailureReasons::APPLICANT_ALREADY_DQT, FailureReasons::SUITABILITY, FailureReasons::SUITABILITY_PREVIOUSLY_DECLINED, + FailureReasons::FRAUD, ].compact AssessmentSection.new( @@ -126,6 +127,7 @@ def qualifications_section FailureReasons::SUITABILITY, FailureReasons::SUITABILITY_PREVIOUSLY_DECLINED, FailureReasons::SPECIAL_EDUCATION_ONLY, + FailureReasons::FRAUD, ].compact AssessmentSection.new(key: "qualifications", checks:, failure_reasons:) @@ -152,6 +154,7 @@ def age_range_subjects_section FailureReasons::AGE_RANGE, FailureReasons::SUITABILITY, FailureReasons::SUITABILITY_PREVIOUSLY_DECLINED, + FailureReasons::FRAUD, ] AssessmentSection.new(key: "age_range_subjects", checks:, failure_reasons:) @@ -193,6 +196,7 @@ def english_language_proficiency_section failure_reasons += [ FailureReasons::SUITABILITY, FailureReasons::SUITABILITY_PREVIOUSLY_DECLINED, + FailureReasons::FRAUD, ] AssessmentSection.new( @@ -214,6 +218,7 @@ def work_history_section FailureReasons::WORK_HISTORY_DURATION, FailureReasons::SUITABILITY, FailureReasons::SUITABILITY_PREVIOUSLY_DECLINED, + FailureReasons::FRAUD, ] AssessmentSection.new(key: "work_history", checks:, failure_reasons:) @@ -274,6 +279,7 @@ def professional_standing_section FailureReasons::FULL_PROFESSIONAL_STATUS, FailureReasons::SUITABILITY, FailureReasons::SUITABILITY_PREVIOUSLY_DECLINED, + FailureReasons::FRAUD, ].compact AssessmentSection.new( diff --git a/app/lib/failure_reasons.rb b/app/lib/failure_reasons.rb index f43ed821c..b19df15c5 100644 --- a/app/lib/failure_reasons.rb +++ b/app/lib/failure_reasons.rb @@ -15,6 +15,7 @@ class FailureReasons EL_MOI_NOT_TAUGHT_IN_ENGLISH = "english_language_moi_not_taught_in_english", EL_QUALIFICATION_INVALID = "english_language_qualification_invalid", EL_SELT_EXPIRED = "english_language_selt_expired", + FRAUD = "fraud", FULL_PROFESSIONAL_STATUS = "full_professional_status", NOT_QUALIFIED_TO_TEACH_MAINSTREAM = "not_qualified_to_teach_mainstream", QUALIFIED_TO_TEACH_CHILDREN_11_TO_16 = @@ -112,6 +113,10 @@ def self.suitability?(failure_reason) ].include?(failure_reason.to_s) end + def self.fraud?(failure_reason) + failure_reason.to_s == FailureReasons::FRAUD + end + def self.further_information_request_document_type(failure_reason) DOCUMENT_FAILURE_REASONS[failure_reason.to_s] end diff --git a/app/view_objects/assessor_interface/assessment_section_view_object.rb b/app/view_objects/assessor_interface/assessment_section_view_object.rb index f2556dff9..45f81f65c 100644 --- a/app/view_objects/assessor_interface/assessment_section_view_object.rb +++ b/app/view_objects/assessor_interface/assessment_section_view_object.rb @@ -163,10 +163,12 @@ def highlighted_work_history_contact_emails def build_key(failure_reason, key_section) key = - if FailureReasons.decline?(failure_reason) - "decline" + if FailureReasons.fraud?(failure_reason) + "fraud" elsif FailureReasons.suitability?(failure_reason) "suitability" + elsif FailureReasons.decline?(failure_reason) + "decline" elsif FailureReasons.further_information_request_document_type( failure_reason, ).present? diff --git a/config/locales/assessor_interface.en.yml b/config/locales/assessor_interface.en.yml index 9b958da46..49d0831a8 100644 --- a/config/locales/assessor_interface.en.yml +++ b/config/locales/assessor_interface.en.yml @@ -160,6 +160,7 @@ en: english_language_qualification_invalid: The applicant’s English language qualification is not from one of the approved providers. english_language_selt_expired: The applicant provided evidence of a SELT but the test was not completed within the last 2 years. english_language_unverifiable_reference_number: Unable to verify the reference number that the applicant has provided. + fraud: Applicant has provided information that cannot be verified and is potentially fraudulent. full_professional_status: Recognition level as a teacher does not match the required level, or has outstanding additional conditions. identification_document_expired: The ID document has expired. identification_document_illegible: The ID document is illegible or in a format that we cannot accept. @@ -283,6 +284,8 @@ en: blank: Enter a note to the applicant duplicate_application_notes: blank: Enter a note to the applicant + fraud_notes: + blank: Enter a note to the applicant full_professional_status_notes: blank: Enter a note to the applicant identification_document_expired_notes: diff --git a/config/locales/helpers.en.yml b/config/locales/helpers.en.yml index d17936308..c696ee7a7 100644 --- a/config/locales/helpers.en.yml +++ b/config/locales/helpers.en.yml @@ -10,6 +10,7 @@ en: failure_reason_notes: decline: As this reason triggers a decline, you do not need to add a note, but you can use the space below to add anything you feel might be helpful, if you want to. document: This FI reason asks the applicant to upload a file. Use this space to give them clear instructions on what they need to provide. + fraud: If you are declining an applicant because of potential fraud, you must enter the additional content agreed by the suitability panel. suitability: If you are declining an applicant because of suitability reasons, you must enter the additional content agreed by the suitability panel. text: This FI allows the applicant to send us a typed response. Use this space to give them clear instructions on what they need to provide. assessor_interface_create_note_form: @@ -85,9 +86,11 @@ en: age_range_min: From age_range_note: 'Internal note: If you''ve entered a new range please explain why (optional)' failure_reason_notes: - text: Note to the applicant - document: Note to the applicant decline: Note to the applicant (optional) + document: Note to the applicant + fraud: Note to the applicant (mandatory) + suitability: Note to the applicant (mandatory) + text: Note to the applicant induction_required_options: true: "No" false: "Yes" diff --git a/config/locales/teacher_interface.en.yml b/config/locales/teacher_interface.en.yml index 80a9a21be..ceb1b14a9 100644 --- a/config/locales/teacher_interface.en.yml +++ b/config/locales/teacher_interface.en.yml @@ -24,6 +24,7 @@ en: english_language_qualification_invalid: Your English language qualification is not from one of the approved providers. english_language_selt_expired: You have provided evidence of a secure English language test (SELT) but the test was not completed within the last 2 years. english_language_unverifiable_reference_number: We were unable to verify the reference number you have provided. + fraud: You have provided information that cannot be verified. full_professional_status: Your recognition level as a teacher does not match the required level or has outstanding conditions. further_information_request_expired: Your application has been declined as you did not respond to the assessor’s request for further information within the specified time. identification_document_expired: Your ID document has expired. diff --git a/spec/lib/assessment_factory_spec.rb b/spec/lib/assessment_factory_spec.rb index 92f7fb971..8412ff26d 100644 --- a/spec/lib/assessment_factory_spec.rb +++ b/spec/lib/assessment_factory_spec.rb @@ -63,6 +63,7 @@ applicant_already_dqt suitability suitability_previously_declined + fraud ], ) end @@ -124,6 +125,7 @@ suitability suitability_previously_declined special_education_only + fraud ], ) end @@ -174,6 +176,7 @@ suitability suitability_previously_declined special_education_only + fraud ], ) end @@ -197,6 +200,7 @@ age_range suitability suitability_previously_declined + fraud ], ) end @@ -223,6 +227,7 @@ age_range suitability suitability_previously_declined + fraud ], ) end @@ -307,6 +312,7 @@ work_history_duration suitability suitability_previously_declined + fraud ], ) end @@ -352,6 +358,7 @@ full_professional_status suitability suitability_previously_declined + fraud ], ) end @@ -397,6 +404,7 @@ full_professional_status suitability suitability_previously_declined + fraud ], ) end @@ -432,6 +440,7 @@ full_professional_status suitability suitability_previously_declined + fraud ], ) end diff --git a/spec/view_objects/assessor_interface/assessment_section_view_object_spec.rb b/spec/view_objects/assessor_interface/assessment_section_view_object_spec.rb index 337b422a3..360aae833 100644 --- a/spec/view_objects/assessor_interface/assessment_section_view_object_spec.rb +++ b/spec/view_objects/assessor_interface/assessment_section_view_object_spec.rb @@ -51,7 +51,7 @@ subject { super().notes_label_key_for(failure_reason:) } context "with a decline failure reason" do - let(:failure_reason) { FailureReasons::DECLINABLE.sample } + let(:failure_reason) { FailureReasons::AGE_RANGE } it do expect(subject).to eq( @@ -60,6 +60,16 @@ end end + context "with a fraud failure reason" do + let(:failure_reason) { FailureReasons::FRAUD } + + it do + expect(subject).to eq( + "helpers.label.assessor_interface_assessment_section_form.failure_reason_notes.fraud", + ) + end + end + context "with a text failure reason" do let(:failure_reason) { "there-once-was-a-cat-with-a-hungry-belly" } @@ -85,7 +95,7 @@ subject { super().notes_hint_key_for(failure_reason:) } context "with a decline failure reason" do - let(:failure_reason) { FailureReasons::DECLINABLE.sample } + let(:failure_reason) { FailureReasons::AGE_RANGE } it do expect(subject).to eq( @@ -94,6 +104,16 @@ end end + context "with a fraud failure reason" do + let(:failure_reason) { FailureReasons::FRAUD } + + it do + expect(subject).to eq( + "helpers.hint.assessor_interface_assessment_section_form.failure_reason_notes.fraud", + ) + end + end + context "with a text failure reason" do let(:failure_reason) { "soon-may-the-kitty-man-come" }