Skip to content

Commit

Permalink
#588 add cancelPendingReservation
Browse files Browse the repository at this point in the history
  • Loading branch information
syjer committed Mar 26, 2019
1 parent 4a5b408 commit 591c127
Showing 1 changed file with 24 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,9 @@

import alfio.controller.ReservationController;
import alfio.controller.form.ContactAndTicketsForm;
import alfio.controller.support.SessionUtil;
import alfio.controller.support.TicketDecorator;
import alfio.manager.TicketReservationManager;
import alfio.model.TicketCategory;
import lombok.AllArgsConstructor;
import lombok.Getter;
Expand All @@ -31,6 +33,7 @@
import org.springframework.web.servlet.mvc.support.RedirectAttributes;

import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpSession;
import java.util.HashMap;
import java.util.List;
import java.util.Locale;
Expand All @@ -43,6 +46,7 @@
public class ReservationApiV2Controller {

private final ReservationController reservationController;
private final TicketReservationManager ticketReservationManager;



Expand Down Expand Up @@ -70,6 +74,15 @@ public static class TicketsByTicketCategory {
return new ResponseEntity<>(model.asMap(), HttpStatus.OK);
}

@DeleteMapping("/event/{eventName}/reservation/{reservationId}")
public ResponseEntity<Boolean> cancelPendingReservation(@PathVariable("eventName") String eventName,
@PathVariable("reservationId") String reservationId,
HttpServletRequest request) {
ticketReservationManager.cancelPendingReservation(reservationId, false, null);
SessionUtil.cleanupSession(request);
return new ResponseEntity<>(true, HttpStatus.OK);
}

@PostMapping("/event/{eventName}/reservation/{reservationId}/validate-to-overview")
public ResponseEntity<Map<String, ?>> validateToOverview(@PathVariable("eventName") String eventName,
@PathVariable("reservationId") String reservationId,
Expand All @@ -85,4 +98,15 @@ public static class TicketsByTicketCategory {
return new ResponseEntity<>(model, HttpStatus.OK);
}

@GetMapping("/event/{eventName}/reservation/{reservationId}/overview")
public ResponseEntity<Map<String, ?>> showOverview(@PathVariable("eventName") String eventName,
@PathVariable("reservationId") String reservationId,
Locale locale,
Model model,
HttpSession session) {
var res = reservationController.showOverview(eventName, reservationId, locale, model, session);
model.addAttribute("viewState", res);
return new ResponseEntity<>(model.asMap(), HttpStatus.OK);
}

}

0 comments on commit 591c127

Please sign in to comment.