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 {
if (bill.getAccountEvent() != null || bill.getPaidDate() != null) {
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);
Product creditproduct = productBean.findCreditProduct();
......@@ -222,7 +228,7 @@ public class BillBean implements BillBeanLocal {
bill.setPaidDate(when.getTime());
// bill = billFacade.merge(bill);
boolean checked = false;
for (BillLine bl : bill.getBillLines()) {
Product prod = bl.getLineProduct();
......
......@@ -107,6 +107,11 @@ public class CheckoutFiBean implements CheckoutFiBeanLocal {
@RolesAllowed(BillPermission.S_CREATE_VERKKOMAKSU)
public List<CheckoutBank> getToken(Bill bill)
{
if (bill.isFoowavePaymentOver())
{
return null;
}
final LanEventPrivateProperty expire = eventbean.getPrivateProperty(LanEventPrivatePropertyKey.CHECKOUT_FI_KEY_EXPIRE);
final String merchantid = eventbean.getPrivatePropertyString(LanEventPrivatePropertyKey.CHECKOUT_FI_MERCHANT_ID);
final String merchantPassword = eventbean.getPrivatePropertyString(LanEventPrivatePropertyKey.CHECKOUT_FI_MERCHANT_PASSWORD);
......
......@@ -132,7 +132,7 @@ public class Bill extends GenericEntity {
@ManyToOne(optional = false)
@JoinColumn(updatable = false, name = "eventuser_id")
private EventUser user;
@SuppressWarnings("unused")
private static final Logger logger = LoggerFactory.getLogger(Bill.class);
......@@ -338,7 +338,7 @@ public class Bill extends GenericEntity {
public void addProduct(Product product, BigDecimal count) {
this.addProduct(product, count, null);
}
public void addProduct(Product product, BigDecimal count, FoodWave foodwave) {
// If bill number > 0 bill has been sent and extra privileges are needed
// to modify.
......@@ -411,4 +411,16 @@ public class Bill extends GenericEntity {
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!