mirror of
https://github.com/internetee/registry.git
synced 2025-05-18 18:29:40 +02:00
Working domain renewal
This commit is contained in:
parent
218ecb3317
commit
684a4ab4f1
4 changed files with 14 additions and 6 deletions
|
@ -125,13 +125,14 @@ class Domain < ActiveRecord::Base
|
|||
end
|
||||
|
||||
def renew(cur_exp_date, period, unit='y')
|
||||
if cur_exp_date == valid_to
|
||||
valid_to = period.to_i.years
|
||||
if cur_exp_date.to_date == valid_to
|
||||
self.valid_to = self.valid_to + period.to_i.years
|
||||
self.period = period
|
||||
save
|
||||
else
|
||||
errors[:base] << {msg: I18n.t('errors.messages.epp_exp_dates_do_not_match'), obj: 'domain', val: cur_exp_date}
|
||||
false
|
||||
end
|
||||
|
||||
save
|
||||
end
|
||||
|
||||
class << self
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue