use of org.mifos.dto.domain.ApplicableCharge in project head by mifos.
the class LoanBusinessService method getAppllicablePenalties.
public List<ApplicableCharge> getAppllicablePenalties(Integer accountId, UserContext userContext) throws ServiceException {
List<ApplicableCharge> applicableChargeList = null;
try {
LoanBO loan = getlegacyLoanDao().getAccount(accountId);
applicableChargeList = getLoanApplicablePenalties(getlegacyLoanDao().getAllApplicablePenalties(accountId), userContext, loan);
} catch (PersistenceException pe) {
throw new ServiceException(pe);
}
addMiscPenalty(applicableChargeList);
return applicableChargeList;
}
use of org.mifos.dto.domain.ApplicableCharge in project head by mifos.
the class LoanBusinessService method addMiscPenalty.
private void addMiscPenalty(List<ApplicableCharge> applicableChargeList) {
ApplicableCharge applicableCharge = new ApplicableCharge();
applicableCharge.setFeeId(AccountConstants.MISC_PENALTY);
applicableCharge.setFeeName("Misc Penalty");
applicableCharge.setIsRateType(false);
applicableCharge.setIsPenaltyType(false);
applicableChargeList.add(applicableCharge);
}
use of org.mifos.dto.domain.ApplicableCharge in project head by mifos.
the class LoanBusinessService method populaleApplicableCharge.
private void populaleApplicableCharge(List<ApplicableCharge> applicableChargeList, List<PenaltyBO> penaltyList, UserContext userContext) {
for (PenaltyBO penalty : penaltyList) {
ApplicableCharge applicableCharge = new ApplicableCharge();
applicableCharge.setFeeId(penalty.getPenaltyId().toString());
applicableCharge.setFeeName(penalty.getPenaltyName());
applicableCharge.setIsPenaltyType(true);
if (penalty instanceof RatePenaltyBO) {
applicableCharge.setAmountOrRate(new LocalizationConverter().getDoubleStringForInterest(((RatePenaltyBO) penalty).getRate()));
applicableCharge.setFormula(((RatePenaltyBO) penalty).getFormula().getFormulaStringThatHasName());
applicableCharge.setIsRateType(true);
} else {
applicableCharge.setAmountOrRate(((AmountPenaltyBO) penalty).getAmount().toString());
applicableCharge.setIsRateType(false);
}
if (!penalty.isOneTime()) {
applicableCharge.setPeriodicity("true");
applicableCharge.setFormula(penalty.getPenaltyFrequency().getName());
}
applicableChargeList.add(applicableCharge);
}
}
Aggregations