Class DunningServiceImpl
java.lang.Object
ch.tocco.nice2.optional.debitor.impl.services.dunning.DunningServiceImpl
- All Implemented Interfaces:
DunningService
-
Constructor Summary
ConstructorsConstructorDescriptionDunningServiceImpl(QueryBuilderFactory queryBuilderFactory, LogicCopyService logicCopyService, Context context, CommandExecutor commandExecutor, EntityDefaultValueService entityDefaultValueService, VoucherService voucherService, BusinessUnitManager businessUnitManager, CurrentArticlePriceService currentArticlePriceService) -
Method Summary
Modifier and TypeMethodDescription@Nullable org.joda.time.LocalDatecalculateMaturitydate(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 vouchervoidfinalizeDunning(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 EntitygetCurrentDunningLevel(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 returned@Nullable org.joda.time.LocalDategetLatestMaturityDate(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 EntitygetNextDunningLevelStatus(Entity debitor) intgetNumberOfPaymentPlanRates(Entity debitor) @Nullable EntitygetPreviousDunningLevelStatus(Entity debitor) booleanisOnHighestDunningLevel(Entity debitor) booleanisOnLowestDunningLevel(Entity debitor) booleanisOpenOrPartlyBalanced(Entity debitor) Returns true if the clearing status of the given debitor is open or partly_balancedvoidlowerDunningLevel(Entity debitor) lower the dunning level for the givendebitorif 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 createdvoidresetDunningLevel(Entity debitor) Reset the dunning level of a given debitor to the lowest available dunning levelvoidriseDunningLevel(Entity debitor, org.joda.time.LocalDate dunningDate, Optional<org.joda.time.LocalDate> fromDateOverride) Increase dunning level of a given debitor by 1.
-
Constructor Details
-
DunningServiceImpl
public DunningServiceImpl(QueryBuilderFactory queryBuilderFactory, LogicCopyService logicCopyService, Context context, CommandExecutor commandExecutor, EntityDefaultValueService entityDefaultValueService, VoucherService voucherService, BusinessUnitManager businessUnitManager, CurrentArticlePriceService currentArticlePriceService)
-
-
Method Details
-
getMaxDunningLevelStatus
- Specified by:
getMaxDunningLevelStatusin interfaceDunningService
-
getMinDunningLevelStatus
- Specified by:
getMinDunningLevelStatusin interfaceDunningService
-
calculateMaturitydate
@Nullable public @Nullable org.joda.time.LocalDate calculateMaturitydate(Entity debitor, Optional<Entity> nextDunningLevelStatus, Optional<org.joda.time.LocalDate> fromDateOverride) Description copied from interface:DunningServiceCalculates 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.- Specified by:
calculateMaturitydatein interfaceDunningService
-
getLatestMaturityDate
Description copied from interface:DunningServiceReturns 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.- Specified by:
getLatestMaturityDatein interfaceDunningService
-
getNumberOfPaymentPlanRates
- Specified by:
getNumberOfPaymentPlanRatesin interfaceDunningService
-
getNextDunningLevelStatus
- Specified by:
getNextDunningLevelStatusin interfaceDunningService
-
getPreviousDunningLevelStatus
- Specified by:
getPreviousDunningLevelStatusin interfaceDunningService
-
getCurrentDunningLevelStatus
Description copied from interface:DunningServiceGets 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- Specified by:
getCurrentDunningLevelStatusin interfaceDunningService
-
getCurrentDunningLevel
- Specified by:
getCurrentDunningLevelin interfaceDunningService
-
isOnLowestDunningLevel
- Specified by:
isOnLowestDunningLevelin interfaceDunningService
-
isOnHighestDunningLevel
- Specified by:
isOnHighestDunningLevelin interfaceDunningService
-
isOpenOrPartlyBalanced
Description copied from interface:DunningServiceReturns true if the clearing status of the given debitor is open or partly_balanced- Specified by:
isOpenOrPartlyBalancedin interfaceDunningService- Parameters:
debitor- the debitor entity to check- Returns:
- true, if id of clearing status is 'open' or 'partly_balanced', false otherwise
-
finalizeDunning
Description copied from interface:DunningServiceWrites the maturity date and dunning level_status of the latest dunning level (attached to the given debitor) to the given debitor- Specified by:
finalizeDunningin interfaceDunningService
-
riseDunningLevel
public void riseDunningLevel(Entity debitor, org.joda.time.LocalDate dunningDate, Optional<org.joda.time.LocalDate> fromDateOverride) Description copied from interface:DunningServiceIncrease 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
- Specified by:
riseDunningLevelin interfaceDunningService
-
lowerDunningLevel
Description copied from interface:DunningServicelower the dunning level for the givendebitorif 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- Specified by:
lowerDunningLevelin interfaceDunningService- Parameters:
debitor- the debitors which shall be lowered
-
createBalanceDunningVoucher
Description copied from interface:DunningServiceCreates a copy of the passed voucher, switches the accounts and sets the appropriate Voucher_type, thereby balancing the voucher- Specified by:
createBalanceDunningVoucherin interfaceDunningService
-
resetDunningLevel
Description copied from interface:DunningServiceReset the dunning level of a given debitor to the lowest available dunning level- Specified by:
resetDunningLevelin interfaceDunningService
-