in pyqldbsamples/add_secondary_owner.py [0:0]
def register_secondary_owner(driver, vin, gov_id):
"""
Register a secondary owner for a vehicle if they are not already registered.
:type driver: :py:class:`pyqldb.driver.qldb_driver.QldbDriver`
:param driver: An instance of the QldbDriver class.
:type vin: str
:param vin: VIN of the vehicle to register a secondary owner for.
:type gov_id: str
:param gov_id: The government ID of the owner.
"""
logger.info('Finding the secondary owners for vehicle with VIN: {}.'.format(vin))
document_ids = get_document_id_by_gov_id(driver, gov_id)
for document_id in document_ids:
if is_secondary_owner_for_vehicle(driver, vin, document_id):
logger.info('Person with ID {} has already been added as a secondary owner of this vehicle.'.format(gov_id))
else:
add_secondary_owner_for_vin(driver, vin, to_ion_struct('PersonId', document_id))