Skip to content

Commit

Permalink
WIP: EY claim rejection reasons
Browse files Browse the repository at this point in the history
  • Loading branch information
vacabor committed Oct 23, 2024
1 parent cd54613 commit 15e3feb
Show file tree
Hide file tree
Showing 5 changed files with 57 additions and 1 deletion.
3 changes: 2 additions & 1 deletion app/models/policies.rb
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,8 @@ module Policies
EarlyCareerPayments,
LevellingUpPremiumPayments,
InternationalRelocationPayments,
FurtherEducationPayments
FurtherEducationPayments,
EarlyYearsPayments
].freeze

AMENDABLE_ELIGIBILITY_ATTRIBUTES = POLICIES.map do |policy|
Expand Down
9 changes: 9 additions & 0 deletions app/models/policies/early_years_payments.rb
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,15 @@ module EarlyYearsPayments
# NOOP as PERSONAL_DATA_ATTRIBUTES_TO_RETAIN_FOR_EXTENDED_PERIOD is empty
EXTENDED_PERIOD_END_DATE = ->(start_of_academic_year) {}

# Options shown to admins when rejecting a claim
ADMIN_DECISION_REJECTED_REASONS = [
:claim_cancelled_by_employer,
:six_month_retention_check_failed,
:duplicate,
:no_response,
:other
]

# TODO: This is needed once the reply-to email address has been added to Gov Notify
def notify_reply_to_id
nil
Expand Down
2 changes: 2 additions & 0 deletions app/models/policies/early_years_payments/eligibility.rb
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
module Policies
module EarlyYearsPayments
class Eligibility < ApplicationRecord
AMENDABLE_ATTRIBUTES = [].freeze

self.table_name = "early_years_payment_eligibilities"

has_one :claim, as: :eligibility, inverse_of: :eligibility
Expand Down
8 changes: 8 additions & 0 deletions config/locales/en.yml
Original file line number Diff line number Diff line change
Expand Up @@ -1418,6 +1418,14 @@ en:
early_years_payments:
<<: *early_years_payment_provider_authenticated
claim_subject: "Early Years Payment"
admin:
decision:
rejected_reasons:
claim_cancelled_by_employer: Claim cancelled by employer
six_month_retention_check_failed: 6 month retention check failed
duplicate: Duplicate
no_response: No response
other: Other
early_years_payment_practitioner:
journey_name: Claim an early years financial incentive payment - practitioner
feedback_email: "[email protected]"
Expand Down
36 changes: 36 additions & 0 deletions spec/models/decision_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -138,6 +138,15 @@
:other
]
end
let(:expected_reasons_ey) do
[
:claim_cancelled_by_employer,
:six_month_retention_check_failed,
:duplicate,
:no_response,
:other
]
end

context "when the claim policy is ECP" do
let(:policy) { Policies::EarlyCareerPayments }
Expand All @@ -156,6 +165,12 @@

it { is_expected.to eq(expected_reasons_tslr) }
end

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

it { is_expected.to eq(expected_reasons_ey) }
end
end

describe "#rejected_reasons_hash" do
Expand Down Expand Up @@ -236,6 +251,27 @@
)
end
end

context "with an EY claim" do
let(:rejected_reasons) do
{
rejected_reasons_claim_cancelled_by_employer: "1",
rejected_reasons_six_month_retention_check_failed: "1"
}
end

let(:claim) { create(:claim, policy: Policies::EarlyYearsPayments) }

it do
is_expected.to eq(
reason_claim_cancelled_by_employer: "1",
reason_six_month_retention_check_failed: "1",
reason_duplicate: "0",
reason_no_response: "0",
reason_other: "0"
)
end
end
end

describe "#selected_rejected_reasons" do
Expand Down

0 comments on commit 15e3feb

Please sign in to comment.