use of org.mifos.dto.domain.CustomerDetailsDto in project head by mifos.
the class ClientRESTController method createClient.
@RequestMapping(value = "client/create", method = RequestMethod.POST)
@ResponseBody
public Map<String, String> createClient(@RequestBody String request) throws Throwable {
ObjectMapper om = createClientMapping();
CreateClientCreationDetail creationDetail = null;
MeetingBO meetingBO = null;
try {
creationDetail = om.readValue(request, CreateClientCreationDetail.class);
} catch (JsonMappingException e) {
e.getCause();
}
validate(creationDetail);
meetingBO = (MeetingBO) creationDetail.getMeeting().toBO();
ClientCreationDetail client = createClient(creationDetail);
CustomerDetailsDto clientDetails = clientServiceFacade.createNewClient(client, meetingBO.toDto(), null);
ClientInformationDto clientInfo = clientServiceFacade.getClientInformationDto(clientDetails.getGlobalCustNum());
Map<String, String> map = new HashMap<String, String>();
map.put("status", "success");
map.put("globalCustNum", clientInfo.getClientDisplay().getGlobalCustNum());
map.put("accountNum", clientInfo.getCustomerAccountSummary().getGlobalAccountNum());
map.put("address", clientInfo.getAddress().getDisplayAddress());
map.put("city", clientInfo.getAddress().getCity());
map.put("state", clientInfo.getAddress().getState());
map.put("country", clientInfo.getAddress().getCountry());
map.put("postal code", clientInfo.getAddress().getZip());
map.put("phone", clientInfo.getAddress().getPhoneNumber());
map.put("dispalyName", clientInfo.getClientDisplay().getDisplayName());
map.put("externalId", clientInfo.getClientDisplay().getExternalId());
map.put("loanOfficer", clientInfo.getClientDisplay().getLoanOfficerName());
return map;
}
Aggregations