-
Notifications
You must be signed in to change notification settings - Fork 16
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
9 changed files
with
80 additions
and
8 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
29 changes: 29 additions & 0 deletions
29
app/models/policies/early_years_payments/claim_checking_tasks.rb
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
# frozen_string_literal: true | ||
|
||
module Policies | ||
module EarlyYearsPayments | ||
class ClaimCheckingTasks | ||
attr_reader :claim | ||
|
||
def initialize(claim) | ||
@claim = claim | ||
end | ||
|
||
delegate :policy, to: :claim | ||
|
||
def applicable_task_names | ||
tasks = [] | ||
|
||
tasks << "matching_details" if matching_claims.exists? | ||
|
||
tasks | ||
end | ||
|
||
private | ||
|
||
def matching_claims | ||
@matching_claims ||= Claim::MatchingAttributeFinder.new(claim).matching_claims | ||
end | ||
end | ||
end | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -49,10 +49,40 @@ | |
eligibility_attributes: {teacher_reference_number: "0902344"}) | ||
} | ||
|
||
let!(:fe_claim) { | ||
create(:claim, | ||
:submitted, | ||
first_name: "Genghis", | ||
surname: "Khan", | ||
date_of_birth: Date.new(1162, 5, 31), | ||
national_insurance_number: "QQ891011C", | ||
email_address: "[email protected]", | ||
bank_account_number: "34682151", | ||
bank_sort_code: "972654", | ||
academic_year: AcademicYear.new("2019"), | ||
building_society_roll_number: "123456789/ABCD", | ||
policy: Policies::FurtherEducationPayments, | ||
eligibility_attributes: {teacher_reference_number: "0902344"}) | ||
} | ||
|
||
let!(:ey_claim) { | ||
create(:claim, | ||
:submitted, | ||
first_name: "Genghis", | ||
surname: "Khan", | ||
date_of_birth: Date.new(1162, 5, 31), | ||
national_insurance_number: "QQ891011C", | ||
email_address: "[email protected]", | ||
bank_account_number: "34682151", | ||
bank_sort_code: "972654", | ||
academic_year: AcademicYear.new("2019"), | ||
policy: Policies::EarlyYearsPayments) | ||
} | ||
|
||
subject(:matching_claims) { Claim::MatchingAttributeFinder.new(source_claim).matching_claims } | ||
|
||
it "includes only claims for ECP or LUP claims" do | ||
expect(matching_claims).to contain_exactly(lup_claim, student_loans_claim) | ||
it "includes claims for ECP, LUP, FE and EY claims" do | ||
expect(matching_claims).to contain_exactly(lup_claim, student_loans_claim, fe_claim, ey_claim) | ||
end | ||
end | ||
|
||
|