Write tests around API for domain lock

This commit is contained in:
Maciej Szlosarczyk 2018-08-10 14:18:24 +03:00
parent 2a7caaa33e
commit 0a0962e007
No known key found for this signature in database
GPG key ID: 41D62D42D3B0D765
6 changed files with 89 additions and 17 deletions

View file

@ -22,6 +22,15 @@ module Api
header.gsub(pattern, '') if header&.match(pattern)
end
def associated_domains(user)
country_code, ident = user.registrant_ident.split('-')
BusinessRegistryCache.fetch_associated_domains(ident, country_code)
rescue Soap::Arireg::NotAvailableError => error
Rails.logger.fatal("[EXCEPTION] #{error}")
user.domains
end
def authenticate
decryptor = AuthTokenDecryptor.create_with_defaults(bearer_token)
decryptor.decrypt_token