Commit 6ccbd31f by Riku Silvola

Merge branch 'master' of codecrew.fi:bortal

2 parents 1edd3b9f 5121e6f8
...@@ -205,6 +205,12 @@ public class BillBean implements BillBeanLocal { ...@@ -205,6 +205,12 @@ public class BillBean implements BillBeanLocal {
if (bill.getAccountEvent() != null || bill.getPaidDate() != null) { if (bill.getAccountEvent() != null || bill.getPaidDate() != null) {
throw new EJBException("Bill already marked paid!"); throw new EJBException("Bill already marked paid!");
} }
if (bill.isFoowavePaymentOver())
{
throw new EJBException("Trying to mark paid a closed or left foodwave");
}
bill = billFacade.reload(bill); bill = billFacade.reload(bill);
Product creditproduct = productBean.findCreditProduct(); Product creditproduct = productBean.findCreditProduct();
...@@ -222,7 +228,7 @@ public class BillBean implements BillBeanLocal { ...@@ -222,7 +228,7 @@ public class BillBean implements BillBeanLocal {
bill.setPaidDate(when.getTime()); bill.setPaidDate(when.getTime());
// bill = billFacade.merge(bill); // bill = billFacade.merge(bill);
boolean checked = false;
for (BillLine bl : bill.getBillLines()) { for (BillLine bl : bill.getBillLines()) {
Product prod = bl.getLineProduct(); Product prod = bl.getLineProduct();
......
...@@ -107,6 +107,11 @@ public class CheckoutFiBean implements CheckoutFiBeanLocal { ...@@ -107,6 +107,11 @@ public class CheckoutFiBean implements CheckoutFiBeanLocal {
@RolesAllowed(BillPermission.S_CREATE_VERKKOMAKSU) @RolesAllowed(BillPermission.S_CREATE_VERKKOMAKSU)
public List<CheckoutBank> getToken(Bill bill) public List<CheckoutBank> getToken(Bill bill)
{ {
if (bill.isFoowavePaymentOver())
{
return null;
}
final LanEventPrivateProperty expire = eventbean.getPrivateProperty(LanEventPrivatePropertyKey.CHECKOUT_FI_KEY_EXPIRE); final LanEventPrivateProperty expire = eventbean.getPrivateProperty(LanEventPrivatePropertyKey.CHECKOUT_FI_KEY_EXPIRE);
final String merchantid = eventbean.getPrivatePropertyString(LanEventPrivatePropertyKey.CHECKOUT_FI_MERCHANT_ID); final String merchantid = eventbean.getPrivatePropertyString(LanEventPrivatePropertyKey.CHECKOUT_FI_MERCHANT_ID);
final String merchantPassword = eventbean.getPrivatePropertyString(LanEventPrivatePropertyKey.CHECKOUT_FI_MERCHANT_PASSWORD); final String merchantPassword = eventbean.getPrivatePropertyString(LanEventPrivatePropertyKey.CHECKOUT_FI_MERCHANT_PASSWORD);
......
...@@ -132,7 +132,7 @@ public class Bill extends GenericEntity { ...@@ -132,7 +132,7 @@ public class Bill extends GenericEntity {
@ManyToOne(optional = false) @ManyToOne(optional = false)
@JoinColumn(updatable = false, name = "eventuser_id") @JoinColumn(updatable = false, name = "eventuser_id")
private EventUser user; private EventUser user;
@SuppressWarnings("unused") @SuppressWarnings("unused")
private static final Logger logger = LoggerFactory.getLogger(Bill.class); private static final Logger logger = LoggerFactory.getLogger(Bill.class);
...@@ -338,7 +338,7 @@ public class Bill extends GenericEntity { ...@@ -338,7 +338,7 @@ public class Bill extends GenericEntity {
public void addProduct(Product product, BigDecimal count) { public void addProduct(Product product, BigDecimal count) {
this.addProduct(product, count, null); this.addProduct(product, count, null);
} }
public void addProduct(Product product, BigDecimal count, FoodWave foodwave) { public void addProduct(Product product, BigDecimal count, FoodWave foodwave) {
// If bill number > 0 bill has been sent and extra privileges are needed // If bill number > 0 bill has been sent and extra privileges are needed
// to modify. // to modify.
...@@ -411,4 +411,16 @@ public class Bill extends GenericEntity { ...@@ -411,4 +411,16 @@ public class Bill extends GenericEntity {
this.sentDate = sentDate; this.sentDate = sentDate;
} }
public boolean isFoowavePaymentOver() {
boolean ret = false;
for (BillLine bl : billLines)
{
if (bl.getFoodwave() != null && (bl.getFoodwave().getClosed() || bl.getFoodwave().getTime().after(Calendar.getInstance())))
{
ret = true;
break;
}
}
return ret;
}
} }
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!