TavernerPOS - Source Code

Clone: 

git clone http://www.librarysmith.co.uk/tavernerPOS

 

Index » tavernerPOS : Commitdiff 321825

Add option to automatically fill in Card Authorisation Code with timestamp for external card terminals

Matt Smith [16-01-10 14:40]
Add option to automatically fill in Card Authorisation Code with timestamp for external card terminals
diff --git a/i18n/messages.properties b/i18n/messages.properties
index c562257..0dbef94 100755
--- a/i18n/messages.properties
+++ b/i18n/messages.properties
@@ -4,7 +4,6 @@ _BaseRootDAO.3=The session factory for '
 _BaseRootDAO.4=' has not been initialized (or an error occured during initialization)
 #Eclipse messages class
 #Sun Mar 15 23:57:09 BDT 2015 TEST
-
 _BaseRootDAO.0=The session factory has not been initialized (or an error occurred during initialization)
 LoginPasswordEntryView.13=LOGIN
 LoginPasswordEntryView.14=ENTER SECRET KEY
@@ -1308,6 +1307,7 @@ BARMOD_AutoTerminalID.1=Automatically set Terminal ID based on last 9 decimal di
 BARMOD_AutoCloseSummary=Enable auto close summary
 BARMOD_AutoCloseSummaryTime=Auto close summary time
 BARMOD_AutoOpenTakeOutTicket=Automatically Open New TAKE OUT (Bar Sale) Ticket on Login (if no existing tickets are present)
+BARMOD_AutoFillCardAuth=Automatically Fill Authorization Code with Time Stamp
 DATETIMEFORMAT=M/d/yy, h:mm a
 DATEFORMAT=dd MMM, yyyy
 DATELONGFORMAT=MMM dd yyyy, h:mm a
diff --git a/i18n/messages_ar.properties b/i18n/messages_ar.properties
index eea68c4..8149622 100755
--- a/i18n/messages_ar.properties
+++ b/i18n/messages_ar.properties
@@ -360,6 +360,7 @@ BARMOD_AutoTerminalID.1=Automatically set Terminal ID based on last 9 decimal di
 BARMOD_AutoCloseSummary=Enable auto close summary
 BARMOD_AutoCloseSummaryTime=Auto close summary time
 BARMOD_AutoOpenTakeOutTicket=Automatically Open New TAKE OUT (Bar Sale) Ticket on Login (if no existing tickets are present)
+BARMOD_AutoFillCardAuth=Automatically Fill Authorization Code with Time Stamp
 DATETIMEFORMAT=d/M/yy, h:mm a
 DATEFORMAT=dd MMM, yyyy
 DATELONGFORMAT=MMM dd yyyy, h:mm a
diff --git a/i18n/messages_ar_EG.properties b/i18n/messages_ar_EG.properties
index 6e5a0fb..85aa6e0 100755
--- a/i18n/messages_ar_EG.properties
+++ b/i18n/messages_ar_EG.properties
@@ -357,6 +357,7 @@ BARMOD_AutoTerminalID.1=Automatically set Terminal ID based on last 9 decimal di
 BARMOD_AutoCloseSummary=Enable auto close summary
 BARMOD_AutoCloseSummaryTime=Auto close summary time
 BARMOD_AutoOpenTakeOutTicket=Automatically Open New TAKE OUT (Bar Sale) Ticket on Login (if no existing tickets are present)
+BARMOD_AutoFillCardAuth=Automatically Fill Authorization Code with Time Stamp
 DATETIMEFORMAT=d/M/yy, h:mm a
 DATEFORMAT=dd MMM, yyyy
 DATELONGFORMAT=MMM dd yyyy, h:mm a
diff --git a/i18n/messages_de.properties b/i18n/messages_de.properties
index 0b1a4ba..96b32e2 100755
--- a/i18n/messages_de.properties
+++ b/i18n/messages_de.properties
@@ -393,6 +393,7 @@ BARMOD_AutoTerminalID.1=Automatically set Terminal ID based on last 9 decimal di
 BARMOD_AutoCloseSummary=Enable auto close summary
 BARMOD_AutoCloseSummaryTime=Auto close summary time
 BARMOD_AutoOpenTakeOutTicket=Automatically Open New TAKE OUT (Bar Sale) Ticket on Login (if no existing tickets are present)
+BARMOD_AutoFillCardAuth=Automatically Fill Authorization Code with Time Stamp
 DATETIMEFORMAT=d/M/yy, h:mm a
 DATEFORMAT=dd MMM, yyyy
 DATELONGFORMAT=MMM dd yyyy, h:mm a
