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

FYST-545-add-maryland-address-screen-and-data-model-to-md #4927

Merged
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
module StateFile
module Questions
class MdPermanentAddressController < QuestionsController
include ReturnToReviewConcern
include EligibilityOffboardingConcern
DrewProebstel marked this conversation as resolved.
Show resolved Hide resolved
end
end
end
39 changes: 39 additions & 0 deletions app/forms/state_file/md_permanent_address_form.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
module StateFile
class MdPermanentAddressForm < QuestionsForm
set_attributes_for :intake,
:confirmed_permanent_address,
:permanent_street,
:permanent_apartment,
:permanent_city,
:permanent_zip,
:permanent_address_outside_md

validates :confirmed_permanent_address, presence: true
validates :permanent_street, presence: true, irs_street_address_type: { maximum: nil }, if: -> { confirmed_permanent_address == "no" }
validates :permanent_apartment, irs_street_address_type: { maximum: nil }
validates :permanent_city, presence: true, irs_street_address_type: { maximum: nil }, if: -> { confirmed_permanent_address == "no" }
validates :permanent_zip, presence: true, zip_code: { zip_code_lengths: [5, 9, 12].freeze }, if: -> { confirmed_permanent_address == "no" }

def initialize(intake = nil, params = nil)
if params[:confirmed_permanent_address] == "yes"
[:permanent_street, :permanent_apartment, :permanent_city, :permanent_zip].each do |param|
params[param] = ""
end
end
super(intake, params)
end

def save
attributes_from_direct_file = confirmed_permanent_address == "yes" ?
{
permanent_city: @intake.direct_file_data.mailing_city,
permanent_street: @intake.direct_file_data.mailing_street,
permanent_apartment: @intake.direct_file_data.mailing_apartment,
permanent_zip: @intake.direct_file_data.mailing_zip,
} : {}
attributes_from_direct_file[:permanent_address_outside_md] = @intake.direct_file_data.mailing_state != 'MD' && confirmed_permanent_address == "yes" ? "yes" : "no"
attributes_from_form = attributes_for(:intake).except(:permanent_zip).merge({permanent_zip: permanent_zip&.delete('-')})
@intake.update(attributes_from_form.merge(attributes_from_direct_file))
end
end
end
1 change: 1 addition & 0 deletions app/lib/navigation/state_file_md_question_navigation.rb
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@ class StateFileMdQuestionNavigation < Navigation::StateFileBaseQuestionNavigatio
Navigation::NavigationStep.new(StateFile::Questions::MdCountyController),
Navigation::NavigationStep.new(StateFile::Questions::DataTransferOffboardingController, false),
Navigation::NavigationStep.new(StateFile::Questions::IncomeReviewController),
Navigation::NavigationStep.new(StateFile::Questions::MdPermanentAddressController),
Navigation::NavigationStep.new(StateFile::Questions::UnemploymentController),
Navigation::NavigationStep.new(StateFile::Questions::PrimaryStateIdController),
Navigation::NavigationStep.new(StateFile::Questions::SpouseStateIdController),
Expand Down
7 changes: 7 additions & 0 deletions app/models/state_file_md_intake.rb
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
# account_type :integer default("unfilled"), not null
# bank_name :string
# city :string
# confirmed_permanent_address :integer default("unfilled"), not null
# consented_to_terms_and_conditions :integer default("unfilled"), not null
# contact_preference :integer default("unfilled"), not null
# current_sign_in_at :datetime
Expand All @@ -32,6 +33,11 @@
# locked_at :datetime
# message_tracker :jsonb
# payment_or_deposit_type :integer default("unfilled"), not null
# permanent_address_outside_md :integer default(0), not null
DrewProebstel marked this conversation as resolved.
Show resolved Hide resolved
# permanent_apartment :string
# permanent_city :string
# permanent_street :string
# permanent_zip :string
# phone_number :string
# phone_number_verified_at :datetime
# political_subdivision :string
Expand Down Expand Up @@ -91,6 +97,7 @@ class StateFileMdIntake < StateFileBaseIntake
enum eligibility_homebuyer_withdrawal: { unfilled: 0, yes: 1, no: 2 }, _prefix: :eligibility_homebuyer_withdrawal
enum eligibility_homebuyer_withdrawal_mfj: { unfilled: 0, yes: 1, no: 2 }, _prefix: :eligibility_homebuyer_withdrawal_mfj
enum eligibility_home_different_areas: { unfilled: 0, yes: 1, no: 2 }, _prefix: :eligibility_home_different_areas
enum confirmed_permanent_address: { unfilled: 0, yes: 1, no: 2 }, _prefix: :confirmed_permanent_address
Copy link
Contributor

