def _get_ar(cls, cursor, identifier: str = None, filing_event_info: dict = None): """Return annual report filing.""" # get directors and registered office as of this filing director_events = cls._get_events(identifier=identifier, filing_type_code='OTCDR', cursor=cursor) office_events = cls._get_events(identifier=identifier, filing_type_code='OTADD', cursor=cursor) director_event_id = None office_event_id = None tmp_timestamp = datetime.datetime.fromtimestamp(0) for event in director_events: if filing_event_info['event_timestmp'] >= event['date'] > tmp_timestamp: director_event_id = event['id'] tmp_timestamp = event['date'] tmp_timestamp = datetime.datetime.fromtimestamp(0) for event in office_events: if filing_event_info['event_timestmp'] >= event['date'] > tmp_timestamp: office_event_id = event['id'] tmp_timestamp = event['date'] recreated_dirs_and_office = True if director_event_id: try: directors = Party.get_by_event(identifier=identifier, event_id=director_event_id, cursor=cursor) except: # noqa B901; pylint: disable=bare-except; # should only get here if agm was before the bob date recreated_dirs_and_office = False directors = Party.get_current(identifier=identifier, cursor=cursor) else: directors = Party.get_current(identifier=identifier, cursor=cursor) directors = [x.as_dict() for x in directors] if office_event_id: try: office_obj_list = (Office.get_by_event(event_id=office_event_id, cursor=cursor)).as_dict() offices = Office.convert_obj_list(office_obj_list) except: # noqa B901; pylint: disable=bare-except; # should only get here if agm was before the bob date recreated_dirs_and_office = False office_obj_list = Office.get_current(identifier=identifier, cursor=cursor) offices = Office.convert_obj_list(office_obj_list) else: office_obj_list = Office.get_current(identifier=identifier, cursor=cursor) offices = Office.convert_obj_list(office_obj_list) filing_obj = Filing() filing_obj.body = { 'annualGeneralMeetingDate': convert_to_json_date(filing_event_info.get('agm_date', None)), 'annualReportDate': convert_to_json_date(filing_event_info['period_end_dt']), 'directors': directors, 'eventId': filing_event_info['event_id'], 'offices': offices } filing_obj.filing_type = 'annualReport' filing_obj.paper_only = not recreated_dirs_and_office filing_obj.effective_date = filing_event_info['period_end_dt'] return filing_obj
def _get_coa(cls, cursor, identifier: str = None, filing_event_info: dict = None): """Get change of address filing for registered and/or records office.""" office_obj_list = Office.get_by_event(cursor, filing_event_info['event_id']) if not office_obj_list: raise FilingNotFoundException(identifier=identifier, filing_type='change_of_address', event_id=filing_event_info['event_id']) offices = Office.convert_obj_list(office_obj_list) # check to see if this filing was made with an AR -> if it was then set the AR date as the effective date effective_date = filing_event_info['event_timestmp'] annual_reports = cls._get_events(cursor=cursor, identifier=identifier, filing_type_code='OTANN') for filing in annual_reports: if convert_to_json_date(filing['date']) == convert_to_json_date(effective_date): effective_date = filing['annualReportDate'] break filing_obj = Filing() filing_obj.body = { 'offices': offices, 'eventId': filing_event_info['event_id'] } filing_obj.filing_type = 'changeOfAddress' filing_obj.paper_only = False filing_obj.effective_date = effective_date return filing_obj
def _get_inc(cls, cursor, identifier: str = None, filing_event_info: dict = None): """Get incorporation filing.""" # business_obj office_obj_list = Office.get_by_event(cursor, filing_event_info['event_id']) if not office_obj_list: raise FilingNotFoundException( identifier=identifier, filing_type='change_of_address', event_id=filing_event_info['event_id']) offices = Office.convert_obj_list(office_obj_list) filing_obj = Filing() filing_obj.body = { 'offices': offices, 'eventId': filing_event_info['event_id'] } filing_obj.filing_type = 'incorporationApplication' filing_obj.paper_only = False return filing_obj
def _get_inc(cls, cursor, identifier: str = None, filing_event_info: dict = None): """Get incorporation filing.""" # business_obj office_obj_list = Office.get_by_event(cursor, filing_event_info['event_id']) share_structure = ShareObject.get_all(cursor, identifier, filing_event_info['event_id']) parties = Party.get_by_event(cursor, identifier, filing_event_info['event_id'], None) if not office_obj_list: raise FilingNotFoundException(identifier=identifier, filing_type='change_of_address', event_id=filing_event_info['event_id']) offices = Office.convert_obj_list(office_obj_list) filing_obj = Filing() filing_obj.body = { 'offices': offices, 'eventId': filing_event_info['event_id'], 'shareClasses': share_structure.to_dict()['shareClasses'], 'parties': [x.as_dict() for x in parties] } filing_obj.filing_type = 'incorporationApplication' filing_obj.paper_only = False return filing_obj