Search in sources :

Example 1 with FeeFormulaEntity

use of org.mifos.accounts.fees.business.FeeFormulaEntity in project head by mifos.

the class FeeServiceFacadeWebTier method parameters.

private FeeParameters parameters() {
    try {
        List<GLCodeEntity> glCodes = generalLedgerDao.retreiveGlCodesBy(FinancialActionConstants.FEEPOSTING, FinancialConstants.CREDIT);
        List<CategoryTypeEntity> categories = this.feeDao.doRetrieveFeeCategories();
        List<FeeFormulaEntity> formulas = this.feeDao.retrieveFeeFormulae();
        List<FeeFrequencyTypeEntity> frequencies = this.feeDao.retrieveFeeFrequencies();
        List<FeePaymentEntity> timesOfCharging = this.feeDao.retrieveFeePayments();
        List<MasterDataEntity> timesOfChargeingCustomer = new ArrayList<MasterDataEntity>();
        for (MasterDataEntity timeOfCharging : timesOfCharging) {
            if (timeOfCharging.getId().equals(FeePayment.UPFRONT.getValue())) {
                timesOfChargeingCustomer.add(timeOfCharging);
            }
        }
        return new FeeParameters(listToMap(categories), listToMap(timesOfCharging), listToMap(timesOfChargeingCustomer), listToMap(formulas), listToMap(frequencies), glCodesToMap(glCodes));
    } catch (FinancialException e) {
        throw new BusinessRuleException(e.getKey(), e);
    }
}
Also used : MasterDataEntity(org.mifos.application.master.business.MasterDataEntity) ArrayList(java.util.ArrayList) GLCodeEntity(org.mifos.accounts.financial.business.GLCodeEntity) FeePaymentEntity(org.mifos.accounts.fees.business.FeePaymentEntity) BusinessRuleException(org.mifos.service.BusinessRuleException) FeeFormulaEntity(org.mifos.accounts.fees.business.FeeFormulaEntity) FeeFrequencyTypeEntity(org.mifos.accounts.fees.business.FeeFrequencyTypeEntity) CategoryTypeEntity(org.mifos.accounts.fees.business.CategoryTypeEntity) FinancialException(org.mifos.accounts.financial.exceptions.FinancialException) FeeParameters(org.mifos.dto.screen.FeeParameters)

Example 2 with FeeFormulaEntity

use of org.mifos.accounts.fees.business.FeeFormulaEntity in project head by mifos.

the class FeeDaoHibernateIntegrationTest method shouldFindFeeFormulaType.

@Test
public void shouldFindFeeFormulaType() {
    // exercise test
    FeeFormulaEntity entity = this.feeDao.findFeeFormulaEntityByType(FeeFormula.AMOUNT_AND_INTEREST);
    // verification
    assertThat(entity, is(notNullValue()));
}
Also used : FeeFormulaEntity(org.mifos.accounts.fees.business.FeeFormulaEntity) Test(org.junit.Test)

Example 3 with FeeFormulaEntity

use of org.mifos.accounts.fees.business.FeeFormulaEntity in project head by mifos.

the class TestObjectFactory method createPeriodicRateFee.

