mirror of
https://github.com/internetee/registry.git
synced 2025-05-16 17:37:17 +02:00
Fix contact create in registrar #2752
This commit is contained in:
parent
4c52e3b0b4
commit
e463fe4d70
3 changed files with 29 additions and 28 deletions
|
@ -4,7 +4,7 @@ module Depp
|
|||
include DisableHtml5Validation
|
||||
|
||||
attr_accessor :id, :name, :email, :phone, :org_name,
|
||||
:ident, :ident_type, :ident_country_code,
|
||||
:ident, :ident_type, :ident_country_code,
|
||||
:street, :city, :zip, :state, :country_code,
|
||||
:password, :legal_document, :statuses, :code
|
||||
|
||||
|
@ -68,7 +68,7 @@ module Depp
|
|||
zip: res.css('postalInfo addr pc').text,
|
||||
state: res.css('postalInfo addr sp').text,
|
||||
country_code: res.css('postalInfo addr cc').text,
|
||||
|
||||
|
||||
# authInfo
|
||||
password: res.css('authInfo pw').text,
|
||||
|
||||
|
@ -145,25 +145,26 @@ module Depp
|
|||
end
|
||||
|
||||
def save
|
||||
create_xml = Depp::Contact.epp_xml.create(
|
||||
{
|
||||
id: { value: code },
|
||||
email: { value: email },
|
||||
voice: { value: phone },
|
||||
postalInfo: {
|
||||
name: { value: name },
|
||||
org: { value: org_name },
|
||||
addr: {
|
||||
street: { value: street },
|
||||
city: { value: city },
|
||||
pc: { value: zip },
|
||||
sp: { value: state },
|
||||
cc: { value: country_code }
|
||||
}
|
||||
hash = {
|
||||
id: { value: code },
|
||||
postalInfo: {
|
||||
name: { value: name },
|
||||
org: { value: org_name },
|
||||
addr: {
|
||||
street: { value: street },
|
||||
city: { value: city },
|
||||
sp: { value: state },
|
||||
pc: { value: zip },
|
||||
cc: { value: country_code }
|
||||
}
|
||||
},
|
||||
extension_xml
|
||||
)
|
||||
},
|
||||
voice: { value: phone },
|
||||
email: { value: email }
|
||||
}
|
||||
|
||||
hash[:id] = nil if code.blank?
|
||||
create_xml = Depp::Contact.epp_xml.create(hash, extension_xml)
|
||||
|
||||
data = Depp::Contact.user.request(create_xml)
|
||||
self.id = data.css('id').text
|
||||
handle_errors(data)
|
||||
|
@ -250,7 +251,7 @@ module Depp
|
|||
return {} if legal_document.blank?
|
||||
|
||||
type = legal_document.original_filename.split('.').last.downcase
|
||||
{
|
||||
{
|
||||
_anonymus: [
|
||||
legalDocument: { value: Base64.encode64(legal_document.read), attrs: { type: type } }
|
||||
]
|
||||
|
@ -274,7 +275,7 @@ module Depp
|
|||
ident_type == 'priv'
|
||||
end
|
||||
|
||||
def persisted?
|
||||
def persisted?
|
||||
id.present?
|
||||
end
|
||||
|
||||
|
@ -282,13 +283,13 @@ module Depp
|
|||
data.css('result').each do |x|
|
||||
success_codes = %(1000, 1300, 1301)
|
||||
next if success_codes.include?(x['code'])
|
||||
|
||||
|
||||
message = "#{x.css('msg').text} #{x.css('value').text}"
|
||||
attr = message.split('[').last.strip.sub(']', '') if message.include?('[')
|
||||
attr = :base if attr.nil?
|
||||
attr = 'phone' if attr == 'voice'
|
||||
attr = 'zip' if attr == 'pc'
|
||||
errors.add(attr, message)
|
||||
errors.add(attr, message)
|
||||
end
|
||||
errors.blank?
|
||||
end
|
||||
|
|
|
@ -87,8 +87,8 @@ describe 'EPP Poll', epp: true do
|
|||
})
|
||||
|
||||
response = epp_plain_request(xml, validate_input: false)
|
||||
response[:msg].should == 'Parameter value range error: op'
|
||||
response[:result_code].should == '2004'
|
||||
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
|
||||
|
||||
it 'dequeues multiple messages' do
|
||||
|
|
|
@ -142,8 +142,8 @@ describe 'EPP Session', epp: true do
|
|||
newPW: { value: '' }
|
||||
), validate_input: false)
|
||||
|
||||
response[:msg].should == 'Password is missing [password]'
|
||||
response[:result_code].should == '2306'
|
||||
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
|
||||
@api_user.password.should == 'ghyt9e4fu'
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue