double monthYears = getTimeSystem().calculateYears( actualMonthBegin, actualMonthEnd );
double monthDays = getTimeSystem().calculateDays( actualMonthBegin, actualMonthEnd );
double monthRate = getInterestRateProvider().getRate( actualMonthBegin );
//add the rent for the rent
Money baseForMonth = rentSummer.immutable();
Money compoundInterest;
if ( getBackingCalculationSystem().isCompoundSystem() && baseForMonth.getValue() != 0 ) {
compoundInterest = getBackingCalculationSystem().calculateInterest( baseForMonth, monthYears, monthDays, monthRate );
rentSummer.plus( compoundInterest );
} else {
compoundInterest = Money.ZERO;
}
//add the rent for the amount
Money interest = getBackingCalculationSystem().calculateInterest( amount, monthYears, monthDays, monthRate );
rentSummer.plus( interest );
//Build the information object (if expected)
interestDetails.add( new InterestDetails( actualMonthBegin, actualMonthEnd, monthRate, baseForMonth, interest.plus( compoundInterest ), monthDays ) );
//Next month --> now we really need the first day of the month
actualMonthBegin = actualMonthBegin.plusMonths( 1 ).withDayOfMonth( 1 );
}