public static RateFeeBO createPeriodicRateFee(final String feeName, final FeeCategory feeCategory, final Double rate, final FeeFormula feeFormula, final RecurrenceType meetingFrequency, final Short recurAfter, final UserContext userContext, final MeetingBO meeting) {
    try {
        MeetingBO newMeeting = new MeetingBO(meetingFrequency, recurAfter, new DateTimeService().getCurrentJavaDateTime(), MeetingType.PERIODIC_FEE);
        // GLCodeEntity glCode =
        // ChartOfAccountsCache.get("31301").getAssociatedGlcode();
        GLCodeEntity glCode = new GLCodeEntity((short) 1, "31301");
        RateFeeBO fee = new RateFeeBO(userContext, feeName, new CategoryTypeEntity(feeCategory), new FeeFrequencyTypeEntity(FeeFrequencyType.PERIODIC), glCode, rate, new FeeFormulaEntity(feeFormula), false, newMeeting);
        // [keith] I have no idea why the fee must save itself. Otherwise
        // mySQL errors crop up
        // when you try to attach the fee to a loan.
        fee.save();
        // addObject(fee);
        return fee;
    // return (RateFeeBO) addObject(testObjectPersistence.persist(fee));
    // return (RateFeeBO)
    // addObject(testObjectPersistence.createFee(fee));
    } catch (Exception e) {
        throw new RuntimeException(e);
    }
}
Also used : RateFeeBO(org.mifos.accounts.fees.business.RateFeeBO) FeeFormulaEntity(org.mifos.accounts.fees.business.FeeFormulaEntity) MifosRuntimeException(org.mifos.core.MifosRuntimeException) FeeFrequencyTypeEntity(org.mifos.accounts.fees.business.FeeFrequencyTypeEntity) MeetingBO(org.mifos.application.meeting.business.MeetingBO) GLCodeEntity(org.mifos.accounts.financial.business.GLCodeEntity) CategoryTypeEntity(org.mifos.accounts.fees.business.CategoryTypeEntity) DateTimeService(org.mifos.framework.util.DateTimeService) SystemException(org.mifos.framework.exceptions.SystemException) MifosRuntimeException(org.mifos.core.MifosRuntimeException) ProductDefinitionException(org.mifos.accounts.productdefinition.exceptions.ProductDefinitionException) ApplicationException(org.mifos.framework.exceptions.ApplicationException) CustomerException(org.mifos.customers.exceptions.CustomerException) PersistenceException(org.mifos.framework.exceptions.PersistenceException) MeetingException(org.mifos.application.meeting.exceptions.MeetingException) OfficeException(org.mifos.customers.office.exceptions.OfficeException)

Example 4 with FeeFormulaEntity

use of org.mifos.accounts.fees.business.FeeFormulaEntity in project head by mifos.

the class TestObjectFactory method createOneTimeRateFee.

/**
     * createOneTimeRateFee.
     * <p/>
     * Changing TestObjectFactory#getUserContext() to {@link TestUtils#makeUserWithLocales()} caused a failure in
     * {@link LoanBOIntegrationTest#testApplyUpfrontFee} (and other tests).
     *
     * @param categoryTypeName TODO
     */
public static FeeBO createOneTimeRateFee(final String feeName, final FeeCategory feeCategory, final Double rate, final FeeFormula feeFormula, final FeePayment feePayment, String categoryTypeName) {
    GLCodeEntity glCode = (GLCodeEntity) StaticHibernateUtil.getSessionTL().get(GLCodeEntity.class, TestGeneralLedgerCode.FEES);
    FeeBO fee;
    try {
        LookUpValueEntity lookUpValue = new LookUpValueEntity();
        lookUpValue.setLookUpName(categoryTypeName);
        CategoryTypeEntity categoryType = new CategoryTypeEntity(feeCategory);
        categoryType.setLookUpValue(lookUpValue);
        fee = new RateFeeBO(getUserContext(), feeName, categoryType, new FeeFrequencyTypeEntity(FeeFrequencyType.ONETIME), glCode, rate, new FeeFormulaEntity(feeFormula), false, new FeePaymentEntity(feePayment));
    } catch (Exception e) {
        throw new RuntimeException(e);
    }
    return testObjectPersistence.createFee(fee);
}
Also used : RateFeeBO(org.mifos.accounts.fees.business.RateFeeBO) FeeFormulaEntity(org.mifos.accounts.fees.business.FeeFormulaEntity) MifosRuntimeException(org.mifos.core.MifosRuntimeException) FeeFrequencyTypeEntity(org.mifos.accounts.fees.business.FeeFrequencyTypeEntity) GLCodeEntity(org.mifos.accounts.financial.business.GLCodeEntity) CategoryTypeEntity(org.mifos.accounts.fees.business.CategoryTypeEntity) FeePaymentEntity(org.mifos.accounts.fees.business.FeePaymentEntity) FeeBO(org.mifos.accounts.fees.business.FeeBO) AmountFeeBO(org.mifos.accounts.fees.business.AmountFeeBO) RateFeeBO(org.mifos.accounts.fees.business.RateFeeBO) SystemException(org.mifos.framework.exceptions.SystemException) MifosRuntimeException(org.mifos.core.MifosRuntimeException) ProductDefinitionException(org.mifos.accounts.productdefinition.exceptions.ProductDefinitionException) ApplicationException(org.mifos.framework.exceptions.ApplicationException) CustomerException(org.mifos.customers.exceptions.CustomerException) PersistenceException(org.mifos.framework.exceptions.PersistenceException) MeetingException(org.mifos.application.meeting.exceptions.MeetingException) OfficeException(org.mifos.customers.office.exceptions.OfficeException) LookUpValueEntity(org.mifos.application.master.business.LookUpValueEntity)

