sistema de pedidos pendientes de pago hechos

This commit is contained in:
2025-12-23 17:41:05 +01:00
parent d4120bb486
commit b94a099e01
15 changed files with 3895 additions and 868 deletions

View File

@ -51,7 +51,7 @@ public class PaymentService {
}
public Payment findFailedPaymentByOrderId(Long orderId) {
return payRepo.findByOrderIdAndStatus(orderId, PaymentStatus.failed)
return payRepo.findFirstByOrderIdAndStatusOrderByIdDesc(orderId, PaymentStatus.failed)
.orElse(null);
}
@ -69,11 +69,17 @@ public class PaymentService {
var node = om.readTree(resp_payload);
Long cartId = null;
Long dirFactId = null;
if (node.has("cartId")) {
cartId = node.get("cartId").asLong();
}
if (node.has("dirFactId")) {
dirFactId = node.get("dirFactId").asLong();
if (node.has("Ds_MerchantData")) {
// format: "Ds_MerchantData": "{"dirFactId":3,"cartId":90}"
String merchantData = node.get("Ds_MerchantData").asText();
merchantData = merchantData.replace(""", "\"");
var mdNode = om.readTree(merchantData);
if (mdNode.has("cartId")) {
cartId = mdNode.get("cartId").asLong();
}
if (mdNode.has("dirFactId")) {
dirFactId = mdNode.get("dirFactId").asLong();
}
}
return Map.of(
"cartId", cartId,