Search in sources :

Example 11 with ApplicableAccountFeeDto

use of org.mifos.dto.domain.ApplicableAccountFeeDto in project head by mifos.

the class ClientCustActionStrutsTest method testPreviewSuccess.

@Test
public void testPreviewSuccess() throws Exception {
    List<FeeDto> feesToRemove = getFees(RecurrenceType.MONTHLY);
    setRequestPathInfo("/clientCustAction.do");
    addRequestParameter("method", "load");
    addRequestParameter("officeId", "3");
    addRequestParameter("groupFlag", "0");
    addRequestParameter(Constants.CURRENTFLOWKEY, flowKey);
    actionPerform();
    flowKey = (String) request.getAttribute(Constants.CURRENTFLOWKEY);
    List<CustomFieldDto> customFieldDefs = getCustomFieldFromSession();
    List<BusinessActivityEntity> povertyStatus = (List<BusinessActivityEntity>) SessionUtils.getAttribute(ClientConstants.POVERTY_STATUS, request);
    setRequestPathInfo("/clientCustAction.do");
    addRequestParameter("method", "next");
    addRequestParameter("officeId", "3");
    addRequestParameter("clientName.salutation", "1");
    addRequestParameter("clientName.firstName", "Client");
    addRequestParameter("clientName.lastName", "LastName");
    addRequestParameter("spouseName.firstName", "Spouse");
    addRequestParameter("spouseName.lastName", "LastName");
    addRequestParameter("spouseName.nameType", "1");
    addRequestDateParameter("dateOfBirth", "20/3/1987");
    addRequestParameter("clientDetailView.gender", "1");
    addRequestParameter("input", "personalInfo");
    addRequestParameter("customerDetail.povertyStatus", povertyStatus.get(0).getId().toString());
    int i = 0;
    for (CustomFieldDto customFieldDef : customFieldDefs) {
        addRequestParameter("customField[" + i + "].fieldId", customFieldDef.getFieldId().toString());
        addRequestParameter("customField[" + i + "].fieldValue", "Req");
        i++;
    }
    addRequestParameter(Constants.CURRENTFLOWKEY, flowKey);
    actionPerform();
    List<ApplicableAccountFeeDto> feeList = (List<ApplicableAccountFeeDto>) SessionUtils.getAttribute(CustomerConstants.ADDITIONAL_FEES_LIST, request);
    ApplicableAccountFeeDto fee = feeList.get(0);
    setRequestPathInfo("/clientCustAction.do");
    addRequestParameter("method", "preview");
    addRequestParameter("input", "mfiInfo");
    addRequestParameter("formedByPersonnel", "1");
    addRequestParameter("selectedFee[0].feeId", fee.getFeeId().toString());
    addRequestParameter("selectedFee[0].amount", fee.getAmount());
    request.setAttribute(Constants.CURRENTFLOWKEY, flowKey);
    SessionUtils.setAttribute(CustomerConstants.CUSTOMER_MEETING, new MeetingBO(RecurrenceType.MONTHLY, Short.valueOf("2"), new Date(), MeetingType.CUSTOMER_MEETING), request);
    addRequestParameter(Constants.CURRENTFLOWKEY, flowKey);
    actionPerform();
    verifyNoActionErrors();
    verifyNoActionMessages();
    verifyForward(ActionForwards.preview_success.toString());
    removeFees(feesToRemove);
}
Also used : BusinessActivityEntity(org.mifos.application.master.business.BusinessActivityEntity) MeetingBO(org.mifos.application.meeting.business.MeetingBO) CustomFieldDto(org.mifos.dto.domain.CustomFieldDto) ApplicableAccountFeeDto(org.mifos.dto.domain.ApplicableAccountFeeDto) FeeDto(org.mifos.accounts.fees.business.FeeDto) List(java.util.List) ArrayList(java.util.ArrayList) ApplicableAccountFeeDto(org.mifos.dto.domain.ApplicableAccountFeeDto) Date(java.util.Date) Test(org.junit.Test)

Example 12 with ApplicableAccountFeeDto

use of org.mifos.dto.domain.ApplicableAccountFeeDto in project head by mifos.

the class CenterActionStrutsTest method testFailurePreview_FeeFrequencyMismatch.

@Test
public void testFailurePreview_FeeFrequencyMismatch() throws Exception {
    List<FeeDto> feesToRemove = getFees(RecurrenceType.WEEKLY);
    setRequestPathInfo("/centerCustAction.do");
    addRequestParameter("method", "load");
    addRequestParameter("officeId", "3");
    actionPerform();
    List<ApplicableAccountFeeDto> feeList = retrieveAdditionalFeesFromSession();
    ApplicableAccountFeeDto fee = feeList.get(0);
    SessionUtils.setAttribute(CustomerConstants.CUSTOMER_MEETING, getMeeting(), request);
    setRequestPathInfo("/centerCustAction.do");
    addRequestParameter("method", "preview");
    addRequestParameter("selectedFee[0].feeId", fee.getFeeId().toString());
    addRequestParameter("selectedFee[0].amount", "200");
    actionPerform();
    Assert.assertEquals("Fee", 1, getErrorSize(CustomerConstants.ERRORS_FEE_FREQUENCY_MISMATCH));
}
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 13 with ApplicableAccountFeeDto

