diff --git a/src/main/java/alfio/controller/ReservationController.java b/src/main/java/alfio/controller/ReservationController.java index 9af27480f2..0b7758f1dc 100644 --- a/src/main/java/alfio/controller/ReservationController.java +++ b/src/main/java/alfio/controller/ReservationController.java @@ -320,7 +320,7 @@ public String handleReservation(@PathVariable("eventName") String eventName, bindingResult.reject(ErrorsCode.STEP_2_ORDER_EXPIRED); } final TicketReservationManager.TotalPrice reservationCost = ticketReservationManager.totalReservationCostWithVAT(reservationId); - paymentForm.validate(bindingResult, reservationCost, event.getMultiplePaymentMethods()); + paymentForm.validate(bindingResult, reservationCost, event.getAllowedPaymentProxies()); if (bindingResult.hasErrors()) { SessionUtil.addToFlash(bindingResult, redirectAttributes); return redirectReservation(ticketReservation, eventName, reservationId); diff --git a/src/main/java/alfio/controller/TicketController.java b/src/main/java/alfio/controller/TicketController.java index 5557b20188..28a1a144d2 100644 --- a/src/main/java/alfio/controller/TicketController.java +++ b/src/main/java/alfio/controller/TicketController.java @@ -25,6 +25,7 @@ import alfio.model.Ticket; import alfio.model.TicketCategory; import alfio.model.TicketReservation; +import alfio.model.transaction.PaymentProxy; import alfio.model.user.Organization; import alfio.repository.TicketCategoryRepository; import alfio.repository.user.OrganizationRepository; @@ -84,13 +85,15 @@ public String showTicket(@PathVariable("eventName") String eventName, @PathVaria TicketCategory ticketCategory = ticketCategoryRepository.getById(data.getRight().getCategoryId(), data.getLeft().getId()); Organization organization = organizationRepository.getById(data.getLeft().getOrganizationId()); - + + TicketReservation reservation = data.getMiddle(); model.addAttribute("ticket", data.getRight())// - .addAttribute("reservation", data.getMiddle())// + .addAttribute("reservation", reservation)// .addAttribute("event", data.getLeft())// .addAttribute("ticketCategory", ticketCategory)// .addAttribute("organization", organization)// .addAttribute("ticketEmailSent", ticketEmailSent) + .addAttribute("alreadyPaid", Optional.ofNullable(reservation.getPaymentMethod()).orElse(PaymentProxy.STRIPE) == PaymentProxy.STRIPE) .addAttribute("pageTitle", "show-ticket.header.title"); return "/event/show-ticket"; diff --git a/src/main/java/alfio/controller/form/PaymentForm.java b/src/main/java/alfio/controller/form/PaymentForm.java index f171895eba..98d627ee79 100644 --- a/src/main/java/alfio/controller/form/PaymentForm.java +++ b/src/main/java/alfio/controller/form/PaymentForm.java @@ -24,6 +24,7 @@ import org.springframework.validation.BindingResult; import org.springframework.validation.ValidationUtils; +import java.util.List; import java.util.Objects; import java.util.Optional; @@ -46,11 +47,12 @@ private static void rejectIfOverLength(BindingResult bindingResult, String field } } - public void validate(BindingResult bindingResult, TicketReservationManager.TotalPrice reservationCost, boolean multiplePaymentMethods) { + public void validate(BindingResult bindingResult, TicketReservationManager.TotalPrice reservationCost, List allowedPaymentMethods) { Optional paymentProxyOptional = Optional.ofNullable(paymentMethod); - PaymentProxy paymentProxy = paymentProxyOptional.orElse(PaymentProxy.STRIPE); + PaymentProxy paymentProxy = paymentProxyOptional.filter(allowedPaymentMethods::contains).orElse(PaymentProxy.STRIPE); boolean priceGreaterThanZero = reservationCost.getPriceWithVAT() > 0; + boolean multiplePaymentMethods = allowedPaymentMethods.size() > 1; if (multiplePaymentMethods && priceGreaterThanZero && !paymentProxyOptional.isPresent()) { bindingResult.reject(ErrorsCode.STEP_2_MISSING_PAYMENT_METHOD); } else if (priceGreaterThanZero && (paymentProxy == PaymentProxy.STRIPE && StringUtils.isBlank(stripeToken))) { diff --git a/src/main/java/alfio/controller/support/TemplateProcessor.java b/src/main/java/alfio/controller/support/TemplateProcessor.java index 2a4a5d8480..4d6ed0b9dd 100644 --- a/src/main/java/alfio/controller/support/TemplateProcessor.java +++ b/src/main/java/alfio/controller/support/TemplateProcessor.java @@ -23,6 +23,7 @@ import alfio.model.Ticket; import alfio.model.TicketCategory; import alfio.model.TicketReservation; +import alfio.model.transaction.PaymentProxy; import alfio.model.user.Organization; import alfio.repository.user.OrganizationRepository; import com.google.zxing.WriterException; @@ -33,6 +34,7 @@ import java.util.Base64; import java.util.HashMap; import java.util.Map; +import java.util.Optional; import static alfio.util.TicketUtil.createQRCode; @@ -93,6 +95,7 @@ public static PDFTemplateBuilder buildPDFTicket(HttpServletRequest request, model.put("event", event); model.put("organization", organization); model.put("qrCodeDataUri", "data:image/png;base64," + Base64.getEncoder().encodeToString(createQRCode(qrCodeText))); + model.put("hasBeenPaid", Optional.ofNullable(ticketReservation.getPaymentMethod()).orElse(PaymentProxy.STRIPE) == PaymentProxy.STRIPE); String page = templateManager.render("/alfio/templates/ticket.ms", model, request); diff --git a/src/main/java/alfio/manager/TicketReservationManager.java b/src/main/java/alfio/manager/TicketReservationManager.java index aff2b0d243..6b214286ac 100644 --- a/src/main/java/alfio/manager/TicketReservationManager.java +++ b/src/main/java/alfio/manager/TicketReservationManager.java @@ -229,7 +229,7 @@ public PaymentResult confirm(String gatewayToken, Event event, String reservatio } private void transitionToInPayment(String reservationId, String email, String fullName, String billingAddress) { - int updatedReservation = ticketReservationRepository.updateTicketReservation(reservationId, IN_PAYMENT.toString(), email, fullName, billingAddress, null); + int updatedReservation = ticketReservationRepository.updateTicketReservation(reservationId, IN_PAYMENT.toString(), email, fullName, billingAddress, null, PaymentProxy.STRIPE.toString()); Validate.isTrue(updatedReservation == 1, "expected exactly one updated reservation, got "+updatedReservation); } @@ -278,7 +278,7 @@ private void completeReservation(String reservationId, String email, String full Validate.isTrue(updatedTickets > 0, "no tickets have been updated"); specialPriceRepository.updateStatusForReservation(Collections.singletonList(reservationId), Status.TAKEN.toString()); ZonedDateTime timestamp = ZonedDateTime.now(ZoneId.of("UTC")); - int updatedReservation = ticketReservationRepository.updateTicketReservation(reservationId, TicketReservationStatus.COMPLETE.toString(), email, fullName, billingAddress, timestamp); + int updatedReservation = ticketReservationRepository.updateTicketReservation(reservationId, TicketReservationStatus.COMPLETE.toString(), email, fullName, billingAddress, timestamp, paymentProxy.toString()); Validate.isTrue(updatedReservation == 1, "expected exactly one updated reservation, got " + updatedReservation); } //cleanup unused special price codes... @@ -352,9 +352,15 @@ private int totalVat(List tickets, BigDecimal vat) { } public OrderSummary orderSummaryForReservationId(String reservationId, Event event) { - TotalPrice reservationCost = totalReservationCostWithVAT(reservationId); + TicketReservation reservation = ticketReservationRepository.findReservationById(reservationId); + TotalPrice reservationCost = totalReservationCostWithVAT(reservationId); List summary = extractSummary(reservationId, event); - return new OrderSummary(reservationCost, summary, reservationCost.getPriceWithVAT() == 0, formatCents(reservationCost.getPriceWithVAT()), formatCents(reservationCost.getVAT())); + boolean free = reservationCost.getPriceWithVAT() == 0; + return new OrderSummary(reservationCost, + summary, free, + formatCents(reservationCost.getPriceWithVAT()), formatCents(reservationCost.getVAT()), + reservation.getStatus() == TicketReservationStatus.OFFLINE_PAYMENT, + reservation.getPaymentMethod() == PaymentProxy.ON_SITE); } private List extractSummary(String reservationId, Event event) { diff --git a/src/main/java/alfio/manager/support/OrderSummary.java b/src/main/java/alfio/manager/support/OrderSummary.java index 8c19ac0813..96746b53df 100644 --- a/src/main/java/alfio/manager/support/OrderSummary.java +++ b/src/main/java/alfio/manager/support/OrderSummary.java @@ -28,9 +28,23 @@ public class OrderSummary { private final boolean free; private final String totalPrice; private final String totalVAT; + private final boolean waitingForPayment; + private final boolean cashPayment; /* lol jmustache */ public boolean getFree() { return free; } + + public boolean getWaitingForPayment() { + return waitingForPayment; + } + + public boolean getCashPayment() { + return cashPayment; + } + + public boolean getNotYetPaid() { + return waitingForPayment || cashPayment; + } } diff --git a/src/main/java/alfio/model/Event.java b/src/main/java/alfio/model/Event.java index 62073bbe49..97dbe45e34 100644 --- a/src/main/java/alfio/model/Event.java +++ b/src/main/java/alfio/model/Event.java @@ -173,4 +173,8 @@ public PaymentProxy getFirstPaymentMethod() { return allowedPaymentProxies.get(0);//it is guaranteed that this list is not empty. } + public boolean supportsPaymentMethod(PaymentProxy paymentProxy) { + return allowedPaymentProxies.contains(paymentProxy); + } + } diff --git a/src/main/java/alfio/model/TicketReservation.java b/src/main/java/alfio/model/TicketReservation.java index fe472bcef7..0a0c996b5b 100644 --- a/src/main/java/alfio/model/TicketReservation.java +++ b/src/main/java/alfio/model/TicketReservation.java @@ -17,6 +17,7 @@ package alfio.model; import alfio.datamapper.ConstructorAnnotationRowMapper.Column; +import alfio.model.transaction.PaymentProxy; import lombok.Getter; import java.time.ZonedDateTime; @@ -36,14 +37,16 @@ public enum TicketReservationStatus { private final String email; private final String billingAddress; private final ZonedDateTime confirmationTimestamp; + private final PaymentProxy paymentMethod; public TicketReservation(@Column("id") String id, - @Column("validity") Date validity, - @Column("status") TicketReservationStatus status, - @Column("full_name") String fullName, - @Column("email_address") String email, - @Column("billing_address") String billingAddress, - @Column("confirmation_ts") ZonedDateTime confirmationTimestamp) { + @Column("validity") Date validity, + @Column("status") TicketReservationStatus status, + @Column("full_name") String fullName, + @Column("email_address") String email, + @Column("billing_address") String billingAddress, + @Column("confirmation_ts") ZonedDateTime confirmationTimestamp, + @Column("payment_method") PaymentProxy paymentMethod) { this.id = id; this.validity = validity; this.status = status; @@ -51,7 +54,8 @@ public TicketReservation(@Column("id") String id, this.email = email; this.billingAddress = billingAddress; this.confirmationTimestamp = confirmationTimestamp; - } + this.paymentMethod = paymentMethod; + } public boolean isStuck() { return status == TicketReservationStatus.STUCK; diff --git a/src/main/java/alfio/repository/TicketReservationRepository.java b/src/main/java/alfio/repository/TicketReservationRepository.java index 57852d1ae8..581ebcd8b1 100644 --- a/src/main/java/alfio/repository/TicketReservationRepository.java +++ b/src/main/java/alfio/repository/TicketReservationRepository.java @@ -31,12 +31,12 @@ public interface TicketReservationRepository { @Query("insert into tickets_reservation(id, validity, status) values (:id, :validity, 'PENDING')") int createNewReservation(@Bind("id") String id, @Bind("validity") Date validity); - @Query("update tickets_reservation set status = :status, full_name = :fullName, email_address = :email, billing_address = :billingAddress, confirmation_ts = :timestamp where id = :reservationId") + @Query("update tickets_reservation set status = :status, full_name = :fullName, email_address = :email, billing_address = :billingAddress, confirmation_ts = :timestamp, payment_method = :paymentMethod where id = :reservationId") int updateTicketReservation(@Bind("reservationId") String reservationId, @Bind("status") String status, @Bind("email") String email, @Bind("fullName") String fullName, - @Bind("billingAddress") String billingAddress, @Bind("timestamp") ZonedDateTime timestamp); + @Bind("billingAddress") String billingAddress, @Bind("timestamp") ZonedDateTime timestamp, @Bind("paymentMethod") String paymentMethod); - @Query("update tickets_reservation set validity = :validity, status = 'OFFLINE_PAYMENT', full_name = :fullName, email_address = :email, billing_address = :billingAddress where id = :reservationId") + @Query("update tickets_reservation set validity = :validity, status = 'OFFLINE_PAYMENT', payment_method = 'OFFLINE', full_name = :fullName, email_address = :email, billing_address = :billingAddress where id = :reservationId") int postponePayment(@Bind("reservationId") String reservationId, @Bind("validity") Date validity, @Bind("email") String email, @Bind("fullName") String fullName, @Bind("billingAddress") String billingAddress); diff --git a/src/main/resources/alfio/db/HSQLDB/V8__RESERVATION_PAYMENT_METHOD.sql b/src/main/resources/alfio/db/HSQLDB/V8__RESERVATION_PAYMENT_METHOD.sql new file mode 100644 index 0000000000..6c2c85c755 --- /dev/null +++ b/src/main/resources/alfio/db/HSQLDB/V8__RESERVATION_PAYMENT_METHOD.sql @@ -0,0 +1,18 @@ +-- +-- 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 . +-- + +alter table tickets_reservation add column payment_method VARCHAR(255); \ No newline at end of file diff --git a/src/main/resources/alfio/db/HSQLDB/V8__TEST_DATA.sql b/src/main/resources/alfio/db/HSQLDB/V9__TEST_DATA.sql similarity index 83% rename from src/main/resources/alfio/db/HSQLDB/V8__TEST_DATA.sql rename to src/main/resources/alfio/db/HSQLDB/V9__TEST_DATA.sql index 2fb1ba4cca..a7a0c338fe 100644 --- a/src/main/resources/alfio/db/HSQLDB/V8__TEST_DATA.sql +++ b/src/main/resources/alfio/db/HSQLDB/V9__TEST_DATA.sql @@ -18,7 +18,7 @@ INSERT INTO organization(name, description, email) VALUES ('demo', 'demo organization', 'info@pippobaudo.com'); insert into event(description, short_name, website_url, website_t_c_url, location, latitude, longitude, start_ts, end_ts, regular_price_cts, currency, available_seats, vat_included, vat, allowed_payment_proxies, private_key, org_id, time_zone, image_url) - values('event desc', 'eventname', 'http://localhost:8080', 'http://localhost:8080', 'demo location', '0', '0', '2015-01-10 05:00:00' , '2015-01-11 04:59:00' , 1000, 'CHF', 440, 'true', 8, 'STRIPE', 'alfio-uberall', 0, 'America/New_York', 'http://localhost:8080/resources/images/sample-logo.png'); +values('event desc', 'eventname', 'http://localhost:8080', 'http://localhost:8080', 'demo location', '0', '0', '2015-01-10 05:00:00' , '2015-01-11 04:59:00' , 1000, 'CHF', 440, 'true', 8, 'STRIPE', 'alfio-uberall', 0, 'America/New_York', 'http://localhost:8080/resources/images/sample-logo.png'); insert into ticket_category(inception, expiration, name, description, max_tickets, price_cts, access_restricted, tc_status, event_id) values ('2014-01-10 00:00:00', '2015-10-10 00:00:00', 'Normal', 'Very good category', 2, 0, false, 'ACTIVE', 0), @@ -29,27 +29,27 @@ insert into ticket_category(inception, expiration, name, description, max_ticket insert into tickets_reservation (id, validity, status, full_name, email_address, billing_address) values('abcdefghi', '2014-01-10 00:00:00', 'IN_PAYMENT', 'ciccio', 'cc@cc.uu', null); insert into ticket (uuid, creation, category_id, event_id, status, original_price_cts, paid_price_cts, tickets_reservation_id) - values - - -- free tickets +values + +-- free tickets ('abcdefghilmn', '2014-01-10 00:00:00', 0, 0, 'FREE', 0, 0, null), ('abcdefghilmo', '2014-01-10 00:00:00', 0, 0, 'FREE', 0, 0, null), - - -- paid ticket + +-- paid ticket ('abcdefghilmn41', '2014-01-10 00:00:00', 1, 0, 'FREE', 463, 463, null), ('abcdefghilmn42', '2014-01-10 00:00:00', 1, 0, 'FREE', 463, 463, null), ('abcdefghilmn43', '2014-01-10 00:00:00', 1, 0, 'FREE', 463, 463, null), ('abcdefghilmo44', '2014-01-10 00:00:00', 1, 0, 'FREE', 463, 463, null), - -- stuck reservation +-- stuck reservation ('abcdefghilmo55', '2014-01-10 00:00:00', 1, 0, 'PENDING', 463, 463, 'abcdefghi'), - -- still not in sale +-- still not in sale ('abcdefghilmo45', '2014-01-10 00:00:00', 2, 0, 'FREE', 463, 463, null), - - --expired + +--expired ('abcdefghilmo46', '2014-01-10 00:00:00', 3, 0, 'FREE', 463, 463, null), - - --restricted + +--restricted ('abcdefghilmo47', '2014-01-10 00:00:00', 4, 0, 'FREE', 463, 463, null), ('abcdefghilmo48', '2014-01-10 00:00:00', 4, 0, 'FREE', 463, 463, null), ('abcdefghilmo49', '2014-01-10 00:00:00', 4, 0, 'FREE', 463, 463, null), @@ -60,8 +60,8 @@ insert into special_price (code, price_cts, ticket_category_id, status) values ('424243', 463, 4, 'FREE'), ('424244', 463, 4, 'FREE'), ('424245', 463, 4, 'CANCELLED'); - + insert into configuration (c_key, c_value, description) values - ('STRIPE_SECRET_KEY', 'sk_test_cayJOFUUYF9cWOoMXemJd61Z', 'Stripe''s secret key'), - ('STRIPE_PUBLIC_KEY', 'pk_test_gY3X0UiTgKCeStUG67i2kEFq', 'Stripe''s public key'), - ('BASE_URL', 'http://localhost:8080/', 'Base application url'); + ('STRIPE_SECRET_KEY', 'sk_test_cayJOFUUYF9cWOoMXemJd61Z', 'Stripe''s secret key'), + ('STRIPE_PUBLIC_KEY', 'pk_test_gY3X0UiTgKCeStUG67i2kEFq', 'Stripe''s public key'), + ('BASE_URL', 'http://localhost:8080/', 'Base application url'); diff --git a/src/main/resources/alfio/db/PGSQL/V8__RESERVATION_PAYMENT_METHOD.sql b/src/main/resources/alfio/db/PGSQL/V8__RESERVATION_PAYMENT_METHOD.sql new file mode 100644 index 0000000000..6c2c85c755 --- /dev/null +++ b/src/main/resources/alfio/db/PGSQL/V8__RESERVATION_PAYMENT_METHOD.sql @@ -0,0 +1,18 @@ +-- +-- 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 . +-- + +alter table tickets_reservation add column payment_method VARCHAR(255); \ No newline at end of file diff --git a/src/main/resources/alfio/i18n/application.properties b/src/main/resources/alfio/i18n/application.properties index c163e60e34..cd684a813e 100644 --- a/src/main/resources/alfio/i18n/application.properties +++ b/src/main/resources/alfio/i18n/application.properties @@ -163,7 +163,8 @@ ticket.holder=Holder ticket.type=Type ticket.reference-number=Reference number ticket.order-information=Order information -ticket.order-information-values={0} by {1} +ticket.order-information-values={0} by {1} +ticket.payment-required=You must pay the ticket amount at the entrance desk #mail messages @@ -184,6 +185,7 @@ email.event-reminder-date=on the following date: email.kind-regards=Kind regards, email-ticket.attached=Attached to this email you will find the ticket for the event: {0}. email-confirmation.completed=Your reservation for the event {0} has been completed. You can modify/review it at {1} +email-confirmation.waiting-for-payment=Your order for the event {0} has been placed. Please follow the payment instructions at {1} email-confirmation.reservation-summary=Reservation summary email-confirmation.summary=Category: {0}, Amount: {1}, Subtotal: {2} {3} email-confirmation.order-information=Order information : {0} @@ -207,6 +209,4 @@ reservation-page-waiting.required-steps=In order to confirm your reservation, we reservation-page-waiting.required-steps.1=Transfer the amount of {0} to the following Bank Account\: {1}. You are required to specify {2} as payment reason reservation-page-waiting.required-steps.2=Send us an e-mail ({0}) with the proof of payment reservation-page-waiting.required-steps.3=That''s it! After that you''ll receive a confirmation e-mail. - - -reservation-page-waiting.step1=Your reservation will expire on {0} \ No newline at end of file +reservation.not-yet-paid=WARNING: You must pay the amount of {0} in order to attend the event \ No newline at end of file diff --git a/src/main/resources/alfio/i18n/application_it.properties b/src/main/resources/alfio/i18n/application_it.properties index adb4578ae0..bb9a5abd8b 100644 --- a/src/main/resources/alfio/i18n/application_it.properties +++ b/src/main/resources/alfio/i18n/application_it.properties @@ -147,6 +147,7 @@ ticket.type=Tipo ticket.reference-number=Numero di riferimento ticket.order-information=Informazioni sull''ordine ticket.order-information-values={0} effettuato da {1} +ticket.payment-required=Sei tenuto a pagare il costo del biglietto all''ingresso. #mail messages email.confirmation-email-sent=Email di conferma spedita correttamente. @@ -166,6 +167,7 @@ email.event-reminder-date=in data\: email.kind-regards=A presto, email-ticket.attached=In allegato il biglietto\: {0} email-confirmation.completed=La tua prenotazione per l''evento {0} \u00E8 stata completata con successo. Puoi controllarla/modificarla qui\: {1} +email-confirmation.waiting-for-payment=Il tuo ordine per l''evento {0} \u00E8 stato effettuato con successo. Per favore segui le istruzioni per il pagamento indicate qui\: {1} email-confirmation.reservation-summary=Riepilogo della prenotazione email-confirmation.summary=Categoria\: {0}, Quantit\u00E0\: {1}, Subtotale\: {2} {3} email-confirmation.order-information=Informazioni sull''ordine \: {0} @@ -197,4 +199,5 @@ reservation-page-waiting.title=Pagamento richiesto entro il: {0}entro e non oltre la data indicata sopra. Di seguito cosa ci aspettiamo che tu faccia\: reservation-page-waiting.required-steps.1=Invia l''importo di {0} al conto corrente\: {1} specificando {2} quale causale del pagamento reservation-page-waiting.required-steps.2=Inviaci una e-mail all''indirizzo {0} con la prova di avvenuto trasferimento -reservation-page-waiting.required-steps.3=\u00C8 tutto! Dopo che il pagamento sar\u00E0 verificato, riceverai una e-mail di conferma e potrai scaricare i biglietti. \ No newline at end of file +reservation-page-waiting.required-steps.3=\u00C8 tutto! Dopo che il pagamento sar\u00E0 verificato, riceverai una e-mail di conferma e potrai scaricare i biglietti. +reservation.not-yet-paid=ATTENZIONE: Sei tenuto a saldare l''ammontare di {0} per partecipare all''evento! \ No newline at end of file diff --git a/src/main/resources/alfio/templates/confirmation-email-for-organizer-txt.ms b/src/main/resources/alfio/templates/confirmation-email-for-organizer-txt.ms index 3d74c0f36c..1068a435c7 100644 --- a/src/main/resources/alfio/templates/confirmation-email-for-organizer-txt.ms +++ b/src/main/resources/alfio/templates/confirmation-email-for-organizer-txt.ms @@ -1,7 +1,7 @@ {{ticketReservation.fullName}}<{{ticketReservation.email}}> has completed the reservation {{ticketReservation.id}} for event {{event.shortName}} {{#orderSummary.summary}} -Category: {{name}}, Amount: {{amount}}, Subtotal: {{subTotal}} {{event.currency}}{{/orderSummary.summary}} +Category: {{name}}, Amount: {{amount}}, Subtotal: {{subTotal}} {{event.currency}}, Payment Method: {{ticketReservation.paymentMethod}}{{/orderSummary.summary}} {{^orderSummary.free}}{{^event.vatIncluded}}VAT {{event.vat}}%: {{orderSummary.totalVAT}} {{event.currency}}{{/event.vatIncluded}}{{/orderSummary.free}} diff --git a/src/main/resources/alfio/templates/confirmation-email-txt.ms b/src/main/resources/alfio/templates/confirmation-email-txt.ms index bb27aa2f46..7faae367bb 100644 --- a/src/main/resources/alfio/templates/confirmation-email-txt.ms +++ b/src/main/resources/alfio/templates/confirmation-email-txt.ms @@ -1,6 +1,7 @@ {{#i18n}}email.hello [{{ticketReservation.fullName}}]{{/i18n}} -{{#i18n}}email-confirmation.completed [{{event.shortName}}] [{{reservationUrl}}]{{/i18n}} +{{^orderSummary.waitingForPayment}}{{#i18n}}email-confirmation.completed [{{event.shortName}}] [{{reservationUrl}}]{{/i18n}}{{/orderSummary.waitingForPayment}} +{{#orderSummary.waitingForPayment}}{{#i18n}}email-confirmation.waiting-for-payment [{{event.shortName}}] [{{reservationUrl}}]{{/i18n}}{{/orderSummary.waitingForPayment}} #### {{#i18n}}email-confirmation.reservation-summary{{/i18n}} #### @@ -12,6 +13,8 @@ {{^orderSummary.free}}{{#event.vatIncluded}} {{#i18n}}reservation-page.vat-included [{{event.vat}}]{{/i18n}}: {{orderSummary.totalVAT}} {{event.currency}}{{/event.vatIncluded}}{{/orderSummary.free}} +{{#orderSummary.notYetPaid}}{{#i18n}}reservation.not-yet-paid [{{orderSummary.totalPrice}} {{event.currency}}]{{/i18n}}{{/orderSummary.notYetPaid}} + {{#hasVat}}{{#i18n}}email-confirmation.vatNr [{{vatNr}}]{{/i18n}}{{/hasVat}} {{#i18n}}email-confirmation.order-information [{{ticketReservation.id}}]{{/i18n}} diff --git a/src/main/resources/alfio/templates/ticket.ms b/src/main/resources/alfio/templates/ticket.ms index 404419813d..ebd9461c73 100644 --- a/src/main/resources/alfio/templates/ticket.ms +++ b/src/main/resources/alfio/templates/ticket.ms @@ -79,5 +79,8 @@

+ {{^hasBeenPaid}} +

{{#i18n}}ticket.payment-required{{/i18n}}

+ {{/hasBeenPaid}} \ No newline at end of file diff --git a/src/main/webapp/WEB-INF/templates/event/reservation-page.ms b/src/main/webapp/WEB-INF/templates/event/reservation-page.ms index a2a0c64c52..f66b4593e2 100644 --- a/src/main/webapp/WEB-INF/templates/event/reservation-page.ms +++ b/src/main/webapp/WEB-INF/templates/event/reservation-page.ms @@ -131,6 +131,7 @@ {{#is-payment-method}}[ON_SITE,{{.}}] {{#i18n}}reservation-page.on-site{{/i18n}}{{/is-payment-method}} {{#is-payment-method}}[OFFLINE,{{.}}] {{#i18n}}reservation-page.offline{{/i18n}}{{/is-payment-method}} + {{/event.firstPaymentMethod}} {{/event.multiplePaymentMethods}} {{#event.allowedPaymentProxies}} diff --git a/src/main/webapp/WEB-INF/templates/event/show-ticket.ms b/src/main/webapp/WEB-INF/templates/event/show-ticket.ms index b71a322930..28cb8598c3 100644 --- a/src/main/webapp/WEB-INF/templates/event/show-ticket.ms +++ b/src/main/webapp/WEB-INF/templates/event/show-ticket.ms @@ -23,7 +23,7 @@ - +
{{#i18n}}ticket.date-time{{/i18n}}{{#i18n}}ticket.date-time{{/i18n}} {{#event.sameDay}} {{#i18n}}event-days.same-day @@ -58,7 +58,7 @@

{{#i18n}}ticket.ticket{{/i18n}}

- + @@ -77,6 +77,10 @@

+{{^alreadyPaid}} +

{{#i18n}}ticket.payment-required{{/i18n}}

+{{/alreadyPaid}} +
diff --git a/src/main/webapp/resources/css/application.css b/src/main/webapp/resources/css/application.css index 3056e2b035..8621002949 100644 --- a/src/main/webapp/resources/css/application.css +++ b/src/main/webapp/resources/css/application.css @@ -86,4 +86,9 @@ body { .ticket-counter:before { counter-increment: ticket-counter; content: counter(ticket-counter) -} \ No newline at end of file +} + +.ticket-header-col { + width:150px +} + diff --git a/src/main/webapp/resources/js/event/reservation-page.js b/src/main/webapp/resources/js/event/reservation-page.js index 182e5d00cb..e9e7a8dcad 100644 --- a/src/main/webapp/resources/js/event/reservation-page.js +++ b/src/main/webapp/resources/js/event/reservation-page.js @@ -107,7 +107,9 @@ $form.find('button').prop('disabled', true); var selectedPaymentMethod = $form.find('input[name=paymentMethod]'); - if(selectedPaymentMethod.length === 0 || selectedPaymentMethod.find('[selected]').val() === 'STRIPE') { + if(selectedPaymentMethod.length === 0 || + (selectedPaymentMethod.length === 1 && selectedPaymentMethod.val() === 'STRIPE') || + selectedPaymentMethod.filter(':checked').val() === 'STRIPE') { Stripe.card.createToken($form, stripeResponseHandler); // Prevent the form from submitting with the default action return false; @@ -187,7 +189,7 @@ }); var paymentMethod = $('input[name=paymentMethod]'); - if(paymentMethod.length > 0) { + if(paymentMethod.length > 1) { $('#payment-method-STRIPE').find('input').removeAttr('required'); $('.payment-method-detail').hide(); @@ -196,7 +198,6 @@ $('.payment-method-detail').hide(); $('#payment-method-'+method).show(); if(method === 'STRIPE') { - var inputFields = $('#payment-method-STRIPE').find('input'); inputFields.attr('required', true); inputFields.first().focus();
{{#i18n}}ticket.holder{{/i18n}}{{#i18n}}ticket.holder{{/i18n}} {{ticket.fullName}} <{{ticket.email}}>