diff --git a/app/controllers/epp/domains_controller.rb b/app/controllers/epp/domains_controller.rb index c7713e3e6..b2a20e2a2 100644 --- a/app/controllers/epp/domains_controller.rb +++ b/app/controllers/epp/domains_controller.rb @@ -196,6 +196,15 @@ class Epp::DomainsController < EppController end def validate_transfer + # period element is disabled for now + if params[:parsed_frame].css('period').any? + epp_errors << { + code: '2307', + msg: I18n.t(:unimplemented_object_service), + value: { obj: 'period' } + } + end + requires 'transfer > transfer' @prefix = 'transfer > transfer >' diff --git a/spec/epp/domain_spec.rb b/spec/epp/domain_spec.rb index 81ba7e08a..2ae9b6908 100644 --- a/spec/epp/domain_spec.rb +++ b/spec/epp/domain_spec.rb @@ -474,7 +474,9 @@ describe 'EPP Domain', epp: true do }) response = epp_plain_request(xml) - response[:results][0][:msg].should == "Element '{https://epp.tld.ee/schema/domain-eis-1.0.xsd}period', attribute 'unit': [facet 'enumeration'] The value '' is not an element of the set {'y', 'm', 'd'}." + response[:results][0][:msg].should == + "Element '{https://epp.tld.ee/schema/domain-eis-1.0.xsd}period', attribute 'unit': "\ + "[facet 'enumeration'] The value '' is not an element of the set {'y', 'm', 'd'}." response[:results][0][:result_code].should == '2001' xml = domain_create_xml({ @@ -482,7 +484,9 @@ describe 'EPP Domain', epp: true do }) response = epp_plain_request(xml) - response[:results][0][:msg].should == "Element '{https://epp.tld.ee/schema/domain-eis-1.0.xsd}period', attribute 'unit': [facet 'enumeration'] The value 'bla' is not an element of the set {'y', 'm', 'd'}." + response[:results][0][:msg].should == + "Element '{https://epp.tld.ee/schema/domain-eis-1.0.xsd}period', attribute 'unit': "\ + "[facet 'enumeration'] The value 'bla' is not an element of the set {'y', 'm', 'd'}." response[:results][0][:result_code].should == '2001' end @@ -572,8 +576,12 @@ describe 'EPP Domain', epp: true do response = epp_plain_request(xml) - response[:results][0][:msg].should == "Element '{urn:ietf:params:xml:ns:secDNS-1.1}pubKey': [facet 'minLength'] The value has a length of '0'; this underruns the allowed minimum length of '1'." - response[:results][1][:msg].should == "Element '{urn:ietf:params:xml:ns:secDNS-1.1}pubKey': '' is not a valid value of the atomic type '{urn:ietf:params:xml:ns:secDNS-1.1}keyType'." + response[:results][0][:msg].should == + "Element '{urn:ietf:params:xml:ns:secDNS-1.1}pubKey': [facet 'minLength'] The value has a "\ + "length of '0'; this underruns the allowed minimum length of '1'." + response[:results][1][:msg].should == + "Element '{urn:ietf:params:xml:ns:secDNS-1.1}pubKey': '' is not a valid value of the atomic "\ + "type '{urn:ietf:params:xml:ns:secDNS-1.1}keyType'." xml = domain_create_xml({}, { _anonymus: [ @@ -836,7 +844,8 @@ describe 'EPP Domain', epp: true do }) response = epp_plain_request(xml) - response[:msg].should == "Element '{urn:ietf:params:xml:ns:secDNS-1.1}keyData': This element is not expected. Expected is ( {urn:ietf:params:xml:ns:secDNS-1.1}dsData )." + response[:msg].should == "Element '{urn:ietf:params:xml:ns:secDNS-1.1}keyData': This element "\ + "is not expected. Expected is ( {urn:ietf:params:xml:ns:secDNS-1.1}dsData )." response[:result_code].should == '2001' end end @@ -1505,7 +1514,9 @@ describe 'EPP Domain', epp: true do it 'returns an error for incorrect op attribute' do response = epp_plain_request(domain_transfer_xml({}, 'bla')) - response[:msg].should == "Element '{urn:ietf:params:xml:ns:epp-1.0}transfer', attribute 'op': [facet 'enumeration'] The value 'bla' is not an element of the set {'approve', 'cancel', 'query', 'reject', 'request'}." + response[:msg].should == + "Element '{urn:ietf:params:xml:ns:epp-1.0}transfer', attribute 'op': [facet 'enumeration'] "\ + "The value 'bla' is not an element of the set {'approve', 'cancel', 'query', 'reject', 'request'}." response[:result_code].should == '2001' end @@ -1658,6 +1669,22 @@ describe 'EPP Domain', epp: true do Setting.transfer_wait_time = 0 end + it 'should not transfer when period element is present' do + pw = domain.auth_info + xml = domain_transfer_xml({ + name: { value: domain.name }, + period: { value: '1', attrs: { unit: 'y' } }, + authInfo: { pw: { value: pw } } + }) + + login_as :registrar2 do + response = epp_plain_request(xml) + response[:msg].should == 'Unimplemented object service' + response[:result_code].should == '2307' + response[:parsed].css('value > period').any?.should == true + end + end + ### UPDATE ### it 'should update right away without update pending status' do existing_pw = domain.auth_info @@ -2243,7 +2270,14 @@ describe 'EPP Domain', epp: true do }) response = epp_plain_request(xml) - response[:results][0][:msg].should == "Element '{https://epp.tld.ee/schema/domain-eis-1.0.xsd}status', attribute 's': [facet 'enumeration'] The value 'invalidStatus' is not an element of the set {'clientDeleteProhibited', 'clientHold', 'clientRenewProhibited', 'clientTransferProhibited', 'clientUpdateProhibited', 'inactive', 'ok', 'pendingCreate', 'pendingDelete', 'pendingRenew', 'pendingTransfer', 'pendingUpdate', 'serverDeleteProhibited', 'serverHold', 'serverRenewProhibited', 'serverTransferProhibited', 'serverUpdateProhibited'}." + response[:results][0][:msg].should == + "Element '{https://epp.tld.ee/schema/domain-eis-1.0.xsd}status', attribute 's': "\ + "[facet 'enumeration'] The value 'invalidStatus' is not an element of the set "\ + "{'clientDeleteProhibited', 'clientHold', 'clientRenewProhibited', "\ + "'clientTransferProhibited', 'clientUpdateProhibited', 'inactive', "\ + "'ok', 'pendingCreate', 'pendingDelete', 'pendingRenew', 'pendingTransfer', "\ + "'pendingUpdate', 'serverDeleteProhibited', 'serverHold', 'serverRenewProhibited', "\ + "'serverTransferProhibited', 'serverUpdateProhibited'}." response[:results][0][:result_code].should == '2001' end @@ -2356,7 +2390,8 @@ describe 'EPP Domain', epp: true do ) response = epp_plain_request(xml) - response[:results][0][:msg].should == "Element '{https://epp.tld.ee/schema/domain-eis-1.0.xsd}period', attribute 'unit': [facet 'enumeration'] The value '' is not an element of the set {'y', 'm', 'd'}." + response[:results][0][:msg].should == "Element '{https://epp.tld.ee/schema/domain-eis-1.0.xsd}period', "\ + "attribute 'unit': [facet 'enumeration'] The value '' is not an element of the set {'y', 'm', 'd'}." response[:results][0][:result_code].should == '2001' xml = @epp_xml.domain.renew( @@ -2366,7 +2401,8 @@ describe 'EPP Domain', epp: true do ) response = epp_plain_request(xml) - response[:results][0][:msg].should == "Element '{https://epp.tld.ee/schema/domain-eis-1.0.xsd}period', attribute 'unit': [facet 'enumeration'] The value 'bla' is not an element of the set {'y', 'm', 'd'}." + response[:results][0][:msg].should == "Element '{https://epp.tld.ee/schema/domain-eis-1.0.xsd}period', "\ + "attribute 'unit': [facet 'enumeration'] The value 'bla' is not an element of the set {'y', 'm', 'd'}." response[:results][0][:result_code].should == '2001' Setting.days_to_renew_domain_before_expire = 90 diff --git a/spec/epp/poll_spec.rb b/spec/epp/poll_spec.rb index b26121aca..99e91103c 100644 --- a/spec/epp/poll_spec.rb +++ b/spec/epp/poll_spec.rb @@ -87,7 +87,8 @@ describe 'EPP Poll', epp: true do }) response = epp_plain_request(xml, validate_input: false) - response[:msg].should == "Element '{urn:ietf:params:xml:ns:epp-1.0}poll', attribute 'op': [facet 'enumeration'] The value 'bla' is not an element of the set {'ack', 'req'}." + response[:msg].should == "Element '{urn:ietf:params:xml:ns:epp-1.0}poll', attribute 'op': "\ + "[facet 'enumeration'] The value 'bla' is not an element of the set {'ack', 'req'}." response[:result_code].should == '2001' end diff --git a/spec/epp/session_spec.rb b/spec/epp/session_spec.rb index 44d59e25b..56910c1a3 100644 --- a/spec/epp/session_spec.rb +++ b/spec/epp/session_spec.rb @@ -142,7 +142,9 @@ describe 'EPP Session', epp: true do newPW: { value: '' } ), validate_input: false) - response[:msg].should == "Element '{urn:ietf:params:xml:ns:epp-1.0}newPW': [facet 'minLength'] The value has a length of '0'; this underruns the allowed minimum length of '6'." + response[:msg].should == + "Element '{urn:ietf:params:xml:ns:epp-1.0}newPW': [facet 'minLength'] The value has a "\ + "length of '0'; this underruns the allowed minimum length of '6'." response[:result_code].should == '2001' @api_user.reload diff --git a/spec/support/epp.rb b/spec/support/epp.rb index 8ec87c576..db6b522c5 100644 --- a/spec/support/epp.rb +++ b/spec/support/epp.rb @@ -352,6 +352,7 @@ module Epp def domain_transfer_xml(xml_params = {}, op = 'request', custom_params = {}) defaults = { name: { value: next_domain_name }, + period: nil, authInfo: { pw: { value: '98oiewslkfkd', attrs: { roid: 'citizen_1234-REP' } } }