Search in sources :

Example 11 with ClientCustActionForm

use of org.mifos.customers.client.struts.actionforms.ClientCustActionForm in project head by mifos.

the class ClientCustActionStrutsTest method testLoadClientUnderGroup_FeeSameFrequecny.

@Test
public void testLoadClientUnderGroup_FeeSameFrequecny() throws Exception {
    createGroupWithoutFee();
    List<FeeDto> fees = getFees(RecurrenceType.WEEKLY);
    StaticHibernateUtil.flushAndClearSession();
    setRequestPathInfo("/clientCustAction.do");
    addRequestParameter("method", "load");
    addRequestParameter("parentGroupId", group.getCustomerId().toString());
    addRequestParameter("groupFlag", "1");
    addRequestParameter(Constants.CURRENTFLOWKEY, flowKey);
    actionPerform();
    verifyNoActionErrors();
    verifyNoActionMessages();
    verifyForward(ActionForwards.load_success.toString());
    ClientCustActionForm actionForm = (ClientCustActionForm) request.getSession().getAttribute("clientCustActionForm");
    Assert.assertEquals(actionForm.getFormedByPersonnelValue(), group.getCustomerFormedByPersonnel().getPersonnelId());
    List<FeeDto> additionalFees = (List<FeeDto>) SessionUtils.getAttribute(CustomerConstants.ADDITIONAL_FEES_LIST, request);
    Assert.assertNotNull(additionalFees);
    Assert.assertEquals(1, additionalFees.size());
    group = (GroupBO) StaticHibernateUtil.getSessionTL().get(GroupBO.class, group.getCustomerId());
    removeFees(fees);
}
Also used : ClientCustActionForm(org.mifos.customers.client.struts.actionforms.ClientCustActionForm) ApplicableAccountFeeDto(org.mifos.dto.domain.ApplicableAccountFeeDto) FeeDto(org.mifos.accounts.fees.business.FeeDto) List(java.util.List) ArrayList(java.util.ArrayList) Test(org.junit.Test)

Example 12 with ClientCustActionForm

use of org.mifos.customers.client.struts.actionforms.ClientCustActionForm in project head by mifos.

the class ClientCustActionStrutsTest method testLoadWithGroupHavingNoLoanOfficer.

@Test
public void testLoadWithGroupHavingNoLoanOfficer() throws Exception {
    createParentGroup(CustomerStatus.GROUP_PARTIAL, null);
    savingsOffering1 = TestObjectFactory.createSavingsProduct("savingsoffering1", "s1", SavingsType.MANDATORY, ApplicableTo.CLIENTS, new Date(System.currentTimeMillis()));
    setRequestPathInfo("/clientCustAction.do");
    addRequestParameter("method", "load");
    addRequestParameter("officeId", "3");
    addRequestParameter("parentGroupId", group.getCustomerId().toString());
    addRequestParameter("groupFlag", "1");
    addRequestParameter(Constants.CURRENTFLOWKEY, flowKey);
    actionPerform();
    verifyNoActionErrors();
    verifyNoActionMessages();
    verifyForward(ActionForwards.load_success.toString());
    Assert.assertNotNull(SessionUtils.getAttribute(ClientConstants.SALUTATION_ENTITY, request));
    Assert.assertNotNull(SessionUtils.getAttribute(ClientConstants.MARITAL_STATUS_ENTITY, request));
    Assert.assertNotNull(SessionUtils.getAttribute(ClientConstants.CITIZENSHIP_ENTITY, request));
    Assert.assertNotNull(SessionUtils.getAttribute(ClientConstants.BUSINESS_ACTIVITIES_ENTITY, request));
    Assert.assertNotNull(SessionUtils.getAttribute(ClientConstants.EDUCATION_LEVEL_ENTITY, request));
    Assert.assertNotNull(SessionUtils.getAttribute(ClientConstants.GENDER_ENTITY, request));
    Assert.assertNotNull(SessionUtils.getAttribute(ClientConstants.SPOUSE_FATHER_ENTITY, request));
    Assert.assertNotNull(SessionUtils.getAttribute(ClientConstants.HANDICAPPED_ENTITY, request));
    Assert.assertNotNull(SessionUtils.getAttribute(ClientConstants.ETHNICITY_ENTITY, request));
    Assert.assertNotNull(SessionUtils.getAttribute(CustomerConstants.CUSTOM_FIELDS_LIST, request));
    Assert.assertNotNull(SessionUtils.getAttribute(CustomerConstants.FORMEDBY_LOAN_OFFICER_LIST, request));
    List<BusinessActivityEntity> povertyStatusList = (List<BusinessActivityEntity>) SessionUtils.getAttribute(ClientConstants.POVERTY_STATUS, request);
    Assert.assertNotNull(povertyStatusList);
    List<SavingsDetailDto> savingsOfferingList = getSavingsOfferingsFromSession();
    Assert.assertNotNull(savingsOfferingList);
    Assert.assertEquals(1, savingsOfferingList.size());
    ClientCustActionForm actionForm = (ClientCustActionForm) request.getSession().getAttribute("clientCustActionForm");
    Assert.assertNull(actionForm.getFormedByPersonnelValue());
    group = (GroupBO) StaticHibernateUtil.getSessionTL().get(GroupBO.class, group.getCustomerId());
    StaticHibernateUtil.flushAndClearSession();
}
Also used : ClientCustActionForm(org.mifos.customers.client.struts.actionforms.ClientCustActionForm) BusinessActivityEntity(org.mifos.application.master.business.BusinessActivityEntity) SavingsDetailDto(org.mifos.dto.domain.SavingsDetailDto) List(java.util.List) ArrayList(java.util.ArrayList) Date(java.util.Date) Test(org.junit.Test)