Choose a reason for hiding this comment

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

Suggested change
enum confirmed_permanent_address: { unfilled: 0, yes: 1, no: 2 }, _prefix: :confirmed_permanent_address
enum confirmed_permanent_address: { unfilled: 0, yes: 1, no: 2 }, _prefix: :confirmed_permanent_address
enum permanent_address_outside_md: { unfilled: 0, yes: 1, no: 2 }, _prefix: :permanent_address_outside_md



def disqualifying_df_data_reason
Expand Down
9 changes: 3 additions & 6 deletions app/validators/zip_code_validator.rb
Original file line number Diff line number Diff line change
Expand Up @@ -7,12 +7,9 @@ def initialize(options)
end

def validate_each(record, attr_name, value)
unless value =~ ZIP_CODE_REGEX && @zip_code_lengths.include?(value.length) && ZipCodes.has_key?(value[0,5])
if @zip_code_lengths == [5]
msg = "validators.zip"
else
msg = "validators.zip_code_with_optional_extra_digits"
end
value = value.to_s.delete("-")
unless value =~ ZIP_CODE_REGEX && @zip_code_lengths.include?(value.length) && ZipCodes.has_key?(value[0, 5])
msg = @zip_code_lengths == [5] ? "validators.zip" : "validators.zip_code_with_optional_extra_digits"
record.errors.add(attr_name, I18n.t(msg))
end
end
Expand Down
55 changes: 55 additions & 0 deletions app/views/state_file/questions/md_permanent_address/edit.html.erb
Original file line number Diff line number Diff line change
@@ -0,0 +1,55 @@
<% title = t(".title") %>
<% content_for :page_title, title %>

<% content_for :card do %>
<h1 class="h2"><%= title %></h1>

<p>
<%= t('.mark_no_hint_html') %>
</p>

<%= form_with model: @form, url: { action: :update }, local: true, method: "put", builder: VitaMinFormBuilder do |f| %>
<% if params[:return_to_review].present? %>
<%= hidden_field_tag "return_to_review", params[:return_to_review] %>
<% end %>
<div class="question-with-follow-up spacing-below-15">
<div class="question-with-follow-up__question">
<div class="white-group">
<div class="form-question spacing-below-15">
<div class="text--bold"><%=t(".address_header") %></div>
<div><%= current_intake.direct_file_data.mailing_street %></div>
<div><%= current_intake.direct_file_data.mailing_city %>, <%= current_intake.direct_file_data.mailing_state %> <%= current_intake.direct_file_data.mailing_zip %></div>
</div>
<div>
<%=
f.cfa_radio_set(
:confirmed_permanent_address,
collection: [
{ value: :yes, label: t("general.affirmative") },
{ value: :no, label: t("general.negative"), input_html: { "data-follow-up": "#permanent-address-fields" } },
]
)
%>
</div>
</div>
</div>

<div class="question-with-follow-up__follow-up" id="permanent-address-fields">
<div class="white-group">
<div class="form-question spacing-below-25">
<%=t(".where_did_you_live") %>
</div>
<div class="form-group-tight">
<%= f.cfa_input_field(:permanent_street, t(".street_address_label")) %>
<%= f.cfa_input_field(:permanent_apartment, t(".apartment_number_label")) %>
<%= f.cfa_input_field(:permanent_city, t(".city_label")) %>
<%= f.cfa_input_field(:unfillable, t(".state_label"), options: { value: "Maryland", disabled: true }) %>
<%= f.cfa_input_field(:permanent_zip, t(".zip_label")) %>
</div>
</div>
</div>
</div>

