Basic domain renew

This commit is contained in:
Martin Lensment 2014-08-06 18:04:46 +03:00
parent d62106da20
commit b828645920
7 changed files with 69 additions and 0 deletions

View file

@ -124,6 +124,16 @@ class Domain < ActiveRecord::Base
errors.add(:admin_contacts, :blank) if admin_contacts.empty?
end
def renew(cur_exp_date, period, unit='y')
if cur_exp_date == valid_to
valid_to = period.to_i.years
else
errors[:base] << {msg: I18n.t('errors.messages.epp_exp_dates_do_not_match'), obj: 'domain', val: cur_exp_date}
end
save
end
class << self
def check_availability(domains)
domains = [domains] if domains.is_a?(String)