mirror of
https://github.com/internetee/registry.git
synced 2025-07-01 16:53:37 +02:00
Save legal doc on domain info request
This commit is contained in:
parent
fb34e3f2eb
commit
0c16146ebb
2 changed files with 26 additions and 1 deletions
|
@ -15,6 +15,10 @@ class Epp::DomainsController < EppController
|
||||||
def info
|
def info
|
||||||
@domain = find_domain
|
@domain = find_domain
|
||||||
handle_errors(@domain) and return unless @domain
|
handle_errors(@domain) and return unless @domain
|
||||||
|
|
||||||
|
@domain.attach_legal_document(Epp::EppDomain.parse_legal_document_from_frame(params[:parsed_frame]))
|
||||||
|
@domain.save!(validate: false)
|
||||||
|
|
||||||
render_epp_response '/epp/domains/info'
|
render_epp_response '/epp/domains/info'
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
|
@ -1421,7 +1421,7 @@ describe 'EPP Domain', epp: true do
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
it 'validates legal document type' do
|
it 'validates legal document type in info request' do
|
||||||
xml = epp_xml.domain.info({
|
xml = epp_xml.domain.info({
|
||||||
name: { value: domain.name }
|
name: { value: domain.name }
|
||||||
}, {
|
}, {
|
||||||
|
@ -1450,6 +1450,27 @@ describe 'EPP Domain', epp: true do
|
||||||
response[:msg].should == 'Attribute is invalid: type'
|
response[:msg].should == 'Attribute is invalid: type'
|
||||||
end
|
end
|
||||||
|
|
||||||
|
it 'saves legal document on info request' do
|
||||||
|
xml = epp_xml.domain.info({
|
||||||
|
name: { value: domain.name }
|
||||||
|
}, {
|
||||||
|
_anonymus: [
|
||||||
|
legalDocument: {
|
||||||
|
value: 'JVBERi0xLjQKJcOkw7zDtsOfCjIgMCBvYmoKPDwvTGVuZ3RoIDMgMCBSL0Zp==',
|
||||||
|
attrs: { type: 'pdf' }
|
||||||
|
}
|
||||||
|
]
|
||||||
|
})
|
||||||
|
|
||||||
|
response = epp_plain_request(xml, :xml)
|
||||||
|
response[:msg].should == 'Command completed successfully'
|
||||||
|
|
||||||
|
docs = domain.legal_documents
|
||||||
|
docs.count.should == 1
|
||||||
|
docs.first.body.should == 'JVBERi0xLjQKJcOkw7zDtsOfCjIgMCBvYmoKPDwvTGVuZ3RoIDMgMCBSL0Zp=='
|
||||||
|
docs.first.document_type.should == 'pdf'
|
||||||
|
end
|
||||||
|
|
||||||
### DELETE ###
|
### DELETE ###
|
||||||
it 'deletes domain' do
|
it 'deletes domain' do
|
||||||
response = epp_plain_request(epp_xml.domain.delete({
|
response = epp_plain_request(epp_xml.domain.delete({
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue