use of org.mifos.dto.domain.SavingsAccountDetailDto in project head by mifos.
the class NotesAction method load.
@TransactionDemarcate(joinToken = true)
public ActionForward load(ActionMapping mapping, ActionForm form, @SuppressWarnings("unused") HttpServletRequest request, @SuppressWarnings("unused") HttpServletResponse response) throws Exception {
clearActionForm(form);
NotesActionForm notesActionForm = (NotesActionForm) form;
Integer accountId = Integer.valueOf(notesActionForm.getAccountId());
AccountBO account = new AccountBusinessService().getAccount(accountId);
if (account.isLoanAccount() || account.isGroupLoanAccount()) {
LoanAccountDetailDto loanAccountDto = this.loanAccountServiceFacade.retrieveLoanAccountNotes(accountId.longValue());
if (account.isLoanAccount()) {
notesActionForm.setAccountTypeId(AccountTypes.LOAN_ACCOUNT.getValue().toString());
} else {
notesActionForm.setAccountTypeId(AccountTypes.GROUP_LOAN_ACCOUNT.getValue().toString());
}
notesActionForm.setGlobalAccountNum(loanAccountDto.getGlobalAccountNum());
notesActionForm.setPrdOfferingName(loanAccountDto.getProductDetails().getPrdOfferingName());
} else if (account.isSavingsAccount()) {
SavingsAccountDetailDto savingsAccountDto = this.savingsServiceFacade.retrieveSavingsAccountNotes(accountId.longValue());
notesActionForm.setPrdOfferingName(savingsAccountDto.getProductDetails().getProductDetails().getName());
notesActionForm.setAccountTypeId(AccountTypes.SAVINGS_ACCOUNT.getValue().toString());
notesActionForm.setGlobalAccountNum(savingsAccountDto.getGlobalAccountNum());
}
return mapping.findForward(ActionForwards.load_success.toString());
}
use of org.mifos.dto.domain.SavingsAccountDetailDto in project head by mifos.
the class LoanAccountServiceFacadeWebTier method makeEarlyRepaymentFromSavings.
public void makeEarlyRepaymentFromSavings(RepayLoanInfoDto repayLoanInfoDto, String savingsAccGlobalNum) {
MifosUser mifosUser = (MifosUser) SecurityContextHolder.getContext().getAuthentication().getPrincipal();
UserContext userContext = new UserContextFactory().create(mifosUser);
SavingsAccountDetailDto savingsAcc = savingsServiceFacade.retrieveSavingsAccountDetails(savingsAccGlobalNum);
Long savingsId = savingsAcc.getAccountId().longValue();
Long customerId = savingsAcc.getCustomerId().longValue();
LocalDate trxnDate = new LocalDate(repayLoanInfoDto.getDateOfPayment());
Double amount = Double.parseDouble(repayLoanInfoDto.getEarlyRepayAmount());
Integer paymentTypeId = Integer.parseInt(repayLoanInfoDto.getPaymentTypeId());
String receiptId = repayLoanInfoDto.getReceiptNumber();
LocalDate receiptDate = new LocalDate(repayLoanInfoDto.getReceiptDate());
Locale preferredLocale = userContext.getPreferredLocale();
SavingsWithdrawalDto savingsWithdrawalDto = new SavingsWithdrawalDto(savingsId, customerId, trxnDate, amount, paymentTypeId, receiptId, receiptDate, preferredLocale);
try {
transactionHelper.startTransaction();
PaymentDto withdrawal = savingsServiceFacade.withdraw(savingsWithdrawalDto, true);
repayLoanInfoDto.setSavingsPaymentId(withdrawal.getPaymentId());
makeEarlyRepayment(repayLoanInfoDto);
transactionHelper.commitTransaction();
} catch (BusinessRuleException e) {
transactionHelper.rollbackTransaction();
throw new BusinessRuleException(e.getMessageKey(), e);
} catch (Exception e) {
transactionHelper.rollbackTransaction();
throw new MifosRuntimeException(e);
}
}
use of org.mifos.dto.domain.SavingsAccountDetailDto in project head by mifos.
the class SavingsAccountController method showSavingsAccountDetails.
@RequestMapping(value = "/viewSavingsAccountDetails", method = RequestMethod.GET)
public ModelAndView showSavingsAccountDetails(HttpServletRequest request, HttpServletResponse response) {
ModelAndView modelAndView = new ModelAndView();
sitePreferenceHelper.resolveSiteType(modelAndView, "viewSavingsAccountDetails", request);
modelAndView.addObject("include_page", new IncludePage(request, response));
String globalAccountNum = request.getParameter("globalAccountNum");
SavingsAccountDetailDto savingsAccountDetailDto = savingsServiceFacade.retrieveSavingsAccountDetails(globalAccountNum);
modelAndView.addObject("savingsAccountDetailDto", savingsAccountDetailDto);
boolean containsQGForCloseSavings = false;
containsQGForCloseSavings = questionnaireServiceFacade.getQuestionGroupInstances(savingsAccountDetailDto.getAccountId(), "Close", "Savings").size() > 0;
modelAndView.addObject("containsQGForCloseSavings", containsQGForCloseSavings);
modelAndView.addObject("backPageUrl", UrlHelper.constructCurrentPageUrl(request));
savingsServiceFacade.putSavingsBusinessKeyInSession(globalAccountNum, request);
// for mifostabletag
request.getSession().setAttribute("recentActivityForDetailPage", savingsAccountDetailDto.getRecentActivity());
return modelAndView;
}
use of org.mifos.dto.domain.SavingsAccountDetailDto in project head by mifos.
the class SavingsAccountController method showSavingsAccountRecentActivity.
@RequestMapping(value = "/viewSavingsAccountRecentActivity", method = RequestMethod.GET)
public ModelAndView showSavingsAccountRecentActivity(HttpServletRequest request, HttpServletResponse response) {
ModelAndView modelAndView = new ModelAndView();
sitePreferenceHelper.resolveSiteType(modelAndView, "viewSavingsAccountRecentActivity", request);
modelAndView.addObject("include_page", new IncludePage(request, response));
String globalAccountNum = request.getParameter("globalAccountNum");
SavingsAccountDetailDto savingsAccountDetailDto = savingsServiceFacade.retrieveSavingsAccountDetails(globalAccountNum);
modelAndView.addObject("savingsAccountDetailDto", savingsAccountDetailDto);
modelAndView.addObject("currentDate", new Date());
List<SavingsRecentActivityDto> recentActivity = this.savingsServiceFacade.retrieveRecentSavingsActivities(savingsAccountDetailDto.getAccountId().longValue());
request.setAttribute("recentActivityList", recentActivity);
savingsServiceFacade.putSavingsBusinessKeyInSession(globalAccountNum, request);
return modelAndView;
}
use of org.mifos.dto.domain.SavingsAccountDetailDto in project head by mifos.
the class CreateSavingsAccountController method createAccount.
private SavingsAccountDetailDto createAccount(CreateSavingsAccountFormBean formBean, Short accountState) {
SavingsProductReferenceDto productReference = formBean.getProduct();
SavingsProductDto savingsProduct = productReference.getSavingsProductDetails();
Integer productId = savingsProduct.getProductDetails().getId();
Integer customerId = formBean.getCustomer().getCustomerId();
// TODO - deposit amount should be validated before reaching here...
String recommendedOrMandatoryAmount = formBean.getMandatoryDepositAmount();
SavingsAccountCreationDto savingsAccountCreation = new SavingsAccountCreationDto(productId, customerId, accountState, recommendedOrMandatoryAmount);
Long savingsId = savingsServiceFacade.createSavingsAccount(savingsAccountCreation, formBean.getQuestionGroups());
SavingsAccountDetailDto savingsAccountDetailDto = savingsServiceFacade.retrieveSavingsAccountDetails(savingsId);
return savingsAccountDetailDto;
}
Aggregations