use of org.springframework.web.bind.annotation.RequestMapping in project head by mifos.
the class CenterRESTController method getCenterChargesByNumber.
@RequestMapping(value = "center/num-{globalCustNum}/charges", method = RequestMethod.GET)
@ResponseBody
public CustomerChargesDetailsDto getCenterChargesByNumber(@PathVariable String globalCustNum) {
CenterBO centerBO = customerDao.findCenterBySystemId(globalCustNum);
CustomerChargesDetailsDto centerCharges = centerServiceFacade.retrieveChargesDetails(centerBO.getCustomerId());
centerCharges.addActivities(centerServiceFacade.retrieveRecentActivities(centerBO.getCustomerId(), 3));
return centerCharges;
}
use of org.springframework.web.bind.annotation.RequestMapping in project head by mifos.
the class CollectionSheetRESTController method saveCollectionSheet.
@RequestMapping(value = "/collectionsheet/save", method = RequestMethod.POST)
@ResponseBody
public Map<String, Object> saveCollectionSheet(@RequestBody JSONSaveCollectionsheet request) throws Throwable {
Map<String, Object> map = new HashMap<String, Object>();
ObjectMapper om = createObjectMapper();
List<InvalidSaveCollectionSheetReason> reasons = new ArrayList<InvalidSaveCollectionSheetReason>();
CollectionSheetErrorsDto errors = null;
SaveCollectionSheetDto saveCollectionSheetDto = null;
try {
saveCollectionSheetDto = om.readValue(request.getJson(), SaveCollectionSheetDto.class);
} catch (JsonMappingException e) {
if (e.getCause() instanceof SaveCollectionSheetException) {
reasons.addAll(((SaveCollectionSheetException) e.getCause()).getInvalidSaveCollectionSheetReasons());
} else {
throw e.getCause();
}
}
if (saveCollectionSheetDto != null) {
try {
errors = collectionSheetServiceFacade.saveCollectionSheet(saveCollectionSheetDto);
map.put("errors", errors != null ? errors.getErrorText() : null);
} catch (MifosRuntimeException e) {
map.put("errors", e.getMessage());
}
}
map.put("invalidCollectionSheet", reasons);
return map;
}
use of org.springframework.web.bind.annotation.RequestMapping in project head by mifos.
the class CustomerRESTController method getApplicableFees.
@RequestMapping(value = "/customer/num-{globalCustNum}/fees", method = RequestMethod.GET)
@ResponseBody
public Map<String, Map<String, String>> getApplicableFees(@PathVariable String globalCustNum) throws Exception {
CustomerBO customerBO = this.customerDao.findCustomerBySystemId(globalCustNum);
Integer accountId = customerBO.getCustomerAccount().getAccountId();
List<ApplicableCharge> applicableCharges = this.accountServiceFacade.getApplicableFees(accountId);
Map<String, Map<String, String>> map = new HashMap<String, Map<String, String>>();
for (ApplicableCharge applicableCharge : applicableCharges) {
Map<String, String> feeMap = new HashMap<String, String>();
feeMap.put("feeId", applicableCharge.getFeeId());
feeMap.put("amountOrRate", applicableCharge.getAmountOrRate());
feeMap.put("formula", applicableCharge.getFormula());
feeMap.put("periodicity", applicableCharge.getPeriodicity());
feeMap.put("paymentType", applicableCharge.getPaymentType());
feeMap.put("isRateType", applicableCharge.getIsRateType());
map.put(applicableCharge.getFeeName(), feeMap);
}
return map;
}
use of org.springframework.web.bind.annotation.RequestMapping in project head by mifos.
the class GroupRESTController method createGroup.
@RequestMapping(value = "group/create", method = RequestMethod.POST)
@ResponseBody
public Map<String, String> createGroup(@RequestBody String request) throws Throwable {
ObjectMapper om = createGroupMapping();
CreateGroupCreationDetailDto creationDetail = null;
MeetingBO meetingBO = null;
try {
creationDetail = om.readValue(request, CreateGroupCreationDetailDto.class);
} catch (JsonMappingException e) {
throw e.getCause();
}
validate(creationDetail);
meetingBO = (MeetingBO) creationDetail.getMeeting().toBO();
GroupCreationDetail group = createGroup(creationDetail);
CustomerDetailsDto groupDetails = groupServiceFacade.createNewGroup(group, meetingBO.toDto());
GroupInformationDto groupInfo = groupServiceFacade.getGroupInformationDto(groupDetails.getGlobalCustNum());
Map<String, String> map = new HashMap<String, String>();
map.put("status", "success");
map.put("globalCusNum", groupInfo.getGroupDisplay().getGlobalCustNum());
map.put("accountNum", groupInfo.getCustomerAccountSummary().getGlobalAccountNum());
map.put("address", groupInfo.getAddress().getDisplayAddress());
map.put("city", groupInfo.getAddress().getCity());
map.put("state", groupInfo.getAddress().getState());
map.put("country", groupInfo.getAddress().getCountry());
map.put("postal code", groupInfo.getAddress().getZip());
map.put("phone", groupInfo.getAddress().getPhoneNumber());
map.put("dispalyName", groupInfo.getGroupDisplay().getDisplayName());
map.put("externalId", groupInfo.getGroupDisplay().getExternalId());
map.put("loanOfficer", groupInfo.getGroupDisplay().getLoanOfficerName());
return map;
}
use of org.springframework.web.bind.annotation.RequestMapping in project head by mifos.
the class GroupRESTController method getGroupChargesByNumber.
@RequestMapping(value = "group/num-{globalCustNum}/charges", method = RequestMethod.GET)
@ResponseBody
public CustomerChargesDetailsDto getGroupChargesByNumber(@PathVariable String globalCustNum) {
GroupBO groupBO = customerDao.findGroupBySystemId(globalCustNum);
CustomerChargesDetailsDto groupCharges = centerServiceFacade.retrieveChargesDetails(groupBO.getCustomerId());
groupCharges.addActivities(centerServiceFacade.retrieveRecentActivities(groupBO.getCustomerId(), 3));
return groupCharges;
}
Aggregations