@Transactional public void redeem(final String tokenNumber,final String service){
  final Token token=tokenRepository.findByTokenNumberAndService(tokenNumber,service);
  if (token == null)   throw new ApplicationRuntimeException("Token " + tokenNumber + " does not exist!");
  redeem(token);
}

@ Transactional public void redeem ( final String tokenNumber , final String service ) { final Token token = tokenRepository . findByTokenNumberAndService ( tokenNumber , service ) ; if ( token == null ) throw new ApplicationRuntimeException ( "Token " + tokenNumber + " does not exist!" ) ; redeem ( token ) ; }
checks whether a token can be redeemed and then redeems it i . e . removes it from the database . if the token does not exist or has expired , it throws an exception .