diff --git a/i18n/messages_en_GB.properties b/i18n/messages_en_GB.properties
index 72aa9c6..e906742 100755
--- a/i18n/messages_en_GB.properties
+++ b/i18n/messages_en_GB.properties
@@ -1308,6 +1308,7 @@ BARMOD_AutoTerminalID.1=Automatically set Terminal ID based on last 9 decimal di
 BARMOD_AutoCloseSummary=Enable auto close summary
 BARMOD_AutoCloseSummaryTime=Auto close summary time
 BARMOD_AutoOpenTakeOutTicket=Automatically Open New TAKE OUT (Bar Sale) Ticket on Login (if no existing tickets are present)
+BARMOD_AutoFillCardAuth=Automatically Fill Authorisation Code with Time Stamp
 DATETIMEFORMAT=d/M/yy, h:mm a
 DATEFORMAT=dd MMM, yyyy
 DATELONGFORMAT=MMM dd yyyy, h:mm a
diff --git a/i18n/messages_es.properties b/i18n/messages_es.properties
index 0596229..c57e48d 100755
--- a/i18n/messages_es.properties
+++ b/i18n/messages_es.properties
@@ -391,6 +391,7 @@ BARMOD_AutoTerminalID.1=Automatically set Terminal ID based on last 9 decimal di
 BARMOD_AutoCloseSummary=Enable auto close summary
 BARMOD_AutoCloseSummaryTime=Auto close summary time
 BARMOD_AutoOpenTakeOutTicket=Automatically Open New TAKE OUT (Bar Sale) Ticket on Login (if no existing tickets are present)
+BARMOD_AutoFillCardAuth=Automatically Fill Authorization Code with Time Stamp
 DATETIMEFORMAT=d/M/yy, h:mm a
 DATEFORMAT=dd MMM, yyyy
 DATELONGFORMAT=MMM dd yyyy, h:mm a
diff --git a/i18n/messages_nl.properties b/i18n/messages_nl.properties
index 9090da5..1176703 100755
--- a/i18n/messages_nl.properties
+++ b/i18n/messages_nl.properties
@@ -393,6 +393,7 @@ BARMOD_AutoTerminalID.1=Automatically set Terminal ID based on last 9 decimal di
 BARMOD_AutoCloseSummary=Enable auto close summary
 BARMOD_AutoCloseSummaryTime=Auto close summary time
 BARMOD_AutoOpenTakeOutTicket=Automatically Open New TAKE OUT (Bar Sale) Ticket on Login (if no existing tickets are present)
+BARMOD_AutoFillCardAuth=Automatically Fill Authorization Code with Time Stamp
 DATETIMEFORMAT=d/M/yy, h:mm a
 DATEFORMAT=dd MMM, yyyy
 DATELONGFORMAT=MMM dd yyyy, h:mm a
diff --git a/src/com/floreantpos/config/CardConfig.java b/src/com/floreantpos/config/CardConfig.java
old mode 100644
new mode 100755
index a5ec4a9..26764a2
--- a/src/com/floreantpos/config/CardConfig.java
+++ b/src/com/floreantpos/config/CardConfig.java
@@ -112,6 +112,15 @@ public class CardConfig {
 		AppConfig.put(Messages.getString("CardConfig.18"), sandbosMode); //$NON-NLS-1$
 	}