Example 13 with ClientCustActionForm

use of org.mifos.customers.client.struts.actionforms.ClientCustActionForm in project head by mifos.

the class ClientCustActionStrutsTest method testCreateSuccessUnderGroup.

@Test
public void testCreateSuccessUnderGroup() throws Exception {
    createParentCustomer();
    setRequestPathInfo("/clientCustAction.do");
    addRequestParameter("method", "load");
    addRequestParameter("parentGroupId", group.getCustomerId().toString());
    addRequestParameter("groupFlag", "1");
    addRequestParameter(Constants.CURRENTFLOWKEY, flowKey);
    actionPerform();
    flowKey = request.getAttribute(Constants.CURRENTFLOWKEY).toString();
    verifyNoActionErrors();
    verifyNoActionMessages();
    verifyForward(ActionForwards.load_success.toString());
    List<BusinessActivityEntity> povertyStatus = (List<BusinessActivityEntity>) SessionUtils.getAttribute(ClientConstants.POVERTY_STATUS, request);
    List<CustomFieldDto> customFieldDefs = getCustomFieldFromSession();
    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", "20/3/1987");
        i++;
    }
    addRequestParameter(Constants.CURRENTFLOWKEY, flowKey);
    actionPerform();
    verifyNoActionErrors();
    verifyNoActionMessages();
    verifyForward(ActionForwards.next_success.toString());
    setRequestPathInfo("/clientCustAction.do");
    addRequestParameter("method", "preview");
    addRequestParameter("input", "mfiInfo");
    addRequestParameter("formedByPersonnel", "1");
    addRequestParameter(Constants.CURRENTFLOWKEY, flowKey);
    actionPerform();
    verifyNoActionErrors();
    verifyNoActionMessages();
    verifyForward(ActionForwards.preview_success.toString());
    setRequestPathInfo("/clientCustAction.do");
    addRequestParameter("method", "create");
    addRequestParameter("input", "create");
    addRequestParameter("status", "1");
    addRequestParameter(Constants.CURRENTFLOWKEY, flowKey);
    actionPerform();
    verifyNoActionErrors();
    verifyNoActionMessages();
    verifyForward(ActionForwards.create_success.toString());
    ClientCustActionForm actionForm = (ClientCustActionForm) request.getSession().getAttribute("clientCustActionForm");
    client = TestObjectFactory.getClient(actionForm.getCustomerIdAsInt());
}
Also used : ClientCustActionForm(org.mifos.customers.client.struts.actionforms.ClientCustActionForm) BusinessActivityEntity(org.mifos.application.master.business.BusinessActivityEntity) CustomFieldDto(org.mifos.dto.domain.CustomFieldDto) List(java.util.List) ArrayList(java.util.ArrayList) Test(org.junit.Test)

Example 14 with ClientCustActionForm

use of org.mifos.customers.client.struts.actionforms.ClientCustActionForm in project head by mifos.

the class ClientCustActionStrutsTest method testCreateSuccessUnderGroupInBranch.

