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

AP-4583: Extend upload evidence for partner #5929

Merged
merged 4 commits into from
Nov 6, 2023
Merged
Changes from 1 commit
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
Next Next commit
Update required_document_category_analyser adding partner_employment_…
…evidence
  • Loading branch information
skdejong committed Nov 6, 2023
commit c57354bc79b19532065aec24d5ae238de5e8253a
4 changes: 4 additions & 0 deletions app/models/partner.rb
Original file line number Diff line number Diff line change
@@ -23,6 +23,10 @@ def hmrc_employment_income?
employments.any?
end

def employment_evidence_required?
extra_employment_information_details.present? || full_employment_details.present?
end

def has_multiple_employments?
employments.length > 1
end
1 change: 1 addition & 0 deletions app/services/required_document_category_analyser.rb
Original file line number Diff line number Diff line change
@@ -12,6 +12,7 @@ def call
required_document_categories << "benefit_evidence" if @application.dwp_override&.has_evidence_of_benefit?
required_document_categories << "gateway_evidence" if @application.section_8_proceedings?
required_document_categories << "employment_evidence" if @application.employment_evidence_required?
required_document_categories << "partner_employment_evidence" if @application&.partner&.employment_evidence_required?
required_document_categories << "court_application_or_order" if has_opponents_application? && !has_listed_final_hearing?
if has_listed_final_hearing? && !has_opponents_application?
required_document_categories << "court_order"
2 changes: 2 additions & 0 deletions app/validators/document_category_validator.rb
Original file line number Diff line number Diff line change
@@ -10,6 +10,8 @@ class DocumentCategoryValidator < ActiveModel::Validator
benefit_evidence_pdf
employment_evidence
employment_evidence_pdf
partner_employment_evidence
partner_employment_evidence_pdf
gateway_evidence
gateway_evidence_pdf
means_report
2 changes: 2 additions & 0 deletions db/seeds/document_categories.csv
Original file line number Diff line number Diff line change
@@ -4,6 +4,8 @@ benefit_evidence,FALSE,,TRUE,TRUE
benefit_evidence_pdf,TRUE,ADMIN1,FALSE,FALSE
employment_evidence,FALSE,,TRUE,TRUE
employment_evidence_pdf,TRUE,ADMIN1,FALSE,FALSE
partner_employment_evidence,FALSE,,TRUE,TRUE
partner_employment_evidence_pdf,TRUE,ADMIN1,FALSE,FALSE
gateway_evidence,FALSE,,TRUE,FALSE
gateway_evidence_pdf,TRUE,STATE,FALSE,FALSE
means_report,TRUE,ADMIN1,FALSE,FALSE
4 changes: 4 additions & 0 deletions spec/factories/legal_aid_applications.rb
Original file line number Diff line number Diff line change
@@ -26,6 +26,10 @@
applicant { build(:applicant, :with_extra_employment_information, employed: true, with_bank_accounts:) }
end

trait :with_employed_partner_and_extra_info do
partner { build(:partner, :with_extra_employment_information, employed: true) }
end

trait :with_employed_applicant_and_employed_partner do
applicant { build(:applicant, employed: true, has_partner: true, partner_has_contrary_interest: false) }
partner { build(:partner, employed: true) }
11 changes: 10 additions & 1 deletion spec/services/required_document_category_analyser_spec.rb
Original file line number Diff line number Diff line change
@@ -61,7 +61,7 @@
end
end

context "when the provider has entered employment details" do
context "when the provider has entered employment details for the client" do
let(:application) { create(:legal_aid_application, :with_employed_applicant_and_extra_info) }

it "updates the required_document_categories with employment_evidence" do
@@ -70,6 +70,15 @@
end
end

context "when the provider has entered employment details for the partner" do
let(:application) { create(:legal_aid_application, :with_applicant, :with_employed_partner_and_extra_info) }

it "updates the required_document_categories with partner_employment_evidence" do
call
expect(application.required_document_categories).to eq %w[partner_employment_evidence]
end
end

context "when the application has a proceeding with opponent_application has_opponent_application true" do
let(:application) { create(:legal_aid_application, :with_applicant, :with_opponents_application_proceeding) }