<%= f.continue %>
<% end %>
<% end %>
11 changes: 11 additions & 0 deletions config/locales/en.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2577,6 +2577,17 @@ en:
permanent_home_heading: What is a permanent home?
subtitle: For the %{year} season, this tool will only be able to serve people with specific tax situations. Please answer the following questions to find out if you can use it.
title: First, let's see if you can use this tool to file your %{year} Maryland taxes
md_permanent_address:
edit:
address_header: Address
apartment_number_label: Apartment/Unit Number
city_label: City
mark_no_hint_html: Mark no if the address listed is a PO Box <strong>or</strong> if you lived at a different address on December 31, 2023
state_label: State
street_address_label: Street Address
title: Did you live at this address on December 31, 2023?
where_did_you_live: Where did you live on December 31, 2023?
zip_label: Zip Code
md_primary_state_id:
md_primary:
encourage_sharing: If you and your spouse have a driver’s license or state issued identification card please provide the requested information from it. The return will not be rejected if you do not provide a driver’s license or state-issued identification. If you provide this information, it may help to identify you as the taxpayer.
Expand Down
11 changes: 11 additions & 0 deletions config/locales/es.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2550,6 +2550,17 @@ es:
permanent_home_heading: "¿Qué es una vivienda permanente?"
subtitle: Para la temporada de %{year}, esta herramienta solo podrá servir a personas con situaciones tributarias específicas. Responda las siguientes preguntas para saber si puede usarla.
title: Primero, veamos si puedes usar esta herramienta para presentar tus impuestos de Maryland de %{year}
md_permanent_address:
edit:
address_header: Dirección
apartment_number_label: Número de apartamento/unidad
city_label: Cuidad
mark_no_hint_html: Marque "No" si la dirección indicada es un apartado postal <strong>o</strong> si vivió en una dirección diferente el 31 de diciembre de 2023
state_label: Estado
street_address_label: Dirección
title: "¿Viviste en esta dirección el 31 de diciembre de 2023?"
where_did_you_live: "¿Dónde viviste el 31 de diciembre de 2023?"
zip_label: Código postal
md_primary_state_id:
md_primary:
encourage_sharing: Si usted y su cónyuge tienen una licencia de conducir o una tarjeta de identificación emitida por el estado, proporcione la información solicitada. La devolución no será rechazada si no proporciona una licencia de conducir o una identificación emitida por el estado. Si proporciona esta información, puede ayudar a identificarlo como contribuyente.
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
class AddPermanentAddressApartmentCityStreetZipToStateFileMdIntake < ActiveRecord::Migration[7.1]
def change
add_column :state_file_md_intakes, :confirmed_permanent_address, :integer, default: 0, null: false
add_column :state_file_md_intakes, :permanent_apartment, :string
add_column :state_file_md_intakes, :permanent_city, :string
add_column :state_file_md_intakes, :permanent_street, :string
add_column :state_file_md_intakes, :permanent_zip, :string
end
end
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
class AddPermanentAddressOutsideMdToMdIntake < ActiveRecord::Migration[7.1]
def change
add_column :state_file_md_intakes, :permanent_address_outside_md, :integer, default: 0, null: false
end
end
8 changes: 7 additions & 1 deletion db/schema.rb
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
#
# It's strongly recommended that you check this file into your version control system.

