mirror of
https://git.imnavajas.es/jjimenez/erp-imprimelibros.git
synced 2026-01-13 08:58:48 +00:00
sistema de pedidos pendientes de pago hechos
This commit is contained in:
@ -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,
|
||||
|
||||
Reference in New Issue
Block a user