diff --git a/app/controllers/hub/state_file/automated_messages_controller.rb b/app/controllers/hub/state_file/automated_messages_controller.rb index 6d7fafff60..d90b9bb896 100644 --- a/app/controllers/hub/state_file/automated_messages_controller.rb +++ b/app/controllers/hub/state_file/automated_messages_controller.rb @@ -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 diff --git a/app/jobs/send_df_transfer_issue_message_job.rb b/app/jobs/send_df_transfer_issue_message_job.rb new file mode 100644 index 0000000000..508054d383 --- /dev/null +++ b/app/jobs/send_df_transfer_issue_message_job.rb @@ -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 diff --git a/app/jobs/send_reminder_apology_message_job.rb b/app/jobs/send_reminder_apology_message_job.rb deleted file mode 100644 index 9f96f2076f..0000000000 --- a/app/jobs/send_reminder_apology_message_job.rb +++ /dev/null @@ -1,12 +0,0 @@ -class SendReminderApologyMessageJob < ApplicationJob - def perform(intake) - StateFile::MessagingService.new( - message: StateFile::AutomatedMessage::ReminderApology, - intake: intake - ).send_message - end - - def priority - PRIORITY_MEDIUM - end -end diff --git a/app/models/state_file/automated_message/df_transfer_issue_message.rb b/app/models/state_file/automated_message/df_transfer_issue_message.rb new file mode 100644 index 0000000000..ae2bfa86c6 --- /dev/null +++ b/app/models/state_file/automated_message/df_transfer_issue_message.rb @@ -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 diff --git a/app/models/state_file/automated_message/reminder_apology.rb b/app/models/state_file/automated_message/reminder_apology.rb deleted file mode 100644 index bde057729c..0000000000 --- a/app/models/state_file/automated_message/reminder_apology.rb +++ /dev/null @@ -1,24 +0,0 @@ -module StateFile::AutomatedMessage - class ReminderApology < BaseAutomatedMessage - - def self.name - 'messages.state_file.reminder_apology'.freeze - end - - def self.after_transition_notification? - false - end - - def self.send_only_once? - true - end - - def email_subject(**args) - I18n.t("messages.state_file.reminder_apology.email.subject", **args) - end - - def email_body(**args) - I18n.t("messages.state_file.reminder_apology.email.body", **args) - end - end -end diff --git a/app/services/state_file/send_df_transfer_issue_message_service.rb b/app/services/state_file/send_df_transfer_issue_message_service.rb new file mode 100644 index 0000000000..1936825dfb --- /dev/null +++ b/app/services/state_file/send_df_transfer_issue_message_service.rb @@ -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 + diff --git a/app/services/state_file/send_reminder_apology_service.rb b/app/services/state_file/send_reminder_apology_service.rb deleted file mode 100644 index a8d03a3406..0000000000 --- a/app/services/state_file/send_reminder_apology_service.rb +++ /dev/null @@ -1,15 +0,0 @@ -module StateFile - class SendReminderApologyService - def self.run - - intakes = EfileSubmission.joins(:efile_submission_transitions) - .for_state_filing - .where("efile_submission_transitions.to_state = 'accepted'") - .extract_associated(:data_source) - - intakes.each do |intake| - SendReminderApologyMessageJob.perform_later(intake) - end - end - end -end diff --git a/config/locales/en.yml b/config/locales/en.yml index 2d23df1c7a..07e91477db 100644 --- a/config/locales/en.yml +++ b/config/locales/en.yml @@ -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: | @@ -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: | diff --git a/config/locales/es.yml b/config/locales/es.yml index 274c79c866..7c85ed0258 100644 --- a/config/locales/es.yml +++ b/config/locales/es.yml @@ -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 %{return_status_link}.\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: | @@ -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: | diff --git a/lib/tasks/state_file.rake b/lib/tasks/state_file.rake index 6a18d40892..d6b15a7f6a 100644 --- a/lib/tasks/state_file.rake +++ b/lib/tasks/state_file.rake @@ -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