ActiveRecord::Schema[7.1].define(version: 2024_10_28_231420) do
ActiveRecord::Schema[7.1].define(version: 2024_10_28_235723) do
# These are extensions that must be enabled in order to support this database
enable_extension "citext"
enable_extension "plpgsql"
Expand Down Expand Up @@ -1876,6 +1876,7 @@
t.integer "account_type", default: 0, null: false
t.string "bank_name"
t.string "city"
t.integer "confirmed_permanent_address", default: 0, null: false
t.integer "consented_to_terms_and_conditions", default: 0, null: false
t.integer "contact_preference", default: 0, null: false
t.datetime "created_at", null: false
Expand Down Expand Up @@ -1903,6 +1904,11 @@
t.datetime "locked_at"
t.jsonb "message_tracker", default: {}
t.integer "payment_or_deposit_type", default: 0, null: false
t.integer "permanent_address_outside_md", default: 0, null: false
t.string "permanent_apartment"
t.string "permanent_city"
t.string "permanent_street"
t.string "permanent_zip"
t.string "phone_number"
t.datetime "phone_number_verified_at"
t.string "political_subdivision"
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
require "rails_helper"

describe StateFile::Questions::MdPermanentAddressController do

let(:intake) { create :state_file_ny_refund_intake}
before do
sign_in intake
end

describe '#edit' do
render_views
it 'succeeds' do
get :edit
expect(response).to be_successful
expect(response_html).to have_text "Did you live at this address"
end
end
end
16 changes: 16 additions & 0 deletions spec/factories/state_file_md_intakes.rb
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
# account_type :integer default("unfilled"), not null
# bank_name :string
# city :string
# confirmed_permanent_address :integer default("unfilled"), not null
# consented_to_terms_and_conditions :integer default("unfilled"), not null
# contact_preference :integer default("unfilled"), not null
# current_sign_in_at :datetime
Expand All @@ -32,6 +33,11 @@
# locked_at :datetime
# message_tracker :jsonb
# payment_or_deposit_type :integer default("unfilled"), not null
# permanent_address_outside_md :integer default(0), not null
# permanent_apartment :string
# permanent_city :string
# permanent_street :string
# permanent_zip :string
# phone_number :string
# phone_number_verified_at :datetime
# political_subdivision :string
Expand Down Expand Up @@ -118,6 +124,16 @@
spouse_last_name { "Lando" }
end

factory :state_file_md_refund_intake do
Copy link
Contributor

Choose a reason for hiding this comment

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

Why do you need this factory case? And if you do need i would advise adding it as a trait instead so it would build or overwrite the base intake something more like:

Suggested change
factory :state_file_md_refund_intake do
trait :with_refund do
after(:build) do |intake, evaluator|
intake.direct_file_data.fed_wages = 2_000
intake.direct_file_data.fed_taxable_income = 2_000
intake.direct_file_data.fed_taxable_ssb = 0
intake.direct_file_data.fed_unemployment = 0
end
end

after(:build) do |intake, evaluator|
intake.direct_file_data.fed_wages = 2_000
intake.direct_file_data.fed_taxable_income = 2_000
intake.direct_file_data.fed_taxable_ssb = 0
intake.direct_file_data.fed_unemployment = 0
intake.raw_direct_file_data = intake.direct_file_data.to_s
DrewProebstel marked this conversation as resolved.
Show resolved Hide resolved
end
end

trait :df_data_2_w2s do
raw_direct_file_data { StateFile::DirectFileApiResponseSampleService.new.read_xml('md_zeus_two_w2s') }
end
Expand Down
4 changes: 4 additions & 0 deletions spec/features/state_file/complete_intake_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -556,6 +556,10 @@
expect(page).to have_text "Here are the income forms we transferred from your federal tax return."
click_on I18n.t("general.continue")

expect(page).to have_text "Mark no if the address listed is a PO Box or if you lived at a different address on December 31"
choose I18n.t("general.affirmative")
click_on I18n.t("general.continue")

expect(page).to have_text I18n.t('state_file.questions.unemployment.edit.title.one', year: MultiTenantService.statefile.current_tax_year)
choose I18n.t("general.affirmative")
fill_in I18n.t('state_file.questions.unemployment.edit.payer_name'), with: "Business Name"
Expand Down
Loading
Loading