Domain transfer improvements, various test fixes

This commit is contained in:
Martin Lensment 2014-08-28 18:10:04 +03:00
parent 187316078b
commit 0adca73f88
5 changed files with 44 additions and 19 deletions

View file

@ -60,7 +60,7 @@ module Epp::DomainsHelper
end
def transfer_domain
@domain = find_domain
@domain = find_domain(secure: false)
handle_errors(@domain) and return unless @domain
handle_errors(@domain) and return unless @domain.transfer(domain_transfer_params)
@ -128,8 +128,10 @@ module Epp::DomainsHelper
end
## SHARED
def find_domain
domain = Domain.find_by(name: @ph[:name])
def find_domain(secure = { secure: true })
domain = Domain.find_by(name: @ph[:name], registrar: current_epp_user.registrar) if secure[:secure] == true
domain = Domain.find_by(name: @ph[:name]) if secure[:secure] == false
unless domain
epp_errors << { code: '2303', msg: I18n.t('errors.messages.epp_domain_not_found'), value: { obj: 'name', val: @ph[:name] } }
end

View file

@ -205,6 +205,7 @@ class Domain < ActiveRecord::Base
end
### TRANSFER ###
def transfer(params)
return false unless authenticate(params[:pw])
@ -212,6 +213,8 @@ class Domain < ActiveRecord::Base
approve_pending_transfer and return true
end
return true if pending_transfer
wait_time = SettingGroup.domain_general.setting(:transfer_wait_time).value.to_i
if wait_time > 0