use of org.mifos.accounts.struts.actionforms.AccountApplyPaymentActionForm in project head by mifos.
the class ApplyPaymentActionStrutsTest method xtestApplyPaymentAndRetrievalForLoanWhenStatusIsChanged.
public void xtestApplyPaymentAndRetrievalForLoanWhenStatusIsChanged() 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(Constants.CURRENTFLOWKEY, (String) request.getAttribute(Constants.CURRENTFLOWKEY));
addRequestParameter("accountId", accountBO.getAccountId().toString());
addRequestParameter("receiptId", "101");
String currentDate = DateUtils.makeDateAsSentFromBrowser();
addRequestDateParameter("receiptDate", currentDate);
addRequestDateParameter("transactionDate", currentDate);
addRequestParameter("paymentTypeId", "1");
actionPerform();
verifyForward("loan_detail_page");
center = TestObjectFactory.getCenter(center.getCustomerId());
group = TestObjectFactory.getGroup(group.getCustomerId());
accountBO = TestObjectFactory.getObject(AccountBO.class, accountBO.getAccountId());
Assert.assertEquals(new Money(getCurrency()), accountBO.getTotalPaymentDue());
Assert.assertEquals(0, accountBO.getTotalInstallmentsDue().size());
Assert.assertEquals(AccountStates.LOANACC_ACTIVEINGOODSTANDING, accountBO.getAccountState().getId().shortValue());
setRequestPathInfo("/loanAccountAction");
addRequestParameter("globalAccountNum", accountBO.getGlobalAccountNum());
addRequestParameter(Constants.CURRENTFLOWKEY, (String) request.getAttribute(Constants.CURRENTFLOWKEY));
addRequestParameter("method", "get");
actionPerform();
//LoanBO loan = (LoanBO) SessionUtils.getAttribute(Constants.BUSINESS_KEY, request);
LoanBO loan = (LoanBO) StaticHibernateUtil.getSessionTL().load(LoanBO.class, accountBO.getAccountId());
Assert.assertEquals(AccountStates.LOANACC_ACTIVEINGOODSTANDING, loan.getAccountState().getId().shortValue());
Assert.assertNotNull(loan.getAccountState().getName());
accountBO = (AccountBO) StaticHibernateUtil.getSessionTL().load(AccountBO.class, accountBO.getAccountId());
}
Aggregations