def update_director(director: Director, new_info: dict): """Update director with new info.""" director.first_name = new_info['officer'].get('firstName', '').upper() director.middle_initial = new_info['officer'].get('middleInitial', '').upper() director.last_name = new_info['officer'].get('lastName', '').upper() director.title = new_info.get('title', '').upper() # director.appointment_date = new_info.get('appointmentDate') director.cessation_date = new_info.get('cessationDate') director.delivery_address = update_address(director.delivery_address, new_info['deliveryAddress']) return director
def add_business_directors(business, directors_json): for director in directors_json['directors']: delivery_address = create_delivery_address(director['deliveryAddress']) officer = director['officer'] d = Director() d.first_name = officer['firstName'] d.last_name = officer['lastName'] d.middle_initial = officer['middleInitial'] d.appointment_date = datetime.date.fromisoformat( director['appointmentDate']) d.title = director['title'] d.delivery_address = delivery_address business.directors.append(d)
def update_director(director: Director, new_info: dict): """Update director with new info.""" director.first_name = new_info['officer'].get('firstName', '').upper() director.middle_initial = new_info['officer'].get('middleInitial', '').upper() director.last_name = new_info['officer'].get('lastName', '').upper() director.title = new_info.get('title', '').upper() # director.appointment_date = new_info.get('appointmentDate') director.cessation_date = new_info.get('cessationDate') director.delivery_address = update_address(director.delivery_address, new_info['deliveryAddress']) if 'mailingAddress' in new_info.keys(): if director.mailing_address is None: director.mailing_address = create_address(new_info['mailingAddress'], Address.MAILING) else: director.mailing_address = update_address(director.mailing_address, new_info['mailingAddress']) return director