mirror of
https://github.com/internetee/registry.git
synced 2025-07-24 03:30:33 +02:00
parent
fc9104a232
commit
4fd18c4a26
4 changed files with 10 additions and 37 deletions
|
@ -78,6 +78,7 @@ class Domain < ActiveRecord::Base
|
|||
end
|
||||
|
||||
before_create :generate_auth_info
|
||||
before_create :set_validity_dates
|
||||
before_create -> { self.reserved = in_reserved_list?; nil }
|
||||
|
||||
before_save :manage_automatic_statuses
|
||||
|
@ -532,6 +533,13 @@ class Domain < ActiveRecord::Base
|
|||
end
|
||||
# rubocop:enable Lint/Loop
|
||||
|
||||
def set_validity_dates
|
||||
self.registered_at = Time.zone.now
|
||||
self.valid_from = Time.zone.now
|
||||
# we need + 1 day as this is more correct from juridical side
|
||||
self.valid_to = valid_from.utc.beginning_of_day + self.class.convert_period_to_time(period, period_unit) + 1.day
|
||||
end
|
||||
|
||||
# rubocop:disable Metrics/AbcSize
|
||||
# rubocop:disable Metrics/MethodLength
|
||||
def set_force_delete
|
||||
|
|
|
@ -51,9 +51,6 @@ class Epp::Domain < Domain
|
|||
class << self
|
||||
def new_from_epp(frame, current_user)
|
||||
domain = Epp::Domain.new
|
||||
domain.registered_at = Time.zone.now
|
||||
domain.valid_from = Time.zone.now
|
||||
domain.expire_time = domain.valid_from.beginning_of_day + convert_period_to_time(domain.period, domain.period_unit) + 1.day
|
||||
domain.attributes = domain.attrs_from(frame, current_user)
|
||||
domain.attach_default_contacts
|
||||
domain
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue