diff --git a/app/forms/claim_submission_base_form.rb b/app/forms/claim_submission_base_form.rb index f57862ccb9..87a76f58c0 100644 --- a/app/forms/claim_submission_base_form.rb +++ b/app/forms/claim_submission_base_form.rb @@ -27,6 +27,8 @@ def save ClaimMailer.submitted(claim).deliver_later ClaimVerifierJob.perform_later(claim) + + true end private diff --git a/app/forms/journeys/further_education_payments/claim_submission_form.rb b/app/forms/journeys/further_education_payments/claim_submission_form.rb index 8959ee87f8..da48296a04 100644 --- a/app/forms/journeys/further_education_payments/claim_submission_form.rb +++ b/app/forms/journeys/further_education_payments/claim_submission_form.rb @@ -2,7 +2,7 @@ module Journeys module FurtherEducationPayments class ClaimSubmissionForm < ::ClaimSubmissionBaseForm def save - super + return false unless super if Policies::FurtherEducationPayments.duplicate_claim?(claim) claim.eligibility.update!(flagged_as_duplicate: true) diff --git a/spec/forms/journeys/further_education_payments/claim_submission_form_spec.rb b/spec/forms/journeys/further_education_payments/claim_submission_form_spec.rb index ab0e2a7c5f..c979deaf78 100644 --- a/spec/forms/journeys/further_education_payments/claim_submission_form_spec.rb +++ b/spec/forms/journeys/further_education_payments/claim_submission_form_spec.rb @@ -108,9 +108,12 @@ ).and_return(double(deliver_later: nil)) first_claim_form = described_class.new(journey_session: journey_session) - second_claim_form = described_class.new(journey_session: journey_session) first_claim_form.save + + journey_session.update! claim: nil + second_claim_form = described_class.new(journey_session: journey_session) + second_claim_form.save expect(ClaimMailer).to(