コード例 #1
0
 private void updateExchangeDetails(
     DirectBookExchange directBookExchange, Book bookRequestedInExchange) {
   directBookExchange.setBookOfferedInExchange(bookRequestedInExchange);
   directBookExchange.setOver(true);
   directBookExchange.setSuccessful(true);
   directBookExchange.setDateCompleted(LocalDateTime.now());
 }
コード例 #2
0
  public void rejectDirectExchange(String userEmail, int id) throws BookExchangeInternalException {
    DirectBookExchange directExchangeToReject =
        bookExchangeDao
            .getDirectBookExchange(id)
            .orElseThrow(() -> new BookExchangeInternalException("No exchange found"));
    directExchangeToReject.setOver(true);
    directExchangeToReject.setSuccessful(false);
    directExchangeToReject.setDateCompleted(LocalDateTime.now());

    bookExchangeDao.saveBookExchange(directExchangeToReject);
    notifyOtherExchangeParticipant(userEmail, directExchangeToReject);
  }