return toOrderDto(reservation, purchase);
}
private OrderDto toOrderDto(Reservation reservation, Purchase purchase) {
OrderDto dto = new OrderDto();
dto.setOrderId(reservation.getAggregateId());
List<ReservedProduct> reservedProducts = reservation.getReservedProducts();
dto.setOrderedProducts(new ArrayList<OrderedProductDto>(transform(reservedProducts,
reservedProductToOrderedProductDto())));
if (purchase != null) {
dto.setStatus(OrderStatus.CONFIRMED);
// TODO CHECK PAYMENT!
} else {
dto.setStatus(OrderStatus.NEW);
}
return dto;
}