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

fix spouse tax filer check #469

Open
wants to merge 6 commits into
base: trunk
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 1 addition & 2 deletions lib/aca_entities/atp/functions/build_application.rb
Original file line number Diff line number Diff line change
Expand Up @@ -283,12 +283,11 @@ def referral_status
def tax_returns_hash
applicant_is_primary_tax_filer = @tax_return.nil? ? nil : @tax_return[:tax_household][:primary_tax_filer][:role_reference][:ref] == @applicant_identifier
tax_dependents = @tax_return.nil? ? nil : @tax_return[:tax_household][:tax_dependents].collect { |a| a[:role_reference][:ref] }

is_tax_filer = if !@tax_return.nil? && @tax_return[:tax_household]
if applicant_is_primary_tax_filer
true
else
@tax_return[:tax_household][:spouse_tax_filer] == @applicant_identifier
@tax_return[:tax_household][:spouse_tax_filer][:role_reference][:ref] == @applicant_identifier
Copy link
Contributor

Choose a reason for hiding this comment

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

Can we add a test case for this change please

Copy link
Author

Choose a reason for hiding this comment

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

end
else
false
Expand Down
15 changes: 15 additions & 0 deletions spec/aca_entities/atp/functions/build_application_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,21 @@
end
end

context "with valid xml containing applicant filing tax return jointly" do
before do
@result = subject.last
end
it "should return true for is_joint_tax_filing" do
expect(@result[:applicants][0][:is_joint_tax_filing]).to be_truthy
end
it "should return joint for tax_filer_kind" do
expect(@result[:applicants][0][:tax_filer_kind]).to eq("joint")
end
it "should return true for is_required_to_file_taxes" do
expect(@result[:applicants][0][:is_required_to_file_taxes]).to be_truthy
end
end

context "with valid xml containing pregnant and post partum applicant" do
before do
@result = subject.first
Expand Down
16 changes: 14 additions & 2 deletions spec/support/atp/inbound_build_application.rb
Original file line number Diff line number Diff line change
Expand Up @@ -167,8 +167,20 @@
:information_changes_indicator => true,
:application_terms_indicator => true,
:attestation_terms => true } },
"tax_returns" => { :name => "tax_returns",
:item => nil },
"insurance_application.tax_returns" => { :name => "insurance_application.tax_returns",
:item => {
:tax_household => {
:primary_tax_filer => { :role_reference => { :ref => "IDC1003158" } },
:spouse_tax_filer => { :role_reference => { :ref => "IDC1003158" } },
:tax_dependents => [{ :role_reference => { :ref => "IDC1002699" } }]
},
:total_exemptions_quantity => "1",
:status_code => "2",
:return_year => "2021",
:agi_amount => 78_100.0,
:magi_amount => 78_100.0,
:taxable_social_security_benefits_amount => 0.0
} },
"record.people.IDC1003158" => { :name => "record.people.IDC1003158",
:item => "IDC1003158" },
"person_name.first_name.IDC1003158" => { :name => "person_name.first_name.IDC1003158",
Expand Down
Loading