use of org.mifos.accounts.util.helpers.WaiveEnum in project head by mifos.
the class AccountAppAction method waiveChargeOverDue.
@TransactionDemarcate(joinToken = true)
public ActionForward waiveChargeOverDue(ActionMapping mapping, @SuppressWarnings("unused") ActionForm form, HttpServletRequest request, @SuppressWarnings("unused") HttpServletResponse response) throws Exception {
UserContext uc = (UserContext) SessionUtils.getAttribute(Constants.USERCONTEXT, request.getSession());
Integer accountId = getIntegerValue(request.getParameter("accountId"));
WaiveEnum waiveEnum = getWaiveType(request.getParameter(AccountConstants.WAIVE_TYPE));
this.centerServiceFacade.waiveChargesOverDue(accountId, waiveEnum.ordinal());
AccountBO account = getAccountBusinessService().getAccount(accountId);
account.updateDetails(uc);
SessionUtils.setAttribute(Constants.BUSINESS_KEY, account, request);
return mapping.findForward("waiveChargesOverDue_Success");
}
use of org.mifos.accounts.util.helpers.WaiveEnum in project head by mifos.
the class AccountAppAction method waiveChargeDue.
@TransactionDemarcate(joinToken = true)
public ActionForward waiveChargeDue(ActionMapping mapping, @SuppressWarnings("unused") ActionForm form, HttpServletRequest request, @SuppressWarnings("unused") HttpServletResponse response) throws Exception {
UserContext uc = (UserContext) SessionUtils.getAttribute(Constants.USERCONTEXT, request.getSession());
Integer accountId = getIntegerValue(request.getParameter("accountId"));
WaiveEnum waiveEnum = getWaiveType(request.getParameter(AccountConstants.WAIVE_TYPE));
this.centerServiceFacade.waiveChargesDue(accountId, waiveEnum.ordinal());
AccountBO account = getAccountBusinessService().getAccount(accountId);
account.updateDetails(uc);
SessionUtils.setAttribute(Constants.BUSINESS_KEY, account, request);
return mapping.findForward("waiveChargesDue_Success");
}
use of org.mifos.accounts.util.helpers.WaiveEnum in project head by mifos.
the class CenterServiceFacadeWebTier method waiveChargesOverDue.
@Override
public void waiveChargesOverDue(Integer accountId, Integer waiveType) {
MifosUser user = (MifosUser) SecurityContextHolder.getContext().getAuthentication().getPrincipal();
UserContext userContext = toUserContext(user);
try {
AccountBO account = new AccountBusinessService().getAccount(accountId);
account.updateDetails(userContext);
WaiveEnum waiveEnum = WaiveEnum.fromInt(waiveType);
if (account.getPersonnel() != null) {
new AccountBusinessService().checkPermissionForWaiveDue(waiveEnum, account.getType(), account.getCustomer().getLevel(), userContext, account.getOffice().getOfficeId(), account.getPersonnel().getPersonnelId());
} else {
new AccountBusinessService().checkPermissionForWaiveDue(waiveEnum, account.getType(), account.getCustomer().getLevel(), userContext, account.getOffice().getOfficeId(), userContext.getId());
}
this.transactionHelper.startTransaction();
account.waiveAmountOverDue(waiveEnum);
this.customerDao.save(account);
this.transactionHelper.commitTransaction();
} catch (ServiceException e) {
this.transactionHelper.rollbackTransaction();
throw new MifosRuntimeException(e);
} catch (ApplicationException e) {
this.transactionHelper.rollbackTransaction();
throw new BusinessRuleException(e.getKey(), e);
} finally {
this.transactionHelper.closeSession();
}
}
Aggregations