Domain pricelist validation

This commit is contained in:
Stas 2015-11-05 18:21:20 +02:00
parent dc6b9ac924
commit b50f954aa8

View file

@ -1,4 +1,5 @@
class Epp::DomainsController < EppController class Epp::DomainsController < EppController
include EppErrors
before_action :find_domain, only: [:info, :renew, :update, :transfer, :delete] before_action :find_domain, only: [:info, :renew, :update, :transfer, :delete]
before_action :find_password, only: [:info, :update, :transfer, :delete] before_action :find_password, only: [:info, :update, :transfer, :delete]
@ -28,6 +29,10 @@ class Epp::DomainsController < EppController
@domain.errors.delete(:name_dirty) if @domain.errors[:puny_label].any? @domain.errors.delete(:name_dirty) if @domain.errors[:puny_label].any?
handle_errors(@domain) and return if @domain.errors.any? handle_errors(@domain) and return if @domain.errors.any?
if !@domain_pricelist || @domain_pricelist.valid_from > Time.zone.now
add_epp_error('2306', nil, nil, 'No price lists for domain')
end
handle_errors and return unless balance_ok?('create') handle_errors and return unless balance_ok?('create')
ActiveRecord::Base.transaction do ActiveRecord::Base.transaction do
if @domain.save # TODO: Maybe use validate: false here because we have already validated the domain? if @domain.save # TODO: Maybe use validate: false here because we have already validated the domain?