Skip to content
Snippets Groups Projects
Commit 8bfa916f authored by Mattheo Valcke's avatar Mattheo Valcke
Browse files

end of REST-TP1

parent bc323e2b
No related branches found
No related tags found
No related merge requests found
......@@ -9,7 +9,9 @@ import fr.ulille.iut.tva.service.TauxTva;
import jakarta.ws.rs.GET;
import jakarta.ws.rs.Path;
import jakarta.ws.rs.PathParam;
import jakarta.ws.rs.Produces;
import jakarta.ws.rs.QueryParam;
import jakarta.ws.rs.core.MediaType;
@Path("tva")
public class TvaRessource {
......@@ -45,6 +47,7 @@ public class TvaRessource {
}
@GET
@Path("lestaux")
@Produces({MediaType.APPLICATION_JSON, MediaType.APPLICATION_XML})
public List<InfoTauxDto> getInfoTaux() {
ArrayList<InfoTauxDto> result = new ArrayList<InfoTauxDto>();
for ( TauxTva t : TauxTva.values() ) {
......@@ -53,4 +56,14 @@ public class TvaRessource {
return result;
}
@GET
@Path("details/{taux}")
@Produces({MediaType.APPLICATION_JSON})
public List<InfoTauxDto> getDetail(@PathParam("taux") String taux, @QueryParam("somme") int somme) {
ArrayList<InfoTauxDto> result = new ArrayList<InfoTauxDto>();
result.add(new InfoTauxDto("montantTotal",new CalculTva().calculerMontant(TauxTva.valueOf(taux.toUpperCase()), somme)));
result.add(new InfoTauxDto("montantTva", TauxTva.valueOf(taux.toUpperCase()).taux ));
result.add(new InfoTauxDto("somme", somme));
return result;
}
}
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment