Updated contact ident_type logic

This commit is contained in:
Andres Keskküla 2014-08-15 12:07:38 +03:00
parent 5fa1107e3e
commit 0a4a7f98c2
4 changed files with 7 additions and 2 deletions

View file

@ -112,6 +112,7 @@ module Epp::ContactsHelper
contact_hash[:address_attributes] =
Address.extract_attributes(( @ph.try(:[], :postalInfo).try(:[], :addr) || [] ), type)
end
contact_hash[:ident_type] = ident_type unless ident_type.nil?
contact_hash
end

View file

@ -31,6 +31,8 @@ describe 'EPP Contact', epp: true do
expect(Contact.count).to eq(1)
expect(Contact.first.org_name).to eq('Example Inc.')
expect(Contact.first.ident).to eq '37605030299'
expect(Contact.first.ident_type).to eq 'op'
expect(Contact.first.address.street).to eq('123 Example Dr.')
expect(Contact.first.address.street2).to eq('Suite 100')
@ -94,6 +96,8 @@ describe 'EPP Contact', epp: true do
expect(response[:msg]).to eq('Command completed successfully')
expect(Contact.first.name).to eq('John Doe')
expect(Contact.first.email).to eq('jdoe@example.com')
expect(Contact.first.ident).to eq('J836954')
expect(Contact.first.ident_type).to eq('passport')
end
it 'returns phone and email error' do

View file

@ -20,7 +20,7 @@
<contact:voice x="1234">+123.7035555555</contact:voice>
<contact:fax>+1.7035555556</contact:fax>
<contact:email>jdoe@example.com</contact:email>
<contact:ident type="op">37605030299</contact:ident>
<contact:ident type="passport">J836954</contact:ident>
<contact:authInfo>
<contact:pw>2fooBAR</contact:pw>
</contact:authInfo>

View file

@ -58,7 +58,7 @@ module EppContactXmlBuilder
xml.tag!('contact:voice', (xml_params[:voice] || '+372.1234567')) unless xml_params[:voice] == false
xml.tag!('contact:fax', (xml_params[:fax] || '123123' )) unless xml_params[:fax] == false
xml.tag!('contact:email', (xml_params[:email] || 'example@test.example')) unless xml_params[:email] == false
xml.tag!('contact:ident', (xml_params[:ident] || '37605030299')) unless xml_params[:ident] == false
xml.tag!('contact:ident', (xml_params[:ident] || '37605030299'), type: 'op') unless xml_params[:ident] == false
unless xml_params[:authInfo] == [false]
xml.tag!('contact:authInfo') do
xml.tag!('contact:pw', xml_params[:authInfo][:pw] ) unless xml_params[:authInfo][:pw] == false