use of org.mifos.accounts.business.AccountBO in project head by mifos.
the class ClientServiceFacadeWebTier method convertFeeViewsToAccountFeeEntities.
private List<AccountFeesEntity> convertFeeViewsToAccountFeeEntities(List<ApplicableAccountFeeDto> feesToApply) {
List<AccountFeesEntity> feesForCustomerAccount = new ArrayList<AccountFeesEntity>();
for (ApplicableAccountFeeDto feeDto : feesToApply) {
FeeBO fee = this.feeDao.findById(feeDto.getFeeId().shortValue());
Double feeAmount = new LocalizationConverter().getDoubleValueForCurrentLocale(feeDto.getAmount());
AccountBO nullReferenceForNow = null;
AccountFeesEntity accountFee = new AccountFeesEntity(nullReferenceForNow, fee, feeAmount);
feesForCustomerAccount.add(accountFee);
}
return feesForCustomerAccount;
}
use of org.mifos.accounts.business.AccountBO in project head by mifos.
the class ClientServiceFacadeWebTier method getClientAccountPayments.
@Override
public List<AccountPaymentDto> getClientAccountPayments(String globalAccountNum) {
List<AccountPaymentDto> clientAccountPayments = new ArrayList<AccountPaymentDto>();
try {
AccountBO account = legacyAccountDao.findBySystemId(globalAccountNum);
List<AccountPaymentEntity> clientAccountPaymentsEntities = account.getAccountPayments();
for (AccountPaymentEntity accountPaymentEntity : clientAccountPaymentsEntities) {
clientAccountPayments.add(accountPaymentEntity.toScreenDto());
}
} catch (PersistenceException e) {
throw new MifosRuntimeException(e);
}
return clientAccountPayments;
}
use of org.mifos.accounts.business.AccountBO in project head by mifos.
the class CenterServiceFacadeWebTier method retrieveAccountTransactionHistory.
@Override
public List<TransactionHistoryDto> retrieveAccountTransactionHistory(String globalAccountNum) {
MifosUser user = (MifosUser) SecurityContextHolder.getContext().getAuthentication().getPrincipal();
UserContext userContext = toUserContext(user);
try {
AccountBO account = new AccountBusinessService().findBySystemId(globalAccountNum);
CustomerBO customerBO = account.getCustomer();
account.updateDetails(userContext);
personnelDao.checkAccessPermission(userContext, customerBO.getOfficeId(), customerBO.getLoanOfficerId());
List<TransactionHistoryDto> transactionHistories = account.getTransactionHistoryView();
for (TransactionHistoryDto transactionHistoryDto : transactionHistories) {
transactionHistoryDto.setUserPrefferedPostedDate(DateUtils.getUserLocaleDate(userContext.getPreferredLocale(), transactionHistoryDto.getPostedDate().toString()));
transactionHistoryDto.setUserPrefferedTransactionDate(DateUtils.getUserLocaleDate(userContext.getPreferredLocale(), transactionHistoryDto.getTransactionDate().toString()));
}
return transactionHistories;
} catch (ServiceException e) {
throw new MifosRuntimeException(e);
} catch (AccountException e) {
throw new MifosRuntimeException("Access denied!", e);
}
}
use of org.mifos.accounts.business.AccountBO in project head by mifos.
the class CenterServiceFacadeWebTier method retrieveAllClosedAccounts.
@Override
public List<ClosedAccountDto> retrieveAllClosedAccounts(Integer customerId) {
List<ClosedAccountDto> closedAccounts = new ArrayList<ClosedAccountDto>();
List<AccountBO> allClosedAccounts = this.customerDao.retrieveAllClosedLoanAndSavingsAccounts(customerId);
for (AccountBO account : allClosedAccounts) {
LocalDate closedDate = new LocalDate(account.getClosedDate());
ClosedAccountDto closedAccount = new ClosedAccountDto(account.getAccountId(), account.getGlobalAccountNum(), account.getType().getValue().intValue(), account.getState().getValue().intValue(), closedDate);
closedAccounts.add(closedAccount);
}
return closedAccounts;
}
use of org.mifos.accounts.business.AccountBO in project head by mifos.
the class ApplyAdjustment method listPossibleAdjustments.
@TransactionDemarcate(joinToken = true)
public ActionForward listPossibleAdjustments(ActionMapping mapping, ActionForm form, HttpServletRequest request, @SuppressWarnings("unused") HttpServletResponse response) throws Exception {
ApplyAdjustmentActionForm appAdjustActionForm = (ApplyAdjustmentActionForm) form;
this.resetActionFormFields(appAdjustActionForm);
AccountBO accnt = getBizService().findBySystemId(appAdjustActionForm.getGlobalAccountNum());
boolean decliningRecalculation = false;
if (accnt instanceof LoanBO) {
LoanBO loan = (LoanBO) accnt;
if (loan.getInterestType().getId().equals(InterestType.DECLINING_PB.getValue())) {
decliningRecalculation = true;
}
}
List<AccountPaymentEntity> payments = accnt.getAccountPayments();
ArrayList<AdjustablePaymentDto> adjustablePayments = new ArrayList<AdjustablePaymentDto>();
int i = 1;
for (AccountPaymentEntity payment : payments) {
//ommit disbursal payment
if (!payment.getAmount().equals(Money.zero()) && i != payments.size()) {
AdjustablePaymentDto adjustablePaymentDto = new AdjustablePaymentDto(payment.getPaymentId(), payment.getAmount(), payment.getPaymentType().getName(), payment.getPaymentDate(), payment.getReceiptDate(), payment.getReceiptNumber());
adjustablePayments.add(adjustablePaymentDto);
if (decliningRecalculation) {
//only last payment
break;
}
}
i++;
}
SessionUtils.setAttribute(Constants.BUSINESS_KEY, accnt, request);
SessionUtils.setAttribute(Constants.POSSIBLE_ADJUSTMENTS, adjustablePayments, request);
request.setAttribute("method", "loadAdjustment");
return mapping.findForward("loadadjustments_success");
}
Aggregations