@RequestMapping(value = "/register/{emailConfirmationToken}/validate", method = GET) public ResponseEntity<?> isConfirmationTokenValid(@Valid @Size(max = Constants.UUID_CHAR_MAX_SIZE) @PathVariable("emailConfirmationToken") String emailConfirmationToken, @Context HttpServletRequest requestContext) throws BaseException { // Get IP address from request String ipAddress = IPAddressUtil.getIPAddress(requestContext); LOG.info("/validate called from {} with token {}", ipAddress, emailConfirmationToken); Optional<Investor> oInvestor = Optional.empty(); try { oInvestor = investorRepository.findOptionalByEmailConfirmationToken(emailConfirmationToken); } catch (Exception e) { throw new UnexpectedException(); } if (!oInvestor.isPresent()) { throw new ConfirmationTokenNotFoundException(); } if (oInvestor.get().getWalletAddress() == null) { return ResponseEntity.ok().build(); } else { AddressResponse addressResponse = new AddressResponse() .setBtc(oInvestor.get().getPayInBitcoinAddress()) .setEther(oInvestor.get().getPayInEtherAddress()); return new ResponseEntity<>(addressResponse, HttpStatus.OK); } }
&& oInvestor.get().getWalletAddress() != null && oInvestor.get().getPayInBitcoinAddress() != null && oInvestor.get().getPayInEtherAddress() != null) {
public static InvestorMessageDTO build(Investor investor) { return new InvestorMessageDTO( investor.getCreationDate(), investor.getEmail(), investor.getEmailConfirmationToken(), investor.getWalletAddress(), investor.getPayInEtherAddress(), investor.getPayInBitcoinAddress(), investor.getRefundEtherAddress(), investor.getRefundBitcoinAddress(), investor.getIpAddress() ); }
context.setVariable("tokenSymbol", this.mailServiceConfigHolder.getTokenSymbol()); context.setVariable("walletAddress", oInvestor.get().getWalletAddress()); context.setVariable("payInEtherAddress", oInvestor.get().getPayInEtherAddress()); context.setVariable("payInBitcoinAddress", oInvestor.get().getPayInBitcoinAddress());
if (oInvestor.get().getWalletAddress() != null) { return new ResponseEntity<>(HttpStatus.CONFLICT);