From 863dbadf854c14771622ef54ecc3e587665c25c1 Mon Sep 17 00:00:00 2001 From: Tahsina Islam <79296603+tahsinaislam@users.noreply.github.com> Date: Mon, 30 Sep 2024 13:57:19 -0500 Subject: [PATCH] Move read/write from old integer columns to new decimal columns (#4797) --- app/controllers/flows_controller.rb | 4 - .../questions/az_subtractions_controller.rb | 2 +- .../questions/unemployment_controller.rb | 6 +- .../state_file/questions/w2_controller.rb | 8 +- .../az_charitable_contributions_form.rb | 12 +-- app/forms/state_file/az_excise_credit_form.rb | 12 +-- app/forms/state_file/az_subtractions_form.rb | 33 ++----- app/lib/efile/az/az140_calculator.rb | 20 ++-- app/lib/efile/ny/it201.rb | 2 +- .../ty2022/states/az/documents/state1099_g.rb | 6 +- .../ty2022/states/ny/documents/state1099_g.rb | 6 +- app/models/state_file1099_g.rb | 20 +--- app/models/state_file_az_intake.rb | 6 +- app/models/state_file_w2.rb | 58 +++++------ .../az_charitable_contributions/edit.html.erb | 4 +- .../questions/az_excise_credit/edit.html.erb | 2 +- .../questions/az_review/edit.html.erb | 8 +- .../questions/az_subtractions/edit.html.erb | 4 +- .../questions/unemployment/_form.html.erb | 6 +- .../questions/unemployment/index.html.erb | 2 +- .../state_file/questions/w2/edit.html.erb | 8 +- config/locales/en.yml | 2 +- config/locales/es.yml | 2 +- db/create_analytics_views.sql | 2 +- jmeter_test/fyst_az_5_minute_stress_test.jmx | 20 ++-- ...haritable_contributions_controller_spec.rb | 4 +- .../az_subtractions_controller_spec.rb | 4 +- .../questions/unemployment_controller_spec.rb | 26 ++--- .../questions/w2_controller_spec.rb | 40 ++++---- spec/data/migrate_monetary_values_spec.rb | 60 ------------ spec/factories/state_file/personas/2023/az.rb | 14 +-- spec/factories/state_file/personas/2023/ny.rb | 6 +- spec/factories/state_file1099_gs.rb | 9 +- spec/factories/state_file_az_intakes.rb | 5 - spec/factories/state_file_w2s.rb | 12 +-- .../state_file/complete_intake_spec.rb | 16 ++-- .../az_charitable_contributions_form_spec.rb | 36 +++---- .../state_file/az_excise_credit_form_spec.rb | 28 ++---- .../state_file/az_subtractions_form_spec.rb | 50 +++++----- spec/lib/efile/az/az140_calculator_spec.rb | 8 +- spec/lib/efile/az/az301_calculator_spec.rb | 4 +- .../submission_builder/state_return_spec.rb | 22 ++--- .../ty2022/states/az/az_return_xml_spec.rb | 4 +- spec/models/state_file1099_g_spec.rb | 95 ++++--------------- spec/models/state_file_az_intake_spec.rb | 7 +- spec/models/state_file_w2_spec.rb | 82 ++++------------ 46 files changed, 264 insertions(+), 523 deletions(-) delete mode 100644 spec/data/migrate_monetary_values_spec.rb diff --git a/app/controllers/flows_controller.rb b/app/controllers/flows_controller.rb index 46ff3ceb28..30ee690504 100644 --- a/app/controllers/flows_controller.rb +++ b/app/controllers/flows_controller.rb @@ -631,12 +631,9 @@ def self.ny_attributes(first_name: 'Testuser', last_name: 'Testuser', filing_sta def self.az_attributes(first_name: 'Testuser', last_name: 'Testuser', filing_status: :single) base_attributes = common_attributes.merge( armed_forces_member: "yes", - armed_forces_wages: 100, armed_forces_wages_amount: 100, - charitable_cash: 123, charitable_cash_amount: 123, charitable_contributions: "yes", - charitable_noncash: 123, charitable_noncash_amount: 123, contact_preference: "email", eligibility_529_for_non_qual_expense: "no", @@ -649,7 +646,6 @@ def self.az_attributes(first_name: 'Testuser', last_name: 'Testuser', filing_sta primary_last_name: last_name, prior_last_names: "Jordan, Pippen, Rodman", tribal_member: "yes", - tribal_wages: 100, tribal_wages_amount: 100, primary_was_incarcerated: "no", spouse_was_incarcerated: "no", diff --git a/app/controllers/state_file/questions/az_subtractions_controller.rb b/app/controllers/state_file/questions/az_subtractions_controller.rb index e8b22c043e..3cf17224af 100644 --- a/app/controllers/state_file/questions/az_subtractions_controller.rb +++ b/app/controllers/state_file/questions/az_subtractions_controller.rb @@ -11,7 +11,7 @@ def self.show?(intake) def form_params params.require(:state_file_az_subtractions_form).permit( - [:armed_forces_member, :armed_forces_wages, :tribal_member, :tribal_wages] + [:armed_forces_member, :armed_forces_wages_amount, :tribal_member, :tribal_wages_amount] ) end end diff --git a/app/controllers/state_file/questions/unemployment_controller.rb b/app/controllers/state_file/questions/unemployment_controller.rb index a062fadb72..f1164cd158 100644 --- a/app/controllers/state_file/questions/unemployment_controller.rb +++ b/app/controllers/state_file/questions/unemployment_controller.rb @@ -80,9 +80,9 @@ def state_file1099_params :payer_street_address, :payer_tin, :payer_zip, - :federal_income_tax_withheld, - :state_income_tax_withheld, - :unemployment_compensation, + :federal_income_tax_withheld_amount, + :state_income_tax_withheld_amount, + :unemployment_compensation_amount, :recipient_city, :recipient_street_address, :recipient_street_address_apartment, diff --git a/app/controllers/state_file/questions/w2_controller.rb b/app/controllers/state_file/questions/w2_controller.rb index 9635fddd38..d37bc7860d 100644 --- a/app/controllers/state_file/questions/w2_controller.rb +++ b/app/controllers/state_file/questions/w2_controller.rb @@ -93,10 +93,10 @@ def self.w2s_for_intake(intake) state_file_intake: intake, w2_index: index, employer_state_id_num: df_w2.EmployerStateIdNum, - state_wages_amt: df_w2.StateWagesAmt, - state_income_tax_amt: df_w2.StateIncomeTaxAmt, - local_wages_and_tips_amt: df_w2.LocalWagesAndTipsAmt, - local_income_tax_amt: df_w2.LocalIncomeTaxAmt, + state_wages_amount: df_w2.StateWagesAmt, + state_income_tax_amount: df_w2.StateIncomeTaxAmt, + local_wages_and_tips_amount: df_w2.LocalWagesAndTipsAmt, + local_income_tax_amount: df_w2.LocalIncomeTaxAmt, locality_nm: df_w2.LocalityNm ) end diff --git a/app/forms/state_file/az_charitable_contributions_form.rb b/app/forms/state_file/az_charitable_contributions_form.rb index 77e92f1478..9bdbff0edb 100644 --- a/app/forms/state_file/az_charitable_contributions_form.rb +++ b/app/forms/state_file/az_charitable_contributions_form.rb @@ -1,21 +1,17 @@ module StateFile class AzCharitableContributionsForm < QuestionsForm - set_attributes_for :intake, :charitable_contributions, :charitable_cash, :charitable_noncash, :charitable_cash_amount, :charitable_noncash_amount + set_attributes_for :intake, :charitable_contributions, :charitable_cash_amount, :charitable_noncash_amount validates :charitable_contributions, inclusion: { in: %w[yes no], message: :blank } - validates_numericality_of :charitable_cash, only_integer: true, message: :whole_number, if: -> { charitable_contributions == "yes" } - validates :charitable_cash, presence: true, numericality: { greater_than_or_equal_to: 0 }, allow_blank: false, if: -> { charitable_contributions == "yes" } - validates_numericality_of :charitable_noncash, only_integer: true, message: :whole_number, if: -> { charitable_contributions == "yes" } - validates :charitable_noncash, presence: true, numericality: { greater_than_or_equal_to: 0, less_than_or_equal_to: 500 }, allow_blank: false, if: -> { charitable_contributions == "yes" } + validates :charitable_cash_amount, presence: true, numericality: { greater_than_or_equal_to: 0 }, allow_blank: false, if: -> { charitable_contributions == "yes" } + validates :charitable_noncash_amount, presence: true, numericality: { greater_than_or_equal_to: 0, less_than_or_equal_to: 500 }, allow_blank: false, if: -> { charitable_contributions == "yes" } def save if charitable_contributions == "no" - @intake.update(charitable_contributions: "no", charitable_cash: nil, charitable_noncash: nil, charitable_cash_amount: nil, charitable_noncash_amount: nil) + @intake.update(charitable_contributions: "no", charitable_cash_amount: nil, charitable_noncash_amount: nil) else @intake.update(attributes_for(:intake)) - additional_attributes = { charitable_cash_amount: charitable_cash, charitable_noncash_amount: charitable_noncash } - @intake.update(attributes_for(:intake).merge(additional_attributes)) end end end diff --git a/app/forms/state_file/az_excise_credit_form.rb b/app/forms/state_file/az_excise_credit_form.rb index 92cf80a9ca..f014fa6669 100644 --- a/app/forms/state_file/az_excise_credit_form.rb +++ b/app/forms/state_file/az_excise_credit_form.rb @@ -5,26 +5,20 @@ class AzExciseCreditForm < QuestionsForm :spouse_was_incarcerated, :ssn_no_employment, :household_excise_credit_claimed, - :household_excise_credit_claimed_amt, :household_excise_credit_claimed_amount validates :primary_was_incarcerated, inclusion: { in: %w[yes no], message: :blank } validates :spouse_was_incarcerated, inclusion: { in: %w[yes no], message: :blank }, if: -> { intake.filing_status_mfj? } validates :ssn_no_employment, inclusion: { in: %w[yes no], message: :blank } validates :household_excise_credit_claimed, inclusion: { in: %w[yes no], message: :blank } - validates_presence_of :household_excise_credit_claimed_amt, if: -> { household_excise_credit_claimed == "yes" } - validates :household_excise_credit_claimed_amt, numericality: { only_integer: true, greater_than: 0, message: ->(_object, _data) { I18n.t('validators.must_enter_amount') } }, allow_blank: true + validates_presence_of :household_excise_credit_claimed_amount, if: -> { household_excise_credit_claimed == "yes" } + validates :household_excise_credit_claimed_amount, numericality: { greater_than: 0, message: ->(_object, _data) { I18n.t('validators.must_enter_amount') } }, allow_blank: true def save attributes = attributes_for(:intake) if household_excise_credit_claimed == "no" - attributes = attributes.merge(household_excise_credit_claimed_amt: nil, household_excise_credit_claimed_amount: nil) - else - attributes = attributes.merge( - household_excise_credit_claimed_amount: household_excise_credit_claimed_amt - ) + attributes = attributes.merge(household_excise_credit_claimed_amount: nil) end - @intake.update(attributes) end end diff --git a/app/forms/state_file/az_subtractions_form.rb b/app/forms/state_file/az_subtractions_form.rb index 3709ec3702..9312aa20d2 100644 --- a/app/forms/state_file/az_subtractions_form.rb +++ b/app/forms/state_file/az_subtractions_form.rb @@ -1,30 +1,15 @@ module StateFile class AzSubtractionsForm < QuestionsForm - set_attributes_for :intake, :tribal_member, :tribal_wages, :armed_forces_member, :armed_forces_wages, :tribal_wages_amount, :armed_forces_wages_amount + set_attributes_for :intake, :tribal_member, :armed_forces_member, :tribal_wages_amount, :armed_forces_wages_amount - validates_numericality_of :tribal_wages, only_integer: true, message: :whole_number, if: -> { tribal_member == "yes" } - validates :tribal_wages, presence: true, allow_blank: false, numericality: { greater_than_or_equal_to: 1 }, if: -> { tribal_member == "yes" } - validates_numericality_of :armed_forces_wages, only_integer: true, message: :whole_number, if: -> { armed_forces_member == "yes" } - validates :armed_forces_wages, presence: true, allow_blank: false, numericality: { greater_than_or_equal_to: 1 }, if: -> { armed_forces_member == "yes" } - validate :below_1040_amount, if: -> { tribal_wages.present? || armed_forces_wages.present? } + validates :tribal_wages_amount, presence: true, allow_blank: false, numericality: { greater_than_or_equal_to: 1 }, if: -> { tribal_member == "yes" } + validates :armed_forces_wages_amount, presence: true, allow_blank: false, numericality: { greater_than_or_equal_to: 1 }, if: -> { armed_forces_member == "yes" } + validate :below_1040_amount, if: -> { tribal_wages_amount.present? || armed_forces_wages_amount.present? } def save attributes_to_save = attributes_for(:intake) - - if tribal_member == "no" - attributes_to_save[:tribal_wages] = nil - attributes_to_save[:tribal_wages_amount] = nil - else - attributes_to_save[:tribal_wages_amount] = tribal_wages - end - - if armed_forces_member == "no" - attributes_to_save[:armed_forces_wages] = nil - attributes_to_save[:armed_forces_wages_amount] = nil - else - attributes_to_save[:armed_forces_wages_amount] = armed_forces_wages - end - + attributes_to_save[:tribal_wages_amount] = nil if tribal_member == "no" + attributes_to_save[:armed_forces_wages_amount] = nil if armed_forces_member == "no" @intake.update(attributes_to_save) end @@ -32,11 +17,11 @@ def save def below_1040_amount amount_limit = @intake.direct_file_data.fed_wages_salaries_tips - total = self.tribal_wages.to_i + self.armed_forces_wages.to_i + total = self.tribal_wages_amount.to_d.round + self.armed_forces_wages_amount.to_d.round if total > amount_limit errors.add(:base, I18n.t("forms.errors.state_credit.exceeds_limit", limit: amount_limit)) - errors.add(:tribal_wages, "") - errors.add(:armed_forces_wages, "") + errors.add(:tribal_wages_amount, "") + errors.add(:armed_forces_wages_amount, "") end end end diff --git a/app/lib/efile/az/az140_calculator.rb b/app/lib/efile/az/az140_calculator.rb index c3fabcbfdf..a15a40c280 100644 --- a/app/lib/efile/az/az140_calculator.rb +++ b/app/lib/efile/az/az140_calculator.rb @@ -23,8 +23,8 @@ def initialize(year:, intake:, include_source: false) end def calculate - set_line(:AZ140_CCWS_LINE_1c, @intake, :charitable_cash) - set_line(:AZ140_CCWS_LINE_2c, @intake, :charitable_noncash) + set_line(:AZ140_CCWS_LINE_1c, :calculate_line_1c) + set_line(:AZ140_CCWS_LINE_2c, :calculate_line_2c) set_line(:AZ140_CCWS_LINE_3c, -> { 0 }) set_line(:AZ140_CCWS_LINE_4c, :calculate_ccws_line_4c) set_line(:AZ140_CCWS_LINE_5c, -> { 0 }) @@ -94,6 +94,14 @@ def analytics_attrs private + def calculate_line_1c + @intake.charitable_cash_amount&.round + end + + def calculate_line_2c + @intake.charitable_noncash_amount&.round + end + def calculate_line_14 line_or_zero(:AZ140_LINE_12) end @@ -120,11 +128,11 @@ def calculate_line_29B end def calculate_line_31 - @intake.tribal_member_yes? ? @intake.tribal_wages : 0 + @intake.tribal_member_yes? ? @intake.tribal_wages_amount&.round : 0 end def calculate_line_32 - @intake.armed_forces_member_yes? ? @intake.armed_forces_wages : 0 + @intake.armed_forces_member_yes? ? @intake.armed_forces_wages_amount&.round : 0 end def calculate_line_35 @@ -255,7 +263,7 @@ def calculate_line_53 # AZ income tax withheld # sum of tax withheld from all income documents: W-2, 1099-R, 1099-G, 1099-INT @direct_file_data.total_w2_state_tax_withheld + - @intake.state_file1099_gs.sum(&:state_income_tax_withheld) + + @intake.state_file1099_gs.sum { |item| item.state_income_tax_withheld_amount.round } + @direct_file_data.total_1099r_state_tax_withheld end @@ -269,7 +277,7 @@ def calculate_line_56 wrksht_line_4 = (@dependent_count + wrksht_line_2) * 25 max_credit = 100 - max_credit -= @intake.household_excise_credit_claimed_amt if @intake.household_excise_credit_claimed_yes? && @intake.household_excise_credit_claimed_amt.is_a?(Integer) + max_credit -= @intake.household_excise_credit_claimed_amount&.round if @intake.household_excise_credit_claimed_yes? [wrksht_line_4, max_credit].min end diff --git a/app/lib/efile/ny/it201.rb b/app/lib/efile/ny/it201.rb index 27d512b016..68b1023399 100644 --- a/app/lib/efile/ny/it201.rb +++ b/app/lib/efile/ny/it201.rb @@ -329,7 +329,7 @@ def calculate_line_72 # NY income tax withheld # sum of tax withheld from all income documents @direct_file_data.total_w2_state_tax_withheld + - @intake.state_file1099_gs.sum(&:state_income_tax_withheld) + @intake.state_file1099_gs.sum { |item| item.state_income_tax_withheld_amount.round } end def calculate_line_73 diff --git a/app/lib/submission_builder/ty2022/states/az/documents/state1099_g.rb b/app/lib/submission_builder/ty2022/states/az/documents/state1099_g.rb index 7ba0f0f27f..0df90efe60 100644 --- a/app/lib/submission_builder/ty2022/states/az/documents/state1099_g.rb +++ b/app/lib/submission_builder/ty2022/states/az/documents/state1099_g.rb @@ -36,10 +36,10 @@ def document xml.StateAbbreviationCd "AZ" xml.ZIPCd sanitize_for_xml(form1099g.recipient_zip) end - xml.UnemploymentCompensation form1099g.unemployment_compensation - xml.FederalTaxWithheld form1099g.federal_income_tax_withheld + xml.UnemploymentCompensation form1099g.unemployment_compensation_amount&.round + xml.FederalTaxWithheld form1099g.federal_income_tax_withheld_amount&.round xml.State1099GStateLocalTaxGrp do - xml.StateTaxWithheldAmt form1099g.state_income_tax_withheld + xml.StateTaxWithheldAmt form1099g.state_income_tax_withheld_amount&.round xml.StateAbbreviationCd "AZ" if form1099g.state_identification_number && form1099g.state_identification_number != '' xml.PayerStateIdNumber form1099g.state_identification_number diff --git a/app/lib/submission_builder/ty2022/states/ny/documents/state1099_g.rb b/app/lib/submission_builder/ty2022/states/ny/documents/state1099_g.rb index 24fd86de4a..4d99f237f1 100644 --- a/app/lib/submission_builder/ty2022/states/ny/documents/state1099_g.rb +++ b/app/lib/submission_builder/ty2022/states/ny/documents/state1099_g.rb @@ -36,10 +36,10 @@ def document xml.StateAbbreviationCd "NY" xml.ZIPCd form1099g.recipient_zip if form1099g.recipient_zip.present? end - xml.UnemploymentCompensation form1099g.unemployment_compensation if form1099g.unemployment_compensation.present? - xml.FederalTaxWithheld form1099g.federal_income_tax_withheld if form1099g.federal_income_tax_withheld.present? + xml.UnemploymentCompensation form1099g.unemployment_compensation_amount.round if form1099g.unemployment_compensation_amount.present? + xml.FederalTaxWithheld form1099g.federal_income_tax_withheld_amount.round if form1099g.federal_income_tax_withheld_amount.present? xml.State1099GStateLocalTaxGrp do - xml.StateTaxWithheldAmt form1099g.state_income_tax_withheld if form1099g.state_income_tax_withheld.present? + xml.StateTaxWithheldAmt form1099g.state_income_tax_withheld_amount.round if form1099g.state_income_tax_withheld_amount.present? xml.StateAbbreviationCd "NY" if form1099g.state_identification_number && form1099g.state_identification_number != '' xml.PayerStateIdNumber form1099g.state_identification_number diff --git a/app/models/state_file1099_g.rb b/app/models/state_file1099_g.rb index b0661cc88f..cebbb05f40 100644 --- a/app/models/state_file1099_g.rb +++ b/app/models/state_file1099_g.rb @@ -4,7 +4,6 @@ # # id :bigint not null, primary key # address_confirmation :integer default("unfilled"), not null -# federal_income_tax_withheld :integer # federal_income_tax_withheld_amount :decimal(12, 2) # had_box_11 :integer default("unfilled"), not null # intake_type :string not null @@ -19,9 +18,7 @@ # recipient_street_address_apartment :string # recipient_zip :string # state_identification_number :string -# state_income_tax_withheld :integer # state_income_tax_withheld_amount :decimal(12, 2) -# unemployment_compensation :integer # unemployment_compensation_amount :decimal(12, 2) # created_at :datetime not null # updated_at :datetime not null @@ -32,9 +29,9 @@ # index_state_file1099_gs_on_intake (intake_type,intake_id) # class StateFile1099G < ApplicationRecord + self.ignored_columns = %w[unemployment_compensation federal_income_tax_withheld state_income_tax_withheld] belongs_to :intake, polymorphic: true before_validation :update_conditional_attributes - before_save :sync_amount_columns enum address_confirmation: { unfilled: 0, yes: 1, no: 2 }, _prefix: :address_confirmation enum had_box_11: { unfilled: 0, yes: 1, no: 2 }, _prefix: :had_box_11 @@ -50,20 +47,11 @@ class StateFile1099G < ApplicationRecord validates :recipient_street_address_apartment, format: { :with => /\A[a-zA-Z0-9\/\s-]+\z/.freeze, message: ->(_object, _data) { I18n.t("errors.attributes.address.street_address.invalid") }}, allow_blank: true validates :recipient_city, presence: true, format: { with: /\A[a-zA-Z\s]+\z/.freeze, message: ->(_object, _data) { I18n.t("errors.attributes.address.city.invalid") }} validates :recipient_zip, zip_code: { zip_code_lengths: [5, 9, 12].freeze } - validates_numericality_of :unemployment_compensation, only_integer: true, message: :whole_number - validates :unemployment_compensation, numericality: { greater_than_or_equal_to: 1 } - validates_numericality_of :federal_income_tax_withheld, only_integer: true, message: :whole_number - validates :federal_income_tax_withheld, numericality: { greater_than_or_equal_to: 0} - validates_numericality_of :state_income_tax_withheld, only_integer: true, message: :whole_number - validates :state_income_tax_withheld, numericality: { greater_than_or_equal_to: 0} + validates :unemployment_compensation_amount, numericality: { greater_than_or_equal_to: 1 } + validates :federal_income_tax_withheld_amount, numericality: { greater_than_or_equal_to: 0} + validates :state_income_tax_withheld_amount, numericality: { greater_than_or_equal_to: 0} validate :state_specific_validation - def sync_amount_columns - self.unemployment_compensation_amount = unemployment_compensation if unemployment_compensation.present? - self.federal_income_tax_withheld_amount = federal_income_tax_withheld if federal_income_tax_withheld.present? - self.state_income_tax_withheld_amount = state_income_tax_withheld if state_income_tax_withheld.present? - end - def update_conditional_attributes if address_confirmation_yes? self.recipient_city = intake.direct_file_data.mailing_city diff --git a/app/models/state_file_az_intake.rb b/app/models/state_file_az_intake.rb index c786cc7c0a..9b90e982fc 100644 --- a/app/models/state_file_az_intake.rb +++ b/app/models/state_file_az_intake.rb @@ -6,13 +6,10 @@ # account_number :string # account_type :integer # armed_forces_member :integer default("unfilled"), not null -# armed_forces_wages :integer # armed_forces_wages_amount :decimal(12, 2) # bank_name :string -# charitable_cash :integer default(0) # charitable_cash_amount :decimal(12, 2) # charitable_contributions :integer default("unfilled"), not null -# charitable_noncash :integer default(0) # charitable_noncash_amount :decimal(12, 2) # consented_to_terms_and_conditions :integer default("unfilled"), not null # contact_preference :integer default("unfilled"), not null @@ -34,7 +31,6 @@ # hashed_ssn :string # household_excise_credit_claimed :integer default("unfilled"), not null # household_excise_credit_claimed_amount :decimal(12, 2) -# household_excise_credit_claimed_amt :integer # last_sign_in_at :datetime # last_sign_in_ip :inet # locale :string default("en") @@ -75,7 +71,6 @@ # spouse_was_incarcerated :integer default("unfilled"), not null # ssn_no_employment :integer default("unfilled"), not null # tribal_member :integer default("unfilled"), not null -# tribal_wages :integer # tribal_wages_amount :decimal(12, 2) # unfinished_intake_ids :text default([]), is an Array # unsubscribed_from_email :boolean default(FALSE), not null @@ -96,6 +91,7 @@ # index_state_file_az_intakes_on_spouse_state_id_id (spouse_state_id_id) # class StateFileAzIntake < StateFileBaseIntake + self.ignored_columns = %w[charitable_cash charitable_noncash household_excise_credit_claimed_amt tribal_wages armed_forces_wages] encrypts :account_number, :routing_number, :raw_direct_file_data, :raw_direct_file_intake_data has_many :az322_contributions, dependent: :destroy diff --git a/app/models/state_file_w2.rb b/app/models/state_file_w2.rb index 3316d35bd3..6e84a24a55 100644 --- a/app/models/state_file_w2.rb +++ b/app/models/state_file_w2.rb @@ -5,15 +5,11 @@ # id :bigint not null, primary key # employer_state_id_num :string # local_income_tax_amount :decimal(12, 2) -# local_income_tax_amt :integer # local_wages_and_tips_amount :decimal(12, 2) -# local_wages_and_tips_amt :integer # locality_nm :string # state_file_intake_type :string # state_income_tax_amount :decimal(12, 2) -# state_income_tax_amt :integer # state_wages_amount :decimal(12, 2) -# state_wages_amt :integer # w2_index :integer # created_at :datetime not null # updated_at :datetime not null @@ -24,7 +20,7 @@ # index_state_file_w2s_on_state_file_intake (state_file_intake_type,state_file_intake_id) # class StateFileW2 < ApplicationRecord - before_save :sync_amount_columns + self.ignored_columns = %w[state_wages_amt state_income_tax_amt local_wages_and_tips_amt local_income_tax_amt] include XmlMethods STATE_TAX_GRP_TEMPLATE = <<~XML @@ -45,50 +41,40 @@ class StateFileW2 < ApplicationRecord validates :w2_index, presence: true, numericality: { only_integer: true, greater_than_or_equal_to: 0 } validates :employer_state_id_num, format: { with: /\A(\d{0,17})\z/, message: ->(_object, _data) { I18n.t('state_file.questions.w2.edit.employer_state_id_error') } } - validates_numericality_of :state_wages_amt, only_integer: true, message: :round_to_whole_number, if: -> { state_wages_amt.present? } - validates :state_wages_amt, numericality: { greater_than_or_equal_to: 0 }, if: -> { state_wages_amt.present? } - validates_numericality_of :state_income_tax_amt, only_integer: true, message: :round_to_whole_number, if: -> { state_income_tax_amt.present? } - validates :state_income_tax_amt, numericality: { greater_than_or_equal_to: 0 }, if: -> { state_income_tax_amt.present? } - validates_numericality_of :local_wages_and_tips_amt, only_integer: true, message: :round_to_whole_number, if: -> { local_wages_and_tips_amt.present? } - validates :local_wages_and_tips_amt, numericality: { greater_than_or_equal_to: 0 }, if: -> { local_wages_and_tips_amt.present? } - validates_numericality_of :local_income_tax_amt, only_integer: true, message: :round_to_whole_number, if: -> { local_income_tax_amt.present? } - validates :local_income_tax_amt, numericality: { greater_than_or_equal_to: 0 }, if: -> { local_income_tax_amt.present? } - validates :locality_nm, presence: { message: ->(_object, _data) { I18n.t('state_file.questions.w2.edit.locality_nm_missing_error') } }, if: -> { local_wages_and_tips_amt.present? && local_wages_and_tips_amt.positive? } - validates :employer_state_id_num, presence: true, if: -> { state_wages_amt.present? && state_wages_amt.positive? } + validates :state_wages_amount, numericality: { greater_than_or_equal_to: 0 }, if: -> { state_wages_amount.present? } + validates :state_income_tax_amount, numericality: { greater_than_or_equal_to: 0 }, if: -> { state_income_tax_amount.present? } + validates :local_wages_and_tips_amount, numericality: { greater_than_or_equal_to: 0 }, if: -> { local_wages_and_tips_amount.present? } + validates :local_income_tax_amount, numericality: { greater_than_or_equal_to: 0 }, if: -> { local_income_tax_amount.present? } + validates :locality_nm, presence: { message: ->(_object, _data) { I18n.t('state_file.questions.w2.edit.locality_nm_missing_error') } }, if: -> { local_wages_and_tips_amount.present? && local_wages_and_tips_amount.positive? } + validates :employer_state_id_num, presence: true, if: -> { state_wages_amount.present? && state_wages_amount.positive? } validates :locality_nm, format: { with: /\A[a-zA-Z]{1}([A-Za-z\-\s']{0,19})\z/, message: :only_letters }, if: -> { locality_nm.present? } validate :validate_tax_amts validate :state_specific_validation before_validation :locality_nm_to_upper_case - def sync_amount_columns - self.state_wages_amount = state_wages_amt if state_wages_amt.present? - self.state_income_tax_amount = state_income_tax_amt if state_income_tax_amt.present? - self.local_wages_and_tips_amount = local_wages_and_tips_amt if local_wages_and_tips_amt.present? - self.local_income_tax_amount = local_income_tax_amt if local_income_tax_amt.present? - end def state_specific_validation state_file_intake.validate_state_specific_w2_requirements(self) if state_file_intake.present? end def validate_tax_amts - if (state_income_tax_amt || 0).positive? && (state_wages_amt || 0) <= 0 - errors.add(:state_wages_amt, I18n.t("state_file.questions.w2.edit.state_wages_amt_error")) + if (state_income_tax_amount || 0).positive? && (state_wages_amount || 0) <= 0 + errors.add(:state_wages_amount, I18n.t("state_file.questions.w2.edit.state_wages_amt_error")) end - if (local_income_tax_amt || 0).positive? && (local_wages_and_tips_amt || 0) <= 0 - errors.add(:local_wages_and_tips_amt, I18n.t("state_file.questions.w2.edit.local_wages_and_tips_amt_error")) + if (local_income_tax_amount || 0).positive? && (local_wages_and_tips_amount || 0) <= 0 + errors.add(:local_wages_and_tips_amount, I18n.t("state_file.questions.w2.edit.local_wages_and_tips_amt_error")) end - if state_income_tax_amt.present? && state_wages_amt.present? && state_income_tax_amt > state_wages_amt - errors.add(:state_income_tax_amt, I18n.t("state_file.questions.w2.edit.state_income_tax_amt_error")) + if state_income_tax_amount.present? && state_wages_amount.present? && state_income_tax_amount > state_wages_amount + errors.add(:state_income_tax_amount, I18n.t("state_file.questions.w2.edit.state_income_tax_amt_error")) end - if local_income_tax_amt.present? && local_wages_and_tips_amt.present? && local_income_tax_amt > local_wages_and_tips_amt - errors.add(:local_income_tax_amt, I18n.t("state_file.questions.w2.edit.local_income_tax_amt_error")) + if local_income_tax_amount.present? && local_wages_and_tips_amount.present? && local_income_tax_amount > local_wages_and_tips_amount + errors.add(:local_income_tax_amount, I18n.t("state_file.questions.w2.edit.local_income_tax_amt_error")) end w2 = state_file_intake.direct_file_data.w2s[w2_index] if w2.present? - if state_income_tax_amt.present? && local_income_tax_amt.present? && (state_income_tax_amt + local_income_tax_amt > w2.WagesAmt) - errors.add(:local_income_tax_amt, I18n.t("state_file.questions.w2.edit.wages_amt_error", wages_amount: w2.WagesAmt)) - errors.add(:state_income_tax_amt, I18n.t("state_file.questions.w2.edit.wages_amt_error", wages_amount: w2.WagesAmt)) + if state_income_tax_amount.present? && local_income_tax_amount.present? && (state_income_tax_amount + local_income_tax_amount > w2.WagesAmt) + errors.add(:local_income_tax_amount, I18n.t("state_file.questions.w2.edit.wages_amt_error", wages_amount: w2.WagesAmt)) + errors.add(:state_income_tax_amount, I18n.t("state_file.questions.w2.edit.wages_amt_error", wages_amount: w2.WagesAmt)) end end end @@ -103,10 +89,10 @@ def state_tax_group_xml_node xml_template = Nokogiri::XML(STATE_TAX_GRP_TEMPLATE) xml_template.at(:StateAbbreviationCd).content = employer_state_id_num.present? ? state_file_intake.state_code.upcase : "" xml_template.at(:EmployerStateIdNum).content = employer_state_id_num - xml_template.at(:StateWagesAmt).content = state_wages_amt - xml_template.at(:StateIncomeTaxAmt).content = state_income_tax_amt - xml_template.at(:LocalWagesAndTipsAmt).content = local_wages_and_tips_amt - xml_template.at(:LocalIncomeTaxAmt).content = local_income_tax_amt + xml_template.at(:StateWagesAmt).content = state_wages_amount&.round + xml_template.at(:StateIncomeTaxAmt).content = state_income_tax_amount&.round + xml_template.at(:LocalWagesAndTipsAmt).content = local_wages_and_tips_amount&.round + xml_template.at(:LocalIncomeTaxAmt).content = local_income_tax_amount&.round xml_template.at(:LocalityNm).content = locality_nm delete_blank_nodes(xml_template) result = xml_template.at(:W2StateTaxGrp) diff --git a/app/views/state_file/questions/az_charitable_contributions/edit.html.erb b/app/views/state_file/questions/az_charitable_contributions/edit.html.erb index 0c4ccd8c07..e00d0a809f 100644 --- a/app/views/state_file/questions/az_charitable_contributions/edit.html.erb +++ b/app/views/state_file/questions/az_charitable_contributions/edit.html.erb @@ -16,8 +16,8 @@
- <%= f.cfa_input_field(:charitable_cash, t(".charitable_cash_html", tax_year: MultiTenantService.statefile.current_tax_year), classes: ["form-width--long"]) %> - <%= f.cfa_input_field(:charitable_noncash, t(".charitable_noncash_html", tax_year: MultiTenantService.statefile.current_tax_year), classes: ["form-width--long"]) %> + <%= f.cfa_input_field(:charitable_cash_amount, t(".charitable_cash_html", tax_year: MultiTenantService.statefile.current_tax_year), classes: ["form-width--long"]) %> + <%= f.cfa_input_field(:charitable_noncash_amount, t(".charitable_noncash_html", tax_year: MultiTenantService.statefile.current_tax_year), classes: ["form-width--long"]) %>
diff --git a/app/views/state_file/questions/az_excise_credit/edit.html.erb b/app/views/state_file/questions/az_excise_credit/edit.html.erb index 717d099292..93d4e04702 100644 --- a/app/views/state_file/questions/az_excise_credit/edit.html.erb +++ b/app/views/state_file/questions/az_excise_credit/edit.html.erb @@ -38,7 +38,7 @@
- <%= f.cfa_input_field(:household_excise_credit_claimed_amt, t(".household_excise_credit_claimed_amt"), classes: ["form-width--long"]) %> + <%= f.cfa_input_field(:household_excise_credit_claimed_amount, t(".household_excise_credit_claimed_amt"), classes: ["form-width--long"]) %>
diff --git a/app/views/state_file/questions/az_review/edit.html.erb b/app/views/state_file/questions/az_review/edit.html.erb index 0e6e7e8611..4ef1db5754 100644 --- a/app/views/state_file/questions/az_review/edit.html.erb +++ b/app/views/state_file/questions/az_review/edit.html.erb @@ -26,13 +26,13 @@

<%=current_intake.tribal_member_yes? ? t("general.affirmative") : t("general.negative") %>

<% if current_intake.tribal_member_yes? %>

<%=t(".tribal_wages") %>

-

<%=number_to_currency(current_intake.tribal_wages) %>

+

<%=number_to_currency(current_intake.tribal_wages_amount) %>

<% end %>

<%=t(".armed_forces_member") %>

<%=current_intake.armed_forces_member_yes? ? t("general.affirmative") : t("general.negative") %>

<% if current_intake.armed_forces_member_yes? %>

<%=t(".armed_forces_wages") %>

-

<%=number_to_currency(current_intake.armed_forces_wages) %>

+

<%=number_to_currency(current_intake.armed_forces_wages_amount) %>

<% end %> <%= link_to t("general.edit"), StateFile::Questions::AzSubtractionsController.to_path_helper(return_to_review: "y"), class: "button--small" %> @@ -44,9 +44,9 @@

<%=current_intake.charitable_contributions_yes? ? t("general.affirmative") : t("general.negative") %>

<% if current_intake.charitable_contributions_yes? %>

<%=t(".charitable_cash") %>

-

<%=number_to_currency(current_intake.charitable_cash) || t("general.none") %>

+

<%=number_to_currency(current_intake.charitable_cash_amount) || t("general.none") %>

<%=t(".charitable_noncash") %>

-

<%=number_to_currency(current_intake.charitable_noncash) || t("general.none") %>

+

<%=number_to_currency(current_intake.charitable_noncash_amount) || t("general.none") %>

<% end %> <%= link_to t("general.edit"), StateFile::Questions::AzCharitableContributionsController.to_path_helper(return_to_review: "y"), class: "button--small" %> diff --git a/app/views/state_file/questions/az_subtractions/edit.html.erb b/app/views/state_file/questions/az_subtractions/edit.html.erb index 315c89f48e..43f9f91eda 100644 --- a/app/views/state_file/questions/az_subtractions/edit.html.erb +++ b/app/views/state_file/questions/az_subtractions/edit.html.erb @@ -21,7 +21,7 @@
<%= f.cfa_input_field( - :tribal_wages, + :tribal_wages_amount, t(".wages_tip"), classes: ["form-width--long"]) %> @@ -46,7 +46,7 @@
<%= f.cfa_input_field( - :armed_forces_wages, + :armed_forces_wages_amount, t(".wages_tip"), classes: ["form-width--long"]) %> diff --git a/app/views/state_file/questions/unemployment/_form.html.erb b/app/views/state_file/questions/unemployment/_form.html.erb index 6ba656be66..7ba54bb402 100644 --- a/app/views/state_file/questions/unemployment/_form.html.erb +++ b/app/views/state_file/questions/unemployment/_form.html.erb @@ -104,10 +104,10 @@

<%= t('state_file.questions.unemployment.edit.money_boxes_label') %>

- <%= f.cfa_input_field(:unemployment_compensation, t('state_file.questions.unemployment.edit.unemployment_compensation_html'), classes: ["form-width--long"]) %> - <%= f.cfa_input_field(:federal_income_tax_withheld, t('state_file.questions.unemployment.edit.federal_income_tax_withheld_html'), classes: ["form-width--long"]) %> + <%= f.cfa_input_field(:unemployment_compensation_amount, t('state_file.questions.unemployment.edit.unemployment_compensation_html'), classes: ["form-width--long"]) %> + <%= f.cfa_input_field(:federal_income_tax_withheld_amount, t('state_file.questions.unemployment.edit.federal_income_tax_withheld_html'), classes: ["form-width--long"]) %> <%= f.cfa_input_field(:state_identification_number, t('state_file.questions.unemployment.edit.box_10b_html'), classes: ["form-width--long"]) %> - <%= f.cfa_input_field(:state_income_tax_withheld, t('state_file.questions.unemployment.edit.state_income_tax_withheld_html'), classes: ["form-width--long"]) %> + <%= f.cfa_input_field(:state_income_tax_withheld_amount, t('state_file.questions.unemployment.edit.state_income_tax_withheld_html'), classes: ["form-width--long"]) %>
diff --git a/app/views/state_file/questions/unemployment/index.html.erb b/app/views/state_file/questions/unemployment/index.html.erb index 8d68cc7eac..90a9fde617 100644 --- a/app/views/state_file/questions/unemployment/index.html.erb +++ b/app/views/state_file/questions/unemployment/index.html.erb @@ -12,7 +12,7 @@ <%= t('.1099_label', name: form1099.recipient_name) %>

- <%= t('.unemployment_compensation', amount: form1099.unemployment_compensation) %> + <%= t('.unemployment_compensation', amount: form1099.unemployment_compensation_amount) %>

<%= link_to t("general.edit"), StateFile::Questions::UnemploymentController.to_path_helper(id: form1099, return_to_review: params[:return_to_review]), class: "button--small button--inline-action" %> diff --git a/app/views/state_file/questions/w2/edit.html.erb b/app/views/state_file/questions/w2/edit.html.erb index 9af35e1198..8bf1fe72f3 100644 --- a/app/views/state_file/questions/w2/edit.html.erb +++ b/app/views/state_file/questions/w2/edit.html.erb @@ -14,16 +14,16 @@ <%= f.cfa_input_field(:employer_state_id_num, t(".box15_html"), classes: ["form-width--long"]) %>
- <%= f.cfa_input_field(:state_wages_amt, t(".box16_html"), classes: ["form-width--long"]) %> + <%= f.cfa_input_field(:state_wages_amount, t(".box16_html"), classes: ["form-width--long"]) %>
- <%= f.cfa_input_field(:state_income_tax_amt, t(".box17_html"), classes: ["form-width--long"]) %> + <%= f.cfa_input_field(:state_income_tax_amount, t(".box17_html"), classes: ["form-width--long"]) %>
- <%= f.cfa_input_field(:local_wages_and_tips_amt, t(".box18_html"), classes: ["form-width--long"]) %> + <%= f.cfa_input_field(:local_wages_and_tips_amount, t(".box18_html"), classes: ["form-width--long"]) %>
- <%= f.cfa_input_field(:local_income_tax_amt, t(".box19_html"), classes: ["form-width--long"]) %> + <%= f.cfa_input_field(:local_income_tax_amount, t(".box19_html"), classes: ["form-width--long"]) %>
<%= f.cfa_input_field(:locality_nm, t(".box20_locality_name"), classes: ["form-width--long"]) %> diff --git a/config/locales/en.yml b/config/locales/en.yml index 2407665419..f805a1ec36 100644 --- a/config/locales/en.yml +++ b/config/locales/en.yml @@ -3068,7 +3068,7 @@ en: itin: Please enter a valid individual taxpayer identification number. legal_name: Please enter a name that only contains letters, apostrophes, hyphens, periods, and accents. must_be_associated_with_tax_return: "%{document_type} must be associated with a tax year." - must_enter_amount: If someone claimed this credit you must enter a whole number amount. + must_enter_amount: If someone claimed this credit you must enter an amount. must_not_be_associated_with_tax_return: "%{document_type} cannot be associated with a tax year." pdf_file_corrupted: File is corrupt. Please generate a new PDF and try uploading again. pdf_file_type: "%{document_type} must be a PDF file" diff --git a/config/locales/es.yml b/config/locales/es.yml index 5a6591b675..b07bfbf108 100644 --- a/config/locales/es.yml +++ b/config/locales/es.yml @@ -3057,7 +3057,7 @@ es: itin: Por favor ingrese un Número de Identificación Personal del Contribuyente válido. legal_name: Ingrese un nombre que solo contenga cartas, apóstrofos, guiones, puntos y acentos. must_be_associated_with_tax_return: "%{document_type} debe estar asociado con un año fiscal" - must_enter_amount: Si alguien reclamó este crédito, debe ingresar el monto en un número entero. + must_enter_amount: Si alguien reclamó este crédito deberá ingresar un monto. must_not_be_associated_with_tax_return: "%{document_type} no puede asociarse a un año fiscal en particular. " pdf_file_corrupted: Archivo está dañado. Genera un nuevo PDF e intenta subirlo de nuevo. pdf_file_type: "%{document_type} debe ser un archivo PDF" diff --git a/db/create_analytics_views.sql b/db/create_analytics_views.sql index 10e53eb088..690cad6b2f 100644 --- a/db/create_analytics_views.sql +++ b/db/create_analytics_views.sql @@ -299,5 +299,5 @@ CREATE view analytics.state_file_ny_intakes AS FROM public.state_file_ny_intakes; CREATE view analytics.state_file_w2s AS -SELECT id, employer_state_id_num, local_income_tax_amt, local_wages_and_tips_amt, locality_nm, state_file_intake_type, state_income_tax_amt, state_wages_amt, w2_index, created_at, updated_at, state_file_intake_id +SELECT id, employer_state_id_num, local_income_tax_amount, local_wages_and_tips_amount, locality_nm, state_file_intake_type, state_income_tax_amount, state_wages_amount, w2_index, created_at, updated_at, state_file_intake_id FROM public.state_file_w2s; diff --git a/jmeter_test/fyst_az_5_minute_stress_test.jmx b/jmeter_test/fyst_az_5_minute_stress_test.jmx index d4b2e6f277..a2f9e86e8f 100644 --- a/jmeter_test/fyst_az_5_minute_stress_test.jmx +++ b/jmeter_test/fyst_az_5_minute_stress_test.jmx @@ -2642,12 +2642,12 @@ Connect to 5s true state_file_az_state_credits_form[tribal_member] - + false = true - state_file_az_state_credits_form[tribal_wages] + state_file_az_state_credits_form[tribal_wages_amount] false @@ -2656,12 +2656,12 @@ Connect to 5s true state_file_az_state_credits_form[armed_forces_member] - + false = true - state_file_az_state_credits_form[armed_forces_wages] + state_file_az_state_credits_form[armed_forces_wages_amount] false @@ -2731,19 +2731,19 @@ Connect to 5s true state_file_az_charitable_contributions_form[charitable_contributions] - + false 0 = true - state_file_az_charitable_contributions_form[charitable_cash] + state_file_az_charitable_contributions_form[charitable_cash_amount] - + false 0 = true - state_file_az_charitable_contributions_form[charitable_noncash] + state_file_az_charitable_contributions_form[charitable_noncash_amount] false @@ -2834,12 +2834,12 @@ Connect to 5s true state_file_az_excise_credit_form[household_excise_credit_claimed] - + false = true - state_file_az_excise_credit_form[household_excise_credit_claimed_amt] + state_file_az_excise_credit_form[household_excise_credit_claimed_amount] false diff --git a/spec/controllers/state_file/questions/az_charitable_contributions_controller_spec.rb b/spec/controllers/state_file/questions/az_charitable_contributions_controller_spec.rb index 43dfb7a571..9a4cb1d138 100644 --- a/spec/controllers/state_file/questions/az_charitable_contributions_controller_spec.rb +++ b/spec/controllers/state_file/questions/az_charitable_contributions_controller_spec.rb @@ -15,8 +15,8 @@ { state_file_az_charitable_contributions_form: { charitable_contributions: "yes", - charitable_cash: "100", - charitable_noncash: "50" + charitable_cash_amount: "100", + charitable_noncash_amount: "50" } } end diff --git a/spec/controllers/state_file/questions/az_subtractions_controller_spec.rb b/spec/controllers/state_file/questions/az_subtractions_controller_spec.rb index eea93f40f0..4a5a71fc3e 100644 --- a/spec/controllers/state_file/questions/az_subtractions_controller_spec.rb +++ b/spec/controllers/state_file/questions/az_subtractions_controller_spec.rb @@ -15,9 +15,9 @@ { state_file_az_subtractions_form: { armed_forces_member: "yes", - armed_forces_wages: "100", + armed_forces_wages_amount: "100", tribal_member: "yes", - tribal_wages: "200" + tribal_wages_amount: "200" } } end diff --git a/spec/controllers/state_file/questions/unemployment_controller_spec.rb b/spec/controllers/state_file/questions/unemployment_controller_spec.rb index 4e217e63b8..f129c1a92d 100644 --- a/spec/controllers/state_file/questions/unemployment_controller_spec.rb +++ b/spec/controllers/state_file/questions/unemployment_controller_spec.rb @@ -58,9 +58,9 @@ payer_city: 'New York', payer_zip: '11102', payer_tin: '270293117', - federal_income_tax_withheld: 123, - state_income_tax_withheld: 456, - unemployment_compensation: 789, + federal_income_tax_withheld_amount: 123, + state_income_tax_withheld_amount: 456, + unemployment_compensation_amount: 789, state_identification_number: '123456789', } } @@ -78,9 +78,9 @@ expect(state_file1099_g.had_box_11).to eq 'yes' expect(state_file1099_g.recipient).to eq 'primary' expect(state_file1099_g.address_confirmation).to eq "yes" - expect(state_file1099_g.federal_income_tax_withheld).to eq 123 - expect(state_file1099_g.state_income_tax_withheld).to eq 456 - expect(state_file1099_g.unemployment_compensation).to eq 789 + expect(state_file1099_g.federal_income_tax_withheld_amount).to eq 123 + expect(state_file1099_g.state_income_tax_withheld_amount).to eq 456 + expect(state_file1099_g.unemployment_compensation_amount).to eq 789 end context "when 'no' was selected for had_box_11" do @@ -155,7 +155,7 @@ create :state_file1099_g, intake: intake, recipient: 'primary', - unemployment_compensation: 456 + unemployment_compensation_amount: 456 end let(:params) { { id: form1099.id } } @@ -175,9 +175,9 @@ had_box_11: 'yes', recipient: 'primary', address_confirmation: 'yes', - federal_income_tax_withheld: 123, - state_income_tax_withheld: 456, - unemployment_compensation: 789 + federal_income_tax_withheld_amount: 123, + state_income_tax_withheld_amount: 456, + unemployment_compensation_amount: 789 end let(:params) do { @@ -186,9 +186,9 @@ had_box_11: 'yes', recipient: 'spouse', address_confirmation: 'yes', - federal_income_tax_withheld: 123, - state_income_tax_withheld: 456, - unemployment_compensation: 789, + federal_income_tax_withheld_amount: 123, + state_income_tax_withheld_amount: 456, + unemployment_compensation_amount: 789, } } end diff --git a/spec/controllers/state_file/questions/w2_controller_spec.rb b/spec/controllers/state_file/questions/w2_controller_spec.rb index db5a7cf475..161b405fe8 100644 --- a/spec/controllers/state_file/questions/w2_controller_spec.rb +++ b/spec/controllers/state_file/questions/w2_controller_spec.rb @@ -99,10 +99,10 @@ id: 1, state_file_w2: { employer_state_id_num: "12345", - state_wages_amt: 10000, - state_income_tax_amt: 500, - local_wages_and_tips_amt: 40, - local_income_tax_amt: 30, + state_wages_amount: 10000, + state_income_tax_amount: 500, + local_wages_and_tips_amount: 40, + local_income_tax_amount: 30, locality_nm: "NYC" } } @@ -110,7 +110,7 @@ context "when the client got here from the review flow" do let!(:w2) { create :state_file_w2, state_file_intake: intake, w2_index: 1 } - let!(:other_w2) { create :state_file_w2, state_file_intake: intake, w2_index: 0, state_wages_amt: 8000 } + let!(:other_w2) { create :state_file_w2, state_file_intake: intake, w2_index: 0, state_wages_amount: 8000 } # can't use shared example here because it's written for the default update in QuestionsController it "redirects to the review page" do @@ -128,7 +128,7 @@ context "with existing w2" do let!(:w2) { create :state_file_w2, state_file_intake: intake, w2_index: 1 } - let!(:other_w2) { create :state_file_w2, state_file_intake: intake, w2_index: 0, state_wages_amt: 8000 } + let!(:other_w2) { create :state_file_w2, state_file_intake: intake, w2_index: 0, state_wages_amount: 8000 } it "updates the w2 and redirects to the index" do expect { @@ -138,10 +138,10 @@ w2.reload expect(w2.state_file_intake).to eq intake expect(w2.employer_state_id_num).to eq "12345" - expect(w2.state_wages_amt).to eq 10000 - expect(w2.state_income_tax_amt).to eq 500 - expect(w2.local_wages_and_tips_amt).to eq 40 - expect(w2.local_income_tax_amt).to eq 30 + expect(w2.state_wages_amount).to eq 10000 + expect(w2.state_income_tax_amount).to eq 500 + expect(w2.local_wages_and_tips_amount).to eq 40 + expect(w2.local_income_tax_amount).to eq 30 expect(w2.locality_nm).to eq "NYC" # TODO: check other_w2 hasn't been updated? perhaps unnecessary test @@ -161,10 +161,10 @@ expect(new_w2.w2_index).to eq 1 expect(new_w2.state_file_intake).to eq intake expect(new_w2.employer_state_id_num).to eq "12345" - expect(new_w2.state_wages_amt).to eq 10000 - expect(new_w2.state_income_tax_amt).to eq 500 - expect(new_w2.local_wages_and_tips_amt).to eq 40 - expect(new_w2.local_income_tax_amt).to eq 30 + expect(new_w2.state_wages_amount).to eq 10000 + expect(new_w2.state_income_tax_amount).to eq 500 + expect(new_w2.local_wages_and_tips_amount).to eq 40 + expect(new_w2.local_income_tax_amount).to eq 30 expect(new_w2.locality_nm).to eq "NYC" expect(response).to redirect_to(StateFile::Questions::W2Controller.to_path_helper(action: :index)) @@ -175,7 +175,7 @@ let(:intake2) do create :state_file_ny_intake, raw_direct_file_data: direct_file_xml.to_xml end - let!(:w2) { create :state_file_w2, state_file_intake: intake, w2_index: 0, state_wages_amt: 8000 } + let!(:w2) { create :state_file_w2, state_file_intake: intake, w2_index: 0, state_wages_amount: 8000 } let(:params) do p = super() p.merge({ @@ -237,10 +237,10 @@ id: 0, state_file_w2: { employer_state_id_num: "12345", - state_wages_amt: 0, - state_income_tax_amt: 500, - local_wages_and_tips_amt: 20, - local_income_tax_amt: 30, + state_wages_amount: 0, + state_income_tax_amount: 500, + local_wages_and_tips_amount: 20, + local_income_tax_amount: 30, locality_nm: "NYC" } } @@ -288,7 +288,7 @@ end context "with a persisted override" do - let!(:w2) { create :state_file_w2, state_file_intake: intake, w2_index: 0, state_wages_amt: 8000 } + let!(:w2) { create :state_file_w2, state_file_intake: intake, w2_index: 0, state_wages_amount: 8000 } it "redirects to the next path" do post :create diff --git a/spec/data/migrate_monetary_values_spec.rb b/spec/data/migrate_monetary_values_spec.rb deleted file mode 100644 index 223f3a2a0a..0000000000 --- a/spec/data/migrate_monetary_values_spec.rb +++ /dev/null @@ -1,60 +0,0 @@ -require 'rails_helper' -require Rails.root.join('db/data/20240918164810_backfill_new_decimal_columns.rb') - -RSpec.describe MigrateMonetaryValues do - let(:intake) { create(:state_file_az_intake, - charitable_cash: 100, - charitable_noncash: 200, - household_excise_credit_claimed_amt: 300, - tribal_wages: 400, - armed_forces_wages: 500 - ) } - - let!(:w2) { create(:state_file_w2, - state_file_intake: intake, - employer_state_id_num: "001245788", - local_income_tax_amt: 200, - local_wages_and_tips_amt: 8000, - locality_nm: "NYC", - state_income_tax_amt: 600, - state_wages_amt: 8000, - w2_index: 0 - ) } - - let!(:state_file_1099) { create(:state_file1099_g, - intake: intake, - address_confirmation: 'no', - recipient_city: 'New York', - recipient_street_address: '123 Main St', - recipient_street_address_apartment: 'Apt E', - recipient_zip: '11102', - unemployment_compensation: 1, - federal_income_tax_withheld: 0, - state_income_tax_withheld: 0 - ) } - - let(:migrate) { described_class.new.migrate } - - describe '#migrate' do - before do - migrate - intake.reload - end - it 'migrates all monetary values correctly' do - expect(intake.charitable_cash_amount).to eq 100 - expect(intake.charitable_noncash_amount).to eq 200 - expect(intake.household_excise_credit_claimed_amount).to eq 300 - expect(intake.tribal_wages_amount).to eq 400 - expect(intake.armed_forces_wages_amount).to eq 500 - - expect(state_file_1099.unemployment_compensation_amount).to eq 1 - expect(state_file_1099.federal_income_tax_withheld_amount).to eq 0 - expect(state_file_1099.state_income_tax_withheld_amount).to eq 0 - - expect(w2.state_wages_amount).to eq 8000 - expect(w2.state_income_tax_amount).to eq 600 - expect(w2.local_wages_and_tips_amount).to eq 8000 - expect(w2.local_income_tax_amount).to eq 200 - end - end -end \ No newline at end of file diff --git a/spec/factories/state_file/personas/2023/az.rb b/spec/factories/state_file/personas/2023/az.rb index 3f5035a51b..bc8cb8d382 100644 --- a/spec/factories/state_file/personas/2023/az.rb +++ b/spec/factories/state_file/personas/2023/az.rb @@ -66,7 +66,7 @@ prior_last_names { "Schitt, Creek" } tribal_member { "yes" } - tribal_wages { 1000 } + tribal_wages_amount { 1000 } armed_forces_member { "no" } @@ -130,10 +130,10 @@ recipient_street_address: "321 ANDY STREET", recipient_city: "PHOENIX", recipient_zip: "85034", - unemployment_compensation: 10000, - federal_income_tax_withheld: 10, + unemployment_compensation_amount: 10000, + federal_income_tax_withheld_amount: 10, state_identification_number: "123456", - state_income_tax_withheld: 10, + state_income_tax_withheld_amount: 10, ) end @@ -142,7 +142,7 @@ tribal_member { "no" } armed_forces_member { "yes" } - armed_forces_wages { 5000 } + armed_forces_wages_amount { 5000 } charitable_contributions { "no" } @@ -196,8 +196,8 @@ armed_forces_member { "no" } charitable_contributions { "yes" } - charitable_cash { 100 } - charitable_noncash { 100 } + charitable_cash_amount { 100 } + charitable_noncash_amount { 100 } payment_or_deposit_type { "direct_deposit" } bank_name { "canvas credit union" } diff --git a/spec/factories/state_file/personas/2023/ny.rb b/spec/factories/state_file/personas/2023/ny.rb index e3aa393119..9ffa9f4e07 100644 --- a/spec/factories/state_file/personas/2023/ny.rb +++ b/spec/factories/state_file/personas/2023/ny.rb @@ -33,10 +33,10 @@ recipient_street_address: "123 Main St", recipient_city: "Pleasantville", recipient_zip: "10572", - unemployment_compensation: 500, - federal_income_tax_withheld: 0, + unemployment_compensation_amount: 500, + federal_income_tax_withheld_amount: 0, state_identification_number: "270293117", - state_income_tax_withheld: 50, + state_income_tax_withheld_amount: 50, ) end diff --git a/spec/factories/state_file1099_gs.rb b/spec/factories/state_file1099_gs.rb index 159ae26e3a..fdbd51faa8 100644 --- a/spec/factories/state_file1099_gs.rb +++ b/spec/factories/state_file1099_gs.rb @@ -4,7 +4,6 @@ # # id :bigint not null, primary key # address_confirmation :integer default("unfilled"), not null -# federal_income_tax_withheld :integer # federal_income_tax_withheld_amount :decimal(12, 2) # had_box_11 :integer default("unfilled"), not null # intake_type :string not null @@ -19,9 +18,7 @@ # recipient_street_address_apartment :string # recipient_zip :string # state_identification_number :string -# state_income_tax_withheld :integer # state_income_tax_withheld_amount :decimal(12, 2) -# unemployment_compensation :integer # unemployment_compensation_amount :decimal(12, 2) # created_at :datetime not null # updated_at :datetime not null @@ -40,9 +37,9 @@ payer_zip {'11102'} payer_tin {'270293117'} state_identification_number {'123456789'} - unemployment_compensation { '1' } - federal_income_tax_withheld { '0' } - state_income_tax_withheld { '0' } + unemployment_compensation_amount { '1' } + federal_income_tax_withheld_amount { '0' } + state_income_tax_withheld_amount { '0' } recipient_city {'New York'} recipient_street_address {'123 Recipient St'} recipient_zip {'11102'} diff --git a/spec/factories/state_file_az_intakes.rb b/spec/factories/state_file_az_intakes.rb index 5f5daf25a1..837c5d778b 100644 --- a/spec/factories/state_file_az_intakes.rb +++ b/spec/factories/state_file_az_intakes.rb @@ -6,13 +6,10 @@ # account_number :string # account_type :integer # armed_forces_member :integer default("unfilled"), not null -# armed_forces_wages :integer # armed_forces_wages_amount :decimal(12, 2) # bank_name :string -# charitable_cash :integer default(0) # charitable_cash_amount :decimal(12, 2) # charitable_contributions :integer default("unfilled"), not null -# charitable_noncash :integer default(0) # charitable_noncash_amount :decimal(12, 2) # consented_to_terms_and_conditions :integer default("unfilled"), not null # contact_preference :integer default("unfilled"), not null @@ -34,7 +31,6 @@ # hashed_ssn :string # household_excise_credit_claimed :integer default("unfilled"), not null # household_excise_credit_claimed_amount :decimal(12, 2) -# household_excise_credit_claimed_amt :integer # last_sign_in_at :datetime # last_sign_in_ip :inet # locale :string default("en") @@ -75,7 +71,6 @@ # spouse_was_incarcerated :integer default("unfilled"), not null # ssn_no_employment :integer default("unfilled"), not null # tribal_member :integer default("unfilled"), not null -# tribal_wages :integer # tribal_wages_amount :decimal(12, 2) # unfinished_intake_ids :text default([]), is an Array # unsubscribed_from_email :boolean default(FALSE), not null diff --git a/spec/factories/state_file_w2s.rb b/spec/factories/state_file_w2s.rb index 73e2a9b6dc..5a26a03a04 100644 --- a/spec/factories/state_file_w2s.rb +++ b/spec/factories/state_file_w2s.rb @@ -5,15 +5,11 @@ # id :bigint not null, primary key # employer_state_id_num :string # local_income_tax_amount :decimal(12, 2) -# local_income_tax_amt :integer # local_wages_and_tips_amount :decimal(12, 2) -# local_wages_and_tips_amt :integer # locality_nm :string # state_file_intake_type :string # state_income_tax_amount :decimal(12, 2) -# state_income_tax_amt :integer # state_wages_amount :decimal(12, 2) -# state_wages_amt :integer # w2_index :integer # created_at :datetime not null # updated_at :datetime not null @@ -27,10 +23,10 @@ factory :state_file_w2 do w2_index { 0 } employer_state_id_num { "12345" } - state_wages_amt { 10000 } - state_income_tax_amt { 350 } - local_wages_and_tips_amt { 100 } - local_income_tax_amt { 100 } + state_wages_amount { 10000 } + state_income_tax_amount { 350 } + local_wages_and_tips_amount { 100 } + local_income_tax_amount { 100 } locality_nm { "NYC" } end end diff --git a/spec/features/state_file/complete_intake_spec.rb b/spec/features/state_file/complete_intake_spec.rb index 19888aebb0..53d51f9db5 100644 --- a/spec/features/state_file/complete_intake_spec.rb +++ b/spec/features/state_file/complete_intake_spec.rb @@ -100,10 +100,10 @@ fill_in I18n.t('state_file.questions.unemployment.edit.zip_code'), with: "11102", match: :first fill_in I18n.t('state_file.questions.unemployment.edit.payer_tin'), with: "270293117" choose I18n.t('state_file.questions.unemployment.edit.confirm_address_yes') - fill_in 'state_file1099_g_unemployment_compensation', with: "123" - fill_in 'state_file1099_g_federal_income_tax_withheld', with: "456" + fill_in 'state_file1099_g_unemployment_compensation_amount', with: "123" + fill_in 'state_file1099_g_federal_income_tax_withheld_amount', with: "456" fill_in 'state_file1099_g_state_identification_number', with: "123456789" - fill_in 'state_file1099_g_state_income_tax_withheld', with: "789" + fill_in 'state_file1099_g_state_income_tax_withheld_amount', with: "789" click_on I18n.t("general.continue") expect(page).to have_text(I18n.t('state_file.questions.unemployment.index.1099_label', name: StateFileNyIntake.last.primary.full_name)) @@ -211,10 +211,10 @@ fill_in I18n.t('state_file.questions.unemployment.edit.zip_code'), with: "85001", match: :first fill_in I18n.t('state_file.questions.unemployment.edit.payer_tin'), with: "123456789" choose I18n.t('state_file.questions.unemployment.edit.confirm_address_yes') - fill_in 'state_file1099_g_unemployment_compensation', with: "123" - fill_in 'state_file1099_g_federal_income_tax_withheld', with: "456" + fill_in 'state_file1099_g_unemployment_compensation_amount', with: "123" + fill_in 'state_file1099_g_federal_income_tax_withheld_amount', with: "456" fill_in 'state_file1099_g_state_identification_number', with: "123456789" - fill_in 'state_file1099_g_state_income_tax_withheld', with: "789" + fill_in 'state_file1099_g_state_income_tax_withheld_amount', with: "789" click_on I18n.t("general.continue") expect(page).to have_text(I18n.t('state_file.questions.unemployment.index.1099_label', name: StateFileAzIntake.last.primary.full_name)) @@ -222,9 +222,9 @@ expect(page).to have_text I18n.t("state_file.questions.az_subtractions.edit.title.one", year: MultiTenantService.statefile.current_tax_year) check "state_file_az_subtractions_form_tribal_member" - fill_in "state_file_az_subtractions_form_tribal_wages", with: "100" + fill_in "state_file_az_subtractions_form_tribal_wages_amount", with: "100" check "state_file_az_subtractions_form_armed_forces_member" - fill_in "state_file_az_subtractions_form_armed_forces_wages", with: "100" + fill_in "state_file_az_subtractions_form_armed_forces_wages_amount", with: "100" click_on I18n.t("general.continue") expect(page).to have_text I18n.t("state_file.questions.az_retirement_income.edit.title") diff --git a/spec/forms/state_file/az_charitable_contributions_form_spec.rb b/spec/forms/state_file/az_charitable_contributions_form_spec.rb index c78ebeaf80..0de843ac18 100644 --- a/spec/forms/state_file/az_charitable_contributions_form_spec.rb +++ b/spec/forms/state_file/az_charitable_contributions_form_spec.rb @@ -26,29 +26,29 @@ it "Requires all contributions to be present" do form = described_class.new(intake, params) expect(form).not_to be_valid - expect(form.errors).to include :charitable_cash - expect(form.errors).to include :charitable_noncash + expect(form.errors).to include :charitable_cash_amount + expect(form.errors).to include :charitable_noncash_amount end it "Requires all contributions to be numeric" do - form = described_class.new(intake, params.merge({ charitable_cash: "a10", charitable_noncash: "b20"})) + form = described_class.new(intake, params.merge({ charitable_cash_amount: "a10", charitable_noncash_amount: "b20"})) expect(form).not_to be_valid - expect(form.errors).to include :charitable_cash - expect(form.errors).to include :charitable_noncash + expect(form.errors).to include :charitable_cash_amount + expect(form.errors).to include :charitable_noncash_amount end context "when non cash contributions exceed 500" do let(:params) do super().merge({ - charitable_cash: 100, - charitable_noncash: 600, + charitable_cash_amount: 100, + charitable_noncash_amount: 600, }) end it "returns false" do form = described_class.new(intake, params) expect(form).not_to be_valid - expect(form.errors).to include(:charitable_noncash) + expect(form.errors).to include(:charitable_noncash_amount) end end end @@ -61,8 +61,8 @@ let(:valid_params) do { charitable_contributions: "yes", - charitable_cash: 100, - charitable_noncash: 100, + charitable_cash_amount: 100, + charitable_noncash_amount: 100, } end @@ -70,8 +70,6 @@ form = described_class.new(intake, valid_params) expect(form).to be_valid form.save - expect(intake.reload.charitable_cash).to eq 100 - expect(intake.reload.charitable_noncash).to eq 100 expect(intake.reload.charitable_cash_amount).to eq 100 expect(intake.reload.charitable_noncash_amount).to eq 100 end @@ -82,8 +80,8 @@ let(:valid_params) do { charitable_contributions: "no", - charitable_cash: "", - charitable_noncash: "", + charitable_cash_amount: "", + charitable_noncash_amount: "", } end @@ -91,20 +89,18 @@ form = described_class.new(intake, valid_params) expect(form).to be_valid form.save - expect(intake.reload.charitable_cash).to be_nil - expect(intake.reload.charitable_noncash).to be_nil expect(intake.reload.charitable_cash_amount).to be_nil expect(intake.reload.charitable_noncash_amount).to be_nil end end describe "going back and saying no to charitable contributions" do - let(:intake) { create :state_file_az_intake, charitable_cash: 100, charitable_noncash: 100} + let(:intake) { create :state_file_az_intake, charitable_cash_amount: 100, charitable_noncash_amount: 100} let(:valid_params) do { charitable_contributions: "no", - charitable_cash: 100, - charitable_noncash: 100, + charitable_cash_amount: 100, + charitable_noncash_amount: 100, } end @@ -112,8 +108,6 @@ form = described_class.new(intake, valid_params) expect(form).to be_valid form.save - expect(intake.reload.charitable_cash).to be_nil - expect(intake.reload.charitable_noncash).to be_nil expect(intake.reload.charitable_cash_amount).to be_nil expect(intake.reload.charitable_noncash_amount).to be_nil end diff --git a/spec/forms/state_file/az_excise_credit_form_spec.rb b/spec/forms/state_file/az_excise_credit_form_spec.rb index 80d39d1493..f482ca0217 100644 --- a/spec/forms/state_file/az_excise_credit_form_spec.rb +++ b/spec/forms/state_file/az_excise_credit_form_spec.rb @@ -65,39 +65,29 @@ } form = described_class.new(intake, invalid_params) expect(form).not_to be_valid - expect(form.errors).to include :household_excise_credit_claimed_amt + expect(form.errors).to include :household_excise_credit_claimed_amount valid_params = { primary_was_incarcerated: "no", ssn_no_employment: "yes", household_excise_credit_claimed: "yes", - household_excise_credit_claimed_amt: 1000 + household_excise_credit_claimed_amount: 1000 } form = described_class.new(intake, valid_params) expect(form).to be_valid expect(form.errors).to be_empty end - it "requires credit amount to be a positive integer" do + it "requires credit amount to be a positive number" do invalid_params_zero = { primary_was_incarcerated: "no", ssn_no_employment: "yes", household_excise_credit_claimed: "yes", - household_excise_credit_claimed_amt: 0 + household_excise_credit_claimed_amount: 0 } form = described_class.new(intake, invalid_params_zero) expect(form).not_to be_valid - expect(form.errors).to include :household_excise_credit_claimed_amt - - invalid_params_float = { - primary_was_incarcerated: "no", - ssn_no_employment: "yes", - household_excise_credit_claimed: "yes", - household_excise_credit_claimed_amt: 500.23 - } - form = described_class.new(intake, invalid_params_float) - expect(form).not_to be_valid - expect(form.errors).to include :household_excise_credit_claimed_amt + expect(form.errors).to include :household_excise_credit_claimed_amount end end end @@ -109,7 +99,7 @@ primary_was_incarcerated: "yes", ssn_no_employment: "yes", household_excise_credit_claimed: "yes", - household_excise_credit_claimed_amt: 1000 + household_excise_credit_claimed_amount: 1000 }) expect(form).to be_valid form.save @@ -118,18 +108,17 @@ expect(intake.primary_was_incarcerated_yes?).to eq true expect(intake.ssn_no_employment_yes?).to eq true expect(intake.household_excise_credit_claimed_yes?).to eq true - expect(intake.household_excise_credit_claimed_amt).to eq 1000 expect(intake.household_excise_credit_claimed_amount).to eq 1000 end it "zeroes out credit amount if credit claimed = no (does not save the amount param if claimed = no)" do - intake.update(household_excise_credit_claimed_amt: 2000) + intake.update(household_excise_credit_claimed_amount: 2000) form = described_class.new(intake, { primary_was_incarcerated: "yes", ssn_no_employment: "yes", household_excise_credit_claimed: "no", - household_excise_credit_claimed_amt: 1000 + household_excise_credit_claimed_amount: 1000 }) expect(form).to be_valid form.save @@ -138,7 +127,6 @@ expect(intake.primary_was_incarcerated_yes?).to eq true expect(intake.ssn_no_employment_yes?).to eq true expect(intake.household_excise_credit_claimed_no?).to eq true - expect(intake.household_excise_credit_claimed_amt).to be_nil expect(intake.household_excise_credit_claimed_amount).to be_nil end end diff --git a/spec/forms/state_file/az_subtractions_form_spec.rb b/spec/forms/state_file/az_subtractions_form_spec.rb index 5a93079b5d..d647dcf13a 100644 --- a/spec/forms/state_file/az_subtractions_form_spec.rb +++ b/spec/forms/state_file/az_subtractions_form_spec.rb @@ -8,9 +8,9 @@ let(:params) do { tribal_member: "no", - tribal_wages: nil, + tribal_wages_amount: nil, armed_forces_member: "no", - armed_forces_wages: nil + armed_forces_wages_amount: nil } end @@ -31,15 +31,15 @@ it "is not valid" do form = described_class.new(intake, params) expect(form).not_to be_valid - expect(form.errors).to include :tribal_wages - expect(form.errors).to include :armed_forces_wages + expect(form.errors).to include :tribal_wages_amount + expect(form.errors).to include :armed_forces_wages_amount end it "non numeric values are invalid" do - form = described_class.new(intake, params.merge(tribal_wages: "a10", armed_forces_wages: "b10")) + form = described_class.new(intake, params.merge(tribal_wages_amount: "a10", armed_forces_wages_amount: "b10")) expect(form).not_to be_valid - expect(form.errors).to include :tribal_wages - expect(form.errors).to include :armed_forces_wages + expect(form.errors).to include :tribal_wages_amount + expect(form.errors).to include :armed_forces_wages_amount end end @@ -47,17 +47,17 @@ let(:params) do { tribal_member: "yes", - tribal_wages: nil, + tribal_wages_amount: nil, armed_forces_member: "yes", - armed_forces_wages: nil + armed_forces_wages_amount: nil } end it "is not valid" do form = described_class.new(intake, params) expect(form).not_to be_valid - expect(form.errors).to include :tribal_wages - expect(form.errors).to include :armed_forces_wages + expect(form.errors).to include :tribal_wages_amount + expect(form.errors).to include :armed_forces_wages_amount end end @@ -65,9 +65,9 @@ let(:params) do { tribal_member: "yes", - tribal_wages: 10, + tribal_wages_amount: 10, armed_forces_member: "no", - armed_forces_wages: nil + armed_forces_wages_amount: nil } end @@ -81,9 +81,9 @@ let(:params) do { tribal_member: "no", - tribal_wages: nil, + tribal_wages_amount: nil, armed_forces_member: "yes", - armed_forces_wages: 10 + armed_forces_wages_amount: 10 } end @@ -99,9 +99,9 @@ let(:params) do { tribal_member: "yes", - tribal_wages: 10, + tribal_wages_amount: 10, armed_forces_member: "yes", - armed_forces_wages: 20 + armed_forces_wages_amount: 20 } end @@ -110,10 +110,8 @@ expect(form).to be_valid form.save expect(intake.reload.tribal_member_yes?).to be true - expect(intake.reload.tribal_wages).to eq 10 expect(intake.reload.tribal_wages_amount).to eq 10 expect(intake.reload.armed_forces_member_yes?).to be true - expect(intake.reload.armed_forces_wages).to eq 20 expect(intake.reload.armed_forces_wages_amount).to eq 20 end end @@ -123,9 +121,9 @@ let(:params) do { tribal_member: "no", - tribal_wages: nil, + tribal_wages_amount: nil, armed_forces_member: "no", - armed_forces_wages: nil + armed_forces_wages_amount: nil } end @@ -134,22 +132,20 @@ expect(form).to be_valid form.save expect(intake.reload.tribal_member_no?).to be true - expect(intake.reload.tribal_wages).to be_nil expect(intake.reload.tribal_wages_amount).to be_nil expect(intake.reload.armed_forces_member_no?).to be true - expect(intake.reload.armed_forces_wages).to be_nil expect(intake.reload.armed_forces_wages_amount).to be_nil end end describe "going back and removing memberships" do - let(:intake) { create :state_file_az_intake, tribal_member: "yes", tribal_wages: 10, armed_forces_member: "yes", armed_forces_wages: 20 } + let(:intake) { create :state_file_az_intake, tribal_member: "yes", tribal_wages_amount: 10, armed_forces_member: "yes", armed_forces_wages_amount: 20 } let(:valid_params) do { tribal_member: "no", - tribal_wages: 10, + tribal_wages_amount: 10, armed_forces_member: "no", - armed_forces_wages: 20 + armed_forces_wages_amount: 20 } end @@ -158,10 +154,8 @@ expect(form).to be_valid form.save expect(intake.reload.tribal_member_no?).to be true - expect(intake.reload.tribal_wages).to be_nil expect(intake.reload.tribal_wages_amount).to be_nil expect(intake.reload.armed_forces_member_no?).to be true - expect(intake.reload.armed_forces_wages).to be_nil expect(intake.reload.armed_forces_wages_amount).to be_nil end end diff --git a/spec/lib/efile/az/az140_calculator_spec.rb b/spec/lib/efile/az/az140_calculator_spec.rb index ee6cc2882f..bf7748eca4 100644 --- a/spec/lib/efile/az/az140_calculator_spec.rb +++ b/spec/lib/efile/az/az140_calculator_spec.rb @@ -16,7 +16,7 @@ raw_direct_file_data: StateFile::XmlReturnSampleService.new.read('az_alexis_hoh_w2_and_1099')) } let(:state_file1099_g) { - create(:state_file1099_g, intake: intake, state_income_tax_withheld: 100) + create(:state_file1099_g, intake: intake, state_income_tax_withheld_amount: 100) } before do @@ -162,7 +162,7 @@ intake.dependents.create(dob: 5.years.ago) intake.dependents.create(dob: 3.years.ago) intake.dependents.create(dob: 1.years.ago) - intake.update(household_excise_credit_claimed: "yes", household_excise_credit_claimed_amt: 40) + intake.update(household_excise_credit_claimed: "yes", household_excise_credit_claimed_amount: 40) instance.calculate expect(instance.lines[:AZ140_LINE_56].value).to eq(60) # (1 filer + 4 dependents) * 25 = 125 but max is 60 end @@ -181,8 +181,8 @@ context 'sets line 7c correctly' do before do - intake.charitable_cash = 50 - intake.charitable_noncash = 50 + intake.charitable_cash_amount = 50 + intake.charitable_noncash_amount = 50 intake.charitable_contributions = 'yes' end diff --git a/spec/lib/efile/az/az301_calculator_spec.rb b/spec/lib/efile/az/az301_calculator_spec.rb index 50a33d825d..4a3bc27a57 100644 --- a/spec/lib/efile/az/az301_calculator_spec.rb +++ b/spec/lib/efile/az/az301_calculator_spec.rb @@ -11,8 +11,8 @@ let(:instance) { az140_calculator.instance_variable_get(:@az301) } before do - intake.charitable_cash = 50 - intake.charitable_noncash = 50 + intake.charitable_cash_amount = 50 + intake.charitable_noncash_amount = 50 intake.charitable_contributions = 'yes' intake.direct_file_data.filing_status = 2 # married_filing_jointly intake.reload diff --git a/spec/lib/submission_builder/state_return_spec.rb b/spec/lib/submission_builder/state_return_spec.rb index 374704ab75..03c3e37bdd 100644 --- a/spec/lib/submission_builder/state_return_spec.rb +++ b/spec/lib/submission_builder/state_return_spec.rb @@ -29,11 +29,11 @@ state_file_intake: intake, w2_index: 1, employer_state_id_num: "00123", - local_income_tax_amt: "0", - local_wages_and_tips_amt: "2000", + local_income_tax_amount: "0", + local_wages_and_tips_amount: "2000", locality_nm: intake.direct_file_data.w2s[0].LocalityNm, - state_income_tax_amt: "700", - state_wages_amt: "2000", + state_income_tax_amount: "700", + state_wages_amount: "2000", ) } before do @@ -62,10 +62,10 @@ w2_from_db = xml.css('IRSW2')[1] expect(w2_from_db.at("EmployerStateIdNum").text).to eq state_file_w2.employer_state_id_num expect(w2_from_db.at("LocalIncomeTaxAmt")).to be_nil - expect(w2_from_db.at("LocalWagesAndTipsAmt").text).to eq state_file_w2.local_wages_and_tips_amt.to_s + expect(w2_from_db.at("LocalWagesAndTipsAmt").text).to eq state_file_w2.local_wages_and_tips_amount.round.to_s expect(w2_from_db.at("LocalityNm").text).to eq state_file_w2.locality_nm - expect(w2_from_db.at("StateIncomeTaxAmt").text).to eq state_file_w2.state_income_tax_amt.to_s - expect(w2_from_db.at("StateWagesAmt").text).to eq state_file_w2.state_wages_amt.to_s + expect(w2_from_db.at("StateIncomeTaxAmt").text).to eq state_file_w2.state_income_tax_amount.round.to_s + expect(w2_from_db.at("StateWagesAmt").text).to eq state_file_w2.state_wages_amount.round.to_s end end @@ -83,11 +83,11 @@ expect(generated_document.css('IRSW2').count).to eq original_w2_count (0..3).each do |i| expect(generated_document.css('IRSW2')[i].at("EmployerStateIdNum").text).to eq send("w2_#{i+1}").employer_state_id_num - expect(generated_document.css('IRSW2')[i].at("LocalIncomeTaxAmt").text).to eq send("w2_#{i+1}").local_income_tax_amt.to_s - expect(generated_document.css('IRSW2')[i].at("LocalWagesAndTipsAmt").text).to eq send("w2_#{i+1}").local_wages_and_tips_amt.to_s + expect(generated_document.css('IRSW2')[i].at("LocalIncomeTaxAmt").text).to eq send("w2_#{i+1}").local_income_tax_amount.round.to_s + expect(generated_document.css('IRSW2')[i].at("LocalWagesAndTipsAmt").text).to eq send("w2_#{i+1}").local_wages_and_tips_amount.round.to_s expect(generated_document.css('IRSW2')[i].at("LocalityNm").text).to eq send("w2_#{i+1}").locality_nm - expect(generated_document.css('IRSW2')[i].at("StateIncomeTaxAmt").text).to eq send("w2_#{i+1}").state_income_tax_amt.to_s - expect(generated_document.css('IRSW2')[i].at("StateWagesAmt").text).to eq send("w2_#{i+1}").state_wages_amt.to_s + expect(generated_document.css('IRSW2')[i].at("StateIncomeTaxAmt").text).to eq send("w2_#{i+1}").state_income_tax_amount.round.to_s + expect(generated_document.css('IRSW2')[i].at("StateWagesAmt").text).to eq send("w2_#{i+1}").state_wages_amount.round.to_s end end end diff --git a/spec/lib/submission_builder/ty2022/states/az/az_return_xml_spec.rb b/spec/lib/submission_builder/ty2022/states/az/az_return_xml_spec.rb index f1f6d69570..12462e7cb6 100644 --- a/spec/lib/submission_builder/ty2022/states/az/az_return_xml_spec.rb +++ b/spec/lib/submission_builder/ty2022/states/az/az_return_xml_spec.rb @@ -96,8 +96,8 @@ state_file_intake: intake, w2_index: 0, employer_state_id_num: "00123", - state_income_tax_amt: "700", - state_wages_amt: "2000", + state_income_tax_amount: "700", + state_wages_amount: "2000", ) } diff --git a/spec/models/state_file1099_g_spec.rb b/spec/models/state_file1099_g_spec.rb index bf0ce2a53b..98ffcd209b 100644 --- a/spec/models/state_file1099_g_spec.rb +++ b/spec/models/state_file1099_g_spec.rb @@ -4,7 +4,6 @@ # # id :bigint not null, primary key # address_confirmation :integer default("unfilled"), not null -# federal_income_tax_withheld :integer # federal_income_tax_withheld_amount :decimal(12, 2) # had_box_11 :integer default("unfilled"), not null # intake_type :string not null @@ -19,9 +18,7 @@ # recipient_street_address_apartment :string # recipient_zip :string # state_identification_number :string -# state_income_tax_withheld :integer # state_income_tax_withheld_amount :decimal(12, 2) -# unemployment_compensation :integer # unemployment_compensation_amount :decimal(12, 2) # created_at :datetime not null # updated_at :datetime not null @@ -52,9 +49,9 @@ recipient_street_address: '123 Main St', recipient_street_address_apartment: 'Apt E', recipient_zip: '11102', - unemployment_compensation: '1', - federal_income_tax_withheld: '0', - state_income_tax_withheld: '0', + unemployment_compensation_amount: '1', + federal_income_tax_withheld_amount: '0', + state_income_tax_withheld_amount: '0', ) state_file_1099.address_confirmation = 'yes' state_file_1099.save @@ -75,27 +72,27 @@ recipient_street_address: '123 Main St', recipient_street_address_apartment: 'Apt E', recipient_zip: '11102', - unemployment_compensation: '1', - federal_income_tax_withheld: '0', - state_income_tax_withheld: '0', + unemployment_compensation_amount: '1', + federal_income_tax_withheld_amount: '0', + state_income_tax_withheld_amount: '0', ) } - it "validates unemployment_compensation" do - state_file_1099.unemployment_compensation = nil + it "validates unemployment_compensation_amount" do + state_file_1099.unemployment_compensation_amount = nil expect(state_file_1099.save).to eq false - state_file_1099.unemployment_compensation = '0' + state_file_1099.unemployment_compensation_amount = '0' expect(state_file_1099.save).to eq false end - it "validates federal_income_tax_withheld" do - state_file_1099.federal_income_tax_withheld = nil + it "validates federal_income_tax_withheld_amount" do + state_file_1099.federal_income_tax_withheld_amount = nil expect(state_file_1099.save).to eq false - state_file_1099.federal_income_tax_withheld = '-1' + state_file_1099.federal_income_tax_withheld_amount = '-1' expect(state_file_1099.save).to eq false end - it "validates state_income_tax_withheld" do - state_file_1099.state_income_tax_withheld = nil + it "validates state_income_tax_withheld_amount" do + state_file_1099.state_income_tax_withheld_amount = nil expect(state_file_1099.save).to eq false - state_file_1099.state_income_tax_withheld = '-1' + state_file_1099.state_income_tax_withheld_amount = '-1' expect(state_file_1099.save).to eq false end @@ -107,26 +104,6 @@ expect(state_file_1099.recipient_address_line2).to eq nil end - context "non-integer number" do - let(:state_file_1099) { build( - :state_file1099_g, - intake: create(:state_file_ny_intake), - address_confirmation: 'no', - recipient_city: 'New York', - recipient_street_address: '123 Main St', - recipient_street_address_apartment: 'Apt E', - recipient_zip: '11102', - unemployment_compensation: '2.5', - federal_income_tax_withheld: '0', - state_income_tax_withheld: '0', - ) } - - it "validates unemployment_compensation for a whole number" do - state_file_1099.valid? - expect(state_file_1099.errors[:unemployment_compensation]).to include "must be a whole number" - end - end - context "for wrong range" do let(:state_file_1099) { build( :state_file1099_g, @@ -136,49 +113,15 @@ recipient_street_address: '123 Main St', recipient_street_address_apartment: 'Apt E', recipient_zip: '11102', - unemployment_compensation: '0', - federal_income_tax_withheld: '0', - state_income_tax_withheld: '0', + unemployment_compensation_amount: '0', + federal_income_tax_withheld_amount: '0', + state_income_tax_withheld_amount: '0', ) } it "validates unemployment_compensation" do state_file_1099.valid? - expect(state_file_1099.errors[:unemployment_compensation]).to include "must be greater than or equal to 1" + expect(state_file_1099.errors[:unemployment_compensation_amount]).to include "must be greater than or equal to 1" end end end - - describe "#sync_amount_columns" do - let(:state_file_1099) { build(:state_file1099_g, intake: create(:state_file_ny_intake)) } - - it "syncs valid amounts for money " do - state_file_1099.unemployment_compensation = 1000 - state_file_1099.federal_income_tax_withheld = 200 - state_file_1099.state_income_tax_withheld = 150 - state_file_1099.save - expect(state_file_1099.unemployment_compensation_amount).to eq 1000 - expect(state_file_1099.federal_income_tax_withheld_amount).to eq 200 - expect(state_file_1099.state_income_tax_withheld_amount).to eq 150 - end - - it "syncs nil values" do - state_file_1099.unemployment_compensation = nil - state_file_1099.federal_income_tax_withheld = nil - state_file_1099.state_income_tax_withheld = nil - state_file_1099.save - expect(state_file_1099.unemployment_compensation_amount).to be_nil - expect(state_file_1099.federal_income_tax_withheld_amount).to be_nil - expect(state_file_1099.state_income_tax_withheld_amount).to be_nil - end - - it "doesn't sync invalid values" do - state_file_1099.unemployment_compensation = "invalid" - state_file_1099.federal_income_tax_withheld = -1000 - state_file_1099.state_income_tax_withheld = 100.50 - state_file_1099.save - expect(state_file_1099.unemployment_compensation_amount).to be_nil - expect(state_file_1099.federal_income_tax_withheld_amount).to be_nil - expect(state_file_1099.state_income_tax_withheld_amount).to be_nil - end - end end diff --git a/spec/models/state_file_az_intake_spec.rb b/spec/models/state_file_az_intake_spec.rb index aa38e9ff72..e396e0c464 100644 --- a/spec/models/state_file_az_intake_spec.rb +++ b/spec/models/state_file_az_intake_spec.rb @@ -6,13 +6,10 @@ # account_number :string # account_type :integer # armed_forces_member :integer default("unfilled"), not null -# armed_forces_wages :integer # armed_forces_wages_amount :decimal(12, 2) # bank_name :string -# charitable_cash :integer default(0) # charitable_cash_amount :decimal(12, 2) # charitable_contributions :integer default("unfilled"), not null -# charitable_noncash :integer default(0) # charitable_noncash_amount :decimal(12, 2) # consented_to_terms_and_conditions :integer default("unfilled"), not null # contact_preference :integer default("unfilled"), not null @@ -34,7 +31,6 @@ # hashed_ssn :string # household_excise_credit_claimed :integer default("unfilled"), not null # household_excise_credit_claimed_amount :decimal(12, 2) -# household_excise_credit_claimed_amt :integer # last_sign_in_at :datetime # last_sign_in_ip :inet # locale :string default("en") @@ -75,7 +71,6 @@ # spouse_was_incarcerated :integer default("unfilled"), not null # ssn_no_employment :integer default("unfilled"), not null # tribal_member :integer default("unfilled"), not null -# tribal_wages :integer # tribal_wages_amount :decimal(12, 2) # unfinished_intake_ids :text default([]), is an Array # unsubscribed_from_email :boolean default(FALSE), not null @@ -248,7 +243,7 @@ context "has new columns" do before do - intake.update(primary_was_incarcerated: "no", spouse_was_incarcerated: "no", household_excise_credit_claimed: "yes", household_excise_credit_claimed_amt: 50) + intake.update(primary_was_incarcerated: "no", spouse_was_incarcerated: "no", household_excise_credit_claimed: "yes", household_excise_credit_claimed_amount: 50) end it "returns false if neither filer was incarcerated" do diff --git a/spec/models/state_file_w2_spec.rb b/spec/models/state_file_w2_spec.rb index 623c8639b6..e8b0025639 100644 --- a/spec/models/state_file_w2_spec.rb +++ b/spec/models/state_file_w2_spec.rb @@ -5,15 +5,11 @@ # id :bigint not null, primary key # employer_state_id_num :string # local_income_tax_amount :decimal(12, 2) -# local_income_tax_amt :integer # local_wages_and_tips_amount :decimal(12, 2) -# local_wages_and_tips_amt :integer # locality_nm :string # state_file_intake_type :string # state_income_tax_amount :decimal(12, 2) -# state_income_tax_amt :integer # state_wages_amount :decimal(12, 2) -# state_wages_amt :integer # w2_index :integer # created_at :datetime not null # updated_at :datetime not null @@ -31,12 +27,12 @@ let(:w2) { create(:state_file_w2, employer_state_id_num: "001245788", - local_income_tax_amt: 200, - local_wages_and_tips_amt: 8000, + local_income_tax_amount: 200, + local_wages_and_tips_amount: 8000, locality_nm: "NYC", state_file_intake: intake, - state_income_tax_amt: 600, - state_wages_amt: 8000, + state_income_tax_amount: 600, + state_wages_amount: 8000, w2_index: 0 ) } @@ -47,7 +43,7 @@ expect(w2).to be_valid end - [:w2_index, :state_wages_amt, :state_income_tax_amt, :local_wages_and_tips_amt, :local_income_tax_amt].each do |field| + [:w2_index, :state_wages_amount, :state_income_tax_amount, :local_wages_and_tips_amount, :local_income_tax_amount].each do |field| context field do it "does not permit strings" do @@ -56,12 +52,6 @@ expect(w2.errors[field]).to be_present end - it "does not permit floats" do - w2.send("#{field}=", 3.14159) - expect(w2).not_to be_valid - expect(w2.errors[field]).to be_present - end - it "does not permit values less than 0" do w2.send("#{field}=", -1) expect(w2).not_to be_valid @@ -78,26 +68,26 @@ it "permits both locality_nm and local_wages_and_tips_amt to be missing" do w2.locality_nm = nil - w2.local_wages_and_tips_amt = 0 - w2.local_income_tax_amt = 0 + w2.local_wages_and_tips_amount = 0 + w2.local_income_tax_amount = 0 expect(w2).to be_valid end it "requires local_income_tax_amt to be less than local_wages_and_tips_amt" do - w2.local_wages_and_tips_amt = 0 + w2.local_wages_and_tips_amount = 0 expect(w2).not_to be_valid - expect(w2.errors[:local_income_tax_amt]).to be_present + expect(w2.errors[:local_income_tax_amount]).to be_present end it "requires state_income_tax_amt to be less than state_wages_amt" do - w2.state_wages_amt = 0 + w2.state_wages_amount = 0 expect(w2).not_to be_valid - expect(w2.errors[:state_income_tax_amt]).to be_present + expect(w2.errors[:state_income_tax_amount]).to be_present end it "permits state_wages_amt to be blank if state_income_tax_amt is blank" do - w2.state_wages_amt = 0 - w2.state_income_tax_amt = 0 + w2.state_wages_amount = 0 + w2.state_income_tax_amount = 0 expect(w2).to be_valid end @@ -109,8 +99,8 @@ it "permits state_wages_amt to be blank if state_income_tax_amt is blank" do w2.employer_state_id_num = nil - w2.state_wages_amt = 0 - w2.state_income_tax_amt = 0 + w2.state_wages_amount = 0 + w2.state_income_tax_amount = 0 expect(w2).to be_valid end @@ -126,7 +116,7 @@ end it "permits local_wages_and_tips_amt to be greater than w2.wagesAmt" do - w2.local_wages_and_tips_amt = 1000000 + w2.local_wages_and_tips_amount = 1000000 expect(w2).to be_valid end @@ -153,44 +143,4 @@ expect(xml.at("StateAbbreviationCd")).to be_nil end end - - describe "#sync_amount_columns" do - let(:w2) { build(:state_file_w2, state_file_intake: create(:state_file_ny_intake)) } - - it "syncs valid amounts for money" do - w2.state_wages_amt = 10000 - w2.state_income_tax_amt = 1000 - w2.local_wages_and_tips_amt = 9000 - w2.local_income_tax_amt = 500 - w2.save - expect(w2.state_wages_amount).to eq 10000 - expect(w2.state_income_tax_amount).to eq 1000 - expect(w2.local_wages_and_tips_amount).to eq 9000 - expect(w2.local_income_tax_amount).to eq 500 - end - - it "syncs nil values" do - w2.state_wages_amt = nil - w2.state_income_tax_amt = nil - w2.local_wages_and_tips_amt = nil - w2.local_income_tax_amt = nil - w2.save - expect(w2.state_wages_amount).to be_nil - expect(w2.state_income_tax_amount).to be_nil - expect(w2.local_wages_and_tips_amount).to be_nil - expect(w2.local_income_tax_amount).to be_nil - end - - it "doesn't sync invalid values" do - w2.state_wages_amt = "invalid" - w2.state_income_tax_amt = -1000 - w2.local_wages_and_tips_amt = 9000.50 - w2.local_income_tax_amt = "500" - w2.save - expect(w2.state_wages_amount).to be_nil - expect(w2.state_income_tax_amount).to be_nil - expect(w2.local_wages_and_tips_amount).to be_nil - expect(w2.local_income_tax_amount).to be_nil - end - end end