use of org.mifos.dto.domain.CustomFieldDto in project head by mifos.
the class CenterUpdateUsingCustomerServiceIntegrationTest method canUpdateCenterWithExternalId.
@Test
public void canUpdateCenterWithExternalId() throws Exception {
// setup
Short loanOfficerId = center.getPersonnel().getPersonnelId();
String newExternalId = "ext123";
LocalDate dateInPast = new LocalDate(center.getMfiJoiningDate()).minusWeeks(4);
String mfiJoiningDate = new SimpleDateFormat("dd/MM/yyyy").format(dateInPast.toDateMidnight().toDate());
AddressDto newAddress = null;
if (center.getAddress() != null) {
newAddress = Address.toDto(center.getAddress());
}
List<CustomFieldDto> customFields = new ArrayList<CustomFieldDto>();
List<CustomerPositionDto> customerPositions = new ArrayList<CustomerPositionDto>();
String updatedDisplayName = "Center " + RandomStringUtils.randomAlphanumeric(5);
CenterUpdate centerUpdate = new CenterUpdate(center.getCustomerId(), updatedDisplayName, center.getVersionNo(), loanOfficerId, newExternalId, mfiJoiningDate, newAddress, customFields, customerPositions);
UserContext userContext = TestUtils.makeUser();
// exercise test
customerService.updateCenter(userContext, centerUpdate);
// verification
center = customerDao.findCenterBySystemId(center.getGlobalCustNum());
assertThat(center.getExternalId(), is(newExternalId));
}
use of org.mifos.dto.domain.CustomFieldDto in project head by mifos.
the class CenterBOIntegrationTest method getCustomFields.
private List<CustomFieldDto> getCustomFields() {
List<CustomFieldDto> fields = new ArrayList<CustomFieldDto>();
fields.add(new CustomFieldDto(Short.valueOf("5"), "value1", CustomFieldType.ALPHA_NUMERIC.getValue()));
fields.add(new CustomFieldDto(Short.valueOf("6"), "value2", CustomFieldType.ALPHA_NUMERIC.getValue()));
return fields;
}
use of org.mifos.dto.domain.CustomFieldDto in project head by mifos.
the class ClientCustActionStrutsTest method testCreateSuccessWithAssociatedSavingsOfferings.
@Test
public void testCreateSuccessWithAssociatedSavingsOfferings() throws Exception {
SecurityContext securityContext = new SecurityContextImpl();
MifosUser principal = new MifosUserBuilder().nonLoanOfficer().withAdminRole().build();
Authentication authentication = new TestingAuthenticationToken(principal, principal);
securityContext.setAuthentication(authentication);
SecurityContextHolder.setContext(securityContext);
savingsOffering1 = TestObjectFactory.createSavingsProduct("savingsPrd1", "s1", SavingsType.MANDATORY, ApplicableTo.CLIENTS, new Date(System.currentTimeMillis()));
List<FeeDto> feesToRemove = getFees(RecurrenceType.WEEKLY);
setRequestPathInfo("/clientCustAction.do");
addRequestParameter("method", "load");
addRequestParameter("officeId", "3");
addRequestParameter("groupFlag", "0");
addRequestParameter(Constants.CURRENTFLOWKEY, flowKey);
actionPerform();
flowKey = (String) request.getAttribute(Constants.CURRENTFLOWKEY);
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", "Req");
i++;
}
addRequestParameter(Constants.CURRENTFLOWKEY, flowKey);
actionPerform();
List<SavingsDetailDto> savingsOfferingList = getSavingsOfferingsFromSession();
SavingsDetailDto savingsOffering = savingsOfferingList.get(0);
setRequestPathInfo("/clientCustAction.do");
addRequestParameter("method", "preview");
addRequestParameter("input", "mfiInfo");
addRequestParameter("loanOfficerId", "1");
addRequestParameter("formedByPersonnel", "1");
addRequestParameter("savingsOffering[0]", savingsOffering.getPrdOfferingId().toString());
addRequestParameter(Constants.CURRENTFLOWKEY, flowKey);
actionPerform();
verifyNoActionErrors();
verifyNoActionMessages();
verifyForward(ActionForwards.preview_success.toString());
MeetingBO weeklyMeeting = new MeetingBuilder().weekly().every(1).occuringOnA(WeekDay.WEDNESDAY).build();
SessionUtils.setAttribute(CustomerConstants.CUSTOMER_MEETING, weeklyMeeting, request);
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());
Assert.assertNotNull(client);
Assert.assertNotNull(client.getOfferingsAssociatedInCreate());
Assert.assertEquals(1, client.getOfferingsAssociatedInCreate().size());
for (ClientInitialSavingsOfferingEntity offering : client.getOfferingsAssociatedInCreate()) {
Assert.assertEquals(savingsOffering1.getPrdOfferingId(), offering.getSavingsOffering().getPrdOfferingId());
Assert.assertTrue(true);
}
removeFees(feesToRemove);
savingsOffering1 = (SavingsOfferingBO) TestObjectFactory.getObject(SavingsOfferingBO.class, savingsOffering.getPrdOfferingId());
}
use of org.mifos.dto.domain.CustomFieldDto in project head by mifos.
the class ClientCustActionStrutsTest method testPreviewFailureForTrainedDate.
@Test
public void testPreviewFailureForTrainedDate() throws Exception {
setRequestPathInfo("/clientCustAction.do");
addRequestParameter("method", "load");
addRequestParameter("officeId", "3");
addRequestParameter("groupFlag", "0");
addRequestParameter(Constants.CURRENTFLOWKEY, flowKey);
actionPerform();
flowKey = request.getAttribute(Constants.CURRENTFLOWKEY).toString();
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(Constants.CURRENTFLOWKEY, flowKey);
int i = 0;
for (CustomFieldDto customFieldDef : customFieldDefs) {
addRequestParameter("customField[" + i + "].fieldId", customFieldDef.getFieldId().toString());
addRequestParameter("customField[" + i + "].fieldValue", "Req");
i++;
}
actionPerform();
setRequestPathInfo("/clientCustAction.do");
addRequestParameter("method", "preview");
addRequestParameter("formedByPersonnel", "1");
addRequestParameter("trained", "1");
addRequestParameter("input", "mfiInfo");
actionPerform();
Assert.assertEquals(1, getErrorSize());
Assert.assertEquals("Client Trained date not present", 1, getErrorSize(CustomerConstants.TRAINED_DATE_MANDATORY));
}
use of org.mifos.dto.domain.CustomFieldDto in project head by mifos.
the class ClientCustActionStrutsTest method getCustomFields.
private List<CustomFieldDto> getCustomFields() {
List<CustomFieldDto> fields = new ArrayList<CustomFieldDto>();
fields.add(new CustomFieldDto(Short.valueOf("5"), "value1", CustomFieldType.ALPHA_NUMERIC.getValue()));
fields.add(new CustomFieldDto(Short.valueOf("6"), "value2", CustomFieldType.ALPHA_NUMERIC.getValue()));
return fields;
}
Aggregations