Compare commits
4 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| 4bb441ffe0 | |||
| 725fdabc5e | |||
| 28e29a2396 | |||
| 22236cc1a0 |
@@ -1,18 +0,0 @@
|
|||||||
name: Java CI with Maven
|
|
||||||
|
|
||||||
on: [workflow_dispatch]
|
|
||||||
|
|
||||||
jobs:
|
|
||||||
build:
|
|
||||||
runs-on: ubuntu-latest
|
|
||||||
|
|
||||||
steps:
|
|
||||||
- uses: actions/checkout@v4
|
|
||||||
- name: Set up JDK 11
|
|
||||||
uses: actions/setup-java@v3
|
|
||||||
with:
|
|
||||||
java-version: '11'
|
|
||||||
distribution: 'adopt'
|
|
||||||
cache: maven
|
|
||||||
- name: Build with Maven
|
|
||||||
run: mvn -B package --file pom.xml
|
|
||||||
@@ -6,5 +6,3 @@ nb-configuration.xml
|
|||||||
nbactions.xml
|
nbactions.xml
|
||||||
*.log
|
*.log
|
||||||
docker.sock
|
docker.sock
|
||||||
.DS_Store
|
|
||||||
|
|
||||||
|
|||||||
@@ -4,7 +4,7 @@
|
|||||||
|
|
||||||
<groupId>com.unicenta</groupId>
|
<groupId>com.unicenta</groupId>
|
||||||
<artifactId>unicentaopos</artifactId>
|
<artifactId>unicentaopos</artifactId>
|
||||||
<version>5.1</version>
|
<version>5.0.1</version>
|
||||||
<packaging>jar</packaging>
|
<packaging>jar</packaging>
|
||||||
<properties>
|
<properties>
|
||||||
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
|
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
|
||||||
@@ -145,11 +145,6 @@
|
|||||||
<artifactId>rxtxcomm</artifactId>
|
<artifactId>rxtxcomm</artifactId>
|
||||||
<version>2.2</version>
|
<version>2.2</version>
|
||||||
</dependency>
|
</dependency>
|
||||||
<dependency>
|
|
||||||
<groupId>com.fazecast</groupId>
|
|
||||||
<artifactId>jSerialComm</artifactId>
|
|
||||||
<version>2.9.3</version>
|
|
||||||
</dependency>
|
|
||||||
<dependency>
|
<dependency>
|
||||||
<groupId>org.jpos</groupId>
|
<groupId>org.jpos</groupId>
|
||||||
<artifactId>jpos</artifactId>
|
<artifactId>jpos</artifactId>
|
||||||
@@ -212,7 +207,6 @@
|
|||||||
<artifactId>javacsv</artifactId>
|
<artifactId>javacsv</artifactId>
|
||||||
<version>2.0</version>
|
<version>2.0</version>
|
||||||
</dependency>
|
</dependency>
|
||||||
<!-- https://mvnrepository.com/artifact/org.netbeans.external/AbsoluteLayout -->
|
|
||||||
<dependency>
|
<dependency>
|
||||||
<groupId>org.netbeans.external</groupId>
|
<groupId>org.netbeans.external</groupId>
|
||||||
<artifactId>AbsoluteLayout</artifactId>
|
<artifactId>AbsoluteLayout</artifactId>
|
||||||
@@ -325,7 +319,12 @@
|
|||||||
<dependency>
|
<dependency>
|
||||||
<groupId>com.unicenta</groupId>
|
<groupId>com.unicenta</groupId>
|
||||||
<artifactId>unicenta-plugins</artifactId>
|
<artifactId>unicenta-plugins</artifactId>
|
||||||
<version>1.2.3</version>
|
<version>1.1</version>
|
||||||
|
</dependency>
|
||||||
|
<dependency>
|
||||||
|
<groupId>uk.co.pos_apps</groupId>
|
||||||
|
<artifactId>openbravo</artifactId>
|
||||||
|
<version>1.0-SNAPSHOT</version>
|
||||||
</dependency>
|
</dependency>
|
||||||
<dependency>
|
<dependency>
|
||||||
<groupId>com.gluonhq</groupId>
|
<groupId>com.gluonhq</groupId>
|
||||||
@@ -549,27 +548,34 @@
|
|||||||
<finalName>unicentaopos</finalName>
|
<finalName>unicentaopos</finalName>
|
||||||
</build>
|
</build>
|
||||||
<repositories>
|
<repositories>
|
||||||
<repository>
|
|
||||||
<id>central</id>
|
|
||||||
<url>https://repo1.maven.org/maven2/</url>
|
|
||||||
<layout>default</layout>
|
|
||||||
</repository>
|
|
||||||
<repository>
|
<repository>
|
||||||
<id>charm-glisten</id>
|
<id>charm-glisten</id>
|
||||||
<name>charm-glisten Repository</name>
|
<name>charm-glisten Repository</name>
|
||||||
<url>https://nexus.gluonhq.com/nexus/content/repositories/releases/</url>
|
<url>https://nexus.gluonhq.com/nexus/content/repositories/releases/</url>
|
||||||
<layout>default</layout>
|
<layout>default</layout>
|
||||||
</repository>
|
</repository>
|
||||||
<repository>
|
|
||||||
<id>flatlaf</id>
|
|
||||||
<name>flatlaf</name>
|
|
||||||
<url>https://dev.webswing.org/public/nexus/repository/webswing-3rd-parties//</url>
|
|
||||||
</repository>
|
|
||||||
<repository>
|
<repository>
|
||||||
<id>unicenta-repo</id>
|
<id>unicenta-repo</id>
|
||||||
<url>https://repo.unicenta.org/maven2/</url>
|
<url>https://repo.unicenta.org/maven2/</url>
|
||||||
<layout>default</layout>
|
<layout>default</layout>
|
||||||
</repository>
|
</repository>
|
||||||
|
<repository>
|
||||||
|
<id>central</id>
|
||||||
|
<url>https://repo1.maven.org/maven2/</url>
|
||||||
|
<layout>default</layout>
|
||||||
|
</repository>
|
||||||
|
<!--These are needed for Swing/Netbeans -->
|
||||||
|
<repository>
|
||||||
|
<id>netbeans</id>
|
||||||
|
<name>NetBeans</name>
|
||||||
|
<url>https://netbeans.apidesign.org/maven2/</url>
|
||||||
|
</repository>
|
||||||
|
<!--These are needed for Swing/Netbeans -->
|
||||||
|
<repository>
|
||||||
|
<id>flatlaf</id>
|
||||||
|
<name>flatlaf</name>
|
||||||
|
<url>https://dev.webswing.org/public/nexus/repository/webswing-3rd-parties//</url>
|
||||||
|
</repository>
|
||||||
</repositories>
|
</repositories>
|
||||||
<distributionManagement>
|
<distributionManagement>
|
||||||
<repository>
|
<repository>
|
||||||
|
|||||||
@@ -67,12 +67,12 @@ public class PreparedSentence extends JDBCSentence {
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
*
|
*
|
||||||
* @param session
|
* @param s
|
||||||
* @param sentence
|
* @param sentence
|
||||||
* @param serwrite
|
* @param serwrite
|
||||||
*/
|
*/
|
||||||
public PreparedSentence(Session session, String sentence, SerializerWrite serwrite) {
|
public PreparedSentence(Session s, String sentence, SerializerWrite serwrite) {
|
||||||
this(session, sentence, serwrite, null);
|
this(s, sentence, serwrite, null);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|||||||
@@ -29,14 +29,14 @@ import com.unicenta.basic.BasicException;
|
|||||||
*/
|
*/
|
||||||
public abstract class SentenceExecTransaction implements SentenceExec {
|
public abstract class SentenceExecTransaction implements SentenceExec {
|
||||||
|
|
||||||
private Session session;
|
private Session m_s;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
*
|
*
|
||||||
* @param session
|
* @param s
|
||||||
*/
|
*/
|
||||||
public SentenceExecTransaction(Session session) {
|
public SentenceExecTransaction(Session s) {
|
||||||
this.session = session;
|
m_s = s;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -66,7 +66,7 @@ public abstract class SentenceExecTransaction implements SentenceExec {
|
|||||||
*/
|
*/
|
||||||
public final int exec(final Object params) throws BasicException {
|
public final int exec(final Object params) throws BasicException {
|
||||||
|
|
||||||
Transaction<Integer> t = new Transaction<Integer>(session) {
|
Transaction<Integer> t = new Transaction<Integer>(m_s) {
|
||||||
public Integer transact() throws BasicException{
|
public Integer transact() throws BasicException{
|
||||||
return execInTransaction(params);
|
return execInTransaction(params);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -52,7 +52,6 @@ public class JPanelConfigPayment extends javax.swing.JPanel implements PanelConf
|
|||||||
initPayments("Not defined", new ConfigPaymentPanelEmpty());
|
initPayments("Not defined", new ConfigPaymentPanelEmpty());
|
||||||
initPayments("external", new ConfigPaymentPanelEmpty());
|
initPayments("external", new ConfigPaymentPanelEmpty());
|
||||||
initPayments("PaymentSense", new ConfigPaymentPanelEmpty());
|
initPayments("PaymentSense", new ConfigPaymentPanelEmpty());
|
||||||
initPayments("Teya", new ConfigPaymentPanelEmpty());
|
|
||||||
|
|
||||||
// Lector de tarjetas.
|
// Lector de tarjetas.
|
||||||
jcboCardReader.addItem("Not defined");
|
jcboCardReader.addItem("Not defined");
|
||||||
@@ -278,12 +277,6 @@ public class JPanelConfigPayment extends javax.swing.JPanel implements PanelConf
|
|||||||
emvConfigPanel.setVisible(Boolean.TRUE);
|
emvConfigPanel.setVisible(Boolean.TRUE);
|
||||||
jcboCardReader.setSelectedItem("EMV");
|
jcboCardReader.setSelectedItem("EMV");
|
||||||
jcboCardReader.setEnabled(Boolean.FALSE);
|
jcboCardReader.setEnabled(Boolean.FALSE);
|
||||||
|
|
||||||
}
|
|
||||||
else if (comboValue(jcboPaymentGateway.getSelectedItem()).equals("Teya")) {
|
|
||||||
emvConfigPanel.setVisible(Boolean.FALSE);
|
|
||||||
jcboCardReader.setSelectedItem("EMV");
|
|
||||||
jcboCardReader.setEnabled(Boolean.FALSE);
|
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
emvConfigPanel.setVisible(Boolean.FALSE);
|
emvConfigPanel.setVisible(Boolean.FALSE);
|
||||||
|
|||||||
@@ -358,7 +358,6 @@ public class JPanelConfigPeripheral extends javax.swing.JPanel implements PanelC
|
|||||||
jcboMachineScale.addItem("dialog1");
|
jcboMachineScale.addItem("dialog1");
|
||||||
jcboMachineScale.addItem("mtind221");
|
jcboMachineScale.addItem("mtind221");
|
||||||
jcboMachineScale.addItem("samsungesp");
|
jcboMachineScale.addItem("samsungesp");
|
||||||
jcboMachineScale.addItem("samsungesp-v2");
|
|
||||||
|
|
||||||
jcboSerialScale.addItem("COM1");
|
jcboSerialScale.addItem("COM1");
|
||||||
jcboSerialScale.addItem("COM2");
|
jcboSerialScale.addItem("COM2");
|
||||||
@@ -613,7 +612,6 @@ public class JPanelConfigPeripheral extends javax.swing.JPanel implements PanelC
|
|||||||
if ("casiopd1".equals(sparam) ||
|
if ("casiopd1".equals(sparam) ||
|
||||||
"dialog1".equals(sparam) ||
|
"dialog1".equals(sparam) ||
|
||||||
"samsungesp".equals(sparam) ||
|
"samsungesp".equals(sparam) ||
|
||||||
"samsungesp-v2".equals(sparam) ||
|
|
||||||
"caspdii".equals(sparam) ||
|
"caspdii".equals(sparam) ||
|
||||||
"acompc100".equals(sparam) ||
|
"acompc100".equals(sparam) ||
|
||||||
"averyberkel6720".equals(sparam) ||
|
"averyberkel6720".equals(sparam) ||
|
||||||
@@ -822,7 +820,6 @@ public class JPanelConfigPeripheral extends javax.swing.JPanel implements PanelC
|
|||||||
if ("casiopd1".equals(sMachineScale) ||
|
if ("casiopd1".equals(sMachineScale) ||
|
||||||
"dialog1".equals(sMachineScale) ||
|
"dialog1".equals(sMachineScale) ||
|
||||||
"samsungesp".equals(sMachineScale) ||
|
"samsungesp".equals(sMachineScale) ||
|
||||||
"samsungesp-v2".equals(sMachineScale) ||
|
|
||||||
"caspdii".equals(sMachineScale) ||
|
"caspdii".equals(sMachineScale) ||
|
||||||
"acompc100".equals(sMachineScale) ||
|
"acompc100".equals(sMachineScale) ||
|
||||||
"averyberkel6720".equals(sMachineScale) ||
|
"averyberkel6720".equals(sMachineScale) ||
|
||||||
@@ -2310,7 +2307,6 @@ public class JPanelConfigPeripheral extends javax.swing.JPanel implements PanelC
|
|||||||
if ("casiopd1".equals(jcboMachineScale.getSelectedItem()) ||
|
if ("casiopd1".equals(jcboMachineScale.getSelectedItem()) ||
|
||||||
"dialog1".equals(jcboMachineScale.getSelectedItem()) ||
|
"dialog1".equals(jcboMachineScale.getSelectedItem()) ||
|
||||||
"samsungesp".equals(jcboMachineScale.getSelectedItem()) ||
|
"samsungesp".equals(jcboMachineScale.getSelectedItem()) ||
|
||||||
"samsungesp-v2".equals(jcboMachineScale.getSelectedItem()) ||
|
|
||||||
"caspdii".equals(jcboMachineScale.getSelectedItem())||
|
"caspdii".equals(jcboMachineScale.getSelectedItem())||
|
||||||
"acompc100".equals(jcboMachineScale.getSelectedItem())||
|
"acompc100".equals(jcboMachineScale.getSelectedItem())||
|
||||||
"averyberkel6720".equals(jcboMachineScale.getSelectedItem())||
|
"averyberkel6720".equals(jcboMachineScale.getSelectedItem())||
|
||||||
|
|||||||
@@ -30,7 +30,7 @@ public class AppLocal {
|
|||||||
|
|
||||||
public static final String APP_NAME = "uniCenta oPOS";
|
public static final String APP_NAME = "uniCenta oPOS";
|
||||||
public static final String APP_ID = "unicentaopos";
|
public static final String APP_ID = "unicentaopos";
|
||||||
public static final String APP_VERSION = "5.1";
|
public static final String APP_VERSION = "5.0";
|
||||||
|
|
||||||
private static final LocaleResources m_resources;
|
private static final LocaleResources m_resources;
|
||||||
|
|
||||||
|
|||||||
@@ -61,14 +61,6 @@ public class JRootFrame extends javax.swing.JFrame implements AppMessage {
|
|||||||
initComponents();
|
initComponents();
|
||||||
}
|
}
|
||||||
|
|
||||||
public JRootApp getRootapp() {
|
|
||||||
return m_rootapp;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setRootapp(JRootApp m_rootapp) {
|
|
||||||
this.m_rootapp = m_rootapp;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @param props
|
* @param props
|
||||||
*/
|
*/
|
||||||
@@ -106,7 +98,6 @@ public class JRootFrame extends javax.swing.JFrame implements AppMessage {
|
|||||||
new JFrmConfig(props).setVisible(true); // Show the configuration window.
|
new JFrmConfig(props).setVisible(true); // Show the configuration window.
|
||||||
}
|
}
|
||||||
|
|
||||||
setRootapp(m_rootapp);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|||||||
@@ -58,14 +58,6 @@ public class JRootKiosk extends javax.swing.JFrame implements AppMessage {
|
|||||||
initComponents();
|
initComponents();
|
||||||
}
|
}
|
||||||
|
|
||||||
public JRootApp getRootapp() {
|
|
||||||
return m_rootapp;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setRootapp(JRootApp m_rootapp) {
|
|
||||||
this.m_rootapp = m_rootapp;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
*
|
*
|
||||||
* @param props
|
* @param props
|
||||||
@@ -73,10 +65,6 @@ public class JRootKiosk extends javax.swing.JFrame implements AppMessage {
|
|||||||
*/
|
*/
|
||||||
public void initFrame(AppProperties props) throws IOException {
|
public void initFrame(AppProperties props) throws IOException {
|
||||||
|
|
||||||
String osName = System.getProperty("os.name").toLowerCase();
|
|
||||||
boolean isWindows = osName.startsWith("windows");
|
|
||||||
boolean isMac = osName.startsWith("mac");
|
|
||||||
|
|
||||||
m_OS = new OSValidator();
|
m_OS = new OSValidator();
|
||||||
m_props = props;
|
m_props = props;
|
||||||
|
|
||||||
@@ -96,16 +84,21 @@ public class JRootKiosk extends javax.swing.JFrame implements AppMessage {
|
|||||||
setTitle(AppLocal.APP_NAME + " - " + AppLocal.APP_VERSION);
|
setTitle(AppLocal.APP_NAME + " - " + AppLocal.APP_VERSION);
|
||||||
|
|
||||||
Dimension d = Toolkit.getDefaultToolkit().getScreenSize();
|
Dimension d = Toolkit.getDefaultToolkit().getScreenSize();
|
||||||
if (isMac) {
|
|
||||||
setBounds(0, 25, d.width, d.height - 25);
|
|
||||||
}
|
|
||||||
else {
|
|
||||||
setBounds(0, 0, d.width, d.height);
|
setBounds(0, 0, d.width, d.height);
|
||||||
}
|
|
||||||
|
|
||||||
GraphicsDevice device = GraphicsEnvironment.getLocalGraphicsEnvironment().getDefaultScreenDevice();
|
/*
|
||||||
|
* 4 Sep 17 JG
|
||||||
|
* 2 Dec 17 - Mod' Thanks Hayk Sokolov!
|
||||||
|
* Change here for Linux/Ubuntu full screen
|
||||||
|
* Thanks to Hans Lengerke for solution
|
||||||
|
*/
|
||||||
|
String osName = System.getProperty("os.name").toLowerCase();
|
||||||
|
boolean isWindows = osName.startsWith("windows");
|
||||||
|
|
||||||
if (device.isFullScreenSupported() && !isWindows && !isMac) {
|
GraphicsDevice device = GraphicsEnvironment
|
||||||
|
.getLocalGraphicsEnvironment().getDefaultScreenDevice();
|
||||||
|
|
||||||
|
if (device.isFullScreenSupported() && !isWindows) {
|
||||||
setResizable(true);
|
setResizable(true);
|
||||||
|
|
||||||
addFocusListener(new FocusListener() {
|
addFocusListener(new FocusListener() {
|
||||||
@@ -129,7 +122,6 @@ public class JRootKiosk extends javax.swing.JFrame implements AppMessage {
|
|||||||
|
|
||||||
new JFrmConfig(props).setVisible(true); // Show the configuration window.
|
new JFrmConfig(props).setVisible(true); // Show the configuration window.
|
||||||
}
|
}
|
||||||
setRootapp(m_rootapp);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|||||||
@@ -98,6 +98,7 @@ public class StartPOS {
|
|||||||
|
|
||||||
String hostname = config.getProperty("machine.hostname");
|
String hostname = config.getProperty("machine.hostname");
|
||||||
TicketInfo.setHostname(hostname);
|
TicketInfo.setHostname(hostname);
|
||||||
|
applicationStarted(hostname);
|
||||||
|
|
||||||
String screenmode = config.getProperty("machine.screenmode");
|
String screenmode = config.getProperty("machine.screenmode");
|
||||||
|
|
||||||
@@ -105,8 +106,6 @@ public class StartPOS {
|
|||||||
JRootKiosk rootkiosk = new JRootKiosk();
|
JRootKiosk rootkiosk = new JRootKiosk();
|
||||||
try {
|
try {
|
||||||
rootkiosk.initFrame(config);
|
rootkiosk.initFrame(config);
|
||||||
applicationStarted(hostname, rootkiosk.getRootapp());
|
|
||||||
|
|
||||||
} catch (IOException ex) {
|
} catch (IOException ex) {
|
||||||
log.error(ex.getMessage());
|
log.error(ex.getMessage());
|
||||||
}
|
}
|
||||||
@@ -114,25 +113,18 @@ public class StartPOS {
|
|||||||
JRootFrame rootframe = new JRootFrame();
|
JRootFrame rootframe = new JRootFrame();
|
||||||
try {
|
try {
|
||||||
rootframe.initFrame(config);
|
rootframe.initFrame(config);
|
||||||
applicationStarted(hostname, rootframe.getRootapp());
|
|
||||||
} catch (Exception ex) {
|
} catch (Exception ex) {
|
||||||
log.error(ex.getMessage());
|
log.error(ex.getMessage());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
private static void applicationStarted(String host, JRootApp jRootApp) {
|
private static void applicationStarted(String host) {
|
||||||
new Thread(() -> {
|
new Thread(() -> {
|
||||||
try {
|
|
||||||
Metrics metrics = new Metrics();
|
Metrics metrics = new Metrics();
|
||||||
metrics.setDevice(host);
|
metrics.setDevice(host);
|
||||||
metrics.setUniCentaVersion(AppLocal.APP_VERSION);
|
metrics.setUniCentaVersion(AppLocal.APP_VERSION);
|
||||||
Application application = new Application();
|
new Application().postMetrics(metrics);
|
||||||
application.postMetrics(metrics);
|
|
||||||
application.startEventListener(host, jRootApp);
|
|
||||||
} catch (Exception e) {
|
|
||||||
log.error("Problem with starting the uniCenta plugin application:${}", e.getMessage());
|
|
||||||
}
|
|
||||||
}).start();
|
}).start();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -39,8 +39,6 @@ public class PaymentGatewayFac {
|
|||||||
return new PaymentGatewayExt();
|
return new PaymentGatewayExt();
|
||||||
case "PaymentSense":
|
case "PaymentSense":
|
||||||
return new PaymentGatewayPaymentSense();
|
return new PaymentGatewayPaymentSense();
|
||||||
case "Teya":
|
|
||||||
return new PaymentGatewayTeya();
|
|
||||||
default:
|
default:
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -26,7 +26,6 @@ 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 {
|
||||||
@@ -35,26 +34,13 @@ public class PaymentGatewayPaymentSense implements PaymentGateway {
|
|||||||
public PaymentGatewayPaymentSense() {
|
public PaymentGatewayPaymentSense() {
|
||||||
}
|
}
|
||||||
|
|
||||||
Window getPaymentWindow(double amount) {
|
Window getPaymentWindow() {
|
||||||
if (amount > 0) {
|
|
||||||
ArrayList<JPaymentSelectReceipt> paymentWindows = new ArrayList<>();
|
|
||||||
for (Window window : Window.getWindows()) {
|
for (Window window : Window.getWindows()) {
|
||||||
if (window instanceof JPaymentSelectReceipt) {
|
if (window.isActive()) {
|
||||||
paymentWindows.add((JPaymentSelectReceipt) window);
|
return 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);
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -67,8 +53,7 @@ public class PaymentGatewayPaymentSense implements PaymentGateway {
|
|||||||
int timer = 0;
|
int timer = 0;
|
||||||
int timeout = 180;
|
int timeout = 180;
|
||||||
|
|
||||||
double roundedValue = RoundUtils.round(payinfo.getTotal());
|
new Application().paymentSenseTransaction(RoundUtils.round(payinfo.getTotal()), getPaymentWindow());
|
||||||
new Application().paymentSenseTransaction(roundedValue, getPaymentWindow(roundedValue));
|
|
||||||
|
|
||||||
while (AppContext.getIsProcessing() == null || AppContext.getIsProcessing()) {
|
while (AppContext.getIsProcessing() == null || AppContext.getIsProcessing()) {
|
||||||
try {
|
try {
|
||||||
|
|||||||
@@ -1,101 +0,0 @@
|
|||||||
// uniCenta oPOS - Touch Friendly Point Of Sale
|
|
||||||
// Copyright (c) 2009-2018 uniCenta & previous Openbravo POS works
|
|
||||||
// https://unicenta.com
|
|
||||||
//
|
|
||||||
// This file is part of uniCenta oPOS
|
|
||||||
//
|
|
||||||
// uniCenta oPOS is free software: you can redistribute it and/or modify
|
|
||||||
// it under the terms of the GNU General Public License as published by
|
|
||||||
// the Free Software Foundation, either version 3 of the License, or
|
|
||||||
// (at your option) any later version.
|
|
||||||
//
|
|
||||||
// uniCenta oPOS is distributed in the hope that it will be useful,
|
|
||||||
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
||||||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
||||||
// GNU General Public License for more details.
|
|
||||||
//
|
|
||||||
// You should have received a copy of the GNU General Public License
|
|
||||||
// along with uniCenta oPOS. If not, see <http://www.gnu.org/licenses/>.
|
|
||||||
|
|
||||||
package com.unicenta.pos.payment;
|
|
||||||
|
|
||||||
import com.unicenta.plugins.Application;
|
|
||||||
import com.unicenta.plugins.common.AppContext;
|
|
||||||
import com.unicenta.pos.util.RoundUtils;
|
|
||||||
import lombok.extern.slf4j.Slf4j;
|
|
||||||
|
|
||||||
import java.awt.*;
|
|
||||||
import java.util.ArrayList;
|
|
||||||
|
|
||||||
@Slf4j
|
|
||||||
public class PaymentGatewayTeya implements PaymentGateway {
|
|
||||||
|
|
||||||
/** Creates a new instance of PaymentGatewayExt */
|
|
||||||
public PaymentGatewayTeya() {
|
|
||||||
}
|
|
||||||
|
|
||||||
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);
|
|
||||||
}
|
|
||||||
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);
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
*
|
|
||||||
* @param payinfo
|
|
||||||
*/
|
|
||||||
@Override
|
|
||||||
public void execute(PaymentInfoMagcard payinfo) {
|
|
||||||
|
|
||||||
int timer = 0;
|
|
||||||
int timeout = 150;
|
|
||||||
|
|
||||||
double roundedValue = RoundUtils.round(payinfo.getTotal());
|
|
||||||
|
|
||||||
new Application().teyaTransaction(roundedValue, getPaymentWindow(roundedValue), payinfo.getTransactionID());
|
|
||||||
|
|
||||||
while (AppContext.getTeyaPaymentResult() == null) {
|
|
||||||
try {
|
|
||||||
log.info("uniCenta-oPos: waiting for payment to complete ....");
|
|
||||||
Thread.sleep(1000);
|
|
||||||
timer += 1;
|
|
||||||
if (timer > timeout) break;
|
|
||||||
} catch (InterruptedException e) {
|
|
||||||
log.error(e.getMessage());
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
if (AppContext.getTeyaPaymentResult().getStatus().equals("SUCCESSFUL")) {
|
|
||||||
payinfo.setCardName("Teya");
|
|
||||||
payinfo.setVerification("Chip and Pin");
|
|
||||||
payinfo.setChipAndPin(true);
|
|
||||||
payinfo.paymentOK(
|
|
||||||
roundedValue > 0 ? AppContext.getTeyaPaymentResult().getReferenceId() : "",
|
|
||||||
roundedValue > 0 ? AppContext.getTeyaPaymentResult().getGatewayPaymentId() : "",
|
|
||||||
AppContext.getTeyaPaymentResult().getStatus()
|
|
||||||
);
|
|
||||||
}
|
|
||||||
else {
|
|
||||||
payinfo.paymentError("Transaction Error! Please try again", AppContext.getTeyaPaymentResult().getStatus());
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -30,6 +30,7 @@ import java.util.ArrayList;
|
|||||||
import java.util.Iterator;
|
import java.util.Iterator;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
*
|
||||||
* @author JG uniCenta
|
* @author JG uniCenta
|
||||||
*/
|
*/
|
||||||
@Slf4j
|
@Slf4j
|
||||||
@@ -50,9 +51,7 @@ public abstract class BasicTicket implements PrintItem {
|
|||||||
*/
|
*/
|
||||||
protected int m_iBodyHeight;
|
protected int m_iBodyHeight;
|
||||||
|
|
||||||
/**
|
/** Creates a new instance of AbstractTicket */
|
||||||
* Creates a new instance of AbstractTicket
|
|
||||||
*/
|
|
||||||
public BasicTicket() {
|
public BasicTicket() {
|
||||||
// JG 16 May 12 use diamond inference
|
// JG 16 May 12 use diamond inference
|
||||||
m_aCommands = new ArrayList<>();
|
m_aCommands = new ArrayList<>();
|
||||||
@@ -61,21 +60,25 @@ public abstract class BasicTicket implements PrintItem {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
*
|
||||||
* @return
|
* @return
|
||||||
*/
|
*/
|
||||||
protected abstract Font getBaseFont();
|
protected abstract Font getBaseFont();
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
*
|
||||||
* @return
|
* @return
|
||||||
*/
|
*/
|
||||||
protected abstract int getFontHeight();
|
protected abstract int getFontHeight();
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
*
|
||||||
* @return
|
* @return
|
||||||
*/
|
*/
|
||||||
protected abstract double getImageScale();
|
protected abstract double getImageScale();
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
*
|
||||||
* @return
|
* @return
|
||||||
*/
|
*/
|
||||||
@Override
|
@Override
|
||||||
@@ -84,6 +87,7 @@ public abstract class BasicTicket implements PrintItem {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
*
|
||||||
* @param g2d
|
* @param g2d
|
||||||
* @param x
|
* @param x
|
||||||
* @param y
|
* @param y
|
||||||
@@ -97,55 +101,10 @@ public abstract class BasicTicket implements PrintItem {
|
|||||||
pi.draw(g2d, x, currenty, width);
|
pi.draw(g2d, x, currenty, width);
|
||||||
currenty += pi.getHeight();
|
currenty += pi.getHeight();
|
||||||
}
|
}
|
||||||
|
|
||||||
saveTicket(g2d, x, y, width);
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
private void saveTicket(Graphics2D g2d, int x, int y, int width) {
|
|
||||||
|
|
||||||
int receiptHeight = 5;
|
|
||||||
|
|
||||||
PrintItem pi;
|
|
||||||
for(Iterator i$ = m_aCommands.iterator(); i$.hasNext(); receiptHeight += pi.getHeight()) {
|
|
||||||
pi = (PrintItem)i$.next();
|
|
||||||
}
|
|
||||||
|
|
||||||
BufferedImage image = new BufferedImage(width + 10, receiptHeight, 1);
|
|
||||||
g2d = image.createGraphics();
|
|
||||||
int currenty = y;
|
|
||||||
|
|
||||||
for(Iterator i$ = this.m_aCommands.iterator(); i$.hasNext(); currenty += pi.getHeight()) {
|
|
||||||
pi = (PrintItem)i$.next();
|
|
||||||
if (pi instanceof PrintItemImage) {
|
|
||||||
((PrintItemImage) pi).setImage(negative(((PrintItemImage) pi).getImage()));
|
|
||||||
}
|
|
||||||
pi.draw(g2d, x, currenty, width);
|
|
||||||
}
|
|
||||||
|
|
||||||
try {
|
|
||||||
ImageIO.write(this.negative(image), "png", new File(System.getProperty("user.home") + "/receipt.png"));
|
|
||||||
}
|
|
||||||
catch (Exception e) {
|
|
||||||
System.out.println("Error serialising receipt image !!! : " + e);
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
public BufferedImage negative(BufferedImage img) {
|
|
||||||
for (int x = 0; x < img.getWidth(); ++x) {
|
|
||||||
for (int y = 0; y < img.getHeight(); ++y) {
|
|
||||||
int RGBA = img.getRGB(x, y);
|
|
||||||
Color col = new Color(RGBA, true);
|
|
||||||
col = new Color(Math.abs(col.getRed() - 255), Math.abs(col.getGreen() - 255), Math.abs(col.getBlue() - 255));
|
|
||||||
img.setRGB(x, y, col.getRGB());
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
return img;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
*
|
||||||
* @return
|
* @return
|
||||||
*/
|
*/
|
||||||
public java.util.List<PrintItem> getCommands() {
|
public java.util.List<PrintItem> getCommands() {
|
||||||
@@ -155,6 +114,7 @@ public abstract class BasicTicket implements PrintItem {
|
|||||||
// INTERFAZ PRINTER 2
|
// INTERFAZ PRINTER 2
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
*
|
||||||
* @param image
|
* @param image
|
||||||
*/
|
*/
|
||||||
public void printImage(BufferedImage image) {
|
public void printImage(BufferedImage image) {
|
||||||
@@ -165,6 +125,7 @@ public abstract class BasicTicket implements PrintItem {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
*
|
||||||
* @param type
|
* @param type
|
||||||
* @param position
|
* @param position
|
||||||
* @param code
|
* @param code
|
||||||
@@ -177,6 +138,7 @@ public abstract class BasicTicket implements PrintItem {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
*
|
||||||
* @param iTextSize
|
* @param iTextSize
|
||||||
*/
|
*/
|
||||||
public void beginLine(int iTextSize) {
|
public void beginLine(int iTextSize) {
|
||||||
@@ -184,6 +146,7 @@ public abstract class BasicTicket implements PrintItem {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
*
|
||||||
* @param iStyle
|
* @param iStyle
|
||||||
* @param sText
|
* @param sText
|
||||||
*/
|
*/
|
||||||
|
|||||||
@@ -70,12 +70,4 @@ public class PrintItemImage implements PrintItem {
|
|||||||
public int getHeight() {
|
public int getHeight() {
|
||||||
return (int) (image.getHeight() * scale);
|
return (int) (image.getHeight() * scale);
|
||||||
}
|
}
|
||||||
|
|
||||||
public BufferedImage getImage() {
|
|
||||||
return image;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setImage(BufferedImage image) {
|
|
||||||
this.image = image;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -33,17 +33,17 @@ import com.unicenta.pos.sales.ReprintTicketInfo;
|
|||||||
import com.unicenta.pos.sales.SharedTicketInfo;
|
import com.unicenta.pos.sales.SharedTicketInfo;
|
||||||
import com.unicenta.pos.sales.TicketsEditor;
|
import com.unicenta.pos.sales.TicketsEditor;
|
||||||
import com.unicenta.pos.ticket.TicketInfo;
|
import com.unicenta.pos.ticket.TicketInfo;
|
||||||
import lombok.extern.slf4j.Slf4j;
|
|
||||||
|
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.UUID;
|
import java.util.UUID;
|
||||||
import javax.swing.*;
|
import javax.swing.JComponent;
|
||||||
|
import javax.swing.JOptionPane;
|
||||||
|
import javax.swing.JPanel;
|
||||||
|
import javax.swing.SwingUtilities;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
*
|
*
|
||||||
* @author JG uniCenta
|
* @author JG uniCenta
|
||||||
*/
|
*/
|
||||||
@Slf4j
|
|
||||||
public class JTicketsBagShared extends JTicketsBag {
|
public class JTicketsBagShared extends JTicketsBag {
|
||||||
|
|
||||||
private String m_sCurrentTicket = null;
|
private String m_sCurrentTicket = null;
|
||||||
@@ -76,24 +76,6 @@ public class JTicketsBagShared extends JTicketsBag {
|
|||||||
@Override
|
@Override
|
||||||
public void activate() {
|
public void activate() {
|
||||||
|
|
||||||
log.debug("Loading Sales screen! "+this.getClass());
|
|
||||||
|
|
||||||
SwingWorker<String, String> reloadLayaway = new SwingWorker<>() {
|
|
||||||
@Override
|
|
||||||
protected String doInBackground() throws Exception {
|
|
||||||
while (true) {
|
|
||||||
log.debug("refresh screen");
|
|
||||||
updateCount();
|
|
||||||
Thread.sleep(5000);
|
|
||||||
}
|
|
||||||
|
|
||||||
//return null;
|
|
||||||
}
|
|
||||||
};
|
|
||||||
|
|
||||||
reloadLayaway.execute();
|
|
||||||
|
|
||||||
|
|
||||||
m_sCurrentTicket = null;
|
m_sCurrentTicket = null;
|
||||||
selectValidTicket();
|
selectValidTicket();
|
||||||
|
|
||||||
@@ -380,9 +362,9 @@ public class JTicketsBagShared extends JTicketsBag {
|
|||||||
|| m_App.getAppUserView().getUser().hasPermission("sales.ViewSharedTicket")
|
|| m_App.getAppUserView().getUser().hasPermission("sales.ViewSharedTicket")
|
||||||
|| m_App.getAppUserView().getUser().hasPermission("sales.Override"))
|
|| m_App.getAppUserView().getUser().hasPermission("sales.Override"))
|
||||||
{
|
{
|
||||||
List<SharedTicketInfo> sharedTicketList = dlReceipts.getSharedTicketList();
|
List<SharedTicketInfo> l = dlReceipts.getSharedTicketList();
|
||||||
JTicketsBagSharedList listDialog = JTicketsBagSharedList.newJDialog(JTicketsBagShared.this);
|
JTicketsBagSharedList listDialog = JTicketsBagSharedList.newJDialog(JTicketsBagShared.this);
|
||||||
String id = listDialog.showTicketsList(sharedTicketList, dlReceipts);
|
String id = listDialog.showTicketsList(l, dlReceipts);
|
||||||
|
|
||||||
if (id != null) {
|
if (id != null) {
|
||||||
saveCurrentTicket();
|
saveCurrentTicket();
|
||||||
|
|||||||
@@ -56,9 +56,6 @@ public class DeviceScale {
|
|||||||
case "samsungesp":
|
case "samsungesp":
|
||||||
m_scale = new ScaleSamsungEsp(sScaleParam1);
|
m_scale = new ScaleSamsungEsp(sScaleParam1);
|
||||||
break;
|
break;
|
||||||
case "samsungesp-v2":
|
|
||||||
m_scale = new ScaleSamsungEspV2(sScaleParam1);
|
|
||||||
break;
|
|
||||||
case "caspdii":
|
case "caspdii":
|
||||||
m_scale = new ScaleCASPDII(sScaleParam1);
|
m_scale = new ScaleCASPDII(sScaleParam1);
|
||||||
break;
|
break;
|
||||||
|
|||||||
@@ -1,95 +0,0 @@
|
|||||||
// uniCenta oPOS - Touch Friendly Point Of Sale
|
|
||||||
// Copyright (c) 2009-2023 uniCenta & previous Openbravo POS works
|
|
||||||
// https://unicenta.com
|
|
||||||
//
|
|
||||||
// This file is part of uniCenta oPOS
|
|
||||||
//
|
|
||||||
// uniCenta oPOS is free software: you can redistribute it and/or modify
|
|
||||||
// it under the terms of the GNU General Public License as published by
|
|
||||||
// the Free Software Foundation, either version 3 of the License, or
|
|
||||||
// (at your option) any later version.
|
|
||||||
//
|
|
||||||
// uniCenta oPOS is distributed in the hope that it will be useful,
|
|
||||||
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
||||||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
||||||
// GNU General Public License for more details.
|
|
||||||
//
|
|
||||||
// You should have received a copy of the GNU General Public License
|
|
||||||
// along with uniCenta oPOS. If not, see <http://www.gnu.org/licenses/>.
|
|
||||||
|
|
||||||
package com.unicenta.pos.scale;
|
|
||||||
|
|
||||||
import com.fazecast.jSerialComm.SerialPort;
|
|
||||||
import com.fazecast.jSerialComm.SerialPortDataListener;
|
|
||||||
import com.fazecast.jSerialComm.SerialPortEvent;
|
|
||||||
|
|
||||||
public class ScaleSamsungEspV2 implements Scale {
|
|
||||||
|
|
||||||
private String result;
|
|
||||||
private final String m_sPortScale;
|
|
||||||
|
|
||||||
/** Creates a new instance of ScaleComm
|
|
||||||
* @param sPortPrinter */
|
|
||||||
public ScaleSamsungEspV2(String sPortPrinter) {
|
|
||||||
m_sPortScale = sPortPrinter;
|
|
||||||
}
|
|
||||||
|
|
||||||
private final SerialPortDataListener dataListener = new SerialPortDataListener() {
|
|
||||||
@Override
|
|
||||||
public int getListeningEvents() {
|
|
||||||
return SerialPort.LISTENING_EVENT_DATA_AVAILABLE;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void serialEvent(SerialPortEvent event) {
|
|
||||||
if (event.getEventType() == SerialPort.LISTENING_EVENT_DATA_AVAILABLE) {
|
|
||||||
SerialPort serialPort = (SerialPort) event.getSerialPort();
|
|
||||||
byte[] newData = new byte[serialPort.bytesAvailable()];
|
|
||||||
serialPort.readBytes(newData, newData.length);
|
|
||||||
String receivedData = new String(newData);
|
|
||||||
result = result + receivedData;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
};
|
|
||||||
|
|
||||||
/**
|
|
||||||
*
|
|
||||||
* @return
|
|
||||||
*/
|
|
||||||
@Override
|
|
||||||
public Double readWeight() {
|
|
||||||
|
|
||||||
// Configura los parámetros del puerto serie
|
|
||||||
SerialPort serialPort = SerialPort.getCommPort(m_sPortScale);
|
|
||||||
serialPort.setBaudRate(4800);
|
|
||||||
serialPort.setNumDataBits(8);
|
|
||||||
serialPort.setNumStopBits(1);
|
|
||||||
serialPort.setParity(1);
|
|
||||||
|
|
||||||
// Abre el puerto serie
|
|
||||||
if (serialPort.openPort()) {
|
|
||||||
|
|
||||||
// Agrega el objeto de escucha al puerto serie
|
|
||||||
serialPort.addDataListener(dataListener);
|
|
||||||
|
|
||||||
// Escribe en el puerto serie
|
|
||||||
result = "";
|
|
||||||
byte[] data = new byte[] {0x24};
|
|
||||||
serialPort.writeBytes(data, data.length);
|
|
||||||
|
|
||||||
// Espera unos segundos para recibir la respuesta (puedes ajustar este tiempo)
|
|
||||||
try {
|
|
||||||
Thread.sleep(1000);
|
|
||||||
} catch (InterruptedException e) {}
|
|
||||||
|
|
||||||
// Cierra el puerto serie
|
|
||||||
serialPort.closePort();
|
|
||||||
}
|
|
||||||
|
|
||||||
try {
|
|
||||||
return Double.valueOf(result);
|
|
||||||
} catch (NumberFormatException e) {
|
|
||||||
return 0.0;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -79,14 +79,14 @@ public final class TicketInfo implements SerializableRead, Externalizable {
|
|||||||
private Double nsum;
|
private Double nsum;
|
||||||
private int ticketstatus;
|
private int ticketstatus;
|
||||||
|
|
||||||
private static String hostname;
|
private static String Hostname;
|
||||||
|
|
||||||
public static void setHostname(String name) {
|
public static void setHostname(String name) {
|
||||||
hostname =name;
|
Hostname=name;
|
||||||
}
|
}
|
||||||
|
|
||||||
public static String getHostname() {
|
public static String getHostname() {
|
||||||
return hostname;
|
return Hostname;
|
||||||
}
|
}
|
||||||
|
|
||||||
/** Creates new TicketModel */
|
/** Creates new TicketModel */
|
||||||
|
|||||||
@@ -19,7 +19,6 @@
|
|||||||
|
|
||||||
package com.unicenta.pos.ticket;
|
package com.unicenta.pos.ticket;
|
||||||
|
|
||||||
import com.google.gson.Gson;
|
|
||||||
import com.unicenta.basic.BasicException;
|
import com.unicenta.basic.BasicException;
|
||||||
import com.unicenta.data.loader.DataRead;
|
import com.unicenta.data.loader.DataRead;
|
||||||
import com.unicenta.data.loader.DataWrite;
|
import com.unicenta.data.loader.DataWrite;
|
||||||
@@ -41,12 +40,6 @@ public class TicketLineInfo implements SerializableWrite, SerializableRead, Seri
|
|||||||
private String m_sTicket;
|
private String m_sTicket;
|
||||||
private int m_iLine;
|
private int m_iLine;
|
||||||
private double multiply;
|
private double multiply;
|
||||||
|
|
||||||
@Override
|
|
||||||
public String toString() {
|
|
||||||
return new Gson().toJson(this);
|
|
||||||
}
|
|
||||||
|
|
||||||
private double price;
|
private double price;
|
||||||
private TaxInfo tax;
|
private TaxInfo tax;
|
||||||
private Properties attributes;
|
private Properties attributes;
|
||||||
|
|||||||
@@ -153,7 +153,7 @@ public final class VoucherEditor extends javax.swing.JPanel implements EditorRec
|
|||||||
} else switch (m_jStatus.getText()) {
|
} else switch (m_jStatus.getText()) {
|
||||||
case "A":
|
case "A":
|
||||||
jLblStatus.setIcon(new javax.swing.ImageIcon(getClass()
|
jLblStatus.setIcon(new javax.swing.ImageIcon(getClass()
|
||||||
.getResource("/com/unicenta/images/ok.png")));
|
.getResource("/com/unicenta/images/OK.png")));
|
||||||
m_jNumber.setEnabled(true);
|
m_jNumber.setEnabled(true);
|
||||||
m_jAmount.setEnabled(true);
|
m_jAmount.setEnabled(true);
|
||||||
m_jCustomer.setEnabled(true);
|
m_jCustomer.setEnabled(true);
|
||||||
|
|||||||
@@ -1,2 +0,0 @@
|
|||||||
UPDATE resources SET content = $FILE{/com/unicenta/pos/templates/Printer.Ticket.xml} WHERE name = 'Printer.Ticket';
|
|
||||||
UPDATE applications SET version = $APP_VERSION{} WHERE id = $APP_ID{};
|
|
||||||
@@ -1,3 +1,61 @@
|
|||||||
UPDATE applications SET version = $APP_VERSION{} WHERE id = $APP_ID{};
|
-- CLEAR THE DECKS
|
||||||
|
DELETE FROM sharedtickets;
|
||||||
|
|
||||||
|
-- Switch OFF table foreign key relationships
|
||||||
|
set foreign_key_checks = 0;
|
||||||
|
|
||||||
|
-- RECREATE applications table
|
||||||
|
DROP TABLE `applications`;
|
||||||
|
CREATE TABLE IF NOT EXISTS `applications` (
|
||||||
|
`id` varchar(255) NOT NULL,
|
||||||
|
`name` varchar(255) NOT NULL,
|
||||||
|
`version` varchar(255) NOT NULL,
|
||||||
|
`instdate` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP,
|
||||||
|
PRIMARY KEY ( `id` )
|
||||||
|
) ENGINE = InnoDB DEFAULT CHARSET=utf8 ROW_FORMAT = Compact;
|
||||||
|
|
||||||
|
|
||||||
|
-- SYSTEM
|
||||||
|
DELETE FROM resources WHERE name = 'script.posapps';
|
||||||
|
|
||||||
|
|
||||||
|
DELETE FROM resources WHERE id = '0';
|
||||||
|
DELETE FROM resources WHERE id = '00';
|
||||||
|
INSERT INTO resources(id, name, restype, content) VALUES('00', 'Menu.Root', 0, $FILE{/com/unicenta/pos/templates/Menu.Root.txt});
|
||||||
|
|
||||||
|
UPDATE resources SET content = $FILE{/com/unicenta/pos/templates/Ticket.Buttons.xml} WHERE name = 'Ticket.Buttons';
|
||||||
|
COMMIT;
|
||||||
|
|
||||||
UPDATE resources SET content = $FILE{/com/unicenta/pos/templates/Printer.Ticket.xml} WHERE name = 'Printer.Ticket';
|
UPDATE resources SET content = $FILE{/com/unicenta/pos/templates/Printer.Ticket.xml} WHERE name = 'Printer.Ticket';
|
||||||
COMMIT;
|
COMMIT;
|
||||||
|
|
||||||
|
UPDATE resources SET content = $FILE{/com/unicenta/pos/templates/Ticket.Close.xml} WHERE name = 'Ticket.Close';
|
||||||
|
COMMIT;
|
||||||
|
|
||||||
|
UPDATE resources SET content = $FILE{/com/unicenta/pos/templates/Cash.Close.xml} WHERE name = 'Cash.Close';
|
||||||
|
COMMIT;
|
||||||
|
|
||||||
|
UPDATE resources SET content = $FILE{/com/unicenta/pos/templates/customer.created.xml} WHERE name = 'Customer.Created';
|
||||||
|
COMMIT;
|
||||||
|
|
||||||
|
UPDATE resources SET content = $FILE{/com/unicenta/pos/templates/customer.deleted.xml} WHERE name = 'Customer.Deleted';
|
||||||
|
COMMIT;
|
||||||
|
|
||||||
|
UPDATE resources SET content = $FILE{/com/unicenta/pos/templates/customer.updated.xml} WHERE name = 'Customer.Updated';
|
||||||
|
COMMIT;
|
||||||
|
|
||||||
|
-- ROLES
|
||||||
|
DELETE FROM roles WHERE id = '0';
|
||||||
|
INSERT INTO roles(id, name, permissions) VALUES('0', 'Administrator role', $FILE{/com/unicenta/pos/templates/Role.Administrator.xml} );
|
||||||
|
DELETE FROM roles WHERE id = '1';
|
||||||
|
INSERT INTO roles(id, name, permissions) VALUES('1', 'Manager role', $FILE{/com/unicenta/pos/templates/Role.Manager.xml} );
|
||||||
|
DELETE FROM roles WHERE id = '2';
|
||||||
|
INSERT INTO roles(id, name, permissions) VALUES('2', 'Employee role', $FILE{/com/unicenta/pos/templates/Role.Employee.xml} );
|
||||||
|
|
||||||
|
|
||||||
|
-- Switch ON table foreign key relationships
|
||||||
|
set foreign_key_checks = 1;
|
||||||
|
|
||||||
|
INSERT INTO applications(id, name, version) VALUES($APP_ID{}, $APP_NAME{}, $APP_VERSION{});
|
||||||
|
|
||||||
|
COMMIT;
|
||||||
@@ -1,3 +1,70 @@
|
|||||||
UPDATE resources SET content = $FILE{/com/unicenta/pos/templates/Printer.Ticket.xml} WHERE name = 'Printer.Ticket';
|
-- CLEAR THE DECKS
|
||||||
UPDATE applications SET version = $APP_VERSION{} WHERE id = $APP_ID{};
|
DELETE FROM sharedtickets;
|
||||||
|
|
||||||
|
-- Switch OFF table foreign key relationships
|
||||||
|
set foreign_key_checks = 0;
|
||||||
|
|
||||||
|
-- RECREATE applications table
|
||||||
|
DROP TABLE `applications`;
|
||||||
|
CREATE TABLE IF NOT EXISTS `applications` (
|
||||||
|
`id` varchar(255) NOT NULL,
|
||||||
|
`name` varchar(255) NOT NULL,
|
||||||
|
`version` varchar(255) NOT NULL,
|
||||||
|
`instdate` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP,
|
||||||
|
PRIMARY KEY ( `id` )
|
||||||
|
) ENGINE = InnoDB DEFAULT CHARSET=utf8 ROW_FORMAT = Compact;
|
||||||
|
|
||||||
|
|
||||||
|
-- SYSTEM
|
||||||
|
DELETE FROM resources WHERE name = 'script.posapps';
|
||||||
|
|
||||||
|
|
||||||
|
DELETE FROM resources WHERE id = '0';
|
||||||
|
DELETE FROM resources WHERE id = '00';
|
||||||
|
INSERT INTO resources(id, name, restype, content) VALUES('00', 'Menu.Root', 0, $FILE{/com/unicenta/pos/templates/Menu.Root.txt});
|
||||||
|
|
||||||
|
UPDATE resources SET content = $FILE{/com/unicenta/pos/templates/Ticket.Buttons.xml} WHERE name = 'Ticket.Buttons';
|
||||||
|
COMMIT;
|
||||||
|
|
||||||
|
UPDATE resources SET content = $FILE{/com/unicenta/pos/templates/Printer.Ticket.xml} WHERE name = 'Printer.Ticket';
|
||||||
|
COMMIT;
|
||||||
|
|
||||||
|
UPDATE resources SET content = $FILE{/com/unicenta/pos/templates/Ticket.Close.xml} WHERE name = 'Ticket.Close';
|
||||||
|
COMMIT;
|
||||||
|
|
||||||
|
UPDATE resources SET content = $FILE{/com/unicenta/pos/templates/Cash.Close.xml} WHERE name = 'Cash.Close';
|
||||||
|
COMMIT;
|
||||||
|
|
||||||
|
UPDATE resources SET content = $FILE{/com/unicenta/pos/templates/customer.created.xml} WHERE name = 'Customer.Created';
|
||||||
|
COMMIT;
|
||||||
|
|
||||||
|
UPDATE resources SET content = $FILE{/com/unicenta/pos/templates/customer.deleted.xml} WHERE name = 'Customer.Deleted';
|
||||||
|
COMMIT;
|
||||||
|
|
||||||
|
UPDATE resources SET content = $FILE{/com/unicenta/pos/templates/customer.updated.xml} WHERE name = 'Customer.Updated';
|
||||||
|
COMMIT;
|
||||||
|
|
||||||
|
UPDATE resources SET content = $FILE{/com/unicenta/pos/templates/script.Linediscount.txt} WHERE name = 'script.Linediscount';
|
||||||
|
COMMIT;
|
||||||
|
|
||||||
|
UPDATE resources SET content = $FILE{/com/unicenta/pos/templates/script.Totaldiscount.txt} WHERE name = 'script.Totaldiscount';
|
||||||
|
COMMIT;
|
||||||
|
|
||||||
|
UPDATE resources SET content = $FILE{/com/unicenta/pos/templates/script.multibuy.txt} WHERE name = 'script.multibuy';
|
||||||
|
COMMIT;
|
||||||
|
|
||||||
|
-- ROLES
|
||||||
|
DELETE FROM roles WHERE id = '0';
|
||||||
|
INSERT INTO roles(id, name, permissions) VALUES('0', 'Administrator role', $FILE{/com/unicenta/pos/templates/Role.Administrator.xml} );
|
||||||
|
DELETE FROM roles WHERE id = '1';
|
||||||
|
INSERT INTO roles(id, name, permissions) VALUES('1', 'Manager role', $FILE{/com/unicenta/pos/templates/Role.Manager.xml} );
|
||||||
|
DELETE FROM roles WHERE id = '2';
|
||||||
|
INSERT INTO roles(id, name, permissions) VALUES('2', 'Employee role', $FILE{/com/unicenta/pos/templates/Role.Employee.xml} );
|
||||||
|
|
||||||
|
|
||||||
|
-- Switch ON table foreign key relationships
|
||||||
|
set foreign_key_checks = 1;
|
||||||
|
|
||||||
|
INSERT INTO applications(id, name, version) VALUES($APP_ID{}, $APP_NAME{}, $APP_VERSION{});
|
||||||
|
|
||||||
COMMIT;
|
COMMIT;
|
||||||
@@ -218,6 +218,7 @@
|
|||||||
<line><text>Tranx ID : </text><text>${paymentline.printTransactionID()}</text></line>
|
<line><text>Tranx ID : </text><text>${paymentline.printTransactionID()}</text></line>
|
||||||
<line><text>Auth Code : </text><text>${paymentline.printAuthorization()}</text></line>
|
<line><text>Auth Code : </text><text>${paymentline.printAuthorization()}</text></line>
|
||||||
<line><text>Verified By : </text><text>${paymentline.printVerification()}</text></line>
|
<line><text>Verified By : </text><text>${paymentline.printVerification()}</text></line>
|
||||||
|
<line><text>Card # (last 4) : </text><text>${paymentline.printLastFourDigits()}</text></line>
|
||||||
#end
|
#end
|
||||||
#if (!$paymentline.chipAndPin)
|
#if (!$paymentline.chipAndPin)
|
||||||
<line size="1"><text align="center" length="42" bold="true">CARD SALE</text></line>
|
<line size="1"><text align="center" length="42" bold="true">CARD SALE</text></line>
|
||||||
|
|||||||
@@ -21,3 +21,7 @@
|
|||||||
// You should have received a copy of the GNU General Public License
|
// You should have received a copy of the GNU General Public License
|
||||||
// along with uniCenta oPOS. If not, see <http://www.gnu.org/licenses/>.
|
// along with uniCenta oPOS. If not, see <http://www.gnu.org/licenses/>.
|
||||||
// **************************************************************************
|
// **************************************************************************
|
||||||
|
|
||||||
|
import uk.co.pos_apps.PosApps;
|
||||||
|
|
||||||
|
PosApps.createCustomer(device, customer);
|
||||||
@@ -21,3 +21,7 @@
|
|||||||
// You should have received a copy of the GNU General Public License
|
// You should have received a copy of the GNU General Public License
|
||||||
// along with uniCenta oPOS. If not, see <http://www.gnu.org/licenses/>.
|
// along with uniCenta oPOS. If not, see <http://www.gnu.org/licenses/>.
|
||||||
// **************************************************************************
|
// **************************************************************************
|
||||||
|
|
||||||
|
import uk.co.pos_apps.PosApps;
|
||||||
|
|
||||||
|
PosApps.deleteCustomer(device, customer);
|
||||||
@@ -21,3 +21,7 @@
|
|||||||
// You should have received a copy of the GNU General Public License
|
// You should have received a copy of the GNU General Public License
|
||||||
// along with uniCenta oPOS. If not, see <http://www.gnu.org/licenses/>.
|
// along with uniCenta oPOS. If not, see <http://www.gnu.org/licenses/>.
|
||||||
// **************************************************************************
|
// **************************************************************************
|
||||||
|
|
||||||
|
import uk.co.pos_apps.PosApps;
|
||||||
|
|
||||||
|
PosApps.updateCustomer(device, customer);
|
||||||
@@ -31,7 +31,7 @@ private boolean printedP6 = false;
|
|||||||
for(int i= 0; i < ticket.getLinesCount(); i++){
|
for(int i= 0; i < ticket.getLinesCount(); i++){
|
||||||
line = ticket.getLine(i);
|
line = ticket.getLine(i);
|
||||||
|
|
||||||
if (line.getProperty("product.printer")!=null && line.getProperty("ticket.updated")!=null) {
|
if (line.getProperty("product.printer")!=null) {
|
||||||
|
|
||||||
if (line.getProperty("product.printer").equals("1")) {
|
if (line.getProperty("product.printer").equals("1")) {
|
||||||
if((printedP1 == false) && line.getProperty("ticket.updated").equals("true")) {
|
if((printedP1 == false) && line.getProperty("ticket.updated").equals("true")) {
|
||||||
|
|||||||
@@ -36,16 +36,15 @@ if (index >= 0) {
|
|||||||
sdiscount = Formats.PERCENT.formatValue((discountrate));
|
sdiscount = Formats.PERCENT.formatValue((discountrate));
|
||||||
for (int number= 0; number < ticket.getLinesCount(); number++) {
|
for (int number= 0; number < ticket.getLinesCount(); number++) {
|
||||||
line = ticket.getLine(number);
|
line = ticket.getLine(number);
|
||||||
TicketLineInfo ticketLineInfo = new TicketLineInfo(
|
ticket.setLine(number,
|
||||||
|
new TicketLineInfo(
|
||||||
line.getProductID(),
|
line.getProductID(),
|
||||||
line.getProductName() + " - Item Discount @ " + sdiscount,
|
line.getProductName() + " - Item Discount @ " + sdiscount,
|
||||||
line.getProductTaxCategoryID(),
|
line.getProductTaxCategoryID(),
|
||||||
line.getProductPrinter(),
|
line.getProductPrinter(),
|
||||||
line.getMultiply(),
|
line.getMultiply(),
|
||||||
line.getNewPrice() - (double)Math.abs(line.getNewPrice() * discountrate * 100) /100,
|
line.getNewPrice() - (double)Math.abs(line.getNewPrice() * discountrate * 100) /100,
|
||||||
line.getTaxInfo());
|
line.getTaxInfo()));
|
||||||
ticketLineInfo.setTicketUpdated("ticket.updated", "true");
|
|
||||||
ticket.setLine(number,ticketLineInfo);
|
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
java.awt.Toolkit.getDefaultToolkit().beep();
|
java.awt.Toolkit.getDefaultToolkit().beep();
|
||||||
|
|||||||
@@ -881,7 +881,7 @@ message.email=Desktop email app' not found
|
|||||||
message.emptycustomer=Customer cannot be empty
|
message.emptycustomer=Customer cannot be empty
|
||||||
message.emptynumber=Number cannot be empty
|
message.emptynumber=Number cannot be empty
|
||||||
message.enterbuyprice=Enter new Buy Price
|
message.enterbuyprice=Enter new Buy Price
|
||||||
message.eolupdate=<html><center><h2>Version 5.1 Upgrade!</h2></br><h3>Your current database version is {0}</h3><br>For version 5.0.1 click <b>YES</b><br/><br/>For any other version click <b>NO</b> and get to 5.0.1 first<br><br/>
|
message.eolupdate=<html><center><h2>Version 5.0 Upgrade!</h2></br><h3>Your current database version is {0}</h3><br>For version 4.6.4 click <b>YES</b><br/><br/>For any other version click <b>NO</b> and get to 4.6.4 first<br><br/>
|
||||||
message.ibuttonassign=<html><center>Get the iButton ID<br>Place iButton onto the reader then click OK
|
message.ibuttonassign=<html><center>Get the iButton ID<br>Place iButton onto the reader then click OK
|
||||||
message.ibuttonnotassign=<html><center>The iButton used is not yet assigned to anyone
|
message.ibuttonnotassign=<html><center>The iButton used is not yet assigned to anyone
|
||||||
message.ibuttonnotfound=No iButton adapter found. Key fobs will be disabled.
|
message.ibuttonnotfound=No iButton adapter found. Key fobs will be disabled.
|
||||||
|
|||||||
@@ -1190,4 +1190,4 @@ cboption.find=Buscar
|
|||||||
button.prodhtmldisplayFont=Tipo de fuente
|
button.prodhtmldisplayFont=Tipo de fuente
|
||||||
button.prodhtmldisplayImage=Imagen
|
button.prodhtmldisplayImage=Imagen
|
||||||
label.csvclear=Diario de importaci\u00f3n
|
label.csvclear=Diario de importaci\u00f3n
|
||||||
message.eolupdate=<html><center><h3>uniCenta oPOS Versi\u00f3n {0} detectada!</h3><h4>\u00a1Las actualizaciones de la versi\u00f3n est\u00e1n cambiando!</h4> Si su versi\u00f3n es 5.0.1 o posterior, elija <b>S\u00cd</b> para continuar.<br/><br/> Para versiones anteriores, haga clic en <b>NO</b> para abrir Opciones de configuraci\u00f3n ahora.<br/></br>Lea la Gu\u00eda de transferencia de datos de uniCenta oPOS
|
message.eolupdate=<html><center><h3>uniCenta oPOS Versi\u00f3n {0} detectada!</h3><h4>\u00a1Las actualizaciones de la versi\u00f3n est\u00e1n cambiando!</h4> Si su versi\u00f3n es 4.5 o posterior, elija <b>S\u00cd</b> para continuar.<br/><br/> Para versiones anteriores, haga clic en <b>NO</b> para abrir Opciones de configuraci\u00f3n ahora.<br/></br>Lea la Gu\u00eda de transferencia de datos de uniCenta oPOS
|
||||||
@@ -468,4 +468,4 @@ transpayment.ticket=Ticket
|
|||||||
transpayment.voucherin=Vales cobrados
|
transpayment.voucherin=Vales cobrados
|
||||||
transpayment.voucherout=Vales emitidos
|
transpayment.voucherout=Vales emitidos
|
||||||
Visor.Title=uniCenta oPOS
|
Visor.Title=uniCenta oPOS
|
||||||
message.eolupdate=<html><center><h3>uniCenta oPOS Versi\u00f3n {0} detectada!</h3><h4>\u00a1Las actualizaciones de la versi\u00f3n est\u00e1n cambiando!</h4> Si su versi\u00f3n es 5.0.1 o posterior, elija <b>S\u00cd</b> para continuar.<br/><br/> Para versiones anteriores, haga clic en <b>NO</b> para abrir Opciones de configuraci\u00f3n ahora.<br/></br>Lea la Gu\u00eda de transferencia de datos de uniCenta oPOS
|
message.eolupdate=<html><center><h3>uniCenta oPOS Versi\u00f3n {0} detectada!</h3><h4>\u00a1Las actualizaciones de la versi\u00f3n est\u00e1n cambiando!</h4> Si su versi\u00f3n es 4.5 o posterior, elija <b>S\u00cd</b> para continuar.<br/><br/> Para versiones anteriores, haga clic en <b>NO</b> para abrir Opciones de configuraci\u00f3n ahora.<br/></br>Lea la Gu\u00eda de transferencia de datos de uniCenta oPOS
|
||||||
@@ -911,7 +911,7 @@ message.transfermessage=Database overdracht
|
|||||||
message.transfernotsupported=Database overdrachtstype wordt niet ondersteund
|
message.transfernotsupported=Database overdrachtstype wordt niet ondersteund
|
||||||
message.transfertitle=Database overdracht
|
message.transfertitle=Database overdracht
|
||||||
message.updatedatabase=<html><center><h3>uniCenta oPOS Version {0} database gedetecteerd!</h3> De database wordt automatisch geüpgraded.<br>GEGEVENS KUNNEN VERLOREN GAAN. MAAK EERST EEN BACKUP.<br><br>Wilt u doorgaan?
|
message.updatedatabase=<html><center><h3>uniCenta oPOS Version {0} database gedetecteerd!</h3> De database wordt automatisch geüpgraded.<br>GEGEVENS KUNNEN VERLOREN GAAN. MAAK EERST EEN BACKUP.<br><br>Wilt u doorgaan?
|
||||||
message.eolupdate=<html><center><h3>uniCenta oPOS Version {0} gedetecteerd!</h3><h4>Versie-upgrades veranderen!</h4>Als je versie 5.0.1 of hoger is kies<b>YES</b>om door te gaan<br/><br/>Voor oudere versies kies<b>NO</b> Om nu de configuratie opties te openen!<br>Lees alstublieft de uniCenta oPOS Data Transfer Guide<br/><br/>
|
message.eolupdate=<html><center><h3>uniCenta oPOS Version {0} gedetecteerd!</h3><h4>Versie-upgrades veranderen!</h4>Als je versie 4.5 of hoger is kies<b>YES</b>om door te gaan<br/><br/>Voor oudere versies kies<b>NO</b> Om nu de configuratie opties te openen!<br>Lees alstublieft de uniCenta oPOS Data Transfer Guide<br/><br/>
|
||||||
message.URL=<html>Een webpagina laten zien in het hoofdscherm . vereist de volledige URL<br />Voor een lokaal bestand begin met - <b>file://</b><br/>Voor een extern bestand gebruik <b>http://</b><br/>
|
message.URL=<html>Een webpagina laten zien in het hoofdscherm . vereist de volledige URL<br />Voor een lokaal bestand begin met - <b>file://</b><br/>Voor een extern bestand gebruik <b>http://</b><br/>
|
||||||
message.uuidcopy=<html><center><h4>UUID is gekopieerd naar het klembord
|
message.uuidcopy=<html><center><h4>UUID is gekopieerd naar het klembord
|
||||||
message.vipno=Klant is geen VIP
|
message.vipno=Klant is geen VIP
|
||||||
|
|||||||
@@ -1,95 +0,0 @@
|
|||||||
package com.unicenta.pos.ticket;
|
|
||||||
|
|
||||||
import com.google.gson.Gson;
|
|
||||||
import org.junit.Test;
|
|
||||||
|
|
||||||
import java.io.IOException;
|
|
||||||
import java.nio.file.Files;
|
|
||||||
import java.nio.file.Paths;
|
|
||||||
|
|
||||||
import static org.junit.Assert.*;
|
|
||||||
|
|
||||||
public class TicketLineInfoTest {
|
|
||||||
|
|
||||||
@Test
|
|
||||||
public void shouldSendOrderDiscountToPrinter(){
|
|
||||||
|
|
||||||
String json = getText("src/test/resources/TicketLineInfo.json");
|
|
||||||
assert json != null;
|
|
||||||
TicketLineInfo ticketLineInfo = new Gson().fromJson(json, TicketLineInfo.class);
|
|
||||||
assert ticketLineInfo != null;
|
|
||||||
sendOrderScript(ticketLineInfo);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Test
|
|
||||||
public void shouldSendItemDiscountToPrinter() {
|
|
||||||
String json = getText("src/test/resources/TicketLineInfoOrderDiscount.json");
|
|
||||||
assert json != null;
|
|
||||||
TicketLineInfo ticketLineInfo = new Gson().fromJson(json, TicketLineInfo.class);
|
|
||||||
assert ticketLineInfo != null;
|
|
||||||
sendOrderScript(ticketLineInfo);
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
private void sendOrderScript(TicketLineInfo line) {
|
|
||||||
boolean printedP1 = false;
|
|
||||||
boolean printedP2 = false;
|
|
||||||
boolean printedP3 = false;
|
|
||||||
boolean printedP4 = false;
|
|
||||||
boolean printedP5 = false;
|
|
||||||
boolean printedP6 = false;
|
|
||||||
|
|
||||||
if (line.getProperty("product.printer")!=null && line.getProperty("ticket.updated")!=null) {
|
|
||||||
|
|
||||||
if (line.getProperty("product.printer").equals("1")) {
|
|
||||||
System.out.print("getting property: ");
|
|
||||||
System.out.println(line.getProperty("ticket.updated").equals("true"));
|
|
||||||
if((printedP1 == false)) {
|
|
||||||
//sales.printTicket("Printer.Ticket.P1");
|
|
||||||
printedP1 = true;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
if (line.getProperty("product.printer").equals("2")) {
|
|
||||||
if((printedP2 == false) && line.getProperty("ticket.updated").equals("true")){
|
|
||||||
//sales.printTicket("Printer.Ticket.P2");
|
|
||||||
printedP2 = true;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
if (line.getProperty("product.printer").equals("3")) {
|
|
||||||
if((printedP3 == false) && line.getProperty("ticket.updated").equals("true")){
|
|
||||||
//sales.printTicket("Printer.Ticket.P3");
|
|
||||||
printedP3 = true;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
if (line.getProperty("product.printer").equals("4")) {
|
|
||||||
if((printedP4 == false) && line.getProperty("ticket.updated").equals("true")){
|
|
||||||
//sales.printTicket("Printer.Ticket.P4");
|
|
||||||
printedP4 = true;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
if (line.getProperty("product.printer").equals("5")) {
|
|
||||||
if((printedP5 == false) && line.getProperty("ticket.updated").equals("true")){
|
|
||||||
//sales.printTicket("Printer.Ticket.P5");
|
|
||||||
printedP5 = true;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
if (line.getProperty("product.printer").equals("6")) {
|
|
||||||
if((printedP6 == false) && line.getProperty("ticket.updated").equals("true")){
|
|
||||||
//sales.printTicket("Printer.Ticket.P6");
|
|
||||||
printedP6 = true;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
private String getText(String path) {
|
|
||||||
try {
|
|
||||||
return new String(Files.readAllBytes(Paths.get(path)));
|
|
||||||
} catch (IOException e) {
|
|
||||||
throw new RuntimeException(e);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -1,35 +0,0 @@
|
|||||||
{
|
|
||||||
"m_sTicket": "8c5bfd03-f4f8-4a3f-b216-57f194e1cda6",
|
|
||||||
"m_iLine": 0,
|
|
||||||
"multiply": 1.0,
|
|
||||||
"price": 8.333333333333334,
|
|
||||||
"tax":
|
|
||||||
{
|
|
||||||
"id": "001",
|
|
||||||
"name": "Tax Standard",
|
|
||||||
"taxcategoryid": "001",
|
|
||||||
"rate": 0.2,
|
|
||||||
"cascade": false
|
|
||||||
},
|
|
||||||
"attributes":
|
|
||||||
{
|
|
||||||
"product.printer": "1",
|
|
||||||
"product.warranty": "false",
|
|
||||||
"product.reference": "123",
|
|
||||||
"product.com": "false",
|
|
||||||
"product.verpatrib": "false",
|
|
||||||
"ticket.updated": "true",
|
|
||||||
"product.name": "Burger",
|
|
||||||
"product.service": "false",
|
|
||||||
"product.categoryid": "000",
|
|
||||||
"product.taxcategoryid": "001",
|
|
||||||
"product.memodate": "1900-01-01 00:00:01",
|
|
||||||
"product.code": "123",
|
|
||||||
"product.vprice": "false",
|
|
||||||
"product.texttip": "",
|
|
||||||
"product.constant": "false"
|
|
||||||
},
|
|
||||||
"productid": "fc33fa54-3af1-486b-85e7-9838160053ea",
|
|
||||||
"updated": false,
|
|
||||||
"newprice": 10.0
|
|
||||||
}
|
|
||||||
@@ -1,23 +0,0 @@
|
|||||||
{
|
|
||||||
"m_sTicket": "5ff16e4c-0df9-4002-bc54-cc60fce92de2",
|
|
||||||
"m_iLine": 0,
|
|
||||||
"multiply": 1.0,
|
|
||||||
"price": 7.333333333333334,
|
|
||||||
"tax":
|
|
||||||
{
|
|
||||||
"id": "001",
|
|
||||||
"name": "Tax Standard",
|
|
||||||
"taxcategoryid": "001",
|
|
||||||
"rate": 0.2,
|
|
||||||
"cascade": false
|
|
||||||
},
|
|
||||||
"attributes":
|
|
||||||
{
|
|
||||||
"product.taxcategoryid": "001",
|
|
||||||
"product.printer": "1",
|
|
||||||
"product.name": "Burger - Item Discount @ 12%"
|
|
||||||
},
|
|
||||||
"productid": "fc33fa54-3af1-486b-85e7-9838160053ea",
|
|
||||||
"updated": false,
|
|
||||||
"newprice": 0.0
|
|
||||||
}
|
|
||||||
Reference in New Issue
Block a user