Search in sources :

Example 6 with PaymentContext

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());
}
Also used : PaymentContext(alfio.model.transaction.PaymentContext) Test(org.junit.jupiter.api.Test)

Example 7 with PaymentContext

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());
}
Also used : PaymentContext(alfio.model.transaction.PaymentContext) Test(org.junit.jupiter.api.Test)

Example 8 with PaymentContext

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");
}
Also used : PaymentContext(alfio.model.transaction.PaymentContext) Test(org.junit.jupiter.api.Test)

Aggregations

PaymentContext (alfio.model.transaction.PaymentContext)8 Test (org.junit.jupiter.api.Test)6 PaymentProxy (alfio.model.transaction.PaymentProxy)2 AllArgsConstructor (lombok.AllArgsConstructor)2 Log4j2 (lombok.extern.log4j.Log4j2)2 PurchaseContextManager (alfio.manager.PurchaseContextManager)1 TicketReservationManager (alfio.manager.TicketReservationManager)1 MollieWebhookPaymentManager (alfio.manager.payment.MollieWebhookPaymentManager)1 FeeCalculator (alfio.manager.support.FeeCalculator)1 PaymentResult (alfio.manager.support.PaymentResult)1 ConfigurationManager (alfio.manager.system.ConfigurationManager)1 UserManager (alfio.manager.user.UserManager)1 Configurable (alfio.model.Configurable)1 PaymentInformation (alfio.model.PaymentInformation)1 PurchaseContext (alfio.model.PurchaseContext)1 PurchaseContextType (alfio.model.PurchaseContext.PurchaseContextType)1 ConfigurationKeys (alfio.model.system.ConfigurationKeys)1 ConfigurationPathLevel (alfio.model.system.ConfigurationPathLevel)1 PaymentMethod (alfio.model.transaction.PaymentMethod)1 Transaction (alfio.model.transaction.Transaction)1