+
+	public static boolean isAutoFillCardAuth() {
+		return AppConfig.getBoolean("AUTO_FILL_CARD_AUTH", true); //$NON-NLS-1$
+	}
+
+	public static void setAutoFillCardAuth(boolean auth) {
+		AppConfig.put("AUTO_FILL_CARD_AUTH", auth); //$NON-NLS-1$
+	}
+
 	public static double getBartabLimit() {
 		try {
 			return Double.parseDouble(AppConfig.getString(Messages.getString("CardConfig.19"), Messages.getString("CardConfig.20"))); //$NON-NLS-1$ //$NON-NLS-2$
diff --git a/src/com/floreantpos/config/ui/CardConfigurationView.java b/src/com/floreantpos/config/ui/CardConfigurationView.java
old mode 100644
new mode 100755
index 07d7d19..5ae225f
--- a/src/com/floreantpos/config/ui/CardConfigurationView.java
+++ b/src/com/floreantpos/config/ui/CardConfigurationView.java
@@ -28,6 +28,7 @@ public class CardConfigurationView extends ConfigurationView {
 	private JComboBox cbCardReader;
 	private JPasswordField tfMerchantPass;
 	private JCheckBox cbSandboxMode;
+	private JCheckBox cbAutoFillCardAuth;
 	private JCheckBox chckbxAllowMagneticSwipe;
 	private JCheckBox chckbxAllowCardManual;
 	private JCheckBox chckbxAllowExternalTerminal;
@@ -63,6 +64,7 @@ public class CardConfigurationView extends ConfigurationView {
 			}
 		});
 		add(chckbxAllowExternalTerminal, "cell 0 2 2 1"); //$NON-NLS-1$
+

 		JLabel lblMagneticCardReader = new JLabel(Messages.getString("CardConfigurationView.9")); //$NON-NLS-1$
 		add(lblMagneticCardReader, "cell 0 3,alignx leading"); //$NON-NLS-1$
@@ -116,11 +118,19 @@ public class CardConfigurationView extends ConfigurationView {
 		cbSandboxMode = new JCheckBox(Messages.getString("CardConfigurationView.25")); //$NON-NLS-1$
 		add(cbSandboxMode, "cell 1 7"); //$NON-NLS-1$

+
+
+
 		JSeparator separator = new JSeparator(JSeparator.HORIZONTAL);
 		add(separator, "newline, growx, span 10, wrap"); //$NON-NLS-1$

 		add(new JLabel(Messages.getString("CardConfigurationView.28"))); //$NON-NLS-1$
 		add(tfBarTabLimit);
+
+		JSeparator separator1 = new JSeparator(JSeparator.HORIZONTAL);
+		add(separator1, "newline, growx, span 10, wrap"); //$NON-NLS-1$
+		cbAutoFillCardAuth = new JCheckBox(Messages.getString("BARMOD_AutoFillCardAuth")); //$NON-NLS-1$
+		add(cbAutoFillCardAuth); //$NON-NLS-1$
 	}

 	protected void updateCheckBoxes() {
@@ -130,10 +140,12 @@ public class CardConfigurationView extends ConfigurationView {
 		}
 		else if(selectedItem == CardReader.MANUAL) {
 			chckbxAllowCardManual.setSelected(true);
+
 		}
 		else if(selectedItem == CardReader.EXTERNAL_TERMINAL) {
 			chckbxAllowExternalTerminal.setSelected(true);
 		}
+
 	}

 	protected void updateCardList() {
@@ -188,6 +200,8 @@ public class CardConfigurationView extends ConfigurationView {
 			tfMerchantPass.setEnabled(false);
 			cbSandboxMode.setEnabled(false);
 		}
+
+		if (chckbxAllowExternalTerminal.isSelected()) cbAutoFillCardAuth.setEnabled(true); else cbAutoFillCardAuth.setEnabled(false);
 	}

 	private DefaultComboBoxModel<CardReader> createComboBoxModel(Vector items) {
@@ -215,8 +229,11 @@ public class CardConfigurationView extends ConfigurationView {

 		CardConfig.setSandboxMode(cbSandboxMode.isSelected());

+		CardConfig.setAutoFillCardAuth(cbAutoFillCardAuth.isSelected());
+
 		CardConfig.setBartabLimit(tfBarTabLimit.getDouble());

+
 		return true;
 	}

@@ -243,6 +260,7 @@ public class CardConfigurationView extends ConfigurationView {
 		}

 		cbSandboxMode.setSelected(CardConfig.isSandboxMode());
+		cbAutoFillCardAuth.setSelected(CardConfig.isAutoFillCardAuth());
 		tfBarTabLimit.setText(String.valueOf(CardConfig.getBartabLimit()));

 		updateCardList();
diff --git a/src/com/floreantpos/ui/views/payment/AuthorizationCodeDialog.java b/src/com/floreantpos/ui/views/payment/AuthorizationCodeDialog.java
old mode 100644
new mode 100755
index c599503..cb95f8e
--- a/src/com/floreantpos/ui/views/payment/AuthorizationCodeDialog.java
+++ b/src/com/floreantpos/ui/views/payment/AuthorizationCodeDialog.java
@@ -18,6 +18,9 @@ import com.floreantpos.swing.QwertyKeyPad;
 import com.floreantpos.ui.TitlePanel;
 import com.floreantpos.ui.dialog.POSDialog;

+import java.sql.Timestamp;
+import java.util.Date;
+
 public class AuthorizationCodeDialog extends POSDialog implements CardInputter {
 	private CardInputListener cardInputListener;
 	private FocusedTextField tfAuthorizationCode;
@@ -45,6 +48,12 @@ public class AuthorizationCodeDialog extends POSDialog implements CardInputter {
 		tfAuthorizationCode.setColumns(12);
 		panel.add(tfAuthorizationCode, "cell 1 0,growx"); //$NON-NLS-1$

+		if (com.floreantpos.config.CardConfig.isAutoFillCardAuth()) {
+		 java.util.Date date= new java.util.Date();
+		 String timeStamp = new Timestamp(date.getTime()).toString();
+		 tfAuthorizationCode.setText(timeStamp.replace(' ', '_'));
+		}
+
 		QwertyKeyPad qwertyKeyPad = new QwertyKeyPad();
 		panel.add(qwertyKeyPad, "cell 0 1 2 1,grow"); //$NON-NLS-1$

Add comment
These comments are moderated so so won't be published until reviewed.