diff --git a/app/mailers/teacher_mailer.rb b/app/mailers/teacher_mailer.rb index 9186978628..7c83828e3a 100644 --- a/app/mailers/teacher_mailer.rb +++ b/app/mailers/teacher_mailer.rb @@ -56,6 +56,36 @@ def application_received ) end + def consent_reminder + @expires_at = + assessment.qualification_requests.consent_required.map(&:expires_at).max + + view_mail( + GOVUK_NOTIFY_TEMPLATE_ID, + to: teacher.email, + subject: I18n.t("mailer.teacher.consent_reminder.subject"), + ) + end + + def consent_requested + @expires_at = + assessment.qualification_requests.consent_required.map(&:expires_at).max + + view_mail( + GOVUK_NOTIFY_TEMPLATE_ID, + to: teacher.email, + subject: I18n.t("mailer.teacher.consent_requested.subject"), + ) + end + + def consent_submitted + view_mail( + GOVUK_NOTIFY_TEMPLATE_ID, + to: teacher.email, + subject: I18n.t("mailer.teacher.consent_submitted.subject"), + ) + end + def further_information_received view_mail( GOVUK_NOTIFY_TEMPLATE_ID, diff --git a/app/views/teacher_mailer/consent_reminder.text.erb b/app/views/teacher_mailer/consent_reminder.text.erb new file mode 100644 index 0000000000..fffcc910c6 --- /dev/null +++ b/app/views/teacher_mailer/consent_reminder.text.erb @@ -0,0 +1,24 @@ +Dear <%= application_form_full_name(@application_form) %>, + +We recently wrote to you asking for your consent to verify some of your qualifications as part of your QTS application. + +We have not received your consent documents. If you do not send them by <%= @expires_at.to_fs(:date) %> we will not be able to proceed with your application. + +## What you need to do + +Download each document then: + +- print it +- sign it, making sure your signature is clear +- scan or photograph it +- upload the signed document + +[Sign in to access your documents](<%= new_teacher_session_url %>) + +You need to sign and upload these documents by <%= @expires_at.to_fs(:date) %> so that we can proceed with your application. + +## Why we need your written consent + +We need your written consent so we can share your data with organisations that can verify your qualifications. This is in accordance with UK General Data Protection Regulation (GDPR). + +<%= render "shared/teacher_mailer/footer" %> diff --git a/app/views/teacher_mailer/consent_requested.text.erb b/app/views/teacher_mailer/consent_requested.text.erb new file mode 100644 index 0000000000..117bbe41b1 --- /dev/null +++ b/app/views/teacher_mailer/consent_requested.text.erb @@ -0,0 +1,24 @@ +Dear <%= application_form_full_name(@application_form) %>, + +As part of your QTS application we need to verify some of your qualifications. To allow us to do this you need to sign and return a consent document for each qualification we need to verify. + +Consent documents have been added to your application. + +## What you need to do + +Download each document then: + +- print it +- sign it, making sure your signature is clear +- scan or photograph it +- upload the signed document + +[Sign in to access your documents](<%= new_teacher_session_url %>) + +You need to sign and upload these documents by <%= @expires_at.to_fs(:date) %> so that we can proceed with your application. + +## Why we need your written consent + +We need your written consent so we can share your data with organisations that can verify your qualifications. This is in accordance with UK General Data Protection Regulation (GDPR). + +<%= render "shared/teacher_mailer/footer" %> diff --git a/app/views/teacher_mailer/consent_submitted.text.erb b/app/views/teacher_mailer/consent_submitted.text.erb new file mode 100644 index 0000000000..83ecf674c1 --- /dev/null +++ b/app/views/teacher_mailer/consent_submitted.text.erb @@ -0,0 +1,15 @@ +Dear <%= application_form_full_name(@application_form) %>, + +Thank you for submitting the consent documents required to progress your QTS application. + +<%= render "shared/teacher_mailer/reference_number" %> + +## What happens next? + +Once an assessor has checked the documents to make sure you’ve provided the required information, they’ll continue reviewing your application. + +If no further information is needed, we’ll contact you with a final QTS application decision once all checks and verifications have been completed. + +<%= render "shared/teacher_mailer/any_questions_contact" %> + +<%= render "shared/teacher_mailer/footer" %> diff --git a/config/locales/mailer.en.yml b/config/locales/mailer.en.yml index 277aeaffd1..e2669fce81 100644 --- a/config/locales/mailer.en.yml +++ b/config/locales/mailer.en.yml @@ -20,6 +20,12 @@ en: 1: Your draft QTS application will be deleted in 1 week application_received: subject: We’ve received your application for qualified teacher status (QTS) + consent_reminder: + subject: "Reminder: we need your written consent to progress your QTS application" + consent_requested: + subject: We need your written consent to progress your QTS application + consent_submitted: + subject: We’ve received your consent documents further_information_received: subject: We’ve received the additional information you sent us further_information_requested: diff --git a/spec/mailers/teacher_mailer_spec.rb b/spec/mailers/teacher_mailer_spec.rb index dc8af699dc..f4a8856d0c 100644 --- a/spec/mailers/teacher_mailer_spec.rb +++ b/spec/mailers/teacher_mailer_spec.rb @@ -19,6 +19,8 @@ ) end + let(:qualification) { create(:qualification, application_form:) } + describe "#application_awarded" do subject(:mail) do described_class.with(application_form:).application_awarded @@ -256,6 +258,126 @@ it_behaves_like "an observable mailer", "application_received" end + describe "#consent_reminder" do + subject(:mail) { described_class.with(application_form:).consent_reminder } + + before do + create( + :qualification_request, + :consent_requested, + assessment:, + consent_requested_at: Date.new(2020, 1, 1), + qualification:, + ) + end + + describe "#subject" do + subject(:subject) { mail.subject } + + it do + is_expected.to eq( + "Reminder: we need your written consent to progress your QTS application", + ) + end + end + + describe "#to" do + subject(:to) { mail.to } + + it { is_expected.to eq(["teacher@example.com"]) } + end + + describe "#body" do + subject(:body) { mail.body.encoded } + + it { is_expected.to include("Dear First Last") } + it do + is_expected.to include( + "We recently wrote to you asking for your consent", + ) + end + it do + is_expected.to include("If you do not send them by 12 February 2020") + end + end + + it_behaves_like "an observable mailer", "consent_reminder" + end + + describe "#consent_requested" do + subject(:mail) { described_class.with(application_form:).consent_requested } + + before do + create( + :qualification_request, + :consent_requested, + assessment:, + consent_requested_at: Date.new(2020, 1, 1), + qualification:, + ) + end + + describe "#subject" do + subject(:subject) { mail.subject } + + it do + is_expected.to eq( + "We need your written consent to progress your QTS application", + ) + end + end + + describe "#to" do + subject(:to) { mail.to } + + it { is_expected.to eq(["teacher@example.com"]) } + end + + describe "#body" do + subject(:body) { mail.body.encoded } + + it { is_expected.to include("Dear First Last") } + it do + is_expected.to include( + "As part of your QTS application we need to verify some of your qualifications", + ) + end + it do + is_expected.to include("upload these documents by 12 February 2020") + end + end + + it_behaves_like "an observable mailer", "consent_requested" + end + + describe "#consent_submitted" do + subject(:mail) { described_class.with(application_form:).consent_submitted } + + describe "#subject" do + subject(:subject) { mail.subject } + + it { is_expected.to eq("We’ve received your consent documents") } + end + + describe "#to" do + subject(:to) { mail.to } + + it { is_expected.to eq(["teacher@example.com"]) } + end + + describe "#body" do + subject(:body) { mail.body.encoded } + + it { is_expected.to include("Dear First Last") } + it do + is_expected.to include("Thank you for submitting the consent documents") + end + it { is_expected.to include("Application reference number: abc") } + end + + it_behaves_like "an observable mailer", "consent_submitted" + end + describe "#further_information_received" do subject(:mail) do described_class.with(application_form:).further_information_received