Skip to content

Commit

Permalink
Merge pull request #3297 from DFE-Digital/provider-verification-status
Browse files Browse the repository at this point in the history
[CAPT-1854] Provider verification status
  • Loading branch information
asmega authored Oct 10, 2024
2 parents f015bca + 3f14648 commit b244de5
Show file tree
Hide file tree
Showing 5 changed files with 54 additions and 4 deletions.
2 changes: 1 addition & 1 deletion app/forms/admin/claims_filter_form.rb
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ def claims
when "failed_bank_validation"
Claim.includes(:decisions).failed_bank_validation.awaiting_decision
when "awaiting_provider_verification"
Claim.by_policy(Policies::FurtherEducationPayments).awaiting_further_education_provider_verification
Claim.by_policy(Policies::FurtherEducationPayments).awaiting_further_education_provider_verification.awaiting_decision
else
Claim.includes(:decisions).not_held.awaiting_decision.not_awaiting_further_education_provider_verification
end
Expand Down
6 changes: 3 additions & 3 deletions app/helpers/admin/claims_helper.rb
Original file line number Diff line number Diff line change
Expand Up @@ -172,16 +172,16 @@ def claim_summary_heading(claim)
end

def status(claim)
if claim.awaiting_provider_verification?
"Awaiting provider verification"
elsif claim.all_payrolled?
if claim.all_payrolled?
"Payrolled"
elsif claim.latest_decision&.approved? && claim.awaiting_qa? && !claim.held?
"Approved awaiting QA"
elsif claim.latest_decision&.approved?
"Approved awaiting payroll"
elsif claim.latest_decision&.rejected?
"Rejected"
elsif claim.awaiting_provider_verification?
"Awaiting provider verification"
elsif claim.held?
"Awaiting decision - on hold"
else
Expand Down
8 changes: 8 additions & 0 deletions spec/factories/claims.rb
Original file line number Diff line number Diff line change
Expand Up @@ -309,6 +309,14 @@
end
end

trait :awaiting_provider_verification do
eligibility_trait { :not_verified }

after(:create) do |claim, _|
create(:note, claim:, label: "provider_verification")
end
end

trait :with_dqt_teacher_status do
dqt_teacher_status do
{
Expand Down
25 changes: 25 additions & 0 deletions spec/forms/admin/claims_filter_form_spec.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
require "rails_helper"

RSpec.describe Admin::ClaimsFilterForm, type: :model do
describe "#claims" do
context "when rejected whilst awaiting provider verification" do
let!(:claim) do
create(
:claim,
:rejected,
:awaiting_provider_verification,
policy: Policies::FurtherEducationPayments
)
end

let(:session) { {} }
let(:filters) { {status: "awaiting_provider_verification"} }

subject { described_class.new(filters:, session:) }

it "filtering by status awaiting provider verification excludes them" do
expect(subject.claims).not_to include(claim)
end
end
end
end
17 changes: 17 additions & 0 deletions spec/helpers/admin/claims_helper_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -540,6 +540,23 @@
end
end
end

context "rejected claim whilst awaiting provider verification" do
let!(:claim) do
create(
:claim,
:rejected,
:awaiting_provider_verification,
policy: Policies::FurtherEducationPayments
)
end

it "returns rejected" do
freeze_time do
expect(status(claim)).to eql "Rejected"
end
end
end
end

describe "#index_status_filter" do
Expand Down

0 comments on commit b244de5

Please sign in to comment.