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); paymentWindows.add((JPaymentSelectReceipt) window);
} }
} }
return paymentWindows.get(paymentWindows.size()-1); return paymentWindows.get(paymentWindows.size() - 1);
} } else {
else {
ArrayList<JPaymentSelectRefund> paymentWindows = new ArrayList<>(); ArrayList<JPaymentSelectRefund> paymentWindows = new ArrayList<>();
for (Window window : Window.getWindows()) { for (Window window : Window.getWindows()) {
if (window instanceof JPaymentSelectRefund) { if (window instanceof JPaymentSelectRefund) {
paymentWindows.add((JPaymentSelectRefund) window); 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; int timeout = 180;
double roundedValue = RoundUtils.round(payinfo.getTotal()); 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()) { while (AppContext.getIsProcessing() == null || AppContext.getIsProcessing()) {
try { try {
log.info("uniCenta-oPos: waiting for payment to complete ...."); log.info("uniCenta-oPos: waiting for payment to complete ....");
Thread.sleep(1000); Thread.sleep(1000);
timer += 1; timer += 1;
if (timer > timeout) break; if (timer > timeout)
break;
} catch (InterruptedException e) { } catch (InterruptedException e) {
log.error(e.getMessage()); log.error(e.getMessage());
} }
@@ -76,18 +77,16 @@ public class PaymentGatewayMediaPayments implements PaymentGateway {
if (AppContext.getMediaPaymentsPaymentResult() == null) { if (AppContext.getMediaPaymentsPaymentResult() == null) {
payinfo.paymentError("Transaction Error! Please try again", "No Response"); 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.setCardName(AppContext.getMediaPaymentsPaymentResult().getProcessingDetails().getCard().getType());
payinfo.setVerification(AppContext.getMediaPaymentsPaymentResult().getProcessingDetails().getVerificationMethod()); payinfo
.setVerification(AppContext.getMediaPaymentsPaymentResult().getProcessingDetails().getVerificationMethod());
payinfo.setChipAndPin(true); payinfo.setChipAndPin(true);
payinfo.paymentOK( payinfo.paymentOK(
AppContext.getMediaPaymentsPaymentResult().getAdditionalInformation().getRequestId(), AppContext.getMediaPaymentsPaymentResult().getAdditionalInformation().getRequestId(),
AppContext.getMediaPaymentsPaymentResult().getTransactionDetails().getId(), AppContext.getMediaPaymentsPaymentResult().getTransactionDetails().getId(),
AppContext.getMediaPaymentsPaymentResult().getProcessingDetails().getStatus() AppContext.getMediaPaymentsPaymentResult().getProcessingDetails().getStatus());
); } else {
}
else {
String errorMsg = AppContext.getMediaPaymentsPaymentResult().getErrorMessage(); String errorMsg = AppContext.getMediaPaymentsPaymentResult().getErrorMessage();
if (errorMsg == null) { if (errorMsg == null) {
errorMsg = AppContext.getMediaPaymentsPaymentResult().getMessage(); errorMsg = AppContext.getMediaPaymentsPaymentResult().getMessage();