Search in sources :

Example 1 with CustomerChargesDetailsDto

use of org.mifos.dto.domain.CustomerChargesDetailsDto 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;
}
Also used : CustomerChargesDetailsDto(org.mifos.dto.domain.CustomerChargesDetailsDto) CenterBO(org.mifos.customers.center.business.CenterBO) RequestMapping(org.springframework.web.bind.annotation.RequestMapping) ResponseBody(org.springframework.web.bind.annotation.ResponseBody)

Example 2 with CustomerChargesDetailsDto

use of org.mifos.dto.domain.CustomerChargesDetailsDto 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;
}
Also used : CustomerChargesDetailsDto(org.mifos.dto.domain.CustomerChargesDetailsDto) GroupBO(org.mifos.customers.group.business.GroupBO) RequestMapping(org.springframework.web.bind.annotation.RequestMapping) ResponseBody(org.springframework.web.bind.annotation.ResponseBody)

Example 3 with CustomerChargesDetailsDto

use of org.mifos.dto.domain.CustomerChargesDetailsDto in project head by mifos.

the class CenterServiceFacadeWebTier method retrieveChargesDetails.

@Override
public CustomerChargesDetailsDto retrieveChargesDetails(Integer customerId) {
    MifosUser mifosUser = (MifosUser) SecurityContextHolder.getContext().getAuthentication().getPrincipal();
    UserContext userContext = new UserContextFactory().create(mifosUser);
    CustomerBO customerBO = this.customerDao.findCustomerById(customerId);
    CustomerAccountBO customerAccount = customerBO.getCustomerAccount();
    try {
        personnelDao.checkAccessPermission(userContext, customerBO.getOfficeId(), customerBO.getLoanOfficerId());
    } catch (AccountException e) {
        throw new MifosRuntimeException("Access denied!", e);
    }
    List<AccountFeesDto> accountFeesDtos = new ArrayList<AccountFeesDto>();
    if (!customerAccount.getAccountFees().isEmpty()) {
        for (AccountFeesEntity accountFeesEntity : customerAccount.getAccountFees()) {
            AccountFeesDto accountFeesDto = new AccountFeesDto(accountFeesEntity.getFees().getFeeFrequency().getFeeFrequencyType().getId(), (accountFeesEntity.getFees().getFeeFrequency().getFeePayment() != null ? accountFeesEntity.getFees().getFeeFrequency().getFeePayment().getId() : null), accountFeesEntity.getFeeStatus(), accountFeesEntity.getFees().getFeeName(), accountFeesEntity.getAccountFeeAmount().toString(), getMeetingRecurrence(accountFeesEntity.getFees().getFeeFrequency().getFeeMeetingFrequency(), userContext), accountFeesEntity.getFees().getFeeId());
            accountFeesDtos.add(accountFeesDto);
        }
    }
    CustomerScheduleDto customerSchedule = null;
    CustomerScheduleEntity scheduleEntity = (CustomerScheduleEntity) customerAccount.getUpcomingInstallment();
    if (scheduleEntity != null) {
        Set<AccountFeesActionDetailEntity> feeEntities = scheduleEntity.getAccountFeesActionDetails();
        List<AccountFeeScheduleDto> feeDtos = new ArrayList<AccountFeeScheduleDto>();
        for (AccountFeesActionDetailEntity feeEntity : feeEntities) {
            feeDtos.add(convertToDto(feeEntity));
        }
        customerSchedule = new CustomerScheduleDto(scheduleEntity.getMiscFee().toString(), scheduleEntity.getMiscFeePaid().toString(), scheduleEntity.getMiscPenalty().toString(), scheduleEntity.getMiscPenaltyPaid().toString(), feeDtos);
    }
    return new CustomerChargesDetailsDto(customerAccount.getNextDueAmount().toString(), customerAccount.getTotalAmountInArrears().toString(), customerAccount.getTotalAmountDue().toString(), customerAccount.getUpcomingChargesDate(), customerSchedule, accountFeesDtos);
}
Also used : CustomerAccountBO(org.mifos.customers.business.CustomerAccountBO) AccountFeesActionDetailEntity(org.mifos.accounts.business.AccountFeesActionDetailEntity) UserContext(org.mifos.security.util.UserContext) ArrayList(java.util.ArrayList) MifosUser(org.mifos.security.MifosUser) UserContextFactory(org.mifos.accounts.servicefacade.UserContextFactory) AccountFeesDto(org.mifos.dto.screen.AccountFeesDto) AccountFeeScheduleDto(org.mifos.dto.domain.AccountFeeScheduleDto) AccountException(org.mifos.accounts.exceptions.AccountException) CustomerScheduleEntity(org.mifos.customers.business.CustomerScheduleEntity) CustomerChargesDetailsDto(org.mifos.dto.domain.CustomerChargesDetailsDto) CustomerBO(org.mifos.customers.business.CustomerBO) CustomerScheduleDto(org.mifos.dto.domain.CustomerScheduleDto) AccountFeesEntity(org.mifos.accounts.business.AccountFeesEntity) MifosRuntimeException(org.mifos.core.MifosRuntimeException)

Example 4 with CustomerChargesDetailsDto

use of org.mifos.dto.domain.CustomerChargesDetailsDto in project head by mifos.

the class ClientRESTController method getClientChargesByNumber.

@RequestMapping(value = "client/num-{globalCustNum}/charges", method = RequestMethod.GET)
@ResponseBody
public CustomerChargesDetailsDto getClientChargesByNumber(@PathVariable String globalCustNum) {
    ClientBO clientBO = customerDao.findClientBySystemId(globalCustNum);
    CustomerChargesDetailsDto clientCharges = centerServiceFacade.retrieveChargesDetails(clientBO.getCustomerId());
    clientCharges.addActivities(centerServiceFacade.retrieveRecentActivities(clientBO.getCustomerId(), 3));
    return clientCharges;
}
Also used : CustomerChargesDetailsDto(org.mifos.dto.domain.CustomerChargesDetailsDto) ClientBO(org.mifos.customers.client.business.ClientBO) RequestMapping(org.springframework.web.bind.annotation.RequestMapping) ResponseBody(org.springframework.web.bind.annotation.ResponseBody)

Aggregations

CustomerChargesDetailsDto (org.mifos.dto.domain.CustomerChargesDetailsDto)4 RequestMapping (org.springframework.web.bind.annotation.RequestMapping)3 ResponseBody (org.springframework.web.bind.annotation.ResponseBody)3 ArrayList (java.util.ArrayList)1 AccountFeesActionDetailEntity (org.mifos.accounts.business.AccountFeesActionDetailEntity)1 AccountFeesEntity (org.mifos.accounts.business.AccountFeesEntity)1 AccountException (org.mifos.accounts.exceptions.AccountException)1 UserContextFactory (org.mifos.accounts.servicefacade.UserContextFactory)1 MifosRuntimeException (org.mifos.core.MifosRuntimeException)1 CustomerAccountBO (org.mifos.customers.business.CustomerAccountBO)1 CustomerBO (org.mifos.customers.business.CustomerBO)1 CustomerScheduleEntity (org.mifos.customers.business.CustomerScheduleEntity)1 CenterBO (org.mifos.customers.center.business.CenterBO)1 ClientBO (org.mifos.customers.client.business.ClientBO)1 GroupBO (org.mifos.customers.group.business.GroupBO)1 AccountFeeScheduleDto (org.mifos.dto.domain.AccountFeeScheduleDto)1 CustomerScheduleDto (org.mifos.dto.domain.CustomerScheduleDto)1 AccountFeesDto (org.mifos.dto.screen.AccountFeesDto)1 MifosUser (org.mifos.security.MifosUser)1 UserContext (org.mifos.security.util.UserContext)1