private void updateExchangeDetails( DirectBookExchange directBookExchange, Book bookRequestedInExchange) { directBookExchange.setBookOfferedInExchange(bookRequestedInExchange); directBookExchange.setOver(true); directBookExchange.setSuccessful(true); directBookExchange.setDateCompleted(LocalDateTime.now()); }
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); }