use of com.salesmanager.shop.model.customer.address.Address in project shopizer by shopizer-ecommerce.
the class CustomerAccountController method editAddress.
@PreAuthorize("hasRole('AUTH_CUSTOMER')")
@RequestMapping(value = "/editAddress.html", method = { RequestMethod.GET, RequestMethod.POST })
public String editAddress(final Model model, final HttpServletRequest request, @RequestParam(value = "billingAddress", required = false) Boolean billingAddress) throws Exception {
MerchantStore store = getSessionAttribute(Constants.MERCHANT_STORE, request);
Authentication auth = SecurityContextHolder.getContext().getAuthentication();
Customer customer = null;
if (auth != null && request.isUserInRole("AUTH_CUSTOMER")) {
customer = customerFacade.getCustomerByUserName(auth.getName(), store);
}
if (customer == null) {
return "redirect:/" + Constants.SHOP_URI;
}
Address address = customerFacade.getAddress(customer.getId(), store, billingAddress);
model.addAttribute("address", address);
model.addAttribute("customerId", customer.getId());
StringBuilder template = new StringBuilder().append(ControllerConstants.Tiles.Customer.EditAddress).append(".").append(store.getStoreTemplate());
return template.toString();
}
Aggregations