mirror of
https://github.com/internetee/registry.git
synced 2025-05-17 01:47:18 +02:00
Add status adding to domain update epp request
This commit is contained in:
parent
290182b7d1
commit
f43662e8b0
3 changed files with 29 additions and 1 deletions
|
@ -28,7 +28,7 @@ class Domain < ActiveRecord::Base
|
|||
has_many :domain_statuses
|
||||
|
||||
has_many :statuses, -> {
|
||||
where(setting_group: SettingGroup.domain_statuses)
|
||||
where(setting_group: SettingGroup.domain_statuses).uniq
|
||||
}, through: :domain_statuses, source: :setting
|
||||
|
||||
delegate :code, to: :owner_contact, prefix: true
|
||||
|
@ -57,6 +57,7 @@ class Domain < ActiveRecord::Base
|
|||
attach_owner_contact(ph[:registrant]) if ph[:registrant]
|
||||
attach_contacts(self.class.parse_contacts_from_frame(parsed_frame))
|
||||
attach_nameservers(self.class.parse_nameservers_from_frame(parsed_frame))
|
||||
attach_statuses(self.class.parse_statuses_from_frame(parsed_frame))
|
||||
|
||||
errors.empty?
|
||||
end
|
||||
|
@ -107,6 +108,12 @@ class Domain < ActiveRecord::Base
|
|||
end
|
||||
end
|
||||
|
||||
def attach_statuses(status_list)
|
||||
status_list.each do |x|
|
||||
statuses << SettingGroup.domain_statuses.settings.find_by(value: x[:value])
|
||||
end
|
||||
end
|
||||
|
||||
### RENEW ###
|
||||
|
||||
def renew(cur_exp_date, period, unit='y')
|
||||
|
@ -237,6 +244,19 @@ class Domain < ActiveRecord::Base
|
|||
p[:unit]
|
||||
end
|
||||
|
||||
def parse_statuses_from_frame(parsed_frame)
|
||||
res = []
|
||||
|
||||
parsed_frame.css('status').each do |x|
|
||||
res << {
|
||||
value: x['s'],
|
||||
description: x.text
|
||||
}
|
||||
end
|
||||
|
||||
res
|
||||
end
|
||||
|
||||
def check_availability(domains)
|
||||
domains = [domains] if domains.is_a?(String)
|
||||
|
||||
|
|
|
@ -7,6 +7,7 @@ describe 'EPP Domain', epp: true do
|
|||
before(:each) do
|
||||
Fabricate(:epp_user)
|
||||
Fabricate(:domain_validation_setting_group)
|
||||
Fabricate(:domain_statuses_setting_group)
|
||||
end
|
||||
|
||||
it 'returns error if contact does not exists' do
|
||||
|
|
|
@ -13,3 +13,10 @@ Fabricator(:domain_validation_setting_group, from: :setting_group) do
|
|||
Fabricate(:setting, code: 'ns_max_count', value: 13)
|
||||
]}
|
||||
end
|
||||
|
||||
Fabricator(:domain_statuses_setting_group, from: :setting_group) do
|
||||
code 'domain_statuses'
|
||||
settings { [
|
||||
Fabricate(:setting, code: 'client_hold', value: 'clientHold')
|
||||
]}
|
||||
end
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue