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);
}
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();
}
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());
}
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();
}
}
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);
}
Aggregations