Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Post Deadline reminder #187355955 #4467

Closed
wants to merge 4 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
28 changes: 28 additions & 0 deletions app/models/state_file/automated_message/post_deadline_reminder.rb
Original file line number Diff line number Diff line change
@@ -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
30 changes: 30 additions & 0 deletions app/services/state_file/post_deadline_reminder_service.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
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::PostDeadlineReminder,
intake: intake
).send_message
end
end
end
end
end
8 changes: 8 additions & 0 deletions config/locales/en.yml
Original file line number Diff line number Diff line change
Expand Up @@ -1609,6 +1609,14 @@ 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},\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!
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think the subject should be Make sure to finish filing your state taxes as soon as possible. according to https://docs.google.com/spreadsheets/d/1pn0ib-gAYgZQJn-KmQJgch5WreS7qvNWJApLHrfQwxg/edit#gid=0

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: |
Expand Down
18 changes: 18 additions & 0 deletions config/locales/es.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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 <a href=\"%{return_status_link}\" target=\"_blank\" rel=\"noopener nofollow\">%{return_status_link}</a>.\n\n¿Preguntas? Responde a este correo electrónico.\n\nSaludos, \nEl equipo de FileYourStateTaxes\n"
Expand Down
1 change: 1 addition & 0 deletions crontab
Original file line number Diff line number Diff line change
Expand Up @@ -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 21 16 4 * bundle exec rake state_file:post_deadline_reminder
5 changes: 5 additions & 0 deletions lib/tasks/state_file.rake
Original file line number Diff line number Diff line change
Expand Up @@ -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
Loading