Skip to content

Commit

Permalink
Add fraud decline reasons
Browse files Browse the repository at this point in the history
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.
  • Loading branch information
thomasleese committed Jul 5, 2024
1 parent 0ac337a commit 8224699
Show file tree
Hide file tree
Showing 8 changed files with 55 additions and 6 deletions.
6 changes: 6 additions & 0 deletions app/lib/assessment_factory.rb
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,7 @@ def personal_information_section
FailureReasons::APPLICANT_ALREADY_DQT,
FailureReasons::SUITABILITY,
FailureReasons::SUITABILITY_PREVIOUSLY_DECLINED,
FailureReasons::FRAUD,
].compact

AssessmentSection.new(
Expand Down Expand Up @@ -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:)
Expand All @@ -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:)
Expand Down Expand Up @@ -193,6 +196,7 @@ def english_language_proficiency_section
failure_reasons += [
FailureReasons::SUITABILITY,
FailureReasons::SUITABILITY_PREVIOUSLY_DECLINED,
FailureReasons::FRAUD,
]

AssessmentSection.new(
Expand All @@ -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:)
Expand Down Expand Up @@ -274,6 +279,7 @@ def professional_standing_section
FailureReasons::FULL_PROFESSIONAL_STATUS,
FailureReasons::SUITABILITY,
FailureReasons::SUITABILITY_PREVIOUSLY_DECLINED,
FailureReasons::FRAUD,
].compact

AssessmentSection.new(
Expand Down
5 changes: 5 additions & 0 deletions app/lib/failure_reasons.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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 =
Expand Down Expand Up @@ -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
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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?
Expand Down
3 changes: 3 additions & 0 deletions config/locales/assessor_interface.en.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down Expand Up @@ -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:
Expand Down
7 changes: 5 additions & 2 deletions config/locales/helpers.en.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down Expand Up @@ -85,9 +86,11 @@ en:
age_range_min: From
age_range_note: '<strong class="govuk-!-font-weight-bold">Internal note:</strong> 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"
Expand Down
1 change: 1 addition & 0 deletions config/locales/teacher_interface.en.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down
9 changes: 9 additions & 0 deletions spec/lib/assessment_factory_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -63,6 +63,7 @@
applicant_already_dqt
suitability
suitability_previously_declined
fraud
],
)
end
Expand Down Expand Up @@ -124,6 +125,7 @@
suitability
suitability_previously_declined
special_education_only
fraud
],
)
end
Expand Down Expand Up @@ -174,6 +176,7 @@
suitability
suitability_previously_declined
special_education_only
fraud
],
)
end
Expand All @@ -197,6 +200,7 @@
age_range
suitability
suitability_previously_declined
fraud
],
)
end
Expand All @@ -223,6 +227,7 @@
age_range
suitability
suitability_previously_declined
fraud
],
)
end
Expand Down Expand Up @@ -307,6 +312,7 @@
work_history_duration
suitability
suitability_previously_declined
fraud
],
)
end
Expand Down Expand Up @@ -352,6 +358,7 @@
full_professional_status
suitability
suitability_previously_declined
fraud
],
)
end
Expand Down Expand Up @@ -397,6 +404,7 @@
full_professional_status
suitability
suitability_previously_declined
fraud
],
)
end
Expand Down Expand Up @@ -432,6 +440,7 @@
full_professional_status
suitability
suitability_previously_declined
fraud
],
)
end
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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(
Expand All @@ -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" }

Expand All @@ -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(
Expand All @@ -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" }

Expand Down

0 comments on commit 8224699

Please sign in to comment.