Skip to content

Commit

Permalink
Adapt apology reminder service/job to a new message (#5472)
Browse files Browse the repository at this point in the history
* exclude message from automated messages page
  • Loading branch information
jenny-heath authored Jan 29, 2025
1 parent de2caca commit 3eab760
Show file tree
Hide file tree
Showing 10 changed files with 121 additions and 87 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ class AutomatedMessagesController < Hub::StateFile::BaseController

def index
Rails.application.eager_load!
@messages = StateFile::AutomatedMessage::BaseAutomatedMessage.descendants
@messages = StateFile::AutomatedMessage::BaseAutomatedMessage.descendants.excluding(StateFile::AutomatedMessage::DfTransferIssueMessage)
@locales = [:en, :es]
@us_state = StateFile::StateInformationService.active_state_codes.include?(params[:us_state]) ? params[:us_state] : "az"
get_intake
Expand Down
25 changes: 25 additions & 0 deletions app/jobs/send_df_transfer_issue_message_job.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
class SendDfTransferIssueMessageJob < ApplicationJob
def perform(email: false, sms: false, contact_info: nil, state_code: nil)
message_instance = StateFile::AutomatedMessage::DfTransferIssueMessage.new

if email
StateFileNotificationEmail.create!(
data_source: nil, # we have no data source because the intakes have been deleted
to: contact_info,
body: message_instance.email_body(state_code: state_code),
subject: message_instance.email_subject(state_code: state_code)
)
end
if sms
StateFileNotificationTextMessage.create!(
data_source: nil, # we have no data source because the intakes have been deleted
to_phone_number: contact_info,
body: message_instance.sms_body(state_code: state_code),
)
end
end

def priority
PRIORITY_MEDIUM
end
end
12 changes: 0 additions & 12 deletions app/jobs/send_reminder_apology_message_job.rb

This file was deleted.

Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
module StateFile::AutomatedMessage
class DfTransferIssueMessage < BaseAutomatedMessage
def self.name
'messages.state_file.df_transfer_issue_message'.freeze
end

def self.after_transition_notification?
false
end

def self.send_only_once?
true
end

def sms_body(state_code:)
I18n.t("messages.state_file.df_transfer_issue_message.sms", state_code: state_code)
end

def email_subject(state_code:)
I18n.t("messages.state_file.df_transfer_issue_message.email.subject", state_name: StateFile::StateInformationService.state_name(state_code))
end

def email_body(state_code:)
I18n.t("messages.state_file.df_transfer_issue_message.email.body", state_code: state_code)
end
end
end
24 changes: 0 additions & 24 deletions app/models/state_file/automated_message/reminder_apology.rb

This file was deleted.

38 changes: 38 additions & 0 deletions app/services/state_file/send_df_transfer_issue_message_service.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
module StateFile
class SendDfTransferIssueMessageService
# assuming a data structure that looks like this:
# [
# {
# email: false,
# sms: true,
# contact_info: "5551112222",
# state_code: "az"
# }
# ]
# and that the client verified and opted in to each of these contact methods
def self.run(contact_list)
contact_list.each_with_index do |contact, i|
puts "."
if !StateFile::StateInformationService.active_state_codes.include?(contact[:state_code])
puts "state code missing or invalid; index #{i}; #{contact[:contact_info]}"
return
end
if contact[:contact_info].blank?
puts "no contact info; index #{i}; #{contact[:state_code]}"
return
end
if !contact[:email] && !contact[:sms]
puts "no contact method; index #{i}; #{contact[:contact_info]} #{contact[:state_code]}"
return
end
SendDfTransferIssueMessageJob.perform_later(
email: contact[:email],
sms: contact[:sms],
contact_info: contact[:contact_info],
state_code: contact[:state_code]
)
end
end
end
end

15 changes: 0 additions & 15 deletions app/services/state_file/send_reminder_apology_service.rb

This file was deleted.

29 changes: 15 additions & 14 deletions config/locales/en.yml
Original file line number Diff line number Diff line change
Expand Up @@ -1544,6 +1544,21 @@ en:
The FileYourStateTaxes team
subject: 'FileYourStateTaxes Update: %{state_name} State Return Accepted'
sms: "Hi %{primary_first_name} - %{state_name} accepted your state tax return! You can expect to receive your refund as soon as %{state_name} approves your refund amount. \n\nDownload your return and check your refund status at %{return_status_link}\n\nNeed help? Email us at help@fileyourstatetaxes.org.\n"
df_transfer_issue_message:
email:
body: |
Hello, You may have experienced an issue transferring your federal return data from IRS Direct File. This issue is now resolved.
To continue filing your state tax return, please create a new account with FileYourStateTaxes by visiting: https://www.fileyourstatetaxes.org/en/%{state_code}/landing-page
Need help? Email us at help@fileyourstatetaxes.org or chat with us on FileYourStateTaxes.org
subject: 'FileYourStateTaxes: Regarding your %{state_name} tax return data import'
sms: |
Hello, you may have experienced an issue transferring your federal return data from IRS Direct File. This issue is now resolved.
To continue filing your state tax return, please create a new account with FileYourStateTaxes by visiting: https://www.fileyourstatetaxes.org/en/%{state_code}/landing-page
Need help? Email us at help@fileyourstatetaxes.org
finish_return:
email:
body: |
Expand Down Expand Up @@ -1625,20 +1640,6 @@ en:
Hi %{primary_first_name} - Unfortunately, %{state_name} rejected your state tax return. Don't worry! We can help you fix and resubmit it at %{return_status_link}.
Questions? Email us at help@fileyourstatetaxes.org.
reminder_apology:
email:
body: |
Hi %{primary_first_name},
Due to an error, some FileYourStateTaxes users who had already completed their state tax returns received an email earlier today reminding them to file by April 15.
If you have received a notification that your state return was accepted, you may disregard the reminder email you may have received earlier today. You can confirm your return status by visiting fileyourstatetaxes.org/en/us/login-options and logging into your account.
We sincerely apologize for the confusion and the stress this may have caused.
Thanks,
FileYourStateTaxes
subject: Please disregard previous message from FileYourStateTaxes
still_processing:
email:
body: |
Expand Down
29 changes: 15 additions & 14 deletions config/locales/es.yml
Original file line number Diff line number Diff line change
Expand Up @@ -1513,6 +1513,21 @@ es:
body: "Hola %{primary_first_name},\n\n¡%{state_name} ha aceptado tu declaración de impuestos estatales! Puedes esperar recibir tu reembolso tan pronto como %{state_name} apruebe la cantidad de tu reembolso.\n\nDescarga tu declaración y verifica el estado de tu reembolso en <a href=\"%{return_status_link}\" target=\"_blank\" rel=\"noopener nofollow\">%{return_status_link}</a>.\n\nSaludos, \nEl equipo de FileYourStateTaxes\n"
subject: 'Actualización de FileYourStateTaxes: Declaración Estatal de %{state_name} Aceptada'
sms: "Hola %{primary_first_name} - %{state_name} ¡Acepté su declaración de impuestos estatales! Puede esperar recibir su reembolso tan pronto como %{state_name} apruebe el monto de su reembolso. \n\nDescargue su devolución y verifique el estado de su reembolso en %{return_status_link}\n\n¿Necesitar ayuda? Envíenos un correo electrónico a help@fileyourstatetaxes.org.\n"
df_transfer_issue_message:
email:
body: |
Hello, You may have experienced an issue transferring your federal return data from IRS Direct File. This issue is now resolved.

To continue filing your state tax return, please create a new account with FileYourStateTaxes by visiting: https://www.fileyourstatetaxes.org/en/%{state_code}/landing-page

Need help? Email us at help@fileyourstatetaxes.org or chat with us on FileYourStateTaxes.org
subject: 'FileYourStateTaxes: Regarding your %{state_name} tax return data import'
sms: |
Hello, you may have experienced an issue transferring your federal return data from IRS Direct File. This issue is now resolved.

To continue filing your state tax return, please create a new account with FileYourStateTaxes by visiting: https://www.fileyourstatetaxes.org/en/%{state_code}/landing-page

Need help? Email us at help@fileyourstatetaxes.org
finish_return:
email:
body: |
Expand Down Expand Up @@ -1586,20 +1601,6 @@ es:
Hola %{primary_first_name} - Lamentablemente, %{state_name} rechazó su declaración de impuestos estatales. ¡No te preocupes! Podemos ayudarle a solucionarlo y volver a enviarlo en %{return_status_link}.

¿Preguntas? Envíenos un correo electrónico a help@fileyourstatetaxes.org.
reminder_apology:
email:
body: |
Hola %{primary_first_name},

Debido a un error, algunos usuarios de FileYourStateTaxes que ya enviaron sus declaraciones de impuestos estatales recibieron un mensaje hoy recordándoles que la fecha límite de declarar es el 15 de abril.

Si has recibido una noticia diciendo que tu declaración fue aceptada, puedes ignorar el mensaje recordatorio que hayas recibido hoy. Puedes confirmar el estatus de tu declaración visitando fileyourstatetaxes.org/es/us/login-options e ingresando a tu cuenta.

Nos disculpamos sinceramente por la confusión y el estrés que esto haya causado.

Gracias,
FileYourStateTaxes
subject: Favor de ignorar el mensaje recordatorio de FileYourStateTaxes
still_processing:
email:
body: |
Expand Down
7 changes: 0 additions & 7 deletions lib/tasks/state_file.rake
Original file line number Diff line number Diff line change
Expand Up @@ -15,13 +15,6 @@ namespace :state_file do
StateFile::SendPostDeadlineReminderService.run
end

task send_reminder_apology_message: :environment do
return unless DateTime.now.year == 2024
return if ENV["DO_NOT_SEND_APOLOGY_EMAIL"].present?

StateFile::SendReminderApologyService.run
end

task backfill_intake_submission_pdfs: :environment do
batch_size = 5
intake_types = StateFile::StateInformationService.state_intake_classes
Expand Down

0 comments on commit 3eab760

Please sign in to comment.