Search in sources :

Example 36 with AmountFeeBO

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

the class CenterScheduleCreationUsingCustomerServiceIntegrationTest method createCenterScheduleWithWeeklyMeetingWithOnePeriodicFeeNoHoliday.

/***********************************************
     * Weekly meeting, with fees
     ***********************************************/
@Test
public void createCenterScheduleWithWeeklyMeetingWithOnePeriodicFeeNoHoliday() throws Exception {
    DateTime startDate = date(2010, 4, 5);
    //Monday
    DateTimeUtils.setCurrentMillisFixed(startDate.getMillis());
    // setup
    MeetingBO weeklyMeeting = new MeetingBuilder().customerMeeting().weekly().every(1).startingToday().build();
    MeetingBuilder weeklyMeetingForFees = new MeetingBuilder().periodicFeeMeeting().weekly().every(1).startingToday();
    AmountFeeBO weeklyPeriodicFeeForCenterOnly = new FeeBuilder().appliesToCenterOnly().withFeeAmount("100.0").withName("Center Weekly Periodic Fee").with(weeklyMeetingForFees).with(sampleBranchOffice()).build();
    IntegrationTestObjectMother.saveFee(weeklyPeriodicFeeForCenterOnly);
    CenterBO center = new CenterBuilder().with(weeklyMeeting).withName("Center-IntegrationTest").with(sampleBranchOffice()).withLoanOfficer(testUser()).withUserContext().build();
    // exercise test
    IntegrationTestObjectMother.createCenter(center, weeklyMeeting, weeklyPeriodicFeeForCenterOnly);
    // verification
    StaticHibernateUtil.flushAndClearSession();
    validateDates(center.getGlobalCustNum(), startDate, startDate.plusWeeks(1), startDate.plusWeeks(2), startDate.plusWeeks(3), startDate.plusWeeks(4), startDate.plusWeeks(5), startDate.plusWeeks(6), startDate.plusWeeks(7), startDate.plusWeeks(8), startDate.plusWeeks(9));
    validateOnePeriodicFee(center.getGlobalCustNum(), "Center Weekly Periodic Fee", 100.0, 100.0, 100.0, 100.0, 100.0, 100.0, 100.0, 100.0, 100.0, 100.0);
}
Also used : FeeBuilder(org.mifos.domain.builders.FeeBuilder) MeetingBO(org.mifos.application.meeting.business.MeetingBO) CenterBO(org.mifos.customers.center.business.CenterBO) CenterBuilder(org.mifos.domain.builders.CenterBuilder) MeetingBuilder(org.mifos.domain.builders.MeetingBuilder) DateTime(org.joda.time.DateTime) AmountFeeBO(org.mifos.accounts.fees.business.AmountFeeBO) Test(org.junit.Test)

Example 37 with AmountFeeBO

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

the class CenterActionStrutsTest method getFees.

private List<FeeDto> getFees(RecurrenceType frequency) throws Exception {
    List<FeeDto> fees = new ArrayList<FeeDto>();
    AmountFeeBO fee1 = (AmountFeeBO) TestObjectFactory.createPeriodicAmountFee("PeriodicAmountFee", FeeCategory.CENTER, "200", frequency, Short.valueOf("2"));
    fees.add(new FeeDto(TestObjectFactory.getContext(), fee1));
    StaticHibernateUtil.flushSession();
    return fees;
}
Also used : ArrayList(java.util.ArrayList) ApplicableAccountFeeDto(org.mifos.dto.domain.ApplicableAccountFeeDto) FeeDto(org.mifos.accounts.fees.business.FeeDto) AmountFeeBO(org.mifos.accounts.fees.business.AmountFeeBO)

Example 38 with AmountFeeBO

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

Example 39 with AmountFeeBO

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

the class TestObjectFactory method getFees.

public static List<FeeDto> getFees() {
    List<FeeDto> fees = new ArrayList<FeeDto>();
    AmountFeeBO maintenanceFee = (AmountFeeBO) createPeriodicAmountFee("Maintenance Fee", FeeCategory.ALLCUSTOMERS, "100", RecurrenceType.WEEKLY, Short.valueOf("1"));
    FeeDto fee = new FeeDto(getContext(), maintenanceFee);
    fees.add(fee);
    return fees;
}
Also used : ArrayList(java.util.ArrayList) FeeDto(org.mifos.accounts.fees.business.FeeDto) AmountFeeBO(org.mifos.accounts.fees.business.AmountFeeBO)

Example 40 with AmountFeeBO

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

the class LoanOfferingBOIntegrationTest method testUpdateWithFundsAndOneTimeFee.

@Test
public void testUpdateWithFundsAndOneTimeFee() throws ProductDefinitionException, FeeException {
    createIntitalObjects();
    GracePeriodTypeEntity gracePeriodType = new GracePeriodTypeEntity(GraceType.GRACEONALLREPAYMENTS);
    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.getTypicalMeeting()));
    FeeBO fee1 = new AmountFeeBO(TestObjectFactory.getContext(), "Loan Periodic", new CategoryTypeEntity(FeeCategory.LOAN), new FeeFrequencyTypeEntity(FeeFrequencyType.ONETIME), intglCodeEntity, new Money(getCurrency(), "100"), false, new FeePaymentEntity(FeePayment.UPFRONT));
    List<FeeBO> fees = new ArrayList<FeeBO>();
    fees.add(fee);
    fees.add(fee1);
    List<FundBO> funds = new ArrayList<FundBO>();
    funds.add(null);
    product = createLoanOfferingBO("Loan Product", "LOAP");
    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, funds, fees, null, (short) 2, RecurrenceType.WEEKLY, waiverInterest);
    Assert.assertEquals(2, product.getLoanOfferingFees().size());
    Assert.assertEquals(1, product.getLoanOfferingFunds().size());
}
Also used : Money(org.mifos.framework.util.helpers.Money) FeeFrequencyTypeEntity(org.mifos.accounts.fees.business.FeeFrequencyTypeEntity) FundBO(org.mifos.accounts.fund.business.FundBO) ArrayList(java.util.ArrayList) 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) Date(java.sql.Date) AmountFeeBO(org.mifos.accounts.fees.business.AmountFeeBO) Test(org.junit.Test)

Aggregations

AmountFeeBO (org.mifos.accounts.fees.business.AmountFeeBO)41 ArrayList (java.util.ArrayList)24 MeetingBO (org.mifos.application.meeting.business.MeetingBO)18 Test (org.junit.Test)17 FeeBO (org.mifos.accounts.fees.business.FeeBO)17 Money (org.mifos.framework.util.helpers.Money)16 MeetingBuilder (org.mifos.domain.builders.MeetingBuilder)14 DateTime (org.joda.time.DateTime)13 FeeBuilder (org.mifos.domain.builders.FeeBuilder)13 CenterBuilder (org.mifos.domain.builders.CenterBuilder)12 AccountFeesEntity (org.mifos.accounts.business.AccountFeesEntity)11 FeeDto (org.mifos.accounts.fees.business.FeeDto)8 CenterBO (org.mifos.customers.center.business.CenterBO)8 CategoryTypeEntity (org.mifos.accounts.fees.business.CategoryTypeEntity)6 FeeFrequencyTypeEntity (org.mifos.accounts.fees.business.FeeFrequencyTypeEntity)6 RateFeeBO (org.mifos.accounts.fees.business.RateFeeBO)6 BigDecimal (java.math.BigDecimal)5 Date (java.sql.Date)5 LocalDate (org.joda.time.LocalDate)5 CreateAccountFeeDto (org.mifos.dto.domain.CreateAccountFeeDto)5