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);
......
...@@ -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!