Updates dto and only draw beer when beer Tap

This commit is contained in:
Thomas Philipona
2019-05-28 15:47:33 +02:00
parent 42d69192f2
commit 6174300162
4 changed files with 19 additions and 29 deletions

View File

@@ -61,12 +61,17 @@ public class MyStompSessionHandler extends StompSessionHandlerAdapter {
String memoArg = "--memo=\"" + invoice.getMemo() + "\""; String memoArg = "--memo=\"" + invoice.getMemo() + "\"";
String productsArg = "--products=" + invoice.getOrderedProducts(); String productsArg = "--products=" + invoice.getOrderedProducts();
if(invoice != null && !invoice.getMemo().startsWith("beerTap")) {
logger.info("Not a beerTap invoice");
return;
}
logger.info("Command: " + command + ", Args: " + memoArg + ", " + productsArg); logger.info("Command: " + command + ", Args: " + memoArg + ", " + productsArg);
ProcessBuilder pb = new ProcessBuilder(command, memoArg, productsArg); ProcessBuilder pb = new ProcessBuilder(command, memoArg, productsArg);
Map<String, String> env = pb.environment(); Map<String, String> env = pb.environment();
env.put("PUZZLE_POS", "beerPos"); env.put("PUZZLE_POS", "beerTap");
pb.directory(new File("./")); pb.directory(new File("./"));
Process p = pb.start(); Process p = pb.start();
p.waitFor(); p.waitFor();

View File

@@ -1,7 +1,6 @@
package ch.puzzle.lnd.websocketbridge.dto; package ch.puzzle.lnd.websocketbridge.dto;
import java.io.Serializable; import java.io.Serializable;
import java.time.Instant;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.List; import java.util.List;
import java.util.Objects; import java.util.Objects;
@@ -170,7 +169,7 @@ public class InvoiceDTO implements Serializable {
sb.append(","); sb.append(",");
first = false; first = false;
} }
sb.append(orderItemDTO.getItemType()); sb.append(orderItemDTO.getProductKey());
} }
return sb.toString(); return sb.toString();
} }

View File

@@ -7,7 +7,7 @@ import java.util.Objects;
public class OrderItemDTO { public class OrderItemDTO {
private Long id; private Long id;
private OrderItemType itemType; private String productKey;
private Integer count; private Integer count;
private List<String> options = new ArrayList<>(); private List<String> options = new ArrayList<>();
private Double total; private Double total;
@@ -16,17 +16,19 @@ public class OrderItemDTO {
return id; return id;
} }
public void setId(Long id) { public String getProductKey() {
return productKey;
}
public void setProductKey(String productKey) {
this.productKey = productKey;
}
public void setId(Long id) {
this.id = id; this.id = id;
} }
public OrderItemType getItemType() {
return itemType;
}
public void setItemType(OrderItemType itemType) {
this.itemType = itemType;
}
public Integer getCount() { public Integer getCount() {
return count; return count;
@@ -77,7 +79,7 @@ public class OrderItemDTO {
public String toString() { public String toString() {
return "OrderItemDTO{" + return "OrderItemDTO{" +
"id=" + id + "id=" + id +
", itemType=" + itemType + ", productKey=" + productKey +
", count=" + count + ", count=" + count +
", options=" + options + ", options=" + options +
", total=" + total + ", total=" + total +

View File

@@ -1,16 +0,0 @@
package ch.puzzle.lnd.websocketbridge.dto;
public enum OrderItemType {
LARGE_BEER(2.0d),
SMALL_BEER(1.0d);
private Double price;
OrderItemType(Double price) {
this.price = price;
}
public Double getPrice() {
return price;
}
}