From 775c2bfae3d9676d5582ed4214aa39f1c9a86afc Mon Sep 17 00:00:00 2001 From: Tim O'Farrell Date: Wed, 10 Apr 2024 09:00:49 -0600 Subject: [PATCH 1/4] Post Deadline reminder #187355955 --- .../post_deadline_reminder.rb | 28 +++++++++++++++++ .../post_deadline_reminder_service.rb | 31 +++++++++++++++++++ config/locales/en.yml | 18 +++++++++++ config/locales/es.yml | 18 +++++++++++ crontab | 1 + lib/tasks/state_file.rake | 5 +++ 6 files changed, 101 insertions(+) create mode 100644 app/models/state_file/automated_message/post_deadline_reminder.rb create mode 100644 app/services/state_file/post_deadline_reminder_service.rb diff --git a/app/models/state_file/automated_message/post_deadline_reminder.rb b/app/models/state_file/automated_message/post_deadline_reminder.rb new file mode 100644 index 0000000000..6923292d46 --- /dev/null +++ b/app/models/state_file/automated_message/post_deadline_reminder.rb @@ -0,0 +1,28 @@ +module StateFile::AutomatedMessage + class PostDeadlineReminder < BaseAutomatedMessage + + def self.name + 'messages.state_file.post_deadline_reminder'.freeze + end + + def self.after_transition_notification? + false + end + + def self.send_only_once? + true + end + + def sms_body(**args) + I18n.t("messages.state_file.post_deadline_reminder.sms", **args) + end + + def email_subject(**args) + I18n.t("messages.state_file.post_deadline_reminder.email.subject", **args) + end + + def email_body(**args) + I18n.t("messages.state_file.post_deadline_reminder.email.body", **args) + end + end +end diff --git a/app/services/state_file/post_deadline_reminder_service.rb b/app/services/state_file/post_deadline_reminder_service.rb new file mode 100644 index 0000000000..9c7c0b2b55 --- /dev/null +++ b/app/services/state_file/post_deadline_reminder_service.rb @@ -0,0 +1,31 @@ +module StateFile + class PostDeadlineReminderService + BATCH_SIZE = 10 + HOURS_AGO = 24 + + def self.run + cutoff_time_ago = HOURS_AGO.hours.ago + + intakes_to_notify = StateFileBaseIntake::STATE_CODES.map do |code| + no_or_old_reminder = <<~SQL + state_file_#{code}_intakes.message_tracker #> '{messages.state_file.finish_return}' IS NULL + OR state_file_#{code}_intakes.message_tracker #> '{messages.state_file.finish_return}' < ? + SQL + "StateFile#{code.titleize}Intake".constantize + .left_joins(:efile_submissions) + .where(efile_submissions: { id: nil }) + .where(no_or_old_reminder, cutoff_time_ago) + end.flatten + + intakes_to_notify.each_slice(BATCH_SIZE) do |batch| + batch.each do |intake| + StateFile::MessagingService.new( + #message: StateFile::AutomatedMessage::FinishReturn, + message: StateFile::AutomatedMessage::FinishReturn, + intake: intake + ).send_message + end + end + end + end +end diff --git a/config/locales/en.yml b/config/locales/en.yml index b4eaa76504..59f8b2b2ac 100644 --- a/config/locales/en.yml +++ b/config/locales/en.yml @@ -1609,6 +1609,24 @@ en: Hello - Thank you for using FileYourStateTaxes! Any issues you may have experienced while using our tool have now been resolved. To continue filing your state taxes, log in here: %{login_link} Questions? Reply to this text. + post_deadline_reminder: + email: + body: | + Hi %{primary_first_name}, + + You haven't submitted your state tax return yet. As a reminder, state taxes are due by April 15. Make sure to submit your state tax return by April 15 in order to avoid late filing fees from %{state_name}. + + Go to fileyourstatetaxes.org/en/us/login-options to finish them now. + + Need help? Reply to this email. + + Best, + The FileYourStateTaxes team + subject: Don't forget to finish your state tax return by April 15! + sms: | + Hi %{primary_first_name} - You haven't submitted your state tax return yet. Make sure to submit your state taxes by April 15 in order to avoid late filing fees. Go to fileyourstatetaxes.org/en/us/login-options to finish them now. + + Need help? Reply to this text. rejected: email: body: | diff --git a/config/locales/es.yml b/config/locales/es.yml index 06caef386e..ea275b62d5 100644 --- a/config/locales/es.yml +++ b/config/locales/es.yml @@ -1583,6 +1583,24 @@ es: Hola, ¡Gracias por usar FileYourStateTaxes! Todos los problemas que hayas experimentado al usar nuestra herramienta han sido resueltos. Para continuar presentando tus impuestos estatales, inicia sesión aquí: %{login_link} ¿Preguntas? Responde a este mensaje. + post_deadline_reminder: + email: + body: | + Hola %{primary_first_name}, + + Aún no has presentado tu declaración de impuestos estatales. Como recordatorio, los impuestos estatales vencen el 15 de abril. Asegúrate de presentar tu declaración de impuestos estatales antes del 15 de abril para evitar multas por presentación tardía en %{state_name}. + + Ve a fileyourstatetaxes.org/es/us/login-options para terminarlos ahora. + + ¿Necesitas ayuda? Responde a este correo electrónico. + + Saludos, + El equipo de FileYourStateTaxes + subject: ¡No olvides terminar tu declaración de impuestos estatales antes del 15 de abril! + sms: | + Hola %{primary_first_name} - Aún no has presentado tu declaración de impuestos estatales. Asegúrate de presentar tus impuestos estatales antes del 15 de abril para evitar multas por presentación tardía. Ve a fileyourstatetaxes.org/es/us/login-options para terminarlos ahora. + + ¿Necesitas ayuda? Responde a este mensaje de texto. rejected: email: body: "Hola %{primary_first_name},\n\nLamentablemente, %{state_name} rechazó tu declaración de impuestos estatales. ¡No te preocupes! Podemos ayudarte a corregirla y volver a enviarla en %{return_status_link}.\n\n¿Preguntas? Responde a este correo electrónico.\n\nSaludos, \nEl equipo de FileYourStateTaxes\n" diff --git a/crontab b/crontab index 28d96d9bb5..db541c6027 100644 --- a/crontab +++ b/crontab @@ -8,3 +8,4 @@ */5 * * * * bundle exec rake worker_heartbeat:perform */10 * * * * bundle exec rake efile:poll_and_get_acknowledgments 0 17 * * * bundle exec rake state_file:reminder_to_finish_state_return +0 0 18 16 4 bundle exec rake state_file:post_deadline_reminder diff --git a/lib/tasks/state_file.rake b/lib/tasks/state_file.rake index 6d860b2331..5dc389d2a2 100644 --- a/lib/tasks/state_file.rake +++ b/lib/tasks/state_file.rake @@ -4,4 +4,9 @@ namespace :state_file do task reminder_to_finish_state_return: :environment do StateFile::ReminderToFinishStateReturnService.run end + + task post_deadline_reminder: :environment do + return unless DateTime.now.year == 2024 + StateFile::PostDeadlineReminderService.run + end end From d9c2cc5e08d3a3506a9066017985f9389485b5e0 Mon Sep 17 00:00:00 2001 From: Tim O'Farrell Date: Wed, 10 Apr 2024 09:04:02 -0600 Subject: [PATCH 2/4] Fixed typo --- app/services/state_file/post_deadline_reminder_service.rb | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/app/services/state_file/post_deadline_reminder_service.rb b/app/services/state_file/post_deadline_reminder_service.rb index 9c7c0b2b55..caf4a8b292 100644 --- a/app/services/state_file/post_deadline_reminder_service.rb +++ b/app/services/state_file/post_deadline_reminder_service.rb @@ -20,8 +20,7 @@ def self.run intakes_to_notify.each_slice(BATCH_SIZE) do |batch| batch.each do |intake| StateFile::MessagingService.new( - #message: StateFile::AutomatedMessage::FinishReturn, - message: StateFile::AutomatedMessage::FinishReturn, + message: StateFile::AutomatedMessage::PostDeadlineReminder, intake: intake ).send_message end From 965ee90dd71775cd81411700fab743c22f0b3381 Mon Sep 17 00:00:00 2001 From: Tim O'Farrell Date: Wed, 10 Apr 2024 09:14:29 -0600 Subject: [PATCH 3/4] I18n fixes --- config/locales/en.yml | 12 +----------- config/locales/es.yml | 12 ++++++------ 2 files changed, 7 insertions(+), 17 deletions(-) diff --git a/config/locales/en.yml b/config/locales/en.yml index 59f8b2b2ac..d362892ba0 100644 --- a/config/locales/en.yml +++ b/config/locales/en.yml @@ -1611,17 +1611,7 @@ en: Questions? Reply to this text. post_deadline_reminder: email: - body: | - Hi %{primary_first_name}, - - You haven't submitted your state tax return yet. As a reminder, state taxes are due by April 15. Make sure to submit your state tax return by April 15 in order to avoid late filing fees from %{state_name}. - - Go to fileyourstatetaxes.org/en/us/login-options to finish them now. - - Need help? Reply to this email. - - Best, - The FileYourStateTaxes team + body: "Hi %{primary_first_name},\n\nYou haven't submitted your state tax return yet. As a reminder, state taxes are due by April 15. Make sure to submit your state tax return by April 15 in order to avoid late filing fees from %{state_name}. \n\nGo to fileyourstatetaxes.org/en/us/login-options to finish them now.\n\nNeed help? Reply to this email.\n\nBest,\nThe FileYourStateTaxes team\n" subject: Don't forget to finish your state tax return by April 15! sms: | Hi %{primary_first_name} - You haven't submitted your state tax return yet. Make sure to submit your state taxes by April 15 in order to avoid late filing fees. Go to fileyourstatetaxes.org/en/us/login-options to finish them now. diff --git a/config/locales/es.yml b/config/locales/es.yml index ea275b62d5..752272cf37 100644 --- a/config/locales/es.yml +++ b/config/locales/es.yml @@ -1587,19 +1587,19 @@ es: email: body: | Hola %{primary_first_name}, - + Aún no has presentado tu declaración de impuestos estatales. Como recordatorio, los impuestos estatales vencen el 15 de abril. Asegúrate de presentar tu declaración de impuestos estatales antes del 15 de abril para evitar multas por presentación tardía en %{state_name}. - + Ve a fileyourstatetaxes.org/es/us/login-options para terminarlos ahora. - + ¿Necesitas ayuda? Responde a este correo electrónico. - + Saludos, El equipo de FileYourStateTaxes - subject: ¡No olvides terminar tu declaración de impuestos estatales antes del 15 de abril! + subject: "¡No olvides terminar tu declaración de impuestos estatales antes del 15 de abril!" sms: | Hola %{primary_first_name} - Aún no has presentado tu declaración de impuestos estatales. Asegúrate de presentar tus impuestos estatales antes del 15 de abril para evitar multas por presentación tardía. Ve a fileyourstatetaxes.org/es/us/login-options para terminarlos ahora. - + ¿Necesitas ayuda? Responde a este mensaje de texto. rejected: email: From 9991334c86df34f785db04f3543998d727dd484c Mon Sep 17 00:00:00 2001 From: Tim O'Farrell Date: Wed, 10 Apr 2024 09:39:17 -0600 Subject: [PATCH 4/4] Cron fix --- crontab | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/crontab b/crontab index db541c6027..9e68ddeec1 100644 --- a/crontab +++ b/crontab @@ -8,4 +8,4 @@ */5 * * * * bundle exec rake worker_heartbeat:perform */10 * * * * bundle exec rake efile:poll_and_get_acknowledgments 0 17 * * * bundle exec rake state_file:reminder_to_finish_state_return -0 0 18 16 4 bundle exec rake state_file:post_deadline_reminder +0 21 16 4 * bundle exec rake state_file:post_deadline_reminder