From 0860bcecf518fcbebc052def7279e2a2c0c0937c Mon Sep 17 00:00:00 2001 From: buzzcode2007 <73412182+buzz_lightsnack_2007@users.noreply.github.com> Date: Wed, 28 Feb 2024 10:44:04 +0800 Subject: [PATCH] enable finishing payment --- .../tech/iBeans/POSware/Lite/OnPayment.java | 24 +++++++++++-------- .../tech/iBeans/POSware/Lite/payment.java | 14 ++++------- 2 files changed, 18 insertions(+), 20 deletions(-) diff --git a/src/main/java/tech/iBeans/POSware/Lite/OnPayment.java b/src/main/java/tech/iBeans/POSware/Lite/OnPayment.java index 4741e9f..acefe03 100644 --- a/src/main/java/tech/iBeans/POSware/Lite/OnPayment.java +++ b/src/main/java/tech/iBeans/POSware/Lite/OnPayment.java @@ -34,6 +34,8 @@ public class OnPayment extends javax.swing.JDialog { // //GEN-BEGIN:initComponents private void initComponents() { + setModal(true); + java.awt.GridBagConstraints gridBagConstraints; jPanel_information = new javax.swing.JPanel(); @@ -137,16 +139,15 @@ public class OnPayment extends javax.swing.JDialog { public static Boolean display() { /* Display the transaction. */ - dialog_payment.setModal(true); - dialog_payment.addWindowListener(new java.awt.event.WindowAdapter() { - @Override - public void windowClosing(java.awt.event.WindowEvent e) { - // Reflect a cancelled payment. - payment.state = false; - e.getWindow().dispose(); - } - }); - getCompletable(); + dialog_payment.addWindowListener(new java.awt.event.WindowAdapter() { + @Override + public void windowClosing(java.awt.event.WindowEvent e) { + // Reflect a cancelled payment. + payment.state = false; + e.getWindow().dispose(); + } + }); + getCompletable(); dialog_payment.setVisible(true); return(payment.state); }; @@ -190,6 +191,9 @@ public class OnPayment extends javax.swing.JDialog { payment.OK = true; payment.state = true; dispose(); + + // Finish the payment. + payment.finish(); }; }; diff --git a/src/main/java/tech/iBeans/POSware/Lite/payment.java b/src/main/java/tech/iBeans/POSware/Lite/payment.java index a02bfec..918ad13 100644 --- a/src/main/java/tech/iBeans/POSware/Lite/payment.java +++ b/src/main/java/tech/iBeans/POSware/Lite/payment.java @@ -1,10 +1,5 @@ package tech.iBeans.POSware.Lite; -import tech.iBeans.POSware.Lite.receipt.*; - -// Import module -import java.util.*; - public class payment{ public static Float total = null; public static Float change = null; @@ -53,11 +48,10 @@ public class payment{ return(calculate()); }; - public static void log() { - /* Log the payment. - */ - - // TODO add payment processing here. + public static void finish() { + /* Finalize the payment. */ + payment.state = true; + transact.finalise(); }; }; \ No newline at end of file