Story #109367018 - add new model to handle domain values are changing, and need to be captured now, not later

New model will provide data to DomainMailer customized as needed for the invocation reason as passed via symbol to
send_mail(). The mail templetes then required modification to use the new data model. This should handle all the data
errors in the update process, including pendingUpdate, confirmed, rejected or expired.
This commit is contained in:
Matt Farnsworth 2015-12-16 16:14:05 +02:00
parent 2c916001ad
commit 51a5798914
17 changed files with 366 additions and 254 deletions

View file

@ -4,18 +4,18 @@ class DomainUpdateConfirmJob < Que::Job
ActiveRecord::Base.transaction do
domain = Epp::Domain.find(domain_id)
case action
when RegistrantVerification::CONFIRMED
domain.poll_message!(:poll_pending_update_confirmed_by_registrant)
domain.apply_pending_update! do |e|
e.instance_variable_set("@changed_attributes", e.changed_attributes.merge("statuses"=>[]))
end
domain.clean_pendings!
when RegistrantVerification::REJECTED
DomainMailer.pending_update_rejected_notification_for_new_registrant(domain_id).deliver
domain.poll_message!(:poll_pending_update_rejected_by_registrant)
domain.clean_pendings!
domain.instance_variable_set("@changed_attributes", domain.changed_attributes.merge("statuses"=>[]))
domain.save
when RegistrantVerification::CONFIRMED
domain.poll_message!(:poll_pending_update_confirmed_by_registrant)
domain.apply_pending_update! do |e|
e.instance_variable_set("@changed_attributes", e.changed_attributes.merge("statuses"=>[]))
end
domain.clean_pendings!
when RegistrantVerification::REJECTED
domain.send_mail :pending_update_rejected_notification_for_new_registrant
domain.poll_message!(:poll_pending_update_rejected_by_registrant)
domain.clean_pendings!
domain.instance_variable_set("@changed_attributes", domain.changed_attributes.merge("statuses"=>[]))
domain.save
end
destroy # it's best to destroy the job in the same transaction
end