use of alfio.model.TicketReservation.TicketReservationStatus in project alf.io by alfio-event.
the class ReservationController method showFailurePage.
@RequestMapping(value = "/event/{eventName}/reservation/{reservationId}/failure", method = RequestMethod.GET)
public String showFailurePage(@PathVariable("eventName") String eventName, @PathVariable("reservationId") String reservationId, @RequestParam(value = "confirmation-email-sent", required = false, defaultValue = "false") boolean confirmationEmailSent, @RequestParam(value = "ticket-email-sent", required = false, defaultValue = "false") boolean ticketEmailSent, Model model) {
Optional<Event> event = eventRepository.findOptionalByShortName(eventName);
if (!event.isPresent()) {
return "redirect:/";
}
Optional<TicketReservation> reservation = ticketReservationManager.findById(reservationId);
Optional<TicketReservationStatus> status = reservation.map(TicketReservation::getStatus);
if (!status.isPresent()) {
return redirectReservation(reservation, eventName, reservationId);
}
TicketReservationStatus ticketReservationStatus = status.get();
if (ticketReservationStatus == TicketReservationStatus.IN_PAYMENT || ticketReservationStatus == TicketReservationStatus.STUCK) {
model.addAttribute("reservation", reservation.get());
model.addAttribute("organizer", organizationRepository.getById(event.get().getOrganizationId()));
model.addAttribute("pageTitle", "reservation-page-error-status.header.title");
model.addAttribute("event", event.get());
return "/event/reservation-page-error-status";
}
return redirectReservation(reservation, eventName, reservationId);
}
use of alfio.model.TicketReservation.TicketReservationStatus in project alf.io by alfio-event.
the class ReservationController method showWaitingPaymentPage.
@RequestMapping(value = "/event/{eventName}/reservation/{reservationId}/waitingPayment", method = RequestMethod.GET)
public String showWaitingPaymentPage(@PathVariable("eventName") String eventName, @PathVariable("reservationId") String reservationId, Model model, Locale locale) {
Optional<Event> event = eventRepository.findOptionalByShortName(eventName);
if (!event.isPresent()) {
return "redirect:/";
}
Optional<TicketReservation> reservation = ticketReservationManager.findById(reservationId);
TicketReservationStatus status = reservation.map(TicketReservation::getStatus).orElse(TicketReservationStatus.PENDING);
if (reservation.isPresent() && status == TicketReservationStatus.OFFLINE_PAYMENT) {
Event ev = event.get();
TicketReservation ticketReservation = reservation.get();
OrderSummary orderSummary = ticketReservationManager.orderSummaryForReservationId(reservationId, ev, locale);
model.addAttribute("totalPrice", orderSummary.getTotalPrice());
model.addAttribute("emailAddress", organizationRepository.getById(ev.getOrganizationId()).getEmail());
model.addAttribute("reservation", ticketReservation);
model.addAttribute("paymentReason", ev.getShortName() + " " + ticketReservationManager.getShortReservationID(ev, reservationId));
model.addAttribute("pageTitle", "reservation-page-waiting.header.title");
model.addAttribute("bankAccount", configurationManager.getStringConfigValue(Configuration.from(ev.getOrganizationId(), ev.getId(), BANK_ACCOUNT_NR)).orElse(""));
Optional<String> maybeAccountOwner = configurationManager.getStringConfigValue(Configuration.from(ev.getOrganizationId(), ev.getId(), BANK_ACCOUNT_OWNER));
model.addAttribute("hasBankAccountOwnerSet", maybeAccountOwner.isPresent());
model.addAttribute("bankAccountOwner", Arrays.asList(maybeAccountOwner.orElse("").split("\n")));
model.addAttribute("expires", ZonedDateTime.ofInstant(ticketReservation.getValidity().toInstant(), ev.getZoneId()));
model.addAttribute("event", ev);
return "/event/reservation-waiting-for-payment";
}
return redirectReservation(reservation, eventName, reservationId);
}
Aggregations