UOCL-310: linked refunds working

This commit is contained in:
2026-06-07 11:33:39 +01:00
parent a8ae4ae1d0
commit f7a74dbdda
@@ -41,16 +41,15 @@ public class PaymentGatewayMediaPayments implements PaymentGateway {
paymentWindows.add((JPaymentSelectReceipt) window);
}
}
return paymentWindows.get(paymentWindows.size()-1);
}
else {
return paymentWindows.get(paymentWindows.size() - 1);
} else {
ArrayList<JPaymentSelectRefund> paymentWindows = new ArrayList<>();
for (Window window : Window.getWindows()) {
if (window instanceof JPaymentSelectRefund) {
paymentWindows.add((JPaymentSelectRefund) window);
}
}
return paymentWindows.get(paymentWindows.size()-1);
return paymentWindows.get(paymentWindows.size() - 1);
}
}
@@ -61,14 +60,16 @@ public class PaymentGatewayMediaPayments implements PaymentGateway {
int timeout = 180;
double roundedValue = RoundUtils.round(payinfo.getTotal());
new Application().mediaPaymentsTransaction(roundedValue, getPaymentWindow(roundedValue), roundedValue > 0 ? payinfo.getTransactionID() : null);
new Application().mediaPaymentsTransaction(roundedValue, getPaymentWindow(roundedValue),
payinfo.getTransactionID());
while (AppContext.getIsProcessing() == null || AppContext.getIsProcessing()) {
try {
log.info("uniCenta-oPos: waiting for payment to complete ....");
Thread.sleep(1000);
timer += 1;
if (timer > timeout) break;
if (timer > timeout)
break;
} catch (InterruptedException e) {
log.error(e.getMessage());
}
@@ -76,18 +77,16 @@ public class PaymentGatewayMediaPayments implements PaymentGateway {
if (AppContext.getMediaPaymentsPaymentResult() == null) {
payinfo.paymentError("Transaction Error! Please try again", "No Response");
}
else if ("APPROVED".equals(AppContext.getMediaPaymentsPaymentResult().getProcessingDetails().getStatus())) {
} else if ("APPROVED".equals(AppContext.getMediaPaymentsPaymentResult().getProcessingDetails().getStatus())) {
payinfo.setCardName(AppContext.getMediaPaymentsPaymentResult().getProcessingDetails().getCard().getType());
payinfo.setVerification(AppContext.getMediaPaymentsPaymentResult().getProcessingDetails().getVerificationMethod());
payinfo
.setVerification(AppContext.getMediaPaymentsPaymentResult().getProcessingDetails().getVerificationMethod());
payinfo.setChipAndPin(true);
payinfo.paymentOK(
AppContext.getMediaPaymentsPaymentResult().getAdditionalInformation().getRequestId(),
AppContext.getMediaPaymentsPaymentResult().getTransactionDetails().getId(),
AppContext.getMediaPaymentsPaymentResult().getProcessingDetails().getStatus()
);
}
else {
AppContext.getMediaPaymentsPaymentResult().getProcessingDetails().getStatus());
} else {
String errorMsg = AppContext.getMediaPaymentsPaymentResult().getErrorMessage();
if (errorMsg == null) {
errorMsg = AppContext.getMediaPaymentsPaymentResult().getMessage();