diff --git a/app/controllers/admin/further_education_payments/provider_verification_emails_controller.rb b/app/controllers/admin/further_education_payments/provider_verification_emails_controller.rb index d847cdf80f..d82194ff20 100644 --- a/app/controllers/admin/further_education_payments/provider_verification_emails_controller.rb +++ b/app/controllers/admin/further_education_payments/provider_verification_emails_controller.rb @@ -6,6 +6,12 @@ class ProviderVerificationEmailsController < Admin::BaseAdminController def create claim = Claim.find(params[:claim_id]) + claim.notes.create!( + created_by: admin_user, + label: "provider_verification", + body: "Verification email sent to #{claim.school.name}" + ) + ClaimMailer.further_education_payment_provider_verification_email(claim).deliver_later flash[:notice] = "Verification email sent to #{claim.school.name}" diff --git a/app/models/policies/further_education_payments/admin_provider_verification_task_presenter.rb b/app/models/policies/further_education_payments/admin_provider_verification_task_presenter.rb index b30052f3ed..6483a94a52 100644 --- a/app/models/policies/further_education_payments/admin_provider_verification_task_presenter.rb +++ b/app/models/policies/further_education_payments/admin_provider_verification_task_presenter.rb @@ -25,6 +25,10 @@ def rows end end + def latest_email + claim.notes.by_label("provider_verification").order(created_at: :desc).first + end + private def verification diff --git a/app/models/policies/further_education_payments/admin_tasks_presenter.rb b/app/models/policies/further_education_payments/admin_tasks_presenter.rb index da9c1dfb17..a8c78e631b 100644 --- a/app/models/policies/further_education_payments/admin_tasks_presenter.rb +++ b/app/models/policies/further_education_payments/admin_tasks_presenter.rb @@ -10,7 +10,7 @@ def initialize(claim) end def provider_verification - AdminProviderVerificationTaskPresenter.new(claim).rows + AdminProviderVerificationTaskPresenter.new(claim) end def provider_name diff --git a/app/views/admin/tasks/provider_verification.html.erb b/app/views/admin/tasks/provider_verification.html.erb index 4f3eff60ae..d4f738979e 100644 --- a/app/views/admin/tasks/provider_verification.html.erb +++ b/app/views/admin/tasks/provider_verification.html.erb @@ -33,7 +33,7 @@
- <% @tasks_presenter.provider_verification.each do |row| %> + <% @tasks_presenter.provider_verification.rows.each do |row| %>+ The verification request was sent to the provider by + <%= user_details(verification_email.created_by) %> on <%= l(verification_email.created_at) %> +
+ <% end %> <%= govuk_button_to( "Send provider verification request", admin_claim_further_education_payments_provider_verification_emails_path(@claim), diff --git a/spec/features/admin/admin_claim_further_education_payments_spec.rb b/spec/features/admin/admin_claim_further_education_payments_spec.rb index 4ad7846782..3796367334 100644 --- a/spec/features/admin/admin_claim_further_education_payments_spec.rb +++ b/spec/features/admin/admin_claim_further_education_payments_spec.rb @@ -1,6 +1,12 @@ require "rails_helper" RSpec.feature "Admin claim further education payments" do + around do |example| + travel_to DateTime.new(AcademicYear.current.start_year, 9, 9, 10, 0, 0) do + example.run + end + end + before do create(:journey_configuration, :further_education_payments_provider) sign_in_as_service_operator @@ -49,6 +55,11 @@ click_on "Send provider verification request" end + expect(page).to have_content( + "The verification request was sent to the provider by " \ + "Aaron Admin on 9 September 2024 11:00am" + ) + provider_email_address = claim.school.eligible_fe_provider.primary_key_contact_email_address expect(provider_email_address).to(