Search in sources :

Example 6 with EthereumAccount

use of eu.cryptoeuro.accountmapper.domain.EthereumAccount in project account-identity by cryptofiat.

the class AccountManagementService method storeNewAccount.

public EthereumAccount storeNewAccount(String address, String ownerId, AuthorisationType authorisationType) {
    address = ethService.without0x(address);
    try {
        validateAccountStoring(address, ownerId);
        EthereumAccount account = EthereumAccount.builder().ownerId(ownerId).address(address).activated(false).authorisationType(authorisationType).build();
        ethereumAccountRepository.save(account);
        return account;
    } catch (CannotStoreAccountException e) {
        throw e;
    } catch (Exception e) {
        throw new CannotStoreAccountException("Crashed while storing new account", e.getCause());
    }
}
Also used : CannotStoreAccountException(eu.cryptoeuro.accountmapper.error.CannotStoreAccountException) EthereumAccount(eu.cryptoeuro.accountmapper.domain.EthereumAccount) CannotStoreAccountException(eu.cryptoeuro.accountmapper.error.CannotStoreAccountException)

Aggregations

EthereumAccount (eu.cryptoeuro.accountmapper.domain.EthereumAccount)6 ResponseEntity (org.springframework.http.ResponseEntity)4 AccountActivationResponse (eu.cryptoeuro.accountmapper.response.AccountActivationResponse)3 ApiOperation (io.swagger.annotations.ApiOperation)3 IOException (java.io.IOException)3 PendingAuthorisation (eu.cryptoeuro.accountmapper.domain.PendingAuthorisation)2 JSONException (org.json.JSONException)2 MobileIDSession (com.codeborne.security.mobileid.MobileIDSession)1 Escrow (eu.cryptoeuro.accountmapper.domain.Escrow)1 CannotStoreAccountException (eu.cryptoeuro.accountmapper.error.CannotStoreAccountException)1 HasActiveAccountException (eu.cryptoeuro.accountmapper.error.HasActiveAccountException)1 LdapNotFoundException (eu.cryptoeuro.accountmapper.error.LdapNotFoundException)1 HttpStatus (org.springframework.http.HttpStatus)1 RequestMapping (org.springframework.web.bind.annotation.RequestMapping)1