Search in sources :

Example 1 with Person

use of com.blockscore.models.Person in project workbench by all-of-us.

the class ProfileController method submitIdVerification.

@Override
public ResponseEntity<Profile> submitIdVerification(IdVerificationRequest request) {
    // TODO(dmohs): Prevent this if the user has already attempted verification?
    Person person = blockscoreService.createPerson(request.getFirstName(), request.getLastName(), new Address().setStreet1(request.getStreetLine1()).setStreet2(request.getStreetLine2()).setCity(request.getCity()).setSubdivision(request.getState()).setPostalCode(request.getZip()).setCountryCode("US"), request.getDob(), request.getDocumentType(), request.getDocumentNumber());
    User user = userService.setBlockscoreIdVerification(person.getId(), person.isValid());
    return getProfileResponse(user);
}
Also used : User(org.pmiops.workbench.db.model.User) Address(com.blockscore.models.Address) InternetAddress(javax.mail.internet.InternetAddress) Person(com.blockscore.models.Person)

Example 2 with Person

use of com.blockscore.models.Person in project workbench by all-of-us.

the class BlockscoreServiceImpl method createPerson.

@Override
public Person createPerson(String firstName, String lastName, Address address, String dobString, String documentType, String documentNumber) {
    Person.Builder person = new Person.Builder(getClient());
    person.setFirstName(firstName).setLastName(lastName).setAddress(address).setDocumentType(documentType).setDocumentValue(documentNumber);
    SimpleDateFormat formatter = new SimpleDateFormat("yyyy-MM-dd");
    try {
        person.setDateOfBirth(formatter.parse(dobString));
    } catch (ParseException e) {
        throw new RuntimeException(e);
    }
    return person.create();
}
Also used : ParseException(java.text.ParseException) Person(com.blockscore.models.Person) SimpleDateFormat(java.text.SimpleDateFormat)

Aggregations

Person (com.blockscore.models.Person)2 Address (com.blockscore.models.Address)1 ParseException (java.text.ParseException)1 SimpleDateFormat (java.text.SimpleDateFormat)1 InternetAddress (javax.mail.internet.InternetAddress)1 User (org.pmiops.workbench.db.model.User)1