use of alfio.manager.support.PartialTicketPDFGenerator in project alf.io by alfio-event.
the class DataMigratorIntegrationTest method testUpdateGender.
@Test
public void testUpdateGender() {
List<TicketCategoryModification> categories = Collections.singletonList(new TicketCategoryModification(null, "default", AVAILABLE_SEATS, new DateTimeModification(LocalDate.now(), LocalTime.now()), new DateTimeModification(LocalDate.now(), LocalTime.now()), DESCRIPTION, BigDecimal.TEN, false, "", false, null, null, null, null, null));
Pair<Event, String> eventUsername = initEvent(categories);
Event event = eventUsername.getKey();
try {
TicketReservationModification trm = new TicketReservationModification();
trm.setAmount(2);
trm.setTicketCategoryId(eventManager.loadTicketCategories(event).get(0).getId());
TicketReservationWithOptionalCodeModification r = new TicketReservationWithOptionalCodeModification(trm, Optional.empty());
Date expiration = DateUtils.addDays(new Date(), 1);
String reservationId = ticketReservationManager.createTicketReservation(event, Collections.singletonList(r), Collections.emptyList(), expiration, Optional.empty(), Optional.empty(), Locale.ENGLISH, false);
ticketReservationManager.confirm("TOKEN", null, event, reservationId, "email@email.ch", new CustomerName("Full Name", "Full", "Name", event), Locale.ENGLISH, null, new TotalPrice(1000, 10, 0, 0), Optional.empty(), Optional.of(PaymentProxy.ON_SITE), false, null, null, null);
List<Ticket> tickets = ticketRepository.findTicketsInReservation(reservationId);
UpdateTicketOwnerForm first = new UpdateTicketOwnerForm();
first.setEmail("email@email.ch");
// first.setTShirtSize("SMALL");
// first.setGender("F");
first.setFirstName("Full");
first.setLastName("Name");
UpdateTicketOwnerForm second = new UpdateTicketOwnerForm();
// second.setTShirtSize("SMALL-F");
second.setEmail("email@email.ch");
second.setFirstName("Full");
second.setLastName("Name");
PartialTicketPDFGenerator generator = TemplateProcessor.buildPartialPDFTicket(Locale.ITALIAN, event, ticketReservationManager.findById(reservationId).get(), ticketCategoryRepository.getByIdAndActive(tickets.get(0).getCategoryId(), event.getId()), organizationRepository.getById(event.getOrganizationId()), templateManager, fileUploadManager, "");
ticketReservationManager.updateTicketOwner(tickets.get(0), Locale.ITALIAN, event, first, (t) -> "", (t) -> "", Optional.empty());
ticketReservationManager.updateTicketOwner(tickets.get(1), Locale.ITALIAN, event, second, (t) -> "", (t) -> "", Optional.empty());
// FIXME
// dataMigrator.fillTicketsGender();
// ticketRepository.findTicketsInReservation(reservationId).forEach(t -> assertEquals("F", t.getGender()));
} finally {
eventManager.deleteEvent(event.getId(), eventUsername.getValue());
}
}
Aggregations