Skip to content

Commit

Permalink
Merge pull request #6238 from ministryofjustice/ap-4327/partner-fixes
Browse files Browse the repository at this point in the history
AP-4327: Partner means fixes
  • Loading branch information
colinbruce authored Jan 17, 2024
2 parents b3ef567 + fdc1048 commit b4ea86a
Show file tree
Hide file tree
Showing 4 changed files with 28 additions and 0 deletions.
10 changes: 10 additions & 0 deletions app/models/cfe/v6/result.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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 #
Expand Down
2 changes: 2 additions & 0 deletions app/services/flow/flows/provider_income.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
2 changes: 2 additions & 0 deletions config/locales/en/shared.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit b4ea86a

Please sign in to comment.