mirror of
https://github.com/internetee/registry.git
synced 2025-05-18 18:29:40 +02:00
Merge branch '111864739-history_legal_doc' into staging
This commit is contained in:
commit
55722d98f9
2 changed files with 25 additions and 10 deletions
|
@ -228,13 +228,21 @@ class Epp::Contact < Contact
|
||||||
end
|
end
|
||||||
|
|
||||||
def add_legal_file_to_new frame
|
def add_legal_file_to_new frame
|
||||||
if doc = attach_legal_document(parse_legal_document_from_frame(frame))
|
legal_document_data = Epp::Contact.parse_legal_document_from_frame(frame)
|
||||||
|
return unless legal_document_data
|
||||||
|
|
||||||
|
doc = LegalDocument.create(
|
||||||
|
documentable_type: Contact,
|
||||||
|
document_type: legal_document_data[:type],
|
||||||
|
body: legal_document_data[:body]
|
||||||
|
)
|
||||||
raise ActiveRecord::Rollback if doc && doc.id.nil?
|
raise ActiveRecord::Rollback if doc && doc.id.nil?
|
||||||
|
self.legal_documents = [doc]
|
||||||
|
|
||||||
frame.css("legalDocument").first.content = doc.path if doc && doc.persisted?
|
frame.css("legalDocument").first.content = doc.path if doc && doc.persisted?
|
||||||
self.legal_document_id = doc.id
|
self.legal_document_id = doc.id
|
||||||
end
|
end
|
||||||
end
|
|
||||||
|
|
||||||
def parse_legal_document_from_frame frame
|
def parse_legal_document_from_frame frame
|
||||||
ld = frame.css('legalDocument').first
|
ld = frame.css('legalDocument').first
|
||||||
|
|
|
@ -202,13 +202,20 @@ class Epp::Domain < Domain
|
||||||
# Adding legal doc to domain and
|
# Adding legal doc to domain and
|
||||||
# if something goes wrong - raise Rollback error
|
# if something goes wrong - raise Rollback error
|
||||||
def add_legal_file_to_new frame
|
def add_legal_file_to_new frame
|
||||||
if doc = attach_legal_document(Epp::Domain.parse_legal_document_from_frame(frame))
|
legal_document_data = Epp::Domain.parse_legal_document_from_frame(frame)
|
||||||
|
return unless legal_document_data
|
||||||
|
|
||||||
|
doc = LegalDocument.create(
|
||||||
|
documentable_type: Domain,
|
||||||
|
document_type: legal_document_data[:type],
|
||||||
|
body: legal_document_data[:body]
|
||||||
|
)
|
||||||
raise ActiveRecord::Rollback if doc && doc.id.nil?
|
raise ActiveRecord::Rollback if doc && doc.id.nil?
|
||||||
|
self.legal_documents = [doc]
|
||||||
|
|
||||||
frame.css("legalDocument").first.content = doc.path if doc && doc.persisted?
|
frame.css("legalDocument").first.content = doc.path if doc && doc.persisted?
|
||||||
self.legal_document_id = doc.id
|
self.legal_document_id = doc.id
|
||||||
end
|
end
|
||||||
end
|
|
||||||
# rubocop: enable Metrics/PerceivedComplexity
|
# rubocop: enable Metrics/PerceivedComplexity
|
||||||
# rubocop: enable Metrics/CyclomaticComplexity
|
# rubocop: enable Metrics/CyclomaticComplexity
|
||||||
# rubocop: enable Metrics/MethodLength
|
# rubocop: enable Metrics/MethodLength
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue