Search in sources :

Example 11 with PaymentResult

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());
}
Also used : PaymentResult(alfio.manager.support.PaymentResult) Test(org.junit.Test)

Example 12 with PaymentResult

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;
}
Also used : PaymentResult(alfio.manager.support.PaymentResult)

Aggregations

PaymentResult (alfio.manager.support.PaymentResult)12 Test (org.junit.Test)9 ZonedDateTime (java.time.ZonedDateTime)4 LocalDate (java.time.LocalDate)3 DateTimeModification.fromZonedDateTime (alfio.model.modification.DateTimeModification.fromZonedDateTime)2 PaymentProxy (alfio.model.transaction.PaymentProxy)2 Triple (org.apache.commons.lang3.tuple.Triple)2 TestConfiguration (alfio.TestConfiguration)1 DataSourceConfiguration (alfio.config.DataSourceConfiguration)1 Initializer (alfio.config.Initializer)1 RepositoryConfiguration (alfio.config.RepositoryConfiguration)1 UserManager (alfio.manager.user.UserManager)1 alfio.model (alfio.model)1 alfio.model.modification (alfio.model.modification)1 alfio.repository (alfio.repository)1 ConfigurationRepository (alfio.repository.system.ConfigurationRepository)1 OrganizationRepository (alfio.repository.user.OrganizationRepository)1 IntegrationTestUtil (alfio.test.util.IntegrationTestUtil)1 IOException (java.io.IOException)1 BigDecimal (java.math.BigDecimal)1