Search in sources :

Example 41 with FeeDto

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

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

the class CenterBOIntegrationTest method testSuccessfulCreate.

@Test
public void testSuccessfulCreate() throws Exception {
    String name = "Center";
    String externalId = "12345";
    Date mfiJoiningDate = getDate("11/12/2005");
    meeting = getMeeting();
    List<FeeDto> fees = getFees();
    center = new CenterBO(TestUtils.makeUser(), name, null, getCustomFields(), fees, externalId, mfiJoiningDate, new OfficePersistence().getOffice(officeId), meeting, legacyPersonnelDao.getPersonnel(personnelId), new CustomerPersistence());
    new CenterPersistence().saveCenter(center);
    StaticHibernateUtil.flushSession();
    center = TestObjectFactory.getCenter(center.getCustomerId());
    Assert.assertEquals(name, center.getDisplayName());
    Assert.assertEquals(externalId, center.getExternalId());
    Assert.assertEquals(mfiJoiningDate, DateUtils.getDateWithoutTimeStamp(center.getMfiJoiningDate().getTime()));
    Assert.assertEquals(officeId, center.getOffice().getOfficeId());
    Assert.assertEquals(2, center.getCustomFields().size());
    Assert.assertEquals(AccountState.CUSTOMER_ACCOUNT_ACTIVE.getValue(), center.getCustomerAccount().getAccountState().getId());
    // check if values in account fees are entered.
    Assert.assertNotNull(center.getCustomerAccount().getAccountFees(fees.get(0).getFeeIdValue()));
    Assert.assertNotNull(center.getCustomerAccount().getAccountFees(fees.get(1).getFeeIdValue()));
}
Also used : FeeDto(org.mifos.accounts.fees.business.FeeDto) CustomerPersistence(org.mifos.customers.persistence.CustomerPersistence) OfficePersistence(org.mifos.customers.office.persistence.OfficePersistence) Date(java.util.Date) CenterPersistence(org.mifos.customers.center.persistence.CenterPersistence) Test(org.junit.Test)

Example 43 with FeeDto

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

the class CenterActionStrutsTest method testFailureFeeFrequencyMismatch.

@Test
public void testFailureFeeFrequencyMismatch() throws Exception {
    List<FeeDto> feesToRemove = getFees(RecurrenceType.MONTHLY);
    setRequestPathInfo("/centerCustAction.do");
    addRequestParameter("method", "load");
    addRequestParameter("officeId", "3");
    actionPerform();
    SessionUtils.setAttribute(CustomerConstants.CUSTOMER_MEETING, new MeetingBO(RecurrenceType.MONTHLY, Short.valueOf("3"), new Date(), MeetingType.CUSTOMER_MEETING), request);
    List<ApplicableAccountFeeDto> feeList = retrieveAdditionalFeesFromSession();
    ApplicableAccountFeeDto fee = feeList.get(0);
    setRequestPathInfo("/centerCustAction.do");
    addRequestParameter("method", "preview");
    addRequestParameter("displayName", "center");
    addRequestParameter("loanOfficerId", "1");
    addRequestParameter(Constants.CURRENTFLOWKEY, (String) request.getAttribute(Constants.CURRENTFLOWKEY));
    addRequestParameter("selectedFee[0].feeId", fee.getFeeId().toString());
    addRequestParameter("selectedFee[0].amount", fee.getAmount());
    actionPerform();
    Assert.assertEquals("Fee", 1, getErrorSize(CustomerConstants.ERRORS_FEE_FREQUENCY_MISMATCH));
}
Also used : MeetingBO(org.mifos.application.meeting.business.MeetingBO) ApplicableAccountFeeDto(org.mifos.dto.domain.ApplicableAccountFeeDto) FeeDto(org.mifos.accounts.fees.business.FeeDto) ApplicableAccountFeeDto(org.mifos.dto.domain.ApplicableAccountFeeDto) Date(java.util.Date) Test(org.junit.Test)

Example 44 with FeeDto

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

Aggregations

FeeDto (org.mifos.accounts.fees.business.FeeDto)44 ArrayList (java.util.ArrayList)29 Test (org.junit.Test)22 ApplicableAccountFeeDto (org.mifos.dto.domain.ApplicableAccountFeeDto)21 FeeBO (org.mifos.accounts.fees.business.FeeBO)13 List (java.util.List)12 AmountFeeBO (org.mifos.accounts.fees.business.AmountFeeBO)11 MeetingBO (org.mifos.application.meeting.business.MeetingBO)10 Date (java.util.Date)7 CustomFieldDto (org.mifos.dto.domain.CustomFieldDto)5 UserContext (org.mifos.security.util.UserContext)5 RateFeeBO (org.mifos.accounts.fees.business.RateFeeBO)4 MifosUser (org.mifos.security.MifosUser)4 FundBO (org.mifos.accounts.fund.business.FundBO)3 BusinessActivityEntity (org.mifos.application.master.business.BusinessActivityEntity)3 ClientCustActionForm (org.mifos.customers.client.struts.actionforms.ClientCustActionForm)3 PersonnelDto (org.mifos.dto.domain.PersonnelDto)3 PageExpiredException (org.mifos.framework.exceptions.PageExpiredException)3 HttpServletRequest (javax.servlet.http.HttpServletRequest)2 DateTime (org.joda.time.DateTime)2