-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
8c1bead
commit efe94dd
Showing
4 changed files
with
59 additions
and
2 deletions.
There are no files selected for viewing
20 changes: 20 additions & 0 deletions
20
app/interactors/transition_authorization_request_to_previous_stage.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,20 @@ | ||
class TransitionAuthorizationRequestToPreviousStage < ApplicationInteractor | ||
def call | ||
return if context.authorization_request_class.blank? | ||
|
||
context.fail! unless context.authorization_request.can_reopen_to_class?(context.authorization_request_class) | ||
|
||
return if context.authorization_request.is_a? context.authorization_request_class | ||
|
||
transition_to_previous_stage | ||
end | ||
|
||
private | ||
|
||
def transition_to_previous_stage | ||
context.authorization_request.update!( | ||
type: context.authorization_request_class.to_s, | ||
form_uid: context.authorization_request.definition.previous_stage_form(context.authorization_request_class).id | ||
) | ||
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
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