public ResponseService Checkout(Customer customer) { var response = new ShoppingCartResponseService(); try { customerService.CustomerDataValidation(customer); this.customer = customer; shoppingCartService.Checkout(); // Return ok value using the generic return class response.SetOKResponse("Shopping cart started successfully"); return(response); } catch (CustomerValidationExceptions e) { response.SetErrorResponse(e.Message); return(response); } catch (Exception e) { traceLogs.SaveErrorLogs(e); response.SetErrorResponse(); return(response); } }
public ResponseService RemoveProduct(Product product) { var response = new ShoppingCartResponseService(); try { productService.ProductDataValidation(product); shoppingCartService.RemoveProduct(product); // Return ok value using the generic return class response.SetOKResponse("Product remove successfully"); return(response); } catch (ProductsValidationExceptions e) { response.SetErrorResponse(e.Message); return(response); } catch (Exception e) { traceLogs.SaveErrorLogs(e); response.SetErrorResponse("Error removing product from shopping cart"); return(response); } }
public ResponseService GetProducts() { var response = new ShoppingCartResponseService(); try { // Return ok value using the generic return class response.SetProducts(shoppingCartService.GetProducts()); return(response); } catch (Exception e) { traceLogs.SaveErrorLogs(e); response.SetErrorResponse("Error getting product from shopping cart"); return(response); } }