private Investor createInvestor() { try { return investorService.getInvestorByEmail(INVESTOR_EMAIL); } catch (InvestorNotFoundException e) { return investorService.saveTransactionless( new Investor(new java.util.Date(), INVESTOR_EMAIL, "token", "walletAddress", "payInEtherPublicKey", "payInBitcoinPublicKey", "refundEtherAddress", "refundBitcoinAddress", "ipAddress")); } }
@RabbitListener( bindings = @QueueBinding(value = @Queue(value = KYC_REMINDER_EMAIL_SENT_QUEUE, autoDelete = "false"), exchange = @Exchange( value = ICONATOR_ENTRY_EXCHANGE, type = ExchangeTypes.TOPIC, ignoreDeclarationExceptions = "true", durable = "true" ), key = KYC_REMINDER_EMAIL_SENT_ROUTING_KEY) ) public void receiveMessage(KycReminderEmailSentMessage message) { try { long investorId = investorService.getInvestorByEmail(message.getEmailAddress()).getId(); kycInfoService.increaseNumberOfRemindersSent(investorId); LOG.debug("Increased numberOfRemindersSent for investor with ID {} by 1", investorId); } catch (InvestorNotFoundException e) { LOG.error("Investor with address {} not found", message.getEmailAddress()); } }
@RabbitListener( bindings = @QueueBinding(value = @Queue(value = KYC_START_EMAIL_SENT_QUEUE, autoDelete = "false"), exchange = @Exchange( value = ICONATOR_ENTRY_EXCHANGE, type = ExchangeTypes.TOPIC, ignoreDeclarationExceptions = "true", durable = "true" ), key = KYC_START_EMAIL_SENT_ROUTING_KEY) ) public void receiveMessage(KycStartEmailSentMessage message) { try { long investorId = investorService.getInvestorByEmail(message.getEmailAddress()).getId(); kycInfoService.setKycStartEmailSent(investorId); LOG.debug("Set kycStartEmailSent for investor with ID {} to true", investorId); } catch (InvestorNotFoundException e) { LOG.error("Investor with address {} not found", message.getEmailAddress()); } }
@Test public void testGetInvestorByEmail() { try { Investor investorFromDb = investorService.getInvestorByEmail("test@test.com"); assertEquals(investor, investorFromDb); } catch(InvestorNotFoundException e) { fail(e.getMessage()); } } }