use of alfio.model.transaction.PaymentContext in project alf.io by alfio-event.
the class TicketReservationManagerTest method returnConfiguredWaitingTimeConsideringEventStart.
@Test
void returnConfiguredWaitingTimeConsideringEventStart() {
initOfflinePaymentTest();
when(event.getBegin()).thenReturn(ZonedDateTime.now(ClockProvider.clock()).plusDays(1));
OptionalInt offlinePaymentWaitingPeriod = BankTransferManager.getOfflinePaymentWaitingPeriod(new PaymentContext(event), configurationManager);
Assertions.assertTrue(offlinePaymentWaitingPeriod.isPresent());
Assertions.assertEquals(1, offlinePaymentWaitingPeriod.getAsInt());
}
use of alfio.model.transaction.PaymentContext in project alf.io by alfio-event.
the class TicketReservationManagerTest method returnTheConfiguredWaitingTime.
@Test
void returnTheConfiguredWaitingTime() {
initOfflinePaymentTest();
when(event.getBegin()).thenReturn(ZonedDateTime.now(ClockProvider.clock()).plusDays(3));
OptionalInt offlinePaymentWaitingPeriod = BankTransferManager.getOfflinePaymentWaitingPeriod(new PaymentContext(event), configurationManager);
Assertions.assertTrue(offlinePaymentWaitingPeriod.isPresent());
Assertions.assertEquals(2, offlinePaymentWaitingPeriod.getAsInt());
}
use of alfio.model.transaction.PaymentContext in project alf.io by alfio-event.
the class TicketReservationManagerTest method considerEventBeginDateWhileCalculatingExpDate.
@Test
void considerEventBeginDateWhileCalculatingExpDate() {
initOfflinePaymentTest();
when(event.getBegin()).thenReturn(ZonedDateTime.now(ClockProvider.clock()).plusDays(1));
ZonedDateTime offlinePaymentDeadline = BankTransferManager.getOfflinePaymentDeadline(new PaymentContext(event), configurationManager);
long days = ChronoUnit.DAYS.between(LocalDate.now(ClockProvider.clock()), offlinePaymentDeadline.toLocalDate());
Assertions.assertTrue(LocalDate.now(ClockProvider.clock()).getDayOfWeek() != DayOfWeek.FRIDAY || days == 3, "value must be 3 on Friday");
Assertions.assertTrue(LocalDate.now(ClockProvider.clock()).getDayOfWeek() != DayOfWeek.SATURDAY || days == 2, "value must be 2 on Saturday");
Assertions.assertTrue(!EnumSet.of(DayOfWeek.MONDAY, DayOfWeek.TUESDAY, DayOfWeek.WEDNESDAY, DayOfWeek.THURSDAY).contains(LocalDate.now(ClockProvider.clock()).getDayOfWeek()) || days == 1, "value must be 1 on week days");
}
Aggregations