I'm trying to create my custom web service and I want to apply a global discount in the cart and recalculate it. I've created a custom addOn for my OCC call, but I'm struggling with the DTO concept and how to implement my method. Basically, the code I use to add a global discount so far is this:
- I'm getting the session cart
- adding a dummy discount
recalculating via the calculation service
applyDiscount(@RequestParam(required = true) Double value) cartService.addGlobalDiscountValue(cartModel, new DiscountValue(“description”, double, value, cartModel.getCurrency().getIsocode())); calculationService.calculateTotals(cartModel, false);
Where should I implement the DTO? Can I use GlobalDiscountRowDTO ? And how to modify the code to be sure I'm using the best practices?
Thanks!
Aucun commentaire:
Enregistrer un commentaire