Search in sources :

Example 11 with ApplicableCharge

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;
}
Also used : ServiceException(org.mifos.framework.exceptions.ServiceException) LoanBO(org.mifos.accounts.loan.business.LoanBO) ApplicableCharge(org.mifos.dto.domain.ApplicableCharge) PersistenceException(org.mifos.framework.exceptions.PersistenceException)

Example 12 with ApplicableCharge

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);
}
Also used : ApplicableCharge(org.mifos.dto.domain.ApplicableCharge)

Example 13 with 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);
    }
}
Also used : RatePenaltyBO(org.mifos.accounts.penalties.business.RatePenaltyBO) PenaltyBO(org.mifos.accounts.penalties.business.PenaltyBO) AmountPenaltyBO(org.mifos.accounts.penalties.business.AmountPenaltyBO) RatePenaltyBO(org.mifos.accounts.penalties.business.RatePenaltyBO) LocalizationConverter(org.mifos.framework.util.LocalizationConverter) ApplicableCharge(org.mifos.dto.domain.ApplicableCharge) AmountPenaltyBO(org.mifos.accounts.penalties.business.AmountPenaltyBO)

Aggregations

ApplicableCharge (org.mifos.dto.domain.ApplicableCharge)13 CustomerAccountBO (org.mifos.customers.business.CustomerAccountBO)6 AccountBO (org.mifos.accounts.business.AccountBO)5 Test (org.junit.Test)4 LoanBO (org.mifos.accounts.loan.business.LoanBO)4 UserContext (org.mifos.security.util.UserContext)4 Money (org.mifos.framework.util.helpers.Money)3 HashMap (java.util.HashMap)2 Map (java.util.Map)2 PersistenceException (org.mifos.framework.exceptions.PersistenceException)2 ServiceException (org.mifos.framework.exceptions.ServiceException)2 LocalizationConverter (org.mifos.framework.util.LocalizationConverter)2 RequestMapping (org.springframework.web.bind.annotation.RequestMapping)2 ResponseBody (org.springframework.web.bind.annotation.ResponseBody)2 Ignore (org.junit.Ignore)1 AmountFeeBO (org.mifos.accounts.fees.business.AmountFeeBO)1 FeeBO (org.mifos.accounts.fees.business.FeeBO)1 RateFeeBO (org.mifos.accounts.fees.business.RateFeeBO)1 FeeCategory (org.mifos.accounts.fees.util.helpers.FeeCategory)1 AmountPenaltyBO (org.mifos.accounts.penalties.business.AmountPenaltyBO)1