This commit is contained in:
Martin Lensment 2015-07-03 10:50:37 +03:00
parent 36e4f2ddc9
commit 7eb509b9a8
2 changed files with 8 additions and 4 deletions

View file

@ -18,16 +18,18 @@ class Epp::DomainsController < EppController
render_epp_response '/epp/domains/info'
end
# rubocop: disable Metrics/PerceivedComplexity
# rubocop: disable Metrics/CyclomaticComplexity
def create
authorize! :create, Epp::Domain
@domain = Epp::Domain.new_from_epp(params[:parsed_frame], current_user)
@domain.valid?
handle_errors(@domain) and return if @domain.errors.any?
handle_errors(@domain) and return if @domain.valid? && @domain.errors.any?
handle_errors and return unless balance_ok?('create')
ActiveRecord::Base.transaction do
if @domain.save
if @domain.save # TODO: Maybe use validate: false here because we have already validated the domain?
current_user.registrar.debit!(@domain_price, "#{I18n.t('create')} #{@domain.name}")
render_epp_response '/epp/domains/create'
else
@ -35,6 +37,8 @@ class Epp::DomainsController < EppController
end
end
end
# rubocop: enable Metrics/PerceivedComplexity
# rubocop: enable Metrics/CyclomaticComplexity
def update
authorize! :update, @domain, @password

View file

@ -55,7 +55,7 @@ describe Pricelist do
end
it 'should have name' do
@pricelist.name.should == 'new .ee'
@pricelist.name.should == 'create ee'
end
it 'should have one version' do