Interface DunningService
- All Known Implementing Classes:
DunningServiceImpl
public interface DunningService
-
Method Summary
Modifier and TypeMethodDescription@Nullable org.joda.time.LocalDate
calculateMaturitydate
(Entity debitor, Optional<Entity> nextDunningLevelStatus, Optional<org.joda.time.LocalDate> fromDateOverride) Calculates the next dunning maturity date.createBalanceDunningVoucher
(Entity voucher, org.joda.time.LocalDate date) Creates a copy of the passed voucher, switches the accounts and sets the appropriate Voucher_type, thereby balancing the vouchervoid
finalizeDunning
(Entity debitor, Optional<Entity> newDunningLevel) Writes the maturity date and dunning level_status of the latest dunning level (attached to the given debitor) to the given debitor@Nullable Entity
getCurrentDunningLevel
(Entity debitor) 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 returnedorg.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.@Nullable Entity
getNextDunningLevelStatus
(Entity debitor) int
getNumberOfPaymentPlanRates
(Entity debitor) @Nullable Entity
getPreviousDunningLevelStatus
(Entity debitor) boolean
isOnHighestDunningLevel
(Entity debitor) boolean
isOnLowestDunningLevel
(Entity debitor) boolean
isOpenOrPartlyBalanced
(Entity debitor) Returns true if the clearing status of the given debitor is open or partly_balancedvoid
lowerDunningLevel
(Entity debitor) lower the dunning level for the givendebitor
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 createdvoid
resetDunningLevel
(Entity debitor) Reset the dunning level of a given debitor to the lowest available dunning levelvoid
riseDunningLevel
(Entity debitor, org.joda.time.LocalDate dunningDate, Optional<org.joda.time.LocalDate> fromDateOverride) Increase dunning level of a given debitor by 1.
-
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
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
-
getPreviousDunningLevelStatus
-
getNextDunningLevelStatus
-
getCurrentDunningLevelStatus
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
-
isOnLowestDunningLevel
-
isOnHighestDunningLevel
-
isOpenOrPartlyBalanced
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
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
lower the dunning level for the givendebitor
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
Reset the dunning level of a given debitor to the lowest available dunning level
-