use of org.mifos.dto.domain.ApplicableAccountFeeDto in project head by mifos.

the class CenterActionStrutsTest method testFailurePreview_WithFee_WithoutFeeAmount.

@Test
public void testFailurePreview_WithFee_WithoutFeeAmount() throws Exception {
    List<FeeDto> feesToRemove = getFees(RecurrenceType.MONTHLY);
    setRequestPathInfo("/centerCustAction.do");
    addRequestParameter("method", "load");
    addRequestParameter("officeId", "3");
    addRequestParameter(Constants.CURRENTFLOWKEY, flowKey);
    actionPerform();
    List<ApplicableAccountFeeDto> feeList = retrieveAdditionalFeesFromSession();
    ApplicableAccountFeeDto fee = feeList.get(0);
    setRequestPathInfo("/centerCustAction.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));
}
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 14 with ApplicableAccountFeeDto

use of org.mifos.dto.domain.ApplicableAccountFeeDto in project head by mifos.

the class CenterActionStrutsTest method testSuccessfulCreate.

@Test
public void testSuccessfulCreate() throws Exception {
    MeetingBO weeklyMeeting = new MeetingBuilder().customerMeeting().weekly().every(1).startingToday().build();
    AmountFeeBO monthlyPeriodicFeeForFirstClients = new FeeBuilder().appliesToCenterOnly().withFeeAmount("200.0").withName("PeriodicAmountFee").withSameRecurrenceAs(weeklyMeeting).with(sampleBranchOffice()).build();
    IntegrationTestObjectMother.saveFee(monthlyPeriodicFeeForFirstClients);
    setRequestPathInfo("/centerCustAction.do");
    addRequestParameter("method", "load");
    addRequestParameter("officeId", "1");
    actionPerform();
    SessionUtils.setAttribute(CustomerConstants.CUSTOMER_MEETING, weeklyMeeting, 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();
    verifyForward(ActionForwards.preview_success.toString());
    setRequestPathInfo("/centerCustAction.do");
    addRequestParameter("method", "create");
    addRequestParameter(Constants.CURRENTFLOWKEY, (String) request.getAttribute(Constants.CURRENTFLOWKEY));
    actionPerform();
    verifyNoActionErrors();
    verifyForward(ActionForwards.create_success.toString());
    CenterCustActionForm actionForm = (CenterCustActionForm) request.getSession().getAttribute("centerCustActionForm");
    center = TestObjectFactory.getCenter(actionForm.getCustomerIdAsInt());
}
Also used : FeeBuilder(org.mifos.domain.builders.FeeBuilder) CenterCustActionForm(org.mifos.customers.center.struts.actionforms.CenterCustActionForm) MeetingBO(org.mifos.application.meeting.business.MeetingBO) MeetingBuilder(org.mifos.domain.builders.MeetingBuilder) ApplicableAccountFeeDto(org.mifos.dto.domain.ApplicableAccountFeeDto) AmountFeeBO(org.mifos.accounts.fees.business.AmountFeeBO) Test(org.junit.Test)

Example 15 with ApplicableAccountFeeDto

use of org.mifos.dto.domain.ApplicableAccountFeeDto 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)

Aggregations

ApplicableAccountFeeDto (org.mifos.dto.domain.ApplicableAccountFeeDto)32 ArrayList (java.util.ArrayList)19 Test (org.junit.Test)15 FeeDto (org.mifos.accounts.fees.business.FeeDto)15 MeetingBO (org.mifos.application.meeting.business.MeetingBO)14 Date (java.util.Date)7 CustomFieldDto (org.mifos.dto.domain.CustomFieldDto)7 MeetingDto (org.mifos.dto.domain.MeetingDto)7 List (java.util.List)6 AddressDto (org.mifos.dto.domain.AddressDto)6 LocalDate (org.joda.time.LocalDate)5 FeeBO (org.mifos.accounts.fees.business.FeeBO)5 PersonnelBO (org.mifos.customers.personnel.business.PersonnelBO)5 MeetingBuilder (org.mifos.domain.builders.MeetingBuilder)5 CustomerDetailsDto (org.mifos.dto.domain.CustomerDetailsDto)5 Address (org.mifos.framework.business.util.Address)5 DateTime (org.joda.time.DateTime)4 ClientFamilyDetailDto (org.mifos.dto.screen.ClientFamilyDetailDto)4 ClientNameDetailDto (org.mifos.dto.screen.ClientNameDetailDto)4 ClientPersonalDetailDto (org.mifos.dto.screen.ClientPersonalDetailDto)4