Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -436,7 +436,8 @@ public ResponseEntity<String> rearrangeCategories(@PathVariable String eventName

private static final String PAYMENT_METHOD = "Payment Method";
private static final String EXTERNAL_REFERENCE = "External Reference";
static final List<String> FIXED_FIELDS = Arrays.asList("ID", "Category", "Event", "Status", "OriginalPrice", "PaidPrice", "Discount", "VAT", "ReservationID", "Full Name", "First Name", "Last Name", "E-Mail", "Locked", "Language", "Confirmation", "Billing Address", "Country Code", "Promo Code","Payment ID", PAYMENT_METHOD, EXTERNAL_REFERENCE);
private static final String RESERVATION_EMAIL_ADDRESS = "Reservation Email address";
static final List<String> FIXED_FIELDS = Arrays.asList("ID", "Category", "Event", "Status", "OriginalPrice", "PaidPrice", "Discount", "VAT", "ReservationID", RESERVATION_EMAIL_ADDRESS, "Full Name", "First Name", "Last Name", "E-Mail", "Locked", "Language", "Confirmation", "Billing Address", "Country Code", "Promo Code","Payment ID", PAYMENT_METHOD, EXTERNAL_REFERENCE);
private static final List<SerializablePair<String, String>> FIXED_PAIRS = FIXED_FIELDS.stream().map(f -> SerializablePair.of(f, f)).collect(toList());
private static final String FISCAL_CODE = "Fiscal Code";
private static final String REFERENCE_TYPE = "Reference Type";
Expand Down Expand Up @@ -499,6 +500,7 @@ private Stream<String[]> exportLines(String eventName, Principal principal, List
if(fields.contains("Discount")) {line.add(MonetaryUtil.centsToUnit(t.getDiscountCts(), currencyCode).toString());}
if(fields.contains("VAT")) {line.add(MonetaryUtil.centsToUnit(t.getVatCts(), currencyCode).toString());}
if(fields.contains("ReservationID")) {line.add(t.getTicketsReservationId());}
if(fields.contains(RESERVATION_EMAIL_ADDRESS)) {line.add(reservation.getEmail());}
if(fields.contains("Full Name")) {line.add(t.getFullName());}
if(fields.contains("First Name")) {line.add(t.getFirstName());}
if(fields.contains("Last Name")) {line.add(t.getLastName());}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -209,6 +209,7 @@ public ResponseEntity<List<DownloadedAttendeesByCategory>> downloadAttendees(@Pa
return new DownloadedAttendeeData(ticket.getFirstName(),
ticket.getLastName(),
ticket.getEmail(),
t.getTicketReservation().getEmail(),
ticket.getUserLanguage(),
Map.of(),
additional,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@ public record DownloadedAttendeeData(
@JsonProperty("firstName") String firstName,
@JsonProperty("lastName") String lastName,
@JsonProperty("email") String email,
@JsonProperty("reservationEmail") String reservationEmail,
@JsonProperty("userLanguage") String userLanguage,
@JsonProperty("metadata") Map<String, String> metadata,
@JsonProperty("additional") Map<String, List<String>> additional,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -113,6 +113,7 @@
private static final String TEST_ATTENDEE_FIRST_NAME = "Attendee";
private static final String TEST_ATTENDEE_LAST_NAME = "Test";
private static final String TEST_ATTENDEE_EMAIL = "attendee@test.com";
private static final String TEST_RESERVATION_EMAIL = "integration-test@test.ch";

@Test
void getAllEventsForExternalInPerson() {
Expand Down Expand Up @@ -191,7 +192,7 @@
mockRequest.addParameter("fields", FIXED_FIELDS.toArray(new String[0]));
MockHttpServletResponse mockResponse = new MockHttpServletResponse();
this.eventApiController.downloadAllTicketsCSV(event.getShortName(), "csv", mockRequest, mockResponse, principal);
String expectedTestAttendeeCsvLine = "\""+foundTicket.getUuid()+"\""+",default,"+"\""+event.getShortName()+"\""+",ACQUIRED,0,0,0,0,"+"\""+foundTicket.getTicketsReservationId()+"\""+",\""+TEST_ATTENDEE_FIRST_NAME+" "+TEST_ATTENDEE_LAST_NAME+"\","+TEST_ATTENDEE_FIRST_NAME+","+TEST_ATTENDEE_LAST_NAME+","+TEST_ATTENDEE_EMAIL+",false,"+TEST_ATTENDEE_USER_LANGUAGE;
String expectedTestAttendeeCsvLine = "\""+foundTicket.getUuid()+"\""+",default,"+"\""+event.getShortName()+"\""+",ACQUIRED,0,0,0,0,"+"\""+foundTicket.getTicketsReservationId()+"\","+TEST_RESERVATION_EMAIL+",\""+TEST_ATTENDEE_FIRST_NAME+" "+TEST_ATTENDEE_LAST_NAME+"\","+TEST_ATTENDEE_FIRST_NAME+","+TEST_ATTENDEE_LAST_NAME+","+TEST_ATTENDEE_EMAIL+",false,"+TEST_ATTENDEE_USER_LANGUAGE;
String returnedCsvContent = mockResponse.getContentAsString().trim().replace("\uFEFF", ""); // remove BOM
assertTrue(returnedCsvContent.startsWith(getExpectedHeaderCsvLine() + "\n" + expectedTestAttendeeCsvLine));
assertTrue(returnedCsvContent.endsWith("\"Billing Address\",,"+TEST_PROMO_CODE+",,," + TEST_ATTENDEE_EXTERNAL_REFERENCE));
Expand Down Expand Up @@ -315,7 +316,7 @@

private AdminReservationModification getTestAdminReservationModification() {
DateTimeModification expiration = DateTimeModification.fromZonedDateTime(ZonedDateTime.now(ClockProvider.clock()).plusDays(1));
AdminReservationModification.CustomerData customerData = new AdminReservationModification.CustomerData("Integration", "Test", "integration-test@test.ch", "Billing Address", "reference", "en", "1234", "CH", null);
AdminReservationModification.CustomerData customerData = new AdminReservationModification.CustomerData("Integration", "Test", TEST_RESERVATION_EMAIL, "Billing Address", "reference", "en", "1234", "CH", null);
var ticketCategoryList = this.ticketCategoryRepository.findAllTicketCategories(event.getId());
AdminReservationModification.Category category = new AdminReservationModification.Category(ticketCategoryList.get(0).getId(), "name", new BigDecimal("100.00"), null);
List<AdminReservationModification.TicketsInfo> ticketsInfoList = Collections.singletonList(new AdminReservationModification.TicketsInfo(category, Collections.singletonList(generateTestAttendee()), true, false));
Expand All @@ -326,8 +327,8 @@
IntegrationTestUtil.ensureMinimalConfiguration(configurationRepository);
List<TicketCategoryModification> categories = List.of(
new TicketCategoryModification(null, "default", TicketCategory.TicketAccessType.INHERIT, AVAILABLE_SEATS,
new DateTimeModification(LocalDate.now(clockProvider().getClock()).minusDays(1), LocalTime.now(clockProvider().getClock())),

Check warning on line 330 in src/test/java/alfio/controller/api/admin/EventApiControllerIntegrationTest.java

View check run for this annotation

SonarQubeCloud / SonarCloud Code Analysis

Do not use the system clock in tests.

See more on https://sonarcloud.io/project/issues?id=alfio-event_alf.io&issues=AZ7R_SwvKgcXX4bOwjPt&open=AZ7R_SwvKgcXX4bOwjPt&pullRequest=1523

Check warning on line 330 in src/test/java/alfio/controller/api/admin/EventApiControllerIntegrationTest.java

View check run for this annotation

SonarQubeCloud / SonarCloud Code Analysis

Do not use the system clock in tests.

See more on https://sonarcloud.io/project/issues?id=alfio-event_alf.io&issues=AZ7R_SwvKgcXX4bOwjPs&open=AZ7R_SwvKgcXX4bOwjPs&pullRequest=1523
new DateTimeModification(LocalDate.now(clockProvider().getClock()).plusDays(1), LocalTime.now(clockProvider().getClock())),

Check warning on line 331 in src/test/java/alfio/controller/api/admin/EventApiControllerIntegrationTest.java

View check run for this annotation

SonarQubeCloud / SonarCloud Code Analysis

Do not use the system clock in tests.

See more on https://sonarcloud.io/project/issues?id=alfio-event_alf.io&issues=AZ7R_SwvKgcXX4bOwjPu&open=AZ7R_SwvKgcXX4bOwjPu&pullRequest=1523

Check warning on line 331 in src/test/java/alfio/controller/api/admin/EventApiControllerIntegrationTest.java

View check run for this annotation

SonarQubeCloud / SonarCloud Code Analysis

Do not use the system clock in tests.

See more on https://sonarcloud.io/project/issues?id=alfio-event_alf.io&issues=AZ7R_SwvKgcXX4bOwjPv&open=AZ7R_SwvKgcXX4bOwjPv&pullRequest=1523
DESCRIPTION, BigDecimal.ZERO, false, "", false, null, null, null, null, null, 0, null, null, AlfioMetadata.empty())
);
return initEvent(categories, organizationRepository, userManager, eventManager, eventRepository, List.of(), format);
Expand All @@ -339,6 +340,7 @@
expectedHeaderCsvLine = expectedHeaderCsvLine.replaceAll("Full Name", "\"Full Name\"");
expectedHeaderCsvLine = expectedHeaderCsvLine.replaceAll("First Name", "\"First Name\"");
expectedHeaderCsvLine = expectedHeaderCsvLine.replaceAll("Last Name", "\"Last Name\"");
expectedHeaderCsvLine = expectedHeaderCsvLine.replaceAll("Reservation Email address", "\"Reservation Email address\"");
expectedHeaderCsvLine = expectedHeaderCsvLine.replaceAll("Billing Address", "\"Billing Address\"");
expectedHeaderCsvLine = expectedHeaderCsvLine.replaceAll("Country Code", "\"Country Code\"");
expectedHeaderCsvLine = expectedHeaderCsvLine.replaceAll("Promo Code", "\"Promo Code\"");
Expand All @@ -356,4 +358,4 @@
void tearDown() {
eventDeleterRepository.deleteAllForEvent(event.getId());
}
}
}