Search in sources :

Example 21 with FeeDto

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

the class TestObjectFactory method getFeesWithMakeUser.

public static List<FeeDto> getFeesWithMakeUser() {
    List<FeeDto> fees = new ArrayList<FeeDto>();
    AmountFeeBO maintenanceFee = (AmountFeeBO) createPeriodicAmountFeeWithMakeUser("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 22 with FeeDto

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

the class CustomerCreationDaoHibernateIntegrationTest method testShouldCreateCustomerAndCustomerAccount.

@Test
public void testShouldCreateCustomerAndCustomerAccount() throws Exception {
    String displayName = "centerCascade";
    Address address = null;
    final List<CustomFieldDto> customFields = new ArrayList<CustomFieldDto>();
    final List<FeeDto> fees = new ArrayList<FeeDto>();
    final String externalId = null;
    final Date mfiJoiningDate = new DateTime().minusDays(1).toDate();
    final OfficeBO existingOffice = IntegrationTestObjectMother.sampleBranchOffice();
    final PersonnelBO loanOfficer = IntegrationTestObjectMother.testUser();
    UserContext userContext = new UserContext();
    userContext.setId(loanOfficer.getPersonnelId());
    userContext.setBranchId(existingOffice.getOfficeId());
    userContext.setBranchGlobalNum(existingOffice.getGlobalOfficeNum());
    center = new CenterBO(userContext, displayName, address, customFields, fees, externalId, mfiJoiningDate, existingOffice, weeklyMeeting, loanOfficer, new CustomerPersistence());
    StaticHibernateUtil.startTransaction();
    customerDao.save(center);
    StaticHibernateUtil.flushSession();
    assertThat(center.getCustomerAccount(), is(notNullValue()));
    assertThat(center.getGlobalCustNum(), is(nullValue()));
}
Also used : Address(org.mifos.framework.business.util.Address) UserContext(org.mifos.security.util.UserContext) CustomFieldDto(org.mifos.dto.domain.CustomFieldDto) ArrayList(java.util.ArrayList) FeeDto(org.mifos.accounts.fees.business.FeeDto) CenterBO(org.mifos.customers.center.business.CenterBO) Date(java.util.Date) DateTime(org.joda.time.DateTime) OfficeBO(org.mifos.customers.office.business.OfficeBO) PersonnelBO(org.mifos.customers.personnel.business.PersonnelBO) CustomerPersistence(org.mifos.customers.persistence.CustomerPersistence) Test(org.junit.Test)

Example 23 with FeeDto

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

the class GroupActionStrutsTest method testSuccessfulPreview.

@Test
public void testSuccessfulPreview() throws Exception {
    List<FeeDto> feesToRemove = getFees(RecurrenceType.WEEKLY);
    createParentCustomer();
    StaticHibernateUtil.flushAndClearSession();
    setRequestPathInfo("/groupCustAction.do");
    addRequestParameter("method", "load");
    addRequestParameter("centerSystemId", center.getGlobalCustNum());
    actionPerform();
    List<ApplicableAccountFeeDto> feeList = getFeesFromSession();
    ApplicableAccountFeeDto fee = feeList.get(0);
    List<CustomFieldDto> customFieldDefs = getCustomFieldsFromSession();
    setRequestPathInfo("/groupCustAction.do");
    addRequestParameter("method", "preview");
    addRequestParameter(Constants.CURRENTFLOWKEY, (String) request.getAttribute(Constants.CURRENTFLOWKEY));
    addRequestParameter("displayName", "group");
    addRequestParameter("status", CustomerStatus.GROUP_PENDING.getValue().toString());
    addRequestParameter("formedByPersonnel", center.getPersonnel().getPersonnelId().toString());
    addRequestParameter("loanOfficerId", center.getLoanOfficerId().toString());
    int i = 0;
    for (CustomFieldDto customFieldDef : customFieldDefs) {
        addRequestParameter("customField[" + i + "].fieldId", customFieldDef.getFieldId().toString());
        addRequestParameter("customField[" + i + "].fieldValue", "11");
        i++;
    }
    addRequestParameter("selectedFee[0].feeId", fee.getFeeId().toString());
    addRequestParameter("selectedFee[0].amount", fee.getAmount());
    actionPerform();
    Assert.assertEquals(0, getErrorSize());
    verifyForward(ActionForwards.preview_success.toString());
    verifyNoActionErrors();
    verifyNoActionMessages();
    StaticHibernateUtil.flushAndClearSession();
    removeFees(feesToRemove);
    Assert.assertNotNull(SessionUtils.getAttribute(CustomerConstants.PENDING_APPROVAL_DEFINED, request));
    center = TestObjectFactory.getCenter(center.getCustomerId());
}
Also used : CustomFieldDto(org.mifos.dto.domain.CustomFieldDto) ApplicableAccountFeeDto(org.mifos.dto.domain.ApplicableAccountFeeDto) FeeDto(org.mifos.accounts.fees.business.FeeDto) ApplicableAccountFeeDto(org.mifos.dto.domain.ApplicableAccountFeeDto) Test(org.junit.Test)

Example 24 with FeeDto

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

the class GroupActionStrutsTest method testFailurePreview_WithDuplicateFee.

@Test
public void testFailurePreview_WithDuplicateFee() throws Exception {
    List<FeeDto> feesToRemove = getFees(RecurrenceType.WEEKLY);
    createParentCustomer();
    StaticHibernateUtil.flushAndClearSession();
    setRequestPathInfo("/groupCustAction.do");
    addRequestParameter("method", "load");
    addRequestParameter("centerSystemId", center.getGlobalCustNum());
    actionPerform();
    List<ApplicableAccountFeeDto> feeList = getFeesFromSession();
    ApplicableAccountFeeDto fee = feeList.get(0);
    setRequestPathInfo("/groupCustAction.do");
    addRequestParameter("method", "preview");
    addRequestParameter("selectedFee[0].feeId", fee.getFeeId().toString());
    addRequestParameter("selectedFee[0].amount", "100");
    addRequestParameter("selectedFee[1].feeId", fee.getFeeId().toString());
    addRequestParameter("selectedFee[1].amount", "150");
    addRequestParameter(Constants.CURRENTFLOWKEY, (String) request.getAttribute(Constants.CURRENTFLOWKEY));
    actionPerform();
    Assert.assertEquals("Fee", 1, getErrorSize(CustomerConstants.FEE));
    verifyInputForward();
    removeFees(feesToRemove);
    center = TestObjectFactory.getCenter(center.getCustomerId());
}
Also used : ApplicableAccountFeeDto(org.mifos.dto.domain.ApplicableAccountFeeDto) FeeDto(org.mifos.accounts.fees.business.FeeDto) ApplicableAccountFeeDto(org.mifos.dto.domain.ApplicableAccountFeeDto) Test(org.junit.Test)

Example 25 with FeeDto

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

the class GroupActionStrutsTest method testFailurePreview_WithFee_WithoutFeeAmount.

@Test
public void testFailurePreview_WithFee_WithoutFeeAmount() throws Exception {
    List<FeeDto> feesToRemove = getFees(RecurrenceType.WEEKLY);
    createParentCustomer();
    StaticHibernateUtil.flushAndClearSession();
    setRequestPathInfo("/groupCustAction.do");
    addRequestParameter("method", "load");
    addRequestParameter("centerSystemId", center.getGlobalCustNum());
    actionPerform();
    List<ApplicableAccountFeeDto> feeList = getFeesFromSession();
    ApplicableAccountFeeDto fee = feeList.get(0);
    setRequestPathInfo("/groupCustAction.do");
    addRequestParameter("method", "preview");
    addRequestParameter("selectedFee[0].feeId", fee.getFeeId().toString());
    addRequestParameter("selectedFee[0].amount", "");
    addRequestParameter(Constants.CURRENTFLOWKEY, (String) request.getAttribute(Constants.CURRENTFLOWKEY));
    actionPerform();
    Assert.assertEquals("Fee", 1, getErrorSize(CustomerConstants.FEE));
    verifyInputForward();
    removeFees(feesToRemove);
    center = TestObjectFactory.getCenter(center.getCustomerId());
}
Also used : ApplicableAccountFeeDto(org.mifos.dto.domain.ApplicableAccountFeeDto) FeeDto(org.mifos.accounts.fees.business.FeeDto) ApplicableAccountFeeDto(org.mifos.dto.domain.ApplicableAccountFeeDto) Test(org.junit.Test)

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