@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; }
private boolean evalRecurrentGroup(BookingGroup bookingGroup, List<WrappedBooking> bookings, List<Matcher> contractBlackList) { if (bookings.size() == 0) { return false; } BigDecimal amount = AmountCalculator.calcAmount(bookings); if (amount.compareTo(BigDecimal.ZERO) == 0) { return false; } bookingGroup.setCycle(CycleCalculator.fromDates(bookings.stream() .map(WrappedBooking::getExecutionDate) .collect(Collectors.toList()))); bookingGroup.setContract(ContractValidator.isContract(bookingGroup, bookings, contractBlackList)); bookingGroup.setCancelled(!bookingGroup.isEffective(LocalDate.now(), bookings)); bookingGroup.setMainCategory(bookings.get(0).getMainCategory()); bookingGroup.setSubCategory(bookings.get(0).getSubCategory()); bookingGroup.setSpecification(bookings.get(0).getSpecification()); bookingGroup.setHomepage(bookings.get(0).getHomepage()); bookingGroup.setHotline(bookings.get(0).getHotline()); bookingGroup.setEmail(bookings.get(0).getEmail()); bookingGroup.setLogo(bookings.get(0).getLogo()); bookingGroup.setMandatreference(bookings.get(0).getMandateReference()); if (StringUtils.isNotBlank(bookings.get(0).getOtherAccount())) { bookingGroup.setOtherAccount(bookings.get(0).getOtherAccount()); } else { bookingGroup.setOtherAccount(bookings.get(0).getReferenceName()); } bookingGroup.setAmount(amount); return true; }