Refactor domain transfer controller

This commit is contained in:
Martin Lensment 2015-03-10 17:17:29 +02:00
parent b91f9b1a8e
commit d056d370be
3 changed files with 42 additions and 25 deletions

View file

@ -385,6 +385,23 @@ class Epp::Domain < Domain
### TRANSFER ###
# rubocop: disable Metrics/PerceivedComplexity
# rubocop: disable Metrics/CyclomaticComplexity
def transfer(frame, action, current_user)
case action
when 'query'
return pending_transfer if pending_transfer
return query_transfer(frame, current_user)
when 'approve'
return approve_transfer(frame, current_user) if pending_transfer
when 'reject'
return reject_transfer(frame, current_user) if pending_transfer
end
add_epp_error('2303', nil, nil, I18n.t('pending_transfer_was_not_found'))
end
# rubocop: enable Metrics/PerceivedComplexity
# rubocop: enable Metrics/CyclomaticComplexity
# rubocop: disable Metrics/MethodLength
def query_transfer(frame, current_user)
return false unless can_be_transferred_to?(current_user.registrar)