add bonuspoint option for checkout

This commit is contained in:
CodeSteak 2020-01-26 13:55:23 +01:00
parent b25a9842e4
commit 62324e4760
2 changed files with 24 additions and 26 deletions

View File

@ -29,17 +29,10 @@ public class RequestController {
}
@PostMapping("/login")
public String loginPost(HttpServletResponse response, @RequestParam(value = "goto", required = false) String gto) {
public String loginPost(HttpServletResponse response) {
response.addCookie(new Cookie("login", "true"));
System.out.println(gto);
if (gto != null && gto.startsWith("/")) {
return "redirect:" + gto;
} else {
return "redirect:/";
}
}
@PostMapping("/logout")
public String logoutPost(HttpServletResponse response) {
@ -82,12 +75,8 @@ public class RequestController {
}
@PostMapping("/shop/articles/{id}")
public String shopArticlesByIdBuy(@RequestAttribute("customer") Boolean isCustomer, @PathVariable("id") Integer id) {
if (isCustomer) {
public String shopArticlesByIdBuy(HttpServletResponse response) {
return "redirect:/shop/checkout";
} else {
return "redirect:/login?goto=%2Fshop%2Farticles%2F"+id;
}
}
@GetMapping("/user/")

View File

@ -132,10 +132,14 @@ Musterstraße 42
<div>
<h2>Zahlung:</h2>
<fieldset>
<input type="radio" name="type" value="priv" id="payment-card" required selected>
<input type="radio" name="type" value="priv" id="payment-card" required checked>
<label for="payment-card">Kartenzahlung</label> <br />
<input class="full-width" type="text" id="cardnumber" name="cardnumber" placeholder="Kartennummer" required />
</fieldset>
<fieldset>
<input class="" type="checkbox" id="bonus" name="bonus" checked/>
<label for="bonus"><h3>10 gesammelte Bonuspunkte verwenden</h3></label>
</fieldset>
</div>
<div>
<h2>Bestellübersicht</h2>
@ -145,6 +149,10 @@ Musterstraße 42
<th>Artikel (Netto)</th>
<th>200,29 €</th>
</tr>
<tr>
<th>Bonuspunkte</th>
<th>-5,00 €</th>
</tr>
<tr>
<th>Umsatzsteuer (19%)</th>
<th>35,00 €</th>
@ -168,4 +176,5 @@ Musterstraße 42
<footer th:replace="/fragments/footer :: footer"></footer>
</body>
</html>