Search in sources :

Example 86 with FeeBO

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

the class FeeInstallmentTest method createMergedFeeInstallmentsForOneFeeBothAccountAndFeeAreScheduledEveryWeekShouldGetOneFeeInstallmentPerAccountEvent.

@Test
public void createMergedFeeInstallmentsForOneFeeBothAccountAndFeeAreScheduledEveryWeekShouldGetOneFeeInstallmentPerAccountEvent() {
    ScheduledEvent masterEvent = new ScheduledEventBuilder().every(1).weeks().build();
    FeeBO feeBO = createWeeklyFeeBO(1);
    AccountFeesEntity accountFeesEntity = createAccountFeesEntity(feeBO, 10.0);
    List<FeeInstallment> feeInstallments = FeeInstallment.createMergedFeeInstallmentsForOneFee(masterEvent, accountFeesEntity, 3);
    assertThat(feeInstallments.size(), is(3));
    assertFeeInstallment(feeInstallments.get(0), 1, 10.0, feeBO);
    assertFeeInstallment(feeInstallments.get(1), 2, 10.0, feeBO);
    assertFeeInstallment(feeInstallments.get(2), 3, 10.0, feeBO);
}
Also used : ScheduledEvent(org.mifos.schedule.ScheduledEvent) ScheduledEventBuilder(org.mifos.domain.builders.ScheduledEventBuilder) FeeInstallment(org.mifos.accounts.util.helpers.FeeInstallment) FeeBO(org.mifos.accounts.fees.business.FeeBO) AmountFeeBO(org.mifos.accounts.fees.business.AmountFeeBO) AccountFeesEntity(org.mifos.accounts.business.AccountFeesEntity) Test(org.junit.Test)

Example 87 with FeeBO

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

the class FeeInstallmentTest method createMergedFeeInstallmentsForOneFeeAccountScheduledEveryWeekFeeScheduledEveryOtherWeekShouldGetOneFeeInstallmentPerEveryOtherAccountEvent.

@Test
public void createMergedFeeInstallmentsForOneFeeAccountScheduledEveryWeekFeeScheduledEveryOtherWeekShouldGetOneFeeInstallmentPerEveryOtherAccountEvent() {
    ScheduledEvent accountEvent = new ScheduledEventBuilder().every(1).weeks().build();
    FeeBO feeBO = createWeeklyFeeBO(2);
    AccountFeesEntity accountFeesEntity = createAccountFeesEntity(feeBO, 10.0);
    List<FeeInstallment> feeInstallments = FeeInstallment.createMergedFeeInstallmentsForOneFee(accountEvent, accountFeesEntity, 4);
    assertThat(feeInstallments.size(), is(2));
    assertFeeInstallment(feeInstallments.get(0), 1, 10.0, feeBO);
    assertFeeInstallment(feeInstallments.get(1), 3, 10.0, feeBO);
}
Also used : ScheduledEvent(org.mifos.schedule.ScheduledEvent) ScheduledEventBuilder(org.mifos.domain.builders.ScheduledEventBuilder) FeeInstallment(org.mifos.accounts.util.helpers.FeeInstallment) FeeBO(org.mifos.accounts.fees.business.FeeBO) AmountFeeBO(org.mifos.accounts.fees.business.AmountFeeBO) AccountFeesEntity(org.mifos.accounts.business.AccountFeesEntity) Test(org.junit.Test)

Example 88 with FeeBO

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

the class FeeInstallmentTest method createMonthlyOnDayFeeBO.

private FeeBO createMonthlyOnDayFeeBO(int every) throws Exception {
    MeetingBO feeMeeting = new MeetingBO(RecurrenceType.MONTHLY, (short) every, new DateTime().toDate(), MeetingType.PERIODIC_FEE);
    FeeBO feeBO = new AmountFeeBO(new Money(TestUtils.RUPEE, "10.0"), "Fee", FeeCategory.ALLCUSTOMERS, FeeFrequencyType.PERIODIC, new GLCodeEntity(Short.valueOf("1"), "10000"), feeMeeting, null, new DateTime().minusDays(14).toDate(), TestUtils.makeUserWithLocales().getId());
    return feeBO;
}
Also used : Money(org.mifos.framework.util.helpers.Money) MeetingBO(org.mifos.application.meeting.business.MeetingBO) GLCodeEntity(org.mifos.accounts.financial.business.GLCodeEntity) FeeBO(org.mifos.accounts.fees.business.FeeBO) AmountFeeBO(org.mifos.accounts.fees.business.AmountFeeBO) DateTime(org.joda.time.DateTime) AmountFeeBO(org.mifos.accounts.fees.business.AmountFeeBO)

Example 89 with FeeBO

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

the class TestObjectFactory method createOneTimeAmountFee.

public static FeeBO createOneTimeAmountFee(final String feeName, final FeeCategory feeCategory, final String feeAmnt, final FeePayment feePayment, final UserContext userContext, String categoryTypeName) {
    GLCodeEntity glCode = (GLCodeEntity) StaticHibernateUtil.getSessionTL().get(GLCodeEntity.class, TestGeneralLedgerCode.FEES);
    try {
        CategoryTypeEntity categoryType = new CategoryTypeEntity(feeCategory);
        LookUpValueEntity lookUpValue = new LookUpValueEntity();
        lookUpValue.setLookUpName(categoryTypeName);
        categoryType.setLookUpValue(lookUpValue);
        FeeBO fee = new AmountFeeBO(userContext, feeName, categoryType, new FeeFrequencyTypeEntity(FeeFrequencyType.ONETIME), glCode, TestUtils.createMoney(feeAmnt), false, new FeePaymentEntity(feePayment));
        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) 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) 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)

Aggregations

FeeBO (org.mifos.accounts.fees.business.FeeBO)89 AmountFeeBO (org.mifos.accounts.fees.business.AmountFeeBO)50 ArrayList (java.util.ArrayList)40 Test (org.junit.Test)37 AccountFeesEntity (org.mifos.accounts.business.AccountFeesEntity)25 RateFeeBO (org.mifos.accounts.fees.business.RateFeeBO)21 Money (org.mifos.framework.util.helpers.Money)21 MeetingBO (org.mifos.application.meeting.business.MeetingBO)17 Date (java.sql.Date)15 FeeDto (org.mifos.accounts.fees.business.FeeDto)13 MifosRuntimeException (org.mifos.core.MifosRuntimeException)13 GLCodeEntity (org.mifos.accounts.financial.business.GLCodeEntity)11 FundBO (org.mifos.accounts.fund.business.FundBO)10 ApplicationException (org.mifos.framework.exceptions.ApplicationException)10 UserContext (org.mifos.security.util.UserContext)10 AccountBO (org.mifos.accounts.business.AccountBO)9 FeeFrequencyTypeEntity (org.mifos.accounts.fees.business.FeeFrequencyTypeEntity)9 FeeInstallment (org.mifos.accounts.util.helpers.FeeInstallment)9 ScheduledEventBuilder (org.mifos.domain.builders.ScheduledEventBuilder)9 CategoryTypeEntity (org.mifos.accounts.fees.business.CategoryTypeEntity)8