@@ -60,7 +60,7 @@ public InvoiceReceiptController(EventRepository eventRepository,
60
60
}
61
61
62
62
private ResponseEntity <Void > handleReservationWith (String eventName , String reservationId , HttpServletResponse response , BiFunction <Event , TicketReservation , ResponseEntity <Void >> with ) {
63
- ResponseEntity <Void > notFound = ResponseEntity .< Void > notFound ().build ();
63
+ ResponseEntity <Void > notFound = ResponseEntity .notFound ().build ();
64
64
return eventRepository .findOptionalByShortName (eventName ).map (event -> {
65
65
return ticketReservationManager .findById (reservationId ).map (ticketReservation -> {
66
66
return with .apply (event , ticketReservation );
@@ -93,7 +93,7 @@ public ResponseEntity<Void> getReceipt(@PathVariable("eventName") String eventNa
93
93
@ PathVariable ("reservationId" ) String reservationId ,
94
94
HttpServletResponse response ) {
95
95
return handleReservationWith (eventName , reservationId , response , (event , reservation ) -> {
96
- if (reservation .getInvoiceNumber () != null ) {
96
+ if (reservation .getInvoiceNumber () != null || ! reservation . getHasInvoiceOrReceiptDocument () ) {
97
97
return ResponseEntity .notFound ().build ();
98
98
}
99
99
@@ -108,7 +108,7 @@ public void getInvoice(@PathVariable("eventName") String eventName,
108
108
@ PathVariable ("reservationId" ) String reservationId ,
109
109
HttpServletResponse response ) {
110
110
handleReservationWith (eventName , reservationId , response , (event , reservation ) -> {
111
- if (reservation .getInvoiceNumber () == null ) {
111
+ if (reservation .getInvoiceNumber () == null || ! reservation . getHasInvoiceOrReceiptDocument () ) {
112
112
return ResponseEntity .notFound ().build ();
113
113
}
114
114
0 commit comments