def create_customer(sr): # Get the customer customer = Customer() customer_body = { "GivenName": sr.customer_first.capitalize(), "FamilyName": sr.customer_last.capitalize(), "FullyQualifiedName": sr.customer_name, "PrimaryEmailAddr": { "Address": sr.customer_email }, "DisplayName": sr.customer_name, #"Suffix": "Jr", #"Title": "Mr", #"MiddleName": "B", "Notes": sr.memo, "PrimaryPhone": { "FreeFormNumber": sr.customer_phone }, #"CompanyName": "King Groceries", "BillAddr": { "CountrySubDivisionCode": sr.customer_state, "City": sr.customer_city, "PostalCode": sr.customer_zip, "Line1": sr.customer_street, "Country": "USA" }, "ShipAddr": { "CountrySubDivisionCode": sr.customer_state, "City": sr.customer_city, "PostalCode": sr.customer_zip, "Line1": sr.customer_street, "Country": "USA" } } customer = customer.from_json(customer_body) #revise customer here logging.debug("Customer Body Sent: {}".format(customer_body)) try: customer.save(qb_client) logging.debug("New Customer Info: {}".format(customer.to_json())) return customer except QuickbooksException as e: logging.error("Errot saving new customer. [{}]".format(e.detail)) return None