@Test
public void testCreateSuccessUnderGroupInBranch() throws Exception {
    try {
        createParentGroup();
        setRequestPathInfo("/clientCustAction.do");
        addRequestParameter("method", "load");
        addRequestParameter("parentGroupId", group.getCustomerId().toString());
        addRequestParameter("groupFlag", "1");
        addRequestParameter(Constants.CURRENTFLOWKEY, flowKey);
        actionPerform();
        flowKey = request.getAttribute(Constants.CURRENTFLOWKEY).toString();
        verifyNoActionErrors();
        verifyNoActionMessages();
        verifyForward(ActionForwards.load_success.toString());
        List<BusinessActivityEntity> povertyStatus = (List<BusinessActivityEntity>) SessionUtils.getAttribute(ClientConstants.POVERTY_STATUS, request);
        List<CustomFieldDto> customFieldDefs = getCustomFieldFromSession();
        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", "20/3/1987");
            i++;
        }
        addRequestParameter(Constants.CURRENTFLOWKEY, flowKey);
        actionPerform();
        verifyNoActionErrors();
        verifyNoActionMessages();
        verifyForward(ActionForwards.next_success.toString());
        setRequestPathInfo("/clientCustAction.do");
        addRequestParameter("method", "preview");
        addRequestParameter("input", "mfiInfo");
        addRequestParameter("formedByPersonnel", "1");
        addRequestParameter(Constants.CURRENTFLOWKEY, flowKey);
        actionPerform();
        verifyNoActionErrors();
        verifyNoActionMessages();
        verifyForward(ActionForwards.preview_success.toString());
        setRequestPathInfo("/clientCustAction.do");
        addRequestParameter("method", "create");
        addRequestParameter("input", "create");
        addRequestParameter("status", "1");
        addRequestParameter(Constants.CURRENTFLOWKEY, flowKey);
        actionPerform();
        verifyNoActionErrors();
        verifyNoActionMessages();
        verifyForward(ActionForwards.create_success.toString());
        ClientCustActionForm actionForm = (ClientCustActionForm) request.getSession().getAttribute("clientCustActionForm");
        client = TestObjectFactory.getClient(actionForm.getCustomerIdAsInt());
    } catch (Exception e) {
        e.printStackTrace();
    }
}
Also used : ClientCustActionForm(org.mifos.customers.client.struts.actionforms.ClientCustActionForm) BusinessActivityEntity(org.mifos.application.master.business.BusinessActivityEntity) CustomFieldDto(org.mifos.dto.domain.CustomFieldDto) List(java.util.List) ArrayList(java.util.ArrayList) IOException(java.io.IOException) PageExpiredException(org.mifos.framework.exceptions.PageExpiredException) Test(org.junit.Test)

Example 15 with ClientCustActionForm

use of org.mifos.customers.client.struts.actionforms.ClientCustActionForm in project head by mifos.

the class PictureFormFile method next.

@TransactionDemarcate(joinToken = true)
public ActionForward next(ActionMapping mapping, ActionForm form, HttpServletRequest request, @SuppressWarnings("unused") HttpServletResponse response) throws Exception {
    ClientCustActionForm actionForm = (ClientCustActionForm) form;
    ClientFamilyDetailsDto clientFamilyDetails = this.clientServiceFacade.retrieveClientFamilyDetails();
    if (clientFamilyDetails.isFamilyDetailsRequired()) {
        SessionUtils.setCollectionAttribute(ClientConstants.LIVING_STATUS_ENTITY, clientFamilyDetails.getLivingStatus(), request);
        SessionUtils.setCollectionAttribute(ClientConstants.GENDER_ENTITY, clientFamilyDetails.getGenders(), request);
        actionForm.setFamilyDetailBean(clientFamilyDetails.getFamilyDetails());
        return mapping.findForward(ActionForwards.next_success_family.toString());
    }
    return createClientQuestionnaire.fetchAppliedQuestions(mapping, actionForm, request, ActionForwards.next_success);
}
Also used : ClientCustActionForm(org.mifos.customers.client.struts.actionforms.ClientCustActionForm) ClientFamilyDetailsDto(org.mifos.dto.domain.ClientFamilyDetailsDto) TransactionDemarcate(org.mifos.framework.util.helpers.TransactionDemarcate)

Aggregations

ClientCustActionForm (org.mifos.customers.client.struts.actionforms.ClientCustActionForm)29 TransactionDemarcate (org.mifos.framework.util.helpers.TransactionDemarcate)21 ArrayList (java.util.ArrayList)10 List (java.util.List)8 CustomFieldDto (org.mifos.dto.domain.CustomFieldDto)8 Test (org.junit.Test)7 ClientBO (org.mifos.customers.client.business.ClientBO)7 ClientNameDetailDto (org.mifos.dto.screen.ClientNameDetailDto)7 BusinessActivityEntity (org.mifos.application.master.business.BusinessActivityEntity)5 MeetingBO (org.mifos.application.meeting.business.MeetingBO)5 UserContext (org.mifos.security.util.UserContext)5 FormFile (org.apache.struts.upload.FormFile)4 ApplicableAccountFeeDto (org.mifos.dto.domain.ApplicableAccountFeeDto)4 InformationOrderServiceFacade (org.mifos.platform.questionnaire.service.InformationOrderServiceFacade)4 ByteArrayInputStream (java.io.ByteArrayInputStream)3 InputStream (java.io.InputStream)3 DateTime (org.joda.time.DateTime)3 FeeDto (org.mifos.accounts.fees.business.FeeDto)3 SpouseFatherLookupEntity (org.mifos.application.master.business.SpouseFatherLookupEntity)3 SavingsDetailDto (org.mifos.dto.domain.SavingsDetailDto)3