payment window fix

This commit is contained in:
2023-11-11 15:15:36 +00:00
parent e136c11f27
commit d40880a7c2
@@ -26,6 +26,7 @@ import lombok.extern.slf4j.Slf4j;
import javax.swing.*; import javax.swing.*;
import java.awt.*; import java.awt.*;
import java.util.ArrayList;
@Slf4j @Slf4j
public class PaymentGatewayPaymentSense implements PaymentGateway { public class PaymentGatewayPaymentSense implements PaymentGateway {
@@ -34,13 +35,26 @@ public class PaymentGatewayPaymentSense implements PaymentGateway {
public PaymentGatewayPaymentSense() { public PaymentGatewayPaymentSense() {
} }
Window getPaymentWindow() { Window getPaymentWindow(double amount) {
for (Window window : Window.getWindows()) { if (amount > 0) {
if (window.isActive()) { ArrayList<JPaymentSelectReceipt> paymentWindows = new ArrayList<>();
return window; for (Window window : Window.getWindows()) {
if (window instanceof JPaymentSelectReceipt) {
paymentWindows.add((JPaymentSelectReceipt) window);
}
} }
return paymentWindows.get(paymentWindows.size()-1);
} }
return null; 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);
}
} }
/** /**