diff --git a/src/main/java/ch/wisv/events/admin/controller/DashboardSalesExportController.java b/src/main/java/ch/wisv/events/admin/controller/DashboardSalesExportController.java index 557836a0..af9804fc 100644 --- a/src/main/java/ch/wisv/events/admin/controller/DashboardSalesExportController.java +++ b/src/main/java/ch/wisv/events/admin/controller/DashboardSalesExportController.java @@ -154,9 +154,6 @@ public static Map aggregateOrders(List map) { - - // String csvContent = "Options:\n" + SalesExportSubmission.toString() + "\n\n"; - // csvContent += "Event;Organized by;Product;Total income;Total amount;VAT rate\n"; StringBuilder csvContent = new StringBuilder("Event;Organized by;Product;Total income;Total amount;VAT rate;price\n"); for (Map.Entry entry : map.entrySet()) { csvContent.append(entry.getValue().eventTitle) diff --git a/src/main/java/ch/wisv/events/core/model/event/Event.java b/src/main/java/ch/wisv/events/core/model/event/Event.java index 642ea4ca..b9df4761 100644 --- a/src/main/java/ch/wisv/events/core/model/event/Event.java +++ b/src/main/java/ch/wisv/events/core/model/event/Event.java @@ -21,7 +21,7 @@ import lombok.Data; import lombok.EqualsAndHashCode; import lombok.Setter; -import org.hibernate.validator.constraints.NotEmpty; +import javax.validation.constraints.NotEmpty; import org.springframework.format.annotation.DateTimeFormat; import org.springframework.format.annotation.DateTimeFormat.ISO; diff --git a/src/main/java/ch/wisv/events/core/service/order/OrderValidationService.java b/src/main/java/ch/wisv/events/core/service/order/OrderValidationService.java index aca52a9d..832db1fe 100644 --- a/src/main/java/ch/wisv/events/core/service/order/OrderValidationService.java +++ b/src/main/java/ch/wisv/events/core/service/order/OrderValidationService.java @@ -29,10 +29,9 @@ public interface OrderValidationService { * @param order of type Order * @param customer of type Customer * - * @throws OrderInvalidException when the Order is invalid for the Customer * @throws OrderExceedCustomerLimitException when Customer limit will be exceeded */ - void assertOrderIsValidForCustomer(Order order, Customer customer) throws OrderInvalidException, OrderExceedCustomerLimitException; + void assertOrderIsValidForCustomer(Order order, Customer customer) throws OrderExceedCustomerLimitException; /** * Assert if an Order is valid to go to the payment process. diff --git a/src/main/java/ch/wisv/events/sales/service/SalesService.java b/src/main/java/ch/wisv/events/sales/service/SalesService.java index 44fd75f3..7976818e 100644 --- a/src/main/java/ch/wisv/events/sales/service/SalesService.java +++ b/src/main/java/ch/wisv/events/sales/service/SalesService.java @@ -1,6 +1,5 @@ package ch.wisv.events.sales.service; -import ch.wisv.events.core.exception.normal.EventNotFoundException; import ch.wisv.events.core.model.customer.Customer; import ch.wisv.events.core.model.event.Event; import ch.wisv.events.core.model.order.Order; @@ -32,5 +31,5 @@ public interface SalesService { * @param event of type Event * @return list of Orders */ - List getAllOrdersByEvent(Event event) throws EventNotFoundException; + List getAllOrdersByEvent(Event event); } diff --git a/src/main/java/ch/wisv/events/webshop/service/PaymentsService.java b/src/main/java/ch/wisv/events/webshop/service/PaymentsService.java index e4997b08..c434b058 100644 --- a/src/main/java/ch/wisv/events/webshop/service/PaymentsService.java +++ b/src/main/java/ch/wisv/events/webshop/service/PaymentsService.java @@ -21,8 +21,7 @@ public interface PaymentsService { * used to process a webhook request made by mollie to signal that the order status has changed. * * @param providerOrderReference reference of the order used by mollie - * @return the updated order */ - Order updateStatusByProviderReference(String providerOrderReference); + void updateStatusByProviderReference(String providerOrderReference); } diff --git a/src/main/java/ch/wisv/events/webshop/service/PaymentsServiceImpl.java b/src/main/java/ch/wisv/events/webshop/service/PaymentsServiceImpl.java index ba509721..63bb17cf 100644 --- a/src/main/java/ch/wisv/events/webshop/service/PaymentsServiceImpl.java +++ b/src/main/java/ch/wisv/events/webshop/service/PaymentsServiceImpl.java @@ -161,15 +161,15 @@ protected PaymentRequest createMolliePaymentRequestFromOrder(Order order) { /** - * updates the order status with the given provider reference. + * updates the order status with the given provider reference. + * * @param providerOrderReference reference of the order used by mollie - * @return the updated order */ @Override - public Order updateStatusByProviderReference(String providerOrderReference) { + public void updateStatusByProviderReference(String providerOrderReference) { try { Order order = orderService.getByChPaymentsReference(providerOrderReference); - return updateOrder(order); + updateOrder(order); } catch (OrderNotFoundException e) { throw new RuntimeException("Order with providerReference " + providerOrderReference + " not found"); } diff --git a/src/test/java/ch/wisv/events/EventsApplicationTest.java b/src/test/java/ch/wisv/events/EventsApplicationTest.java index 1ce2e873..e07e53cd 100644 --- a/src/test/java/ch/wisv/events/EventsApplicationTest.java +++ b/src/test/java/ch/wisv/events/EventsApplicationTest.java @@ -1,13 +1,11 @@ package ch.wisv.events; -import ch.wisv.events.core.exception.runtime.PaymentsConnectionException; import ch.wisv.events.core.model.customer.Customer; import ch.wisv.events.core.model.order.Order; import ch.wisv.events.core.service.auth.AuthenticationService; import ch.wisv.events.core.service.mail.MailService; import ch.wisv.events.utils.LdapGroup; import ch.wisv.events.webshop.service.PaymentsService; -import ch.wisv.events.webshop.service.PaymentsServiceImpl; import com.google.common.collect.ImmutableList; import org.mockito.Mockito; import org.springframework.boot.CommandLineRunner; @@ -69,17 +67,16 @@ public PaymentsService paymentsService() { } @Component - public class TestRunner implements CommandLineRunner { + public static class TestRunner implements CommandLineRunner { /** * Callback used to run the bean. * * @param args incoming main method arguments * - * @throws Exception on error */ @Override - public void run(String... args) throws Exception { + public void run(String... args) { } } diff --git a/src/test/java/ch/wisv/events/admin/controller/DashboardSalesExportControllerTest.java b/src/test/java/ch/wisv/events/admin/controller/DashboardSalesExportControllerTest.java index aabad4b2..024e120d 100644 --- a/src/test/java/ch/wisv/events/admin/controller/DashboardSalesExportControllerTest.java +++ b/src/test/java/ch/wisv/events/admin/controller/DashboardSalesExportControllerTest.java @@ -89,7 +89,7 @@ public void testAggregateOrders() throws Exception { } @Test - public void testGenerateCsvContent() throws Exception { + public void testGenerateCsvContent() { // Mostly test if amounts are correctly rounded to 2 decimals Event event = this.createEvent(); diff --git a/src/test/java/ch/wisv/events/webshop/service/PaymentsServiceImplTest.java b/src/test/java/ch/wisv/events/webshop/service/PaymentsServiceImplTest.java index 6415a838..3773fdd5 100644 --- a/src/test/java/ch/wisv/events/webshop/service/PaymentsServiceImplTest.java +++ b/src/test/java/ch/wisv/events/webshop/service/PaymentsServiceImplTest.java @@ -15,11 +15,9 @@ import ch.wisv.events.core.model.product.Product; import ch.wisv.events.core.service.mail.MailService; import ch.wisv.events.core.service.order.OrderService; -import java.io.IOException; import java.time.LocalDateTime; import java.util.ArrayList; import java.util.List; -import java.util.UUID; import ch.wisv.events.core.util.VatRate; import org.junit.After; @@ -32,7 +30,6 @@ import static org.mockito.Mockito.mock; import static org.mockito.Mockito.when; -import java.math.BigDecimal; import java.util.Optional; /** @@ -85,10 +82,9 @@ public void testGetMollieUrl() throws Exception { /** * Test get payments mollie url with decimals. * - * @throws Exception when something goes wrong */ @Test - public void testCreateMolliePaymentRequestFromOrder() throws Exception { + public void testCreateMolliePaymentRequestFromOrder() { List products = new ArrayList<>(); // Use a product ending on .05 to ensure correct rounding of decimals