diff --git a/app/models/cfe/v6/result.rb b/app/models/cfe/v6/result.rb index 045c5f5cec..22ceb5b2eb 100644 --- a/app/models/cfe/v6/result.rb +++ b/app/models/cfe/v6/result.rb @@ -209,6 +209,10 @@ def partner_allowance disposable_income_summary.key?(:partner_allowance) ? disposable_income_summary[:partner_allowance] : 0.0 end + def disregarded_state_benefits(partner: false) + deductions(partner:)[:disregarded_state_benefits] + end + def total_deductions dependants_allowance + disregarded_state_benefits + partner_allowance end @@ -218,6 +222,12 @@ def total_deductions_including_fixed_employment_allowance total_deductions - employment_deduction end + def deductions(partner: false) + # stub out zero values if not found until CFE is updated + values = disposable_income_breakdown(partner:)[:deductions] + values || { dependants_allowance: 0.0, disregarded_state_benefits: 0.0 } + end + ################################################################ # # # CAPITAL # diff --git a/app/services/flow/flows/provider_income.rb b/app/services/flow/flows/provider_income.rb index 040807ef52..c808b2a44f 100644 --- a/app/services/flow/flows/provider_income.rb +++ b/app/services/flow/flows/provider_income.rb @@ -111,6 +111,8 @@ class ProviderIncome < FlowSteps :cash_outgoings elsif application.income_types? && !application.uploading_bank_statements? :income_summary + elsif application.applicant.has_partner_with_no_contrary_interest? + :partner_about_financial_means else :has_dependants end diff --git a/config/locales/en/shared.yml b/config/locales/en/shared.yml index 740875d8d3..67024060a0 100644 --- a/config/locales/en/shared.yml +++ b/config/locales/en/shared.yml @@ -218,6 +218,8 @@ en: dependants_allowance: Dependants allowance disregarded_state_benefits: Client income from benefits excluded from calculation partner_allowance: Partner allowance + partner: + disregarded_state_benefits: Partner income from benefits excluded from calculation income: benefits: Benefits employment: Gross employment income diff --git a/spec/requests/providers/means/identify_types_of_outgoings_controller_spec.rb b/spec/requests/providers/means/identify_types_of_outgoings_controller_spec.rb index cbc8767f92..7795dc4ad0 100644 --- a/spec/requests/providers/means/identify_types_of_outgoings_controller_spec.rb +++ b/spec/requests/providers/means/identify_types_of_outgoings_controller_spec.rb @@ -196,6 +196,20 @@ request expect(response).to redirect_to(providers_legal_aid_application_means_has_dependants_path(legal_aid_application)) end + + context "and there is a partner" do + let(:legal_aid_application) do + create(:legal_aid_application, + :with_applicant_and_partner, + :with_non_passported_state_machine, + no_debit_transaction_types_selected: true) + end + + it "redirects to the about partner financial means page" do + request + expect(response).to redirect_to(providers_legal_aid_application_partners_about_financial_means_path(legal_aid_application)) + end + end end context "with bank statement upload flow" do