diff --git a/src/main/java/ch/wisv/events/core/admin/SalesExportSubmission.java b/src/main/java/ch/wisv/events/core/admin/SalesExportSubmission.java index 08b02ea2..e59bd111 100644 --- a/src/main/java/ch/wisv/events/core/admin/SalesExportSubmission.java +++ b/src/main/java/ch/wisv/events/core/admin/SalesExportSubmission.java @@ -49,7 +49,7 @@ public SalesExportSubmission() { this.month = LocalDate.now().getMonthValue()-1; } - this.includedPaymentMethods = Lists.newArrayList(PaymentMethod.IDEAL, PaymentMethod.SOFORT); + this.includedPaymentMethods = Lists.newArrayList(PaymentMethod.IDEAL, PaymentMethod.SOFORT, PaymentMethod.MOLLIE); this.freeProductsIncluded = false; diff --git a/src/main/java/ch/wisv/events/core/model/order/PaymentMethod.java b/src/main/java/ch/wisv/events/core/model/order/PaymentMethod.java index 882b9118..7ee1cc48 100644 --- a/src/main/java/ch/wisv/events/core/model/order/PaymentMethod.java +++ b/src/main/java/ch/wisv/events/core/model/order/PaymentMethod.java @@ -29,6 +29,11 @@ public enum PaymentMethod { */ SOFORT("sofort", cost -> 1.01089 * cost + 0.3025), + /** + * User paid his order via Mollie. + */ + MOLLIE("mollie", cost -> cost), + /** * User paid his order via another method. */ diff --git a/src/main/java/ch/wisv/events/webshop/controller/WebshopPaymentController.java b/src/main/java/ch/wisv/events/webshop/controller/WebshopPaymentController.java index c480ed4a..d1372429 100644 --- a/src/main/java/ch/wisv/events/webshop/controller/WebshopPaymentController.java +++ b/src/main/java/ch/wisv/events/webshop/controller/WebshopPaymentController.java @@ -86,7 +86,11 @@ public String paymentOverview(Model model, RedirectAttributes redirect, @PathVar ); } - return "webshop/payment/index"; + if (orderService.containsOnlyReservable(order)) { + return "webshop/payment/index"; + } + + return "redirect:/checkout/" + order.getPublicReference() + "/payment/mollie"; } catch (EventsException e) { redirect.addFlashAttribute(MODEL_ATTR_ERROR, e.getMessage()); @@ -117,29 +121,16 @@ public String paymentReservation(RedirectAttributes redirect, @PathVariable Stri } /** - * Payment method using iDeal. - * - * @param redirect of type RedirectAttributes - * @param key of type String - * - * @return String string - */ - @GetMapping("/ideal") - public String paymentIdeal(RedirectAttributes redirect, @PathVariable String key) { - return this.payment(redirect, key, PaymentMethod.IDEAL); - } - - /** - * Payment method using SOFORT. + * Payment method using Mollie. * * @param redirect of type RedirectAttributes * @param key of type String * * @return String string */ - @GetMapping("/sofort") - public String paymentSofort(RedirectAttributes redirect, @PathVariable String key) { - return this.payment(redirect, key, PaymentMethod.SOFORT); + @GetMapping("/mollie") + public String paymentMollie(RedirectAttributes redirect, @PathVariable String key) { + return this.payment(redirect, key, PaymentMethod.MOLLIE); } /** 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 8ab5e02d..bbc7939f 100644 --- a/src/main/java/ch/wisv/events/webshop/service/PaymentsServiceImpl.java +++ b/src/main/java/ch/wisv/events/webshop/service/PaymentsServiceImpl.java @@ -25,7 +25,6 @@ import java.math.BigDecimal; import java.math.RoundingMode; import java.util.HashMap; -import java.util.List; import java.util.Map; import java.util.Optional; @@ -129,14 +128,6 @@ protected PaymentRequest createMolliePaymentRequestFromOrder(Order order) { metadata.put("products", productString); - PaymentMethod method; - - if (order.getPaymentMethod() == ch.wisv.events.core.model.order.PaymentMethod.IDEAL) { - method = PaymentMethod.IDEAL; - } else { - method = PaymentMethod.SOFORT; - } - String returnUrl = clientUri + "/return/" + order.getPublicReference(); String webhookUrl = clientUri + "/api/v1/orders/status"; @@ -148,7 +139,6 @@ protected PaymentRequest createMolliePaymentRequestFromOrder(Order order) { Amount paymentAmount = Amount.builder().value(BigDecimal.valueOf(value).setScale(2, RoundingMode.CEILING)).currency("EUR").build(); return PaymentRequest.builder() - .method(Optional.of(List.of(method))) .amount(paymentAmount) .description("W.I.S.V. 'Christiaan Huygens'") .consumerName(Optional.of(order.getOwner().getName())) diff --git a/src/main/resources/static/images/icon-pay-later.jpg b/src/main/resources/static/images/icon-pay-later.jpg deleted file mode 100644 index 4f9cf4d9..00000000 Binary files a/src/main/resources/static/images/icon-pay-later.jpg and /dev/null differ diff --git a/src/main/resources/static/images/icon-pay-later.png b/src/main/resources/static/images/icon-pay-later.png new file mode 100644 index 00000000..98db2398 Binary files /dev/null and b/src/main/resources/static/images/icon-pay-later.png differ diff --git a/src/main/resources/static/images/icon-pay-now.png b/src/main/resources/static/images/icon-pay-now.png new file mode 100644 index 00000000..9d5acba5 Binary files /dev/null and b/src/main/resources/static/images/icon-pay-now.png differ diff --git a/src/main/resources/templates/webshop/payment/index.html b/src/main/resources/templates/webshop/payment/index.html index 710d3922..b9cef744 100644 --- a/src/main/resources/templates/webshop/payment/index.html +++ b/src/main/resources/templates/webshop/payment/index.html @@ -52,49 +52,18 @@