Search in sources :

Example 1 with CategoryTypeEntity

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

the class LoanOfferingBOIntegrationTest method testUpdateFeeNotMatchingFrequencyOfLoanOffering.

@Test
public void testUpdateFeeNotMatchingFrequencyOfLoanOffering() throws ProductDefinitionException, FeeException {
    createIntitalObjects();
    GracePeriodTypeEntity gracePeriodType = new GracePeriodTypeEntity(GraceType.NONE);
    Date startDate = offSetCurrentDate(0);
    Date endDate = offSetCurrentDate(2);
    FeeBO fee = new AmountFeeBO(TestObjectFactory.getContext(), "Loan Periodic", new CategoryTypeEntity(FeeCategory.LOAN), new FeeFrequencyTypeEntity(FeeFrequencyType.PERIODIC), intglCodeEntity, new Money(getCurrency(), "100"), false, TestObjectFactory.createMeeting(TestObjectFactory.getNewMeeting(MONTHLY, EVERY_MONTH, CUSTOMER_MEETING, MONDAY)));
    List<FeeBO> fees = new ArrayList<FeeBO>();
    fees.add(fee);
    product = createLoanOfferingBO("Loan Product", "LOAP");
    try {
        product.update((short) 1, "Loan Product", "LOAN", productCategory, prdApplicableMaster, startDate, endDate, "Loan Product updated", PrdStatus.LOAN_ACTIVE, gracePeriodType, interestTypes, (short) 0, new Money(getCurrency(), "3000"), new Money(getCurrency(), "1000"), new Money(getCurrency(), "1000"), 12.0, 2.0, 12.0, (short) 12, (short) 1, (short) 2, false, true, false, null, fees, null, (short) 2, RecurrenceType.WEEKLY, waiverInterest);
        Assert.fail();
    } catch (ProductDefinitionException e) {
    }
}
Also used : Money(org.mifos.framework.util.helpers.Money) FeeFrequencyTypeEntity(org.mifos.accounts.fees.business.FeeFrequencyTypeEntity) ProductDefinitionException(org.mifos.accounts.productdefinition.exceptions.ProductDefinitionException) ArrayList(java.util.ArrayList) CategoryTypeEntity(org.mifos.accounts.fees.business.CategoryTypeEntity) FeeBO(org.mifos.accounts.fees.business.FeeBO) AmountFeeBO(org.mifos.accounts.fees.business.AmountFeeBO) Date(java.sql.Date) AmountFeeBO(org.mifos.accounts.fees.business.AmountFeeBO) Test(org.junit.Test)

Example 2 with CategoryTypeEntity

use of org.mifos.accounts.fees.business.CategoryTypeEntity 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 3 with CategoryTypeEntity

use of org.mifos.accounts.fees.business.CategoryTypeEntity 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 CategoryTypeEntity

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

the class TestObjectFactory method createPeriodicAmountFee.

private static FeeBO createPeriodicAmountFee(final String feeName, final FeeCategory feeCategory, final String feeAmnt, final RecurrenceType meetingFrequency, final Short recurAfter, final UserContext userContext, String categoryLookupValue) {
    try {
        GLCodeEntity glCode = ChartOfAccountsCache.get("31301").getAssociatedGlcode();
        MeetingBO meeting = new MeetingBO(meetingFrequency, recurAfter, new DateTimeService().getCurrentJavaDateTime(), MeetingType.PERIODIC_FEE);
        LookUpValueEntity lookUpValue = new LookUpValueEntity();
        lookUpValue.setLookUpName(categoryLookupValue);
        CategoryTypeEntity categoryType = new CategoryTypeEntity(feeCategory);
        categoryType.setLookUpValue(lookUpValue);
        FeeBO fee = new AmountFeeBO(userContext, feeName, categoryType, new FeeFrequencyTypeEntity(FeeFrequencyType.PERIODIC), glCode, TestUtils.createMoney(feeAmnt), false, meeting);
        return testObjectPersistence.createFee(fee);
    } catch (Exception e) {
        throw new RuntimeException(e);
    }
}
Also used : 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) FeeBO(org.mifos.accounts.fees.business.FeeBO) AmountFeeBO(org.mifos.accounts.fees.business.AmountFeeBO) RateFeeBO(org.mifos.accounts.fees.business.RateFeeBO) DateTimeService(org.mifos.framework.util.DateTimeService) AmountFeeBO(org.mifos.accounts.fees.business.AmountFeeBO) 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 CategoryTypeEntity

use of org.mifos.accounts.fees.business.CategoryTypeEntity 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)

Aggregations

CategoryTypeEntity (org.mifos.accounts.fees.business.CategoryTypeEntity)11 FeeFrequencyTypeEntity (org.mifos.accounts.fees.business.FeeFrequencyTypeEntity)10 AmountFeeBO (org.mifos.accounts.fees.business.AmountFeeBO)8 FeeBO (org.mifos.accounts.fees.business.FeeBO)8 GLCodeEntity (org.mifos.accounts.financial.business.GLCodeEntity)6 ProductDefinitionException (org.mifos.accounts.productdefinition.exceptions.ProductDefinitionException)6 ArrayList (java.util.ArrayList)5 Test (org.junit.Test)5 FeePaymentEntity (org.mifos.accounts.fees.business.FeePaymentEntity)5 RateFeeBO (org.mifos.accounts.fees.business.RateFeeBO)5 MeetingException (org.mifos.application.meeting.exceptions.MeetingException)5 MifosRuntimeException (org.mifos.core.MifosRuntimeException)5 ApplicationException (org.mifos.framework.exceptions.ApplicationException)5 Date (java.sql.Date)4 CustomerException (org.mifos.customers.exceptions.CustomerException)4 OfficeException (org.mifos.customers.office.exceptions.OfficeException)4 PersistenceException (org.mifos.framework.exceptions.PersistenceException)4 SystemException (org.mifos.framework.exceptions.SystemException)4 Money (org.mifos.framework.util.helpers.Money)4 FeeFormulaEntity (org.mifos.accounts.fees.business.FeeFormulaEntity)3