use of alfio.manager.support.PaymentResult in project alf.io by alfio-event.
the class WaitingQueueManagerIntegrationTest method testWaitingQueueForUnboundedCategory.
@Test
public void testWaitingQueueForUnboundedCategory() {
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));
Event event = initEvent(categories, organizationRepository, userManager, eventManager, eventRepository).getKey();
TicketCategory unbounded = ticketCategoryRepository.findByEventId(event.getId()).get(0);
TicketReservationModification tr = new TicketReservationModification();
tr.setAmount(AVAILABLE_SEATS);
tr.setTicketCategoryId(unbounded.getId());
TicketReservationWithOptionalCodeModification mod = new TicketReservationWithOptionalCodeModification(tr, Optional.empty());
String reservationId = ticketReservationManager.createTicketReservation(event, Collections.singletonList(mod), Collections.emptyList(), DateUtils.addDays(new Date(), 1), Optional.<String>empty(), Optional.<String>empty(), Locale.ENGLISH, false);
TotalPrice reservationCost = ticketReservationManager.totalReservationCostWithVAT(reservationId);
PaymentResult result = ticketReservationManager.confirm("", null, event, reservationId, "test@test.ch", new CustomerName("Full Name", "Full", "Name", event), Locale.ENGLISH, "", reservationCost, Optional.empty(), Optional.of(PaymentProxy.OFFLINE), false, null, null, null);
assertTrue(result.isSuccessful());
assertEquals(0, eventRepository.findStatisticsFor(event.getId()).getDynamicAllocation());
}
use of alfio.manager.support.PaymentResult in project alf.io by alfio-event.
the class WaitingQueueManagerIntegrationTest method reserveTickets.
private String reserveTickets(Event event, TicketCategory category, int num) {
TicketReservationModification tr = new TicketReservationModification();
tr.setAmount(num);
tr.setTicketCategoryId(category.getId());
TicketReservationWithOptionalCodeModification tcm = new TicketReservationWithOptionalCodeModification(tr, Optional.empty());
String reservationId = ticketReservationManager.createTicketReservation(event, Collections.singletonList(tcm), Collections.emptyList(), DateUtils.addDays(new Date(), 1), Optional.empty(), Optional.empty(), Locale.ENGLISH, false);
TotalPrice reservationCost = ticketReservationManager.totalReservationCostWithVAT(reservationId);
PaymentResult result = ticketReservationManager.confirm("", null, event, reservationId, "test@test.ch", new CustomerName("Full Name", "Full", "Name", event), Locale.ENGLISH, "", reservationCost, Optional.empty(), Optional.of(PaymentProxy.OFFLINE), false, null, null, null);
assertTrue(result.isSuccessful());
return reservationId;
}
Aggregations