mirror of
https://github.com/internetee/registry.git
synced 2025-08-04 17:01:44 +02:00
Check for domain dispute on create
This commit is contained in:
parent
928f96691c
commit
1dc2cf8e12
5 changed files with 41 additions and 4 deletions
|
@ -92,7 +92,7 @@ module Epp
|
|||
status: Auction.statuses[:payment_received])
|
||||
active_auction.domain_registered!
|
||||
end
|
||||
|
||||
Dispute.close_by_domain(@domain.name)
|
||||
render_epp_response '/epp/domains/create'
|
||||
else
|
||||
handle_errors(@domain)
|
||||
|
|
|
@ -27,6 +27,10 @@ class Dispute < ApplicationRecord
|
|||
dispute.update(closed: true) if dispute.present?
|
||||
end
|
||||
|
||||
def self.valid_auth?(domain_name, password)
|
||||
Dispute.active.find_by(domain_name: domain_name, password: password).present?
|
||||
end
|
||||
|
||||
def set_expiry_date
|
||||
return if starts_at.blank?
|
||||
|
||||
|
@ -98,7 +102,6 @@ class Dispute < ApplicationRecord
|
|||
private
|
||||
|
||||
def validate_start_date
|
||||
puts 'EXECUTED'
|
||||
return if starts_at.nil?
|
||||
|
||||
errors.add(:starts_at, :past) if starts_at.past?
|
||||
|
|
|
@ -90,7 +90,7 @@ class Domain < ApplicationRecord
|
|||
validates :transfer_code, presence: true
|
||||
|
||||
validate :validate_reservation
|
||||
|
||||
validate :validate_disputed
|
||||
def validate_reservation
|
||||
return if persisted? || !in_reserved_list?
|
||||
|
||||
|
@ -104,6 +104,19 @@ class Domain < ApplicationRecord
|
|||
errors.add(:base, :invalid_auth_information_reserved)
|
||||
end
|
||||
|
||||
def validate_disputed
|
||||
return if persisted? || !in_disputed_list?
|
||||
|
||||
if reserved_pw.blank?
|
||||
errors.add(:base, :required_parameter_missing_reserved)
|
||||
return false
|
||||
end
|
||||
|
||||
return if Dispute.valid_auth?(name, reserved_pw)
|
||||
|
||||
errors.add(:base, :invalid_auth_information_reserved)
|
||||
end
|
||||
|
||||
validate :status_is_consistant
|
||||
def status_is_consistant
|
||||
has_error = (statuses.include?(DomainStatus::SERVER_HOLD) && statuses.include?(DomainStatus::SERVER_MANUAL_INZONE))
|
||||
|
@ -277,6 +290,10 @@ class Domain < ApplicationRecord
|
|||
@in_reserved_list ||= ReservedDomain.by_domain(name).any?
|
||||
end
|
||||
|
||||
def in_disputed_list?
|
||||
@in_disputed_list ||= Dispute.active.find_by(domain_name: name).present?
|
||||
end
|
||||
|
||||
def disputed?
|
||||
Dispute.active.where(domain_name: name).any?
|
||||
end
|
||||
|
@ -302,6 +319,8 @@ class Domain < ApplicationRecord
|
|||
return false if statuses.include_any?(DomainStatus::DELETE_CANDIDATE, DomainStatus::PENDING_RENEW,
|
||||
DomainStatus::PENDING_TRANSFER, DomainStatus::PENDING_DELETE,
|
||||
DomainStatus::PENDING_UPDATE, DomainStatus::PENDING_DELETE_CONFIRMATION)
|
||||
return false if disputed?
|
||||
|
||||
true
|
||||
end
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue