Search in sources :

Example 1 with CannotStoreAccountException

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

the class AccountManagementService method markActivated.

public void markActivated(EthereumAccount account, String txHash) {
    try {
        account.setActivated(true);
        account.setTransactionHash(txHash);
        ethereumAccountRepository.save(account);
    } catch (Exception e) {
        throw new CannotStoreAccountException("Crashed while activating new account", e.getCause());
    }
}
Also used : CannotStoreAccountException(eu.cryptoeuro.accountmapper.error.CannotStoreAccountException) CannotStoreAccountException(eu.cryptoeuro.accountmapper.error.CannotStoreAccountException)

Example 2 with CannotStoreAccountException

use of eu.cryptoeuro.accountmapper.error.CannotStoreAccountException 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

CannotStoreAccountException (eu.cryptoeuro.accountmapper.error.CannotStoreAccountException)2 EthereumAccount (eu.cryptoeuro.accountmapper.domain.EthereumAccount)1