mirror of
https://github.com/puzzle/lightning-beer-tap.git
synced 2025-12-17 07:04: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 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);
|
||||
|
||||
ProcessBuilder pb = new ProcessBuilder(command, memoArg, productsArg);
|
||||
|
||||
Map<String, String> env = pb.environment();
|
||||
env.put("PUZZLE_POS", "beerPos");
|
||||
env.put("PUZZLE_POS", "beerTap");
|
||||
pb.directory(new File("./"));
|
||||
Process p = pb.start();
|
||||
p.waitFor();
|
||||
|
||||
@@ -1,7 +1,6 @@
|
||||
package ch.puzzle.lnd.websocketbridge.dto;
|
||||
|
||||
import java.io.Serializable;
|
||||
import java.time.Instant;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import java.util.Objects;
|
||||
@@ -170,7 +169,7 @@ public class InvoiceDTO implements Serializable {
|
||||
sb.append(",");
|
||||
first = false;
|
||||
}
|
||||
sb.append(orderItemDTO.getItemType());
|
||||
sb.append(orderItemDTO.getProductKey());
|
||||
}
|
||||
return sb.toString();
|
||||
}
|
||||
|
||||
@@ -7,7 +7,7 @@ import java.util.Objects;
|
||||
public class OrderItemDTO {
|
||||
|
||||
private Long id;
|
||||
private OrderItemType itemType;
|
||||
private String productKey;
|
||||
private Integer count;
|
||||
private List<String> options = new ArrayList<>();
|
||||
private Double total;
|
||||
@@ -16,17 +16,19 @@ public class OrderItemDTO {
|
||||
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;
|
||||
}
|
||||
|
||||
public OrderItemType getItemType() {
|
||||
return itemType;
|
||||
}
|
||||
|
||||
public void setItemType(OrderItemType itemType) {
|
||||
this.itemType = itemType;
|
||||
}
|
||||
|
||||
|
||||
public Integer getCount() {
|
||||
return count;
|
||||
@@ -77,7 +79,7 @@ public class OrderItemDTO {
|
||||
public String toString() {
|
||||
return "OrderItemDTO{" +
|
||||
"id=" + id +
|
||||
", itemType=" + itemType +
|
||||
", productKey=" + productKey +
|
||||
", count=" + count +
|
||||
", options=" + options +
|
||||
", 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