From b9e55dbd683d445ed0ff227249753bd605635180 Mon Sep 17 00:00:00 2001 From: Felix Clack Date: Mon, 1 Jul 2024 09:12:09 +0100 Subject: [PATCH] Add a visa check task for IRP For the international relocation payments journey we want to add a new admin task for checking the visa type provided. We collect the visa type as part of the journey, so we want an admin task to confirm this. --- app/models/claim_checking_tasks.rb | 3 ++- .../admin_tasks_presenter.rb | 6 +++++ app/models/task.rb | 1 + app/views/admin/tasks/visa.html.erb | 26 +++++++++++++++++++ config/locales/en.yml | 3 +++ ...dmin_view_claim_feature_shared_examples.rb | 2 +- 6 files changed, 39 insertions(+), 2 deletions(-) create mode 100644 app/views/admin/tasks/visa.html.erb diff --git a/app/models/claim_checking_tasks.rb b/app/models/claim_checking_tasks.rb index e00040e4dc..f1725845fa 100644 --- a/app/models/claim_checking_tasks.rb +++ b/app/models/claim_checking_tasks.rb @@ -12,7 +12,7 @@ def initialize(claim) delegate :policy, to: :claim def applicable_task_names - return ["identity_confirmation"] if policy.international_relocation_payments? + return ["identity_confirmation", "visa"] if policy.international_relocation_payments? @applicable_task_names ||= Task::NAMES.dup.tap do |task_names| task_names.delete("induction_confirmation") unless claim.policy == Policies::EarlyCareerPayments @@ -21,6 +21,7 @@ def applicable_task_names task_names.delete("payroll_details") unless claim.must_manually_validate_bank_details? task_names.delete("matching_details") unless matching_claims.exists? task_names.delete("payroll_gender") unless claim.payroll_gender_missing? || task_names_for_claim.include?("payroll_gender") + task_names.delete("visa") unless claim.policy.international_relocation_payments? end end diff --git a/app/models/policies/international_relocation_payments/admin_tasks_presenter.rb b/app/models/policies/international_relocation_payments/admin_tasks_presenter.rb index e64aa294ea..9e7f35fddd 100644 --- a/app/models/policies/international_relocation_payments/admin_tasks_presenter.rb +++ b/app/models/policies/international_relocation_payments/admin_tasks_presenter.rb @@ -16,6 +16,12 @@ def identity_confirmation ] end + def visa + [ + ["Visa type", eligibility.visa_type] + ] + end + private delegate :eligibility, to: :claim diff --git a/app/models/task.rb b/app/models/task.rb index 8dae76bdab..b2d48af068 100644 --- a/app/models/task.rb +++ b/app/models/task.rb @@ -18,6 +18,7 @@ class Task < ApplicationRecord payroll_details matching_details payroll_gender + visa ].freeze belongs_to :claim diff --git a/app/views/admin/tasks/visa.html.erb b/app/views/admin/tasks/visa.html.erb new file mode 100644 index 0000000000..3110ab6a7d --- /dev/null +++ b/app/views/admin/tasks/visa.html.erb @@ -0,0 +1,26 @@ +<% content_for(:page_title) { page_title("Claim #{@claim.reference} visa check for #{@claim.policy.short_name}") } %> +<%= link_to "Back", admin_claim_tasks_path(claim_id: @claim.id), class: "govuk-back-link" %> +<%= render "shared/error_summary", instance: @task, errored_field_id_overrides: { "passed": "task_passed_true" } if @task.errors.any? %> + +
+ <%= render "claim_summary", claim: @claim, heading: "Visa check" %> + +
+

<%= @current_task_name.humanize %>

+
+ +
+ <%= render "admin/claims/answers", answers: @tasks_presenter.visa %> +
+ +
+ <% if !@task.passed.nil? %> + <%= render "task_outcome", task: @task %> + <% else %> + <%= render "form", task_name: "visa", claim: @claim %> + <% end %> + + <%= render partial: "admin/task_pagination" %> +
+
+ diff --git a/config/locales/en.yml b/config/locales/en.yml index 1f6b38a59f..d989bfee03 100644 --- a/config/locales/en.yml +++ b/config/locales/en.yml @@ -153,6 +153,7 @@ en: student_loan_plan: "Check student loan plan" payroll_details: "Check bank/building society account details" census_subjects_taught: "Check eligible subjects are taught" + visa: "Check visa" undo_decision: approved: "Undo approval" rejected: "Undo rejection" @@ -780,6 +781,8 @@ en: task_questions: identity_confirmation: title: "Did %{claim_full_name} submit the claim?" + visa: + title: "Is the claimant’s visa type eligible for a claim?" further_education_payments: landing_page: Find out if you are eligible for any incentive payments for further education teachers diff --git a/spec/support/admin_view_claim_feature_shared_examples.rb b/spec/support/admin_view_claim_feature_shared_examples.rb index 939e59cbcc..60616d168c 100644 --- a/spec/support/admin_view_claim_feature_shared_examples.rb +++ b/spec/support/admin_view_claim_feature_shared_examples.rb @@ -179,7 +179,7 @@ def expect_page_to_have_policy_sections(policy) when Policies::EarlyCareerPayments ["Identity confirmation", "Qualifications", "Induction confirmation", "Census subjects taught", "Employment", "Student loan plan", "Decision"] when Policies::InternationalRelocationPayments - ["Identity confirmation", "Decision"] + ["Identity confirmation", "Visa", "Decision"] else raise "Unimplemented policy: #{policy}" end