@Test public void testHandleStartToPayForCoins() throws Exception { fixture = Fixtures.newGivenWhenThenFixture(ExecutedMoneyTransaction.class); commandHandler = new ExecutionCommandHandler(); fixture.registerAnnotatedCommandHandler(commandHandler); commandHandler.setMoneyRepository(fixture.getRepository()); PayBuyMoneyTransactionCommand command = new PayBuyMoneyTransactionCommand( feeTransactionId, paidReceivedFeeId, payableReceivableFeeId, offsetId, orderId, orderTransactionId, portfolioId, userId, tradeTime, dueDate, TradeType.BUY, tradedPrice, tradeAmount, money, orderBookId, coinId ); fixture.given() .when(command) .expectEvents(new ExecutedPayMoneyTransactionStartedEvent( feeTransactionId, paidReceivedFeeId, payableReceivableFeeId, offsetId, orderId, orderTransactionId, portfolioId, userId, tradeTime, dueDate, TradeType.BUY, tradedPrice, tradeAmount, money, orderBookId, coinId )); }
@CommandHandler public void handleStartToPayForCoins(PayBuyMoneyTransactionCommand command) { ExecutedMoneyTransaction transaction = new ExecutedMoneyTransaction( command.getFeeTransactionId(), command.getPaidFeeId(), command.getAccountPayableFeeId(), command.getOffsetId(), ExecutedFeeType.PAY, command.getOrderId(), command.getOrderTransactionId(), command.getPortfolioId(), command.getUserId(), command.getTradeTime(), command.getDueDate(), command.getTradeType(), command.getTradedPrice(), command.getTradeAmount(), command.getExecutedMoney(), command.getOrderBookId(), command.getCoinId()); moneyRepository.add(transaction); }
ExecutionCommandHandler { @CommandHandler public void handleStartToPayForCoins(PayBuyMoneyTransactionCommand command) { ExecutedMoneyTransaction transaction = new ExecutedMoneyTransaction( command.getFeeTransactionId(), command.getPaidFeeId(), command.getAccountPayableFeeId(), command.getOffsetId(), ExecutedFeeType.PAY, command.getOrderId(), command.getOrderTransactionId(), command.getPortfolioId(), command.getUserId(), command.getTradeTime(), command.getDueDate(), command.getTradeType(), command.getTradedPrice(), command.getTradeAmount(), command.getExecutedMoney(), command.getOrderBookId(), command.getCoinId()); moneyRepository.add(transaction); } }
ExecutionCommandHandler { @CommandHandler public void handleStartToPayForCoins(PayBuyMoneyTransactionCommand command) { ExecutedMoneyTransaction transaction = new ExecutedMoneyTransaction( command.getFeeTransactionId(), command.getPaidFeeId(), command.getAccountPayableFeeId(), command.getOffsetId(), ExecutedFeeType.PAY, command.getOrderId(), command.getOrderTransactionId(), command.getPortfolioId(), command.getUserId(), command.getTradeTime(), command.getDueDate(), command.getTradeType(), command.getTradedPrice(), command.getTradeAmount(), command.getExecutedMoney(), command.getOrderBookId(), command.getCoinId()); moneyRepository.add(transaction); }  }
ExecutionCommandHandler { @CommandHandler public void handleStartToPayForCoins(PayBuyMoneyTransactionCommand command) { ExecutedMoneyTransaction transaction = new ExecutedMoneyTransaction( command.getFeeTransactionId(), command.getPaidFeeId(), command.getAccountPayableFeeId(), command.getOffsetId(), ExecutedFeeType.PAY, command.getOrderId(), command.getOrderTransactionId(), command.getPortfolioId(), command.getUserId(), command.getTradeTime(), command.getDueDate(), command.getTradeType(), command.getTradedPrice(), command.getTradeAmount(), command.getExecutedMoney(), command.getOrderBookId(), command.getCoinId()); moneyRepository.add(transaction); }  @CommandHandler void handleStartToSell(PaySellCommissionTransactionCommand command); @CommandHandler void handleStartToBuy(PayBuyCommissionTransactionCommand command); @CommandHandler void handleStartToPaySoldCoin(PaySoldCoinTransactionCommand command); @CommandHandler void handleStartToReceiveMoneyFromSale(GainSoldMoneyTransactionCommand command); @CommandHandler void handleStartToPayForCoins(PayBuyMoneyTransactionCommand command); @CommandHandler void handleStartToReceiveCoinsFromSale(GainBuyCoinTransactionCommand command); @Resource(name = "executedCommissionTransactionRepository") void setCommissionRepository(Repository<ExecutedCommissionTransaction> commissionRepository); @Resource(name = "executedCoinTransactionRepository") void setCoinRepository(Repository<ExecutedCoinTransaction> coinRepository); @Resource(name = "executedMoneyTransactionRepository") void setMoneyRepository(Repository<ExecutedMoneyTransaction> moneyRepository); }
ExecutionCommandHandler { @CommandHandler public void handleStartToPayForCoins(PayBuyMoneyTransactionCommand command) { ExecutedMoneyTransaction transaction = new ExecutedMoneyTransaction( command.getFeeTransactionId(), command.getPaidFeeId(), command.getAccountPayableFeeId(), command.getOffsetId(), ExecutedFeeType.PAY, command.getOrderId(), command.getOrderTransactionId(), command.getPortfolioId(), command.getUserId(), command.getTradeTime(), command.getDueDate(), command.getTradeType(), command.getTradedPrice(), command.getTradeAmount(), command.getExecutedMoney(), command.getOrderBookId(), command.getCoinId()); moneyRepository.add(transaction); }  @CommandHandler void handleStartToSell(PaySellCommissionTransactionCommand command); @CommandHandler void handleStartToBuy(PayBuyCommissionTransactionCommand command); @CommandHandler void handleStartToPaySoldCoin(PaySoldCoinTransactionCommand command); @CommandHandler void handleStartToReceiveMoneyFromSale(GainSoldMoneyTransactionCommand command); @CommandHandler void handleStartToPayForCoins(PayBuyMoneyTransactionCommand command); @CommandHandler void handleStartToReceiveCoinsFromSale(GainBuyCoinTransactionCommand command); @Resource(name = "executedCommissionTransactionRepository") void setCommissionRepository(Repository<ExecutedCommissionTransaction> commissionRepository); @Resource(name = "executedCoinTransactionRepository") void setCoinRepository(Repository<ExecutedCoinTransaction> coinRepository); @Resource(name = "executedMoneyTransactionRepository") void setMoneyRepository(Repository<ExecutedMoneyTransaction> moneyRepository);  }