Fixed search_global_company_profiles_id method
New response and fixed query parameter
This commit is contained in:
@@ -67,24 +67,33 @@ class FocusCompliance(Request):
|
||||
|
||||
return fal_data
|
||||
|
||||
def search_global_company_profiles_id(self) -> list:
|
||||
def search_global_company_profiles_id(self, company_name: str = None) -> list:
|
||||
"""Поиск сводной информации по санкционным профилям ЮЛ
|
||||
|
||||
:param company_name: Наименование компании
|
||||
:type company_name: str
|
||||
:return: Список идентификаторов профилей
|
||||
:rtype: list
|
||||
"""
|
||||
if self.inn:
|
||||
query = self.inn
|
||||
elif company_name:
|
||||
query = company_name
|
||||
else:
|
||||
return {'success': False, 'result': 'Не указан ИНН или наименование контрагента'}
|
||||
|
||||
try:
|
||||
response = self.get(f'{self._focus_base_url}/companies/profiles/search', query=self.inn)
|
||||
response = self.get(f'{self._focus_base_url}/companies/profiles/search', query=query)
|
||||
profiles = response['legalEntityProfiles']
|
||||
|
||||
if not profiles:
|
||||
return profiles
|
||||
return {'success': True, 'result': profiles}
|
||||
elif len(profiles) > 1:
|
||||
return [profile['id'] for profile in profiles]
|
||||
return {'success': True, 'result': [profile['id'] for profile in profiles]}
|
||||
else:
|
||||
return [profiles[0]['id']]
|
||||
return {'success': True, 'result': [profiles[0]['id']]}
|
||||
except KeyError:
|
||||
return None
|
||||
return {'success': False, 'result': 'Key Error'}
|
||||
|
||||
def legal_entity_profile_report(self, profile_id_list: list, path: str = None) -> dict:
|
||||
"""Получение печатного отчета по профилю ЮЛ
|
||||
|
||||
Reference in New Issue
Block a user