use of org.mifos.application.servicefacade.CreateCenterDetailsDto in project head by mifos.
the class CenterRESTController method createCenter.
@RequestMapping(value = "/center/create", method = RequestMethod.POST)
@ResponseBody
public Map<String, String> createCenter(@RequestBody String request) throws Throwable {
ObjectMapper om = createCenterMaping();
CreateCenterDetailsDto creationDetail = null;
MeetingBO meetingBO = null;
try {
creationDetail = om.readValue(request, CreateCenterDetailsDto.class);
} catch (JsonMappingException e) {
throw e.getCause();
}
validate(creationDetail);
meetingBO = (MeetingBO) creationDetail.getMeeting().toBO();
CenterCreationDetail center = createCenter(creationDetail);
CustomerDetailsDto details = this.centerServiceFacade.createNewCenter(center, meetingBO.toDto());
CenterInformationDto centerInfo = this.centerServiceFacade.getCenterInformationDto(details.getGlobalCustNum());
Map<String, String> map = new HashMap<String, String>();
map.put("status", "success");
map.put("globalCustNum", centerInfo.getCenterDisplay().getGlobalCustNum());
map.put("accountNum", centerInfo.getCustomerAccountSummary().getGlobalAccountNum());
map.put("name", center.getDisplayName());
map.put("externalId", center.getExternalId());
map.put("mfiDate", center.getMfiJoiningDate().toString());
map.put("address", center.getAddressDto().getDisplayAddress());
map.put("city", center.getAddressDto().getCity());
map.put("state", center.getAddressDto().getState());
map.put("country", center.getAddressDto().getCountry());
map.put("postal code", center.getAddressDto().getZip());
map.put("phone", center.getAddressDto().getPhoneNumber());
return map;
}
Aggregations