Example 5 with FeeFormulaEntity

use of org.mifos.accounts.fees.business.FeeFormulaEntity in project head by mifos.

the class FeeServiceImpl method createOneTimeFee.

private FeeBO createOneTimeFee(FeeCreateRequest feeCreateRequest, FeeFrequencyTypeEntity feeFrequencyType, CategoryTypeEntity feeCategoryType, GLCodeEntity glCodeEntity, UserContext userContext) throws FeeException {
    FeePaymentEntity feePaymentEntity = this.feeDao.findFeePaymentEntityByType(feeCreateRequest.getFeePaymentType());
    FeeBO feeBO = null;
    if (feeCreateRequest.isRateFee()) {
        FeeFormulaEntity feeFormulaEntity = this.feeDao.findFeeFormulaEntityByType(feeCreateRequest.getFeeFormula());
        feeBO = new RateFeeBO(userContext, feeCreateRequest.getFeeName(), feeCategoryType, feeFrequencyType, glCodeEntity, feeCreateRequest.getRate(), feeFormulaEntity, feeCreateRequest.isCustomerDefaultFee(), feePaymentEntity);
    } else {
        Money feeMoney = new Money(getCurrency(feeCreateRequest.getCurrencyId()), feeCreateRequest.getAmount());
        feeBO = new AmountFeeBO(userContext, feeCreateRequest.getFeeName(), feeCategoryType, feeFrequencyType, glCodeEntity, feeMoney, feeCreateRequest.isCustomerDefaultFee(), feePaymentEntity);
    }
    return feeBO;
}
Also used : RateFeeBO(org.mifos.accounts.fees.business.RateFeeBO) Money(org.mifos.framework.util.helpers.Money) FeeFormulaEntity(org.mifos.accounts.fees.business.FeeFormulaEntity) FeePaymentEntity(org.mifos.accounts.fees.business.FeePaymentEntity) FeeBO(org.mifos.accounts.fees.business.FeeBO) RateFeeBO(org.mifos.accounts.fees.business.RateFeeBO) AmountFeeBO(org.mifos.accounts.fees.business.AmountFeeBO) AmountFeeBO(org.mifos.accounts.fees.business.AmountFeeBO)

Aggregations

FeeFormulaEntity (org.mifos.accounts.fees.business.FeeFormulaEntity)9 RateFeeBO (org.mifos.accounts.fees.business.RateFeeBO)6 Money (org.mifos.framework.util.helpers.Money)4 AmountFeeBO (org.mifos.accounts.fees.business.AmountFeeBO)3 CategoryTypeEntity (org.mifos.accounts.fees.business.CategoryTypeEntity)3 FeeBO (org.mifos.accounts.fees.business.FeeBO)3 FeeFrequencyTypeEntity (org.mifos.accounts.fees.business.FeeFrequencyTypeEntity)3 FeePaymentEntity (org.mifos.accounts.fees.business.FeePaymentEntity)3 GLCodeEntity (org.mifos.accounts.financial.business.GLCodeEntity)3 ProductDefinitionException (org.mifos.accounts.productdefinition.exceptions.ProductDefinitionException)2 MeetingBO (org.mifos.application.meeting.business.MeetingBO)2 MeetingException (org.mifos.application.meeting.exceptions.MeetingException)2 MifosRuntimeException (org.mifos.core.MifosRuntimeException)2 CustomerException (org.mifos.customers.exceptions.CustomerException)2 OfficeException (org.mifos.customers.office.exceptions.OfficeException)2 ApplicationException (org.mifos.framework.exceptions.ApplicationException)2 PersistenceException (org.mifos.framework.exceptions.PersistenceException)2 SystemException (org.mifos.framework.exceptions.SystemException)2 DateTimeService (org.mifos.framework.util.DateTimeService)2 ArrayList (java.util.ArrayList)1