@Override public String value(WrappedBooking input) { return Attribute.normalize(input.getCreditorId()); } },
@Override public boolean match(WrappedBooking input) { return StringUtils.equalsIgnoreCase(input.getCreditorId(), creditorId); }
@Override public boolean match(WrappedBooking input) { if (creditorId != null && StringUtils.equalsIgnoreCase(creditorId, input.getCreditorId())) { return true; } return operator.link(input, left, right); }
@Override public boolean match(WrappedBooking input) { if (creditorId != null && StringUtils.equalsIgnoreCase(creditorId, input.getCreditorId())) { return true; } return compare.evaluate(value, attribute.value(input)); }
@Override public BookingGroup createGroup(WrappedBooking booking) { if (booking == null || booking.getPurpose() == null || booking.getMandateReference() == null || booking.getCreditorId() == null || booking.getRuleIds() == null) { return null; } log.trace("create group for {}, {}", booking.getCreditorId(), booking.getMandateReference()); return new BookingGroup(booking.getCreditorId()+"|"+booking.getMandateReference(), booking.getRuleIds().toString(), getGroupName(), getGroupType()); }
@Override public BookingGroup createGroup(WrappedBooking booking) { BookingGroup bookingGroup; if (booking.getCreditorId() != null && booking.getMandateReference() != null) { log.trace("interpreted as standing order booking with kref & mref"); bookingGroup = new BookingGroup(booking.getCreditorId(), booking.getMandateReference(), getGroupName(), getGroupType()); } else if (booking.getIban() != null) { log.trace("interpreted as standing order booking with iban"); bookingGroup = new BookingGroup(booking.getIban(), booking.getAmount().toPlainString(), getGroupName(), getGroupType()); } else { log.trace("interpreted as non sepa booking with amount"); bookingGroup = new BookingGroup(booking.getReferenceName(), booking.getAmount().toPlainString(), getGroupName(), getGroupType()); } return bookingGroup; }
/** * Assert if the given booking is a recurrent non sepa booking. * <p> * If a blacklist is defined each entry will be matched with the given input. * If all non null attribute values of the blacklist entry matches the booking will be refused. * * @param booking the booking to be asserted * @param blacklist booking templates to be false * @return true if the booking is a recurrent non sepa booking otherwise false. */ public static boolean isRecurrent(WrappedBooking booking, List<Matcher> blacklist) { // should only have negative amount if (booking.getAmount() == null || booking.getAmount().compareTo(BigDecimal.ZERO) >= 0) { return false; } // should have a purpose if (booking.getPurpose() == null) { return false; } // should not have a valid creditorId if (booking.getCreditorId() != null) { return false; } for (Matcher backlistEntry : blacklist) { if (backlistEntry.match(booking)) { return false; } } return true; }
if (booking.getCreditorId() == null) { return false;