mirror of
https://git.imnavajas.es/jjimenez/erp-imprimelibros.git
synced 2026-01-13 00:48:49 +00:00
terminado
This commit is contained in:
@ -576,6 +576,42 @@ public class skApiClient {
|
||||
return Boolean.parseBoolean(result);
|
||||
}
|
||||
|
||||
|
||||
public Boolean cancelarPedido(Long pedidoId) {
|
||||
|
||||
String result = performWithRetry(() -> {
|
||||
String url = this.skApiUrl + "api/cancelar-pedido/" + pedidoId;
|
||||
|
||||
HttpHeaders headers = new HttpHeaders();
|
||||
headers.setContentType(MediaType.APPLICATION_JSON);
|
||||
headers.setBearerAuth(authService.getToken());
|
||||
|
||||
HttpEntity<Void> entity = new HttpEntity<>(headers);
|
||||
|
||||
ResponseEntity<String> response = restTemplate.exchange(
|
||||
url,
|
||||
HttpMethod.POST,
|
||||
entity,
|
||||
String.class);
|
||||
|
||||
try {
|
||||
Map<String, Object> responseBody = new ObjectMapper().readValue(
|
||||
response.getBody(),
|
||||
new TypeReference<Map<String, Object>>() {
|
||||
});
|
||||
|
||||
Boolean success = (Boolean) (responseBody.get("success") != null ? responseBody.get("success") : false);
|
||||
|
||||
return success.toString();
|
||||
|
||||
} catch (JsonProcessingException e) {
|
||||
e.printStackTrace();
|
||||
return "false"; // Fallback en caso de error
|
||||
}
|
||||
});
|
||||
return Boolean.parseBoolean(result);
|
||||
}
|
||||
|
||||
/******************
|
||||
* PRIVATE METHODS
|
||||
******************/
|
||||
|
||||
Reference in New Issue
Block a user