def add_applicant(nr, nr_applicant): applicant = nr.applicants.one_or_none() if not applicant: applicant = Applicant() nr.applicants.append(applicant) applicant.lastName = nr_applicant['last_name'] applicant.firstName = nr_applicant['first_name'] applicant.middleName = nr_applicant['middle_name'] applicant.phoneNumber = nr_applicant['phone_number'] applicant.faxNumber = nr_applicant['fax_number'] applicant.emailAddress = nr_applicant['email_address'] applicant.contact = nr_applicant['contact'] applicant.clientFirstName = nr_applicant['client_first_name'] applicant.clientLastName = nr_applicant['client_last_name'] applicant.declineNotificationInd = nr_applicant['decline_notification_ind'] applicant.addrLine1 = nr_applicant['addr_line_1'] applicant.addrLine2 = nr_applicant['addr_line_2'] applicant.addrLine3 = nr_applicant['addr_line_3'] applicant.city = nr_applicant['city'] applicant.postalCd = nr_applicant['postal_cd'] applicant.stateProvinceCd = nr_applicant['state_province_cd'] applicant.countryTypeCd = nr_applicant['country_type_cd']
def set_applicant_attributes(json_data, nr_id): # applicant, contact and address info for applicant in json_data.get('applicants', None): nrd_app = Applicant() party_id = get_applicant_sequence() nrd_app.nrId = nr_id nrd_app.partyId = party_id nrd_app.lastName = convert_to_ascii(applicant['lastName']) nrd_app.firstName = convert_to_ascii(applicant['firstName']) if applicant['middleName']: nrd_app.middleName = convert_to_ascii(applicant['middleName']) nrd_app.contact = convert_to_ascii(applicant['contact']) if applicant['middleName']: nrd_app.middleName = convert_to_ascii(applicant['middleName']) if applicant['clientFirstName']: nrd_app.clientFirstName = convert_to_ascii( applicant['clientFirstName']) if applicant['clientLastName']: nrd_app.clientLastName = convert_to_ascii( applicant['clientLastName']) if applicant['phoneNumber']: nrd_app.phoneNumber = convert_to_ascii(applicant['phoneNumber']) if applicant['faxNumber']: nrd_app.faxNumber = convert_to_ascii(applicant['faxNumber']) nrd_app.emailAddress = convert_to_ascii(applicant['emailAddress']) nrd_app.addrLine1 = convert_to_ascii(applicant['addrLine1']) if applicant['addrLine2']: nrd_app.addrLine2 = convert_to_ascii(applicant['addrLine2']) nrd_app.city = convert_to_ascii(applicant['city']) nrd_app.stateProvinceCd = applicant['stateProvinceCd'] nrd_app.postalCd = convert_to_ascii(applicant['postalCd']) nrd_app.countryTypeCd = applicant['countryTypeCd'] return nrd_app
def map_request_applicant(applicant: Applicant, request_applicant: dict): applicant.lastName = convert_to_ascii(request_applicant.get('lastName')) applicant.firstName = convert_to_ascii(request_applicant.get('firstName')) if request_applicant.get('middleName'): applicant.middleName = convert_to_ascii(request_applicant.get('middleName')) applicant.contact = convert_to_ascii(request_applicant.get('contact')) if request_applicant.get('clientFirstName'): applicant.clientFirstName = convert_to_ascii(request_applicant.get('clientFirstName')) if request_applicant.get('clientLastName'): applicant.clientLastName = convert_to_ascii(request_applicant.get('clientLastName')) if request_applicant.get('phoneNumber'): applicant.phoneNumber = convert_to_ascii(request_applicant.get('phoneNumber')) if request_applicant.get('faxNumber'): applicant.faxNumber = convert_to_ascii(request_applicant.get('faxNumber')) applicant.emailAddress = convert_to_ascii(request_applicant.get('emailAddress')) applicant.addrLine1 = convert_to_ascii(request_applicant.get('addrLine1')) if request_applicant.get('addrLine2'): applicant.addrLine2 = convert_to_ascii(request_applicant.get('addrLine2')) if request_applicant.get('addrLine3'): applicant.addrLine3 = convert_to_ascii(request_applicant.get('addrLine3')) applicant.city = convert_to_ascii(request_applicant.get('city')) applicant.stateProvinceCd = request_applicant.get('stateProvinceCd') applicant.postalCd = convert_to_ascii(request_applicant.get('postalCd')) applicant.countryTypeCd = request_applicant.get('countryTypeCd') return applicant