diff --git a/app/operations/insurance_policies/aca_individuals/insurance_policies/construct_cv3_payload.rb b/app/operations/insurance_policies/aca_individuals/insurance_policies/construct_cv3_payload.rb index ff41d8a6..2da2cc6f 100644 --- a/app/operations/insurance_policies/aca_individuals/insurance_policies/construct_cv3_payload.rb +++ b/app/operations/insurance_policies/aca_individuals/insurance_policies/construct_cv3_payload.rb @@ -415,6 +415,7 @@ def construct_annual_premiums(months_of_year) end def construct_coverage_information(insurance_policy, covered_individuals, tax_household) + has_applied_aptc = false (1..12).collect do |month| enrollments_for_month = insurance_policy.enrollments_for_month(month, insurance_policy.start_on.year) if insurance_policy.aasm_state == "canceled" @@ -431,8 +432,11 @@ def construct_coverage_information(insurance_policy, covered_individuals, tax_ho next unless any_thh_members_enrolled?(tax_household, enrollments_for_month) next if enrollments_tax_household_for_month_empty?(enrollments_for_month, tax_household) + aptc_tax_credit = insurance_policy.applied_aptc_amount_for(enrollments_for_month, month, tax_household) + has_applied_aptc = true if aptc_tax_credit.to_f > 0.0 + # if npt and mid month end date, do not include that month if aqhp - next if insurance_policy.term_for_np && mid_month_end?(insurance_policy.end_on, month) && tax_household.is_aqhp + next if insurance_policy.term_for_np && mid_month_end?(insurance_policy.end_on, month) && has_applied_aptc if tax_household.is_aqhp && covered_individuals.present? update_covered_individuals_end_date(covered_individuals, enrollments_for_month, tax_household) @@ -442,7 +446,6 @@ def construct_coverage_information(insurance_policy, covered_individuals, tax_ho pediatric_dental_pre = enrollments_for_month.first &.pediatric_dental_premium(enrollments_for_month, thh_members, month) pre_amt_tot = calculate_ehb_premium_for(insurance_policy, tax_household, enrollments_for_month, month) - aptc_tax_credit = insurance_policy.applied_aptc_amount_for(enrollments_for_month, month, tax_household) slcsp = insurance_policy.fetch_slcsp_premium(enrollments_for_month, month, tax_household, aptc_tax_credit) total_premium = format('%.2f', (pre_amt_tot.to_f + pediatric_dental_pre)) diff --git a/spec/operations/insurance_policies/aca_individuals/insurance_policies/construct_cv3_payload_spec.rb b/spec/operations/insurance_policies/aca_individuals/insurance_policies/construct_cv3_payload_spec.rb index 07d095e2..27f35943 100644 --- a/spec/operations/insurance_policies/aca_individuals/insurance_policies/construct_cv3_payload_spec.rb +++ b/spec/operations/insurance_policies/aca_individuals/insurance_policies/construct_cv3_payload_spec.rb @@ -587,7 +587,6 @@ it "should include mid month for uqhp npt policies" do result = subject.call({ insurance_policy: npt_mid_month_uqhp_insurance_policy }) expect(result.value![:aptc_csr_tax_households][0][:months_of_year].count).to eq 3 - print(result.value![:aptc_csr_tax_households][0][:months_of_year]) expect(result.success?).to be_truthy end end