use of org.mifos.accounts.struts.actionforms.AccountApplyPaymentActionForm in project head by mifos.
the class AccountApplyGroupPaymentAction method previous.
@TransactionDemarcate(joinToken = true)
public ActionForward previous(ActionMapping mapping, @SuppressWarnings("unused") ActionForm form, @SuppressWarnings("unused") HttpServletRequest request, @SuppressWarnings("unused") HttpServletResponse response) throws Exception {
//workaround for checkbox problem
AccountApplyPaymentActionForm accountApplyPaymentActionForm = (AccountApplyPaymentActionForm) form;
accountApplyPaymentActionForm.setTruePrintReceipt(accountApplyPaymentActionForm.getPrintReceipt());
accountApplyPaymentActionForm.setPrintReceipt(false);
return mapping.findForward(ActionForwards.previous_success.toString());
}
use of org.mifos.accounts.struts.actionforms.AccountApplyPaymentActionForm in project head by mifos.
the class AccountApplyPaymentAction method validate.
@TransactionDemarcate(joinToken = true)
public ActionForward validate(ActionMapping mapping, @SuppressWarnings("unused") ActionForm form, HttpServletRequest request, @SuppressWarnings("unused") HttpServletResponse response) throws Exception {
String method = (String) request.getAttribute("methodCalled");
String forward = null;
//workaround for checkbox problem
AccountApplyPaymentActionForm accountApplyPaymentActionForm = (AccountApplyPaymentActionForm) form;
accountApplyPaymentActionForm.setTruePrintReceipt(accountApplyPaymentActionForm.getPrintReceipt());
accountApplyPaymentActionForm.setPrintReceipt(false);
if (method != null) {
forward = method + "_failure";
}
return mapping.findForward(forward);
}
use of org.mifos.accounts.struts.actionforms.AccountApplyPaymentActionForm in project head by mifos.
the class ApplyPaymentActionStrutsTest method xtestApplyPaymentForLoanWhenReceiptDateisNull.
public void xtestApplyPaymentForLoanWhenReceiptDateisNull() throws Exception {
request.setAttribute(Constants.CURRENTFLOWKEY, flowKey);
accountBO = createLoanAccount();
SessionUtils.setAttribute(Constants.ACCOUNT_VERSION, accountBO.getVersionNo(), request);
SessionUtils.setAttribute(Constants.ACCOUNT_TYPE, AccountTypes.getAccountType(accountBO.getAccountType().getAccountTypeId()).name(), request);
SessionUtils.setAttribute(Constants.ACCOUNT_ID, accountBO.getAccountId(), request);
accountBO.setUserContext(TestObjectFactory.getContext());
PersonnelBO loggedInUser = IntegrationTestObjectMother.testUser();
accountBO.changeStatus(AccountState.LOAN_ACTIVE_IN_BAD_STANDING, null, "", loggedInUser);
AccountApplyPaymentActionForm accountApplyPaymentActionForm = new AccountApplyPaymentActionForm();
accountApplyPaymentActionForm.setAmount("212");
request.getSession().setAttribute("applyPaymentActionForm", accountApplyPaymentActionForm);
setRequestPathInfo("/applyPaymentAction");
addRequestParameter("input", "loan");
addRequestParameter("method", "applyPayment");
addRequestParameter("accountId", accountBO.getAccountId().toString());
addRequestParameter("receiptId", "101");
String currentDate = DateUtils.makeDateAsSentFromBrowser();
addRequestDateParameter("receiptDate", "");
addRequestDateParameter("transactionDate", currentDate);
addRequestParameter("paymentTypeId", "1");
addRequestParameter(Constants.CURRENTFLOWKEY, (String) request.getAttribute(Constants.CURRENTFLOWKEY));
actionPerform();
verifyForward("loan_detail_page");
Assert.assertEquals(new Money(getCurrency()), accountBO.getTotalPaymentDue());
Assert.assertEquals(0, accountBO.getTotalInstallmentsDue().size());
Assert.assertEquals(AccountStates.LOANACC_ACTIVEINGOODSTANDING, accountBO.getAccountState().getId().shortValue());
}
use of org.mifos.accounts.struts.actionforms.AccountApplyPaymentActionForm in project head by mifos.
the class ApplyPaymentActionStrutsTest method testApplyPaymentPreviewDateValidation.
@Test
public void testApplyPaymentPreviewDateValidation() throws Exception {
request.setAttribute(Constants.CURRENTFLOWKEY, flowKey);
accountBO = createLoanAccount();
accountBO.setUserContext(TestObjectFactory.getContext());
PersonnelBO loggedInUser = IntegrationTestObjectMother.testUser();
accountBO.changeStatus(AccountState.LOAN_ACTIVE_IN_BAD_STANDING, null, "", loggedInUser);
AccountApplyPaymentActionForm accountApplyPaymentActionForm = new AccountApplyPaymentActionForm();
accountApplyPaymentActionForm.setAmount("212");
request.getSession().setAttribute("applyPaymentActionForm", accountApplyPaymentActionForm);
setRequestPathInfo("/applyPaymentAction");
addRequestParameter("input", "loan");
addRequestParameter("method", "preview");
addRequestParameter("accountId", accountBO.getAccountId().toString());
addRequestParameter("receiptId", "101");
// date fields added individually because we're adding an invalid dat
addRequestParameter("transactionDateDD", "4");
addRequestParameter("transactionDateMM", "20");
addRequestParameter("transactionDateYY", "2007");
addRequestParameter("paymentTypeId", "1");
addRequestParameter(Constants.CURRENTFLOWKEY, (String) request.getAttribute(Constants.CURRENTFLOWKEY));
actionPerform();
verifyActionErrors(new String[] { AccountConstants.ERROR_INVALIDDATE });
verifyInputForward();
}
use of org.mifos.accounts.struts.actionforms.AccountApplyPaymentActionForm in project head by mifos.
the class AccountApplyGroupIndividualAction method load.
@TransactionDemarcate(joinToken = true)
public ActionForward load(ActionMapping mapping, ActionForm form, HttpServletRequest request, @SuppressWarnings("unused") HttpServletResponse response) throws Exception {
UserContext userContext = getUserContext(request);
AccountApplyPaymentActionForm actionForm = (AccountApplyPaymentActionForm) form;
actionForm.setReceiptDate(null);
actionForm.setReceiptId(null);
actionForm.setPaymentTypeId(null);
actionForm.setTransactionDate(DateUtils.makeDateAsSentFromBrowser());
actionForm.setPrintReceipt(false);
actionForm.setTruePrintReceipt(false);
final AccountReferenceDto accountReferenceDto = new AccountReferenceDto(Integer.valueOf(actionForm.getAccountId()));
AccountPaymentDto accountPaymentDto = accountServiceFacade.getAccountPaymentInformation(accountReferenceDto.getAccountId(), request.getParameter(Constants.INPUT), userContext.getLocaleId(), new UserReferenceDto(userContext.getId()), DateUtils.getCurrentJavaDateTime());
setValuesInSession(request, actionForm, accountPaymentDto);
actionForm.setLastPaymentDate(accountPaymentDto.getLastPaymentDate());
actionForm.setAmount(accountPaymentDto.getTotalPaymentDue());
actionForm.setTransferPaymentTypeId(this.legacyAcceptedPaymentTypeDao.getSavingsTransferId());
return mapping.findForward(ActionForwards.load_success.toString());
}
Aggregations