Ejemplo n.º 1
0
 @RequestMapping(
     value = "/events/{eventName}/pending-payments/{reservationId}/confirm",
     method = POST)
 public String confirmPayment(
     @PathVariable("eventName") String eventName,
     @PathVariable("reservationId") String reservationId,
     Principal principal,
     Model model,
     HttpServletRequest request) {
   ticketReservationManager.confirmOfflinePayment(loadEvent(eventName, principal), reservationId);
   ticketReservationManager
       .findById(reservationId)
       .filter(TicketReservation::isDirectAssignmentRequested)
       .ifPresent(
           reservation ->
               ticketHelper.directTicketAssignment(
                   eventName,
                   reservationId,
                   reservation.getEmail(),
                   reservation.getFullName(),
                   reservation.getFirstName(),
                   reservation.getLastName(),
                   reservation.getUserLanguage(),
                   Optional.empty(),
                   request,
                   model));
   return OK;
 }
Ejemplo n.º 2
0
  @RequestMapping(value = "/events/{eventName}/pending-payments/bulk-confirmation", method = POST)
  public List<Triple<Boolean, String, String>> bulkConfirmation(
      @PathVariable("eventName") String eventName,
      Principal principal,
      @RequestBody UploadBase64FileModification file)
      throws IOException {

    try (InputStreamReader isr = new InputStreamReader(file.getInputStream());
        CSVReader reader = new CSVReader(isr)) {
      Event event = loadEvent(eventName, principal);
      return reader
          .readAll()
          .stream()
          .map(
              line -> {
                String reservationID = null;
                try {
                  Validate.isTrue(line.length >= 2);
                  reservationID = line[0];
                  ticketReservationManager.validateAndConfirmOfflinePayment(
                      reservationID, event, new BigDecimal(line[1]));
                  return Triple.of(Boolean.TRUE, reservationID, "");
                } catch (Exception e) {
                  return Triple.of(
                      Boolean.FALSE, Optional.ofNullable(reservationID).orElse(""), e.getMessage());
                }
              })
          .collect(Collectors.toList());
    }
  }
Ejemplo n.º 3
0
 @RequestMapping(value = "/events/{eventName}/pending-payments/{reservationId}", method = DELETE)
 public String deletePendingPayment(
     @PathVariable("eventName") String eventName,
     @PathVariable("reservationId") String reservationId,
     Principal principal) {
   ticketReservationManager.deleteOfflinePayment(
       loadEvent(eventName, principal), reservationId, false);
   return OK;
 }
Ejemplo n.º 4
0
 @RequestMapping(value = "/events/{eventName}/pending-payments")
 public List<SerializablePair<TicketReservation, OrderSummary>> getPendingPayments(
     @PathVariable("eventName") String eventName, Principal principal) {
   return ticketReservationManager
       .getPendingPayments(
           eventStatisticsManager.getSingleEventWithStatistics(eventName, principal.getName()))
       .stream()
       .map(SerializablePair::fromPair)
       .collect(Collectors.toList());
 }