Story #109367694 - use creator or updator as string, when registrar can not be found

This commit is contained in:
Matt Farnsworth 2015-12-04 14:11:21 +02:00
parent 251a9e1666
commit 098c40efc1
2 changed files with 16 additions and 4 deletions

View file

@ -48,11 +48,17 @@ xml.epp_head do
xml.tag!('contact:clID', @contact.registrar.try(:code)) xml.tag!('contact:clID', @contact.registrar.try(:code))
xml.tag!('contact:crID', @contact.creator.registrar.try(:code)) # EPP requires a creator ID, which should be registrar code if we have one
crID = contact.creator.try(:registrar)
crID = crID.code if crID.present? # Did creator return a kind of User that has a registrar?
crID = contact.creator unless crID.present? # Fallback if we failed, maybe this is a string only
xml.tag!('contact:crID', crID)
xml.tag!('contact:crDate', @contact.created_at.try(:iso8601)) xml.tag!('contact:crDate', @contact.created_at.try(:iso8601))
if @contact.updated_at != @contact.created_at if @contact.updated_at != @contact.created_at
xml.tag!('contact:upID', @contact.updator.registrar.code) if @contact.updator.try(:registrar).present? upID = contact.updator.try(:registrar)
upID = upID.code if upID.present? # Did updator return a kind of User that has a registrar?
xml.tag!('contact:upID', upID) if upID.present? # optional upID
xml.tag!('contact:upDate', @contact.updated_at.try(:iso8601)) xml.tag!('contact:upDate', @contact.updated_at.try(:iso8601))
end end
# xml.tag!('contact:trDate', '123') if false # xml.tag!('contact:trDate', '123') if false

View file

@ -38,11 +38,17 @@ xml.epp_head do
xml.tag!('domain:clID', @domain.registrar.code) xml.tag!('domain:clID', @domain.registrar.code)
xml.tag!('domain:crID', @domain.creator.registrar.code) if @domain.creator # EPP requires a creator ID, which should be registrar code if we have one
crID = @domain.creator.try(:registrar)
crID = crID.code if crID.present? # Did creator return a kind of User that has a registrar?
crID = @domain.creator unless crID.present? # Fallback if we failed, maybe this is a string only
xml.tag!('domain:crID', crID)
xml.tag!('domain:crDate', @domain.created_at.try(:iso8601)) xml.tag!('domain:crDate', @domain.created_at.try(:iso8601))
if @domain.updated_at != @domain.created_at if @domain.updated_at != @domain.created_at
xml.tag!('domain:upID', @domain.updator.registrar.code) if @domain.updator.try(:registrar).present? upID = @domain.updator.try(:registrar)
upID = upID.code if upID.present? # Did updator return a kind of User that has a registrar?
xml.tag!('domain:upID', upID) if upID.present? # optional upID
xml.tag!('domain:upDate', @domain.updated_at.try(:iso8601)) xml.tag!('domain:upDate', @domain.updated_at.try(:iso8601))
end end