mirror of
https://github.com/puzzle/lightning-beer-tap.git
synced 2025-12-18 15:44:21 +01:00
Updates dto and only draw beer when beer Tap
This commit is contained in:
@@ -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();
|
||||||
|
|||||||
@@ -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();
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -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 +
|
||||||
|
|||||||
@@ -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;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
Reference in New Issue
Block a user