package com.imprimelibros.erp.pedido; import org.springframework.stereotype.Service; @Service public class PedidoService { public int getDescuentoFidelizacion() { // descuento entre el 1% y el 6% para clientes fidelidad (mas de 1500€ en el ultimo año) double totalGastado = 1600.0; // Ejemplo, deberías obtenerlo del historial del cliente if(totalGastado < 1200) { return 0; } else if(totalGastado >= 1200 && totalGastado < 1999) { return 1; } else if(totalGastado >= 2000 && totalGastado < 2999) { return 2; } else if(totalGastado >= 3000 && totalGastado < 3999) { return 3; } else if(totalGastado >= 4000 && totalGastado < 4999) { return 4; } else if(totalGastado >= 5000) { return 5; } return 0; } }