Interface DunningService

All Known Implementing Classes:
DunningServiceImpl

public interface DunningService
  • Method Details

    • getMaxDunningLevelStatus

      Entity getMaxDunningLevelStatus()
    • getMinDunningLevelStatus

      Entity getMinDunningLevelStatus()
    • calculateMaturitydate

      @Nullable @Nullable org.joda.time.LocalDate calculateMaturitydate(Entity debitor, Optional<Entity> nextDunningLevelStatus, Optional<org.joda.time.LocalDate> fromDateOverride)
      Calculates the next dunning maturity date. Uses either the given optional fromDateOverride or the return value of getLatestMaturityDate as base and adds the maturity_in_days of the next dunning level status. If no next dunning level status is selectable (e.g. the highest dunning level status is already selected) null is returned.
    • getLatestMaturityDate

      org.joda.time.LocalDate getLatestMaturityDate(Entity debitor)
      Returns the latest maturity date of a given debitor - if the current Dunning_level_status.level is higher then the current dunning_level_status.level, the maturity date of the current dunning_level_status is returned - if the current Dunnint_level_status.level equals the lowest Dunning_level_status.level (e.g. "Zahlungsfrist"), either the debitors maturity date or the debitors rate maturity date is returned, depending on the quantity of rates (relPayment_schedule.quantity). If more than one rate is planned, the rate maturity date is used, else the debitors maturity date is returned.
    • getNumberOfPaymentPlanRates

      int getNumberOfPaymentPlanRates(Entity debitor)
    • getPreviousDunningLevelStatus

      @Nullable @Nullable Entity getPreviousDunningLevelStatus(Entity debitor)
    • getNextDunningLevelStatus

      @Nullable @Nullable Entity getNextDunningLevelStatus(Entity debitor)
    • getCurrentDunningLevelStatus

      Entity getCurrentDunningLevelStatus(Entity debitor)
      Gets the status of the highest dunning level of a given debitor If no dunning level is attached to this debitor, the lowest available dunning level status is returned
    • getCurrentDunningLevel

      @Nullable @Nullable Entity getCurrentDunningLevel(Entity debitor)
    • isOnLowestDunningLevel

      boolean isOnLowestDunningLevel(Entity debitor)
    • isOnHighestDunningLevel

      boolean isOnHighestDunningLevel(Entity debitor)
    • isOpenOrPartlyBalanced

      boolean isOpenOrPartlyBalanced(Entity debitor)
      Returns true if the clearing status of the given debitor is open or partly_balanced
      Parameters:
      debitor - the debitor entity to check
      Returns:
      true, if id of clearing status is 'open' or 'partly_balanced', false otherwise
    • finalizeDunning

      void finalizeDunning(Entity debitor, Optional<Entity> newDunningLevel) throws InterruptedException
      Writes the maturity date and dunning level_status of the latest dunning level (attached to the given debitor) to the given debitor
      Throws:
      InterruptedException
    • riseDunningLevel

      void riseDunningLevel(Entity debitor, org.joda.time.LocalDate dunningDate, Optional<org.joda.time.LocalDate> fromDateOverride)
      Increase dunning level of a given debitor by 1. Do nothing if the debitor already is at the highest dunning level The maturitydate is calculated as follows:

       1. If fromDateOverride is set: fromDateOverride + nextDunningLevelStatus.maturity_in_days
       2. If fromDateOverride is not set: latestMaturityDate of Debitor + nextDunningLevelStatus.maturity_in_days
       
    • lowerDunningLevel

      void lowerDunningLevel(Entity debitor) throws InterruptedException
      lower the dunning level for the given debitor if the current dunning level of the debitor has dunning vouchers which are not exported the dunning vouchers will be deleted if the current dunning level of the debitor has dunning vouchers which are exported balance dunning vouchers will be created
      Parameters:
      debitor - the debitors which shall be lowered
      Throws:
      InterruptedException
    • createBalanceDunningVoucher

      Entity createBalanceDunningVoucher(Entity voucher, org.joda.time.LocalDate date) throws InterruptedException
      Creates a copy of the passed voucher, switches the accounts and sets the appropriate Voucher_type, thereby balancing the voucher
      Throws:
      InterruptedException
    • resetDunningLevel

      void resetDunningLevel(Entity debitor)
      Reset the dunning level of a given debitor to the lowest available dunning level