use of org.mifos.accounts.productdefinition.business.LoanOfferingBO in project head by mifos.
the class LoanAccountActionStrutsTest method testUpdateSuccessWithoutRegeneratingNewRepaymentSchedule.
@Test
public void testUpdateSuccessWithoutRegeneratingNewRepaymentSchedule() throws Exception {
request.setAttribute(Constants.CURRENTFLOWKEY, flowKey);
accountBO = getLoanAccount();
LoanBO loan = (LoanBO) accountBO;
LoanOfferingBO loanOffering = loan.getLoanOffering();
Date firstInstallmentDate = loan.getDetailsOfNextInstallment().getActionDate();
SessionUtils.setAttribute(Constants.BUSINESS_KEY, loan, request);
Date newDate = DateUtils.addWeeks(loan.getDisbursementDate(), 1);
Date originalDate = loan.getDisbursementDate();
setRequestPathInfo("/loanAccountAction.do");
addRequestParameter(Constants.CURRENTFLOWKEY, (String) request.getAttribute(Constants.CURRENTFLOWKEY));
addRequestParameter("method", "update");
addRequestParameter("loanAmount", loanOffering.getEligibleLoanAmountSameForAllLoan().getDefaultLoanAmount().toString());
addRequestParameter("interestRate", loan.getLoanOffering().getDefInterestRate().toString());
addRequestParameter("noOfInstallments", loanOffering.getDefaultNumOfEligibleInstallmentsSameForAllLoan().toString());
addRequestParameter("disbursementDate", DateUtils.format(newDate));
addRequestParameter("businessActivityId", "1");
addRequestParameter("intDedDisbursement", "0");
addRequestParameter("gracePeriodDuration", "1");
addRequestParameter("collateralNote", "test");
actionPerform();
verifyForward(ActionForwards.update_success.toString());
loan = TestObjectFactory.getObject(LoanBO.class, loan.getAccountId());
Assert.assertEquals("test", loan.getCollateralNote());
Assert.assertEquals(300.0, loan.getLoanAmount().getAmount().doubleValue(), DELTA);
Assert.assertEquals(1, loan.getGracePeriodDuration().intValue());
Assert.assertEquals(DateUtils.format(originalDate), DateUtils.getUserLocaleDate(TestObjectFactory.getContext().getPreferredLocale(), DateUtils.toDatabaseFormat(loan.getDisbursementDate())));
Assert.assertEquals(firstInstallmentDate, loan.getAccountActionDate(Short.valueOf("1")).getActionDate());
}
use of org.mifos.accounts.productdefinition.business.LoanOfferingBO in project head by mifos.
the class LegacyLoanDaoIntegrationTest method getBadAccount.
private LoanBO getBadAccount() {
Date startDate = new Date(System.currentTimeMillis());
LoanOfferingBO loanOffering = TestObjectFactory.createLoanOffering("Loanabcd", "abcd", ApplicableTo.CLIENTS, startDate, PrdStatus.LOAN_ACTIVE, 300.0, 1.2, (short) 3, InterestType.FLAT, meeting);
return TestObjectFactory.createLoanAccount("42423142323", group, AccountState.LOAN_ACTIVE_IN_BAD_STANDING, startDate, loanOffering);
}
use of org.mifos.accounts.productdefinition.business.LoanOfferingBO in project head by mifos.
the class LegacyLoanDaoIntegrationTest method getLoanAccount.
private AccountBO getLoanAccount(final AccountState state, final Date startDate) {
LoanOfferingBO loanOffering = TestObjectFactory.createLoanOffering("Loanvcfg", "bhgf", ApplicableTo.GROUPS, startDate, PrdStatus.LOAN_ACTIVE, 300.0, 1.2, (short) 3, InterestType.FLAT, meeting);
final int disbursalType = 1;
return TestObjectFactory.createLoanAccountWithDisbursement("99999999999", group, state, startDate, loanOffering, disbursalType);
}
use of org.mifos.accounts.productdefinition.business.LoanOfferingBO in project head by mifos.
the class LegacyLoanDaoIntegrationTest method getGoodAccount.
private LoanBO getGoodAccount() {
Date startDate = new Date(System.currentTimeMillis());
LoanOfferingBO loanOffering = TestObjectFactory.createLoanOffering("Loanabf", "abf", ApplicableTo.CLIENTS, startDate, PrdStatus.LOAN_ACTIVE, 300.0, 1.2, (short) 3, InterestType.FLAT, meeting);
return TestObjectFactory.createLoanAccount("42423142342", group, AccountState.LOAN_ACTIVE_IN_GOOD_STANDING, startDate, loanOffering);
}
use of org.mifos.accounts.productdefinition.business.LoanOfferingBO in project head by mifos.
the class AccountStatusActionStrutsTest method getLoanAccount.
private LoanBO getLoanAccount(CustomerBO customerBO) {
Date startDate = new Date(System.currentTimeMillis());
LoanOfferingBO loanOffering = TestObjectFactory.createLoanOffering(startDate, meeting);
return TestObjectFactory.createLoanAccount("42423142341", customerBO, AccountState.LOAN_PENDING_APPROVAL, startDate, loanOffering);
}
Aggregations