Skip to content

Commit

Permalink
Run claim verifiers for policy if it has them
Browse files Browse the repository at this point in the history
Previously we were not running the claim verifiers for EY as EY claims
don't have a trn. This commit passes in a nil dqt teacher status if the
policy doesn't have a trn but still runs the claim verifiers.
  • Loading branch information
rjlynch committed Oct 31, 2024
1 parent 347232d commit b42070c
Show file tree
Hide file tree
Showing 2 changed files with 22 additions and 8 deletions.
20 changes: 12 additions & 8 deletions app/jobs/claim_verifier_job.rb
Original file line number Diff line number Diff line change
@@ -1,8 +1,17 @@
class ClaimVerifierJob < ApplicationJob
def perform(claim)
dqt_teacher_status = if claim.policy == Policies::EarlyYearsPayments
nil
elsif claim.has_dqt_record?
AutomatedChecks::ClaimVerifier.new(
claim: claim,
dqt_teacher_status: dqt_teacher_status(claim)
).perform
end

private

def dqt_teacher_status(claim)
return if claim.policy == Policies::EarlyYearsPayments

if claim.has_dqt_record?
Dqt::Teacher.new(claim.dqt_teacher_status)
else
Dqt::Client.new.teacher.find(
Expand All @@ -11,10 +20,5 @@ def perform(claim)
nino: claim.national_insurance_number
)
end

AutomatedChecks::ClaimVerifier.new(
claim:,
dqt_teacher_status:
).perform
end
end
10 changes: 10 additions & 0 deletions spec/jobs/claim_verifier_job_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,16 @@
end
end

context "when the claim is for EarlyYearsPayments" do
let(:claim) { build(:claim, policy: Policies::EarlyYearsPayments) }

it "performs the verifier job but doesn't request dqt info" do
expect(AutomatedChecks::ClaimVerifier).to receive(:new)
expect(dbl).not_to receive(:find)
described_class.new.perform(claim)
end
end

context "when the claim does not have a DQT record payload" do
let(:dqt_teacher_status) { nil }

Expand Down

0 comments on commit b42070c

Please sign in to comment.