Search in sources :

Example 1 with FeeCategory

use of org.mifos.accounts.fees.util.helpers.FeeCategory in project head by mifos.

the class AccountBusinessService method getAppllicableFees.

public List<ApplicableCharge> getAppllicableFees(Integer accountId, UserContext userContext) throws ServiceException {
    List<ApplicableCharge> applicableChargeList = null;
    try {
        AccountBO account = getlegacyAccountDao().getAccount(accountId);
        FeeCategory categoryType = getCategoryType(account.getCustomer());
        if (account.getType() == AccountTypes.LOAN_ACCOUNT || account.getType() == AccountTypes.GROUP_LOAN_ACCOUNT) {
            applicableChargeList = getLoanApplicableCharges(getlegacyAccountDao().getAllApplicableFees(accountId, FeeCategory.LOAN), userContext, (LoanBO) account);
        } else if (account.getType() == AccountTypes.CUSTOMER_ACCOUNT) {
            if (account.getCustomer().getCustomerMeeting() == null) {
                throw new ServiceException(AccountExceptionConstants.APPLY_CAHRGE_NO_CUSTOMER_MEETING_EXCEPTION);
            }
            applicableChargeList = getCustomerApplicableCharges(getlegacyAccountDao().getAllApplicableFees(accountId, categoryType), userContext, ((CustomerAccountBO) account).getCustomer().getCustomerMeeting().getMeeting().getMeetingDetails().getRecurrenceType().getRecurrenceId());
        }
        addMiscFeeAndPenalty(applicableChargeList);
    } catch (PersistenceException pe) {
        throw new ServiceException(pe);
    }
    return applicableChargeList;
}
Also used : CustomerAccountBO(org.mifos.customers.business.CustomerAccountBO) AccountBO(org.mifos.accounts.business.AccountBO) CustomerAccountBO(org.mifos.customers.business.CustomerAccountBO) 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) FeeCategory(org.mifos.accounts.fees.util.helpers.FeeCategory)

Example 2 with FeeCategory

use of org.mifos.accounts.fees.util.helpers.FeeCategory in project head by mifos.

the class FeeServiceFacadeWebTier method createFee.

@Override
public String createFee(FeeCreateDto feeCreateDto) {
    MifosUser user = (MifosUser) SecurityContextHolder.getContext().getAuthentication().getPrincipal();
    UserContext userContext = new UserContextFactory().create(user);
    try {
        FeeCategory feeCategory = (feeCreateDto.getCategoryType() != null) ? FeeCategory.getFeeCategory(feeCreateDto.getCategoryType()) : null;
        FeeFrequencyType feeFrequencyType = (feeCreateDto.getFeeFrequencyType() != null) ? FeeFrequencyType.getFeeFrequencyType(feeCreateDto.getFeeFrequencyType()) : null;
        FeePayment feePayment = (feeCreateDto.getFeePaymentType() != null) ? FeePayment.getFeePayment(feeCreateDto.getFeePaymentType()) : null;
        FeeFormula feeFormula = (feeCreateDto.getFeeFormula() != null) ? FeeFormula.getFeeFormula(feeCreateDto.getFeeFormula()) : null;
        RecurrenceType feeRecurrenceType = (feeCreateDto.getFeeRecurrenceType() != null) ? RecurrenceType.fromInt(feeCreateDto.getFeeRecurrenceType()) : null;
        FeeCreateRequest feeCreateRequest = new FeeCreateRequest(feeCategory, feeFrequencyType, feeCreateDto.getGlCode(), feePayment, feeFormula, feeCreateDto.getFeeName(), feeCreateDto.isRateFee(), feeCreateDto.isCustomerDefaultFee(), feeCreateDto.getRate(), feeCreateDto.getCurrencyId(), feeCreateDto.getAmount(), feeRecurrenceType, feeCreateDto.getMonthRecurAfter(), feeCreateDto.getWeekRecurAfter());
        FeeBO fee = this.feeService.create(feeCreateRequest, userContext);
        return fee.getFeeId().toString();
    } catch (ApplicationException e) {
        throw new BusinessRuleException(e.getKey(), e);
    }
}
Also used : FeePayment(org.mifos.accounts.fees.util.helpers.FeePayment) BusinessRuleException(org.mifos.service.BusinessRuleException) FeeFormula(org.mifos.accounts.fees.util.helpers.FeeFormula) ApplicationException(org.mifos.framework.exceptions.ApplicationException) FeeFrequencyType(org.mifos.accounts.fees.util.helpers.FeeFrequencyType) UserContext(org.mifos.security.util.UserContext) RecurrenceType(org.mifos.application.meeting.util.helpers.RecurrenceType) MifosUser(org.mifos.security.MifosUser) UserContextFactory(org.mifos.accounts.servicefacade.UserContextFactory) FeeBO(org.mifos.accounts.fees.business.FeeBO) FeeCategory(org.mifos.accounts.fees.util.helpers.FeeCategory)

Aggregations

FeeCategory (org.mifos.accounts.fees.util.helpers.FeeCategory)2 AccountBO (org.mifos.accounts.business.AccountBO)1 FeeBO (org.mifos.accounts.fees.business.FeeBO)1 FeeFormula (org.mifos.accounts.fees.util.helpers.FeeFormula)1 FeeFrequencyType (org.mifos.accounts.fees.util.helpers.FeeFrequencyType)1 FeePayment (org.mifos.accounts.fees.util.helpers.FeePayment)1 LoanBO (org.mifos.accounts.loan.business.LoanBO)1 UserContextFactory (org.mifos.accounts.servicefacade.UserContextFactory)1 RecurrenceType (org.mifos.application.meeting.util.helpers.RecurrenceType)1 CustomerAccountBO (org.mifos.customers.business.CustomerAccountBO)1 ApplicableCharge (org.mifos.dto.domain.ApplicableCharge)1 ApplicationException (org.mifos.framework.exceptions.ApplicationException)1 PersistenceException (org.mifos.framework.exceptions.PersistenceException)1 ServiceException (org.mifos.framework.exceptions.ServiceException)1 MifosUser (org.mifos.security.MifosUser)1 UserContext (org.mifos.security.util.UserContext)1 BusinessRuleException (org.mifos.service.BusinessRuleException)1