app/models/concerns/user_events.rb
# EPP requires a server defined creator ID, which should be registrar code if we have one
EPP requires a server defined creator ID, which should be registrar code if we have one
EPP requires a server defined creator ID which should be registrar code if we have one
def cr_id
      registrar = creator.try(:registrar)
      if registrar.present?            
        registrar.code
      else
        if versions.first.try(:object).nil?
          changes = versions.first.try(:object_changes)
          cr_registrar_id = changes['registrar_id'].second if changes.present?
        else
          cr_registrar_id = versions.first.object['registrar_id']
        end
        if cr_registrar_id.present?
          Registrar.find(cr_registrar_id).code
        else
          creator_str || self.registrar.code 
        end
      end
    end
def cr_id registrar = creator . try ( :registrar ) if registrar . present? registrar . code else if versions . first . try ( :object ) . nil? changes = versions . first . try ( :object_changes ) cr_registrar_id = changes [ 'registrar_id' ] . second if changes . present? else cr_registrar_id = versions . first . object [ 'registrar_id' ] end if cr_registrar_id . present? Registrar . find ( cr_registrar_id ) . code else creator_str || self . registrar . code end end end
EPP requires a server defined creator ID, which should be registrar code if we have one
EPP requires a server defined creator ID which should be registrar code if we have one
# try this, rebuild user for registrar before searching history? really? # Did creator return a kind of User that has a registrar? # untested, expected never to execute # cr_id optional for domain, but required for contact; but we want something here anyway # Fallback