-
-
Notifications
You must be signed in to change notification settings - Fork 352
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
initial work on waiting list check #588
- Loading branch information
Showing
1 changed file
with
46 additions
and
4 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -25,10 +25,7 @@ | |
import alfio.controller.api.v2.TranslationsApiController; | ||
import alfio.controller.api.v2.model.EventCode; | ||
import alfio.controller.api.v2.model.Language; | ||
import alfio.controller.form.ContactAndTicketsForm; | ||
import alfio.controller.form.PaymentForm; | ||
import alfio.controller.form.ReservationForm; | ||
import alfio.controller.form.UpdateTicketOwnerForm; | ||
import alfio.controller.form.*; | ||
import alfio.manager.EventManager; | ||
import alfio.manager.EventStatisticsManager; | ||
import alfio.manager.user.UserManager; | ||
|
@@ -37,6 +34,7 @@ | |
import alfio.model.modification.EventModification; | ||
import alfio.model.modification.TicketCategoryModification; | ||
import alfio.model.modification.TicketReservationModification; | ||
import alfio.model.system.ConfigurationKeys; | ||
import alfio.model.transaction.PaymentMethod; | ||
import alfio.model.transaction.PaymentProxy; | ||
import alfio.repository.*; | ||
|
@@ -216,6 +214,12 @@ public void ensureConfiguration() { | |
); | ||
additionalServiceApiController.insert(event.getId(), addServ, new BeanPropertyBindingResult(addServ, "additionalService")); | ||
// | ||
|
||
|
||
// enable reservation list and pre sales | ||
configurationRepository.insertEventLevel(event.getOrganizationId(), event.getId(), ConfigurationKeys.ENABLE_WAITING_QUEUE.getValue(), "true", ""); | ||
configurationRepository.insertEventLevel(event.getOrganizationId(), event.getId(), ConfigurationKeys.ENABLE_PRE_REGISTRATION.getValue(), "true", ""); | ||
// | ||
} | ||
|
||
@Test | ||
|
@@ -336,6 +340,44 @@ public void reservationFlowTest() throws Exception { | |
assertEquals(1, additionalItem.getDescription().size()); | ||
assertEquals("additional title", additionalItem.getTitle().get("en")); | ||
assertEquals("<p>additional desc</p>\n", additionalItem.getDescription().get("en")); | ||
|
||
// check presence of reservation list | ||
assertFalse(items.isWaitingList()); | ||
assertFalse(items.isPreSales()); | ||
// | ||
|
||
// fix dates to enable reservation list | ||
var tc = ticketCategoryRepository.getById(visibleCat.getId()); | ||
ticketCategoryRepository.fixDates(visibleCat.getId(), tc.getInception(event.getZoneId()).plusDays(2), tc.getExpiration(event.getZoneId())); | ||
// | ||
items = eventApiV2Controller.getTicketCategories(event.getShortName(), null, new BindingAwareModelMap(), new MockHttpServletRequest()).getBody(); | ||
assertTrue(items.isWaitingList()); | ||
assertTrue(items.isPreSales()); | ||
// | ||
|
||
var subForm = new WaitingQueueSubscriptionForm(); | ||
subForm.setFirstName("first"); | ||
subForm.setLastName("last"); | ||
subForm.setPrivacyPolicyAccepted(true); | ||
subForm.setTermAndConditionsAccepted(true); | ||
subForm.setUserLanguage(Locale.ENGLISH); | ||
var subRes = eventApiV2Controller.subscribeToWaitingList(event.getShortName(), subForm, new BeanPropertyBindingResult(subForm, "subForm")); | ||
assertEquals(HttpStatus.UNPROCESSABLE_ENTITY, subRes.getStatusCode()); | ||
assertFalse(subRes.getBody().isSuccess()); | ||
assertEquals(1, subRes.getBody().getValidationErrors().size()); | ||
assertEquals("email", subRes.getBody().getValidationErrors().get(0).getFieldName()); | ||
assertEquals("error.email", subRes.getBody().getValidationErrors().get(0).getCode()); | ||
// | ||
|
||
subForm.setEmail("[email protected]"); | ||
//subRes = eventApiV2Controller.subscribeToWaitingList(event.getShortName(), subForm, new BeanPropertyBindingResult(subForm, "subForm")); | ||
//assertEquals(HttpStatus.OK, subRes.getStatusCode()); | ||
//assertTrue(subRes.getBody().isSuccess()); | ||
//assertEquals(0, subRes.getBody().getErrorCount()); | ||
//assertTrue(subRes.getBody().getValue()); | ||
|
||
// | ||
ticketCategoryRepository.fixDates(visibleCat.getId(), tc.getInception(event.getZoneId()).minusDays(2), tc.getExpiration(event.getZoneId())); | ||
} | ||
|
||
// hidden category check | ||
|