mirror of
https://github.com/internetee/registry.git
synced 2025-08-06 09:45:11 +02:00
Merge pull request #1761 from internetee/1760-move-domain-update-confirm-to-interactor
Move DomainUpdateConfirm to Interactor
This commit is contained in:
commit
4fe489c0c0
11 changed files with 218 additions and 59 deletions
|
@ -327,6 +327,7 @@ class Domain < ApplicationRecord
|
|||
end
|
||||
|
||||
def notify_registrar(message_key)
|
||||
# TODO: To be deleted with DomainDeleteConfirm refactoring
|
||||
registrar.notifications.create!(
|
||||
text: "#{I18n.t(message_key)}: #{name}",
|
||||
attached_obj_id: id,
|
||||
|
@ -335,11 +336,13 @@ class Domain < ApplicationRecord
|
|||
end
|
||||
|
||||
def preclean_pendings
|
||||
# TODO: To be deleted with refactoring
|
||||
self.registrant_verification_token = nil
|
||||
self.registrant_verification_asked_at = nil
|
||||
end
|
||||
|
||||
def clean_pendings!
|
||||
# TODO: To be deleted with refactoring
|
||||
preclean_pendings
|
||||
self.pending_json = {}
|
||||
statuses.delete(DomainStatus::PENDING_DELETE_CONFIRMATION)
|
||||
|
|
|
@ -508,25 +508,6 @@ class Epp::Domain < Domain
|
|||
errors.empty? && super(at)
|
||||
end
|
||||
|
||||
def apply_pending_update!
|
||||
preclean_pendings
|
||||
user = ApiUser.find(pending_json['current_user_id'])
|
||||
frame = Nokogiri::XML(pending_json['frame'])
|
||||
|
||||
self.statuses.delete(DomainStatus::PENDING_UPDATE)
|
||||
self.upid = user.registrar.id if user.registrar
|
||||
self.up_date = Time.zone.now
|
||||
|
||||
return unless update(frame, user, false)
|
||||
clean_pendings!
|
||||
|
||||
save!
|
||||
|
||||
WhoisRecord.find_by(domain_id: id).save # need to reload model
|
||||
|
||||
true
|
||||
end
|
||||
|
||||
def apply_pending_delete!
|
||||
preclean_pendings
|
||||
statuses.delete(DomainStatus::PENDING_DELETE_CONFIRMATION)
|
||||
|
|
|
@ -18,13 +18,13 @@ class RegistrantVerification < ApplicationRecord
|
|||
def domain_registrant_change_confirm!(initiator)
|
||||
self.action_type = DOMAIN_REGISTRANT_CHANGE
|
||||
self.action = CONFIRMED
|
||||
DomainUpdateConfirmJob.enqueue domain.id, CONFIRMED, initiator if save
|
||||
DomainUpdateConfirmJob.perform_later domain.id, CONFIRMED, initiator if save
|
||||
end
|
||||
|
||||
def domain_registrant_change_reject!(initiator)
|
||||
self.action_type = DOMAIN_REGISTRANT_CHANGE
|
||||
self.action = REJECTED
|
||||
DomainUpdateConfirmJob.run domain.id, REJECTED, initiator if save
|
||||
DomainUpdateConfirmJob.perform_later domain.id, REJECTED, initiator if save
|
||||
end
|
||||
|
||||
def domain_registrant_delete_confirm!(initiator)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue