falta el update carrito del backend

This commit is contained in:
2025-10-29 13:31:25 +01:00
parent c272fd7b9b
commit 5e9631073e
17 changed files with 516 additions and 162 deletions

View File

@ -0,0 +1,28 @@
package com.imprimelibros.erp.pedido;
import org.springframework.stereotype.Service;
@Service
public class PedidoService {
public int hasDescuentoFidelidad() {
// 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 && totalGastado < 9999) {
return 5;
} else if(totalGastado >= 10000) {
return 6;
}
return 0;
}
}