Merge branch '111864739-history_legal_doc' into staging

* 111864739-history_legal_doc:
  111864739-contact_and_domain_create
This commit is contained in:
Stas 2016-02-17 18:40:32 +02:00
commit 0c63f0fa54
5 changed files with 67 additions and 18 deletions

View file

@ -194,9 +194,21 @@ class Epp::Domain < Domain
end
at[:dnskeys_attributes] = dnskeys_attrs(dnskey_frame, action)
at[:legal_documents_attributes] = legal_document_from(frame)
at
end
# Adding legal doc to domain and
# if something goes wrong - raise Rollback error
def add_legal_file_to_new frame
if doc = attach_legal_document(Epp::Domain.parse_legal_document_from_frame(frame))
raise ActiveRecord::Rollback if doc && doc.id.nil?
frame.css("legalDocument").first.content = doc.path if doc && doc.persisted?
self.legal_document_id = doc.id
end
end
# rubocop: enable Metrics/PerceivedComplexity
# rubocop: enable Metrics/CyclomaticComplexity
# rubocop: enable Metrics/MethodLength
@ -456,15 +468,6 @@ class Epp::Domain < Domain
status_list
end
def legal_document_from(frame)
ld = frame.css('legalDocument').first
return [] unless ld
[{
body: ld.text,
document_type: ld['type']
}]
end
# rubocop: disable Metrics/AbcSize
# rubocop: disable Metrics/CyclomaticComplexity