Skip to content

Commit

Permalink
Merge branch 'CAPT-1531/irp-notify-emails' into IRP-review-app-6
Browse files Browse the repository at this point in the history
  • Loading branch information
rjlynch committed Jul 30, 2024
2 parents 58419ca + abd4f3e commit 1f58d68
Show file tree
Hide file tree
Showing 3 changed files with 39 additions and 4 deletions.
4 changes: 3 additions & 1 deletion app/models/policies/international_relocation_payments.rb
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,9 @@ module InternationalRelocationPayments
:invalid_bank_details,
:ineligible_visa_or_entry_date,
:ineligible_employment_terms,
:no_response_from_school
:no_response_from_school,
:suspected_fraud,
:information_mismatch_new_details_needed
]

# NOTE RL: currently IRP only has a single reply to address, so notify
Expand Down
2 changes: 2 additions & 0 deletions config/locales/en.yml
Original file line number Diff line number Diff line change
Expand Up @@ -784,6 +784,8 @@ en:
ineligible_visa_or_entry_date: "Visa/entry date ineligible"
ineligible_employment_terms: Ineligible employment terms
no_response_from_school: No response from school
suspected_fraud: Suspected fraud
information_mismatch_new_details_needed: "Information mismatch - new details needed"
eligibility_answers:
nationality: "Nationality"
passport_number: "Passport number"
Expand Down
37 changes: 34 additions & 3 deletions spec/mailers/claim_mailer_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ class SomePolicy; end
end

it "sets the GOV.UK Notify reply_to_id according to the policy" do
expect(mail["reply_to_id"].value).to eql(policy.notify_reply_to_id)
expect(mail["reply_to_id"]&.value).to eql(policy.notify_reply_to_id)
end

it "mentions the type of claim in the subject and body" do
Expand All @@ -37,7 +37,7 @@ class SomePolicy; end
end

it "sets the GOV.UK Notify reply_to_id according to the policy" do
expect(mail["reply_to_id"].value).to eql(policy.notify_reply_to_id)
expect(mail["reply_to_id"]&.value).to eql(policy.notify_reply_to_id)
end

it "includes a personalisation key for claim reference (ref_number)" do
Expand All @@ -57,7 +57,7 @@ class SomePolicy; end
end

# Characteristics common to all policies
[Policies::EarlyCareerPayments, Policies::StudentLoans, Policies::LevellingUpPremiumPayments].each do |policy|
[Policies::EarlyCareerPayments, Policies::StudentLoans, Policies::LevellingUpPremiumPayments, Policies::InternationalRelocationPayments].each do |policy|
context "with a #{policy} claim" do
let!(:journey_configuration) { create(:journey_configuration, policy.to_s.underscore) }

Expand All @@ -84,6 +84,12 @@ class SomePolicy; end
expect(mail.template_id).to eq "f9e39fcd-301a-4427-9159-6831fd484e39"
end
end

context "when InternationalRelocationPayments", if: policy == Policies::InternationalRelocationPayments do
it "uses the correct template" do
expect(mail.template_id).to eq "316d6c56-2354-4cb7-9d1d-3b61bc7e8c59"
end
end
end

describe "#approved" do
Expand All @@ -109,6 +115,12 @@ class SomePolicy; end
expect(mail.template_id).to eq "2032be01-6aee-4a1a-81ce-cf91e09de8d7"
end
end

context "when InternationalRelocationPayments", if: policy == Policies::InternationalRelocationPayments do
it "uses the correct template" do
expect(mail.template_id).to eq "5cf5287f-3bdf-4d0b-b999-b61987b9c39f"
end
end
end

describe "#rejected" do
Expand Down Expand Up @@ -202,6 +214,25 @@ class SomePolicy; end

include_examples "template id and personalisation keys"
end

context "when InternationalRelocationPayments", if: policy == Policies::InternationalRelocationPayments do
let(:expected_template_id) { "1edc468c-a1bf-4bea-bb79-042740cd8547" }

let(:expected_rejected_reasons_keys) do
{
reason_duplicate: "yes",
reason_ineligible_school: "no",
reason_invalid_bank_details: "no",
reason_ineligible_visa_or_entry_date: "no",
reason_ineligible_employment_terms: "no",
reason_no_response_from_school: "no",
reason_suspected_fraud: "no",
reason_information_mismatch_new_details_needed: "no"
}
end

include_examples "template id and personalisation keys"
end
end

describe "#update_after_three_weeks" do
Expand Down

0 comments on commit 1f58d68

Please sign in to comment.