trabajando en la tabla de transferencias

This commit is contained in:
2025-11-05 21:46:54 +01:00
parent a4443763d8
commit c11c34011e
14 changed files with 800 additions and 433 deletions

View File

@ -163,9 +163,9 @@ public class RedsysController {
try {
String idem = "refund-" + paymentId + "-" + amountCents + "-" + UUID.randomUUID();
paymentService.refundViaRedsys(paymentId, amountCents, idem);
return ResponseEntity.ok("Refund solicitado");
return ResponseEntity.ok("{success:true}");
} catch (Exception e) {
return ResponseEntity.badRequest().body("Error refund: " + e.getMessage());
return ResponseEntity.badRequest().body("{success:false, error: '" + e.getMessage() + "'}");
}
}
}

View File

@ -287,10 +287,6 @@ public class RedsysService {
HttpResponse<String> response = httpClient.send(request, HttpResponse.BodyHandlers.ofString());
System.out.println("### Redsys refund REST request:\n" + json);
System.out.println("### HTTP " + response.statusCode());
System.out.println("### Redsys refund REST response:\n" + response.body());
if (response.statusCode() / 100 != 2)
throw new IllegalStateException("HTTP error Redsys refund: " + response.statusCode());
@ -313,8 +309,7 @@ public class RedsysService {
// Decodificar MerchantParameters de la respuesta
Map<String, Object> decoded = decodeMerchantParametersToMap(dsMerchantParametersResp);
System.out.println("### Redsys refund decoded response:\n" + decoded);
String dsResponse = String.valueOf(decoded.get("Ds_Response"));
if (!"0900".equals(dsResponse)) {
throw new IllegalStateException("Devolución rechazada, Ds_Response=" + dsResponse);