use of org.mifos.customers.struts.actionforms.CustomerApplyAdjustmentActionForm in project head by mifos.
the class CustomerApplyAdjustmentAction method applyAdjustment.
@TransactionDemarcate(validateAndResetToken = true)
@CloseSession
public ActionForward applyAdjustment(ActionMapping mapping, ActionForm form, HttpServletRequest request, @SuppressWarnings("unused") HttpServletResponse response) throws Exception {
String forward = null;
request.setAttribute(CustomerConstants.METHOD, CustomerConstants.METHOD_APPLY_ADJUSTMENT);
CustomerApplyAdjustmentActionForm applyAdjustmentActionForm = (CustomerApplyAdjustmentActionForm) form;
String globalCustNum = applyAdjustmentActionForm.getGlobalCustNum();
CustomerBO customerBO = this.customerDao.findCustomerBySystemId(globalCustNum);
SessionUtils.removeAttribute(Constants.BUSINESS_KEY, request);
SessionUtils.setAttribute(Constants.BUSINESS_KEY, customerBO, request);
if (null == customerBO.getCustomerAccount().findMostRecentNonzeroPaymentByPaymentDate()) {
request.setAttribute(CustomerConstants.METHOD, CustomerConstants.METHOD_PREVIEW_ADJUSTMENT);
throw new ApplicationException(AccountExceptionConstants.ZEROAMNTADJUSTMENT);
}
try {
this.centerServiceFacade.revertLastChargesPayment(globalCustNum, applyAdjustmentActionForm.getAdjustmentNote());
} catch (BusinessRuleException e) {
request.setAttribute(CustomerConstants.METHOD, CustomerConstants.METHOD_PREVIEW_ADJUSTMENT);
throw e;
}
String inputPage = applyAdjustmentActionForm.getInput();
resetActionFormFields(applyAdjustmentActionForm);
if (inputPage != null) {
if (inputPage.equals(CustomerConstants.VIEW_GROUP_CHARGES)) {
forward = CustomerConstants.APPLY_ADJUSTMENT_GROUP_SUCCESS;
} else if (inputPage.equals(CustomerConstants.VIEW_CENTER_CHARGES)) {
forward = CustomerConstants.APPLY_ADJUSTMENT_CENTER_SUCCESS;
} else if (inputPage.equals(CustomerConstants.VIEW_CLIENT_CHARGES)) {
forward = CustomerConstants.APPLY_ADJUSTMENT_CLIENT_SUCCESS;
}
}
return mapping.findForward(forward);
}
use of org.mifos.customers.struts.actionforms.CustomerApplyAdjustmentActionForm in project head by mifos.
the class CustomerApplyAdjustmentAction method loadAdjustment.
@TransactionDemarcate(joinToken = true)
public ActionForward loadAdjustment(ActionMapping mapping, ActionForm form, HttpServletRequest request, @SuppressWarnings("unused") HttpServletResponse response) throws Exception {
CustomerApplyAdjustmentActionForm applyAdjustmentActionForm = (CustomerApplyAdjustmentActionForm) form;
resetActionFormFields(applyAdjustmentActionForm);
String globalCustNum = applyAdjustmentActionForm.getGlobalCustNum();
CustomerBO customerBO = this.customerDao.findCustomerBySystemId(globalCustNum);
SessionUtils.removeAttribute(Constants.BUSINESS_KEY, request);
SessionUtils.setAttribute(Constants.BUSINESS_KEY, customerBO, request);
request.setAttribute(CustomerConstants.METHOD, CustomerConstants.METHOD_LOAD_ADJUSTMENT);
if (null == customerBO.getCustomerAccount().findMostRecentNonzeroPaymentByPaymentDate()) {
request.setAttribute("isDisabled", "true");
throw new ApplicationException(AccountExceptionConstants.ZEROAMNTADJUSTMENT);
}
return mapping.findForward(CustomerConstants.METHOD_LOAD_ADJUSTMENT_SUCCESS);
}
use of org.mifos.customers.struts.actionforms.CustomerApplyAdjustmentActionForm in project head by mifos.
the class CustomerApplyAdjustmentAction method cancelAdjustment.
@TransactionDemarcate(validateAndResetToken = true)
public ActionForward cancelAdjustment(ActionMapping mapping, ActionForm form, @SuppressWarnings("unused") HttpServletRequest request, @SuppressWarnings("unused") HttpServletResponse response) throws Exception {
String forward = null;
CustomerApplyAdjustmentActionForm applyAdjustmentActionForm = (CustomerApplyAdjustmentActionForm) form;
String inputPage = applyAdjustmentActionForm.getInput();
resetActionFormFields(applyAdjustmentActionForm);
if (inputPage != null) {
if (inputPage.equals(CustomerConstants.VIEW_GROUP_CHARGES)) {
forward = CustomerConstants.CANCELADJ_GROUP_SUCCESS;
} else if (inputPage.equals(CustomerConstants.VIEW_CENTER_CHARGES)) {
forward = CustomerConstants.CANCELADJ_CENTER_SUCCESS;
} else if (inputPage.equals(CustomerConstants.VIEW_CLIENT_CHARGES)) {
forward = CustomerConstants.CANCELADJ_CLIENT_SUCCESS;
}
}
return mapping.findForward(forward);
}
use of org.mifos.customers.struts.actionforms.CustomerApplyAdjustmentActionForm in project head by mifos.
the class CustomerApplyAdjustmentAction method previewAdjustment.
@TransactionDemarcate(joinToken = true)
public ActionForward previewAdjustment(ActionMapping mapping, ActionForm form, HttpServletRequest request, @SuppressWarnings("unused") HttpServletResponse response) throws Exception {
request.setAttribute(CustomerConstants.METHOD, CustomerConstants.METHOD_PREVIEW_ADJUSTMENT);
CustomerApplyAdjustmentActionForm applyAdjustmentActionForm = (CustomerApplyAdjustmentActionForm) form;
String globalCustNum = applyAdjustmentActionForm.getGlobalCustNum();
CustomerBO customerBO = this.customerDao.findCustomerBySystemId(globalCustNum);
SessionUtils.removeAttribute(Constants.BUSINESS_KEY, request);
SessionUtils.setAttribute(Constants.BUSINESS_KEY, customerBO, request);
if (null == customerBO.getCustomerAccount().findMostRecentNonzeroPaymentByPaymentDate()) {
request.setAttribute(CustomerConstants.METHOD, CustomerConstants.METHOD_LOAD_ADJUSTMENT);
request.setAttribute("isDisabled", "true");
throw new ApplicationException(AccountExceptionConstants.ZEROAMNTADJUSTMENT);
}
return mapping.findForward(CustomerConstants.METHOD_PREVIEW_ADJUSTMENT_SUCCESS);
}
Aggregations