Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
80453 pt2 rehydrate 5655 controller (#16459)
* 80453 create a method to upsert IPFs based on 5655 metadata * move user verification logic out of UserVerification model at reviewer's request * 80453 add rehydration controller methods * linter or leave 'er am I right?
- Loading branch information
Showing
4 changed files
with
79 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
19 changes: 19 additions & 0 deletions
19
modules/debts_api/lib/debts_api/v0/fsr_rehydration_service.rb
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
# frozen_string_literal: true | ||
|
||
module DebtsApi | ||
class V0::FsrRehydrationService | ||
include SentryLogging | ||
|
||
class UserDoesNotOwnsubmission < StandardError; end | ||
class NoInProgressFormDataStored < StandardError; end | ||
|
||
def self.attempt_rehydration(user_uuid:, submission_id:) | ||
submission = DebtsApi::V0::Form5655Submission.find(submission_id) | ||
|
||
raise NoInProgressFormDataStored unless submission.ipf_data | ||
raise UserDoesNotOwnsubmission unless submission.user_uuid == user_uuid | ||
|
||
submission.upsert_in_progress_form | ||
end | ||
end | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters