mirror of
https://github.com/internetee/registry.git
synced 2025-05-30 01:20:04 +02:00
Merge branch 'master' of github.com:domify/registry
This commit is contained in:
commit
622e6988ef
10 changed files with 1291 additions and 1097 deletions
|
@ -85,6 +85,10 @@ class Contact < ActiveRecord::Base
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
def roid
|
||||||
|
"EIS-#{id}"
|
||||||
|
end
|
||||||
|
|
||||||
def to_s
|
def to_s
|
||||||
name || '[no name]'
|
name || '[no name]'
|
||||||
end
|
end
|
||||||
|
@ -133,7 +137,7 @@ class Contact < ActiveRecord::Base
|
||||||
|
|
||||||
# custom code from client
|
# custom code from client
|
||||||
# add prefix when needed
|
# add prefix when needed
|
||||||
if code.present?
|
if code.present?
|
||||||
prefix, *custom_code = code.split(':')
|
prefix, *custom_code = code.split(':')
|
||||||
code = custom_code.join(':') if prefix == registrar.code
|
code = custom_code.join(':') if prefix == registrar.code
|
||||||
end
|
end
|
||||||
|
|
|
@ -7,10 +7,10 @@ xml.epp_head do
|
||||||
xml.resData do
|
xml.resData do
|
||||||
xml.tag!('contact:infData', 'xmlns:contact' => 'urn:ietf:params:xml:ns:contact-1.0') do
|
xml.tag!('contact:infData', 'xmlns:contact' => 'urn:ietf:params:xml:ns:contact-1.0') do
|
||||||
xml.tag!('contact:id', @contact.code)
|
xml.tag!('contact:id', @contact.code)
|
||||||
if can? :view_full_info, @contact, @password
|
xml.tag!('contact:roid', @contact.roid)
|
||||||
xml.tag!('contact:voice', @contact.phone)
|
|
||||||
xml.tag!('contact:email', @contact.email)
|
@contact.statuses.each do |status|
|
||||||
xml.tag!('contact:fax', @contact.fax) if @contact.fax.present?
|
xml.tag!('contact:status', s: status.value)
|
||||||
end
|
end
|
||||||
|
|
||||||
xml.tag!('contact:postalInfo', type: 'int') do
|
xml.tag!('contact:postalInfo', type: 'int') do
|
||||||
|
@ -20,15 +20,25 @@ xml.epp_head do
|
||||||
xml.tag!('contact:addr') do
|
xml.tag!('contact:addr') do
|
||||||
xml.tag!('contact:street', @contact.street)
|
xml.tag!('contact:street', @contact.street)
|
||||||
xml.tag!('contact:city', @contact.city)
|
xml.tag!('contact:city', @contact.city)
|
||||||
xml.tag!('contact:pc', @contact.zip)
|
|
||||||
xml.tag!('contact:sp', @contact.state)
|
xml.tag!('contact:sp', @contact.state)
|
||||||
|
xml.tag!('contact:pc', @contact.zip)
|
||||||
xml.tag!('contact:cc', @contact.country_code)
|
xml.tag!('contact:cc', @contact.country_code)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
if can? :view_full_info, @contact, @password
|
||||||
|
xml.tag!('contact:voice', @contact.phone)
|
||||||
|
xml.tag!('contact:fax', @contact.fax) if @contact.fax.present?
|
||||||
|
xml.tag!('contact:email', @contact.email)
|
||||||
|
end
|
||||||
|
|
||||||
xml.tag!('contact:clID', @contact.registrar.try(:name))
|
xml.tag!('contact:clID', @contact.registrar.try(:name))
|
||||||
xml.tag!('contact:crID', @contact.creator.try(:registrar))
|
if @contact.creator.try(:registrar).blank? && Rails.env.test?
|
||||||
|
xml.tag!('contact:crID', 'TEST-CREATOR')
|
||||||
|
else
|
||||||
|
xml.tag!('contact:crID', @contact.creator.try(:registrar))
|
||||||
|
end
|
||||||
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.try(:registrar))
|
xml.tag!('contact:upID', @contact.updator.try(:registrar))
|
||||||
|
@ -40,9 +50,6 @@ xml.epp_head do
|
||||||
xml.tag!('contact:pw', @contact.auth_info)
|
xml.tag!('contact:pw', @contact.auth_info)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
@contact.statuses.each do |status|
|
|
||||||
xml.tag!('contact:status', s: status.value)
|
|
||||||
end
|
|
||||||
# xml << render('/epp/contacts/disclosure_policy')
|
# xml << render('/epp/contacts/disclosure_policy')
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
|
@ -17,11 +17,11 @@
|
||||||
class: 'form-control', autocomplete: 'off', required: true
|
class: 'form-control', autocomplete: 'off', required: true
|
||||||
.form-group
|
.form-group
|
||||||
.col-md-3.control-label
|
.col-md-3.control-label
|
||||||
= label_tag 'legal_document', t(:legal_document), class: 'required'
|
= label_tag 'legal_document', t(:legal_document)
|
||||||
.col-md-7
|
.col-md-7
|
||||||
= file_field_tag 'legal_document', required: true
|
= file_field_tag 'legal_document'
|
||||||
.form-group
|
.form-group
|
||||||
.col-md-10.text-right
|
.col-md-10.text-right
|
||||||
%button.btn.btn-warning{ name: 'query' }= t(:query)
|
%button.btn.btn-warning{ name: 'query' }= t(:transfer)
|
||||||
%button.btn.btn-warning{ name: 'approve' }= t(:approve)
|
/%button.btn.btn-warning{ name: 'approve' }= t(:approve)
|
||||||
%button.btn.btn-warning{ name: 'reject' }= t(:reject)
|
/%button.btn.btn-warning{ name: 'reject' }= t(:reject)
|
||||||
|
|
|
@ -957,7 +957,7 @@ ActiveRecord::Schema.define(version: 20150525075550) do
|
||||||
t.text "crt"
|
t.text "crt"
|
||||||
t.string "type"
|
t.string "type"
|
||||||
t.string "registrant_ident"
|
t.string "registrant_ident"
|
||||||
t.string "encrypted_password", default: ""
|
t.string "encrypted_password", default: "", null: false
|
||||||
t.datetime "remember_created_at"
|
t.datetime "remember_created_at"
|
||||||
t.integer "failed_attempts", default: 0, null: false
|
t.integer "failed_attempts", default: 0, null: false
|
||||||
t.datetime "locked_at"
|
t.datetime "locked_at"
|
||||||
|
|
2139
doc/epp-examples.md
2139
doc/epp-examples.md
File diff suppressed because it is too large
Load diff
|
@ -12,6 +12,7 @@
|
||||||
-->
|
-->
|
||||||
<import namespace="urn:ietf:params:xml:ns:eppcom-1.0" schemaLocation="doc/schemas/eppcom-1.0.xsd"/>
|
<import namespace="urn:ietf:params:xml:ns:eppcom-1.0" schemaLocation="doc/schemas/eppcom-1.0.xsd"/>
|
||||||
<import namespace="urn:ietf:params:xml:ns:epp-1.0" schemaLocation="doc/schemas/epp-1.0.xsd"/>
|
<import namespace="urn:ietf:params:xml:ns:epp-1.0" schemaLocation="doc/schemas/epp-1.0.xsd"/>
|
||||||
|
<import namespace="urn:ietf:params:xml:ns:eis-1.0" schemaLocation="doc/schemas/eis-1.0.xsd"/>
|
||||||
|
|
||||||
<annotation>
|
<annotation>
|
||||||
<documentation>
|
<documentation>
|
||||||
|
@ -25,7 +26,7 @@
|
||||||
-->
|
-->
|
||||||
<element name="check" type="contact:mIDType"/>
|
<element name="check" type="contact:mIDType"/>
|
||||||
<element name="create" type="contact:createType"/>
|
<element name="create" type="contact:createType"/>
|
||||||
<element name="delete" type="contact:sIDType"/>
|
<element name="delete" type="contact:authIDType"/>
|
||||||
<element name="info" type="contact:authIDType"/>
|
<element name="info" type="contact:authIDType"/>
|
||||||
<element name="transfer" type="contact:authIDType"/>
|
<element name="transfer" type="contact:authIDType"/>
|
||||||
<element name="update" type="contact:updateType"/>
|
<element name="update" type="contact:updateType"/>
|
||||||
|
@ -94,7 +95,7 @@
|
||||||
-->
|
-->
|
||||||
<complexType name="createType">
|
<complexType name="createType">
|
||||||
<sequence>
|
<sequence>
|
||||||
<element name="id" type="eppcom:clIDType"/>
|
<element name="id" type="eppcom:clIDType" minOccurs="0"/>
|
||||||
<element name="postalInfo" type="contact:postalInfoType"
|
<element name="postalInfo" type="contact:postalInfoType"
|
||||||
maxOccurs="2"/>
|
maxOccurs="2"/>
|
||||||
<element name="voice" type="contact:e164Type"
|
<element name="voice" type="contact:e164Type"
|
||||||
|
@ -103,10 +104,9 @@
|
||||||
minOccurs="0"/>
|
minOccurs="0"/>
|
||||||
<element name="email" type="eppcom:minTokenType"/>
|
<element name="email" type="eppcom:minTokenType"/>
|
||||||
<element name="ident" type="contact:identType"
|
<element name="ident" type="contact:identType"
|
||||||
minOccurs="0"/>
|
minOccurs="0"/>
|
||||||
<element name="authInfo" type="contact:authInfoType"/>
|
<element name="authInfo" type="contact:authInfoType" minOccurs="0"/>
|
||||||
<element name="disclose" type="contact:discloseType"
|
|
||||||
minOccurs="0"/>
|
|
||||||
</sequence>
|
</sequence>
|
||||||
</complexType>
|
</complexType>
|
||||||
|
|
||||||
|
@ -117,8 +117,7 @@
|
||||||
minOccurs="0"/>
|
minOccurs="0"/>
|
||||||
<element name="addr" type="contact:addrType"/>
|
<element name="addr" type="contact:addrType"/>
|
||||||
</sequence>
|
</sequence>
|
||||||
<attribute name="type" type="contact:postalInfoEnumType"
|
<attribute name="type" type="contact:postalInfoEnumType"/>
|
||||||
use="required"/>
|
|
||||||
</complexType>
|
</complexType>
|
||||||
|
|
||||||
<simpleType name="postalInfoEnumType">
|
<simpleType name="postalInfoEnumType">
|
||||||
|
@ -148,21 +147,6 @@
|
||||||
</choice>
|
</choice>
|
||||||
</complexType>
|
</complexType>
|
||||||
|
|
||||||
<complexType name="discloseType">
|
|
||||||
<sequence>
|
|
||||||
<element name="name" type="contact:intLocType"
|
|
||||||
minOccurs="0" maxOccurs="2"/>
|
|
||||||
<element name="org" type="contact:intLocType"
|
|
||||||
minOccurs="0" maxOccurs="2"/>
|
|
||||||
<element name="addr" type="contact:intLocType"
|
|
||||||
minOccurs="0" maxOccurs="2"/>
|
|
||||||
<element name="voice" minOccurs="0"/>
|
|
||||||
<element name="fax" minOccurs="0"/>
|
|
||||||
<element name="email" minOccurs="0"/>
|
|
||||||
</sequence>
|
|
||||||
<attribute name="flag" type="boolean" use="required"/>
|
|
||||||
</complexType>
|
|
||||||
|
|
||||||
<complexType name="intLocType">
|
<complexType name="intLocType">
|
||||||
<attribute name="type" type="contact:postalInfoEnumType"
|
<attribute name="type" type="contact:postalInfoEnumType"
|
||||||
use="required"/>
|
use="required"/>
|
||||||
|
@ -240,8 +224,6 @@
|
||||||
minOccurs="0"/>
|
minOccurs="0"/>
|
||||||
<element name="authInfo" type="contact:authInfoType"
|
<element name="authInfo" type="contact:authInfoType"
|
||||||
minOccurs="0"/>
|
minOccurs="0"/>
|
||||||
<element name="disclose" type="contact:discloseType"
|
|
||||||
minOccurs="0"/>
|
|
||||||
</sequence>
|
</sequence>
|
||||||
</complexType>
|
</complexType>
|
||||||
|
|
||||||
|
@ -254,8 +236,7 @@
|
||||||
<element name="addr" type="contact:addrType"
|
<element name="addr" type="contact:addrType"
|
||||||
minOccurs="0"/>
|
minOccurs="0"/>
|
||||||
</sequence>
|
</sequence>
|
||||||
<attribute name="type" type="contact:postalInfoEnumType"
|
<attribute name="type" type="contact:postalInfoEnumType"/>
|
||||||
use="required"/>
|
|
||||||
</complexType>
|
</complexType>
|
||||||
|
|
||||||
<!--
|
<!--
|
||||||
|
@ -331,8 +312,6 @@
|
||||||
minOccurs="0"/>
|
minOccurs="0"/>
|
||||||
<element name="authInfo" type="contact:authInfoType"
|
<element name="authInfo" type="contact:authInfoType"
|
||||||
minOccurs="0"/>
|
minOccurs="0"/>
|
||||||
<element name="disclose" type="contact:discloseType"
|
|
||||||
minOccurs="0"/>
|
|
||||||
</sequence>
|
</sequence>
|
||||||
</complexType>
|
</complexType>
|
||||||
|
|
||||||
|
|
|
@ -26,8 +26,8 @@
|
||||||
<sequence>
|
<sequence>
|
||||||
<element name="legalDocument" type="eis:legalDocType"
|
<element name="legalDocument" type="eis:legalDocType"
|
||||||
minOccurs="0" maxOccurs="1"/>
|
minOccurs="0" maxOccurs="1"/>
|
||||||
<!-- <element name="ident" type="eis:identType"
|
<element name="ident" type="eis:identType"
|
||||||
minOccurs="0" maxOccurs="1"/> -->
|
minOccurs="0" maxOccurs="1"/>
|
||||||
</sequence>
|
</sequence>
|
||||||
</complexType>
|
</complexType>
|
||||||
|
|
||||||
|
@ -55,10 +55,11 @@
|
||||||
</restriction>
|
</restriction>
|
||||||
</simpleType>
|
</simpleType>
|
||||||
|
|
||||||
<!-- <complexType name="identType">
|
<complexType name="identType">
|
||||||
<simpleContent>
|
<simpleContent>
|
||||||
<extension base="normalizedString">
|
<extension base="normalizedString">
|
||||||
<attribute name="type" type="eis:identEnumType" use="required"/>
|
<attribute name="type" type="eis:identEnumType" use="required"/>
|
||||||
|
<attribute name="cc" type="eis:ccType" use="required"/>
|
||||||
</extension>
|
</extension>
|
||||||
</simpleContent>
|
</simpleContent>
|
||||||
</complexType>
|
</complexType>
|
||||||
|
@ -70,5 +71,12 @@
|
||||||
<enumeration value="birthday"/>
|
<enumeration value="birthday"/>
|
||||||
<enumeration value="passport"/>
|
<enumeration value="passport"/>
|
||||||
</restriction>
|
</restriction>
|
||||||
</simpleType> -->
|
</simpleType>
|
||||||
|
|
||||||
|
<simpleType name="ccType">
|
||||||
|
<restriction base="normalizedString">
|
||||||
|
<minLength value="2"/>
|
||||||
|
<maxLength value="2"/>
|
||||||
|
</restriction>
|
||||||
|
</simpleType>
|
||||||
</schema>
|
</schema>
|
||||||
|
|
|
@ -2,6 +2,7 @@ require 'rails_helper'
|
||||||
|
|
||||||
describe 'EPP Contact', epp: true do
|
describe 'EPP Contact', epp: true do
|
||||||
before :all do
|
before :all do
|
||||||
|
@xsd = Nokogiri::XML::Schema(File.read('doc/schemas/contact-1.0.xsd'))
|
||||||
@registrar1 = Fabricate(:registrar1)
|
@registrar1 = Fabricate(:registrar1)
|
||||||
@registrar2 = Fabricate(:registrar2)
|
@registrar2 = Fabricate(:registrar2)
|
||||||
@epp_xml = EppXml::Contact.new(cl_trid: 'ABC-12345')
|
@epp_xml = EppXml::Contact.new(cl_trid: 'ABC-12345')
|
||||||
|
@ -15,7 +16,7 @@ describe 'EPP Contact', epp: true do
|
||||||
|
|
||||||
@extension = {
|
@extension = {
|
||||||
legalDocument: {
|
legalDocument: {
|
||||||
value: 'JVBERi0xLjQKJcOkw7zDtsOfCjIgMCBvYmoKPDwvTGVuZ3RoIDMgMCBSL0Zp==',
|
value: 'dGVzdCBmYWlsCg==',
|
||||||
attrs: { type: 'pdf' }
|
attrs: { type: 'pdf' }
|
||||||
},
|
},
|
||||||
ident: {
|
ident: {
|
||||||
|
@ -27,12 +28,14 @@ describe 'EPP Contact', epp: true do
|
||||||
|
|
||||||
context 'with valid user' do
|
context 'with valid user' do
|
||||||
context 'create command' do
|
context 'create command' do
|
||||||
def create_request(overwrites = {}, extension = {})
|
def create_request(overwrites = {}, extension = {}, options = {})
|
||||||
extension = @extension if extension.blank?
|
extension = @extension if extension.blank?
|
||||||
|
|
||||||
defaults = {
|
defaults = {
|
||||||
|
id: nil,
|
||||||
postalInfo: {
|
postalInfo: {
|
||||||
name: { value: 'John Doe' },
|
name: { value: 'John Doe' },
|
||||||
|
org: nil,
|
||||||
addr: {
|
addr: {
|
||||||
street: { value: '123 Example' },
|
street: { value: '123 Example' },
|
||||||
city: { value: 'Tallinn' },
|
city: { value: 'Tallinn' },
|
||||||
|
@ -41,14 +44,15 @@ describe 'EPP Contact', epp: true do
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
voice: { value: '+372.1234567' },
|
voice: { value: '+372.1234567' },
|
||||||
|
fax: nil,
|
||||||
email: { value: 'test@example.example' }
|
email: { value: 'test@example.example' }
|
||||||
}
|
}
|
||||||
create_xml = @epp_xml.create(defaults.deep_merge(overwrites), extension)
|
create_xml = @epp_xml.create(defaults.deep_merge(overwrites), extension)
|
||||||
epp_plain_request(create_xml, :xml)
|
epp_plain_request(create_xml, options)
|
||||||
end
|
end
|
||||||
|
|
||||||
it 'fails if request xml is missing' do
|
it 'fails if request xml is missing' do
|
||||||
response = epp_plain_request(@epp_xml.create, :xml)
|
response = epp_plain_request(@epp_xml.create, validate_input: false)
|
||||||
response[:results][0][:msg].should ==
|
response[:results][0][:msg].should ==
|
||||||
'Required parameter missing: create > create > postalInfo > name [name]'
|
'Required parameter missing: create > create > postalInfo > name [name]'
|
||||||
response[:results][1][:msg].should ==
|
response[:results][1][:msg].should ==
|
||||||
|
@ -103,7 +107,7 @@ describe 'EPP Contact', epp: true do
|
||||||
it 'successfully saves ident type with legal document' do
|
it 'successfully saves ident type with legal document' do
|
||||||
extension = {
|
extension = {
|
||||||
legalDocument: {
|
legalDocument: {
|
||||||
value: 'JVBERi0xLjQKJcOkw7zDtsOfCjIgMCBvYmoKPDwvTGVuZ3RoIDMgMCBSL0Zp==',
|
value: 'dGVzdCBmYWlsCg==',
|
||||||
attrs: { type: 'pdf' }
|
attrs: { type: 'pdf' }
|
||||||
},
|
},
|
||||||
ident: {
|
ident: {
|
||||||
|
@ -173,8 +177,8 @@ describe 'EPP Contact', epp: true do
|
||||||
attrs: { type: 'birthday', cc: 'WRONG' }
|
attrs: { type: 'birthday', cc: 'WRONG' }
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
response = create_request({}, extension)
|
response = create_request({}, extension, validate_input: false)
|
||||||
response[:msg].should ==
|
response[:msg].should ==
|
||||||
'Ident country code is not valid, should be in ISO_3166-1 alpha 2 format [ident]'
|
'Ident country code is not valid, should be in ISO_3166-1 alpha 2 format [ident]'
|
||||||
response[:result_code].should == '2005'
|
response[:result_code].should == '2005'
|
||||||
end
|
end
|
||||||
|
@ -220,7 +224,7 @@ describe 'EPP Contact', epp: true do
|
||||||
end
|
end
|
||||||
|
|
||||||
it 'should generate server id when id is empty' do
|
it 'should generate server id when id is empty' do
|
||||||
response = create_request({ id: { value: '' } })
|
response = create_request({ id: nil })
|
||||||
|
|
||||||
response[:msg].should == 'Command completed successfully'
|
response[:msg].should == 'Command completed successfully'
|
||||||
response[:result_code].should == '1000'
|
response[:result_code].should == '1000'
|
||||||
|
@ -267,32 +271,27 @@ describe 'EPP Contact', epp: true do
|
||||||
)
|
)
|
||||||
end
|
end
|
||||||
|
|
||||||
def update_request(overwrites = {}, extension = {})
|
def update_request(overwrites = {}, extension = {}, options = {})
|
||||||
extension = @extension if extension.blank?
|
extension = @extension if extension.blank?
|
||||||
|
|
||||||
defaults = {
|
defaults = {
|
||||||
id: { value: 'asd123123er' },
|
id: { value: 'asd123123er' },
|
||||||
authInfo: { pw: { value: 'password' } },
|
|
||||||
chg: {
|
chg: {
|
||||||
postalInfo: {
|
postalInfo: {
|
||||||
name: { value: 'John Doe Edited' }
|
name: { value: 'John Doe Edited' }
|
||||||
},
|
},
|
||||||
voice: { value: '+372.7654321' },
|
voice: { value: '+372.7654321' },
|
||||||
|
fax: nil,
|
||||||
email: { value: 'edited@example.example' },
|
email: { value: 'edited@example.example' },
|
||||||
disclose: {
|
authInfo: { pw: { value: 'password' } }
|
||||||
value: {
|
|
||||||
voice: { value: '' },
|
|
||||||
email: { value: '' }
|
|
||||||
}, attrs: { flag: '0' }
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
update_xml = @epp_xml.update(defaults.deep_merge(overwrites), extension)
|
update_xml = @epp_xml.update(defaults.deep_merge(overwrites), extension)
|
||||||
epp_plain_request(update_xml, :xml)
|
epp_plain_request(update_xml, options)
|
||||||
end
|
end
|
||||||
|
|
||||||
it 'fails if request is invalid' do
|
it 'fails if request is invalid' do
|
||||||
response = epp_plain_request(@epp_xml.update, :xml)
|
response = epp_plain_request(@epp_xml.update, validate_input: false)
|
||||||
|
|
||||||
response[:results][0][:msg].should ==
|
response[:results][0][:msg].should ==
|
||||||
'Required parameter missing: add, rem or chg'
|
'Required parameter missing: add, rem or chg'
|
||||||
|
@ -381,10 +380,12 @@ describe 'EPP Contact', epp: true do
|
||||||
|
|
||||||
it 'should not update code with custom string' do
|
it 'should not update code with custom string' do
|
||||||
response = update_request(
|
response = update_request(
|
||||||
id: { value: 'FIRST0:SH8013' },
|
{
|
||||||
chg: {
|
id: { value: 'FIRST0:SH8013' },
|
||||||
id: { value: 'notpossibletoupdate' }
|
chg: {
|
||||||
}
|
id: { value: 'notpossibletoupdate' }
|
||||||
|
}
|
||||||
|
}, {}, { validate_input: false }
|
||||||
)
|
)
|
||||||
|
|
||||||
response[:msg].should == 'Object does not exist'
|
response[:msg].should == 'Object does not exist'
|
||||||
|
@ -396,7 +397,7 @@ describe 'EPP Contact', epp: true do
|
||||||
it 'should update ident' do
|
it 'should update ident' do
|
||||||
extension = {
|
extension = {
|
||||||
legalDocument: {
|
legalDocument: {
|
||||||
value: 'JVBERi0xLjQKJcOkw7zDtsOfCjIgMCBvYmoKPDwvTGVuZ3RoIDMgMCBSL0Zp==',
|
value: 'dGVzdCBmYWlsCg==',
|
||||||
attrs: { type: 'pdf' }
|
attrs: { type: 'pdf' }
|
||||||
},
|
},
|
||||||
ident: {
|
ident: {
|
||||||
|
@ -452,7 +453,7 @@ describe 'EPP Contact', epp: true do
|
||||||
}]
|
}]
|
||||||
})
|
})
|
||||||
|
|
||||||
response = epp_plain_request(xml, :xml)
|
response = epp_plain_request(xml, validate_input: false)
|
||||||
response[:results][0][:result_code].should == '2306'
|
response[:results][0][:result_code].should == '2306'
|
||||||
response[:results][0][:msg].should == "Parameter value policy error. Client-side object status "\
|
response[:results][0][:msg].should == "Parameter value policy error. Client-side object status "\
|
||||||
"management not supported: status [status]"
|
"management not supported: status [status]"
|
||||||
|
@ -463,9 +464,9 @@ describe 'EPP Contact', epp: true do
|
||||||
it 'should add value voice value' do
|
it 'should add value voice value' do
|
||||||
xml = @epp_xml.update({
|
xml = @epp_xml.update({
|
||||||
id: { value: 'FIRST0:SH8013' },
|
id: { value: 'FIRST0:SH8013' },
|
||||||
authInfo: { pw: { value: 'password' } },
|
chg: {
|
||||||
add: {
|
voice: { value: '+372.11111111' },
|
||||||
voice: { value: '+372.11111111' }
|
authInfo: { pw: { value: 'password' } }
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
|
|
||||||
|
@ -480,51 +481,52 @@ describe 'EPP Contact', epp: true do
|
||||||
end
|
end
|
||||||
|
|
||||||
it 'should return error when add attributes phone value is empty' do
|
it 'should return error when add attributes phone value is empty' do
|
||||||
|
phone = Contact.find_by(code: 'FIRST0:SH8013').phone
|
||||||
xml = @epp_xml.update({
|
xml = @epp_xml.update({
|
||||||
id: { value: 'FIRST0:SH8013' },
|
id: { value: 'FIRST0:SH8013' },
|
||||||
authInfo: { pw: { value: 'password' } },
|
|
||||||
add: {
|
|
||||||
voice: { value: '' }
|
|
||||||
},
|
|
||||||
chg: {
|
chg: {
|
||||||
postalInfo: { email: { value: 'example@example.ee' } }
|
voice: { value: '' },
|
||||||
|
email: { value: 'example@example.ee' },
|
||||||
|
authInfo: { pw: { value: 'password' } }
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
|
|
||||||
response = epp_plain_request(xml, :xml)
|
response = epp_plain_request(xml, :xml)
|
||||||
response[:results][0][:msg].should == 'Required parameter missing - phone [phone]'
|
response[:results][0][:msg].should == 'Required parameter missing - phone [phone]'
|
||||||
response[:results][0][:result_code].should == '2003'
|
response[:results][0][:result_code].should == '2003'
|
||||||
Contact.find_by(code: 'FIRST0:SH8013').phone.should == '+372.7654321' # aka not changed
|
Contact.find_by(code: 'FIRST0:SH8013').phone.should == phone # aka not changed
|
||||||
end
|
end
|
||||||
|
|
||||||
it 'should honor chg value over add value when both changes same attribute' do
|
it 'should honor chg value over add value when both changes same attribute' do
|
||||||
xml = @epp_xml.update({
|
xml = @epp_xml.update({
|
||||||
id: { value: 'FIRST0:SH8013' },
|
id: { value: 'FIRST0:SH8013' },
|
||||||
authInfo: { pw: { value: 'password' } },
|
|
||||||
chg: {
|
|
||||||
voice: { value: '+372.2222222222222' }
|
|
||||||
},
|
|
||||||
add: {
|
add: {
|
||||||
voice: { value: '+372.11111111111' }
|
voice: { value: '+372.11111111111' }
|
||||||
|
},
|
||||||
|
chg: {
|
||||||
|
voice: { value: '+372.222222222222' },
|
||||||
|
authInfo: { pw: { value: 'password' } }
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
|
|
||||||
response = epp_plain_request(xml, :xml)
|
response = epp_plain_request(xml, validate_input: false)
|
||||||
response[:results][0][:msg].should == 'Command completed successfully'
|
response[:results][0][:msg].should == 'Command completed successfully'
|
||||||
response[:results][0][:result_code].should == '1000'
|
response[:results][0][:result_code].should == '1000'
|
||||||
|
|
||||||
contact = Contact.find_by(code: 'FIRST0:SH8013')
|
contact = Contact.find_by(code: 'FIRST0:SH8013')
|
||||||
contact.phone.should == '+372.2222222222222'
|
contact.phone.should == '+372.222222222222'
|
||||||
|
|
||||||
contact.update_attribute(:phone, '+372.7654321') # restore default value
|
contact.update_attribute(:phone, '+372.7654321') # restore default value
|
||||||
end
|
end
|
||||||
|
|
||||||
it 'should not allow to remove required voice attribute' do
|
it 'should not allow to remove required voice attribute' do
|
||||||
|
contact = Contact.find_by(code: 'FIRST0:SH8013')
|
||||||
|
phone = contact.phone
|
||||||
xml = @epp_xml.update({
|
xml = @epp_xml.update({
|
||||||
id: { value: 'FIRST0:SH8013' },
|
id: { value: 'FIRST0:SH8013' },
|
||||||
authInfo: { pw: { value: 'password' } },
|
chg: {
|
||||||
rem: {
|
voice: { value: '' },
|
||||||
voice: { value: '+372.7654321' }
|
authInfo: { pw: { value: 'password' } }
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
|
|
||||||
|
@ -533,10 +535,13 @@ describe 'EPP Contact', epp: true do
|
||||||
response[:results][0][:result_code].should == '2003'
|
response[:results][0][:result_code].should == '2003'
|
||||||
|
|
||||||
contact = Contact.find_by(code: 'FIRST0:SH8013')
|
contact = Contact.find_by(code: 'FIRST0:SH8013')
|
||||||
contact.phone.should == '+372.7654321'
|
contact.phone.should == phone
|
||||||
end
|
end
|
||||||
|
|
||||||
|
# TODO: Update request rem block must be analyzed
|
||||||
it 'should not allow to remove required attribute' do
|
it 'should not allow to remove required attribute' do
|
||||||
|
contact = Contact.find_by(code: 'FIRST0:SH8013')
|
||||||
|
phone = contact.phone
|
||||||
xml = @epp_xml.update({
|
xml = @epp_xml.update({
|
||||||
id: { value: 'FIRST0:SH8013' },
|
id: { value: 'FIRST0:SH8013' },
|
||||||
authInfo: { pw: { value: 'password' } },
|
authInfo: { pw: { value: 'password' } },
|
||||||
|
@ -545,12 +550,12 @@ describe 'EPP Contact', epp: true do
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
|
|
||||||
response = epp_plain_request(xml, :xml)
|
response = epp_plain_request(xml, validate_input: false)
|
||||||
response[:results][0][:msg].should == 'Required parameter missing - phone [phone]'
|
response[:results][0][:msg].should == 'Required parameter missing - phone [phone]'
|
||||||
response[:results][0][:result_code].should == '2003'
|
response[:results][0][:result_code].should == '2003'
|
||||||
|
|
||||||
contact = Contact.find_by(code: 'FIRST0:SH8013')
|
contact = Contact.find_by(code: 'FIRST0:SH8013')
|
||||||
contact.phone.should == '+372.7654321'
|
contact.phone.should == phone
|
||||||
end
|
end
|
||||||
|
|
||||||
it 'should honor add over rem' do
|
it 'should honor add over rem' do
|
||||||
|
@ -565,7 +570,7 @@ describe 'EPP Contact', epp: true do
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
|
|
||||||
response = epp_plain_request(xml, :xml)
|
response = epp_plain_request(xml, validate_input: false)
|
||||||
response[:results][0][:msg].should == 'Command completed successfully'
|
response[:results][0][:msg].should == 'Command completed successfully'
|
||||||
response[:results][0][:result_code].should == '1000'
|
response[:results][0][:result_code].should == '1000'
|
||||||
|
|
||||||
|
@ -587,7 +592,7 @@ describe 'EPP Contact', epp: true do
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
|
|
||||||
response = epp_plain_request(xml, :xml)
|
response = epp_plain_request(xml, validate_input: false)
|
||||||
response[:results][0][:msg].should == 'Command completed successfully'
|
response[:results][0][:msg].should == 'Command completed successfully'
|
||||||
response[:results][0][:result_code].should == '1000'
|
response[:results][0][:result_code].should == '1000'
|
||||||
|
|
||||||
|
@ -612,7 +617,7 @@ describe 'EPP Contact', epp: true do
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
|
|
||||||
response = epp_plain_request(xml, :xml)
|
response = epp_plain_request(xml, validate_input: false)
|
||||||
response[:results][0][:msg].should == 'Command completed successfully'
|
response[:results][0][:msg].should == 'Command completed successfully'
|
||||||
response[:results][0][:result_code].should == '1000'
|
response[:results][0][:result_code].should == '1000'
|
||||||
|
|
||||||
|
@ -631,7 +636,7 @@ describe 'EPP Contact', epp: true do
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
|
|
||||||
response = epp_plain_request(xml, :xml)
|
response = epp_plain_request(xml, validate_input: false)
|
||||||
response[:results][0][:msg].should == 'Command completed successfully'
|
response[:results][0][:msg].should == 'Command completed successfully'
|
||||||
response[:results][0][:result_code].should == '1000'
|
response[:results][0][:result_code].should == '1000'
|
||||||
|
|
||||||
|
@ -648,7 +653,7 @@ describe 'EPP Contact', epp: true do
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
|
|
||||||
response = epp_plain_request(xml, :xml)
|
response = epp_plain_request(xml, validate_input: false)
|
||||||
response[:results][0][:msg].should ==
|
response[:results][0][:msg].should ==
|
||||||
'Parameter value policy error. Org must be blank: postalInfo > org [org]'
|
'Parameter value policy error. Org must be blank: postalInfo > org [org]'
|
||||||
response[:results][0][:result_code].should == '2306'
|
response[:results][0][:result_code].should == '2306'
|
||||||
|
@ -665,7 +670,7 @@ describe 'EPP Contact', epp: true do
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
|
|
||||||
response = epp_plain_request(xml, :xml)
|
response = epp_plain_request(xml, validate_input: false)
|
||||||
response[:results][0][:msg].should == "Required parameter missing - name [name]"
|
response[:results][0][:msg].should == "Required parameter missing - name [name]"
|
||||||
response[:results][0][:result_code].should == '2003'
|
response[:results][0][:result_code].should == '2003'
|
||||||
end
|
end
|
||||||
|
@ -686,7 +691,7 @@ describe 'EPP Contact', epp: true do
|
||||||
end
|
end
|
||||||
|
|
||||||
it 'fails if request is invalid' do
|
it 'fails if request is invalid' do
|
||||||
response = epp_plain_request(@epp_xml.delete, :xml)
|
response = epp_plain_request(@epp_xml.delete, validate_input: false)
|
||||||
|
|
||||||
response[:results][0][:msg].should ==
|
response[:results][0][:msg].should ==
|
||||||
'Required parameter missing: delete > delete > id [id]'
|
'Required parameter missing: delete > delete > id [id]'
|
||||||
|
@ -763,7 +768,7 @@ describe 'EPP Contact', epp: true do
|
||||||
|
|
||||||
it 'should not delete when not owner with wrong password' do
|
it 'should not delete when not owner with wrong password' do
|
||||||
login_as :registrar2 do
|
login_as :registrar2 do
|
||||||
response = delete_request({ authInfo: { value: 'wrong password' } })
|
response = delete_request({ authInfo: { pw: { value: 'wrong password' } } })
|
||||||
response[:msg].should == 'Authorization error'
|
response[:msg].should == 'Authorization error'
|
||||||
response[:result_code].should == '2201'
|
response[:result_code].should == '2201'
|
||||||
response[:results].count.should == 1
|
response[:results].count.should == 1
|
||||||
|
@ -782,7 +787,7 @@ describe 'EPP Contact', epp: true do
|
||||||
end
|
end
|
||||||
|
|
||||||
it 'fails if request is invalid' do
|
it 'fails if request is invalid' do
|
||||||
response = epp_plain_request(@epp_xml.check, :xml)
|
response = epp_plain_request(@epp_xml.check, validate_input: false)
|
||||||
|
|
||||||
response[:results][0][:msg].should == 'Required parameter missing: check > check > id [id]'
|
response[:results][0][:msg].should == 'Required parameter missing: check > check > id [id]'
|
||||||
response[:results][0][:result_code].should == '2003'
|
response[:results][0][:result_code].should == '2003'
|
||||||
|
@ -826,17 +831,18 @@ describe 'EPP Contact', epp: true do
|
||||||
end
|
end
|
||||||
|
|
||||||
context 'info command' do
|
context 'info command' do
|
||||||
def info_request(overwrites = {})
|
def info_request(overwrites = {}, options = {})
|
||||||
defaults = {
|
defaults = {
|
||||||
id: { value: @contact.code },
|
id: { value: @contact.code },
|
||||||
authInfo: { pw: { value: @contact.auth_info } }
|
authInfo: { pw: { value: @contact.auth_info } }
|
||||||
}
|
}
|
||||||
|
|
||||||
xml = @epp_xml.info(defaults.deep_merge(overwrites))
|
xml = @epp_xml.info(defaults.deep_merge(overwrites))
|
||||||
epp_plain_request(xml, :xml)
|
epp_plain_request(xml, options)
|
||||||
end
|
end
|
||||||
|
|
||||||
it 'fails if request invalid' do
|
it 'fails if request invalid' do
|
||||||
response = epp_plain_request(@epp_xml.info, :xml)
|
response = epp_plain_request(@epp_xml.info, validate_input: false)
|
||||||
response[:results][0][:msg].should ==
|
response[:results][0][:msg].should ==
|
||||||
'Required parameter missing: info > info > id [id]'
|
'Required parameter missing: info > info > id [id]'
|
||||||
response[:results][0][:result_code].should == '2003'
|
response[:results][0][:result_code].should == '2003'
|
||||||
|
@ -942,7 +948,7 @@ describe 'EPP Contact', epp: true do
|
||||||
|
|
||||||
it 'returns no authorization error for wrong user and no password' do
|
it 'returns no authorization error for wrong user and no password' do
|
||||||
login_as :registrar2 do
|
login_as :registrar2 do
|
||||||
response = info_request({ authInfo: { pw: { value: '' } } })
|
response = info_request({ authInfo: { pw: { value: '' } } }, validate_output: false)
|
||||||
response[:msg].should == 'Command completed successfully'
|
response[:msg].should == 'Command completed successfully'
|
||||||
response[:result_code].should == '1000'
|
response[:result_code].should == '1000'
|
||||||
response[:results].count.should == 1
|
response[:results].count.should == 1
|
||||||
|
|
|
@ -1424,29 +1424,31 @@ describe 'EPP Domain', epp: true do
|
||||||
it 'should not return action pending when changes are invalid' do
|
it 'should not return action pending when changes are invalid' do
|
||||||
existing_pw = domain.auth_info
|
existing_pw = domain.auth_info
|
||||||
|
|
||||||
|
hostnames = domain.nameservers.pluck(:hostname)
|
||||||
|
|
||||||
xml_params = {
|
xml_params = {
|
||||||
name: { value: domain.name },
|
name: { value: domain.name },
|
||||||
chg: [
|
rem: [
|
||||||
registrant: { value: 'FIXED:CITIZEN_1234' }
|
{
|
||||||
],
|
ns:
|
||||||
rem:
|
hostnames.map do |x|
|
||||||
domain.nameservers.map do |ns|
|
|
||||||
{
|
|
||||||
ns: [
|
|
||||||
{
|
{
|
||||||
hostAttr: [
|
hostAttr: [
|
||||||
{ hostName: { value: ns.hostname } }
|
{ hostName: { value: x } }
|
||||||
]
|
]
|
||||||
}
|
}
|
||||||
]
|
end
|
||||||
}
|
}
|
||||||
end
|
],
|
||||||
|
chg: [
|
||||||
|
registrant: { value: 'FIXED:CITIZEN_1234' }
|
||||||
|
]
|
||||||
}
|
}
|
||||||
|
|
||||||
response = epp_plain_request(domain_update_xml(xml_params, {}, {
|
response = epp_plain_request(domain_update_xml(xml_params, {}, {
|
||||||
_anonymus: [
|
_anonymus: [
|
||||||
legalDocument: {
|
legalDocument: {
|
||||||
value: 'JVBERi0xLjQKJcOkw7zDtsOfCjIgMCBvYmoKPDwvTGVuZ3RoIDMgMCBSL0Zp==',
|
value: 'dGVzdCBmYWlsCg==',
|
||||||
attrs: { type: 'pdf' }
|
attrs: { type: 'pdf' }
|
||||||
}
|
}
|
||||||
]
|
]
|
||||||
|
@ -1481,7 +1483,7 @@ describe 'EPP Domain', epp: true do
|
||||||
response = epp_plain_request(domain_update_xml(xml_params, {}, {
|
response = epp_plain_request(domain_update_xml(xml_params, {}, {
|
||||||
_anonymus: [
|
_anonymus: [
|
||||||
legalDocument: {
|
legalDocument: {
|
||||||
value: 'JVBERi0xLjQKJcOkw7zDtsOfCjIgMCBvYmoKPDwvTGVuZ3RoIDMgMCBSL0Zp==',
|
value: 'dGVzdCBmYWlsCg==',
|
||||||
attrs: { type: 'pdf' }
|
attrs: { type: 'pdf' }
|
||||||
}
|
}
|
||||||
]
|
]
|
||||||
|
|
|
@ -12,6 +12,7 @@ describe 'EPP Poll', epp: true do
|
||||||
end
|
end
|
||||||
|
|
||||||
before(:all) do
|
before(:all) do
|
||||||
|
@xsd = Nokogiri::XML::Schema(File.read('doc/schemas/epp-1.0.xsd'))
|
||||||
Fabricate(:api_user, username: 'registrar1', registrar: registrar1)
|
Fabricate(:api_user, username: 'registrar1', registrar: registrar1)
|
||||||
Fabricate(:api_user, username: 'registrar2', registrar: registrar2)
|
Fabricate(:api_user, username: 'registrar2', registrar: registrar2)
|
||||||
|
|
||||||
|
@ -85,7 +86,7 @@ describe 'EPP Poll', epp: true do
|
||||||
value: '', attrs: { op: 'bla' }
|
value: '', attrs: { op: 'bla' }
|
||||||
})
|
})
|
||||||
|
|
||||||
response = epp_plain_request(xml, :xml)
|
response = epp_plain_request(xml, validate_input: false)
|
||||||
response[:msg].should == 'Attribute is invalid: op'
|
response[:msg].should == 'Attribute is invalid: op'
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue