Search in sources :

Example 1 with HasActiveAccountException

use of eu.cryptoeuro.accountmapper.error.HasActiveAccountException in project account-identity by cryptofiat.

the class EscrowController method getEscrow.

@RequestMapping(method = RequestMethod.GET, value = "/{idCode}")
public ResponseEntity<AccountActivationResponse> getEscrow(@PathVariable("idCode") @Valid long idCode) throws IOException {
    if (accountService.hasActivatedAccount(idCode)) {
        throw new HasActiveAccountException();
    }
    ;
    if (ldapService.lookupIdCode(idCode) == null) {
        throw new LdapNotFoundException();
    }
    ;
    EthereumAccount account;
    account = escrowService.approveEscrowAccountForId(idCode);
    AccountActivationResponse aaResponse = AccountActivationResponse.builder().authenticationStatus(AuthenticationStatus.LOGIN_SUCCESS.name()).ownerId(account.getOwnerId()).address(account.getAddress()).transactionHash(account.getTransactionHash()).build();
    return new ResponseEntity<AccountActivationResponse>(aaResponse, HttpStatus.OK);
}
Also used : HasActiveAccountException(eu.cryptoeuro.accountmapper.error.HasActiveAccountException) ResponseEntity(org.springframework.http.ResponseEntity) LdapNotFoundException(eu.cryptoeuro.accountmapper.error.LdapNotFoundException) AccountActivationResponse(eu.cryptoeuro.accountmapper.response.AccountActivationResponse) EthereumAccount(eu.cryptoeuro.accountmapper.domain.EthereumAccount) RequestMapping(org.springframework.web.bind.annotation.RequestMapping)

Aggregations

EthereumAccount (eu.cryptoeuro.accountmapper.domain.EthereumAccount)1 HasActiveAccountException (eu.cryptoeuro.accountmapper.error.HasActiveAccountException)1 LdapNotFoundException (eu.cryptoeuro.accountmapper.error.LdapNotFoundException)1 AccountActivationResponse (eu.cryptoeuro.accountmapper.response.AccountActivationResponse)1 ResponseEntity (org.springframework.http.ResponseEntity)1 RequestMapping (org.springframework.web.bind.annotation.RequestMapping)1