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 java.awt.*;
import java.util.ArrayList;
@Slf4j
public class PaymentGatewayPaymentSense implements PaymentGateway {
@@ -34,13 +35,26 @@ public class PaymentGatewayPaymentSense implements PaymentGateway {
public PaymentGatewayPaymentSense() {
}
Window getPaymentWindow() {
for (Window window : Window.getWindows()) {
if (window.isActive()) {
return window;
Window getPaymentWindow(double amount) {
if (amount > 0) {
ArrayList<JPaymentSelectReceipt> paymentWindows = new ArrayList<>();
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);
}
}
/**