Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Unexpected behaviour of contact code #415

Open
artur-intech opened this issue Mar 9, 2017 · 2 comments
Open

Unexpected behaviour of contact code #415

artur-intech opened this issue Mar 9, 2017 · 2 comments

Comments

@artur-intech
Copy link
Contributor

artur-intech commented Mar 9, 2017

I have discovered the following issue while testing EPP update: I manually created new contact with the code "test". Then I tried to update it via EPP by specifying "test" as a content of "id" tag, but it failed, since the code is saved to the database as is if created outside of EPP, but is converted to uppercase when making EPP query.

  • It is unexpected
  • Against least surprise principle
  • Impossible to remember

Last thing leads to additional effort finding out why newly added contact is not found. It is also unnatural to always specify the code in uppercase. Consider this example https://github.com/internetee/registry/blob/master/spec/requests/epp/contact/update/phone_spec.rb: it opens up a question: why TEST is just upper-cased?!

Querying a contact via EPP fails if a contact is created using one of the following statements:

Contact.create!(name: 'test', code: 'test1', phone: '+123.4', email: 'test111@internet.ee', country_code: 'EE', ident: '37605030299', ident_type: 'priv', ident_country_code: 'EE', registrar: Registrar.last)

RSpec.describe 'EPP contact:update' do
  let!(:contact) { create(:contact, code: 'test') }
  let(:request_xml) { <<-XML
    <?xml version="1.0" encoding="UTF-8" standalone="no"?>
    <epp xmlns="https://epp.tld.ee/schema/epp-ee-1.0.xsd">
      <command>
        <update>
          <contact:update xmlns:contact="https://epp.tld.ee/schema/contact-ee-1.1.xsd">
            <contact:id>test</contact:id>
...

I consider this kind of behaviour harmful and suggest that we either remove auto uppercase in EPP at all or make it predictable by adding auto conversion to Contact model, so it is always saved upper-cased.

@artur-intech artur-intech changed the title Unexpected behaviour Unexpected behaviour of contact code Mar 9, 2017
@vohmar
Copy link
Contributor

vohmar commented Mar 9, 2017

conversion is a must.
You can move conversion to contact model if it helps the development but nothing must change for EPP users.

@artur-intech
Copy link
Contributor Author

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants