Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

AP-4170: Correct validation for dwp override #5920

Merged
merged 1 commit into from
Oct 31, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ def update
@form = Providers::ConfirmDWPNonPassportedApplicationsForm.new(form_params)

if @form.valid?
remove_dwp_override if correct_dwp_result?
update_joint_benefit_response
update_application_state
HMRC::CreateResponsesService.call(legal_aid_application) if make_hmrc_call?
Expand All @@ -25,6 +26,10 @@ def update

private

def remove_dwp_override
legal_aid_application.dwp_override&.destroy!
end

def partner
@partner = legal_aid_application.partner
end
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -122,6 +122,12 @@
patch_request
expect(HMRC::CreateResponsesService).to have_received(:call).once
end

it "successfully deletes any existing dwp override" do
create(:dwp_override, legal_aid_application: application)
patch_request
expect(application.reload.dwp_override).to be_nil
end
end

context "and the solicitor wants to override the results with a non joint benefit" do
Expand Down
Loading