-
-
Notifications
You must be signed in to change notification settings - Fork 347
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
#449 - add category info to tickets in invoice
add creation timestamp on reservation
- Loading branch information
Showing
16 changed files
with
138 additions
and
15 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
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
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
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
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 |
---|---|---|
@@ -0,0 +1,37 @@ | ||
/** | ||
* This file is part of alf.io. | ||
* | ||
* alf.io is free software: you can redistribute it and/or modify | ||
* it under the terms of the GNU General Public License as published by | ||
* the Free Software Foundation, either version 3 of the License, or | ||
* (at your option) any later version. | ||
* | ||
* alf.io is distributed in the hope that it will be useful, | ||
* but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
* GNU General Public License for more details. | ||
* | ||
* You should have received a copy of the GNU General Public License | ||
* along with alf.io. If not, see <http://www.gnu.org/licenses/>. | ||
*/ | ||
package alfio.model; | ||
|
||
import lombok.RequiredArgsConstructor; | ||
import lombok.experimental.Delegate; | ||
|
||
@RequiredArgsConstructor | ||
public class TicketWithCategory { | ||
|
||
@Delegate | ||
private final Ticket ticket; | ||
private final TicketCategory category; | ||
|
||
public String getCategoryName() { | ||
return category.getName(); | ||
} | ||
|
||
public TicketCategory getCategory() { | ||
return category; | ||
} | ||
|
||
} |
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
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
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
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
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 |
---|---|---|
|
@@ -205,6 +205,11 @@ private static Ticket sampleTicket() { | |
return sampleTicket("Firstname", "Lastname", "[email protected]"); | ||
} | ||
|
||
private static TicketCategory sampleCategory() { | ||
return new TicketCategory(0, ZonedDateTime.now().minusDays(1), ZonedDateTime.now().plusDays(1), 100, "test category", false, TicketCategory.Status.ACTIVE, | ||
0, true, 100, null, null, null, null, null); | ||
} | ||
|
||
private static Ticket sampleTicket(String firstName, String lastName, String email) { | ||
return new Ticket(0, "597e7e7b-c514-4dcb-be8c-46cf7fe2c36e", ZonedDateTime.now(), 0, "ACQUIRED", 0, | ||
"597e7e7b-c514-4dcb-be8c-46cf7fe2c36e", firstName + " " + lastName, firstName, lastName, email, false, "en", | ||
|
@@ -214,13 +219,15 @@ private static Ticket sampleTicket(String firstName, String lastName, String ema | |
private static TicketReservation sampleTicketReservation() { | ||
return new TicketReservation("597e7e7b-c514-4dcb-be8c-46cf7fe2c36e", new Date(), TicketReservation.TicketReservationStatus.COMPLETE, | ||
"Firstname Lastname", "FirstName", "Lastname", "[email protected]", "billing address", ZonedDateTime.now(), ZonedDateTime.now(), | ||
PaymentProxy.STRIPE, true, null, false, "en", false, null, null, null, "123456", "CH", false, new BigDecimal("8.00"), true); | ||
PaymentProxy.STRIPE, true, null, false, "en", false, null, null, null, "123456", | ||
"CH", false, new BigDecimal("8.00"), true, | ||
ZonedDateTime.now().minusMinutes(1)); | ||
} | ||
|
||
private static Map<String, Object> prepareSampleDataForConfirmationEmail(Organization organization, Event event) { | ||
TicketReservation reservation = sampleTicketReservation(); | ||
Optional<String> vat = Optional.of("VAT-NR"); | ||
List<Ticket> tickets = Collections.singletonList(sampleTicket()); | ||
List<TicketWithCategory> tickets = Collections.singletonList(new TicketWithCategory(sampleTicket(), sampleCategory())); | ||
OrderSummary orderSummary = new OrderSummary(new TotalPrice(1000, 80, 0, 0), | ||
Collections.singletonList(new SummaryRow("Ticket", "10.00", "9.20", 1, "9.20", "9.20", 1000, SummaryRow.SummaryType.TICKET)), false, "10.00", "0.80", false, false, "8", PriceContainer.VatStatus.INCLUDED, "1.00"); | ||
String reservationUrl = "http://your-domain.tld/reservation-url/"; | ||
|
@@ -240,7 +247,7 @@ public static Map<String, Object> prepareModelForConfirmationEmail(Organization | |
Event event, | ||
TicketReservation reservation, | ||
Optional<String> vat, | ||
List<Ticket> tickets, | ||
List<TicketWithCategory> tickets, | ||
OrderSummary orderSummary, | ||
String reservationUrl, | ||
String reservationShortID, | ||
|
@@ -260,8 +267,8 @@ public static Map<String, Object> prepareModelForConfirmationEmail(Organization | |
|
||
model.put("hasRefund", StringUtils.isNotEmpty(orderSummary.getRefundedAmount())); | ||
|
||
ZonedDateTime confirmationTimestamp = Optional.ofNullable(reservation.getConfirmationTimestamp()).orElseGet(ZonedDateTime::now); | ||
model.put("confirmationDate", confirmationTimestamp.withZoneSameInstant(event.getZoneId())); | ||
ZonedDateTime creationTimestamp = Optional.ofNullable(reservation.getCreationTimestamp()).orElseGet(ZonedDateTime::now); | ||
model.put("confirmationDate", creationTimestamp.withZoneSameInstant(event.getZoneId())); | ||
|
||
if (reservation.getValidity() != null) { | ||
model.put("expirationDate", ZonedDateTime.ofInstant(reservation.getValidity().toInstant(), event.getZoneId())); | ||
|
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
20 changes: 20 additions & 0 deletions
20
src/main/resources/alfio/db/HSQLDB/V22_1.15.2__ADD_CREATION_TIMESTAMP.sql
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 |
---|---|---|
@@ -0,0 +1,20 @@ | ||
-- | ||
-- This file is part of alf.io. | ||
-- | ||
-- alf.io is free software: you can redistribute it and/or modify | ||
-- it under the terms of the GNU General Public License as published by | ||
-- the Free Software Foundation, either version 3 of the License, or | ||
-- (at your option) any later version. | ||
-- | ||
-- alf.io is distributed in the hope that it will be useful, | ||
-- but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
-- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
-- GNU General Public License for more details. | ||
-- | ||
-- You should have received a copy of the GNU General Public License | ||
-- along with alf.io. If not, see <http://www.gnu.org/licenses/>. | ||
-- | ||
|
||
alter table tickets_reservation add column creation_ts timestamp with time zone; | ||
|
||
update tickets_reservation set creation_ts = coalesce(confirmation_ts, (select event_time from auditing where reservation_id = id and event_type = 'RESERVATION_CREATE')) |
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
Oops, something went wrong.